王志国
3 weeks ago
4 changed files with 1586 additions and 1716 deletions
@ -1,139 +1,122 @@ |
|||
<template> |
|||
<view> |
|||
<!-- <requiredLocation title="需求库位" :locationCode="dataContent.toLocationCode" |
|||
:isShowEdit="dataContent.allowModifyLocation==1"></requiredLocation> --> |
|||
<view> |
|||
<!-- <requiredLocation title="需求库位" :locationCode="dataContent.toLocationCode" |
|||
:isShowEdit="dataContent.allowModifyLocation==1"></requiredLocation> --> |
|||
|
|||
<view v-for="(item,index) in dataContent.subList" style="margin-bottom: 20rpx;"> |
|||
<uni-swipe-action ref="swipeAction" :class="item.scaned? 'scan_view':''"> |
|||
<uni-swipe-action-item |
|||
:right-options="(item.scaned&&isEdit)?editAndRemoveOptions : item.scaned? removeOptions:options" |
|||
@click="swipeClick($event,item,index)" style='padding:20rpx 0px 5px 0px;align-items: center;'> |
|||
<item-qty :dataContent="item" :handleQty="item.handleQty" :isShowBalanceQty="false"></item-qty> |
|||
<location :locationCode="item.fromLocationCode"></location> |
|||
<recommendBalanceBatch style='margin-left: 20px;' :detail="item" :isShowLocation="false" |
|||
:isShowPack="item.packingNumber"></recommendBalanceBatch> |
|||
|
|||
</uni-swipe-action-item> |
|||
</uni-swipe-action> |
|||
</view> |
|||
</view> |
|||
<qtyEdit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></qtyEdit> |
|||
<detail-info-popup ref="detailInfoPopup"></detail-info-popup> |
|||
<comMessage ref="message"></comMessage> |
|||
<view v-for="(item,index) in dataContent.subList" style="margin-bottom: 20rpx;"> |
|||
<u-swipe-action ref="swipeAction" |
|||
:options="(item.scaned&&isEdit)?editAndRemoveOptions : item.scaned? removeOptions:options" |
|||
@click="(...event)=>swipeClick(event,item,index)" |
|||
:class="item.scaned? 'scan_view':''"> |
|||
<item-qty :dataContent="item" :handleQty="item.handleQty" :isShowBalanceQty="false"></item-qty> |
|||
<location :locationCode="item.fromLocationCode"></location> |
|||
<recommendBalanceBatch style='margin-left: 20px;' :detail="item" :isShowLocation="false" |
|||
:isShowPack="item.packingNumber"></recommendBalanceBatch> |
|||
</u-swipe-action> |
|||
</view> |
|||
</view> |
|||
<qtyEdit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></qtyEdit> |
|||
<detail-info-popup ref="detailInfoPopup"></detail-info-popup> |
|||
<comMessage ref="message"></comMessage> |
|||
</template> |
|||
|
|||
<script> |
|||
import itemQty from '@/mycomponents/item/itemQty.vue' |
|||
import recommend from '@/mycomponents/recommend/recommend.vue' |
|||
import recommendBalanceBatch from '@/mycomponents/balance/recommendBalanceBatch.vue' |
|||
import handleBalance from '@/mycomponents/balance/handleBalance.vue' |
|||
import recommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue' |
|||
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue' |
|||
import requiredLocation from '@/mycomponents/location/requiredLocation.vue' |
|||
import qtyEdit from '@/mycomponents/qty/qtyEdit.vue' |
|||
import location from '@/mycomponents/balance/location.vue' |
|||
import detailInfoPopup from '@/pages/productionReceipt/coms/detailInfoPopup.vue' |
|||
<script setup lang="ts"> |
|||
import itemQty from '@/mycomponents/item/itemQty.vue' |
|||
import recommend from '@/mycomponents/recommend/recommend.vue' |
|||
import recommendBalanceBatch from '@/mycomponents/balance/recommendBalanceBatch.vue' |
|||
import handleBalance from '@/mycomponents/balance/handleBalance.vue' |
|||
import recommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue' |
|||
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue' |
|||
import requiredLocation from '@/mycomponents/location/requiredLocation.vue' |
|||
import qtyEdit from '@/mycomponents/qty/qtyEdit.vue' |
|||
import location from '@/mycomponents/balance/location.vue' |
|||
import detailInfoPopup from '@/pages/productionReceipt/coms/detailInfoPopup.vue' |
|||
|
|||
import { |
|||
getDetailOption, |
|||
getPurchaseReceiptOption, |
|||
getRemoveOption, |
|||
getEditRemoveOption |
|||
} from '@/common/array.js'; |
|||
getDetailOption, |
|||
getPurchaseReceiptOption, |
|||
getRemoveOption, |
|||
getEditRemoveOption |
|||
} from '@/common/array.js'; |
|||
|
|||
import {ref, nextTick, onMounted} from 'vue'; |
|||
|
|||
const props = defineProps({ |
|||
dataContent: { |
|||
type: Object, |
|||
default: () => ({}) |
|||
}, |
|||
settingParam: { |
|||
type: Object, |
|||
default: () => ({}) |
|||
}, |
|||
isEdit: { |
|||
type: Boolean, |
|||
default: true |
|||
} |
|||
}); |
|||
const emit = defineEmits(['updateData']); |
|||
|
|||
export default { |
|||
emits: ['updateData'], |
|||
components: { |
|||
itemQty, |
|||
recommend, |
|||
recommendBalanceBatch, |
|||
handleBalance, |
|||
recommendQtyEdit, |
|||
requiredLocation, |
|||
qtyEdit, |
|||
location, |
|||
detailInfoPopup |
|||
}, |
|||
props: { |
|||
dataContent: { |
|||
type: Object, |
|||
default: {} |
|||
}, |
|||
settingParam: { |
|||
type: Object, |
|||
default: {} |
|||
}, |
|||
isEdit: { |
|||
type: Boolean, |
|||
default: true |
|||
}, |
|||
}, |
|||
watch: { |
|||
const option = ref([]); |
|||
const showItem = ref({}); |
|||
const editItem = ref({}); |
|||
const batchItem = ref({}); |
|||
const detailOptions = ref([]); |
|||
const scanOptions = ref([]); |
|||
const removeOptions = ref([]); |
|||
const editAndRemoveOptions = ref([]); |
|||
const collapse = ref(null); |
|||
const balanceQtyEdit = ref(null); |
|||
const receiptHint = ref(null); |
|||
const message = ref(null); |
|||
onMounted(() => { |
|||
removeOptions.value = getRemoveOption(); |
|||
editAndRemoveOptions.value = getEditRemoveOption(); |
|||
}); |
|||
|
|||
}, |
|||
const resizeCollapse = () => { |
|||
nextTick(() => { |
|||
collapse.value.forEach(r => { |
|||
r.childrens.forEach(i => { |
|||
i.init(); |
|||
}); |
|||
r.resize(); |
|||
}); |
|||
}); |
|||
}; |
|||
|
|||
data() { |
|||
return { |
|||
option: [], |
|||
showItem: {}, |
|||
editItem: {}, |
|||
batchItem: {}, |
|||
detailOptions: [], |
|||
scanOptions: [] |
|||
} |
|||
}, |
|||
const swipeClick = (e, item, index) => { |
|||
if (e.content.text === "编辑") { |
|||
edit(item); |
|||
} else if (e.content.text === "移除") { |
|||
remove(item, index); |
|||
} |
|||
}; |
|||
|
|||
mounted() { |
|||
|
|||
this.removeOptions = getRemoveOption(); |
|||
this.editAndRemoveOptions = getEditRemoveOption() |
|||
}, |
|||
const edit = (item) => { |
|||
editItem.value = item; |
|||
balanceQtyEdit.value.openEditPopup(item); |
|||
}; |
|||
|
|||
methods: { |
|||
resizeCollapse() { |
|||
this.$nextTick(r => { |
|||
this.$refs.collapse.forEach(r => { |
|||
r.childrens.forEach(i => { |
|||
i.init(); |
|||
}) |
|||
r.resize(); |
|||
}) |
|||
}); |
|||
}, |
|||
const detail = (item) => { |
|||
showItem.value = item; |
|||
receiptHint.value.openScanPopup(); |
|||
}; |
|||
|
|||
swipeClick(e, item, index) { |
|||
if (e.content.text == "编辑") { |
|||
this.edit(item) |
|||
} else if (e.content.text == "移除") { |
|||
this.remove(item, index) |
|||
} |
|||
}, |
|||
const remove = (item, index) => { |
|||
message.value.showQuestionMessage("确定移除扫描信息?", (res) => { |
|||
if (res) { |
|||
item.handleQty = 0; |
|||
item.scaned = false; |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
edit(item) { |
|||
let that = this; |
|||
that.editItem = item; |
|||
that.$refs.balanceQtyEdit.openEditPopup(item); |
|||
}, |
|||
const confirm = (val) => { |
|||
editItem.value.handleQty = Number(val); |
|||
emit('updateData', editItem.value); |
|||
}; |
|||
|
|||
detail(item) { |
|||
this.showItem = item; |
|||
this.$refs.receiptHint.openScanPopup() |
|||
}, |
|||
remove(item, index) { |
|||
this.$refs.message.showQuestionMessage("确定移除扫描信息?", |
|||
res => { |
|||
if (res) { |
|||
item.handleQty = 0; |
|||
item.scaned = false ; |
|||
} |
|||
}); |
|||
}, |
|||
confirm(val) { |
|||
this.editItem.handleQty = Number(val); |
|||
this.$emit('updateData', this.editItem) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style> |
|||
|
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -1,479 +1,437 @@ |
|||
<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> |
|||
<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 setup lang="ts"> |
|||
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' |
|||
|
|||
|
|||
import {ref} from 'vue'; |
|||
import {onLoad, onNavigationBarButtonTap, onBackPress} from '@dcloudio/uni-app'; |
|||
|
|||
const id = ref(''); |
|||
const jobContent = ref({}); |
|||
const subList = ref([]); |
|||
const detailSource = ref([]); |
|||
const detailOptions = ref([]); |
|||
const scanOptions = ref([]); |
|||
const status = ref(""); |
|||
const toLocationCode = ref(""); |
|||
const jobStatus = ref(""); |
|||
const dataContent = ref('') |
|||
|
|||
const managementList = ref([]); |
|||
const comMessage = ref(null); |
|||
const scanPopup = ref(null); |
|||
const comScanIssuePack = ref(null); |
|||
import {useCountStore} from '@/store' |
|||
const store = useCountStore(); |
|||
|
|||
onLoad((option) => { |
|||
uni.setNavigationBarTitle({ |
|||
title: option.title + '详情' |
|||
}); |
|||
id.value = option.id; |
|||
if (id.value != undefined) { |
|||
// 新建的任务自动接收 |
|||
if (option.status == "1") { |
|||
receive(() => { |
|||
getDetail(); |
|||
}); |
|||
} else { |
|||
getDetail(); |
|||
} |
|||
} |
|||
}); |
|||
|
|||
onNavigationBarButtonTap((e) => { |
|||
if (e.index === 0) { |
|||
goHome(); |
|||
} |
|||
}); |
|||
|
|||
onBackPress((e) => { |
|||
// 已经接收但是没提交任务 |
|||
if (e.from == 'backbutton') { |
|||
if (jobStatus.value == "2") { |
|||
// 取消承接任务 |
|||
cancleTakeDeliverJob(id.value).then(() => { |
|||
uni.navigateBack(); |
|||
}).catch(() => { |
|||
uni.navigateBack(); |
|||
}); |
|||
} else { |
|||
uni.navigateBack(); |
|||
} |
|||
return true; |
|||
} |
|||
}); |
|||
|
|||
const receive = (callback) => { |
|||
if (id.value != null) { |
|||
takeDeliverJob(id.value).then(() => { |
|||
callback(); |
|||
}).catch((error) => { |
|||
showErrorMessage(error); |
|||
}); |
|||
} |
|||
}; |
|||
|
|||
const getDetail = () => { |
|||
uni.showLoading({ |
|||
title: "加载中....", |
|||
mask: true |
|||
}); |
|||
getDeliverDetail(id.value).then((res) => { |
|||
uni.hideLoading(); |
|||
if (res.data && res.data.subList.length > 0) { |
|||
jobContent.value = res.data; |
|||
jobStatus.value = res.data.status; |
|||
subList.value = res.data.subList; |
|||
detailSource.value = res.data; |
|||
toLocationCode.value = subList.value[0].toLocationCode; |
|||
resizeCollapse(); |
|||
} else { |
|||
showMessage('未获取到详情'); |
|||
} |
|||
}).catch((error) => { |
|||
uni.hideLoading(); |
|||
showErrorMessage(error); |
|||
}); |
|||
}; |
|||
|
|||
const closeScan = () => { |
|||
resizeCollapse(); |
|||
}; |
|||
|
|||
const resizeCollapse = () => { |
|||
// 实现具体逻辑 |
|||
}; |
|||
|
|||
const submit = () => { |
|||
uni.showLoading({ |
|||
title: "提交中....", |
|||
mask: true |
|||
}); |
|||
|
|||
// 目前任务只到一个库位 |
|||
const itemCodes = []; |
|||
const locationCode = detailSource.value.subList[0].toLocationCode; |
|||
detailSource.value.subList.forEach((item) => { |
|||
itemCodes.push(item.itemCode); |
|||
}); |
|||
|
|||
// 获取管理模式,封装参数 |
|||
getManagementPrecisions(itemCodes, locationCode, (res) => { |
|||
if (res.success) { |
|||
managementList.value = res.list; |
|||
submitJob(); |
|||
} else { |
|||
uni.hideLoading(); |
|||
showErrorMessage(res.message); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
const checkCount = () => { |
|||
let str = ""; |
|||
let taskQty = 0; |
|||
let totalQty = 0; |
|||
detailSource.value.subList.forEach((item) => { |
|||
taskQty = calc.add(taskQty, item.qty); |
|||
const handleQty = item.qty ? item.qty : 0; |
|||
totalQty = calc.add(totalQty, handleQty); |
|||
// 实际扫描的数量 |
|||
item.totalQty = totalQty; |
|||
}); |
|||
|
|||
// 如果允许部分提交任务有扫描记录就可以直接提交;如果不允许部分执行,任务数量和提交数量不一致给出提示 |
|||
if (jobContent.value.allowPartialComplete == "FALSE") { |
|||
detailSource.value.subList.forEach((detail) => { |
|||
if (taskQty != totalQty) { |
|||
str += `物料号【${detail.itemCode}】任务数量【${taskQty}】与实际提交数量【${totalQty}】不一致\n`; |
|||
} |
|||
}); |
|||
} |
|||
|
|||
if (str) { |
|||
str = '不允许提交\n' + str; |
|||
showErrorMessage(str); |
|||
} |
|||
|
|||
return str ? false : true; |
|||
}; |
|||
|
|||
const submitJob = () => { |
|||
const params = setParams(); |
|||
console.log("提交参数", params); |
|||
if (params.subList.length == 0) { |
|||
uni.hideLoading(); |
|||
comMessage.value.showConfirmMessageModal('请扫描箱码'); |
|||
return; |
|||
} |
|||
|
|||
if (!checkCount()) { |
|||
uni.hideLoading(); |
|||
return; |
|||
} |
|||
|
|||
deliverJobSubmit(params).then((res) => { |
|||
uni.hideLoading(); |
|||
if (res.data) { |
|||
showCommitSuccessMessage("提交成功\n生成发货记录\n" + res.data); |
|||
} else { |
|||
showErrorMessage("提交失败[" + res.msg + "]"); |
|||
} |
|||
}).catch((error) => { |
|||
uni.hideLoading(); |
|||
showErrorMessage(error); |
|||
}); |
|||
}; |
|||
|
|||
const setParams = () => { |
|||
const subList = []; |
|||
const createTime = getCurrDateTime(); |
|||
const creator = store.id; |
|||
|
|||
detailSource.value.subList.forEach((r) => { |
|||
if (r.scaned) { |
|||
const subItem = {...r}; |
|||
subItem.recordList = []; |
|||
const record = {}; |
|||
record.handleQty = r.handleQty; |
|||
record.toContainerNumber = r.ContainerNumber; |
|||
record.toInventoryStatus = r.inventoryStatus; |
|||
record.toLocationCode = subItem.toLocationCode; |
|||
record.supplierCode = r.supplierCode; |
|||
const info = getPackingNumberAndBatch(managementList.value, 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; |
|||
subItem.recordList.push(record); |
|||
subList.push(deepCopyData(subItem)); |
|||
} |
|||
}); |
|||
|
|||
jobContent.value.subList = subList; |
|||
jobContent.value.createTime = createTime; |
|||
jobContent.value.creator = creator; |
|||
return jobContent.value; |
|||
}; |
|||
|
|||
const cancel = () => { |
|||
comMessage.value.showQuestionMessage('是否要清空已扫描的物料和目标库位信息?', (res) => { |
|||
if (res) { |
|||
clearInfo(); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
const clearInfo = () => { |
|||
dataContent.value.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; |
|||
}); |
|||
} |
|||
}); |
|||
} |
|||
}); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
const updateData = (record) => { |
|||
}; |
|||
|
|||
const scanPopupGetFocus = () => { |
|||
if (scanPopup.value != undefined) { |
|||
scanPopup.value.getfocus(); |
|||
} |
|||
}; |
|||
|
|||
const showMessage = (message) => { |
|||
comMessage.value.showMessage(message, (res) => { |
|||
if (res) { |
|||
afterCloseMessage(); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
const showErrorMessage = (message) => { |
|||
comMessage.value.showErrorMessage(message, (res) => { |
|||
if (res) { |
|||
afterCloseMessage(); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
const showScanMessage = (message) => { |
|||
comMessage.value.showScanMessage(message); |
|||
}; |
|||
|
|||
const showCommitSuccess = () => { |
|||
comMessage.value.showCommitSuccess(); |
|||
}; |
|||
|
|||
const showCommitSuccessMessage = (hint) => { |
|||
comMessage.value.showSuccessMessage(hint, (res) => { |
|||
navigateBack(1); |
|||
}); |
|||
}; |
|||
|
|||
const showRescanMessage = (message) => { |
|||
comMessage.value.showRescanMessage(message); |
|||
}; |
|||
|
|||
const afterCloseMessage = () => { |
|||
scanPopupGetFocus(); |
|||
}; |
|||
|
|||
const closeScanMessage = () => { |
|||
scanPopupGetFocus(); |
|||
}; |
|||
|
|||
const confirm = (data) => { |
|||
dataContent.value = data; |
|||
}; |
|||
|
|||
const confirmResult = (result) => { |
|||
dataContent.value = result; |
|||
}; |
|||
|
|||
const openScanDetailPopup = () => { |
|||
const datacontent = {...detailSource.value}; // 深度克隆 |
|||
comScanIssuePack.value.openScanPopup(datacontent, jobContent.value); |
|||
}; |
|||
|
|||
const closeScanPopup = () => { |
|||
// 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; |
|||
// } |
|||
.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> |
Loading…
Reference in new issue