diff --git a/api/request2.js b/api/request2.js index 04a61954..40a8fa64 100644 --- a/api/request2.js +++ b/api/request2.js @@ -1056,8 +1056,8 @@ export function productionReceiptJobSubmit(params) { */ export function productionReceiptRecordSubmit(params) { return request({ - url: baseApi + "/magic-api/pda/job/putaway/jobSubmit", - method: "put", + url: baseApi + "/wms/productreceipt-record-main/create", + method: "post", data: params, }); } @@ -1349,7 +1349,7 @@ export function unPlannedReceiptRequestHandle(id) { */ export function unPlannedReceiptRecordbSubmit(id, params) { return request({ - url: baseApi + "/magic-api/pda/job/purchasereturn/jobSubmit?id=" + id, + url: baseApi + "/wms/unplannedreceipt-record-main/create", method: "post", data: params, }); @@ -2081,8 +2081,8 @@ export function transferReceiptJobSubmit(params) { */ export function transferReceiptRecordSubmit(params) { return request({ - url: baseApi + "/magic-api/pda/job/purchasereceipt/jobSubmit", - method: "put", + url: baseApi + "/wms/transferreceipt-record-main/create", + method: "post", data: params, }); } @@ -2162,8 +2162,8 @@ export function transferIssueJobSubmit(params) { */ export function transferIssueRecordSubmit(params) { return request({ - url: baseApi + "/magic-api/pda/job/purchasereceipt/jobSubmit", - method: "put", + url: baseApi + "/wms/transferissue-record-main/create", + method: "post", data: params, }); } @@ -2819,8 +2819,8 @@ export function scrapRequestHandle(id) { */ export function scrapRecordSubmit(params) { return request({ - url: baseApi + "/wms/purchasereturn-request-main/submit", - method: "put", + url: baseApi + "/wms/scrap-record-main/create", + method: "post", data: params, }); } @@ -3012,6 +3012,21 @@ export function getBalanceByFilter(param) { }); } +/** + * 查询管理精度,多个零件,多个库位 + * @param {*} + * + */ +export function getPrecisionStrategy(param) { + return request({ + url: baseApi + "/wms/rule/getPrecisionStrategy", + method: "post", + data: param, + }); +} + + + /** * 删除文件 diff --git a/common/balance.js b/common/balance.js index 8733e89a..77dcd174 100644 --- a/common/balance.js +++ b/common/balance.js @@ -1,8 +1,40 @@ import { getManagementPrecision, + getPrecisionStrategy, getBalanceByFilter } from '@/api/request2.js'; + +/** + * "itemCode": [], + "locationCode":"INSPECT" + 管理精度策略 + * @param {*} + * + */ +export function getPrecisionStrategyList(itemList, callback) { + // let jsonParem = JSON.stringify(param) + let result = { + list: [], + success: true, + message: '' + }; + + getPrecisionStrategy(itemList).then(res => { + if (res.data == null) { + result.success = false + result.message = '未查询到管理精度信息' + } else { + result.list = res.data; + } + callback(result); + }).catch(error => { + result.success = false; + result.message = error; + callback(result); + }) +} + /** * "itemCode": [], "locationCode":"INSPECT" diff --git a/common/basic.js b/common/basic.js index f3507b2a..84ab342c 100644 --- a/common/basic.js +++ b/common/basic.js @@ -320,17 +320,6 @@ export function getUnPlannedIssuseReasonList(value) { return unplannedIissueReason } -//获取报废出库原因 -export function getScarpReasonList(value) { - if (scrapReasonList.length == 0) { - scrapReasonList = getDirectoryInfo("scrap_reason") - } - scrapReasonList.forEach(res => { - res.text = res.label; - res.value = res.code - }) - return scrapReasonList -} //获取检验不合格原因 export function getInspectReasonList(value) { @@ -606,6 +595,43 @@ export function getInspectReasonList(value) { // else return 'Other' // } +export function getPackingNumberAndBatchByList(managementList, itemCode, packingNumber,locationCode, batch) { + var itemInfo = { + packingNumber: "", + batch: "" + } + + var manageType = queryManageModelByList(managementList, itemCode,locationCode) + if (manageType == "BY_QUANTITY") { + itemInfo.packingNumber = "" + itemInfo.batch = "" + } else if (manageType == "BY_BATCH") { + itemInfo.packingNumber = "" + itemInfo.batch = batch + } else if (manageType == "BY_PACKAGING") { + itemInfo.packingNumber = packingNumber + itemInfo.batch = batch + } else if (manageType == "BY_UNIQUE_ID") { + itemInfo.packingNumber = packingNumber + itemInfo.batch = batch + } + return itemInfo; +} + +export function queryManageModelByList(managementList, itemCode,locationCode) { + var result = managementList.filter(res => { + if (res.itemCode == itemCode&&res.locationCode==locationCode) { + return res.ManagementPrecision + } + }) + + if (result != undefined) { + return result[0].ManagementPrecision + } else { + return "" + } +} + // 获取业务类型字典项 export function getBusinessTypeDesc(type) { diff --git a/common/label.js b/common/label.js index b720c6a6..34e763c6 100644 --- a/common/label.js +++ b/common/label.js @@ -6,7 +6,7 @@ import { } from '@/api/request2.js'; -export function getLabelInfo(scanMsg, callBack) { +export function getLabelInfo(scanMsg,headerType, callBack) { console.log('扫描信息:', scanMsg); if (scanMsg.length == 0) { return null @@ -15,6 +15,21 @@ export function getLabelInfo(scanMsg, callBack) { let header = items[0]; let version = items[1]; if ((header != undefined) && (version!=undefined)) { + if(header!=headerType){ + let labelResult = { + label: { + labelType: "", + barType: '', + code:"" + }, + package: null, + success: false, + message: '请输入'+headerType+"开始的标签", + } + callBack(labelResult); + return; + } + //解析扫描的是一维码还是二维码 let type = header.substring(header.length - 1, header.length); if (type == 'Q') //qrcode diff --git a/common/record.js b/common/record.js index 353842eb..ff25f732 100644 --- a/common/record.js +++ b/common/record.js @@ -26,8 +26,9 @@ export function createDetailInfo(data, pack) { Object.assign(detail, data) detail.balanceQty = Number(detail.qty) detail.stdPackQty = Number(pack.stdPackQty) - detail.stdPackUnit =pack.stdPackUnit + detail.stdPackUnit = pack.stdPackUnit detail.package = pack; + return detail; } diff --git a/mycomponents/balance/purchaseLabel.vue b/mycomponents/balance/purchaseLabel.vue index c4b25002..18a48b91 100644 --- a/mycomponents/balance/purchaseLabel.vue +++ b/mycomponents/balance/purchaseLabel.vue @@ -2,7 +2,7 @@ - + diff --git a/mycomponents/package/packageTarget.vue b/mycomponents/package/packageTarget.vue index 51dc3176..a8c8a7c8 100644 --- a/mycomponents/package/packageTarget.vue +++ b/mycomponents/package/packageTarget.vue @@ -11,7 +11,7 @@ - + diff --git a/mycomponents/production/productionInfo.vue b/mycomponents/production/productionInfo.vue index 6ced48a6..e54bbaa6 100644 --- a/mycomponents/production/productionInfo.vue +++ b/mycomponents/production/productionInfo.vue @@ -1,11 +1,11 @@ diff --git a/mycomponents/scan/winComScan.vue b/mycomponents/scan/winComScan.vue index 7c0efff3..21191a55 100644 --- a/mycomponents/scan/winComScan.vue +++ b/mycomponents/scan/winComScan.vue @@ -84,9 +84,9 @@ type: Boolean, default: true }, - labelType:{ + headerType:{ type: String, - default: 'PurchaseLabel' //PurchaseLabel LocationLabel MakeLabel ContainerLabel + default: 'HPQ' //HLB HMQ HCQ HPQ } }, data() { @@ -154,7 +154,7 @@ if (that.isShowHistory) { that.scanList.unshift(content); } - getLabelInfo(content, callback => { + getLabelInfo(content,this.headerType, callback => { let scanResult = callback; if (scanResult.success) { that.clear(); diff --git a/mycomponents/scan/winScanLocation.vue b/mycomponents/scan/winScanLocation.vue index d08952fd..e36ea506 100644 --- a/mycomponents/scan/winScanLocation.vue +++ b/mycomponents/scan/winScanLocation.vue @@ -13,7 +13,7 @@ + :boxFocus="true" :isShowHistory="isShowHistory" headerType="HLB"> diff --git a/mycomponents/scan/winScanPack.vue b/mycomponents/scan/winScanPack.vue index 7b8c9daf..1d1d09fc 100644 --- a/mycomponents/scan/winScanPack.vue +++ b/mycomponents/scan/winScanPack.vue @@ -14,7 +14,7 @@ - @@ -45,6 +45,10 @@ isShowHistory: { type: Boolean, default: true + }, + headerType:{ + type: String, + default: 'HPQ' } }, data() { diff --git a/pages/inventoryMove/job/inventoryMoveDetail.vue b/pages/inventoryMove/job/inventoryMoveDetail.vue index d181cc1b..e425e564 100644 --- a/pages/inventoryMove/job/inventoryMoveDetail.vue +++ b/pages/inventoryMove/job/inventoryMoveDetail.vue @@ -48,7 +48,8 @@ inventoryMoveSubmit } from '@/api/request2.js'; import { - getManagementPrecisions + getManagementPrecisions, + getPrecisionStrategyList } from '@/common/balance.js'; import { @@ -61,7 +62,7 @@ updateTitle, navigateBack, getCurrDateTime, - getPackingNumberAndBatch, + getPackingNumberAndBatchByList, getInventoryStatusName } from '@/common/basic.js'; @@ -203,7 +204,7 @@ this.scanPopupGetFocus(); } }, - + openDetail(item) { this.$refs.jobDetailPopup.openPopup(item) }, @@ -264,16 +265,17 @@ } else { let balanceStatus = getInventoryStatusName(result.balance.inventoryStatus); let itemStatus = getInventoryStatusName(itemDetail.inventoryStatus); - if (itemDetail.inventoryStatus != result.balance.inventoryStatus){ - if(this.jobContent.allowModifyInventoryStatus=="TRUE"){ - this.showQuestionMessage('任务中允许修改库存状态,实际库存状态[' + balanceStatus + ']与推荐库存状态[' + itemStatus + + if (itemDetail.inventoryStatus != result.balance.inventoryStatus) { + if (this.jobContent.allowModifyInventoryStatus == "TRUE") { + this.showQuestionMessage('任务中允许修改库存状态,实际库存状态[' + balanceStatus + ']与推荐库存状态[' + + itemStatus + ']不一致,是否继续转移?', res => { if (res) { itemDetail.scaned = true; - itemDetail.handleQty = Number(result.balance.qty) ; + itemDetail.handleQty = Number(result.balance.qty); itemDetail.toInventoryStatus = result.balance.inventoryStatus; itemDetail.balance = result.balance; - itemDetail.balance.balanceQty =Number(result.balance.qty) ; + itemDetail.balance.balanceQty = Number(result.balance.qty); itemDetail.balance.stdPackQty = Number(result.package.stdPackQty) itemDetail.balance.stdPackUnit = result.package.stdPackUnit this.calcHandleQty(); @@ -281,15 +283,16 @@ this.scanPopupGetFocus(); } }); - }else { - this.showQuestionMessage('任务中不允许修改库存状态,实际库存状态[' + balanceStatus + ']与推荐库存状态[' + itemStatus + + } else { + this.showQuestionMessage('任务中不允许修改库存状态,实际库存状态[' + balanceStatus + ']与推荐库存状态[' + + itemStatus + ']不一致,不允许转移!', res => { this.scanPopupGetFocus(); }); } - }else { + } else { itemDetail.scaned = true; - itemDetail.handleQty = Number(result.balance.qty) ; + itemDetail.handleQty = Number(result.balance.qty); itemDetail.toInventoryStatus = result.balance.inventoryStatus; itemDetail.balance = result.balance; itemDetail.balance.balanceQty = Number(result.balance.qty); @@ -297,27 +300,6 @@ itemDetail.balance.stdPackUnit = result.package.stdPackUnit this.calcHandleQty(); } - - - // if (itemDetail.inventoryStatus != result.balance.inventoryStatus) { - // this.showQuestionMessage('实际库存状态[' + balanceStatus + ']与推荐库存状态[' + itemStatus + - // ']不一致,是否继续转移?', res => { - // if (res) { - // itemDetail.scaned = true; - // itemDetail.handleQty = Number(result.balance.qty) ; - // itemDetail.toInventoryStatus = result.balance.inventoryStatus; - // itemDetail.balance = result.balance; - // itemDetail.balance.balanceQty = result.balance.qty; - // itemDetail.balance.stdPackQty = result.package.stdPackQty - // itemDetail.balance.stdPackUnit = result.package.stdPackUnit - // this.calcHandleQty(); - // } else { - // this.scanPopupGetFocus(); - // } - // }); - // } else { - - // } } } } @@ -362,35 +344,60 @@ title: "提交中....", mask: true }); - this.managementList = []; - //查询管理模式 - // this.detailSource.forEach(item => { - // item.subList.forEach(detail => { - // if (detail.scaned) { - // getManagementPrecisions(item.itemCode,detail.toLocationCode,res=>{ - // if (res.success) { - // this.managementList = this.managementList.concat(res.list) - - // } - // }) - // } - // }) - // }) - var params = this.setParams(); - console.log("提交" + JSON.stringify(params)) - - inventoryMoveSubmit(params).then(res => { - uni.hideLoading() - if (res.data) { - this.showCommitSuccessMessage("提交成功
生成库存转移记录
" + res.data) + //查询管理模式 + this.managementList = []; + var precisionStrategParams = this.setPrecisionStrategParams() + getPrecisionStrategyList(precisionStrategParams, res => { + if (res.success) { + this.managementList = res.list; + + var params = this.setParams() + console.log("提交" + JSON.stringify(params)) + inventoryMoveSubmit(params).then(res => { + uni.hideLoading() + if (res.data) { + this.showCommitSuccessMessage("提交成功
生成库存转移记录
" + res.data) + } else { + this.showErrorMessage("提交失败[" + res.msg + "]") + } + }).catch(error => { + uni.hideLoading() + this.showErrorMessage(error) + }) } else { - this.showErrorMessage("提交失败[" + res.msg + "]") + uni.hideLoading(); + this.showErrorMessage(res.message); } - }).catch(error => { - uni.hideLoading() - this.showErrorMessage(error) + }) + + }, + + setPrecisionStrategParams(){ + var itemList = [] + this.detailSource.forEach(item => { + item.subList.forEach(detail => { + if (detail.scaned) { + var filterResult = itemList.filter(res => { + if (res.itemCode == item.itemCode + &&res.locationCode == detail.toLocationCode) { + return res + } + }) + //去掉重复元素 + if(filterResult.length==0){ + var result = { + itemCode: item.itemCode, + locationCode: detail.toLocationCode + } + itemList.push(result) + } + + } + }) + }) + return itemList; }, setParams() { @@ -400,12 +407,12 @@ this.detailSource.forEach(item => { item.subList.forEach(detail => { if (detail.scaned) { - // var info = getPackingNumberAndBatch(this.managementList, detail.itemCode, - // detail.packingNumber, detail.batch); - detail.toPackingNumber = detail.packingNumber; - detail.toBatch = detail.batch; + var info = getPackingNumberAndBatchByList(this.managementList, detail.itemCode, + detail.packingNumber, detail.toLocationCode, detail.batch); + detail.toPackingNumber = info.packingNumber; + detail.toBatch = info.batch; detail.toContainerNumber = ''; - + detail.toLocationCode = detail.toLocationCode; subList.push(detail) } @@ -478,7 +485,7 @@ navigateBack(1) }) }, - + } } diff --git a/pages/productPutaway/record/productPutawayRecord.vue b/pages/productPutaway/record/productPutawayRecord.vue index d26fbd19..f1dbbdca 100644 --- a/pages/productPutaway/record/productPutawayRecord.vue +++ b/pages/productPutaway/record/productPutawayRecord.vue @@ -18,13 +18,14 @@ - + + @@ -44,15 +45,14 @@ diff --git a/pages/scrap/record/scrapRecord.vue b/pages/scrap/record/scrapRecord.vue index f2f27e65..6b54bdbd 100644 --- a/pages/scrap/record/scrapRecord.vue +++ b/pages/scrap/record/scrapRecord.vue @@ -10,7 +10,7 @@ + @change="reasonChange"> @@ -56,12 +56,12 @@ import { goHome, updateTitle, - getScarpReasonList } from '@/common/basic.js'; import { getInventoryStatusDesc, getDirectoryItemArray, + getScarpReasonList } from '@/common/directory.js'; import { @@ -94,27 +94,19 @@ data() { return { id: '', - receiptJob: {}, - received: false, - isShowPackingCode: true, - scanCount: 0, dataContent: {}, //任务内容 subList: [], //接口返回的任务subList detailSource: [], //绑定在页面上的数据源 locationTypeList: [], - toLocationInfo: {}, - businessTypeInfo: {}, - fromLocationInfo: {}, fromLocationCode: "", - isShowLocation: false, fromlocationTypeList: [], tolocationTypeList: [], - allowModifyLocation: false, inInventoryStatus: "", //目标入库库存状态 outInventoryStatus: "", //来源出库库存状态 businessType: {}, reasonList: [], - reason: "", + reasonText: "", + reasonCode:"", }; }, onLoad(option) { @@ -249,7 +241,7 @@ commit() { - if(this.reason==""){ + if(this.reasonText==""){ this.showMessage("请先选择报废原因") return; } @@ -258,19 +250,18 @@ title: "提交中....", mask: true }); - - // scrapRecordSubmit(params).then(res => { - // uni.hideLoading() - // if (res.data) { - // this.showCommitSuccessMessage("提交成功
生成采购收货记录" + res.data, ) - // } else { - // this.showErrorMessage("提交失败[" + res.msg + "]") - // } - // }).catch(error => { - // uni.hideLoading() - // this.showErrorMessage(error) - // }) + scrapRecordSubmit(params).then(res => { + uni.hideLoading() + if (res.data) { + this.showCommitSuccessMessage("提交成功
生成报废出库记录" + res.data) + } else { + this.showErrorMessage("提交失败[" + res.msg + "]") + } + }).catch(error => { + uni.hideLoading() + this.showErrorMessage(error) + }) }, @@ -279,10 +270,26 @@ this.detailSource.forEach(item => { item.subList.forEach(detail => { if (detail.scaned) { - // var info = getPackingNumberAndBatch(this.managementList, detail.itemCode, - // detail.packingNumber, detail.batch); - // detail.toPackingNumber =info.packingNumber; - // detail.toBatch =info.batch; + detail.itemCode = detail.itemCode; + detail.itemName = detail.package.itemName; + detail.itemDesc1 = detail.package.itemDesc1; + detail.itemDesc2 = detail.package.itemDesc2; + + detail.inventoryStatus = detail.inventoryStatus; + + detail.fromPackingNumber = detail.packingNumber; + detail.toPackingNumber = detail.packingNumber; + + detail.fromContainerNumber = detail.containerNumber; + detail.toContainerNumber = detail.containerNumber + + detail.fromBatch = detail.batch; + detail.toBatch = detail.batch; + + detail.fromLocationCode = detail.locationCode; + detail.toLocationCode = ""; + + detail.reason = this.reasonCode; subList.push(detail) } }) @@ -290,31 +297,7 @@ return subList; }, - setRequestParams(){ - var subList = [] - var supplierCode="" - this.detailSource.forEach(item => { - item.subList.forEach(detail => { - if (detail.scaned) { - if(supplierCode==""){ - supplierCode = detail.package.supplierCode - } - subList.push(detail) - } - }) - }) - - this.dataContent.subList = subList - this.dataContent.supplierCode = supplierCode - this.dataContent.businessType = "PurchasePutaway" - this.dataContent.departmentCode= "研发部门"; - this.dataContent.status= 1 ; - this.dataContent.autoCommit = "FALSE"; - this.dataContent.autoAgree = "FALSE"; - this.dataContent.autoExecute = "FALSE"; - this.dataContent.directCreateRecord = "FALSE"; - return this.dataContent; - }, + showMessage(message) { @@ -345,14 +328,18 @@ this.getFromLocationCode(location, code) }, getFromLocationCode(location, code) { - this.fromLocationInfo = location; this.fromLocationCode = code; this.openScanPopup(); }, showCommitSuccessMessage(hint) { this.$refs.comMessage.showSuccessMessage(hint, res => { - this.fromLocationCode = ''; + this.reasonCode = "" + this.reasonText = ""; + this.detailSource = []; + this.subList =[]; + this.managementList =[]; + this.dataContent ={} }) }, @@ -365,6 +352,15 @@ this.detailSource.splice(i, 1) } } + }, + reasonChange(e) { + if (e.detail.value.length == 0) { + this.reasonCode = "" + this.reasonText = "" + } else { + this.reasonCode = e.detail.value[0].value + this.reasonText = e.detail.value[0].text + } } } } diff --git a/pages/transfer/coms/comTransferRecord.vue b/pages/transfer/coms/comTransferRecord.vue index 9aeea896..b4179202 100644 --- a/pages/transfer/coms/comTransferRecord.vue +++ b/pages/transfer/coms/comTransferRecord.vue @@ -1,16 +1,15 @@ diff --git a/pages/unPlanned/record/receiptRecord.vue b/pages/unPlanned/record/receiptRecord.vue index a05e811f..f56bf620 100644 --- a/pages/unPlanned/record/receiptRecord.vue +++ b/pages/unPlanned/record/receiptRecord.vue @@ -8,7 +8,7 @@ + @change="reasonChange"> @@ -22,12 +22,13 @@
- + + @@ -66,11 +67,11 @@ import { goHome, updateTitle, - getPackingNumberAndBatch + getPackingNumberAndBatchByList } from '@/common/basic.js'; import { - getManagementPrecisions + getPrecisionStrategyList } from '@/common/balance.js'; @@ -91,15 +92,15 @@ data() { return { toLocationCode: "", - toLocationInfo: {}, toInventoryStatus: [], businessType: {}, //业务类型 detailSource: [], //绑定在页面上的数据源 businessTypeCode: "UnplannedReceipt", - reason: "", + reasonText: "", + reasonCode:"", reasonList: [], - showToLoaction:true, - dataContent:{} + dataContent:{}, + managementList:[] } }, @@ -112,7 +113,7 @@ this.tolocationTypeList = res.tolocationTypeList; this.openScanPopup(); } else { - this.$refs.comMessage.showBreakMessage(res.message); + this.showErrorMessage(res.message) } }); }, @@ -125,7 +126,6 @@ this.$refs.scanPopup.openScanPopup(); }, getToLocationCode(location, code) { - this.toLocationCodeInfo = location; this.toLocationCode = code; }, getScanResult(result) { @@ -188,6 +188,7 @@ label.inventoryStatus = "OK"; detail.package = pack; detail.label = label; + detail.label.scaned = true return detail; }, @@ -227,77 +228,138 @@ this.detailSource.splice(index, 1) }, commit() { - if (this.showToLoaction &&this.toLocationCode == "") { + if (this.toLocationCode == "") { this.showErrorMessage("请先选择目标库位") return; } - if (this.reason == '') { + if (this.reasonText == '') { this.showErrorMessage("请选择入库原因") return; } - //记录有目标库位,需要查询管理模式 - var itemCodes = [] - this.detailSource.forEach(item => { - itemCodes.push(item.itemCode) - }) - //获取管理模式,封装参数 - getManagementPrecisions(itemCodes, this.toLocationCode, res => { - if (res.success) { - this.managementList = res.list; - var params = this.setParams(true) - console.log("提交参数", JSON.stringify(params)); - - // unPlannedReceiptRecordbSubmit(params).then(res => { - // uni.hideLoading() - // if (res.data) { - // this.showCommitSuccessMessage("提交成功
生成计划外入库记录" + res.data, ) - // } else { - // this.showErrorMessage("提交失败"+res.msg) - // } - // }).catch(error => { - // uni.hideLoading() - // this.showErrorMessage(error) - // }) - } else { - uni.hideLoading(); - this.showErrorMessage(res.message); - } - }); + if (this.detailSource.length > 0 && this.detailSource[0].subList.length > 0) { + //查询管理模式 + uni.showLoading({ + title: "提交中....", + mask: true + }); + this.managementList = []; + var precisionStrategParams = this.setPrecisionStrategParams() + getPrecisionStrategyList(precisionStrategParams, res => { + if (res.success) { + this.managementList = res.list; + var params = this.setParams() + console.log("提交" + JSON.stringify(params)) + unPlannedReceiptRecordbSubmit(params).then(res => { + uni.hideLoading() + if (res.data) { + this.showCommitSuccessMessage("提交成功
生成计划外入库记录
" + res.data) + } else { + this.showErrorMessage("提交失败[" + res.msg + "]") + } + }).catch(error => { + uni.hideLoading() + this.showErrorMessage(error) + }) + + } else { + uni.hideLoading(); + this.showErrorMessage(res.message); + } + + }) + }else { + this.showErrorMessage("没有要提交的数据,请先扫描") + } + + + }, + setPrecisionStrategParams() { + var itemList = [] + this.detailSource.forEach(item => { + item.subList.forEach(detail => { + if (detail.scaned) { + detail.toLocationCode = this.toLocationCode; + var filterResult = itemList.filter(res => { + if (res.itemCode == item.itemCode && + detail.toLocationCode == res.locationCode) { + return res + } + }) + //去掉重复元素 + if (filterResult.length == 0) { + var result = { + itemCode: item.itemCode, + locationCode: detail.toLocationCode + } + itemList.push(result) + } + + } + }) + }) + return itemList; }, - setParams(queryModel) { + setParams() { + var subList = [] var creator = this.$store.state.user.id this.detailSource.forEach(item => { item.subList.forEach(detail => { if (detail.scaned) { - // var subItem = {}; - // Object.assign(subItem, detail) - if (queryModel) { - var info = getPackingNumberAndBatch(this.managementList, detail.itemCode, - detail.packingNumber, detail.batch); - detail.toPackingNumber = info.packingNumber;; - detail.toContainerNumber = detail.containerNumber - detail.toBatch = info.batch; - detail.toInventoryStatus = detail.inventoryStatus - detail.toLocationCode = this.toLocationCode - } else { - detail.toPackingNumber = detail.packingNumber; - detail.toContainerNumber = detail.containerNumber - detail.toBatch = detail.toBatch; - detail.toInventoryStatus = detail.inventoryStatus - detail.toLocationCode = "" - } + var info = getPackingNumberAndBatchByList(this.managementList, detail.label.itemCode, + detail.label.packingNumber, detail.toLocationCode, detail.label.batch); + + detail.itemCode = detail.package.itemCode; + detail.itemName = detail.package.itemName; + detail.itemDesc1 = detail.package.itemDesc1; + detail.itemDesc2 = detail.package.itemDesc2; + + detail.inventoryStatus = detail.inventoryStatus; + + detail.fromPackingNumber = info.packingNumber; + detail.toPackingNumber = info.packingNumber; + + // detail.fromContainerNumber = detail.containerNumber; + // detail.toContainerNumber = detail.containerNumber + + detail.fromBatch = info.batch; + detail.toBatch = info.batch; + + detail.fromLocationCode = ""; + detail.toLocationCode = detail.toLocationCode; + + detail.reason = this.reasonCode; subList.push(detail) } }) }) - this.dataContent.subList = subList + this.dataContent.subList = subList; this.dataContent.creator = creator; return this.dataContent; }, + reasonChange(e) { + if (e.detail.value.length == 0) { + this.reasonCode = "" + this.reasonText = "" + } else { + this.reasonCode = e.detail.value[0].value + this.reasonText = e.detail.value[0].text + } + }, + showCommitSuccessMessage(hint) { + this.$refs.comMessage.showSuccessMessage(hint, res => { + this.reasonCode = "" + this.reasonText = ""; + this.detailSource = []; + this.managementList=[]; + this.dataContent ={} + this.toLocationCode ="" + }) + }, + } }