|
@ -69,7 +69,8 @@ |
|
|
jobList: [], |
|
|
jobList: [], |
|
|
detailOptions: [], |
|
|
detailOptions: [], |
|
|
detailRemoveOption: [], |
|
|
detailRemoveOption: [], |
|
|
ishsowLoading:false |
|
|
ishsowLoading:false, |
|
|
|
|
|
asnNumberList:[] |
|
|
}; |
|
|
}; |
|
|
}, |
|
|
}, |
|
|
onShow() {}, |
|
|
onShow() {}, |
|
@ -128,160 +129,230 @@ |
|
|
}); |
|
|
}); |
|
|
const asnNumber = result.label.asn || result.label.code |
|
|
const asnNumber = result.label.asn || result.label.code |
|
|
const isAsn = result.label.code ? true : false |
|
|
const isAsn = result.label.code ? true : false |
|
|
|
|
|
if (!asnNumber) { |
|
|
try { |
|
|
this.showMessage("标签格式异常,请重新补打标签") |
|
|
if (!asnNumber) { |
|
|
uni.hideLoading(); |
|
|
this.showMessage("标签格式异常,请重新补打标签") |
|
|
return; |
|
|
uni.hideLoading(); |
|
|
} |
|
|
return; |
|
|
// 如果扫描箱标签 |
|
|
} |
|
|
if (!isAsn) { |
|
|
this.scanMessage = "" |
|
|
//asn已经被扫描过,不需要重新获取任务接口 |
|
|
let filters = [] |
|
|
if(this.asnNumberList.includes(asnNumber)){ |
|
|
// ASN单号 |
|
|
|
|
|
filters = [{ |
|
|
|
|
|
column: "asn_number", |
|
|
|
|
|
action: "==", |
|
|
|
|
|
value: asnNumber |
|
|
|
|
|
}, { |
|
|
|
|
|
column: "status", |
|
|
|
|
|
action: "in", |
|
|
|
|
|
value: '1,2', |
|
|
|
|
|
} |
|
|
|
|
|
// , { |
|
|
|
|
|
// column: "accept_user_id", |
|
|
|
|
|
// action: "==", |
|
|
|
|
|
// value: this.$store.state.user.id |
|
|
|
|
|
// }, |
|
|
|
|
|
] |
|
|
|
|
|
getPurchaseReceiptASNJobList({ |
|
|
|
|
|
filters: filters, |
|
|
|
|
|
pageNo: 1, |
|
|
|
|
|
pageSize: 100, |
|
|
|
|
|
}).then(async res => { |
|
|
|
|
|
this.scanMessage = result.scanMessage |
|
|
|
|
|
let resultList = res.data.list; |
|
|
|
|
|
uni.hideLoading() |
|
|
uni.hideLoading() |
|
|
if (resultList.length > 0) { |
|
|
result.label.lookNumber = result.package.number.substring(result.package.number |
|
|
// 判断目前是否有已扫描的asn单号 |
|
|
.length - 5); |
|
|
const asnObj = this.jobList.find(item => item.asnNumber == asnNumber) |
|
|
// 扫描的箱标签asn单号已经在列表中 |
|
|
if (resultList[0].acceptUserId && resultList[0].acceptUserId != this.$store.state.user.id) { |
|
|
const itemObj = this.jobList.find(item => item.asnNumber == asnNumber && item.itemCode == result |
|
|
this.showMessage(`ASN单号【${asnNumber}】已经被${resultList[0].acceptUserName}承接`) |
|
|
.label.itemCode) |
|
|
|
|
|
if (!itemObj) { |
|
|
|
|
|
this.showMessage(`ASN单号【${asnNumber}】物料代码【${result.label.itemCode}】不在列表中 `) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
// 如果扫描箱标签 |
|
|
const packObj = itemObj.packageDOS.find(cur => cur.number == result.label.packingNumber) |
|
|
if (!isAsn) { |
|
|
if (!packObj) { |
|
|
result.label.lookNumber = result.package.number.substring(result.package.number |
|
|
this.showMessage( |
|
|
.length - 5); |
|
|
`ASN单号【${asnNumber}】物料代码【${result.label.itemCode}】不存在看板编号【${ result.label.lookNumber}】`) |
|
|
|
|
|
return |
|
|
// 扫描的箱标签asn单号不在列表中给个提示 |
|
|
} |
|
|
if (!asnObj) { |
|
|
if (packObj.requestNumber) { |
|
|
this.$refs.comMessage.showQuestionMessage(`ASN单号【${asnNumber}】不在列表中,是否要按此ASN收货?`, async res => { |
|
|
this.showMessage(`看板编号【${ result.label.lookNumber}】已经收货`) |
|
|
if (res) { |
|
|
returns |
|
|
// 承接任务 // 如果任务状态是待处理的情况需要承接 |
|
|
} |
|
|
if (resultList[0].status == '1') { |
|
|
if (packObj.scaned) { |
|
|
await this.handleTakePurchaseReceiptJob(resultList[0].masterId, () => { |
|
|
this.showMessage(`看板编号【${ result.label.lookNumber}】已扫描`) |
|
|
resultList.forEach(item => { |
|
|
return |
|
|
item.status = '2' |
|
|
} |
|
|
item.acceptUserId = 4 |
|
|
itemObj.scaned = true |
|
|
}) |
|
|
packObj.scaned = true |
|
|
}) |
|
|
packObj.handleQty = result.label.qty |
|
|
} else if (resultList[0].status == '2') { |
|
|
this.calcHandleQty(this.jobList); |
|
|
// 如果任务状态是进行中的时候需要判断承接人和登录人是否一致 |
|
|
this.scanPopupGetFocus() |
|
|
if (resultList[0].acceptUserId != this.$store.state.user.id) { |
|
|
// 改asn单号没有被扫描过 |
|
|
this.showMessage(`ASN单号【${asnNumber}】已经被${resultList[0].acceptUserName}承接`) |
|
|
}else{ |
|
|
return |
|
|
try { |
|
|
|
|
|
this.scanMessage = "" |
|
|
|
|
|
let filters = [] |
|
|
|
|
|
// ASN单号 |
|
|
|
|
|
filters = [{ |
|
|
|
|
|
column: "asn_number", |
|
|
|
|
|
action: "==", |
|
|
|
|
|
value: asnNumber |
|
|
|
|
|
}, { |
|
|
|
|
|
column: "status", |
|
|
|
|
|
action: "in", |
|
|
|
|
|
value: '1,2', |
|
|
|
|
|
} |
|
|
|
|
|
] |
|
|
|
|
|
getPurchaseReceiptASNJobList({ |
|
|
|
|
|
filters: filters, |
|
|
|
|
|
pageNo: 1, |
|
|
|
|
|
pageSize: 100, |
|
|
|
|
|
}).then(async res => { |
|
|
|
|
|
this.asnNumberList.push(asnNumber) |
|
|
|
|
|
this.scanMessage = result.scanMessage |
|
|
|
|
|
let resultList = res.data.list; |
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
if (resultList.length > 0) { |
|
|
|
|
|
// 判断目前是否有已扫描的asn单号 |
|
|
|
|
|
const asnObj = this.jobList.find(item => item.asnNumber == asnNumber) |
|
|
|
|
|
if (resultList[0].acceptUserId && resultList[0].acceptUserId != this.$store.state.user.id) { |
|
|
|
|
|
this.showMessage(`ASN单号【${asnNumber}】已经被${resultList[0].acceptUserName}承接`) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
result.label.lookNumber = result.package.number.substring(result.package.number |
|
|
|
|
|
.length - 5); |
|
|
|
|
|
// 扫描的箱标签asn单号不在列表中给个提示 |
|
|
|
|
|
if (!asnObj) { |
|
|
|
|
|
this.$refs.comMessage.showQuestionMessage(`ASN单号【${asnNumber}】不在列表中,是否要按此ASN收货?`, async res => { |
|
|
|
|
|
if (res) { |
|
|
|
|
|
// 承接任务 // 如果任务状态是待处理的情况需要承接 |
|
|
|
|
|
if (resultList[0].status == '1') { |
|
|
|
|
|
await this.handleTakePurchaseReceiptJob(resultList[0].masterId, () => { |
|
|
|
|
|
resultList.forEach(item => { |
|
|
|
|
|
item.status = '2' |
|
|
|
|
|
item.acceptUserId = 4 |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
} else if (resultList[0].status == '2') { |
|
|
|
|
|
// 如果任务状态是进行中的时候需要判断承接人和登录人是否一致 |
|
|
|
|
|
if (resultList[0].acceptUserId != this.$store.state.user.id) { |
|
|
|
|
|
this.showMessage(`ASN单号【${asnNumber}】已经被${resultList[0].acceptUserName}承接`) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
this.jobList = [...this.jobList, ...resultList] |
|
|
|
|
|
const itemObj = this.jobList.find(item => item.asnNumber == asnNumber && item |
|
|
|
|
|
.itemCode == result.label.itemCode) |
|
|
|
|
|
const packObj = itemObj.packageDOS.find(cur => cur.number == result.label |
|
|
|
|
|
.packingNumber) |
|
|
|
|
|
if (packObj.requestNumber) { |
|
|
|
|
|
this.showMessage(`看板编号【${ result.label.lookNumber}】已经收货`) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
if (packObj.scaned) { |
|
|
|
|
|
this.showMessage(`看板编号【${ result.label.lookNumber}】已经扫描`) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
itemObj.scaned = true |
|
|
|
|
|
packObj.scaned = true |
|
|
|
|
|
packObj.handleQty = result.label.qty |
|
|
|
|
|
packObj.packingNumber = result.package.number |
|
|
|
|
|
packObj.packQty = Number(result.package.packQty); |
|
|
|
|
|
packObj.packUnit = result.package.packUnit |
|
|
|
|
|
packObj.labelQty = Number(result.label.qty); |
|
|
|
|
|
packObj.convertRate = result.label.convertRate |
|
|
|
|
|
packObj.supplierQty = parseFloat(calc.div(parseFloat(packObj.handleQty), parseFloat(packObj.convertRate)).toFixed(5)) |
|
|
|
|
|
packObj.supplierUom = result.label.purchaseUom |
|
|
|
|
|
this.calcHandleQty(this.jobList); |
|
|
|
|
|
this.scanPopupGetFocus() |
|
|
|
|
|
}else{ |
|
|
|
|
|
this.scanPopupGetFocus() |
|
|
} |
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} else { |
|
|
|
|
|
// 扫描的箱标签asn单号已经在列表中 |
|
|
|
|
|
const itemObj = this.jobList.find(item => item.asnNumber == asnNumber && item.itemCode == result |
|
|
|
|
|
.label.itemCode) |
|
|
|
|
|
if (!itemObj) { |
|
|
|
|
|
this.showMessage(`ASN单号【${asnNumber}】物料代码【${result.label.itemCode}】不在列表中 `) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
const packObj = itemObj.packageDOS.find(cur => cur.number == result.label.packingNumber) |
|
|
|
|
|
if (!packObj) { |
|
|
|
|
|
this.showMessage( |
|
|
|
|
|
`ASN单号【${asnNumber}】物料代码【${result.label.itemCode}】不存在看板编号【${ result.label.lookNumber}】`) |
|
|
|
|
|
return |
|
|
} |
|
|
} |
|
|
this.jobList = [...this.jobList, ...resultList] |
|
|
|
|
|
const itemObj = this.jobList.find(item => item.asnNumber == asnNumber && item |
|
|
|
|
|
.itemCode == result.label.itemCode) |
|
|
|
|
|
const packObj = itemObj.packageDOS.find(cur => cur.number == result.label |
|
|
|
|
|
.packingNumber) |
|
|
|
|
|
if (packObj.requestNumber) { |
|
|
if (packObj.requestNumber) { |
|
|
this.showMessage(`看板编号【${ result.label.lookNumber}】已经收货`) |
|
|
this.showMessage(`看板编号【${ result.label.lookNumber}】已经收货`) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
if (packObj.scaned) { |
|
|
if (packObj.scaned) { |
|
|
this.showMessage(`看板编号【${ result.label.lookNumber}】已经扫描`) |
|
|
this.showMessage(`看板编号【${ result.label.lookNumber}】已扫描`) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
itemObj.scaned = true |
|
|
itemObj.scaned = true |
|
|
packObj.scaned = true |
|
|
packObj.scaned = true |
|
|
packObj.handleQty = result.label.qty |
|
|
packObj.handleQty = result.label.qty |
|
|
packObj.packingNumber = result.package.number |
|
|
|
|
|
packObj.packQty = Number(result.package.packQty); |
|
|
|
|
|
packObj.packUnit = result.package.packUnit |
|
|
|
|
|
packObj.labelQty = Number(result.label.qty); |
|
|
|
|
|
packObj.convertRate = result.label.convertRate |
|
|
|
|
|
packObj.supplierQty = parseFloat(calc.div(parseFloat(packObj.handleQty), parseFloat(packObj.convertRate)).toFixed(5)) |
|
|
|
|
|
packObj.supplierUom = result.label.purchaseUom |
|
|
|
|
|
this.calcHandleQty(this.jobList); |
|
|
this.calcHandleQty(this.jobList); |
|
|
this.scanPopupGetFocus() |
|
|
this.scanPopupGetFocus() |
|
|
}else{ |
|
|
|
|
|
this.scanPopupGetFocus() |
|
|
|
|
|
} |
|
|
} |
|
|
}); |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
// 扫描的箱标签asn单号已经在列表中 |
|
|
this.showMessage("未查询到此ASN关联的采购收货任务") |
|
|
const itemObj = this.jobList.find(item => item.asnNumber == asnNumber && item.itemCode == result |
|
|
|
|
|
.label.itemCode) |
|
|
|
|
|
if (!itemObj) { |
|
|
|
|
|
this.showMessage(`ASN单号【${asnNumber}】物料代码【${result.label.itemCode}】不在列表中 `) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
const packObj = itemObj.packageDOS.find(cur => cur.number == result.label.packingNumber) |
|
|
|
|
|
if (!packObj) { |
|
|
|
|
|
this.showMessage( |
|
|
|
|
|
`ASN单号【${asnNumber}】物料代码【${result.label.itemCode}】不存在看板编号【${ result.label.lookNumber}】`) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
if (packObj.requestNumber) { |
|
|
|
|
|
this.showMessage(`看板编号【${ result.label.lookNumber}】已经收货`) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
if (packObj.scaned) { |
|
|
|
|
|
this.showMessage(`看板编号【${ result.label.lookNumber}】已扫描`) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
itemObj.scaned = true |
|
|
|
|
|
packObj.scaned = true |
|
|
|
|
|
packObj.handleQty = result.label.qty |
|
|
|
|
|
this.calcHandleQty(this.jobList); |
|
|
|
|
|
this.scanPopupGetFocus() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
if (asnObj) { |
|
|
|
|
|
this.showMessage(`ASN单号【${asnNumber}】已经扫描`) |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
} |
|
|
// 承接任务 // 如果任务状态是待处理的情况需要承接 |
|
|
}).catch(error => { |
|
|
if (resultList[0].status == '1') { |
|
|
this.showMessage(error + "\n扫描[" + result.scanMessage + "]") |
|
|
await this.handleTakePurchaseReceiptJob(resultList[0].masterId, () => { |
|
|
}) |
|
|
resultList.forEach(item => { |
|
|
} catch (e) { |
|
|
item.status = '2' |
|
|
this.showMessage(e.message) |
|
|
item.acceptUserId = this.$store.state.user.id |
|
|
} |
|
|
}) |
|
|
}; |
|
|
}) |
|
|
}else{ |
|
|
} else if (resultList[0].status == '2') { |
|
|
//asn已经被扫描过,不需要重新获取任务接口 |
|
|
// 如果任务状态是进行中的时候需要判断承接人和登录人是否一致 |
|
|
if(this.asnNumberList.includes(asnNumber)){ |
|
|
if (resultList[0].acceptUserId != this.$store.state.user.id) { |
|
|
this.showMessage(`ASN单号【${asnNumber}】已经扫描`) |
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
return; |
|
|
|
|
|
}else{ |
|
|
|
|
|
try { |
|
|
|
|
|
this.scanMessage = "" |
|
|
|
|
|
let filters = [] |
|
|
|
|
|
// ASN单号 |
|
|
|
|
|
filters = [{ |
|
|
|
|
|
column: "asn_number", |
|
|
|
|
|
action: "==", |
|
|
|
|
|
value: asnNumber |
|
|
|
|
|
}, { |
|
|
|
|
|
column: "status", |
|
|
|
|
|
action: "in", |
|
|
|
|
|
value: '1,2', |
|
|
|
|
|
} |
|
|
|
|
|
] |
|
|
|
|
|
getPurchaseReceiptASNJobList({ |
|
|
|
|
|
filters: filters, |
|
|
|
|
|
pageNo: 1, |
|
|
|
|
|
pageSize: 100, |
|
|
|
|
|
}).then(async res => { |
|
|
|
|
|
this.asnNumberList.push(asnNumber) |
|
|
|
|
|
this.scanMessage = result.scanMessage |
|
|
|
|
|
let resultList = res.data.list; |
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
if (resultList.length > 0) { |
|
|
|
|
|
// 判断目前是否有已扫描的asn单号 |
|
|
|
|
|
const asnObj = this.jobList.find(item => item.asnNumber == asnNumber) |
|
|
|
|
|
if (resultList[0].acceptUserId && resultList[0].acceptUserId != this.$store.state.user.id) { |
|
|
this.showMessage(`ASN单号【${asnNumber}】已经被${resultList[0].acceptUserName}承接`) |
|
|
this.showMessage(`ASN单号【${asnNumber}】已经被${resultList[0].acceptUserName}承接`) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
// 承接任务 // 如果任务状态是待处理的情况需要承接 |
|
|
|
|
|
if (resultList[0].status == '1') { |
|
|
|
|
|
await this.handleTakePurchaseReceiptJob(resultList[0].masterId, () => { |
|
|
|
|
|
resultList.forEach(item => { |
|
|
|
|
|
item.status = '2' |
|
|
|
|
|
item.acceptUserId = this.$store.state.user.id |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
} else if (resultList[0].status == '2') { |
|
|
|
|
|
// 如果任务状态是进行中的时候需要判断承接人和登录人是否一致 |
|
|
|
|
|
if (resultList[0].acceptUserId != this.$store.state.user.id) { |
|
|
|
|
|
this.showMessage(`ASN单号【${asnNumber}】已经被${resultList[0].acceptUserName}承接`) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
this.jobList = [...this.jobList, ...resultList] |
|
|
|
|
|
this.scanPopupGetFocus() |
|
|
|
|
|
} else { |
|
|
|
|
|
this.showMessage("未查询到此ASN关联的采购收货任务") |
|
|
} |
|
|
} |
|
|
this.jobList = [...this.jobList, ...resultList] |
|
|
}).catch(error => { |
|
|
this.scanPopupGetFocus() |
|
|
this.showMessage(error + "\n扫描[" + result.scanMessage + "]") |
|
|
} |
|
|
}) |
|
|
} else { |
|
|
} catch (e) { |
|
|
this.showMessage("未查询到此ASN关联的采购收货任务") |
|
|
this.showMessage(e.message) |
|
|
} |
|
|
} |
|
|
}).catch(error => { |
|
|
} |
|
|
this.showMessage(error + "\n扫描[" + result.scanMessage + "]") |
|
|
|
|
|
}) |
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
this.showMessage(e.message) |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
calcHandleQty(detailSource) { |
|
|
calcHandleQty(detailSource) { |
|
|
for (let item of detailSource) { |
|
|
for (let item of detailSource) { |
|
|