|
|
@ -46,7 +46,9 @@ import { getProductRecycleDetail, productRecycleJobsubmit, cancleTakeProductRecy |
|
|
|
|
|
|
|
import { goHome, getCurrDateTime, getPackingNumberAndBatch, navigateBack } from '@/common/basic.js' |
|
|
|
import { getInventoryStatusName } from '@/common/directory.js' |
|
|
|
|
|
|
|
import { |
|
|
|
calc |
|
|
|
} from '@/common/calc' |
|
|
|
import { getDataSource, createRecordInfo, calcHandleQty, getScanCount } from '@/common/detail.js' |
|
|
|
|
|
|
|
import { getManagementPrecisions } from '@/common/balance.js' |
|
|
@ -76,6 +78,7 @@ const comMessageRef = ref() |
|
|
|
const jobDetailPopup = ref() |
|
|
|
const fromLocationCode = ref() |
|
|
|
const toLocationAreaTypeList = ref([]) |
|
|
|
const labelInfo = ref({}) |
|
|
|
onLoad((option) => { |
|
|
|
uni.setNavigationBarTitle({ |
|
|
|
title: `${option.title}详情` |
|
|
@ -162,8 +165,9 @@ const getDetail = () => { |
|
|
|
getManagementPrecisions(itemCodes, fromLocationCode.value, res => { |
|
|
|
if (res.success) { |
|
|
|
managementList.value = res.list; |
|
|
|
managementType.value = managementList.value.some(item => item.ManagementPrecision == |
|
|
|
'BY_BATCH') ? 'BY_BATCH' : '' |
|
|
|
managementType.value = managementList.value && |
|
|
|
managementList.value[0] && |
|
|
|
managementList.value[0].ManagementPrecision?managementList.value[0].ManagementPrecision:'BY_PACKAGING' |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
@ -202,8 +206,16 @@ const calcScanCount = (closeScan) => { |
|
|
|
const updateData = () => { |
|
|
|
calcHandleQty1() |
|
|
|
} |
|
|
|
|
|
|
|
const getScanResult = (result) => { |
|
|
|
const getScanResult = (result)=> { |
|
|
|
console.log(result.label) |
|
|
|
labelInfo.value = result.label |
|
|
|
if(managementType.value == 'BY_BATCH' ||managementType.value == "BY_QUANTITY" ){ |
|
|
|
getScanResultAfterBatch(result) |
|
|
|
}else{ |
|
|
|
getScanResultAfter(result) |
|
|
|
} |
|
|
|
} |
|
|
|
const getScanResultAfter = (result) => { |
|
|
|
try { |
|
|
|
const { packingNumber } = result.label |
|
|
|
const { batch } = result.label |
|
|
@ -275,6 +287,105 @@ const getScanResult = (result) => { |
|
|
|
showErrorMessage(e.message) |
|
|
|
} |
|
|
|
} |
|
|
|
const getScanResultAfterBatch = (result)=> { |
|
|
|
try { |
|
|
|
const packingNumber = result.label.packingNumber; |
|
|
|
const batch = result.label.batch; |
|
|
|
const qty = result.label.qty; |
|
|
|
const itemCode = result.label.itemCode; |
|
|
|
let itemDetail = undefined; |
|
|
|
const detail = detailSource.value.find(r => r.itemCode == itemCode); |
|
|
|
if (detail == undefined) { |
|
|
|
showMessage("物料号【" + itemCode + "】不在列表中") |
|
|
|
} else { |
|
|
|
detail.scaned = true |
|
|
|
let balanceStatus = getInventoryStatusName(result.balance.inventoryStatus); |
|
|
|
//箱码、批次、库位、状态 都相等 |
|
|
|
itemDetail = detail.subList.find(r => { |
|
|
|
return r.batch == batch && |
|
|
|
r.fromLocationCode == result.fromLocationCode && |
|
|
|
r.inventoryStatus == result.balance.inventoryStatus |
|
|
|
}) |
|
|
|
if (itemDetail) { |
|
|
|
// 箱码、批次、库位、状态一致 |
|
|
|
if (itemDetail.scaned) { |
|
|
|
// this.showErrorMessage("\n批次【" + batch + "】\n库位【" + result |
|
|
|
// .fromLocationCode + "】\n状态【" + balanceStatus + "】\n已经扫描") |
|
|
|
itemDetail.handleQty = calc.add(itemDetail.handleQty,Number(result.label.qty)); |
|
|
|
itemDetail.balanceQty = Number(result.label.qty); |
|
|
|
} else { |
|
|
|
itemDetail.scaned = true; |
|
|
|
itemDetail.handleQty = Number(result.label.qty); |
|
|
|
itemDetail.balanceQty = Number(result.label.qty); |
|
|
|
itemDetail.toInventoryStatus = result.balance.inventoryStatus; |
|
|
|
itemDetail.inventoryStatus = result.balance.inventoryStatus; |
|
|
|
itemDetail.balance = result.balance; |
|
|
|
itemDetail.balance.balanceQty = Number(result.balance.qty); |
|
|
|
itemDetail.balance.packQty = Number(result.package.packQty) |
|
|
|
itemDetail.balance.packUnit = result.package.packUnit |
|
|
|
} |
|
|
|
calcHandleQty(); |
|
|
|
} else { |
|
|
|
//箱码、批次、库位相等 |
|
|
|
itemDetail = detail.subList.find(r => { |
|
|
|
return r.batch == batch && |
|
|
|
r.fromLocationCode == result.fromLocationCode |
|
|
|
}) |
|
|
|
|
|
|
|
if (itemDetail) { |
|
|
|
let itemStatus = getInventoryStatusName(itemDetail.inventoryStatus); |
|
|
|
//箱码、批次、库位相等,状态不相等 |
|
|
|
if(balanceStatus!=itemStatus){ |
|
|
|
if (jobContent.value.allowModifyInventoryStatus == "TRUE") { |
|
|
|
showQuestionMessage('实际库存状态[' + balanceStatus + ']与推荐库存状态[' + itemStatus + |
|
|
|
']不一致,是否继续回收?', res => { |
|
|
|
if (res) { |
|
|
|
itemDetail.scaned = true; |
|
|
|
itemDetail.handleQty = itemDetail.handleQty ? calc.add(itemDetail.handleQty,Number(result.label.qty)) : Number(result.label.qty); |
|
|
|
itemDetail.toInventoryStatus = result.balance.inventoryStatus; |
|
|
|
itemDetail.inventoryStatus = result.balance.inventoryStatus; |
|
|
|
itemDetail.balance = result.balance; |
|
|
|
itemDetail.balance.balanceQty = result.balance.qty; |
|
|
|
itemDetail.balance.packQty = result.package.packQty |
|
|
|
itemDetail.balance.packUnit = result.package.packUnit |
|
|
|
calcHandleQty(); |
|
|
|
} else { |
|
|
|
scanPopupGetFocus(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} else { |
|
|
|
showQuestionMessage('任务中不允许修改库存状态,实际库存状态[' + balanceStatus + ']与推荐库存状态[' + |
|
|
|
itemStatus + |
|
|
|
']不一致,不允许回收!', res => { |
|
|
|
scanPopupGetFocus(); |
|
|
|
}); |
|
|
|
} |
|
|
|
//箱码、批次、库位相等,状态相等 |
|
|
|
}else{ |
|
|
|
itemDetail.scaned = true; |
|
|
|
itemDetail.handleQty = itemDetail.handleQty ? calc.add(itemDetail.handleQty,Number(result.label.qty)) : Number(result.label.qty); |
|
|
|
itemDetail.toInventoryStatus = result.balance.inventoryStatus; |
|
|
|
itemDetail.inventoryStatus = result.balance.inventoryStatus; |
|
|
|
itemDetail.balance = result.balance; |
|
|
|
itemDetail.balance.balanceQty = result.balance.qty; |
|
|
|
itemDetail.balance.packQty = result.package.packQty |
|
|
|
itemDetail.balance.packUnit = result.package.packUnit |
|
|
|
calcHandleQty(); |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
showErrorMessage("\n批次【" + batch + "】\n库位【" + result |
|
|
|
.fromLocationCode + "】\n状态【" + balanceStatus + "】\n不在任务列表中") |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
scanPopupGetFocus(); |
|
|
|
} catch (e) { |
|
|
|
showErrorMessage(e.message); |
|
|
|
} |
|
|
|
} |
|
|
|
const commit = () => { |
|
|
|
scanCount.value = getScanCount(subList.value) |
|
|
|
if (scanCount.value == 0) { |
|
|
@ -284,12 +395,20 @@ const commit = () => { |
|
|
|
// //允许部分提交 |
|
|
|
// //扫描数量和任务数量相等,直接提交 |
|
|
|
if (scanCount.value == subList.value.length) { |
|
|
|
checkCount(); |
|
|
|
if(managementType.value == 'BY_BATCH' ||managementType.value == "BY_QUANTITY" ){ |
|
|
|
checkCountBatch() |
|
|
|
}else{ |
|
|
|
checkCount(); |
|
|
|
} |
|
|
|
} else if (scanCount.value < subList.value.length) { |
|
|
|
//扫描数量小于任务数量,判断是否允许部分提交 |
|
|
|
if (jobContent.value.allowPartialComplete == "TRUE") { |
|
|
|
//提交 |
|
|
|
checkCount(); |
|
|
|
if(managementType.value == 'BY_BATCH' ||managementType.value == "BY_QUANTITY" ){ |
|
|
|
checkCountBatch() |
|
|
|
}else{ |
|
|
|
checkCount(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
//不允许部分提交,提示 |
|
|
|
comMessageRef.value.showErrorMessage("任务明细未全部完成,不允许部分提交!", res => { |
|
|
@ -327,6 +446,41 @@ const checkCount = ()=>{ |
|
|
|
submitJob() |
|
|
|
} |
|
|
|
} |
|
|
|
const checkCountBatch = ()=> { |
|
|
|
// 提交的数量和任务数量不一致提示 |
|
|
|
let str = '' |
|
|
|
let str1 = '' |
|
|
|
detailSource.value.forEach((item) => { |
|
|
|
item.subList.forEach(cur => { |
|
|
|
if (cur.qty != cur.handleQty) { |
|
|
|
let tempHandleQty = 0 |
|
|
|
if(cur.handleQty){ |
|
|
|
tempHandleQty=cur.handleQty |
|
|
|
}else { |
|
|
|
tempHandleQty =0 |
|
|
|
} |
|
|
|
str += `物料号【${item.itemCode}】提交数量【${tempHandleQty}】与任务物料数量【${cur.qty}】不一致` |
|
|
|
} |
|
|
|
if(cur.handleQty > cur.balance.qty){ |
|
|
|
str1 += `物料号【${item.itemCode}】提交数量【${cur.handleQty}】不可以大于库存数量【${cur.balance.qty}】` |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
if (str1) { |
|
|
|
comMessageRef.value.showMessage(str1); |
|
|
|
return |
|
|
|
} |
|
|
|
if (str) { |
|
|
|
str = '任务明细未全部完成,是否提交?\n'+ str |
|
|
|
comMessageRef.value.showQuestionMessage1(str, 'red', res => { |
|
|
|
if (res) { |
|
|
|
this.submitJob() |
|
|
|
} |
|
|
|
}); |
|
|
|
} else { |
|
|
|
submitJob() |
|
|
|
} |
|
|
|
} |
|
|
|
const submitJob = () => { |
|
|
|
proxy.$modal.loading('提交中...') |
|
|
|
let itemCodes = [] |
|
|
@ -368,7 +522,7 @@ const setParams = () => { |
|
|
|
let info = getPackingNumberAndBatch(this.managementList, detail.itemCode, detail.packingNumber, detail.batch); |
|
|
|
detail.toPackingNumber = info.packingNumber; |
|
|
|
detail.packingNumber = info.packingNumber; |
|
|
|
detail.fromPackingNumber = info.packingNumber; |
|
|
|
detail.fromPackingNumber = labelInfo.value.packingNumber; |
|
|
|
subList.push(detail) |
|
|
|
} |
|
|
|
}) |
|
|
|