diff --git a/src/api/request2.js b/src/api/request2.js index bff958ec..cc88d8d6 100644 --- a/src/api/request2.js +++ b/src/api/request2.js @@ -296,6 +296,32 @@ export function getBalanceByLocationcode(params) { }); } +/** + * 按库位查询 预计入 + * @param {*} + */ +export function getExpectInByLocationCode(params) { + + return request({ + url: baseApi + "/wms/expectin/senior", + method: "post", + data: params, + }); +} + +/** + * 按库位查询 预计出 + * @param {*} + */ +export function getExpectOutByLocationCode(params) { + + return request({ + url: baseApi + "/wms/expectout/senior", + method: "post", + data: params, + }); +} + /** * 查询器具信息接口 * @param {*} number 器具代码 @@ -4169,3 +4195,15 @@ export function getJimuPutawayJobDetail(data) { data:data }); } + +/** + * 查询库位,后台自己查询管理模式 + * @param {*} + */ +export function getBalanceByParams(data) { + return request({ + url: baseApi + "/wms/balance/getBalanceListByPackage", + method: "post", + data:data + }); +} diff --git a/src/mycomponents/balance/balanceSelect.vue b/src/mycomponents/balance/balanceSelect.vue index 15589b5b..931f3adc 100644 --- a/src/mycomponents/balance/balanceSelect.vue +++ b/src/mycomponents/balance/balanceSelect.vue @@ -3,10 +3,10 @@ - + - + diff --git a/src/mycomponents/balance/location.vue b/src/mycomponents/balance/location.vue index d5956aa4..9a730b5c 100644 --- a/src/mycomponents/balance/location.vue +++ b/src/mycomponents/balance/location.vue @@ -1,7 +1,7 @@ diff --git a/src/mycomponents/scan/winComScan.vue b/src/mycomponents/scan/winComScan.vue index 409e1cc9..12066256 100644 --- a/src/mycomponents/scan/winComScan.vue +++ b/src/mycomponents/scan/winComScan.vue @@ -6,7 +6,7 @@ @@ -225,6 +225,7 @@ getfocus() { let that = this; this.$nextTick(r => { + console.log("获取焦点") that.boxfocus = true; }); // this.hide() @@ -232,7 +233,9 @@ losefocus() { let that = this; this.$nextTick(r => { + console.log("失去焦点") that.boxfocus = false; + uni.hideKeyboard(); }); }, clear() { diff --git a/src/mycomponents/scan/winComScanBalance.vue b/src/mycomponents/scan/winComScanBalance.vue new file mode 100644 index 00000000..7a3e012d --- /dev/null +++ b/src/mycomponents/scan/winComScanBalance.vue @@ -0,0 +1,227 @@ + + + + + \ No newline at end of file diff --git a/src/mycomponents/scan/winScanLocation.vue b/src/mycomponents/scan/winScanLocation.vue index a43cc3be..66531474 100644 --- a/src/mycomponents/scan/winScanLocation.vue +++ b/src/mycomponents/scan/winScanLocation.vue @@ -13,7 +13,7 @@ + :isShowHistory="isShowHistory" headerType=""> diff --git a/src/mycomponents/scan/winScanPackAndLocation.vue b/src/mycomponents/scan/winScanPackAndLocation.vue index 55b5397e..d3063f05 100644 --- a/src/mycomponents/scan/winScanPackAndLocation.vue +++ b/src/mycomponents/scan/winScanPackAndLocation.vue @@ -18,7 +18,7 @@ margin-right: 20rpx; border-radius: 8rpx; height: 30px;"> - + 来源库位 @@ -31,7 +31,7 @@ @confirm="handleConfirm" style='height: 30rpx;border:1px solid #fff ;'> - + {{fromLocationCode}} @@ -160,7 +160,7 @@ } this.fromInventoryStatuses = getDirectoryItemArray(this.businessType.outInventoryStatuses) this.inventoryStatus = getDirectoryItemArray(this.businessType.outInventoryStatuses); //出库库存状态 - this.fromLocationAreaTypeList = getDirectoryItemArray(this.businessType.fromLocationAreaTypeList); //出库库区 + this.fromLocationAreaTypeList = getDirectoryItemArray(this.businessType.outAreaTypes); //出库库区 if (!this.show) { setTimeout(res => { this.$refs.popup.open('bottom') diff --git a/src/mycomponents/scan/winScanPackJob.vue b/src/mycomponents/scan/winScanPackJob.vue index e0b66aad..47cba583 100644 --- a/src/mycomponents/scan/winScanPackJob.vue +++ b/src/mycomponents/scan/winScanPackJob.vue @@ -70,11 +70,11 @@ methods: { // 弹出 openScanPopup(){ - this.$refs.popup.open('bottom') }, // 关闭 closeScanPopup(content) { + this.$refs.comscan.losefocus() this.$refs.popup.close(); this.$emit("close", ''); }, diff --git a/src/pages.json b/src/pages.json index 8b9fd09c..2a6381f9 100644 --- a/src/pages.json +++ b/src/pages.json @@ -69,7 +69,7 @@ "path": "pages/query/location", "style": { "navigationBarTitleText": "按库位查询库存", - "enablePullDownRefresh": false, + "enablePullDownRefresh": true, "titleNView": { "autoBackButton": "true", "buttons": [{}] diff --git a/src/pages/count/coms/comCountDetailcards.vue b/src/pages/count/coms/comCountDetailcards.vue index 7d2fdafb..9b45c358 100644 --- a/src/pages/count/coms/comCountDetailcards.vue +++ b/src/pages/count/coms/comCountDetailcards.vue @@ -10,6 +10,7 @@ @@ -71,6 +72,10 @@ type: Boolean, default: false }, + isShowRecommendQty: { + type: Boolean, + default: true + } }, methods: { edit(){ diff --git a/src/pages/count/coms/comCountJobCard.vue b/src/pages/count/coms/comCountJobCard.vue index 64e5abe5..30ea3de0 100644 --- a/src/pages/count/coms/comCountJobCard.vue +++ b/src/pages/count/coms/comCountJobCard.vue @@ -3,7 +3,7 @@ - + 阶段 : {{getCountStageName(dataContent.stage)}} diff --git a/src/pages/count/job/countBlindDetail.vue b/src/pages/count/job/countBlindDetail.vue index 5b8e0783..d2870e6b 100644 --- a/src/pages/count/job/countBlindDetail.vue +++ b/src/pages/count/job/countBlindDetail.vue @@ -40,6 +40,7 @@ @@ -66,7 +67,9 @@ - + @@ -242,15 +245,15 @@ } else { that.jobContent = res.data; that.jobStatus = res.data.status; - that.fromLocationCode = that.jobContent.locationCode; - // res.data.subList.forEach(item => { - // item.recommendQty = item.qty - // item.handleQty = 0 - // item.countTime = new Date() - // item.fromLocationCode =that.fromLocationCode; - // }) - // that.allDetails = res.data.subList; - // that.allCount = res.data.subList.length; + that.fromLocationCode = that.jobContent.countSplitCode; + res.data.subList.forEach(item => { + item.recommendQty = item.qty + item.handleQty = 0 + item.countTime = new Date() + item.fromLocationCode =that.fromLocationCode; + }) + that.allDetails = res.data.subList; + that.allCount = res.data.subList.length; that.initList() } @@ -335,9 +338,9 @@ var packingNumber = result.label.packingNumber var pack = result.package var batch = result.label.batch - var inventoryStatus = "OK" - var qty = result.label.qty ? result.label.qty : 0; - + var inventoryStatus = result.balance ? result.balance.inventoryStatus : "OK" + var qty = result.balance ? result.balance.qty : 0; + //按物料、箱码、批次、状态匹配 let items = this.allDetails.filter(r => r.itemCode === itemCode && @@ -346,13 +349,21 @@ r.inventoryStatus === inventoryStatus) //不在任务列表中,是否添加库存 if (items.length == 0) { - var detail = this.createAddDetailInfo(pack,qty) - detail.countTime = new Date(); - this.allDetails.push(detail) - this.updateList(); - this.$refs.countQtyEdit.openEditPopupShowSeconds(detail, - null); - + this.$refs.comMessage.showQuestionMessage("包装【" + result.label.packingNumber + + "】不在任务列表中,是否要添加到列表中?", + res => { + //创建盘点信息,标记为已经扫描 + if (res) { + var detail = this.createAddDetailInfo(pack,qty) + detail.countTime = new Date(); + this.allDetails.push(detail) + this.updateList(); + this.$refs.countQtyEdit.openEditPopupShowSeconds(detail, + null); + } else { + this.scanPopupGetFocus(); + } + }) } else { var selectItem = items[0] //已经扫描 @@ -368,15 +379,15 @@ this.scanPopupGetFocus(); } }) - + } else { //未扫描,赋值 selectItem.scaned = true; - selectItem.recommendQty =Number(qty); + selectItem.balanceQty= Number(qty) selectItem.handleQty = Number(qty) selectItem.packQty = pack.packQty selectItem.packUnit = pack.packUnit - + this.$refs.countQtyEdit.openEditPopupShowSeconds(selectItem, null); selectItem.countTime = new Date(); @@ -424,7 +435,7 @@ //创建盘盈的明细 createAddDetailInfo(pack,qty) { var detail = { - id: this.jobContent.masterId, //新增的明细 + masterId: this.jobContent.id, //新增的明细 scaned: true, countDetailNumber: "", ownerCode: "", @@ -448,6 +459,7 @@ countQty: 0, balanceQty: 0, fromLocationCode: this.fromLocationCode, + locationCode:this.fromLocationCode, creator: this.$store.state.user.id, countTime: new Date() } diff --git a/src/pages/count/job/countJob.vue b/src/pages/count/job/countJob.vue index 3f6a1ed4..85f35df4 100644 --- a/src/pages/count/job/countJob.vue +++ b/src/pages/count/job/countJob.vue @@ -152,6 +152,11 @@ action: "in", value: this.status }) + filters.push({ + column: "countSplitType", + action: "==", + value: "locationCode" + }) // filters.push({ // column: "accept_user_id", @@ -195,20 +200,20 @@ }, openJobDetail(item) { - uni.navigateTo({ - url: './countDetail?id=' + item.id + '&status=' + item.status - }); - // //明盘 - // if(item.isOpenCount=="TRUE"){ - // uni.navigateTo({ - // url: './countLightDetail?id=' + item.id + '&status=' + item.status - // }); - // }else { - // //盲盘 - // uni.navigateTo({ - // url: './countBlindDetail?id=' + item.id + '&status=' + item.status - // }); - // } + // uni.navigateTo({ + // url: './countDetail?id=' + item.id + '&status=' + item.status + // }); + //明盘 + if(item.isOpenCount=="TRUE"){ + uni.navigateTo({ + url: './countLightDetail?id=' + item.id + '&status=' + item.status + }); + }else { + //盲盘 + uni.navigateTo({ + url: './countBlindDetail?id=' + item.id + '&status=' + item.status + }); + } }, showItemList(itemList) { @@ -293,6 +298,12 @@ action: "==", value: code }) + + filters.push({ + column: "countSplitType", + action: "==", + value: "locationCode" + }) var params = { filters: filters, diff --git a/src/pages/count/job/countLightDetail.vue b/src/pages/count/job/countLightDetail.vue index 51f1b74d..a0edefd5 100644 --- a/src/pages/count/job/countLightDetail.vue +++ b/src/pages/count/job/countLightDetail.vue @@ -68,7 +68,9 @@ - + @@ -244,7 +246,7 @@ } else { that.jobContent = res.data; that.jobStatus = res.data.status; - that.fromLocationCode = that.jobContent.locationCode; + that.fromLocationCode = that.jobContent.countSplitCode; res.data.subList.forEach(item => { item.recommendQty = item.qty item.handleQty = 0 @@ -434,7 +436,7 @@ //创建盘盈的明细 createAddDetailInfo(pack,qty) { var detail = { - id: this.jobContent.masterId, //新增的明细 + masterId: this.jobContent.id, //新增的明细 scaned: true, countDetailNumber: "", ownerCode: "", diff --git a/src/pages/deliver/coms/comScanDeliverPack.vue b/src/pages/deliver/coms/comScanDeliverPack.vue index 2b30bafa..c0e522eb 100644 --- a/src/pages/deliver/coms/comScanDeliverPack.vue +++ b/src/pages/deliver/coms/comScanDeliverPack.vue @@ -342,7 +342,7 @@ ) } } else { - if (this.jobContent.AllowModifyBatch == null) { + if (this.jobContent.allowModifyBatch == "TRUE") { this.showQuestionMessage('在【' + that.fromLocationCode + '】库位下,未查找到批次【' + lot + '】的发货明细,是否要继续发货?', res => { if (res) { diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index d3ba15bc..128d1822 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -387,7 +387,7 @@ console.log("包装规格获取失败", res) }) - var switchCode="FgPutawayLocationCodeValidate,SemiPutawayLocationCodeValidate,PurchasePutawayToLocationCodeValidate,IssueToLocationCodeValidate,fgProductReceipCommitValidate,purchasereceiptPrintPDA"; + var switchCode="FgPutawayLocationCodeValidate,SemiPutawayLocationCodeValidate,PurchasePutawayToLocationCodeValidate,IssueToLocationCodeValidate,fgProductReceipCommitValidate,purchasereceiptPrintPDA,purchaseReceiptLocationCodeValidate"; getSwitchByCode(switchCode).then(res=>{ uni.setStorageSync("switch", res.data) diff --git a/src/pages/issue/coms/comScanIssuePack.vue b/src/pages/issue/coms/comScanIssuePack.vue index f2b15e7a..2d902071 100644 --- a/src/pages/issue/coms/comScanIssuePack.vue +++ b/src/pages/issue/coms/comScanIssuePack.vue @@ -41,12 +41,12 @@ margin-right: 20rpx; margin-top: 8rpx; border-radius: 8rpx;"> - + 来源库位 - + @@ -113,7 +113,8 @@ getDetailEditRemoveOption } from '@/common/array.js'; import { - getWorkShopLineStation + getWorkShopLineStation, + getBalanceByFilter } from '@/api/request2.js'; import { @@ -161,7 +162,10 @@ import { getDirectoryItemArray } from '../../../common/directory.js'; defaultValueList: [], fromInventoryStatuses: "", packageInfo: {}, - label: {} + label: {}, + inputStyleObject:{ + fontSize: "100rpx" + } } }, created() { @@ -215,7 +219,7 @@ import { getDirectoryItemArray } from '../../../common/directory.js'; let that = this; that.fromLocationList = []; if (that.dataContent != null) { - that.fromInventoryStatuses = getDirectoryItemArray(this.jobContent.outInventoryStatuses) + that.fromInventoryStatuses = this.jobContent.outInventoryStatuses that.toLocation = that.dataContent[0]; that.toLocationCode = that.dataContent[0].toLocationCode; that.fromLocationList = that.getFromLocationList(); @@ -250,6 +254,192 @@ import { getDirectoryItemArray } from '../../../common/directory.js'; this.showErrorMessage('发料库位【' + fromlocation + '】不存在') } }, + + onScanResult(result){ + try { + let that = this; + if (that.fromLocationCode == '') { + that.showErrorMessage('请选择来源库位', res => { + that.$refs.toLocationCombox.onFocus(); + }); + return; + } + let packageInfo = result.package; + let itemCode = result.label.itemCode; + let packingCode = result.label.packingNumber; + let lot = result.label.batch; + let item = that.toLocation.Items.find(r => r.itemCode == itemCode); + if (item == undefined) { + that.showErrorMessage('未查找到物料【' + itemCode + '】的发料明细', + res => { + that.getfocus(); + } + ) + return; + } else { + //查找库存信息 + uni.showLoading({ + title: '加载中', + mask: true + }) + + this.getBalance(result.label, packageInfo, balances => { + this.packageInfo =packageInfo; + //扫描的是外包装 + let s = ''; + if (!result.package.parentNumber) { + if (balances.list.length == 0) { + this.showErrorMessage('未查找到该包装的库存信息,请重新扫描') + } else { + let newBalances = balances.list.filter(b => b.locationCode == that + .fromLocationCode); + if (newBalances.length == 0) { + this.showErrorMessage('未查找到该包装的库存信息,请重新扫描') + } else if (newBalances.length == 1) { + let balance = newBalances[0]; + this.afterGetBalance(result.label, balance, packageInfo); + } else { + this.showBalanceSelect(newBalances); + } + } + } else { + //扫描的是小包装 + if (balances.list.length == 0) { + this.showErrorMessage('未查找到该包装的库存信息,请重新扫描') + } else { + //小包装库存 + let subPackitems = balances.list.filter(r => r.packingNumber == packageInfo + .number) + //外包装库存 + let subParentPackitems = balances.list.filter(r => r.packingNumber == + packageInfo + .parentNumber&&r.locationCode==this.fromLocationCode) + + + //小包装没有库存, + if (subPackitems.length == 0) { + //外包装有库存,出库后剩余库存未转换为出库包装规格 + + if (subParentPackitems.length > 0) { + if(subParentPackitems.length==1){ + let balance = subParentPackitems[0]; + balance.qty=packageInfo.qty; + this.afterGetBalance(result.label, balance, packageInfo); + }else { + this.showBalanceSelect(subParentPackitems); + } + + } else { + this.showErrorMessage('按外包装【' + packageInfo.parentNumber + '】和子包装【' + + packageInfo.number + '】都未查找到库存余额') + } + } else { + var locationCode = this.fromLocationCode + if(balances.list==1){ + locationCode=balances.list[0].locationCode + }else { + var manyBlances = balances.list.filter(r=>r.locationCode!=this.fromLocationCode) + if(manyBlances.length>0){ + locationCode = manyBlances[0].locationCode; + } + + } + this.showErrorMessage('该包装【' + packageInfo.number + '】在库位【' + + locationCode + + '】已经有库存余额,请重新扫描') + } + + + + // //小包装没有库存,外包装有库存 + // if (subitems.length == 0 && subParentPackitems.length > 0) { + // this.afterGetBalance(result.label, null, packageInfo); + // } else if (subitems.length > 0 && subParentPackitems.length == 0) { + // //小包装没有库存,外包装没有有库存 + // this.showErrorMessage('该包装在库位【' + balances.list[0].locationCode + + // '】已经有库存余额,请重新扫描') + // } else { + + // } + + } + } + uni.hideLoading(); + }); + + + // getBalanceByManagementPrecision(result.label, that.fromLocationCode, that.fromInventoryStatuses, + // balanceRes => { + // if (balanceRes.success) { + // let s = ''; + // if (balanceRes.data.list.length == 0) { + // this.afterGetBalance(result.label, null, packageInfo); + // } else if (balanceRes.data.list.length == 1) { + // let balance = balanceRes.data.list[0]; + // this.afterGetBalance(result.label, balance, packageInfo); + // } else { + // this.showBalanceSelect(balanceRes.data.list); + // } + // } else { + // this.showErrorMessage(balanceRes.message.message); + // } + // uni.hideLoading(); + // }); + } + } catch (e) { + this.showErrorMessage(e.stack) + uni.hideLoading(); + } + }, + + getBalance(label, packageInfo, callback) { + var filters = [] + + if (packageInfo.parentNumber) { + var packingNumber = packageInfo.parentNumber + "," + label.packingNumber; + filters.push({ + column: "packingNumber", + action: "in", + value: packingNumber + }) + } else { + filters.push({ + column: "packingNumber", + action: "==", + value: label.packingNumber + }) + } + + filters.push({ + column: "itemCode", + action: "==", + value: label.itemCode + }) + filters.push({ + column: "batch", + action: "==", + value: label.batch + }) + + if (this.fromInventoryStatuses != null && this.fromInventoryStatuses != "") { + filters.push({ + column: "inventoryStatus", + action: "in", + value: this.fromInventoryStatuses + }) + } + + var params = { + filters: filters, + pageNo: 1, + pageSize: 100, + } + getBalanceByFilter(params).then(res => { + callback(res.data) + }).catch(err => { + this.showErrorMessage(err.message); + }) + }, onScan(result) { @@ -267,7 +457,7 @@ import { getDirectoryItemArray } from '../../../common/directory.js'; } } }, - onScanResult(result) { + onScanResult1(result) { try { let that = this; if (that.fromLocationCode == '') { @@ -324,7 +514,7 @@ import { getDirectoryItemArray } from '../../../common/directory.js'; }, selectBalanceItem(balance) { - this.afterGetBalance(this.label, balance, this.packageInfo); + this.afterGetBalance(this.label, balance,this.packageInfo); }, afterGetBalance(label, balance, packageInfo) { @@ -432,6 +622,7 @@ import { getDirectoryItemArray } from '../../../common/directory.js'; scaned: true, itemCode: label.itemCode, packingNumber: label.packingNumber, + parentPackingNumber: packageInfo.parentNumber, batch: label.batch, qty: Number(balance.qty), // qty: Number(label.qty) > Number(balance.qty) ? Number(balance.qty) : Number(label.qty), @@ -585,4 +776,7 @@ import { getDirectoryItemArray } from '../../../common/directory.js'; max-height: 300rpx; padding: 10rpx; } + .my-combox{ + font-size: 50px; + } \ No newline at end of file diff --git a/src/pages/issue/job/issueDetail.vue b/src/pages/issue/job/issueDetail.vue index 176fa4f8..e8719ce2 100644 --- a/src/pages/issue/job/issueDetail.vue +++ b/src/pages/issue/job/issueDetail.vue @@ -367,6 +367,8 @@ .packingNumber; record.toBatch = info.batch; } + record.fromParentPackingNumber = r + .parentPackingNumber; subItem.recordList.push(record); }) subList.push(deepCopyData(subItem)); diff --git a/src/pages/issue/record/directIssue.vue b/src/pages/issue/record/directIssue.vue index 1bcb962f..a63dc45a 100644 --- a/src/pages/issue/record/directIssue.vue +++ b/src/pages/issue/record/directIssue.vue @@ -16,10 +16,9 @@ + :isShowToLocation="false" @updateData="updateData" @removePack="removePack"> - + @@ -44,11 +43,13 @@ - + + @@ -56,6 +57,7 @@ import { issueRecordSubmit, getWorkShopLineStation, + getBalanceByFilter } from '@/api/request2.js'; import { @@ -95,6 +97,7 @@ import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' import recordDetailCard from '@/mycomponents/record/recordDetailCard.vue' + import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' export default { components: { @@ -105,7 +108,8 @@ winScanLocation, winScanPackAndLocation, recordComDetailCard, - recordDetailCard + recordDetailCard, + balanceSelect }, data() { return { @@ -125,7 +129,8 @@ businessTypeCode: "Issue", positionList: [], show: false, - positionInfo: "请选择生产线" + positionInfo: "请选择生产线", + resultData: {} }; }, onLoad(option) { @@ -169,7 +174,139 @@ mounted() {}, methods: { + getBalance(label, packageInfo, callback) { + var filters = [] + + if (packageInfo.parentNumber) { + var packingNumber = packageInfo.parentNumber + "," + label.packingNumber; + filters.push({ + column: "packingNumber", + action: "in", + value: packingNumber + }) + } else { + filters.push({ + column: "packingNumber", + action: "==", + value: label.packingNumber + }) + } + + filters.push({ + column: "itemCode", + action: "==", + value: label.itemCode + }) + filters.push({ + column: "batch", + action: "==", + value: label.batch + }) + + if (this.fromInventoryStatuses != null && this.fromInventoryStatuses != "") { + filters.push({ + column: "inventoryStatus", + action: "in", + value: this.fromInventoryStatuses + }) + } + + var params = { + filters: filters, + pageNo: 1, + pageSize: 100, + } + getBalanceByFilter(params).then(res => { + callback(res.data) + }).catch(err => { + this.showErrorMessage(err.message); + }) + }, getScanResult(result) { + this.resultData = result; + let packageInfo = result.package; + this.getBalance(result.label, packageInfo, balances => { + + //扫描的是外包装 + let s = ''; + if (!result.package.parentNumber) { + if (balances.list.length == 0) { + this.showErrorMessage('未查找到该包装的库存信息,请重新扫描') + } else { + let newBalances = balances.list.filter(b => b.locationCode == this + .fromLocationCode); + if (newBalances.length == 0) { + this.showErrorMessage('未查找到该包装的库存信息,请重新扫描') + } else if (newBalances.length == 1) { + let balance = newBalances[0]; + result.balance = balance; + this.afterGetBalance(result); + } else { + this.showBalanceSelect(newBalances); + } + } + } else { + //扫描的是小包装 + if (balances.list.length == 0) { + this.showErrorMessage('未查找到该包装的库存信息,请重新扫描') + } else { + //小包装库存 + let subPackitems = balances.list.filter(r => r.packingNumber == packageInfo + .number) + //外包装库存 + let subParentPackitems = balances.list.filter(r => r.packingNumber == + packageInfo + .parentNumber && r.locationCode == this.fromLocationCode) + + + //小包装没有库存, + if (subPackitems.length == 0) { + //外包装有库存,出库后剩余库存未转换为出库包装规格 + + if (subParentPackitems.length > 0) { + if (subParentPackitems.length == 1) { + let balance = subParentPackitems[0]; + balance.qty = packageInfo.qty; + result.balance = balance; + this.afterGetBalance(result); + } else { + this.showBalanceSelect(subParentPackitems); + } + + } else { + this.showErrorMessage('按外包装【' + packageInfo.parentNumber + '】和子包装【' + + packageInfo.number + '】都未查找到库存余额') + } + } else { + var locationCode = this.fromLocationCode + if (balances.list == 1) { + locationCode = balances.list[0].locationCode + } else { + var manyBlances = balances.list.filter(r => r.locationCode != this + .fromLocationCode) + if (manyBlances.length > 0) { + locationCode = manyBlances[0].locationCode; + } + } + this.showErrorMessage('该包装【' + packageInfo.number + '】在库位【' + + locationCode + + '】已经有库存余额,请重新扫描') + } + } + } + }) + }, + + showBalanceSelect(items) { + this.$refs.balanceSelect.openPopup(items); + }, + + selectBalanceItem(balance) { + this.resultData.balance =balance; + this.afterGetBalance(this.resultData); + }, + + afterGetBalance(result){ let balance = result.balance; let label = result.label; let pack = result.package; @@ -187,15 +324,17 @@ var itemp = createItemInfo(balance, pack); let newDetail = createDetailInfo(balance, pack); // + newDetail.parentNumber =pack.parentNumber; + newDetail.packingNumber =pack.number newDetail.packUnit =packUnit; newDetail.packQty=packQty; itemp.subList.push(newDetail); this.detailSource.push(itemp) calcHandleQty(this.detailSource); - + } else { var detail = item.subList.find(r => { - if (r.packingNumber == balance.packingNumber && + if (r.packingNumber == pack.number && r.batch == balance.batch && r.locationCode == balance.locationCode && r.inventoryStatus == balance.inventoryStatus) { @@ -204,10 +343,60 @@ }) if (detail == undefined) { let newDetail = createDetailInfo(balance, pack); + newDetail.parentNumber =pack.parentNumber; + newDetail.packingNumber =pack.number newDetail.packUnit =packUnit; newDetail.packQty=packQty; item.subList.push(newDetail); calcHandleQty(this.detailSource); + } else { + if (detail.scaned == true) { + this.showErrorMessage("箱码[" + detail.packingNumber + "]批次[" + balance.batch + "]已经在列表中") + } + } + } + }, + + + getScanResult1(result) { + let balance = result.balance; + let label = result.label; + let pack = result.package; + let packUnit = pack.packUnit; + let packQty = pack.packQty + var item = this.detailSource.find(res => { + if (res.itemCode == balance.itemCode) { + return res + } + }) + if (this.fromWarehouseCode == '') { + this.fromWarehouseCode = balance.warehouseCode; + } + if (item == undefined) { + + var itemp = createItemInfo(balance, pack); + let newDetail = createDetailInfo(balance, pack); // + newDetail.packUnit = packUnit; + newDetail.packQty = packQty; + itemp.subList.push(newDetail); + this.detailSource.push(itemp) + calcHandleQty(this.detailSource); + + } else { + var detail = item.subList.find(r => { + if (r.packingNumber == balance.packingNumber && + r.batch == balance.batch && + r.locationCode == balance.locationCode && + r.inventoryStatus == balance.inventoryStatus) { + return r; + } + }) + if (detail == undefined) { + let newDetail = createDetailInfo(balance, pack); + newDetail.packUnit = packUnit; + newDetail.packQty = packQty; + item.subList.push(newDetail); + calcHandleQty(this.detailSource); } else { if (detail.scaned == true) { this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]已经在列表中") @@ -302,24 +491,25 @@ } else { this.showErrorMessage("车间-生产线基础信息维护错误") } - + //赋值到库位代码 let toLocationCode = '' - this.positionList.forEach(item=>{ - if(this.workshopCode == item.value){ // 车间 - item.children.find(child=>{ - if(this.productionLineCode==child.value){ - toLocationCode = child.children.find(subChild=>this.workStationCode==subChild.value).rawLocationCode; + this.positionList.forEach(item => { + if (this.workshopCode == item.value) { // 车间 + item.children.find(child => { + if (this.productionLineCode == child.value) { + toLocationCode = child.children.find(subChild => this.workStationCode == + subChild.value).rawLocationCode; } }) } }) - this.detailSource.forEach(item=>{ + this.detailSource.forEach(item => { item.subList.forEach(detail => { detail.toLocationCode = toLocationCode }) }) - + }, removeItem(index, item) { @@ -380,7 +570,9 @@ getPrecisionStrategyList(precisionStrategyParams, res => { if (res.success) { this.managementList = res.list; - var params = {...this.setRecordParams()} + var params = { + ...this.setRecordParams() + } console.log("提交参数", JSON.stringify(params)); issueRecordSubmit(params).then(res => { @@ -426,20 +618,20 @@ submitItem.qty = detail.handleQty; submitItem.package = ""; submitItem.recordList = [{ - toInventoryStatus:detail.inventoryStatus, - fromPackingNumber:info.packingNumber, - fromBatch:info.batch, - toPackingNumber:info.packingNumber, - toBatch:info.batch, - fromLocationCode:detail.locationCode, - toLocationCode:detail.toLocationCode, - handleQty:detail.handleQty, - fromPackUnit:detail.packUnit, - toPackUnit:detail.packUnit, - fromPackQty:detail.packQty, - toPackQty:detail.packQty - } - ] + toInventoryStatus: detail.inventoryStatus, + fromParentPackingNumber: detail.parentNumber, + fromPackingNumber: info.packingNumber, + fromBatch: info.batch, + toPackingNumber: info.packingNumber, + toBatch: info.batch, + fromLocationCode: detail.locationCode, + toLocationCode: detail.toLocationCode, + handleQty: detail.handleQty, + fromPackUnit: detail.packUnit, + toPackUnit: detail.packUnit, + fromPackQty: detail.packQty, + toPackQty: detail.packQty + }] subList.push(submitItem) } }) @@ -458,13 +650,6 @@ if (res) {} }); }, - showErrorMessage(message) { - this.$refs.comMessage.showErrorMessage(message, res => { - if (res) { - - } - }); - }, showScanMessage(message) { this.$refs.comMessage.showScanMessage(message); @@ -502,17 +687,17 @@ }) }, - updateData() { - calcHandleQty(this.detailSource); - for (var i = 0; i < this.detailSource.length; i++) { - let item = this.detailSource[i]; - if (item.qty == 0) { - this.detailSource.splice(i, 1) + updateData() { + calcHandleQty(this.detailSource); + for (var i = 0; i < this.detailSource.length; i++) { + let item = this.detailSource[i]; + if (item.qty == 0) { + this.detailSource.splice(i, 1) + } } - } - this.$forceUpdate(); - - }, + this.$forceUpdate(); + + }, clearData() { this.fromLocationInfo = {}; @@ -520,7 +705,7 @@ this.fromWarehouseCode = ''; this.toWarehouseCode = ''; this.detailSource = []; - this.to + this.positionInfo= "请选择生产线"; } } } diff --git a/src/pages/login/index.vue b/src/pages/login/index.vue index 4d2ccead..2206d6d9 100644 --- a/src/pages/login/index.vue +++ b/src/pages/login/index.vue @@ -4,10 +4,12 @@