|
|
@ -21,8 +21,8 @@ |
|
|
|
<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> |
|
|
|
<!-- <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,14 +42,15 @@ |
|
|
|
import { |
|
|
|
putawayRequestSubmit, |
|
|
|
putawayRecordSubmit, |
|
|
|
validateItemAndLocation |
|
|
|
validateItemAndLocation, |
|
|
|
getPutawayRecommendLocation |
|
|
|
} from '@/api/request2.js'; |
|
|
|
|
|
|
|
import { |
|
|
|
goHome, |
|
|
|
updateTitle, |
|
|
|
getCurrDateTime, |
|
|
|
getPackingNumberAndBatch |
|
|
|
getPackingNumberAndBatchByList |
|
|
|
} from '@/common/basic.js'; |
|
|
|
import { |
|
|
|
getInventoryStatusDesc, |
|
|
@ -66,7 +67,7 @@ |
|
|
|
import { |
|
|
|
getManagementPrecisions, |
|
|
|
getPrecisionStrategyList, |
|
|
|
getPrecisionStrategyParamsByLocation |
|
|
|
getPrecisionStrategyParams |
|
|
|
} from '@/common/balance.js'; |
|
|
|
|
|
|
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|
|
@ -102,7 +103,8 @@ |
|
|
|
inInventoryStatus: "", //目标入库库存状态 |
|
|
|
outInventoryStatus: "", //来源出库库存状态 |
|
|
|
businessType: {}, |
|
|
|
showToLoaction: true |
|
|
|
showToLoaction: true, |
|
|
|
recommendLocationList: [] //推荐库位列表 |
|
|
|
}; |
|
|
|
}, |
|
|
|
onLoad(option) { |
|
|
@ -130,6 +132,7 @@ |
|
|
|
onPullDownRefresh() {}, |
|
|
|
|
|
|
|
mounted() {}, |
|
|
|
|
|
|
|
methods: { |
|
|
|
getScanResult(result) { |
|
|
|
let balance = result.balance; |
|
|
@ -141,10 +144,15 @@ |
|
|
|
} |
|
|
|
}) |
|
|
|
if (item == undefined) { |
|
|
|
var itemp = createItemInfo(balance, pack); |
|
|
|
let newDetail = createDetailInfo(balance, pack); // |
|
|
|
itemp.subList.push(newDetail); |
|
|
|
this.detailSource.push(itemp) |
|
|
|
// 获取推荐库位 |
|
|
|
this.getRecommendLocation(balance, pack, toLocationCode => { |
|
|
|
var itemp = createItemInfo(balance, pack); |
|
|
|
let newDetail = createDetailInfo(balance, pack); // |
|
|
|
newDetail.toLocationCode = toLocationCode; |
|
|
|
itemp.subList.push(newDetail); |
|
|
|
this.detailSource.push(itemp) |
|
|
|
}) |
|
|
|
|
|
|
|
} else { |
|
|
|
var detail = item.subList.find(r => { |
|
|
|
if (r.packingNumber == balance.packingNumber && |
|
|
@ -164,7 +172,33 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
this.calcHandleQty(); |
|
|
|
}, |
|
|
|
|
|
|
|
//获取推荐库位 |
|
|
|
getRecommendLocation(balance, pack, callback) { |
|
|
|
let recommend = this.recommendLocationList.find(r => r.itemCode == balance.itemCode); |
|
|
|
if (recommend == undefined) { |
|
|
|
let param = { |
|
|
|
itemCode: balance.itemCode, |
|
|
|
batch: balance.batch, |
|
|
|
inventoryStatus: balance.inventoryStatus, |
|
|
|
supplierCode: pack.supplierCode |
|
|
|
}; |
|
|
|
console.log(JSON.stringify(param)) |
|
|
|
getPutawayRecommendLocation(param).then(res => { |
|
|
|
this.recommendLocationList.push({ |
|
|
|
itemCode: balance.itemCode, |
|
|
|
locationCode: res.data.code |
|
|
|
}) |
|
|
|
callback(res.data.code); |
|
|
|
}).catch(error => { |
|
|
|
uni.hideLoading() |
|
|
|
this.showErrorMessage(error) |
|
|
|
}) |
|
|
|
|
|
|
|
} else { |
|
|
|
callback(recommend.locationCode); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
showErrorMessage(message) { |
|
|
@ -215,8 +249,8 @@ |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$refs.scanLocationCode.openScanPopup(); |
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
closeScanPopup() { |
|
|
|
this.$refs.scanPopup.closeScanPopup(); |
|
|
|
}, |
|
|
@ -232,11 +266,6 @@ |
|
|
|
}, |
|
|
|
|
|
|
|
commit() { |
|
|
|
if (this.showToLoaction && this.toLocationCode == "") { |
|
|
|
this.showMessage("请先选择目标库位") |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
//查询库位零件关系 |
|
|
|
|
|
|
|
// uni.showLoading({ |
|
|
@ -245,56 +274,30 @@ |
|
|
|
// }); |
|
|
|
|
|
|
|
//记录有目标库位,需要查询管理模式 |
|
|
|
|
|
|
|
//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; |
|
|
|
|
|
|
|
let precisionStrategyParams = getPrecisionStrategyParams(this.detailSource); |
|
|
|
//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, ) |
|
|
|
// } else { |
|
|
|
// this.showErrorMessage("提交失败[" + res.msg + "]") |
|
|
|
// } |
|
|
|
// }).catch(error => { |
|
|
|
// uni.hideLoading() |
|
|
|
// this.showErrorMessage(error) |
|
|
|
// }) |
|
|
|
// } else { |
|
|
|
// uni.hideLoading(); |
|
|
|
// this.showErrorMessage(res.message); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
getPrecisionStrategyList(precisionStrategyParams, 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, ) |
|
|
|
} else { |
|
|
|
this.showErrorMessage("提交失败[" + res.msg + "]") |
|
|
|
} |
|
|
|
}).catch(error => { |
|
|
|
uni.hideLoading() |
|
|
|
this.showErrorMessage(error) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
uni.hideLoading(); |
|
|
|
this.showErrorMessage(res.message); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
@ -336,13 +339,13 @@ |
|
|
|
this.detailSource.forEach(item => { |
|
|
|
item.subList.forEach(detail => { |
|
|
|
if (detail.scaned) { |
|
|
|
var info = getPackingNumberAndBatch(this.managementList, detail.itemCode, |
|
|
|
var info = getPackingNumberAndBatchByList(this.managementList, detail.itemCode, |
|
|
|
detail.packingNumber, detail.batch); |
|
|
|
detail.toPackingNumber = info.packingNumber;; |
|
|
|
detail.toContainerNumber = detail.containerNumber |
|
|
|
detail.toBatch = info.batch; |
|
|
|
detail.toInventoryStatus = detail.inventoryStatus |
|
|
|
detail.toLocationCode = this.toLocationCode |
|
|
|
// detail.toInventoryStatus = detail.inventoryStatus |
|
|
|
// detail.toLocationCode = detail.toLocationCode |
|
|
|
detail.package = null; |
|
|
|
subList.push(detail) |
|
|
|
} |
|
|
|