lucw 7 месяцев назад
Родитель
Сommit
43c86499ea

+ 10 - 1
src/api/producetaskrulerecord/index.js

@@ -112,4 +112,13 @@ export async function produceTaskRecordRules(data) {
   return Promise.reject(new Error(res.data.message));
 }
 
-
+// /mes/workorder/getProduceTaskInstanceId/{workOrderId}/{produceTaskId}
+export async function getProduceTaskInstanceId(workOrderId, produceTaskId) {
+  const res = await request.get(
+    `/mes/workorder/getProduceTaskInstanceId/${workOrderId}/${produceTaskId}`
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 1 - 0
src/views/batchRecord/components/editModal.vue

@@ -526,6 +526,7 @@
           :executeStatus="form.executeStatus"
           @refresh="getListByWorkOrderId"
         ></material>
+
         <header-title
           v-if="form.itemType == 2"
           title="检查项目"

+ 6 - 4
src/views/produce/components/feeding/index.vue

@@ -825,15 +825,11 @@
           }
         }
 
-        // 点击了缓存或者投料
-        this.$emit('reload');
-
         const isCache = await this.checkCache(type);
 
         if (!isCache) {
           return false;
         }
-
         this.loading = this.$loading({
           lock: true,
           text: '加载中',
@@ -854,6 +850,12 @@
           }
         });
 
+        // 延迟刷新
+        setTimeout(() => {
+          // 点击了缓存或者投料
+          this.$emit('reload');
+        }, 800);
+
         // for (let item of this.List) {
         //   await checkRepeatFeed({
         //     currentTaskDiagram: item.currentTaskDiagram,

+ 16 - 5
src/views/produce/components/prenatalExamination/index.vue

@@ -57,8 +57,10 @@
 <script>
   import releaseRulesDialog from './releaseRulesDialog.vue';
   import programRulesDialog from './programRulesDialog.vue';
-  import { getLastRuleRecords } from '@/api/producetaskrulerecord/index.js';
-  import { getDate } from '@/utils/dateUtils';
+  import {
+    getLastRuleRecords,
+    getProduceTaskInstanceId
+  } from '@/api/producetaskrulerecord/index.js';
   import taskDialog from './taskDialog.vue';
 
   export default {
@@ -103,6 +105,7 @@
       },
       // 获取数据
       async getData() {
+        if (!this.workOrderInfo || !this.produceTaskInfo) return;
         this.loading = true;
         const body = {
           workOrderId: this.workOrderInfo.id,
@@ -111,17 +114,25 @@
           isTempRecord: 0
         };
         const data = await getLastRuleRecords(body);
-        this.ruleRecordsList = data.map(i => {
+        const produceTaskInstanceInfo = await getProduceTaskInstanceId(
+          this.workOrderInfo.id,
+          this.produceTaskInfo.id
+        );
+        this.ruleRecordsList = data.map((i) => {
           // 工序名称
-          i.produceTaskName = this.produceTaskInfo.name
+          i.produceTaskName = produceTaskInstanceInfo.name;
+          i.produceTaskInstanceId = produceTaskInstanceInfo.id;
           return i;
         });
+        console.log('list', produceTaskInstanceInfo);
         console.log('报工流程 事项', this.ruleRecordsList);
         this.loading = false;
       },
       handleClose() {
-        this.$emit('close');
         this.dialogVisible = false;
+        this.workOrderInfo = null;
+        this.produceTaskInfo = null;
+        this.$emit('close');
       },
       async handleUpdate() {
         try {

+ 49 - 35
src/views/produce/components/prenatalExamination/material.vue

@@ -40,6 +40,7 @@
     >
       <template v-slot:reportQuantity="{ row }">
         <div>
+          <!-- {{ reportQuantitymax(row) }} -->
           <el-input-number
             size="small"
             v-model.number="row.reportQuantity"
@@ -374,38 +375,37 @@
                       (item) => item.categoryCode === row.categoryCode
                     );
 
-                  if (!materialQuotaItem) {
-                    return 0 + (row.unit || '');
-                  }
-
-                  // 计算比例
-                  const proportion =
-                    materialQuotaItem.count / this.materialQuotaInfo.baseCount;
-
-                  if (this.materialQuotaInfo.standardOutput) {
-                    // BOM标准产出
-                    const preItem = this.sumOutputDetails.find(
-                      (item) =>
-                        item.categoryCode ===
-                        this.materialQuotaInfo.standardOutput.categoryCode
-                    );
-                    if (preItem) {
-                      preCount += preItem.sumReportQuantity * proportion;
+                  if (materialQuotaItem) {
+                    // 计算比例
+                    const proportion =
+                      materialQuotaItem.count /
+                      this.materialQuotaInfo.baseCount;
+
+                    if (this.materialQuotaInfo.standardOutput) {
+                      // BOM标准产出
+                      const preItem = this.sumOutputDetails.find(
+                        (item) =>
+                          item.categoryCode ===
+                          this.materialQuotaInfo.standardOutput.categoryCode
+                      );
+                      if (preItem) {
+                        preCount += preItem.sumReportQuantity * proportion;
+                      }
                     }
-                  }
 
-                  if (this.categoryInfo) {
-                    // 在制品
-                    const preItem = this.sumOutputDetails.find(
-                      (item) =>
-                        item.categoryCode === this.categoryInfo.categoryCode
-                    );
-                    if (preItem) {
-                      preCount += preItem.sumReportQuantity * proportion;
+                    if (this.categoryInfo) {
+                      // 在制品
+                      const preItem = this.sumOutputDetails.find(
+                        (item) =>
+                          item.categoryCode === this.categoryInfo.categoryCode
+                      );
+                      if (preItem) {
+                        preCount += preItem.sumReportQuantity * proportion;
+                      }
                     }
                   }
                 }
-
+                // debugger;
                 let count = 0;
                 if (outputItem) {
                   if (this.executeStatus === 2) {
@@ -694,7 +694,7 @@
             });
           }
         });
-
+        console.log('this.localPickDetails', this.localPickDetails);
         this.$emit('update:pickDetails', this.localPickDetails);
       },
       // bom标准产出赋值
@@ -753,9 +753,17 @@
           );
           console.log('this.materialQuotaInfo', data);
           if (JSON.stringify(data) === '{}') {
-            this.materialQuotaInfo = null;
+            this.materialQuotaInfo = this.materialQuota;
             return;
           }
+          if (data.materialQuota) {
+            // 过滤数据
+            data.materialQuota = data.materialQuota.filter((i) => {
+              return i.isReworkBom != 1;
+            });
+          } else {
+            data.materialQuota = [];
+          }
           this.materialQuotaInfo = data;
           console.log('this.materialQuotaInfo', this.materialQuotaInfo);
         }
@@ -821,7 +829,7 @@
             (item) => !(item.categoryId === row.categoryId)
           );
         }
-
+        console.log('this.localOutputDetails', this.localOutputDetails);
         this.$emit('update:outputDetails', this.localOutputDetails);
       },
       // getCategoryAndLevelByCategoryId 获取产品 在制品信息
@@ -921,12 +929,18 @@
           if (!pickItem) return pickItem.quantity - preCount;
 
           // 已执行,处理重新一键报工时,sumReportQuantity包含了当前报工数量
-          if (this.executeStatus === 2) {
-            return (
+          if (this.executeStatus == 2) {
+            const count =
               pickItem.quantity -
-              (pickItem.sumReportQuantity - row.reportQuantityCopy) -
-              preCount
-            );
+              (row.sumReportQuantity - row.reportQuantityCopy) -
+              preCount;
+
+            // 如果小于本次报工数量 则返回本次报工数量
+            if (count < row.reportQuantityCopy) {
+              return row.reportQuantityCopy;
+            } else {
+              return count;
+            }
           } else {
             return pickItem.quantity - pickItem.sumReportQuantity - preCount;
           }

+ 9 - 2
src/views/produce/components/prenatalExamination/releaseRulesDialog.vue

@@ -237,7 +237,12 @@
     </el-form>
 
     <material
-      v-if="addForm.produceTaskId && addForm.reportWorkType == 2"
+      v-if="
+        addForm.produceTaskId &&
+        addForm.reportWorkType == 2 &&
+        workOrderInfo &&
+        productionInfo
+      "
       ref="materialRef"
       :pickDetails.sync="addForm.pickDetails"
       :outputDetails.sync="addForm.outputDetails"
@@ -247,7 +252,7 @@
       :ruleId="addForm.ruleId"
       :produceTaskId="addForm.produceTaskId"
       :produceTaskName="addForm.produceTaskName"
-      :produceTaskInstanceId="workOrderInfo.taskId"
+      :produceTaskInstanceId="productionInfo.produceTaskInstanceId"
       :bomCategoryId="workOrderInfo.bomCategoryId"
       :outputType="addForm.outputType"
       :categoryId="workOrderInfo.categoryId"
@@ -1023,6 +1028,8 @@
       },
       handleBeforeClose() {
         this.addForm = JSON.parse(JSON.stringify(this.formDate));
+        this.workOrderInfo = null;
+        this.productionInfo = null;
         this.statisticsType = '1';
         console.log('this.$refs.ruleFormRef', this.addForm);
         this.$nextTick(() => {

+ 2 - 2
vue.config.js

@@ -37,14 +37,14 @@ module.exports = {
         // target: 'http://192.168.1.251:18086',
         // target: 'http://192.168.1.251:18086',
         // target: 'http://192.168.1.125:18086',
-        // target: 'http://192.168.1.116:18086', // 赵沙金
+        target: 'http://192.168.1.116:18086', // 赵沙金
         // target: 'http://192.168.1.251:18086', // 开发环境
         // target: 'http://192.168.1.103:18086',192.168.1.116
         // target: 'http://192.168.1.144:18086',
         // target: 'http://192.168.1.30:18086',
         // target: 'http://192.168.1.211:18086',
         // target: 'http://192.168.1.33:18086',
-        target: 'http://192.168.1.251:18186', // 测试环境
+        // target: 'http://192.168.1.251:18186', // 测试环境
         // target: 'http://192.168.1.251:18087',
         // target: 'http://116.163.22.90:86/api', // 嘉实生产
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域