Browse Source

page/deliver/job 文件迁移 8/8-10/25

hella_vue3
王志国 4 weeks ago
parent
commit
7eece6e49d
  1. 99
      src/pages/deliver/job/deliverDetail.vue
  2. 479
      src/pages/deliver/job/deliverDetailBatch.vue
  3. 19
      src/pages/deliver/job/deliverJob.vue

99
src/pages/deliver/job/deliverDetail.vue

@ -13,7 +13,7 @@
<view class="cell_box uni-flex uni-row">
<view class="cell_info">
<view class="text_lightblue">发货类型</view>
<view>{{ jobContent.deliverType }}</view>
<view style="line-height: 34rpx;">{{ jobContent.deliverType }}</view>
</view>
<view class="cell_info">
@ -31,18 +31,20 @@
</view>
<view class="page-main">
<scroll-view scroll-y="true" class="">
<scroll-view scroll-y="true" class="page-main-scroll">
<view v-for="(toLocation, index) in detailSource">
<comDeliverDetailCard ref="comIssueDetailCardRef" :dataContent="toLocation" @updateData="updateData"> </comDeliverDetailCard>
<comDeliverDetailCard ref="comIssueDetailCardRef" :dataContent="toLocation" :settingParam="jobContent" @updateData="updateData"> </comDeliverDetailCard>
</view>
</scroll-view>
</view>
<div class="btn_bottom" style="width: 100%">
<view class="" style="display: flex; flex-direction: row">
<button class="btn_commit" hover-class="btn_commit_after" style="flex: 1" @click="submit()">提交</button>
<view class="page-footer" style="width: 100%">
<view class="uni-flex u-col-center space-between padding_10" style="background-color:ghostwhite; width: 100%;">
<view class="uni-flex uni-row">
<button class="btn_single_commit" hover-class="btn_commit_after" style="flex: 1" @click="submit()">提交</button>
</view>
</view>
</div>
</view>
<win-scan-button @goScan="openScanDetailPopup"></win-scan-button>
<comScanDeliverPack ref="comScanIssuePackRef" @closeScan="closeScan" @updateData="updateData"> </comScanDeliverPack>
<com-message ref="comMessageRef" />
@ -56,7 +58,7 @@ import { getDeliverDetail, takeDeliverJob, cancleTakeDeliverJob, deliverJobSubmi
import { calc } from '@/common/calc.js'
import { goHome, navigateBack, getRemoveOption, getCurrDateTime, getPackingNumberAndBatch } from '@/common/basic.js'
import { goHome, navigateBack, getRemoveOption, getCurrDateTime, getPackingNumberAndBatch,deepCopyData } from '@/common/basic.js'
import { getDataSource } from '@/pages/issue/js/issue.js'
@ -142,21 +144,15 @@ const getDetail = () => {
getDeliverDetail(id.value)
.then((res) => {
uni.hideLoading()
if (res.data == null) {
showMessage('未获取到详情')
} else if (res.data.subList.length > 0) {
if (res.data && res.data.subList.length > 0) {
jobContent.value = res.data
jobStatus.value = res.data.status
subList.value = res.data.subList
detailSource.value = getDataSource(detailSource.value, subList.value)
toLocationCode.value = subList.value[0].toLocationCode
setTimeout((r) => {
resizeCollapse()
}, 100)
uni.hideLoading()
resizeCollapse()
} else {
showMessage('列表数据为0')
showMessage('未获取到详情')
}
})
.catch((error) => {
@ -202,6 +198,57 @@ const submit = () => {
})
}
}
const checkCount = ()=>{
let str = ""
detailSource.value.forEach(detail => {
detail.Items.forEach(item => {
let taskQty = 0;
item.taskQty = calc.add(taskQty, item.qty)
let totalQty = 0;
item.Locations.forEach(lco => {
lco.Batchs.forEach(batch => {
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) {
let hanleQty = record.qty ? record.qty : 0
totalQty = calc.add(totalQty, hanleQty)
}
})
})
})
//
item.totalQty = totalQty
})
})
//
detailSource.value.forEach(detail => {
detail.Items.forEach(item => {
if (jobContent.value.allowPartialComplete == "FALSE") {
if (item.taskQty != item.totalQty) {
str += `物料号【${item.itemCode}】任务数量【${item.taskQty}】与实际提交数量【${item.totalQty}】不一致\n`
}
}
})
})
if (str) {
str = '不允许提交\n' + str
showErrorMessage(str)
}
return str ? false : true
}
const submitJob = () => {
const params = setParams()
if (params.subList.length == 0) {
@ -209,11 +256,15 @@ const submitJob = () => {
comMessageRef.value.showConfirmMessageModal('请扫描箱码')
return
}
if(!checkCount()){
uni.hideLoading()
return;
}
deliverJobSubmit(params)
.then((res) => {
uni.hideLoading()
if (res.data) {
showCommitSuccessMessage(`提交成功<br>生成发货记录<br>${res.data}`)
showCommitSuccessMessage(`提交成功\n生成发货记录\n${res.data}`)
} else {
showErrorMessage(`提交失败[${res.msg}]`)
}
@ -237,9 +288,11 @@ const setParams = () => {
batch.Records.forEach((r) => {
const record = {}
record.handleQty = r.qty
record.fromPackingNumber = r.packingNumber;
record.toContainerNumber = r.ContainerNumber
record.toInventoryStatus = r.inventoryStatus
record.toLocationCode = subItem.toLocationCode
// record.toLocationCode = subItem.toLocationCode
record.toLocationCode = toLocationCode.value;
record.supplierCode = r.supplierCode
// 使
@ -251,10 +304,11 @@ const setParams = () => {
record.toPackingNumber = info.packingNumber
record.toBatch = info.batch
}
record.fromPackingNumber = r.packingNumber
record.fromParentPackingNumber = r.parentPackingNumber
subItem.toLocationCode = toLocationCode.value
subItem.recordList.push(record)
})
subList.push(subItem)
subList.push(deepCopyData(subItem))
}
})
})
@ -326,9 +380,6 @@ const showErrorMessage = (message) => {
afterCloseMessage()
})
}
const showScanMessage = (message) => {
comMessageRef.value.showScanMessage(message)
}
const showCommitSuccess = () => {
comMessageRef.value.showCommitSuccess()
}

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

@ -0,0 +1,479 @@
<template>
<view class="page-wraper">
<view class="page-header">
<view class="header-view">
<view class="header_job_top">
<job-top :dataContent="jobContent"></job-top>
</view>
<view class="cen_card" style="padding: 5rpx;">
<view class="cell_box uni-flex uni-row">
<view class="cell_info">
<view class="text_lightblue">发货类型</view>
<view>{{jobContent.deliverType}}</view>
</view>
<view class="cell_info">
<view class="text_lightblue">客户代码</view>
<view>{{jobContent.customerCode}}</view>
</view>
<view class="cell_info">
<view class="text_lightblue">目标库位</view>
<view>{{toLocationCode}}</view>
</view>
</view>
</view>
</view>
</view>
<view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll">
<view>
<comDeliverDetailCardBatch ref='comIssueDetailCard' :dataContent="detailSource" :settingParam="jobContent"
@updateData='updateData'>
</comDeliverDetailCardBatch>
</view>
</scroll-view>
</view>
<view class="page-footer">
<view class="uni-flex u-col-center space-between padding_10" style="background-color:ghostwhite; width: 100%; ">
<view class="">
</view>
<view class=" uni-flex uni-row">
<button class="btn_single_commit" hover-class="btn_commit_after" @click="submit()">提交</button>
</view>
</view>
</view>
<win-scan-button @goScan='openScanDetailPopup'></win-scan-button>
<comScanDeliverPackBatch ref="comScanIssuePack" @closeScan='closeScan' @updateData='updateData'>
</comScanDeliverPackBatch>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
import {
getDeliverDetail,
takeDeliverJob,
cancleTakeDeliverJob,
deliverJobSubmit
} from '@/api/request2.js';
import {
calc
} from '@/common/calc.js';
import {
goHome,
navigateBack,
getRemoveOption,
getCurrDateTime,
getPackingNumberAndBatch,
deepCopyData
} from '@/common/basic.js';
import {
getDataSource
} from '@/pages/issue/js/issue.js';
import {
getManagementPrecisions
} from '@/common/balance.js';
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue'
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import comDeliverDetailCardBatch from '@/pages/deliver/coms/comDeliverDetailCardBatch.vue'
import comScanDeliverPackBatch from '@/pages/deliver/coms/comScanDeliverPackBatch.vue'
import jobTop from '@/mycomponents/job/jobTop.vue'
export default {
name: 'issueDetail',
components: {
jobDetailPopup,
winScanButton,
comDeliverDetailCardBatch,
comScanDeliverPackBatch,
jobTop
},
data() {
return {
id: '',
jobContent: {}, //
subList: [], //subList
detailSource: [], //
detailOptions: [],
scanOptions: [],
status: "",
toLocationCode: "",
jobStatus: ""
};
},
props: {
},
onLoad(option) {
uni.setNavigationBarTitle({
title: option.title + '详情'
})
this.id = option.id;
if (this.id != undefined) {
//
if (option.status == "1") {
this.receive((callback => {
this.getDetail();
}));
} else {
this.getDetail();
}
}
},
onNavigationBarButtonTap(e) {
if (e.index === 0) {
goHome();
}
},
//
onBackPress(e) {
//
if (e.from == 'backbutton') {
if (this.jobStatus == "2") {
//
cancleTakeDeliverJob(this.id).then(res => {
uni.navigateBack();
}).catch(error => {
uni.navigateBack();
})
} else {
uni.navigateBack();
}
return true;
}
},
methods: {
//
receive(callback) {
if (this.id != null) {
takeDeliverJob(this.id).then(res => {
callback();
}).catch(error => {
this.showErrorMessage(error)
})
}
},
getDetail() {
var that = this;
uni.showLoading({
title: "加载中....",
mask: true
});
getDeliverDetail(that.id).then(res => {
uni.hideLoading();
if (res.data && res.data.subList.length > 0) {
that.jobContent = res.data;
that.jobStatus = res.data.status;
that.subList = res.data.subList;
that.detailSource = res.data;
that.toLocationCode = that.subList[0].toLocationCode
that.resizeCollapse();
} else {
that.showMessage('未获取到详情');
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
},
closeScan() {
this.resizeCollapse();
},
resizeCollapse() {
},
submit() {
uni.showLoading({
title: "提交中....",
mask: true
});
//
var itemCodes = []
let locationCode = this.detailSource.subList[0].toLocationCode
this.detailSource.subList.forEach(item => {
itemCodes.push(item.itemCode)
})
//
getManagementPrecisions(itemCodes, locationCode, res => {
if (res.success) {
this.managementList = res.list;
this.submitJob();
} else {
uni.hideLoading();
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() {
let str = ""
var taskQty = 0;
var totalQty = 0;
this.detailSource.subList.forEach(item => {
item.taskQty = calc.add(taskQty, item.qty)
var hanleQty = item.qty ? item.qty : 0
totalQty = calc.add(totalQty, hanleQty)
//
item.totalQty = totalQty
})
//
this.detailSource.subList.forEach(detail => {
if (this.jobContent.allowPartialComplete == "FALSE") {
if (item.taskQty != item.totalQty) {
str += `物料号【${item.itemCode}】任务数量【${item.taskQty}】与实际提交数量【${item.totalQty}】不一致\n`
}
}
})
if (str) {
str = '不允许提交\n' + str
this.showErrorMessage(str)
}
return str ? false : true
},
submitJob() {
var params = this.setParams()
console.log("提交参数", params);
if (params.subList.length == 0) {
uni.hideLoading()
this.$refs.comMessage.showConfirmMessageModal('请扫描箱码')
return
}
if (!this.checkCount()) {
uni.hideLoading()
return;
}
deliverJobSubmit(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 = []
var createTime = getCurrDateTime();
var creator = this.$store.state.user.id
this.detailSource.subList.forEach(r => {
if (r.scaned) {
let subItem = {
...r
}
subItem.recordList = []
let record = {};
record.handleQty = r.handleQty;
record.toContainerNumber = r.ContainerNumber;
record.toInventoryStatus = r.inventoryStatus;
record.toLocationCode = subItem.toLocationCode;
record.supplierCode = r.supplierCode;
var info = getPackingNumberAndBatch(this.managementList, r.itemCode, r.packingNumber, r.batch);
record.toPackingNumber = info.packingNumber;
record.packingNumber = info.packingNumber;
record.fromPackingNumber = info.packingNumber;
record.toBatch = info.batch;
subItem.toPackingNumber = info.packingNumber;
subItem.packingNumber = info.packingNumber;
subItem.fromPackingNumber = info.packingNumber;
// //使
// if (this.toLocationCode == null) {
// record.toPackingNumber = r.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;
// }
subItem.recordList.push(record);
subList.push(deepCopyData(subItem));
}
})
this.jobContent.subList = subList
this.jobContent.createTime = createTime;
this.jobContent.creator = creator;
return this.jobContent;
},
cancel() {
let that = this;
this.$refs.comMessage.showQuestionMessage('是否要清空已扫描的物料和目标库位信息?', res => {
if (res) {
that.clearInfo();
}
});
},
clearInfo() {
this.dataContent.itemCodeList.forEach(res => {
if (res.recommendList != null) {
res.recommendList.forEach(res1 => {
if (res1.locationCodeList != null) {
res1.locationCodeList.forEach(res2 => {
if (res2.packingCodeList != null) {
res2.packingCodeList.forEach(res3 => {
res3.itemCode = "";
res3.qty = 0;
})
}
})
}
})
}
})
},
updateData(record) {
},
scanPopupGetFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.getfocus();
}
},
showMessage(message) {
this.$refs.comMessage.showMessage(message, res => {
if (res) {
this.afterCloseMessage()
}
});
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
this.afterCloseMessage()
}
});
},
showScanMessage(message) {
this.$refs.comMessage.showScanMessage(message);
},
showCommitSuccess() {
this.$refs.comMessage.showCommitSuccess();
},
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
navigateBack(1)
})
},
showRescanMessage(message) {
this.$refs.comMessage.showRescanMessage(message);
},
afterCloseMessage() {
this.scanPopupGetFocus();
},
closeScanMessage() {
this.scanPopupGetFocus();
},
confirm(data) {
this.dataContent = data;
},
confirmResult(result) {
this.dataContent = result;
this.$forceUpdate();
},
openScanDetailPopup() {
var datacontent = {}
//
// Object.assign(datacontent, this.detailSource);
this.$refs.comScanIssuePack.openScanPopup(this.detailSource, this.jobContent);
},
closeScanPopup() {
this.updateCommitBtn();
},
}
};
</script>
<style scoped lang="scss">
.uni-numbox__value {
width: 40px;
}
button[disabled] {
background-color: #3C9CFF;
color: #fff;
opacity: 0.7;
}
// /deep/ .input-value {
// font-size: 16px;
// }
// /deep/ .uni-collapse-item__title-text {
// font-size: 16px;
// }
// /deep/ .uni-collapse-item--border {
// border-bottom-width: 0px;
// border-bottom-color: #ebeef5;
// }
// /deep/ .uni-collapse-item--border {
// border-bottom-width: 1px;
// border-bottom-color: #ebeef5;
// }
</style>

19
src/pages/deliver/job/deliverJob.vue

@ -23,7 +23,7 @@ import { getDeliverJobList, cancleTakeDeliverJob } from '@/api/request2.js'
import { goHome, updateTitle } from '@/common/basic.js'
import { getDetailOption, getDetailGiveupOption } from '@/common/array.js'
import {getManagementPrecisions} from '@/common/balance.js';
import comEmptyView from '@/mycomponents/common/comEmptyView.vue'
import jobFilter from '@/mycomponents/job/jobFilter.vue'
import comDeliverJobCard from '@/pages/deliver/coms/comDeliverJobCard.vue'
@ -160,7 +160,22 @@ const getList = (type) => {
})
}
const openJobDetail = (item) => {
proxy.$tab.navigateTo(`./deliverDetail?id=${item.masterId}&status=${item.status}&title=${title.value}`)
getManagementPrecisions([item.itemCode], item.fromLocationCode, ret => {
if (ret.success) {
let managementList,
managementType
managementList = ret.list;
managementType = managementList.some(cur => cur.ManagementPrecision == 'BY_BATCH') ?
'BY_BATCH' : ''
if (managementType == 'BY_BATCH') {
proxy.$tab.navigateTo({
url: './deliverDetailBatch?id=' + item.masterId + '&status=' + item.status+'&title='+this.title
});
} else {
proxy.$tab.navigateTo(`./deliverDetail?id=${item.masterId}&status=${item.status}&title=${title.value}`)
}
}
})
}
const selectedItem = (item) => {
openJobDetail(item)

Loading…
Cancel
Save