695593266@qq.com 2 hafta önce
ebeveyn
işleme
c16b8f8878

+ 23 - 3
src/views/produce/components/picking/newWokePopup.vue

@@ -171,6 +171,8 @@
             });
             const ids = _ids.join(',');
             this.getFilepProcess(ids);
+          } else {
+            this.refreshFileTable();
           }
         });
 
@@ -178,7 +180,6 @@
       },
 
       openTwo(req) {
-        console.log(req, 'req');
         this.rightMode = 'list';
         this.currentRow = null;
         this.itemData = req;
@@ -190,21 +191,40 @@
           jobNumber: '',
           lcyStatus: '3',
           loginName: '',
-          name: req.productCode,
+          name: this.getProductCode(req),
           pageNum: 1,
           size: 10
         }).then((res) => {
-          this.workList = res.list;
+          this.workList = res?.list || [];
+          this.refreshFileTable();
         });
 
         this.visible = true;
       },
 
+      getProductCode(req) {
+        return (
+          req?.productCode ||
+          req?.materialCode ||
+          req?.categoryCode ||
+          req?.productCategoryCode ||
+          ''
+        );
+      },
+
+      refreshFileTable() {
+        this.$nextTick(() => {
+          this.$refs.fileTable?.reload?.();
+          this.$refs.fileTable?.doLayout?.();
+        });
+      },
+
       async getFilepProcess(ids) {
         await filePageAPI({
           ids: "'" + ids + "'"
         }).then((res) => {
           this.workList = res;
+          this.refreshFileTable();
         });
       },
 

+ 28 - 2
src/views/produce/components/qualityInspection/index.vue

@@ -263,6 +263,8 @@
         this.getData();
         await this.$nextTick();
 
+        const fileReq = this.buildCraftFileReq(req);
+
         const res = await parameterGetByCode({
           code: 'mes_craft_file_by_category_code'
         });
@@ -270,12 +272,36 @@
         const byCategory = res?.value === '1';
 
         if (byCategory) {
-          this.$refs.wokePopupRef?.openTwo(req);
+          this.$refs.wokePopupRef?.openTwo(fileReq);
         } else {
-          this.$refs.wokePopupRef?.open(req);
+          this.$refs.wokePopupRef?.open(fileReq);
         }
       },
 
+      getCraftFileProductCode(req) {
+        return (
+          req?.productCode ||
+          this.workOrder?.productCode ||
+          this.workOrder?.materialCode ||
+          this.workOrder?.categoryCode ||
+          this.workOrder?.productCategoryCode ||
+          ''
+        );
+      },
+
+      buildCraftFileReq(req) {
+        return {
+          ...req,
+          taskId: req?.taskId || this.produceTaskInfo?.id,
+          workOrderId:
+            req?.workOrderId ||
+            this.workOrder?.workOrderId ||
+            this.workOrder?.mesWorkOrderId ||
+            this.workOrder?.id,
+          productCode: this.getCraftFileProductCode(req)
+        };
+      },
+
       // 获取数据
       async getData() {
         this.loading = true;

+ 23 - 18
src/views/produce/index.vue

@@ -1391,11 +1391,7 @@
         const row = this.workData?.list?.[0];
         if (!row) return null;
 
-        return {
-          taskId: this.taskObj.id,
-          workOrderId: this.workListIds[0],
-          productCode: row.productCode
-        };
+        return this.buildCraftFileReq(row, this.workListIds[0]);
       },
 
       getTaskForWork() {
@@ -1404,10 +1400,25 @@
           return null;
         }
 
+        return this.buildCraftFileReq(this.taskData, this.taskData.workOrderId);
+      },
+
+      getCraftFileProductCode(row) {
+        return (
+          row?.productCode ||
+          row?.materialCode ||
+          row?.categoryCode ||
+          row?.productCategoryCode ||
+          ''
+        );
+      },
+
+      buildCraftFileReq(row, workOrderId) {
         return {
           taskId: this.taskObj.id,
-          workOrderId: this.taskData.workOrderId,
-          productCode: this.taskData.productCode
+          workOrderId:
+            workOrderId || row?.workOrderId || row?.mesWorkOrderId || row?.id,
+          productCode: this.getCraftFileProductCode(row)
         };
       },
 
@@ -1568,11 +1579,7 @@
           const item = this.workData?.list?.[0];
           if (!item) return null;
 
-          const req = {
-            taskId: this.taskObj.id,
-            workOrderId: this.workListIds[0],
-            productCode: item.productCode
-          };
+          const req = this.buildCraftFileReq(item, this.workListIds[0]);
 
           this.$refs.qualityInspectionRef.open(
             this.workData.list[0],
@@ -1631,12 +1638,10 @@
         // console.log(item, 'item1111');
         // if (!item) return null;
 
-        const req = {
-          taskId: this.taskObj.id,
-          workOrderId:
-            row.workOrderId || row.mesWorkOrderId || this.workListIds[0],
-          productCode: row.productCode
-        };
+        const req = this.buildCraftFileReq(
+          row,
+          row.workOrderId || row.mesWorkOrderId || this.workListIds[0]
+        );
 
         this.$refs.qualityInspectionRef.open(row, taskData, 1, req);
       },

+ 42 - 10
src/views/produceOrder/workReport.vue

@@ -838,6 +838,39 @@
         );
       },
 
+      getCraftFileProductCode(row) {
+        return (
+          row?.productCode ||
+          row?.materialCode ||
+          row?.categoryCode ||
+          row?.productCategoryCode ||
+          ''
+        );
+      },
+
+      buildCraftFileReq(row, workOrderId) {
+        return {
+          taskId: this.taskObj.id,
+          workOrderId:
+            workOrderId || row?.workOrderId || row?.mesWorkOrderId || row?.id,
+          productCode: this.getCraftFileProductCode(row)
+        };
+      },
+
+      async openWorkFile(req) {
+        const res = await parameterGetByCode({
+          code: 'mes_craft_file_by_category_code'
+        });
+
+        const byCategory = res?.value === '1';
+
+        if (byCategory) {
+          this.$refs.wokePopupRef.openTwo(req);
+        } else {
+          this.$refs.wokePopupRef.open(req);
+        }
+      },
+
       async checkQualityResult() {
         if (
           this.taskObj &&
@@ -1040,12 +1073,12 @@
           if (this.workListIds.length > 1) {
             return this.$message.warning('工艺文件只能选择一个工单!');
           }
-          let req = {
-            taskId: this.taskObj.id,
-            workOrderId: this.workListIds[0]
-          };
+          const req = this.buildCraftFileReq(
+            this.workOrderInfo,
+            this.workListIds[0]
+          );
 
-          this.$refs.wokePopupRef.open(req);
+          await this.openWorkFile(req);
         }
         if (t == 'feed') {
         }
@@ -1074,11 +1107,10 @@
             return this.$message.warning('首件两检只能选择一个工单!');
           }
 
-          const req = {
-            taskId: this.taskObj.id,
-            workOrderId: this.workOrderInfo.id,
-            productCode: this.workOrderInfo.productCode
-          };
+          const req = this.buildCraftFileReq(
+            this.workOrderInfo,
+            this.workOrderInfo.id
+          );
 
           this.$refs.qualityInspectionRef.open(
             this.workOrderInfo,

+ 2 - 2
vue.config.js

@@ -32,7 +32,7 @@ module.exports = {
       // 当我们的本地的请求 有/api的时候,就会代理我们的请求地址向另外一个服务器发出请求
       '/api': {
         // target: 'http://124.71.68.31:50001',
-        target: 'http://192.168.1.125:18086',
+        // target: 'http://192.168.1.125:18086',
         // target: 'http://192.168.1.251:18086',
         // target: 'http://192.168.1.251:18186',
         // target: 'http://192.168.1.251:18086', // 开发环境
@@ -45,7 +45,7 @@ module.exports = {
         // target: 'http://192.168.1.251:18186', // 测试环境
         // target: 'http://192.168.1.251:18087',
         // target: 'http://116.163.22.90:86/api', // 嘉实生产
-        // target: 'http://aiot.zoomwin.com.cn:51005/api',
+        target: 'http://aiot.zoomwin.com.cn:51005/api',
         // target: 'http://f222326r53.imwork.net',
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {