|
|
@ -101,6 +101,7 @@ |
|
|
|
import { |
|
|
|
isCheckMesCode, |
|
|
|
planReceiptSubmit, |
|
|
|
createByPlanSubmit, |
|
|
|
createPutawayRequestByPlan, |
|
|
|
createInspectRequestByPlan, |
|
|
|
getPlanByNumber, |
|
|
@ -156,7 +157,9 @@ |
|
|
|
allList: [], |
|
|
|
index: 1, |
|
|
|
loadingType: "", |
|
|
|
pageSize: 500 |
|
|
|
pageSize: 500, |
|
|
|
settingPutAwayRequestSwitch:true, |
|
|
|
settingPutAwayInspectSwitch :true |
|
|
|
|
|
|
|
}; |
|
|
|
}, |
|
|
@ -211,10 +214,13 @@ |
|
|
|
packUnit: result.packUnit, |
|
|
|
workStationCode: result.workStationCode, |
|
|
|
fgLocationCode: result.fgLocationCode, |
|
|
|
putAwayRequestSwitch:result.putAwayRequestSwitch, |
|
|
|
putAwayInspectSwitch:result.putAwayInspectSwitch, |
|
|
|
putAwayRequestSwitch: result.putAwayRequestSwitch, |
|
|
|
putAwayInspectSwitch: result.putAwayInspectSwitch, |
|
|
|
subList: [] |
|
|
|
} |
|
|
|
this.settingPutAwayRequestSwitch =result.putAwayRequestSwitch |
|
|
|
this.settingPutAwayInspectSwitch =result.putAwayInspectSwitch |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
initList() { |
|
|
@ -268,19 +274,19 @@ |
|
|
|
}, |
|
|
|
|
|
|
|
async commit() { |
|
|
|
let list=[] |
|
|
|
try { |
|
|
|
let startTime = new Date() |
|
|
|
uni.showLoading({ |
|
|
|
title: "提交中...", |
|
|
|
mask: true |
|
|
|
}) |
|
|
|
let params = this.setParams() |
|
|
|
console.log(JSON.stringify(params)) |
|
|
|
|
|
|
|
let list = [] |
|
|
|
var planData = await planReceiptSubmit(params) |
|
|
|
console.log('planData', planData) |
|
|
|
if (planData.data && planData.data.length > 0) { |
|
|
|
planData.data.forEach(item => { |
|
|
|
|
|
|
|
var planData = await createByPlanSubmit(params) |
|
|
|
if (planData.data.tb1&&planData.data.tb1.length>0) { |
|
|
|
planData.data.tb1.forEach(item => { |
|
|
|
list.push({ |
|
|
|
itemCode: item.itemCode, // 物品代码 |
|
|
|
itemName: item.itemName, // 物品名称 |
|
|
@ -300,65 +306,36 @@ |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
throw new Error("提交失败") |
|
|
|
} |
|
|
|
|
|
|
|
//创建上架申请 |
|
|
|
if(this.dataContent.putAwayRequestSwitch){ |
|
|
|
if(list.length>0&&list[0].requestNumber){ |
|
|
|
await createPutawayRequestByPlan(list[0].requestNumber) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//创建检验申请 |
|
|
|
if(this.dataContent.putAwayInspectSwitch){ |
|
|
|
if(list.length>0&&list[0].requestNumber){ |
|
|
|
await createInspectRequestByPlan(list[0].requestNumber) |
|
|
|
} |
|
|
|
throw new Error("提交失败未获取到打印信息") |
|
|
|
} |
|
|
|
|
|
|
|
var queryParams = { |
|
|
|
filters: [{ |
|
|
|
column: "number", |
|
|
|
action: "==", |
|
|
|
value: this.dataContent.planNumber |
|
|
|
}], |
|
|
|
pageNo: 1, |
|
|
|
pageSize: 100, |
|
|
|
} |
|
|
|
|
|
|
|
let isAllSubmit = Number(Number(this.dataContent.goodQty) + Number(this.showList.length)) == |
|
|
|
Number(this.dataContent.planQty) |
|
|
|
|
|
|
|
var planeInfo = await getPlanByNumber(queryParams); |
|
|
|
if (planeInfo.data && planeInfo.data.list.length > 0) { |
|
|
|
if (planeInfo.data.list[0].goodQty >= planeInfo.data.list[0].planQty) { |
|
|
|
this.clear(); |
|
|
|
if (planData.data.tb2 && planData.data.tb2.list.length > 0) { |
|
|
|
var planInfo = planData.data.tb2.list[0] |
|
|
|
//完工数大于等于计划数,说明已经完成 |
|
|
|
if (planInfo.goodQty >= planInfo.planQty) { |
|
|
|
uni.showToast({ |
|
|
|
title:"计划已完成", |
|
|
|
duration:2000 |
|
|
|
}) |
|
|
|
this.clearData() |
|
|
|
} else { |
|
|
|
this.dataContent.planNumber = planeInfo.data.list[0].number; |
|
|
|
this.dataContent.handleQty = 0; |
|
|
|
this.dataContent.planQty = planeInfo.data.list[0].planQty |
|
|
|
this.dataContent.goodQty = planeInfo.data.list[0].goodQty |
|
|
|
this.dataContent.noGoodQty = calc.sub(planeInfo.data.list[0].planQty, planeInfo.data.list[ |
|
|
|
0].goodQty), |
|
|
|
this.dataContent.subList = [] |
|
|
|
//更新已完工数和未完工数 |
|
|
|
this.dataContent.planQty = planInfo.planQty |
|
|
|
this.dataContent.goodQty = planInfo.goodQty |
|
|
|
this.dataContent.noGoodQty = calc.sub(planInfo.planQty, planInfo.goodQty), |
|
|
|
this.dataContent.handleQty = 0; |
|
|
|
this.dataContent.subList = [] |
|
|
|
this.showList = []; |
|
|
|
this.allList = [] |
|
|
|
this.index = 1 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
uni.hideLoading() |
|
|
|
if (isAllSubmit) { |
|
|
|
this.clearData() |
|
|
|
} else { |
|
|
|
this.showList = []; |
|
|
|
this.allList = []; |
|
|
|
this.index = 1; |
|
|
|
this.dataContent.handleQty = 0; |
|
|
|
throw new Error("提交失败未获取到计划信息") |
|
|
|
} |
|
|
|
var hintMsg ="提交成功\n生成装配收货记录\n"; |
|
|
|
if(list.length>0&&list[0].requestNumber){ |
|
|
|
|
|
|
|
uni.hideLoading() |
|
|
|
var hintMsg = "提交成功\n生成装配收货记录\n"; |
|
|
|
if (list.length > 0 && list[0].requestNumber) { |
|
|
|
hintMsg += list[0].requestNumber |
|
|
|
} |
|
|
|
nextTick(() => { |
|
|
@ -369,15 +346,33 @@ |
|
|
|
uni.hideLoading() |
|
|
|
var hint = error.message ? error.message : error |
|
|
|
if (hint.indexOf('请返回开工阶段') > -1) { |
|
|
|
this.showErrorMessage('计划已完成') |
|
|
|
this.showMessage('计划已完成') |
|
|
|
this.clearData() |
|
|
|
this.openFg(); |
|
|
|
} else { |
|
|
|
this.showErrorMessage(hint) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
this.startSetting(list) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
async startSetting(list){ |
|
|
|
//创建上架申请 |
|
|
|
if (this.settingPutAwayRequestSwitch) { |
|
|
|
if (list.length > 0 && list[0].requestNumber) { |
|
|
|
await createPutawayRequestByPlan(list[0].requestNumber) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//创建检验申请 |
|
|
|
if (this.settingPutAwayInspectSwitch) { |
|
|
|
if (list.length > 0 && list[0].requestNumber) { |
|
|
|
await createInspectRequestByPlan(list[0].requestNumber) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
setParams() { |
|
|
|
this.allList.forEach(res => { |
|
|
@ -558,6 +553,13 @@ |
|
|
|
this.scanPopupGetFocus() |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
showMessage(message) { |
|
|
|
this.$refs.comMessage.showMessage(message, res => { |
|
|
|
if (res) { |
|
|
|
this.openFg(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|