|
|
@ -1,7 +1,7 @@ |
|
|
|
<template> |
|
|
|
<view class="page-wraper"> |
|
|
|
<view class=""> |
|
|
|
<com-blank-view @goScan="showFromLocationPopup" v-if="recommendList.length == 0"></com-blank-view> |
|
|
|
<com-blank-view @goScan="openScanPopup" v-if="recommendList.length == 0"></com-blank-view> |
|
|
|
</view> |
|
|
|
<view class="page-wraper" v-if="recommendList.length > 0"> |
|
|
|
<!-- <view class="page-header"> |
|
|
@ -34,7 +34,7 @@ |
|
|
|
<scroll-view scroll-y="true" class="page-main-scroll"> |
|
|
|
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
|
|
|
<view class=""> |
|
|
|
<record-com-detail-card :dataContent="item" :index="index" :settingParam="dataContent" :isShowFromLocation="false" @removeItem="removeItem(index, item)" :isShowToLocation="false" @updateData="updateData" @removePack="removePack"> </record-com-detail-card> |
|
|
|
<record-com-detail-card :dataContent="item" :index="index" :settingParam="dataContent" :isShowFromLocation="true" @removeItem="removeItem(index, item)" :isShowToLocation="false" @updateData="updateData" @removePack="removePack"> </record-com-detail-card> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</scroll-view> |
|
|
@ -57,10 +57,8 @@ |
|
|
|
</view> |
|
|
|
<win-scan-button @goScan="openScanPopup"></win-scan-button> |
|
|
|
</view> |
|
|
|
<win-scan-pack-and-location ref="scanPopup" @getResult="onScan" :allowModifyLocation="false" :queryBalance="false"> </win-scan-pack-and-location> |
|
|
|
<winComScanBalance ref="scanPopup" @getBalance="getScanResult" :bussinessCode="businessTypeCode"> </winComScanBalance> |
|
|
|
<comMessage ref="comMessage"></comMessage> |
|
|
|
<win-scan-location ref="scanLocationCode" title="来源库位" @getLocation="getLocation" :locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location> |
|
|
|
<balance-select ref="balanceSelect" @onSelectItem="selectBalanceItem"></balance-select> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
@ -73,7 +71,7 @@ import { calc } from '@/common/calc.js' |
|
|
|
|
|
|
|
import { getInventoryStatusDesc, getDirectoryItemArray } from '@/common/directory.js' |
|
|
|
|
|
|
|
import { getBusinessType, createItemInfo, createDetailInfo, calcTreeHandleQty, calcHandleQty } from '@/common/record.js' |
|
|
|
import { getBusinessType, createItemInfo, createDetailInfo, calcHandleQty } from '@/common/record.js' |
|
|
|
|
|
|
|
import { getManagementPrecisions, getPrecisionStrategyList, getPrecisionStrategyParams } from '@/common/balance.js' |
|
|
|
|
|
|
@ -81,11 +79,9 @@ import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|
|
|
import winScanPack from '@/mycomponents/scan/winScanPack.vue' |
|
|
|
import requiredLocation from '@/mycomponents/location/requiredLocation.vue' |
|
|
|
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
|
|
|
import winScanLocation from '@/mycomponents/scan/winScanLocation.vue' |
|
|
|
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' |
|
|
|
import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue' |
|
|
|
import balance from '@/mycomponents/balance/balance.vue' |
|
|
|
|
|
|
|
export default { |
|
|
@ -94,11 +90,9 @@ export default { |
|
|
|
winScanPack, |
|
|
|
requiredLocation, |
|
|
|
comBlankView, |
|
|
|
winScanLocation, |
|
|
|
winScanPackAndLocation, |
|
|
|
recordComDetailCard, |
|
|
|
recordDetailCard, |
|
|
|
balanceSelect, |
|
|
|
winComScanBalance, |
|
|
|
balance |
|
|
|
}, |
|
|
|
data() { |
|
|
@ -112,7 +106,7 @@ export default { |
|
|
|
toLocationAreaTypeList: [], |
|
|
|
inInventoryStatus: '', // 目标入库库存状态 |
|
|
|
outInventoryStatus: '', // 来源出库库存状态 |
|
|
|
businessType: {}, |
|
|
|
businessType: null, |
|
|
|
showToLoaction: true, |
|
|
|
recommendLocationList: [], // 推荐库位列表 |
|
|
|
fromWarehouseCode: '', // 来源仓库 |
|
|
@ -121,7 +115,8 @@ export default { |
|
|
|
show: false, |
|
|
|
positionInfo: '请选择生产线', |
|
|
|
resultData: {}, |
|
|
|
recommendList: [] |
|
|
|
recommendList: [], |
|
|
|
fromInventoryStatuses: [] |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad(option) { |
|
|
@ -132,9 +127,9 @@ export default { |
|
|
|
getBusinessType(this.businessTypeCode, (res) => { |
|
|
|
if (res.success) { |
|
|
|
this.businessType = res.businessType |
|
|
|
this.fromInventoryStatuses = getDirectoryItemArray(res.fromInventoryStatuses) |
|
|
|
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList |
|
|
|
this.toLocationAreaTypeList = res.toLocationAreaTypeList |
|
|
|
this.showFromLocationPopup() |
|
|
|
this.openScanPopup() |
|
|
|
} else { |
|
|
|
this.showErrorMessage(res.message) |
|
|
|
} |
|
|
@ -168,122 +163,7 @@ export default { |
|
|
|
mounted() {}, |
|
|
|
|
|
|
|
methods: { |
|
|
|
getBalance(label, packageInfo, callback) { |
|
|
|
const filters = [] |
|
|
|
|
|
|
|
if (packageInfo.parentNumber) { |
|
|
|
const 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 |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
const params = { |
|
|
|
filters, |
|
|
|
pageNo: 1, |
|
|
|
pageSize: 100 |
|
|
|
} |
|
|
|
getBalanceByFilter(params) |
|
|
|
.then((res) => { |
|
|
|
callback(res.data) |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
this.showErrorMessage(err.message) |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
getScanResult(result) { |
|
|
|
this.resultData = result |
|
|
|
const packageInfo = result.package |
|
|
|
this.getBalance(result.label, packageInfo, (balances) => { |
|
|
|
// 扫描的是外包装 |
|
|
|
const s = '' |
|
|
|
if (!result.package.parentNumber) { |
|
|
|
if (balances.list.length == 0) { |
|
|
|
this.showErrorMessage('未查找到该包装的库存信息,请重新扫描') |
|
|
|
} else { |
|
|
|
const newBalances = balances.list.filter((b) => b.locationCode == this.fromLocationCode) |
|
|
|
if (newBalances.length == 0) { |
|
|
|
this.showErrorMessage('未查找到该包装的库存信息,请重新扫描') |
|
|
|
} else if (newBalances.length == 1) { |
|
|
|
const balance = newBalances[0] |
|
|
|
result.balance = balance |
|
|
|
this.afterGetBalance(result) |
|
|
|
} else { |
|
|
|
this.showBalanceSelect(newBalances) |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 扫描的是小包装 |
|
|
|
if (balances.list.length == 0) { |
|
|
|
this.showErrorMessage('未查找到该包装的库存信息,请重新扫描') |
|
|
|
} else { |
|
|
|
// 小包装库存 |
|
|
|
const subPackitems = balances.list.filter((r) => r.packingNumber == packageInfo.number) |
|
|
|
// 外包装库存 |
|
|
|
const 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) { |
|
|
|
const 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 { |
|
|
|
let locationCode = this.fromLocationCode |
|
|
|
if (balances.list == 1) { |
|
|
|
locationCode = balances.list[0].locationCode |
|
|
|
} else { |
|
|
|
const manyBlances = balances.list.filter((r) => r.locationCode != this.fromLocationCode) |
|
|
|
if (manyBlances.length > 0) { |
|
|
|
locationCode = manyBlances[0].locationCode |
|
|
|
} |
|
|
|
} |
|
|
|
this.showErrorMessage(`该包装【${packageInfo.number}】在库位【${locationCode}】已经有库存余额,请重新扫描`) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
onScan(result) { |
|
|
|
const that = this |
|
|
|
const pack = result.package |
|
|
|
if (that.recommendList.length > 0) { |
|
|
@ -295,7 +175,7 @@ export default { |
|
|
|
if (batch == undefined) { |
|
|
|
that.showErrorMessage(`扫描的批次【${pack.batch}】,不是系统推荐的批次,不满足系统的先进先出规则,请重新扫描物料`) |
|
|
|
} else { |
|
|
|
this.getScanResult(result) |
|
|
|
this.setData(result) |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
@ -325,7 +205,7 @@ export default { |
|
|
|
if (recommendInfo.batch != result.package.batch) { |
|
|
|
that.showErrorMessage(`扫描的批次【${result.package.batch}】,不是系统推荐的批次【${recommendInfo.batch}】,不满足系统的先进先出规则,请重新扫描`) |
|
|
|
} else { |
|
|
|
this.getScanResult(result) |
|
|
|
this.setData(result) |
|
|
|
} |
|
|
|
} else { |
|
|
|
that.showErrorMessage('未查找到物料的推荐信息') |
|
|
@ -339,16 +219,7 @@ export default { |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
showBalanceSelect(items) { |
|
|
|
this.$refs.balanceSelect.openPopup(items) |
|
|
|
}, |
|
|
|
|
|
|
|
selectBalanceItem(balance) { |
|
|
|
this.resultData.balance = balance |
|
|
|
this.afterGetBalance(this.resultData) |
|
|
|
}, |
|
|
|
|
|
|
|
afterGetBalance(result) { |
|
|
|
setData(result) { |
|
|
|
const { balance } = result |
|
|
|
const { label } = result |
|
|
|
const pack = result.package |
|
|
@ -392,81 +263,6 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
getScanResult1(result) { |
|
|
|
const { balance } = result |
|
|
|
const { label } = result |
|
|
|
const pack = result.package |
|
|
|
const { packUnit } = pack |
|
|
|
const { packQty } = pack |
|
|
|
const item = this.detailSource.find((res) => { |
|
|
|
if (res.itemCode == balance.itemCode) { |
|
|
|
return res |
|
|
|
} |
|
|
|
}) |
|
|
|
if (this.fromWarehouseCode == '') { |
|
|
|
this.fromWarehouseCode = balance.warehouseCode |
|
|
|
} |
|
|
|
if (item == undefined) { |
|
|
|
const itemp = createItemInfo(balance, pack) |
|
|
|
const newDetail = createDetailInfo(balance, pack) // |
|
|
|
newDetail.packUnit = packUnit |
|
|
|
newDetail.packQty = packQty |
|
|
|
itemp.subList.push(newDetail) |
|
|
|
this.detailSource.push(itemp) |
|
|
|
calcHandleQty(this.detailSource) |
|
|
|
} else { |
|
|
|
const 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) { |
|
|
|
const 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}]已经在列表中`) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 获取推荐库位 |
|
|
|
getRecommendLocation(balance, pack, callback) { |
|
|
|
uni.showLoading({ |
|
|
|
title: '扫描中...', |
|
|
|
mask: true |
|
|
|
}) |
|
|
|
const recommend = this.recommendLocationList.find((r) => r.itemCode == balance.itemCode) |
|
|
|
if (recommend == undefined) { |
|
|
|
const param = { |
|
|
|
itemCode: balance.itemCode, |
|
|
|
batch: balance.batch, |
|
|
|
inventoryStatus: balance.inventoryStatus, |
|
|
|
supplierCode: pack.supplierCode, |
|
|
|
businessCode: this.businessTypeCode |
|
|
|
} |
|
|
|
console.log(JSON.stringify(param)) |
|
|
|
getPutawayRecommendLocation(param) |
|
|
|
.then((res) => { |
|
|
|
this.recommendLocationList.push({ |
|
|
|
itemCode: balance.itemCode, |
|
|
|
locationCode: res.data.code |
|
|
|
}) |
|
|
|
callback(res.data) |
|
|
|
uni.hideLoading() |
|
|
|
}) |
|
|
|
.catch((error) => { |
|
|
|
uni.hideLoading() |
|
|
|
this.showErrorMessage(error) |
|
|
|
uni.hideLoading() |
|
|
|
}) |
|
|
|
} else { |
|
|
|
callback(recommend) |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
showErrorMessage(message) { |
|
|
|
this.$refs.comMessage.showErrorMessage(message, (res) => { |
|
|
|
if (res) { |
|
|
@ -474,18 +270,6 @@ export default { |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
calcTreeHandleQty() { |
|
|
|
for (const item of this.detailSource) { |
|
|
|
item.qty = 0 |
|
|
|
for (const detail of item.subList) { |
|
|
|
if (detail != undefined) { |
|
|
|
item.qty = calc.add(item.qty, detail.qty) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.$forceUpdate() |
|
|
|
}, |
|
|
|
|
|
|
|
showSelect() { |
|
|
|
// if (this.editPosition) { |
|
|
|
this.show = true |
|
|
@ -554,38 +338,35 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
openScanPopup() { |
|
|
|
if (this.fromLocationCode == '') { |
|
|
|
this.showFromLocationPopup() |
|
|
|
return |
|
|
|
if (this.businessType) { |
|
|
|
this.$refs.scanPopup.openScanPopup(this.businessType) |
|
|
|
} else { |
|
|
|
this.getBusinessType() |
|
|
|
} |
|
|
|
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType) |
|
|
|
}, |
|
|
|
|
|
|
|
showFromLocationPopup() { |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$refs.scanLocationCode.openScanPopup() |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
closeScanPopup() { |
|
|
|
if (this.$refs.scanPopup != undefined) { |
|
|
|
if (this.$refs.scanPopup) { |
|
|
|
this.$refs.scanPopup.closeScanPopup() |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
scanPopupGetFocus() { |
|
|
|
if (this.$refs.scanPopup != undefined) { |
|
|
|
if (this.$refs.scanPopup) { |
|
|
|
this.$refs.scanPopup.getfocus() |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// scanLocationCode(location, code) { |
|
|
|
// this.toLocationCode = code |
|
|
|
// this.toLocationCode = location; |
|
|
|
|
|
|
|
// }, |
|
|
|
|
|
|
|
commit() { |
|
|
|
if (this.detailSource.length == 0) { |
|
|
|
this.showErrorMessage('扫描数据为0,请先扫描数据') |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
if (this.positionInfo == '请选择生产线') { |
|
|
|
this.showErrorMessage('请先选择生产线') |
|
|
|
return |
|
|
|
} |
|
|
|
uni.showLoading({ |
|
|
|
title: '提交中....', |
|
|
|
mask: true |
|
|
@ -693,24 +474,6 @@ export default { |
|
|
|
closeScanMessage() { |
|
|
|
this.scanPopupGetFocus() |
|
|
|
}, |
|
|
|
getLocation(location, code) { |
|
|
|
this.getFromLocationCode(location, code) |
|
|
|
}, |
|
|
|
getFromLocationCode(location, code) { |
|
|
|
this.fromLocationInfo = location |
|
|
|
this.fromLocationCode = code |
|
|
|
this.openScanPopup() |
|
|
|
}, |
|
|
|
getToLocationCode(location, code) { |
|
|
|
if (this.fromLocationCode == code) { |
|
|
|
uni.showToast({ |
|
|
|
title: `来源库位[${this.fromLocationCode}]不能与目标库位[${code}]一致`, |
|
|
|
duration: 2000 |
|
|
|
}) |
|
|
|
return |
|
|
|
} |
|
|
|
this.toLocationCode = code |
|
|
|
}, |
|
|
|
|
|
|
|
showCommitSuccessMessage(hint) { |
|
|
|
this.$refs.comMessage.showSuccessMessage(hint, (res) => { |
|
|
@ -736,6 +499,7 @@ export default { |
|
|
|
this.toWarehouseCode = '' |
|
|
|
this.detailSource = [] |
|
|
|
this.positionInfo = '请选择生产线' |
|
|
|
this.recommendList = [] |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|