|
|
@ -17,13 +17,12 @@ |
|
|
|
</scroll-view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<requiredLocation v-if="showToLoaction" title="目标库位" :locationCode="toLocationCode" |
|
|
|
@getLocation='getToLocationCode' :locationTypeList="tolocationTypeList"></requiredLocation> |
|
|
|
|
|
|
|
<view class="page-footer"> |
|
|
|
<view class="uni-flex u-col-center space-between padding_10" |
|
|
|
style="background-color:ghostwhite; width: 100%; "> |
|
|
|
<view class=""> |
|
|
|
<requiredLocation v-if="showToLoaction" title="目标库位" :locationCode="toLocationCode" |
|
|
|
@getLocation='getToLocationCode' :locationTypeList="tolocationTypeList"></requiredLocation> |
|
|
|
</view> |
|
|
|
<view class=" uni-flex uni-row"> |
|
|
|
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button> |
|
|
@ -42,7 +41,8 @@ |
|
|
|
<script> |
|
|
|
import { |
|
|
|
putawayRequestSubmit, |
|
|
|
putawayRecordSubmit |
|
|
|
putawayRecordSubmit, |
|
|
|
validateItemAndLocation |
|
|
|
} from '@/api/request2.js'; |
|
|
|
|
|
|
|
import { |
|
|
@ -56,12 +56,6 @@ |
|
|
|
getDirectoryItemArray |
|
|
|
} from '@/common/directory.js'; |
|
|
|
|
|
|
|
import { |
|
|
|
getDetailOption, |
|
|
|
getDetailRemoveOption, |
|
|
|
getDetailEditRemoveOption |
|
|
|
} from '@/common/array.js'; |
|
|
|
|
|
|
|
import { |
|
|
|
getBusinessType, |
|
|
|
createItemInfo, |
|
|
@ -70,7 +64,9 @@ |
|
|
|
} from '@/common/record.js'; |
|
|
|
|
|
|
|
import { |
|
|
|
getManagementPrecisions |
|
|
|
getManagementPrecisions, |
|
|
|
getPrecisionStrategyList, |
|
|
|
getPrecisionStrategyParamsByLocation |
|
|
|
} from '@/common/balance.js'; |
|
|
|
|
|
|
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|
|
@ -96,35 +92,20 @@ |
|
|
|
data() { |
|
|
|
return { |
|
|
|
id: '', |
|
|
|
receiptJob: {}, |
|
|
|
received: false, |
|
|
|
dataContent: {}, //内容 |
|
|
|
detailSource: [], //绑定在页面上的数据源 |
|
|
|
locationTypeList: [], |
|
|
|
businessTypeInfo: {}, |
|
|
|
fromLocationInfo: {}, |
|
|
|
fromLocationCode: "", |
|
|
|
toLocationCode: "", |
|
|
|
isShowLocation: false, |
|
|
|
fromlocationTypeList: [], |
|
|
|
tolocationTypeList: [], |
|
|
|
inInventoryStatus: "", //目标入库库存状态 |
|
|
|
outInventoryStatus: "", //来源出库库存状态 |
|
|
|
businessType: {}, |
|
|
|
fromType: "", |
|
|
|
showToLoaction: true |
|
|
|
}; |
|
|
|
}, |
|
|
|
onLoad(option) { |
|
|
|
this.fromType = option.fromType |
|
|
|
if (this.fromType == "requestType") { |
|
|
|
this.showToLoaction = false |
|
|
|
updateTitle("原料上架申请") |
|
|
|
} else { |
|
|
|
updateTitle("原料上架记录") |
|
|
|
this.showToLoaction = true |
|
|
|
|
|
|
|
} |
|
|
|
var typeCode = "PurchasePutaway" |
|
|
|
getBusinessType(typeCode, res => { |
|
|
|
if (res.success) { |
|
|
@ -188,10 +169,10 @@ |
|
|
|
|
|
|
|
showErrorMessage(message) { |
|
|
|
this.$refs.comMessage.showErrorMessage(message, res => { |
|
|
|
if (res) { |
|
|
|
} |
|
|
|
if (res) {} |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
calcHandleQty() { |
|
|
|
for (let item of this.detailSource) { |
|
|
|
item.qty = 0; |
|
|
@ -207,6 +188,7 @@ |
|
|
|
updateData() { |
|
|
|
this.calcHandleQty(); |
|
|
|
}, |
|
|
|
|
|
|
|
removeItem(index, item) { |
|
|
|
this.detailSource.splice(index, 1) |
|
|
|
}, |
|
|
@ -228,6 +210,7 @@ |
|
|
|
} |
|
|
|
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType); |
|
|
|
}, |
|
|
|
|
|
|
|
showFromLocationPopup() { |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$refs.scanLocationCode.openScanPopup(); |
|
|
@ -254,42 +237,52 @@ |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
uni.showLoading({ |
|
|
|
title: "提交中....", |
|
|
|
mask: true |
|
|
|
}); |
|
|
|
//查询库位零件关系 |
|
|
|
|
|
|
|
// uni.showLoading({ |
|
|
|
// title: "提交中....", |
|
|
|
// mask: true |
|
|
|
// }); |
|
|
|
|
|
|
|
if (this.fromType == "requestType") { |
|
|
|
var params = this.setRequestParams() |
|
|
|
console.log("提交" + JSON.stringify(params)) |
|
|
|
// putawayRequestSubmit(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 { |
|
|
|
//记录有目标库位,需要查询管理模式 |
|
|
|
var itemCodes = [] |
|
|
|
this.detailSource.forEach(item => { |
|
|
|
itemCodes.push(item.itemCode) |
|
|
|
}) |
|
|
|
//获取管理模式,封装参数 |
|
|
|
getManagementPrecisions(itemCodes, this.toLocationCode, res => { |
|
|
|
if (res.success) { |
|
|
|
this.managementList = res.list; |
|
|
|
var params = this.setRecordParams(true) |
|
|
|
console.log("提交参数", JSON.stringify(params)); |
|
|
|
|
|
|
|
//1:查询库位零件关系 |
|
|
|
// var itemCodes = [] |
|
|
|
// let conditions = []; |
|
|
|
// this.detailSource.forEach(item => { |
|
|
|
// debugger; |
|
|
|
// let condition = { |
|
|
|
// itemCode: item.itemCode, |
|
|
|
// batch: item.batch, |
|
|
|
// inventoryStatus: item.inInventoryStatus, |
|
|
|
// locationCode: this.toLocationCode |
|
|
|
// }; |
|
|
|
// conditions.push(condition) |
|
|
|
// }) |
|
|
|
|
|
|
|
|
|
|
|
let itemAndLocationRelations = this.getItemAndLocationRelations(); |
|
|
|
validateItemAndLocation(itemAndLocationRelations, res => { |
|
|
|
debugger; |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
let precisionStrategyParams = getPrecisionStrategyParamsByLocation(this.detailSource, this.toLocationCode); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
//2:获取管理模式,封装参数 |
|
|
|
// getManagementPrecisions(itemCodes, this.toLocationCode, res => { |
|
|
|
// if (res.success) { |
|
|
|
// this.managementList = res.list; |
|
|
|
// var params = this.setRecordParams(true) |
|
|
|
// console.log("提交参数", JSON.stringify(params)); |
|
|
|
|
|
|
|
// putawayRecordSubmit(params).then(res => { |
|
|
|
// uni.hideLoading() |
|
|
|
// if (res.data) { |
|
|
|
// this.showCommitSuccessMessage("提交成功<br>生成采购收货记录" + res.data, ) |
|
|
|
// this.showCommitSuccessMessage("提交成功<br>生成采购上架记录" + res.data, ) |
|
|
|
// } else { |
|
|
|
// this.showErrorMessage("提交失败[" + res.msg + "]") |
|
|
|
// } |
|
|
@ -297,12 +290,44 @@ |
|
|
|
// uni.hideLoading() |
|
|
|
// this.showErrorMessage(error) |
|
|
|
// }) |
|
|
|
} else { |
|
|
|
uni.hideLoading(); |
|
|
|
this.showErrorMessage(res.message); |
|
|
|
// } else { |
|
|
|
// uni.hideLoading(); |
|
|
|
// this.showErrorMessage(res.message); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getItemAndLocationRelations() { |
|
|
|
var itemList = [] |
|
|
|
this.detailSource.forEach(item => { |
|
|
|
item.subList.forEach(detail => { |
|
|
|
if (detail.scaned) { |
|
|
|
detail.toLocationCode = this.toLocationCode; |
|
|
|
var filterResult = itemList.filter(res => { |
|
|
|
if (res.itemCode == item.itemCode && |
|
|
|
res.locationCode == detail.toLocationCode && |
|
|
|
res.batch == detail.batch && |
|
|
|
res.inventoryStatus == detail.inventoryStatus) { |
|
|
|
return res |
|
|
|
} |
|
|
|
}); |
|
|
|
}) |
|
|
|
//去掉重复元素 |
|
|
|
if (filterResult.length == 0) { |
|
|
|
var result = { |
|
|
|
itemCode: item.itemCode, |
|
|
|
locationCode: detail.toLocationCode, |
|
|
|
batch: detail.batch, |
|
|
|
inventoryStatus: detail.inventoryStatus, |
|
|
|
} |
|
|
|
itemList.push(result) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
return itemList; |
|
|
|
}, |
|
|
|
|
|
|
|
setRecordParams(queryModel) { |
|
|
@ -311,7 +336,6 @@ |
|
|
|
this.detailSource.forEach(item => { |
|
|
|
item.subList.forEach(detail => { |
|
|
|
if (detail.scaned) { |
|
|
|
if (queryModel) { |
|
|
|
var info = getPackingNumberAndBatch(this.managementList, detail.itemCode, |
|
|
|
detail.packingNumber, detail.batch); |
|
|
|
detail.toPackingNumber = info.packingNumber;; |
|
|
@ -319,14 +343,7 @@ |
|
|
|
detail.toBatch = info.batch; |
|
|
|
detail.toInventoryStatus = detail.inventoryStatus |
|
|
|
detail.toLocationCode = this.toLocationCode |
|
|
|
} else { |
|
|
|
// detail.toPackingNumber = detail.packingNumber; |
|
|
|
// detail.toContainerNumber = detail.containerNumber |
|
|
|
// detail.toBatch = detail.toBatch; |
|
|
|
// detail.toInventoryStatus = detail.inventoryStatus |
|
|
|
// detail.toLocationCode = "" |
|
|
|
} |
|
|
|
|
|
|
|
detail.package = null; |
|
|
|
subList.push(detail) |
|
|
|
} |
|
|
|
}) |
|
|
@ -336,33 +353,6 @@ |
|
|
|
return this.dataContent; |
|
|
|
}, |
|
|
|
|
|
|
|
setRequestParams(){ |
|
|
|
var subList = [] |
|
|
|
var supplierCode="" |
|
|
|
this.detailSource.forEach(item => { |
|
|
|
item.subList.forEach(detail => { |
|
|
|
if (detail.scaned) { |
|
|
|
if(supplierCode==""){ |
|
|
|
supplierCode = detail.package.supplierCode |
|
|
|
} |
|
|
|
subList.push(detail) |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
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"; |
|
|
|
return this.dataContent; |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
showMessage(message) { |
|
|
|
this.$refs.comMessage.showMessage(message, res => { |
|
|
|
if (res) {} |
|
|
|