Index: ssts-web/src/main/webapp/dataUpdater/sqls/4.7.1_4.7.2_sqlserver.sql =================================================================== diff -u --- ssts-web/src/main/webapp/dataUpdater/sqls/4.7.1_4.7.2_sqlserver.sql (revision 0) +++ ssts-web/src/main/webapp/dataUpdater/sqls/4.7.1_4.7.2_sqlserver.sql (revision 17361) @@ -0,0 +1,16 @@ +update toussedefinition set price = + (select sum(p) from + (select sum(isnull(mi.count, 0) * isnull(md.disinfectionPrice, 0)) p + from MaterialInstance mi + join materialdefinition md + on mi.materialDefinition_id = md.id + where mi.tousse_id = toussedefinition.id + union + select sum(isnull(di.amount, 0) * isnull(dg.referencePrice, 0)) p + from DiposableGoodsInstance di + join DisposableGoods dg + on di.diposableGoods_id = dg.id + where di.tousseDefinition_id = toussedefinition.id + ) vw + ) + where toussetype = '消毒物品' and forDisplay='1'; \ No newline at end of file Index: ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/materialdefinition/service/MaterialDefinitionManagerImpl.java =================================================================== diff -u -r17345 -r17361 --- ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/materialdefinition/service/MaterialDefinitionManagerImpl.java (.../MaterialDefinitionManagerImpl.java) (revision 17345) +++ ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/materialdefinition/service/MaterialDefinitionManagerImpl.java (.../MaterialDefinitionManagerImpl.java) (revision 17361) @@ -399,6 +399,7 @@ temp.put("type", "器械"); temp.put("spelling", md.getSpelling()); temp.put("cost", md.getCost()); + temp.put("price", md.getDisinfectionPrice()); temp.put("storage", md.getStorage()); temp.put("externalCode", md.getExternalCode()); temp.put("unit", md.getUnit()); @@ -424,6 +425,7 @@ temp.put("type", "一次性物品"); temp.put("spelling", diposableGood.getSpelling()); temp.put("cost", diposableGood.getReferencePrice()); + temp.put("price", diposableGood.getReferencePrice()); temp.put("storage", diposableGood.getAmount()); temp.put("externalCode", diposableGood.getExternalCode()); temp.put("goodsType", diposableGood.getGoodsType()); Index: ssts-web/src/main/webapp/dataUpdater/sqls/4.7.1_4.7.2_oracle.sql =================================================================== diff -u --- ssts-web/src/main/webapp/dataUpdater/sqls/4.7.1_4.7.2_oracle.sql (revision 0) +++ ssts-web/src/main/webapp/dataUpdater/sqls/4.7.1_4.7.2_oracle.sql (revision 17361) @@ -0,0 +1,17 @@ +update toussedefinition set price = + nvl((select sum(nvl(mi.count, 0) * nvl(md.disinfectionPrice, 0)) p + from MaterialInstance mi + join materialdefinition md + on mi.materialDefinition_id = md.id + where mi.tousse_id = toussedefinition.id + + ),0) + + nvl(( + select sum(nvl(di.amount, 0) * nvl(dg.referencePrice, 0)) p + from DiposableGoodsInstance di + join DisposableGoods dg + on di.diposableGoods_id = dg.id + where di.tousseDefinition_id = toussedefinition.id + + ),0) + where toussetype = '消毒物品' and fordisplay='1'; \ No newline at end of file Index: ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/toussedefinition/action/TousseDefinitionAction.java =================================================================== diff -u -r17330 -r17361 --- ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/toussedefinition/action/TousseDefinitionAction.java (.../TousseDefinitionAction.java) (revision 17330) +++ ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/toussedefinition/action/TousseDefinitionAction.java (.../TousseDefinitionAction.java) (revision 17361) @@ -345,7 +345,7 @@ Authentication auth = SecurityContextHolder.getContext() .getAuthentication(); appLogManager = (LogManager) SpringBeanManger.getBean("appLogManager"); - if(priceHidden!=null && !priceHidden.equals("")){ + if(StringUtils.isNotBlank(priceHidden)){ String operationDescription = getOperationDescription("价格",time,userName,priceHidden); appLogManager.writeLog(auth, operationDescription,Log.LOG_TYPE_MODIFY_TOUSSE_PRICE); } @@ -1018,10 +1018,11 @@ JSONObject obj = new JSONObject(); obj.put("id", mi.getId()); String name = mi.getMaterialName(); - if(mi.getMaterialDefinition() != null){ - name = CssdUtils.getMaterialName(mi.getMaterialDefinition()); + MaterialDefinition md = mi.getMaterialDefinition(); + if(md != null){ + obj.put("name", CssdUtils.getMaterialName(mi.getMaterialDefinition())); + obj.put("price", md.getDisinfectionPrice()); } - obj.put("name", name); obj.put("type", "器械"); obj.put("count", mi.getCount()); obj.put("includeImplant", mi.materialIsImplant()); @@ -1037,6 +1038,7 @@ JSONObject obj = new JSONObject(); obj.put("id", di.getId()); obj.put("name", goodsName); + obj.put("price", disposableGoods.getReferencePrice()); obj.put("type", "一次性物品"); obj.put("count", di.getAmount()); obj.put("basketGroupNum", ""); @@ -1045,11 +1047,9 @@ } } } - HttpServletResponse response = StrutsParamUtils.getResponse(); - response.setCharacterEncoding("UTF-8"); try { - response.getWriter().print(array.toString()); - } catch (IOException e) { + StrutsResponseUtils.output(array); + } catch (Exception e) { e.printStackTrace(); } } Index: ssts-web/src/main/webapp/disinfectsystem/basedatamanager/tousse/tousseForm.js =================================================================== diff -u -r17360 -r17361 --- ssts-web/src/main/webapp/disinfectsystem/basedatamanager/tousse/tousseForm.js (.../tousseForm.js) (revision 17360) +++ ssts-web/src/main/webapp/disinfectsystem/basedatamanager/tousse/tousseForm.js (.../tousseForm.js) (revision 17361) @@ -100,6 +100,7 @@ name : '', type : '', count : 1, + countShow : 1, isImplant:'' }); top.Ext.getCmp('configGrid').stopEditing();// 停止编辑 @@ -388,7 +389,7 @@ method : "POST" }), reader : new top.Ext.data.JsonReader({ - fields : [ "id", "name", "type", "count", "sequence"] + fields : [ "id", "name", "type", "count", "price", "sequence"] }) }); @@ -425,6 +426,7 @@ {name : 'spelling',mapping : 'spelling'}, {name : 'type',mapping : 'type'}, {name : 'name',mapping : 'name'}, + {name : 'price',mapping : 'price'}, {name:'isImplant',mapping:'isImplant'} ]) }), @@ -443,7 +445,11 @@ var editRecord = top.Ext.getCmp('configGrid').getStore().getAt(eventEdit.row); editRecord.data.type = record.data.type; editRecord.data.isImplant = record.data.isImplant; + editRecord.data.price = record.data.price; } + if(top.Ext.getCmp('tousseType').getValue() == '消毒物品'){ + top.Ext.getCmp('price').setValue(recountDisinfectionGoodsPrice()); + } }, specialKey : function(field,event){ if(event.getKey()==13 ){ @@ -455,11 +461,11 @@ } }) }, { - id : 'count', + id : 'countShow', header : "数量", width : 40, - dataIndex : 'count', - editor : new top.Ext.form.TextField( { + dataIndex : 'countShow', + editor : new top.Ext.form.NumberField( { allowBlank : false, listeners:{ specialKey : function(field,event){ @@ -468,10 +474,25 @@ newRow(); } } + }, + click : function(field){ + field.focus(); + }, + change : function(field,newV,oldV){ + field.setValue(newV); + },blur : function (field){ + if(eventEdit != null){ + var editRecord = top.Ext.getCmp('configGrid').getStore().getAt(eventEdit.row); + editRecord.data.count = field.getValue(); + if(top.Ext.getCmp('tousseType').getValue() == '消毒物品'){ + top.Ext.getCmp('price').setValue(recountDisinfectionGoodsPrice()); + } + } } } }) - }, { + },{id : 'count',xtype : 'hidden',dataIndex : 'count',hidden:true }, + { id:'isImplant', header:"是否植入物", width : 70, @@ -501,12 +522,15 @@ {name : 'name'}, {name : 'type'}, {name : 'count'}, + {name : 'countShow'}, + {name : 'price'}, {name:'isImplant'} ]); materialConfig = Ext.data.Record.create([ {name : 'id'}, {name : 'count'}, + {name : 'price'}, {name : 'materileName'}, {name : 'name'}, {name : 'specification'}, @@ -553,6 +577,10 @@ for ( var i = 0; i < rows.length; i++) { configStore.remove(rows[i]); } + //如果是消毒物品,则重新计算材料消毒价格及一次性物品参考价之和 + if(top.Ext.getCmp('tousseType').getValue() == '消毒物品'){ + top.Ext.getCmp('price').setValue(recountDisinfectionGoodsPrice()); + } } } }); @@ -719,11 +747,16 @@ top.Ext.getCmp('isInvoice').disable(); //禁用“是否发货”下拉框,并默认赋值为“是” top.Ext.getCmp('isInvoice').setValue('是'); + + top.Ext.getCmp('price').setValue(recountDisinfectionGoodsPrice()); }else if(tousseType == '外部代理灭菌'){ //外部代理灭菌 top.Ext.getCmp('autoOutStockForPacking').disable(); //禁用“自动扣包内材料”下拉框,并默认赋值为“否” top.Ext.getCmp('autoOutStockForPacking').setValue('否'); top.Ext.getCmp('isInvoice').disable(); //禁用“是否发货”下拉框,并默认赋值为“是” top.Ext.getCmp('isInvoice').setValue('是'); + + top.Ext.getCmp('isRecycling').disable(); //禁用“是否回收”下拉框,并默认赋值为“否” + top.Ext.getCmp('isRecycling').setValue('否'); } } }, @@ -2097,11 +2130,14 @@ name : materialName, type : '器械', count : mi.count, + countShow : mi.count, + price : materialDefinition.disinfectionPrice, isImplant:isImplant }); var m = new materialConfig({ id : mi.id, count:mi.count, + price : materialDefinition.disinfectionPrice, materileName : materialName, name : name, specification : sp, @@ -2123,6 +2159,8 @@ name : goodsName, type : '一次性物品', count : tousseDefinitionMaterial.amount, + countShow : tousseDefinitionMaterial.amount, + price : tousseDefinitionMaterial.diposableGoods.referencePrice, isImplant:'' }); configStore.add(material); @@ -2140,11 +2178,15 @@ top.Ext.getCmp('isRecycling').disable(); //禁用“是否回收”下拉框 }else if(tousseType == '消毒物品'){ //消毒物品 top.Ext.getCmp('isInvoice').disable(); //禁用“是否发货”下拉框 + }else if(tousseType == '外部代理灭菌'){ //外部代理灭菌 top.Ext.getCmp('isApplyEntireTousse').disable(); //禁用“是否整包申请”下拉框 top.Ext.getCmp('autoOutStockForPacking').disable(); //禁用“自动扣包内材料”下拉框 top.Ext.getCmp('isSterile').disable(); //禁用“是否灭菌”下拉框 top.Ext.getCmp('isInvoice').disable(); //禁用“是否发货”下拉框,并默认赋值为“是” + + top.Ext.getCmp('isRecycling').disable(); //禁用“是否回收”下拉框,并默认赋值为“否” + top.Ext.getCmp('isRecycling').setValue('否'); } setMaterialCountAndMaterialType(materialsPanel); } @@ -2237,6 +2279,27 @@ top.Ext.getCmp('materialType').setText('材料种类:' + materialType); } +/** + * 重新计算消毒物品的价格,以下情况时会调用 + * 1.包类型改为消毒物品时 + * 2.材料清单所选材料被选中时 + * 3.材料清单所选材料的数量被修改时 + * 4.材料清单有材料被删除时 + * @returns + */ +function recountDisinfectionGoodsPrice(){ + var disinfectionPrice = 0; + var configStore = top.Ext.getCmp('configGrid').getStore(); + if(configStore.data && configStore.data.items && configStore.data.items.length > 0){ + for(var i = 0;i < configStore.data.items.length;i++){ + if(configStore.data.items[i] && configStore.data.items[i].data && configStore.data.items[i].data.price && configStore.data.items[i].data.count){ + disinfectionPrice = disinfectionPrice + (configStore.data.items[i].data.price * configStore.data.items[i].data.count); + } + } + } + return disinfectionPrice; +} + function validateAndSubmit2(TousseName){ var orginalName = top.Ext.getCmp('orginalName').getValue(); //原器械包名称