|
|
@ -1,13 +1,14 @@ |
|
|
|
<template> |
|
|
|
<view class="page-wraper"> |
|
|
|
<view class="page-header"> |
|
|
|
<view class="header_job_top"> |
|
|
|
<view class="header-view"> |
|
|
|
<view class="header_job_top" > |
|
|
|
<job-top :dataContent="jobContent"></job-top> |
|
|
|
</view> |
|
|
|
<view class="header_item"> |
|
|
|
<view class="header_item" > |
|
|
|
申请单号 : {{jobContent.requestNumber}} |
|
|
|
</view> |
|
|
|
<view class='split_line'></view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="page-main"> |
|
|
@ -67,6 +68,10 @@ |
|
|
|
calcHandleQty, |
|
|
|
getScanCount |
|
|
|
} from '@/common/detail.js'; |
|
|
|
|
|
|
|
import { |
|
|
|
calc |
|
|
|
} from '@/common/calc.js'; |
|
|
|
|
|
|
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|
|
|
import winScanPack from '@/mycomponents/scan/winScanPack.vue' |
|
|
@ -208,7 +213,15 @@ |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getScanResult(result) { |
|
|
|
getScanResult(result,managementPrecisionParams) { |
|
|
|
this.managementPrecision = managementPrecisionParams |
|
|
|
if(managementPrecisionParams == 'BY_QUANTITY' || managementPrecisionParams == 'BY_BATCH'){ |
|
|
|
this.setDataBatch(result,managementPrecisionParams) |
|
|
|
}else{ |
|
|
|
this.setData(result,managementPrecisionParams) |
|
|
|
} |
|
|
|
}, |
|
|
|
setDataBatch(result,managementPrecisionParams){ |
|
|
|
try { |
|
|
|
var packingNumber = result.balance.packingNumber; |
|
|
|
var batch = result.balance.batch; |
|
|
@ -217,7 +230,123 @@ |
|
|
|
var locationCode = result.balance.locationCode; |
|
|
|
var inventoryStatus = result.balance.inventoryStatus; |
|
|
|
var detail = this.detailSource.find(r => r.itemCode == itemCode); |
|
|
|
|
|
|
|
|
|
|
|
if (detail == undefined) { |
|
|
|
this.showErrorMessage("物料号【" + itemCode + "】不在列表中") |
|
|
|
} else { |
|
|
|
var 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) { |
|
|
|
this.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 (this.jobContent.allowModifyInventoryStatus == "TRUE") { |
|
|
|
this.scanPopupLoseFocus(); |
|
|
|
this.$refs.comMessage.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 |
|
|
|
this.calcHandleQty(); |
|
|
|
} else { |
|
|
|
this.scanPopupGetFocus(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} else { |
|
|
|
this.scanPopupLoseFocus(); |
|
|
|
this.$refs.comMessage.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 |
|
|
|
this.calcHandleQty(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
let balanceStatus = getInventoryStatusName(result.balance.inventoryStatus); |
|
|
|
let itemStatus = getInventoryStatusName(itemDetail.inventoryStatus); |
|
|
|
if (itemDetail.inventoryStatus != result.balance.inventoryStatus) { |
|
|
|
if (this.jobContent.allowModifyInventoryStatus == "TRUE") { |
|
|
|
this.scanPopupLoseFocus(); |
|
|
|
this.$refs.comMessage.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 |
|
|
|
this.calcHandleQty(); |
|
|
|
} else { |
|
|
|
this.scanPopupGetFocus(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} else { |
|
|
|
this.scanPopupLoseFocus(); |
|
|
|
this.$refs.comMessage.showQuestionMessage('任务中不允许修改库存状态,实际库存状态[' + balanceStatus + ']与推荐库存状态[' + |
|
|
|
itemStatus + |
|
|
|
']不一致,不允许转移!', res => { |
|
|
|
this.scanPopupGetFocus(); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
} 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 |
|
|
|
this.calcHandleQty(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
this.showMessage(e.message) |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
setData(result){ |
|
|
|
try { |
|
|
|
var packingNumber = result.balance.packingNumber; |
|
|
|
var batch = result.balance.batch; |
|
|
|
var qty = result.balance.qty; |
|
|
|
var itemCode = result.balance.itemCode; |
|
|
|
var locationCode = result.balance.locationCode; |
|
|
|
var inventoryStatus = result.balance.inventoryStatus; |
|
|
|
var detail = this.detailSource.find(r => r.itemCode == itemCode); |
|
|
|
|
|
|
|
if (detail == undefined) { |
|
|
|
this.showErrorMessage("物料号【" + itemCode + "】不在列表中") |
|
|
|
} else { |
|
|
@ -259,7 +388,7 @@ |
|
|
|
this.scanPopupGetFocus(); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
itemDetail.scaned = true; |
|
|
|
itemDetail.handleQty = Number(result.label.qty); |
|
|
@ -278,7 +407,6 @@ |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//继续扫描 |
|
|
|
continueScan() { |
|
|
|
this.scanCount = getScanCount(this.subList); |
|
|
@ -302,7 +430,6 @@ |
|
|
|
|
|
|
|
|
|
|
|
commit() { |
|
|
|
|
|
|
|
this.scanCount = getScanCount(this.subList); |
|
|
|
if (this.scanCount == 0) { |
|
|
|
this.showErrorMessage("扫描数为0,请先扫描") |
|
|
@ -311,12 +438,20 @@ |
|
|
|
|
|
|
|
// //扫描数量和任务数量相等,直接提交 |
|
|
|
if (this.scanCount == this.subList.length) { |
|
|
|
this.checkCount(); |
|
|
|
if(this.managementPrecision == 'BY_QUANTITY' || this.managementPrecision == 'BY_BATCH'){ |
|
|
|
this.checkCountBatch(); |
|
|
|
}else{ |
|
|
|
this.checkCount(); |
|
|
|
} |
|
|
|
} else if (this.scanCount < this.subList.length) { |
|
|
|
//扫描数量小于任务数量,判断是否允许部分提交 |
|
|
|
if (this.jobContent.allowPartialComplete == "TRUE") { |
|
|
|
//提交 |
|
|
|
this.checkCount(); |
|
|
|
if(this.managementPrecision == 'BY_QUANTITY' || this.managementPrecision == 'BY_BATCH'){ |
|
|
|
this.checkCountBatch(); |
|
|
|
}else{ |
|
|
|
this.checkCount(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
//不允许部分提交,提示 |
|
|
|
this.$refs.comMessage.showErrorMessage("任务明细未全部完成,不允许部分提交!", res => { |
|
|
@ -355,6 +490,42 @@ |
|
|
|
this.submitJob() |
|
|
|
} |
|
|
|
}, |
|
|
|
checkCountBatch(){ |
|
|
|
// 提交的数量和任务数量不一致提示 |
|
|
|
let str = '' |
|
|
|
let str1 = '' |
|
|
|
this.detailSource.forEach((item) => { |
|
|
|
item.subList.forEach(cur => { |
|
|
|
if (cur.qty != cur.handleQty) { |
|
|
|
var 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){ |
|
|
|
this.$refs.comMessage.showConfirmWarningModal(str1) |
|
|
|
return |
|
|
|
} |
|
|
|
if (str) { |
|
|
|
str = '任务明细未全部完成,是否提交?\n'+str |
|
|
|
this.$refs.comMessage.showQuestionMessage1(str, 'red', res => { |
|
|
|
if (res) { |
|
|
|
this.submitJob() |
|
|
|
} |
|
|
|
}); |
|
|
|
} else { |
|
|
|
this.submitJob() |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
async submitJob() { |
|
|
|
uni.showLoading({ |
|
|
@ -372,7 +543,7 @@ |
|
|
|
this.managementList = res.list; |
|
|
|
//没有目标库位,不查询管理模式 |
|
|
|
var params = this.setParams() |
|
|
|
console.log("提交参数", JSON.stringify(params)); |
|
|
|
console.log("提交参数",params); |
|
|
|
scrapJobSubmit(params).then(res => { |
|
|
|
uni.hideLoading() |
|
|
|
if (res.data) { |
|
|
|