From 9615c9d430291d13fe433f0be8965d0cbdcb5448 Mon Sep 17 00:00:00 2001 From: wangyufei <2267742828@qq.com> Date: Thu, 1 Aug 2024 15:53:18 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E8=AE=A1=E5=88=92=E5=BC=80?= =?UTF-8?q?=E5=85=B3=E5=8D=95=E6=8D=AE=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../productionplan/productionMain/index.vue | 118 ++++++----------- .../productionMainAssemble/index.vue | 117 ++++++----------- .../productionMainAssembleSparePart/index.vue | 121 +++++++----------- .../productionMainPredictSparePart/index.vue | 117 +++++++---------- 4 files changed, 170 insertions(+), 303 deletions(-) diff --git a/src/views/wms/productionManage/productionplan/productionMain/index.vue b/src/views/wms/productionManage/productionplan/productionMain/index.vue index ca254fd72..686c1aae0 100644 --- a/src/views/wms/productionManage/productionplan/productionMain/index.vue +++ b/src/views/wms/productionManage/productionplan/productionMain/index.vue @@ -88,7 +88,7 @@ import * as ProductionDetailApi from '@/api/wms/productionDetail' import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as ItemBasicApi from '@/api/wms/itembasic' import * as BomApi from "@/api/wms/bom"; - +import * as SwitchApi from '@/api/wms/switch' // 生产计划主 // 预生产计划 defineOptions({ name: 'ProductionMain' }) @@ -338,31 +338,7 @@ const buttonTableClick = async (val, row) => { tableObject.loading = true await ProductionMainApi.submit(row.masterId).then((res) => { if (res.status == '6') { - // 生成备料计划 - ProductionMainApi.generatePreparetoissue(row.number).then((PreparetoissueRes) => { - // 生成收货申请 - ProductionMainApi.generateProductreceiptRequest(row.number).then(() => { - message.success(t('common.updateSuccess')) - tableObject.loading = false - getList() - }).catch(err => { - tableObject.loading = false - console.log(err) - }) - // 生成发料申请 - ProductionMainApi.generateIssueRequest(PreparetoissueRes.number) - }).catch(err => { - console.log(err) - // 生成收货申请 - ProductionMainApi.generateProductreceiptRequest(row.number).then(() => { - message.success(t('common.updateSuccess')) - tableObject.loading = false - getList() - }).catch(err => { - tableObject.loading = false - console.log(err) - }) - }) + autoCreatePlanRequest(row) } // message.success(t('common.updateSuccess')) // tableObject.loading = false @@ -410,30 +386,8 @@ const buttonTableClick = async (val, row) => { }) // 生成备料计划 tableObject.loading = true - ProductionMainApi.generatePreparetoissue(row.number).then((PreparetoissueRes) => { - // 生成收货申请 - ProductionMainApi.generateProductreceiptRequest(row.number).then(() => { - message.success(t('common.updateSuccess')) - tableObject.loading = false - getList() - }).catch(err => { - tableObject.loading = false - console.log(err) - }) - // 生成发料申请 - ProductionMainApi.generateIssueRequest(PreparetoissueRes.number) - }).catch(err => { - console.log(err) - // 生成收货申请 - ProductionMainApi.generateProductreceiptRequest(row.number).then(() => { - message.success(t('common.updateSuccess')) - tableObject.loading = false - getList() - }).catch(err => { - tableObject.loading = false - console.log(err) - }) - }) + autoCreatePlanRequest(row) + } }) if (!isAvailable) { @@ -494,6 +448,42 @@ const buttonTableClick = async (val, row) => { } +const planSwitch = ref(false) +const requestSwitch = ref(false) +const getSwitch = async ()=>{ + let switch1 = await SwitchApi.getByCode('CreatePrepareToIssuePlanAfterProductionPlanPublished') + planSwitch.value = switch1=='TRUE' + let switch2 = await SwitchApi.getByCode('CreateProductReciptRequestAfterProductionPlanPublished') + requestSwitch.value = switch2=='TRUE' + console.log('switch1',switch1) + console.log('switch2',switch2) + +} +// 自动提交 +const autoCreatePlanRequest = async (row)=>{ + // 生成备料计划 + try { + + if(planSwitch.value) { + // /generatePreparetoissue?number + let PreparetoissueRes = await ProductionMainApi.generatePreparetoissue(row.number) + // 生成发料申请 + // generateIssueRequest + ProductionMainApi.generateIssueRequest(PreparetoissueRes.number) + } + } finally { + try { + if(requestSwitch.value){ + // /generateProductreceiptRequest + await ProductionMainApi.generateProductreceiptRequest(row.number) + } + } finally { + message.success(t('common.updateSuccess')) + tableObject.loading = false + getList() + } + } +} /** 添加/修改操作 */ const formRef = ref() const openForm =async (type: string, row?: number) => { @@ -606,32 +596,7 @@ const submitForm = async (formType, submitData) => { await ProductionMainApi.createProductionMain(data).then((res) => { // console.log(565,res) if (res.status == '6') { - // 生成备料计划 - tableObject.loading = true - ProductionMainApi.generatePreparetoissue(res.number).then((PreparetoissueRes) => { - // 生成收货申请 - ProductionMainApi.generateProductreceiptRequest(res.number).then(() => { - message.success(t('common.createSuccess')) - tableObject.loading = false - getList() - }).catch(err => { - tableObject.loading = false - console.log(err) - }) - // 生成发料申请 - ProductionMainApi.generateIssueRequest(PreparetoissueRes.number) - }).catch(err => { - console.log(err) - // 生成收货申请 - ProductionMainApi.generateProductreceiptRequest(res.number).then(() => { - message.success(t('common.createSuccess')) - tableObject.loading = false - getList() - }).catch(err => { - tableObject.loading = false - console.log(err) - }) - }) + autoCreatePlanRequest(res) } }) // message.success(t('common.createSuccess')) @@ -685,6 +650,7 @@ const searchFormClick = (searchData) => { /** 初始化 **/ onMounted(async () => { + getSwitch() tableObject.params = { planType: 'predict' } diff --git a/src/views/wms/productionManage/productionplan/productionMainAssemble/index.vue b/src/views/wms/productionManage/productionplan/productionMainAssemble/index.vue index c1c214df9..2d1720d5c 100644 --- a/src/views/wms/productionManage/productionplan/productionMainAssemble/index.vue +++ b/src/views/wms/productionManage/productionplan/productionMainAssemble/index.vue @@ -88,6 +88,7 @@ import * as ProductionDetailApi from '@/api/wms/productionDetail' import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as ItemBasicApi from '@/api/wms/itembasic' import * as BomApi from "@/api/wms/bom"; +import * as SwitchApi from '@/api/wms/switch' // 装配计划 defineOptions({ name: 'ProductionMainAssemble' }) @@ -335,33 +336,7 @@ const buttonTableClick = async (val, row) => { tableObject.loading = true await ProductionMainApi.submit(row.masterId).then((res) => { if (res.status == '6') { - // 生成备料计划 - ProductionMainApi.generatePreparetoissue(row.number).then((PreparetoissueRes) => { - // 生成收货申请 - ProductionMainApi.generateProductreceiptRequest(row.number).then(() => { - message.success(t('common.updateSuccess')) - tableObject.loading = false - getList() - }).catch(err => { - tableObject.loading = false - console.log(err) - }) - // 生成发料申请 - ProductionMainApi.generateIssueRequest(PreparetoissueRes.number) - }).catch(err => { - // tableObject.loading = false - console.log(err) - // 生成收货申请 - // tableObject.loading = true - ProductionMainApi.generateProductreceiptRequest(row.number).then(() => { - message.success(t('common.updateSuccess')) - tableObject.loading = false - getList() - }).catch(err => { - tableObject.loading = false - console.log(err) - }) - }) + autoCreatePlanRequest(res) } // message.success(t('common.updateSuccess')) // tableObject.loading = false @@ -409,30 +384,7 @@ const buttonTableClick = async (val, row) => { }) // 生成备料计划 tableObject.loading = true - ProductionMainApi.generatePreparetoissue(row.number).then((PreparetoissueRes) => { - // 生成收货申请 - ProductionMainApi.generateProductreceiptRequest(row.number).then(() => { - message.success(t('common.updateSuccess')) - tableObject.loading = false - getList() - }).catch(err => { - tableObject.loading = false - console.log(err) - }) - // 生成发料申请 - ProductionMainApi.generateIssueRequest(PreparetoissueRes.number) - }).catch(err => { - console.log(err) - // 生成收货申请 - ProductionMainApi.generateProductreceiptRequest(row.number).then(() => { - message.success(t('common.updateSuccess')) - tableObject.loading = false - getList() - }).catch(err => { - tableObject.loading = false - console.log(err) - }) - }) + autoCreatePlanRequest(row) } }) if (!isAvailable) { @@ -604,32 +556,7 @@ const submitForm = async (formType, submitData) => { await ProductionMainApi.createProductionMain(data).then((res) => { // console.log(565,res) if (res.status == '6') { - // 生成备料计划 - tableObject.loading = true - ProductionMainApi.generatePreparetoissue(res.number).then((PreparetoissueRes) => { - // 生成收货申请 - ProductionMainApi.generateProductreceiptRequest(res.number).then(() => { - message.success(t('common.createSuccess')) - tableObject.loading = false - getList() - }).catch(err => { - tableObject.loading = false - console.log(err) - }) - // 生成发料申请 - ProductionMainApi.generateIssueRequest(PreparetoissueRes.number) - }).catch(err => { - console.log(err) - // 生成收货申请 - ProductionMainApi.generateProductreceiptRequest(res.number).then(() => { - message.success(t('common.createSuccess')) - tableObject.loading = false - getList() - }).catch(err => { - tableObject.loading = false - console.log(err) - }) - }) + autoCreatePlanRequest(res) } }) // message.success(t('common.createSuccess')) @@ -644,7 +571,42 @@ const submitForm = async (formType, submitData) => { formRef.value.formLoading = false } } +const planSwitch = ref(false) +const requestSwitch = ref(false) +const getSwitch = async ()=>{ + let switch1 = await SwitchApi.getByCode('CreatePrepareToIssuePlanAfterProductionPlanPublished') + planSwitch.value = switch1=='TRUE' + let switch2 = await SwitchApi.getByCode('CreateProductReciptRequestAfterProductionPlanPublished') + requestSwitch.value = switch2=='TRUE' + console.log('switch1',switch1) + console.log('switch2',switch2) +} +// 自动提交 +const autoCreatePlanRequest = async (row)=>{ + // 生成备料计划 + try { + + if(planSwitch.value) { + // /generatePreparetoissue?number + let PreparetoissueRes = await ProductionMainApi.generatePreparetoissue(row.number) + // 生成发料申请 + // generateIssueRequest + ProductionMainApi.generateIssueRequest(PreparetoissueRes.number) + } + } finally { + try { + if(requestSwitch.value){ + // /generateProductreceiptRequest + await ProductionMainApi.generateProductreceiptRequest(row.number) + } + } finally { + message.success(t('common.updateSuccess')) + tableObject.loading = false + getList() + } + } +} /** 导入 */ const importFormRef = ref() const handleImport = () => { @@ -683,6 +645,7 @@ const searchFormClick = (searchData) => { /** 初始化 **/ onMounted(async () => { + getSwitch() tableObject.params = { planType: 'assemble' } diff --git a/src/views/wms/productionManage/productionplan/productionMainAssembleSparePart/index.vue b/src/views/wms/productionManage/productionplan/productionMainAssembleSparePart/index.vue index b0e9ce7a9..f18d7babd 100644 --- a/src/views/wms/productionManage/productionplan/productionMainAssembleSparePart/index.vue +++ b/src/views/wms/productionManage/productionplan/productionMainAssembleSparePart/index.vue @@ -88,6 +88,7 @@ import * as ProductionDetailApi from '@/api/wms/productionDetail' import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as ItemBasicApi from '@/api/wms/itembasic' import * as BomApi from "@/api/wms/bom"; +import * as SwitchApi from '@/api/wms/switch' // 装配备件计划 defineOptions({ name: 'ProductionMainASparePart' }) @@ -327,33 +328,7 @@ const buttonTableClick = async (val, row) => { tableObject.loading = true await ProductionMainApi.submit(row.masterId).then((res) => { if (res.status == '6') { - // 生成备料计划 - ProductionMainApi.generatePreparetoissue(row.number).then((PreparetoissueRes) => { - // 生成收货申请 - ProductionMainApi.generateProductreceiptRequest(row.number).then(() => { - message.success(t('common.updateSuccess')) - tableObject.loading = false - getList() - }).catch(err => { - tableObject.loading = false - console.log(err) - }) - // 生成发料申请 - ProductionMainApi.generateIssueRequest(PreparetoissueRes.number) - }).catch(err => { - // tableObject.loading = false - console.log(err) - // 生成收货申请 - // tableObject.loading = true - ProductionMainApi.generateProductreceiptRequest(row.number).then(() => { - message.success(t('common.updateSuccess')) - tableObject.loading = false - getList() - }).catch(err => { - tableObject.loading = false - console.log(err) - }) - }) + autoCreatePlanRequest(row) } // message.success(t('common.updateSuccess')) // tableObject.loading = false @@ -401,32 +376,7 @@ const buttonTableClick = async (val, row) => { }) // 生成备料计划 tableObject.loading = true - ProductionMainApi.generatePreparetoissue(row.number).then((PreparetoissueRes) => { - // 生成收货申请 - ProductionMainApi.generateProductreceiptRequest(row.number).then(() => { - message.success(t('common.updateSuccess')) - tableObject.loading = false - getList() - }).catch(err => { - tableObject.loading = false - console.log(err) - }) - // 生成发料申请 - ProductionMainApi.generateIssueRequest(PreparetoissueRes.number) - }).catch(err => { - // tableObject.loading = false - console.log(err) - // 生成收货申请 - // tableObject.loading = true - ProductionMainApi.generateProductreceiptRequest(row.number).then(() => { - message.success(t('common.updateSuccess')) - tableObject.loading = false - getList() - }).catch(err => { - tableObject.loading = false - console.log(err) - }) - }) + autoCreatePlanRequest(row) } }) if (!isAvailable) { @@ -598,30 +548,8 @@ const submitForm = async (formType, submitData) => { if (res.status == '6') { // 生成备料计划 tableObject.loading = true - ProductionMainApi.generatePreparetoissue(res.number).then((PreparetoissueRes) => { - // 生成收货申请 - ProductionMainApi.generateProductreceiptRequest(res.number).then(() => { - message.success(t('common.createSuccess')) - tableObject.loading = false - getList() - }).catch(err => { - tableObject.loading = false - console.log(err) - }) - // 生成发料申请 - ProductionMainApi.generateIssueRequest(PreparetoissueRes.number) - }).catch(err => { - console.log(err) - // 生成收货申请 - ProductionMainApi.generateProductreceiptRequest(res.number).then(() => { - message.success(t('common.createSuccess')) - tableObject.loading = false - getList() - }).catch(err => { - tableObject.loading = false - console.log(err) - }) - }) + autoCreatePlanRequest(res) + } }) // message.success(t('common.createSuccess')) @@ -637,6 +565,44 @@ const submitForm = async (formType, submitData) => { } } + +const planSwitch = ref(false) +const requestSwitch = ref(false) +const getSwitch = async ()=>{ + let switch1 = await SwitchApi.getByCode('CreatePrepareToIssuePlanAfterProductionPlanPublished') + planSwitch.value = switch1=='TRUE' + let switch2 = await SwitchApi.getByCode('CreateProductReciptRequestAfterProductionPlanPublished') + requestSwitch.value = switch2=='TRUE' + console.log('switch1',switch1) + console.log('switch2',switch2) + +} +// 自动提交 +const autoCreatePlanRequest = async (row)=>{ + // 生成备料计划 + try { + + if(planSwitch.value) { + // /generatePreparetoissue?number + let PreparetoissueRes = await ProductionMainApi.generatePreparetoissue(row.number) + // 生成发料申请 + // generateIssueRequest + ProductionMainApi.generateIssueRequest(PreparetoissueRes.number) + } + } finally { + try { + if(requestSwitch.value){ + // /generateProductreceiptRequest + await ProductionMainApi.generateProductreceiptRequest(row.number) + } + } finally { + message.success(t('common.updateSuccess')) + tableObject.loading = false + getList() + } + } +} + /** 导入 */ const importFormRef = ref() const handleImport = () => { @@ -675,6 +641,7 @@ const searchFormClick = (searchData) => { /** 初始化 **/ onMounted(async () => { + getSwitch() tableObject.params = { planType: 'assembleSparePart' } diff --git a/src/views/wms/productionManage/productionplan/productionMainPredictSparePart/index.vue b/src/views/wms/productionManage/productionplan/productionMainPredictSparePart/index.vue index 3b44d5f4c..37d343540 100644 --- a/src/views/wms/productionManage/productionplan/productionMainPredictSparePart/index.vue +++ b/src/views/wms/productionManage/productionplan/productionMainPredictSparePart/index.vue @@ -88,6 +88,7 @@ import * as ProductionDetailApi from '@/api/wms/productionDetail' import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as ItemBasicApi from '@/api/wms/itembasic' import * as BomApi from "@/api/wms/bom"; +import * as SwitchApi from '@/api/wms/switch' // 预生产备件计划 defineOptions({ name: 'ProductionMainPredictSparePart' }) @@ -327,31 +328,7 @@ const buttonTableClick = async (val, row) => { tableObject.loading = true await ProductionMainApi.submit(row.masterId).then((res) => { if (res.status == '6') { - // 生成备料计划 - ProductionMainApi.generatePreparetoissue(row.number).then((PreparetoissueRes) => { - // 生成收货申请 - ProductionMainApi.generateProductreceiptRequest(row.number).then(() => { - message.success(t('common.updateSuccess')) - tableObject.loading = false - getList() - }).catch(err => { - tableObject.loading = false - console.log(err) - }) - // 生成发料申请 - ProductionMainApi.generateIssueRequest(PreparetoissueRes.number) - }).catch(err => { - console.log(err) - // 生成收货申请 - ProductionMainApi.generateProductreceiptRequest(row.number).then(() => { - message.success(t('common.updateSuccess')) - tableObject.loading = false - getList() - }).catch(err => { - tableObject.loading = false - console.log(err) - }) - }) + autoCreatePlanRequest(row) } // message.success(t('common.updateSuccess')) // tableObject.loading = false @@ -399,30 +376,8 @@ const buttonTableClick = async (val, row) => { }) // 生成备料计划 tableObject.loading = true - ProductionMainApi.generatePreparetoissue(row.number).then((PreparetoissueRes) => { - // 生成收货申请 - ProductionMainApi.generateProductreceiptRequest(row.number).then(() => { - message.success(t('common.updateSuccess')) - tableObject.loading = false - getList() - }).catch(err => { - tableObject.loading = false - console.log(err) - }) - // 生成发料申请 - ProductionMainApi.generateIssueRequest(PreparetoissueRes.number) - }).catch(err => { - console.log(err) - // 生成收货申请 - ProductionMainApi.generateProductreceiptRequest(row.number).then(() => { - message.success(t('common.updateSuccess')) - tableObject.loading = false - getList() - }).catch(err => { - tableObject.loading = false - console.log(err) - }) - }) + autoCreatePlanRequest(row) + } }) if (!isAvailable) { @@ -596,30 +551,8 @@ const submitForm = async (formType, submitData) => { if (res.status == '6') { // 生成备料计划 tableObject.loading = true - ProductionMainApi.generatePreparetoissue(res.number).then((PreparetoissueRes) => { - // 生成收货申请 - ProductionMainApi.generateProductreceiptRequest(res.number).then(() => { - message.success(t('common.createSuccess')) - tableObject.loading = false - getList() - }).catch(err => { - tableObject.loading = false - console.log(err) - }) - // 生成发料申请 - ProductionMainApi.generateIssueRequest(PreparetoissueRes.number) - }).catch(err => { - console.log(err) - // 生成收货申请 - ProductionMainApi.generateProductreceiptRequest(res.number).then(() => { - message.success(t('common.createSuccess')) - tableObject.loading = false - getList() - }).catch(err => { - tableObject.loading = false - console.log(err) - }) - }) + autoCreatePlanRequest(res) + } }) // message.success(t('common.createSuccess')) @@ -635,6 +568,43 @@ const submitForm = async (formType, submitData) => { } } +const planSwitch = ref(false) +const requestSwitch = ref(false) +const getSwitch = async ()=>{ + let switch1 = await SwitchApi.getByCode('CreatePrepareToIssuePlanAfterProductionPlanPublished') + planSwitch.value = switch1=='TRUE' + let switch2 = await SwitchApi.getByCode('CreateProductReciptRequestAfterProductionPlanPublished') + requestSwitch.value = switch2=='TRUE' + console.log('switch1',switch1) + console.log('switch2',switch2) + +} +// 自动提交 +const autoCreatePlanRequest = async (row)=>{ + // 生成备料计划 + try { + + if(planSwitch.value) { + // /generatePreparetoissue?number + let PreparetoissueRes = await ProductionMainApi.generatePreparetoissue(row.number) + // 生成发料申请 + // generateIssueRequest + ProductionMainApi.generateIssueRequest(PreparetoissueRes.number) + } + } finally { + try { + if(requestSwitch.value){ + // /generateProductreceiptRequest + await ProductionMainApi.generateProductreceiptRequest(row.number) + } + } finally { + message.success(t('common.updateSuccess')) + tableObject.loading = false + getList() + } + } +} + /** 导入 */ const importFormRef = ref() const handleImport = () => { @@ -672,6 +642,7 @@ const searchFormClick = (searchData) => { /** 初始化 **/ onMounted(async () => { + getSwitch() tableObject.params = { planType: 'predictSparePart' }