Index: ssts-web/src/main/webapp/disinfectsystem/invoice/invoicePlanExtractedForm.js =================================================================== diff -u -r23550 -r25049 --- ssts-web/src/main/webapp/disinfectsystem/invoice/invoicePlanExtractedForm.js (.../invoicePlanExtractedForm.js) (revision 23550) +++ ssts-web/src/main/webapp/disinfectsystem/invoice/invoicePlanExtractedForm.js (.../invoicePlanExtractedForm.js) (revision 25049) @@ -120,17 +120,22 @@ var rows = top.Ext.getCmp('sendOutGoods').getSelectionModel().getSelections();// 返回值为 if (rows) { for ( var i = 0; i < rows.length; i++) { + var goods = rows[i].data; var name = rows[i].data['name']; var amount = rows[i].data['count']; var barcode = rows[i].data['barcode']; sendOutGoodsStore.remove(rows[i]); -// var appRecord = rows[i].data['appRecord']; - var appRecord = barcodeToAppRecordMap[barcode]; - if(!isUndefinedOrNullOrEmpty(appRecord)){ - updateAmountByRecord(appRecord,-amount); + if(goods.tousseType == '聚合包' && sstsConfig.comboTousseSendByWrapperTousse){ + adjustComboTousseAppListAoumt(goods, 'sub'); + continue; }else{ - updateAmount1(name,amount); + var appRecord = barcodeToAppRecordMap[barcode]; + if(!isUndefinedOrNullOrEmpty(appRecord)){ + updateAmountByRecord(appRecord,-amount); + }else{ + updateAmount1(name,amount); + } } sendDeleteScannedGoodsLog(rows[i].data); @@ -237,13 +242,16 @@ var newAmount = Number(amount) + Number(tempAmount); record.set('tempAmount',newAmount); // 计算材料数量 - var materialAmount = calculateScannedMaterialAmount(record); - record.set('scannedMaterialAmount',materialAmount); + refreshScannedMaterialAmount(record); updateErrorAmount(record); refreshTotalAmount(); return false; } +function refreshScannedMaterialAmount(record){ + var materialAmount = calculateScannedMaterialAmount(record); + record.set('scannedMaterialAmount',materialAmount); +} function calculateScannedMaterialAmount(record){ var tempAmount = record.get('tempAmount'); var tousseItems = record.get('tousseItems'); @@ -546,7 +554,45 @@ updateAmountByRecord(record,count); resortRecyclingapplication(record) } - +// 添加聚合包 +function addComboGoods(goods,speakBasket){ + var count = 1;// 此次的发货数量 + + var goodsName = goods.name; + var add = true; + + var newRecord = new addGridItem({ + id : 0, + barcode : goods.barcode, + name : goods.name, + ttsName : goods.ttsName, + tousseFixedBarcode : goods.tousseFixedBarcode, + showTousseName : goods.showTousseName, + count : count, + scanAmount : goods.scanAmount, + tousseInstancesBelongToThisComboTousse: goods.tousseInstancesBelongToThisComboTousse, +// waitDeliveryCount:waitDeliveryCount, + diposable : goods.diposable, + price : goods.price, + fluctuationPrice : goods.fluctuationPrice, +// storage : storageAmount, + batchNumber : goods.batchNumber, + tousseType : goods.tousseType, + typeInfoOnScanned : goods.typeInfoOnScanned, + sterilizerName : goods.sterilizerName, + frequency : goods.frequency, + isTracable : goods.isTracable, + tousseDefinitionId : goods.tousseDefinitionId, + externalCode : goods.externalCode, + isRoutine : goods.isRoutine + }); + sendOutGoodsStore.insert(0,newRecord); + + barcodeToScanGoodsMap[goods.barcode] = goods; + speakBasket.addGoods('',getTtsNameByGoods(goods),count); + adjustComboTousseAppListAoumt(goods,'add'); +// resortRecyclingapplication(record); +} /* 按(待发数量-已扫数量)的降序排序,当扫描一个条码后, 对应右边的物品行显示顺序调整到第一行,接下来的行的顺序是已扫数量为0的行按待发数量从大到小排序、 @@ -713,6 +759,32 @@ } return false; } + +function adjustComboTousseAppListAoumt(data,type){ + var comboTousseNameToAmountMap = getComboTousseNameToAmountMap(data.tousseInstancesBelongToThisComboTousse); + for ( var i = 0; i < recyclingapplicationStore.getCount(); i++) { + var record = recyclingapplicationStore.getAt(i); + var name1 =record.get('name'); + var count =record.get('count'); + var tempAmount = record.get('tempAmount'); + var totalAmount = 0; + if(comboTousseNameToAmountMap.hasOwnProperty(name1)){ + totalAmount = Number(comboTousseNameToAmountMap[name1]); + } + if(totalAmount == 0){ + continue; + } + if(type == 'sub'){ + totalAmount = -totalAmount; + } + record.set('tempAmount',Number(tempAmount) + totalAmount); + refreshScannedMaterialAmount(record); + updateErrorAmount(record); + resortRecyclingapplication(record); + } + refreshTotalAmount(); + return true; +} // 聚合包是否都在发货计划内 function isComboTousseAllInPlan(data){ var tousseInstancesBelongToThisComboTousse = data.tousseInstancesBelongToThisComboTousse; @@ -744,6 +816,10 @@ if(isComboTousseExceedAmount(data)){ return ; } + if(sstsConfig.comboTousseSendByWrapperTousse){ + addComboGoods(data,speakBasket); + return; + } for(var x=0;x