Index: ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/goodPurchasePlanView.jsp =================================================================== diff -u -r23133 -r23512 --- ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/goodPurchasePlanView.jsp (.../goodPurchasePlanView.jsp) (revision 23133) +++ ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/goodPurchasePlanView.jsp (.../goodPurchasePlanView.jsp) (revision 23512) @@ -40,6 +40,7 @@ var supplier = '<%=Supplier.SUPPLIER_TYPE_SUPPLIER%>';//供货单位 + Index: ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/goodPurchasePlanView.js =================================================================== diff -u -r23133 -r23512 --- ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/goodPurchasePlanView.js (.../goodPurchasePlanView.js) (revision 23133) +++ ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/goodPurchasePlanView.js (.../goodPurchasePlanView.js) (revision 23512) @@ -45,34 +45,131 @@ return 3; }} -var supplierStore = new Ext.data.Store({ - proxy : new Ext.data.HttpProxy({ - url : WWWROOT + '/disinfectSystem/baseData/supplierAction!getSupplierData.do?supplierType='+encodeURI(supplier), - method : 'POST' - }), - reader : new Ext.data.JsonReader({ - totalProperty : 'totalCount', - root : 'data' - }, [ - {name : 'id',mapping : 'id'}, - {name : 'name',mapping : 'name'} - ]) -}); +//var madeCompanyNeedVerifyStore = new Ext.data.Store({ +// proxy : new Ext.data.HttpProxy({ +// url : WWWROOT + '/disinfectSystem/baseData/supplierAction!getSupplierData.do?supplierType='+encodeURI(supplier), +// method : 'POST' +// }), +// reader : new Ext.data.JsonReader({ +// totalProperty : 'totalCount', +// root : 'data' +// }, [ +// {name : 'id',mapping : 'id'}, +// {name : 'name',mapping : 'name'} +// ]) +//}); -var madeCompanyStore = new Ext.data.Store({ - proxy : new Ext.data.HttpProxy({ - url : WWWROOT + '/disinfectSystem/baseData/supplierAction!getSupplierData.do?supplierType='+encodeURI(madeCompany), - method : 'POST' - }), - reader : new Ext.data.JsonReader({ - totalProperty : 'totalCount', - root : 'data' - }, [ - {name : 'id',mapping : 'id'}, - {name : 'name',mapping : 'name'} - ]) -}); +//var madeCompanyStore = new Ext.data.Store({ +// proxy : new Ext.data.HttpProxy({ +// url : WWWROOT + '/disinfectSystem/baseData/supplierAction!getSupplierData.do?supplierType='+encodeURI(madeCompany), +// method : 'POST' +// }), +// reader : new Ext.data.JsonReader({ +// totalProperty : 'totalCount', +// root : 'data' +// }, [ +// {name : 'id',mapping : 'id'}, +// {name : 'name',mapping : 'name'} +// ]) +//}); +//var supplierNeedVerifyStore = new Ext.data.Store({ +// proxy : new Ext.data.HttpProxy({ +// url : WWWROOT + '/disinfectSystem/baseData/supplierAction!getSupplierDataNeedVerify.do?supplierType='+encodeURI(supplier), +// method : 'POST' +// }), +// reader : new Ext.data.JsonReader({ +// totalProperty : 'totalCount', +// root : 'data' +// }, [ +// {name : 'id',mapping : 'id'}, +// {name : 'name',mapping : 'name'} +// ]), +// listeners: { +// beforeload: function(s,options){ +// selectedRecord = top.Ext.getCmp('goodPurchaseItemGrid').getSelectionModel().getSelections()[0]; +// var disposableGoodsId = selectedRecord.data["disposableGoodsId"];//一次性物品id +// var manufacturerId = selectedRecord.data["manufacturerId"];//生产厂家id +// s.baseParams.disposableGoodsID =""; +// s.baseParams.manufacturerId =""; +// s.baseParams.needVerify = ""; +//// //若有一次性物品id 且 配置了需要校验则:过滤校验供应商 +// if(!isUndefinedOrNullOrEmpty(disposableGoodsId) && sstsConfig.godownEntryNeedVerify){ +// s.baseParams.disposableGoodsID = disposableGoodsId; +// s.baseParams.needVerify = true;//需要校验 +// if(!isUndefinedOrNullOrEmpty(manufacturerId)){ +// s.baseParams.manufacturerId = manufacturerId; +// } +// } +// } +// } +//}); + +//供应商数据源(根据一次性物品采购计划入库是否需要校验配置项 和 是否为一次性物品 启用校验过滤) +var supplierStore = new Ext.data.Store({ + proxy : new Ext.data.HttpProxy({ + url : WWWROOT + '/disinfectSystem/baseData/supplierAction!getSupplierDataNeedVerify.do?supplierType='+encodeURI(supplier), + method : 'POST' + }), + reader : new Ext.data.JsonReader({ + totalProperty : 'totalCount', + root : 'data' + }, [ + {name : 'id',mapping : 'id'}, + {name : 'name',mapping : 'name'} + ]), + listeners: { + beforeload: function(s,options){ + var disposableGoodsId = top.Ext.getCmp('disposableGoodsId').getValue();//一次性物品id + var manufacturerId = top.Ext.getCmp('manufacturerId').getValue();//生产厂家id + s.baseParams.disposableGoodsID =""; + s.baseParams.manufacturerId =""; + s.baseParams.needVerify = ""; + //若有一次性物品id且配置了需要校验则:过滤校验供应商 + if(!isUndefinedOrNullOrEmpty(disposableGoodsId) && sstsConfig.godownEntryNeedVerify){ + s.baseParams.disposableGoodsID = disposableGoodsId; + s.baseParams.needVerify = true;//需要校验 + if(!isUndefinedOrNullOrEmpty(manufacturerId)){ + s.baseParams.manufacturerId = manufacturerId; + } + } + } + } + }); + +//生产厂家数据源(根据一次性物品采购计划入库是否需要校验配置项 和 是否为一次性物品 启用校验过滤) + var madeCompanyStore = new Ext.data.Store({ + proxy : new Ext.data.HttpProxy({ + url : WWWROOT + '/disinfectSystem/baseData/supplierAction!getSupplierDataNeedVerify.do?supplierType='+encodeURI(madeCompany), + method : 'POST' + }), + reader : new Ext.data.JsonReader({ + totalProperty : 'totalCount', + root : 'data' + }, [ + {name : 'id',mapping : 'id'}, + {name : 'name',mapping : 'name'} + ]), + listeners: { + beforeload: function(s,options){ + var disposableGoodsId = top.Ext.getCmp('disposableGoodsId').getValue();//一次性物品id + var supplierId = top.Ext.getCmp('supplierId').getValue();//供应商id + s.baseParams.disposableGoodsID =""; + s.baseParams.manufacturerId =""; + s.baseParams.needVerify = ""; + //若有一次性物品id且配置了需要校验则:过滤校验生产厂家 + if(!isUndefinedOrNullOrEmpty(disposableGoodsId) && sstsConfig.godownEntryNeedVerify){ + s.baseParams.disposableGoodsID = disposableGoodsId; + s.baseParams.needVerify = true;//需要校验 + if(!isUndefinedOrNullOrEmpty(supplierId)){ + s.baseParams.supplierId = supplierId; + } + } + + } + } + }); + var GoodPurchasePlanItemRecord = Ext.data.Record.create([ {name : 'localID'}, {name : 'id'}, @@ -128,80 +225,6 @@ }); } -function validateForm(){ - if(!top.Ext.getCmp('goodPurchaseForm').form.isValid()){ - showResult('请正确填写表单各值'); - return false; - } - var name = top.Ext.getCmp('name1').getValue(); - if(name.length==0){ - showResult('请填写物品名称!'); - top.Ext.getCmp('name1').focus(false,100); - return false; - } - var count = top.Ext.getCmp('amount1').getValue(); - if(count.length==0){ - showResult('请填写物品数量!'); - top.Ext.getCmp('amount1').focus(false,100); - return false; - } - //var countNum = Ext.num(parseInt(count),0) - if(!/^\d+$/.test(count)){ - showResult('物品数量只能是整数'); - top.Ext.getCmp('amount1').focus(false,100); - return false; - } - - var lastConsumption = top.Ext.getCmp('lastConsumption1').getValue(); - if(lastConsumption != null && lastConsumption.length > 0){ - //var lastConsumptionNum = Ext.num(parseInt(lastConsumption),0) - if(!/^\d+$/.test(lastConsumption)){ - showResult('上期消耗量只能是整数'); - top.Ext.getCmp('lastConsumption1').focus(false,100); - return false; - } - } - - var stockQuantity = top.Ext.getCmp('stockQuantity').getValue(); - if(stockQuantity != null && stockQuantity.length > 0){ - if(!/^\d+$/.test(stockQuantity)){ - showResult('库存数量只能是整数'); - top.Ext.getCmp('stockQuantity').focus(false,100); - return false; - } - } - - var unit = top.Ext.getCmp('unit1').getValue(); - if(unit.length==0){ - showResult('请填写物品单位!'); - top.Ext.getCmp('unit1').focus(false,100); - return false; - } - /*var specification = top.Ext.getCmp('specification1').getValue(); - if(specification.length==0){ - showResult('请填写物品规格!'); - top.Ext.getCmp('specification1').focus(false,100); - return false; - }*/ - var cost = top.Ext.getCmp('purchase').getValue(); - if(cost.length==0){ - showResult('请填写物品进价!'); - top.Ext.getCmp('purchase').focus(false,100); - return false; - } - if(!/^(([1-9]+[0-9]*.{1}[0-9]+)|([0].{1}[1-9]+[0-9]*)|([1-9][0-9]*)|([0][.][0-9]+[1-9]*))$/.test(cost)){ - showResult('物品进价只能是正数'); - top.Ext.getCmp('purchase').focus(false,100); - return false; - } - - if(top.Ext.getCmp('supplier1').getValue() == null || top.Ext.getCmp('supplier1').getValue() == ''){ - showResult("请填写供应商!"); - top.Ext.getCmp('supplier1').focus(false,100); - return false; - } - return true; -} function clearForm(){ top.Ext.getCmp('name1').setValue(''); top.Ext.getCmp('amount1').setValue(''); @@ -218,68 +241,6 @@ top.Ext.getCmp('manufacturer').setValue(''); top.Ext.getCmp('name1').focus(); } -function addItems(departName,departCoding,name,unit,specification,lastConsuption, - stockQuantity,scheduleAmount,purchase,manufacturer,supplierName,disposableGoodsId,materialDefinitionId,supplierId,manufacturerId){ - for(var i = 0;i < top.Ext.getCmp('goodPurchaseItemGrid').getStore().getCount();i++){ - if(top.Ext.getCmp('goodPurchaseItemGrid').getStore().getAt(i).data.name == name){ - showResult("该物品已经存在,不能重复添加!"); - return false; - } - } - var lastConsuptionNum = Ext.num(parseInt(lastConsuption),0) - if(isNaN(lastConsuptionNum)){ - lastConsuptionNum = ''; - } - - var stockQuantityNum = Ext.num(parseInt(stockQuantity),0) - if(isNaN(stockQuantityNum)){ - stockQuantityNum = ''; - } - - var scheduleAmountNum = Ext.num(parseInt(scheduleAmount),0) - if(isNaN(scheduleAmountNum)){ - scheduleAmountNum = ''; - } - - var purchaseNum = Ext.num(parseFloat(purchase),0) - if(isNaN(purchaseNum)){ - purchaseNum = ''; - } - - var totalPriceNum = Ext.num(parseInt(scheduleAmount) * parseFloat(purchase),0) - if(isNaN(totalPriceNum)){ - totalPriceNum = ''; - } - //添加操作 - var goodPurchasePlanItem = new GoodPurchasePlanItemRecord({ - localID:g_localID++, - id : "", - departName : departName, - departCoding : departCoding, - name : name, - unit : unit, - specification : specification, - lastConsuption : lastConsuptionNum, - stockQuantity : stockQuantityNum, - scheduleAmount : scheduleAmountNum, - purchase : purchaseNum, - totalPrice:totalPriceNum, - manufacturer:manufacturer, - supplierName : supplierName, - disposableGoodsId : disposableGoodsId, - materialDefinitionId : materialDefinitionId, - supplierId : supplierId, - manufacturerId : manufacturerId - }); - //alert(purchase + " " + scheduleAmount + " " ); - //alert("lastConsuption:" + lastConsuption); - //alert("tatalPrice:" + Ext.num(parseFloat(scheduleAmount) * parseFloat(purchase),0)); - //top.Ext.getCmp('goodPurchaseItemGrid').getStore().add(goodPurchasePlanItem); - top.Ext.getCmp('goodPurchaseItemGrid').getStore().insert(0 , goodPurchasePlanItem); - setTotalMoney(top.Ext.getCmp('goodPurchaseItemGrid')); - clearForm(); - return true; -} function renderDeleteButton(v,p,record){ return ""; @@ -367,675 +328,7 @@ top.Ext.getCmp(id).focus(); top.Ext.getCmp(id).selectText(); } -function addGoodPurchasePlan(id) { - var form = new top.Ext.FormPanel({ - id : 'goodPurchaseForm', - frame : true, - labelSeparator : ':', - bodyStyle : 'padding:5px 5px 0px 5px', - width : 850, - autoScroll : true, - labelAlign : 'left', - items:[{ - layout : 'column', - items : [{ - xtype : 'hidden', - name : 'id', - id : 'id' - },{ - xtype : 'hidden', - name : 'items', - id : 'items' - },{ - xtype : 'hidden', - name : 'originalItems', - id : 'originalItems' - },{ - xtype : 'hidden', - name : 'formParams', - id : 'formParams' - },{ - xtype : 'hidden', - name : 'originalFormParams', - id : 'originalFormParams' - },{ - id : 'serialNum', - columnWidth : .25, - layout : 'form', - labelWidth : 40, - hidden:true, - items : [{ - xtype : 'textfield', - fieldLabel : '单号', - maxLength : '41', - id : 'serialNumber', - name : 'serialNumber', - cls : 'fieldReadOnlyNoRemove', - allowBlank : true, - readOnly : true, - anchor : '95%' - }] - }, { - columnWidth : .25, - layout : 'form', - labelWidth : 60, - items : [{ - xtype : 'textfield', - fieldLabel : '操作员', - maxLength : '50', - id : 'operator', - name : 'operator', - allowBlank : false, - readOnly : true, - cls : 'fieldReadOnlyNoRemove', - value : $Id('userName').value, - anchor : '95%' - }] - }, { - columnWidth : .25, - layout : 'form', - labelWidth : 60, - items : [{ - xtype : 'datefieldWithMin', - fieldLabel : '操作时间', - id : 'time', - name : 'time', - format : 'Y-m-d H:i', -// value : new Date(), - allowBlank : false, - anchor : '95%', - listeners : { - render : function() { - setStartDate(top.Ext, 'yyyy/MM/dd HH:mm', 'time'); //(操作时间,取服务器时间 cjr) - } - } - }] - },{ - columnWidth : .25, - layout : 'form', - labelWidth : 80, - items : [{ - xtype : 'textfield', - fieldLabel : '总金额', - id : 'totalPrice', - name : 'totalPrice', - readOnly:true, - cls : 'fieldReadOnlyNoRemove', - anchor : '95%' - }] - - }, { - columnWidth : 1, - layout : 'form', - labelWidth : 40, - items : [{ - xtype : 'textarea', - fieldLabel : '备注', - height : 50, - id : 'remark', - name : 'remark', - maxLength : 665, - allowBlank : true, - anchor : '100%' - }] - }] - },new top.Ext.grid.EditorGridPanel({ - id : 'goodPurchaseItemGrid', - bodyStyle : 'border:1px solid #afd7af', - frame :false, - height : 390, - store : new top.Ext.data.Store({ - reader : new top.Ext.data.JsonReader({ - fields : [ - {name : 'id'}, - {name : 'departName'}, - {name : 'departCoding'}, - {name : 'name'}, - {name : 'unit'}, - {name : 'specification'}, - - {name : 'lastConsuption'}, - {name : 'stockQuantity'}, - {name : 'scheduleAmount'}, - {name : 'purchase'}, - {name : 'totalPrice'}, - {name : 'manufacturer'}, - {name : 'supplierName'}, - {name : 'deleteButton'}, - {name : 'disposableGoodsId'}, - {name : 'materialDefinitionId'}, - {name : 'manufacturerId'}, - {name : 'supplierId'} - ] - }) - }), - cm : new top.Ext.grid.ColumnModel([new Ext.grid.RowNumberer(), - {header : "id",dataIndex : 'id',hidden : true}, - {header : "科室",dataIndex : 'departName',width : 80,menuDisabled : true}, - {header : "编码",dataIndex : 'departCoding',width : 60,menuDisabled : true}, - {header : "名称",dataIndex : 'name',width : 200,menuDisabled : true}, - {header : "规格",dataIndex : 'specification',width : 90,menuDisabled : true}, - {header : "单位",dataIndex : 'unit',width : 50,menuDisabled : true}, - {header : "上期消耗量",dataIndex : 'lastConsuption',width : 80,menuDisabled : true, - editor : new top.Ext.form.TextField({ - regex: /^\d+$/, - regexText:'只能输入数字', - allowBlank : false - }) - }, - {header : "库存数量",width : 70,dataIndex : 'stockQuantity',menuDisabled : true}, - {header : "计划数",width : 60,dataIndex : 'scheduleAmount',menuDisabled : true, - editor : new top.Ext.form.TextField({ - regex: /^\d+$/, - regexText:'只能输入数字', - allowBlank : false, - listeners:{ - change :function(field,newVal,oldVal){ - var grid = top.Ext.getCmp('goodPurchaseItemGrid'); - setTotalMoney(grid); - } - } - }) - }, - {header : "进价",dataIndex : 'purchase',width : 70,menuDisabled : true, - editor : new top.Ext.form.TextField({ - regex: /^(([1-9]+[0-9]*.{1}[0-9]+)|([0].{1}[1-9]+[0-9]*)|([1-9][0-9]*)|([0][.][0-9]+[1-9]*))$/, - regexText:'只能输入正数', - allowBlank : false, - listeners:{ - change :function(field,newVal,oldVal){ - var grid = top.Ext.getCmp('goodPurchaseItemGrid'); - setTotalMoney(grid); - } - } - }) - }, - {header : "金额",width : 80,menuDisabled : true,dataIndex : 'totalPrice', renderer:renderTotalPrice}, - {header : "供应商",width : 150,dataIndex : 'supplierName',menuDisabled : true, - editor : new top.Ext.form.ComboBox({ - queryParam : 'supplierName', - minChars : 0, - valueField : 'id', - displayField : 'name', - store : supplierStore, - forceSelection : true, - lazyInit : false, - triggerAction : 'all', - hideTrigger : true, - typeAhead : false, - allowBlank : true, - width : 100, - listeners : { - select : function(combo, record, index) { - combo.setValue(record.data.name); - selectedRecord = top.Ext.getCmp('goodPurchaseItemGrid').getSelectionModel().getSelections()[0]; - selectedRecord.set("supplierId",record.data.id); - } - } - }) - }, - {header : "生产商",width : 150,dataIndex : 'manufacturer',menuDisabled : true, - editor : new top.Ext.form.ComboBox({ - queryParam : 'supplierName', - minChars : 0, - valueField : 'id', - displayField : 'name', - store : madeCompanyStore, - forceSelection : true, - lazyInit : false, - triggerAction : 'all', - hideTrigger : true, - typeAhead : false, - allowBlank : true, - width : 100, - listeners : { - select : function(combo, record, index) { - combo.setValue(record.data.name); - selectedRecord = top.Ext.getCmp('goodPurchaseItemGrid').getSelectionModel().getSelections()[0]; - selectedRecord.set("manufacturerId",record.data.id); -// console.log(selectedRecord); - } - } - }) - }, - {header : "删除",width : 70,menuDisabled : true,dataIndex : 'deleteButton', renderer:renderDeleteButton} - ]), - width :983, - selModel : new top.Ext.grid.RowSelectionModel({ - singleSelect : false - }), - tbar : [{ - xtype : 'hidden', - name : 'disposableGoodsId', - id : 'disposableGoodsId' - },{ - xtype : 'hidden', - name : 'materialDefinitionId', - id : 'materialDefinitionId' - },{ - xtype : 'hidden', - name : 'barcode', - id : 'barcode' - },{ - xtype : 'hidden', - name : 'supplierId', - id : 'supplierId' - },{ - xtype : 'hidden', - name : 'manufacturerId', - id : 'manufacturerId' - },{ - text : '  物品名称:' - },{ - xtype : 'combo', - id : 'name1', - name : 'name1', - queryParam : 'spell', - minChars : 0, - valueField : 'name', - displayField : 'name', - store : disposableGoodsAndMaterialStore, - forceSelection : true, - lazyInit : false, - triggerAction : 'all', - hideTrigger : true, - typeAhead : false, - allowBlank : true, - width : 270, - tabIndex : 1, - selectOnFocus : true, - listeners : { - select : function(combo, record, index) { - top.Ext.getCmp('name1').setValue(record.data.name); - top.Ext.getCmp('name1').selectText(); - var disposableGoodsId = record.data.disposableGoodsId; - var materialDefinitionId = record.data.materialDefinitionId; - - //加载相关的信息 - /*DiposableGoodsTableManager.getDiposableGoodsInfoForGoodPurchase(record.data.id,function(result){ - if(result != ""){ - var array = result.split("#;"); - top.Ext.getCmp('stockQuantity').setValue(array[0]); - top.Ext.getCmp('specification1').setValue(array[1]); - top.Ext.getCmp('unit1').setValue(array[2]); - top.Ext.getCmp('supplier1').setValue(array[3]); - top.Ext.getCmp('manufacturer').setValue(array[4]); - } - });*/ - - if(disposableGoodsId){ - top.Ext.getCmp('materialDefinitionId').setValue(""); - top.Ext.getCmp('disposableGoodsId').setValue(disposableGoodsId); - top.Ext.getCmp('purchase').setValue(record.data.referencePrice); - //选择物品后自动带出上一次录入的数据,增加进价 - GoodPurchaseTableManager.getLastGoodPurchaseItemByDisposableGoodsId(disposableGoodsId,function(result){ - if(result && result != ""){ - var lastGoodPurchaseItem = Ext.decode(result); - top.Ext.getCmp('stockQuantity').setValue(lastGoodPurchaseItem.stockQuantity); - top.Ext.getCmp('specification1').setValue(lastGoodPurchaseItem.specification1); - top.Ext.getCmp('purchase').setValue(lastGoodPurchaseItem.purchase); - top.Ext.getCmp('unit1').setValue(lastGoodPurchaseItem.unit1); - top.Ext.getCmp('supplier1').setValue(lastGoodPurchaseItem.supplier1); - top.Ext.getCmp('manufacturer').setValue(lastGoodPurchaseItem.manufacturer); - top.Ext.getCmp('supplierId').setValue(lastGoodPurchaseItem.supplierId); - top.Ext.getCmp('manufacturerId').setValue(lastGoodPurchaseItem.manufacturerId); - } - }); - }else if(materialDefinitionId){ - top.Ext.getCmp('disposableGoodsId').setValue(""); - top.Ext.getCmp('materialDefinitionId').setValue(materialDefinitionId); - //选择物品后自动带出上一次录入的数据,增加进价 - GoodPurchaseTableManager.getLastGoodPurchaseItemByMaterialDefinitionId(materialDefinitionId,function(result){ - if(result && result != ""){ - var lastGoodPurchaseItem = Ext.decode(result); - top.Ext.getCmp('stockQuantity').setValue(lastGoodPurchaseItem.stockQuantity); - top.Ext.getCmp('specification1').setValue(lastGoodPurchaseItem.specification1); - top.Ext.getCmp('purchase').setValue(lastGoodPurchaseItem.purchase); - top.Ext.getCmp('unit1').setValue(lastGoodPurchaseItem.unit1); - top.Ext.getCmp('supplier1').setValue(lastGoodPurchaseItem.supplier1); - top.Ext.getCmp('manufacturer').setValue(lastGoodPurchaseItem.manufacturer); - top.Ext.getCmp('supplierId').setValue(lastGoodPurchaseItem.supplierId); - top.Ext.getCmp('manufacturerId').setValue(lastGoodPurchaseItem.manufacturerId); - } - }); - } - top.Ext.getCmp('amount1').focus(); - top.Ext.getCmp('amount1').selectText(); - }, - specialkey : function(field, ee) { - if (ee.getKey() == Ext.EventObject.ENTER) { - focusTo('amount1'); - } - } - } - },{ - text : '数  量:' - },{ - xtype : 'textfield', - maxLength : '16', - id : 'amount1', - name : 'amount1', - allowBlank:true, - width : 100, - regex: /^\d+$/, - regexText:'只能输入整数', - anchor : '95%', - tabIndex : 2, - listeners : { - specialkey : function(field, e) { - if (e.getKey() == Ext.EventObject.ENTER) { - focusTo('unit1'); - } - } - } - },{ - text : '规  格:' - },{ - xtype : 'textfield', - allowBlank:true, - id : 'specification1', - name : 'specification1', - maxLength : '30', - width : 150, - tabIndex : 4, - anchor : '95%', - listeners : { - specialkey : function(field, ee) { - if (ee.getKey() == Ext.EventObject.ENTER) { - focusTo('lastConsumption1'); - } - } - } - }], - listeners: { - render : function() { - var tbar = new top.Ext.Toolbar ({ - items : [{ - text : '上期消耗量:' - },{ - xtype : 'textfield', - maxLength : '16', - id : 'lastConsumption1', - name : 'lastConsumption1', - allowBlank:true, - width : 100, - regex: /^\d+$/, - regexText:'只能输入整数', - anchor : '95%', - tabIndex : 5, - listeners : { - specialkey : function(field, e) { - if (e.getKey() == Ext.EventObject.ENTER) { - focusTo('stockQuantity'); - } - } - } - },{ - text : '库存数量:' - },{ - xtype : 'textfield', - maxLength : '16', - id : 'stockQuantity', - name : 'stockQuantity', - allowBlank:true, - width : 108, - regex: /^\d+$/, - regexText:'只能输入整数', - anchor : '95%', - tabIndex : 6, - listeners : { - specialkey : function(field, e) { - if (e.getKey() == Ext.EventObject.ENTER) { - focusTo('purchase'); - } - } - } - },{ - text:'进  价:' - },{ - xtype : 'textfield', - maxLength : '16', - id : 'purchase', - name : 'purchase', - width : 100, - tabIndex : 7, - regex: /^(([1-9]+[0-9]*.{1}[0-9]+)|([0].{1}[1-9]+[0-9]*)|([1-9][0-9]*)|([0][.][0-9]+[1-9]*))$/, - regexText:'只能输入正数', - anchor : '95%', - allowBlank:true, - listeners : { - specialkey : function(field, e) { - if (e.getKey() == Ext.EventObject.ENTER) { - focusTo('supplier1'); - } - } - } - },{ - text : '单  位:' - },{ - xtype : 'textfield', - allowBlank:true, - id : 'unit1', - name : 'unit1', - maxLength : '30', - width : 150, - tabIndex : 3, - anchor : '95%', - listeners : { - specialkey : function(field, ee) { - if (ee.getKey() == Ext.EventObject.ENTER) { - focusTo('specification1'); - } - } - } - }] - }); - tbar.render(top.Ext.getCmp('goodPurchaseItemGrid').tbar); - - var tbar3 = new top.Ext.Toolbar ({ - items : [{ - text : '  供 应 商:' - },{ - xtype : 'combo', - id : 'supplier1', - name : 'supplier1', - queryParam : 'supplierName', - minChars : 0, - valueField : 'name', - displayField : 'name', - store : supplierStore, - forceSelection : false, - lazyInit : false, - triggerAction : 'all', - hideTrigger : true, - typeAhead : false, - selectOnFocus :true, - allowBlank : true, - width : 270, - tabIndex : 8, - listeners : { - select : function(field, r) { - top.Ext.getCmp('supplierId').setValue(r.data.id); - focusTo('manufacturer'); - }, - specialKey:function(f,e){ - if (e.getKey() == Ext.EventObject.ENTER) { - focusTo('manufacturer'); - } - } - } - },{ - text : '生产商:' - },{ - xtype : 'combo', - id : 'manufacturer', - name : 'manufacturer', - maxLength : '60', - queryParam : 'supplierName', - minChars : 0, - valueField : 'name', - displayField : 'name', - store : madeCompanyStore, - forceSelection : false, - lazyInit : false, - triggerAction : 'all', - hideTrigger : false, - typeAhead : false, - allowBlank : true, - selectOnFocus :true, - editable:true, - width : 300, - tabIndex : 9, - listeners : { - select : function(field, r) { - top.Ext.getCmp('manufacturerId').setValue(r.data.id); - }, - 'keydown' : function(obj, e){ - if (e.getKey() == e.BACKSPACE) {e.stopEvent();} - } - } - },{ - text : '添加', - iconCls : 'btn_ext_add', - id:'addBtn', - handler : function() { - if(addPurchaseGoods() == true){ - focusTo('name1'); - } - } - }] - }); - tbar3.render(top.Ext.getCmp('goodPurchaseItemGrid').tbar); - } - } - })], - buttons : [{ - text : '打印预览', - hidden: (id == ""?true:false), - handler : function() { - printGoodPurchasePlan(id, 1); - } - },{ - text : '打印', - hidden: (id == ""?true:false), - handler : function() { - printGoodPurchasePlan(id, 0) - } - },{ - text : '保存', - hidden:saveButton, - handler : function() { - if(!form.getForm().isValid()){ - showResult('请正确填写表单各值'); - return false; - } - var name = top.Ext.getCmp('name1').getValue(); - - var items = buildJSONStringFromStore(top.Ext.getCmp('goodPurchaseItemGrid').getStore()); - // console.log(items); - // 设置表单参数json - setFormParams(form,['id','remark','time']); - top.Ext.getCmp("items").setValue(items); - - // items为json数组字符串,不会为null - if(items == '[]'){ - showResult('请正确填写表单各值'); - return false; - } - form.form.submit({ - url : WWWROOT + '/disinfectSystem/goodPurchaseAction!saveGoodPurchasePlan.do', - method : 'POST', - waitMsg : '正在保存数据,请稍候', - waitTitle : '提交表单', - success : function(form, action) { - showResult(action.result.message); - grid.dwrReload(); - window.close(); - }, - failure : function(form, action) { - showResult(action.result.message); - } - }); - } - },{ - text : '取消', - handler : function() { - window.close(); - } - }] - }); - - var window = new top.Ext.Window( { - id : 'recyclingApplicationWin', - layout : 'fit', - title : '采购单信息', - width : 1020, - height :550, - modal : true, -// autoHeight : true, - border :false, - plain : true, - items : [ form ] - }); - window.show(); - top.Ext.getCmp('name1').focus(false, 100); -} -//添加 -function addPurchaseGoods(){ - if(!validateForm()){ - return false; - } - /*if(!top.Ext.getCmp('goodPurchaseForm').form.isValid()){ - showResult('请正确填写表单各值'); - return false; - }*/ - var disposableGoodsId = top.Ext.getCmp('disposableGoodsId').getValue(); - var materialDefinitionId = top.Ext.getCmp('materialDefinitionId').getValue(); - var supplierId = top.Ext.getCmp('supplierId').getValue(); - var manufacturerId = top.Ext.getCmp('manufacturerId').getValue(); - var name = top.Ext.getCmp('name1').getValue(); - /*if(name.length==0){ - showResult('请填写物品名称!'); - top.Ext.getCmp('name1').focus(false,100); - return false; - }*/ - var scheduleAmount = top.Ext.getCmp('amount1').getValue(); - /*if(scheduleAmount.length==0){ - showResult('请填写物品数量!'); - top.Ext.getCmp('amount1').focus(false,100); - return false; - }*/ - var unit = top.Ext.getCmp('unit1').getValue(); - /*if(unit.length==0){ - showResult('请填写物品单位!'); - top.Ext.getCmp('unit1').focus(false,100); - return false; - }*/ - var specification = top.Ext.getCmp('specification1').getValue(); - /*if(specification.length==0){ - showResult('请填写物品规格!'); - top.Ext.getCmp('specification1').focus(false,100); - return false; - }*/ - var purchase = top.Ext.getCmp('purchase').getValue(); - /*if(purchase.length==0){ - showResult('请填写物品进价!'); - top.Ext.getCmp('purchase').focus(false,100); - return false; - }*/ - - var supplierName = top.Ext.getCmp('supplier1').getValue(); - var manufacturer = top.Ext.getCmp('manufacturer').getRawValue(); - var stockQuantity = top.Ext.getCmp('stockQuantity').getRawValue(); - var departName = $Id('departName').value; - var departCoding = $Id('departCoding').value; - var lastConsuption = top.Ext.getCmp('lastConsumption1').getValue(); - //alert(departName + " " + departCoding); - return addItems(departName,departCoding,name,unit,specification,lastConsuption, - stockQuantity,scheduleAmount,purchase,manufacturer,supplierName,disposableGoodsId,materialDefinitionId,supplierId,manufacturerId); -} - // 删除 function deleteGoodPurchasePlan(grid) { var records = grid.getSelectionModel().getSelections(); Index: ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/godownEntryView.js =================================================================== diff -u -r23147 -r23512 --- ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/godownEntryView.js (.../godownEntryView.js) (revision 23147) +++ ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/godownEntryView.js (.../godownEntryView.js) (revision 23512) @@ -155,6 +155,114 @@ } } }); + +//供应商数据源(校验用) + var supplierNeedVerifyStore = new Ext.data.Store({ + proxy : new Ext.data.HttpProxy({ + url : WWWROOT + '/disinfectSystem/baseData/supplierAction!getSupplierDataNeedVerify.do?supplierType='+encodeURI(supplier), + method : 'POST' + }), + reader : new Ext.data.JsonReader({ + totalProperty : 'totalCount', + root : 'data' + }, [ + {name : 'id',mapping : 'id'}, + {name : 'name',mapping : 'name'} + ]), + listeners: { + beforeload: function(s,options){ + var disposableGoodsID = top.Ext.getCmp('disposableGoodsID').getValue();//一次性物品id + var manufacturerId = top.Ext.getCmp('manufacturerId').getValue();//生产厂家id +// console.log(disposableGoodsID); + s.baseParams.manufacturerId =""; + s.baseParams.disposableGoodsID =""; + s.baseParams.needVerify = true;//需要校验用 + if(!isUndefinedOrNullOrEmpty(manufacturerId)){ + s.baseParams.manufacturerId = manufacturerId; + } + if(!isUndefinedOrNullOrEmpty(disposableGoodsID)){ + s.baseParams.disposableGoodsID = disposableGoodsID; + } + } + } + }); + +//生产厂家数据源(校验用) + var madeCompanyNeedVerifyStore = new Ext.data.Store({ + proxy : new Ext.data.HttpProxy({ + url : WWWROOT + '/disinfectSystem/baseData/supplierAction!getSupplierDataNeedVerify.do?supplierType='+encodeURI(madeCompany), + method : 'POST' + }), + reader : new Ext.data.JsonReader({ + totalProperty : 'totalCount', + root : 'data' + }, [ + {name : 'id',mapping : 'id'}, + {name : 'name',mapping : 'name'} + ]), + listeners: { + beforeload: function(s,options){ + var disposableGoodsID = top.Ext.getCmp('disposableGoodsID').getValue();//一次性物品id + var supplierId = top.Ext.getCmp('supplierId').getValue();//供应商id +// console.log(supplierId); + s.baseParams.supplierId =""; + s.baseParams.disposableGoodsID =""; + s.baseParams.needVerify = true;//需要校验用 + if(!isUndefinedOrNullOrEmpty(supplierId)){ + s.baseParams.supplierId = supplierId; + } + if(!isUndefinedOrNullOrEmpty(disposableGoodsID)){ + s.baseParams.disposableGoodsID = disposableGoodsID; + } + } + } + }); + +//注册证号数据源(校验用) + certificationStore = new top.Ext.data.Store({ + proxy : new top.Ext.data.HttpProxy({ + url : WWWROOT + '/disinfectSystem/baseData/supplierAction!getCertificationStoreList.do', + method : 'POST' + }), + reader : new top.Ext.data.JsonReader( + { + totalProperty : 'totalCount', + root : 'data' + },[ + {name : 'id'}, + {name : 'certificateNumber'} + ]), + listeners: { + beforeload: function(s,options){ + var manufacturerId = top.Ext.getCmp('manufacturerId').getValue();//生产厂家id + var disposableGoodsID = top.Ext.getCmp('disposableGoodsID').getValue();//一次性物品id + s.baseParams.manufacturerId = ''; + s.baseParams.disposableGoodsID = ''; + if(!isUndefinedOrNullOrEmpty(manufacturerId)){ + s.baseParams.manufacturerId = manufacturerId; + } + if(!isUndefinedOrNullOrEmpty(disposableGoodsID)){ + s.baseParams.disposableGoodsID = disposableGoodsID; + } + }, + load : function(store,records) { + //注册证自动填入 +// console.log(records); + if(records.length > 0){ + var combo = top.Ext.getCmp('certification1'); + combo.setValue(records[0].data.id); + // 触发选中事件 + combo.fireEvent('select', combo,records[0],0); + }else{ + var combo = top.Ext.getCmp('certification1'); + combo.setValue(""); + // 触发选中事件 + combo.fireEvent('select', combo,"",0); + } + } + + } + }) var hasTypeStore = new Ext.data.SimpleStore({ fields : ['hasType'], data : [[HAS_TYPE_NO],[HAS_TYPE_YES]] @@ -271,6 +379,28 @@ return false; } } + + //是否需要校验物品关联的供应商,生产厂家,注册证 + if(sstsConfig.godownEntryNeedVerify){ + if(top.Ext.isEmpty(top.Ext.getCmp('supplier1').getValue()) || manufacturerId == null){ + showResult("请填写供应商!"); + return false; + } + if(top.Ext.isEmpty(top.Ext.getCmp('manufacturer').getValue()) || supplierId == null){ + showResult("请填写生产厂家!"); + return false; + } + var certificationId = top.Ext.getCmp('certification1').getValue(); + if(certificationId == '' || certification == null){ + showResult("请填写注册证号!"); + return false; + } + //检查物品相关证件是否过期 + if(!checkGoodsValidityTime(disposableGoodsID,supplierId,manufacturerId,certificationId)){ + return false; + } + } + var qualifiedCheck = top.Ext.getCmp("qualifiedCheck").getValue(); var qualifiedLabel = top.Ext.getCmp("qualifiedLabel").getValue(); @@ -316,13 +446,17 @@ top.Ext.getCmp('supplierId').setValue(''); top.Ext.getCmp('sterileBatchNumber').setValue(''); top.Ext.getCmp('manufacturer').setValue(''); - top.Ext.getCmp('certification').setValue(''); + top.Ext.getCmp('certification1').setValue(''); // top.Ext.getCmp('qualifiedCheck').setValue(''); // top.Ext.getCmp('qualifiedLabel').setValue(''); top.Ext.getCmp('name1').focus(); batchNumStore.baseParams.disposableGoodsID = ''; batchNumStore.load(); + //配置godownEntryNeedVerify为true:注册证stroe + if(sstsConfig.godownEntryNeedVerify){ + certificationStore.load(); + } } function renderDeleteButton(v,p,record){ @@ -445,7 +579,7 @@ top.Ext.getCmp('supplier1').setValue(info.supplierName); } if(!isUndefinedOrNullOrEmpty(info.certification)){ - top.Ext.getCmp('certification').setValue(info.certification); + top.Ext.getCmp('certification1').setValue(info.certification); } }else{ @@ -496,1391 +630,11 @@ } }, failure : function(response, options) { - alert(1); var result = Ext.decode(response.responseText); } }); } -var selectModel = new top.Ext.grid.CheckboxSelectionModel(); -//从入库单列表点添加或点击列表中某一行的单都会调用此function -function addGodownEntry() { - Ext.getCmp("formSubmitResult").setValue(formSubmitResultInit); - wareHouseStore.load(); - var form = new top.Ext.FormPanel({ - id : 'godownEntryForm', - frame : true, - labelSeparator : ':', - bodyStyle : 'padding:5px 5px 0px 5px', - width : 850, - autoScroll : true, - labelAlign : 'left', - items:[{ - layout : 'column', - items : [{ - xtype : 'hidden', - name : 'id', - id : 'id' - },{ - xtype : 'hidden', - name : 'type', - value : TYPE_IN - },{ - xtype : 'hidden', - name : 'items', - id : 'items' - },{ - xtype : 'hidden', - name : 'originalItems', - id : 'originalItems' - },{ - xtype : 'hidden', - name : 'formParams', - id : 'formParams' - },{ - xtype : 'hidden', - name : 'originalFormParams', - id : 'originalFormParams' - },{ - xtype : 'hidden', - name : 'warehouseID', - id : 'warehouseID' - },{ - xtype : 'hidden', - name : 'warehouseName', - id : 'warehouseName' - },{ - id : 'serialNum', - columnWidth : .20, - layout : 'form', - labelWidth : 40, - hidden:true, - items : [{ - xtype : 'textfield', - fieldLabel : '单号', - maxLength : '41', - id : 'serialNumber', - name : 'serialNumber', - cls : 'fieldReadOnlyNoRemove', - allowBlank : true, - readOnly : true, - anchor : '95%' - }] - },{ - columnWidth : .20, - layout : 'form', - labelWidth : 40, - items:[{ - xtype : 'combo', - fieldLabel : '仓库', - id : 'wareHouse1', - name : 'wareHouse1', - minChars : 0, - valueField : 'id', - displayField : 'name', - store : wareHouseStore, - forceSelection : true, - lazyInit : false, - triggerAction : 'all', - hideTrigger : true, - typeAhead : false, - allowBlank : true, - width : 100, - listeners : { - select : function(combo, record, index) { - setWareHouseInfo(record.data.id,record.data.name); - top.Ext.getCmp('wareHouse1').setValue(record.data.id); - //diposableGoodsStore.proxy.extraParams.warehouseID = record.data.id; - //diposableGoodsStore.proxy.conn.extraParams.spell = top.Ext.getCmp('name1').getValue(); - /*diposableGoodsStore.reload({ - callback:function(e){ - console.log(e); - } - });*/ - - top.Ext.getCmp('name1').focus(); - top.Ext.getCmp('name1').enable(); - }, - specialkey : function(field, ee) { - if (ee.getKey() == Ext.EventObject.ENTER) { - top.Ext.getCmp('name1').focus(); - } - } - } - }] - }, { - columnWidth : .15, - layout : 'form', - labelWidth : 60, - items : [{ - xtype : 'textfield', - fieldLabel : '操作员', - maxLength : '50', - id : 'operator', - name : 'operator', - allowBlank : false, - readOnly : true, - cls : 'fieldReadOnlyNoRemove', - value : $Id('userName').value, - anchor : '95%' - }] - }, { - columnWidth : .25, - layout : 'form', - labelWidth : 60, - items : [{ - xtype : 'datefieldWithMin', - fieldLabel : '入库时间', - id : 'time', - name : 'time', - format : 'Y-m-d H:i', - altFormats:'Y-m-d|Y-n-j|y-n-j|y-m-j|y-m-d|y-n-d|Y-n-d|Y-m-j|Ymd|Ynj|ynj|ymj|ymd|ynd|Ynd|Ymj|Y/m/d|Y/n/j|y/n/j|y/m/j|y/m/d|y/n/d|Y/n/d|Y/m/j', -// value : new Date(), - allowBlank : false, - anchor : '95%', - listeners : { - render : function() { - setStartDate(top.Ext, 'yyyy/MM/dd HH:mm', 'time'); //(入库时间,取服务器时间 cjr) - } - } - }] - }, { - columnWidth : .20, - layout : 'form', - labelWidth : 80, - items : [{ - xtype : 'textfield', - fieldLabel : '入库单总价', - id : 'totalPrice', - name : 'totalPrice', - readOnly:true, - cls : 'fieldReadOnlyNoRemove', - anchor : '95%' - }] - },{ - hidden : !sstsConfig.showDisposableGoodsGodownEntryVerifier || (commonEntry.isOpen() ? false:true), - columnWidth : .25, - layout : 'form', - labelWidth : 130, - items :[{ - xtype : 'textfield', - fieldLabel :'扫描供应室核对人条码', - id : 'supplyRoomVerifierBarcode', - name : 'supplyRoomVerifierBarcode', - width : 100, - enableKeyEvents : true, - listeners : { - render : function(c) { - c.getEl().on('keypress',function(e) { - if (e.getKey() == 13) {// 输入;号键,grid重新加载 - loadUserVerifierByBarcode('supplyRoomVerifierBarcode'); - } - }); - } - } - }] - },{ - hidden : !sstsConfig.showDisposableGoodsGodownEntryVerifier|| (commonEntry.isOpen() ? false:true), - columnWidth : .25, - layout : 'form', - labelWidth : 80, - items:[{ - xtype : 'combo', - fieldLabel : '供应室核对人', - id : 'supplyRoomVerifier', - name : 'supplyRoomVerifier', - queryParam : 'spell', - valueField : 'name', - displayField : 'name', - store : verifierStore, - forceSelection : true, - lazyInit : true, - minChars : 0, - listWidth:100, - triggerAction : 'all', - hideTrigger : true, - typeAhead : false, - allowBlank : true, - width : 100, - listeners : { - select : function(combo, record, index) { - top.Ext.getCmp('supplyRoomVerifier').setValue(record.data.name); - top.Ext.getCmp('equipmentVerifierBarcode').focus(); - }, - specialkey : function(field, ee) { - if (ee.getKey() == Ext.EventObject.ENTER) { - top.Ext.getCmp('equipmentVerifierBarcode').focus(); - } - } - } - }] - },{ - hidden : !sstsConfig.showDisposableGoodsGodownEntryVerifier|| (commonEntry.isOpen() ? false:true), - columnWidth : .25, - layout : 'form', - labelWidth : 130, - items :[{ - xtype : 'textfield', - fieldLabel :'扫描设备科核对人条码', - id : 'equipmentVerifierBarcode', - name : 'equipmentVerifierBarcode', - width : 100, - enableKeyEvents : true, - listeners : { - render : function(c) { - c.getEl().on('keypress',function(e) { - if (e.getKey() == 13) {// 输入;号键,grid重新加载 - loadUserVerifierByBarcode('equipmentVerifierBarcode'); - } - }); - } - } - }] - },{ - hidden : !sstsConfig.showDisposableGoodsGodownEntryVerifier|| (commonEntry.isOpen() ? false:true), - columnWidth : .25, - layout : 'form', - labelWidth : 80, - items:[{ - xtype : 'combo', - fieldLabel : '设备科核对人', - id : 'equipmentVerifier', - name : 'equipmentVerifier', - queryParam : 'spell', - valueField : 'name', - displayField : 'name', - store : verifierStore, - forceSelection : true, - lazyInit : true, - minChars : 0, - listWidth:100, - triggerAction : 'all', - hideTrigger : true, - typeAhead : false, - allowBlank : true, - width : 100, - listeners : { - select : function(combo, record, index) { - top.Ext.getCmp('equipmentVerifier').setValue(record.data.name); - } - } - }] - },{ - columnWidth : 1, - layout : 'form', - labelWidth : 40, - items : [{ - xtype : 'textarea', - fieldLabel : '备注', - height : 50, - id : 'remark', - name : 'remark', - maxLength : 665, - allowBlank : true, - anchor : '100%' - }] - }] - },new top.Ext.grid.EditorGridPanel({ - id : 'godownEntryItemGrid', - bodyStyle : 'border:1px solid #afd7af', - frame :false, - sm : selectModel, - height : 390, - viewConfig: { - forceFit:true - }, - store : new top.Ext.data.Store({ - proxy : new top.Ext.data.HttpProxy({ - url : WWWROOT + '/disinfectSystem/godownEntryAction!loadGodownEntryItemByid.do', - method : 'POST' - }), - reader : new top.Ext.data.JsonReader({ - fields : [ - {name : 'id'}, - {name : 'disposableGoodsID'}, - {name : 'name'}, - {name : 'amount'}, - {name : 'disposableGoodsBatchID'}, - {name : 'batchNumber'}, - {name : 'cost'}, - {name : 'expDate'}, - {name : 'supplierName'}, - {name : 'sterileBatchNumber'}, - {name : 'manufacturer'}, - {name : 'certification'}, - {name : 'totalPrice'}, - {name : 'deleteButton'}, - {name : 'hasBiologicalTestReport'}, - {name : 'hasInvoice'}, - {name : 'grade'}, - {name : 'manufacturerId'}, - {name : 'supplierId'}, - {name : 'qualifiedCheck'},//标签合格 - {name : 'qualifiedLabel'}//验收合格 - ] - }) - }), - cm : new top.Ext.grid.ColumnModel([new Ext.grid.RowNumberer(), selectModel, - {header : "id",dataIndex : 'id',hidden : true}, - {header : "disposableGoodsID",dataIndex : 'disposableGoodsID',hidden : true}, - {header : "名称",dataIndex : 'name',width : 250,menuDisabled : true}, - {header : "数量",dataIndex : 'amount',width : 50,menuDisabled : true, - editor : new top.Ext.form.TextField({ - regex: /^\d+$/, - regexText:'只能输入数字', - allowBlank : false, - listeners:{ - change :function(field,newVal,oldVal){ - if(commonEntry.isOpen()){ - field.setValue(oldVal); - return false; - } - var grid = top.Ext.getCmp('godownEntryItemGrid'); - setTotalMoney(grid); - },focus:function(){ - if(commonEntry.isOpen()){ - alert('查看和编辑入库单时不能修改数量'); - return false; - } - } - } - }) - }, - {header : "批次",width : 70,dataIndex : 'batchNumber',menuDisabled : true, - editor : new top.Ext.form.TextField({ - allowBlank : false, - listeners:{ - change :function(field,newVal,oldVal){ - var grid = top.Ext.getCmp('godownEntryItemGrid'); - setTotalMoney(grid); - },focus:function(){ - if(!commonEntry.isOpen()){ - alert('添加入库单的时候不能修改批次号'); - return false; - } - } - } - }) - }, - {header : "失效日期",width : 80,dataIndex : 'expDate',menuDisabled : true, renderer:top.Ext.util.Format.dateRenderer('Y-m-d'), - editor : new top.Ext.form.DateExtensiableField({ - minWidth : 177, - format : 'Y-m-d', - altFormats:'Y-m-d|Y-n-j|y-n-j|y-m-j|y-m-d|y-n-d|Y-n-d|Y-m-j|Ymd|Ynj|ynj|ymj|ymd|ynd|Ynd|Ymj|Y/m/d|Y/n/j|y/n/j|y/m/j|y/m/d|y/n/d|Y/n/d|Y/m/j', - allowBlank : false - }) - }, - {header : "单价",dataIndex : 'cost',width : 50,menuDisabled : true, - editor : new top.Ext.form.TextField({ - regex: /^(([1-9]+[0-9]*.{1}[0-9]+)|([0].{1}[1-9]+[0-9]*)|([1-9][0-9]*)|([0][.][0-9]+[1-9]*))$/, - regexText:'只能输入正数', - allowBlank : false, - listeners:{ - change :function(field,newVal,oldVal){ - if(commonEntry.isOpen()){ - field.setValue(oldVal); - return false; - } - var grid = top.Ext.getCmp('godownEntryItemGrid'); - setTotalMoney(grid); - },focus:function(){ - if(commonEntry.isOpen()){ - alert('查看和编辑入库单时不能修改单价'); - return false; - } - } - } - }) - }, - {id : 'expandColumn',header : "供应商",width : 180,dataIndex : 'supplierName',menuDisabled : true, - editor : new top.Ext.form.ComboBox({ - queryParam : 'supplierName', - minChars : 0, - valueField : 'id', - displayField : 'name', - store : supplierStore, - forceSelection : true, - lazyInit : false, - triggerAction : 'all', - hideTrigger : true, - typeAhead : false, - allowBlank : true, - width : 100, - listeners : { - select : function(combo, record, index) { - combo.setValue(record.data.name); - selectedRecord = top.Ext.getCmp('godownEntryItemGrid').getSelectionModel().getSelections()[0]; - selectedRecord.set("supplierId",record.data.id); - } - } - }) - }, - {header : "灭菌批号",width : 80,dataIndex : 'sterileBatchNumber',menuDisabled : true, - editor : new top.Ext.form.TextField({ - maxLength : 30, - allowBlank : true - }) - }, - {header : "生产厂家",width : 100,dataIndex : 'manufacturer',menuDisabled : true, - editor : new top.Ext.form.ComboBox({ - queryParam : 'supplierName', - minChars : 0, - valueField : 'id', - displayField : 'name', - store : madeCompanyStore, - forceSelection : true, - lazyInit : false, - triggerAction : 'all', - hideTrigger : true, - typeAhead : false, - allowBlank : true, - width : 100, - listeners : { - select : function(combo, record, index) { - combo.setValue(record.data.name); - selectedRecord = top.Ext.getCmp('godownEntryItemGrid').getSelectionModel().getSelections()[0]; - selectedRecord.set("manufacturerId",record.data.id); - } - } - }) - }, - {header : "产地",width : 80,dataIndex : 'producingArea',menuDisabled : true, - editor : new top.Ext.form.TextField({ - maxLength : 30, - allowBlank : true - }) - }, - {header : "注册证号",width : 120,dataIndex : 'certification',menuDisabled : true, - editor : new top.Ext.form.TextField({ - maxLength : 30, - allowBlank : true - }) - }, - {header : "标签合格",width : 80,menuDisabled : true,dataIndex : 'qualifiedLabel',hidden:!sstsConfig.godownEntryShowQualified}, - {header : "验收合格",width : 80,menuDisabled : true,dataIndex : 'qualifiedCheck',hidden:!sstsConfig.godownEntryShowQualified}, - {header : "总价",width : 70,menuDisabled : true,dataIndex : 'totalPrice', renderer:renderTotalPrice}, - {header : "生物检测",width : 70,menuDisabled : true,dataIndex : 'hasBiologicalTestReport', - editor : new top.Ext.form.ComboBox({ - minChars : 0, - store : hasTypeStore, - forceSelection : true, - lazyInit : false, - valueField : 'hasType', - displayField : 'hasType', - mode : 'local', - triggerAction : 'all', - hideTrigger : true, - typeAhead : false, - allowBlank : false, - editable:false, - width : 100, - listeners : { - select : function(combo, record, index) { - combo.setValue(record.data.hasType); - } - } - }),hidden:!sstsConfig.godownEntryShowBiologicalTestReport}, - {header : "有无发票",width : 70,menuDisabled : true,dataIndex : 'hasInvoice', - editor : new top.Ext.form.ComboBox({ - minChars : 0, - store : hasTypeStore, - forceSelection : true, - lazyInit : false, - valueField : 'hasType', - displayField : 'hasType', - mode : 'local', - triggerAction : 'all', - hideTrigger : true, - typeAhead : false, - allowBlank : false, - editable:false, - width : 100, - listeners : { - select : function(combo, record, index) { - combo.setValue(record.data.hasType); - } - } - }),hidden:!sstsConfig.godownEntryShowInvoice}, - {header : '类别',width : 50,menuDisabled : true,dataIndex : 'grade', - editor : new top.Ext.form.ComboBox({ - minChars : 0, - store : gradeStore, - forceSelection : true, - lazyInit : false, - valueField : 'name', - displayField : 'name', - mode : 'local', - triggerAction : 'all', - hideTrigger : true, - typeAhead : false, - allowBlank : false, - editable:false, - width : 100, - listeners : { - select : function(combo, record, index) { - //combo.setValue(record.data.name); - } - } - })}, - {header : "删除",width : 50,menuDisabled : true,dataIndex : 'deleteButton', renderer:renderDeleteButton} - ]), - width :1380, - autoExpandColumn : 'expandColumn', - selModel : new top.Ext.grid.RowSelectionModel({ - singleSelect : false - }), - tbar : [{ - xtype : 'hidden', - name : 'disposableGoodsID', - id : 'disposableGoodsID' - },{ - xtype : 'hidden', - name : 'supplierId', - id : 'supplierId' - },{ - xtype : 'hidden', - name : 'manufacturerId', - id : 'manufacturerId' - },{ - xtype : 'hidden', - name : 'barcode', - id : 'barcode' - },{ - text : '扫描条码 :' - },{ - xtype : 'textfield', - id : 'barcode', - name : 'barcode', - width :90, - enableKeyEvents : true, - listeners : { - render : function(c) { - c.getEl().on('keypress',function(e) { - if (e.getKey() == 13) {// 输入;号键,grid重新加载 - loadReturnDiposableGoodsItem(); - } - }); - } - } - },{ - text : '物品名称:' - },{ - xtype : 'combo', - id : 'name1', - name : 'name1', - queryParam : 'spell', - minChars : 0, - valueField : 'id', - displayField : 'name', - pageSize : 100, - listConfig: {width: 300}, - store : sstsConfig.restrictGodownEntryDiposableGoods == true ? diposableGoodsStore:allDiposableGoodsStore, - forceSelection : true, - lazyInit : false, - triggerAction : 'all', - hideTrigger : true, - typeAhead : false, - allowBlank : true, - width : 270, - tabIndex : 1, - selectOnFocus : true, - disabled:true, - listeners : { - select : function(combo, record, index) { - top.Ext.getCmp('name1').setValue(record.data.name); - top.Ext.getCmp('name1').selectText(); - top.Ext.getCmp('disposableGoodsID').setValue(record.data.id); - top.Ext.getCmp('cost1').setValue(record.data.referencePrice); - //根据一次性物品id加载最近一次入库的一次性物品的供应商、注册证号、生产厂家、灭菌批次、产地、类别、单价等 - GodownEntryTableManager.getLastDiposableGoodsFromGodownEntry(record.data.id,function(result){ - if(result && result != ""){ - var lastGodownEntryItem = Ext.decode(result); - top.Ext.getCmp('supplier1').setValue(lastGodownEntryItem.supplierName); - top.Ext.getCmp('certification').setValue(lastGodownEntryItem.certification); - top.Ext.getCmp('manufacturer').setValue(lastGodownEntryItem.manufacturer); - top.Ext.getCmp('supplierId').setValue(lastGodownEntryItem.supplierId); - top.Ext.getCmp('manufacturerId').setValue(lastGodownEntryItem.manufacturerId); - top.Ext.getCmp('sterileBatchNumber').setValue(lastGodownEntryItem.sterileBatchNumber); - top.Ext.getCmp('producingArea').setValue(lastGodownEntryItem.producingArea); - top.Ext.getCmp('grade').setValue(lastGodownEntryItem.grade); - top.Ext.getCmp('cost1').setValue(lastGodownEntryItem.cost); - } - }); - batchNumStore.baseParams.disposableGoodsID = record.data.id; - batchNumStore.load(); - top.Ext.getCmp('amount1').focus(); - top.Ext.getCmp('amount1').selectText(); - }, - specialkey : function(field, ee) { - if (ee.getKey() == Ext.EventObject.ENTER) { - top.Ext.getCmp('amount1').focus(); - top.Ext.getCmp('amount1').selectText(); - } - } - } - },{ - text : '数    量:' - },{ - xtype : 'textfield', - maxLength : '16', - id : 'amount1', - name : 'amount1', - allowBlank:true, - width : 80, - regex: /^\d+$/, - regexText:'只能输入数字', - anchor : '95%', - tabIndex : 2, - listeners : { - specialkey : function(field, e) { - if (e.getKey() == Ext.EventObject.ENTER) { - top.Ext.getCmp('batchNumber1').focus(); - top.Ext.getCmp('batchNumber1').selectText(); - } - } - } - },{ - text : '生产批次:' - },{ - xtype : 'combo', - id : 'batchNumber1', - name : 'batchNumber1', - maxLength : '30', - queryParam : 'spell', - minChars : 0, - valueField : 'batchNumber', - displayField : 'batchNumber', - store : batchNumStore, - forceSelection : false, - lazyInit : false, - triggerAction : 'all', - hideTrigger : false, - typeAhead : false, - allowBlank:true, - selectOnFocus :true, - width : 150, - tabIndex : 3, - anchor : '95%', - listeners : { - select : function(combo, record, index) { - top.Ext.getCmp('batchNumber1').setValue(record.data.batchNumber); - - var goodsId = top.Ext.getCmp('disposableGoodsID').getValue(); - var batchNumber = record.data.batchNumber; - //加载灭菌批号、生产厂家 - DiposableGoodsTableManager.getDisposableGoodsBatchPropertyByDisposableGoodsID(goodsId,batchNumber,function(result){ - if(result!=""){ - var array = result.split("#;"); - top.Ext.getCmp('manufacturer').setValue(array[0]); - top.Ext.getCmp('sterileBatchNumber').setValue(array[1]); - top.Ext.getCmp('expDate1').setValue(array[2]); - top.Ext.getCmp('manufacturerId').setValue(array[3]); - } - }); - - }, - specialkey : function(field, ee) { - if (ee.getKey() == Ext.EventObject.ENTER) { - top.Ext.getCmp('producingArea').focus(); - top.Ext.getCmp('producingArea').selectText(); - } - } - } - },{ - text : '产地:' - },{ - xtype : 'textfield', - id : 'producingArea', - name : 'producingArea', - width : 80, - tabIndex : 4, - anchor : '95%', - allowBlank:true, - listeners:{ - specialkey : function(field, ee) { - if (ee.getKey() == Ext.EventObject.ENTER) { - if(sstsConfig.godownEntryShowBiologicalTestReport){ - top.Ext.getCmp('hasBiologicalTestReport').focus(); - top.Ext.getCmp('hasBiologicalTestReport').selectText(); - }else{ - top.Ext.getCmp('expDate1').focus(); - top.Ext.getCmp('expDate1').selectText(); - } - } - } - } - },{ - text:'生物检测:', - hidden:!sstsConfig.godownEntryShowBiologicalTestReport - },{ - xtype : 'combo', - id : 'hasBiologicalTestReport', - name : 'hasBiologicalTestReport', - minChars : 0, - valueField : 'hasType', - displayField : 'hasType', - mode : 'local', - store : hasTypeStore, - forceSelection : true, - lazyInit : false, - triggerAction : 'all', - hideTrigger : false, - typeAhead : false, - selectOnFocus :true, - allowBlank : true, - editable:false, - width : 80, - tabIndex : 5, - hidden:!sstsConfig.godownEntryShowBiologicalTestReport, - listeners : { - select : function(field, r) { - top.Ext.getCmp('expDate1').focus(); - }, - specialKey:function(f,e){ - if (e.getKey() == Ext.EventObject.ENTER) { - top.Ext.getCmp('expDate1').focus(); - top.Ext.getCmp('expDate1').selectText(); - } - } - } - }], - listeners: { - render : function() { - var tbar = new top.Ext.Toolbar ({ - items : [{ - text : '失 效 期:' - },{ - xtype : 'dateextensiablefield',//dateextensiablefield - id : 'expDate1', - name : 'expDate1', - width : 190, - minWidth : 190, - tabIndex : 6, - anchor : '95%', - allowBlank:true, - invalidText :'日期输入不正确', - format : 'Y-m-d', - altFormats:'Y-m|Y-n|y-n|y-m|Y-m-d|Y-n-j|y-n-j|y-m-j|y-m-d|y-n-d|Y-n-d|Y-m-j|Ym|Ymd|Yn|Ynj|yn|ynj|ymj|ymd|ynd|Ynd|Ymj|Y/m/d|Y/n/j|y/n/j|y/m/j|y/m/d|y/n/d|Y/n/d|Y/m/j', -// readOnly:true, - listeners : { - specialkey : function(field, e) { - if (e.getKey() == Ext.EventObject.ENTER) { - top.Ext.getCmp('batchNumber1'). collapse(); - var isOK = field.validate(); - if(isOK){ - var value = field.getValue(); - field.setValue(value); - top.Ext.getCmp('cost1').focus(); - top.Ext.getCmp('cost1').selectText(); - } - - } - } - } - },{ - text : '单    价:' - },{ - xtype : 'textfield', - maxLength : '16', - id : 'cost1', - name : 'cost1', - width : 80, - tabIndex : 7, - regex: /^(([1-9]+[0-9]*.{1}[0-9]+)|([0].{1}[1-9]+[0-9]*)|([1-9][0-9]*)|([0][.][0-9]+[1-9]*))$/, - regexText:'只能输入正数', - anchor : '95%', - allowBlank:true, - listeners : { - specialkey : function(field, e) { - if (e.getKey() == Ext.EventObject.ENTER) { - top.Ext.getCmp('batchNumber1'). collapse(); - top.Ext.getCmp('supplier1').focus(); - top.Ext.getCmp('supplier1').selectText(); - } - } - } - },{ - text : '供 应 商:' - },{ - xtype : 'combo', - id : 'supplier1', - name : 'supplier1', - queryParam : 'supplierName', - minChars : 0, - valueField : 'name', - displayField : 'name', - store : supplierStore, - forceSelection : true, - lazyInit : false, - triggerAction : 'all', - hideTrigger : true, - typeAhead : false, - selectOnFocus :true, - allowBlank : true, - width : 190, - tabIndex : 8, - listeners : { - select : function(field, r) { - top.Ext.getCmp('supplierId').setValue(r.data.id); - top.Ext.getCmp('hasInvoice').focus(); - }, - specialKey:function(f,e){ - if (e.getKey() == Ext.EventObject.ENTER) { - if(sstsConfig.godownEntryShowInvoice){ - top.Ext.getCmp('hasInvoice').focus(); - top.Ext.getCmp('hasInvoice').selectText(); - }else{ - top.Ext.getCmp('manufacturer').focus(); - top.Ext.getCmp('manufacturer').selectText(); - } - } - } - } - },{ - text:'有无发票:', - hidden:!sstsConfig.godownEntryShowInvoice - },{ - xtype : 'combo', - id : 'hasInvoice', - name : 'hasInvoice', - minChars : 0, - valueField : 'hasType', - displayField : 'hasType', - mode : 'local', - store : hasTypeStore, - forceSelection : true, - lazyInit : false, - triggerAction : 'all', - hideTrigger : false, - typeAhead : false, - selectOnFocus :true, - allowBlank : true, - editable:false, - width : 80, - tabIndex : 9, - hidden:!sstsConfig.godownEntryShowInvoice, - listeners : { - select : function(field, r) { - top.Ext.getCmp('manufacturer').focus(); - }, - specialKey:function(f,e){ - if (e.getKey() == Ext.EventObject.ENTER) { - top.Ext.getCmp('manufacturer').focus(); - top.Ext.getCmp('manufacturer').selectText(); - } - } - } - }] - }); - tbar.render(top.Ext.getCmp('godownEntryItemGrid').tbar); - - var tbar3 = new top.Ext.Toolbar ({ - items : [{ - text : '生产厂家:' - },{ - xtype : 'combo', - id : 'manufacturer', - name : 'manufacturer', - maxLength : '60', - queryParam : 'supplierName', - minChars : 0, - valueField : 'name', - displayField : 'name', - store : madeCompanyStore, - forceSelection : true, - lazyInit : false, - triggerAction : 'all', - hideTrigger : false, - typeAhead : false, - allowBlank : true, - selectOnFocus :true, - width : 190, - tabIndex : 10, - listeners : { - select : function(field, r) { - top.Ext.getCmp('manufacturerId').setValue(r.data.id); - top.Ext.getCmp('sterileBatchNumber').focus(); - }, - 'keydown' : function(obj, e){ - if (e.getKey() == e.BACKSPACE) {e.stopEvent();} - }, - specialKey:function(f,e){ - var key = e.getKey(); - if (key == Ext.EventObject.ENTER) { - top.Ext.getCmp('sterileBatchNumber').focus(); - top.Ext.getCmp('sterileBatchNumber').selectText(); - } - } - } - },{ - text : '灭菌批号:' - },{ - xtype : 'textfield', - id : 'sterileBatchNumber', - name : 'sterileBatchNumber', - width : 80, - tabIndex : 11, - anchor : '95%', - allowBlank:true, - listeners : { - specialkey : function(field, e) { - if (e.getKey() == Ext.EventObject.ENTER) { - top.Ext.getCmp('certification').focus(); - top.Ext.getCmp('certification').selectText(); - } - } - } - },{ - text : '注册证号:' - },{ - xtype : 'textfield', - id : 'certification', - name : 'certification', - width : 190, - tabIndex : 12, - allowBlank:true, - anchor : '100%', - listeners : { - specialkey : function(field, e) { - var key = e.getKey(); - if (key == Ext.EventObject.ENTER) { - addGodown(); - top.Ext.getCmp('name1').focus(); - top.Ext.getCmp('name1').selectText(); - } - } - } - },{ - text : '类别:' - },{ - xtype : 'combo', - id : 'grade', - name : 'grade', - minChars : 0, - valueField : 'name', - displayField : 'name', - mode : 'local', - triggerAction : 'all', - store : gradeStore, - forceSelection : false, - allowBlank : true, - editable:false, - width : 60 - },{ - text:'标签合格', - hidden:!sstsConfig.godownEntryShowQualified - },{ - xtype : 'combo', - id : 'qualifiedLabel', - name : 'qualifiedLabel', - minChars : 0, - valueField : 'qualifiedType', - displayField : 'qualifiedType', - mode : 'local', - store : qualifiedStore, - forceSelection : true, - lazyInit : false, - triggerAction : 'all', - hideTrigger : false, - typeAhead : false, - selectOnFocus :true, - allowBlank : true, - editable:false, - width : 40, - tabIndex : 9, - hidden:!sstsConfig.godownEntryShowQualified, - listeners : { - render : function(field, e){ - if(sstsConfig.godownEntryShowQualified){ - field.setValue(HAS_TYPE_PASS); - } - } - } - },{ - text:'验收合格', - hidden:!sstsConfig.godownEntryShowQualified - },{ - xtype : 'combo', - id : 'qualifiedCheck', - name : 'qualifiedCheck', - minChars : 0, - valueField : 'qualifiedType', - displayField : 'qualifiedType', - mode : 'local', - store : qualifiedStore, - forceSelection : true, - lazyInit : false, - triggerAction : 'all', - hideTrigger : false, - typeAhead : false, - selectOnFocus :true, - allowBlank : true, - editable:false, - width : 40, - tabIndex : 9, - hidden:!sstsConfig.godownEntryShowQualified, - listeners : { - render : function(field, e){ - if(sstsConfig.godownEntryShowQualified){ - field.setValue(HAS_TYPE_PASS); - } - } - - } - },{ - text : '添加', - iconCls : 'btn_ext_add', - id:'addBtn', - hidden : commonEntry.isOpen(), - handler : function() { - addGodown(); - top.Ext.getCmp('name1').focus(); - top.Ext.getCmp('name1').selectText(); - } - }] - }); - tbar3.render(top.Ext.getCmp('godownEntryItemGrid').tbar); - } - } - })], - buttons : [ - { - text : '修改物品', - hidden : !commonEntry.isOpen(), - handler : function() { - var store = top.Ext.getCmp('godownEntryItemGrid').getStore(); - var modifyRecords = store.getModifiedRecords(); - var len = modifyRecords.length; - if(len==0){ - showResult("请先修改物品"); - return; - } - var items = []; - for (var i = 0; i < len; i++) { - var record = modifyRecords[i]; - items.push({ - id : record.data.id,//入库明细id - disposableGoodsID : record.data.disposableGoodsID,//一次性物品定义id - batchID : record.data.disposableGoodsBatchID,//批次id - batchNumber : record.data.batchNumber,//批次号 - expDate : record.data.expDate.format('Y-m-d'),//失效期 - supplierName : record.data.supplierName,//供应商 - supplierId : record.data.supplierId,//供应商id - sterileBatchNumber : record.data.sterileBatchNumber,//灭菌批号 - manufacturer : record.data.manufacturer,//生产厂家 - manufacturerId : record.data.manufacturerId,//生产厂家id - producingArea : record.data.producingArea,//产地 - certification : record.data.certification,//注册证号 - grade : record.data.grade//类别 - }); - } - top.Ext.getCmp("items").setValue(JSON.stringify(items)); - form.form.submit({ - url : WWWROOT + '/disinfectSystem/godownEntryAction!modifyGodownEntryItemBaseData.do', - method : 'POST', - waitMsg : '正在保存数据,请稍候', - waitTitle : '提交表单', - success : function(form, action) { - if(!isUndefinedOrNullOrEmpty(action.result.message)){ - showResult(action.result.message); - return; - } - godownEntryWin.close(); - grid.dwrReload(); - }, - failure : function(form, action) { - alert(action.result.message); - } - }); - } - },{ - text : '保存核对人', - hidden: verifierUpdateButton || !sstsConfig.showDisposableGoodsGodownEntryVerifier||(commonEntry.isOpen()?false:true), - handler : function(){ - var supplyRoomVerifier = top.Ext.getCmp('supplyRoomVerifier').getValue();//供应室核对员 - var equipmentVerifier = top.Ext.getCmp('equipmentVerifier').getValue();//设备科核对员 - if(isUndefinedOrNullOrEmpty(equipmentVerifier)){ - showResult('设备科核对员不能为空!'); - return false; - }; - if(isUndefinedOrNullOrEmpty(supplyRoomVerifier)){ - showResult('供应室核对员不能为空!'); - return false; - }; - // 设置表单参数json - setFormParams(form,['id','equipmentVerifier','supplyRoomVerifier']); - form.form.submit({ - url : WWWROOT + '/disinfectSystem/godownEntryAction!saveGodownEntryVerifier.do', - method : 'POST', - waitMsg : '正在保存数据,请稍候', - waitTitle : '提交表单', - success : function(form, action) { - showResult(action.result.message); - godownEntryWin.close(); - grid.dwrReload(); - }, - failure : function(form, action) { - alert(action.result.message); - } - }); - } - },{ - text : '打印新批次', - hidden : commonEntry.isOpen() ? false:true, - handler : function(){ - var ids = top.Ext.getCmp("id").getValue(); - godownEntryWin.close(); - grid.dwrReload(); - commonEntry.printGodownEntryNewBatch(ids); - } - },{ - text : '选择打印', - handler : function() { - if(!form.getForm().isValid()){ - showResult('请正确填写表单各值'); - return false; - } - var items = []; - var records = top.Ext.getCmp('godownEntryItemGrid').getSelectionModel().getSelections(); - if (records.length == 0) { - showResult("请选择要打印的一次性物品!"); - return false; - } - - for ( var i = 0, len = records.length; i < len; i++) { - if(isUndefinedOrNullOrEmpty(records[i].data.id)){ - showResult(records[i].data.name + "未保存!请先保存再打印"); - return false; - } - items.push(records[i].data); - } - top.Ext.getCmp("items").setValue(JSON.stringify(items)); - form.form.submit({ - url : WWWROOT + '/disinfectSystem/godownEntryAction!printSomeGodownEntryItem.do', - method : 'POST', - waitMsg : '正在保存数据,请稍候', - waitTitle : '提交表单', - success : function(form, action) { - if(!isUndefinedOrNullOrEmpty(action.result.errorMessage)){ - showResult(action.result.errorMessage); - return; - } - Ext.getCmp("formSubmitResult").setValue(formSubmitResultSucc); - godownEntryWin.close(); - grid.dwrReload(); - //打印条码 - commonEntry.printBarcode(action.result.items,false); - - }, - failure : function(form, action) { - showResult(action.failureType); - Ext.getCmp("formSubmitResult").setValue(formSubmitResultFail); - } - }); - } - },{ - text : '保存并打印新标签', - hidden:saveButton || (commonEntry.isOpen() ? true:false), - handler : function() { - if(!form.getForm().isValid()){ - showResult('请正确填写表单各值'); - return false; - } - /*var name = top.Ext.getCmp('name1').getValue(); - if(name.length==0){ - showResult('请填写物品名称!'); - return false; - } - var count = top.Ext.getCmp('amount1').getValue(); - if(count.length==0){ - showResult('请填写物品数量!'); - return false; - } - var cost = top.Ext.getCmp('cost1').getValue(); - if(cost.length==0){ - showResult('请填写物品价格!'); - return false; - } - var batchNumber = top.Ext.getCmp('batchNumber1').getRawValue(); - if(batchNumber.length==0){ - showResult('请填写物品批次号!'); - return false; - }*/ - var items = buildJSONStringFromStore(top.Ext.getCmp('godownEntryItemGrid').getStore()); - top.Ext.getCmp("items").setValue(items); - // items为json数组字符串,不会为null - if(items == '[]'){ - showResult('请正确填写表单各值'); - return false; - } - form.form.submit({ - url : WWWROOT + '/disinfectSystem/godownEntryAction!saveGodownEntry.do', - method : 'POST', - params : {print : true}, - waitMsg : '正在保存数据,请稍候', - waitTitle : '提交表单', - success : function(form, action) { - Ext.getCmp("formSubmitResult").setValue(formSubmitResultSucc); - //保存返回的结果 - entryItemJsonArray = action.result.items; - showResult(action.result.message); - godownEntryWin.close(); - grid.dwrReload(); - - //打印条码 - commonEntry.printBarcode(entryItemJsonArray,true); - - }, - failure : function(form, action) { - showResult(action.result.message); - Ext.getCmp("formSubmitResult").setValue(formSubmitResultFail); - } - }); - } - },{ - text : '保存', - hidden:saveButton || (commonEntry.isOpen()?true:false), - handler : function() { - if(!form.getForm().isValid()){ - showResult('请正确填写表单各值'); - return false; - } - var name = top.Ext.getCmp('name1').getValue(); - /*if(name.length==0){ - showResult('请填写物品名称!'); - return false; - } - var count = top.Ext.getCmp('amount1').getValue(); - if(count.length==0){ - showResult('请填写物品数量!'); - return false; - } - var cost = top.Ext.getCmp('cost1').getValue(); - if(cost.length==0){ - showResult('请填写物品价格!'); - return false; - } - var batchNumber = top.Ext.getCmp('batchNumber1').getRawValue(); - if(batchNumber.length==0){ - showResult('请填写物品批次号!'); - return false; - }*/ - //var items = buildJSONStringFromStore(top.Ext.getCmp('godownEntryItemGrid').getStore()); -// var store = top.Ext.getCmp('godownEntryItemGrid').getStore(); -// var len = store.getCount(); -// for (var i = 0; i < len; i++) { -// var record = store.getAt(i); -// var expDate = record.data.expDate; -// //若是修改入库单失效日期则需要.format('Y-m-d')防止失效期不正确 -// expDate=expDate.format('Y-m-d'); -// store.getAt(i).set("expDate", expDate); -// }; -// var items = buildJSONStringFromStore(store); - var store = top.Ext.getCmp('godownEntryItemGrid').getStore(); - var len = store.getCount(); - var items = []; - for (var i = 0; i < len; i++) { - var record = store.getAt(i); -// console.log(record); - items.push({ - amount : record.data.amount, - batchID : record.data.batchID, - batchNumber : record.data.batchNumber, - certification : record.data.certification , - cost : record.data.cost, - disposableGoodsID : record.data.disposableGoodsID, - expDate : record.data.expDate.format('Y-m-d'), - grade : record.data.grade, - hasBiologicalTestReport : record.data.hasBiologicalTestReport, - hasInvoice : record.data.hasInvoice, - id : record.data.id, - identification : record.data.identification, - identificationID : record.data.identificationID, - localID: record.data.localID, - manufacturer : record.data.manufacturer, - name :record.data.name, - producingArea : record.data.producingArea, - sterileBatchNumber : record.data.sterileBatchNumber, - supplierName : record.data.supplierName, - supplierId : record.data.supplierId, - manufacturerId : record.data.manufacturerId, - qualifiedLabel : record.data.qualifiedLabel, - qualifiedCheck : record.data.qualifiedCheck, - totalPrice: record.data.totalPrice - }); -// console.log(items); - } - // 设置表单参数json - setFormParams(form,['id','remark','time','warehouseName','warehouseID']); -// top.Ext.getCmp("items").setValue(items); - top.Ext.getCmp("items").setValue(JSON.stringify(items)); - // items为json数组字符串,不会为null - if(items.length == 0){ - showResult('请正确填写表单各值'); - return false; - } -// console.log(items); - form.form.submit({ - url : WWWROOT + '/disinfectSystem/godownEntryAction!saveGodownEntry.do', - method : 'POST', - waitMsg : '正在保存数据,请稍候', - waitTitle : '提交表单', - success : function(form, action) { - showResult(action.result.message); - Ext.getCmp("formSubmitResult").setValue(formSubmitResultSucc); - godownEntryWin.close(); - grid.dwrReload(); - var barcodeStr = action.result.barcode; - var tableHtml = ""; - if(barcodeStr != null){ - var barcodeArray = barcodeStr.split(";"); - for(var i = 0;i < barcodeArray.length;i++){ - var items = barcodeArray[i].split("#&"); - var name = items[0]; - var barcode = items[2]; - var expDate = items[3]; - var supplierName = items[4]; - var batchNumber = items[5]; - var specification = items[6]; - tableHtml += ""+name+""+specification+""+ - batchNumber+""+barcode+""+expDate+""; - } - } - if(tableHtml.length > 0){ - var title = ""+tableHtml+"
名称规格批次条码失效期
"; - top.Ext.MessageBox.alert("已入库物品清单", title); - } - - }, - failure : function(form, action) { - showResult(action.result.message); - Ext.getCmp("formSubmitResult").setValue(formSubmitResultFail); - } - }); - } - },{ - text : '取消', - handler : function() { - godownEntryWin.close(); - } - }] - }); - - var godownEntryWin = new top.Ext.Window( { - id : 'recyclingApplicationWin', - layout : 'fit', - title : '入库单信息', - width : 1020, - height :570, - modal : true, -// autoHeight : true, - border :false, - plain : true, - items : [ form ] - }); - godownEntryWin.show(); - top.Ext.getCmp('name1').focus(false, 100); -} //添加 function addGodown(){ if(!top.Ext.getCmp('godownEntryForm').form.isValid()){ @@ -1916,7 +670,7 @@ var supplierName = top.Ext.getCmp('supplier1').getRawValue(); var sterileBatchNumber = top.Ext.getCmp('sterileBatchNumber').getRawValue(); var manufacturer = top.Ext.getCmp('manufacturer').getRawValue(); - var certification = top.Ext.getCmp('certification').getRawValue(); + var certification = top.Ext.getCmp('certification1').getRawValue();//注册证号 if(isUndefinedOrNullOrEmpty(supplierName)){ top.Ext.getCmp('supplierId').setValue(''); } Index: ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/goodPurchasePlanFrom.js =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/goodPurchasePlanFrom.js (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/goodPurchasePlanFrom.js (revision 23512) @@ -0,0 +1,937 @@ +/** + *goodPurchaseForm采购计划表单 + * @param id + */ +function addGoodPurchasePlan(id) { + var form = new top.Ext.FormPanel({ + id : 'goodPurchaseForm', + frame : true, + labelSeparator : ':', + bodyStyle : 'padding:5px 5px 0px 5px', + width : 850, + autoScroll : true, + labelAlign : 'left', + items:[{ + layout : 'column', + items : [{ + xtype : 'hidden', + name : 'id', + id : 'id' + },{ + xtype : 'hidden', + name : 'items', + id : 'items' + },{ + xtype : 'hidden', + name : 'originalItems', + id : 'originalItems' + },{ + xtype : 'hidden', + name : 'formParams', + id : 'formParams' + },{ + xtype : 'hidden', + name : 'originalFormParams', + id : 'originalFormParams' + },{ + id : 'serialNum', + columnWidth : .25, + layout : 'form', + labelWidth : 40, + hidden:true, + items : [{ + xtype : 'textfield', + fieldLabel : '单号', + maxLength : '41', + id : 'serialNumber', + name : 'serialNumber', + cls : 'fieldReadOnlyNoRemove', + allowBlank : true, + readOnly : true, + anchor : '95%' + }] + }, { + columnWidth : .25, + layout : 'form', + labelWidth : 60, + items : [{ + xtype : 'textfield', + fieldLabel : '操作员', + maxLength : '50', + id : 'operator', + name : 'operator', + allowBlank : false, + readOnly : true, + cls : 'fieldReadOnlyNoRemove', + value : $Id('userName').value, + anchor : '95%' + }] + }, { + columnWidth : .25, + layout : 'form', + labelWidth : 60, + items : [{ + xtype : 'datefieldWithMin', + fieldLabel : '操作时间', + id : 'time', + name : 'time', + format : 'Y-m-d H:i', +// value : new Date(), + allowBlank : false, + anchor : '95%', + listeners : { + render : function() { + setStartDate(top.Ext, 'yyyy/MM/dd HH:mm', 'time'); //(操作时间,取服务器时间 cjr) + } + } + }] + },{ + + columnWidth : .25, + layout : 'form', + labelWidth : 80, + items : [{ + xtype : 'textfield', + fieldLabel : '总金额', + id : 'totalPrice', + name : 'totalPrice', + readOnly:true, + cls : 'fieldReadOnlyNoRemove', + anchor : '95%' + }] + + }, { + columnWidth : 1, + layout : 'form', + labelWidth : 40, + items : [{ + xtype : 'textarea', + fieldLabel : '备注', + height : 50, + id : 'remark', + name : 'remark', + maxLength : 665, + allowBlank : true, + anchor : '100%' + }] + }] + },new top.Ext.grid.EditorGridPanel({ + id : 'goodPurchaseItemGrid', + bodyStyle : 'border:1px solid #afd7af', + frame :false, + height : 390, + store : new top.Ext.data.Store({ + reader : new top.Ext.data.JsonReader({ + fields : [ + {name : 'id'}, + {name : 'departName'}, + {name : 'departCoding'}, + {name : 'name'}, + {name : 'unit'}, + {name : 'specification'}, + + {name : 'lastConsuption'}, + {name : 'stockQuantity'}, + {name : 'scheduleAmount'}, + {name : 'purchase'}, + {name : 'totalPrice'}, + {name : 'manufacturer'}, + {name : 'supplierName'}, + {name : 'deleteButton'}, + {name : 'disposableGoodsId'}, + {name : 'materialDefinitionId'}, + {name : 'manufacturerId'}, + {name : 'supplierId'} + ] + }) + }), + cm : new top.Ext.grid.ColumnModel([new Ext.grid.RowNumberer(), + {header : "id",dataIndex : 'id',hidden : true}, + {header : "科室",dataIndex : 'departName',width : 80,menuDisabled : true}, + {header : "编码",dataIndex : 'departCoding',width : 60,menuDisabled : true}, + {header : "名称",dataIndex : 'name',width : 200,menuDisabled : true}, + {header : "规格",dataIndex : 'specification',width : 90,menuDisabled : true}, + {header : "单位",dataIndex : 'unit',width : 50,menuDisabled : true}, + {header : "上期消耗量",dataIndex : 'lastConsuption',width : 80,menuDisabled : true, + editor : new top.Ext.form.TextField({ + regex: /^\d+$/, + regexText:'只能输入数字', + allowBlank : false + }) + }, + {header : "库存数量",width : 70,dataIndex : 'stockQuantity',menuDisabled : true}, + {header : "计划数",width : 60,dataIndex : 'scheduleAmount',menuDisabled : true, + editor : new top.Ext.form.TextField({ + regex: /^\d+$/, + regexText:'只能输入数字', + allowBlank : false, + listeners:{ + change :function(field,newVal,oldVal){ + var grid = top.Ext.getCmp('goodPurchaseItemGrid'); + setTotalMoney(grid); + } + } + }) + }, + {header : "进价",dataIndex : 'purchase',width : 70,menuDisabled : true, + editor : new top.Ext.form.TextField({ + regex: /^(([1-9]+[0-9]*.{1}[0-9]+)|([0].{1}[1-9]+[0-9]*)|([1-9][0-9]*)|([0][.][0-9]+[1-9]*))$/, + regexText:'只能输入正数', + allowBlank : false, + listeners:{ + change :function(field,newVal,oldVal){ + var grid = top.Ext.getCmp('goodPurchaseItemGrid'); + setTotalMoney(grid); + } + } + }) + }, + {header : "金额",width : 80,menuDisabled : true,dataIndex : 'totalPrice', renderer:renderTotalPrice}, + {header : "供应商",width : 150,dataIndex : 'supplierName',menuDisabled : true + /* ,editor : new top.Ext.form.ComboBox({ + queryParam : 'supplierName', + minChars : 0, + valueField : 'id', + displayField : 'name', + store : supplierNeedVerifyStore, + forceSelection : true, + lazyInit : false, + triggerAction : 'all', + hideTrigger : true, + typeAhead : false, + allowBlank : true, + width : 100, + listeners : { + focus : function(thiz){ + thiz.store.reload(); + }, + select : function(combo, record, index) { + combo.setValue(record.data.name); + selectedRecord = top.Ext.getCmp('goodPurchaseItemGrid').getSelectionModel().getSelections()[0]; + selectedRecord.set("supplierId",record.data.id); + } + } + })*/ + }, + {header : "生产商",width : 150,dataIndex : 'manufacturer',menuDisabled : true +/* ,editor : new top.Ext.form.ComboBox({ + queryParam : 'supplierName', + minChars : 0, + valueField : 'id', + displayField : 'name', + store : madeCompanyNeedVerifyStore, + forceSelection : true, + lazyInit : false, + triggerAction : 'all', + hideTrigger : true, + typeAhead : false, + allowBlank : true, + width : 100, + listeners : { + focus : function(thiz){ + thiz.store.reload(); + }, + select : function(combo, record, index) { + combo.setValue(record.data.name); + selectedRecord = top.Ext.getCmp('goodPurchaseItemGrid').getSelectionModel().getSelections()[0]; + selectedRecord.set("manufacturerId",record.data.id); + } + } + })*/ + }, + {header : "删除",width : 70,menuDisabled : true,dataIndex : 'deleteButton', renderer:renderDeleteButton} + ]), + width :983, + selModel : new top.Ext.grid.RowSelectionModel({ + singleSelect : false + }), + tbar : [{ + xtype : 'hidden', + name : 'disposableGoodsId', + id : 'disposableGoodsId' + },{ + xtype : 'hidden', + name : 'materialDefinitionId', + id : 'materialDefinitionId' + },{ + xtype : 'hidden', + name : 'barcode', + id : 'barcode' + },{ + xtype : 'hidden', + name : 'supplierId', + id : 'supplierId' + },{ + xtype : 'hidden', + name : 'manufacturerId', + id : 'manufacturerId' + },{ + text : '  物品名称:' + },{ + xtype : 'combo', + id : 'name1', + name : 'name1', + queryParam : 'spell', + minChars : 0, + valueField : 'name', + displayField : 'name', + store : disposableGoodsAndMaterialStore, + forceSelection : true, + lazyInit : false, + triggerAction : 'all', + hideTrigger : true, + typeAhead : false, + allowBlank : true, + width : 270, + tabIndex : 1, + selectOnFocus : true, + listeners : { + select : function(combo, record, index) { + top.Ext.getCmp('name1').setValue(record.data.name); + top.Ext.getCmp('name1').selectText(); + var disposableGoodsId = record.data.disposableGoodsId; + var materialDefinitionId = record.data.materialDefinitionId; + + //加载相关的信息 + /*DiposableGoodsTableManager.getDiposableGoodsInfoForGoodPurchase(record.data.id,function(result){ + if(result != ""){ + var array = result.split("#;"); + top.Ext.getCmp('stockQuantity').setValue(array[0]); + top.Ext.getCmp('specification1').setValue(array[1]); + top.Ext.getCmp('unit1').setValue(array[2]); + top.Ext.getCmp('supplier1').setValue(array[3]); + top.Ext.getCmp('manufacturer').setValue(array[4]); + } + });*/ + + if(disposableGoodsId){ + top.Ext.getCmp('materialDefinitionId').setValue(""); + top.Ext.getCmp('disposableGoodsId').setValue(disposableGoodsId); + top.Ext.getCmp('purchase').setValue(record.data.referencePrice); + //选择物品后自动带出上一次录入的数据,增加进价 + GoodPurchaseTableManager.getLastGoodPurchaseItemByDisposableGoodsId(disposableGoodsId,function(result){ + if(result && result != ""){ + var lastGoodPurchaseItem = Ext.decode(result); + top.Ext.getCmp('stockQuantity').setValue(lastGoodPurchaseItem.stockQuantity); + top.Ext.getCmp('specification1').setValue(lastGoodPurchaseItem.specification1); + top.Ext.getCmp('purchase').setValue(lastGoodPurchaseItem.purchase); + top.Ext.getCmp('unit1').setValue(lastGoodPurchaseItem.unit1); + top.Ext.getCmp('supplierId').setValue(lastGoodPurchaseItem.supplierId); + top.Ext.getCmp('supplier1').setValue(lastGoodPurchaseItem.supplier1); + top.Ext.getCmp('manufacturerId').setValue(lastGoodPurchaseItem.manufacturerId); + top.Ext.getCmp('manufacturer').setValue(lastGoodPurchaseItem.manufacturer); + } + }); + }else if(materialDefinitionId){ + top.Ext.getCmp('disposableGoodsId').setValue(""); + top.Ext.getCmp('materialDefinitionId').setValue(materialDefinitionId); + //选择物品后自动带出上一次录入的数据,增加进价 + GoodPurchaseTableManager.getLastGoodPurchaseItemByMaterialDefinitionId(materialDefinitionId,function(result){ + if(result && result != ""){ + var lastGoodPurchaseItem = Ext.decode(result); + top.Ext.getCmp('stockQuantity').setValue(lastGoodPurchaseItem.stockQuantity); + top.Ext.getCmp('specification1').setValue(lastGoodPurchaseItem.specification1); + top.Ext.getCmp('purchase').setValue(lastGoodPurchaseItem.purchase); + top.Ext.getCmp('unit1').setValue(lastGoodPurchaseItem.unit1); + top.Ext.getCmp('supplier1').setValue(lastGoodPurchaseItem.supplier1); + top.Ext.getCmp('manufacturer').setValue(lastGoodPurchaseItem.manufacturer); + top.Ext.getCmp('supplierId').setValue(lastGoodPurchaseItem.supplierId); + top.Ext.getCmp('manufacturerId').setValue(lastGoodPurchaseItem.manufacturerId); + } + }); + } + //配置godownEntryNeedVerify为true:则需要刷新供应商,生产厂家stroe + if(sstsConfig.godownEntryNeedVerify){ + supplierStore.load(); + madeCompanyStore.load(); + } + top.Ext.getCmp('amount1').focus(); + top.Ext.getCmp('amount1').selectText(); + }, + specialkey : function(field, ee) { + if (ee.getKey() == Ext.EventObject.ENTER) { + focusTo('amount1'); + } + } + } + },{ + text : '数  量:' + },{ + xtype : 'textfield', + maxLength : '16', + id : 'amount1', + name : 'amount1', + allowBlank:true, + width : 100, + regex: /^\d+$/, + regexText:'只能输入整数', + anchor : '95%', + tabIndex : 2, + listeners : { + specialkey : function(field, e) { + if (e.getKey() == Ext.EventObject.ENTER) { + focusTo('unit1'); + } + } + } + },{ + text : '规  格:' + },{ + xtype : 'textfield', + allowBlank:true, + id : 'specification1', + name : 'specification1', + maxLength : '30', + width : 150, + tabIndex : 4, + anchor : '95%', + listeners : { + specialkey : function(field, ee) { + if (ee.getKey() == Ext.EventObject.ENTER) { + focusTo('lastConsumption1'); + } + } + } + }], + listeners: { + render : function() { + var tbar = new top.Ext.Toolbar ({ + items : [{ + text : '上期消耗量:' + },{ + xtype : 'textfield', + maxLength : '16', + id : 'lastConsumption1', + name : 'lastConsumption1', + allowBlank:true, + width : 100, + regex: /^\d+$/, + regexText:'只能输入整数', + anchor : '95%', + tabIndex : 5, + listeners : { + specialkey : function(field, e) { + if (e.getKey() == Ext.EventObject.ENTER) { + focusTo('stockQuantity'); + } + } + } + },{ + text : '库存数量:' + },{ + xtype : 'textfield', + maxLength : '16', + id : 'stockQuantity', + name : 'stockQuantity', + allowBlank:true, + width : 108, + regex: /^\d+$/, + regexText:'只能输入整数', + anchor : '95%', + tabIndex : 6, + listeners : { + specialkey : function(field, e) { + if (e.getKey() == Ext.EventObject.ENTER) { + focusTo('purchase'); + } + } + } + },{ + text:'进  价:' + },{ + xtype : 'textfield', + maxLength : '16', + id : 'purchase', + name : 'purchase', + width : 100, + tabIndex : 7, + regex: /^(([1-9]+[0-9]*.{1}[0-9]+)|([0].{1}[1-9]+[0-9]*)|([1-9][0-9]*)|([0][.][0-9]+[1-9]*))$/, + regexText:'只能输入正数', + anchor : '95%', + allowBlank:true, + listeners : { + specialkey : function(field, e) { + if (e.getKey() == Ext.EventObject.ENTER) { + focusTo('supplier1'); + } + } + } + },{ + text : '单  位:' + },{ + xtype : 'textfield', + allowBlank:true, + id : 'unit1', + name : 'unit1', + maxLength : '30', + width : 150, + tabIndex : 3, + anchor : '95%', + listeners : { + specialkey : function(field, ee) { + if (ee.getKey() == Ext.EventObject.ENTER) { + focusTo('specification1'); + } + } + } + }] + }); + tbar.render(top.Ext.getCmp('goodPurchaseItemGrid').tbar); + + var tbar3 = new top.Ext.Toolbar ({ + items : [{ + text : '  供 应 商:' + },{ + xtype : 'combo', + id : 'supplier1', + name : 'supplier1', + queryParam : 'supplierName', + minChars : 0, + valueField : 'name', + displayField : 'name', + store : supplierStore, + forceSelection : true, + lazyInit : false, + triggerAction : 'all', + hideTrigger : true, + typeAhead : false, + selectOnFocus :true, + allowBlank : true, + width : 270, + tabIndex : 8, + listeners : { + select : function(field, r) { + top.Ext.getCmp('supplierId').setValue(r.data.id); + //配置godownEntryNeedVerify为true:则需要刷新生产厂家stroe + if(sstsConfig.godownEntryNeedVerify){ + madeCompanyStore.load(); + } + focusTo('manufacturer'); + }, + specialKey:function(f,e){ + if (e.getKey() == Ext.EventObject.ENTER) { + focusTo('manufacturer'); + } + } + } + },{ + text : '生产商:' + },{ + xtype : 'combo', + id : 'manufacturer', + name : 'manufacturer', + maxLength : '60', + queryParam : 'supplierName', + minChars : 0, + valueField : 'name', + displayField : 'name', + store : madeCompanyStore, + forceSelection : true, + lazyInit : false, + triggerAction : 'all', + hideTrigger : false, + typeAhead : false, + allowBlank : true, + selectOnFocus :true, + editable:true, + width : 300, + tabIndex : 9, + listeners : { + select : function(field, r) { + top.Ext.getCmp('manufacturerId').setValue(r.data.id); + //配置godownEntryNeedVerify为true:则需要刷新供应商stroe + if(sstsConfig.godownEntryNeedVerify){ + supplierStore.load(); + } + }, + 'keydown' : function(obj, e){ + if (e.getKey() == e.BACKSPACE) {e.stopEvent();} + } + } + },{ + text : '添加', + iconCls : 'btn_ext_add', + id:'addBtn', + handler : function() { + if(addPurchaseGoods() == true){ + focusTo('name1'); + } + } + }] + }); + tbar3.render(top.Ext.getCmp('goodPurchaseItemGrid').tbar); + } + } + })], + buttons : [{ + text : '打印预览', + hidden: (id == ""?true:false), + handler : function() { + printGoodPurchasePlan(id, 1); + } + },{ + text : '打印', + hidden: (id == ""?true:false), + handler : function() { + printGoodPurchasePlan(id, 0) + } + },{ + text : '保存', + hidden :saveButton || (id == ""?false:true), + handler : function() { + if(!form.getForm().isValid()){ + showResult('请正确填写表单各值'); + return false; + } + var name = top.Ext.getCmp('name1').getValue(); + + var items = buildJSONStringFromStore(top.Ext.getCmp('goodPurchaseItemGrid').getStore()); + // console.log(items); + // 设置表单参数json + setFormParams(form,['id','remark','time']); + top.Ext.getCmp("items").setValue(items); + + // items为json数组字符串,不会为null + if(items == '[]'){ + showResult('请正确填写表单各值'); + return false; + } + form.form.submit({ + url : WWWROOT + '/disinfectSystem/goodPurchaseAction!saveGoodPurchasePlan.do', + method : 'POST', + waitMsg : '正在保存数据,请稍候', + waitTitle : '提交表单', + success : function(form, action) { + showResult(action.result.message); + grid.dwrReload(); + window.close(); + }, + failure : function(form, action) { + showResult(action.result.message); + } + }); + } + },{ + text : '修改', + hidden: saveButton || (id == ""?true:false), + handler : function() { + if(!form.getForm().isValid()){ + showResult('请正确填写表单各值'); + return false; + } + //若godownEntryNeedVerify 为 true 则需要进行一次性物品的供应商,生产厂家校验 + if(sstsConfig.godownEntryNeedVerify){ + var store = top.Ext.getCmp('goodPurchaseItemGrid').getStore(); + var modifyRecords = store.getModifiedRecords(); + var len = modifyRecords.length; +// console.log(modifyRecords); + if(len > 0){ + for (var i = 0; i < len; i++) { + var record = modifyRecords[i]; + var disposableGoodsId = record.data.disposableGoodsId; + //若是一次性物品则需要校验 + if(!isUndefinedOrNullOrEmpty(disposableGoodsId)){ + var supplierId = record.data.supplierId; + var manufacturerId = record.data.manufacturerId; + //检查物品相关证件是否过期 + if(!checkGoodsValidityTime(disposableGoodsId,supplierId,manufacturerId)){ + return false; + } + } + } + } + } + var name = top.Ext.getCmp('name1').getValue(); + var items = buildJSONStringFromStore(top.Ext.getCmp('goodPurchaseItemGrid').getStore()); + // console.log(items); + // 设置表单参数json + setFormParams(form,['id','remark','time']); + top.Ext.getCmp("items").setValue(items); + // items为json数组字符串,不会为null + if(items == '[]'){ + showResult('请正确填写表单各值'); + return false; + } + form.form.submit({ + url : WWWROOT + '/disinfectSystem/goodPurchaseAction!saveGoodPurchasePlan.do', + method : 'POST', + waitMsg : '正在保存数据,请稍候', + waitTitle : '提交表单', + success : function(form, action) { + showResult(action.result.message); + grid.dwrReload(); + window.close(); + }, + failure : function(form, action) { + showResult(action.result.message); + } + }); + } + },{ + text : '取消', + handler : function() { + window.close(); + } + }] + }); + + var window = new top.Ext.Window( { + id : 'recyclingApplicationWin', + layout : 'fit', + title : '采购单信息', + width : 1020, + height :550, + modal : true, +// autoHeight : true, + border :false, + plain : true, + items : [ form ] + }); + window.show(); + top.Ext.getCmp('name1').focus(false, 100); +} + +//添加 +function addPurchaseGoods(){ + if(!validateForm()){ + return false; + } + /*if(!top.Ext.getCmp('goodPurchaseForm').form.isValid()){ + showResult('请正确填写表单各值'); + return false; + }*/ + var disposableGoodsId = top.Ext.getCmp('disposableGoodsId').getValue();//一次性物品id + var materialDefinitionId = top.Ext.getCmp('materialDefinitionId').getValue();//材料id + var supplierId = top.Ext.getCmp('supplierId').getValue(); + var manufacturerId = top.Ext.getCmp('manufacturerId').getValue(); + var name = top.Ext.getCmp('name1').getValue(); + /*if(name.length==0){ + showResult('请填写物品名称!'); + top.Ext.getCmp('name1').focus(false,100); + return false; + }*/ + var scheduleAmount = top.Ext.getCmp('amount1').getValue(); + /*if(scheduleAmount.length==0){ + showResult('请填写物品数量!'); + top.Ext.getCmp('amount1').focus(false,100); + return false; + }*/ + var unit = top.Ext.getCmp('unit1').getValue(); + /*if(unit.length==0){ + showResult('请填写物品单位!'); + top.Ext.getCmp('unit1').focus(false,100); + return false; + }*/ + var specification = top.Ext.getCmp('specification1').getValue(); + /*if(specification.length==0){ + showResult('请填写物品规格!'); + top.Ext.getCmp('specification1').focus(false,100); + return false; + }*/ + var purchase = top.Ext.getCmp('purchase').getValue(); + /*if(purchase.length==0){ + showResult('请填写物品进价!'); + top.Ext.getCmp('purchase').focus(false,100); + return false; + }*/ + + var supplierName = top.Ext.getCmp('supplier1').getValue(); + var manufacturer = top.Ext.getCmp('manufacturer').getRawValue(); + var stockQuantity = top.Ext.getCmp('stockQuantity').getRawValue(); + var departName = $Id('departName').value; + var departCoding = $Id('departCoding').value; + var lastConsuption = top.Ext.getCmp('lastConsumption1').getValue(); + //alert(departName + " " + departCoding); + return addItems(departName,departCoding,name,unit,specification,lastConsuption, + stockQuantity,scheduleAmount,purchase,manufacturer,supplierName,disposableGoodsId,materialDefinitionId,supplierId,manufacturerId); +} + +function addItems(departName,departCoding,name,unit,specification,lastConsuption, + stockQuantity,scheduleAmount,purchase,manufacturer,supplierName,disposableGoodsId,materialDefinitionId,supplierId,manufacturerId){ + for(var i = 0;i < top.Ext.getCmp('goodPurchaseItemGrid').getStore().getCount();i++){ + if(top.Ext.getCmp('goodPurchaseItemGrid').getStore().getAt(i).data.name == name){ + showResult("该物品已经存在,不能重复添加!"); + return false; + } + } + var lastConsuptionNum = Ext.num(parseInt(lastConsuption),0) + if(isNaN(lastConsuptionNum)){ + lastConsuptionNum = ''; + } + + var stockQuantityNum = Ext.num(parseInt(stockQuantity),0) + if(isNaN(stockQuantityNum)){ + stockQuantityNum = ''; + } + + var scheduleAmountNum = Ext.num(parseInt(scheduleAmount),0) + if(isNaN(scheduleAmountNum)){ + scheduleAmountNum = ''; + } + + var purchaseNum = Ext.num(parseFloat(purchase),0) + if(isNaN(purchaseNum)){ + purchaseNum = ''; + } + + var totalPriceNum = Ext.num(parseInt(scheduleAmount) * parseFloat(purchase),0) + if(isNaN(totalPriceNum)){ + totalPriceNum = ''; + } + + //一次物品是否校验物品 + if(!isUndefinedOrNullOrEmpty(disposableGoodsId) && sstsConfig.godownEntryNeedVerify){ + if(top.Ext.isEmpty(top.Ext.getCmp('supplier1').getValue()) || manufacturerId == null){ + showResult("请填写供应商!"); + return false; + } + if(top.Ext.isEmpty(top.Ext.getCmp('manufacturer').getValue()) || supplierId == null){ + showResult("请填写生产厂家!"); + return false; + } + //检查物品相关证件是否过期 + if(!checkGoodsValidityTime(disposableGoodsId,supplierId,manufacturerId)){ + return false; + } + } + //添加操作 + var goodPurchasePlanItem = new GoodPurchasePlanItemRecord({ + localID:g_localID++, + id : "", + departName : departName, + departCoding : departCoding, + name : name, + unit : unit, + specification : specification, + lastConsuption : lastConsuptionNum, + stockQuantity : stockQuantityNum, + scheduleAmount : scheduleAmountNum, + purchase : purchaseNum, + totalPrice:totalPriceNum, + manufacturer:manufacturer, + supplierName : supplierName, + disposableGoodsId : disposableGoodsId, + materialDefinitionId : materialDefinitionId, + supplierId : supplierId, + manufacturerId : manufacturerId + }); + //alert(purchase + " " + scheduleAmount + " " ); + //alert("lastConsuption:" + lastConsuption); + //alert("tatalPrice:" + Ext.num(parseFloat(scheduleAmount) * parseFloat(purchase),0)); + //top.Ext.getCmp('goodPurchaseItemGrid').getStore().add(goodPurchasePlanItem); + top.Ext.getCmp('goodPurchaseItemGrid').getStore().insert(0 , goodPurchasePlanItem); + setTotalMoney(top.Ext.getCmp('goodPurchaseItemGrid')); + clearForm(); + return true; +} +/** + * 添加校验 + * @returns {Boolean} + */ +function validateForm(){ + if(!top.Ext.getCmp('goodPurchaseForm').form.isValid()){ + showResult('请正确填写表单各值'); + return false; + } + var name = top.Ext.getCmp('name1').getValue(); + if(name.length==0){ + showResult('请填写物品名称!'); + top.Ext.getCmp('name1').focus(false,100); + return false; + } + var count = top.Ext.getCmp('amount1').getValue(); + if(count.length==0){ + showResult('请填写物品数量!'); + top.Ext.getCmp('amount1').focus(false,100); + return false; + } + //var countNum = Ext.num(parseInt(count),0) + if(!/^\d+$/.test(count)){ + showResult('物品数量只能是整数'); + top.Ext.getCmp('amount1').focus(false,100); + return false; + } + + var lastConsumption = top.Ext.getCmp('lastConsumption1').getValue(); + if(lastConsumption != null && lastConsumption.length > 0){ + //var lastConsumptionNum = Ext.num(parseInt(lastConsumption),0) + if(!/^\d+$/.test(lastConsumption)){ + showResult('上期消耗量只能是整数'); + top.Ext.getCmp('lastConsumption1').focus(false,100); + return false; + } + } + + var stockQuantity = top.Ext.getCmp('stockQuantity').getValue(); + if(stockQuantity != null && stockQuantity.length > 0){ + if(!/^\d+$/.test(stockQuantity)){ + showResult('库存数量只能是整数'); + top.Ext.getCmp('stockQuantity').focus(false,100); + return false; + } + } + + var unit = top.Ext.getCmp('unit1').getValue(); + if(unit.length==0){ + showResult('请填写物品单位!'); + top.Ext.getCmp('unit1').focus(false,100); + return false; + } + /*var specification = top.Ext.getCmp('specification1').getValue(); + if(specification.length==0){ + showResult('请填写物品规格!'); + top.Ext.getCmp('specification1').focus(false,100); + return false; + }*/ + var cost = top.Ext.getCmp('purchase').getValue(); + if(cost.length==0){ + showResult('请填写物品进价!'); + top.Ext.getCmp('purchase').focus(false,100); + return false; + } + if(!/^(([1-9]+[0-9]*.{1}[0-9]+)|([0].{1}[1-9]+[0-9]*)|([1-9][0-9]*)|([0][.][0-9]+[1-9]*))$/.test(cost)){ + showResult('物品进价只能是正数'); + top.Ext.getCmp('purchase').focus(false,100); + return false; + } + + if(top.Ext.getCmp('supplier1').getValue() == null || top.Ext.getCmp('supplier1').getValue() == ''){ + showResult("请填写供应商!"); + top.Ext.getCmp('supplier1').focus(false,100); + return false; + } + return true; +} + +/** + * 检查添加物品的相关证件是否过期 + * @param disposableGoodsId + * @param supplierId + * @param manufacturerId + * @returns {Boolean} + */ +function checkGoodsValidityTime(disposableGoodsId,supplierId,manufacturerId){ + var isCheckSuccess = true; + Ext4.Ajax.request({ + url : WWWROOT + '/disinfectSystem/baseData/supplierAction!checkGoodsValidityTime.do', + async:false, + params : { + disposableGoodsId : disposableGoodsId, + supplierId : supplierId, + manufacturerId : manufacturerId, + needVerifyCertification : false//是否需要校验注册证 + }, + success : function(response) { + var message = Ext.decode(response.responseText).message; + if(message){ + showResult(message); + isCheckSuccess = false; + } + }, + failure : function(response, options) { + showResult(response.responseText); + isCheckSuccess = false; + } + }); + return isCheckSuccess; +} \ No newline at end of file Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/supplier/action/SupplierAction.java =================================================================== diff -u -r23501 -r23512 --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/supplier/action/SupplierAction.java (.../SupplierAction.java) (revision 23501) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/supplier/action/SupplierAction.java (.../SupplierAction.java) (revision 23512) @@ -2,6 +2,7 @@ import java.io.IOException; import java.io.UnsupportedEncodingException; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -10,11 +11,13 @@ import javax.servlet.http.HttpServletResponse; +import net.sf.json.JSONArray; import net.sf.json.JSONObject; import net.sf.json.JsonConfig; import net.sf.json.util.CycleDetectionStrategy; import net.sf.json.util.PropertyFilter; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang.StringUtils; import org.apache.struts2.convention.annotation.Action; import org.apache.struts2.convention.annotation.Namespace; @@ -24,15 +27,18 @@ import com.forgon.disinfectsystem.basedatamanager.supplier.service.SupplierManager; import com.forgon.disinfectsystem.basedatamanager.supplier.service.RegistrationCertificationManager; import com.forgon.disinfectsystem.basedatamanager.supplyroomconfig.service.SupplyRoomConfigManager; +import com.forgon.disinfectsystem.entity.basedatamanager.supplier.Certificate; import com.forgon.disinfectsystem.entity.basedatamanager.supplier.Supplier; import com.forgon.disinfectsystem.entity.basedatamanager.supplier.SupplierContact; import com.forgon.disinfectsystem.entity.expensivegoods.AuthorizationCertification; +import com.forgon.disinfectsystem.entity.expensivegoods.ExpensiveGoodsModel; import com.forgon.entity.PageEntity; import com.forgon.systemsetting.model.HttpOption; import com.forgon.systemsetting.service.HttpOptionManager; import com.forgon.tools.StrutsParamUtils; import com.forgon.tools.StrutsResponseUtils; import com.forgon.tools.hibernate.ObjectDao; +import com.forgon.tools.json.JSONUtil; import com.forgon.tools.json.JsonPropertyFilter; import com.forgon.tools.util.PageUtil; import com.opensymphony.xwork2.ModelDriven; @@ -321,6 +327,78 @@ } /** + * 根据生产厂家,一次性物品获得注册证集合 + */ + public String getCertificationStoreList(){ + String disposableGoodsID = StrutsParamUtils.getPraramValue("disposableGoodsID", "");//物品id + String manufacturerId = StrutsParamUtils.getPraramValue("manufacturerId", "");//生产厂家id + try { + List> mapList = supplierManager.getCertificationListByManufacturerIdAndDisposableGoodsID(disposableGoodsID,manufacturerId); + PageUtil.outPutResult(PageUtil.getPagePara(), mapList); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + /** + *查询相应供应商/生产厂家信息(根据needVerify判断是否需要关联证件过滤) + * @return + * @throws Exception + */ + public String getSupplierDataNeedVerify() { + if (supplierName == null) { + return null; + } + try { + supplierName = java.net.URLDecoder.decode(supplierName, "UTF-8"); + Pattern pat = Pattern.compile("[\\u4E00-\\u9FA5]+"); + Matcher m = pat.matcher(supplierName); + if (!m.find()) { + supplierName = supplierName.toUpperCase(); + } + String type = StrutsParamUtils.getPraramValue("supplierType", "");//类型 + Long manufacturerId = StrutsParamUtils.getPraramLongValue("manufacturerId", null);//生产厂家id + Long supplierId = StrutsParamUtils.getPraramLongValue("supplierId", null);//供应商id + Long disposableGoodsID = StrutsParamUtils.getPraramLongValue("disposableGoodsID", null);//一次性物品id + boolean needVerify = StrutsParamUtils.getBoolPraramValue("needVerify",false);//是否需要校验 + List> mapList = new ArrayList>(); + //根据是否需要校验:获得供应商/生产厂家 + if(needVerify){ + mapList = supplierManager.searchSupplierNeedVerify(supplierName, type,manufacturerId,supplierId,disposableGoodsID); + }else{ + mapList = supplierManager.searchSupplier(supplierName, type); + } + PageUtil.outPutResult(PageUtil.getPagePara(), mapList); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + return null; + } + + /** + * 入库填添加明细时校验厂商相关证件有效 + */ + public void checkGoodsValidityTime(){ + String disposableGoodsID = StrutsParamUtils.getPraramValue("disposableGoodsId", "");//一次性物品id + String supplierId = StrutsParamUtils.getPraramValue("supplierId", "");//供应商id + String manufacturerId = StrutsParamUtils.getPraramValue("manufacturerId", "");//生产厂家id + String certificationId = StrutsParamUtils.getPraramValue("certificationId", "");//注册证id + boolean needVerifyCertification = StrutsParamUtils.getBoolPraramValue("certificationId", false);//是否需要校验前台的注册证 + JSONObject result = new JSONObject(); + try { + JSONObject checkRestult = supplierManager.checkItemValidity(disposableGoodsID,supplierId,manufacturerId,certificationId,needVerifyCertification); + if(checkRestult.get("message")!=null){ + result = JSONUtil.buildJsonObject(true, checkRestult.get("message").toString()); + } + } catch (Exception e) { + e.printStackTrace(); + result = JSONUtil.buildJsonObject(false,"校验失败!"+ e.getMessage()); + } + StrutsResponseUtils.output(result); + } + + /** * 根据拼音获取所有供应商联系人Json */ public void getsupplierContacData() { Index: ssts-web/src/main/webapp/disinfectsystem/config/gzfdzl/config.js =================================================================== diff -u -r23409 -r23512 --- ssts-web/src/main/webapp/disinfectsystem/config/gzfdzl/config.js (.../config.js) (revision 23409) +++ ssts-web/src/main/webapp/disinfectsystem/config/gzfdzl/config.js (.../config.js) (revision 23512) @@ -72,8 +72,8 @@ needGodownEntryLinkageGoodPurchase: true, //采购计划显示入库状态,默认为false showGoodPurchaseStockStatus: true, + //一次性物品入库,采购计划添加一次性物品时:校验物品的供应商,生产厂家相关证件是否有效,默认为false + godownEntryNeedVerify:true, //一次性物品入库单显示标签合格,验收合格选项,默认为false - godownEntryShowQualified:true, - // 是否启用一次性物品高值耗材功能,默认为否 - enableExpensiveDisposableGoods: true + godownEntryShowQualified:true } \ No newline at end of file Index: ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/godownEntryView.jsp =================================================================== diff -u -r23147 -r23512 --- ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/godownEntryView.jsp (.../godownEntryView.jsp) (revision 23147) +++ ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/godownEntryView.jsp (.../godownEntryView.jsp) (revision 23512) @@ -39,6 +39,8 @@ + + Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/supplier/service/SupplierManager.java =================================================================== diff -u -r23486 -r23512 --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/supplier/service/SupplierManager.java (.../SupplierManager.java) (revision 23486) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/supplier/service/SupplierManager.java (.../SupplierManager.java) (revision 23512) @@ -4,6 +4,8 @@ import java.util.Map; import java.util.Set; +import net.sf.json.JSONObject; + import com.forgon.disinfectsystem.entity.assestmanagement.DisposableGoods; import com.forgon.disinfectsystem.entity.basedatamanager.supplier.Certificate; import com.forgon.disinfectsystem.entity.basedatamanager.supplier.Supplier; @@ -65,8 +67,51 @@ * @return 供应商List集合 */ public List> findSupplierContactList(String contactName,String supplierName); + + /** + *(根据授权证,注册证,一次性物品关联) 获取关联的生产厂家/供应商 + * @param supplierName + * @param type 生产厂家/供货单位 + * @param manufacturerId + * @param supplierId + * @param disposableGoodsID + * @return + */ + public List> searchSupplierNeedVerify(String supplierName, String type + ,Long manufacturerId,Long supplierId, Long disposableGoodsID); + /** + * 校验一次性物品的生产厂家,供应商的相关证件 + * 1.先校验生产厂家,再校验供应商 + * 2.若一次性物品不需要授权:只校验传入的供应商 + * 3.若一次性物品不需要授权:从传入的供应商开始校验,直到上一级厂商id等于生产厂家id或厂商为空:则校验完毕 + * 3.供应商 + * (1.营业执照 2.经营许可证 3.授权书 4.法人授权委托书 5.质量保证书) + * 3-1 该物品需要授权 且 该供应商不等于传入的生产厂家 :则校验授权证(该物品厂商是供应商同时是生产厂家下该厂商不用授权证) + * 4.生产厂家 + * (1.营业执照 2.生产许可证 3.注册证) + * 4-1 该生产厂家是供应商同时是生产厂家 但不等于传入的生产厂家 :则不需要校验该厂家 + * 4-2 needVerifyCertification为false:不需要校验传入的注册证 + * @param disposableGoodsID + * @param supplierId + * @param manufacturerId + * @param certificationId + * @param needVerifyCertification + * @return + */ + JSONObject checkItemValidity(String disposableGoodsID, String supplierId,String manufacturerId + , String certificationId,Boolean needVerifyCertification); + + /** + * 根据生产厂家id,一次性物品id获得注册证号(正在使用) + * @param disposableGoodsID + * @param manufacturerId + * @return + */ + List> getCertificationListByManufacturerIdAndDisposableGoodsID(String disposableGoodsID, String manufacturerId); + + /** * 根据供应商类型及用户帐号查询供应室名称(未配置申请人员或配置了申请人员工号包含该人员工号参数的都查出来) * @param supplierType 供应商类型 * @param userCode 人员工号 Index: ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/godownEntryForm.js =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/godownEntryForm.js (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/godownEntryForm.js (revision 23512) @@ -0,0 +1,1482 @@ +var selectModel = new top.Ext.grid.CheckboxSelectionModel(); +//从入库单列表点添加或点击列表中某一行的单都会调用此function +function addGodownEntry() { + //根据配置获得注册证tbar + var certificationTbar; + if(sstsConfig.godownEntryNeedVerify){//需要校验 + certificationTbar = new top.Ext.form.ComboBox({ + id : 'certification1', + name : 'certification', + maxLength : '80', + valueField : 'id', + displayField : 'certificateNumber', + store : certificationStore, + triggerAction : 'all', + forceSelection : false, + lazyInit : false, + allowBlank : true, + typeAhead : false, + editable:false, + width : 190, + listeners : { + specialkey : function(field, e) { + var key = e.getKey(); + if (key == Ext.EventObject.ENTER) { + addGodown(); + top.Ext.getCmp('name1').focus(); + top.Ext.getCmp('name1').selectText(); + } + } + }}) + }else{ + certificationTbar = new top.Ext.form.TextField({ + xtype : 'textfield', + id : 'certification1', + name : 'certification', + width : 190, + tabIndex : 12, + allowBlank:true, + anchor : '100%', + listeners : { + specialkey : function(field, e) { + var key = e.getKey(); + if (key == Ext.EventObject.ENTER) { + addGodown(); + top.Ext.getCmp('name1').focus(); + top.Ext.getCmp('name1').selectText(); + } + } + } + }); + } + + Ext.getCmp("formSubmitResult").setValue(formSubmitResultInit); + wareHouseStore.load(); + //创建formPanel + var form = new top.Ext.FormPanel({ + id : 'godownEntryForm', + frame : true, + labelSeparator : ':', + bodyStyle : 'padding:5px 5px 0px 5px', + width : 850, + autoScroll : true, + labelAlign : 'left', + items:[{ + layout : 'column', + items : [{ + xtype : 'hidden', + name : 'id', + id : 'id' + },{ + xtype : 'hidden', + name : 'type', + value : TYPE_IN + },{ + xtype : 'hidden', + name : 'items', + id : 'items' + },{ + xtype : 'hidden', + name : 'originalItems', + id : 'originalItems' + },{ + xtype : 'hidden', + name : 'formParams', + id : 'formParams' + },{ + xtype : 'hidden', + name : 'originalFormParams', + id : 'originalFormParams' + },{ + xtype : 'hidden', + name : 'warehouseID', + id : 'warehouseID' + },{ + xtype : 'hidden', + name : 'warehouseName', + id : 'warehouseName' + },{ + id : 'serialNum', + columnWidth : .20, + layout : 'form', + labelWidth : 40, + hidden:true, + items : [{ + xtype : 'textfield', + fieldLabel : '单号', + maxLength : '41', + id : 'serialNumber', + name : 'serialNumber', + cls : 'fieldReadOnlyNoRemove', + allowBlank : true, + readOnly : true, + anchor : '95%' + }] + },{ + columnWidth : .20, + layout : 'form', + labelWidth : 40, + items:[{ + xtype : 'combo', + fieldLabel : '仓库', + id : 'wareHouse1', + name : 'wareHouse1', + minChars : 0, + valueField : 'id', + displayField : 'name', + store : wareHouseStore, + forceSelection : true, + lazyInit : false, + triggerAction : 'all', + hideTrigger : true, + typeAhead : false, + allowBlank : true, + width : 100, + listeners : { + select : function(combo, record, index) { + setWareHouseInfo(record.data.id,record.data.name); + top.Ext.getCmp('wareHouse1').setValue(record.data.id); + //diposableGoodsStore.proxy.extraParams.warehouseID = record.data.id; + //diposableGoodsStore.proxy.conn.extraParams.spell = top.Ext.getCmp('name1').getValue(); + /*diposableGoodsStore.reload({ + callback:function(e){ + console.log(e); + } + });*/ + + top.Ext.getCmp('name1').focus(); + top.Ext.getCmp('name1').enable(); + }, + specialkey : function(field, ee) { + if (ee.getKey() == Ext.EventObject.ENTER) { + top.Ext.getCmp('name1').focus(); + } + } + } + }] + }, { + columnWidth : .15, + layout : 'form', + labelWidth : 60, + items : [{ + xtype : 'textfield', + fieldLabel : '操作员', + maxLength : '50', + id : 'operator', + name : 'operator', + allowBlank : false, + readOnly : true, + cls : 'fieldReadOnlyNoRemove', + value : $Id('userName').value, + anchor : '95%' + }] + }, { + columnWidth : .25, + layout : 'form', + labelWidth : 60, + items : [{ + xtype : 'datefieldWithMin', + fieldLabel : '入库时间', + id : 'time', + name : 'time', + format : 'Y-m-d H:i', + altFormats:'Y-m-d|Y-n-j|y-n-j|y-m-j|y-m-d|y-n-d|Y-n-d|Y-m-j|Ymd|Ynj|ynj|ymj|ymd|ynd|Ynd|Ymj|Y/m/d|Y/n/j|y/n/j|y/m/j|y/m/d|y/n/d|Y/n/d|Y/m/j', +// value : new Date(), + allowBlank : false, + anchor : '95%', + listeners : { + render : function() { + setStartDate(top.Ext, 'yyyy/MM/dd HH:mm', 'time'); //(入库时间,取服务器时间 cjr) + } + } + }] + }, { + columnWidth : .20, + layout : 'form', + labelWidth : 80, + items : [{ + xtype : 'textfield', + fieldLabel : '入库单总价', + id : 'totalPrice', + name : 'totalPrice', + readOnly:true, + cls : 'fieldReadOnlyNoRemove', + anchor : '95%' + }] + },{ + hidden : !sstsConfig.showDisposableGoodsGodownEntryVerifier || (commonEntry.isOpen() ? false:true), + columnWidth : .25, + layout : 'form', + labelWidth : 130, + items :[{ + xtype : 'textfield', + fieldLabel :'扫描供应室核对人条码', + id : 'supplyRoomVerifierBarcode', + name : 'supplyRoomVerifierBarcode', + width : 100, + enableKeyEvents : true, + listeners : { + render : function(c) { + c.getEl().on('keypress',function(e) { + if (e.getKey() == 13) {// 输入;号键,grid重新加载 + loadUserVerifierByBarcode('supplyRoomVerifierBarcode'); + } + }); + } + } + }] + },{ + hidden : !sstsConfig.showDisposableGoodsGodownEntryVerifier|| (commonEntry.isOpen() ? false:true), + columnWidth : .25, + layout : 'form', + labelWidth : 80, + items:[{ + xtype : 'combo', + fieldLabel : '供应室核对人', + id : 'supplyRoomVerifier', + name : 'supplyRoomVerifier', + queryParam : 'spell', + valueField : 'name', + displayField : 'name', + store : verifierStore, + forceSelection : true, + lazyInit : true, + minChars : 0, + listWidth:100, + triggerAction : 'all', + hideTrigger : true, + typeAhead : false, + allowBlank : true, + width : 100, + listeners : { + select : function(combo, record, index) { + top.Ext.getCmp('supplyRoomVerifier').setValue(record.data.name); + top.Ext.getCmp('equipmentVerifierBarcode').focus(); + }, + specialkey : function(field, ee) { + if (ee.getKey() == Ext.EventObject.ENTER) { + top.Ext.getCmp('equipmentVerifierBarcode').focus(); + } + } + } + }] + },{ + hidden : !sstsConfig.showDisposableGoodsGodownEntryVerifier|| (commonEntry.isOpen() ? false:true), + columnWidth : .25, + layout : 'form', + labelWidth : 130, + items :[{ + xtype : 'textfield', + fieldLabel :'扫描设备科核对人条码', + id : 'equipmentVerifierBarcode', + name : 'equipmentVerifierBarcode', + width : 100, + enableKeyEvents : true, + listeners : { + render : function(c) { + c.getEl().on('keypress',function(e) { + if (e.getKey() == 13) {// 输入;号键,grid重新加载 + loadUserVerifierByBarcode('equipmentVerifierBarcode'); + } + }); + } + } + }] + },{ + hidden : !sstsConfig.showDisposableGoodsGodownEntryVerifier|| (commonEntry.isOpen() ? false:true), + columnWidth : .25, + layout : 'form', + labelWidth : 80, + items:[{ + xtype : 'combo', + fieldLabel : '设备科核对人', + id : 'equipmentVerifier', + name : 'equipmentVerifier', + queryParam : 'spell', + valueField : 'name', + displayField : 'name', + store : verifierStore, + forceSelection : true, + lazyInit : true, + minChars : 0, + listWidth:100, + triggerAction : 'all', + hideTrigger : true, + typeAhead : false, + allowBlank : true, + width : 100, + listeners : { + select : function(combo, record, index) { + top.Ext.getCmp('equipmentVerifier').setValue(record.data.name); + } + } + }] + },{ + columnWidth : 1, + layout : 'form', + labelWidth : 40, + items : [{ + xtype : 'textarea', + fieldLabel : '备注', + height : 50, + id : 'remark', + name : 'remark', + maxLength : 665, + allowBlank : true, + anchor : '100%' + }] + }] + },new top.Ext.grid.EditorGridPanel({ + id : 'godownEntryItemGrid', + bodyStyle : 'border:1px solid #afd7af', + frame :false, + sm : selectModel, + height : 390, + viewConfig: { + forceFit:true + }, + store : new top.Ext.data.Store({ + proxy : new top.Ext.data.HttpProxy({ + url : WWWROOT + '/disinfectSystem/godownEntryAction!loadGodownEntryItemByid.do', + method : 'POST' + }), + reader : new top.Ext.data.JsonReader({ + fields : [ + {name : 'id'}, + {name : 'disposableGoodsID'}, + {name : 'name'}, + {name : 'amount'}, + {name : 'disposableGoodsBatchID'}, + {name : 'batchNumber'}, + {name : 'cost'}, + {name : 'expDate'}, + {name : 'supplierName'}, + {name : 'sterileBatchNumber'}, + {name : 'manufacturer'}, + {name : 'certification'}, + {name : 'totalPrice'}, + {name : 'deleteButton'}, + {name : 'hasBiologicalTestReport'}, + {name : 'hasInvoice'}, + {name : 'grade'}, + {name : 'manufacturerId'}, + {name : 'supplierId'}, + {name : 'qualifiedCheck'},//标签合格 + {name : 'qualifiedLabel'}//验收合格 + ] + }) + }), + cm : new top.Ext.grid.ColumnModel([new Ext.grid.RowNumberer(), selectModel, + {header : "id",dataIndex : 'id',hidden : true}, + {header : "disposableGoodsID",dataIndex : 'disposableGoodsID',hidden : true}, + {header : "名称",dataIndex : 'name',width : 250,menuDisabled : true}, + {header : "数量",dataIndex : 'amount',width : 50,menuDisabled : true, + editor : new top.Ext.form.TextField({ + regex: /^\d+$/, + regexText:'只能输入数字', + allowBlank : false, + listeners:{ + change :function(field,newVal,oldVal){ + if(commonEntry.isOpen()){ + field.setValue(oldVal); + return false; + } + var grid = top.Ext.getCmp('godownEntryItemGrid'); + setTotalMoney(grid); + },focus:function(){ + if(commonEntry.isOpen()){ + alert('查看和编辑入库单时不能修改数量'); + return false; + } + } + } + }) + }, + {header : "批次",width : 70,dataIndex : 'batchNumber',menuDisabled : true, + editor : new top.Ext.form.TextField({ + allowBlank : false, + listeners:{ + change :function(field,newVal,oldVal){ + var grid = top.Ext.getCmp('godownEntryItemGrid'); + setTotalMoney(grid); + },focus:function(){ + if(!commonEntry.isOpen()){ + alert('添加入库单的时候不能修改批次号'); + return false; + } + } + } + }) + }, + {header : "失效日期",width : 80,dataIndex : 'expDate',menuDisabled : true, renderer:top.Ext.util.Format.dateRenderer('Y-m-d'), + editor : new top.Ext.form.DateExtensiableField({ + minWidth : 177, + format : 'Y-m-d', + altFormats:'Y-m-d|Y-n-j|y-n-j|y-m-j|y-m-d|y-n-d|Y-n-d|Y-m-j|Ymd|Ynj|ynj|ymj|ymd|ynd|Ynd|Ymj|Y/m/d|Y/n/j|y/n/j|y/m/j|y/m/d|y/n/d|Y/n/d|Y/m/j', + allowBlank : false + }) + }, + {header : "单价",dataIndex : 'cost',width : 50,menuDisabled : true, + editor : new top.Ext.form.TextField({ + regex: /^(([1-9]+[0-9]*.{1}[0-9]+)|([0].{1}[1-9]+[0-9]*)|([1-9][0-9]*)|([0][.][0-9]+[1-9]*))$/, + regexText:'只能输入正数', + allowBlank : false, + listeners:{ + change :function(field,newVal,oldVal){ + if(commonEntry.isOpen()){ + field.setValue(oldVal); + return false; + } + var grid = top.Ext.getCmp('godownEntryItemGrid'); + setTotalMoney(grid); + },focus:function(){ + if(commonEntry.isOpen()){ + alert('查看和编辑入库单时不能修改单价'); + return false; + } + } + } + }) + }, + {id : 'expandColumn',header : "供应商",width : 180,dataIndex : 'supplierName',menuDisabled : true, + editor : sstsConfig.godownEntryNeedVerify == true ? false : new top.Ext.form.ComboBox({ + queryParam : 'supplierName', + minChars : 0, + valueField : 'id', + displayField : 'name', + store : supplierStore, + forceSelection : true, + lazyInit : false, + triggerAction : 'all', + hideTrigger : true, + typeAhead : false, + allowBlank : true, + width : 100, + listeners : { + select : function(combo, record, index) { + combo.setValue(record.data.name); + selectedRecord = top.Ext.getCmp('godownEntryItemGrid').getSelectionModel().getSelections()[0]; + selectedRecord.set("supplierId",record.data.id); + } + } + }) + }, + {header : "灭菌批号",width : 80,dataIndex : 'sterileBatchNumber',menuDisabled : true, + editor : new top.Ext.form.TextField({ + maxLength : 30, + allowBlank : true + }) + }, + {header : "生产厂家",width : 100,dataIndex : 'manufacturer',menuDisabled : true, + editor : sstsConfig.godownEntryNeedVerify == true ? false : new top.Ext.form.ComboBox({ + queryParam : 'supplierName', + minChars : 0, + valueField : 'id', + displayField : 'name', + store : madeCompanyStore, + forceSelection : true, + lazyInit : false, + triggerAction : 'all', + hideTrigger : true, + typeAhead : false, + allowBlank : true, + width : 100, + listeners : { + select : function(combo, record, index) { + combo.setValue(record.data.name); + selectedRecord = top.Ext.getCmp('godownEntryItemGrid').getSelectionModel().getSelections()[0]; + selectedRecord.set("manufacturerId",record.data.id); + } + } + }) + }, + {header : "产地",width : 80,dataIndex : 'producingArea',menuDisabled : true, + editor : new top.Ext.form.TextField({ + maxLength : 30, + allowBlank : true + }) + }, + {header : "注册证号",width : 120,dataIndex : 'certification',menuDisabled : true +// ,editor : new top.Ext.form.TextField({ +// maxLength : 30, +// allowBlank : true +// }) + }, + {header : "标签合格",width : 80,menuDisabled : true,dataIndex : 'qualifiedLabel',hidden:!sstsConfig.godownEntryShowQualified}, + {header : "验收合格",width : 80,menuDisabled : true,dataIndex : 'qualifiedCheck',hidden:!sstsConfig.godownEntryShowQualified}, + {header : "总价",width : 70,menuDisabled : true,dataIndex : 'totalPrice', renderer:renderTotalPrice}, + {header : "生物检测",width : 70,menuDisabled : true,dataIndex : 'hasBiologicalTestReport', + editor : new top.Ext.form.ComboBox({ + minChars : 0, + store : hasTypeStore, + forceSelection : true, + lazyInit : false, + valueField : 'hasType', + displayField : 'hasType', + mode : 'local', + triggerAction : 'all', + hideTrigger : true, + typeAhead : false, + allowBlank : false, + editable:false, + width : 100, + listeners : { + select : function(combo, record, index) { + combo.setValue(record.data.hasType); + } + } + }),hidden:!sstsConfig.godownEntryShowBiologicalTestReport}, + {header : "有无发票",width : 70,menuDisabled : true,dataIndex : 'hasInvoice', + editor : new top.Ext.form.ComboBox({ + minChars : 0, + store : hasTypeStore, + forceSelection : true, + lazyInit : false, + valueField : 'hasType', + displayField : 'hasType', + mode : 'local', + triggerAction : 'all', + hideTrigger : true, + typeAhead : false, + allowBlank : false, + editable:false, + width : 100, + listeners : { + select : function(combo, record, index) { + combo.setValue(record.data.hasType); + } + } + }),hidden:!sstsConfig.godownEntryShowInvoice}, + {header : '类别',width : 50,menuDisabled : true,dataIndex : 'grade', + editor : new top.Ext.form.ComboBox({ + minChars : 0, + store : gradeStore, + forceSelection : true, + lazyInit : false, + valueField : 'name', + displayField : 'name', + mode : 'local', + triggerAction : 'all', + hideTrigger : true, + typeAhead : false, + allowBlank : false, + editable:false, + width : 100, + listeners : { + select : function(combo, record, index) { + //combo.setValue(record.data.name); + } + } + })}, + {header : "删除",width : 50,menuDisabled : true,dataIndex : 'deleteButton', renderer:renderDeleteButton} + ]), + width :1380, + autoExpandColumn : 'expandColumn', + selModel : new top.Ext.grid.RowSelectionModel({ + singleSelect : false + }), + tbar : [{ + xtype : 'hidden', + name : 'disposableGoodsID', + id : 'disposableGoodsID' + },{ + xtype : 'hidden', + name : 'supplierId', + id : 'supplierId' + },{ + xtype : 'hidden', + name : 'manufacturerId', + id : 'manufacturerId' + },{ + xtype : 'hidden', + name : 'barcode', + id : 'barcode' + },{ + text : '扫描条码 :' + },{ + xtype : 'textfield', + id : 'barcode', + name : 'barcode', + width :90, + enableKeyEvents : true, + listeners : { + render : function(c) { + c.getEl().on('keypress',function(e) { + if (e.getKey() == 13) {// 输入;号键,grid重新加载 + loadReturnDiposableGoodsItem(); + } + }); + } + } + },{ + text : '物品名称:' + },{ + xtype : 'combo', + id : 'name1', + name : 'name1', + queryParam : 'spell', + minChars : 0, + valueField : 'id', + displayField : 'name', + pageSize : 100, + listConfig: {width: 300}, + store : sstsConfig.restrictGodownEntryDiposableGoods == true ? diposableGoodsStore:allDiposableGoodsStore, + forceSelection : true, + lazyInit : false, + triggerAction : 'all', + hideTrigger : true, + typeAhead : false, + allowBlank : true, + width : 270, + tabIndex : 1, + selectOnFocus : true, + disabled:true, + listeners : { + select : function(combo, record, index) { + top.Ext.getCmp('name1').setValue(record.data.name); + top.Ext.getCmp('name1').selectText(); + top.Ext.getCmp('disposableGoodsID').setValue(record.data.id); + top.Ext.getCmp('cost1').setValue(record.data.referencePrice); + //根据一次性物品id加载最近一次入库的一次性物品的供应商、注册证号、生产厂家、灭菌批次、产地、类别、单价等 + GodownEntryTableManager.getLastDiposableGoodsFromGodownEntry(record.data.id,function(result){ +// console.log(result); + if(result && result != ""){ + var lastGodownEntryItem = Ext.decode(result); + top.Ext.getCmp('supplier1').setValue(lastGodownEntryItem.supplierName); + top.Ext.getCmp('certification1').setValue(lastGodownEntryItem.certification); + top.Ext.getCmp('manufacturer').setValue(lastGodownEntryItem.manufacturer); + top.Ext.getCmp('supplierId').setValue(lastGodownEntryItem.supplierId); + top.Ext.getCmp('manufacturerId').setValue(lastGodownEntryItem.manufacturerId); + top.Ext.getCmp('sterileBatchNumber').setValue(lastGodownEntryItem.sterileBatchNumber); + top.Ext.getCmp('producingArea').setValue(lastGodownEntryItem.producingArea); + top.Ext.getCmp('grade').setValue(lastGodownEntryItem.grade); + top.Ext.getCmp('cost1').setValue(lastGodownEntryItem.cost); + //配置godownEntryNeedVerify为true:则需要刷新供应商,生产厂家,注册证stroe + if(sstsConfig.godownEntryNeedVerify){ + supplierNeedVerifyStore.load(); + madeCompanyNeedVerifyStore.load(); + certificationStore.load(); + } + } + }); + batchNumStore.baseParams.disposableGoodsID = record.data.id; + batchNumStore.load(); + top.Ext.getCmp('amount1').focus(); + top.Ext.getCmp('amount1').selectText(); + }, + specialkey : function(field, ee) { + if (ee.getKey() == Ext.EventObject.ENTER) { + top.Ext.getCmp('amount1').focus(); + top.Ext.getCmp('amount1').selectText(); + } + } + } + },{ + text : '数    量:' + },{ + xtype : 'textfield', + maxLength : '16', + id : 'amount1', + name : 'amount1', + allowBlank:true, + width : 80, + regex: /^\d+$/, + regexText:'只能输入数字', + anchor : '95%', + tabIndex : 2, + listeners : { + specialkey : function(field, e) { + if (e.getKey() == Ext.EventObject.ENTER) { + top.Ext.getCmp('batchNumber1').focus(); + top.Ext.getCmp('batchNumber1').selectText(); + } + } + } + },{ + text : '生产批次:' + },{ + xtype : 'combo', + id : 'batchNumber1', + name : 'batchNumber1', + maxLength : '30', + queryParam : 'spell', + minChars : 0, + valueField : 'batchNumber', + displayField : 'batchNumber', + store : batchNumStore, + forceSelection : false, + lazyInit : false, + triggerAction : 'all', + hideTrigger : false, + typeAhead : false, + allowBlank:true, + selectOnFocus :true, + width : 150, + tabIndex : 3, + anchor : '95%', + listeners : { + select : function(combo, record, index) { + top.Ext.getCmp('batchNumber1').setValue(record.data.batchNumber); + + var goodsId = top.Ext.getCmp('disposableGoodsID').getValue(); + var batchNumber = record.data.batchNumber; + //加载灭菌批号、生产厂家 + DiposableGoodsTableManager.getDisposableGoodsBatchPropertyByDisposableGoodsID(goodsId,batchNumber,function(result){ + if(result!=""){ + var array = result.split("#;"); + top.Ext.getCmp('manufacturer').setValue(array[0]); + top.Ext.getCmp('sterileBatchNumber').setValue(array[1]); + top.Ext.getCmp('expDate1').setValue(array[2]); + top.Ext.getCmp('manufacturerId').setValue(array[3]); + //配置godownEntryNeedVerify为true:则需要刷新供应商,生产厂家,注册证stroe + if(sstsConfig.godownEntryNeedVerify){ + supplierNeedVerifyStore.load(); + madeCompanyNeedVerifyStore.load(); + certificationStore.load(); + } + } + }); + + }, + specialkey : function(field, ee) { + if (ee.getKey() == Ext.EventObject.ENTER) { + top.Ext.getCmp('producingArea').focus(); + top.Ext.getCmp('producingArea').selectText(); + } + } + } + },{ + text : '产地:' + },{ + xtype : 'textfield', + id : 'producingArea', + name : 'producingArea', + width : 80, + tabIndex : 4, + anchor : '95%', + allowBlank:true, + listeners:{ + specialkey : function(field, ee) { + if (ee.getKey() == Ext.EventObject.ENTER) { + if(sstsConfig.godownEntryShowBiologicalTestReport){ + top.Ext.getCmp('hasBiologicalTestReport').focus(); + top.Ext.getCmp('hasBiologicalTestReport').selectText(); + }else{ + top.Ext.getCmp('expDate1').focus(); + top.Ext.getCmp('expDate1').selectText(); + } + } + } + } + },{ + text:'生物检测:', + hidden:!sstsConfig.godownEntryShowBiologicalTestReport + },{ + xtype : 'combo', + id : 'hasBiologicalTestReport', + name : 'hasBiologicalTestReport', + minChars : 0, + valueField : 'hasType', + displayField : 'hasType', + mode : 'local', + store : hasTypeStore, + forceSelection : true, + lazyInit : false, + triggerAction : 'all', + hideTrigger : false, + typeAhead : false, + selectOnFocus :true, + allowBlank : true, + editable:false, + width : 80, + tabIndex : 5, + hidden:!sstsConfig.godownEntryShowBiologicalTestReport, + listeners : { + select : function(field, r) { + top.Ext.getCmp('expDate1').focus(); + }, + specialKey:function(f,e){ + if (e.getKey() == Ext.EventObject.ENTER) { + top.Ext.getCmp('expDate1').focus(); + top.Ext.getCmp('expDate1').selectText(); + } + } + } + }], + listeners: { + render : function() { + var tbar = new top.Ext.Toolbar ({ + items : [{ + text : '失 效 期:' + },{ + xtype : 'dateextensiablefield',//dateextensiablefield + id : 'expDate1', + name : 'expDate1', + width : 190, + minWidth : 190, + tabIndex : 6, + anchor : '95%', + allowBlank:true, + invalidText :'日期输入不正确', + format : 'Y-m-d', + altFormats:'Y-m|Y-n|y-n|y-m|Y-m-d|Y-n-j|y-n-j|y-m-j|y-m-d|y-n-d|Y-n-d|Y-m-j|Ym|Ymd|Yn|Ynj|yn|ynj|ymj|ymd|ynd|Ynd|Ymj|Y/m/d|Y/n/j|y/n/j|y/m/j|y/m/d|y/n/d|Y/n/d|Y/m/j', +// readOnly:true, + listeners : { + specialkey : function(field, e) { + if (e.getKey() == Ext.EventObject.ENTER) { + top.Ext.getCmp('batchNumber1'). collapse(); + var isOK = field.validate(); + if(isOK){ + var value = field.getValue(); + field.setValue(value); + top.Ext.getCmp('cost1').focus(); + top.Ext.getCmp('cost1').selectText(); + } + + } + } + } + },{ + text : '单    价:' + },{ + xtype : 'textfield', + maxLength : '16', + id : 'cost1', + name : 'cost1', + width : 80, + tabIndex : 7, + regex: /^(([1-9]+[0-9]*.{1}[0-9]+)|([0].{1}[1-9]+[0-9]*)|([1-9][0-9]*)|([0][.][0-9]+[1-9]*))$/, + regexText:'只能输入正数', + anchor : '95%', + allowBlank:true, + listeners : { + specialkey : function(field, e) { + if (e.getKey() == Ext.EventObject.ENTER) { + top.Ext.getCmp('batchNumber1'). collapse(); + top.Ext.getCmp('supplier1').focus(); + top.Ext.getCmp('supplier1').selectText(); + } + } + } + },{ + text : '供 应 商:' + },{ + xtype : 'combo', + id : 'supplier1', + name : 'supplier1', + queryParam : 'supplierName', + minChars : 0, + valueField : 'name', + displayField : 'name', + store : sstsConfig.godownEntryNeedVerify == true ? supplierNeedVerifyStore : supplierStore, + forceSelection : true, + lazyInit : false, + triggerAction : 'all', + hideTrigger : true, + typeAhead : false, + selectOnFocus :true, + allowBlank : true, + width : 190, + tabIndex : 8, + listeners : { + select : function(field, r) { + top.Ext.getCmp('supplierId').setValue(r.data.id); + top.Ext.getCmp('hasInvoice').focus(); + if(sstsConfig.godownEntryNeedVerify){ + madeCompanyNeedVerifyStore.load(); + } + }, + specialKey:function(f,e){ + if (e.getKey() == Ext.EventObject.ENTER) { + if(sstsConfig.godownEntryShowInvoice){ + top.Ext.getCmp('hasInvoice').focus(); + top.Ext.getCmp('hasInvoice').selectText(); + }else{ + top.Ext.getCmp('manufacturer').focus(); + top.Ext.getCmp('manufacturer').selectText(); + } + } + } + } + },{ + text:'有无发票:', + hidden:!sstsConfig.godownEntryShowInvoice + },{ + xtype : 'combo', + id : 'hasInvoice', + name : 'hasInvoice', + minChars : 0, + valueField : 'hasType', + displayField : 'hasType', + mode : 'local', + store : hasTypeStore, + forceSelection : true, + lazyInit : false, + triggerAction : 'all', + hideTrigger : false, + typeAhead : false, + selectOnFocus :true, + allowBlank : true, + editable:false, + width : 80, + tabIndex : 9, + hidden:!sstsConfig.godownEntryShowInvoice, + listeners : { + select : function(field, r) { + top.Ext.getCmp('manufacturer').focus(); + }, + specialKey:function(f,e){ + if (e.getKey() == Ext.EventObject.ENTER) { + top.Ext.getCmp('manufacturer').focus(); + top.Ext.getCmp('manufacturer').selectText(); + } + } + } + }] + }); + tbar.render(top.Ext.getCmp('godownEntryItemGrid').tbar); + + var tbar3 = new top.Ext.Toolbar ({ + items : [{ + text : '生产厂家:' + },{ + xtype : 'combo', + id : 'manufacturer', + name : 'manufacturer', + maxLength : '60', + queryParam : 'supplierName', + minChars : 0, + valueField : 'name', + displayField : 'name', + store : sstsConfig.godownEntryNeedVerify == true ? madeCompanyNeedVerifyStore : madeCompanyStore, + forceSelection : true, + lazyInit : false, + triggerAction : 'all', + hideTrigger : false, + typeAhead : false, + allowBlank : true, + selectOnFocus :true, + width : 190, + tabIndex : 10, + listeners : { + select : function(field, r) { + top.Ext.getCmp('manufacturerId').setValue(r.data.id); + top.Ext.getCmp('sterileBatchNumber').focus(); + if(sstsConfig.godownEntryNeedVerify){ + supplierNeedVerifyStore.load(); + certificationStore.load(); + } + }, + 'keydown' : function(obj, e){ + if (e.getKey() == e.BACKSPACE) {e.stopEvent();} + }, + specialKey:function(f,e){ + var key = e.getKey(); + if (key == Ext.EventObject.ENTER) { + top.Ext.getCmp('sterileBatchNumber').focus(); + top.Ext.getCmp('sterileBatchNumber').selectText(); + } + } + } + },{ + text : '灭菌批号:' + },{ + xtype : 'textfield', + id : 'sterileBatchNumber', + name : 'sterileBatchNumber', + width : 80, + tabIndex : 11, + anchor : '95%', + allowBlank:true, + listeners : { + specialkey : function(field, e) { + if (e.getKey() == Ext.EventObject.ENTER) { + top.Ext.getCmp('certification1').focus(); + top.Ext.getCmp('certification1').selectText(); + } + } + } + },{ + text : '注册证号:' + } + /*,{ + xtype : 'textfield', + id : 'certification', + name : 'certification', + width : 190, + tabIndex : 12, + allowBlank:true, + anchor : '100%', + listeners : { + specialkey : function(field, e) { + var key = e.getKey(); + if (key == Ext.EventObject.ENTER) { + addGodown(); + top.Ext.getCmp('name1').focus(); + top.Ext.getCmp('name1').selectText(); + } + } + } + }*/ + ,certificationTbar, + { + text : '类别:' + },{ + xtype : 'combo', + id : 'grade', + name : 'grade', + minChars : 0, + valueField : 'name', + displayField : 'name', + mode : 'local', + triggerAction : 'all', + store : gradeStore, + forceSelection : false, + allowBlank : true, + editable:false, + width : 60 + },{ + text:'标签合格', + hidden:!sstsConfig.godownEntryShowQualified + },{ + xtype : 'combo', + id : 'qualifiedLabel', + name : 'qualifiedLabel', + minChars : 0, + valueField : 'qualifiedType', + displayField : 'qualifiedType', + mode : 'local', + store : qualifiedStore, + forceSelection : true, + lazyInit : false, + triggerAction : 'all', + hideTrigger : false, + typeAhead : false, + selectOnFocus :true, + allowBlank : true, + editable:false, + width : 40, + tabIndex : 9, + hidden:!sstsConfig.godownEntryShowQualified, + listeners : { + render : function(field, e){ + if(sstsConfig.godownEntryShowQualified){ + field.setValue(HAS_TYPE_PASS); + } + } + } + },{ + text:'验收合格', + hidden:!sstsConfig.godownEntryShowQualified + },{ + xtype : 'combo', + id : 'qualifiedCheck', + name : 'qualifiedCheck', + minChars : 0, + valueField : 'qualifiedType', + displayField : 'qualifiedType', + mode : 'local', + store : qualifiedStore, + forceSelection : true, + lazyInit : false, + triggerAction : 'all', + hideTrigger : false, + typeAhead : false, + selectOnFocus :true, + allowBlank : true, + editable:false, + width : 40, + tabIndex : 9, + hidden:!sstsConfig.godownEntryShowQualified, + listeners : { + render : function(field, e){ + if(sstsConfig.godownEntryShowQualified){ + field.setValue(HAS_TYPE_PASS); + } + } + + } + },{ + text : '添加', + iconCls : 'btn_ext_add', + id:'addBtn', + hidden : commonEntry.isOpen(), + handler : function() { + addGodown(); + top.Ext.getCmp('name1').focus(); + top.Ext.getCmp('name1').selectText(); + } + }] + }); + tbar3.render(top.Ext.getCmp('godownEntryItemGrid').tbar); + } + } + })], + buttons : [ + { + text : '修改物品', + hidden : !commonEntry.isOpen(), + handler : function() { + var store = top.Ext.getCmp('godownEntryItemGrid').getStore(); + var modifyRecords = store.getModifiedRecords(); + var len = modifyRecords.length; + if(len==0){ + showResult("请先修改物品"); + return; + } + var items = []; + for (var i = 0; i < len; i++) { + var record = modifyRecords[i]; + items.push({ + id : record.data.id,//入库明细id + disposableGoodsID : record.data.disposableGoodsID,//一次性物品定义id + batchID : record.data.disposableGoodsBatchID,//批次id + batchNumber : record.data.batchNumber,//批次号 + expDate : record.data.expDate.format('Y-m-d'),//失效期 + supplierName : record.data.supplierName,//供应商 + supplierId : record.data.supplierId,//供应商id + sterileBatchNumber : record.data.sterileBatchNumber,//灭菌批号 + manufacturer : record.data.manufacturer,//生产厂家 + manufacturerId : record.data.manufacturerId,//生产厂家id + producingArea : record.data.producingArea,//产地 + certification : record.data.certification,//注册证号 + grade : record.data.grade//类别 + }); + } + top.Ext.getCmp("items").setValue(JSON.stringify(items)); + form.form.submit({ + url : WWWROOT + '/disinfectSystem/godownEntryAction!modifyGodownEntryItemBaseData.do', + method : 'POST', + waitMsg : '正在保存数据,请稍候', + waitTitle : '提交表单', + success : function(form, action) { + if(!isUndefinedOrNullOrEmpty(action.result.message)){ + showResult(action.result.message); + return; + } + godownEntryWin.close(); + grid.dwrReload(); + }, + failure : function(form, action) { + alert(action.result.message); + } + }); + } + },{ + text : '保存核对人', + hidden: verifierUpdateButton || !sstsConfig.showDisposableGoodsGodownEntryVerifier||(commonEntry.isOpen()?false:true), + handler : function(){ + var supplyRoomVerifier = top.Ext.getCmp('supplyRoomVerifier').getValue();//供应室核对员 + var equipmentVerifier = top.Ext.getCmp('equipmentVerifier').getValue();//设备科核对员 + if(isUndefinedOrNullOrEmpty(equipmentVerifier)){ + showResult('设备科核对员不能为空!'); + return false; + }; + if(isUndefinedOrNullOrEmpty(supplyRoomVerifier)){ + showResult('供应室核对员不能为空!'); + return false; + }; + // 设置表单参数json + setFormParams(form,['id','equipmentVerifier','supplyRoomVerifier']); + form.form.submit({ + url : WWWROOT + '/disinfectSystem/godownEntryAction!saveGodownEntryVerifier.do', + method : 'POST', + waitMsg : '正在保存数据,请稍候', + waitTitle : '提交表单', + success : function(form, action) { + showResult(action.result.message); + godownEntryWin.close(); + grid.dwrReload(); + }, + failure : function(form, action) { + alert(action.result.message); + } + }); + } + },{ + text : '打印新批次', + hidden : commonEntry.isOpen() ? false:true, + handler : function(){ + var ids = top.Ext.getCmp("id").getValue(); + godownEntryWin.close(); + grid.dwrReload(); + commonEntry.printGodownEntryNewBatch(ids); + } + },{ + text : '选择打印', + handler : function() { + if(!form.getForm().isValid()){ + showResult('请正确填写表单各值'); + return false; + } + var items = []; + var records = top.Ext.getCmp('godownEntryItemGrid').getSelectionModel().getSelections(); + if (records.length == 0) { + showResult("请选择要打印的一次性物品!"); + return false; + } + + for ( var i = 0, len = records.length; i < len; i++) { + if(isUndefinedOrNullOrEmpty(records[i].data.id)){ + showResult(records[i].data.name + "未保存!请先保存再打印"); + return false; + } + items.push(records[i].data); + } + top.Ext.getCmp("items").setValue(JSON.stringify(items)); + form.form.submit({ + url : WWWROOT + '/disinfectSystem/godownEntryAction!printSomeGodownEntryItem.do', + method : 'POST', + waitMsg : '正在保存数据,请稍候', + waitTitle : '提交表单', + success : function(form, action) { + if(!isUndefinedOrNullOrEmpty(action.result.errorMessage)){ + showResult(action.result.errorMessage); + return; + } + Ext.getCmp("formSubmitResult").setValue(formSubmitResultSucc); + godownEntryWin.close(); + grid.dwrReload(); + //打印条码 + commonEntry.printBarcode(action.result.items,false); + + }, + failure : function(form, action) { + showResult(action.failureType); + Ext.getCmp("formSubmitResult").setValue(formSubmitResultFail); + } + }); + } + },{ + text : '保存并打印新标签', + hidden:saveButton || (commonEntry.isOpen() ? true:false), + handler : function() { + if(!form.getForm().isValid()){ + showResult('请正确填写表单各值'); + return false; + } + /*var name = top.Ext.getCmp('name1').getValue(); + if(name.length==0){ + showResult('请填写物品名称!'); + return false; + } + var count = top.Ext.getCmp('amount1').getValue(); + if(count.length==0){ + showResult('请填写物品数量!'); + return false; + } + var cost = top.Ext.getCmp('cost1').getValue(); + if(cost.length==0){ + showResult('请填写物品价格!'); + return false; + } + var batchNumber = top.Ext.getCmp('batchNumber1').getRawValue(); + if(batchNumber.length==0){ + showResult('请填写物品批次号!'); + return false; + }*/ + var items = buildJSONStringFromStore(top.Ext.getCmp('godownEntryItemGrid').getStore()); + top.Ext.getCmp("items").setValue(items); + // items为json数组字符串,不会为null + if(items == '[]'){ + showResult('请正确填写表单各值'); + return false; + } + form.form.submit({ + url : WWWROOT + '/disinfectSystem/godownEntryAction!saveGodownEntry.do', + method : 'POST', + params : {print : true}, + waitMsg : '正在保存数据,请稍候', + waitTitle : '提交表单', + success : function(form, action) { + Ext.getCmp("formSubmitResult").setValue(formSubmitResultSucc); + //保存返回的结果 + entryItemJsonArray = action.result.items; + showResult(action.result.message); + godownEntryWin.close(); + grid.dwrReload(); + + //打印条码 + commonEntry.printBarcode(entryItemJsonArray,true); + + }, + failure : function(form, action) { + showResult(action.result.message); + Ext.getCmp("formSubmitResult").setValue(formSubmitResultFail); + } + }); + } + },{ + text : '保存', + hidden:saveButton || (commonEntry.isOpen()?true:false), + handler : function() { + if(!form.getForm().isValid()){ + showResult('请正确填写表单各值'); + return false; + } + var name = top.Ext.getCmp('name1').getValue(); + /*if(name.length==0){ + showResult('请填写物品名称!'); + return false; + } + var count = top.Ext.getCmp('amount1').getValue(); + if(count.length==0){ + showResult('请填写物品数量!'); + return false; + } + var cost = top.Ext.getCmp('cost1').getValue(); + if(cost.length==0){ + showResult('请填写物品价格!'); + return false; + } + var batchNumber = top.Ext.getCmp('batchNumber1').getRawValue(); + if(batchNumber.length==0){ + showResult('请填写物品批次号!'); + return false; + }*/ + //var items = buildJSONStringFromStore(top.Ext.getCmp('godownEntryItemGrid').getStore()); +// var store = top.Ext.getCmp('godownEntryItemGrid').getStore(); +// var len = store.getCount(); +// for (var i = 0; i < len; i++) { +// var record = store.getAt(i); +// var expDate = record.data.expDate; +// //若是修改入库单失效日期则需要.format('Y-m-d')防止失效期不正确 +// expDate=expDate.format('Y-m-d'); +// store.getAt(i).set("expDate", expDate); +// }; +// var items = buildJSONStringFromStore(store); + var store = top.Ext.getCmp('godownEntryItemGrid').getStore(); + var len = store.getCount(); + var items = []; + for (var i = 0; i < len; i++) { + var record = store.getAt(i); +// console.log(record); + items.push({ + amount : record.data.amount, + batchID : record.data.batchID, + batchNumber : record.data.batchNumber, + certification : record.data.certification , + cost : record.data.cost, + disposableGoodsID : record.data.disposableGoodsID, + expDate : record.data.expDate.format('Y-m-d'), + grade : record.data.grade, + hasBiologicalTestReport : record.data.hasBiologicalTestReport, + hasInvoice : record.data.hasInvoice, + id : record.data.id, + identification : record.data.identification, + identificationID : record.data.identificationID, + localID: record.data.localID, + manufacturer : record.data.manufacturer, + name :record.data.name, + producingArea : record.data.producingArea, + sterileBatchNumber : record.data.sterileBatchNumber, + supplierName : record.data.supplierName, + supplierId : record.data.supplierId, + manufacturerId : record.data.manufacturerId, + qualifiedLabel : record.data.qualifiedLabel, + qualifiedCheck : record.data.qualifiedCheck, + totalPrice: record.data.totalPrice + }); +// console.log(items); + } + // 设置表单参数json + setFormParams(form,['id','remark','time','warehouseName','warehouseID']); +// top.Ext.getCmp("items").setValue(items); + top.Ext.getCmp("items").setValue(JSON.stringify(items)); + // items为json数组字符串,不会为null + if(items.length == 0){ + showResult('请正确填写表单各值'); + return false; + } +// console.log(items); + form.form.submit({ + url : WWWROOT + '/disinfectSystem/godownEntryAction!saveGodownEntry.do', + method : 'POST', + waitMsg : '正在保存数据,请稍候', + waitTitle : '提交表单', + success : function(form, action) { + showResult(action.result.message); + Ext.getCmp("formSubmitResult").setValue(formSubmitResultSucc); + godownEntryWin.close(); + grid.dwrReload(); + var barcodeStr = action.result.barcode; + var tableHtml = ""; + if(barcodeStr != null){ + var barcodeArray = barcodeStr.split(";"); + for(var i = 0;i < barcodeArray.length;i++){ + var items = barcodeArray[i].split("#&"); + var name = items[0]; + var barcode = items[2]; + var expDate = items[3]; + var supplierName = items[4]; + var batchNumber = items[5]; + var specification = items[6]; + tableHtml += ""+name+""+specification+""+ + batchNumber+""+barcode+""+expDate+""; + } + } + if(tableHtml.length > 0){ + var title = ""+tableHtml+"
名称规格批次条码失效期
"; + top.Ext.MessageBox.alert("已入库物品清单", title); + } + + }, + failure : function(form, action) { + showResult(action.result.message); + Ext.getCmp("formSubmitResult").setValue(formSubmitResultFail); + } + }); + } + },{ + text : '取消', + handler : function() { + godownEntryWin.close(); + } + }] + }); + + var godownEntryWin = new top.Ext.Window( { + id : 'recyclingApplicationWin', + layout : 'fit', + title : '入库单信息', + width : 1020, + height :570, + modal : true, +// autoHeight : true, + border :false, + plain : true, + items : [ form ] + }); + godownEntryWin.show(); + top.Ext.getCmp('name1').focus(false, 100); +}; + +/** + * 检查入库物品的相关证件是否过期 + */ +function checkGoodsValidityTime(disposableGoodsId,supplierId,manufacturerId,certificationId){ + var isCheckSuccess = true; + Ext4.Ajax.request({ + url : WWWROOT + '/disinfectSystem/baseData/supplierAction!checkGoodsValidityTime.do', + async:false, + params : { + disposableGoodsId : disposableGoodsId, + supplierId : supplierId, + manufacturerId : manufacturerId, + certificationId : certificationId, + needVerifyCertification : true//是否需要校验前台的注册证 + }, + success : function(response) { + var message = Ext.decode(response.responseText).message; + if(message){ + showResult(message); + isCheckSuccess = false; + } + }, + failure : function(response, options) { + showResult(response.responseText); + isCheckSuccess = false; + } + }); + return isCheckSuccess; +} \ No newline at end of file Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/supplier/service/SupplierManagerImpl.java =================================================================== diff -u -r23509 -r23512 --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/supplier/service/SupplierManagerImpl.java (.../SupplierManagerImpl.java) (revision 23509) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/basedatamanager/supplier/service/SupplierManagerImpl.java (.../SupplierManagerImpl.java) (revision 23512) @@ -12,6 +12,8 @@ import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; +import java.sql.ResultSet; +import java.sql.SQLException; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -38,12 +40,16 @@ import com.forgon.disinfectsystem.entity.basedatamanager.supplier.ExpensiveGoodsSupplier; import com.forgon.disinfectsystem.entity.basedatamanager.supplier.Supplier; import com.forgon.disinfectsystem.entity.basedatamanager.supplier.SupplierContact; +import com.forgon.disinfectsystem.entity.expensivegoods.ExpensiveGoodsModel; +import com.forgon.disinfectsystem.entity.foreigntousseapplication.ForeignTousseApplication; +import com.forgon.disinfectsystem.entity.invoicemanager.InvoicePlan; import com.forgon.security.tools.Util; import com.forgon.tools.GB2Alpha; import com.forgon.tools.GB2WB; import com.forgon.tools.db.DatabaseUtil; import com.forgon.tools.hibernate.BasePoManagerImpl; import com.forgon.tools.json.JSONUtil; +import com.forgon.tools.string.StringTools; import com.forgon.tools.util.SqlUtils; /** @@ -982,8 +988,423 @@ } return null; } + +/////////////////关联证件表获得供应商或生产厂家/////////////////////////////////// + @Override + public List> searchSupplierNeedVerify(String spell, String type, Long manufacturerId,Long supplierId, Long disposableGoodsID) { + List> mapList = null ; + String sql = null; + //1、模糊查询 + if(StringUtils.isBlank(spell)){ + sql = "where 1=1"; + }else{ + sql = "where (po.spelling like '%" + spell + + "%' or po.wbCode like '%" + spell + + "%' or po.companyName like '%" + spell + + "%')"; + } + //2、如果当前登录用户为外来器械供应商的申请人员时 + if(StringUtils.equals(type, Supplier.SUPPLIER_TYPE_RENTTOUSSE)){ + List supplierNameList = getSupplierNameListByTypeAndUserCode(Supplier.SUPPLIER_TYPE_RENTTOUSSE, AcegiHelper.getLoginUser().getUserName()); + if(CollectionUtils.isNotEmpty(supplierNameList)){ + sql += " and " + SqlUtils.getStringFieldInLargeCollectionsPredicate("companyName", supplierNameList); + } + } + //3、根据类型获取供应商/生产厂家信息 + switch (type) { + case Supplier.SUPPLIER_TYPE_SUPPLIER://供应商 + sql += " and (po.isSupplier = 1 or po.rentTousse = '" + type+"')"; + mapList = getSupplierNeedVerify(sql,spell,manufacturerId,supplierId,disposableGoodsID); + break; + case Supplier.SUPPLIER_TYPE_MADECOMPANY://生产厂家 + sql += " and (po.isManufacturer = 1 or po.rentTousse = '" + type+"')"; + mapList = getMadeCompanyNeedVerify(sql,spell,manufacturerId,supplierId,disposableGoodsID); + break; + } + return mapList; + } + /** + *根据sql语句获得供应商信息(分4种情况) + * @return + */ + private List> getSupplierNeedVerify(String sql,String spell,Long manufacturerId,Long supplierId, Long disposableGoodsID){ + List> mapList = new ArrayList>(); + //情况1.没传一次性物品id,没传生产厂家id + if(!DatabaseUtil.isPoIdValid(manufacturerId) && !DatabaseUtil.isPoIdValid(disposableGoodsID)){ + //获得全部供应商 + String getSupplierSql = "select po.id,po.companyName name from Supplier po "+ sql; + mapList = objectDao.findSqlByParam(getSupplierSql,new Object[]{}); + return mapList; + } + //情况2.有传一次性物品id,没传生产厂家id + if(!DatabaseUtil.isPoIdValid(manufacturerId) && DatabaseUtil.isPoIdValid(disposableGoodsID)){ + DisposableGoods dG = (DisposableGoods) objectDao.getByProperty(DisposableGoods.class.getSimpleName(),"id", disposableGoodsID); + if(dG!=null){ + //2.1判断该物品是否需要授权 + //2-1需要授权 + if(dG.getIsNeedAuthorization()!=null && dG.getIsNeedAuthorization()){ + //根据一次性物品id获得授权的供应商(授权记录有关联一次性物品的供应商/同时是生产厂家也同时是供应商) + String getSupplierSql = "select po.id,po.companyName as name from Supplier po "+ sql + buildGetSqllByDisposableGoods(disposableGoodsID); + mapList = objectDao.findSqlByParam(getSupplierSql,new Object[]{}); + //根据一次性物品的生产厂家 获得授权的供应商(授权记录没有关联一次性物品的供应商) + //根据一次性物品id 查出该物品的生产厂家 + // String hql = String.format("select po.supplier.id from Certificate po join po.disposableGoodss dgs" + // + " where po.type = '%s' and po.isNowUsing = 1 and dgs.id = %s",Certificate.CERTIFICATE_TYPE_REGISTRATIONCERTIFICATE, disposableGoodsID); + // List manufacturerIdList = objectDao.findByHql(hql); + // String addSql2 = String.format(" and po.id in(" + // +" select supplier_id from Certificate where isnowUsing =1 and AuthorizationRecord_Id in (" + // + "select ar.id from AuthorizationRecord ar where %s " + // + "and not exists (select * from AUZRecord_DisposableGoods adg where adg.authorizationRecord_id = ar.id)))", + // SqlUtils.getNonStringFieldInCollectionsPredicate("ar.manufacturerId",manufacturerIdList)); + // String getSupplierSql2 = "select po.id,po.companyName as name from Supplier po "+ sql + addSql2; + //两个sql语句合拼查询 + // String getSupplierSql = getSupplierSql1 + " union " + getSupplierSql2; + // mapList = objectDao.findSqlByParam(getSupplierSql,new Object[]{}); + return mapList; + //2-2不需要授权 + }else{ + //获得该物品的(正在使用)注册证下关联的供应商 + String sql2 = String.format(" and po.id in(select rs.supplier_id from REG_Supplier rs where rs.registrationCertificate_id " + +" in (select cf.id from Certificate cf join REG_DisposableGoods rd on cf.id = rd.registrationCertificate_id " + + "where rd.disposableGoods_id= %s and cf.isNowUsing=1))" + , disposableGoodsID); + String getSupplierSql = "select po.id,po.companyName name from Supplier po "+ sql + sql2; + mapList = objectDao.findSqlByParam(getSupplierSql,new Object[]{}); + return mapList; + } + }else{ + throw new RuntimeException("根据id:"+disposableGoodsID+"获取不到一次性物品!"); + } + } + //情况3.有传生产厂家id,有传一次性物品id + if(DatabaseUtil.isPoIdValid(manufacturerId) && DatabaseUtil.isPoIdValid(disposableGoodsID)){ + DisposableGoods dG = (DisposableGoods) objectDao.getByProperty(DisposableGoods.class.getSimpleName(),"id", disposableGoodsID); + if(dG!=null){ + //3.1判断该物品是否需要授权 + //3-1需要授权 + if(dG.getIsNeedAuthorization()!=null && dG.getIsNeedAuthorization()){ + //拼接sql语句:根据生产厂家id,一次性物品id获得该生产厂家下有被授权该一次性物品的供应商 + String getSupplierSql = "select po.id,po.companyName as name from Supplier po "+ sql + buildGetSqllByDisposableGoodsAndManufacturerId(disposableGoodsID,manufacturerId); + mapList = objectDao.findSqlByParam(getSupplierSql,new Object[]{}); + return mapList; + //3-2不需要授权 + }else{ + //获得该物品的注册证下关联的供应商 + String sql2 = String.format(" and po.id in(select rs.supplier_id from REG_Supplier rs where rs.registrationCertificate_id " + + " in(select rd.registrationCertificate_id from REG_DisposableGoods rd where rd.disposableGoods_id = %s))" + , disposableGoodsID); + String getSupplierSql = "select po.id,po.companyName name from Supplier po "+ sql + sql2; + mapList = objectDao.findSqlByParam(getSupplierSql,new Object[]{}); + return mapList; + } + } + return mapList; + } + //情况4.有传生产厂家id,没传一次性物品id + if(DatabaseUtil.isPoIdValid(manufacturerId) && !DatabaseUtil.isPoIdValid(disposableGoodsID)){ + //4.1通过生产厂家id获得该生产厂家下的供应商(该生产厂家也有可能还是供应商) + String sql2 = String.format(" and (po.id in " + + " (select Supplier_Id from Certificate where isnowUsing = 1 " + + " and AuthorizationRecord_Id in(select id from AuthorizationRecord where manufacturerId = %s))" + + " or id = %s )",manufacturerId,manufacturerId); + String getSupplierSql = "select po.id,po.companyName as name from Supplier po "+ sql + sql2; + mapList = objectDao.findSqlByParam(getSupplierSql,new Object[]{}); + return mapList; + } + return mapList; + } + + //返回sql语句:根据一次性物品id获得授权的供应商,注册证的生产厂家 + private String buildGetSqllByDisposableGoods(Long disposableGoodsID){ + String sql =""; + if(DatabaseUtil.isPoIdValid(disposableGoodsID)){ + sql = String.format(" and (po.id in ( " + + " select supplier_id from Certificate where isnowUsing = 1 and AuthorizationRecord_Id in (" + + " select AuthorizationRecord_id from AUZRecord_DisposableGoods where DisposableGoods_Id = %s ))" + + " or po.id in ( " + + " select supplier_id from Certificate where isnowUsing =1 and id in ( " + + " select registrationCertificate_id from REG_DisposableGoods where DisposableGoods_Id = %s )))" + ,disposableGoodsID,disposableGoodsID); + } + return sql; + } + + //返回sql语句:根据生产厂家id,一次性物品id获得该生产厂家下有被授权该一次性物品的供应商(包括授权记录没关联一次性物品) + private String buildGetSqllByDisposableGoodsAndManufacturerId(Long disposableGoodsID, Long manufacturerId) { + String sql =""; + if(DatabaseUtil.isPoIdValid(disposableGoodsID) && DatabaseUtil.isPoIdValid(manufacturerId)){ + sql = String.format(" and (po.id in(" + +"select supplier_id from Certificate where isnowUsing = 1 and AuthorizationRecord_Id in(" + +" select ar.id from AuthorizationRecord ar where ar.manufacturerId = %s" + +" and ar.id in( " + +" select AuthorizationRecord_id from AUZRecord_DisposableGoods where DisposableGoods_Id = %s)" + // + "or not exists (select * from AUZRecord_DisposableGoods adg where adg.authorizationRecord_id = ar.id))" + +" ))or id = %s)",manufacturerId,disposableGoodsID,manufacturerId); + } + return sql; + } + + /** + * 根据sql语句获得生产厂家信息(分4种情况) + * @return + */ + private List> getMadeCompanyNeedVerify(String sql,String spell,Long manufacturerId,Long supplierId, Long disposableGoodsID){ + List> mapList = new ArrayList>() ; + //情况1.没传一次性物品id,没传供应商id + if(!DatabaseUtil.isPoIdValid(disposableGoodsID) && !DatabaseUtil.isPoIdValid(supplierId)){ + //获得全部生产厂家 + String getSupplierSql = "select po.id,po.companyName as name from Supplier po "+ sql ; + mapList = objectDao.findSqlByParam(getSupplierSql,new Object[]{}); + return mapList; + } + //情况2.有传一次性物品id,没传供应商id + if(DatabaseUtil.isPoIdValid(disposableGoodsID) && !DatabaseUtil.isPoIdValid(supplierId)){ + //拼接sql语句:根据一次性物品id获得注册证的生产厂家 + String sql2 = String.format(" and po.id in (" + + "select supplier_id from Certificate where isnowUsing =1 and id in(" + + "select registrationCertificate_id from REG_DisposableGoods where DisposableGoods_Id = %s))", disposableGoodsID); + String getSupplierSql = "select po.id,po.companyName as name from Supplier po "+ sql + sql2; + mapList = objectDao.findSqlByParam(getSupplierSql,new Object[]{}); + return mapList; + } + //情况3.有传一次性物品id,有传供应商id + if(DatabaseUtil.isPoIdValid(disposableGoodsID) && DatabaseUtil.isPoIdValid(supplierId)){ + DisposableGoods dG = (DisposableGoods) objectDao.getByProperty(DisposableGoods.class.getSimpleName(),"id", disposableGoodsID); + if(dG!=null){ + //3.1判断该物品是否需要授权 + //3-1需要授权 + if(dG.getIsNeedAuthorization()!=null && dG.getIsNeedAuthorization()){ + //拼接sql语句:通过供应商id,一次性物品id获得该物品授权的生产厂家(供应商也可能同时为生产厂家) + String sql2 = String.format("and (po.id in(" + + " select manufacturerId from AuthorizationRecord where Authorized_Id = %s and id in(" + + " select authorizationRecord_id from AUZRecord_DisposableGoods where DisposableGoods_Id = %s))or id = %s)" + , supplierId,disposableGoodsID,supplierId); + String getSupplierSql = "select po.id,po.companyName as name from Supplier po "+ sql +sql2; + mapList = objectDao.findSqlByParam(getSupplierSql,new Object[]{}); + //3-2不需要授权则 + }else{ + //拼接sql语句:根据一次性物品id获得注册证的生产厂家 + String sql2 = String.format(" and po.id in (" + + "select supplier_id from Certificate where isnowUsing =1 and id in(" + + "select registrationCertificate_id from REG_DisposableGoods where DisposableGoods_Id = %s))", disposableGoodsID); + String getSupplierSql = "select po.id,po.companyName as name from Supplier po "+ sql + sql2; + mapList = objectDao.findSqlByParam(getSupplierSql,new Object[]{}); + } + } + return mapList; + } + //情况4.没传一次性物品id,有传供应商id + if(!DatabaseUtil.isPoIdValid(disposableGoodsID) && DatabaseUtil.isPoIdValid(supplierId)){ + //拼接sql语句:根据供应商id获得生产厂家(供应商也可能同时是生产厂家) + String sql2 = String.format(" and (po.id in(select manufacturerId from AuthorizationRecord where Authorized_Id = %s)or id = %s)", supplierId,supplierId); + String getSupplierSql = "select po.id,po.companyName as name from Supplier po "+ sql + sql2; + mapList = objectDao.findSqlByParam(getSupplierSql,new Object[]{}); + return mapList; + } + return mapList; + } + + /** + * 注册证号集合 + */ @Override + public List> getCertificationListByManufacturerIdAndDisposableGoodsID(String disposableGoodsID,String manufacturerId) { + List> mapList = new ArrayList>(); + if(DatabaseUtil.isPoIdValid(manufacturerId)){ + //根据生产厂家id获得 + String sql = String.format("where po.Supplier_Id = %s and po.type = '%s' and isNowUsing = 1", + manufacturerId, Certificate.CERTIFICATE_TYPE_REGISTRATIONCERTIFICATE); + //一次性物品id过滤 + if( DatabaseUtil.isPoIdValid(disposableGoodsID)){ + sql += " and po.id in(select registrationCertificate_id from REG_DisposableGoods where disposableGoods_id = "+ disposableGoodsID+")"; + } + String getCertificateSql = "select po.id,po.certificateNumber from Certificate po "+sql; + mapList = objectDao.findSqlByParam(getCertificateSql,new Object[]{}); + } + return mapList; + } + + @Override + public JSONObject checkItemValidity(String disposableGoodsID,String supplierId, String manufacturerId, + String certificationId,Boolean needVerifyCertification) { + JSONObject resultJson = null; + if(DatabaseUtil.isPoIdValid(disposableGoodsID) && DatabaseUtil.isPoIdValid(supplierId) && DatabaseUtil.isPoIdValid(manufacturerId)){ + //获取一次性物品 + DisposableGoods disposableGood = (DisposableGoods) objectDao.getByProperty(DisposableGoods.class.getSimpleName(),"id", Long.parseLong(disposableGoodsID)); + if(disposableGood == null){ + throw new RuntimeException("获取不到id为:"+disposableGood+"的一次性物品!"); + } + Supplier manufacturer = this.get(manufacturerId);//生产厂家 + Supplier supplier = this.get(supplierId);//供应商 + //1.校验该生产厂家的相关证件是否有效 + resultJson = checkSupplierOrManufacturerValidity(manufacturer,manufacturer,disposableGood,certificationId, needVerifyCertification); + if(!resultJson.isEmpty()){ + return resultJson; + } + //2-1.该物品需要授权(需要校验供应商授权关系)检查该供应商的上一级授权的厂商相关证件是否有效,直到检查到该生产厂家为止 + if(disposableGood.getIsNeedAuthorization() != null && disposableGood.getIsNeedAuthorization()){ + resultJson = checkSupplierValidity(supplier,manufacturer,disposableGood,certificationId, needVerifyCertification); + return resultJson; + }else{ + //2-2.该物品不需要授权(不需要校验授权)检查该供应商的相关证件有效 + resultJson = checkSupplierOrManufacturerValidity(supplier,manufacturer,disposableGood,certificationId, needVerifyCertification); + return resultJson; + } + }else{ + throw new RuntimeException("获取不到有效的参数!"); + } + } + + /** + * 递归校验供应商 + * 直到上一级厂商id等于生产厂家id 或 厂商为空则跳出递归 + * @param supplier + * @param manufacturer + * @param disposableGood + * @param certificationId + * @param needVerifyCertification + * @return + */ + private JSONObject checkSupplierValidity(Supplier supplier, Supplier manufacturer ,DisposableGoods disposableGood + ,String certificationId,Boolean needVerifyCertification){ + JSONObject resultJson = new JSONObject(); + //1.这级厂商id等于生产厂家id 或 则级厂商为空则跳出递归 + if(supplier != null && !supplier.getId().equals(manufacturer.getId())){ + //2.校验供应商 + resultJson = checkSupplierOrManufacturerValidity(supplier,manufacturer,disposableGood,certificationId,needVerifyCertification); + if(resultJson.isEmpty()){ + //2.1查找上一级的被授权厂商(通过生产厂家id,一次性物品id,供应商id) + String hql = String.format("select ar.authorizer from AuthorizationRecord ar join ar.disposableGoodss dg" + + " where ar.authorized = %s and ar.manufacturerId = %s and dg.id = %s",supplier.getId(),manufacturer.getId(),disposableGood.getId()); + @SuppressWarnings("unchecked") + List authorizers = objectDao.findByHql(hql); + // if(CollectionUtils.isNotEmpty(authorizers)){ + //递归校验直到查到生产厂家 + return checkSupplierValidity(authorizers.get(0),manufacturer,disposableGood,certificationId,needVerifyCertification); + // }else{ + // //2.2 若找不到上一级厂商则(可能是没关联一次性物品的全部授权) + // //查找上一级的被授权厂商(导入时全部物品授权则不关联一次性物品) + // String hql2 = String.format("select ar.authorizer from AuthorizationRecord ar" + // + " where ar.authorized = %s and ar.manufacturerId = %s and not exists (select a from AuthorizationRecord a inner join a.disposableGoodss)" + // , supplier.getId(),manufacturer.getId()); + // @SuppressWarnings("unchecked") + // List authorizer2 = objectDao.findByHql(hql2); + // //递归校验直到查到生产厂家 + // return checkSupplierValidity(authorizer2.get(0),manufacturer,disposableGood,certificationId); + // } + }else{ + return resultJson; + } + } + return resultJson; + } + + /** + * 校验生产厂家/供应商是否有正在用的相关证件 + * 1.若是:供应商(1.营业执照 2.经营许可证 3.授权书 4.法人授权委托书 5.质量保证书) + * 1-1 该物品需要授权 且 该供应商不等于传入的生产厂家 :则校验授权证(该物品厂商是供应商同时是生产厂家下该厂商不用授权证) + * 2.若是:生产厂家(1.营业执照 2.生产许可证 3.注册证) + * 2-1 该生产厂家是供应商同时是生产厂家 但不等于传入的生产厂家 :则不需要校验该厂家 + * 2-2 needVerifyCertification为false:不需要校验传入的注册证 + * @param supplier 供应商 + * @param manufacturer 生产厂家 + * @param dG 一次性物品 + * @param certificationId 注册证id + * @param needVerifyCertification(是否需要校验传入的注册证) + * @return + */ + private JSONObject checkSupplierOrManufacturerValidity(Supplier supplier, Supplier manufacturer ,DisposableGoods dG + ,String certificationId,Boolean needVerifyCertification){ + JSONObject resultJson = new JSONObject(); + Long supplierId = supplier.getId();//厂商id(生产厂家/供应商) + Long manufacturerId = manufacturer.getId();//生产厂家id + Long disposableGoodsID = dG.getId();//一次性物品id + //获得厂商下正在使用的证件(除了授权证和注册证) + @SuppressWarnings("unchecked") + List certificateList = objectDao.findBySql(Certificate.class.getSimpleName(), + String.format("where po.supplier.id = %s and po.isNowUsing = 1 and po.type not in('%s','%s')", + supplierId,Certificate.CERTIFICATE_TYPE_AUTHORIZATIONCERTIFICATE,Certificate.CERTIFICATE_TYPE_REGISTRATIONCERTIFICATE)); + //1.若是:供应商(1.营业执照 2.经营许可证 3.授权书 4.法人授权委托书 5.质量保证书) + if(supplier.getIsSupplier()!=null && supplier.getIsSupplier()){ + //1-1.授权证(该物品需要授权且该厂商不是页面传的生产厂家 则校验授权证) + if((dG.getIsNeedAuthorization() != null && dG.getIsNeedAuthorization()) && supplierId != manufacturerId){ + //获得该生产厂家下该物品的供应商正在使用的授权证(包括授权记录没关联一次性物品) + String sql = String.format("select count(*) from Certificate po where po.Supplier_Id = %s and po.type='%s' and po.isNowUsing =1 " + + " and po.AuthorizationRecord_Id in (select ar.id from AuthorizationRecord ar where ar.manufacturerId = %s " + + " and (ar.id in (select distinct authorizationRecord_id from AUZRecord_DisposableGoods where DisposableGoods_Id = %s)))" + //+ " or not exists (select * from AUZRecord_DisposableGoods adg where adg.authorizationRecord_id = ar.id)))" + ,supplierId,Certificate.CERTIFICATE_TYPE_AUTHORIZATIONCERTIFICATE,manufacturerId,disposableGoodsID); + int isNowUsingAtuhorCount = objectDao.countBySql(sql); + if(isNowUsingAtuhorCount == 0){ + resultJson.put("message",String.format("生产厂家'%s'下物品%s的供应商'%s'没有正在使用的授权证!", manufacturer.getCompanyName(),dG.getName(),supplier.getCompanyName())); + return resultJson; + } + } + //1-2.经营许可证 + if(certificateList.stream().noneMatch(cc -> Certificate.CERTIFICATE_TYPE_BUSINESSCERTIFICATE.equals(cc.getType()))){ + resultJson.put("message",String.format("供应商'%s'没有正在使用的经营许可证!",supplier.getCompanyName())); + return resultJson; + } + //1-3.营业执照 + if(certificateList.stream().noneMatch(cc -> Certificate.CERTIFICATE_TYPE_BUSINESSLICENSE.equals(cc.getType()))){ + resultJson.put("message",String.format("供应商'%s'没有正在使用的营业执照!",supplier.getCompanyName())); + return resultJson; + } + //1-4.法人授权委托书 + if(certificateList.stream().noneMatch(cc -> Certificate.CERTIFICATE_TYPE_AUTHORIZATIONLETTER.equals(cc.getType()))){ + resultJson.put("message",String.format("供应商'%s'没有正在使用的法人授权委托书!",supplier.getCompanyName())); + return resultJson; + } + //1-5. 质量保证书 + if(certificateList.stream().noneMatch(cc -> Certificate.CERTIFICATE_TYPE_QUALITYGUARANTEE.equals(cc.getType()))){ + resultJson.put("message",String.format("供应商'%s'没有正在使用的质量保证书!",supplier.getCompanyName())); + return resultJson; + } + } + //2.若是:生产厂家且该厂商是页面传的生产厂家(1.营业执照 2.生产许可证 3.注册证) + else if(supplier.getIsManufacturer() !=null && supplier.getIsManufacturer() && supplierId == manufacturerId){ + //2-1.注册证 + if(needVerifyCertification){//是否需要校验前台注册证 + //2-1-1获得该生产厂家的一次性物品正在使用的注册证(根据 注册证号id,生产厂家id,一次性物品id ) + Certificate cf = (Certificate) objectDao.getByProperty(Certificate.class.getSimpleName(),"id", Long.parseLong(certificationId)); + String sql = String.format("select count(*) from Certificate po where po.id = %s and po.Supplier_Id = %s and po.isNowUsing = 1 and po.type='%s'" + + " and po.id in( select distinct registrationCertificate_id from REG_DisposableGoods where DisposableGoods_Id = %s)", + certificationId,supplierId,Certificate.CERTIFICATE_TYPE_REGISTRATIONCERTIFICATE,disposableGoodsID); + int isNowUsingCertificationCount = objectDao.countBySql(sql); + if(isNowUsingCertificationCount == 0){ + resultJson.put("message",String.format("物品'%s'的生产厂家'%s'下没有正在使用的注册证'%s'!",dG.getName(),supplier.getCompanyName(),cf.getCertificateNumber())); + return resultJson; + } + }else{ + //2-1-2获得该生产厂家的一次性物品正在使用的注册证(根据 生产厂家id,一次性物品id ) + String sql = String.format("select count(*) from Certificate po where po.Supplier_Id = %s and po.isNowUsing = 1 and po.type='%s'" + + " and po.id in( select distinct registrationCertificate_id from REG_DisposableGoods where DisposableGoods_Id = %s)" + ,supplierId,Certificate.CERTIFICATE_TYPE_REGISTRATIONCERTIFICATE,disposableGoodsID); + int isNowUsingCertificationCount = objectDao.countBySql(sql); + if(isNowUsingCertificationCount == 0){ + resultJson.put("message",String.format("物品'%s'的生产厂家'%s'下没有正在使用的注册证!",dG.getName(),supplier.getCompanyName())); + return resultJson; + } + } + //2-2. 营业执照 + if(certificateList.stream().noneMatch(cc -> Certificate.CERTIFICATE_TYPE_BUSINESSLICENSE.equals(cc.getType()))){ + resultJson.put("message",String.format("生产厂家'%s'没有正在使用的营业执照!",supplier.getCompanyName())); + return resultJson; + } + //2-3.生产许可证 + if(certificateList.stream().noneMatch(cc -> Certificate.CERTIFICATE_TYPE_PRODUCTIONCERTIFICATE.equals(cc.getType()))){ + resultJson.put("message",String.format("生产厂家'%s'没有正在使用的生产许可证!",supplier.getCompanyName())); + return resultJson; + } + }else{ + throw new RuntimeException("未找到:"+supplier.getCompanyName()+"的类型!"); + } + return resultJson; + } +//////////////////////////////////// + + @Override public List getSupplierNameListByTypeAndUserCode(String supplierType , String userCode){ String hql = "select companyName from " + Supplier.class.getSimpleName() + " where rentTousse='"+ supplierType +"'"; //以及所有未配置申请人员的供应商 Index: ssts-diposablegoods/src/main/java/com/forgon/disinfectsystem/diposablegoods/service/GoodPurchasePlanManagerImpl.java =================================================================== diff -u -r23133 -r23512 --- ssts-diposablegoods/src/main/java/com/forgon/disinfectsystem/diposablegoods/service/GoodPurchasePlanManagerImpl.java (.../GoodPurchasePlanManagerImpl.java) (revision 23133) +++ ssts-diposablegoods/src/main/java/com/forgon/disinfectsystem/diposablegoods/service/GoodPurchasePlanManagerImpl.java (.../GoodPurchasePlanManagerImpl.java) (revision 23512) @@ -704,13 +704,13 @@ } //若部分入库的明细数量>0 则采购单状态为:部分入库 if(partGodownList.size()>0){ - goodPurchasePlan.setStockStatus(goodPurchasePlan.STOCK_STATUS_PART_GODOWN); + goodPurchasePlan.setStockStatus(GoodPurchasePlan.STOCK_STATUS_PART_GODOWN); } //若已入库明细数量=采购明细数量 则采购单状态为:已入库 else if(godownedList.size()== gpItemList.size()){ - goodPurchasePlan.setStockStatus(goodPurchasePlan.STOCK_STATUS_GODOWNED); + goodPurchasePlan.setStockStatus(GoodPurchasePlan.STOCK_STATUS_GODOWNED); }else{ - goodPurchasePlan.setStockStatus(goodPurchasePlan.STOCK_STATUS_UNGODOWN); + goodPurchasePlan.setStockStatus(GoodPurchasePlan.STOCK_STATUS_UNGODOWN); } return goodPurchasePlan; }