Browse Source

YT-568所有任务列表隐藏掉扫描箱码进入任务功能,采购收货任务要保留扫描ASN单号

intex_online20241111
zhang_li 4 weeks ago
parent
commit
e142cb1567
  1. 508
      src/pages/deliver/job/deliverDetailBatch.vue

508
src/pages/deliver/job/deliverDetailBatch.vue

@ -9,7 +9,7 @@
<view class="cell_box uni-flex uni-row"> <view class="cell_box uni-flex uni-row">
<view class="cell_info"> <view class="cell_info">
<view class="text_lightblue">发货类型</view> <view class="text_lightblue">发货类型</view>
<view style="line-height: 34rpx;">{{jobContent.deliverType}}</view> <view>{{jobContent.deliverType}}</view>
</view> </view>
<view class="cell_info"> <view class="cell_info">
@ -19,7 +19,7 @@
<view class="cell_info"> <view class="cell_info">
<view class="text_lightblue">目标库位</view> <view class="text_lightblue">目标库位</view>
<view >{{toLocationCode}}</view> <view>{{toLocationCode}}</view>
</view> </view>
</view> </view>
</view> </view>
@ -28,19 +28,20 @@
<view class="page-main"> <view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll"> <scroll-view scroll-y="true" class="page-main-scroll">
<view>
</view>
<view v-for="(toLocation, index) in detailSource"> <view v-for="(toLocation, index) in detailSource">
<comDeliverDetailCardBatch ref='comIssueDetailCard' <comDeliverDetailCardBatch ref='comIssueDetailCardBatch' :dataContent="toLocation" :settingParam="jobContent"
:dataContent="toLocation" @updateData='updateData' :allowBiggerQty='allowBiggerQty'>
:settingParam="jobContent"
@updateData='updateData'>
</comDeliverDetailCardBatch> </comDeliverDetailCardBatch>
<view class="split_line"></view>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
<view class="page-footer"> <view class="page-footer">
<view class="uni-flex u-col-center space-between padding_10" <view class="uni-flex u-col-center space-between padding_10" style="background-color:ghostwhite; width: 100%; ">
style="background-color:ghostwhite; width: 100%; ">
<view class=""> <view class="">
</view> </view>
<view class=" uni-flex uni-row"> <view class=" uni-flex uni-row">
@ -48,9 +49,14 @@
</view> </view>
</view> </view>
</view> </view>
<win-scan-button @goScan='openScanDetailPopup'></win-scan-button>
<comScanDeliverPackBatch ref="comScanIssuePack" @closeScan='closeScan' @updateData='updateData' :locationCode='fromLocationCode'> <win-scan-button @goScan='openScanPopup'></win-scan-button>
</comScanDeliverPackBatch> <!-- <comScanDeliverPackBatch ref="comScanIssuePack" @closeScan='closeScan' @updateData='updateData'>
</comScanDeliverPackBatch> -->
<winScanPackAndLocation :balanceFromInventoryStatuses="false" :toLocationCode="jobToLocationCode" ref="scanPopup"
@getResult='getScanResult' :noShowBalanceMessage="false" @confirm='confirmFromLocation'>
</winScanPackAndLocation>
<comMessage ref="comMessage"></comMessage> <comMessage ref="comMessage"></comMessage>
</view> </view>
</template> </template>
@ -74,13 +80,19 @@
getRemoveOption, getRemoveOption,
getCurrDateTime, getCurrDateTime,
getPackingNumberAndBatch, getPackingNumberAndBatch,
deepCopyData deepCopyData,
compareAsc,
} from '@/common/basic.js'; } from '@/common/basic.js';
import {
getDataSource
} from '@/pages/issue/js/issue.js';
import {
getTreeDataSource,
calcTreeHandleQty,
getScanCount,
getThreeDataSource,
getDataSource,
calcHandleQty,
} from '@/common/detail.js';
import { import {
getManagementPrecisions getManagementPrecisions
} from '@/common/balance.js'; } from '@/common/balance.js';
@ -88,10 +100,10 @@
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue' import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue'
import winScanButton from '@/mycomponents/scan/winScanButton.vue' import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import comDeliverDetailCard from '@/pages/deliver/coms/comDeliverDetailCard.vue'
import comDeliverDetailCardBatch from '@/pages/deliver/coms/comDeliverDetailCardBatch.vue' import comDeliverDetailCardBatch from '@/pages/deliver/coms/comDeliverDetailCardBatch.vue'
import comScanDeliverPackBatch from '@/pages/deliver/coms/comScanDeliverPackBatch.vue' import comScanDeliverPackBatch from '@/pages/deliver/coms/comScanDeliverPackBatch.vue'
import jobTop from '@/mycomponents/job/jobTop.vue' import jobTop from '@/mycomponents/job/jobTop.vue'
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue"
export default { export default {
name: 'issueDetail', name: 'issueDetail',
@ -99,8 +111,9 @@
jobDetailPopup, jobDetailPopup,
winScanButton, winScanButton,
comDeliverDetailCardBatch, comDeliverDetailCardBatch,
comScanDeliverPackBatch,
jobTop, jobTop,
comScanDeliverPackBatch winScanPackAndLocation
}, },
data() { data() {
return { return {
@ -113,7 +126,7 @@
status: "", status: "",
toLocationCode: "", toLocationCode: "",
jobStatus: "", jobStatus: "",
fromLocationCode:'' allowBiggerQty:"TRUE",//
}; };
}, },
@ -184,13 +197,16 @@
}); });
getDeliverDetail(that.id).then(res => { getDeliverDetail(that.id).then(res => {
uni.hideLoading(); uni.hideLoading();
if (res.data &&res.data.subList.length > 0) { if (res.data && res.data.subList.length > 0) {
that.jobContent = res.data; that.jobContent = res.data;
that.jobStatus = res.data.status; that.jobStatus = res.data.status;
that.subList = res.data.subList; that.subList = res.data.subList;
that.detailSource = getDataSource(that.detailSource, that.subList) // that.detailSource = res.data;
that.fromLocationCode = that.subList[0].fromLocationCode that.detailSource = getThreeDataSource(that.jobContent)
console.log(999,that.detailSource)
that.toLocationCode = that.subList[0].toLocationCode that.toLocationCode = that.subList[0].toLocationCode
that.allowBiggerQty = res.data.allowBiggerQty;
that.resizeCollapse(); that.resizeCollapse();
} else { } else {
that.showMessage('未获取到详情'); that.showMessage('未获取到详情');
@ -207,14 +223,201 @@
resizeCollapse() { resizeCollapse() {
this.$nextTick(r => { this.$nextTick(r => {
this.$refs.comIssueDetailCard.forEach(r => { this.$refs.comIssueDetailCardBatch.forEach(r => {
r.resizeCollapse(); r.resizeCollapse();
}) })
}); });
}, },
getScanResult(result, managementTypeParams) {
console.log(222,result)
this.managementType = managementTypeParams
if(managementTypeParams == "BY_BATCH" ||managementTypeParams == "BY_QUANTITY" ){
this.setDataBatch(result)
}else{
this.setData(result)
}
},
setDataBatch(result) {
try {
let that = this
this.balanceinfo = result.balance
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("没有库存余额")
return;
}
console.log(9558,result)
// var inventoryStatus = "OK";
var detail = this.detailSource.find(r => r.itemCode == itemCode);
if (detail == undefined) {
this.showErrorMessage("物料号【" + itemCode + "】不在列表中")
} else {
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 + "")
console.log(222,this.fromLocationCode)
detail.subList.push({
scaned:true,
fromLocationCode:this.fromLocationCode,
toLocationCode:this.toLocationCode,
batch:result.label.batch,
handleQty:result.label.qty,
qty:result.balance.qty,
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,
// packList:[{
// scaned : true,
// handleQty : Number(result.label.qty),
// toLocationCode : result.balance.toLocationCode,
// }]
})
console.log(999,detail)
detail.handleQty = 0
detail.qty = 0
detail.subList.forEach(item=>{
detail.handleQty = calc.add(detail.handleQty,item.handleQty)
detail.qty = calc.add(detail.qty,item.qty)
// item.packList.forEach(cur=>{
// cur.handleQty = calc.add(detail.handleQty,item.handleQty)
// })
})
setTimeout(r => {
that.resizeCollapse();
that.$forceUpdate()
}, 100)
} else {
if (!isExit.cancleScanedHiht && isExit.scaned) {
// this.showMessage("" + batch + "")
} 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;
}
itemDetail.handleQty = calc.add(itemDetail.handleQty,result.label.qty);
detail.handleQty = 0
detail.balance = result.balance,
detail.subList.forEach(item=>{
detail.handleQty = calc.add(detail.handleQty,item.handleQty)
// item.packList.forEach(cur=>{
// cur.handleQty = calc.add(detail.handleQty,item.handleQty)
// })
})
// calcHandleQtyAdd(this.detailSource, result.label);
}
this.continueScan()
this.$forceUpdate()
} else {
var scanedLength = 0;
// itemDetail.packList.forEach(res => {
// if (res.scaned) {
// scanedLength++;
// }
// })
//
itemDetail.fromInventoryStatus = result.balance.inventoryStatus;
if (itemDetail.scaned ) {
// this.showMessage("" + packingNumber + "")
// calcHandleQtyAdd(this.detailSource, result.label);
itemDetail.balance=result.balance
itemDetail.balanceQty=result.balance.qty
itemDetail.uom=result.balance.uom,
itemDetail.handleQty = calc.add(itemDetail.handleQty,result.label.qty);
detail.handleQty = 0
detail.subList.forEach(item=>{
detail.handleQty = calc.add(detail.handleQty,item.handleQty)
})
} else {
debugger
itemDetail.scaned = true;
this.detailSource[0].subList.sort(compareAsc('scaned')); //
itemDetail.handleQty = result.label.qty;
itemDetail.scaned = true
itemDetail.balance=result.balance
itemDetail.balanceQty=result.balance.qty
itemDetail.uom=result.balance.uom
itemDetail.packQty=result.package.packQty
itemDetail.packUnit=result.package.packUnit
itemDetail.fromlocationCode=this.fromLocationCode
itemDetail.toLocationCode=this.toLocationCode
// itemDetail.toInventoryStatus = "OK"
// itemDetail.packList.forEach(pac => {
// pac.scaned = true
// pac.handleQty = Number(result.label.qty);
// pac.toLocationCode = result.balance.toLocationCode;
// })
detail.handleQty = 0
detail.subList.forEach(item=>{
detail.handleQty = calc.add(detail.handleQty,item.handleQty)
// item.packList.forEach(cur=>{
// cur.handleQty = calc.add(detail.handleQty,item.handleQty)
// })
})
// calcTreeHandleQty(this.detailSource);
this.continueScan()
this.$forceUpdate()
}
}
}
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
detail.packingNumber = ''
})
})
} catch (e) {
this.showMessage(e.message)
}
},
//
continueScan() {
this.scanCount = getScanCount(this.subList);
if (this.scanCount == this.subList.length) {
this.closeScanPopup();
} else {
this.scanPopupGetFocus();
}
},
submit() { submit() {
uni.showLoading({ uni.showLoading({
title: "提交中....", title: "提交中....",
@ -223,31 +426,45 @@
// //
var itemCodes = [] var itemCodes = []
let locationCode = this.detailSource[0].toLocationCode //
this.detailSource.forEach(toLocationCode => { var itemCodes = []
toLocationCode.Items.forEach(item => { let locationCode = this.detailSource[0].subList[0].toLocationCode
itemCodes.push(item.itemCode) this.detailSource.forEach(toLocation => {
}) itemCodes.push(toLocation.itemCode)
}) })
console.log( this.detailSource)
//使
if (locationCode == null) {
this.submitJob();
} else {
// //
getManagementPrecisions(itemCodes, locationCode, res => { getManagementPrecisions(itemCodes, locationCode, res => {
if (res.success) { if (res.success) {
this.managementList = res.list; this.managementList = res.list;
console.log(res)
this.managementType = this.managementList && this.managementList[0] ? this.managementList[0].ManagementPrecision : 'BY_PACKAGING'
this.submitJob(); this.submitJob();
} else { } else {
uni.hideLoading(); uni.hideLoading();
this.showErrorMessage(res.message); // this.showErrorMessage(res.message);
} }
}); });
} // //使
// if (locationCode == null) {
// this.submitJob();
// } else {
// //
// getManagementPrecisions(itemCodes, locationCode, res => {
// if (res.success) {
// this.managementList = res.list;
// this.submitJob();
// } else {
// uni.hideLoading();
// this.showErrorMessage(res.message);
// }
// });
// }
}, },
checkCount(){ checkCount() {
let str="" let str=""
this.detailSource.forEach(detail => { this.detailSource.forEach(detail => {
detail.Items.forEach(item => { detail.Items.forEach(item => {
@ -257,18 +474,6 @@
item.Locations.forEach(lco => { item.Locations.forEach(lco => {
lco.Batchs.forEach(batch => { lco.Batchs.forEach(batch => {
batch.Records.forEach(record => { batch.Records.forEach(record => {
// if (batch.qty != record.qty) {
// var tempHandleQty = 0
// if (record.qty) {
// tempHandleQty = record.qty
// } else {
// tempHandleQty = 0
// }
// if (batch.qty != 0) {
// str +=
// `${record.packingNumber}${tempHandleQty}${batch.qty}\n`
// }
// }
if(record){ if(record){
var hanleQty =record.qty?record.qty:0 var hanleQty =record.qty?record.qty:0
totalQty = calc.add(totalQty,hanleQty) totalQty = calc.add(totalQty,hanleQty)
@ -299,27 +504,90 @@
} }
return str?false:true return str?false:true
},
checkCountBatch() {
let str = ""
let str1 = ""
let str2 = ""
this.detailSource.forEach(detail => {
var taskQty = 0;
var totalQty = 0;
detail.subList.forEach(item => {
if(item.scaned){
item.taskQty=0
item.totalQty=0
item.taskQty =calc.add(item.taskQty,item.qty)
item.totalQty =calc.add(item.totalQty,item.handleQty)
if (this.jobContent.allowPartialComplete == "FALSE") {
if(item.handleQty!=item.taskQty){
str += `批次【${item.batch}】提交数量【${item.handleQty}】与任务物料数量【${item.taskQty}】不一致\n`
}
}
if (this.allowBiggerQty == 'FALSE') {
if ( item.taskQty < item.totalQty) {
str1 += '数量[' + item.totalQty + ']不允许大于任务数量[' + item.taskQty + ']'
}
}
if(item.handleQty>item.balance.qty){
str2 += `批次【${item.batch}】提交数量【${item.handleQty}】不可以大于库存数量【${item.balance.qty}`
}
}
})
})
if (str) {
str = '不允许提交\n' + str
this.showErrorMessage(str)
}
if (str1) {
str1 = '不允许提交\n' + str1
this.showErrorMessage(str1)
}
if (str2) {
str2 = '不允许提交\n' + str2
this.showErrorMessage(str2)
}
return str || str1 || str2 ? false : true
}, },
submitJob() { submitJob() {
var params = this.setParams() var params = this.setParams()
console.log("提交参数", JSON.stringify(params)); console.log("提交参数", params);
const isTrue = params.subList.some(item=>{
if (params.subList.length == 0) { console.log(item.recordList.some(cur=>cur.scaned))
return item.recordList.some(cur=>cur.scaned) == true
})
if(!isTrue){
uni.hideLoading() uni.hideLoading()
this.$refs.comMessage.showConfirmMessageModal('请扫描箱码') this.showErrorMessage("请扫描您需要提交的发货任务")
return return
} }
// return;
if(!this.checkCount()){ // if (params.subList.length == 0) {
// uni.hideLoading()
// this.$refs.comMessage.showConfirmMessageModal('')
// return
// }
if(this.managementType == "BY_BATCH" ||this.managementType == "BY_QUANTITY" ){
if (!this.checkCountBatch()) {
uni.hideLoading()
return;
}
}else{
if (!this.checkCount()) {
uni.hideLoading() uni.hideLoading()
return ; return;
} }
}
debugger
deliverJobSubmit(params).then(res => { deliverJobSubmit(params).then(res => {
uni.hideLoading() uni.hideLoading()
if (res.data) { if (res.data) {
this.showCommitSuccessMessage("提交成功\n生成发货记录\n" + res.data) this.showCommitSuccessMessage("提交成功\n生成发货记录\n" + res.data)
} else { } else {
this.showErrorMessage("提交失败[" + res.msg + "]") this.showErrorMessage("提交失败[" + res.msg + "]")
@ -334,55 +602,34 @@
var subList = [] var subList = []
var createTime = getCurrDateTime(); var createTime = getCurrDateTime();
var creator = this.$store.state.user.id var creator = this.$store.state.user.id
console.log(222,this.detailSource)
this.detailSource.forEach(toLocationCode => { this.detailSource.forEach(toLocationCode => {
toLocationCode.Items.forEach(item => { let obj = {...toLocationCode}
item.Locations.forEach(fromLocation => { delete obj.subList
fromLocation.Batchs.forEach(batch => { obj.recordList = []
let subItem = batch.detail; let obj1 ={}
subItem.recordList = []; let arr = toLocationCode.subList.filter(item=>item.scaned)
if (batch.Records.length > 0) { arr.forEach(record=>{
batch.Records.forEach(r => { obj1.scaned =record.scaned;
let record = {}; obj1.handleQty =record.handleQty;
record.handleQty = r.qty; obj1.fromLocationCode =record.fromLocationCode;
record.fromPackingNumber = r obj1.fromInventoryStatus =record.fromInventoryStatus;
.packingNumber; obj1.copyContent =record.copyContent;
record.toContainerNumber = r obj1.toContainerNumber = record.ContainerNumber;
.ContainerNumber; obj1.toInventoryStatus =record.inventoryStatus;
record.toInventoryStatus = r obj1.toLocationCode = record.toLocationCode;
.inventoryStatus; obj1.supplierCode = record.supplierCode;
// record.toLocationCode = subItem obj1.toPackingNumber ='';
// .toLocationCode; obj1.packingNumber = ''
record.toLocationCode = this.toLocationCode; obj1.fromPackingNumber = '';
record.supplierCode = r.supplierCode; obj1.toBatch = record.batch;
obj1.toPackingNumber = '';
//使 obj1.packingNumber = '';
if (this.toLocationCode == null) { obj1.fromPackingNumber ='';
record.toPackingNumber = r obj.recordList.push(obj1)
.packingNumber;
record.toBatch = r.batch;
} else {
var info =
getPackingNumberAndBatch(
this.managementList, r
.itemCode,
r.packingNumber, r
.batch);
record.toPackingNumber = info
.packingNumber;
record.toBatch = info.batch;
}
record.fromParentPackingNumber = r
.parentPackingNumber;
subItem.toLocationCode = this.toLocationCode
subItem.recordList.push(record);
})
subList.push(deepCopyData(subItem));
}
}) })
subList.push(obj)
}) })
})
})
this.jobContent.subList = subList this.jobContent.subList = subList
this.jobContent.createTime = createTime; this.jobContent.createTime = createTime;
this.jobContent.creator = creator; this.jobContent.creator = creator;
@ -420,30 +667,12 @@
}, },
updateData(record) { updateData(record) {
let requestLocation = this.detailSource.find(r => r.toLocationCode == record.toLocationCode); calcHandleQty(this.detailSource);
let item = requestLocation.Items.find(r => r.itemCode == record.itemCode);
let itemHandleQty = 0;
if (item != undefined) {
item.Locations.forEach(l => {
let batch = l.Batchs.find(b => (b.packingNumber == record.packingNumber || b
.packingNumber == null || b.packingNumber == '') && b.batch ==
record.batch);
let handleQty = 0;
if (batch != undefined) {
batch.Records.forEach(res => {
handleQty = calc.add(handleQty, res.qty)
})
batch.handleQty = handleQty;
itemHandleQty = calc.add(itemHandleQty, handleQty)
}
})
}
// item.handleQty=itemHandleQty;
}, },
scanPopupGetFocus() { scanPopupGetFocus() {
if (this.$refs.scanPopup != undefined) { if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.getfocus(); this.$refs.scanPopup.packGetFocus();
} }
}, },
@ -496,15 +725,42 @@
this.dataContent = result; this.dataContent = result;
this.$forceUpdate(); this.$forceUpdate();
}, },
openScanDetailPopup() { // openScanDetailPopup() {
var datacontent = {} // var datacontent = {}
// // //
// Object.assign(datacontent, this.detailSource); // // Object.assign(datacontent, this.detailSource);
this.$refs.comScanIssuePack.openScanPopup(this.detailSource, this.jobContent); // this.$refs.comScanIssuePack.openScanPopup(this.detailSource, this.jobContent);
}, // },
closeScanPopup() { closeScanPopup() {
this.updateCommitBtn(); // this.updateCommitBtn();
},
openScanPopup() {
let fromLocationCode = '';
let fromlocationList = [];
for (var i = 0; i < this.detailSource.length; i++) {
let item = this.detailSource[i];
item.subList.forEach(l => {
//
var location = fromlocationList.find(res => res == l.fromLocationCode)
if (location == undefined) {
fromlocationList.push(l.fromLocationCode);
}
//
if (fromLocationCode == '') {
if (!l.scaned) {
fromLocationCode = l.fromLocationCode;
}
}
})
}
this.fromLocationCode = fromLocationCode
console.log(this.fromLocationCode)
this.$refs.scanPopup.openScanPopupForJob(fromLocationCode, fromlocationList, this.jobContent);
},
}, },
confirmFromLocation(fromLocationCodeParams){
this.fromlocationCode = fromLocationCodeParams
} }
}; };
</script> </script>

Loading…
Cancel
Save