Kaynağa Gözat

功能调整-产前产后投料过程监测等按钮禁用逻辑调整

lucw 7 ay önce
ebeveyn
işleme
c90c36f277

+ 3 - 3
src/api/producetaskrulerecord/index.js

@@ -24,10 +24,10 @@ export async function saveRuleRecord(data) {
   return Promise.reject(new Error(res.data.message));
 }
 
-// 产前准备是否完成,工序配置事项的产前准备部分,事项里每一项都有已执行记录 /mes/producetaskrulerecord/isPreProductionResult
-export async function isPreProductionResult(body) {
+// 产前准备是否完成,工序配置事项的产前准备部分,事项里每一项都有已执行记录 /mes/producetaskrulerecord/checkProductionResult
+export async function checkProductionResult(body) {
   const res = await request.post(
-    '/mes/producetaskrulerecord/isPreProductionResult',
+    '/mes/producetaskrulerecord/checkProductionResult',
     body
   );
   if (res.data.code == 0) {

+ 7 - 0
src/components/selectReleaseRules/select-release-rules.vue

@@ -106,6 +106,13 @@
               return this.getDictValue('记录规则报工类型', row.reportWorkType);
             }
           },
+          {
+            prop: 'executeMethodName',
+            label: '执行方式',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
           {
             prop: 'version',
             label: '版本号',

+ 11 - 1
src/views/checklistManagement/checklist.vue

@@ -143,7 +143,7 @@
           },
           {
             prop: 'formingNum',
-            label: '数量',
+            label: '要求生产数量',
             align: 'center',
             minWidth: 110,
             showOverflowTooltip: true,
@@ -151,6 +151,16 @@
               return row.orders.map((i) => i.formingNum).join(', ');
             }
           },
+          {
+            prop: 'formedNum',
+            label: '实际生产数量',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true,
+            formatter: (row) => {
+              return row.orders.map((i) => i.formedNum).join(', ');
+            }
+          },
           {
             prop: 'specification',
             label: '规格',

+ 3 - 0
src/views/produce/components/feeding/index.vue

@@ -825,6 +825,9 @@
           }
         }
 
+        // 点击了缓存或者投料
+        this.$emit('reload');
+
         const isCache = await this.checkCache(type);
 
         if (!isCache) {

+ 42 - 22
src/views/produce/components/footBtn.vue

@@ -26,8 +26,10 @@
       singleReportInspection: {},
       // 是否完成产前准备
       isPreProductionResult: {
-        type: Boolean,
-        default: true
+        type: Object,
+        default: () => {
+          return null;
+        }
       }
     },
     data() {
@@ -263,17 +265,24 @@
           }
         ],
         btnList: [],
-        // 未完成产前准备 需要禁用的按钮
-        disable: [
-          '投料',
-          '过程监测',
-          '报工',
-          '委外请托',
-          '暂停启动',
-          '产后检查',
-          '工单交接',
-          '异常'
-        ]
+        disableObj: {
+          preResult: {
+            buts: ['投料', '过程监测', '产后检查', '报工'],
+            msg: '请先完成产前准备'
+          },
+          feedResult: {
+            buts: ['过程监测', '产后检查', '报工'],
+            msg: '请先完成投料'
+          },
+          processResult: {
+            buts: ['产后检查', '报工'],
+            msg: '请先完成过程监测'
+          },
+          postResult: {
+            buts: ['报工'],
+            msg: '请先完成产后检查'
+          }
+        }
       };
     },
     computed: {
@@ -285,14 +294,24 @@
         return this.$store.state.user.info.clientEnvironmentId;
       },
       btnListData() {
-        if (this.isPreProductionResult) {
-          return this.btnList;
-        }
+        // 根据是否完成产前准备等前置条件 来禁用按钮
         return this.btnList.map((i) => {
-          return {
-            ...i,
-            disable: this.disable.includes(i.name)
-          };
+          if (this.isPreProductionResult) {
+            for (let key in this.isPreProductionResult) {
+              let obj = this.disableObj[key];
+              if (!this.isPreProductionResult[key]) {
+                // 未完成
+                if (obj.buts.includes(i.name) && !i.disable) {
+                  return {
+                    ...i,
+                    disable: true,
+                    msg: obj.msg
+                  };
+                }
+              }
+            }
+          }
+          return i;
         });
       }
     },
@@ -364,8 +383,9 @@
     },
     methods: {
       footClick(item) {
-        if (item.disable && !this.isPreProductionResult) {
-          return this.$message.warning(`请先完成产前准备!`);
+        if (item.disable) {
+          this.$message.warning(item.msg);
+          return;
         }
         this.$emit('footBtn', item.type);
       }

+ 0 - 17
src/views/produce/components/new_produceOrder.vue

@@ -93,7 +93,6 @@
     removeItem,
     updateCertificateNumber
   } from '@/api/inspectionWork';
-  import { isPreProductionResult } from '@/api/producetaskrulerecord/index.js';
 
   export default {
     components: { routings },
@@ -473,28 +472,12 @@
           return this.$message.warning('请选择报工类型相同的工单');
         }
 
-        if (
-          this.produceTaskInfo &&
-          this.produceTaskInfo.isPrenatalPreProduction &&
-          val.length > 0
-        ) {
-          // 判断是否要求先完成 产前准备
-          const result = await isPreProductionResult({
-            produceTaskId: this.produceTaskInfo.id,
-            workOrderIds: val.map((i) => i.id)
-          });
-          this.$emit('changeIsPreProductionResult', result);
-        } else {
-          this.$emit('changeIsPreProductionResult', true);
-        }
-
         let ids = [];
         ids = val.map((item) => {
           return item.id;
         });
         this.$emit('workSelect', { ids: ids, list: val });
       },
-
       rowClick(e) {
         this.$emit('rowClick', e, this.taskObj.id);
       },

+ 1 - 0
src/views/produce/components/prenatalExamination/index.vue

@@ -114,6 +114,7 @@
         this.loading = false;
       },
       handleClose() {
+        this.$emit('close');
         this.dialogVisible = false;
       },
       async handleUpdate() {

+ 28 - 10
src/views/produce/index.vue

@@ -164,7 +164,6 @@
                 ref="produceOrder"
                 @getTaskName="getTaskName"
                 :produceTaskInfo="produceTaskInfo"
-                @changeIsPreProductionResult="changeIsPreProductionResult"
               >
               </produceOrder>
             </div>
@@ -191,6 +190,7 @@
                 <feeding
                   :workListIds="workListIds"
                   :feedNeedEquipment="feedNeedEquipment"
+                  @reload="reloadFeeding"
                 ></feeding>
               </div>
 
@@ -345,7 +345,10 @@
     <BomDetailsPop ref="bomDrawer"></BomDetailsPop>
 
     <!-- 产前准备 、 过程监测 、产后检测 -->
-    <prenatalExamination ref="prenatalExaminationRef" />
+    <prenatalExamination
+      ref="prenatalExaminationRef"
+      @close="closePrenatalExamination"
+    />
   </div>
 </template>
 
@@ -394,6 +397,7 @@
   } from '@/api/produce/index';
   import prenatalExamination from './components/prenatalExamination/index.vue';
   import { workorderPage2 } from '@/api/produce/workOrder.js';
+  import { checkProductionResult } from '@/api/producetaskrulerecord/index.js';
 
   export default {
     components: {
@@ -487,7 +491,7 @@
           { label: '过程检测', action: 'Edit' },
           { label: '产后检查', action: 'Favorite' }
         ],
-        isPreProductionResult: true,
+        isPreProductionResult: null,
         chooseType: '1',
         isUpdataTask: false,
         treeKey: '1'
@@ -617,7 +621,7 @@
 
         // 重置按钮 禁用
         if (this.produceTaskInfo && this.produceTaskInfo.id != data.id) {
-          this.isPreProductionResult = true;
+          this.isPreProductionResult = null;
         }
 
         console.log(data, 'handleNodeClick');
@@ -663,7 +667,7 @@
             if (this.produceTaskList?.length) {
               this.$store.commit('user/setTaskObj', this.produceTaskList[0]);
               this.$nextTick(() => {
-                this.$refs.taskListRef.setCurrentKey(
+                this.$refs.taskListRef?.setCurrentKey(
                   this.produceTaskList[0].id
                 );
               });
@@ -682,7 +686,7 @@
             if (this.produceTaskList?.length) {
               this.$store.commit('user/setTaskObj', this.produceTaskList[0]);
               this.$nextTick(() => {
-                this.$refs.taskListRef.setCurrentKey(
+                this.$refs.taskListRef?.setCurrentKey(
                   this.produceTaskList[0].id
                 );
               });
@@ -835,6 +839,7 @@
         this.operationType = null;
         this.workListIds = data.ids;
         this.workData = data;
+        this.checkProductionResult();
       },
 
       pickingWokeClose() {
@@ -1202,10 +1207,23 @@
           });
         }
       },
-      // 是否完成 产前准备 限制按钮
-      changeIsPreProductionResult(isPreProductionResult) {
-        console.log('isPreProductionResult', isPreProductionResult);
-        this.isPreProductionResult = isPreProductionResult;
+      closePrenatalExamination() {
+        this.checkProductionResult();
+      },
+      //是否完成 产前准备 限制按钮
+      async checkProductionResult() {
+        if (this.produceTaskInfo && this.workListIds.length > 0) {
+          // 判断是否要求先完成 产前准备等事项
+          const result = await checkProductionResult({
+            produceTaskId: this.produceTaskInfo.id,
+            workOrderIds: this.workListIds
+          });
+          this.isPreProductionResult = result;
+        }
+      },
+      // 投料后 重新检测按钮状态
+      reloadFeeding() {
+        this.checkProductionResult();
       }
     },