Browse Source

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

hella_vue3
王志国 4 weeks 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> <image class="fr icons_scan_close" src="/static/icons/icons_scan_close.svg" @click="closeScanPopup()"> </image>
</view> </view>
</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="uni-center" style="width: 25%; font-size: 35rpx"> 来源库位 </view>
<view class="" style="width: 75%; padding: 8rpx"> <view class="" style="width: 75%; padding: 8rpx">
<uni-combox class="my-combox" :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请选择库位" @confirm="fromLocationUpdate" :inputStyle="inputStyleObject"></uni-combox> <uni-combox class="my-combox" :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请选择库位" @confirm="fromLocationUpdate" :inputStyle="inputStyleObject"></uni-combox>
</view> </view>
</view> </view>!-->
<view class=""> <view class="">
<view class=""> <view class="">
@ -147,7 +147,7 @@ const initData = () => {
fromInventoryStatuses.value = jobContent.value.outInventoryStatuses fromInventoryStatuses.value = jobContent.value.outInventoryStatuses
toLocation.value = dataContent.value[0] toLocation.value = dataContent.value[0]
toLocationCode.value = dataContent.value[0].toLocationCode toLocationCode.value = dataContent.value[0].toLocationCode
fromLocationList.value = getFromLocationList() // fromLocationList.value = getFromLocationList()
} }
} }
@ -155,24 +155,24 @@ const showBalanceSelect = (items) => {
balanceSelectRef.value.openPopup(items) balanceSelectRef.value.openPopup(items)
} }
const getFromLocationList = () => { // const getFromLocationList = () => {
let list = [] // let list = []
dataContent.value.forEach((location) => { // dataContent.value.forEach((location) => {
location.Items.forEach((item) => { // location.Items.forEach((item) => {
item.Locations.forEach((f) => { // item.Locations.forEach((f) => {
const item = list.find((l) => l == f.fromLocationCode) // const item = list.find((l) => l == f.fromLocationCode)
if (item == undefined) { // if (item == undefined) {
list.push(f.fromLocationCode) // list.push(f.fromLocationCode)
} // }
}) // })
}) // })
}) // })
//
// // //
list = uniqueArray(list) // list = uniqueArray(list)
fromLocationCode.value = list[0] // fromLocationCode.value = list[0]
return list // return list
} // }
const fromLocationUpdate = (fromlocation) => { const fromLocationUpdate = (fromlocation) => {
const location = fromLocationList.value.find((r) => r == fromlocation) const location = fromLocationList.value.find((r) => r == fromlocation)
@ -183,12 +183,12 @@ const fromLocationUpdate = (fromlocation) => {
} }
const onScanResult = (result) => { const onScanResult = (result) => {
try { try {
if (fromLocationCode.value == '') { // if (fromLocationCode.value == '') {
showErrorMessage('请选择来源库位', (res) => { // showErrorMessage('', (res) => {
toLocationCombox.value.onFocus() // toLocationCombox.value.onFocus()
}) // })
return // return
} // }
const packageInfoParams = result.package const packageInfoParams = result.package
const { itemCode } = result.label const { itemCode } = result.label
const packingCode = result.label.packingNumber 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) => { const selectBalanceItem = (balance) => {
afterGetBalance(label.value, balance, packageInfo.value) afterGetBalance(label.value, balance, packageInfo.value)
@ -440,6 +396,7 @@ const afterGetBalance = (label, balance, packageInfo) => {
const packingCode = label.packingNumber const packingCode = label.packingNumber
const lot = label.batch const lot = label.batch
const item = toLocation.value.Items.find((r) => r.itemCode == itemCode) const item = toLocation.value.Items.find((r) => r.itemCode == itemCode)
fromLocationCode.value = balance.locationCode;
const fromLocation = item.Locations.find((l) => l.fromLocationCode == fromLocationCode.value) const fromLocation = item.Locations.find((l) => l.fromLocationCode == fromLocationCode.value)
if (fromLocation != undefined) { if (fromLocation != undefined) {
const batch = fromLocation.Batchs.find((r) => r.batch == lot) const batch = fromLocation.Batchs.find((r) => r.batch == lot)
@ -492,9 +449,11 @@ const afterGetBalance = (label, balance, packageInfo) => {
}) })
} }
} else { } else {
showErrorMessage(`未查找到推荐库位【${fromLocationCode.value}】的发料明细`, (res) => { let locaion = createLocationInfo(label, balance, packageInfo);
getfocus() item.Locations.push(locaion);
}) // showErrorMessage(`${fromLocationCode.value}`, (res) => {
// getfocus()
// })
} }
} catch (e) { } catch (e) {
showErrorMessage(e.stack, (res) => { 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 createBatchInfo = (data, balance, packageInfo) => {
const batch = { const batch = {

Loading…
Cancel
Save