Index: ssts-web/src/main/webapp/disinfectsystem/stocktakeinfomanager/stockTakeInfoView.js =================================================================== diff -u -r12724 -r12804 --- ssts-web/src/main/webapp/disinfectsystem/stocktakeinfomanager/stockTakeInfoView.js (.../stockTakeInfoView.js) (revision 12724) +++ ssts-web/src/main/webapp/disinfectsystem/stocktakeinfomanager/stockTakeInfoView.js (.../stockTakeInfoView.js) (revision 12804) @@ -143,6 +143,7 @@ hideTrigger : true, typeAhead : false, allowBlank : true, + disabled:true, width : 220, listeners : { select : function(combo, record, index) { @@ -159,7 +160,7 @@ // 清空批次 clearBatchNumber(); // DiposableGoodsTableManager.getBatchNumbersByDiposableGoodsId(record.data.id,"inStock",function(batchNumbers){ - DiposableGoodsTableManager.getBatchsByDiposableGoodsId(record.data.id,false,function(batchesStr){ + DiposableGoodsTableManager.getBatchsByDiposableGoodsId(record.data.id,top.Ext.getCmp('wareHouseId').getValue(),false,function(batchesStr){ var batches = JSON.parse(batchesStr); // alert(batchesStr) transBatchesDate(batches); @@ -205,6 +206,7 @@ listWidth:300, anchor : '95%', editable:false, + disabled:true, listeners : { select : function(combo, record, index) { var batch = record.data; @@ -252,6 +254,7 @@ width : 50, regex: /^\d+$/, regexText:'只能输入数字', + disabled:true, listeners : { specialkey : function(field, e) { if (e.getKey() == Ext.EventObject.ENTER) { @@ -280,6 +283,7 @@ name : 'barcode', width :100, enableKeyEvents : true, + disabled:true, listeners : { render : function(c) { c.getEl().on('keypress',function(e) { @@ -303,16 +307,19 @@ fields: [ {name : 'id',mapping : 'id'}, {name : 'name',mapping : 'name'} - ], + ]/*, listeners : { load : function(store,records) { if(records.length > 0 && id == "") { + if (top.Ext.getCmp('wareHouseId')) { + top.Ext.getCmp('wareHouseId').setValue(records[0].data.id); + } if (top.Ext.getCmp('wareHouseName')) { - top.Ext.getCmp('wareHouseName').setValue(records[0].data.id); + top.Ext.getCmp('wareHouseName').setValue(records[0].data.name); } } } - } + }*/ }); var form = new top.Ext.FormPanel({ @@ -359,6 +366,10 @@ name : 'wareHouseId', id : 'wareHouseId' },{ + xtype : 'hidden', + name : 'wareHouseName', + id : 'wareHouseName' + },{ columnWidth : .3, layout : 'form', labelWidth : 50, @@ -395,16 +406,27 @@ items : [{ xtype : 'combo', fieldLabel : '仓库', - id : 'wareHouseName', - name : 'wareHouseName', + id : 'wareHouse', + name : 'wareHouse', editable:false, valueField : 'id', displayField : 'name', store : wareHouseStore, forceSelection : true, allowBlank : false, triggerAction : 'all', - anchor : '95%' + anchor : '95%', + listeners : { + select : function(combo, record, index) { + top.Ext.getCmp('wareHouseId').setValue(combo.value); + top.Ext.getCmp('wareHouseName').setValue(combo.getRawValue()); + + top.Ext.getCmp('tempName').setDisabled(false); + top.Ext.getCmp('batchNumber').setDisabled(false); + top.Ext.getCmp('tempAmount').setDisabled(false); + top.Ext.getCmp('barcode').setDisabled(false); + } + } }] }, { columnWidth : 1, @@ -497,10 +519,19 @@ top.Ext.getCmp('stockTakeDate').setValue(Ext.util.Format.date(new Date(action.result.data.stockTakeDate.time), 'Y-m-d H:i')); top.Ext.getCmp('stockTakeItemGrid').getStore().loadData(action.result.data.stockTakeItems); + top.Ext.getCmp('wareHouseId').setRawValue(action.result.data.wareHouseId); + top.Ext.getCmp('wareHouseName').setValue(action.result.data.wareHouseName); + top.Ext.getCmp('wareHouse').setRawValue(action.result.data.wareHouseName); + // 保存原始数据,只需要保存需要修改的属性 - setOriginalFormParams(form,['id','remark','type','stockTakeDate']); + setOriginalFormParams(form,['id','remark','type','stockTakeDate','wareHouseId','wareHouseName']); var originalItems = buildJSONStringFromStore(top.Ext.getCmp('stockTakeItemGrid').getStore()); top.Ext.getCmp("originalItems").setValue(originalItems); + + top.Ext.getCmp('tempName').setDisabled(false); + top.Ext.getCmp('batchNumber').setDisabled(false); + top.Ext.getCmp('tempAmount').setDisabled(false); + top.Ext.getCmp('barcode').setDisabled(false); }, failure : function(form, action) { } @@ -518,14 +549,13 @@ btThis.enable(); return false; } - setFormParams(form,['id','remark','type','stockTakeDate']); + setFormParams(form,['id','remark','type','stockTakeDate','wareHouseId','wareHouseName']); var items = buildJSONStringFromStore(top.Ext.getCmp('stockTakeItemGrid').getStore()); top.Ext.getCmp("items").setValue(items); - top.Ext.getCmp("wareHouseId").setValue(top.Ext.getCmp("wareHouseName").getValue()); - if(items == '[]'){ showResult('盘点明细列表不能为空'); + btThis.enable(); return false; } @@ -552,7 +582,7 @@ grid.dwrReload(); }, failure : function(form, action) { - showResult('系统出错,请稍候再试'); + showResult(action.result.message); } }); }else{ @@ -577,7 +607,7 @@ } function addDiposableGoodsItems() { - var batch = getSelectedBatch(); + var batchStock = getSelectedBatch(); var tempName = top.Ext.getCmp('tempName'); var tempbatchNumber = top.Ext.getCmp('batchNumber'); var tempAmount = top.Ext.getCmp('tempAmount'); @@ -586,13 +616,13 @@ showResult('请输入'+type+'名称!'); return; } - if(isUndefinedOrNull(batch)){ + if(isUndefinedOrNull(batchStock)){ showResult('请选择批次号!'); return; } - var diposableGoodsID = batch.diposableGoods.id; - var batchID = batch.id; - var batchNumber = batch.batchNumber; + var diposableGoodsID = batchStock.diposableGoods.id; + var batchID = batchStock.disposableGoodsBatchID; + var batchNumber = batchStock.batchNumber; if(batchNumber == '') { showResult('请选择批次号!'); return; @@ -604,7 +634,7 @@ } var stockTakeItemStore = top.Ext.getCmp('stockTakeItemGrid').getStore(); - var name = batch.diposableGoods.showName; + var name = batchStock.diposableGoods.showName; // 物品是否重复 for(var i = 0;i < stockTakeItemStore.getCount();i++){ var item = stockTakeItemStore.getAt(i).data; @@ -614,10 +644,10 @@ } } var actualCountedQuantity = parseInt(tempAmount.getValue(),10); - var storageDifference = actualCountedQuantity - batch.storage; + var storageDifference = actualCountedQuantity - batchStock.storage; var stockTakeItemRecord = new StockTakeItemRecord({ stockTakeInfoID:'', - diposableGoodsID:batch.diposableGoods.id, + diposableGoodsID:batchStock.diposableGoods.id, batchID : batchID, materialName : name, actualCountedQuantity : actualCountedQuantity,