小小儁爺
2024-05-31 261925b27f173fd3be409a6df1b9798aea87be37
1.生产工单  按工序走模式功能新增
已修改1个文件
78 ■■■■ 文件已修改
src/views/workOrder/workOrderList.vue 78 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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 {
        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,
@@ -2624,6 +2619,11 @@
      }
      const { data: res } = await UpdateMesOrderStepSearch(data)
      this.dialogForm.mesmaxqty = res.canupdate_qty
      if (this.mesSetting.route) { // 按工艺路线走模式
        if (!this.dialogForm.routecode) {
          await this.getPartcodeChangeDialog()
        }
      if (res.stepdata.length > 0) {
        res.stepdata.forEach(i => {
@@ -2655,11 +2655,43 @@
          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()
        }
      }
      this.dialogVisible = true
      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 = ''
      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,