From 46528c3843ce67038ddb2e00dd3d3998c206a69e Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期一, 06 五月 2024 17:26:10 +0800
Subject: [PATCH] 1.递交

---
 src/views/produce/stepReport.vue |  188 ++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 153 insertions(+), 35 deletions(-)

diff --git a/src/views/produce/stepReport.vue b/src/views/produce/stepReport.vue
index 055d33e..b48169f 100644
--- a/src/views/produce/stepReport.vue
+++ b/src/views/produce/stepReport.vue
@@ -8,6 +8,7 @@
           v-waves
           icon="el-icon-thumb"
           type="primary"
+          :disabled="radioSelected===''"
           @click="report()"
         >鎶ュ伐
         </el-button>
@@ -16,7 +17,8 @@
           v-waves
           type="primary"
           icon="el-icon-thumb"
-          @click="sendOut"
+          :disabled="radioSelected===''"
+          @click="sendOut()"
         >鍙戞枡
         </el-button>
         <el-button
@@ -24,7 +26,8 @@
           v-waves
           type="primary"
           icon="el-icon-thumb"
-          @click="takeIn"
+          :disabled="radioSelected===''"
+          @click="takeIn()"
         >鏀舵枡
         </el-button>
         <el-button
@@ -32,9 +35,14 @@
           v-waves
           type="primary"
           icon="el-icon-thumb"
-          @click="handleBad"
+          :disabled="radioSelected===''"
+          @click="handleBad()"
         >澶勭悊
         </el-button>
+      </div>
+
+      <div v-if="form.wocode" style="position: absolute;left: 460px;z-index: 2;top: 23px;font-weight: bolder">
+        褰撳墠宸ュ崟鍙蜂负锛歿{ form.wocode }}
       </div>
 
       <el-tabs
@@ -43,12 +51,14 @@
         type="border-card"
         @tab-click="tabClick"
       >
+
         <el-tab-pane
           v-for="item in elTabsArr"
           :key="item.code"
           :label="item.name"
           :name="item.name"
         >
+
           <div class="bodyTopFormGroup">
             <el-form
               ref="form"
@@ -61,19 +71,50 @@
 
                 <el-form-item label="宸ュ崟鍙�" style=" display: flex;">
                   <el-input
-                    v-model="form.wocode"
+                    v-model="workOrderCurrentValue"
                     :name="'produceCode'+item.code"
                     placeholder="璇锋壂鎻忔垨杈撳叆"
                     style="width: 300px"
+
                     @keyup.enter.native="val=>enterNative(val,'produceCode' + item.code)"
                   />
                 </el-form-item>
                 <el-form-item label="浜у搧缂栫爜" style=" display: flex;">
-                  <el-input v-model="form.partcode" placeholder="璇疯緭鍏�" style="width: 200px" />
+                  <el-input
+                    v-model="form.partcode"
+                    placeholder="璇疯緭鍏�"
+                    style="width: 200px"
+
+                    @keyup.enter.native="val=>enterNative(val,'produceCode' + item.code)"
+                  />
                 </el-form-item>
                 <el-form-item label="浜у搧鍚嶇О" style=" display: flex;">
-                  <el-input v-model="form.partname" placeholder="璇疯緭鍏�" style="width: 200px" />
+                  <el-input
+                    v-model="form.partname"
+                    placeholder="璇疯緭鍏�"
+
+                    style="width: 200px"
+                    @keyup.enter.native="val=>enterNative(val,'produceCode' + item.code)"
+                  />
                 </el-form-item>
+                <el-form-item label="杞﹂棿鍚嶇О" style=" display: flex;">
+                  <el-select
+                    v-model="form.wkshopcode"
+                    filterable
+                    :popper-append-to-body="false"
+                    style="width: 200px"
+
+                    placeholder="璇烽�夋嫨"
+                  >
+                    <el-option
+                      v-for="item in wkshopcodeArr"
+                      :key="item.torg_code"
+                      :label="item.torg_name"
+                      :value="item.torg_code"
+                    />
+                  </el-select>
+                </el-form-item>
+
                 <!--                <el-form-item label="瑙勬牸鍨嬪彿" style=" display: flex;">-->
                 <!--                  <el-input v-model="form.partspec" placeholder="璇疯緭鍏�" style="width: 200px" />-->
                 <!--                </el-form-item>-->
@@ -161,7 +202,7 @@
               <el-table-column
                 prop="wo_code"
                 label="宸ュ崟鍙�"
-                width="160"
+                min-width="160"
                 show-tooltip-when-overflow
                 sortable="custom"
               />
@@ -190,6 +231,13 @@
                   {{ row.partspec ? row.partspec : '/' }}
                 </template>
               </el-table-column>
+              <el-table-column
+                prop="wkshp_name"
+                min-width="110"
+                show-tooltip-when-overflow
+                label="杞﹂棿鍚嶇О"
+                sortable="custom"
+              />
               <el-table-column
                 prop="stepname"
                 label="宸ュ簭鍚嶇О"
@@ -302,7 +350,10 @@
       @close="handleClose"
     >
       <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="110px">
-        <el-divider v-if="activeName==='鐢熶骇鍒楄〃'||activeName==='澶栧崗鏀舵枡'||activeName==='涓嶈壇寰呭鐞�'" content-position="left">鍩烘湰淇℃伅</el-divider>
+        <!--        <el-divider v-if="activeName==='鐢熶骇鍒楄〃'||activeName==='澶栧崗鏀舵枡'||activeName==='涓嶈壇寰呭鐞�'" content-position="left">鍩烘湰淇℃伅</el-divider>-->
+        <el-divider v-if="activeName==='鐢熶骇鍒楄〃'" content-position="left">鎶ュ伐淇℃伅</el-divider>
+        <el-divider v-if="activeName==='澶栧崗鏀舵枡'" content-position="left">鏀舵枡淇℃伅</el-divider>
+        <el-divider v-if="activeName==='涓嶈壇寰呭鐞�'" content-position="left">寰呭鐞嗕俊鎭�</el-divider>
         <el-form-item label="宸ュ崟缂栧彿" class="dialogFormItem">
           <div class="dialogFormItemDiv">{{ dialogForm.wo_code }}</div>
         </el-form-item>
@@ -313,13 +364,13 @@
           <div class="dialogFormItemDiv">{{ dialogForm.partname }}</div>
         </el-form-item>
         <el-form-item label="瑙勬牸鍨嬪彿" class="dialogFormItem">
-          <div class="dialogFormItemDiv">{{ dialogForm.partspec }}</div>
+          <div class="dialogFormItemDiv">{{ dialogForm.partspec ? dialogForm.partspec : '/' }}</div>
         </el-form-item>
         <el-form-item label="褰撳墠宸ュ簭" class="dialogFormItem">
           <div class="dialogFormItemDiv">{{ dialogForm.stepname }}</div>
         </el-form-item>
         <el-form-item label="涓嬮亾宸ュ簭" class="dialogFormItem">
-          <div class="dialogFormItemDiv">{{ dialogForm.nextstepname }}</div>
+          <div class="dialogFormItemDiv">{{ dialogForm.nextstepname ? dialogForm.nextstepname : '/' }}</div>
         </el-form-item>
         <el-form-item label="浠诲姟鏁伴噺" class="dialogFormItem">
           <div class="dialogFormItemDiv">{{ dialogForm.planqty }}</div>
@@ -344,12 +395,13 @@
           <div class="dialogFormItemDiv" style="color:red;">{{ dialogForm.noputqty }}</div>
         </el-form-item>
 
-        <el-form-item v-if="activeName==='鐢熶骇鍒楄〃'" prop="eqpcode" label="鎶ュ伐璁惧" class="dialogFormItem">
+        <el-form-item v-if="activeName==='鐢熶骇鍒楄〃'" label="鎶ュ伐璁惧" class="dialogFormItem">
           <el-select
             v-model="dialogForm.eqpcode"
             style="width:200px"
             placeholder="璇烽�夋嫨"
             filterable
+            clearable
             :popper-append-to-body="false"
           >
             <el-option
@@ -475,7 +527,7 @@
           <el-input v-model="dialogForm.sqty" oninput="value=value.replace(/[^\d]/g,'')" style="width: 200px" />
         </el-form-item>
 
-        <el-divider v-if="activeName==='鐢熶骇鍒楄〃'||activeName==='澶栧崗鏀舵枡'" content-position="left">涓嶈壇鏄庣粏</el-divider>
+        <el-divider v-if="activeName==='鐢熶骇鍒楄〃'||activeName==='澶栧崗鏀舵枡'" content-position="left">涓嶈壇鏄庣粏淇℃伅</el-divider>
         <el-button
           v-if="activeName==='鐢熶骇鍒楄〃'||activeName==='澶栧崗鏀舵枡'"
           v-waves
@@ -487,6 +539,7 @@
         <el-table
           v-if="activeName==='鐢熶骇鍒楄〃'||activeName==='澶栧崗鏀舵枡'"
           ref="defectTableDataRef"
+          key="defectTableDataKey"
           :data="defectTableData"
           border
           row-class-name="custom-row"
@@ -504,7 +557,6 @@
           />
           <el-table-column
             prop="stepcode"
-            show-tooltip-when-overflow
             label="缂洪櫡缂栫爜/鍚嶇О"
             align="center"
             min-width="450"
@@ -531,7 +583,6 @@
           <el-table-column
             prop="badqty"
             label="涓嶈壇鏁伴噺"
-            show-tooltip-when-overflow
             align="center"
           >
             <template slot-scope="{row}">
@@ -575,12 +626,13 @@
           <div
             style="color: #fff;width: 22px;height: 22px;display: flex;justify-content: center;align-items: center;border-radius: 50%"
             :style="{backgroundColor:$store.state.settings.theme}"
-          >{{ index+1 }}</div>
+          >{{ index + 1 }}
+          </div>
           <div style="margin-left:30px;width: 160px;" class="ellipsis">
             {{ item.tp }}
           </div>
           <div style="margin-left:30px;">
-            鍙敹鏁伴噺锛歿{ item.fqty }}
+            鍙敹鏁伴噺锛歿{ item.acceptQty }}
           </div>
         </div>
 
@@ -588,6 +640,7 @@
         <el-table
           v-if="activeName==='涓嶈壇寰呭鐞�'"
           ref="badTableDataDataRef"
+          key="badTableDataDataKey"
           :data="badTableData"
           border
           row-class-name="custom-row"
@@ -642,7 +695,6 @@
           <el-table-column
             prop="repair_qty"
             label="缁翠慨鍚堟牸鏁伴噺"
-            show-tooltip-when-overflow
             align="center"
           >
             <template slot-scope="{row}">
@@ -658,7 +710,6 @@
           <el-table-column
             prop="laborbad_qty"
             label="宸ュ簾鏁伴噺"
-            show-tooltip-when-overflow
             align="center"
           >
             <template slot-scope="{row}">
@@ -674,7 +725,6 @@
           <el-table-column
             prop="materielbad_qty"
             label="鏂欏簾鏁伴噺"
-            show-tooltip-when-overflow
             align="center"
           >
             <template slot-scope="{row}">
@@ -751,6 +801,7 @@
 import elDragDialog from '@/directive/el-drag-dialog'
 import waves from '@/directive/waves'
 import {
+  EditOrderNgStepSeave,
   MesOrderNgStepSearch,
   MesOrderNgSubStepSearch,
   MesOrderStepSearch, MesOrderStepStart,
@@ -762,7 +813,7 @@
   EqpPermissions,
   GroupsPermissions,
   GroupsPersonPermissions,
-  PersonPermissions
+  PersonPermissions, PrentOrganizationNoCompany
 } from '@/api/GeneralBasicData'
 import { nanoid } from 'nanoid'
 import { LabelBarCode } from '@/api/systemSetting'
@@ -779,6 +830,7 @@
       mainHeight: 0,
       tableHeight: 0,
       form: {
+        wkshopcode: '',
         wocode: '', // 宸ュ崟鍙�
         partcode: '', // 浜у搧缂栫爜
         partname: '', // 浜у搧鍚嶇О
@@ -788,6 +840,7 @@
         page: 1, // 绗嚑椤�
         rows: 20 // 姣忛〉澶氬皯鏉�
       },
+      wkshopcodeArr: [],
       total: 10,
       tableData: [],
       activeName: '鐢熶骇鍒楄〃',
@@ -797,6 +850,7 @@
         { code: 'IN', name: '澶栧崗鏀舵枡' },
         { code: 'BAD', name: '涓嶈壇寰呭鐞�' }
       ],
+
       radioSelected: '', // 澶氶�夋閫変腑鍊�
 
       dialogVisible: false,
@@ -881,7 +935,8 @@
       wxArr: [], // 寰�鏉ュ崟浣嶄笅鎷�
 
       defectTableData: [],
-      badTableData: []
+      badTableData: [],
+      workOrderCurrentValue: ''
 
     }
   },
@@ -912,6 +967,9 @@
 
       const { data: res5 } = await CustomerPermissions() // 寰�鏉ュ崟浣�
       this.wxArr = res5
+
+      const { data: res6 } = await PrentOrganizationNoCompany()// 鏃犲叕鍙哥殑缁勭粐涓嬫媺
+      this.wkshopcodeArr = res6
     },
     tabClick() {
       let belong
@@ -934,7 +992,7 @@
           break
       }
       this.enterNative(this.form.wocode, belong)
-      this.search()
+
       this.radioSelected = ''
     },
     enterNative(val, belong) {
@@ -958,6 +1016,7 @@
           $('input[name=\'produceCodeBAD\']')[0].focus()
         })
       }
+      this.search()
     },
     // 鎺掑簭鏀瑰彉鏃�
     sortChange({ column, prop, order }) {
@@ -974,6 +1033,8 @@
     },
     // 鏌ヨ
     async search() {
+      this.form.wocode = this.workOrderCurrentValue
+      this.workOrderCurrentValue = ''
       if (this.activeName === '鐢熶骇鍒楄〃') {
         const res = await MesOrderStepSearch(this.form)
         this.tableData = res.data
@@ -1021,8 +1082,8 @@
     // 涓嶈壇澶勭悊    鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟(涓嶈壇鏄庣粏)
     async handleBad(row) {
       const data = {
-        wocode: row.wo_code,
-        stepcode: row.stepcode
+        wocode: row ? row.wo_code : this.tableData.find(i => i.id === this.radioSelected).wo_code,
+        stepcode: row ? row.stepcode : this.tableData.find(i => i.id === this.radioSelected).stepcode
       }
       let res = await MesOrderNgSubStepSearch(data)
       if (res.code === '200') {
@@ -1049,13 +1110,13 @@
         this.dialogForm.eqpcode = res.data1.eqpcode
         this.dialogForm.eqpname = res.data1.eqpname
 
-        this.badTableData = res.data2
-
-        // 涓嬪懆鍥炴潵鍐欎笉鑹鐞嗕繚瀛樻帴鍙�
-        this.badTableData.forEach(item => {
+        res.data2.forEach(item => {
           item.repair_qty = 0
-          item.bad_qty = 0
+          item.laborbad_qty = 0
+          item.materielbad_qty = 0
         })
+
+        this.badTableData = res.data2
 
         this.dialogVisible = true
       }
@@ -1090,7 +1151,17 @@
         this.dialogForm.eqpcode = res.eqpcode
         this.dialogForm.eqpname = res.eqpname
 
-        this.dialogForm.list = res.list
+        if (this.activeName === '澶栧崗鏀舵枡') {
+          this.dialogForm.list = []
+          res.list.forEach(i => {
+            i.acceptQty = parseFloat(i.fqty) - parseFloat(i.sqty) - parseFloat(i.ng_qty) - parseFloat(i.laborbad_qty) - parseFloat(i.materielbad_qty)
+            if (i.acceptQty > 0) {
+              this.dialogForm.list.push(i)
+            }
+          })
+        }
+
+        // this.dialogForm.list = res.list
 
         this.dialogVisible = true
       }
@@ -1209,7 +1280,8 @@
             const res = await SavaMesOrderStepReport(data)
             if (res.code === '200') {
               this.$notify.success('鎶ュ伐鎴愬姛锛�')
-              await this.search()
+              // await this.search()
+              await this.tabClick()
               this.$store.state.app.buttonIsDisabled = false
               this.dialogVisible = false
             } else {
@@ -1221,6 +1293,9 @@
           if (this.activeName === '澶栧崗鍙戞枡') {
             if (parseFloat(this.dialogForm.fqty) < 1) {
               return this.$message.info('鍙戞枡鏁伴噺涓嶈兘涓洪浂锛�')
+            }
+            if (parseFloat(this.dialogForm.fqty) > parseFloat(this.dialogForm.noreportqty)) {
+              return this.$message.info('鍙戞枡鏁伴噺涓嶈兘澶т簬鏈彂鏁伴噺!')
             }
             const data = {
               mesordercode: this.dialogForm.wo_code,
@@ -1239,7 +1314,8 @@
             const res = await SavaMesOrderStepOut(data)
             if (res.code === '200') {
               this.$notify.success('鍙戞枡鎴愬姛锛�')
-              await this.search()
+              // await this.search()
+              await this.tabClick()
               this.$store.state.app.buttonIsDisabled = false
               this.dialogVisible = false
             } else {
@@ -1260,8 +1336,8 @@
               return this.$message.info('鏀舵枡鏁伴噺鍔犱笉鑹暟閲忎笉鑳藉ぇ浜庝簡鍙敹鏁伴噺!')
             }
 
-            if (this.dialogForm.list.find(i => i.name === this.dialogForm.wxcode)) {
-              if (this.dialogForm.list.find(i => i.name === this.dialogForm.wxcode).fqty < parseFloat(this.dialogForm.sqty) + parseFloat(this.dialogForm.noputqty)) {
+            if (this.dialogForm.list.find(i => i.Name === this.dialogForm.wxcode)) {
+              if (this.dialogForm.list.find(i => i.Name === this.dialogForm.wxcode).acceptQty < parseFloat(this.dialogForm.sqty) + parseFloat(this.dialogForm.noputqty)) {
                 return this.$message.info('鏀舵枡鏁伴噺鍔犱笉鑹暟閲忎笉鑳藉ぇ浜庤渚涘簲鍟嗗彲鏀舵暟閲�!')
               }
             } else {
@@ -1307,12 +1383,37 @@
             const res = await SavaMesOrderStepIn(data)
             if (res.code === '200') {
               this.$notify.success('鏀舵枡鎴愬姛锛�')
-              await this.search()
+              // await this.search()
+              await this.tabClick()
               this.$store.state.app.buttonIsDisabled = false
               this.dialogVisible = false
             } else {
               this.$store.state.app.buttonIsDisabled = false
               this.$notify.error('鏀舵枡澶辫触锛�')
+            }
+          }
+
+          if (this.activeName === '涓嶈壇寰呭鐞�') {
+            let flag = false
+            this.badTableData.forEach(i => {
+              if (parseFloat(i.repair_qty) + parseFloat(i.laborbad_qty) + parseFloat(i.materielbad_qty) > parseFloat(i.ng_qty)) {
+                flag = true
+              }
+            })
+            if (flag) {
+              return this.$message.info('缁翠慨鍚堟牸鏁伴噺+宸ュ簾鏁伴噺+鏂欏簾鏁伴噺涓嶈兘澶т簬涓嶈壇鏁伴噺锛�')
+            }
+            this.$store.state.app.buttonIsDisabled = true
+            const res = await EditOrderNgStepSeave({ Data: this.badTableData })
+            if (res.code === '200') {
+              this.$notify.success('鎻愪氦鎴愬姛锛�')
+              // await this.search()
+              await this.tabClick()
+              this.$store.state.app.buttonIsDisabled = false
+              this.dialogVisible = false
+            } else {
+              this.$store.state.app.buttonIsDisabled = false
+              this.$notify.error('鎻愪氦澶辫触锛�')
             }
           }
         }
@@ -1367,10 +1468,13 @@
       })
     },
     reset() {
+      this.form.wkshopcode = ''
       this.form.wocode = ''
+      this.form.workOrderCurrentValue = ''
       this.form.partcode = ''
       this.form.partname = ''
       this.form.partspec = ''
+      this.search()
     },
 
     headerCellStyle() {
@@ -1396,4 +1500,18 @@
   width: 200px;
 }
 
+::v-deep .el-select__caret {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+
+::v-deep .el-dialog .el-form-item__label {
+  font-weight: lighter !important;
+}
+
+::v-deep .el-dialog .el-divider__text {
+  font-weight: bolder !important;
+}
+
 </style>

--
Gitblit v1.9.3