Index: ssts-web/src/main/webapp/disinfectsystem/invoice/invoicePlanExtractedForm.js =================================================================== diff -u -r33511 -r33556 --- ssts-web/src/main/webapp/disinfectsystem/invoice/invoicePlanExtractedForm.js (.../invoicePlanExtractedForm.js) (revision 33511) +++ ssts-web/src/main/webapp/disinfectsystem/invoice/invoicePlanExtractedForm.js (.../invoicePlanExtractedForm.js) (revision 33556) @@ -22,51 +22,51 @@ var tousseGroupName = ""; var tousseGroupIds = null; //发货单 -var showInvoiceAssistantSender = getSystemSetConfig('showInvoiceAssistantSender',true); -var showInvoicePersonInCharge = getSystemSetConfig('showInvoicePersonInCharge',true); +var showInvoiceAssistantSender = getSystemSetConfig('showInvoiceAssistantSender', true); +var showInvoicePersonInCharge = getSystemSetConfig('showInvoicePersonInCharge', true); var height = 730; -if(showInvoiceAssistantSender || showInvoicePersonInCharge){ +if (showInvoiceAssistantSender || showInvoicePersonInCharge) { height += 40; } -var recyclingApplicationWinWidth = windowW < 1280 ? windowW-4 : 1280; -var recyclingApplicationWinHeight = windowH < 864 ? windowH-20 : height; +var recyclingApplicationWinWidth = windowW < 1280 ? windowW - 4 : 1280; +var recyclingApplicationWinHeight = windowH < 864 ? windowH - 20 : height; //条码列表 -var sendOutGoodsWidth = windowW < 1280 ? windowW*0.57-50 : 660; -var sendOutGoodsHeight = windowH < 864 ? windowH-300 : 475; +var sendOutGoodsWidth = windowW < 1280 ? windowW * 0.57 - 50 : 660; +var sendOutGoodsHeight = windowH < 864 ? windowH - 300 : 475; //发货单明细 -var sendOutGoodsDetailWidth = windowW < 1280 ? windowW*0.43 : 546; -var sendOutGoodsDetailHeight = windowH < 864 ? windowH-300 : 475; +var sendOutGoodsDetailWidth = windowW < 1280 ? windowW * 0.43 : 546; +var sendOutGoodsDetailHeight = windowH < 864 ? windowH - 300 : 475; //发货单窗口的申请单下拉框的参数 var tousseGroupIdsForApplyList = null; var selectedSterilingMethodsForApplyList = null; var wareHouseStore = new Ext.data.Store({ - proxy : new Ext.data.HttpProxy({ - url : WWWROOT + '/disinfectSystem/baseData/wareHouseAction!getWareHouseData.do', - method : 'POST' + proxy: new Ext.data.HttpProxy({ + url: WWWROOT + '/disinfectSystem/baseData/wareHouseAction!getWareHouseData.do', + method: 'POST' }), - reader : new Ext.data.JsonReader({ - totalProperty : 'totalCount', - root : 'data' + reader: new Ext.data.JsonReader({ + totalProperty: 'totalCount', + root: 'data' }, [ - {name : 'id',mapping : 'id'}, - {name : 'name',mapping : 'name'}, - {name : 'orgUnitCode',mapping : 'orgUnitCode'}, + { name: 'id', mapping: 'id' }, + { name: 'name', mapping: 'name' }, + { name: 'orgUnitCode', mapping: 'orgUnitCode' }, ]), - listeners : { - load : function(store,records) { + listeners: { + load: function (store, records) { var sourceWarehouseIdCmp = top.Ext.getCmp('sourceWarehouseId'); - if(!sourceWarehouseIdCmp){ + if (!sourceWarehouseIdCmp) { return; } var id = sourceWarehouseIdCmp.getValue(); //var name = top.Ext.getCmp('sourceWarehouseName').getValue(); - if(records.length > 0 && (id == null || id == '')){ + if (records.length > 0 && (id == null || id == '')) { //id=records[0].data.id; //name = records[0].data.name; var combo = top.Ext.getCmp("warehouse"); - if (typeof(combo) != "undefined"){ + if (typeof (combo) != "undefined") { // 触发选中事件 - combo.fireEvent('select', combo,records[0],0); + combo.fireEvent('select', combo, records[0], 0); } } wareHouseStoreLoaded = true; @@ -77,179 +77,179 @@ } }); -if(sstsConfig.disableLoadToVirtualBasket == false){ +if (sstsConfig.disableLoadToVirtualBasket == false) { beginBarcodeLabel = '条码/篮筐(首):'; hiddenEndBarcode = false;//显示尾篮筐 } //条码扫描模式(单个条码逐个扫描或首尾条码段扫描两种模式) var currentScanMode = "single"; -if(sstsConfig.invoicePageScanMode && sstsConfig.invoicePageScanMode != null){ +if (sstsConfig.invoicePageScanMode && sstsConfig.invoicePageScanMode != null) { currentScanMode = sstsConfig.invoicePageScanMode; } -function sayGoods(record){ - if(record && record.data){ +function sayGoods(record) { + if (record && record.data) { speaker.speak(record.data.showTousseName + ",数量为" + record.data.count); } } //发货单明细累减 -function updateAmount1(name,amount){ - if(name != null && name.length > 0){ - for ( var i = 0; i < recyclingapplicationStore1.getCount(); i++) { - var record = recyclingapplicationStore1.getAt(i); - var tempName = record.get('name'); - var tempAmount = record.get('tempAmount'); - if(tempName == name){ - if(tempAmount==null || tempAmount.length <= 0){ - tempAmount = 0; - } - record.set('tempAmount',Number(tempAmount) - Number(amount)); +function updateAmount1(name, amount) { + if (name != null && name.length > 0) { + for (var i = 0; i < recyclingapplicationStore1.getCount(); i++) { + var record = recyclingapplicationStore1.getAt(i); + var tempName = record.get('name'); + var tempAmount = record.get('tempAmount'); + if (tempName == name) { + if (tempAmount == null || tempAmount.length <= 0) { + tempAmount = 0; + } + record.set('tempAmount', Number(tempAmount) - Number(amount)); updateErrorAmount(record); refreshTotalAmount(); - } + } } } return false; } //异常物品列表删除选中的物品 -function removeSendOutAbnormalGoods(barcode){ +function removeSendOutAbnormalGoods(barcode) { var AbnormalGoodsNum = top.Ext.getCmp('sendOutAbnormalGoods').getStore().data.keys; var rows = top.Ext.getCmp('sendOutAbnormalGoods').getSelectionModel().getSelections();// 返回值为 - if(rows){ - for( var i = 0; i < rows.length; i++){ + if (rows) { + for (var i = 0; i < rows.length; i++) { sendOutAbnormalGoodsStore.remove(rows[i]); - return ; + return; } } } //删除发货扫描的物品 -function removeSendOutGoods(){ +function removeSendOutGoods() { //左边已扫物品的已选项 var rows = top.Ext.getCmp('sendOutGoods').getSelectionModel().getSelections(); if (rows && rows.length > 0) { - for ( var i = 0; i < rows.length; i++) { + 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 amount = rows[i].data['count']; var barcode = rows[i].data['barcode']; var tousseType = rows[i].data['tousseType']; sendOutGoodsStore1.remove(rows[i]); - + //固定条码和批次条码判断的参数 var reAllBarcodeArr = []; - for(var i = 0; i < allBarcodeArr.length; i++){ - if(allBarcodeArr[i].barcode != barcode){ + for (var i = 0; i < allBarcodeArr.length; i++) { + if (allBarcodeArr[i].barcode != barcode) { reAllBarcodeArr.push(allBarcodeArr[i]); } } allBarcodeArr = reAllBarcodeArr; - if(goods.tousseType == '聚合包'){ + if (goods.tousseType == '聚合包') { adjustComboTousseAppListAoumt(goods, 'sub'); continue; - }else{ + } else { var appRecord = barcodeToAppRecordMap[barcode]; - if(!isUndefinedOrNullOrEmpty(appRecord)){ - updateAmountByRecord(appRecord,-amount); - }else{ - updateAmount1(name,amount); + if (!isUndefinedOrNullOrEmpty(appRecord)) { + updateAmountByRecord(appRecord, -amount); + } else { + updateAmount1(name, amount); } } //sendDeleteScannedGoodsLog(rows[i].data); - if(tousseType == '一次性物品'){ + if (tousseType == '一次性物品') { recalcDisposableGoodsAmount(name); } } } } //获取不同状态的颜色 -function getStatusColor(record){ +function getStatusColor(record) { var rowClassName = ''; var rowColor = ''; - if(sstsConfig.colorChangeRuleOfInvoicPlanToSendGoodsList == '2'){ - if(record.json.status == '已灭菌'){ + if (sstsConfig.colorChangeRuleOfInvoicPlanToSendGoodsList == '2') { + if (record.json.status == '已灭菌') { rowClassName = 'my_row_blue'; - if(sstsConfig.backgroudColorConfigOfInvoiceGoodsList - && sstsConfig.backgroudColorConfigOfInvoiceGoodsList.sterilizedColor - ){ + if (sstsConfig.backgroudColorConfigOfInvoiceGoodsList + && sstsConfig.backgroudColorConfigOfInvoiceGoodsList.sterilizedColor + ) { rowClassName = sstsConfig.backgroudColorConfigOfInvoiceGoodsList.sterilizedColor.className || ''; rowColor = sstsConfig.backgroudColorConfigOfInvoiceGoodsList.sterilizedColor.color || ''; } - }else { + } else { rowClassName = 'my_row_yellow'; - if(sstsConfig.backgroudColorConfigOfInvoiceGoodsList - && sstsConfig.backgroudColorConfigOfInvoiceGoodsList.unsterilizedColor - ){ + if (sstsConfig.backgroudColorConfigOfInvoiceGoodsList + && sstsConfig.backgroudColorConfigOfInvoiceGoodsList.unsterilizedColor + ) { rowClassName = sstsConfig.backgroudColorConfigOfInvoiceGoodsList.unsterilizedColor.className || ''; rowColor = sstsConfig.backgroudColorConfigOfInvoiceGoodsList.unsterilizedColor.color || ''; } } - }else { + } else { //判断是否全是今天申请的;如果同一种物品,内含今天申请的和非今天申请的,则为黄色,不然为白色(无底色) - if(record.json.beforeToday == true){ + if (record.json.beforeToday == true) { rowClassName = 'my_row_yellow'; - if(sstsConfig.backgroudColorConfigOfInvoiceGoodsList - && sstsConfig.backgroudColorConfigOfInvoiceGoodsList.beforeToday - ){ + if (sstsConfig.backgroudColorConfigOfInvoiceGoodsList + && sstsConfig.backgroudColorConfigOfInvoiceGoodsList.beforeToday + ) { //由配置项自定义颜色 rowClassName = sstsConfig.backgroudColorConfigOfInvoiceGoodsList.beforeToday.className || ''; rowColor = sstsConfig.backgroudColorConfigOfInvoiceGoodsList.beforeToday.color || ''; } } - if(record.json.beforeToday == false){ + if (record.json.beforeToday == false) { rowClassName = 'my_row_white'; } } return { - rowClassName:rowClassName, - rowColor:rowColor + rowClassName: rowClassName, + rowColor: rowColor } } -function getNewBackgroundColor(record){ +function getNewBackgroundColor(record) { var rowClassName = ''; var rowColor = ''; //误差数量=已扫数量-待发数量 - if(record.data.errorAmount < 0){ + if (record.data.errorAmount < 0) { rowClassName = 'my_row_red'; - if(sstsConfig.backgroudColorConfigOfInvoiceGoodsList - && sstsConfig.backgroudColorConfigOfInvoiceGoodsList.overFulled - ){ + if (sstsConfig.backgroudColorConfigOfInvoiceGoodsList + && sstsConfig.backgroudColorConfigOfInvoiceGoodsList.overFulled + ) { rowClassName = sstsConfig.backgroudColorConfigOfInvoiceGoodsList.overFulled.className || ''; rowColor = sstsConfig.backgroudColorConfigOfInvoiceGoodsList.overFulled.color || ''; } - }else if(record.data.errorAmount > 0 && record.data.errorAmount < record.data.count){ + } else if (record.data.errorAmount > 0 && record.data.errorAmount < record.data.count) { rowClassName = 'my_row_blue'; //已扫码但是未扫满的背景色 - if(sstsConfig.backgroudColorConfigOfInvoiceGoodsList - && sstsConfig.backgroudColorConfigOfInvoiceGoodsList.scanBeforeFull - ){ + if (sstsConfig.backgroudColorConfigOfInvoiceGoodsList + && sstsConfig.backgroudColorConfigOfInvoiceGoodsList.scanBeforeFull + ) { //由配置项自定义颜色 rowClassName = sstsConfig.backgroudColorConfigOfInvoiceGoodsList.scanBeforeFull.className || ''; rowColor = sstsConfig.backgroudColorConfigOfInvoiceGoodsList.scanBeforeFull.color || ''; } - }else if(record.data.errorAmount == 0){ + } else if (record.data.errorAmount == 0) { //扫码扫满的背景色 rowClassName = 'my_row_green'; - if(sstsConfig.backgroudColorConfigOfInvoiceGoodsList - && sstsConfig.backgroudColorConfigOfInvoiceGoodsList.scanFulled - ){ + if (sstsConfig.backgroudColorConfigOfInvoiceGoodsList + && sstsConfig.backgroudColorConfigOfInvoiceGoodsList.scanFulled + ) { //由配置项自定义颜色 rowClassName = sstsConfig.backgroudColorConfigOfInvoiceGoodsList.scanFulled.className || ''; rowColor = sstsConfig.backgroudColorConfigOfInvoiceGoodsList.scanFulled.color || ''; } - }else{ + } else { //加急 - if(record.json.maxUrgentLevel && record.json.maxUrgentLevel.colorCode !== ''){ + if (record.json.maxUrgentLevel && record.json.maxUrgentLevel.colorCode !== '') { var obj = getStatusColor(record); rowClassName = obj.rowClassName; rowColor = obj.rowColor; return { - rowClassName:rowClassName, - rowColor:rowColor + rowClassName: rowClassName, + rowColor: rowColor }; } //未扫码的背景色 @@ -258,68 +258,68 @@ rowColor = obj.rowColor; } return { - rowClassName:rowClassName, - rowColor:rowColor + rowClassName: rowClassName, + rowColor: rowColor }; } -function renderFunction(v, p, record, name){ +function renderFunction(v, p, record, name) { var rowColor = getNewBackgroundColor(record).rowColor || ''; var content = ''; - if(name == '紧急程度'){ - if(sstsConfig.enableUrgentFunction && record.json.maxUrgentLevel && record.json.maxUrgentLevel.colorCode != undefined){ + if (name == '紧急程度') { + if (sstsConfig.enableUrgentFunction && record.json.maxUrgentLevel && record.json.maxUrgentLevel.colorCode != undefined) { rowColor = record.json.maxUrgentLevel.colorCode; content = record.json.maxUrgentLevel.name; - }else { + } else { content = ''; } - }else if(name == '加急' || name == '误差' || name == '库存'){ - if(name == '加急'){ - if(sstsConfig.enableUrgentFunction && record.json.maxUrgentLevel && record.json.maxUrgentLevel.colorCode != undefined){ + } else if (name == '加急' || name == '误差' || name == '库存') { + if (name == '加急') { + if (sstsConfig.enableUrgentFunction && record.json.maxUrgentLevel && record.json.maxUrgentLevel.colorCode != undefined) { rowColor = record.json.maxUrgentLevel.colorCode; } } - if (v == null || v.length <= 0){ - content = (name == '库存')?'':0 - }else{ + if (v == null || v.length <= 0) { + content = (name == '库存') ? '' : 0 + } else { content = v; } - }else if(name == '实发'){ + } else if (name == '实发') { var tousseAmount = 0; - if (v ==null || v.length <= 0){ + if (v == null || v.length <= 0) { tousseAmount = 0; - }else{ + } else { tousseAmount = v; } var goodsType = record.get('goodsType'); var isCleanedEntirely = record.get('isCleanedEntirely'); var scannedMaterialAmount = record.get('scannedMaterialAmount'); - if (scannedMaterialAmount == null){ + if (scannedMaterialAmount == null) { scannedMaterialAmount = 0; } - if((goodsType == '消毒物品') && (isCleanedEntirely == '否')){ - content = tousseAmount+'('+scannedMaterialAmount+')'; - }else{ + if ((goodsType == '消毒物品') && (isCleanedEntirely == '否')) { + content = tousseAmount + '(' + scannedMaterialAmount + ')'; + } else { content = tousseAmount; } - }else if(name == '申请的物品'){ - if(sstsConfig.enableDisposableGoodsFullCaseApplicationAmount){ - if(record.get('count')%record.get('fullCaseApplicationAmount') == 0){ - content = "" + v || ''; - }else { + } else if (name == '申请的物品') { + if (sstsConfig.enableDisposableGoodsFullCaseApplicationAmount) { + if (record.get('count') % record.get('fullCaseApplicationAmount') == 0) { + content = "" + v || ''; + } else { content = v || ''; } - }else { + } else { content = v || ''; } - }else { + } else { content = v || ''; } - if(rowColor == ''){ - return '
'+content+'
'; - }else { - return '
'+content+'
'; + if (rowColor == '') { + return '
' + content + '
'; + } else { + return '
' + content + '
'; } } @@ -328,110 +328,110 @@ * @param disposableGoodsName 一次性物品名称 * */ -function recalcDisposableGoodsAmount(disposableGoodsName){ +function recalcDisposableGoodsAmount(disposableGoodsName) { //1.遍历左边已扫物品的已选项,计算该物品的总数量 var totalAmount = 0; var storeCount1 = sendOutGoodsStore1.getCount(); - for(var i = 0;i < storeCount1;i++){ + for (var i = 0; i < storeCount1; i++) { var recData = sendOutGoodsStore1.getAt(i).data; - if(recData.name == disposableGoodsName){ - totalAmount+= recData.count; + if (recData.name == disposableGoodsName) { + totalAmount += recData.count; } } //2.找到右边发货物品明细的该物品,设置其已扫数量及误差数量 var storeCount2 = recyclingapplicationStore1.getCount(); - for(var j = 0;j < storeCount2;j++){ + for (var j = 0; j < storeCount2; j++) { var rec = recyclingapplicationStore1.getAt(j); - if(rec.data.showTousseName == disposableGoodsName){ - rec.set('tempAmount',totalAmount); - rec.set('errorAmount',parseInt(rec.data.count,10) - parseInt(totalAmount,10)); + if (rec.data.showTousseName == disposableGoodsName) { + rec.set('tempAmount', totalAmount); + rec.set('errorAmount', parseInt(rec.data.count, 10) - parseInt(totalAmount, 10)); break; } } } //删除发货明细项 -function removeSendOutGoodsDetail(id){ +function removeSendOutGoodsDetail(id) { var rows = top.Ext.getCmp('sendOutGoodsDetail').getSelectionModel().getSelections();// 返回值为 if (rows) { - for ( var i = 0; i < rows.length; i++) { + for (var i = 0; i < rows.length; i++) { var name = rows[i].data['name']; - var amount = rows[i].data['count']; + var amount = rows[i].data['count']; recyclingapplicationStore1.remove(rows[i]); } } } //删除发货明细项 -function removeSendOutTousseByBarcode(barcode){ - var record = findRecordByNameAndValueFromStore(sendOutGoodsStore1,'barcode',barcode); - if(record != null){ +function removeSendOutTousseByBarcode(barcode) { + var record = findRecordByNameAndValueFromStore(sendOutGoodsStore1, 'barcode', barcode); + if (record != null) { var name = record.data['name']; - sendOutGoodsStore1.remove(record); - updateAmount1(name,1); + sendOutGoodsStore1.remove(record); + updateAmount1(name, 1); } } //验证条码是否重复扫描 -function isBarcodeRepeat(barcode){ - if(barcode != null && barcode.length > 0){ - for ( var i = 0; i < sendOutGoodsStore1.getCount(); i++) { - var record = sendOutGoodsStore1.getAt(i); - var tempBarcode =record.get('barcode'); - if(barcode == tempBarcode){ - return true; - break; - } +function isBarcodeRepeat(barcode) { + if (barcode != null && barcode.length > 0) { + for (var i = 0; i < sendOutGoodsStore1.getCount(); i++) { + var record = sendOutGoodsStore1.getAt(i); + var tempBarcode = record.get('barcode'); + if (barcode == tempBarcode) { + return true; + break; + } } //固定条码和批次条码的判断 - var isBatch = /^[0-9]*$/ ;//全数字的批次条码正则 - if(allBarcodeArr.length != 0){ - for(var i = 0; i < allBarcodeArr.length; i++){ + var isBatch = /^[0-9]*$/;//全数字的批次条码正则 + if (allBarcodeArr.length != 0) { + for (var i = 0; i < allBarcodeArr.length; i++) { //同名物品 - if(allBarcodeArr[i].name == goodsInfo.name){ + if (allBarcodeArr[i].name == goodsInfo.name) { //扫描的是批次条码 //是否为同种类型的条码 - if(isBatch.test(allBarcodeArr[i].barcode)){ - if(isBatch.test(goodsInfo.barcode)){ + if (isBatch.test(allBarcodeArr[i].barcode)) { + if (isBatch.test(goodsInfo.barcode)) { //同物品同类型条码 } - else{ + else { //同物品不同类型条码 - showResult('请扫描批次条码!' , null , true); + showResult('请扫描批次条码!', null, true); return true; } } - else{ + else { //扫描的是固定条码 - if(!isBatch.test(goodsInfo.barcode)){ + if (!isBatch.test(goodsInfo.barcode)) { //同物品同类型条码 } - else{ + else { //同物品不同类型条码 - showResult('请扫描固定条码!' , null , true); + showResult('请扫描固定条码!', null, true); return true; } } } } } - else{ + else { allBarcodeArr.push(goodsInfo); - } + } } return false; } -function removeTousseIfNeeded(goods){ +function removeTousseIfNeeded(goods) { var barcode = goods.barcode; - if(isBarcodeRepeat(barcode)){ + if (isBarcodeRepeat(barcode)) { var name = goods.name; for (var i = 0; i < recyclingapplicationStore1.getCount(); i++) { var record = recyclingapplicationStore1.getAt(i); var tempName = record.get('name'); var tempAmount = record.get('tempAmount'); - if(tempName == name){ + if (tempName == name) { var errorAmount = record.get('errorAmount'); - if(errorAmount < 0){ + if (errorAmount < 0) { removeSendOutTousseByBarcode(barcode); return true; } @@ -443,160 +443,160 @@ //扫描的物品是否是待发货物品 //name不是showTousseName字段 -function isInvoiceGoods(name){ - if(name != null && name.length > 0){ - for ( var i = 0; i < recyclingapplicationStore1.getCount(); i++) { - var record = recyclingapplicationStore1.getAt(i); - var name1 =record.get('name'); - if(name == name1){ - return true; - break; - } +function isInvoiceGoods(name) { + if (name != null && name.length > 0) { + for (var i = 0; i < recyclingapplicationStore1.getCount(); i++) { + var record = recyclingapplicationStore1.getAt(i); + var name1 = record.get('name'); + if (name == name1) { + return true; + break; + } } } return false; } //发货单明细累加 -function updateAmount(name,amount){ - if(name != null && name.length > 0){ +function updateAmount(name, amount) { + if (name != null && name.length > 0) { for (var i = 0; i < recyclingapplicationStore1.getCount(); i++) { var record = recyclingapplicationStore1.getAt(i); var tempName = record.get('name'); var tempAmount = record.get('tempAmount'); - if(tempName == name){ - if(tempAmount==null || tempAmount.length <= 0){ + if (tempName == name) { + if (tempAmount == null || tempAmount.length <= 0) { tempAmount = 0; } - record.set('tempAmount',Number(amount) + Number(tempAmount)); + record.set('tempAmount', Number(amount) + Number(tempAmount)); updateErrorAmount(record); refreshTotalAmount(); } } } return false; } -function updateAmountByRecord(record,amount){ +function updateAmountByRecord(record, amount) { var tempAmount = record.get('tempAmount'); - if(tempAmount==null || tempAmount.length <= 0){ + if (tempAmount == null || tempAmount.length <= 0) { tempAmount = 0; } var newAmount = Number(amount) + Number(tempAmount); - record.set('tempAmount',newAmount); + record.set('tempAmount', newAmount); // 计算材料数量 refreshScannedMaterialAmount(record); updateErrorAmount(record); refreshTotalAmount(); return false; } -function refreshScannedMaterialAmount(record){ +function refreshScannedMaterialAmount(record) { var materialAmount = calculateScannedMaterialAmount(record); - record.set('scannedMaterialAmount',materialAmount); + record.set('scannedMaterialAmount', materialAmount); } -function calculateScannedMaterialAmount(record){ +function calculateScannedMaterialAmount(record) { var tempAmount = record.get('tempAmount'); var tousseItems = record.get('tousseItems'); var goodsType = record.get('goodsType'); var isCleanedEntirely = record.get('isCleanedEntirely'); var scannedMaterialAmount1 = 0;// 非固定条码 var scannedTousseAmount1 = 0;// 非固定条码 var scannedMaterialAmount2 = 0;// 固定条码 - if((goodsType == '消毒物品') && (isCleanedEntirely == '否') && !isUndefinedOrNull(tousseItems)){ - - }else{ + if ((goodsType == '消毒物品') && (isCleanedEntirely == '否') && !isUndefinedOrNull(tousseItems)) { + + } else { return 0; } - for ( var i = 0; i < sendOutGoodsStore1.getCount(); i++) { - var sendOutRecord = sendOutGoodsStore1.getAt(i); - var barcode = sendOutRecord.get('barcode'); - var tousseFixedBarcode = sendOutRecord.get('tousseFixedBarcode'); - var count = sendOutRecord.get('count'); - var goods = barcodeToScanGoodsMap[barcode]; - var tempMaterialAmount = 0; - if(goods && goods.materialAmount){ - tempMaterialAmount = goods.materialAmount; - } - if(barcodeToAppRecordMap[barcode] == record && !tousseFixedBarcode){ - scannedMaterialAmount1 += tempMaterialAmount; - scannedTousseAmount1 += count; - } + for (var i = 0; i < sendOutGoodsStore1.getCount(); i++) { + var sendOutRecord = sendOutGoodsStore1.getAt(i); + var barcode = sendOutRecord.get('barcode'); + var tousseFixedBarcode = sendOutRecord.get('tousseFixedBarcode'); + var count = sendOutRecord.get('count'); + var goods = barcodeToScanGoodsMap[barcode]; + var tempMaterialAmount = 0; + if (goods && goods.materialAmount) { + tempMaterialAmount = goods.materialAmount; + } + if (barcodeToAppRecordMap[barcode] == record && !tousseFixedBarcode) { + scannedMaterialAmount1 += tempMaterialAmount; + scannedTousseAmount1 += count; + } } - if(scannedTousseAmount1 < tempAmount){ + if (scannedTousseAmount1 < tempAmount) { var scannedTousseAmount2 = tempAmount - scannedTousseAmount1; var amountArray = []; - for(var i=0;i 0){ + while (count > 0) { --count; amountArray.push(materialAmount); } } - scannedTousseAmount2 = Math.min(scannedTousseAmount2,amountArray.length); - - for(var i=0;i Number(applicationAmount)){//发货数量不能大于待发货数量 - b = false; - top.Ext.getCmp('sendOutGoodsDetail').getView().getRow(i).style.backgroundColor = '#FFB5B5'; - showResult(record.get('name')+" 发货数量不能大于" + applicationAmount , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); - } + for (var i = 0; i < recyclingapplicationStore1.getCount(); i++) { + var record = recyclingapplicationStore1.getAt(i); + var count = record.get('count'); + var tempAmount = record.get('tempAmount'); + var applicationAmount = record.get('applicationAmount'); + if (count != tempAmount) {//实际数量要与发货数量相同 + b = false; + top.Ext.getCmp('sendOutGoodsDetail').getView().getRow(i).style.backgroundColor = '#FFB5B5'; + showResult(record.get('showTousseName') + " 发货数量与实发数量不同!", null, sstsConfig.messagePauseTimeOnInvoiceplanPage); + } + if (Number(count) > Number(applicationAmount)) {//发货数量不能大于待发货数量 + b = false; + top.Ext.getCmp('sendOutGoodsDetail').getView().getRow(i).style.backgroundColor = '#FFB5B5'; + showResult(record.get('name') + " 发货数量不能大于" + applicationAmount, null, sstsConfig.messagePauseTimeOnInvoiceplanPage); + } } return b; } var addGridItem = Ext.data.Record.create([ - {name : 'id'}, - {name : 'barcode'}, - {name : 'urgentLevel'}, - {name : 'name'}, - {name : 'appRecord'}, - {name : 'tousseFixedBarcode'}, - {name : 'showTousseName'}, - {name : 'fullCaseApplicationAmount'}, - {name : 'count'}, - {name : 'waitDeliveryCount'}, - {name : 'diposable'}, - {name : 'price'}, - {name : 'fluctuationPrice'}, - {name : 'storage'}, - {name : 'batchNumber'}, - {name : 'tousseType'}, - {name : 'typeInfoOnScanned'}, - {name : 'sterilizerName'}, - {name : 'frequency'}, - {name : 'isTracable'}, - {name : 'tousseDefinitionId'} - ]); + { name: 'id' }, + { name: 'barcode' }, + { name: 'urgentLevel' }, + { name: 'name' }, + { name: 'appRecord' }, + { name: 'tousseFixedBarcode' }, + { name: 'showTousseName' }, + { name: 'fullCaseApplicationAmount' }, + { name: 'count' }, + { name: 'waitDeliveryCount' }, + { name: 'diposable' }, + { name: 'price' }, + { name: 'fluctuationPrice' }, + { name: 'storage' }, + { name: 'batchNumber' }, + { name: 'tousseType' }, + { name: 'typeInfoOnScanned' }, + { name: 'sterilizerName' }, + { name: 'frequency' }, + { name: 'isTracable' }, + { name: 'tousseDefinitionId' } +]); //异常物品列表 - var addAbnormalGridItem = Ext.data.Record.create([ - {name : 'id'}, - {name : 'barcode'}, - {name : 'name'}, - {name : 'appRecord'}, - {name : 'tousseFixedBarcode'}, - {name : 'showTousseName'}, - {name : 'status'}, - {name : 'depart'}, - {name : 'batchNumber'} - ]); +var addAbnormalGridItem = Ext.data.Record.create([ + { name: 'id' }, + { name: 'barcode' }, + { name: 'name' }, + { name: 'appRecord' }, + { name: 'tousseFixedBarcode' }, + { name: 'showTousseName' }, + { name: 'status' }, + { name: 'depart' }, + { name: 'batchNumber' } +]); var AppGoodsItem = Ext.data.Record.create([ - {name : 'showTousseName'}, - {name : 'applicationAmount'}, - {name : 'sendAmount'}, - {name : 'count'} - ]); + { name: 'showTousseName' }, + { name: 'applicationAmount' }, + { name: 'sendAmount' }, + { name: 'count' } +]); // 根据条码获取发送项 -function getSendOutGoodsByBarcode(barcode){ - if(isUndefinedOrNullOrEmpty(barcode)){ +function getSendOutGoodsByBarcode(barcode) { + if (isUndefinedOrNullOrEmpty(barcode)) { return null; } - for ( var i = 0; i < sendOutGoodsStore1.getCount(); i++) { - var record = sendOutGoodsStore1.getAt(i); - var tempBarcode =record.get('barcode'); - if(barcode == tempBarcode){ - return record.data; - } + for (var i = 0; i < sendOutGoodsStore1.getCount(); i++) { + var record = sendOutGoodsStore1.getAt(i); + var tempBarcode = record.get('barcode'); + if (barcode == tempBarcode) { + return record.data; + } } return null; } -function getSendOutRecordByBarcode(barcode){ - if(isUndefinedOrNullOrEmpty(barcode)){ +function getSendOutRecordByBarcode(barcode) { + if (isUndefinedOrNullOrEmpty(barcode)) { return null; } - for ( var i = 0; i < sendOutGoodsStore1.getCount(); i++) { - var record = sendOutGoodsStore1.getAt(i); - var tempBarcode = record.get('barcode'); - if(barcode == tempBarcode){ - return record; - } + for (var i = 0; i < sendOutGoodsStore1.getCount(); i++) { + var record = sendOutGoodsStore1.getAt(i); + var tempBarcode = record.get('barcode'); + if (barcode == tempBarcode) { + return record; + } } return null; } // 名字到数量的map -function getTousseNameToAmountMap(scannedResult){ +function getTousseNameToAmountMap(scannedResult) { var map = {}; - for(var i=0;i= storageAmount){ + if (sendAmount >= storageAmount) { return; } - + } - if(goods.tousseFixedBarcode || (goods.diposable == '是')){ - if(notSendAmount < storageAmount){// 待发货数量小于库存 + if (goods.tousseFixedBarcode || (goods.diposable == '是')) { + if (notSendAmount < storageAmount) {// 待发货数量小于库存 count = notSendAmount; - }else{ + } else { count = storageAmount; } } - if(project == 'gdsy'){ - if(goods.diposable == '是'){ - if(storageAmount < notSendAmount){// 库存小于待发货数量 + if (project == 'gdsy') { + if (goods.diposable == '是') { + if (storageAmount < notSendAmount) {// 库存小于待发货数量 var msg = getTtsNameByGoods(goods) + goods.barcode + ',该批次只满足部分发货!' - showResult(msg , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + showResult(msg, null, sstsConfig.messagePauseTimeOnInvoiceplanPage); } } } - - + + // 固定条码每次增加的数量不能超过包定义的扫描数量 - if(goods.tousseFixedBarcode){ + if (goods.tousseFixedBarcode) { var remnantStorage = storageAmount - sendAmount; //如果扫描的灭菌筐时,取storage数量 - if(isContainer){ + if (isContainer) { count = remnantStorage; - }else{ - count = Math.min(count,goods.scanAmount);// 单次增加数量不能超过每次扫描数量 - count = Math.min(count,remnantStorage);// 增加数量不能超过剩余库存 + } else { + count = Math.min(count, goods.scanAmount);// 单次增加数量不能超过每次扫描数量 + count = Math.min(count, remnantStorage);// 增加数量不能超过剩余库存 } - - if(count == 0){ + + if (count == 0) { return; } } - + var price = goods.price; var add = true; - if(goods.tousseFixedBarcode){ + if (goods.tousseFixedBarcode) { var existingRecord = getSendOutRecordByBarcode(goods.barcode); - if(existingRecord != null){ + if (existingRecord != null) { add = false; var totalCount = count + existingRecord.data.count; - existingRecord.set('count',totalCount); + existingRecord.set('count', totalCount); } } - if(add){ + if (add) { var newRecord = new addGridItem({ - id : 0, - barcode : goods.barcode, - urgentLevel : goods.urgentLevel, - name : goods.name, - ttsName : goods.ttsName, - tousseFixedBarcode : goods.tousseFixedBarcode, - showTousseName : goods.showTousseName, - fullCaseApplicationAmount:goods.fullCaseApplicationAmount, - count : count, - scanAmount : goods.scanAmount, - waitDeliveryCount:waitDeliveryCount, - diposable : goods.diposable, - price : 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 + id: 0, + barcode: goods.barcode, + urgentLevel: goods.urgentLevel, + name: goods.name, + ttsName: goods.ttsName, + tousseFixedBarcode: goods.tousseFixedBarcode, + showTousseName: goods.showTousseName, + fullCaseApplicationAmount: goods.fullCaseApplicationAmount, + count: count, + scanAmount: goods.scanAmount, + waitDeliveryCount: waitDeliveryCount, + diposable: goods.diposable, + price: 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 }); - sendOutGoodsStore1.insert(0,newRecord); + sendOutGoodsStore1.insert(0, newRecord); } barcodeToAppRecordMap[goods.barcode] = record; barcodeToScanGoodsMap[goods.barcode] = goods; - speakBasket.addGoods('',getTtsNameByGoods(goods),count); -// clearScanText(); - updateAmountByRecord(record,count); + speakBasket.addGoods('', getTtsNameByGoods(goods), count); + // clearScanText(); + updateAmountByRecord(record, count); resortRecyclingapplication(record) } // 添加聚合包 -function addComboGoods(goods,speakBasket){ +function addComboGoods(goods, speakBasket) { var count = 1;// 此次的发货数量 - + var goodsName = goods.name; var add = true; - + var newRecord = new addGridItem({ - id : 0, - barcode : goods.barcode, - urgentLevel : goods.urgentLevel, - name : goods.name, - ttsName : goods.ttsName, - tousseFixedBarcode : goods.tousseFixedBarcode, - showTousseName : goods.showTousseName, - count : count, - scanAmount : goods.scanAmount, + id: 0, + barcode: goods.barcode, + urgentLevel: goods.urgentLevel, + 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 + // 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 }); - sendOutGoodsStore1.insert(0,newRecord); - + sendOutGoodsStore1.insert(0, newRecord); + barcodeToScanGoodsMap[goods.barcode] = goods; - speakBasket.addGoods('',getTtsNameByGoods(goods),count); - adjustComboTousseAppListAoumt(goods,'add'); -// resortRecyclingapplication(record); + speakBasket.addGoods('', getTtsNameByGoods(goods), count); + adjustComboTousseAppListAoumt(goods, 'add'); + // resortRecyclingapplication(record); } /* 按(待发数量-已扫数量)的降序排序,当扫描一个条码后, 对应右边的物品行显示顺序调整到第一行,接下来的行的顺序是已扫数量为0的行按待发数量从大到小排序、 (待发数量-已扫数量)按大到小排、已扫描的物品按扫描的先后顺序倒排等 */ var g_curRecord = null; -function safelyGetScanTime(r){ +function safelyGetScanTime(r) { var scanTime = Number(r.get('scanTime')); - if(scanTime){ + if (scanTime) { return Number(scanTime); } return 0; } -function sortFun(r1,r2){ +function sortFun(r1, r2) { var waitDeliveryCount1 = Number(r1.get('count'));// 申请数量 var waitDeliveryCount2 = Number(r2.get('count'));// 申请数量 var sendAmount1 = Number(r1.get('tempAmount'));// 已扫描数量 @@ -908,281 +908,281 @@ var scanTime1 = safelyGetScanTime(r1);// 扫描时间 var scanTime2 = safelyGetScanTime(r2);// 扫描时间 // 是否当前记录 - if(r1 == g_curRecord){ + if (r1 == g_curRecord) { return -1; - }else if(r2 == g_curRecord){ + } else if (r2 == g_curRecord) { return 1; } // 已扫数量为0 - if(sendAmount1 == 0 && sendAmount2 != 0){ + if (sendAmount1 == 0 && sendAmount2 != 0) { return -1; - }else if(sendAmount2 == 0 && sendAmount1 != 0){ + } else if (sendAmount2 == 0 && sendAmount1 != 0) { return 1; - }else if(sendAmount2 == 0 && sendAmount1 == 0){ - if(waitDeliveryCount1 != waitDeliveryCount2){ + } else if (sendAmount2 == 0 && sendAmount1 == 0) { + if (waitDeliveryCount1 != waitDeliveryCount2) { return waitDeliveryCount2 - waitDeliveryCount1; } } // 剩余待发数量 - if(notSendAmount1 != notSendAmount2){ + if (notSendAmount1 != notSendAmount2) { return notSendAmount2 - notSendAmount1; } // 扫描时间。 return scanTime2 - scanTime1; } -function sortFun_invoicePlan(r1,r2){ +function sortFun_invoicePlan(r1, r2) { var notSendAmount1 = Number(r1.get('count')); var notSendAmount2 = Number(r2.get('count')); - + return notSendAmount2 - notSendAmount1; } -function resortRecyclingapplication(curRecord){ - if(!sstsConfig.invoicePlanExtractedForm_resortRecyclingApplicationItems){ +function resortRecyclingapplication(curRecord) { + if (!sstsConfig.invoicePlanExtractedForm_resortRecyclingApplicationItems) { return; } g_curRecord = curRecord; var records = []; - for ( var i = 0; i < recyclingapplicationStore1.getCount(); i++) { - var record = recyclingapplicationStore1.getAt(i); -// record.set('sortValue',i+1); - records.push(record); + for (var i = 0; i < recyclingapplicationStore1.getCount(); i++) { + var record = recyclingapplicationStore1.getAt(i); + // record.set('sortValue',i+1); + records.push(record); } -// curRecord.set('sortValue',0); - curRecord.set('scanTime',new Date().getTime()); -// recyclingapplicationStore1.sort('sortValue'); + // curRecord.set('sortValue',0); + curRecord.set('scanTime', new Date().getTime()); + // recyclingapplicationStore1.sort('sortValue'); records.sort(sortFun); recyclingapplicationStore1.removeAll(); recyclingapplicationStore1.add(records); } -function clearScanText(){ +function clearScanText() { var barcodeEnd = top.Ext.getCmp("scanTextEnd").getValue().Trim(); - if(barcodeEnd == ''){ - if(hiddenEndBarcode || currentScanMode == 'single'){ + if (barcodeEnd == '') { + if (hiddenEndBarcode || currentScanMode == 'single') { top.Ext.getCmp('scanText').setValue("");//如果使用虚拟篮筐机制,扫描成功后需要清除该文本内容 - }else{ + } else { top.Ext.getCmp('scanTextEnd').focus();//否则不清除,条码/篮筐(尾)获得焦点 } } - if(barcodeEnd != ''){ + if (barcodeEnd != '') { top.Ext.getCmp('scanText').setValue("");//尾条码输入完成,所有条码都取消,要输入确认取消条码了 top.Ext.getCmp('scanTextEnd').setValue("");//清除尾条码,以输入确认取消条码 top.Ext.getCmp('scanText').focus();//否则不清除,条码/篮筐(尾)获得焦点 } } -function getApplicationGoodsByName(goodsName){ - var record = findRecordByNameAndValueFromStore(recyclingapplicationStore1,"name",goodsName); - if(record != null){ +function getApplicationGoodsByName(goodsName) { + var record = findRecordByNameAndValueFromStore(recyclingapplicationStore1, "name", goodsName); + if (record != null) { return record.data; } return null; } -function preprocessBeforeGetBarcodeInfo(){ +function preprocessBeforeGetBarcodeInfo() { var barcode = top.Ext.getCmp("scanText").getValue().Trim(); var barcodeEnd = top.Ext.getCmp("scanTextEnd").getValue().Trim(); - + clearScanText();// 清除条码 var singleMode = true; - if(barcodeEnd != ''){ + if (barcodeEnd != '') { singleMode = false; } var sourceWarehouseId = top.Ext.getCmp("sourceWarehouseId").getValue(); - if(isUndefinedOrNullOrEmpty(sourceWarehouseId)){ - showResult('请先选择仓库!' , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + if (isUndefinedOrNullOrEmpty(sourceWarehouseId)) { + showResult('请先选择仓库!', null, sstsConfig.messagePauseTimeOnInvoiceplanPage); return false; } - if(singleMode){// 判断是否已经扫描过该条码 + if (singleMode) {// 判断是否已经扫描过该条码 var goods = getSendOutGoodsByBarcode(barcode); - if(goods != null){ - if(goods.tousseFixedBarcode){ + if (goods != null) { + if (goods.tousseFixedBarcode) { // 固定条码允许重复扫 return true; } - if(goods.tousseType == '器械包'){// 目前只处理普通器械包的误差,以及删除 + if (goods.tousseType == '器械包') {// 目前只处理普通器械包的误差,以及删除 var appGoods = getApplicationGoodsByName(goods.name); - if(appGoods.errorAmount >= 0){// 误差数量大于等于0时,能正常发货,此时重复扫描,按以前的逻辑处理,提示条码已存在 - showResult('条形码:'+barcode+' 已经存在!' , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + if (appGoods.errorAmount >= 0) {// 误差数量大于等于0时,能正常发货,此时重复扫描,按以前的逻辑处理,提示条码已存在 + showResult('条形码:' + barcode + ' 已经存在!', null, sstsConfig.messagePauseTimeOnInvoiceplanPage); return false; - }else{// 误差数量小于0时,说明扫描数量已经大于申请数量,此时重复扫描某个包,需要删除该包。 + } else {// 误差数量小于0时,说明扫描数量已经大于申请数量,此时重复扫描某个包,需要删除该包。 // 删除该器械包 removeSendOutTousseByBarcode(goods.barcode); return false; } - }else{ - showResult('条形码:'+barcode+' 已经存在!' , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + } else { + showResult('条形码:' + barcode + ' 已经存在!', null, sstsConfig.messagePauseTimeOnInvoiceplanPage); return false; } } } return true; } //名字到数量的map -function getComboTousseNameToAmountMap(tousseInstancesBelongToThisComboTousse){ +function getComboTousseNameToAmountMap(tousseInstancesBelongToThisComboTousse) { var map = {}; - for(var i=0;i 0){ - timeOut = setTimeout(function(){ - if(isIE()){ - document.getElementById('invoicePlanAudioIE').setAttribute('src',WWWROOT+'/common/audio/beep.wav'); - }else { - var myAudio = new Audio(); - myAudio.preload = true; - myAudio.controls = true; - myAudio.src = WWWROOT+'/common/audio/beep.ogg'; - myAudio.play(); +function setTime(time) { + if (time > 0) { + timeOut = setTimeout(function () { + if (isIE()) { + document.getElementById('invoicePlanAudioIE').setAttribute('src', WWWROOT + '/common/audio/beep.wav'); + } else { + var myAudio = new Audio(); + myAudio.preload = true; + myAudio.controls = true; + myAudio.src = WWWROOT + '/common/audio/beep.ogg'; + myAudio.play(); myAudio.loop = false; } - time --; + time--; setTime(time); }, 150); } } //先播放报警声后弹出提示 function loadBeep(resultMsg) { setTime(33); - var timeOut2 = setTimeout(function() { + var timeOut2 = setTimeout(function () { speakMessage(resultMsg); }, 5000); - top.Ext.MessageBox.confirm = function(title, msg, fn) { + top.Ext.MessageBox.confirm = function (title, msg, fn) { this.show({ - title : title, - msg : msg, - buttons:{yes:'确认'}, - fn : fn, - icon : this.QUESTION + title: title, + msg: msg, + buttons: { yes: '确认' }, + fn: fn, + icon: this.QUESTION }); return this; } - top.Ext.MessageBox.confirm('提示',resultMsg,function(btn){ + top.Ext.MessageBox.confirm('提示', resultMsg, function (btn) { clearTimeout(timeOut); clearTimeout(timeOut2); }) @@ -1192,280 +1192,280 @@ var barcode = top.Ext.getCmp("scanText").getValue().Trim(); var barcodeEnd = top.Ext.getCmp("scanTextEnd").getValue().Trim(); var singleMode = true; - if(barcodeEnd != ''){ + if (barcodeEnd != '') { singleMode = false; } - var sourceWarehouseId = top.Ext.getCmp("sourceWarehouseId").getValue(); - if(!preprocessBeforeGetBarcodeInfo()){ + var sourceWarehouseId = top.Ext.getCmp("sourceWarehouseId").getValue(); + if (!preprocessBeforeGetBarcodeInfo()) { return; } // 如果条码/篮筐(尾)不为空 - if(barcodeEnd != ''){ + if (barcodeEnd != '') { barcode += ";" + barcodeEnd; } // 开始查询条码信息 top.Ext.getCmp("sendOutGoods").getEl().mask("后台处理中,请稍候..."); - Ext.Ajax.timeout=300*1000; -// clearScanText();// 清除条码 + Ext.Ajax.timeout = 300 * 1000; + // clearScanText();// 清除条码 Ext.Ajax.request({ - url : WWWROOT + '/disinfectSystem/invoiceAction!loadGoodsByBarcode.do', - params : {barcode : barcode,orgUnitCoding : orgUnitCoding,sourceWarehouseId: sourceWarehouseId}, - async : false, - success : function(response, options) { + url: WWWROOT + '/disinfectSystem/invoiceAction!loadGoodsByBarcode.do', + params: { barcode: barcode, orgUnitCoding: orgUnitCoding, sourceWarehouseId: sourceWarehouseId }, + async: false, + success: function (response, options) { var result = Ext.decode(response.responseText); - if(!result.success){ - if(result.error){ + if (!result.success) { + if (result.error) { showResult(result.error); - }else{ + } else { showResult("操作失败."); } top.Ext.getCmp("sendOutGoods").getEl().unmask(); return; } - if(result.data.length == 0){ + if (result.data.length == 0) { showResult("篮筐内没有该科室的待发货物品!"); top.Ext.getCmp("sendOutGoods").getEl().unmask(); return; } var typeInfoOnScanned = result.data[0].typeInfoOnScanned; - if(typeInfoOnScanned == "orgUnit"){ - if (sendOutGoodsStore1.getCount() == 0 || sendOutGoodsStore1.getCount() < 0){ + if (typeInfoOnScanned == "orgUnit") { + if (sendOutGoodsStore1.getCount() == 0 || sendOutGoodsStore1.getCount() < 0) { closeInvoiceFormWindow(); invoicePlanFormOpened = false; - addAndEditInvoicePlan(result.data[0].departCode,result.data[0].depart); - }else{ - showResult("已扫描了待发物品,不能切换科室" , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + addAndEditInvoicePlan(result.data[0].departCode, result.data[0].depart); + } else { + showResult("已扫描了待发物品,不能切换科室", null, sstsConfig.messagePauseTimeOnInvoiceplanPage); top.Ext.getCmp("sendOutGoods").getEl().unmask(); } - }else{ + } else { top.Ext.getCmp("sendOutGoods").getEl().unmask(); // 首先处理错误信息 - if(!isUndefinedOrNullOrEmpty(result.errMsg)){ - if(sstsConfig.isUseAbnormalGoodsTable && sstsConfig.isUseAbnormalGoodsTable == true){ + if (!isUndefinedOrNullOrEmpty(result.errMsg)) { + if (sstsConfig.isUseAbnormalGoodsTable && sstsConfig.isUseAbnormalGoodsTable == true) { //加入异常物品列表 - if(result.data[0].barcode != null){ + if (result.data[0].barcode != null) { addAbnormalGoods(result.data[0]); } } - if(sstsConfig.enableTheAlarmConfirmationDialogBoxPopsUpWhenTheShipmentScansAbnormalItems){ + if (sstsConfig.enableTheAlarmConfirmationDialogBoxPopsUpWhenTheShipmentScansAbnormalItems) { loadBeep(result.errMsg); - }else { - showResult(result.errMsg , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + } else { + showResult(result.errMsg, null, sstsConfig.messagePauseTimeOnInvoiceplanPage); } top.Ext.getCmp('scanText').setValue(""); top.Ext.getCmp('scanTextEnd').setValue(""); top.Ext.getCmp('scanText').focus(); return; } - if(result.data.length == 0){ - showResult("找不到该条码对应的信息。" , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + if (result.data.length == 0) { + showResult("找不到该条码对应的信息。", null, sstsConfig.messagePauseTimeOnInvoiceplanPage); top.Ext.getCmp('scanText').setValue(""); top.Ext.getCmp('scanTextEnd').setValue(""); top.Ext.getCmp('scanText').focus(); return; } - if(result.isNeedRoutineMonitoringWarning != undefined && result.isNeedRoutineMonitoringWarning == true){ - showResult("该物品灭菌炉没有进行监测,请登记!" , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + if (result.isNeedRoutineMonitoringWarning != undefined && result.isNeedRoutineMonitoringWarning == true) { + showResult("该物品灭菌炉没有进行监测,请登记!", null, sstsConfig.messagePauseTimeOnInvoiceplanPage); } // 验证灭菌筐内的物品是否符合发货条件,扫描的器械包数量是否大于申请数量 var tousseNameToAmountMap = getTousseNameToAmountMap(result); var exceedAmountNames = {};// 超过待发数量的包 - if(result.isContainer != undefined && result.isContainer == true){ - for ( var i = 0; i < recyclingapplicationStore1.getCount(); i++) { - var record = recyclingapplicationStore1.getAt(i); - var name1 =record.get('name'); - var count =record.get('count'); - var tempAmount = record.get('tempAmount'); - var totalAmount = 0; - if(tousseNameToAmountMap.hasOwnProperty(name1)){ - totalAmount = tousseNameToAmountMap[name1]; - } - //待发数量是否大于篮筐内该物品的数量 - var sendAmount = Number(count) - Number(tempAmount);// 待发数量 - if(sendAmount < Number(totalAmount)){ - exceedAmountNames[name1] = { - scannedAmount: totalAmount - } - } + if (result.isContainer != undefined && result.isContainer == true) { + for (var i = 0; i < recyclingapplicationStore1.getCount(); i++) { + var record = recyclingapplicationStore1.getAt(i); + var name1 = record.get('name'); + var count = record.get('count'); + var tempAmount = record.get('tempAmount'); + var totalAmount = 0; + if (tousseNameToAmountMap.hasOwnProperty(name1)) { + totalAmount = tousseNameToAmountMap[name1]; + } + //待发数量是否大于篮筐内该物品的数量 + var sendAmount = Number(count) - Number(tempAmount);// 待发数量 + if (sendAmount < Number(totalAmount)) { + exceedAmountNames[name1] = { + scannedAmount: totalAmount + } + } } } - for( var name in exceedAmountNames ){ - if(exceedAmountNames.hasOwnProperty(name)){ - showResult(name + ",篮筐内数量大于申请数量,请逐个扫描!" , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + for (var name in exceedAmountNames) { + if (exceedAmountNames.hasOwnProperty(name)) { + showResult(name + ",篮筐内数量大于申请数量,请逐个扫描!", null, sstsConfig.messagePauseTimeOnInvoiceplanPage); } } - + var speakBasket = new SpeakBasket(); - - for(var x=0;x 1) && goods.tousseFixedBarcode){// 扫单个包才提示 + if ((result.data.length > 1) && goods.tousseFixedBarcode) {// 扫单个包才提示 //continue; } //固定条码和批次条码判断的参数 var goodsName = result.data[x].name; var goodsBarcode = result.data[x].barcode; - goodsInfo = { name : goodsName , barcode : goodsBarcode}; + goodsInfo = { name: goodsName, barcode: goodsBarcode }; var b = isBarcodeRepeat(goods.barcode); - if(b && (goods.diposable == '是' || !goods.tousseFixedBarcode || goods.tousseType==EXPENSIVEGOODS_TYPE_NAME)){// 扫描多个时,如果存在已扫描的,直接忽略,跳过 + if (b && (goods.diposable == '是' || !goods.tousseFixedBarcode || goods.tousseType == EXPENSIVEGOODS_TYPE_NAME)) {// 扫描多个时,如果存在已扫描的,直接忽略,跳过 continue; } // 校验是否超过待发数量,如果是,也跳过 - if(exceedAmountNames.hasOwnProperty(goods.name)){ + if (exceedAmountNames.hasOwnProperty(goods.name)) { continue; } - // var record = findRecordByNameAndValueFromStore(recyclingapplicationStore1,"name",goods.name); + // var record = findRecordByNameAndValueFromStore(recyclingapplicationStore1,"name",goods.name); var record = findRecordByGoodsVOFromRecyclingApplication(goods); // 如果未找到,继续找下一个 - if (record == undefined){ - var msg = '['+getTtsNameByGoods(goods)+']不在发货计划中!'; - if(!isUndefinedOrNullOrEmpty(goods.tousseType)){ - msg = '['+goods.tousseType+']'+'['+getTtsNameByGoods(goods)+']不在发货计划中!'; + if (record == undefined) { + var msg = '[' + getTtsNameByGoods(goods) + ']不在发货计划中!'; + if (!isUndefinedOrNullOrEmpty(goods.tousseType)) { + msg = '[' + goods.tousseType + ']' + '[' + getTtsNameByGoods(goods) + ']不在发货计划中!'; } - if(sstsConfig.isUseAbnormalGoodsTable && sstsConfig.isUseAbnormalGoodsTable == true){ + if (sstsConfig.isUseAbnormalGoodsTable && sstsConfig.isUseAbnormalGoodsTable == true) { //加入异常物品列表 addAbnormalGoods(goods); } - if(sstsConfig.enableTheAlarmConfirmationDialogBoxPopsUpWhenTheShipmentScansAbnormalItems){ + if (sstsConfig.enableTheAlarmConfirmationDialogBoxPopsUpWhenTheShipmentScansAbnormalItems) { loadBeep(msg); - }else { - showResult(msg , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + } else { + showResult(msg, null, sstsConfig.messagePauseTimeOnInvoiceplanPage); } continue; } // 唯一条码消毒物品的校验 - if(goods.tousseType == '消毒物品' && !goods.tousseFixedBarcode){ - if(!validateDisinfection(record,goods)){ - showResult(getTtsNameByGoods(goods)+'的材料与申请单中的材料不一致' , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + if (goods.tousseType == '消毒物品' && !goods.tousseFixedBarcode) { + if (!validateDisinfection(record, goods)) { + showResult(getTtsNameByGoods(goods) + '的材料与申请单中的材料不一致', null, sstsConfig.messagePauseTimeOnInvoiceplanPage); continue; } } //(物品类型为外部代理灭菌、外来器械包、外来器械拆分小包或代理灭菌的包)并且为要追溯的包时 - if((goods.tousseType == '外部代理灭菌' || goods.tousseType == '外来器械包' || goods.tousseType == '外来器械拆分小包' || goods.proxyDisinfection_id) && !goods.tousseFixedBarcode){ + if ((goods.tousseType == '外部代理灭菌' || goods.tousseType == '外来器械包' || goods.tousseType == '外来器械拆分小包' || goods.proxyDisinfection_id) && !goods.tousseFixedBarcode) { var inPlan = false; - for(var i=0;i 0){ - // showResult(msg); - // } - // } - newAddAudioTips("invoicePlanAudio","",speakBasket); + + // for(var x=0;x 0){ + // showResult(msg); + // } + // } + newAddAudioTips("invoicePlanAudio", "", speakBasket); //speakBasket.speakContent(); - // if(result.data.length > 0 && alreadyAddAmount == 0){ - // showResult("器械包已扫描或不在发货单中"); - // } + // if(result.data.length > 0 && alreadyAddAmount == 0){ + // showResult("器械包已扫描或不在发货单中"); + // } } }, - failure : function(response, options) { + failure: function (response, options) { top.Ext.getCmp("sendOutGoods").getEl().unmask(); - showResult('获取条码信息失败' , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + showResult('获取条码信息失败', null, sstsConfig.messagePauseTimeOnInvoiceplanPage); top.Ext.getCmp('scanText').setValue(""); top.Ext.getCmp('scanTextEnd').setValue(""); top.Ext.getCmp('scanText').focus(); } - + }); } //发货单明细修改 function updateAmount2(name, amount) { if (name != null && name.length > 0) { - for ( var i = 0; i < recyclingapplicationStore1.getCount(); i++) { + for (var i = 0; i < recyclingapplicationStore1.getCount(); i++) { var record = recyclingapplicationStore1.getAt(i); var tempName = record.get('name'); //实发数量 @@ -1484,164 +1484,164 @@ } function findRecordByGoodsVOFromRecyclingApplication(vo) { - for ( var i = 0; i < recyclingapplicationStore1.getCount(); i++) { + for (var i = 0; i < recyclingapplicationStore1.getCount(); i++) { var record = recyclingapplicationStore1.getAt(i); var name = record.get('name'); var diposable = record.get('diposable'); var disposableGoodsIdSet = record.get('disposableGoodsIdSet'); var expensiveGoodsIdSet = record.get('expensiveGoodsIdSet'); - if(name == vo.name && diposable != vo.diposable){ - var msg = '待发物品['+name+']为一次性物品,请扫描一次性物品条码!'; - if(diposable != '是'){ - msg = '待发物品['+name+']为器械包,请扫描器械包条码!'; + if (name == vo.name && diposable != vo.diposable) { + var msg = '待发物品[' + name + ']为一次性物品,请扫描一次性物品条码!'; + if (diposable != '是') { + msg = '待发物品[' + name + ']为器械包,请扫描器械包条码!'; } - showResult(msg , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + showResult(msg, null, sstsConfig.messagePauseTimeOnInvoiceplanPage); return null; } - - if(diposable == '是'){ + + if (diposable == '是') { // 一次性物品优先根据id来匹配 - if(disposableGoodsIdSet.length > 0 && !isUndefinedOrNullOrEmpty(vo.typeInfoOnScanned)){ + if (disposableGoodsIdSet.length > 0 && !isUndefinedOrNullOrEmpty(vo.typeInfoOnScanned)) { var typeInfoOnScanned = JSON.parse(vo.typeInfoOnScanned); - for(var di=0;di 0 && !isUndefinedOrNullOrEmpty(vo.typeInfoOnScanned)){ + if (expensiveGoodsIdSet.length > 0 && !isUndefinedOrNullOrEmpty(vo.typeInfoOnScanned)) { var typeInfoOnScanned = JSON.parse(vo.typeInfoOnScanned); - for(var di=0;di 0){ - for(var di=0;di 0) { + for (var di = 0; di < disposableGoodsIdSet.length; ++di) { + var disposableGoodsId = disposableGoodsIdSet[di]; + if (ids == '') { + ids = disposableGoodsId; + } else { + ids += ',' + disposableGoodsId; + } + } + } } - if(ids == ''){ + if (ids == '') { return; } Ext.Ajax.request({ - url : WWWROOT + '/disinfectSystem/diposableGoodsAction!getStorageByDisposableGoodsIds.do', - params : {disposableGoodsIds : ids,warehouseId:warehouseId}, - success : function(response, options) { + url: WWWROOT + '/disinfectSystem/diposableGoodsAction!getStorageByDisposableGoodsIds.do', + params: { disposableGoodsIds: ids, warehouseId: warehouseId }, + success: function (response, options) { lastLoadWarehouseId = warehouseId; var storages = JSON.parse(response.responseText); setStorage(storages); }, - failure : function(form, action) { + failure: function (form, action) { } }); } // 刷新总包数 -function refreshTotalAmount(){ +function refreshTotalAmount() { var appAmount = 0; var scannedAmount = 0; - for ( var i = 0; i < recyclingapplicationStore1.getCount(); i++) { - var record = recyclingapplicationStore1.getAt(i); - var tempScannedAmount = record.get('tempAmount'); - var tempAppAmount = record.get('count'); - var diposable = record.get('diposable'); - if('是' == diposable){ - continue; - } - tempAppAmount = Number(tempAppAmount); - tempScannedAmount = Number(tempScannedAmount); - appAmount += tempAppAmount; - scannedAmount += tempScannedAmount; + for (var i = 0; i < recyclingapplicationStore1.getCount(); i++) { + var record = recyclingapplicationStore1.getAt(i); + var tempScannedAmount = record.get('tempAmount'); + var tempAppAmount = record.get('count'); + var diposable = record.get('diposable'); + if ('是' == diposable) { + continue; + } + tempAppAmount = Number(tempAppAmount); + tempScannedAmount = Number(tempScannedAmount); + appAmount += tempAppAmount; + scannedAmount += tempScannedAmount; } - var text = '申请总包数:'+appAmount+',已扫:'+scannedAmount+''; + var text = '申请总包数:' + appAmount + ',已扫:' + scannedAmount + ''; var amountElement = top.Ext.getCmp('tousseAmountInfo'); - if(amountElement != null){ + if (amountElement != null) { amountElement.setText(text); } } -function setStorage(storages){ - if(storages.length > 0){ - for ( var i = 0; i < storages.length; i++) { +function setStorage(storages) { + if (storages.length > 0) { + for (var i = 0; i < storages.length; i++) { var storage = storages[i]; var record = findAppRecordByStorageInfo(storage); - if(record){ -// if(!isUndefinedOrNull(storage.middlePackageStorage)){ -// record.set('storage',storage.storage); -// }else{ -// record.set('storage',storage.storage); -// } - record.set('storage',storage.storage); + if (record) { + // if(!isUndefinedOrNull(storage.middlePackageStorage)){ + // record.set('storage',storage.storage); + // }else{ + // record.set('storage',storage.storage); + // } + record.set('storage', storage.storage); } } } } -function findAppRecordByStorageInfo(storage){ - for(var i=0;i 0){ +function middlePackageAmountValid(middlePackageAmount) { + if (!isUndefinedOrNull(middlePackageAmount) && middlePackageAmount > 0) { return true; } return false; @@ -1654,168 +1654,168 @@ */ var invoicePlanFormOpened = false; var g_orgUnitCoding = ''; -function addAndEditInvoicePlan(orgUnitCoding,depart,invoicePlanId) { +function addAndEditInvoicePlan(orgUnitCoding, depart, invoicePlanId) { //发货计划 - if(invoicePlanFormOpened){ + if (invoicePlanFormOpened) { return; } g_orgUnitCoding = orgUnitCoding; invoicePlanFormOpened = true; lastLoadWarehouseId = null; - defaultFocusedFieldOnInvoiceForm = getStrValueFromJs('sstsConfig.defaultFocusedFieldOnInvoiceForm',defaultFocusedFieldOnInvoiceForm); + defaultFocusedFieldOnInvoiceForm = getStrValueFromJs('sstsConfig.defaultFocusedFieldOnInvoiceForm', defaultFocusedFieldOnInvoiceForm); //异常物品列表--Ext.data.Store sendOutAbnormalGoodsStore = new Ext.data.Store({ - reader : new Ext.data.JsonReader({ - fields : [ - {name : 'id'}, - {name : 'barcode'}, - {name : 'name'}, - {name : 'ttsName'}, - {name : 'appRecord'}, - {name : 'showTousseName'}, - {name : 'status'}, - {name : 'depart'}, - {name : 'batchNumber'} + reader: new Ext.data.JsonReader({ + fields: [ + { name: 'id' }, + { name: 'barcode' }, + { name: 'name' }, + { name: 'ttsName' }, + { name: 'appRecord' }, + { name: 'showTousseName' }, + { name: 'status' }, + { name: 'depart' }, + { name: 'batchNumber' } ] }) }); // 发货物品 - sendOutGoodsStore1= new Ext.data.Store({ - reader : new Ext.data.JsonReader({ - fields : [ - {name : 'id'}, - {name : 'barcode'}, - {name : 'urgentLevel'}, - {name : 'name'}, - {name : 'ttsName'}, - {name : 'appRecord'}, - {name : 'showTousseName'}, - {name : 'count'}, - {name : 'scanAmount'}, - {name : 'waitDeliveryCount'}, - {name : 'tousseInstancesBelongToThisComboTousse'}, - {name : 'diposable'}, - {name : 'tousseType'}, - {name : 'tousseFixedBarcode'}, - {name : 'price'}, - {name : 'fluctuationPrice'}, - {name : 'storage'}, - {name : 'batchNumber'}, - {name : 'sterilizerName'}, - {name : 'frequency'}, - {name : 'externalCode'} - ] + sendOutGoodsStore1 = new Ext.data.Store({ + reader: new Ext.data.JsonReader({ + fields: [ + { name: 'id' }, + { name: 'barcode' }, + { name: 'urgentLevel' }, + { name: 'name' }, + { name: 'ttsName' }, + { name: 'appRecord' }, + { name: 'showTousseName' }, + { name: 'count' }, + { name: 'scanAmount' }, + { name: 'waitDeliveryCount' }, + { name: 'tousseInstancesBelongToThisComboTousse' }, + { name: 'diposable' }, + { name: 'tousseType' }, + { name: 'tousseFixedBarcode' }, + { name: 'price' }, + { name: 'fluctuationPrice' }, + { name: 'storage' }, + { name: 'batchNumber' }, + { name: 'sterilizerName' }, + { name: 'frequency' }, + { name: 'externalCode' } + ] }) }); - - var recyclingapplicationRd = new Ext.data.JsonReader( { - fields : [ - {name : 'id'}, - {name : 'barcode'}, - {name : 'name'}, - {name : 'ttsName'}, - {name : 'tousseItems'}, - {name : 'scannedMaterialAmount'}, - {name : 'showTousseName'}, - {name : 'fullCaseApplicationAmount'}, - {name : 'count'},//待发数量 - {name : 'middlePackageAmount'}, - {name : 'diposable'}, - {name : 'disposableGoodsId'}, - {name : 'goodsType'}, - {name : 'price'}, - {name : 'urgentAmount'},//加急数量 - {name : 'tempAmount'},//实发数量 - {name : 'errorAmount'},//误差数量 - {name : 'storage'},//库存数量 - {name : 'amount'},//?未知 - {name : 'scanTime'}, - {name : 'sortValue'}, - {name : 'applicationAmount'}, - {name : 'batchNumber'}, - {name : 'isCleanedEntirely'}, - {name : 'disposableGoodsIdSet'}, - {name : 'expensiveGoodsIdSet'}, - {name : 'invoicePlanIDList'}, - {name : 'invoicePlanType'} + + var recyclingapplicationRd = new Ext.data.JsonReader({ + fields: [ + { name: 'id' }, + { name: 'barcode' }, + { name: 'name' }, + { name: 'ttsName' }, + { name: 'tousseItems' }, + { name: 'scannedMaterialAmount' }, + { name: 'showTousseName' }, + { name: 'fullCaseApplicationAmount' }, + { name: 'count' },//待发数量 + { name: 'middlePackageAmount' }, + { name: 'diposable' }, + { name: 'disposableGoodsId' }, + { name: 'goodsType' }, + { name: 'price' }, + { name: 'urgentAmount' },//加急数量 + { name: 'tempAmount' },//实发数量 + { name: 'errorAmount' },//误差数量 + { name: 'storage' },//库存数量 + { name: 'amount' },//?未知 + { name: 'scanTime' }, + { name: 'sortValue' }, + { name: 'applicationAmount' }, + { name: 'batchNumber' }, + { name: 'isCleanedEntirely' }, + { name: 'disposableGoodsIdSet' }, + { name: 'expensiveGoodsIdSet' }, + { name: 'invoicePlanIDList' }, + { name: 'invoicePlanType' } ] }); //科室申请单的store -// var requestUrlRoot = WWWROOT + '/disinfectSystem/invoiceAction!getInvoicePlansByOrgAndTousseType.do'; + // var requestUrlRoot = WWWROOT + '/disinfectSystem/invoiceAction!getInvoicePlansByOrgAndTousseType.do'; var requestUrlRoot = WWWROOT + '/disinfectSystem/invoicePlanAction!getInvoicePlansByOrgAndTousseType.do'; - var urls = requestUrlRoot + '?departCode=' + - orgUnitCoding + '&applyDate=' + - selectedApplyDate; - if(selectedTousseType){ + var urls = requestUrlRoot + '?departCode=' + + orgUnitCoding + '&applyDate=' + + selectedApplyDate; + if (selectedTousseType) { urls += '&tousseType=' + encodeURI(selectedTousseType); } - if(selectedDisposableGoodsType){ + if (selectedDisposableGoodsType) { urls += '&disposableGoodsType=' + encodeURI(selectedDisposableGoodsType); } - if(selectedSterilingMethodsForApplyList){ + if (selectedSterilingMethodsForApplyList) { urls += '&sterilingMethods=' + encodeURI(selectedSterilingMethodsForApplyList); } - if(tousseGroupIdsForApplyList){ + if (tousseGroupIdsForApplyList) { //urls += '&tousseGroupIds=' + encodeURI(tousseGroupIdsForApplyList); urls += tousseGroupIdsForApplyList; - }if(selectedAppFormType){ + } if (selectedAppFormType) { urls += '&appFormType=' + encodeURI(selectedAppFormType); } - + var departApplicationStore = new Ext.data.Store({ - proxy : new Ext.data.HttpProxy({ - url :urls, - method : 'POST' + proxy: new Ext.data.HttpProxy({ + url: urls, + method: 'POST' }), - reader : new Ext.data.JsonReader({fields : [{name : 'id'},{name : 'typeAndserialNumber'},{name : 'remark'}]}), + reader: new Ext.data.JsonReader({ fields: [{ name: 'id' }, { name: 'typeAndserialNumber' }, { name: 'remark' }] }), listeners: { - load: function(thiz,records,options){ + load: function (thiz, records, options) { // 设置备注 var remarks = ''; - if(records.length > 0){ - for(var i = 0; i < records.length;++i){ - if(!isUndefinedOrNullOrEmpty(records[i].data.remark)){ + if (records.length > 0) { + for (var i = 0; i < records.length; ++i) { + if (!isUndefinedOrNullOrEmpty(records[i].data.remark)) { remarks += records[i].data.remark; } } var remark2Cmp = top.Ext.getCmp('remark2'); - if(remark2Cmp){ + if (remark2Cmp) { remark2Cmp.setValue(remarks); } } - - if(records.length > 0 && invoicePlanId){ + + if (records.length > 0 && invoicePlanId) { var index; - for(var index = 0; index < records.length;++index){ - if(records[index].data.id == invoicePlanId){ + for (var index = 0; index < records.length; ++index) { + if (records[index].data.id == invoicePlanId) { break; } } - if(index < records.length){ + if (index < records.length) { var combo = top.Ext.getCmp('invoicePlanId'); - if(combo){ + if (combo) { combo.setValue(records[index].data.id); - combo.fireEvent('select', combo,records[index],index); + combo.fireEvent('select', combo, records[index], index); } } } } } }); - + //申请物品 recyclingapplicationStore1 = new Ext.data.Store({ - proxy : new Ext.data.HttpProxy({ + proxy: new Ext.data.HttpProxy({ //url : WWWROOT + '/disinfectSystem/invoiceAction!loadDepartApplicationAllGoodsByCondition.do', - url : WWWROOT + '/disinfectSystem/invoicePlanAction!loadDepartApplicationAllGoodsByCondition.do', - method : 'POST' + url: WWWROOT + '/disinfectSystem/invoicePlanAction!loadDepartApplicationAllGoodsByCondition.do', + method: 'POST' }), - reader : recyclingapplicationRd, + reader: recyclingapplicationRd, listeners: { - load: function(thiz,records,options){ + load: function (thiz, records, options) { initErrorAmount(); var sourceWarehouseIdCmp = top.Ext.getCmp('sourceWarehouseId'); - if(sourceWarehouseIdCmp != null){ + if (sourceWarehouseIdCmp != null) { var sourceWarehouseId = sourceWarehouseIdCmp.getValue(); refreshTotalAmount(); //refreshStorage(sourceWarehouseId); @@ -1824,198 +1824,218 @@ } } }); - + recyclingapplicationStore1.removeAll(); - recyclingapplicationStore1.on("beforeload", function(thiz, options) { + recyclingapplicationStore1.on("beforeload", function (thiz, options) { thiz.baseParams["orgUnitCoding"] = orgUnitCoding; recyclingapplicationStore1.baseParams['invoicePlanId'] = selectedInvoicePlanId; recyclingapplicationStore1.baseParams['applyDate'] = selectedApplyDate; recyclingapplicationStore1.baseParams['tousseType'] = encodeURI(selectedTousseType); recyclingapplicationStore1.baseParams['disposableGoodsType'] = encodeURI(selectedDisposableGoodsType); - if(selectedSterilingMethods != "" && selectedSterilingMethods != "null" && selectedSterilingMethods != null){ + if (selectedSterilingMethods != "" && selectedSterilingMethods != "null" && selectedSterilingMethods != null) { recyclingapplicationStore1.baseParams['sterilingMethods'] = encodeURI(selectedSterilingMethods); } recyclingapplicationStore1.baseParams['tousseGroupIds'] = tousseGroupIds; //申请单类型 recyclingapplicationStore1.baseParams['appFormType'] = encodeURI(selectedAppFormType); - if(top.Ext.getCmp("sendOutGoodsDetail")){ + if (top.Ext.getCmp("sendOutGoodsDetail")) { top.Ext.getCmp("sendOutGoodsDetail").getEl().mask("加载中,请稍候..."); } }); - - recyclingapplicationStore1.on("load", function(thiz, options) { - if(top.Ext.getCmp("sendOutGoodsDetail")){ + + recyclingapplicationStore1.on("load", function (thiz, options) { + if (top.Ext.getCmp("sendOutGoodsDetail")) { top.Ext.getCmp("sendOutGoodsDetail").getEl().unmask(); } //是否存在待发的一次性物品 var existsDisposableGoodsWaitDelivery = false; //如果待发物品中有一次性物品,则设置"一键扫描一次性物品"按钮显示 - for(var i = 0;i < recyclingapplicationStore1.getCount();i++){ + for (var i = 0; i < recyclingapplicationStore1.getCount(); i++) { var record = recyclingapplicationStore1.getAt(i); - if(record.data.goodsType == '一次性物品'){ + if (record.data.goodsType == '一次性物品') { existsDisposableGoodsWaitDelivery = true; break; } } - if(sstsConfig.oneKeyScanDisposableGoodsForPC && sstsConfig.isInitiateDisposableGoodsFixedBarcode && existsDisposableGoodsWaitDelivery){ + if (sstsConfig.oneKeyScanDisposableGoodsForPC && sstsConfig.isInitiateDisposableGoodsFixedBarcode && existsDisposableGoodsWaitDelivery) { top.Ext.getCmp('btnBatchScanDisposableGoods').setVisible(true); top.Ext.getCmp('btnBatchScanDisposableGoods').enable(); - }else{ + } else { top.Ext.getCmp('btnBatchScanDisposableGoods').setVisible(false); } }); - + recyclingapplicationStore1.load(); -// sendOutGoodsStore.removeAll(); -// sendOutGoodsStore.on("beforeload", function(thiz, options) { -// thiz.baseParams["orgUnitCoding"] = orgUnitCoding; -// }); -// sendOutGoodsStore.load(); + // sendOutGoodsStore.removeAll(); + // sendOutGoodsStore.on("beforeload", function(thiz, options) { + // thiz.baseParams["orgUnitCoding"] = orgUnitCoding; + // }); + // sendOutGoodsStore.load(); var width0 = 0; var width1 = 0; var width2 = 0; - if(isIE()){ + if (isIE()) { width0 = 240; width1 = 75; width2 = 40; - }else { + } else { width0 = 195; width1 = 70; width2 = 50; } - - var recyclingapplicationCm = new Ext.grid.ColumnModel([ - {header : "申请的物品",align:'center',dataIndex : 'showTousseName',width : width0,menuDisabled: true, renderer : function(v, p, record){ - return renderFunction(v, p, record, '申请的物品'); - }}, - {header : "name",dataIndex : 'name',hidden : true,menuDisabled: true}, - {header : "待发",dataIndex : 'count',align:'right',width : width2, menuDisabled: true, renderer : function(v, p, record){ - return renderFunction(v, p, record, '待发'); - }}, - {header : "紧急程度",align:'center',dataIndex : 'topUrgentLevel',width : width1,menuDisabled: true, - renderer : function(v, p, record){ + + var recyclingapplicationCm = new Ext.grid.ColumnModel([ + { + header: "申请的物品", align: 'center', dataIndex: 'showTousseName', width: width0, menuDisabled: true, renderer: function (v, p, record) { + return renderFunction(v, p, record, '申请的物品'); + } + }, + { header: "name", dataIndex: 'name', hidden: true, menuDisabled: true }, + { + header: "待发", dataIndex: 'count', align: 'right', width: width2, menuDisabled: true, renderer: function (v, p, record) { + return renderFunction(v, p, record, '待发'); + } + }, + { + header: "紧急程度", align: 'center', dataIndex: 'topUrgentLevel', width: width1, menuDisabled: true, + renderer: function (v, p, record) { return renderFunction(v, p, record, '紧急程度'); } }, - {header : '加急',id : 'urgentAmount',align:'right',dataIndex : 'urgentAmount',width : width2,value : 0, menuDisabled: true, renderer : function(v, p, record){ - return renderFunction(v, p, record, '加急'); - }}, - {header : '实发',id : 'tempAmount',align:'right',dataIndex : 'tempAmount',width : width2,value : 0, menuDisabled: true, renderer : function(v, p, record){ - return renderFunction(v, p, record, '实发'); - }}, - {header : '误差',id : 'errorAmount',align:'right',dataIndex : 'errorAmount',width : width2,value : 0, menuDisabled: true, renderer : function(v, p, record){ - return renderFunction(v, p, record, '误差'); - }}, - {header : '库存',id : 'storage',align:'right',dataIndex : 'storage',width : width2,value : 0, menuDisabled: true, renderer : function(v, p, record){ - return renderFunction(v, p, record, '库存'); - }}, - {id : 'diposable',header : "是否一次性材料",dataIndex : 'diposable',hidden :true}, - {id :'applicationAmount',header : "最大发货数量",dataIndex : 'applicationAmount',hidden : true,width :150}, - {header : "",dataIndex : '',width :10, renderer : function(v, p, record){ - return renderFunction(v, p, record, ''); - }} + { + header: '加急', id: 'urgentAmount', align: 'right', dataIndex: 'urgentAmount', width: width2, value: 0, menuDisabled: true, renderer: function (v, p, record) { + return renderFunction(v, p, record, '加急'); + } + }, + { + header: '实发', id: 'tempAmount', align: 'right', dataIndex: 'tempAmount', width: width2, value: 0, menuDisabled: true, renderer: function (v, p, record) { + return renderFunction(v, p, record, '实发'); + } + }, + { + header: '误差', id: 'errorAmount', align: 'right', dataIndex: 'errorAmount', width: width2, value: 0, menuDisabled: true, renderer: function (v, p, record) { + return renderFunction(v, p, record, '误差'); + } + }, + { + header: '库存', id: 'storage', align: 'right', dataIndex: 'storage', width: width2, value: 0, menuDisabled: true, renderer: function (v, p, record) { + return renderFunction(v, p, record, '库存'); + } + }, + { id: 'diposable', header: "是否一次性材料", dataIndex: 'diposable', hidden: true }, + { id: 'applicationAmount', header: "最大发货数量", dataIndex: 'applicationAmount', hidden: true, width: 150 }, + { + header: "", dataIndex: '', width: 10, renderer: function (v, p, record) { + return renderFunction(v, p, record, ''); + } + } ]); - + var recyclingErrorCm = new Ext.grid.ColumnModel([ - {header : "材料名称",dataIndex : 'goodsName',width : 170,menuDisabled: true}, - {header : "缺失数量",dataIndex : 'count',width : 60, menuDisabled: true}, - {header : '单价',id : 'price',dataIndex : 'price',width : 60,value : 0,menuDisabled: true} + { header: "材料名称", dataIndex: 'goodsName', width: 170, menuDisabled: true }, + { header: "缺失数量", dataIndex: 'count', width: 60, menuDisabled: true }, + { header: '单价', id: 'price', dataIndex: 'price', width: 60, value: 0, menuDisabled: true } ]); //异常物品列表字段 var abnormalCm = new Ext.grid.ColumnModel([ - {header : "条码",dataIndex : 'barcode',width : 80,menuDisabled: true}, - {header : "物品名称",dataIndex : 'showTousseName',width : 100,menuDisabled: true}, - {id : 'deleteItem',header:'删除',width : 15, align:'center', menuDisabled: true, - renderer: function(v,p,record){ - var str = ""; - return str; - }, - dataIndex:'button' + { header: "条码", dataIndex: 'barcode', width: 80, menuDisabled: true }, + { header: "物品名称", dataIndex: 'showTousseName', width: 100, menuDisabled: true }, + { + id: 'deleteItem', header: '删除', width: 15, align: 'center', menuDisabled: true, + renderer: function (v, p, record) { + var str = ""; + return str; }, - {header : "包状态",dataIndex : 'status',width : 80, menuDisabled: true}, - {header : "回收科室",dataIndex : 'depart',width : 125, menuDisabled: true}, - {header : "name",dataIndex : 'name',hidden : true,menuDisabled: true}, - {header : "批次/灭菌日期",dataIndex : 'batchNumber',width : 110,menuDisabled: true} + dataIndex: 'button' + }, + { header: "包状态", dataIndex: 'status', width: 80, menuDisabled: true }, + { header: "回收科室", dataIndex: 'depart', width: 125, menuDisabled: true }, + { header: "name", dataIndex: 'name', hidden: true, menuDisabled: true }, + { header: "批次/灭菌日期", dataIndex: 'batchNumber', width: 110, menuDisabled: true } ]); var sendOutGoodsColumnModel = new Ext.grid.ColumnModel([ - {header : "条码",dataIndex : 'barcode',align:'center',width :72 ,menuDisabled: true, - renderer : function(v, p, record){ - if(sstsConfig.enableUrgentFunction && record.data.urgentLevel != undefined && record.data.urgentLevel.colorCode != undefined){ - var result = ""; - result += "
"; - result += ""; - return result; - } - else{ - return v; - } + { + header: "条码", dataIndex: 'barcode', align: 'center', width: 72, menuDisabled: true, + renderer: function (v, p, record) { + if (sstsConfig.enableUrgentFunction && record.data.urgentLevel != undefined && record.data.urgentLevel.colorCode != undefined) { + var result = ""; + result += "
"; + result += ""; + return result; } - }, - {header : "物品名称",align:'center',dataIndex : 'showTousseName',width : windowW < 1280 ? 195 : 320,menuDisabled: true}, - {header : "name",dataIndex : 'name',hidden : true,menuDisabled: true}, - {header : "批次/灭菌日期",align:'center',dataIndex : 'batchNumber',width : 90,menuDisabled: true}, - {header : "灭菌炉名称",dataIndex : 'sterilizerName',width : 150,menuDisabled: true,hidden :true}, - {header : "炉次",dataIndex : 'frequency',width : 55,menuDisabled: true,hidden :true}, - {id : 'diposable',header : "是否一次性材料",dataIndex : 'diposable',hidden :true,width : 150}, - {header : "单价",dataIndex : 'fluctuationPrice',width : 50, align:'right', menuDisabled: true}, - {header : "数量",dataIndex : 'count',width : 50, align:'right', menuDisabled: true, - editor : new Ext.form.NumberField({ - allowBlank : false, - allowNegative : false, - minValue :1, - style : 'text-align: left', - allowDecimals : false, - listeners : { - focus : function(thiz){ + else { + return v; + } + } + }, + { header: "物品名称", align: 'center', dataIndex: 'showTousseName', width: windowW < 1280 ? 195 : 320, menuDisabled: true }, + { header: "name", dataIndex: 'name', hidden: true, menuDisabled: true }, + { header: "批次/灭菌日期", align: 'center', dataIndex: 'batchNumber', width: 90, menuDisabled: true }, + { header: "灭菌炉名称", dataIndex: 'sterilizerName', width: 150, menuDisabled: true, hidden: true }, + { header: "炉次", dataIndex: 'frequency', width: 55, menuDisabled: true, hidden: true }, + { id: 'diposable', header: "是否一次性材料", dataIndex: 'diposable', hidden: true, width: 150 }, + { header: "单价", dataIndex: 'fluctuationPrice', width: 50, align: 'right', menuDisabled: true }, + { + header: "数量", dataIndex: 'count', width: 50, align: 'right', menuDisabled: true, + editor: new Ext.form.NumberField({ + allowBlank: false, + allowNegative: false, + minValue: 1, + style: 'text-align: left', + allowDecimals: false, + listeners: { + focus: function (thiz) { thiz.selectText(); } } - })}, - {id : 'deleteItem',header:'删除',width : 25, align:'center', menuDisabled: true, - renderer: function(v,p,record){ - var str = ""; - return str; + }) }, - dataIndex:'button' - }]); - - var invoicePlan_rd = new Ext.data.JsonReader( { - fields : [ - {name : 'showTousseName'}, - {name : 'applicationAmount'}, - {name : 'sendAmount'}, - {name : 'count'} + { + id: 'deleteItem', header: '删除', width: 25, align: 'center', menuDisabled: true, + renderer: function (v, p, record) { + var str = ""; + return str; + }, + dataIndex: 'button' + }]); + + var invoicePlan_rd = new Ext.data.JsonReader({ + fields: [ + { name: 'showTousseName' }, + { name: 'applicationAmount' }, + { name: 'sendAmount' }, + { name: 'count' } ] }); - + //申请物品 var invoicePlan_recyclingapplicationStore = new Ext.data.Store({ - reader : invoicePlan_rd + reader: invoicePlan_rd }); //申请物品(新加了一个带1的store,之前应该是受到待发物品的重名影响,会报未定义) var invoicePlan_recyclingapplicationStore1 = new Ext.data.Store({ - reader : invoicePlan_rd + reader: invoicePlan_rd }); - function doSaveAction(printInvoiceCallback){ + function doSaveAction(printInvoiceCallback) { //异常物品处理完毕与否 - if(sstsConfig.isUseAbnormalGoodsTable && sstsConfig.isUseAbnormalGoodsTable == true){ + if (sstsConfig.isUseAbnormalGoodsTable && sstsConfig.isUseAbnormalGoodsTable == true) { var AbnormalGoodsNum = top.Ext.getCmp('sendOutAbnormalGoods').getStore().data.keys; - if(AbnormalGoodsNum.length > 0){ - showResult('请处理完异常物品再提交' , null ,sstsConfig.messagePauseTimeOnInvoiceplanPage); + if (AbnormalGoodsNum.length > 0) { + showResult('请处理完异常物品再提交', null, sstsConfig.messagePauseTimeOnInvoiceplanPage); return false; } } if (!form.getForm().isValid()) { - showResult('请正确填写表单各值' , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + showResult('请正确填写表单各值', null, sstsConfig.messagePauseTimeOnInvoiceplanPage); return false; } //验证发货物品表格 - if(!sendOutGoodsStore1|| sendOutGoodsStore1.getCount() == 0){ - showResult('发货物品不能为空!' , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + if (!sendOutGoodsStore1 || sendOutGoodsStore1.getCount() == 0) { + showResult('发货物品不能为空!', null, sstsConfig.messagePauseTimeOnInvoiceplanPage); top.Ext.getCmp('scanText').setValue(""); top.Ext.getCmp('scanTextEnd').setValue(""); top.Ext.getCmp('scanText').focus(); @@ -2026,62 +2046,62 @@ return false; }*/ var bool = validGridAmount(); - if(!bool){ + if (!bool) { return false; } - if(project == 'gdsy'){ - if(!isScanAmountEqualsAppAmountConfirmed){ - if(!isScanAmountEqualsAppAmount()){ - confirmSaveWin = top.Ext.MessageBox.prompt("请确认","部分物品实发数量与待发数量存在差异,是否继续发货?", - function(button, text) { - - if ("cancel" == button || (!isUndefinedOrNullOrEmpty(text) && (text != BARCODE_ACTION_YES))){ - confirmSaveWin = null; - isScanAmountEqualsAppAmountConfirmed = false; - }else{ - isScanAmountEqualsAppAmountConfirmed = true; - doSaveAction(); - } - }); - speaker.speak("部分物品实发数量与待发数量存在差异,是否继续发货","是否继续发货"); + if (project == 'gdsy') { + if (!isScanAmountEqualsAppAmountConfirmed) { + if (!isScanAmountEqualsAppAmount()) { + confirmSaveWin = top.Ext.MessageBox.prompt("请确认", "部分物品实发数量与待发数量存在差异,是否继续发货?", + function (button, text) { + + if ("cancel" == button || (!isUndefinedOrNullOrEmpty(text) && (text != BARCODE_ACTION_YES))) { + confirmSaveWin = null; + isScanAmountEqualsAppAmountConfirmed = false; + } else { + isScanAmountEqualsAppAmountConfirmed = true; + doSaveAction(); + } + }); + speaker.speak("部分物品实发数量与待发数量存在差异,是否继续发货", "是否继续发货"); return false; } } } isScanAmountEqualsAppAmountConfirmed = false; getTousseGridData1(); - form.form.submit( { + form.form.submit({ //url : WWWROOT + '/disinfectSystem/invoiceAction!saveDepartInvoice.do', - url : WWWROOT + '/disinfectSystem/invoiceAction!saveInvoiceByDepartOrInvoicePlanId.do', - method : 'POST', - waitMsg : '正在保存数据,请稍候', - waitTitle : '提交表单', + url: WWWROOT + '/disinfectSystem/invoiceAction!saveInvoiceByDepartOrInvoicePlanId.do', + method: 'POST', + waitMsg: '正在保存数据,请稍候', + waitTitle: '提交表单', timeout: 60, - success : function(form, action) { + success: function (form, action) { // 一定要事务提交成功才返回发货计划列表界面 - showResult(action.result.message , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); - if(action.result.success){ - if(printInvoiceCallback != null){ + showResult(action.result.message, null, sstsConfig.messagePauseTimeOnInvoiceplanPage); + if (action.result.success) { + if (printInvoiceCallback != null) { printInvoiceCallback(action.result.invoiceIds); } closeInvoiceFormWindow(); // 返回退货界面 - if(openMode == INVOICE_FORM_OPEN_MODE_CLICKRETURNRECORD){ - document.location.href = WWWROOT+'/disinfectsystem/returnGoodsRecord/returnGoodsRecordView.jsp'; + if (openMode == INVOICE_FORM_OPEN_MODE_CLICKRETURNRECORD) { + document.location.href = WWWROOT + '/disinfectsystem/returnGoodsRecord/returnGoodsRecordView.jsp'; return; } grid.getStore().reload(); } }, - failure : function(form, action) { - if(!isUndefinedOrNullOrEmpty(action.result) && !isUndefinedOrNullOrEmpty(action.result.message)){ - showResult(action.result.message , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); - }else{ - showResult("发货超时,请稍后查看发货单以确定发货是否成功,避免重复发货!" , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + failure: function (form, action) { + if (!isUndefinedOrNullOrEmpty(action.result) && !isUndefinedOrNullOrEmpty(action.result.message)) { + showResult(action.result.message, null, sstsConfig.messagePauseTimeOnInvoiceplanPage); + } else { + showResult("发货超时,请稍后查看发货单以确定发货是否成功,避免重复发货!", null, sstsConfig.messagePauseTimeOnInvoiceplanPage); closeInvoiceFormWindow(); // 返回退货界面 - if(openMode == INVOICE_FORM_OPEN_MODE_CLICKRETURNRECORD){ - document.location.href = WWWROOT+'/disinfectsystem/returnGoodsRecord/returnGoodsRecordView.jsp'; + if (openMode == INVOICE_FORM_OPEN_MODE_CLICKRETURNRECORD) { + document.location.href = WWWROOT + '/disinfectsystem/returnGoodsRecord/returnGoodsRecordView.jsp'; return; } grid.getStore().reload(); @@ -2093,161 +2113,161 @@ * 发货并打印发货单 * @param invoiceIds 发货单的id数组 */ - function printInvoiceAfterInvoice(invoiceIds){ - if(!isUndefinedOrNull(invoiceIds)){ - var invoicePrintModule = new InvoicePrintModule(grid,$Id('userName').value); - invoicePrintModule.batchPrintInvoiceWithType(invoiceIds.join(","),'全部'); + function printInvoiceAfterInvoice(invoiceIds) { + if (!isUndefinedOrNull(invoiceIds)) { + var invoicePrintModule = new InvoicePrintModule(grid, $Id('userName').value); + invoicePrintModule.batchPrintInvoiceWithType(invoiceIds.join(","), '全部'); } } - function callback_yes(){ + function callback_yes() { doSaveAction(); } - function callback_no(){ - if(confirmSaveWin){ + function callback_no() { + if (confirmSaveWin) { confirmSaveWin.hide(); confirmSaveWin = null; isScanAmountEqualsAppAmountConfirmed = false; - }else{ + } else { closeInvoiceFormWindow(); } } - + v_callback_yes = callback_yes; v_callback_no = callback_no; - barcodeBtn = new BarcodeBtn(function(){callback_yes();},function(){callback_no();}); + barcodeBtn = new BarcodeBtn(function () { callback_yes(); }, function () { callback_no(); }); form = new top.Ext.FormPanel({ - id : 'recyclingApplicationForm', - frame : true, + id: 'recyclingApplicationForm', + frame: true, region: 'center', - labelSeparator : ':', - bodyStyle : 'padding:5px 5px 0px 5px', - width : windowW < 1280 ? windowW-4 : 1280, - autoHeight : true, - // autoScroll : true, - labelAlign:'right', - layout : 'form', - items : [{ - xtype : "fieldset", - title : "基础数据", - layout : 'column', + labelSeparator: ':', + bodyStyle: 'padding:5px 5px 0px 5px', + width: windowW < 1280 ? windowW - 4 : 1280, + autoHeight: true, + // autoScroll : true, + labelAlign: 'right', + layout: 'form', + items: [{ + xtype: "fieldset", + title: "基础数据", + layout: 'column', style: 'padding:0px', - autoHeight : true, - items : [{ - layout : 'column', - columnWidth :1, - items:[{ - xtype : 'hidden', - name : 'id', - id : 'id' - },{ - xtype : 'hidden', - name : 'sendOutGoodsStoreData', - id : 'sendOutGoodsStoreData' - },{ - xtype :'hidden', - name : 'recyclingappStoreData', - id : 'recyclingappStoreData' - },{ - xtype :'hidden', - name : 'status', - id : 'status' - },{ - xtype :'hidden', - name : 'orgUnitCoding', - id : 'orgUnitCoding', - value:orgUnitCoding - },{ - xtype :'hidden', - name : 'applyDate', - id : 'applyDateHidden', - value:selectedApplyDate - },{ - xtype :'hidden', - name : 'tousseType', - id : 'tousseTypeHidden', - value:selectedTousseType - },{ - xtype :'hidden', - name : 'appFormType', - id : 'appFormTypeHidden', - value:selectedAppFormType - },{ - xtype :'hidden', - name : 'invoicePlanId', - id : 'invoicePlanIdHidden', - value:selectedInvoicePlanId - },{ - xtype :'hidden', - name : 'personInChargeCode', - id : 'personInChargeCode' - },{ - xtype : 'hidden', - name : 'sourceWarehouseId', - id : 'sourceWarehouseId' - },{ - xtype : 'hidden', - name : 'sourceWarehouseName', - id : 'sourceWarehouseName' - },{ - xtype : 'hidden', - name : 'warehouseID', - id : 'warehouseID' - },{ - xtype : 'hidden', - name : 'warehouseName', - id : 'warehouseName' - },{ - xtype : 'hidden', - name : 'tousseGroupIds', - id : 'tousseGroupIds' - },{ - layout : 'form', - labelWidth :120, - columnWidth :.33, - items : [{ - xtype : 'textfield', - fieldLabel : '申请科室', - maxLength : '100', - id : 'depart2', - name : 'depart', - value : depart, - readOnly:true, - anchor : '99%', - cls:'fieldReadOnlyNoRemove' + autoHeight: true, + items: [{ + layout: 'column', + columnWidth: 1, + items: [{ + xtype: 'hidden', + name: 'id', + id: 'id' + }, { + xtype: 'hidden', + name: 'sendOutGoodsStoreData', + id: 'sendOutGoodsStoreData' + }, { + xtype: 'hidden', + name: 'recyclingappStoreData', + id: 'recyclingappStoreData' + }, { + xtype: 'hidden', + name: 'status', + id: 'status' + }, { + xtype: 'hidden', + name: 'orgUnitCoding', + id: 'orgUnitCoding', + value: orgUnitCoding + }, { + xtype: 'hidden', + name: 'applyDate', + id: 'applyDateHidden', + value: selectedApplyDate + }, { + xtype: 'hidden', + name: 'tousseType', + id: 'tousseTypeHidden', + value: selectedTousseType + }, { + xtype: 'hidden', + name: 'appFormType', + id: 'appFormTypeHidden', + value: selectedAppFormType + }, { + xtype: 'hidden', + name: 'invoicePlanId', + id: 'invoicePlanIdHidden', + value: selectedInvoicePlanId + }, { + xtype: 'hidden', + name: 'personInChargeCode', + id: 'personInChargeCode' + }, { + xtype: 'hidden', + name: 'sourceWarehouseId', + id: 'sourceWarehouseId' + }, { + xtype: 'hidden', + name: 'sourceWarehouseName', + id: 'sourceWarehouseName' + }, { + xtype: 'hidden', + name: 'warehouseID', + id: 'warehouseID' + }, { + xtype: 'hidden', + name: 'warehouseName', + id: 'warehouseName' + }, { + xtype: 'hidden', + name: 'tousseGroupIds', + id: 'tousseGroupIds' + }, { + layout: 'form', + labelWidth: 120, + columnWidth: .33, + items: [{ + xtype: 'textfield', + fieldLabel: '申请科室', + maxLength: '100', + id: 'depart2', + name: 'depart', + value: depart, + readOnly: true, + anchor: '99%', + cls: 'fieldReadOnlyNoRemove' }] - },{ - layout : 'form', - labelWidth :120, - columnWidth :.33, - items : [{ - xtype : 'textfield', - fieldLabel : '发货员条码', - maxLength : '16', - id : 'senderBarcode', - name : 'senderBarcode', - anchor : '99%', - listeners : { - render : function(p) { - p.getEl().on('keypress',function(e) { + }, { + layout: 'form', + labelWidth: 120, + columnWidth: .33, + items: [{ + xtype: 'textfield', + fieldLabel: '发货员条码', + maxLength: '16', + id: 'senderBarcode', + name: 'senderBarcode', + anchor: '99%', + listeners: { + render: function (p) { + p.getEl().on('keypress', function (e) { if (e.getKey() == 13) {//回车键 - InvoiceTableManager.getUserNameOfCurrentLoginUserOrgsByBarcode( - top.Ext.getCmp('senderBarcode').getValue(),function(userName) { + InvoiceTableManager.getUserNameOfCurrentLoginUserOrgsByBarcode( + top.Ext.getCmp('senderBarcode').getValue(), function (userName) { if (userName != null) { var resultArray = userName.split(":"); - if(resultArray[0] == "success"){ + if (resultArray[0] == "success") { top.Ext.getCmp('sender').setValue(resultArray[1]); - Ext.state.Manager.getProvider().set('cookieSender',resultArray[1]); - }else{ - showResult(resultArray[1] , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + Ext.state.Manager.getProvider().set('cookieSender', resultArray[1]); + } else { + showResult(resultArray[1], null, sstsConfig.messagePauseTimeOnInvoiceplanPage); top.Ext.getCmp('sender').setValue(""); } } top.Ext.getCmp('senderBarcode').setValue(""); - if(getSystemSetConfig('showInvoiceAssistantSender',true)){ + if (getSystemSetConfig('showInvoiceAssistantSender', true)) { top.Ext.getCmp('assistantSenderBarcode').focus(); - }else if(getSystemSetConfig('showInvoicePersonInCharge',true)){ + } else if (getSystemSetConfig('showInvoicePersonInCharge', true)) { top.Ext.getCmp('personInChargeBarcode').focus(); - }else{ + } else { top.Ext.getCmp('scanText').focus(); } }); @@ -2256,55 +2276,55 @@ } } }] - },{ - layout : 'form', - labelWidth :120, - columnWidth :.33, - items : [{ - xtype : 'textfield', - fieldLabel : '发货员', - maxLength : '41', - id : 'sender', - name : 'sender', - readOnly:true, - allowBlank : false, - anchor : '99%', - height:28, - value: getSystemSetConfig('invoiceSenderUseLoginUser',true)?$Id('userName').value:'', - cls:'fieldReadOnlyNoRemove' + }, { + layout: 'form', + labelWidth: 120, + columnWidth: .33, + items: [{ + xtype: 'textfield', + fieldLabel: '发货员', + maxLength: '41', + id: 'sender', + name: 'sender', + readOnly: true, + allowBlank: false, + anchor: '99%', + height: 28, + value: getSystemSetConfig('invoiceSenderUseLoginUser', true) ? $Id('userName').value : '', + cls: 'fieldReadOnlyNoRemove' }] - },{ - layout : 'form', - labelWidth :120, - columnWidth :.33, - hidden: !getSystemSetConfig('showInvoiceAssistantSender',true), - items : [{ - xtype : 'textfield', - fieldLabel : '核对员条码', - maxLength : '16', - id : 'assistantSenderBarcode', - name : 'assistantSenderBarcode', - anchor : '99%', - listeners : { - render : function(p) { - p.getEl().on('keypress',function(e) { + }, { + layout: 'form', + labelWidth: 120, + columnWidth: .33, + hidden: !getSystemSetConfig('showInvoiceAssistantSender', true), + items: [{ + xtype: 'textfield', + fieldLabel: '核对员条码', + maxLength: '16', + id: 'assistantSenderBarcode', + name: 'assistantSenderBarcode', + anchor: '99%', + listeners: { + render: function (p) { + p.getEl().on('keypress', function (e) { if (e.getKey() == 13) {//回车键 - InvoiceTableManager.getUserNameOfCurrentLoginUserOrgsByBarcode( - top.Ext.getCmp('assistantSenderBarcode').getValue(),function(userName) { + InvoiceTableManager.getUserNameOfCurrentLoginUserOrgsByBarcode( + top.Ext.getCmp('assistantSenderBarcode').getValue(), function (userName) { if (userName != null) { var resultArray = userName.split(":"); - if(resultArray[0] == "success"){ + if (resultArray[0] == "success") { top.Ext.getCmp('assistantSender').setValue(resultArray[1]); - Ext.state.Manager.getProvider().set('cookieAssistantSender',resultArray[1]); - }else{ - showResult(resultArray[1] , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + Ext.state.Manager.getProvider().set('cookieAssistantSender', resultArray[1]); + } else { + showResult(resultArray[1], null, sstsConfig.messagePauseTimeOnInvoiceplanPage); top.Ext.getCmp('assistantSender').setValue(""); } } top.Ext.getCmp('assistantSenderBarcode').setValue(""); - if(getSystemSetConfig('showInvoicePersonInCharge',true)){ + if (getSystemSetConfig('showInvoicePersonInCharge', true)) { top.Ext.getCmp('personInChargeBarcode').focus(); - }else{ + } else { top.Ext.getCmp('scanText').focus(); } }); @@ -2313,1107 +2333,1107 @@ } } }] - },{ - layout : 'form', - labelWidth :120, - columnWidth :.33, - hidden: !getSystemSetConfig('showInvoiceAssistantSender',true), - items : [{ - xtype : 'textfield', - fieldLabel : '核对员', - maxLength : '41', - id : 'assistantSender', - name : 'assistantSender', - readOnly:true, - allowBlank : !getSystemSetConfig('showInvoiceAssistantSender',true) || !getSystemSetConfig('invoiceAssistantSenderRequired',true), - anchor : '99%', - cls:'x-item-disabled' + }, { + layout: 'form', + labelWidth: 120, + columnWidth: .33, + hidden: !getSystemSetConfig('showInvoiceAssistantSender', true), + items: [{ + xtype: 'textfield', + fieldLabel: '核对员', + maxLength: '41', + id: 'assistantSender', + name: 'assistantSender', + readOnly: true, + allowBlank: !getSystemSetConfig('showInvoiceAssistantSender', true) || !getSystemSetConfig('invoiceAssistantSenderRequired', true), + anchor: '99%', + cls: 'x-item-disabled' }] - },{ - layout : 'form', - labelWidth :120, - columnWidth :.33, - hidden: !getSystemSetConfig('showInvoicePersonInCharge',true), - items : [{ - xtype : 'textfield', - fieldLabel : '下送责任人条码', - maxLength : '16', - id : 'personInChargeBarcode', - name : 'personInChargeBarcode', - anchor : '99%', - listeners : { - render : function(p) { - p.getEl().on('keypress',function(e) { + }, { + layout: 'form', + labelWidth: 120, + columnWidth: .33, + hidden: !getSystemSetConfig('showInvoicePersonInCharge', true), + items: [{ + xtype: 'textfield', + fieldLabel: '下送责任人条码', + maxLength: '16', + id: 'personInChargeBarcode', + name: 'personInChargeBarcode', + anchor: '99%', + listeners: { + render: function (p) { + p.getEl().on('keypress', function (e) { if (e.getKey() == 13) {//回车键 var barcode = top.Ext.getCmp('personInChargeBarcode').getValue(); top.Ext.getCmp('personInChargeBarcode').setValue(""); - UserTableManager.getUserByBarcode(barcode,function(responseText){ - if(!isUndefinedOrNullOrEmpty(responseText)){ - var result = top.Ext.decode(responseText); - if(!result.success){ - result.isNotSameOrgUnit?showResult("不允许登记非本科室人员,请扫描本科室人员条码" , null , sstsConfig.messagePauseTimeOnInvoiceplanPage):showResult("输入的条码有误!" , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); - return; - } - Ext.state.Manager.getProvider().set('cookiePersonInCharge',result.fullName); - Ext.state.Manager.getProvider().set('cookiePersonInChargeCode',result.name); - top.Ext.getCmp('personInCharge').setValue(result.fullName); - top.Ext.getCmp('personInChargeCode').setValue(result.name); - top.Ext.getCmp('scanText').focus(); - }else{ - showResult('找不到该条码所对应的人员信息' , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); - } - }); + UserTableManager.getUserByBarcode(barcode, function (responseText) { + if (!isUndefinedOrNullOrEmpty(responseText)) { + var result = top.Ext.decode(responseText); + if (!result.success) { + result.isNotSameOrgUnit ? showResult("不允许登记非本科室人员,请扫描本科室人员条码", null, sstsConfig.messagePauseTimeOnInvoiceplanPage) : showResult("输入的条码有误!", null, sstsConfig.messagePauseTimeOnInvoiceplanPage); + return; + } + Ext.state.Manager.getProvider().set('cookiePersonInCharge', result.fullName); + Ext.state.Manager.getProvider().set('cookiePersonInChargeCode', result.name); + top.Ext.getCmp('personInCharge').setValue(result.fullName); + top.Ext.getCmp('personInChargeCode').setValue(result.name); + top.Ext.getCmp('scanText').focus(); + } else { + showResult('找不到该条码所对应的人员信息', null, sstsConfig.messagePauseTimeOnInvoiceplanPage); + } + }); } }); } } }] - },{ - layout : 'form', - labelWidth :120, - columnWidth :.33, - hidden: !getSystemSetConfig('showInvoicePersonInCharge',true), - items : [{ - xtype : 'textfield', - fieldLabel : '下送责任人', - maxLength : '41', - id : 'personInCharge', - name : 'personInCharge', - readOnly:true, - allowBlank : !getSystemSetConfig('showInvoicePersonInCharge',true) || !getSystemSetConfig('invoicePersonInChargeRequired',false), - anchor : '99%', - cls:'x-item-disabled' + }, { + layout: 'form', + labelWidth: 120, + columnWidth: .33, + hidden: !getSystemSetConfig('showInvoicePersonInCharge', true), + items: [{ + xtype: 'textfield', + fieldLabel: '下送责任人', + maxLength: '41', + id: 'personInCharge', + name: 'personInCharge', + readOnly: true, + allowBlank: !getSystemSetConfig('showInvoicePersonInCharge', true) || !getSystemSetConfig('invoicePersonInChargeRequired', false), + anchor: '99%', + cls: 'x-item-disabled' }] - },{ - layout : 'form', - labelWidth :120, - columnWidth :.33, - items : [{ - xtype : 'datefieldWithMin', - fieldLabel : '发货时间', - id : 'sendTime', - name : 'sendTime', - allowBlank : false, - 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', - format:'Y-m-d H:i', -// value:new Date(), - anchor : '99%', - listeners : { - render : function() { + }, { + layout: 'form', + labelWidth: 120, + columnWidth: .33, + items: [{ + xtype: 'datefieldWithMin', + fieldLabel: '发货时间', + id: 'sendTime', + name: 'sendTime', + allowBlank: false, + 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', + format: 'Y-m-d H:i', + // value:new Date(), + anchor: '99%', + listeners: { + render: function () { setStartDate(top.Ext, 'yyyy/MM/dd HH:mm', 'sendTime'); //(设置发货时间,取服务器时间 cjr) } } - + }] - },{ - columnWidth : .5, - layout : 'form', - labelWidth :120, - columnWidth :.33, - items:[{ - xtype : 'combo', - fieldLabel : '仓库', - id : 'warehouse', - name : 'warehouse', - minChars : 0, - valueField : 'id', - displayField : 'name', - store : wareHouseStore, - forceSelection : true, - lazyInit : false, - triggerAction : 'all', - hideTrigger : true, - typeAhead : false, - allowBlank : false, - anchor : '99%', - listeners : { - select : function(combo, record, index) { + }, { + columnWidth: .5, + layout: 'form', + labelWidth: 120, + columnWidth: .33, + items: [{ + xtype: 'combo', + fieldLabel: '仓库', + id: 'warehouse', + name: 'warehouse', + minChars: 0, + valueField: 'id', + displayField: 'name', + store: wareHouseStore, + forceSelection: true, + lazyInit: false, + triggerAction: 'all', + hideTrigger: true, + typeAhead: false, + allowBlank: false, + anchor: '99%', + listeners: { + select: function (combo, record, index) { top.Ext.getCmp('warehouse').setValue(record.data.name); top.Ext.getCmp('sourceWarehouseId').setValue(record.data.id); top.Ext.getCmp('sourceWarehouseName').setValue(record.data.name); // 刷新库存数据 refreshStorage(record.data.id); -// top.Ext.getCmp('remark2').focus(); + // top.Ext.getCmp('remark2').focus(); }, - specialkey : function(field, ee) { + specialkey: function (field, ee) { if (ee.getKey() == Ext.EventObject.ENTER) { -// top.Ext.getCmp('remark2').focus(); + // top.Ext.getCmp('remark2').focus(); } } } - }] - },{ - layout : 'form', - columnWidth : 1, - labelWidth :120, - items : [{ - xtype : 'textarea', - fieldLabel : '备注', - id : 'remark2', - name : 'remark', - anchor : '98.5%', - height : 40, - cls:'x-item-disabled', - readOnly:true }] - },{ - layout : 'form', - columnWidth : 1, - labelWidth :120, - items : [{ - xtype : 'textarea', - fieldLabel : '发货备注', - id : 'invoiceRemark', - name : 'invoiceRemark', - anchor : '98.5%', - height : 40 + }, { + layout: 'form', + columnWidth: 1, + labelWidth: 120, + items: [{ + xtype: 'textarea', + fieldLabel: '备注', + id: 'remark2', + name: 'remark', + anchor: '98.5%', + height: 40, + cls: 'x-item-disabled', + readOnly: true }] + }, { + layout: 'form', + columnWidth: 1, + labelWidth: 120, + items: [{ + xtype: 'textarea', + fieldLabel: '发货备注', + id: 'invoiceRemark', + name: 'invoiceRemark', + anchor: '98.5%', + height: 40 + }] }] }] - },{ - layout:'column', - items:[{ - layout : 'form', - columnWidth : windowW < 1280 ? 0.57 : 0.55, - items:[ + }, { + layout: 'column', + items: [{ + layout: 'form', + columnWidth: windowW < 1280 ? 0.57 : 0.55, + items: [ new top.Ext.grid.EditorGridPanel({ - id : 'sendOutGoods', - store : sendOutGoodsStore1, - columnWidth : 0.5, - cm : sendOutGoodsColumnModel, - width : sendOutGoodsWidth, - height : sendOutGoodsHeight, - autoExpandColumn : 'deleteItem', - enableHdMenu : false, - frame : false, - bodyStyle : 'border:1px solid #afd7af', + id: 'sendOutGoods', + store: sendOutGoodsStore1, + columnWidth: 0.5, + cm: sendOutGoodsColumnModel, + width: sendOutGoodsWidth, + height: sendOutGoodsHeight, + autoExpandColumn: 'deleteItem', + enableHdMenu: false, + frame: false, + bodyStyle: 'border:1px solid #afd7af', viewConfig: { - autoFit:true + autoFit: true }, - clicksToEdit : 1,// 设置点击几次才可编辑 - selModel : new top.Ext.grid.RowSelectionModel({ - singleSelect : false + clicksToEdit: 1,// 设置点击几次才可编辑 + selModel: new top.Ext.grid.RowSelectionModel({ + singleSelect: false }), - tbar : [{ - text : '扫描模式:', - hidden : hiddenEndBarcode - },{ - xtype:'combo', - id : 'scanMode', - name : 'scanMode', - hidden : hiddenEndBarcode, - fieldLabel : '扫描模式', - valueField : 'scanModeCode', - displayField : 'scanModeName', - triggerAction : 'all', - width : 80, - allowBlank : true, - editable : false, - value:currentScanMode, - store : new Ext.data.SimpleStore({ - fields : ['scanModeCode', 'scanModeName' ], - data : [['single','单个条码'],['area','首尾条码']] + tbar: [{ + text: '扫描模式:', + hidden: hiddenEndBarcode + }, { + xtype: 'combo', + id: 'scanMode', + name: 'scanMode', + hidden: hiddenEndBarcode, + fieldLabel: '扫描模式', + valueField: 'scanModeCode', + displayField: 'scanModeName', + triggerAction: 'all', + width: 80, + allowBlank: true, + editable: false, + value: currentScanMode, + store: new Ext.data.SimpleStore({ + fields: ['scanModeCode', 'scanModeName'], + data: [['single', '单个条码'], ['area', '首尾条码']] }), - mode:'local', - forceSelection : true, - triggerAction : 'all', - listeners : { - select : function(combo, record, index){ + mode: 'local', + forceSelection: true, + triggerAction: 'all', + listeners: { + select: function (combo, record, index) { currentScanMode = record.get("scanModeCode"); //首尾条码全部清空,且让首条码得到焦点 top.Ext.getCmp('scanText').setValue(""); top.Ext.getCmp('scanTextEnd').setValue(""); top.Ext.getCmp('scanText').focus(); } }, - anchor : '100%' - },{ - text : beginBarcodeLabel - },{ - xtype : 'textfield', - id : 'scanText', - name : 'scanText', - width : 90, - enableKeyEvents : true, - listeners : { - render : function(c) { + anchor: '100%' + }, { + text: beginBarcodeLabel + }, { + xtype: 'textfield', + id: 'scanText', + name: 'scanText', + width: 90, + enableKeyEvents: true, + listeners: { + render: function (c) { allBarcodeArr = []; - c.getEl().on('keypress',function(e) { - + c.getEl().on('keypress', function (e) { + //扫码按下回车键 if (e.getKey() == 13) {// 输入;号键,grid重新加载 - if(top.Ext.getCmp("scanText").getValue() != ''){ - if(!barcodeBtn.processBarcode(top.Ext.getCmp("scanText").getValue())){ + if (top.Ext.getCmp("scanText").getValue() != '') { + if (!barcodeBtn.processBarcode(top.Ext.getCmp("scanText").getValue())) { loadGoodsByBarcode(orgUnitCoding); } - }else{ - showResult("请扫描输入器械包/篮筐(首)条码!" , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + } else { + showResult("请扫描输入器械包/篮筐(首)条码!", null, sstsConfig.messagePauseTimeOnInvoiceplanPage); } } }); - c.getEl().on('focus',function(e) { + c.getEl().on('focus', function (e) { top.Ext.getCmp('scanText').setValue(''); }); } } - },{ - text : '条码/篮筐(尾):', - hidden : hiddenEndBarcode - },{ - xtype : 'textfield', - id : 'scanTextEnd', - name : 'scanTextEnd', - hidden : hiddenEndBarcode, - width : 90, - enableKeyEvents : true, - listeners : { - render : function(c) { - c.getEl().on('keypress',function(e) { + }, { + text: '条码/篮筐(尾):', + hidden: hiddenEndBarcode + }, { + xtype: 'textfield', + id: 'scanTextEnd', + name: 'scanTextEnd', + hidden: hiddenEndBarcode, + width: 90, + enableKeyEvents: true, + listeners: { + render: function (c) { + c.getEl().on('keypress', function (e) { if (e.getKey() == 13) {// 输入;号键,grid重新加载 - if(top.Ext.getCmp("scanTextEnd").getValue() != ''){ - - if(!barcodeBtn.processBarcode(top.Ext.getCmp("scanTextEnd").getValue())){ + if (top.Ext.getCmp("scanTextEnd").getValue() != '') { + + if (!barcodeBtn.processBarcode(top.Ext.getCmp("scanTextEnd").getValue())) { loadGoodsByBarcode(orgUnitCoding); } - }else{ - showResult("请扫描输入器械包/篮筐(尾)条码!" , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + } else { + showResult("请扫描输入器械包/篮筐(尾)条码!", null, sstsConfig.messagePauseTimeOnInvoiceplanPage); } } }); - c.getEl().on('focus',function(e) { + c.getEl().on('focus', function (e) { top.Ext.getCmp('scanTextEnd').setValue(''); }); } } - },{ - id:'btnBatchScanDisposableGoods', - xtype:'button', - text:'一键扫描一次性物品', - iconCls : 'btn_ext_one_key_scan', + }, { + id: 'btnBatchScanDisposableGoods', + xtype: 'button', + text: '一键扫描一次性物品', + iconCls: 'btn_ext_one_key_scan', //hidden:!(sstsConfig.oneKeyScanDisposableGoodsForPC && sstsConfig.isInitiateDisposableGoodsFixedBarcode && existsDisposableGoodsWaitDelivery),//显示此按钮的3个条件:PC端是否开启一键扫描一次性物品功能、开启固定条码功能、待发货的物品中有一次性物品 - hidden:true, - handler:function(){ + hidden: true, + handler: function () { this.disable(); var sourceWarehouseId = top.Ext.getCmp("sourceWarehouseId").getValue(); - if(isUndefinedOrNullOrEmpty(sourceWarehouseId)){ - showResult('请先选择仓库!' , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + if (isUndefinedOrNullOrEmpty(sourceWarehouseId)) { + showResult('请先选择仓库!', null, sstsConfig.messagePauseTimeOnInvoiceplanPage); return false; } var amountAndIdArray = []; var dataLength = recyclingapplicationStore1.getCount(); - if(dataLength > 0){ - for(var i = 0;i < dataLength;i++){ + if (dataLength > 0) { + for (var i = 0; i < dataLength; i++) { var dataRecord = recyclingapplicationStore1.getAt(i); var disposableGoodsId = dataRecord.data.disposableGoodsId; var errorAmount = dataRecord.data.errorAmount; - if(disposableGoodsId && errorAmount > 0){ - var amountAndIdObject = {disposableGoodsId:disposableGoodsId,amount:errorAmount}; + if (disposableGoodsId && errorAmount > 0) { + var amountAndIdObject = { disposableGoodsId: disposableGoodsId, amount: errorAmount }; amountAndIdArray.push(amountAndIdObject); } } } - if(amountAndIdArray.length > 0){ + if (amountAndIdArray.length > 0) { Ext.Ajax.request({ - url : WWWROOT + '/disinfectSystem/invoiceAction!getDisposableGoodInfoByMapAndWareHouseId.do', - params : {amountAndIdArray : JSON.stringify(amountAndIdArray),wareHouseId : sourceWarehouseId}, - success : function(response, options) { + url: WWWROOT + '/disinfectSystem/invoiceAction!getDisposableGoodInfoByMapAndWareHouseId.do', + params: { amountAndIdArray: JSON.stringify(amountAndIdArray), wareHouseId: sourceWarehouseId }, + success: function (response, options) { var responseResultJson = top.Ext.decode(response.responseText); - if(responseResultJson.data && responseResultJson.data.length > 0){ - for(var index = 0;index < responseResultJson.data.length;index++){ + if (responseResultJson.data && responseResultJson.data.length > 0) { + for (var index = 0; index < responseResultJson.data.length; index++) { var goods = responseResultJson.data[index]; //如果左边已扫描窗口中没有此条码时,添加至左边页面. var storeCount = sendOutGoodsStore1.getCount(); - if(storeCount == 0){ + if (storeCount == 0) { var newRecord = new addGridItem({ - id:0, - barcode : goods.barcode, - name : goods.name, - ttsName : goods.ttsName, - showTousseName : goods.name, - count : goods.amount, - storage : goods.stockAmount, - diposable : '是', - price : goods.referencePrice, - fluctuationPrice : goods.referencePrice, - tousseType : '一次性物品', - typeInfoOnScanned : goods.typeInfoOnScanned + id: 0, + barcode: goods.barcode, + name: goods.name, + ttsName: goods.ttsName, + showTousseName: goods.name, + count: goods.amount, + storage: goods.stockAmount, + diposable: '是', + price: goods.referencePrice, + fluctuationPrice: goods.referencePrice, + tousseType: '一次性物品', + typeInfoOnScanned: goods.typeInfoOnScanned }); - sendOutGoodsStore1.insert(0,newRecord); - updateAmount2(goods.name,goods.amount); - }else{ + sendOutGoodsStore1.insert(0, newRecord); + updateAmount2(goods.name, goods.amount); + } else { var foundBarcode = false; var goodsBarcode = goods.barcode; - for ( var i = 0; i < storeCount; i++) { + for (var i = 0; i < storeCount; i++) { var record = sendOutGoodsStore1.getAt(i); var existsGoods = record.data; - if(goodsBarcode == existsGoods.barcode){ + if (goodsBarcode == existsGoods.barcode) { foundBarcode = true; break; } } - if(!foundBarcode){ + if (!foundBarcode) { var newRecord = new addGridItem({ - id:0, - barcode : goods.barcode, - name : goods.name, - ttsName : goods.ttsName, - showTousseName : goods.name, - count : goods.amount, - storage : goods.stockAmount, - diposable : '是', - price : goods.referencePrice, - fluctuationPrice : goods.referencePrice, - tousseType : '一次性物品', - typeInfoOnScanned : goods.typeInfoOnScanned + id: 0, + barcode: goods.barcode, + name: goods.name, + ttsName: goods.ttsName, + showTousseName: goods.name, + count: goods.amount, + storage: goods.stockAmount, + diposable: '是', + price: goods.referencePrice, + fluctuationPrice: goods.referencePrice, + tousseType: '一次性物品', + typeInfoOnScanned: goods.typeInfoOnScanned }); - sendOutGoodsStore1.insert(0,newRecord); + sendOutGoodsStore1.insert(0, newRecord); //updateAmount2(goods.name,goods.amount); recalcDisposableGoodsAmount(goods.name); } } } } }, - failure : function(form, action) { - + failure: function (form, action) { + } }); } } }], - listeners : { - beforeedit : function(grid){// 只有一次性物品和固定条码才能编辑数量 + listeners: { + beforeedit: function (grid) {// 只有一次性物品和固定条码才能编辑数量 var record = grid.record; var goods = record.data; - if(record.data.diposable == '是') { + if (record.data.diposable == '是') { return true; } //不追溯的包改为都可以修改发货数量(之前不追溯的包只有器械包和敷料包才可以改数量) - if(/*(goods.tousseType == '器械包' || goods.tousseType == '敷料包') && */goods.tousseFixedBarcode){ + if (/*(goods.tousseType == '器械包' || goods.tousseType == '敷料包') && */goods.tousseFixedBarcode) { return true; } return false; }, - afteredit :function(grid){ + afteredit: function (grid) { var id = grid.record.data['id']; var name = grid.record.data['name']; var barcode = grid.record.data['barcode']; var tousseType = grid.record.data['tousseType']; //数量列 var count = grid.record.data['count']; var countInt = parseInt(count); - var storage = grid.record.data['storage']; + var storage = grid.record.data['storage']; var storageInt = parseInt(storage); //待发货数量改为从右边待发货物品明细中取.从已扫条码明细中从取不合理 //var waitDeliveryCount = grid.record.data['waitDeliveryCount']; var waitDeliveryCount; - for(var i = 0;i < recyclingapplicationStore1.getCount();i++){ + for (var i = 0; i < recyclingapplicationStore1.getCount(); i++) { var record = recyclingapplicationStore1.getAt(i); - if(name == record.data.name){ + if (name == record.data.name) { waitDeliveryCount = record.data.count; break; } } var waitDeliveryCountInt = parseInt(waitDeliveryCount); //id=0表示为一次性物品? - if(id==0){ + if (id == 0) { //查出该物品的其它条码的已扫数量 var otherBarcodeSummaryAmountOfCurrentDisposableGoods = 0; var storeCount1 = sendOutGoodsStore1.getCount(); - for(var i = 0;i < storeCount1;i++){ + for (var i = 0; i < storeCount1; i++) { var recData = sendOutGoodsStore1.getAt(i).data; - if(recData.name == name && recData.barcode != barcode){ + if (recData.name == name && recData.barcode != barcode) { otherBarcodeSummaryAmountOfCurrentDisposableGoods += recData.count; } } //针对一次性物品,沿用之前的逻辑,即比较的库存数量为打开科室的发货页面时所加载出来的库存数量 - if(record.data.diposable == '是') { - var maxAmountCanSend = Math.min(storageInt,waitDeliveryCountInt) - otherBarcodeSummaryAmountOfCurrentDisposableGoods; - if(countInt > storageInt){ - showResult('库存量为:' + storage + ',已超过库存量!' , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + if (record.data.diposable == '是') { + var maxAmountCanSend = Math.min(storageInt, waitDeliveryCountInt) - otherBarcodeSummaryAmountOfCurrentDisposableGoods; + if (countInt > storageInt) { + showResult('库存量为:' + storage + ',已超过库存量!', null, sstsConfig.messagePauseTimeOnInvoiceplanPage); } - if((countInt + otherBarcodeSummaryAmountOfCurrentDisposableGoods) > waitDeliveryCountInt){ - showResult('申请数量为:' + waitDeliveryCountInt + ',已超过申请数量!' , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + if ((countInt + otherBarcodeSummaryAmountOfCurrentDisposableGoods) > waitDeliveryCountInt) { + showResult('申请数量为:' + waitDeliveryCountInt + ',已超过申请数量!', null, sstsConfig.messagePauseTimeOnInvoiceplanPage); } - - if(countInt <= maxAmountCanSend){ - updateAmount2(name,countInt); + + if (countInt <= maxAmountCanSend) { + updateAmount2(name, countInt); } else { - updateAmount2(name,maxAmountCanSend); -// showResult('库存量为:' + storage + ',已超过库存量!'); -// var index = recyclingapplicationStore1.find("name",name); -// var tempAmount = recyclingapplicationStore1.getAt(index).data['tempAmount']; - grid.record.set('count',maxAmountCanSend); + updateAmount2(name, maxAmountCanSend); + // showResult('库存量为:' + storage + ',已超过库存量!'); + // var index = recyclingapplicationStore1.find("name",name); + // var tempAmount = recyclingapplicationStore1.getAt(index).data['tempAmount']; + grid.record.set('count', maxAmountCanSend); } - }else{ - if((countInt) > waitDeliveryCountInt){ - showResult('申请数量为:' + waitDeliveryCountInt + ',已超过申请数量!' , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); - grid.record.set('count',waitDeliveryCountInt); + } else { + if ((countInt) > waitDeliveryCountInt) { + showResult('申请数量为:' + waitDeliveryCountInt + ',已超过申请数量!', null, sstsConfig.messagePauseTimeOnInvoiceplanPage); + grid.record.set('count', waitDeliveryCountInt); } //如果不是一次性物品,即不追溯的各种类型的器械包时,要请求后台与系统实时库存数量进行对比 Ext.Ajax.request({ - url : WWWROOT + '/disinfectSystem/invoiceAction!getUnTraceTousseStockByDepartCodingOrInvoicePlanId.do', - params : {invoicePlanId : selectedInvoicePlanId,departCoding : orgUnitCoding,tousseFixBarcode : barcode}, - success : function(response, options) { + url: WWWROOT + '/disinfectSystem/invoiceAction!getUnTraceTousseStockByDepartCodingOrInvoicePlanId.do', + params: { invoicePlanId: selectedInvoicePlanId, departCoding: orgUnitCoding, tousseFixBarcode: barcode }, + success: function (response, options) { var obj = JSON.parse(response.responseText); - if(obj.data && obj.data.stockAmount){ + if (obj.data && obj.data.stockAmount) { storageInt = obj.data.stockAmount; - if(isNaN(storageInt)){ - showResult('物品【'+ name +'】库存不足' , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + if (isNaN(storageInt)) { + showResult('物品【' + name + '】库存不足', null, sstsConfig.messagePauseTimeOnInvoiceplanPage); } - var maxAmountCanSend = Math.min(storageInt,waitDeliveryCountInt); - if(countInt > storageInt){ - showResult('库存量为:' + storageInt + ',已超过库存量!' , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + var maxAmountCanSend = Math.min(storageInt, waitDeliveryCountInt); + if (countInt > storageInt) { + showResult('库存量为:' + storageInt + ',已超过库存量!', null, sstsConfig.messagePauseTimeOnInvoiceplanPage); } - if(countInt <= maxAmountCanSend){ - updateAmount2(name,countInt); + if (countInt <= maxAmountCanSend) { + updateAmount2(name, countInt); } else { - updateAmount2(name,maxAmountCanSend); -// showResult('库存量为:' + storage + ',已超过库存量!'); -// var index = recyclingapplicationStore1.find("name",name); -// var tempAmount = recyclingapplicationStore1.getAt(index).data['tempAmount']; - grid.record.set('count',maxAmountCanSend); + updateAmount2(name, maxAmountCanSend); + // showResult('库存量为:' + storage + ',已超过库存量!'); + // var index = recyclingapplicationStore1.find("name",name); + // var tempAmount = recyclingapplicationStore1.getAt(index).data['tempAmount']; + grid.record.set('count', maxAmountCanSend); } - }else{ - showResult('物品【'+ name +'】库存不足' , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + } else { + showResult('物品【' + name + '】库存不足', null, sstsConfig.messagePauseTimeOnInvoiceplanPage); } }, - failure : function(form, action) { - showResult('物品【'+ name +'】库存不足' , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + failure: function (form, action) { + showResult('物品【' + name + '】库存不足', null, sstsConfig.messagePauseTimeOnInvoiceplanPage); } }); } } else { var record = getRecord(recyclingapplicationStore1, "name", name, 0); - if(record != null) { + if (record != null) { var tempAmount = record.data['tempAmount']; - if(parseInt(count) <= (storageInt + parseInt(tempAmount))){ - updateAmount2(name,count); + if (parseInt(count) <= (storageInt + parseInt(tempAmount))) { + updateAmount2(name, count); } else { - showResult('库存量为:' + storage + ',已超过库存量!' , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); - grid.record.set('count',tempAmount); + showResult('库存量为:' + storage + ',已超过库存量!', null, sstsConfig.messagePauseTimeOnInvoiceplanPage); + grid.record.set('count', tempAmount); } } } - - if(tousseType == '一次性物品'){ + + if (tousseType == '一次性物品') { recalcDisposableGoodsAmount(name); } } } } - )] - - },{ - layout : 'form', - columnWidth : windowW < 1280 ? 0.43 : 0.45, - items:[new top.Ext.grid.EditorGridPanel({ - id : 'sendOutGoodsDetail', - title : '待发货物品明细', - store : recyclingapplicationStore1, - cm : recyclingapplicationCm, - enableHdMenu : false, - width : sendOutGoodsDetailWidth, - height : sendOutGoodsDetailHeight, - loadMask : true, - tbar:[{ - text:'申请单:', - handler : function(){ - if(isUndefinedOrNullOrEmpty(selectedInvoicePlanId)){ - showResult('请先选择申请单!' , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); - return; - } - var w = top.Ext.getCmp('invoicePlan_recyclingApplicationForm'); - w.expand(); - } - },{ - xtype:'combo', - id : 'invoicePlanId', - name : 'invoicePlanId', - valueField : 'id', - width: 150, - listWidth : 180, - displayField : 'typeAndserialNumber', - allowBlank : true, - editable : false, - store : departApplicationStore, - forceSelection : true, - triggerAction : 'all', - listeners : { - select : function(combo, record, index){ - //1.根据申请单号的条件重新加载发货单明细 - var id = record.get('id'); - selectedInvoicePlanId = id; - recyclingapplicationStore1.baseParams['invoicePlanId'] = id; - recyclingapplicationStore1.load(); - //2.清除已扫描的记录 - sendOutGoodsStore1.removeAll(); - top.Ext.getCmp('sendOutGoodsStoreData').setValue(''); - //3.hidden赋值 - top.Ext.getCmp('invoicePlanIdHidden').setValue(id); - //4.已扫描的首尾器械包或篮筐条码清空 - top.Ext.getCmp('scanText').setValue(''); - top.Ext.getCmp('scanTextEnd').setValue(''); - // 清空申请单信息 - top.Ext.getCmp('invoicePlan_applicant').setValue(''); - top.Ext.getCmp('invoicePlan_applicationTime').setValue(''); - top.Ext.getCmp('invoicePlan_recyclingStatus').setValue(''); - top.Ext.getCmp('invoicePlan_recyclingTime').setValue(''); - invoicePlan_recyclingapplicationStore1.removeAll(); - // 加载申请单信息 - if(isUndefinedOrNullOrEmpty(selectedInvoicePlanId)){ - // showResult('请先选择申请单!' , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + )] + + }, { + layout: 'form', + columnWidth: windowW < 1280 ? 0.43 : 0.45, + items: [new top.Ext.grid.EditorGridPanel({ + id: 'sendOutGoodsDetail', + title: '待发货物品明细', + store: recyclingapplicationStore1, + cm: recyclingapplicationCm, + enableHdMenu: false, + width: sendOutGoodsDetailWidth, + height: sendOutGoodsDetailHeight, + loadMask: true, + tbar: [{ + text: '申请单:', + handler: function () { + if (isUndefinedOrNullOrEmpty(selectedInvoicePlanId)) { + showResult('请先选择申请单!', null, sstsConfig.messagePauseTimeOnInvoiceplanPage); return; } - Ext.Ajax.request({ - url : WWWROOT + '/disinfectSystem/invoicePlanAction!getInvoicePlanInfoForInvoice.do', - params : {id : selectedInvoicePlanId}, - success : function(response, options) { - var obj = JSON.parse(response.responseText); - // openInvoicePlanWindow(obj); - // top.Ext.getCmp('invoicePlan_recyclingApplicationForm').show(); - - top.Ext.getCmp('invoicePlan_applicant').setValue(obj.applicant); - top.Ext.getCmp('invoicePlan_applicationTime').setValue(obj.applicationTime); - top.Ext.getCmp('invoicePlan_recyclingStatus').setValue(obj.recyclingStatus); - top.Ext.getCmp('invoicePlan_recyclingTime').setValue(obj.recyclingTime); - - invoicePlan_recyclingapplicationStore1.removeAll(); - var items = obj.applicationItems; - var rs = []; - for(var i=0;i