Browse Source

采购上架

intex_online20241205
zhang_li 3 months ago
parent
commit
603b69e497
  1. 2
      src/mycomponents/detail/comJobDetailCardBatch.vue
  2. 1
      src/mycomponents/qty/compareQty.vue
  3. 404
      src/pages/putaway/job/putawayDetail.vue

2
src/mycomponents/detail/comJobDetailCardBatch.vue

@ -13,7 +13,7 @@
@updateData="updateData"
:isShowStatus="isShowStatus"
:isShowPackListStatus="isShowPackListStatus"
></package-list>
>{</package-list>
</uni-collapse-item>
</uni-collapse>

1
src/mycomponents/qty/compareQty.vue

@ -3,6 +3,7 @@
<status v-show="isShowStatus && dataContent.inventoryStatus" :status='dataContent.inventoryStatus'></status>
<view class="uni-flex uni-row center">
<view class="uni-flex uni-row ">
<view v-if="Number(handleQty)!=0">
<view v-if="isShowRecommendQty">
<view v-if="Number(recommendQty)>Number(handleQty)" class="text_greater">

404
src/pages/putaway/job/putawayDetail.vue

@ -16,7 +16,7 @@
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
<view class="">
<!-- 物料按照批次的组件 批次不显示包装 -->
<comJobDetailCardBatch :dataContent="item" :index="index" :settingParam="jobContent" :isShowStatus="true"
<comJobDetailCardBatch ref='comJobDetailCardBatchRef' :dataContent="item" :index="index" :settingParam="jobContent" :isShowStatus="true"
@remove="updateData" @updateData="updateData" :locationAreaTypeList='toLocationAreaTypeList'
:isShowPackListStatus="false" v-if="managementType == 'BY_BATCH'">
</comJobDetailCardBatch>
@ -277,7 +277,11 @@
updateData() {
console.log("updateData")
// this.calcHandleQty();
if (this.managementType == 'BY_BATCH' || managementPrecision == 'BY_QUANTITY') {
calcHandleQty(this.detailSource);
} else {
calcTreeHandleQty(this.detailSource)
}
},
//
openScanPopupSimulate(message) {
@ -329,36 +333,168 @@
},
getScanResult(result, managementPrecision) {
try {
this.managementType = managementPrecision
let array1 = []//
let array2 = []//
this.detailSource.forEach(item=>{
item.subList.forEach(cur=>{
array1.push(cur.fromLocationCode)
array2.push(cur.batch)
})
})
//
const obj1 = array1.find(item=>item == result.fromLocationCode)
const obj2 = array2.find(item=>item == result.label.batch)
// this.jobContent.allowModifyLocation = 'FALSE'
// this.jobContent.allowModifyBatch = 'FALSE'
if(this.jobContent.allowModifyLocation == 'FALSE'){
if(!obj1){
this.showErrorMessage(`不可以扫描推荐库位【${array1.join(',')}】以外的库位`)
return
}
}
if(this.jobContent.allowModifyBatch == 'FALSE'){
if(!obj2){
this.showErrorMessage(`不可以扫描推荐批次【${array2.join(',')}】以外的批次`)
return
}
}
if(!obj1){
this.recommendQty = 0
}else{
this.recommendQty = result.balance.qty
}
//
if (this.managementType == 'BY_BATCH' || managementPrecision == 'BY_QUANTITY') {
this.setDataBatch(result, managementPrecision)
} else {
this.setData(result, managementPrecision)
}
},
resizeCollapse() {
this.$nextTick(r => {
this.$refs.comJobDetailCardBatchRef.forEach(r => {
r.resizeCollapse();
})
});
},
//
setDataBatch(result, managementPrecision){
try {
var packingNumber = result.label.packingNumber;
var batch = result.label.batch;
var qty = result.label.qty;
var itemCode = result.label.itemCode;
var locationCode = result.fromLocationCode;
if (!result.balance) {
this.showMessage("箱码【" + packingNumber + "】没有库存余额")
return;
}
// var inventoryStatus = "OK";
var detail = this.detailSource.find(r => r.itemCode == itemCode);
if (detail == undefined) {
this.showErrorMessage("物料号【" + itemCode + "】不在列表中")
} else {
detail.scaned = true
var itemDetail = detail.subList.find(r => {
return r.batch == batch &&
r.fromLocationCode == result.fromLocationCode
})
if (itemDetail == undefined) {
// let newItemDetail = {}
detail.subList.push({
scaned:true,
fromLocationCode:result.fromLocationCode,
toLocationCode:this.toLocationCode,
batch:result.label.batch,
handleQty:result.label.qty,
qty:this.recommendQty,
inventoryStatus:result.balance.inventoryStatus,
toLocation:result.balance.toLocation,
balance:result.balance,
balanceQty:result.balance.qty,
packQty:result.package.packQty,
packUnit:result.package.packUnit,
uom:result.balance.uom,
})
setTimeout(r => {
this.resizeCollapse();
this.$forceUpdate()
}, 100)
calcHandleQty(this.detailSource);
} else {
var scanedLength = 0;
itemDetail.packList.forEach(res => {
if (res.scaned) {
scanedLength++;
}
})
//
itemDetail.fromInventoryStatus = result.balance.inventoryStatus;
if (!itemDetail.cancleScanedHiht && itemDetail.scaned && scanedLength == itemDetail.packList
.length) {
// this.showMessage("" + packingNumber + "")
// this.showMessage("" + batch + "")
itemDetail.handleQty = calc.add(Number(result.label.qty),itemDetail.handleQty)
} else {
itemDetail.scaned = true;
itemDetail.balanceQty = result.balance.qty;
this.detailSource[0].subList.sort(compareAsc('scaned')); //
itemDetail.handleQty = result.label.qty;
// itemDetail.toInventoryStatus = "OK"
itemDetail.packList.forEach(pac => {
pac.scaned = true
pac.handleQty = Number(pac.qty);
pac.toLocationCode = this.toLocationCode;
})
this.continueScan()
this.$forceUpdate()
}
calcHandleQty(this.detailSource);
}
}
} catch (e) {
this.showMessage(e.message)
}
},
setData(result, managementPrecision){
try {
var packingNumber = result.label.packingNumber;
var batch = result.label.batch;
var qty = result.label.qty;
var itemCode = result.label.itemCode;
var locationCode = result.fromLocationCode;
if (!result.balance) {
this.showMessage("箱码【" + packingNumber + "】没有库存余额")
return;
}
// var inventoryStatus = "OK";
var detail = this.detailSource.find(r => r.itemCode == itemCode);
if (detail == undefined) {
this.showErrorMessage("物料号【" + itemCode + "】不在列表中")
} else {
detail.scaned = true
if (this.managementType == 'BY_BATCH') {
this.verificationBatch(detail, packingNumber, batch, qty, itemCode, locationCode, result)
} else {
var itemDetail = detail.subList.find(r => {
return r.packingNumber == packingNumber &&
r.batch == batch &&
r.fromLocationCode == result.fromLocationCode
})
if (itemDetail == undefined) {
var isExit;
for (let subItem of detail.subList) {
@ -391,7 +527,7 @@
} else {
qty = Number(result.label.qty);
}
isExit.handleQty = Number(result.label.qty);
isExit.toLocationCode = this.toLocationCode;
}
@ -406,10 +542,10 @@
scanedLength++;
}
})
//
itemDetail.fromInventoryStatus = result.balance.inventoryStatus;
if (!itemDetail.cancleScanedHiht && itemDetail.scaned && scanedLength == itemDetail.packList
.length) {
this.showMessage("箱码【" + packingNumber + "】已经扫描")
@ -423,13 +559,12 @@
pac.handleQty = Number(pac.qty);
pac.toLocationCode = this.toLocationCode;
})
calcTreeHandleQty(this.detailSource);
this.continueScan()
this.$forceUpdate()
}
}
}
}
if (this.managementType == 'BY_BATCH') {
this.detailSource.forEach(item => {
@ -442,88 +577,6 @@
this.showMessage(e.message)
}
},
//
verificationBatch(detail,packingNumber,batch,qty,itemCode,locationCode,result){
var itemDetail = detail.subList.find(r => {
return r.batch == batch &&
r.fromLocationCode == result.fromLocationCode
})
if (itemDetail == undefined) {
var isExit;
for (let subItem of detail.subList) {
var item;
for (let pack of subItem.packList) {
if (pack.batch == batch) {
item = pack;
isExit = pack;
break;
}
}
if (item != undefined) {
subItem.scaned = true
subItem.handleQty = 0;
item = undefined
}
}
if (isExit == undefined) {
this.showErrorMessage("批次【" + batch + "】库位【" + result
.fromLocationCode + "】不在列表中")
} else {
if (!isExit.cancleScanedHiht && isExit.scaned) {
// this.showMessage("" + batch + "")
isExit.handleQty = calc.add(Number(result.label.qty),isExit.handleQty)
} else {
isExit.scaned = true
let qty = 0;
if (result.balance != null) {
qty = Number(result.balance.qty);
} else {
qty = Number(result.label.qty);
}
isExit.handleQty = Number(result.label.qty);
isExit.toLocationCode = this.toLocationCode;
}
}
calcTreeHandleQty(this.detailSource);
this.continueScan()
this.$forceUpdate()
} else {
var scanedLength = 0;
itemDetail.packList.forEach(res => {
if (res.scaned) {
scanedLength++;
}
})
//
itemDetail.fromInventoryStatus = result.balance.inventoryStatus;
if (!itemDetail.cancleScanedHiht && itemDetail.scaned && scanedLength == itemDetail.packList
.length) {
// this.showMessage("" + packingNumber + "")
// this.showMessage("" + batch + "")
itemDetail.handleQty = calc.add(Number(result.label.qty),itemDetail.handleQty)
} else {
itemDetail.scaned = true;
this.detailSource[0].subList.sort(compareAsc('scaned')); //
itemDetail.handleQty = result.label.qty;
// itemDetail.toInventoryStatus = "OK"
itemDetail.packList.forEach(pac => {
pac.scaned = true
pac.handleQty = Number(pac.qty);
pac.toLocationCode = this.toLocationCode;
})
this.continueScan()
this.$forceUpdate()
}
calcTreeHandleQty(this.detailSource);
}
},
scanLocationCode(location, code) {
this.toLocationCode = code
this.detailSource.forEach(item => {
@ -556,17 +609,8 @@
}
});
},
commit() {
this.scanCount = getScanCount(this.subList);
if (this.scanCount == 0) {
this.showErrorMessage("扫描数为0,请先扫描")
return;
}
if (!this.checkLocation()) {
return
}
//
check(){
//
if (this.scanCount == this.subList.length) {
this.submitJob();
@ -583,47 +627,149 @@
//
this.$refs.comMessage.showErrorMessage("任务明细未全部完成,不允许部分提交!", res => {
if (res) {
this.openScanPopup();
this.openScanPopup(this.jobToLocationCode);
}
});
}
}
},
//
checkBatch(){
//
let str = ''
let str1 = ''
let str2 = ''
var scanCount=0;
// this.jobContent.allowBiggerQty = "FALSE"
// this.jobContent.allowSmallerQty = "FALSE"
// this.jobContent.allowPartialComplete = "TRUE"
this.detailSource.forEach((item) => {
item.subList.forEach(cur=>{
if(cur.scaned){
scanCount++;
if(parseFloat(cur.qty)>parseFloat(cur.handleQty)){
str += `物料号【${item.itemCode}】批次【${cur.batch}】实际提交数量【${cur.handleQty}】不可以小于任务数量【${cur.qty}\n`
}
if(parseFloat(cur.qty)<parseFloat(cur.handleQty)){
str1 += `物料号【${item.itemCode}】批次【${cur.batch}】实际提交数量【${cur.handleQty}】不可以大于任务数量【${cur.qty}\n`
}
if(parseFloat(cur.handleQty)>parseFloat(cur.balanceQty)){
str2 += `物料号【${item.itemCode}】批次【${cur.batch}】实际提交数量【${cur.handleQty}】不可以大于库存数量【${cur.qty}\n`
}
}
})
})
if (scanCount == 0) {
this.showErrorMessage("扫描数为0,请先扫描")
return;
}
if (!this.checkLocation()) {
return
}
if(this.jobContent.allowBiggerQty == "FALSE"){
if(str1){
this.$refs.comMessage.showErrorMessage(str1);
return;
}
}
if(this.jobContent.allowSmallerQty == "FALSE"){
if(str){
this.$refs.comMessage.showErrorMessage(str);
return;
}
}
if(str2){
this.$refs.comMessage.showErrorMessage(str2);
return;
}
return;
if(this.scanCount < this.subList.length){
//
if (this.jobContent.allowPartialComplete == "TRUE") {
//
this.$refs.comMessage.showQuestionMessage1("任务明细未全部完成,是否提交?", 'red', res => {
if (res) {
this.submitJob()
}
});
} else {
//
this.$refs.comMessage.showErrorMessage("任务明细未全部完成,不允许部分提交!", res => {
if (res) {
this.openScanPopup(this.jobToLocationCode);
}
});
}
}else{
this.submitJob();
}
},
submitJob() {
uni.showLoading({
title: "提交中....",
mask: true
});
commit() {
var itemCodes = []
this.detailSource.forEach(item => {
itemCodes.push(item.itemCode)
})
//
getManagementPrecisions(itemCodes, this.toLocationCode, res => {
if (res.success) {
this.managementList = res.list;
var params = this.setParams()
console.log("提交参数", JSON.stringify(params));
putawayJobSubmit(params).then(res => {
uni.hideLoading()
if (res.data) {
this.showCommitSuccessMessage("提交成功\n生成采购上架记录\n" + res.data)
} else {
this.showErrorMessage("提交失败[" + res.msg + "]")
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
this.managementType = this.managementList&&this.managementList[0]&&this.managementList[0].ManagementPrecision ? this.managementList[0].ManagementPrecision : 'BY_PACKAGING'
if(this.managementType == 'BY_BATCH' || this.managementType == 'BY_QUANTITY'){
this.checkBatch()
}else{
this.check()
}
} else {
uni.hideLoading();
this.showErrorMessage(res.message);
}
})
//
// if (this.scanCount == this.subList.length) {
// this.submitJob();
// } else if (this.scanCount < this.subList.length) {
// //
// if (this.jobContent.allowPartialComplete == "TRUE") {
// //
// this.$refs.comMessage.showQuestionMessage1(",?", 'red', res => {
// if (res) {
// this.submitJob()
// }
// });
// } else {
// //
// this.$refs.comMessage.showErrorMessage(",!", res => {
// if (res) {
// this.openScanPopup();
// }
// });
// }
// }
},
submitJob() {
uni.showLoading({
title: "提交中....",
mask: true
});
var params = this.setParams()
console.log("提交参数", JSON.stringify(params));
putawayJobSubmit(params).then(res => {
uni.hideLoading()
if (res.data) {
this.showCommitSuccessMessage("提交成功\n生成采购上架记录\n" + res.data)
} else {
this.showErrorMessage("提交失败[" + res.msg + "]")
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
},
setParams() {
var subList = []

Loading…
Cancel
Save