Browse Source

asn收货逻辑修改

intex
张立 1 week ago
parent
commit
b4c9329587
  1. 99
      src/pages/purchaseReceipt/job/purchaseReceiptAsn.vue

99
src/pages/purchaseReceipt/job/purchaseReceiptAsn.vue

@ -69,7 +69,8 @@
jobList: [], jobList: [],
detailOptions: [], detailOptions: [],
detailRemoveOption: [], detailRemoveOption: [],
ishsowLoading:false ishsowLoading:false,
asnNumberList:[]
}; };
}, },
onShow() {}, onShow() {},
@ -128,13 +129,47 @@
}); });
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
try {
if (!asnNumber) { if (!asnNumber) {
this.showMessage("标签格式异常,请重新补打标签") this.showMessage("标签格式异常,请重新补打标签")
uni.hideLoading(); uni.hideLoading();
return; return;
} }
//
if (!isAsn) {
//asn
if(this.asnNumberList.includes(asnNumber)){
uni.hideLoading()
result.label.lookNumber = result.package.number.substring(result.package.number
.length - 5);
// 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}】已经收货`)
returns
}
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()
// asn
}else{
try {
this.scanMessage = "" this.scanMessage = ""
let filters = [] let filters = []
// ASN // ASN
@ -147,17 +182,13 @@
action: "in", action: "in",
value: '1,2', value: '1,2',
} }
// , {
// column: "accept_user_id",
// action: "==",
// value: this.$store.state.user.id
// },
] ]
getPurchaseReceiptASNJobList({ getPurchaseReceiptASNJobList({
filters: filters, filters: filters,
pageNo: 1, pageNo: 1,
pageSize: 100, pageSize: 100,
}).then(async res => { }).then(async res => {
this.asnNumberList.push(asnNumber)
this.scanMessage = result.scanMessage this.scanMessage = result.scanMessage
let resultList = res.data.list; let resultList = res.data.list;
uni.hideLoading() uni.hideLoading()
@ -168,11 +199,8 @@
this.showMessage(`ASN单号【${asnNumber}】已经被${resultList[0].acceptUserName}承接`) this.showMessage(`ASN单号【${asnNumber}】已经被${resultList[0].acceptUserName}承接`)
return return
} }
//
if (!isAsn) {
result.label.lookNumber = result.package.number.substring(result.package.number result.label.lookNumber = result.package.number.substring(result.package.number
.length - 5); .length - 5);
// asn // asn
if (!asnObj) { if (!asnObj) {
this.$refs.comMessage.showQuestionMessage(`ASN单号【${asnNumber}】不在列表中,是否要按此ASN收货?`, async res => { this.$refs.comMessage.showQuestionMessage(`ASN单号【${asnNumber}】不在列表中,是否要按此ASN收货?`, async res => {
@ -249,11 +277,52 @@
this.calcHandleQty(this.jobList); this.calcHandleQty(this.jobList);
this.scanPopupGetFocus() this.scanPopupGetFocus()
} }
} else { } else {
if (asnObj) { this.showMessage("未查询到此ASN关联的采购收货任务")
}
}).catch(error => {
this.showMessage(error + "\n扫描[" + result.scanMessage + "]")
})
} catch (e) {
this.showMessage(e.message)
}
};
}else{
//asn
if(this.asnNumberList.includes(asnNumber)){
this.showMessage(`ASN单号【${asnNumber}】已经扫描`) this.showMessage(`ASN单号【${asnNumber}】已经扫描`)
uni.hideLoading()
return; 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}承接`)
return
} }
// // // //
if (resultList[0].status == '1') { if (resultList[0].status == '1') {
@ -272,7 +341,6 @@
} }
this.jobList = [...this.jobList, ...resultList] this.jobList = [...this.jobList, ...resultList]
this.scanPopupGetFocus() this.scanPopupGetFocus()
}
} else { } else {
this.showMessage("未查询到此ASN关联的采购收货任务") this.showMessage("未查询到此ASN关联的采购收货任务")
} }
@ -282,6 +350,9 @@
} catch (e) { } catch (e) {
this.showMessage(e.message) this.showMessage(e.message)
} }
}
}
}, },
calcHandleQty(detailSource) { calcHandleQty(detailSource) {
for (let item of detailSource) { for (let item of detailSource) {

Loading…
Cancel
Save