Browse Source

YT-1955制品回收任务

intex_online20250220
lijuncheng 1 week ago
parent
commit
b17a9dc7e4
  1. 236
      src/pages/productRecycle/job/productRecycleJobDetail.vue

236
src/pages/productRecycle/job/productRecycleJobDetail.vue

@ -12,8 +12,8 @@
<scroll-view scroll-y="true" class="page-main-scroll">
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
<view class="">
<comDetailCardBatch :dataContent="item" :index="index" :settingParam="jobContent" :isShowStatus="false"
@remove="updateData" @updateData="updateData" @openDetail="openDetail"
<comDetailCardBatch :dataContent="item" :index="index" :settingParam="jobContent"
:isShowStatus="false" @remove="updateData" @updateData="updateData" @openDetail="openDetail"
:locationAreaTypeList='toLocationAreaTypeList' v-if="managementType == 'BY_BATCH'">
</comDetailCardBatch>
<com-detail-card :dataContent="item" :settingParam="jobContent" @remove="updateData"
@ -71,7 +71,7 @@
import {
getManagementPrecisions
} from '@/common/balance.js';
import {
calc
} from '@/common/calc'
@ -103,7 +103,8 @@
businessTypeInfo: {},
managementList: [],
jobStatus: "",
managementType: ''
managementType: '',
toLocationAreaTypeList: []
};
},
onLoad(option) {
@ -194,7 +195,7 @@
res.fromLocationCode = res.toLocationCode
})
that.toLocationCode = that.jobContent.toLocationCode
that.detailSource =await getDataSource(that.subList);
that.detailSource = await getDataSource(that.subList);
//
var itemCodes = []
this.detailSource.forEach(item => {
@ -205,7 +206,9 @@
getManagementPrecisions(itemCodes, that.fromLocationCode, res => {
if (res.success) {
this.managementList = res.list;
this.managementType = this.managementList&&this.managementList[0]&&this.managementList[0].ManagementPrecision?this.managementList[0].ManagementPrecision:'BY_PACKAGING'
this.managementType = this.managementList && this.managementList[
0] && this.managementList[0].ManagementPrecision ? this
.managementList[0].ManagementPrecision : 'BY_PACKAGING'
}
})
} else {
@ -251,16 +254,19 @@
},
getScanResult(result) {
console.log(result.label)
this.labelInfo = result.label
if(this.managementType == 'BY_BATCH' ||this.managementType == "BY_QUANTITY" ){
if (this.managementType == 'BY_BATCH') {
this.getScanResultAfterBatch(result)
}else{
} else if (this.managementType == "BY_QUANTITY") {
this.getScanResultAfterQuantity(result)
} else {
this.getScanResultAfter(result)
}
},
getScanResultAfter(result){
getScanResultAfter(result) {
try {
var packingNumber = result.label.packingNumber;
var batch = result.label.batch;
@ -279,7 +285,7 @@
r.batch == batch &&
r.fromLocationCode == result.fromLocationCode &&
r.inventoryStatus == result.balance.inventoryStatus
})
if (itemDetail) {
//
@ -305,7 +311,7 @@
r.batch == batch &&
r.fromLocationCode == result.fromLocationCode
})
if (itemDetail) {
let itemStatus = getInventoryStatusName(itemDetail.inventoryStatus);
//
@ -337,16 +343,16 @@
this.showErrorMessage("箱码【" + packingNumber + "】\n批次【" + batch + "】\n库位【" + result
.fromLocationCode + "】\n状态【" + balanceStatus + "】\n不在任务列表中")
}
}
}
this.scanPopupGetFocus();
} catch (e) {
this.showErrorMessage(e.message);
}
},
getScanResultAfterBatch(result){
getScanResultAfterBatch(result) {
try {
var packingNumber = result.label.packingNumber;
var batch = result.label.batch;
@ -361,18 +367,18 @@
let balanceStatus = getInventoryStatusName(result.balance.inventoryStatus);
//
itemDetail = detail.subList.find(r => {
return
r.batch == batch &&
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.handleQty = calc.add(itemDetail.handleQty, Number(result.label.qty));
itemDetail.balanceQty = Number(result.label.qty);
} else {
itemDetail.scaned = true;
@ -385,24 +391,26 @@
itemDetail.balance.packQty = Number(result.package.packQty)
itemDetail.balance.packUnit = result.package.packUnit
}
this.calcHandleQty();
this.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 (balanceStatus != itemStatus) {
if (this.jobContent.allowModifyInventoryStatus == "TRUE") {
this.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.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;
@ -421,10 +429,11 @@
this.scanPopupGetFocus();
});
}
//
}else{
//
} else {
itemDetail.scaned = true;
itemDetail.handleQty = itemDetail.handleQty ? calc.add(itemDetail.handleQty,Number(result.label.qty)) : Number(result.label.qty);
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;
@ -433,14 +442,117 @@
itemDetail.balance.packUnit = result.package.packUnit
this.calcHandleQty();
}
} else {
this.showErrorMessage("\n批次【" + batch + "】\n库位【" + result
.fromLocationCode + "】\n状态【" + balanceStatus + "】\n不在任务列表中")
}
}
}
this.scanPopupGetFocus();
} catch (e) {
this.showErrorMessage(e.message);
}
},
getScanResultAfterQuantity(result) {
try {
var packingNumber = result.label.packingNumber;
var batch = result.label.batch;
var qty = result.label.qty;
var itemCode = result.label.itemCode;
var itemDetail = undefined;
var detail = this.detailSource.find(r => r.itemCode == itemCode);
if (detail == undefined) {
this.showMessage("物料号【" + itemCode + "】不在列表中")
} else {
detail.scaned = true
let balanceStatus = getInventoryStatusName(result.balance.inventoryStatus);
//
itemDetail = detail.subList.find(r => {
return
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
}
this.calcHandleQty();
} else {
//
itemDetail = detail.subList.find(r => {
return r.fromLocationCode == result.fromLocationCode
})
if (itemDetail) {
let itemStatus = getInventoryStatusName(itemDetail.inventoryStatus);
//
if (balanceStatus != itemStatus) {
if (this.jobContent.allowModifyInventoryStatus == "TRUE") {
this.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
this.calcHandleQty();
} else {
this.scanPopupGetFocus();
}
});
} else {
this.showQuestionMessage('任务中不允许修改库存状态,实际库存状态[' + balanceStatus + ']与推荐库存状态[' +
itemStatus +
']不一致,不允许回收!', res => {
this.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
this.calcHandleQty();
}
} else {
this.showErrorMessage("\n库位【" + result
.fromLocationCode + "】\n不在任务列表中")
}
}
}
this.scanPopupGetFocus();
} catch (e) {
@ -453,53 +565,53 @@
this.showErrorMessage("扫描数为0,请先扫描")
return;
}
// //
// //
if (this.scanCount == this.subList.length) {
if(this.managementType == 'BY_BATCH' ||this.managementType == "BY_QUANTITY" ){
if (this.managementType == 'BY_BATCH' || this.managementType == "BY_QUANTITY") {
this.checkCountBatch()
}else{
this.checkCount();
} else {
this.checkCount();
}
} else if (this.scanCount < this.subList.length) {
//
if (this.jobContent.allowPartialComplete == "TRUE") {
//
if(this.managementType == 'BY_BATCH' ||this.managementType == "BY_QUANTITY" ){
if (this.managementType == 'BY_BATCH' || this.managementType == "BY_QUANTITY") {
this.checkCountBatch()
}else{
this.checkCount();
} else {
this.checkCount();
}
} else {
//
this.$refs.comMessage.showErrorMessage("任务明细未全部完成,不允许部分提交!", res => {
if (res) {
this.openScanPopup();
}
});
if (res) {
this.openScanPopup();
}
});
}
}
},
checkCount(){
checkCount() {
//
let str = ''
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
var tempHandleQty = 0
if (cur.handleQty) {
tempHandleQty = cur.handleQty
} else {
tempHandleQty = 0
}
str += `包装号【${cur.packingNumber}】提交数量【${tempHandleQty}】与任务物料数量【${cur.qty}】不一致`
}
})
})
if (str) {
str = '任务明细未全部完成,是否提交?\n'+str
str = '任务明细未全部完成,是否提交?\n' + str
this.$refs.comMessage.showQuestionMessage1(str, 'red', res => {
if (res) {
this.submitJob()
@ -509,23 +621,24 @@
this.submitJob()
}
},
checkCountBatch(){
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
var 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 (cur.handleQty > cur.balance.qty) {
str1 +=
`物料号【${item.itemCode}】提交数量【${cur.handleQty}】不可以大于库存数量【${cur.balance.qty}`
}
})
})
@ -534,7 +647,7 @@
return
}
if (str) {
str = '任务明细未全部完成,是否提交?\n'+ str
str = '任务明细未全部完成,是否提交?\n' + str
this.$refs.comMessage.showQuestionMessage1(str, 'red', res => {
if (res) {
this.submitJob()
@ -558,7 +671,6 @@
if (res.success) {
this.managementList = res.list;
var params = this.setParams()
console.log("提交参数",params);
productRecycleJobsubmit(params).then(res => {
uni.hideLoading()
if (res.data) {
@ -568,7 +680,7 @@
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
this.showErrorMessage(error)
})
}
})
@ -587,7 +699,7 @@
detail.toLocationCode = detail.toLocationCode;
var info = getPackingNumberAndBatch(this.managementList, detail.itemCode,
detail.packingNumber, detail.batch);
detail.packingNumber, detail.batch);
detail.toPackingNumber = info.packingNumber;
detail.packingNumber = info.packingNumber;
detail.fromPackingNumber = this.labelInfo.packingNumber;
@ -663,7 +775,7 @@
this.$refs.comMessage.showQuestionMessage(message, res => {
if (res) {
callback(res);
}else {
} else {
this.scanPopupGetFocus()
}
});

Loading…
Cancel
Save