Browse Source

修改发料任务的扫描 2024/8/7

hella_vue3
王志国 1 month ago
parent
commit
f1bf3e34de
  1. 121
      src/pages/issue/coms/comScanIssuePack.vue

121
src/pages/issue/coms/comScanIssuePack.vue

@ -10,12 +10,12 @@
<image class="fr icons_scan_close" src="/static/icons/icons_scan_close.svg" @click="closeScanPopup()"> </image>
</view>
</view>
<view class="uni-flex uni-row" style="align-items: center; background-color: #fff; margin-left: 20rpx; margin-right: 20rpx; margin-top: 8rpx; border-radius: 8rpx">
<!--<view class="uni-flex uni-row" style="align-items: center; background-color: #fff; margin-left: 20rpx; margin-right: 20rpx; margin-top: 8rpx; border-radius: 8rpx">
<view class="uni-center" style="width: 25%; font-size: 35rpx"> 来源库位 </view>
<view class="" style="width: 75%; padding: 8rpx">
<uni-combox class="my-combox" :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请选择库位" @confirm="fromLocationUpdate" :inputStyle="inputStyleObject"></uni-combox>
</view>
</view>
</view>!-->
<view class="">
<view class="">
@ -147,7 +147,7 @@ const initData = () => {
fromInventoryStatuses.value = jobContent.value.outInventoryStatuses
toLocation.value = dataContent.value[0]
toLocationCode.value = dataContent.value[0].toLocationCode
fromLocationList.value = getFromLocationList()
// fromLocationList.value = getFromLocationList()
}
}
@ -155,24 +155,24 @@ const showBalanceSelect = (items) => {
balanceSelectRef.value.openPopup(items)
}
const getFromLocationList = () => {
let list = []
dataContent.value.forEach((location) => {
location.Items.forEach((item) => {
item.Locations.forEach((f) => {
const item = list.find((l) => l == f.fromLocationCode)
if (item == undefined) {
list.push(f.fromLocationCode)
}
})
})
})
//
list = uniqueArray(list)
fromLocationCode.value = list[0]
return list
}
// const getFromLocationList = () => {
// let list = []
// dataContent.value.forEach((location) => {
// location.Items.forEach((item) => {
// item.Locations.forEach((f) => {
// const item = list.find((l) => l == f.fromLocationCode)
// if (item == undefined) {
// list.push(f.fromLocationCode)
// }
// })
// })
// })
//
// //
// list = uniqueArray(list)
// fromLocationCode.value = list[0]
// return list
// }
const fromLocationUpdate = (fromlocation) => {
const location = fromLocationList.value.find((r) => r == fromlocation)
@ -183,12 +183,12 @@ const fromLocationUpdate = (fromlocation) => {
}
const onScanResult = (result) => {
try {
if (fromLocationCode.value == '') {
showErrorMessage('请选择来源库位', (res) => {
toLocationCombox.value.onFocus()
})
return
}
// if (fromLocationCode.value == '') {
// showErrorMessage('', (res) => {
// toLocationCombox.value.onFocus()
// })
// return
// }
const packageInfoParams = result.package
const { itemCode } = result.label
const packingCode = result.label.packingNumber
@ -384,51 +384,7 @@ const onScan = (result) => {
}
}
}
const onScanResult1 = (result) => {
try {
if (fromLocationCode.value == '') {
showErrorMessage('请选择来源库位', (res) => {
toLocationCombox.value.onFocus()
})
return
}
label.value = result.package
// let packageInfo = result.package;
const { itemCode } = result.label
const packingCode = result.label.packingNumber
const lot = result.label.batch
const item = toLocation.value.Items.find((r) => r.itemCode == itemCode)
if (item == undefined) {
showErrorMessage(`未查找到物料【${itemCode}】的发料明细`, (res) => {
getfocus()
})
return
}
//
proxy.$modal.loading('加载中')
getBalanceByManagementPrecision(result.label, fromLocationCode.value, fromInventoryStatuses.value, (balanceRes) => {
if (balanceRes.success) {
if (balanceRes.data.list.length == 0) {
showErrorMessage(`在来源库位[${fromLocationCode.value}],未查找到该包装的库存记录`, (res) => {
packGetFocus()
})
} else if (balanceRes.data.list.length == 1) {
const balance = balanceRes.data.list[0]
afterGetBalance(result.label, balance, packageInfo.value)
} else {
showBalanceSelect(balanceRes.data.list)
}
} else {
showErrorMessage(balanceRes.message)
}
uni.hideLoading()
})
} catch (e) {
showErrorMessage(e.stack)
uni.hideLoading()
}
}
const selectBalanceItem = (balance) => {
afterGetBalance(label.value, balance, packageInfo.value)
@ -440,6 +396,7 @@ const afterGetBalance = (label, balance, packageInfo) => {
const packingCode = label.packingNumber
const lot = label.batch
const item = toLocation.value.Items.find((r) => r.itemCode == itemCode)
fromLocationCode.value = balance.locationCode;
const fromLocation = item.Locations.find((l) => l.fromLocationCode == fromLocationCode.value)
if (fromLocation != undefined) {
const batch = fromLocation.Batchs.find((r) => r.batch == lot)
@ -492,9 +449,11 @@ const afterGetBalance = (label, balance, packageInfo) => {
})
}
} else {
showErrorMessage(`未查找到推荐库位【${fromLocationCode.value}】的发料明细`, (res) => {
getfocus()
})
let locaion = createLocationInfo(label, balance, packageInfo);
item.Locations.push(locaion);
// showErrorMessage(`${fromLocationCode.value}`, (res) => {
// getfocus()
// })
}
} catch (e) {
showErrorMessage(e.stack, (res) => {
@ -502,6 +461,20 @@ const afterGetBalance = (label, balance, packageInfo) => {
})
}
}
//
const createLocationInfo = (label, balance, packageInfo)=> {
let location = {
fromLocationCode: balance.locationCode,
qty: balance.qty,
uom: balance.uom,
handleQty: 0,
Batchs: []
}
let batch = createBatchInfo(label, balance, packageInfo);
batch.detail = balance;
location.Batchs.push(batch);
return location;
}
const createBatchInfo = (data, balance, packageInfo) => {
const batch = {

Loading…
Cancel
Save