Index: ssts-web/src/main/webapp/homepage/recyclingAppcationShow.js =================================================================== diff -u -r14428 -r20349 --- ssts-web/src/main/webapp/homepage/recyclingAppcationShow.js (.../recyclingAppcationShow.js) (revision 14428) +++ ssts-web/src/main/webapp/homepage/recyclingAppcationShow.js (.../recyclingAppcationShow.js) (revision 20349) @@ -704,7 +704,7 @@ return false; } if(type == tousseApplicationForm){ - addTousseApplicationItem(); +// addTousseApplicationItem(); }else{ addRecyclingApplicationItem(); } @@ -728,7 +728,7 @@ return ; } if(type == tousseApplicationForm){ - addTousseApplicationItem(); +// addTousseApplicationItem(); }else{ addRecyclingApplicationItem(); } Index: ssts-web/src/main/webapp/disinfectsystem/config/zsyy/config.js =================================================================== diff -u -r20326 -r20349 --- ssts-web/src/main/webapp/disinfectsystem/config/zsyy/config.js (.../config.js) (revision 20326) +++ ssts-web/src/main/webapp/disinfectsystem/config/zsyy/config.js (.../config.js) (revision 20349) @@ -194,6 +194,8 @@ recycleAllTousseIntoBasketInExpressRecycle:true, //待回收界面是否启用器械包分组过滤。与记住回收人的控件位置上重叠,所以同一个项目只能有一个启用 enableTousseGroupFilterInAwaitRecycling:true, + //器械包申请单的物品视图是否分成两个grid(为true分成两个,为false或者没配都是一个) + tousseApplicationFormGridSplit : true, //是否显示一次性物品同步申请单(为true需要显示,为false或者没配都不显示) syncApplicationDisposable:true } \ No newline at end of file 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); } } Index: ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/goodsApplicationForm.js =================================================================== diff -u -r20158 -r20349 --- ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/goodsApplicationForm.js (.../goodsApplicationForm.js) (revision 20158) +++ ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/goodsApplicationForm.js (.../goodsApplicationForm.js) (revision 20349) @@ -13,6 +13,11 @@ */ function comboApplication(id,hiddenCommitButton,hiddenSaveButton,hiddenReturnEditButton,type,tousseGroups, originalCommittedStatus,handleDepartCoding,isInterveneAmount) { + //器械包申请单的物品视图是否分成两个grid + var tousseApplicationFormGridSplit = false; + if (sstsConfig.tousseApplicationFormGridSplit && type == tousseApplicationForm) { + tousseApplicationFormGridSplit = true; + } //登录用户的当前科室编码 var departCoding = $Id('departCoding').value; @@ -479,7 +484,7 @@ var tousseColumnArr2 = [{ dataIndex : 'id',hidden : true },{ - header : "物品",xtype : 'treecolumn',dataIndex : 'name',width : ((formType == comboApplicationForm) ? 310 : 500),sortable: false, renderer:showTousseInfoDiv + header : "物品",xtype : 'treecolumn',dataIndex : 'name',width : ((formType == comboApplicationForm || tousseApplicationFormGridSplit) ? 310 : 500),sortable: false, renderer:showTousseInfoDiv },{ header : "最小单位数量",dataIndex : 'unitCount',hidden: productMode,sortable: false },{ @@ -779,11 +784,11 @@ //右边的top.Ext4.tree.Panel的Tbar var diposableTreeGridTbar = []; - if (formType == comboApplicationForm) { + if (formType == comboApplicationForm || tousseApplicationFormGridSplit) { goodsTreeGrids.push({ xtype : 'tree-grid', id : 'tousseTreeGrid', - width : (type == comboApplicationForm && !sstsConfig.hideDisposablePriceColumn) ? configWinWidth/2 - 100 : configWinWidth/2 - 50, + width : ((type == comboApplicationForm || tousseApplicationFormGridSplit) && !sstsConfig.hideDisposablePriceColumn) ? configWinWidth/2 - 100 : configWinWidth/2 - 50, height : configWinHeight - 200, store : leftTemplateStore, flex : 1, @@ -816,7 +821,7 @@ listeners : { specialkey : function(field, ee) { if (ee.getKey() == Ext.EventObject.ENTER && !checkAdd()) { - addRecyclingApplicationItem(); + addRecyclingApplicationItem(tousseApplicationFormGridSplit); } } } @@ -842,7 +847,7 @@ field.focus(); return false; } - addRecyclingApplicationItem(); + addRecyclingApplicationItem(tousseApplicationFormGridSplit); } } } @@ -852,7 +857,7 @@ iconCls : 'btn_ext_add', handler : function() { if (!checkAdd()){ - addRecyclingApplicationItem(); + addRecyclingApplicationItem(tousseApplicationFormGridSplit); } } },{ @@ -897,7 +902,7 @@ xtype : 'tree-grid', id : 'diposableTreeGrid', columns : tousseColumnArr2, - width : ((formType == comboApplicationForm) ? (!sstsConfig.hideDisposablePriceColumn ? configWinWidth/2 + 60 : configWinWidth/2 + 10) : (configWinWidth - 30)), + width : ((formType == comboApplicationForm || tousseApplicationFormGridSplit) ? (!sstsConfig.hideDisposablePriceColumn ? configWinWidth/2 + 60 : configWinWidth/2 + 10) : (configWinWidth - 30)), flex : 1, height : configWinHeight - 200, store : rightTemplateStore, Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/action/RecyclingApplicationAction.java =================================================================== diff -u -r20175 -r20349 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/action/RecyclingApplicationAction.java (.../RecyclingApplicationAction.java) (revision 20175) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/action/RecyclingApplicationAction.java (.../RecyclingApplicationAction.java) (revision 20349) @@ -658,6 +658,12 @@ public void loadDepartmentAppTemplate() { String applicationFormType = StrutsParamUtils.getPraramValue("applicationType", ""); String handleDepartCoding = StrutsParamUtils.getPraramValue("handleDepartCoding", ""); + //器械包申请单的物品视图是否分成两个grid + boolean tousseApplicationFormGridSplit = false; + if (CssdUtils.getSystemSetConfigByNameBool("tousseApplicationFormGridSplit", false) + && InvoicePlan.TYPE_TOUSSE_APPLICATION_FORM.equals(applicationFormType)) { + tousseApplicationFormGridSplit = true; + } TousseDefinitionHelper tousseDefinitionHelper = TousseDefinitionHelper.getInstance(); //根据申请单类型来设置物品类型,用于后面filterGoodByType()方法来过滤对应的物品 @@ -668,18 +674,22 @@ String applicationId = StrutsParamUtils.getPraramValue("id", null); StringBuffer leftStoreJson = new StringBuffer(); StringBuffer rightStoreJson = new StringBuffer(); - // 申请单申请的物品 + // 申请单申请的物品(注意key的取值:如果是“消毒物品”=类型;名称,其他的物品=类型;id) Map applicationItemMap = new HashMap(); RecyclingApplication application = null; if (StringUtils.isNotBlank(applicationId)) { application = recyclingApplicationManager .getRecyclingApplicationById(applicationId); if (application != null) { for (TousseItem tousseItem : application.getApplicationItems()) { - // applicationItemMap.put(tousseItem.getTousseName(), tousseItem); - //这里放到map要用id而不能用名字,因为一次性物品可能会出现同名的情况 - boolean flag = DisposableGoods.TYPE_NAME.equals(tousseItem.getTousseType()); - applicationItemMap.put(flag ? tousseItem.getDisposableGoodsId().toString() : tousseItem.getTousseDefinitionId().toString(), tousseItem); + String tousseType = tousseItem.getTousseType(); + String key = ""; + if (TousseDefinition.PACKAGE_TYPE_DISINFECTION.equals(tousseType)) { + key = String.format("%s;%s", tousseType, tousseItem.getTousseName()); + } else { + key = String.format("%s;%s", tousseType, (tousseItem.disposable() ? tousseItem.getDisposableGoodsId() : tousseItem.getTousseDefinitionId())); + } + applicationItemMap.put(key, tousseItem); } } } @@ -726,11 +736,6 @@ JSONArray toussesJsonArray = new JSONArray(); JSONArray diposableJsonArray = new JSONArray(); - /** - * 修复科室存在模板时,如果申请物品存在非整包的物品,非整包物品的数量修改后不能正确显示 - * 如果存在申请单id则不会重新加载模板的数据,防止模板的数据覆盖更新后的数据 - * (已取消,在js页面只需判断名字是否相同就可以,因此不用判断是否存在申请单id) - */ if (templates != null){ List tousseItems = departmentAppTemplateManager.getTousseDefinitionTemplateItems(templates); List diposableGoodsItems = departmentAppTemplateManager.getDiposableGoodsTemplateItems(templates); @@ -767,13 +772,18 @@ if (templates != null && templates.size() > 0) { for (DepartmentAppTemplate template : templates) { String templateType = template.getTemplateType(); - if (DepartmentAppTemplate.TEMPLATE_TYPE_TOUSSE1.equals(templateType) - || DepartmentAppTemplate.TEMPLATE_TYPE_TOUSSE2.equals(templateType)) { - JSONArray toussesJsonArray = new JSONArray(); - List tempList = tousseDefinitionHelper.filterGoodByType(template, goodType); - departmentAppTemplateManager.tousseDefinitionTemplateItems2JsonArray(toussesJsonArray, tempList, tousseDefinitionFloatPercent); - - updateItemsApplyInfo(applicationItemMap, toussesJsonArray); + if (DepartmentAppTemplate.TEMPLATE_TYPE_DIPOSABLEGOODS.equals(templateType)) { + continue; + } + + JSONArray toussesJsonArray = new JSONArray(); + List tempList = tousseDefinitionHelper.filterGoodByType(template, goodType); + departmentAppTemplateManager.tousseDefinitionTemplateItems2JsonArray(toussesJsonArray, tempList, tousseDefinitionFloatPercent); + updateItemsApplyInfo(applicationItemMap, toussesJsonArray); + + if (DepartmentAppTemplate.TEMPLATE_TYPE_TOUSSE1.equals(templateType) && tousseApplicationFormGridSplit) { + appendJsonString(leftStoreJson, toussesJsonArray.toString()); + } else { appendJsonString(rightStoreJson, toussesJsonArray.toString()); } } @@ -794,14 +804,23 @@ } else { if (templates != null) { for (DepartmentAppTemplate template : templates) { + String templateType = template.getTemplateType(); + if (DepartmentAppTemplate.TEMPLATE_TYPE_DIPOSABLEGOODS.equals(templateType)) { + continue; + } + JSONArray toussesJsonArray = new JSONArray(); List tempList = tousseDefinitionHelper.filterGoodByType(template, goodType); //按照sortNumber重新排序 departmentAppTemplateManager.sortTousseTemplateItems(tempList); departmentAppTemplateManager.tousseDefinitionTemplateItems2JsonArray(toussesJsonArray, tempList, tousseDefinitionFloatPercent); - updateItemsApplyInfo(applicationItemMap, toussesJsonArray); - appendJsonString(rightStoreJson, toussesJsonArray.toString()); + + if (DepartmentAppTemplate.TEMPLATE_TYPE_TOUSSE1.equals(templateType) && tousseApplicationFormGridSplit) { + appendJsonString(leftStoreJson, toussesJsonArray.toString()); + } else { + appendJsonString(rightStoreJson, toussesJsonArray.toString()); + } } } } @@ -840,13 +859,14 @@ JSONObject json = this.getDisposableGoodMsg(tousseItem,diposableFloatPercent); appendJsonString(rightStoreJson, json.toString()); } else { - if (rightStoreJson.length() > 0) { - rightStoreJson.append(","); - } TousseDefinition td = tousseDefinitionManager.getTousseDefinitionByTousseItem(tousseItem); - JSONObject json = departmentAppTemplateManager.tousseItem2Json(tousseItem, td, tousseDefinitionFloatPercent,true); - rightStoreJson.append(json.toString()); + + if (tousseApplicationFormGridSplit) { + appendJsonString(leftStoreJson, json.toString()); + } else { + appendJsonString(rightStoreJson, json.toString()); + } } } } @@ -934,8 +954,8 @@ } /** - * 遍历所定义的模板的物品的JSONArray,查找其中的物品是否有已申领的物品,如果有,则更新数量和价格信息. - * @param applicationItemMap 申请项的Map<物品id,申请项> + * 遍历所定义的模板的物品的JSONArray,查找其中的物品是否有已申领的物品,如果有,则更新数量和价格信息,并且从applicationItemMap删除. + * @param applicationItemMap 申请项的Map<如果是“消毒物品”=类型;名称,其他的物品=类型;id,申请项> * @param toussesJsonArray 科室申领模版配置的物品集合 */ private void updateItemsApplyInfo( @@ -946,25 +966,31 @@ } for (int i = 0; i < toussesJsonArray.size(); i++) { JSONObject obj = toussesJsonArray.getJSONObject(i); - String tousseType = obj.optString("tousseType"); + //这个json对象的tousseDefinitionID既可以表示一次性物品定义的id也可以表示器械包定义的id - String goodId = obj.optString("tousseDefinitionID"); - TousseItem tousseItem = applicationItemMap.get(goodId); + String goodsId = obj.optString("tousseDefinitionID"); + String tousseType = obj.optString("tousseType"); + String goodsName = obj.optString("name"); + + + //注意key的取值:如果是“消毒物品”=类型;名称,其他的物品=类型;id + String key = ""; + if (TousseDefinition.PACKAGE_TYPE_DISINFECTION.equals(tousseType)) { + key = String.format("%s;%s", tousseType, goodsName); + } else { + key = String.format("%s;%s", tousseType, goodsId); + } + TousseItem tousseItem = applicationItemMap.get(key); + if (tousseItem != null) { String amountStr = tousseItem.getAmount().toString(); - String urgentAmount = StringTools.handleNullOrZero(tousseItem.getUrgentAmount()); //删除科室申领模板里面配置的 - applicationItemMap.remove(goodId); - Long itemId = tousseItem.getId(); + applicationItemMap.remove(key); - obj.put("id", itemId.toString()); - JSONArray materialsArray = new JSONArray(); if(TousseDefinition.PACKAGE_TYPE_DISINFECTION.equals(tousseType)){ - // 这里改成用tousseItem的tousseDefinitionId去找TousseDefinition,如果用名字去找的话,他会去找到祖先的TousseDefinition, - // 当这个物品是非整包清洗的情况,找出来的材料数量就是模板的数量,这样就会覆盖掉申请单上的数量 Long tousseDefinitionId = tousseItem.getTousseDefinitionId(); TousseDefinition td = tousseDefinitionManager.get(tousseDefinitionId); materialsArray = tousseDefinitionManager.getMaterialsOfDisinfectionGoods(td, true); @@ -980,6 +1006,7 @@ } } + obj.put("id", tousseItem.getId().toString()); obj.put("recyclingAmount", tousseItem.getRecyclingAmount()); obj.put("urgentAmount", urgentAmount); obj.put("count", amountStr);