Bladeren bron

bug修复,功能完善

lucw 7 maanden geleden
bovenliggende
commit
fb49641cf3

+ 8 - 6
src/views/batchRecord/components/editModal.vue

@@ -1179,7 +1179,7 @@
     },
     methods: {
       // 外部调用,打开弹窗
-      open(type, data) {
+      open(type, data, activeComp = 'main') {
         console.log('data', type, data);
         this.type = type;
         this.form.reportWorkType = this.reportWorkType;
@@ -1203,6 +1203,9 @@
           this.title = `${this.reportWorkTypeName}事项`;
           this.form.workOrderId = data.workOrderId;
           this.form.id = data.id;
+          if (data.processInstanceId) {
+            this.activeComp = activeComp;
+          }
           if (this.form.workOrderId) {
             this.getProductTaskList(this.form.workOrderId);
             // 根据工单id 获取详情
@@ -1307,6 +1310,7 @@
         this.details = null;
         this.workOrderInfo = null;
         this.rulesDetail = null;
+        this.activeComp = 'main';
         this.$nextTick(() => {
           this.$refs.formRef.clearValidate();
           this.visible = false;
@@ -1671,7 +1675,7 @@
           i.reportQuantityCopy = i.reportQuantity;
 
           const sumItem = materialObject.sumOutputDetails.find(
-            (i) => i.categoryCode === i.categoryCode
+            (item) => item.categoryCode === i.categoryCode
           );
 
           if (sumItem) {
@@ -1744,14 +1748,12 @@
           return i;
         });
 
-        this.preOutputDetails = preOutputDetails.filter(
-          (i) => i.outputType != 1
-        );
+        this.preOutputDetails = preOutputDetails;
 
         this.sumOutputDetails = materialObject.sumOutputDetails;
 
         this.form.pickDetails = [
-          ...preOutputDetails.filter((i) => i.outputType == 1),
+          ...preOutputDetails.map((i) => i),
           ...pickDetails
         ];
 

+ 36 - 0
src/views/batchRecord/components/list.vue

@@ -40,6 +40,16 @@
         >
           {{ row.code }}
         </el-link>
+
+        <!-- <template v-slot:approvalStatus="{ row }">
+          <el-link
+            type="primary"
+            :underline="false"
+            @click="openEdit('detail', row, 'bpm')"
+          >
+            {{ approvalStatusText(row) }}
+          </el-link>
+        </template> -->
       </template>
 
       <template v-slot:action="{ row }">
@@ -328,6 +338,12 @@
             type: 'input',
             placeholder: '请输入'
           },
+          {
+            label: '生产工单号:',
+            value: 'workOrderCode',
+            type: 'input',
+            placeholder: '请输入'
+          },
           {
             label: '类型:',
             value: 'itemType',
@@ -488,6 +504,26 @@
         this.$message.success('报工成功!');
         this.butLoading = false;
         this.reload();
+      },
+      approvalStatusText(row) {
+        switch (row.approvalStatus) {
+          case 0:
+            return '未提交';
+          case 1:
+            return '审核中';
+          case 2:
+            return '审核通过';
+          case 3:
+            return '审核不通过';
+          case 4:
+            return '终止审核中';
+          case 5:
+            return '终止审核通过';
+          case 7:
+            return '流程废止';
+          default:
+            return '';
+        }
       }
     }
   };

+ 26 - 3
src/views/checklistManagement/checklist.vue

@@ -49,7 +49,12 @@
       ref="checkAddRef"
       @confirm="checkAddConfirm('add', $event)"
     ></checkAdd>
-    <checkDetails ref="checkDetailsRef" @reload="reload"></checkDetails>
+
+    <checkDetails
+      ref="checkDetailsRef"
+      @reload="reload"
+      saveClose
+    ></checkDetails>
 
     <process-submit-dialog
       :processSubmitDialogFlag.sync="processSubmitDialogFlag"
@@ -101,6 +106,16 @@
             minWidth: 110,
             showOverflowTooltip: true
           },
+          {
+            prop: 'checklistType',
+            label: '放行类型',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true,
+            formatter: (row) => {
+              return this.getDictValue('放行类型', row.checklistType + '');
+            }
+          },
           {
             prop: 'productCode',
             label: '产品编码',
@@ -132,7 +147,7 @@
             }
           },
           {
-            prop: 'code',
+            prop: 'workOrderCode',
             label: '生产工单号',
             align: 'center',
             minWidth: 110,
@@ -302,6 +317,12 @@
       // 提交审批
       openApproval(row) {
         console.log('row', row);
+
+        let businessType = this.getDictValue(
+          '放行类型',
+          row.checklistType + ''
+        );
+        console.log('businessType', businessType);
         this.processSubmitDialogFlag = true;
         this.$nextTick(async () => {
           let params = {
@@ -309,7 +330,9 @@
             businessKey: 'work_order_checklist_approval',
             formCreateUserId: row.createUserId,
             variables: {
-              businessCode: row.code
+              businessCode: row.code,
+              businessName: '放行单',
+              businessType: businessType
             }
           };
 

+ 32 - 5
src/views/checklistManagement/components/checkDetails.vue

@@ -40,6 +40,7 @@
       :model="form"
       :rules="rules"
       label-width="100px"
+      :disabled="type == 'detail'"
     >
       <header-title title="基本信息"></header-title>
 
@@ -73,7 +74,11 @@
         :datasource="form.orders"
       >
         <template v-slot:action="{ row }">
-          <el-link icon="el-icon-edit" type="primary" :underline="false"
+          <el-link
+            icon="el-icon-edit"
+            type="primary"
+            :underline="false"
+            @click="openWorkOrderDetail(row)"
             >详情</el-link
           >
           <el-link
@@ -246,13 +251,13 @@
     </el-form>
 
     <template v-slot:footer>
-      <el-button
+      <!-- <el-button
         v-if="type != 'detail'"
         type="primary"
         @click="submit"
         :loading="butLoading"
         >提 交</el-button
-      >
+      > -->
       <el-button
         v-if="type != 'detail'"
         type="primary"
@@ -262,6 +267,8 @@
       >
       <el-button @click="handleClose">取 消</el-button>
     </template>
+
+    <detailsPop ref="detailsRef"> </detailsPop>
   </ele-modal>
 </template>
 
@@ -278,10 +285,19 @@
   } from '@/api/checklistrecord/index';
   import bpmTask from '@/components/bpmTask/bpmTask.vue';
   import bpmDetail from '@/views/bpm/processInstance/detail.vue';
+  import detailsPop from '@/views/produceOrder/components/details/index.vue';
+  import { getById as getworkOrderById } from '@/api/produceOrder/index';
 
   export default {
     mixins: [dictMixins],
-    components: { selectWorkOrder, SelectUser, bpmTask, bpmDetail },
+    components: { selectWorkOrder, SelectUser, bpmTask, bpmDetail, detailsPop },
+    props: {
+      // 保存是否关闭弹窗
+      saveClose: {
+        type: Boolean,
+        default: false
+      }
+    },
     data() {
       const formBaseData = {
         id: null,
@@ -500,6 +516,7 @@
 
           this.form.templateId = data.templateId;
           this.form.templateName = data.templateName;
+          this.form.checklistType = data.checklistType;
 
           // 处理携带的生产工单
           if (data.workOrderList && data.workOrderList.length) {
@@ -545,15 +562,16 @@
                 // 存在id 则更新
                 if (this.form.id) {
                   await checklistrecordUpdate(this.form);
+                  this.$message.success('操作成功');
                 } else {
                   this.form.createUserName = this.$store.state.user.info.name;
                   const data = await checklistrecordSave(this.form);
+                  this.$message.success('操作成功');
                   this.form.id = data;
                   this.getCheckDetails(data);
                 }
               } else {
               }
-              this.$message.success('操作成功');
               this.butLoading = false;
               this.$emit('reload');
             } catch (error) {
@@ -562,6 +580,10 @@
 
             if (type != 'save') {
               this.handleClose();
+            } else {
+              if (this.saveClose) {
+                this.handleClose();
+              }
             }
           } else {
             // 转换为数组
@@ -758,6 +780,11 @@
           this.form.qualityCheckUserId = userInfo.id;
           this.form.qualityCheckUserName = userInfo.name;
         }
+      },
+      async openWorkOrderDetail(row) {
+        console.log('row', row);
+        const info = await getworkOrderById(row.workOrderId);
+        this.$refs.detailsRef.open(info);
       }
     }
   };

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

@@ -850,12 +850,6 @@
           }
         });
 
-        // 延迟刷新
-        setTimeout(() => {
-          // 点击了缓存或者投料
-          this.$emit('reload');
-        }, 800);
-
         // for (let item of this.List) {
         //   await checkRepeatFeed({
         //     currentTaskDiagram: item.currentTaskDiagram,
@@ -919,6 +913,13 @@
             this.executorIdList = [];
             this.checked = false;
             this.teamId = '';
+
+            // 延迟刷新
+            setTimeout(() => {
+              // 点击了缓存或者投料
+              this.$emit('reload');
+            }, 500);
+
             this.$emit('feedSuccess', 'success');
           })
           .catch((e) => {

+ 164 - 36
src/views/produce/components/prenatalExamination/material.vue

@@ -24,6 +24,38 @@
           @change="selectedChange(row)"
         ></el-checkbox>
       </template>
+
+      <template v-slot:feedQuantityHeader>
+        <el-tooltip
+          effect="dark"
+          content="数量是指存在多次投料时,本道工序在本次记录表报工时的累计当时投料数量;"
+          placement="top"
+        >
+          <div>
+            <span>数量</span>
+            <i
+              class="el-icon-info"
+              style="margin-left: 4px; color: #909399"
+            ></i>
+          </div>
+        </el-tooltip>
+      </template>
+
+      <template v-slot:sumConsumeQuantityHeader>
+        <el-tooltip
+          effect="dark"
+          content="累计消耗数量是指存在多次记录表报工时,本次记录表报工时的累计实时消耗数量;"
+          placement="top"
+        >
+          <div>
+            <span>累计消耗数量</span>
+            <i
+              class="el-icon-info"
+              style="margin-left: 4px; color: #909399"
+            ></i>
+          </div>
+        </el-tooltip>
+      </template>
     </ele-pro-table>
 
     <header-title title="产出清单" style="margin-top: 20px"></header-title>
@@ -80,6 +112,54 @@
           @change="$emit('update:outputDetails', localOutputDetails)"
         ></el-input>
       </template>
+
+      <template v-slot:sumReportQuantityHeader>
+        <el-tooltip
+          effect="dark"
+          content="已报工数量是指存在多次记录表报工时,多次报工数量的累计实时已报工数量;"
+          placement="top"
+        >
+          <div>
+            <span>已报工数量</span>
+            <i
+              class="el-icon-info"
+              style="margin-left: 4px; color: #909399"
+            ></i>
+          </div>
+        </el-tooltip>
+      </template>
+
+      <template v-slot:sumQualifiedQuantityHeader>
+        <el-tooltip
+          effect="dark"
+          content="合格品数量是指存在多次记录表报工时,多次报工数量的累计实时合格品数量;"
+          placement="top"
+        >
+          <div>
+            <span>合格总数</span>
+            <i
+              class="el-icon-info"
+              style="margin-left: 4px; color: #909399"
+            ></i>
+          </div>
+        </el-tooltip>
+      </template>
+
+      <template v-slot:sumNoQualifiedQuantityHeader>
+        <el-tooltip
+          effect="dark"
+          content="不合格品数量是指存在多次记录表报工时,多次报工数量的累计实时不合格品数量;"
+          placement="top"
+        >
+          <div>
+            <span>不合格总数</span>
+            <i
+              class="el-icon-info"
+              style="margin-left: 4px; color: #909399"
+            ></i>
+          </div>
+        </el-tooltip>
+      </template>
     </ele-pro-table>
 
     <materialModal ref="materialModalRef" @confirm="materialConfirm" />
@@ -249,7 +329,7 @@
     computed: {
       // 物料清单(包含上到工序产出明细)
       materialList() {
-        return [...this.preOutputDetails, ...this.localPickDetails];
+        return this.localPickDetails;
       },
       // 物料清单表头
       materialColumns() {
@@ -304,7 +384,8 @@
             minWidth: 120,
             formatter: (row) => {
               return (row.quantity || 0) + (row.unit || '');
-            }
+            },
+            headerSlot: 'feedQuantityHeader'
           },
           {
             label: '当次消耗数量',
@@ -317,10 +398,12 @@
                 const outputItem = this.localOutputDetails.find(
                   (item) => item.categoryCode === row.categoryCode
                 );
-                return (
-                  (outputItem ? outputItem.reportQuantity : 0) +
-                  (row.unit || '')
-                );
+
+                if (outputItem) {
+                  return outputItem.reportQuantity + (row.unit || '');
+                }
+
+                return 0 + (row.unit || '');
               } else {
                 // 产出为在制品 或 BOM标准产出
                 // 查询基数
@@ -352,7 +435,9 @@
                   return '0' + (row.unit || '');
                 }
                 // 当次消耗
-                let needQuantity = outputItem.reportQuantity * count;
+                let needQuantity = this.formatNumber(
+                  outputItem.reportQuantity * count
+                );
                 return needQuantity + (row.unit || '');
               }
             }
@@ -389,7 +474,9 @@
                           this.materialQuotaInfo.standardOutput.categoryCode
                       );
                       if (preItem) {
-                        preCount += preItem.sumReportQuantity * proportion;
+                        preCount += this.formatNumber(
+                          preItem.sumReportQuantity * proportion
+                        );
                       }
                     }
 
@@ -400,7 +487,9 @@
                           item.categoryCode === this.categoryInfo.categoryCode
                       );
                       if (preItem) {
-                        preCount += preItem.sumReportQuantity * proportion;
+                        preCount += this.formatNumber(
+                          preItem.sumReportQuantity * proportion
+                        );
                       }
                     }
                   }
@@ -479,7 +568,9 @@
                       this.materialQuotaInfo.standardOutput.categoryCode
                   );
                   if (preItem) {
-                    preCount += preItem.sumReportQuantity * proportion;
+                    preCount += this.formatNumber(
+                      preItem.sumReportQuantity * proportion
+                    );
                   }
                 }
                 // 在制品
@@ -492,7 +583,9 @@
                         item.categoryCode === this.categoryInfo.categoryCode
                     );
                     if (preItem) {
-                      preCount += preItem.sumReportQuantity * proportion;
+                      preCount += this.formatNumber(
+                        preItem.sumReportQuantity * proportion
+                      );
                     }
                   }
                 }
@@ -508,17 +601,19 @@
                   cumulativeOutputQuantity =
                     outputItem.sumReportQuantity + outputItem.reportQuantity;
                 }
-                const needQuantity = cumulativeOutputQuantity * proportion;
+                const needQuantity = this.formatNumber(
+                  cumulativeOutputQuantity * proportion
+                );
 
                 // 已消耗数量转换
-                // const sumReportQuantity = row.sumReportQuantity * proportion;
                 const sumReportQuantity = row.sumReportQuantity;
 
                 return (
                   needQuantity + preCount + sumReportQuantity + (row.unit || '')
                 );
               }
-            }
+            },
+            headerSlot: 'sumConsumeQuantityHeader'
           }
         ];
         if (this.outputType == 1) {
@@ -618,7 +713,8 @@
             minWidth: 120,
             formatter(row) {
               return (row.sumReportQuantity || 0) + row.unit;
-            }
+            },
+            headerSlot: 'sumReportQuantityHeader'
           },
           {
             label: '合格总数',
@@ -626,7 +722,8 @@
             minWidth: 120,
             formatter(row) {
               return (row.sumQualifiedQuantity || 0) + (row.unit || '');
-            }
+            },
+            headerSlot: 'sumQualifiedQuantityHeader'
           },
           {
             label: '不合格总数',
@@ -634,7 +731,8 @@
             minWidth: 120,
             formatter(row) {
               return (row.sumNoQualifiedQuantity || 0) + (row.unit || '');
-            }
+            },
+            headerSlot: 'sumNoQualifiedQuantityHeader'
           }
         ]
       };
@@ -648,7 +746,6 @@
             ruleId: this.ruleId,
             produceTaskId: this.produceTaskId
           },
-          // ...this.localPickDetails, ...this.preOutputDetails
           []
         );
       },
@@ -885,10 +982,20 @@
       reportQuantitymax(row) {
         if (this.outputType == 1) {
           // 查询物料本身
-          const pickItem = this.localPickDetails.find(
+          let pickItem = this.localPickDetails.find(
             (item) => item.categoryCode === row.categoryCode
           );
 
+          if (!pickItem) {
+            // 查询上到工序产出明细
+            pickItem = this.preOutputDetails.find(
+              (item) => item.categoryCode === row.categoryCode
+            );
+          }
+
+          // 未找到物料,则不限制
+          if (!pickItem) return Infinity;
+
           // 查询其他工单sumOutputDetails中已产生的bom标准产出和在制品的累计消耗数量
           let preCount = 0;
           if (this.materialQuotaInfo) {
@@ -909,7 +1016,9 @@
                     this.materialQuotaInfo.standardOutput.categoryCode
                 );
                 if (preItem) {
-                  preCount += preItem.sumReportQuantity * proportion;
+                  preCount += this.formatNumber(
+                    preItem.sumReportQuantity * proportion
+                  );
                 }
               }
 
@@ -919,15 +1028,14 @@
                   (item) => item.categoryCode === this.categoryInfo.categoryCode
                 );
                 if (preItem) {
-                  preCount += preItem.sumReportQuantity * proportion;
+                  preCount += this.formatNumber(
+                    preItem.sumReportQuantity * proportion
+                  );
                 }
               }
             }
           }
 
-          // 未找到物料,则返回剩余数量
-          if (!pickItem) return pickItem.quantity - preCount;
-
           // 已执行,处理重新一键报工时,sumReportQuantity包含了当前报工数量
           if (this.executeStatus == 2) {
             const count =
@@ -951,6 +1059,7 @@
             (item) => item.categoryCode === row.categoryCode
           );
 
+          // debugger;
           // 存在则当前row为在制品或BOM标准产出
           if (preOutputItem) {
             // 区分已执行状态
@@ -975,9 +1084,17 @@
 
           // 计算每个物料的最大可报工数量
           const maxQuantities = quota.map((item) => {
-            const pickItem = this.localPickDetails.find(
+            let pickItem = this.localPickDetails.find(
               (p) => p.categoryCode === item.categoryCode
             );
+
+            // 从上一道工序产出物中找
+            if (!pickItem) {
+              pickItem = this.preOutputDetails.find(
+                (p) => p.categoryCode === item.categoryCode
+              );
+            }
+
             if (!pickItem) {
               return Infinity;
             }
@@ -1001,8 +1118,9 @@
                   this.materialQuotaInfo.standardOutput.categoryCode
               );
               if (preStd) {
-                preOutputConsumedProportion +=
-                  preStd.sumReportQuantity * proportion;
+                preOutputConsumedProportion += this.formatNumber(
+                  preStd.sumReportQuantity * proportion
+                );
               }
             }
 
@@ -1015,8 +1133,9 @@
                 (s) => s.categoryCode === this.categoryInfo.categoryCode
               );
               if (preWip) {
-                preOutputConsumedProportion +=
-                  preWip.sumReportQuantity * proportion;
+                preOutputConsumedProportion += this.formatNumber(
+                  preWip.sumReportQuantity * proportion
+                );
               }
             }
 
@@ -1026,7 +1145,9 @@
               : row.sumReportQuantity;
 
             // 已执行的比例换算,换算为需要多少物料数量
-            const consumedProportion = consumedQuantity * proportion;
+            const consumedProportion = this.formatNumber(
+              consumedQuantity * proportion
+            );
 
             // 最大可报工数量
             let maxQuantity =
@@ -1070,15 +1191,17 @@
           }
 
           for (const item of this.localOutputDetails) {
-            const pickitem = this.localPickDetails.find(
-              (pick) => pick.categoryCode == item.categoryCode
-            );
-
-            const prePickitem = this.preOutputDetails.find(
+            let pickitem = this.localPickDetails.find(
               (pick) => pick.categoryCode == item.categoryCode
             );
+            // 从上一道工序产出物中找
+            if (!pickitem) {
+              pickitem = this.preOutputDetails.find(
+                (pick) => pick.categoryCode == item.categoryCode
+              );
+            }
 
-            if (pickitem == null && prePickitem == null) {
+            if (!pickitem) {
               this.$message.warning(
                 `所需物料【${item.categoryName}】未在物料清单中找到`
               );
@@ -1122,6 +1245,11 @@
         } else {
           this.setMaterialQuotaInfo();
         }
+      },
+      // 处理数字精度问题,不使用toFixed,避免4舍5入
+      formatNumber(value, decimalPlaces = 4) {
+        const factor = Math.pow(10, decimalPlaces);
+        return Math.floor(value * factor) / factor;
       }
     }
   };

+ 3 - 5
src/views/produce/components/prenatalExamination/releaseRulesDialog.vue

@@ -892,7 +892,7 @@
           i.reportQuantityCopy = i.reportQuantity;
 
           const sumItem = materialObject.sumOutputDetails.find(
-            (item) => i.categoryCode === item.categoryCode
+            (item) => item.categoryCode === i.categoryCode
           );
 
           if (sumItem) {
@@ -966,14 +966,12 @@
           return i;
         });
 
-        this.preOutputDetails = preOutputDetails.filter(
-          (i) => i.outputType != 1
-        );
+        this.preOutputDetails = preOutputDetails;
 
         this.sumOutputDetails = materialObject.sumOutputDetails;
 
         this.addForm.pickDetails = [
-          ...preOutputDetails.filter((i) => i.outputType == 1),
+          ...preOutputDetails.map((i) => i),
           ...pickDetails
         ];
 

+ 1 - 0
src/views/produceOrder/components/details/index.vue

@@ -6,6 +6,7 @@
       :custom-class="isFullscreen ? 'not-fullscreen' : 'is-fullscreen'"
       :before-close="handleClose"
       :with-header="false"
+      append-to-body
     >
       <!-- 自定义头部 -->
       <div class="custom-drawer-header">

+ 2 - 2
vue.config.js

@@ -36,8 +36,8 @@ module.exports = {
         // target: 'http://192.168.1.125:18086',
         // 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.125: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',