|
|
@ -1,7 +1,7 @@ |
|
|
|
<template> |
|
|
|
<view class="page-wraper"> |
|
|
|
<view class=""> |
|
|
|
<com-blank-view @goScan='getLocation' v-if="detailSource.length==0"></com-blank-view> |
|
|
|
<com-blank-view @goScan='showFromLocationPopup' v-if="detailSource.length==0"></com-blank-view> |
|
|
|
</view> |
|
|
|
<view class="page-wraper" v-if="detailSource.length>0"> |
|
|
|
<view class="page-main"> |
|
|
@ -24,7 +24,8 @@ |
|
|
|
</view> |
|
|
|
<uni-data-picker v-if="detailSource.length>0" style="padding: 20rpx; background-color:#fff;" |
|
|
|
class='uni-data-picker' placeholder="请选择客户" popup-title="选择客户" :localdata="customerList" |
|
|
|
v-model="customer"> |
|
|
|
@change="reasonChange"> |
|
|
|
|
|
|
|
</uni-data-picker> |
|
|
|
</view> |
|
|
|
|
|
|
@ -32,7 +33,7 @@ |
|
|
|
<view class="uni-flex u-col-center space-between padding_10" |
|
|
|
style="background-color:ghostwhite; width: 100%; "> |
|
|
|
<view class=""> |
|
|
|
<requiredLocation v-if="showToLoaction" ref='comScanLocation' title="目标库位" :locationCode="toLocationCode" |
|
|
|
<requiredLocation ref='comScanLocation' title="目标库位" :locationCode="toLocationCode" |
|
|
|
@getLocation='scanLocationCode' :isShowEdit="true" |
|
|
|
:locationTypeList="tolocationTypeList"></requiredLocation> |
|
|
|
</view> |
|
|
@ -44,7 +45,7 @@ |
|
|
|
<win-scan-button @goScan='openScanPopup'></win-scan-button> |
|
|
|
</view> |
|
|
|
|
|
|
|
<win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult'></win-scan-pack-and-location> |
|
|
|
<win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult' headerType="HMQ"></win-scan-pack-and-location> |
|
|
|
<comMessage ref="comMessage"></comMessage> |
|
|
|
<win-scan-location ref="scanLocationCode" title="来源库位" @getLocation='getLocation' |
|
|
|
:locationTypeList="fromlocationTypeList"></win-scan-location> |
|
|
@ -55,12 +56,11 @@ |
|
|
|
<script> |
|
|
|
import { |
|
|
|
getBasicCustomerList, |
|
|
|
deliverRequestSubmit, |
|
|
|
deliverRecordSubmit |
|
|
|
} from '@/api/request2.js'; |
|
|
|
import { |
|
|
|
goHome, |
|
|
|
updateTitle |
|
|
|
getPackingNumberAndBatchByList |
|
|
|
} from '@/common/basic.js'; |
|
|
|
|
|
|
|
import { |
|
|
@ -68,6 +68,10 @@ |
|
|
|
getDirectoryItemArray |
|
|
|
} from '@/common/directory.js'; |
|
|
|
|
|
|
|
import { |
|
|
|
getPrecisionStrategyList |
|
|
|
} from '@/common/balance.js'; |
|
|
|
|
|
|
|
import { |
|
|
|
getBusinessType, |
|
|
|
createItemInfo, |
|
|
@ -100,34 +104,24 @@ |
|
|
|
data() { |
|
|
|
return { |
|
|
|
id: '', |
|
|
|
receiptJob: {}, |
|
|
|
received: false, |
|
|
|
isShowPackingCode: true, |
|
|
|
scanCount: 0, |
|
|
|
subList: [], //接口返回的任务subList |
|
|
|
detailSource: [], //绑定在页面上的数据源 |
|
|
|
locationTypeList: [], |
|
|
|
businessTypeInfo: {}, |
|
|
|
fromLocationInfo: {}, |
|
|
|
fromLocationCode: "", |
|
|
|
toLocationCode: "", |
|
|
|
isShowLocation: false, |
|
|
|
fromlocationTypeList: [], |
|
|
|
tolocationTypeList: [], |
|
|
|
allowModifyLocation: false, |
|
|
|
businessType: {}, |
|
|
|
customerList: [], |
|
|
|
customer: "", |
|
|
|
fromType: "", |
|
|
|
showToLoaction: true, |
|
|
|
dataContent:{} |
|
|
|
customerText: "", |
|
|
|
customerCode : "", |
|
|
|
dataContent:{}, |
|
|
|
managementList:[] |
|
|
|
}; |
|
|
|
}, |
|
|
|
onLoad(option) { |
|
|
|
this.fromType = option.fromType |
|
|
|
this.updateTitle(); |
|
|
|
|
|
|
|
var typeCode = "DeliverRequest" |
|
|
|
var typeCode = "DeliverRecord" |
|
|
|
getBusinessType(typeCode, res => { |
|
|
|
if (res.success) { |
|
|
|
this.businessType = res.businessType; |
|
|
@ -135,7 +129,7 @@ |
|
|
|
this.tolocationTypeList = res.tolocationTypeList; |
|
|
|
this.showFromLocationPopup(); |
|
|
|
} else { |
|
|
|
this.$refs.comMessage.showBreakMessage(res.message); |
|
|
|
this.showErrorMessage(res.message) |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
@ -165,17 +159,6 @@ |
|
|
|
|
|
|
|
mounted() {}, |
|
|
|
methods: { |
|
|
|
updateTitle() { |
|
|
|
if (this.fromType == "requestType") { |
|
|
|
this.showToLoaction = false |
|
|
|
updateTitle("制品发货申请") |
|
|
|
} else { |
|
|
|
this.showToLoaction = true |
|
|
|
updateTitle("制品发货记录") |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getScanResult(result) { |
|
|
|
let balance = result.balance; |
|
|
|
let label = result.label; |
|
|
@ -187,9 +170,8 @@ |
|
|
|
return res |
|
|
|
} |
|
|
|
}) |
|
|
|
var qty =labelQty>balanceQty?balanceQty:labelQty |
|
|
|
if (item == undefined) { |
|
|
|
var itemp = createItemInfo(qty, pack); |
|
|
|
var itemp = createItemInfo(balance.qty, pack); |
|
|
|
let newDetail = createDetailInfo(balance, pack); // |
|
|
|
if(labelQty) |
|
|
|
itemp.subList.push(newDetail); |
|
|
@ -289,108 +271,118 @@ |
|
|
|
}, |
|
|
|
|
|
|
|
commit() { |
|
|
|
if (this.customer == "") { |
|
|
|
if (this.customerText == "") { |
|
|
|
this.showMessage("请先选择客户") |
|
|
|
return; |
|
|
|
} |
|
|
|
console.log("客户", this.customer) |
|
|
|
if (this.toLocationCode == ""&&this.showToLoaction) { |
|
|
|
console.log("客户", this.customerText) |
|
|
|
if (this.toLocationCode == "") { |
|
|
|
this.showMessage("请先选择目标库位") |
|
|
|
return; |
|
|
|
} |
|
|
|
uni.showLoading({ |
|
|
|
title: "提交中....", |
|
|
|
mask: true |
|
|
|
}); |
|
|
|
if (this.detailSource.length > 0 && this.detailSource[0].subList.length > 0) { |
|
|
|
//查询管理模式 |
|
|
|
uni.showLoading({ |
|
|
|
title: "提交中....", |
|
|
|
mask: true |
|
|
|
}); |
|
|
|
this.managementList = []; |
|
|
|
var precisionStrategParams = this.setPrecisionStrategParams() |
|
|
|
|
|
|
|
getPrecisionStrategyList(precisionStrategParams, res => { |
|
|
|
if (res.success) { |
|
|
|
this.managementList = res.list; |
|
|
|
var params = this.setParams() |
|
|
|
console.log("提交" + JSON.stringify(params)) |
|
|
|
deliverRecordSubmit(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) |
|
|
|
}) |
|
|
|
|
|
|
|
} else { |
|
|
|
uni.hideLoading(); |
|
|
|
this.showErrorMessage(res.message); |
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
if (this.fromType == "requestType") { |
|
|
|
var params = this.setRequestParams(); |
|
|
|
console.log("提交" + JSON.stringify(params)) |
|
|
|
// deliverRequestSubmit(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 { |
|
|
|
// deliverRecordSubmit(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) |
|
|
|
// }) |
|
|
|
this.showErrorMessage("没有要提交的数据,请先扫描") |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
setParams() { |
|
|
|
var subList = [] |
|
|
|
var creator = this.$store.state.user.id |
|
|
|
setPrecisionStrategParams() { |
|
|
|
var itemList = [] |
|
|
|
this.detailSource.forEach(item => { |
|
|
|
item.subList.forEach(detail => { |
|
|
|
if (detail.scaned) { |
|
|
|
detail.toPackingNumber = detail.packingNumber; |
|
|
|
detail.toContainerNumber = detail.containerNumber |
|
|
|
detail.toBatch = detail.toBatch; |
|
|
|
detail.toInventoryStatus = detail.inventoryStatus |
|
|
|
detail.toLocationCode = "" |
|
|
|
detail.toLocationCode = this.toLocationCode; |
|
|
|
var filterResult = itemList.filter(res => { |
|
|
|
if (res.itemCode == item.itemCode && |
|
|
|
detail.toLocationCode == res.locationCode) { |
|
|
|
return res |
|
|
|
} |
|
|
|
}) |
|
|
|
//去掉重复元素 |
|
|
|
if (filterResult.length == 0) { |
|
|
|
var result = { |
|
|
|
itemCode: item.itemCode, |
|
|
|
locationCode: detail.toLocationCode |
|
|
|
} |
|
|
|
itemList.push(result) |
|
|
|
} |
|
|
|
|
|
|
|
subList.push(detail) |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.dataContent.subList = subList |
|
|
|
this.dataContent.creator = creator; |
|
|
|
return this.dataContent; |
|
|
|
return itemList; |
|
|
|
}, |
|
|
|
|
|
|
|
setRequestParams(){ |
|
|
|
setParams() { |
|
|
|
var subList = [] |
|
|
|
var supplierCode="" |
|
|
|
var creator = this.$store.state.user.id |
|
|
|
this.detailSource.forEach(item => { |
|
|
|
item.subList.forEach(detail => { |
|
|
|
if (detail.scaned) { |
|
|
|
detail.soNumber =detail.package.soNumber; |
|
|
|
detail.soLine = detail.soLine.soNumber; |
|
|
|
// soNumber: 926926926, |
|
|
|
// soLine: 926, |
|
|
|
// itemCode: THILDD0A691AG, |
|
|
|
// remark: , |
|
|
|
// qty: 2, |
|
|
|
// uom: EA |
|
|
|
var info = getPackingNumberAndBatchByList(this.managementList, detail.itemCode, |
|
|
|
detail.packingNumber, detail.toLocationCode, detail.batch); |
|
|
|
detail.itemCode = detail.itemCode; |
|
|
|
detail.itemName = detail.package.itemName; |
|
|
|
detail.itemDesc1 = detail.package.itemDesc1; |
|
|
|
detail.itemDesc2 = detail.package.itemDesc2; |
|
|
|
|
|
|
|
detail.inventoryStatus = detail.inventoryStatus; |
|
|
|
|
|
|
|
detail.fromPackingNumber = info.packingNumber; |
|
|
|
detail.toPackingNumber = info.packingNumber; |
|
|
|
|
|
|
|
detail.fromContainerNumber = detail.containerNumber; |
|
|
|
detail.toContainerNumber = detail.containerNumber |
|
|
|
|
|
|
|
detail.fromBatch = info.batch; |
|
|
|
detail.toBatch = info.batch; |
|
|
|
|
|
|
|
detail.fromLocationCode = detail.locationCode; |
|
|
|
detail.toLocationCode = detail.toLocationCode; |
|
|
|
|
|
|
|
subList.push(detail) |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
this.dataContent.subList = subList |
|
|
|
this.dataContent.deliverPlanNumber = "DP20231130-0001" |
|
|
|
this.dataContent.customerCode = "CF" |
|
|
|
this.dataContent.customerDockCode = "" |
|
|
|
this.dataContent.carrierCode = "" |
|
|
|
this.dataContent.transferMode = "" |
|
|
|
this.dataContent.vehiclePlateNumber = "" |
|
|
|
this.dataContent.remark = "" |
|
|
|
this.dataContent.dueTime = "" |
|
|
|
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.subList = subList; |
|
|
|
this.dataContent.creator = creator; |
|
|
|
this.dataContent.customerCode =this.customerCode; |
|
|
|
this.dataContent.fromWarehouseCode = this.detailSource[0].subList[0].warehouseCode; |
|
|
|
this.dataContent.toWarehouseCode = this.toWarehouseCode; |
|
|
|
return this.dataContent; |
|
|
|
}, |
|
|
|
|
|
|
@ -422,24 +414,21 @@ |
|
|
|
this.getFromLocationCode(location, code) |
|
|
|
}, |
|
|
|
getFromLocationCode(location, code) { |
|
|
|
this.fromLocationInfo = location; |
|
|
|
this.fromLocationCode = code; |
|
|
|
this.openScanPopup(); |
|
|
|
}, |
|
|
|
getToLocationCode(location, code) { |
|
|
|
if (this.fromLocationCode == code) { |
|
|
|
uni.showToast({ |
|
|
|
title: "来源库位[" + this.fromLocationCode + "]不能与目标库位[" + code + "]一致", |
|
|
|
duration: 2000 |
|
|
|
}) |
|
|
|
return |
|
|
|
} |
|
|
|
this.toLocationCode = code; |
|
|
|
}, |
|
|
|
|
|
|
|
showCommitSuccessMessage(hint) { |
|
|
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
|
|
|
this.fromLocationCode = ''; |
|
|
|
this.subList = []; |
|
|
|
this.detailSource = []; |
|
|
|
this.toLocationCode = ''; |
|
|
|
this.dataContent = {} |
|
|
|
this.toWarehouseCode = "" |
|
|
|
|
|
|
|
}) |
|
|
|
}, |
|
|
@ -452,7 +441,16 @@ |
|
|
|
this.detailSource.splice(i, 1) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
reasonChange(e) { |
|
|
|
if (e.detail.value.length == 0) { |
|
|
|
this.customerCode = "" |
|
|
|
this.customerText = "" |
|
|
|
} else { |
|
|
|
this.customerCode = e.detail.value[0].value |
|
|
|
this.customerText = e.detail.value[0].text |
|
|
|
} |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|