Index: ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/goodsTemplateApplicationView.js =================================================================== diff -u -r12331 -r12332 --- ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/goodsTemplateApplicationView.js (.../goodsTemplateApplicationView.js) (revision 12331) +++ ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/goodsTemplateApplicationView.js (.../goodsTemplateApplicationView.js) (revision 12332) @@ -4,7 +4,7 @@ var tousseSum; var dispableGoodSum; var applicationWindow; - +var curSelectedGoods = null; var windowHeight = top.document.body.clientHeight > 650 ? 650 : top.document.body.clientHeight; var invoicePlanPrintButtonName = '发货计划'; if (sstsConfig.invoicePlanPrintButtonName != undefined){ @@ -192,6 +192,7 @@ fields : [ {name : 'id'}, {name : 'name'}, + {name : 'tousseDefinitionID'}, {name : 'count'}, {name : 'type'} ] @@ -209,9 +210,10 @@ } }, fields : [ - //{name : 'id',mapping : 'id'}, + {name : 'id',mapping : 'id'}, {name : 'spelling',mapping : 'spelling'}, {name : 'name',mapping : 'name'}, + {name : 'tousseDefinitionID'}, {name : 'type',mapping : 'type'}, {name : 'tousseType',mapping : 'tousseType'}, {name : 'isCleanedEntirely',mapping : 'isCleanedEntirely'}, @@ -343,6 +345,7 @@ fields: [ {name : 'nodeId'}, {name : 'id'}, + {name : 'tousseDefinitionID'}, {name : 'name'}, {name : 'count'}, {name : 'countBackup'}, @@ -577,6 +580,20 @@ return foundNode; } +function getExsistNodeByTousseDefinitionID(treeStore, id){ + var foundNode = null; + var rootNode = treeStore.getRootNode(); + rootNode.cascade(function(n) { + if(n.get('id') == id){ + // 是根结点的直接节点,不是消毒物品的材料 + if (n.parentNode == rootNode){ + foundNode = n; + return foundNode; + } + } + }); + return foundNode; +} function updateNode(treegrid, foundNode, count, price){ var targetNode = foundNode; @@ -597,9 +614,9 @@ } //TODO 5 取消科室申请模板 -function addItems(name,count,diposable,isCleanedEntirely,price,externalCode,storageAmount,tousseType,materials,unit,packageSpec,minApplyAmount){ +function addItems(tousseDefinitionID,name,count,diposable,isCleanedEntirely,price,externalCode,storageAmount,tousseType,materials,unit,packageSpec,minApplyAmount){ var foundNode = null; - foundNode = getExsistNode(leftTemplateStore, name); + foundNode = getExsistNodeByTousseDefinitionID(leftTemplateStore, tousseDefinitionID); if (foundNode != null){ updateNode('tousseTreeGrid', foundNode, count, price); @@ -625,6 +642,7 @@ if (tousseType != tousseType_disinfectGoods){ tousseInstance = Ext4.create('ApplyItemModel',{ id : 0, + tousseDefinitionID: tousseDefinitionID, name : name, count : count, diposable : diposable, @@ -655,6 +673,7 @@ tousseInstance = Ext4.create('ApplyItemModel',{ id : 0, + tousseDefinitionID: tousseDefinitionID, name : name, count : pacakgeCount, diposable : diposable, @@ -694,6 +713,7 @@ //添加申请单(器械包) function addTousseApplicationItem(){ + var id = curSelectedGoods.id; var name = top.Ext4.getCmp('package1').getValue();//得到器械包名称 var count = top.Ext4.getCmp('count1').getValue();//得到申请数量 if(Ext4.isEmpty(name)){ @@ -706,7 +726,7 @@ top.Ext4.getCmp('count1').setValue(""); top.Ext4.getCmp('count1').focus(); }else{//都不为空,我就让你加进来 - addItems(name,count,top.Ext4.getCmp('isDiposableGoods').getValue(),top.Ext4.getCmp('isCleanedEntirely').getValue(),top.Ext4.getCmp('price').getValue(),'','','',''); + addItems(id,name,count,top.Ext4.getCmp('isDiposableGoods').getValue(),top.Ext4.getCmp('isCleanedEntirely').getValue(),top.Ext4.getCmp('price').getValue(),'','','',''); } } @@ -744,6 +764,7 @@ } function addRecyclingApplicationItem(){ + var id = curSelectedGoods.id; var name = top.Ext4.getCmp('package1').getValue(); var count = top.Ext4.getCmp('count1').getValue(); var tousseType = top.Ext4.getCmp('tousseType').getValue(); @@ -784,7 +805,7 @@ var packageSpec = top.Ext4.getCmp('packageSpec').getValue(); var isCleanedEntirely = top.Ext4.getCmp('isCleanedEntirely').getValue(); - addItems(name,count,isDiposableGoods,isCleanedEntirely,price,externalCode,storageAmount,tousseType,materials,unit,packageSpec,minApplyAmount); + addItems(id,name,count,isDiposableGoods,isCleanedEntirely,price,externalCode,storageAmount,tousseType,materials,unit,packageSpec,minApplyAmount); top.Ext4.getCmp('diposableGoodsAmount').setValue(''); top.Ext4.getCmp('minApplyAmount').setValue(''); top.Ext4.getCmp('isDiposableGoods').setValue(""); @@ -1711,6 +1732,7 @@ record = records[0]; } top.Ext4.getCmp('package1').setRawValue(record.data.name); + curSelectedGoods = record.data; var tousseType = record.data.tousseType; if(tousseType != tousseType_diposableGoods){ top.Ext4.getCmp('isDiposableGoods').setValue('否'); @@ -1758,6 +1780,7 @@ return; } } + curSelectedGoods = null; packageComp.setValue(''); } @@ -1951,6 +1974,7 @@ } tousseInstanceInfos.push({ id: n.get('id'), + tousseDefinitionID: n.get('tousseDefinitionID'), tousseName: n.get('name'), amount: applyAmount, price: price, @@ -2651,9 +2675,6 @@ InvoicePlanTableManager.findApplicationItemVOListByInvoicePlanId(record.data['id'],function(voItems){ for(var i=0;i 0) { - tousseName = tousseName.substring(0,tousseName.indexOf('_' + record.data.id)); - } if(record.data['type'] == '借物单'){ BorrowName = "

已还数量

"; BorrowAmount = "" + voItems[i].alsoAmount+"";