Browse Source

修改计划完工和无计划完工

hella_online_20240924
lijuncheng 2 months ago
parent
commit
84dc668606
  1. 124
      src/pages/fg/receiptByPlan.vue
  2. 46
      src/pages/fg/receiptNoPlan.vue

124
src/pages/fg/receiptByPlan.vue

@ -101,6 +101,7 @@
import { import {
isCheckMesCode, isCheckMesCode,
planReceiptSubmit, planReceiptSubmit,
createByPlanSubmit,
createPutawayRequestByPlan, createPutawayRequestByPlan,
createInspectRequestByPlan, createInspectRequestByPlan,
getPlanByNumber, getPlanByNumber,
@ -156,7 +157,9 @@
allList: [], allList: [],
index: 1, index: 1,
loadingType: "", loadingType: "",
pageSize: 500 pageSize: 500,
settingPutAwayRequestSwitch:true,
settingPutAwayInspectSwitch :true
}; };
}, },
@ -211,10 +214,13 @@
packUnit: result.packUnit, packUnit: result.packUnit,
workStationCode: result.workStationCode, workStationCode: result.workStationCode,
fgLocationCode: result.fgLocationCode, fgLocationCode: result.fgLocationCode,
putAwayRequestSwitch:result.putAwayRequestSwitch, putAwayRequestSwitch: result.putAwayRequestSwitch,
putAwayInspectSwitch:result.putAwayInspectSwitch, putAwayInspectSwitch: result.putAwayInspectSwitch,
subList: [] subList: []
} }
this.settingPutAwayRequestSwitch =result.putAwayRequestSwitch
this.settingPutAwayInspectSwitch =result.putAwayInspectSwitch
}, },
initList() { initList() {
@ -268,19 +274,19 @@
}, },
async commit() { async commit() {
let list=[]
try { try {
let startTime = new Date()
uni.showLoading({ uni.showLoading({
title: "提交中...", title: "提交中...",
mask: true mask: true
}) })
let params = this.setParams() let params = this.setParams()
console.log(JSON.stringify(params)) console.log(JSON.stringify(params))
let list = [] var planData = await createByPlanSubmit(params)
var planData = await planReceiptSubmit(params) if (planData.data.tb1&&planData.data.tb1.length>0) {
console.log('planData', planData) planData.data.tb1.forEach(item => {
if (planData.data && planData.data.length > 0) {
planData.data.forEach(item => {
list.push({ list.push({
itemCode: item.itemCode, // itemCode: item.itemCode, //
itemName: item.itemName, // itemName: item.itemName, //
@ -300,65 +306,36 @@
}) })
}) })
} else { } else {
throw new Error("提交失败") 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)
}
} }
var queryParams = { if (planData.data.tb2 && planData.data.tb2.list.length > 0) {
filters: [{ var planInfo = planData.data.tb2.list[0]
column: "number", //
action: "==", if (planInfo.goodQty >= planInfo.planQty) {
value: this.dataContent.planNumber uni.showToast({
}], title:"计划已完成",
pageNo: 1, duration:2000
pageSize: 100, })
} this.clearData()
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();
} else { } else {
this.dataContent.planNumber = planeInfo.data.list[0].number; //
this.dataContent.handleQty = 0; this.dataContent.planQty = planInfo.planQty
this.dataContent.planQty = planeInfo.data.list[0].planQty this.dataContent.goodQty = planInfo.goodQty
this.dataContent.goodQty = planeInfo.data.list[0].goodQty this.dataContent.noGoodQty = calc.sub(planInfo.planQty, planInfo.goodQty),
this.dataContent.noGoodQty = calc.sub(planeInfo.data.list[0].planQty, planeInfo.data.list[ this.dataContent.handleQty = 0;
0].goodQty), this.dataContent.subList = []
this.dataContent.subList = []
this.showList = []; this.showList = [];
this.allList = [] this.allList = []
this.index = 1 this.index = 1
} }
}
uni.hideLoading()
if (isAllSubmit) {
this.clearData()
} else { } else {
this.showList = []; throw new Error("提交失败未获取到计划信息")
this.allList = [];
this.index = 1;
this.dataContent.handleQty = 0;
} }
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 hintMsg += list[0].requestNumber
} }
nextTick(() => { nextTick(() => {
@ -369,15 +346,33 @@
uni.hideLoading() uni.hideLoading()
var hint = error.message ? error.message : error var hint = error.message ? error.message : error
if (hint.indexOf('请返回开工阶段') > -1) { if (hint.indexOf('请返回开工阶段') > -1) {
this.showErrorMessage('计划已完成') this.showMessage('计划已完成')
this.clearData() this.clearData()
this.openFg();
} else { } else {
this.showErrorMessage(hint) 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() { setParams() {
this.allList.forEach(res => { this.allList.forEach(res => {
@ -558,6 +553,13 @@
this.scanPopupGetFocus() this.scanPopupGetFocus()
} }
}); });
},
showMessage(message) {
this.$refs.comMessage.showMessage(message, res => {
if (res) {
this.openFg();
}
});
} }
} }

46
src/pages/fg/receiptNoPlan.vue

@ -97,7 +97,7 @@
<script> <script>
import { import {
isCheckMesCode, isCheckMesCode,
planReceiptSubmit, createByPlanSubmit,
createPutawayRequestByPlan, createPutawayRequestByPlan,
createInspectRequestByPlan, createInspectRequestByPlan,
getPlanByNumber, getPlanByNumber,
@ -150,6 +150,8 @@
loadingType: "", loadingType: "",
pageSize: 20, pageSize: 20,
scanedQty: 0, scanedQty: 0,
settingPutAwayRequestSwitch:true,
settingPutAwayInspectSwitch :true
}; };
}, },
@ -214,6 +216,8 @@
putAwayRequestSwitch:result.putAwayRequestSwitch, putAwayRequestSwitch:result.putAwayRequestSwitch,
putAwayInspectSwitch:result.putAwayInspectSwitch putAwayInspectSwitch:result.putAwayInspectSwitch
} }
this.settingPutAwayRequestSwitch =result.putAwayRequestSwitch
this.settingPutAwayInspectSwitch =result.putAwayInspectSwitch
}, },
initList() { initList() {
@ -264,6 +268,7 @@
}, },
async commit() { async commit() {
let list = []
try { try {
uni.showLoading({ uni.showLoading({
title: "提交中...", title: "提交中...",
@ -271,12 +276,10 @@
}) })
let params = this.setParams() let params = this.setParams()
console.log(JSON.stringify(params))
let list = [] var planData = await createByPlanSubmit(params)
var planData = await planReceiptSubmit(params) if (planData.data.tb1&&planData.data.tb1.length>0) {
if (planData.data&&planData.data.length>0) { planData.data.tb1.forEach(item => {
planData.data.forEach(item => {
list.push({ list.push({
itemCode: item.itemCode, // itemCode: item.itemCode, //
itemName: item.itemName, // itemName: item.itemName, //
@ -298,19 +301,6 @@
} else { } else {
throw new Error("提交失败") 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)
}
}
var hintMsg ="提交成功\n生成装配收货记录\n"; var hintMsg ="提交成功\n生成装配收货记录\n";
if(list.length>0&&list[0].requestNumber){ if(list.length>0&&list[0].requestNumber){
hintMsg += list[0].requestNumber hintMsg += list[0].requestNumber
@ -327,6 +317,24 @@
var hint = error.message ? error.message : error var hint = error.message ? error.message : error
this.showErrorMessage(hint) 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)
}
}
console.log("提交所有完成"+getCurrDateTime())
}, },
setParams() { setParams() {

Loading…
Cancel
Save