Index: ssts-web/src/main/webapp/disinfectsystem/invoice/materialInvoiceView.js =================================================================== diff -u -r26354 -r26359 --- ssts-web/src/main/webapp/disinfectsystem/invoice/materialInvoiceView.js (.../materialInvoiceView.js) (revision 26354) +++ ssts-web/src/main/webapp/disinfectsystem/invoice/materialInvoiceView.js (.../materialInvoiceView.js) (revision 26359) @@ -27,13 +27,15 @@ var MaterialInvoiceItemRecord = Ext.data.Record.create([ {name : 'id'}, + {name : 'tousseDefinitionId'}, {name : 'materialDefinitionId'}, {name : 'materialName'}, {name : 'amount'}, {name : 'storage'}, {name : 'userecordId'}, {name : 'userecordName'}, - {name : 'userecordDepartCoding'} + {name : 'userecordDepartCoding'}, + {name : 'tousseName'} ]); var departRecord = Ext.data.Record.create([ @@ -159,8 +161,7 @@ {name : 'cost',mapping : 'cost'}, {name : 'displayName',mapping : 'displayName'}, {name : 'spelling',mapping : 'spelling'}, - {name : 'storage',mapping : 'storage'}, - {name : 'type',mapping : 'type'} + {name : 'storage',mapping : 'storage'} ]), listeners : { beforeload : function(store,option) { @@ -212,12 +213,23 @@ showResult("发货数量不能大于库存数量!"); return false; } - for(var i = 0;i < top.Ext.getCmp('materialInvoiceItemGrid').getStore().getCount();i++){ - if(top.Ext.getCmp('materialInvoiceItemGrid').getStore().getAt(i).data.materialDefinitionId == materialDefinitionId - && top.Ext.getCmp('materialInvoiceItemGrid').getStore().getAt(i).data.userecordDepartCoding == userecordDepartCoding){ - showResult("该物品以及关联的使用记录已经存在,不能重复添加!"); - return false; + // + if (!top.Ext.getCmp('materialInvoiceItemGrid').getStore().getAt(i).data.tousseDefinitionId + || top.Ext.getCmp('materialInvoiceItemGrid').getStore().getAt(i).data.tousseDefinitionId == '') { + if(top.Ext.getCmp('materialInvoiceItemGrid').getStore().getAt(i).data.materialDefinitionId == materialDefinitionId + && top.Ext.getCmp('materialInvoiceItemGrid').getStore().getAt(i).data.userecordId == userecordId){ + showResult("该物品以及关联的使用记录已经存在,不能重复添加!"); + top.Ext.getCmp('name1').setValue(''); + top.Ext.getCmp('cost').setValue(''); + top.Ext.getCmp('amount1').setValue(''); + top.Ext.getCmp('materialDefinitionId').setValue(''); + top.Ext.getCmp('userecordId').setValue(''); + top.Ext.getCmp('userecordName').setValue(''); + top.Ext.getCmp('userecordDepartCoding').setValue(''); + top.Ext.getCmp('name1').focus(); + return false; + } } } @@ -262,8 +274,17 @@ for(var i = 0;i < top.Ext.getCmp('materialInvoiceItemGrid').getStore().getCount();i++){ if(top.Ext.getCmp('materialInvoiceItemGrid').getStore().getAt(i).data.tousseDefinitionId == tousseDefinitionId - && top.Ext.getCmp('materialInvoiceItemGrid').getStore().getAt(i).data.userecordDepartCoding == userecordDepartCoding){ - showResult("该物品以及关联的使用记录已经存在,不能重复添加!"); + && top.Ext.getCmp('materialInvoiceItemGrid').getStore().getAt(i).data.userecordId == userecordId){ + showResult("该器械包物品以及关联的使用记录已经存在,不能重复添加!"); + top.Ext.getCmp('toussedefinitionId').setValue(''); + top.Ext.getCmp('name2').setValue(''); + top.Ext.getCmp('cost').setValue(''); + top.Ext.getCmp('amount1').setValue(''); + top.Ext.getCmp('materialDefinitionId').setValue(''); + top.Ext.getCmp('userecordId').setValue(''); + top.Ext.getCmp('userecordName').setValue(''); + top.Ext.getCmp('userecordDepartCoding').setValue(''); + top.Ext.getCmp('name2').focus(); return false; } } @@ -303,7 +324,6 @@ } }); top.Ext.getCmp('toussedefinitionId').setValue(''); - top.Ext.getCmp('type').setValue(''); top.Ext.getCmp('name2').setValue(''); top.Ext.getCmp('cost').setValue(''); top.Ext.getCmp('amount1').setValue(''); @@ -502,7 +522,6 @@ cm : new Ext.grid.ColumnModel([new Ext.grid.RowNumberer(), {header : "id",dataIndex : 'id',hidden : true}, {header : "materialDefinitionId",dataIndex : 'materialDefinitionId',hidden : true}, - {header : "tousseDefinitionId",dataIndex : 'tousseDefinitionId',hidden : true}, {header : "器械包名称",dataIndex : 'tousseName',width : 50}, {header : "材料名称",dataIndex : 'materialName',width : 50,menuDisabled : true, editor : new top.Ext.form.ComboBox({ @@ -545,8 +564,8 @@ } })*/ }, - {header : "单价",width : 20,menuDisabled : true,dataIndex : 'singlePrice', id:'singlePrice'}, - {header : " 数量",dataIndex : 'amount',width : 20,menuDisabled : true, + {header : "单价",width : 20,menuDisabled : true,dataIndex : 'singlePrice', id:'singlePrice', align:'center'}, + {header : " 数量",dataIndex : 'amount',width : 20,menuDisabled : true, align:'center', editor : new Ext.form.TextField({ regex: /^\d+$/, regexText:'只能输入数字', @@ -568,10 +587,6 @@ id : 'toussedefinitionId' },{ xtype : 'hidden', - name : 'type', - id : 'type' - },{ - xtype : 'hidden', name : 'tousseName', id : 'tousseName' },{ @@ -608,7 +623,6 @@ width : 150, listeners : { select : function(combo, record, index) { - top.Ext.getCmp('type').setValue(record.data.type); // 器械包 top.Ext.getCmp('toussedefinitionId').setValue(record.data.id); top.Ext.getCmp('tousseName').setValue(record.data.name); @@ -707,10 +721,9 @@ text : '添加', iconCls : 'btn_ext_add', handler : function() { - var type = top.Ext.getCmp('type').getValue(); - if (type !== '') { + var toussedefinitionId = top.Ext.getCmp('toussedefinitionId').getValue(); + if (toussedefinitionId !== '') { // 器械包材料 - var toussedefinitionId = top.Ext.getCmp('toussedefinitionId').getValue(); var tousseName = top.Ext.getCmp('tousseName').getValue(); var amount = top.Ext.getCmp('amount1').getValue(); var userecordId = top.Ext.getCmp('userecordId').getValue(); @@ -768,6 +781,8 @@ jsonArray[len].materialName = record.data.materialName; jsonArray[len].amount = record.data.amount; jsonArray[len].userecordId = record.data.userecordId; + jsonArray[len].tousseName = record.data.tousseName; + jsonArray[len].tousseDefinitionId = record.data.tousseDefinitionId; } top.Ext.getCmp("materialInvoiceItem").setValue(Ext.encode(jsonArray)); @@ -1009,6 +1024,7 @@ var materialInvoiceItem = new MaterialInvoiceItemRecord({ id : action.result.data.materialInvoiceItemList[i].id, materialDefinitionId : action.result.data.materialInvoiceItemList[i].materialDefinitionId, + tousseName : action.result.data.materialInvoiceItemList[i].tousseName, materialName : materialName, singlePrice : action.result.data.materialInvoiceItemList[i].price, amount : action.result.data.materialInvoiceItemList[i].amount,