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.

492 lines
12 KiB

1 year ago
<template>
<view class="page-wraper">
<view class="page-header">
<view class="header_job_top">
<job-top :dataContent="jobContent"></job-top>
12 months ago
</view>
<view class="header_item">
申请单号 : {{jobContent.requestNumber}}
</view>
</view>
<view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll">
11 months ago
<view v-for="(toLocation, index) in detailSource">
<work-station :workshopCode="jobContent.workShopCode" :productionLineCode="toLocation.productionLineCode"
:workStationCode="toLocation.workStationCode" :rawLocationCode="toLocation.toLocationCode"></work-station>
12 months ago
<com-issue-detail-card ref='comIssueDetailCard' :dataContent="toLocation" @updateData='updateData'>
</com-issue-detail-card>
</view>
1 year ago
</scroll-view>
</view>
<div class="btn_bottom">
<view class="" style="display: flex;flex-direction: row;">
<view class="">
12 months ago
<!-- <button class="btn_commit" hover-class="btn_commit_after" @click="resizeCollapse()">刷新UI</button> -->
1 year ago
<button class="btn_commit" hover-class="btn_commit_after" @click="submit()">提交</button>
</view>
</view>
</div>
<win-scan-button @goScan='openScanDetailPopup'></win-scan-button>
<com-scan-issue-pack ref="comScanIssuePack" @closeScan='closeScan' @updateData='updateData'>
</com-scan-issue-pack>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
import {
1 year ago
takeIssueJob,
1 year ago
cancleTakeIssueJob,
getIssueJobDetail,
issueJobSubmit
1 year ago
} from '@/api/request2.js';
import {
goHome,
updateTitle,
navigateBack,
1 year ago
getRemoveOption,
12 months ago
getCurrDateTime,
getDirectoryItemArray,
getPackingNumberAndBatch,
1 year ago
} from '@/common/basic.js';
import {
getDataSource
} from '@/pages/issue/js/issue.js';
12 months ago
import {
getManagementPrecisions
} from '@/common/balance.js';
1 year ago
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue'
import comIssueDetailCard from '@/pages/issue/coms/comIssueDetailCard.vue'
12 months ago
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
1 year ago
import comScanIssuePack from '@/pages/issue/coms/comScanIssuePack.vue'
import comMessage from '@/mycomponents/common/comMessage.vue'
12 months ago
import comIssueRequestInfo from '@/pages/issue/coms/comIssueRequestInfo.vue'
12 months ago
import jobTop from '@/mycomponents/job/jobTop.vue'
11 months ago
import workStation from '@/mycomponents/workStation/workStation.vue'
12 months ago
1 year ago
export default {
name: 'issueDetail',
components: {
jobDetailPopup,
winScanButton,
comIssueDetailCard,
12 months ago
comIssueRequestInfo,
1 year ago
comScanIssuePack,
12 months ago
comMessage,
11 months ago
jobTop,
workStation
1 year ago
},
data() {
return {
id: '',
jobContent: {}, //任务内容
1 year ago
subList: [], //接口返回的任务subList
1 year ago
detailSource: [], //绑定在页面上的数据源
detailOptions: [],
scanOptions: []
};
},
props: {
},
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
},
onNavigationBarButtonTap(e) {
if (e.index === 0) {
goHome();
}
},
//拦截返回按钮事件
onBackPress(e) {
//已经接收但是没提交任务
if (this.received) {
//取消承接任务
cancleTakeIssueJob(this.id).then(res => {}).catch(error => {
this.showMessage(err);
})
}
},
watch: {
locationTypes(newVal) {
let value = newVal;
},
},
mounted: function() {
12 months ago
// this.resizeCollapse();
1 year ago
},
methods: {
12 months ago
resizeCollapse() {
this.$nextTick(r => {
this.$refs.comIssueDetailCard.forEach(r => {
r.resizeCollapse();
})
12 months ago
// this.$refs.mainCollapse.forEach(r => {
// r.childrens.forEach(i => {
// i.init();
// })
// r.resize();
// })
12 months ago
});
},
1 year ago
//接收
receive(callback) {
if (this.id != null) {
takeIssueJob(this.id).then(res => {
callback();
}).catch(error => {
this.showErrorMessage(error)
})
}
},
getDetail() {
var that = this;
uni.showLoading({
title: "加载中....",
mask: true
});
getIssueJobDetail(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;
that.detailSource = getDataSource(that.detailSource, that.subList)
12 months ago
setTimeout(r => {
that.resizeCollapse();
}, 100)
1 year ago
uni.hideLoading();
} else {
that.showMessage('列表数据为0');
}
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
},
closeScan() {
this.resizeCollapse();
},
12 months ago
// submit() {
//3.如果是按批次先进先出发料提交时如果扫描的箱码不是先进的批次,则报错
//:请扫描XXX批次,改批次满足先进先出规则。否则可以直接提交
// var isOutIn = getApp().globalData.feed_configList.filter(
// res => {
// if (res.name == 'feed_isOutIn') {
// return res;
// }
// });
// this.dataContent.itemCodeList.forEach(res => {
// if (res.handleQty > res.recommendQty) {
// this.$refs.modal.showConfirmMessageModal('实际数量大于需求数量,是否提交?', confirm => {
// if (confirm) {
// //提交
// uni.showToast({
// title: "提交"
// })
// }
// })
// } else {
// uni.showToast({
// title: "扫描的数量" + res.handleQty + "]小于推荐数量[" + res.recommendQty + "]"
// })
// }
// })
// },
12 months ago
12 months ago
submit() {
12 months ago
uni.showLoading({
title: "提交中....",
mask: true
});
//目前任务只到一个库位
var itemCodes = []
let locationCode = this.detailSource[0].toLocationCode
12 months ago
this.detailSource.forEach(toLocation => {
toLocation.Items.forEach(item => {
itemCodes.push(item.itemCode)
})
12 months ago
})
//使用在途库,不查询管理模式
if (this.jobContent.useOnTheWayLocation == 'TRUE') {
12 months ago
this.submitJob();
12 months ago
} else {
//获取管理模式,封装参数
getManagementPrecisions(itemCodes, locationCode, res => {
if (res.success) {
this.managementList = res.list;
12 months ago
this.submitJob();
12 months ago
} else {
uni.hideLoading();
this.showErrorMessage(res.message);
}
});
}
},
12 months ago
submitJob() {
var params = this.setParams()
console.log("提交参数", JSON.stringify(params));
issueJobSubmit(params).then(res => {
uni.hideLoading()
if (res.data) {
this.showCommitSuccessMessage("提交成功<br>生成发货记录" + res.data)
} else {
this.showErrorMessage("提交失败" + res.msg)
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
},
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.fromPackingNumber = r
.packingNumber;
record.fromBatch = r.batch;
record.fromContainerNumber = r
.ContainerNumber;
12 months ago
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
})
12 months ago
})
})
this.jobContent.subList = subList
this.jobContent.createTime = createTime;
this.jobContent.creator = creator;
return this.jobContent;
},
1 year ago
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) {
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
12 months ago
.packingNumber == null || b.packingNumber == '') && b.batch ==
1 year ago
record.batch);
let handleQty = 0;
12 months ago
if (batch != undefined) {
batch.Records.forEach(res => {
handleQty += Number(res.qty)
})
batch.handleQty = handleQty;
itemHandleQty += handleQty;
}
1 year ago
})
}
12 months ago
this.resizeCollapse();
12 months ago
item.handleQty = itemHandleQty;
1 year ago
},
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();
},
12 months ago
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
navigateBack(1)
12 months ago
})
},
1 year ago
showRescanMessage(message) {
this.$refs.comMessage.showRescanMessage(message);
},
afterCloseMessage() {
this.scanPopupGetFocus();
},
showScanMessage(message) {
this.$refs.comMessage.showScanMessage(message);
},
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>