diff --git a/src/api/request2.js b/src/api/request2.js index 2f8668c8..184b1780 100644 --- a/src/api/request2.js +++ b/src/api/request2.js @@ -421,7 +421,7 @@ export function getPackageByNumber(number) { * @param {*} * */ -export function getPackageListByNumber(number) { +export async function getPackageListByNumber(number) { var params = { number: number, pageNo: 1, @@ -4301,7 +4301,7 @@ export function overPackageRecordSubmit(params) { * @param {*} * */ -export function getManagementPrecision(params) { +export async function getManagementPrecision(params) { return request({ url: baseApi + "/wms/rule/getPrecisionStrategyByItemCodes", method: "post", diff --git a/src/common/balance.js b/src/common/balance.js index 75e207e5..8fa38a44 100644 --- a/src/common/balance.js +++ b/src/common/balance.js @@ -105,7 +105,7 @@ export function getPrecisionStrategyList(itemList, callback) { * @param {*} * */ -export function getManagementPrecisions(itemCodes, locationCode, callback) { +export async function getManagementPrecisions(itemCodes, locationCode, callback) { // let jsonParem = JSON.stringify(param) let result = { list: [], @@ -117,7 +117,7 @@ export function getManagementPrecisions(itemCodes, locationCode, callback) { itemCodes: itemCodes, locationCode: locationCode } - getManagementPrecision(params).then(res => { + await getManagementPrecision(params).then(res => { if (res.data == null) { result.success = false result.message = '未查询到管理精度信息' diff --git a/src/common/label.js b/src/common/label.js index 355b68c6..f17c0113 100644 --- a/src/common/label.js +++ b/src/common/label.js @@ -10,10 +10,11 @@ import { getDirectoryItemArray } from '../common/directory.js'; + import { + getManagementPrecisions + } from '@/common/balance.js'; - -export function getLabelInfo(scanMsg, headerType, callBack) { - console.log('扫描信息:', scanMsg); +export function getLabelInfo(scanMsg, headerType, callBack,locationCode) { if (scanMsg.length == 0) { return null } @@ -41,17 +42,17 @@ export function getLabelInfo(scanMsg, headerType, callBack) { let type = header.substring(header.length - 1, header.length); if (type == 'Q') //qrcode { - getQRCodeInfo(header, version, scanMsg, callBack); + getQRCodeInfo(header, version, scanMsg, callBack,locationCode); } // else if (type == 'B') //barcode // { // getBarCodeInfo(header, version, items[2], callBack); // } else { //直接输入文本 - getBarCodeInfo('text', 'V1.0', scanMsg, callBack); + getBarCodeInfo('text', 'V1.0', scanMsg, callBack,locationCode); } } else { - getBarCodeInfo('text', 'V1.0', scanMsg, callBack); + getBarCodeInfo('text', 'V1.0', scanMsg, callBack,locationCode); // let labelResult = { // label: { // labelType: "", @@ -66,7 +67,7 @@ export function getLabelInfo(scanMsg, headerType, callBack) { } } -export function getQRCodeInfo(header, version, scanMsg, callBack) { +export function getQRCodeInfo(header, version, scanMsg, callBack,locationCode) { //获取包装信息 let labelItem = labelDic.find(r => r.header == header && r.version == version); if (labelItem == undefined) { @@ -91,7 +92,7 @@ export function getQRCodeInfo(header, version, scanMsg, callBack) { }; labelDic.push(newItem); - getLabelItems(newItem, scanMsg, callBack); + getLabelItems(newItem, scanMsg, callBack,locationCode); } }).catch(err => { labelResult.success = false; @@ -99,22 +100,32 @@ export function getQRCodeInfo(header, version, scanMsg, callBack) { callBack(err); }) } else { - getLabelItems(labelItem, scanMsg, callBack); + getLabelItems(labelItem, scanMsg, callBack,locationCode); } } -export function getLabelItems(labelItem, scanMsg, callBack) { +export async function getLabelItems(labelItem, scanMsg, callBack,locationCode) { let labelResult = analysisQRCodeLabel(labelItem, scanMsg); if (labelResult.label.labelType == 'PurchaseLabel' || labelResult.label.labelType == 'MakeLabel') { //查询包装信息 let packingNumber = labelResult.label.packingNumber + let packingNumber1 = labelResult.label.packingNumber//记录单号 + if(locationCode){ + await getManagementPrecisions([labelResult.label.itemCode], locationCode, res => { + if (res.success) { + const managementList = res.list; + const managementType = managementList&&managementList[0]&&managementList[0].ManagementPrecision ? managementList[0].ManagementPrecision :'BY_PACKAGING' + if(managementType == 'BY_BATCH' || managementType == 'BY_QUANTITY'){ + packingNumber = '' + } + } + }) + } if (packingNumber != undefined && packingNumber != '') { - getPackageListByNumber(packingNumber).then(pack => { + await getPackageListByNumber(packingNumber).then(pack => { if (pack.data.reqPackage) { labelResult.package = pack.data.reqPackage; labelResult.package.subList = pack.data.subList; - console.log('包装信息', JSON.stringify(labelResult.package)) - } else { labelResult.success = false; labelResult.message = '包装号[' + packingNumber + ']没有包装信息'; @@ -128,6 +139,7 @@ export function getLabelItems(labelItem, scanMsg, callBack) { } else { //线边的物料可能没有箱码 labelResult.package = labelResult.label; + labelResult.package.number = packingNumber1 ? packingNumber1 : '' callBack(labelResult); // labelResult.success = false; // labelResult.message = '在条码中未解析到箱码'; diff --git a/src/mycomponents/item/itemCompareQty.vue b/src/mycomponents/item/itemCompareQty.vue index ed37206c..7c97325f 100644 --- a/src/mycomponents/item/itemCompareQty.vue +++ b/src/mycomponents/item/itemCompareQty.vue @@ -20,7 +20,7 @@ + + \ No newline at end of file diff --git a/src/mycomponents/scan/winComScan.vue b/src/mycomponents/scan/winComScan.vue index 0a55bf5f..979ae50c 100644 --- a/src/mycomponents/scan/winComScan.vue +++ b/src/mycomponents/scan/winComScan.vue @@ -58,6 +58,11 @@ import { getLabelInfo } from '../../common/label.js'; + + import { + getManagementPrecisions + } from '@/common/balance.js'; + export default { name: "winComScan", @@ -83,6 +88,10 @@ headerType: { type: String, default: 'HPQ' //HLB HMQ HCQ HPQ + }, + locationCode:{ + type: String, + default: '' } }, data() { @@ -99,7 +108,6 @@ } }, mounted() { - }, watch: { placeholder() { @@ -170,6 +178,7 @@ if (that.isShowHistory) { that.scanList.unshift(content); } + getLabelInfo(content, this.headerType, callback => { // uni.hideLoading(); let scanResult = callback; @@ -187,7 +196,7 @@ } }) } - }); + },this.locationCode); }, 200); } }, diff --git a/src/mycomponents/scan/winScanPack.vue b/src/mycomponents/scan/winScanPack.vue index 7da05b49..2da925c1 100644 --- a/src/mycomponents/scan/winScanPack.vue +++ b/src/mycomponents/scan/winScanPack.vue @@ -15,7 +15,7 @@ + :isShowHistory="isShowHistory" :clearResult="true" :locationCode='locationCode'> @@ -48,11 +48,13 @@ headerType:{ type: String, default: 'HPQ' - } + }, + }, data() { return { show: false, + locationCode:'' } }, created() { @@ -69,8 +71,9 @@ }) }, - openScanPopup() { + openScanPopup(locationCode1) { this.$refs.popup.open('bottom') + this.locationCode = locationCode1 setTimeout(res => { this.getfocus() }, 500) diff --git a/src/pages/inventoryMove/record/okToHoldRecord.vue b/src/pages/inventoryMove/record/okToHoldRecord.vue index e025da9a..bac77279 100644 --- a/src/pages/inventoryMove/record/okToHoldRecord.vue +++ b/src/pages/inventoryMove/record/okToHoldRecord.vue @@ -1,11 +1,11 @@ + \ No newline at end of file diff --git a/src/pages/purchaseReceipt/job/receiptDetail.vue b/src/pages/purchaseReceipt/job/receiptDetail.vue index 2aa4839d..d0474dc2 100644 --- a/src/pages/purchaseReceipt/job/receiptDetail.vue +++ b/src/pages/purchaseReceipt/job/receiptDetail.vue @@ -76,7 +76,7 @@ - + @@ -117,7 +117,14 @@ calcTreeHandleQty } from '@/common/detail.js'; - + import { + Decimal + } from 'decimal.js'; //引入 + + import { + calc + } from '@/common/calc' + import winScanButton from '@/mycomponents/scan/winScanButton.vue' import winScanPackAndCont from '@/mycomponents/scan/winScanPackAndCont.vue' import winScanPack from '@/mycomponents/scan/winScanPack.vue' @@ -169,8 +176,7 @@ switchCode1: "", isCheckLocation: 'purchaseReceiptLocationCodeValidate', //校验收货库位 reasonText: "", - - + packingNumberList:[], // printDeafult: {}, //默认打印机 // templateDeafult: {} //默认的模板 }; @@ -275,18 +281,18 @@ } that.isAllReceived = false; - //获取管理模式,封装参数 - var itemCodes = [] - this.detailSource.forEach(item => { - itemCodes.push(item.itemCode) - }) - getManagementPrecisions(itemCodes, that.jobToLocationCode, res => { - if (res.success) { - this.managementList = res.list; - this.managementType = this.managementList.some(item => item.ManagementPrecision == - 'BY_BATCH') ? 'BY_BATCH' : '' - } - }) + //获取管理模式,封装参数 + var itemCodes = [] + this.detailSource.forEach(item => { + itemCodes.push(item.itemCode) + }) + getManagementPrecisions(itemCodes, that.jobToLocationCode, res => { + if (res.success) { + this.managementList = res.list; + this.managementType = this.managementList.some(item => item.ManagementPrecision == + 'BY_BATCH') ? 'BY_BATCH' : '' + } + }) // if (uni.getStorageSync('purchaseReceiptDetailPointParams')) { // const purchaseReceiptDetailPointParams = uni.getStorageSync( // 'purchaseReceiptDetailPointParams') @@ -450,10 +456,10 @@ itemDetail.forEach(item => { item.scaned = true; itemDetail.scanDate = new Date(); - item.handleQty = item.qty; + item.handleQty = calc.add(item.handleQty,result.label.qty) item.toLocationCode = this.toLocationCode; }) - calcHandleQty(this.detailSource); + // calcHandleQty(this.detailSource); this.detailSource[0].subList.sort(compareDesc('scanDate')); //按扫描信息排序 this.continueScan() this.$forceUpdate() @@ -483,10 +489,17 @@ if (pack == undefined) { this.showMessage("批次【" + batch + "】不在列表中") } else { - if (pack.scaned) { + let isScan = false + if(packingNumber){ + isScan = this.packingNumberList.some(item=>item == packingNumber) + }else{ + isScan = false + } + if (isScan) { pack.scanDate = new Date(); - this.showMessage("批次【" + batch + "】已经扫描"); + this.showMessage("箱码【" + packingNumber + "】已经扫描"); } else { + this.packingNumberList.push(packingNumber) pack.scaned = true pack.scanDate = new Date(); pack.handleQty = Number(result.label.qty); @@ -507,24 +520,31 @@ scanedLength++; } }) - if (itemDetail.scaned && scanedLength == itemDetail - .packList.length) { + let isScan = false + if(packingNumber){ + isScan = this.packingNumberList.some(item=>item == packingNumber) + }else{ + isScan = false + } + if (isScan) { itemDetail.scanDate = new Date(); - this.showMessage("批次【" + batch + "】已经扫描") + this.showMessage("箱码【" + packingNumber + "】已经扫描") } else { + this.packingNumberList.push(packingNumber) itemDetail.scaned = true; itemDetail.scanDate = new Date(); - itemDetail.handleQty = Number(result.label.qty); + itemDetail.handleQty =itemDetail.handleQty ?itemDetail.handleQty:0 + itemDetail.handleQty = calc.add(itemDetail.handleQty,result.label.qty) + console.log(itemDetail.handleQty) itemDetail.toLocationCode = this.toLocationCode; itemDetail.labelQty = Number(result.label.qty); itemDetail.packList.forEach(pac => { pac.scaned = true pac.scanDate = new Date(); - pac.handleQty = Number(pac.qty); + pac.handleQty = calc.add(pac.handleQty,result.label.qty); pac.toLocationCode = this.toLocationCode; }) - - calcTreeHandleQty(this.detailSource); + detail.handleQty = itemDetail.handleQty this.detailSource[0].subList.sort(compareDesc('scanDate')); //按扫描信息排序 this.continueScan() this.$forceUpdate() @@ -598,7 +618,7 @@ //不允许部分提交,提示 this.$refs.comMessage.showErrorMessage("任务明细未全部完成,不允许部分提交!", res => { if (res) { - this.openScanPopup(); + this.openScanPopup(this.jobToLocationCode); } }); } @@ -634,7 +654,6 @@ } }) }, - submitJob() { uni.showLoading({ title: "提交中....", @@ -644,8 +663,6 @@ this.detailSource.forEach(item => { itemCodes.push(item.itemCode) }) - - //获取管理模式,封装参数 getManagementPrecisions(itemCodes, this.toLocationCode, res => { if (res.success) { @@ -888,7 +905,7 @@ }, openScanPopup() { - this.$refs.scanPopup.openScanPopup(); + this.$refs.scanPopup.openScanPopup(this.jobToLocationCode); }, closeScanPopup() {