You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

465 lines
11 KiB

1 year ago
<template>
<view class="page-wraper">
11 months ago
<view class="page-header">
<view class="header_job_top">
<job-top :dataContent="jobContent"></job-top>
11 months ago
</view>
<view class="header_item">
11 months ago
申请单号{{jobContent.requestNumber}}
</view>
11 months ago
<u-line color="#D8D8D8"></u-line>
11 months ago
<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.customerCode}}</view>
</view>
<view class="cell_info">
<view class="text_lightblue">客户寄售库</view>
<view>{{toLocationCode}}</view>
</view>
</view>
<u-line />
</view>
</view>
1 year ago
<view class="page-main">
12 months ago
<scroll-view scroll-y="true" class="">
<view v-for="(toLocation, index) in detailSource">
<comDeliverDetailCard ref='comIssueDetailCard' :dataContent="toLocation" @updateData='updateData'>
</comDeliverDetailCard>
1 year ago
</view>
</scroll-view>
</view>
1 year ago
12 months ago
<div class="btn_bottom">
<view class="" style="display: flex;flex-direction: row;">
1 year ago
<view class="">
12 months ago
<button class="btn_commit" hover-class="btn_commit_after" @click="submit()">提交</button>
1 year ago
</view>
</view>
12 months ago
</div>
<win-scan-button @goScan='openScanDetailPopup'></win-scan-button>
<comScanDeliverPack ref="comScanIssuePack" @closeScan='closeScan' @updateData='updateData'>
</comScanDeliverPack>
<comMessage ref="comMessage"></comMessage>
1 year ago
</view>
</template>
<script>
import {
getDeliverDetail,
getBasicLocationByCode,
1 year ago
takeDeliverJob,
1 year ago
cancleTakeDeliverJob,
deliverJobSubmit
} from '@/api/request2.js';
1 year ago
import {
calc
} from '@/common/calc.js';
1 year ago
import {
goHome,
12 months ago
updateTitle,
navigateBack,
12 months ago
getRemoveOption,
1 year ago
getCurrDateTime,
12 months ago
getDirectoryItemArray,
getPackingNumberAndBatch,
1 year ago
} from '@/common/basic.js';
import {
12 months ago
getDataSource
} from '@/pages/issue/js/issue.js';
import {
getManagementPrecisions
} from '@/common/balance.js';
1 year ago
12 months ago
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue'
1 year ago
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
12 months ago
import comDeliverDetailCard from '@/pages/deliver/coms/comDeliverDetailCard.vue'
import comScanDeliverPack from '@/pages/deliver/coms/comScanDeliverPack.vue'
1 year ago
import comMessage from '@/mycomponents/common/comMessage.vue'
11 months ago
import jobTop from '@/mycomponents/job/jobTop.vue'
1 year ago
export default {
12 months ago
name: 'issueDetail',
1 year ago
components: {
12 months ago
jobDetailPopup,
1 year ago
winScanButton,
12 months ago
comDeliverDetailCard,
comScanDeliverPack,
11 months ago
comMessage,
jobTop
1 year ago
},
data() {
return {
id: '',
jobContent: {}, //任务内容
1 year ago
subList: [], //接口返回的任务subList
1 year ago
detailSource: [], //绑定在页面上的数据源
12 months ago
detailOptions: [],
scanOptions: [],
status: "",
received: false,
toLocationCode: ""
1 year ago
};
},
12 months ago
props: {
},
1 year ago
onLoad(option) {
this.id = option.id;
if (this.id != undefined) {
//新建的任务自动接收
if (option.status == "1") {
this.receive((callback => {
this.received = true;
this.getDetail();
}));
} else {
this.getDetail();
}
}
1 year ago
},
12 months ago
1 year ago
onNavigationBarButtonTap(e) {
if (e.index === 0) {
goHome();
}
},
12 months ago
1 year ago
//拦截返回按钮事件
onBackPress(e) {
//已经接收但是没提交任务
if (e.from == 'backbutton') {
if (this.received) {
//取消承接任务
cancleTakeDeliverJob(this.id).then(res => {
uni.navigateBack();
}).catch(error => {
uni.navigateBack();
})
} else {
uni.navigateBack();
}
return true;
1 year ago
}
1 year ago
},
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 == null) {
that.showMessage('未获取到详情');
} else {
if (res.data.subList.length > 0) {
that.jobContent = res.data;
1 year ago
that.subList = res.data.subList;
12 months ago
that.detailSource = getDataSource(that.detailSource, that.subList)
that.toLocationCode = that.subList[0].toLocationCode
12 months ago
that.resizeCollapse();
1 year ago
} else {
that.showMessage('列表数据为0');
}
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
},
12 months ago
closeScan() {
this.resizeCollapse();
1 year ago
},
12 months ago
resizeCollapse() {
this.$nextTick(r => {
this.$refs.comIssueDetailCard.forEach(r => {
r.resizeCollapse();
})
});
1 year ago
},
1 year ago
12 months ago
submit() {
uni.showLoading({
title: "提交中....",
mask: true
});
1 year ago
12 months ago
//目前任务只到一个库位
var itemCodes = []
let locationCode = this.detailSource[0].toLocationCode
this.detailSource.forEach(toLocationCode => {
toLocationCode.Items.forEach(item => {
12 months ago
itemCodes.push(item.itemCode)
})
})
1 year ago
12 months ago
//使用在途库,不查询管理模式
if (this.jobContent.useOnTheWayLocation == 'TRUE') {
this.submitJob();
} else {
//获取管理模式,封装参数
getManagementPrecisions(itemCodes, locationCode, res => {
if (res.success) {
this.managementList = res.list;
this.submitJob();
} else {
uni.hideLoading();
this.showErrorMessage(res.message);
1 year ago
}
12 months ago
});
1 year ago
}
},
12 months ago
submitJob() {
var params = this.setParams()
console.log("提交参数", JSON.stringify(params));
1 year ago
12 months ago
deliverJobSubmit(params).then(res => {
uni.hideLoading()
if (res.data) {
this.showCommitSuccessMessage("提交成功<br>生成发货记录" + res.data)
1 year ago
} else {
this.showErrorMessage("提交失败[" + res.msg + "]")
1 year ago
}
12 months ago
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
1 year ago
},
12 months ago
setParams() {
var subList = []
var createTime = getCurrDateTime();
var creator = this.$store.state.user.id
this.detailSource.forEach(toLocationCode => {
toLocationCode.Items.forEach(item => {
item.Locations.forEach(fromLocation => {
fromLocation.Batchs.forEach(batch => {
let subItem = batch.detail;
subItem.recordList = [];
if (batch.Records.length > 0) {
batch.Records.forEach(r => {
let record = {};
record.handleQty = r.qty;
record.toContainerNumber = r
.ContainerNumber;
record.toInventoryStatus = r
.inventoryStatus;
record.toLocationCode = subItem
.toLocationCode;
record.supplierCode = r.supplierCode;
//使用在途库不改变管理模式
if (this.jobContent.useOnTheWayLocation ==
'TRUE') {
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(subItem);
}
})
1 year ago
})
})
})
1 year ago
12 months ago
this.jobContent.subList = subList
this.jobContent.createTime = createTime;
this.jobContent.creator = creator;
return this.jobContent;
},
1 year ago
12 months ago
cancel() {
let that = this;
this.$refs.comMessage.showQuestionMessage('是否要清空已扫描的物料和目标库位信息?', res => {
12 months ago
if (res) {
that.clearInfo();
1 year ago
}
12 months ago
});
1 year ago
},
12 months ago
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;
})
}
})
}
1 year ago
12 months ago
})
1 year ago
}
1 year ago
12 months ago
})
1 year ago
},
1 year ago
12 months ago
updateData(record) {
let requestLocation = this.detailSource.find(r => r.toLocationCode == record.toLocationCode);
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)
12 months ago
})
batch.handleQty = handleQty;
itemHandleQty = calc.add(itemHandleQty, handleQty)
1 year ago
}
})
12 months ago
}
// item.handleQty=itemHandleQty;
1 year ago
},
12 months ago
scanPopupGetFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.getfocus();
1 year ago
}
},
12 months ago
showMessage(message) {
this.$refs.comMessage.showMessage(message, res => {
if (res) {
this.afterCloseMessage()
}
});
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
1 year ago
if (res) {
12 months ago
this.afterCloseMessage()
1 year ago
}
});
},
12 months ago
showScanMessage(message) {
this.$refs.comMessage.showScanMessage(message);
1 year ago
},
12 months ago
showCommitSuccess() {
this.$refs.comMessage.showCommitSuccess();
1 year ago
},
12 months ago
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
navigateBack(1)
1 year ago
})
},
12 months ago
showRescanMessage(message) {
this.$refs.comMessage.showRescanMessage(message);
1 year ago
},
afterCloseMessage() {
this.scanPopupGetFocus();
},
12 months ago
showScanMessage(message) {
this.$refs.comMessage.showScanMessage(message);
1 year ago
},
12 months ago
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();
1 year ago
},
}
12 months ago
};
1 year ago
</script>
<style scoped lang="scss">
12 months ago
.uni-numbox__value {
width: 40px;
1 year ago
}
12 months ago
button[disabled] {
background-color: #3C9CFF;
color: #fff;
opacity: 0.7;
1 year ago
}
12 months ago
// /deep/ .input-value {
// font-size: 16px;
// }
1 year ago
12 months ago
// /deep/ .uni-collapse-item__title-text {
// font-size: 16px;
// }
1 year ago
12 months ago
// /deep/ .uni-collapse-item--border {
// border-bottom-width: 0px;
// border-bottom-color: #ebeef5;
// }
1 year ago
12 months ago
// /deep/ .uni-collapse-item--border {
// border-bottom-width: 1px;
// border-bottom-color: #ebeef5;
// }
1 year ago
</style>