From 261925b27f173fd3be409a6df1b9798aea87be37 Mon Sep 17 00:00:00 2001
From: 小小儁爺 <1694218219@qq.com>
Date: 星期五, 31 五月 2024 16:12:37 +0800
Subject: [PATCH] 1.生产工单 按工序走模式功能新增
---
src/views/workOrder/workOrderList.vue | 120 +++++++++++++++++++++++++++++++++++++++++-------------------
1 files changed, 82 insertions(+), 38 deletions(-)
diff --git a/src/views/workOrder/workOrderList.vue b/src/views/workOrder/workOrderList.vue
index 7d4fab9..1954a3b 100644
--- a/src/views/workOrder/workOrderList.vue
+++ b/src/views/workOrder/workOrderList.vue
@@ -629,7 +629,7 @@
placeholder="璇烽�夋嫨杞﹂棿"
@change="getMesOrderNewStepContent"
>
-
+ <!-- @change="sourceType? getMesOrderNewStepContent():routecodeChange()"-->
<el-option
v-for="item in wkshopArr"
:key="item.torg_code"
@@ -671,7 +671,7 @@
</el-form-item>
<!-- :disabled="dialogForm.partcode===''"-->
- <el-form-item label="宸ヨ壓璺嚎" prop="wkshopcode">
+ <el-form-item v-if="mesSetting.route" label="宸ヨ壓璺嚎" prop="wkshopcode">
<el-select
v-model="dialogForm.routecode"
filterable
@@ -2355,10 +2355,15 @@
methods: {
// 宸ュ簭鏉ユ簮鍒囨崲
sourceTypeChange(val) {
+ this.stepTableData = []
if (val) {
this.getMesOrderNewStepContent()
} else {
- this.routecodeChange()
+ if (this.mesSetting.route) {
+ this.routecodeChange()
+ } else {
+ this.getBasicProcessData()
+ }
}
},
@@ -2606,16 +2611,6 @@
this.dialogForm.mesqtyinit = row.plan_qty
- // this.sourceTypeChange(false)
-
- if (!this.dialogForm.routecode) {
- await this.getPartcodeChangeDialog()
- }
-
- // if (row.status === 'NEW') {
- //
- // }
-
const data = {
sourceid: this.dialogForm.sourceorderid,
sourcewo: this.dialogForm.sourceorder,
@@ -2625,34 +2620,55 @@
const { data: res } = await UpdateMesOrderStepSearch(data)
this.dialogForm.mesmaxqty = res.canupdate_qty
- if (res.stepdata.length > 0) {
- res.stepdata.forEach(i => {
- this.stepTableData.push(
- {
- stepcode: i.step_code,
- stepname: i.stepname,
- stepprice: i.stepprice
- }
- )
- })
- this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
- } else {
- const data2 = {
- wkshopcode: this.dialogForm.wkshopcode,
- partcode: this.dialogForm.partcode
+ if (this.mesSetting.route) { // 鎸夊伐鑹鸿矾绾胯蛋妯″紡
+ if (!this.dialogForm.routecode) {
+ await this.getPartcodeChangeDialog()
}
- const { data: res2 } = await MesOrderNewStepContent(data2)
- if (res2.length > 0) {
- res2.forEach(i => {
+
+ if (res.stepdata.length > 0) {
+ res.stepdata.forEach(i => {
this.stepTableData.push(
{
stepcode: i.step_code,
- // stepname: i.stepname,
+ stepname: i.stepname,
stepprice: i.stepprice
}
)
})
this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
+ } else {
+ const data2 = {
+ wkshopcode: this.dialogForm.wkshopcode,
+ partcode: this.dialogForm.partcode
+ }
+ const { data: res2 } = await MesOrderNewStepContent(data2)
+ if (res2.length > 0) {
+ res2.forEach(i => {
+ this.stepTableData.push(
+ {
+ stepcode: i.step_code,
+ // stepname: i.stepname,
+ stepprice: i.stepprice
+ }
+ )
+ })
+ this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
+ }
+ }
+ } else {
+ if (res.stepdata.length > 0) {
+ res.stepdata.forEach(i => {
+ this.stepTableData.push(
+ {
+ stepcode: i.step_code,
+ stepname: i.stepname,
+ stepprice: i.stepprice
+ }
+ )
+ })
+ this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
+ } else {
+ await this.getBasicProcessData()
}
}
@@ -2660,6 +2676,22 @@
this.$nextTick(() => {
this.setSort()
})
+ },
+ // 鎸夊伐搴忔ā寮忚蛋鐨勬椂鍊� 寮曠敤鍩虹璧勬枡 宸ヨ壓
+ async getBasicProcessData() {
+ const { data: res } = await PartSelectRpute({ partcode: this.dialogForm.partcode })
+ res.sort((a, b) => a.step_seq - b.step_seq)
+ this.stepTableData = []
+ res.forEach(i => {
+ this.stepTableData.push(
+ {
+ stepcode: i.step_code,
+ stepname: i.step_name,
+ stepprice: i.unprice
+ }
+ )
+ })
+ this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
},
// 宸ュ崟鍏抽棴浜嬩欢
orderClose() {
@@ -2671,26 +2703,33 @@
this.dialogForm.partname = this.partArr.find(item => item.partcode === val).partname
this.dialogForm.partcode = this.partArr.find(item => item.partcode === val).partcode
this.dialogForm.partspec = this.partArr.find(item => item.partcode === val).partspec
- // if (this.dialogForm.wkshopcode) {
- // // this.getMesOrderNewStepContent()
- // }
+
this.dialogForm.routecode = ''
- this.getPartcodeChangeDialog()
+
+ if (this.mesSetting.route) {
+ this.getPartcodeChangeDialog()
+ } else {
+ this.getBasicProcessData()
+ }
},
async getPartcodeChangeDialog() {
const { data: res } = await PartSelectRpute({ partcode: this.dialogForm.partcode })
this.routecodeArr = res
+ // if (this.mesSetting.route) { // 鎸夊伐鑹鸿矾绾胯蛋妯″紡
this.dialogForm.routecode = this.partArr.find(item => item.partcode === this.dialogForm.partcode).default_route
-
if (this.dialogForm.routecode && !this.sourceType) {
await this.routecodeChange()
} else {
await this.getMesOrderNewStepContent()
}
+ // }
+ // else { // 鎸夊伐搴忚蛋妯″紡
+ // await this.getMesOrderNewStepContent()
+ // }
},
-
+ // 宸ヨ壓璺嚎鍊兼敼鍙�
async routecodeChange() {
const data = {
partcode: this.dialogForm.partcode,
@@ -2714,7 +2753,12 @@
this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
}
},
+
async getMesOrderNewStepContent() {
+ // if (!this.mesSetting.route && this.operation === 'edit') {
+ // return
+ // }
+
const data = {
routecode: this.dialogForm.routecode,
wkshopcode: this.dialogForm.wkshopcode,
--
Gitblit v1.9.3