Index: ssts-web/src/main/webapp/disinfectsystem/assestManagement/expensiveGoods/expensiveGoodsWarningView.jsp =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/assestManagement/expensiveGoods/expensiveGoodsWarningView.jsp (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/assestManagement/expensiveGoods/expensiveGoodsWarningView.jsp (revision 21930) @@ -0,0 +1,63 @@ +<%@ page contentType="text/html; charset=UTF-8"%> +<%@ include file="/common/taglibs.jsp"%> +<%@page import="com.forgon.disinfectsystem.entity.assestmanagement.DisposableGoods,com.forgon.Constants"%> + + + + +一次性物品信息 + + +<%@ include file="/common/includeExtJsAndCss.jsp"%> + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ +
+ + \ No newline at end of file Index: ssts-web/src/main/java/com/forgon/disinfectsystem/component/grid/GridManagerImpl.java =================================================================== diff -u -r21904 -r21930 --- ssts-web/src/main/java/com/forgon/disinfectsystem/component/grid/GridManagerImpl.java (.../GridManagerImpl.java) (revision 21904) +++ ssts-web/src/main/java/com/forgon/disinfectsystem/component/grid/GridManagerImpl.java (.../GridManagerImpl.java) (revision 21930) @@ -30,6 +30,9 @@ import com.forgon.databaseadapter.service.DateQueryAdapter; import com.forgon.directory.acegi.tools.AcegiHelper; import com.forgon.disinfectsystem.basedatamanager.supplyroomconfig.service.SupplyRoomConfigManager; +import com.forgon.disinfectsystem.basedatamanager.warehouse.service.WareHouseManager; +import com.forgon.disinfectsystem.entity.assestmanagement.ExpensiveGoods; +import com.forgon.disinfectsystem.entity.assestmanagement.ExpensiveGoodsStock; import com.forgon.disinfectsystem.entity.basedatamanager.materialdefinition.MaterialDefinition; import com.forgon.disinfectsystem.entity.basedatamanager.supplyroomconfig.SupplyRoomConfig; import com.forgon.disinfectsystem.entity.basedatamanager.toussedefinition.TousseDefinition; @@ -46,6 +49,7 @@ import com.forgon.tools.hibernate.ObjectDao; import com.forgon.tools.json.JSONUtil; import com.forgon.tools.string.StringTools; +import com.forgon.tools.util.SqlUtils; /** * @author Terry @@ -59,7 +63,14 @@ private DateQueryAdapter dateQueryAdapter; private SupplyRoomConfigManager supplyRoomConfigManager; + + private WareHouseManager wareHouseManager; + + public void setWareHouseManager(WareHouseManager wareHouseManager) { + this.wareHouseManager = wareHouseManager; + } + public void setSupplyRoomConfigManager( SupplyRoomConfigManager supplyRoomConfigManager) { this.supplyRoomConfigManager = supplyRoomConfigManager; @@ -219,7 +230,6 @@ md.setStorage(new Long(totalAmount)); } } - //如果为包实例,且条件有任务组时(只过滤出本任务组的器械包实例) else if(TousseInstance.class.getSimpleName().equals(poClass)){ Map sqlWhereParamMap = getParamFromView(parameterMap); @@ -325,6 +335,33 @@ } + //如果查询高值耗材定义,则库存根据当前科室查找 + else if(ExpensiveGoods.class.getSimpleName().equals(poClass) && CollectionUtils.isNotEmpty(list)){ + for(Object obj : list){ + ExpensiveGoods eg = (ExpensiveGoods)obj; + Set warehouseIdSet = wareHouseManager.getCurrentUserOrgUnitWarehouseIds(); + if(CollectionUtils.isNotEmpty(warehouseIdSet)){ + ResultSet rs = + objectDao.executeSql("select sum(amount) amount from "+ ExpensiveGoodsStock.class.getSimpleName() + +" where 1=1 and expensiveGoods_id=" + eg.getId() + " and amount > 0 " + + " and " + SqlUtils.getNonStringFieldInCollectionsPredicate("warehouseID", warehouseIdSet)); + int totalAmount = 0; + try { + if(rs.next()){ + BigDecimal bd = rs.getBigDecimal("amount"); + if(bd != null){ + totalAmount = bd.intValue(); + } + } + DatabaseUtil.closeResultSetAndStatement(rs); + } catch (SQLException e) { + + } + eg.setAmount(new Long(totalAmount)); + } + } + } + Map map = new HashMap(); map.put("totalResults", totalResults); map.put("list", list); Index: ssts-web/src/main/webapp/disinfectsystem/assestManagement/expensiveGoods/expensiveGoodsWarningView.js =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/assestManagement/expensiveGoods/expensiveGoodsWarningView.js (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/assestManagement/expensiveGoods/expensiveGoodsWarningView.js (revision 21930) @@ -0,0 +1,1400 @@ +var entityName = "高值耗材"; +var grid; +var root; +var formObj; +var formWindow; +var autoFillExternalCodeOfDisposableGoods = false; +var SUPPLIER_TYPE_SUPPLIER = '生产厂家'; +var supplierStore = null; + +var diposableGoodsBatchNumStore = null; +var batchRecord = null; +var selCertification = null; + + +function addExpensiveGoods(id) { + autoFillExternalCodeOfDisposableGoods = getBoolValueFromJs('sstsConfig.autoFillExternalCodeOfDisposableGoods',autoFillExternalCodeOfDisposableGoods); + var dType = document.getElementById("parm_s_type").value; + var diposableGooodsStore = new Ext.data.SimpleStore({ + fields : [ 'typeName' ], + url : WWWROOT + '/disinfectSystem/expensiveGoodsAction!getExpensiveGoodsType.do' + }); + + //能否作为器械包材料 + var isPartOfTousseMaterialStore = new Ext.data.SimpleStore( { + fields : [ 'value'], + data : [[CONSTANT_YES],[CONSTANT_NO]] + }); + var goodsTypeStore = new Ext.data.SimpleStore( { + fields : [ 'value'], + data : [['普通物品'],['高值耗材']] + }); + + //能否被科室申请 + var isApplicationMaterialStore = new Ext.data.SimpleStore( { + fields : [ 'value'], + data : [[CONSTANT_YES],[CONSTANT_NO]] + }); + + //是否供应室物品 + var yesNoStore = new Ext.data.SimpleStore( { + fields : [ 'value'], + data : [[STR_YES],[STR_NO]] + }); + + + var inventoryGoodsStore = new Ext.data.SimpleStore({ + fields : [ 'value' ], + data : [ ['否' ], ['是' ]] + }); + supplierStore = new Ext.data.Store({ + pageSize : 100, + proxy : new Ext.data.HttpProxy({ + url : WWWROOT + '/disinfectSystem/baseData/supplierAction!getExpensiveGoodsSupplierData.do?supplierType='+encodeURI(SUPPLIER_TYPE_SUPPLIER), + method : 'POST' + }), + reader : new Ext.data.JsonReader({ + totalProperty : 'totalCount', + root : 'data' + }, [ + {name : 'id',mapping : 'id'}, + {name : 'name',mapping : 'name'} + ]) + }); + + + diposableGoodsBatchNumStore = new Ext.data.Store({ + reader : new Ext.data.JsonReader({ + fields : [ + {name : 'id'}, + {name : 'name'}, + {name : 'barcode'}, + {name : 'certification'} + ] + }) + }); + + batchRecord = Ext.data.Record.create([ + {name : 'id'}, + {name : 'name'}, + {name : 'certification'} + ]); + + + formObj = new top.Ext.FormPanel( { + id : 'expensiveGoodsForm', + frame : true, + labelAlign:'right', + labelSeparator : ':', + bodyStyle : 'padding:5px 5px 0px 5px', + // autoHeight : true, + height : 400, +// autoScroll : true, + items:[{ + layout : 'column', + items : [{ + columnWidth : 0.5, + layout : 'form', + labelWidth : 70, + items : [{ + xtype : 'hidden', + name : 'id', + id : 'id' + },{ + xtype : 'hidden', + name : 'certificationId', + id : 'certificationId' + },{ + xtype : 'hidden', + name : 'originalFormParams', + id : 'originalFormParams' + },{ + xtype : 'hidden', + name : 'originalGoodsType', + id : 'originalGoodsType' + },{ + xtype : 'hidden', + name : 'orginalName', + id : 'orginalName' + },{ + xtype : 'hidden', + name : 'orginalSpecification', + id : 'orginalSpecification' + },{ + xtype : 'hidden', + name : 'orginalApplicationSpecification', + id : 'orginalApplicationSpecification' + },{ + xtype : 'hidden', + name : 'items', + id : 'items' + },{ + xtype : 'hidden', + name : 'notInventoryDeptCode', + id : 'notInventoryDeptCode' + },{ + columnWidth : 1, + layout : 'form', + labelWidth : 110, + items : [{ + xtype : 'textfield', + fieldLabel : '名称', + maxLength : '41', + id : 'name', + name : 'name', + allowBlank : false, + anchor : '95%', + listeners:{ + change:function(field,nV,oV){ + var value = nV.trim(); + field.setValue(value); + } + } + }] + },{ + layout:'column', + items:[{ +// hidden: !sstsConfig.expensiveGoodsInventorySerialNumber, + columnWidth : 1, + layout : 'form', + border:true, + labelWidth :110, + items : [{ + xtype : 'numberfield', + fieldLabel : '物资编码', + maxLength : '16', +// width : 380, + id : 'inventorySerialNumber', + allowBlank : true, + anchor : '95%' + }] + },{ + hidden: !sstsConfig.expensiveGoodsInventorySerialNumber||!sstsConfig.showHrpDiposableGoodByInventorySerialNumber, + columnWidth : .13, + layout : 'form', + border:true, + width: 10, + items : [{//根据物资编码查找hrp高值耗材信息 + xtype: 'button', + iconCls: 'icon_search', + handler: getHrpDiposableGood + }] + } + ] + },{ + columnWidth : 1, + layout : 'form', + labelWidth : 110, + items : [{ + xtype : 'textfield', + fieldLabel : '规格', + maxLength : '41', + id : 'specification', + name : 'specification', + allowBlank : true, + anchor : '95%' + }] + },{ + columnWidth : 1, + layout : 'form', + labelWidth : 110, + items : [{ + xtype : 'textfield', + fieldLabel : '包装规格', + maxLength : '41', + id : 'packageSpec', + name : 'packageSpec', + allowBlank : true, + anchor : '95%' + }] + },{ + columnWidth : 1, + layout : 'form', + labelWidth : 110, + items : [{ + xtype : 'combo', + fieldLabel : "类型", + valueField : 'typeName', + displayField : 'typeName', + store : diposableGooodsStore, + forceSelection : true, + editable : false, + triggerAction : 'all', + name : "type", + id : "type", + value : dType, + anchor : '95%', + listeners : { + select : function(combo , record , index){ + + } + } + }] + },{ + columnWidth : 1, + layout : 'form', + labelWidth : 110, + items : [{ + xtype : 'combo', + fieldLabel : "类别", + valueField : 'name', + displayField : 'name', + store : new Ext.data.SimpleStore({ + data:[['一类'],['二类'],['三类']], + fields:['name'] + }), + mode : 'local', + forceSelection : true, + editable : false, + triggerAction : 'all', + name : "grade", + id : "grade", + anchor : '95%' + }] + },{ + columnWidth : 1, + layout : 'form', + labelWidth : 110, + items : [{ + xtype : 'combo', + fieldLabel : "能否配包", + valueField : 'value', + displayField : 'value', + value: '能', + store : isPartOfTousseMaterialStore, + forceSelection : true, + allowBlank : false, + mode : 'local', + triggerAction : 'all', + name : "isPartOfTousseMaterial", + id : "isPartOfTousseMaterial", + anchor : '95%' + }] + }, { + columnWidth : 1, + layout : 'form', + labelWidth : 110, + items : [{ + xtype : 'combo', + fieldLabel : '能否申请', + valueField : 'value', + displayField : 'value', + value: '能', + store : isApplicationMaterialStore, + forceSelection : true, + allowBlank : false, + mode : 'local', + triggerAction : 'all', + name : "isApplicationMaterial", + id : "isApplicationMaterial", + anchor : '95%' + }] + },{ + columnWidth : 1, + layout : 'form', + labelWidth : 110, + items : [{ + xtype : 'combo', + fieldLabel : '消毒供应中心物品', + valueField : 'value', + displayField : 'value', + value: '是', + store : yesNoStore, + forceSelection : true, + allowBlank : false, + mode : 'local', + triggerAction : 'all', + name : "isSupplyRoomGoods", + id : "isSupplyRoomGoods", + anchor : '95%' + }] + },{ + columnWidth : 1, + layout : 'form', + labelWidth : 110, + items : [{ + xtype : 'combo', + fieldLabel : '包外标签是否打印', + valueField : 'value', + displayField : 'value', + value: '是', + store : yesNoStore, + forceSelection : true, + allowBlank : false, + mode : 'local', + triggerAction : 'all', + name : "printInLabel", + id : "printInLabel", + anchor : '95%' + }] + },{ + columnWidth : 1, + layout : 'form', + labelWidth : 110, + items : [{ + xtype : 'numberfield', + fieldLabel : '最小库存', + allowDecimals : false, + maxLength : '16', + id : 'minStorage', + name : 'minStorage', + anchor : '95%' + }] + }, { + columnWidth : 1, + layout : 'form', + labelWidth : 110, + items : [{ + xtype : 'numberfield', + fieldLabel : '最大库存', + allowDecimals : false, + maxLength : '16', + id : 'maxStorage', + name : 'maxStorage', + anchor : '95%' + }] + },{ + columnWidth : 1, + layout : 'form', + labelWidth : 110, + items : [{ + xtype : 'numberfield', + fieldLabel : '总数', + maxLength : '16', + id : 'amount', + name : 'amount', + allowBlank : true, + anchor : '95%' + }] + },{ + columnWidth: 1, + layout : 'form', + labelWidth : 110, + items : [{ + xtype : 'combo', + id : 'expensiveGoodsSupplier', + name : 'expensiveGoodsSupplier', + fieldLabel : '厂家', + queryParam : 'supplierName', + minChars : 0, + valueField : 'id', + displayField : 'name', + pageSize : 100, +// listConfig: {width: 25}, + store : supplierStore, + forceSelection : true, + lazyInit : true, + triggerAction : 'all', + hideTrigger : true, + emptyText : '', + typeAhead : false, + allowBlank : true, + anchor : '95%', + listeners : { + select : function(combo, record, index) { + diposableGoodsBatchNumStore.removeAll(); + top.Ext.getCmp("registrationCertification").setValue(''); + var diposableGoodsID = record.data.id+''; + ExpensiveGoodsTableManager.getCertificationsByExpensiveGoodsSupplierId(diposableGoodsID, + function(batchesStr){ + var batches = top.Ext4.JSON.decode(batchesStr); + if(batches.length > 0){ + setBatchNumbers(batches,true); + } + }); + }, + specialkey : function(field, ee) { + if (ee.getKey() == Ext.EventObject.ENTER) { + top.Ext.getCmp('batchNumber').focus(); + } + } + } + }] + }] + },{ + columnWidth : 0.5, +// title: 'Hrp高值耗材数据', + id :'hrpContrastDefinition', +// hidden:true, + height : 350, + width : 500, + layout : 'column', +// xtype: 'fieldset', + items: [{ + columnWidth : 1, + layout : 'form', + labelWidth : 110, + items : [{ + xtype : 'textfield', + fieldLabel : '拼音码', + id : 'spelling', + name : 'spelling', + readOnly : true, + allowBlank : true, + anchor : '95%' + }] + },{ + columnWidth : 1, + layout : 'form', + labelWidth : 110, + items : [{ + xtype : 'textfield', + fieldLabel : '五笔码', + id : 'wbCode', + name : 'wbCode', + readOnly : true, + allowBlank : true, + anchor : '95%' + }] + }, { + columnWidth : 1, + layout : 'form', + labelWidth : 110, + items : [{ + xtype : 'textfield', + fieldLabel : '收费码', + maxLength : '16', + id : 'chargeCode', + name : 'chargeCode', + allowBlank : true, + anchor : '95%' + }] + }, { + columnWidth : 1, + layout : 'form', + labelWidth : 110, + items : [{ + xtype : 'textfield', + fieldLabel : '平台代码', + maxLength : '16', + id : 'platformCode', + name : 'platformCode', + allowBlank : true, + anchor : '95%' + }] + }, { + columnWidth : 1, + layout : 'form', + labelWidth : 110, + items : [{ + xtype : 'textfield', + fieldLabel : '外部编码', + maxLength : '16', + id : 'externalCode', + name : 'externalCode', + allowBlank : true, + anchor : '95%' + }] + },{ + columnWidth : 1, + layout : 'form', + labelWidth : 110, + items : [{ + xtype : 'numberfield', + fieldLabel : '参考价', + maxLength : '16', + id : 'referencePrice', + name : 'referencePrice', + allowBlank : false, + allowNegative : false, + anchor : '95%' + }] + },{ + columnWidth : 1, + layout : 'form', + labelWidth : 110, + items : [{ + xtype : 'numberfield', + fieldLabel : '最小申请数量', + maxLength : '16', + id : 'minApplyAmount', + name : 'minApplyAmount', + allowBlank : true, + anchor : '95%' + }] + }, { + columnWidth : 1, + layout : 'form', + labelWidth : 110, + items : [{ + xtype : 'numberfield', + fieldLabel : '最大申请数量', + maxLength : '16', + id : 'maxApplyAmount', + name : 'maxApplyAmount', + allowBlank : true, + anchor : '95%' + }] + },{ + columnWidth : 1, + layout : 'form', + labelWidth : 110, + items : [{ + xtype : 'textfield', + fieldLabel : '单位', + maxLength : '16', + id : 'unit', + name : 'unit', + allowBlank : true, + anchor : '95%' + }] + },{ + columnWidth : 1, + layout : 'form', + labelWidth : 110, + items : [{ + xtype : 'numberfield', + fieldLabel : '顺序号', + maxLength : '16', + id : 'sequence', + name : 'sequence', + allowDecimals : false, + allowBlank : true, + anchor : '95%' + }] + },{ + columnWidth : 1, + layout : 'form', + labelWidth : 110, + items : [{ + xtype : 'combo', + fieldLabel : '是否盘点', + id : 'isInventoryGoods', + name : 'isInventoryGoods', + width : 130, + valueField : 'value', + displayField : 'value', + store : inventoryGoodsStore, + forceSelection : true, + allowBlank: true, + mode : 'local', + editable : false, + triggerAction : 'all', + anchor : '95%' + }] + },{ + columnWidth : 1, + layout : 'form', + labelWidth : 110, + items : [{ + xtype : 'combo', + fieldLabel : '是否植入物', + valueField : 'value', + displayField : 'value', + value: '否', + store : yesNoStore, + forceSelection : true, + allowBlank : false, + mode : 'local', + triggerAction : 'all', + name : "isImplant", + id : "isImplant", + anchor : '95%' + }] + },{ + columnWidth : 1, + layout : 'column', + labelWidth : 0, + items : [{ + layout : 'form', + labelWidth : 110, + columnWidth : 1, + items : [{ +// xtype : 'textfield', +// fieldLabel : '注册证', +// readOnly: true, +// maxLength : '16', +// id : 'registrationCertification', +// name : 'registrationCertification', +// allowBlank : true, +// anchor : '95%' + xtype : 'combo', + id : 'registrationCertification', + name : 'registrationCertification', + fieldLabel : '注册证', + valueField : 'certification', + displayField : 'certification', + store : diposableGoodsBatchNumStore, + editable : false, + forceSelection : false, + mode : 'local', + triggerAction : 'all', + typeAhead : false, + allowBlank : true, +// width : 150, + anchor : '95%', + listeners : { + blur : function(thiz) {}, + select : function(combo, record, index) { + selCertification = { + id: record.data.id, + certification: record.data.certification + } + } + } + }] + } +// ,{ +// layout : 'form', +// labelWidth : 0, +// columnWidth : 0.2, +// items : [new top.Ext.Button({ +// text:'选择', +// handler : function() { +// selectRegistrationCertification(); +// } +// })] +// } + ] + }] + }] + + }], + buttons : [{ + id : 'saveBtn', + text : '保存', + handler : save + },{ + id : 'cancleBtn', + text : '取消', + handler : function() { + formWindow.close(); + } + }] + }); + + if($Id("parm_s_type").value != ""){ + top.Ext.getCmp("type").setValue($Id("parm_s_type").value); + } + + formWindow = new top.Ext.Window( { + id : 'expensiveGoodsWin', + layout : 'fit', + title : '高值耗材信息', + width : 700, + // height : 620, + height : top.screen.height > 800 ? 415 : 415, + modal : true, + // autoHeight : true, + border : false, + plain : true, + items : [ formObj ] + }); + formWindow.show(); + diposableGooodsStore.load(); + // 如果类型不为空,并且配置为自动增加外部编码,那么获取下一个编码,并且填上 + if(!isUndefinedOrNullOrEmpty(dType) && + autoFillExternalCodeOfDisposableGoods){ + ExpensiveGoodsTableManager.getNextExternalCodeOfDisposableGoods(dType,function(externalCode){ + if(!isUndefinedOrNullOrEmpty(externalCode)){ + top.Ext.getCmp("externalCode").setValue(externalCode); + } + }); + } +} + +function onSelCertification(){ + if(selCertification == null){ + return; + } + top.Ext.getCmp('certificationId').setValue(selCertification.id); + top.Ext.getCmp('registrationCertification').setValue(selCertification.certification); +} +function setBatchNumbers(batches,fireSelect) { + for(var i = 0;i 0){ +// setBatchNumbers(batches,true); +// } +// }); +// }, +// specialkey : function(field, ee) { +// if (ee.getKey() == Ext.EventObject.ENTER) { +// top.Ext.getCmp('batchNumber').focus(); +// } +// } +// } +// },{ +// xtype : 'combo', +// id : 'certification2', +// name : 'certification2', +// fieldLabel : '注册证', +// valueField : 'certification', +// displayField : 'certification', +// store : diposableGoodsBatchNumStore, +// editable : false, +// forceSelection : false, +// mode : 'local', +// triggerAction : 'all', +// typeAhead : false, +// allowBlank : true, +// width : 150, +// anchor : '95%', +// listeners : { +// blur : function(thiz) {}, +// select : function(combo, record, index) { +// selCertification = { +// id: record.data.id, +// certification: record.data.certification +// } +// } +// } +// }], +// buttons : [{ +// text : '确定', +// id : 'saveBtn', +// hidden:false, +// handler : function(){ +// var certification = top.Ext.getCmp("certification2").getValue(); +// if(isUndefinedOrNullOrEmpty(certification)){ +// showResult('请选择注册证!'); +// return false; +// } +// top.Ext.getCmp('returnGoodsRecordWin').close(); +// onSelCertification(); +// } +// },{ +// text : '取消', +// handler : function() { +// top.Ext.getCmp('returnGoodsRecordWin').close(); +// } +// }] +// }); +// var win = new top.Ext.Window({ +// id : 'returnGoodsRecordWin', +// layout : 'fit', +// title : '信息', +// width : 500, +// modal : true, +//// autoHeight : true, +// border : false, +// height:150, +// plain : true, +// items : [ form ] +// +// }); +// win.show(); +//} + +function printAmount() { + top.Ext.MessageBox.prompt("输入框", "打印数量:", function(bu, txt) { + return txt; + }); +} + +function printBarcode(barcodeStr){ + if(barcodeStr!=null && barcodeStr.length > 0){ + top.Ext.Msg.show({ + title: '输入框', + msg: '打印数量:', + width: 100, + buttons: Ext.MessageBox.OKCANCEL, + prompt : true, + fn: function(bu, txt) { + if(bu == 'ok'){ + if(isNaN(txt) == false){ + var godownEntryItem = barcodeStr.split(";"); + var specification = top.Ext.getCmp('specification').getValue(); + for(var j = 0 ; j< Number(txt) ; j++){ + for ( var i = 0; i < godownEntryItem.length; i++) { + var resultItem = godownEntryItem[i].split("#&"); + var name =resultItem[0]; + var barcode = resultItem[1]; + var expDate = resultItem[2]; + var supplierName = resultItem[3]; + var batchNumber = resultItem[4]; + printExpensiveGoodsInfo(barcode,name,expDate,supplierName,batchNumber,0,specification); + } + } + }else{ + showResult("打印数量必须是数字,请重新输入!"); + } + } + }, + animEl: 'addAddressBtn', + value:'1' + }); + } +} + +function submitForSaveDisposableGoods(){ + formObj.form.submit( { + url : WWWROOT + '/disinfectSystem/expensiveGoodsAction!saveExpensiveGoods.do', + method : 'POST', + waitMsg : '正在保存数据,请稍候', + waitTitle : '提交表单', + success : function(form, action) { + var result = Ext.decode(action.response.responseText); + if(isUndefinedOrNullOrEmpty(result.errorMessage)){ + showResult('保存成功'); + formWindow.close(); + grid.dwrReload(); + }else{ + showResult('保存出错, ' + result.errorMessage); + top.Ext.getCmp('saveBtn').enable(); + } + }, + failure : function(form, action) { + showResult('保存出错'); + top.Ext.getCmp('saveBtn').enable(); + } + }); +} +function validateAndSubmit(){ +// var originalGoodsType = top.Ext.getCmp("originalGoodsType").getValue(); +// var goodsType = top.Ext.getCmp("goodsType").getValue(); + var orginalName = top.Ext.getCmp("orginalName").getValue(); + var orginalSpecification = top.Ext.getCmp("orginalSpecification").getValue(); + var name = top.Ext.getCmp("name").getValue(); + var specification = top.Ext.getCmp("specification").getValue(); + var msg = ''; + var id = top.Ext.getCmp('id').getValue(); + + if(id != null && id != ''){ + if(!stringLooksEquals(orginalName,name) && (!stringLooksEquals(orginalSpecification,specification))){ + msg = "是否确定修改名称和规格?" + }else if(!stringLooksEquals(orginalName,name)){ + msg = "是否确定修改高值耗材名称?" + }else if(!stringLooksEquals(orginalSpecification,specification)){ + msg = "是否确定修改高值耗材规格?" + } + } + +// if(!stringLooksEquals(originalGoodsType,goodsType)){ +// msg += "是否确定更改物品类型?" +// } + if(msg == ''){ + submitForSaveDisposableGoods(); + return; + } + top.Ext.MessageBox.confirm("请确认",msg, + function(button, text) { + if ("yes" == button){ + submitForSaveDisposableGoods(); + }else{ + top.Ext.getCmp('saveBtn').enable(); + } + }); +} + +function save(){ + onSelCertification(); + //if(!form.getForm().isValid()){ + if(!formObj.getForm().isValid()){ + showResult('请正确填写表单各值'); + return false; + } + var max = top.Ext.getCmp('maxStorage').getValue(); + var min = top.Ext.getCmp('minStorage').getValue(); + var minApply = top.Ext.getCmp('minApplyAmount').getValue(); + var maxApply = top.Ext.getCmp('maxApplyAmount').getValue(); + if(typeof max == 'number' && typeof min == 'number'){ + if(min>max){ + showResult('最小库存不能大于最大库存'); + top.Ext.getCmp('minStorage').focus(); + return false; + } + if(minApply > maxApply){ + showResult('最小申请数不能大于最大申请数'); + top.Ext.getCmp('minApplyAmount').focus(); + return false; + } + } + + this.disable(); + validateAndSubmit(); +} + +function printBatchNum(barcodeStr){ + if(barcodeStr!=null && barcodeStr.length > 0){ + Ext.Msg.show({ + title: '输入框', + msg: '打印数量:', + width: 100, + buttons: Ext.MessageBox.OKCANCEL, + prompt : true, + fn: function(bu, txt) { + if(bu == 'ok'){ + if(isNaN(txt) == false){ + var godownEntryItem = barcodeStr.split(";"); + for(var j = 0 ; j< Number(txt) ; j++){ + for ( var i = 0; i < godownEntryItem.length; i++) { + var resultItem = godownEntryItem[i].split("#&"); + var name =resultItem[0]; + var barcode = resultItem[1]; + var expDate = resultItem[2]; + var supplierName = resultItem[3]; + var batchNumber = resultItem[4]; + var specification = resultItem[5]; + printExpensiveGoodsInfo(barcode,name,expDate,supplierName,batchNumber,0,specification); + } + } + }else{ + showResult("打印数量必须是数字,请重新输入!"); + } + } + }, + animEl: 'addAddressBtn', + value:'1' + }); + } +} +function onStorageRecordDetail(grid){ + var records = grid.getSelectionModel().getSelections(); + if(records.length == 0){ + showResult("请选择高值耗材"); + return; + } + if(records.length != 1){ + showResult("只能选择一个高值耗材"); + return; + } + + var storageRecord = new StorageRecord(); + storageRecord.setDisposableGoodsId(records[0].data['id']); + storageRecord.showDetail(); +} + +function printExpensiveDisposableGoodsBarcode(grid){ + var records = grid.getSelectionModel().getSelections(); + if(records.length == 0){ + showResult("请选择要打印的物品"); + }else{ + var ids = ""; + for(var i = 0,len=records.length;i 1) { + showResult("一次只能修改一个高值耗材!"); + return false; + } + id = records[0].data['id']; + addExpensiveGoods(id); + top.Ext.getCmp('expensiveGoodsForm').form.load({ + url : WWWROOT + '/disinfectSystem/expensiveGoodsAction!loadExpensiveGoods.do', + method : 'GET', + waitMsg : '正在加载数据,请稍候', + params : {id : id}, + success : function(form, action) { + var expensiveGoods = action.result.data; +// top.Ext.getCmp("orginalName").setValue(expensiveGoods.name); +// top.Ext.getCmp("orginalSpecification").setValue(expensiveGoods.specification); +// top.Ext.getCmp("registrationCertification").setValue(expensiveGoods.registrationCertification); +// top.Ext.getCmp("manufactor").setValue(expensiveGoods.expensiveGoodsSupplier); + }, + failure : function(form, action) { + } + }); +}; + +function reloadGrid(type){ + $Id("parm_s_type").value = type; + grid.dwrReload(); +} + +function modify(){ + loadFormData(grid); +} + +function rendeColor(v, p, record){ + var data = record.data; + var amount = data.amount; + if(typeof amount=='number'){ + if((typeof data.minStorage=='number' && data.minStorage>amount) || (typeof data.maxStorage=='number' && data.maxStorage" + v + "

"; + } + } + return "" + v + ""; +} + +//hrp高值耗材信息 +function getHrpDiposableGood(){ + var inventorySerialNumber = top.Ext.getCmp('inventorySerialNumber').getValue(); + if(!inventorySerialNumber){ + showResult("请填写物资编码"); + return false; + } + Ext.Ajax.request({ + url : WWWROOT + '/disinfectSystem/expensiveGoodsAction!getHrpDefinition.do', + params : {inventorySerialNumber : inventorySerialNumber}, + success : function(response, options){ + var obj = Ext.util.JSON.decode(response.responseText); + if(obj.success){ + var data = obj.data; + if (data) { + top.Ext.getCmp("hrpName").setValue(data.name); + top.Ext.getCmp("hrpSpecification").setValue(data.specification); + top.Ext.getCmp("hrpUnit").setValue(data.unit); + top.Ext.getCmp("hrpCost").setValue(data.cost); + top.Ext.getCmp("hrpContrastDefinition").show(); + } else { + showResult("没有该物资编码对应的hrp高值耗材信息"); + } + }else{ + showResult("后台异常,请联系系统管理!"); + } + } + }) +} + +Ext.onReady(function() { + Ext.QuickTips.init(); + + //********* 1、Tree *********** + root = new Ext.tree.AsyncTreeNode({ + text:'高值耗材类型', + id:'0', + draggable:false, + listeners:{ + click:function(node,event){ + reloadGrid(""); + } + } + }); + + var myLoader = new Ext.tree.TreeLoader({dataUrl:WWWROOT + '/disinfectSystem/expensiveGoodsAction!treeLoad.do'}); + + //********* 2、ForgonGrid *********** + var columns = [ + {header : "编码",width : 60,dataIndex : 'externalCode'}, + {header : "名称",width : 150,dataIndex : 'name', renderer : rendeColor}, + {header : "规格",width : 100,dataIndex : 'specification'}, + {header : "类别",width : 80,dataIndex : 'grade'}, + {header : "包装规格",width : 80,dataIndex : 'packageSpec'}, + {header : "参考价",width : 60,dataIndex : 'referencePrice'}, + {header : "总数",width : 50,dataIndex : 'amount'}, + {header : "最小申请数量",width : 80,dataIndex : 'minApplyAmount'}, + {header : "最大申请数量",width : 80,dataIndex : 'maxApplyAmount'}, + {header : "单位",width : 50,dataIndex : 'unit'}, + {header : "顺序号",width : 50,dataIndex : 'sequence'}, + {header : "拼音码",width : 90,dataIndex : 'spelling'}, + {header : "五笔码",width : 90,dataIndex : 'wbCode'}, + {header : "能否作为器械包材料",width : 120,dataIndex : 'isPartOfTousseMaterial'}, + {header : "能否被科室申请",width : 100,dataIndex : 'isApplicationMaterial'}, + {header : "是否消毒供应中心领用物品",width : 100,dataIndex : 'isSupplyRoomGoods'}, + {header : "最小库存",width : 60,dataIndex : 'minStorage'}, + {id : 'operationRemark',header : "最大库存",width : 60,dataIndex : 'maxStorage'} + + ]; + + var readerDetail = [ + {name : 'id'}, + {name : 'name'}, + {name : 'externalCode'}, + {name : 'specification'}, + {name : 'grade'}, + {name : 'packageSpec'}, + {name : 'amount'}, + {name : 'minApplyAmount'}, + {name : 'maxApplyAmount'}, + {name : 'unit'}, + {name : 'sequence'}, + {name : 'minStorage'}, + {name : 'maxStorage'}, + {name : 'spelling'}, + {name : 'wbCode'}, + {name : 'isPartOfTousseMaterial'}, + {name : 'referencePrice'}, + {name : 'isApplicationMaterial'}, + {name : 'isSupplyRoomGoods'} + ]; + + var filters = new Ext.grid.GridFilters({ + filters:[ + {type: 'string', dataIndex: 'name'}, + {type: 'string', dataIndex: 'externalCode'}, + {type: 'numeric', dataIndex: 'amount'}, + {type: 'numeric', dataIndex: 'minApplyAmount'}, + {type: 'numeric', dataIndex: 'maxApplyAmount'}, + {type: 'string', dataIndex: 'unit'}, + {type: 'numeric', dataIndex: 'sequence'}, + {type: 'numeric', dataIndex: 'minStorage'}, + {type: 'numeric', dataIndex: 'maxStorage'}, + {type: 'string', dataIndex: 'spelling'}, + {type: 'string', dataIndex: 'wbCode'}, + {type: 'string', dataIndex: 'isPartOfTousseMaterial'}, + {type: 'string', dataIndex: 'isApplicationMaterial'}, + {type: 'string', dataIndex: 'isSupplyRoomGoods'}, + {type: 'numeric', dataIndex: 'referencePrice'} + ]} + ); + + var tbar = [ { + text : '添加', +// hidden : SSTS_ExpensiveGoods_Create, + iconCls : 'btn_ext_application_add', + handler : function() { + addExpensiveGoods(0); + } + }, '-', { + text : '修改', +// hidden : SSTS_ExpensiveGoods_Update, + iconCls : 'btn_ext_application_edit', + id : 'editTbar', + handler : function() { + loadFormData(grid); + } + }, '-', { + text : '删除', +// hidden : SSTS_ExpensiveGoods_Delete, + iconCls : 'btn_ext_application_del', + handler : function() { + deleteExpensiveGoods(grid); + } + },'-',{ + text : '出入库记录', + hidden: true, + iconCls : 'btn_ext_refresh', + handler : function(){ + onStorageRecordDetail(grid); + } + }, '-' , { + text : '打印高值耗材', + hidden: true, + iconCls : 'icon_print', + handler : function(){ + printExpensiveDisposableGoodsBarcode(grid); + } + }/* + , '-' , { + //用于程序员调试 + text : '更新旧数据', + hidden : false, + handler : function() { + ExpensiveGoodsTableManager.updateOldData(function(msg){showResult(msg);}); + } + }, '-' , { + //将属于供应室领用的高值耗材进行分类 + text : '分类供应室领用类型', + hadden : false, + handler : function() { + ExpensiveGoodsTableManager.updateSupplyRoomExpensiveGoodsType(function(msg){showResult('更新成功,请刷新页面')}); + } + } + , '-' , { + text : '导出高值耗材库存', + handler : function() { + window.location.href = WWWROOT+"/disinfectsystem/reportforms/expensiveGoodsStorageReportExportForm.jsp"; + } + }, '-' , { + text : '导出物资收发存汇总', + handler : function() { + window.location.href = WWWROOT+"/disinfectsystem/reportforms/expensiveGoodsPriceStatisticsReportExportForm.jsp"; + } + }, '-' , { + //用于程序员调试 + text : '更新旧数据', + hidden : false, + handler : function() { + ExpensiveGoodsTableManager.updateOldData(function(msg){showResult(msg);}); + } + }, '-', { + text : '导入高值耗材库存EXCEL', + hidden : false, + handler : function() { + location.href = WWWROOT + + "/disinfectsystem/basedatamanager/importbasedata/amendExpensiveGoodsStorage.mhtml"; + } + } + */ + ]; + + grid = new Ext.ux.ForgonPageGrid( { + tbar : tbar, + pageSize : 20, + defaultSortField : 'externalCode', + title : '高值耗材预警列表', + defaultSortDirection : 'ASC', + isCheckboxSelectionModel : true, + rememberSelected : false, + isShowSearchField : true, + plugins: filters, + columns : columns, + autoExpandColumn : 'operationRemark', + renderTo : 'gridDiv', + frame : false + }, readerDetail, + ExpensiveGoodsTableManager.findExpensiveGoodsMinAndMaxStockTableList, + null + ); + + var viewport = new Ext.Viewport({ + layout:'border', + items:[{ + region:'west', + id:'west-panel', + lines : false, + margins : '0 0 5 5', + cmargins : '0 0 0 0', + layout : 'accordion', + layoutConfig : {animate : true}, + collapsible: true, //允许折叠 + animCollapse:true, //折叠时是否有动画效果 + split: true, //是否允许拖动大小,与下面的折叠形式配合 + collapseMode:'mini', //折叠形式 + width: 200, + minSize : 130, + maxSize : 400, + xtype: 'treepanel', + loader: myLoader, //数据加载 + autoScroll: true, + root: root, + tbar:[ + new Ext.Action({ + text: '展开所有', + handler: function(){ + var treePanel = viewport.findById('west-panel'); + treePanel.expandAll(); + } + }), + new Ext.Action({ + text: '折叠所有', + handler: function(){ + var treePanel = viewport.findById('west-panel'); + treePanel.collapseAll(); + } + }) + ] + },{ + region:'center', + margins:'0 5 5 0', + xtype : 'panel', + autoScroll:true, + layout: 'fit', + items:grid + }] + }); + + root.expand(false, /*no anim*/ false); +}); \ No newline at end of file Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/systemwarning/SystemWarningItemVO.java =================================================================== diff -u -r21064 -r21930 --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/systemwarning/SystemWarningItemVO.java (.../SystemWarningItemVO.java) (revision 21064) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/systemwarning/SystemWarningItemVO.java (.../SystemWarningItemVO.java) (revision 21930) @@ -16,7 +16,8 @@ public static final String NOTICE_TYPE_SATISFACTIONSURVEY_TABLE = "满意度调查"; public static final String WARNING_TYPE_REGISTRATIONCERTIFICATION = "即将过期的供应商注册证"; public static final String WARNING_TYPE_DISABLED_REGISTRATIONCERTIFICATION = "已过期的供应商注册证"; - + public static final String WARNING_TYPE_EXPENSIVEGOODS_MIN_STOCK = "小于最小高值耗材库存"; + public static final String WARNING_TYPE_EXPENSIVEGOODS_MAX_STOCK = "大于最大高值耗材库存"; private String warningItemType;//告警类型 private Integer warningAmount;//告警数量 Index: ssts-web/src/main/webapp/homepage/portalPage.js =================================================================== diff -u -r21692 -r21930 --- ssts-web/src/main/webapp/homepage/portalPage.js (.../portalPage.js) (revision 21692) +++ ssts-web/src/main/webapp/homepage/portalPage.js (.../portalPage.js) (revision 21930) @@ -1373,6 +1373,10 @@ addTab('warningInfo','告警管理',WWWROOT + '/disinfectsystem/basedatamanager/materialDefinition/materialDefinitionView.jsp?warning=warning'); }else if(v == warningCertification ){ addTab('warningInfo','告警管理',WWWROOT + '/disinfectsystem/basedatamanager/supplier/supplierCertificationWarningView.jsp?queryType='+v); + }else if(v == warningExpensiveGoods ){ + addTab('warningInfo','告警管理',WWWROOT + '/disinfectsystem/assestManagement/expensiveGoods/expensiveGoodsWarningView.jsp?queryType='+v); + }else if(v == warningMaxExpensiveGoods ){ + addTab('warningInfo','告警管理',WWWROOT + '/disinfectsystem/assestManagement/expensiveGoods/expensiveGoodsWarningView.jsp?queryType='+v); } warningWindow.close(); } Index: ssts-expensivegoods/src/main/java/com/forgon/disinfectsystem/expensiveGoods/dwr/table/ExpensiveGoodsTableManager.java =================================================================== diff -u -r21882 -r21930 --- ssts-expensivegoods/src/main/java/com/forgon/disinfectsystem/expensiveGoods/dwr/table/ExpensiveGoodsTableManager.java (.../ExpensiveGoodsTableManager.java) (revision 21882) +++ ssts-expensivegoods/src/main/java/com/forgon/disinfectsystem/expensiveGoods/dwr/table/ExpensiveGoodsTableManager.java (.../ExpensiveGoodsTableManager.java) (revision 21930) @@ -18,6 +18,7 @@ import org.springframework.stereotype.Service; import com.alibaba.fastjson.JSONArray; +import com.forgon.Constants; import com.forgon.component.grid.GridManager; import com.forgon.databaseadapter.service.DateQueryAdapter; import com.forgon.disinfectsystem.basedatamanager.warehouse.service.WareHouseManager; @@ -30,6 +31,7 @@ import com.forgon.disinfectsystem.entity.assestmanagement.ExpensiveGoodsStock; import com.forgon.disinfectsystem.entity.basedatamanager.datasynchronization.HisMaterialDefinition; import com.forgon.disinfectsystem.entity.basedatamanager.datasynchronization.HisMaterialType; +import com.forgon.disinfectsystem.entity.basedatamanager.materialdefinition.MaterialDefinition; import com.forgon.disinfectsystem.entity.basedatamanager.supplier.ExpensiveGoodsSupplier; import com.forgon.disinfectsystem.entity.basedatamanager.supplier.RegistrationCertification; import com.forgon.disinfectsystem.entity.systemwarning.SystemWarningItemVO; @@ -608,4 +610,39 @@ } return dataJsonArray.toString(); } + + /** + * 查询所有高值耗材小于最小库存和大于最大库存的信息 + * @param parameterMap + * @return + */ + public String findExpensiveGoodsMinAndMaxStockTableList( + Map> parameterMap) { + Map sqlWhereParamMap = gridManager + .getParamFromView(parameterMap); + + // 关键字查询-》把小写字母转换成大写字母 + if (!parameterMap.get("grid_search_query").isEmpty()) { + List keyList = parameterMap.get("grid_search_query"); + List queryKey = new ArrayList(keyList.size()); + for (int i = 0; i < keyList.size(); i++) { + queryKey.add(((String) keyList.get(i)).toUpperCase()); + } + parameterMap.put("grid_search_query", queryKey); + } + + String type = sqlWhereParamMap.get("type"); + String sql = "where 1=1"; + + if (StringUtils.isNotBlank(type)) { + sql = String.format(" where %s", SqlUtils.getStringFieldPredicate("po.type", type)); + } else { + sql += " and 1=1"; + } + sql += " and po.minStorage > po.amount or po.amount > po.maxStorage "; + return gridManager.renderGrid(parameterMap, + ExpensiveGoods.class.getSimpleName(), sql, + null); + } + } Index: ssts-web/src/main/webapp/disinfectsystem/assestManagement/expensiveGoods/expensiveGoodsView.js =================================================================== diff -u -r21684 -r21930 --- ssts-web/src/main/webapp/disinfectsystem/assestManagement/expensiveGoods/expensiveGoodsView.js (.../expensiveGoodsView.js) (revision 21684) +++ ssts-web/src/main/webapp/disinfectsystem/assestManagement/expensiveGoods/expensiveGoodsView.js (.../expensiveGoodsView.js) (revision 21930) @@ -354,6 +354,19 @@ anchor : '95%' }] },{ + columnWidth : 1, + layout : 'form', + labelWidth : 110, + items : [{ + xtype : 'numberfield', + fieldLabel : '总数', + maxLength : '16', + id : 'amount', + name : 'amount', + allowBlank : true, + anchor : '95%' + }] + },{ columnWidth: 1, layout : 'form', labelWidth : 110, @@ -660,7 +673,7 @@ title : '高值耗材信息', width : 700, // height : 620, - height : top.screen.height > 800 ? 400 : 400, + height : top.screen.height > 800 ? 420 : 420, modal : true, // autoHeight : true, border : false, @@ -1180,7 +1193,7 @@ {header : "类别",width : 80,dataIndex : 'grade'}, {header : "包装规格",width : 80,dataIndex : 'packageSpec'}, {header : "参考价",width : 60,dataIndex : 'referencePrice'}, - {header : "总数",width : 50,dataIndex : 'amount',hidden:true}, + {header : "总数",width : 50,dataIndex : 'amount'}, {header : "最小申请数量",width : 80,dataIndex : 'minApplyAmount'}, {header : "最大申请数量",width : 80,dataIndex : 'maxApplyAmount'}, {header : "单位",width : 50,dataIndex : 'unit'}, Index: ssts-web/src/main/webapp/homepage/menuconfigure.js =================================================================== diff -u -r21887 -r21930 --- ssts-web/src/main/webapp/homepage/menuconfigure.js (.../menuconfigure.js) (revision 21887) +++ ssts-web/src/main/webapp/homepage/menuconfigure.js (.../menuconfigure.js) (revision 21930) @@ -457,7 +457,8 @@ {hidden :SSTS_SystemWarning_DiposableGoods,text:"一次性物品告警",href:WWWROOT + '/disinfectsystem/assestManagement/diposableGoods/diposableGoodsWarningView.jsp',hrefTarget:linkTarget,leaf:true}, {hidden :SSTS_SystemWarning_TousseGoods,text:"器械包告警",href:WWWROOT + '/disinfectsystem/assestManagement/tousseGoods/tousseGoodsWarningView.jsp',hrefTarget:linkTarget,leaf:true}, {hidden :SSTS_SystemWarning_MATERIAL_MIN_STOCK,text:"材料库存告警",href:WWWROOT + '/disinfectsystem/basedatamanager/materialDefinition/materialDefinitionView.jsp?warning=warning',hrefTarget:linkTarget,leaf:true}, - {hidden :SSTS_SystemWarning_RegistrationCertification,text:"供应商注册证告警",href:WWWROOT + '/disinfectsystem/basedatamanager/supplier/supplierCertificationWarningView.jsp',hrefTarget:linkTarget,leaf:true} + {hidden :SSTS_SystemWarning_RegistrationCertification,text:"供应商注册证告警",href:WWWROOT + '/disinfectsystem/basedatamanager/supplier/supplierCertificationWarningView.jsp',hrefTarget:linkTarget,leaf:true}, + {hidden :SSTS_SystemWarning_RegistrationCertification,text:"高值耗材库存告警",href:WWWROOT + '/disinfectsystem/assestManagement/expensiveGoods/expensiveGoodsWarningView.jsp',hrefTarget:linkTarget,leaf:true} ] },{ text:"退货记录管理", Index: ssts-web/src/main/webapp/homepage/portalPage.jsp =================================================================== diff -u -r21064 -r21930 --- ssts-web/src/main/webapp/homepage/portalPage.jsp (.../portalPage.jsp) (revision 21064) +++ ssts-web/src/main/webapp/homepage/portalPage.jsp (.../portalPage.jsp) (revision 21930) @@ -176,6 +176,8 @@ var disabledTousseGoods = '<%=SystemWarningItemVO.WARNING_TYPE_DISABLED_TOUSSE%>'; var satisfactionSurveyNotice = '<%=SystemWarningItemVO.NOTICE_TYPE_SATISFACTIONSURVEY_TABLE%>'; var warningCertification = '<%=SystemWarningItemVO.WARNING_TYPE_REGISTRATIONCERTIFICATION%>'; +var warningExpensiveGoods = '<%=SystemWarningItemVO.WARNING_TYPE_EXPENSIVEGOODS_MIN_STOCK%>'; +var warningMaxExpensiveGoods = '<%=SystemWarningItemVO.WARNING_TYPE_EXPENSIVEGOODS_MAX_STOCK%>'; var directOrgUnitCodesWhereUserBelong = '<%=directOrgUnitCodesWhereUserBelong%>'; var directOrgUnitNamesWhereUserBelong = '<%=userData.getDirectOrgUnitNamesWhereUserBelong()%>'; var dirOrgCode = '<%=request.getAttribute("departCoding")%>'; Index: ssts-web/src/main/java/com/forgon/disinfectsystem/systemwarning/service/SystemWarningManagerImpl.java =================================================================== diff -u -r21064 -r21930 --- ssts-web/src/main/java/com/forgon/disinfectsystem/systemwarning/service/SystemWarningManagerImpl.java (.../SystemWarningManagerImpl.java) (revision 21064) +++ ssts-web/src/main/java/com/forgon/disinfectsystem/systemwarning/service/SystemWarningManagerImpl.java (.../SystemWarningManagerImpl.java) (revision 21930) @@ -7,16 +7,21 @@ import java.util.Calendar; import java.util.Date; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; import net.sf.json.JSONObject; import com.forgon.databaseadapter.service.DateQueryAdapter; import com.forgon.directory.acegi.tools.AcegiHelper; import com.forgon.directory.vo.LoginUserData; import com.forgon.disinfectsystem.basedatamanager.supplyroomconfig.service.SupplyRoomConfigManager; +import com.forgon.disinfectsystem.basedatamanager.warehouse.service.WareHouseManager; import com.forgon.disinfectsystem.entity.assestmanagement.DisposableGoodsBatchStock; +import com.forgon.disinfectsystem.entity.assestmanagement.ExpensiveGoods; +import com.forgon.disinfectsystem.entity.assestmanagement.ExpensiveGoodsStock; import com.forgon.disinfectsystem.entity.basedatamanager.materialdefinition.MaterialDefinition; import com.forgon.disinfectsystem.entity.basedatamanager.supplier.RegistrationCertification; import com.forgon.disinfectsystem.entity.basedatamanager.supplyroomconfig.SupplyRoomConfig; @@ -31,6 +36,7 @@ import com.forgon.tools.SqlBuilder; import com.forgon.tools.db.DatabaseUtil; import com.forgon.tools.hibernate.ObjectDao; +import com.forgon.tools.util.SqlUtils; /** * @author wangyi 2013-03-26 上午 09:51 @@ -54,6 +60,8 @@ private static final String SSTS_SYSTEMWARNING_REGISTRATIONCERTIFICATION = "SSTS_SystemWarning_RegistrationCertification"; private SupplyRoomConfigManager supplyRoomConfigManager; + + private WareHouseManager wareHouseManager; private UserManager userManager; @@ -63,6 +71,10 @@ this.appLogManager = appLogManager; } + public void setWareHouseManager(WareHouseManager wareHouseManager) { + this.wareHouseManager = wareHouseManager; + } + public void setUserManager(UserManager userManager) { this.userManager = userManager; } @@ -348,6 +360,31 @@ warningList.add(vo); } } + + // 高值耗材库存最小提示 + boolean expensiveGoodsQuery = operationManager.isUserHasOperation( + SSTS_SYSTEMWARNING_REGISTRATIONCERTIFICATION, userOperationIds); + if (expensiveGoodsQuery) { + int certificationAmount = getWarningExpensiveGoodsCount(orgUnitCoding); + if (certificationAmount > 0) { + SystemWarningItemVO vo = new SystemWarningItemVO(); + vo.setWarningItemType(SystemWarningItemVO.WARNING_TYPE_EXPENSIVEGOODS_MIN_STOCK); + vo.setWarningAmount(certificationAmount); + warningList.add(vo); + } + } + + // 高值耗材库存最大提示 + if (expensiveGoodsQuery) { + int certificationAmount = getWarningMaxExpensiveGoodsCount(orgUnitCoding); + if (certificationAmount > 0) { + SystemWarningItemVO vo = new SystemWarningItemVO(); + vo.setWarningItemType(SystemWarningItemVO.WARNING_TYPE_EXPENSIVEGOODS_MAX_STOCK); + vo.setWarningAmount(certificationAmount); + warningList.add(vo); + } + } + return warningList; } @@ -421,4 +458,64 @@ return 0; } + /*** + * 得到所有现有库存小于最小库存的高值耗材定义 + * @return + */ + @SuppressWarnings({ "unchecked", "rawtypes" }) + private int getWarningExpensiveGoodsCount(String orgUnitCoding) { + + boolean isRelativeDeparment = supplyRoomConfigManager + .isCssdTraceabilitySystemRelativeDepartment(orgUnitCoding); + + // 是否追溯系统相关部门 + if (isRelativeDeparment) { + String sql = "where 1=1 and " + SqlUtils.getNonStringFieldInCollectionsPredicate("warehouseID", wareHouseManager.getCurrentUserOrgUnitWarehouseIds()); + List expensiveGoodsStock = (List) objectDao.findBySql(ExpensiveGoodsStock.class.getSimpleName(),sql); + int goodsAmount = 0; + List expensiveGood = new ArrayList(); + Set set = new HashSet(); + String sql1 = " where po.minStorage > 0 and "+ 0 + "< po.minStorage "; + List expensiveGoods = objectDao.getBySql_ForUpdate2(ExpensiveGoods.class.getSimpleName(),sql1); + set.addAll(expensiveGoods); + if(expensiveGoodsStock.size()>0){ + for(ExpensiveGoodsStock egs : expensiveGoodsStock){ + String sql2 = " where po.minStorage > 0 and "+ egs.getAmount() + "< po.minStorage and po.id = " + egs.getExpensiveGoods().getId(); + expensiveGood = (List) objectDao.getBySql_ForUpdate2(ExpensiveGoods.class.getSimpleName(),sql2); + String sql3 = " where po.minStorage > 0 and "+ egs.getAmount() + "> po.minStorage and po.id = " + egs.getExpensiveGoods().getId(); + expensiveGood.addAll((List) objectDao.getBySql_ForUpdate2(ExpensiveGoods.class.getSimpleName(),sql3)); + set.removeAll(expensiveGood); + } + } + goodsAmount = set.size(); + return goodsAmount; + } + return 0; + } + + /*** + * 得到所有现有库存大于最大库存的高值耗材定义 + * @return + */ + @SuppressWarnings("unchecked") + private int getWarningMaxExpensiveGoodsCount(String orgUnitCoding) { + boolean isRelativeDeparment = supplyRoomConfigManager + .isCssdTraceabilitySystemRelativeDepartment(orgUnitCoding); + + // 是否追溯系统相关部门 + if (isRelativeDeparment) { + String sql = "where 1=1 and " + SqlUtils.getNonStringFieldInCollectionsPredicate("warehouseID", wareHouseManager.getCurrentUserOrgUnitWarehouseIds()); + List expensiveGoodsStock = (List) objectDao.findBySql(ExpensiveGoodsStock.class.getSimpleName(),sql); + if(expensiveGoodsStock.size()>0){ + int goodsAmount = 0; + for(ExpensiveGoodsStock expensiveGoods : expensiveGoodsStock){ + String sql1 = " where po.minStorage > 0 and "+ expensiveGoods.getAmount() + " >= po.maxStorage and po.id = " + expensiveGoods.getExpensiveGoods().getId(); + goodsAmount += objectDao.countObjectBySql(ExpensiveGoods.class.getSimpleName(),sql1); + } + return goodsAmount; + } + } + return 0; + } + }