|
|
@ -1,7 +1,7 @@ |
|
|
|
<template> |
|
|
|
<view class="page-wraper"> |
|
|
|
<view class="page-header"> |
|
|
|
<view class="page-header-box"> |
|
|
|
<view class="header-view"> |
|
|
|
<view class="header_job_top"> |
|
|
|
<job-top :dataContent="jobContent"></job-top> |
|
|
|
</view> |
|
|
@ -46,7 +46,9 @@ import { ref, getCurrentInstance, nextTick } from 'vue' |
|
|
|
import { onLoad, onShow, onNavigationBarButtonTap, onReady, onBackPress, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app' |
|
|
|
import { getScrapJobDetail, takeScrapJob, cancleTakeScrapJob, scrapJobSubmit } from '@/api/request2.js' |
|
|
|
import { goHome, navigateBack, getPackingNumberAndBatch, getDirectoryItemArray, getInventoryStatusName } from '@/common/basic.js' |
|
|
|
|
|
|
|
import { |
|
|
|
calc |
|
|
|
} from '@/common/calc.js'; |
|
|
|
import { getManagementPrecisions } from '@/common/balance.js' |
|
|
|
|
|
|
|
import { getDataSource, calcHandleQty, getScanCount } from '@/common/detail.js' |
|
|
@ -75,6 +77,8 @@ const comMessageRef = ref() |
|
|
|
const scanPopup = ref() |
|
|
|
const managementType = ref('') |
|
|
|
const fromLocationCode = ref('') |
|
|
|
const managementPrecision = ref('') |
|
|
|
|
|
|
|
onLoad((option) => { |
|
|
|
uni.setNavigationBarTitle({ |
|
|
|
title: `${option.title}详情` |
|
|
@ -173,8 +177,128 @@ const getDetail = () => { |
|
|
|
showErrorMessage(error) |
|
|
|
}) |
|
|
|
} |
|
|
|
const getScanResult = (result,managementPrecisionParams)=> { |
|
|
|
managementPrecision.value = managementPrecisionParams |
|
|
|
if(managementPrecisionParams == 'BY_QUANTITY' || managementPrecisionParams == 'BY_BATCH'){ |
|
|
|
setDataBatch(result,managementPrecisionParams) |
|
|
|
}else{ |
|
|
|
setData(result,managementPrecisionParams) |
|
|
|
} |
|
|
|
} |
|
|
|
const setDataBatch = (result,managementPrecisionParams)=> { |
|
|
|
try { |
|
|
|
const { packingNumber } = result.balance |
|
|
|
const { batch } = result.balance |
|
|
|
const { qty } = result.balance |
|
|
|
const { itemCode } = result.balance |
|
|
|
const { locationCode } = result.balance |
|
|
|
const { inventoryStatus } = result.balance |
|
|
|
const detail = detailSource.value.find((r) => r.itemCode == itemCode) |
|
|
|
if (detail == undefined) { |
|
|
|
showErrorMessage("物料号【" + itemCode + "】不在列表中") |
|
|
|
} else { |
|
|
|
let itemDetail = {} |
|
|
|
if(managementPrecisionParams == 'BY_QUANTITY'){ |
|
|
|
itemDetail = detail.subList.find(r => { |
|
|
|
return r.fromlocationCode == result.fromlocationCode |
|
|
|
}) |
|
|
|
}else if(managementPrecisionParams == 'BY_BATCH'){ |
|
|
|
itemDetail = detail.subList.find(r => { |
|
|
|
return r.batch == batch&& r.fromlocationCode == result.fromlocationCode |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
if (itemDetail == undefined) { |
|
|
|
showErrorMessage("批次[" + (batch ? batch: '') + "]不在列表中") |
|
|
|
} else { |
|
|
|
if (itemDetail.scaned) { |
|
|
|
// this.showErrorMessage("箱码[" + packingNumber + "]" + "批次[" + batch + "]已经扫描") |
|
|
|
let balanceStatus = getInventoryStatusName(result.balance.inventoryStatus); |
|
|
|
let itemStatus = getInventoryStatusName(itemDetail.inventoryStatus); |
|
|
|
if (itemDetail.inventoryStatus != result.balance.inventoryStatus) { |
|
|
|
if (jobContent.value.allowModifyInventoryStatus == "TRUE") { |
|
|
|
scanPopupLoseFocus(); |
|
|
|
comMessageRef.value.showQuestionMessage('任务中允许修改库存状态,实际库存状态[' + balanceStatus + ']与推荐库存状态[' + |
|
|
|
itemStatus + |
|
|
|
']不一致,是否继续出库?', res => { |
|
|
|
if (res) { |
|
|
|
itemDetail.scaned = true; |
|
|
|
itemDetail.toInventoryStatus = 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 { |
|
|
|
scanPopupGetFocus(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} else { |
|
|
|
scanPopupLoseFocus(); |
|
|
|
comMessageRef.value.showQuestionMessage('任务中不允许修改库存状态,实际库存状态[' + balanceStatus + ']与推荐库存状态[' + |
|
|
|
itemStatus + |
|
|
|
']不一致,不允许转移!', res => { |
|
|
|
this.scanPopupGetFocus(); |
|
|
|
}); |
|
|
|
} |
|
|
|
} else { |
|
|
|
itemDetail.scaned = true; |
|
|
|
itemDetail.handleQty = calc.add(itemDetail.handleQty, Number(result.label.qty)); |
|
|
|
itemDetail.toInventoryStatus = 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 { |
|
|
|
let balanceStatus = getInventoryStatusName(result.balance.inventoryStatus); |
|
|
|
let itemStatus = getInventoryStatusName(itemDetail.inventoryStatus); |
|
|
|
if (itemDetail.inventoryStatus != result.balance.inventoryStatus) { |
|
|
|
if (jobContent.value.allowModifyInventoryStatus == "TRUE") { |
|
|
|
scanPopupLoseFocus(); |
|
|
|
comMessageRef.value.showQuestionMessage('任务中允许修改库存状态,实际库存状态[' + balanceStatus + ']与推荐库存状态[' + |
|
|
|
itemStatus + |
|
|
|
']不一致,是否继续出库?', res => { |
|
|
|
if (res) { |
|
|
|
itemDetail.scaned = true; |
|
|
|
itemDetail.toInventoryStatus = 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 { |
|
|
|
scanPopupGetFocus(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} else { |
|
|
|
scanPopupLoseFocus(); |
|
|
|
comMessageRef.value.showQuestionMessage('任务中不允许修改库存状态,实际库存状态[' + balanceStatus + ']与推荐库存状态[' + |
|
|
|
itemStatus + |
|
|
|
']不一致,不允许转移!', res => { |
|
|
|
scanPopupGetFocus(); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
const getScanResult = (result) => { |
|
|
|
} else { |
|
|
|
itemDetail.scaned = true; |
|
|
|
itemDetail.handleQty = Number(result.label.qty); |
|
|
|
itemDetail.toInventoryStatus = 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(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
showMessage(e.message) |
|
|
|
} |
|
|
|
} |
|
|
|
const setData = (result) => { |
|
|
|
try { |
|
|
|
const { packingNumber } = result.balance |
|
|
|
const { batch } = result.balance |
|
|
@ -186,7 +310,8 @@ const getScanResult = (result) => { |
|
|
|
|
|
|
|
if (detail == undefined) { |
|
|
|
showErrorMessage(`物料号【${itemCode}】不在列表中`) |
|
|
|
} else { |
|
|
|
} |
|
|
|
else { |
|
|
|
const itemDetail = detail.subList.find((r) => { |
|
|
|
return r.packingNumber == packingNumber && r.batch == batch |
|
|
|
}) |
|
|
@ -200,7 +325,7 @@ const getScanResult = (result) => { |
|
|
|
if (itemDetail.inventoryStatus != result.balance.inventoryStatus) { |
|
|
|
if (jobContent.value.allowModifyInventoryStatus == 'TRUE') { |
|
|
|
scanPopupLoseFocus() |
|
|
|
showQuestionMessage(`任务中允许修改库存状态,实际库存状态[${balanceStatus}]与推荐库存状态[${itemStatus}]不一致,是否继续出库?`, (res) => { |
|
|
|
comMessageRef.value.showQuestionMessage(`任务中允许修改库存状态,实际库存状态[${balanceStatus}]与推荐库存状态[${itemStatus}]不一致,是否继续出库?`, (res) => { |
|
|
|
if (res) { |
|
|
|
itemDetail.scaned = true |
|
|
|
itemDetail.handleQty = Number(result.balance.qty) |
|
|
@ -216,7 +341,7 @@ const getScanResult = (result) => { |
|
|
|
}) |
|
|
|
} else { |
|
|
|
scanPopupLoseFocus() |
|
|
|
showQuestionMessage(`任务中不允许修改库存状态,实际库存状态[${balanceStatus}]与推荐库存状态[${itemStatus}]不一致,不允许转移!`, (res) => { |
|
|
|
comMessageRef.value.showQuestionMessage(`任务中不允许修改库存状态,实际库存状态[${balanceStatus}]与推荐库存状态[${itemStatus}]不一致,不允许转移!`, (res) => { |
|
|
|
scanPopupGetFocus() |
|
|
|
}) |
|
|
|
} |
|
|
@ -264,12 +389,20 @@ const commit = () => { |
|
|
|
} |
|
|
|
// //扫描数量和任务数量相等,直接提交 |
|
|
|
if (scanCount.value == subList.value.length) { |
|
|
|
if(managementPrecision.value == 'BY_QUANTITY' || managementPrecision.value == 'BY_BATCH'){ |
|
|
|
checkCountBatch(); |
|
|
|
}else{ |
|
|
|
checkCount(); |
|
|
|
} |
|
|
|
} else if (scanCount.value < subList.value.length) { |
|
|
|
//扫描数量小于任务数量,判断是否允许部分提交 |
|
|
|
if (jobContent.value.allowPartialComplete == "TRUE") { |
|
|
|
//提交 |
|
|
|
if(managementPrecision.value == 'BY_QUANTITY' || managementPrecision.value == 'BY_BATCH'){ |
|
|
|
checkCountBatch(); |
|
|
|
}else{ |
|
|
|
checkCount(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
//不允许部分提交,提示 |
|
|
|
comMessageRef.value.showErrorMessage("任务明细未全部完成,不允许部分提交!", res => { |
|
|
@ -307,6 +440,42 @@ 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 += `批次【${cur.batch}】提交数量【${tempHandleQty}】与任务物料数量【${cur.qty}】不一致` |
|
|
|
} |
|
|
|
if(cur.handleQty > cur.balance.balanceQty){ |
|
|
|
str1 += `批次【${cur.batch}】提交数量【${ cur.balance.balanceQty}】不允许大于库存数量【${ cur.balance.balanceQty}】` |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
if(str1){ |
|
|
|
comMessageRef.value.showConfirmWarningModal(str1) |
|
|
|
return |
|
|
|
} |
|
|
|
if (str) { |
|
|
|
str = '任务明细未全部完成,是否提交?\n'+str |
|
|
|
comMessageRef.value.showQuestionMessage1(str, 'red', res => { |
|
|
|
if (res) { |
|
|
|
submitJob() |
|
|
|
} |
|
|
|
}); |
|
|
|
} else { |
|
|
|
submitJob() |
|
|
|
} |
|
|
|
} |
|
|
|
const submitJob = async () => { |
|
|
|
proxy.$modal.loading('提交中...') |
|
|
|
//获取管理模式,封装参数 |
|
|
|