Index: ssts-web/src/main/webapp/disinfectsystem/config/gdsy/config.js =================================================================== diff -u -r20127 -r20149 --- ssts-web/src/main/webapp/disinfectsystem/config/gdsy/config.js (.../config.js) (revision 20127) +++ ssts-web/src/main/webapp/disinfectsystem/config/gdsy/config.js (.../config.js) (revision 20149) @@ -1,4 +1,4 @@ -var sstsConfig = { +var sstsConfig = { //洗手护士巡回护士能否不填 useRecordCircuitNurseAllowBlank : true, useRecordWashHandNurseAllowBlank : true, @@ -231,6 +231,8 @@ hideUnprintedDisposableGoodsInvoicePlan: true, // 退货时,是否打印库存为0的批次,默认为false returnGoodsRecordForm_printZeroStockBatches: true, + // 发货扫描后,重新排序申请物品 + invoicePlanExtractedForm_resortRecyclingApplicationItems : true, //禁用供应室领用记录删除(防止因删除导致回写结果不准确) disableReceiveRecordDelete : true } \ No newline at end of file Index: ssts-web/src/main/webapp/disinfectsystem/invoice/invoicePlanExtractedForm.js =================================================================== diff -u -r20034 -r20149 --- ssts-web/src/main/webapp/disinfectsystem/invoice/invoicePlanExtractedForm.js (.../invoicePlanExtractedForm.js) (revision 20034) +++ ssts-web/src/main/webapp/disinfectsystem/invoice/invoicePlanExtractedForm.js (.../invoicePlanExtractedForm.js) (revision 20149) @@ -472,7 +472,7 @@ if(goods.diposable == '是'){ if(storageAmount < notSendAmount){// 库存小于待发货数量 var msg = goods.showTousseName + goods.barcode + '库存不能满足发货计划!' - speaker.speak(msg,msg); + showResult(msg); } } } @@ -531,8 +531,72 @@ speakBasket.addGoods('',goods.showTousseName,count); // clearScanText(); updateAmountByRecord(record,count); + resortRecyclingapplication(record) } +/* +按(待发数量-已扫数量)的降序排序,当扫描一个条码后, +对应右边的物品行显示顺序调整到第一行,接下来的行的顺序是已扫数量为0的行按待发数量从大到小排序、 +(待发数量-已扫数量)按大到小排、已扫描的物品按扫描的先后顺序倒排等 +*/ +var g_curRecord = null; +function safelyGetScanTime(r){ + var scanTime = Number(r.get('scanTime')); + if(scanTime){ + return Number(scanTime); + } + return 0; +} +function sortFun(r1,r2){ + var waitDeliveryCount1 = Number(r1.get('count'));// 申请数量 + var waitDeliveryCount2 = Number(r2.get('count'));// 申请数量 + var sendAmount1 = Number(r1.get('tempAmount'));// 已扫描数量 + var sendAmount2 = Number(r2.get('tempAmount'));// 已扫描数量 + var notSendAmount1 = Number(r1.get('count')) - Number(r1.get('tempAmount')); + var notSendAmount2 = Number(r2.get('count')) - Number(r2.get('tempAmount')); + var scanTime1 = safelyGetScanTime(r1);// 扫描时间 + var scanTime2 = safelyGetScanTime(r2);// 扫描时间 + // 是否当前记录 + if(r1 == g_curRecord){ + return -1; + }else if(r2 == g_curRecord){ + return 1; + } + // 已扫数量为0 + if(sendAmount1 == 0 && sendAmount2 != 0){ + return -1; + }else if(sendAmount2 == 0 && sendAmount1 != 0){ + return 1; + }else if(sendAmount2 == 0 && sendAmount1 == 0){ + if(waitDeliveryCount1 != waitDeliveryCount2){ + return waitDeliveryCount2 - waitDeliveryCount1; + } + } + // 剩余待发数量 + if(notSendAmount1 != notSendAmount2){ + return notSendAmount2 - notSendAmount1; + } + // 扫描时间。 + return scanTime2 - scanTime1; +} +function resortRecyclingapplication(curRecord){ + if(!sstsConfig.invoicePlanExtractedForm_resortRecyclingApplicationItems){ + return; + } + g_curRecord = curRecord; + var records = []; + for ( var i = 0; i < recyclingapplicationStore.getCount(); i++) { + var record = recyclingapplicationStore.getAt(i); +// record.set('sortValue',i+1); + records.push(record); + } +// curRecord.set('sortValue',0); + curRecord.set('scanTime',new Date().getTime()); +// recyclingapplicationStore.sort('sortValue'); + records.sort(sortFun); + recyclingapplicationStore.removeAll(); + recyclingapplicationStore.add(records); +} function clearScanText(){ var barcodeEnd = top.Ext.getCmp("scanTextEnd").getValue().Trim(); if(barcodeEnd == ''){ @@ -1131,6 +1195,8 @@ {name : 'errorAmount'}, {name : 'storage'}, {name : 'amount'}, + {name : 'scanTime'}, + {name : 'sortValue'}, {name : 'applicationAmount'}, {name : 'batchNumber'}, {name : 'isCleanedEntirely'},