Index: ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/goodsApplicationView.js =================================================================== diff -u -r20153 -r20349 --- ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/goodsApplicationView.js (.../goodsApplicationView.js) (revision 20153) +++ ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/goodsApplicationView.js (.../goodsApplicationView.js) (revision 20349) @@ -800,10 +800,11 @@ * @param minApplyAmount 最小申请数量(只用于一次性物品) * @param maxApplyAmount 最大申请数量(只用于一次性物品) * @param urgentAmount 加急数量 + * @param gridSplit 器械包申请单的物品视图是否分成两个grid * @param para 追加的参数,是一个对象,里面可以有多种属性,方便以后扩展用(目前只有{behavior:操作类型(添加或者提交交或者绑定物品),transferScale:中包装单位装换单位系数,middlePackageUnit:申领单位(原来叫中包装单位)}) */ function addItems(tousseDefinitionID,name,count,diposable,isApplyEntireTousse,price,externalCode, - storageAmount,tousseType,materials,unit,packageSpec,minApplyAmount,maxApplyAmount,urgentAmount,para){ + storageAmount,tousseType,materials,unit,packageSpec,minApplyAmount,maxApplyAmount,urgentAmount,gridSplit,para){ //1、处理从模板里面找到的(因为前面过滤已经添加的物品,所以剩下的只是模板的物品了) var foundNode = null; var needToCheckNode = {tousseDefinitionID : tousseDefinitionID,name : name,tousseType : tousseType}; @@ -814,14 +815,15 @@ updateNode('diposableTreeGrid', foundNode, count, price, urgentAmount, para); } }else{ - if (sstsConfig.applicationFormType == 1) { - foundNode = goodsAppDomObj.getExitsNodeByNode(leftTemplateStore, needToCheckNode, (tousseType == tousseType_disinfectGoods ? goodsAppDomObj.checkNameAndType : null)); - } else { + var tempGrid = 'tousseTreeGrid'; + foundNode = goodsAppDomObj.getExitsNodeByNode(leftTemplateStore, needToCheckNode, (tousseType == tousseType_disinfectGoods ? goodsAppDomObj.checkNameAndType : null)); + if (foundNode == null) { foundNode = goodsAppDomObj.getExitsNodeByNode(rightTemplateStore, needToCheckNode, (tousseType == tousseType_disinfectGoods ? goodsAppDomObj.checkNameAndType : null)); + tempGrid = 'diposableTreeGrid'; } if (foundNode != null){ - updateNode((sstsConfig.applicationFormType == 1 ? 'tousseTreeGrid' : 'diposableTreeGrid'), foundNode, count, price,urgentAmount); + updateNode(tempGrid, foundNode, count, price,urgentAmount); if(tousseType == tousseType_disinfectGoods){ updateDisinfectParentNode(foundNode, para); } @@ -901,13 +903,15 @@ panel.getSelectionModel().select(appendNode, true); }else{ var appendNode = null; - if (sstsConfig.applicationFormType == 1) { + var tempGrid = 'tousseTreeGrid'; + if (sstsConfig.applicationFormType == 1 || gridSplit) { appendNode = leftTemplateStore.getRootNode().appendChild(tousseInstance); } else { appendNode = rightTemplateStore.getRootNode().appendChild(tousseInstance); + tempGrid = 'diposableTreeGrid'; } - updateNode((sstsConfig.applicationFormType == 1 ? 'tousseTreeGrid' : 'diposableTreeGrid'), appendNode, count, price, urgentAmount); + updateNode(tempGrid, appendNode, count, price, urgentAmount); if(tousseType == tousseType_disinfectGoods){ updateDisinfectParentNode(appendNode, para); } @@ -918,27 +922,6 @@ } /** - * 添加申请单(这个方法在运作监控那里用到,估计可以删掉了). - */ -function addTousseApplicationItem(){ - var id = curSelectedGoods.id; - var name = top.Ext4.getCmp('package1').getValue();//得到器械包名称 - var count = top.Ext4.getCmp('count1').getValue();//得到申请数量 - if(Ext4.isEmpty(name)){ - var alertTips = "请输入申请物品!"; - showResult(alertTips); - top.Ext4.getCmp('package1').setValue(""); - top.Ext4.getCmp('package1').focus(); - }else if(Ext4.isEmpty(count)){ - showResult("请输入数量,数量必须大于0!"); - top.Ext4.getCmp('count1').setValue(""); - top.Ext4.getCmp('count1').focus(); - }else{//都不为空,我就让你加进来 - addItems(id,name,count,top.Ext4.getCmp('isDiposableGoods').getValue(),top.Ext4.getCmp('isApplyEntireTousse').getValue(),top.Ext4.getCmp('price').getValue(),'','','','',''); - } -} - -/** * 验证申请的数量是否符合规定(即:申请数量applyAmount必须是minApplyAmount的倍数). * @param minApplyAmount 最小申请数量 * @param applyAmount 申请数量 @@ -1008,9 +991,10 @@ /** * 添加物品(器械包和一次性物品)到物品申请列表中. + * @param gridSplit 器械包申请单的物品视图是否分成两个grid * @returns {Boolean} */ -function addRecyclingApplicationItem(){ +function addRecyclingApplicationItem(gridSplit){ var id = curSelectedGoods.id; var name = top.Ext4.getCmp('package1').getValue(); var count = top.Ext4.getCmp('count1').getValue(); @@ -1029,26 +1013,19 @@ //1、验证此物品是否已经存在申请列表中,模板除外(如果是器械包和一次性物品用id和名字校验,如果是消毒物品则用名称和器械包类型校验) - var findNode = null; var needToCheckNode = {tousseDefinitionID : id,name : name,tousseType : tousseType}; var goodsAppDomObj = GoodsAppHelper.getGoodsAppDomObj(); - if(isDiposableGoods == '是') { - findNode = goodsAppDomObj.getExitsNodeByNode(rightTemplateStore, needToCheckNode); - } else { - if (sstsConfig.applicationFormType == 1) { - findNode = goodsAppDomObj.getExitsNodeByNode(leftTemplateStore, needToCheckNode, (tousseType == tousseType_disinfectGoods ? goodsAppDomObj.checkNameAndType : null)); - } else { - findNode = goodsAppDomObj.getExitsNodeByNode(rightTemplateStore, needToCheckNode, (tousseType == tousseType_disinfectGoods ? goodsAppDomObj.checkNameAndType : null)); - } + var findNode = goodsAppDomObj.getExitsNodeByNode(leftTemplateStore, needToCheckNode, (tousseType == tousseType_disinfectGoods ? goodsAppDomObj.checkNameAndType : null)); + if (Ext4.isEmpty(findNode) || Ext4.isEmpty(findNode.get('count'))) { + findNode = goodsAppDomObj.getExitsNodeByNode(rightTemplateStore, needToCheckNode, (tousseType == tousseType_disinfectGoods ? goodsAppDomObj.checkNameAndType : null)); } if (!Ext4.isEmpty(findNode) && !Ext4.isEmpty(findNode.get('count'))){ showResult("已经存在:" + name + ",请不要重复添加!"); return false; } - //para对象,里面可以有多种属性,方便以后扩展用 var para = {behavior : 'add',transferScale: transferScale,middlePackageUnit: middlePackageUnit}; @@ -1084,20 +1061,20 @@ if (btn != 'yes') { return false; }else{ - addItems(id,name,count,isDiposableGoods,isApplyEntireTousse,price,externalCode,storageAmount,tousseType,materials,unit,packageSpec,minApplyAmount,maxApplyAmount,urgentAmount,para); + addItems(id,name,count,isDiposableGoods,isApplyEntireTousse,price,externalCode,storageAmount,tousseType,materials,unit,packageSpec,minApplyAmount,maxApplyAmount,urgentAmount,gridSplit,para); afterAddItem(true); } }); }else if(!isUndefinedOrNullOrEmpty(maxApplyAmount) && count > maxApplyAmount){ top.Ext4.Msg.alert("提示消息","申请数量大于最大可申请数量"); - addItems(id,name,count,isDiposableGoods,isApplyEntireTousse,price,externalCode,storageAmount,tousseType,materials,unit,packageSpec,minApplyAmount,maxApplyAmount,urgentAmount,para); + addItems(id,name,count,isDiposableGoods,isApplyEntireTousse,price,externalCode,storageAmount,tousseType,materials,unit,packageSpec,minApplyAmount,maxApplyAmount,urgentAmount,gridSplit,para); afterAddItem(true); }else{ - addItems(id,name,count,isDiposableGoods,isApplyEntireTousse,price,externalCode,storageAmount,tousseType,materials,unit,packageSpec,minApplyAmount,maxApplyAmount,urgentAmount,para); + addItems(id,name,count,isDiposableGoods,isApplyEntireTousse,price,externalCode,storageAmount,tousseType,materials,unit,packageSpec,minApplyAmount,maxApplyAmount,urgentAmount,gridSplit,para); afterAddItem(true); } }else{ - addItems(id,name,count,isDiposableGoods,isApplyEntireTousse,price,externalCode,storageAmount,tousseType,materials,unit,packageSpec,minApplyAmount,maxApplyAmount,urgentAmount,para); + addItems(id,name,count,isDiposableGoods,isApplyEntireTousse,price,externalCode,storageAmount,tousseType,materials,unit,packageSpec,minApplyAmount,maxApplyAmount,urgentAmount,gridSplit,para); afterAddItem(false); } }