Browse Source

修改补料任务的推荐 2024/8/7

hella_vue3
王志国 4 weeks ago
parent
commit
944073e0aa
  1. 3
      src/pages/repleinsh/coms/comRepleishDetailCard.vue
  2. 388
      src/pages/repleinsh/coms/comScanReplishPack.vue
  3. 2
      src/pages/repleinsh/job/repleinshDetail.vue
  4. 2
      src/pages/repleinsh/job/repleinshJob.vue

3
src/pages/repleinsh/coms/comRepleishDetailCard.vue

@ -26,7 +26,8 @@
<text class="card_packing_code card_content">外包装</text> <text class="card_packing_code card_content">外包装</text>
<text class="card_content">{{ record.parentPackingNumber }}</text> <text class="card_content">{{ record.parentPackingNumber }}</text>
</view> --> </view> -->
<handle-balance :detail="record" :isShowLocation="false" :isShowBatch="batch.packingNumber != null" :isShowStatus="true"> </handle-balance> <handle-balance :detail="record" :isShowLocation="false" :isShowStatus='true'></handle-balance>
<!-- <handle-balance :detail="record" :isShowLocation="false" :isShowBatch="batch.packingNumber != null" :isShowStatus="true"> </handle-balance>-->
</u-swipe-action> </u-swipe-action>
</view> </view>
</view> </view>

388
src/pages/repleinsh/coms/comScanReplishPack.vue

@ -8,12 +8,12 @@
<text class="fr" @click="closeScanPopup()">关闭</text> <text class="fr" @click="closeScanPopup()">关闭</text>
</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%"> 来源库位 </view> <!-- <view class="uni-center" style="width: 25%"> 来源库位 </view>-->
<view class="" style="width: 75%; padding: 8rpx"> <!-- <view class="" style="width: 75%; padding: 8rpx">-->
<uni-combox :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请选择库位" @confirm="fromLocationUpdate"></uni-combox> <!-- <uni-combox :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请选择库位" @confirm="fromLocationUpdate"></uni-combox>-->
</view> <!-- </view>-->
</view> <!-- </view>-->
<view class=""> <view class="">
<view class=""> <view class="">
@ -56,13 +56,13 @@ import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue'
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' import balanceSelect from '@/mycomponents/balance/balanceSelect.vue'
import { getDetailOption, getDetailEditRemoveOption, getDetailGiveupOption } from '@/common/array.js' import { getDetailOption, getDetailEditRemoveOption, getDetailGiveupOption } from '@/common/array.js'
import { getWorkShopLineStation, getBalanceByFilter } from '@/api/request2.js' import { getWorkShopLineStation, getBalanceByFilter, getBalanceByParams } from '@/api/request2.js'
import { calc } from '@/common/calc.js' import { calc } from '@/common/calc.js'
import { uniqueArray } from '@/common/basic.js' import { uniqueArray } from '@/common/basic.js'
import { getBalanceByManagementPrecision } from '@/common/balance.js' import { getBalanceByManagementPrecision } from '@/common/balance.js'
import { getDirectoryItemArray } from '../../../common/directory.js' import { getDirectoryItemArray,getInventoryStatusDesc,getListLocationAreaTypeDesc } from '../../../common/directory.js'
import { getLabelInfo } from '@/common/label.js' import { getLabelInfo } from '@/common/label.js'
const props = defineProps({ const props = defineProps({
@ -137,7 +137,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()
} }
} }
@ -145,27 +145,27 @@ const showBalanceSelect = (items) => {
balanceSelectRef.value.openPopup(items) balanceSelectRef.value.openPopup(items)
} }
const getFromLocationList = () => { // const getFromLocationList = () => {
const list = [] // let list = []
const location = dataContent.value.find((r) => r.toLocationCode == toLocationCode.value) // const location = dataContent.value.find((r) => r.toLocationCode == toLocationCode.value)
if (location != undefined) { // if (location != undefined) {
location.Items.forEach((item) => { // location.Items.forEach((item) => {
item.Locations.forEach((f) => { // item.Locations.forEach((f) => {
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
} // }
comMessageRef.value.showErrorMessages(`需求库位【${toLocationCode.value}】不存在`, (res) => { // comMessageRef.value.showErrorMessages(`${toLocationCode.value}`, (res) => {
if (res) { // if (res) {
scanMsg.value = '' // scanMsg.value = ''
getfocus() // getfocus()
} // }
}) // })
} // }
const fromLocationUpdate = (fromlocation) => { const fromLocationUpdate = (fromlocation) => {
const location = fromLocationList.value.find((r) => r == fromlocation) const location = fromLocationList.value.find((r) => r == fromlocation)
@ -174,15 +174,41 @@ const fromLocationUpdate = (fromlocation) => {
showErrorMessage(`发料库位【${fromlocation}】不存在`) showErrorMessage(`发料库位【${fromlocation}】不存在`)
} }
} }
const onScan = (result)=> {
const onScan = (result) => { if (!result.package) {
try { this.showErrorMessage('扫描数据错误[' + result.label.code + "]",
if (fromLocationCode.value == '') { res => {
showErrorMessage('请选择来源库位', (res) => { getfocus();
toLocationCombox.value.onFocus() }
}) )
return;
}
if (toLocation.value && result.package.packUnit) {
let item = toLocation.value.Items.find(r => r.itemCode == result.package.itemCode);
if (!item) {
showErrorMessage('扫描物料代码不属于该任务');
return return
} }
if (result.package.packUnit !== item.packUnit) {
comMessageRef.value.showQuestionMessage(
`扫描物料包装【${result.package.packUnit}】与任务推荐包装规格【${item.packUnit}】不一致.是否要继续发料?`, res => {
if (res) {
onScanResult(result)
}
});
} else {
onScanResult(result)
}
}
}
const onScanResult = (result) => {
try {
// if (fromLocationCode.value == '') {
// showErrorMessage('', (res) => {
// toLocationCombox.value.onFocus()
// })
// 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
@ -194,129 +220,168 @@ const onScan = (result) => {
}) })
return return
} }
var params = {
itemCode: result.package.itemCode,
batch: result.label.batch,
packingNumber: result.label.packingNumber,
parentPackingNumber: result.package.parentNumber,
inventoryStatus: jobContent.value.outInventoryStatuses.split(','),
areaType: jobContent.value.fromAreaTypes.split(','),
bussinessCode: jobContent.value.businessType
}
// //
uni.showLoading({ uni.showLoading({
title: '加载中', title: '查询中',
mask: true mask: true
}) })
getBalanceByParams(params).then(res => {
getBalance(result.label, packageInfoParams, (balances) => { if (res.data.length == 0) {
packageInfo.value = packageInfoParams let status = getInventoryStatusDesc(params.inventoryStatus)
// let areaType = getListLocationAreaTypeDesc(params.areaType)
const s = '' let hint =
if (!result.package.parentNumber) { "按物料号 [" + params.itemCode + "] <br>" +
if (balances.list.length == 0) { "包装号 [" + params.packingNumber + "] <br>" +
showErrorMessage('未查找到该包装的库存信息,请重新扫描') "批次 [" + params.batch + "] <br>" +
} else { "状态 [" + status + "] <br>" +
const newBalances = balances.list.filter((b) => b.locationCode == that.fromLocationCode) "库区 [" + areaType + "] <br>" +
if (newBalances.length == 0) { "未查找到库存余额"
showErrorMessage('未查找到该包装的库存信息,请重新扫描') showErrorMessage(hint)
} else if (newBalances.length == 1) { } else if (res.data.length == 1) {
const balance1 = newBalances[0] result.balance = res.data[0]
afterGetBalance(result.label, balance1, packageInfoParams)
} else { if (result.label.packingNumber != result.balance.packingNumber) {
showBalanceSelect(newBalances) result.balance.handleQty = Number(result.label.qty)
}
}
} else {
//
if (balances.list.length == 0) {
showErrorMessage('未查找到该包装的库存信息,请重新扫描')
} else {
//
const subPackitems = balances.list.filter((r) => r.packingNumber == packageInfoParams.number)
//
const subParentPackitems = balances.list.filter((r) => r.packingNumber == packageInfoParams.parentNumber && r.locationCode == fromLocationCode.value)
//
if (subPackitems.length == 0) {
//
if (subParentPackitems.length > 0) {
if (subParentPackitems.length == 1) {
const balance = subParentPackitems[0]
balance.qty = packageInfoParams.qty
afterGetBalance(result.label, balance, packageInfoParams)
} else { } else {
showBalanceSelect(subParentPackitems) result.balance.handleQty = Number(result.balance.qty)
} }
afterGetBalance(result.label, result.balance, result.package);
} else { } else {
showErrorMessage(`按外包装【${packageInfoParams.parentNumber}】和子包装【${packageInfoParams.number}】都未查找到库存余额`) //
} balanceSelectRef.value.openPopup(res.data);
} else {
let locationCode = fromLocationCode.value
if (balances.list == 1) {
locationCode = balances.list[0].locationCode
} else {
const manyBlances = balances.list.filter((r) => r.locationCode != fromLocationCode.value)
if (manyBlances.length > 0) {
locationCode = manyBlances[0].locationCode
}
}
showErrorMessage(`该包装【${packageInfoParams.number}】在库位【${locationCode}】已经有库存余额,请重新扫描`)
}
}
} }
uni.hideLoading() uni.hideLoading()
}) }).catch(error => {
uni.hideLoading()
showErrorMessage(error)
})
// getBalance(result.label, packageInfoParams, (balances) => {
// packageInfo.value = packageInfoParams
// //
// const s = ''
// if (!result.package.parentNumber) {
// if (balances.list.length == 0) {
// showErrorMessage(',')
// } else {
// const newBalances = balances.list.filter((b) => b.locationCode == that.fromLocationCode)
// if (newBalances.length == 0) {
// showErrorMessage(',')
// } else if (newBalances.length == 1) {
// const balance1 = newBalances[0]
// afterGetBalance(result.label, balance1, packageInfoParams)
// } else {
// showBalanceSelect(newBalances)
// }
// }
// } else {
// //
// if (balances.list.length == 0) {
// showErrorMessage(',')
// } else {
// //
// const subPackitems = balances.list.filter((r) => r.packingNumber == packageInfoParams.number)
// //
// const subParentPackitems = balances.list.filter((r) => r.packingNumber == packageInfoParams.parentNumber && r.locationCode == fromLocationCode.value)
//
// //
// if (subPackitems.length == 0) {
// //
//
// if (subParentPackitems.length > 0) {
// if (subParentPackitems.length == 1) {
// const balance = subParentPackitems[0]
// balance.qty = packageInfoParams.qty
// afterGetBalance(result.label, balance, packageInfoParams)
// } else {
// showBalanceSelect(subParentPackitems)
// }
// } else {
// showErrorMessage(`${packageInfoParams.parentNumber}${packageInfoParams.number}`)
// }
// } else {
// let locationCode = fromLocationCode.value
// if (balances.list == 1) {
// locationCode = balances.list[0].locationCode
// } else {
// const manyBlances = balances.list.filter((r) => r.locationCode != fromLocationCode.value)
// if (manyBlances.length > 0) {
// locationCode = manyBlances[0].locationCode
// }
// }
// showErrorMessage(`${packageInfoParams.number}${locationCode},`)
// }
// }
// }
// uni.hideLoading()
// })
} catch (e) { } catch (e) {
showErrorMessage(e.stack) showErrorMessage(e.stack)
uni.hideLoading() uni.hideLoading()
} }
} }
const getBalance = (labelParams, packageInfo, callback) => { // const getBalance = (labelParams, packageInfo, callback) => {
const filters = [] // const filters = []
if (packageInfo.parentNumber) { // if (packageInfo.parentNumber) {
const packingNumber = `${packageInfo.parentNumber},${labelParams.packingNumber}` // const packingNumber = `${packageInfo.parentNumber},${labelParams.packingNumber}`
filters.push({ // filters.push({
column: 'packingNumber', // column: 'packingNumber',
action: 'in', // action: 'in',
value: packingNumber // value: packingNumber
}) // })
} else { // } else {
filters.push({ // filters.push({
column: 'packingNumber', // column: 'packingNumber',
action: '==', // action: '==',
value: labelParams.packingNumber // value: labelParams.packingNumber
}) // })
} // }
filters.push({ // filters.push({
column: 'packingNumber', // column: 'packingNumber',
action: '==', // action: '==',
value: labelParams.packingNumber // value: labelParams.packingNumber
}) // })
filters.push({ // filters.push({
column: 'itemCode', // column: 'itemCode',
action: '==', // action: '==',
value: labelParams.itemCode // value: labelParams.itemCode
}) // })
filters.push({ // filters.push({
column: 'batch', // column: 'batch',
action: '==', // action: '==',
value: labelParams.batch // value: labelParams.batch
}) // })
//
if (fromInventoryStatuses.value != null && fromInventoryStatuses.value != '') { // if (fromInventoryStatuses.value != null && fromInventoryStatuses.value != '') {
filters.push({ // filters.push({
column: 'inventoryStatus', // column: 'inventoryStatus',
action: 'in', // action: 'in',
value: fromInventoryStatuses.value // value: fromInventoryStatuses.value
}) // })
} // }
//
const params = { // const params = {
filters, // filters,
pageNo: 1, // pageNo: 1,
pageSize: 100 // pageSize: 100
} // }
getBalanceByFilter(params) // getBalanceByFilter(params)
.then((res) => { // .then((res) => {
callback(res.data) // callback(res.data)
}) // })
.catch((err) => { // .catch((err) => {
showErrorMessage(err.message) // showErrorMessage(err.message)
}) // })
} // }
const selectBalanceItem = (balanceParams) => { const selectBalanceItem = (balanceParams) => {
afterGetBalance(label.value, balanceParams, packageInfo.value) afterGetBalance(label.value, balanceParams, packageInfo.value)
@ -328,7 +393,9 @@ const afterGetBalance = (labelParams, balanceParams, packageInfo) => {
const packingCode = labelParams.packingNumber const packingCode = labelParams.packingNumber
const lot = labelParams.batch const lot = labelParams.batch
const item = toLocation.value.Items.find((r) => r.itemCode == itemCode) const item = toLocation.value.Items.find((r) => r.itemCode == itemCode)
fromLocationCode.value = balanceParams.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)
if (batch != undefined) { if (batch != undefined) {
@ -377,9 +444,11 @@ const afterGetBalance = (labelParams, balanceParams, packageInfo) => {
}) })
} }
} else { } else {
showErrorMessage(`未查找到推荐库位【${fromLocationCode.value}】的发料明细`, (res) => { let locaion = createLocationInfo(labelParams, balanceParams, packageInfo);
getfocus() item.Locations.push(locaion);
}) // showErrorMessage(`${fromLocationCode.value}`, (res) => {
// getfocus()
// })
} }
} catch (e) { } catch (e) {
showErrorMessage(e.stack, (res) => { showErrorMessage(e.stack, (res) => {
@ -387,7 +456,20 @@ const afterGetBalance = (labelParams, balanceParams, packageInfo) => {
}) })
} }
} }
//
const createLocationInfo = (labelParams, balanceParams, packageInfo)=> {
let location = {
fromLocationCode: balanceParams.locationCode,
qty: balanceParams.qty,
uom: balanceParams.uom,
handleQty: 0,
Batchs: []
}
let batch = createBatchInfo(labelParams, balanceParams, packageInfo);
batch.detail = balanceParams;
location.Batchs.push(batch);
return location;
}
const createBatchInfo = (labelParams, balanceParams, packageInfo) => { const createBatchInfo = (labelParams, balanceParams, packageInfo) => {
const batch = { const batch = {
batch: labelParams.batch, batch: labelParams.batch,
@ -396,11 +478,11 @@ const createBatchInfo = (labelParams, balanceParams, packageInfo) => {
Records: [] Records: []
} }
let record = {} let record = {}
if (balanceParams == null) { if (balanceParams != null) {
record = creatRecordByBalance(labelParams, packageInfo) record = creatRecordByBalance(balanceParams, packageInfo)
batch.handleQty = Number(labelParams.qty) batch.handleQty = Number(labelParams.qty)
} else { } else {
record = creatRecordByLabel(balanceParams, packageInfo) record = creatRecordByLabel(labelParams, packageInfo)
batch.handleQty = Number(balanceParams.qty) batch.handleQty = Number(balanceParams.qty)
} }
batch.Records.push(record) batch.Records.push(record)

2
src/pages/repleinsh/job/repleinshDetail.vue

@ -241,7 +241,7 @@ const setSubmitParamsAndSubmit = () => {
const submitJob = () => { const submitJob = () => {
proxy.$modal.loading('提交中....') proxy.$modal.loading('提交中....')
const params = setParams() const params = setParams()
return;
repleinshJobSubmit(params) repleinshJobSubmit(params)
.then((res) => { .then((res) => {
uni.hideLoading() uni.hideLoading()

2
src/pages/repleinsh/job/repleinshJob.vue

@ -496,7 +496,7 @@ const getScanResult = (result) => {
selectItem(list[0]) selectItem(list[0])
} }
} else { } else {
showMessage(`物料号[${result.label.itemCode}]批次[${result.label.batch}]未查找到任务<br>` + `扫描[${result.scanMessage}]`) showMessage(`按来源库位[${balance.locationCode}]批次[${result.label.batch}]物料号[${result.label.itemCode}]未查找到任务<br>` + `扫描[${result.scanMessage}]`)
} }
}) })
.catch((error) => { .catch((error) => {

Loading…
Cancel
Save