Browse Source

YT-1061 采购上架修改

intex
lijuncheng 3 days ago
parent
commit
3e5748b960
  1. 452
      src/pages/putaway/job/putawayDetail.vue

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

@ -16,14 +16,15 @@
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> <view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
<view class=""> <view class="">
<!-- 物料按照批次的组件 批次不显示包装 --> <!-- 物料按照批次的组件 批次不显示包装 -->
<comJobDetailCardBatch ref='comJobDetailCardBatchRef' :dataContent="item" :index="index" :settingParam="jobContent" :isShowStatus="true" <comJobDetailCardBatch ref='comJobDetailCardBatchRef' :dataContent="item" :index="index"
@remove="updateData" @updateData="updateData" :locationAreaTypeList='toLocationAreaTypeList' :settingParam="jobContent" :isShowStatus="true" @remove="updateData"
@updateData="updateData" :locationAreaTypeList='toLocationAreaTypeList'
:isShowPackListStatus="false" v-if="managementType == 'BY_BATCH'"> :isShowPackListStatus="false" v-if="managementType == 'BY_BATCH'">
</comJobDetailCardBatch> </comJobDetailCardBatch>
<!-- 物料按照包装的组件 --> <!-- 物料按照包装的组件 -->
<comJobDetailCard :dataContent="item" :index="index" :settingParam="jobContent" :isShowStatus="true" <comJobDetailCard :dataContent="item" :index="index" :settingParam="jobContent"
@remove="updateData" @updateData="updateData" :locationAreaTypeList='toLocationAreaTypeList' :isShowStatus="true" @remove="updateData" @updateData="updateData"
:isShowPackListStatus="false" v-else> :locationAreaTypeList='toLocationAreaTypeList' :isShowPackListStatus="false" v-else>
</comJobDetailCard> </comJobDetailCard>
</view> </view>
</view> </view>
@ -31,7 +32,8 @@
</view> </view>
<view class="page-footer"> <view class="page-footer">
<view class="uni-flex u-col-center space-between padding_10" style="background-color:ghostwhite; width: 100%; "> <view class="uni-flex u-col-center space-between padding_10"
style="background-color:ghostwhite; width: 100%; ">
<view class=""> <view class="">
<locationCompare ref='comScanLocation' title="目标库位" :recommendLocationCode="jobToLocationCode" <locationCompare ref='comScanLocation' title="目标库位" :recommendLocationCode="jobToLocationCode"
:locationCode="toLocationCode" @getLocation='scanLocationCode' :isShowEdit="isCheckLocation" :locationCode="toLocationCode" @getLocation='scanLocationCode' :isShowEdit="isCheckLocation"
@ -47,8 +49,8 @@
<!-- <winScanPackAndLocationNoBalance ref="scanPopup" @getResult='getScanResult' :allowNullBalance="true"> <!-- <winScanPackAndLocationNoBalance ref="scanPopup" @getResult='getScanResult' :allowNullBalance="true">
</winScanPackAndLocationNoBalance> --> </winScanPackAndLocationNoBalance> -->
<winScanPackAndLocation :balanceFromInventoryStatuses="false" :toLocationCode="jobToLocationCode" ref="scanPopup" <winScanPackAndLocation :balanceFromInventoryStatuses="false" :toLocationCode="jobToLocationCode"
@getResult='getScanResult' :noShowBalanceMessage="false"> ref="scanPopup" @getResult='getScanResult' :noShowBalanceMessage="false">
</winScanPackAndLocation> </winScanPackAndLocation>
<comMessage ref="comMessage"></comMessage> <comMessage ref="comMessage"></comMessage>
@ -120,7 +122,7 @@
toLocationAreaTypeList: [], toLocationAreaTypeList: [],
jobStatus: "", jobStatus: "",
jobToLocationCode: "", jobToLocationCode: "",
isCheckLocation: false, isCheckLocation: true,
scanMessage: "", scanMessage: "",
managementType: '' // managementType: '' //
}; };
@ -212,12 +214,6 @@
that.fromLocationCode = that.subList[0].fromLocationCode that.fromLocationCode = that.subList[0].fromLocationCode
that.jobToLocationCode = that.subList[0].toLocationCode; that.jobToLocationCode = that.subList[0].toLocationCode;
that.toLocationAreaTypeList = getDirectoryItemArray(that.jobContent.toAreaTypes) that.toLocationAreaTypeList = getDirectoryItemArray(that.jobContent.toAreaTypes)
that.isCheckLocation = getSwitchInfoByCode("PurchasePutawayToLocationCodeValidate")
if (that.isCheckLocation) {
that.toLocationCode = ""
} else {
that.toLocationCode = that.jobToLocationCode;
}
// //
var itemCodes = [] var itemCodes = []
this.detailSource.forEach(item => { this.detailSource.forEach(item => {
@ -227,15 +223,25 @@
getManagementPrecisions(itemCodes, that.jobToLocationCode, res => { getManagementPrecisions(itemCodes, that.jobToLocationCode, res => {
if (res.success) { if (res.success) {
this.managementList = res.list; this.managementList = res.list;
this.managementType = this.managementList.some(item => item.ManagementPrecision == this.managementType = this.managementList.some(item => item
'BY_BATCH') ? 'BY_BATCH' : '' .ManagementPrecision ==
'BY_PACKAGING') ? 'BY_PACKAGING' : 'BY_BATCH'
} }
}) })
if (this.managementType == "BY_PACKAGING") {
that.isCheckLocation = getSwitchInfoByCode("PurchasePutawayToLocationCodeValidate")
if (that.isCheckLocation) {
that.toLocationCode = ""
} else {
that.toLocationCode = that.jobToLocationCode;
}
}else {
this.isCheckLocation=true;
}
// //
if (this.scanMessage) { if (this.scanMessage) {
this.openScanPopupSimulate(this.scanMessage) this.openScanPopupSimulate(this.scanMessage)
} }
} else { } else {
that.showMessage('列表数据为0'); that.showMessage('列表数据为0');
} }
@ -277,10 +283,10 @@
updateData() { updateData() {
console.log("updateData") console.log("updateData")
// this.calcHandleQty(); // this.calcHandleQty();
if (this.managementType == 'BY_BATCH' || managementPrecision == 'BY_QUANTITY') { if (this.managementType == 'BY_BATCH' || this.managementType == 'BY_QUANTITY') {
calcHandleQty(this.detailSource); calcHandleQty(this.detailSource);
} else { } else {
calcTreeHandleQty(this.detailSource) calcTreeHandleQty(this.detailSource)
} }
}, },
// //
@ -333,43 +339,12 @@
}, },
getScanResult(result, managementPrecision) { getScanResult(result, managementPrecision) {
this.managementType = managementPrecision this.managementType = managementPrecision;
let array1 = []// if (this.managementType == 'BY_BATCH' || managementPrecision == 'BY_QUANTITY') {
let array2 = []// this.setDataBatch(result, managementPrecision)
this.detailSource.forEach(item=>{ } else {
item.subList.forEach(cur=>{ this.setData(result, managementPrecision)
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() { resizeCollapse() {
@ -380,26 +355,26 @@
}); });
}, },
// //
setDataBatch(result, managementPrecision){ setDataBatch(result, managementPrecision) {
try { try {
var packingNumber = result.label.packingNumber; var packingNumber = result.label.packingNumber;
var batch = result.label.batch; var batch = result.label.batch;
var qty = result.label.qty; var qty = result.label.qty;
var itemCode = result.label.itemCode; var itemCode = result.label.itemCode;
var locationCode = result.fromLocationCode; var locationCode = result.fromLocationCode;
if (!result.balance) {
this.showMessage("箱码【" + packingNumber + "】没有库存余额")
return;
}
// var inventoryStatus = "OK"; if (!result.balance) {
var detail = this.detailSource.find(r => r.itemCode == itemCode); this.showMessage("箱码【" + packingNumber + "】没有库存余额")
return;
}
if (detail == undefined) { // var inventoryStatus = "OK";
this.showErrorMessage("物料号【" + itemCode + "】不在列表中") var detail = this.detailSource.find(r => r.itemCode == itemCode);
} else {
detail.scaned = true if (detail == undefined) {
this.showErrorMessage("物料号【" + itemCode + "】不在列表中")
} else {
detail.scaned = true
var itemDetail = detail.subList.find(r => { var itemDetail = detail.subList.find(r => {
return r.batch == batch && return r.batch == batch &&
@ -407,27 +382,9 @@
}) })
if (itemDetail == undefined) { if (itemDetail == undefined) {
// let newItemDetail = {} this.showErrorMessage("物料号【" + itemCode + "】" + "批次【" + batch + "】库位【" + locationCode +
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 { } else {
var scanedLength = 0; var scanedLength = 0;
itemDetail.packList.forEach(res => { itemDetail.packList.forEach(res => {
@ -442,8 +399,8 @@
if (!itemDetail.cancleScanedHiht && itemDetail.scaned && scanedLength == itemDetail.packList if (!itemDetail.cancleScanedHiht && itemDetail.scaned && scanedLength == itemDetail.packList
.length) { .length) {
// this.showMessage("" + packingNumber + "") // this.showMessage("" + packingNumber + "")
// this.showMessage("" + batch + "") // this.showMessage("" + batch + "")
itemDetail.handleQty = calc.add(Number(result.label.qty),itemDetail.handleQty) itemDetail.handleQty = calc.add(Number(result.label.qty), itemDetail.handleQty)
} else { } else {
itemDetail.scaned = true; itemDetail.scaned = true;
itemDetail.balanceQty = result.balance.qty; itemDetail.balanceQty = result.balance.qty;
@ -467,7 +424,7 @@
} }
}, },
setData(result, managementPrecision){ setData(result, managementPrecision) {
try { try {
var packingNumber = result.label.packingNumber; var packingNumber = result.label.packingNumber;
var batch = result.label.batch; var batch = result.label.batch;
@ -489,82 +446,82 @@
detail.scaned = true detail.scaned = true
var itemDetail = detail.subList.find(r => { var itemDetail = detail.subList.find(r => {
return r.packingNumber == packingNumber && return r.packingNumber == packingNumber &&
r.batch == batch && r.batch == batch &&
r.fromLocationCode == result.fromLocationCode r.fromLocationCode == result.fromLocationCode
}) })
if (itemDetail == undefined) { if (itemDetail == undefined) {
var isExit; var isExit;
for (let subItem of detail.subList) { for (let subItem of detail.subList) {
var item; var item;
for (let pack of subItem.packList) { for (let pack of subItem.packList) {
if (pack.packingNumber == packingNumber && if (pack.packingNumber == packingNumber &&
pack.batch == batch) { pack.batch == batch) {
item = pack; item = pack;
isExit = pack; isExit = pack;
break; break;
}
}
if (item != undefined) {
subItem.scaned = true
subItem.handleQty = 0;
item = undefined
} }
} }
if (isExit == undefined) { if (item != undefined) {
this.showErrorMessage("箱码【" + packingNumber + "】,批次【" + batch + "】库位【" + result subItem.scaned = true
.fromLocationCode + "】不在列表中") subItem.handleQty = 0;
item = undefined
}
}
if (isExit == undefined) {
this.showErrorMessage("箱码【" + packingNumber + "】,批次【" + batch + "】库位【" + result
.fromLocationCode + "】不在列表中")
} else {
if (!isExit.cancleScanedHiht && isExit.scaned) {
this.showMessage("箱码【" + packingNumber + "】已经扫描")
} else { } else {
if (!isExit.cancleScanedHiht && isExit.scaned) { isExit.scaned = true
this.showMessage("箱码【" + packingNumber + "】已经扫描") let qty = 0;
if (result.balance != null) {
qty = Number(result.balance.qty);
} else { } else {
isExit.scaned = true qty = Number(result.label.qty);
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;
} }
isExit.handleQty = Number(result.label.qty);
isExit.toLocationCode = this.toLocationCode;
} }
calcTreeHandleQty(this.detailSource); }
this.continueScan() calcTreeHandleQty(this.detailSource);
this.$forceUpdate() 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 + "】已经扫描")
} else { } else {
var scanedLength = 0; itemDetail.scaned = true;
itemDetail.packList.forEach(res => { this.detailSource[0].subList.sort(compareAsc('scaned')); //
if (res.scaned) { itemDetail.handleQty = result.label.qty;
scanedLength++; // itemDetail.toInventoryStatus = "OK"
} itemDetail.packList.forEach(pac => {
pac.scaned = true
pac.handleQty = Number(pac.qty);
pac.toLocationCode = this.toLocationCode;
}) })
// calcTreeHandleQty(this.detailSource);
itemDetail.fromInventoryStatus = result.balance.inventoryStatus; this.continueScan()
this.$forceUpdate()
if (!itemDetail.cancleScanedHiht && itemDetail.scaned && scanedLength == itemDetail.packList
.length) {
this.showMessage("箱码【" + packingNumber + "】已经扫描")
} 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;
})
calcTreeHandleQty(this.detailSource);
this.continueScan()
this.$forceUpdate()
}
} }
}
} }
if (this.managementType == 'BY_BATCH') { if (this.managementType == 'BY_BATCH') {
this.detailSource.forEach(item => { this.detailSource.forEach(item => {
@ -577,13 +534,30 @@
this.showMessage(e.message) this.showMessage(e.message)
} }
}, },
scanLocationCode(location, code) { scanLocationCode(location, code) {
this.toLocationCode = code //
this.detailSource.forEach(item => { if(this.jobContent.allowModifyLocation=="TRUE"){
item.subList.forEach(detail => { this.toLocationCode = code
detail.toLocationCode = code this.detailSource.forEach(item => {
item.subList.forEach(detail => {
detail.toLocationCode = code
})
}) })
}) }else {
//
if(code==this.jobToLocationCode){
this.toLocationCode = code
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
detail.toLocationCode = code
})
})
}else {
this.showErrorMessage("扫描的库位【"+code+"】与推荐的库位【"+this.jobToLocationCode+"】不一致")
}
}
}, },
openDetail(item) { openDetail(item) {
@ -610,7 +584,7 @@
}); });
}, },
// //
check(){ check() {
// //
if (this.scanCount == this.subList.length) { if (this.scanCount == this.subList.length) {
this.submitJob(); this.submitJob();
@ -635,77 +609,83 @@
}, },
// //
checkBatch(){ checkBatch() {
// //
let str = '' let str = ''
let str1 = '' let str1 = ''
let str2 = '' let str2 = ''
var scanCount=0; var scanCount = 0;
// this.jobContent.allowBiggerQty = "FALSE" // this.jobContent.allowBiggerQty = "FALSE"
// this.jobContent.allowSmallerQty = "FALSE" // this.jobContent.allowSmallerQty = "FALSE"
// this.jobContent.allowPartialComplete = "TRUE" // this.jobContent.allowPartialComplete = "TRUE"
this.detailSource.forEach((item) => { this.detailSource.forEach((item) => {
item.subList.forEach(cur=>{ item.subList.forEach(cur => {
if(cur.scaned){ if (cur.scaned) {
scanCount++; scanCount++;
if(parseFloat(cur.qty)>parseFloat(cur.handleQty)){ if (parseFloat(cur.qty) > parseFloat(cur.handleQty)) {
str += `物料号【${item.itemCode}】批次【${cur.batch}】实际提交数量【${cur.handleQty}】不可以小于任务数量【${cur.qty}\n` 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.balanceQty}\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.balanceQty}\n`
}
}
}) })
if (scanCount == 0) { })
this.showErrorMessage("扫描数为0,请先扫描") if (scanCount == 0) {
this.showErrorMessage("扫描数为0,请先扫描")
return;
}
if (!this.checkLocation()) {
return
}
if (this.jobContent.allowBiggerQty == "FALSE") {
if (str1) {
this.$refs.comMessage.showErrorMessage(str1);
return; return;
} }
if (!this.checkLocation()) { }
return if (this.jobContent.allowSmallerQty == "FALSE") {
} if (str) {
if(this.jobContent.allowBiggerQty == "FALSE"){ this.$refs.comMessage.showErrorMessage(str);
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 (str2) {
if (this.jobContent.allowPartialComplete == "TRUE") { this.$refs.comMessage.showErrorMessage(str2);
// return;
this.$refs.comMessage.showQuestionMessage1("任务明细未全部完成,是否提交?", 'red', res => { }
if (res) { if (this.scanCount < this.subList.length) {
this.submitJob() //
} if (this.jobContent.allowPartialComplete == "TRUE") {
}); //
} else { this.$refs.comMessage.showQuestionMessage1("任务明细未全部完成,是否提交?", 'red', res => {
// if (res) {
this.$refs.comMessage.showErrorMessage("任务明细未全部完成,不允许部分提交!", res => { this.submitJob()
if (res) { }
this.openScanPopup(this.jobToLocationCode); });
} } else {
}); //
} this.$refs.comMessage.showErrorMessage("任务明细未全部完成,不允许部分提交!", res => {
}else{ if (res) {
this.submitJob(); this.openScanPopup(this.jobToLocationCode);
}
});
} }
} else {
this.submitJob();
}
}, },
commit() { commit() {
if (!this.checkLocation()) {
return
}
var itemCodes = [] var itemCodes = []
this.detailSource.forEach(item => { this.detailSource.forEach(item => {
itemCodes.push(item.itemCode) itemCodes.push(item.itemCode)
@ -714,10 +694,12 @@
getManagementPrecisions(itemCodes, this.toLocationCode, res => { getManagementPrecisions(itemCodes, this.toLocationCode, res => {
if (res.success) { if (res.success) {
this.managementList = res.list; 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[
if(this.managementType == 'BY_BATCH' || this.managementType == 'BY_QUANTITY'){ 0].ManagementPrecision ? this.managementList[0].ManagementPrecision :
'BY_PACKAGING'
if (this.managementType == 'BY_BATCH' || this.managementType == 'BY_QUANTITY') {
this.checkBatch() this.checkBatch()
}else{ } else {
this.check() this.check()
} }
} else { } else {
@ -754,7 +736,7 @@
item.subList.forEach(detail => { item.subList.forEach(detail => {
if (detail.scaned) { if (detail.scaned) {
var info = getPackingNumberAndBatch(this.managementList, detail.itemCode, var info = getPackingNumberAndBatch(this.managementList, detail.itemCode,
detail.packingNumber, detail.batch); detail.packingNumber, detail.batch);
detail.toPackingNumber = info.packingNumber; detail.toPackingNumber = info.packingNumber;
detail.packingNumber = info.packingNumber; detail.packingNumber = info.packingNumber;
detail.fromPackingNumber = info.packingNumber; detail.fromPackingNumber = info.packingNumber;

Loading…
Cancel
Save