|
|
@ -1,7 +1,7 @@ |
|
|
|
<template> |
|
|
|
<view class="page-wraper"> |
|
|
|
<view class=""> |
|
|
|
<com-blank-view @goScan='showFromLocationPopup' v-if="detailSource.length==0"></com-blank-view> |
|
|
|
<com-blank-view @goScan='showRequestPopup' v-if="detailSource.length==0"></com-blank-view> |
|
|
|
</view> |
|
|
|
<view class="page-wraper" v-if="detailSource.length>0"> |
|
|
|
<view class="page-main"> |
|
|
@ -44,7 +44,6 @@ |
|
|
|
|
|
|
|
<script> |
|
|
|
import { |
|
|
|
repleinshRequestSubmit, |
|
|
|
repleinshRecordSubmit, |
|
|
|
getBalanceByBatchOffShelf |
|
|
|
} from '@/api/request2.js'; |
|
|
@ -52,7 +51,7 @@ |
|
|
|
import { |
|
|
|
goHome, |
|
|
|
updateTitle, |
|
|
|
|
|
|
|
getCurrDateTime |
|
|
|
} from '@/common/basic.js'; |
|
|
|
|
|
|
|
import { |
|
|
@ -77,6 +76,10 @@ |
|
|
|
getDataSource |
|
|
|
} from '@/pages/issue/js/issue.js'; |
|
|
|
|
|
|
|
import { |
|
|
|
getManagementPrecisions |
|
|
|
} from '@/common/balance.js'; |
|
|
|
|
|
|
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|
|
|
import winScanPack from '@/mycomponents/scan/winScanPack.vue' |
|
|
|
import requiredLocation from '@/mycomponents/location/requiredLocation.vue' |
|
|
@ -107,32 +110,22 @@ |
|
|
|
return { |
|
|
|
id: '', |
|
|
|
receiptJob: {}, |
|
|
|
received: false, |
|
|
|
isShowPackingCode: true, |
|
|
|
scanCount: 0, |
|
|
|
dataContent: {}, //任务内容 |
|
|
|
subList: [], //接口返回的任务subList |
|
|
|
detailSource: [], //绑定在页面上的数据源 |
|
|
|
locationTypeList: [], |
|
|
|
toLocationInfo: {}, |
|
|
|
businessTypeInfo: {}, |
|
|
|
fromLocationInfo: {}, |
|
|
|
fromLocationCode: "", |
|
|
|
toLocationInfo: {}, |
|
|
|
toLocationCode: "", |
|
|
|
isShowLocation: false, |
|
|
|
fromlocationTypeList: [], |
|
|
|
tolocationTypeList: [], |
|
|
|
allowModifyLocation: false, |
|
|
|
inInventoryStatus: "", //目标入库库存状态 |
|
|
|
outInventoryStatus: "", //来源出库库存状态 |
|
|
|
businessType: {}, |
|
|
|
fromType: "", |
|
|
|
requestList: [], |
|
|
|
managementList: [], |
|
|
|
dataContent: {} |
|
|
|
}; |
|
|
|
}, |
|
|
|
onLoad(option) { |
|
|
|
this.fromType = option.fromType |
|
|
|
var typeCode = "Repleinment" |
|
|
|
getBusinessType(typeCode, res => { |
|
|
|
if (res.success) { |
|
|
@ -282,7 +275,7 @@ |
|
|
|
// item.handleQty=itemHandleQty; |
|
|
|
// this.closeScan(); |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
showErrorMessage(message) { |
|
|
|
this.$refs.comMessage.showErrorMessage(message, res => { |
|
|
|
if (res) { |
|
|
@ -303,9 +296,6 @@ |
|
|
|
this.$forceUpdate(); |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
removeItem(index, item) { |
|
|
|
this.detailSource.splice(index, 1) |
|
|
|
}, |
|
|
@ -346,91 +336,104 @@ |
|
|
|
this.toLocationCode = location; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
commit() { |
|
|
|
if (this.toLocationCode == "") { |
|
|
|
this.showMessage("请先选择目标库位") |
|
|
|
return; |
|
|
|
} |
|
|
|
submit() { |
|
|
|
uni.showLoading({ |
|
|
|
title: "提交中....", |
|
|
|
mask: true |
|
|
|
}); |
|
|
|
|
|
|
|
if (this.fromType == "requestType") { |
|
|
|
var params = this.setRequestParams(); |
|
|
|
console.log("提交" + JSON.stringify(params)) |
|
|
|
|
|
|
|
// repleinshRequestSubmit(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) |
|
|
|
// }) |
|
|
|
} else { |
|
|
|
// repleinshRecordSubmit(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) |
|
|
|
// }) |
|
|
|
} |
|
|
|
//目前任务只到一个库位 |
|
|
|
var itemCodes = [] |
|
|
|
let locationCode = this.detailSource[0].toLocationCode |
|
|
|
this.detailSource.forEach(toLocation => { |
|
|
|
toLocation.Items.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); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
setParams() { |
|
|
|
var subList = [] |
|
|
|
this.detailSource.forEach(item => { |
|
|
|
item.subList.forEach(detail => { |
|
|
|
if (detail.scaned) { |
|
|
|
// var info = getPackingNumberAndBatch(this.managementList, detail.itemCode, |
|
|
|
// detail.packingNumber, detail.batch); |
|
|
|
// detail.toPackingNumber =info.packingNumber; |
|
|
|
// detail.toBatch =info.batch; |
|
|
|
subList.push(detail) |
|
|
|
} |
|
|
|
}) |
|
|
|
submitJob() { |
|
|
|
var params = this.setParams() |
|
|
|
console.log("提交参数", JSON.stringify(params)); |
|
|
|
|
|
|
|
repleinshRecordSubmit(params).then(res => { |
|
|
|
uni.hideLoading() |
|
|
|
if (res.data) { |
|
|
|
this.showCommitSuccessMessage("提交成功<br>生成补料记录<br>" + res.data) |
|
|
|
} else { |
|
|
|
this.showErrorMessage("提交失败:" + res.msg) |
|
|
|
} |
|
|
|
}).catch(error => { |
|
|
|
uni.hideLoading() |
|
|
|
this.showErrorMessage(error) |
|
|
|
}) |
|
|
|
return subList; |
|
|
|
}, |
|
|
|
|
|
|
|
setRequestParams() { |
|
|
|
setParams() { |
|
|
|
var subList = [] |
|
|
|
var supplierCode = "" |
|
|
|
this.detailSource.forEach(item => { |
|
|
|
item.subList.forEach(detail => { |
|
|
|
if (detail.scaned) { |
|
|
|
if (supplierCode == "") { |
|
|
|
supplierCode = detail.package.supplierCode |
|
|
|
} |
|
|
|
subList.push(detail) |
|
|
|
} |
|
|
|
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; |
|
|
|
|
|
|
|
record.toContainerNumber = r |
|
|
|
.ContainerNumber; |
|
|
|
record.toInventoryStatus = r |
|
|
|
.inventoryStatus; |
|
|
|
record.toLocationCode = subItem |
|
|
|
.toLocationCode; |
|
|
|
record.fromLocationCode = fromLocation.fromLocationCode |
|
|
|
record.supplierCode = r.supplierCode; |
|
|
|
|
|
|
|
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); |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
this.dataContent.subList = subList |
|
|
|
this.dataContent.supplierCode = supplierCode |
|
|
|
this.dataContent.businessType = "PurchasePutaway" |
|
|
|
this.dataContent.departmentCode = "研发部门"; |
|
|
|
this.dataContent.status = 1; |
|
|
|
this.dataContent.autoCommit = "FALSE"; |
|
|
|
this.dataContent.autoAgree = "FALSE"; |
|
|
|
this.dataContent.autoExecute = "FALSE"; |
|
|
|
this.dataContent.directCreateRecord = "FALSE"; |
|
|
|
this.dataContent.createTime = createTime; |
|
|
|
this.dataContent.creator = creator; |
|
|
|
return this.dataContent; |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
showMessage(message) { |
|
|
|
this.$refs.comMessage.showMessage(message, res => { |
|
|
|
if (res) {} |
|
|
@ -459,7 +462,6 @@ |
|
|
|
this.getToLocationCode(location, code) |
|
|
|
}, |
|
|
|
getFromLocationCode(location, code) { |
|
|
|
this.fromLocationInfo = location; |
|
|
|
this.fromLocationCode = code; |
|
|
|
this.openScanPopup(); |
|
|
|
}, |
|
|
@ -477,12 +479,17 @@ |
|
|
|
|
|
|
|
showCommitSuccessMessage(hint) { |
|
|
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
|
|
|
this.fromLocationCode = ''; |
|
|
|
|
|
|
|
this.clearData(); |
|
|
|
}) |
|
|
|
}, |
|
|
|
clearData() { |
|
|
|
this.fromLocationCode = ''; |
|
|
|
this.detailSource = []; |
|
|
|
this.requestList = []; |
|
|
|
this.dataContent = {} |
|
|
|
this.managementList = [] |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|