Przeglądaj źródła

Merge branch 'master' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-wt into dengfei

695593266@qq.com 9 miesięcy temu
rodzic
commit
7e99132ded

+ 266 - 209
src/BIZComponents/inventoryTableDetails.vue

@@ -154,12 +154,16 @@
       isProductionRequirements: {
         type: Boolean,
         default: false
+      },
+      quoteType: {
+        type: Number,
+        default: 1
       }
     },
     data() {
       return {
         allPrice: 0,
-
+        supplierObj: [],
         form: {
           discountTotalPrice: 0,
           datasource: []
@@ -168,28 +172,23 @@
     },
     computed: {
       columns() {
-        let orderColumn = {
-          width: 1,
-          show: false
-        };
-        if (this.isOrderNo) {
-          orderColumn = {
-            minWidth: 200,
-            prop: 'orderNo',
-            label: '订单编码',
-            showOverflowTooltip: true,
-            align: 'center'
-          };
-        }
-        return [
+        // 基础列(新增字段之前的列)
+        const baseColumns = [
           {
             width: 45,
             type: 'index',
             columnKey: 'index',
             align: 'center'
           },
-          orderColumn,
 
+          {
+            minWidth: 200,
+            prop: 'orderNo',
+            label: '订单编码',
+            showOverflowTooltip: true,
+            align: 'center',
+            isNone: !this.isOrderNo
+          },
           {
             width: 280,
             prop: 'productName',
@@ -218,74 +217,170 @@
             label: '规格',
             slot: 'specification',
             align: 'center'
-          },
-          this.contractBookType == 1
-            ? {
-                width: 200,
-                prop: 'customerMark',
-                label: '客户代号',
-                slot: 'customerMark',
-                headerSlot: 'headerCustomerMark',
-                align: 'center'
-              }
-            : {
-                width: 1
-              },
-          this.contractBookType == 2
-            ? {
-                width: 200,
-                prop: 'customerMark',
-                label: '供应商代号',
-                slot: 'customerMark',
-                headerSlot: 'headerSupplierMark',
-                align: 'center'
-              }
-            : {
-                width: 1
-              },
-          this.isCustomerMark
-            ? {
-                minWidth: 120,
-                prop: 'entrustedEnterpriseId',
-                label: '受托企业',
-                slot: 'entrustedEnterpriseId',
-                show: this.isCustomerMark,
-                align: 'center',
-                showOverflowTooltip: true,
-                formatter: (row, column) => {
-                  return (
-                    (this.supplierObj &&
-                      this.supplierObj[row.productId]?.find(
-                        (item) => item.id === row.entrustedEnterpriseId
-                      )?.name) ||
-                    ''
-                  );
+          }
+        ];
+        // 条件显示的新增字段列(仅当quoteType为2时显示)
+        const additionalColumns =
+          this.quoteType === 2
+            ? [
+                // 新增字段:厚度
+                {
+                  width: 150,
+                  prop: 'thickNess',
+                  label: '厚度',
+                  slot: 'thickNess',
+                  formatter: (row, column) => {
+                    if (row.thickNess) {
+                      return row.thickNess + ' mm';
+                    }
+                  },
+                  align: 'center'
+                },
+                // 新增字段:平方数
+                {
+                  width: 150,
+                  prop: 'squareNumber',
+                  label: '平方数',
+                  formatter: (row, column) => {
+                    if (row.squareNumber) {
+                      return row.squareNumber + ' m²';
+                    }
+                  },
+                  align: 'center'
+                },
+                // 新增字段:加工费(未税)
+                {
+                  width: 150,
+                  prop: 'processingFeeBeforeTax',
+                  label: '加工费(未税)',
+                  formatter: (row, column) => {
+                    if (row.processingFeeBeforeTax) {
+                      return row.processingFeeBeforeTax + ' 元';
+                    }
+                  },
+                  align: 'center'
+                },
+                // 新增字段:包装费(未税)
+                {
+                  width: 150,
+                  prop: 'packagingFeeNotTaxed',
+                  label: '包装费(未税)',
+                  formatter: (row, column) => {
+                    if (row.packagingFeeNotTaxed) {
+                      return row.packagingFeeNotTaxed + ' 元';
+                    }
+                  },
+                  align: 'center'
+                },
+                // 新增字段:运输费(未税)
+                {
+                  width: 150,
+                  prop: 'transportationFeeWithoutTax',
+                  label: '运输费(未税)',
+                  formatter: (row, column) => {
+                    if (row.transportationFeeWithoutTax) {
+                      return row.transportationFeeWithoutTax + ' 元';
+                    }
+                  },
+                  align: 'center'
+                },
+                // 新增字段:未税小计
+                {
+                  width: 150,
+                  prop: 'quotationSubtotalBeforeTax',
+                  label: '未税小计',
+                  align: 'center',
+                  formatter: (row, column) => {
+                    if (row.quotationSubtotalBeforeTax) {
+                      return row.quotationSubtotalBeforeTax + ' 元';
+                    }
+                  }
+                },
+                // 新增字段:税率(%)
+                {
+                  width: 150,
+                  prop: 'extraTax',
+                  label: '税率(%)',
+                  align: 'center',
+                  formatter: (row, column) => {
+                    return row.extraTax;
+                  }
+                },
+                // 新增字段:含税小计
+                {
+                  width: 150,
+                  prop: 'quotationSubtotalTax',
+                  label: '含税小计',
+                  align: 'center',
+                  formatter: (row, column) => {
+                    if (row.quotationSubtotalTax) {
+                      return row.quotationSubtotalTax + ' 元';
+                    }
+                  }
                 }
-              }
-            : {
-                width: 1
-              },
+              ]
+            : [];
+        const remainingColumns = [
           {
-            width: 150,
+            width: 200,
+            prop: 'customerMark',
+            label: this.contractBookType == 1 ? '客户代号' : '供应商代号',
+            slot: 'customerMark',
+            headerSlot: 'headerCustomerMark',
+            isNone: this.quoteType === 2,
+            align: 'center'
+          },
+          {
+            minWidth: 240,
+            prop: 'taskName',
+            label: '工序',
+            slot: 'taskName',
+            align: 'center'
+          },
+          {
+            minWidth: 160,
+            prop: 'productionCodes',
+            label: '生产编号',
+            isNone: this.quoteType === 2,
+            align: 'center'
+          },
+          {
+            minWidth: 280,
+            prop: 'productionRequirements',
+            label: '生产要求',
+            align: 'center',
+            isNone: !this.isProductionRequirements
+          },
+          {
+            minWidth: 120,
+            prop: 'entrustedEnterpriseId',
+            label: '受托企业',
+            slot: 'entrustedEnterpriseId',
+            isNone: !this.isCustomerMark,
+            align: 'center',
+            showOverflowTooltip: true,
+            formatter: (row, column) => {
+              return (
+                this.supplierObj[row.productId]?.find(
+                  (item) => item.id === row.entrustedEnterpriseId
+                )?.name || ''
+              );
+            }
+          },
+          {
+            width: 180,
             prop: 'saleCount',
             label: '数量',
             slot: 'saleCount',
             headerSlot: 'headerTotalCount',
             align: 'center'
           },
-          // {
-          //   width: 150,
-          //   prop: 'saleUnit',
-          //   label: '单位',
-          //   slot: 'saleUnit',
-          //   headerSlot: 'headerTotalCount',
-          //   align: 'center'
-          // },
           {
             width: 120,
             prop: 'packingSpecification',
             align: 'center',
             label: '包装规格',
+            isNone: this.quoteType === 2,
             showOverflowTooltip: true
           },
           {
@@ -293,68 +388,31 @@
             prop: 'totalCount',
             label: '计量数量',
             slot: 'totalCount',
+            isNone: this.quoteType === 2,
+            headerSlot: 'headerTotalCount',
             formatter: (row, column) => {
               if (row.totalCount) {
                 return row.totalCount + ' ' + row.measuringUnit;
               }
             },
-            headerSlot: 'headerTotalCount',
             align: 'center'
           },
-          // {
-          //   width: 120,
-          //   prop: 'measuringUnit',
-          //   label: '计量单位',
-          //   slot: 'measuringUnit',
-          //   align: 'center'
-          // },
-          this.pageName == 'send'
-            ? {
-                minWidth: 110,
-                prop: 'sendTotalCount',
-                label: '已发货数量',
-                slot: 'sendTotalCount',
-                formatter: (row, column) => {
-                  if (row.sendTotalCount) {
-                    return row.sendTotalCount + ' ' + row.measuringUnit;
-                  }
-                },
-                align: 'center'
-              }
-            : {
-                width: 1
-              },
-          this.pageName == 'send'
-            ? {
-                minWidth: 110,
-                prop: 'notSendTotalCount',
-                label: '未发货数量',
-                slot: 'notSendTotalCount',
-                formatter: (row, column) => {
-                  if (row.notSendTotalCount) {
-                    return row.notSendTotalCount + ' ' + row.measuringUnit;
-                  }
-                },
-                align: 'center'
-              }
-            : {
-                width: 1
-              },
+
           {
-            width: 120,
+            width: 140,
             prop: 'singleWeight',
             label: '单重',
             slot: 'singleWeight',
+            headerSlot: 'headerSingleWeight',
             formatter: (row, column) => {
               if (row.singleWeight) {
                 return row.singleWeight + ' ' + row.weightUnit;
               }
             },
-            headerSlot: 'headerSingleWeight',
             align: 'center'
           },
           {
-            width: 120,
+            width: 140,
             prop: 'totalWeight',
             label: '总重',
             slot: 'totalWeight',
@@ -365,31 +423,12 @@
             },
             align: 'center'
           },
-          // {
-          //   width: 120,
-          //   prop: 'weightUnit',
-          //   label: '重量单位',
-          //   slot: 'weightUnit',
-          //   align: 'center'
-          // },
-          // {
-          //   width: 160,
-          //   prop: 'pricingWay',
-          //   label: '计价方式',
-          //   slot: 'pricingWay',
-          //   align: 'center',
-          //   formatter: (row, column) => {
-          //     return row.pricingWay == 1
-          //       ? '按数量计费'
-          //       : row.pricingWay == 2
-          //       ? '按重量计费'
-          //       : '';
-          //   }
-          // },
+
           {
             width: 160,
             prop: 'goodsPriceType',
             label: '价格类型',
+            isNone: this.quoteType === 2,
             formatter: (row, column) => {
               return this.getDictValue('商品价格类型', row.goodsPriceType);
             },
@@ -400,40 +439,41 @@
             prop: 'singlePrice',
             label: '单价',
             slot: 'singlePrice',
+            isNone: this.quoteType === 2,
             headerSlot: 'headerSinglePrice',
             align: 'center'
           },
+
           {
             width: 160,
             prop: 'taxRate',
             label: '税率',
+            isNone: this.quoteType === 2,
             formatter: (_row, _column, cellValue) => {
               return _row.taxRate ? _row.taxRate + '%' : '';
             },
             align: 'center'
           },
           {
-            width: 160,
+            width: 150,
             prop: 'notaxSinglePrice',
             label: '不含税单价',
+            isNone: this.quoteType === 2,
+            slot: 'notaxSinglePrice',
             align: 'center'
           },
-          this.isDiscount
-            ? {
-                width: 160,
-                prop: 'discountSinglePrice',
-                label: '折让单价',
-                align: 'center',
-
-                formatter: (_row, _column, cellValue) => {
-                  return _row.discountSinglePrice
-                    ? Number(_row.discountSinglePrice).toFixed(2)
-                    : '';
-                }
-              }
-            : {
-                width: 1
-              },
+          {
+            width: 160,
+            prop: 'discountSinglePrice',
+            label: '折让单价',
+            align: 'center',
+            isNone: !this.isDiscount,
+            formatter: (_row, _column, cellValue) => {
+              return _row.discountSinglePrice
+                ? Number(_row.discountSinglePrice).toFixed(2)
+                : '';
+            }
+          },
           {
             width: 120,
             prop: 'totalPrice',
@@ -441,25 +481,23 @@
             slot: 'totalPrice',
             align: 'center'
           },
-          this.isDiscount
-            ? {
-                width: 160,
-                prop: 'discountTotalPrice',
-                label: '折让合计',
-                align: 'center',
-                formatter: (_row, _column, cellValue) => {
-                  return _row.discountTotalPrice
-                    ? Number(_row.discountTotalPrice).toFixed(2)
-                    : '';
-                }
-              }
-            : {
-                width: 1
-              },
+          {
+            width: 160,
+            prop: 'discountTotalPrice',
+            label: '折让合计',
+            align: 'center',
+            isNone: !this.isDiscount,
+            formatter: (_row, _column, cellValue) => {
+              return _row.discountTotalPrice
+                ? Number(_row.discountTotalPrice).toFixed(2)
+                : '';
+            }
+          },
           {
             minWidth: 120,
             prop: 'goodsLevel',
             label: '物品级别',
+            isNone: this.quoteType === 2,
             formatter: (_row, _column, cellValue) => {
               return levelList.find((item) => item.value == _row.goodsLevel)
                 ?.label;
@@ -471,6 +509,7 @@
             prop: 'batchNo',
             label: '批次号',
             slot: 'batchNo',
+            isNone: this.quoteType === 2,
             align: 'center'
           },
           {
@@ -478,6 +517,7 @@
             prop: 'productBrand',
             label: '牌号',
             slot: 'productBrand',
+            isNone: this.quoteType === 2,
             align: 'center'
           },
           {
@@ -485,34 +525,41 @@
             prop: 'modelType',
             label: '型号',
             slot: 'modelType',
+            isNone: this.quoteType === 2,
             align: 'center'
           },
-          {
-            width: 120,
-            prop: 'imgCode',
-            align: 'center',
-            label: '图号/件号',
-            showOverflowTooltip: true
-          },
           {
             minWidth: 120,
             prop: 'modelKey',
             label: '机型',
+            slot: 'modelKey',
+            isNone: this.quoteType === 2,
             showOverflowTooltip: true,
             align: 'center'
           },
           {
             minWidth: 120,
             prop: 'colorKey',
+            slot: 'colorKey',
             showOverflowTooltip: true,
             label: '颜色',
+            isNone: this.quoteType === 2,
             align: 'center'
           },
+          {
+            width: 120,
+            prop: 'imgCode',
+            align: 'center',
+            label: '图号/件号',
+            isNone: this.quoteType === 2,
+            showOverflowTooltip: true
+          },
           {
             prop: 'provenance',
             label: '产地',
             slot: 'provenance',
             align: 'center',
+            isNone: this.quoteType === 2,
             minWidth: 200,
             showOverflowTooltip: true,
             formatter: (row, column) => {
@@ -528,6 +575,7 @@
             prop: 'produceType',
             align: 'center',
             label: '属性类型',
+            isNone: this.quoteType === 2,
             showOverflowTooltip: true,
             formatter: (row, column) => {
               if (row.produceType) {
@@ -539,56 +587,25 @@
               }
             }
           },
-          {
-            minWidth: 160,
-            prop: 'productionCodes',
-            label: '生产编号',
-            align: 'center'
-          },
-          this.isProductionRequirements
-            ? {
-                minWidth: 280,
-                prop: 'productionRequirements',
-                label: '生产要求',
-                align: 'center'
-              }
-            : {
-                width: 1
-              },
-          {
-            minWidth: 240,
-            prop: 'taskName',
-            label: '工序',
-            slot: 'taskName',
-            align: 'center'
-          },
-          {
-            width: 120,
-            prop: 'packingSpecification',
-            align: 'center',
-            label: '包装规格',
-            showOverflowTooltip: true
-          },
           {
             width: 160,
             prop: 'arrivalWay',
             label: '到货方式',
             align: 'center',
+            isNone: !this.isArrivalWay || this.quoteType === 2,
             formatter: (_row, _column, cellValue) => {
               return _row.arrivalWay == 1
                 ? '一次性到货'
                 : _row.arrivalWay == 2
                 ? '分批到货'
                 : '';
-            },
-            show: this.isArrivalWay
+            }
           },
           {
             width: 160,
             prop: 'customerExpectDeliveryDeadline',
             label: this.contractBookType == 1 ? '客户期望交期' : '交付日期',
             slot: 'customerExpectDeliveryDeadline',
-
             align: 'center'
           },
           {
@@ -596,16 +613,17 @@
             prop: 'produceDeliveryDeadline',
             label: '生产交付交期',
             slot: 'produceDeliveryDeadline',
+            isNone: this.contractBookType != 1,
             headerSlot: 'headerProduceDeliveryDeadline',
-            show: this.contractBookType == 1,
             align: 'center'
           },
+
           {
             width: 200,
             prop: 'guaranteePeriod',
             label: '有效期',
+            isNone: this.quoteType === 2,
             slot: 'guaranteePeriod',
-
             align: 'center',
             formatter: (_row, _column, cellValue) => {
               return (
@@ -620,17 +638,39 @@
             slot: 'guaranteePeriodDeadline',
             align: 'center'
           },
+
           {
             width: 220,
             prop: 'customerReqFiles',
             label: '客户需求',
             slot: 'customerReqFiles',
+            isNone: this.quoteType === 2,
             align: 'center'
           },
+          // {
+          //   width: 100,
+          //   prop: 'density',
+          //   label: '密度',
+          //   align: 'center'
+          // },
+          {
+            width: 150,
+            prop: 'productType',
+            label: '生产加工方式',
+            align: 'center',
+            formatter: (_row, _column, cellValue) => {
+              return _row.productType == 2
+                ? '加工'
+                : _row.productType == 3
+                ? '装配'
+                : '';
+            }
+          },
           {
             width: 130,
             prop: 'technicalAnswerName',
             label: '技术答疑人',
+            isNone: this.quoteType === 2,
             slot: 'technicalAnswerName',
             align: 'center'
           },
@@ -638,6 +678,7 @@
             width: 220,
             prop: 'technicalParams',
             label: '技术参数',
+            isNone: this.quoteType === 2,
             slot: 'technicalParams',
             align: 'center'
           },
@@ -648,10 +689,18 @@
             slot: 'technicalDrawings',
             align: 'center'
           },
+          {
+            width: 120,
+            prop: 'drawingVersion',
+            isNone: this.quoteType === 2,
+            label: '图纸版本',
+            align: 'center'
+          },
           {
             width: 240,
             prop: 'technologyRouteName',
             label: '工艺路线',
+            isNone: this.quoteType === 2,
             slot: 'technologyRouteName',
             align: 'center'
           },
@@ -659,6 +708,7 @@
             width: 240,
             prop: 'industryArtFiles',
             label: '工艺附件',
+            isNone: this.quoteType === 2,
             slot: 'industryArtFiles',
             align: 'center'
           },
@@ -667,6 +717,7 @@
             prop: 'otherFiles',
             label: '其他附件',
             slot: 'otherFiles',
+            isNone: this.quoteType === 2,
             align: 'center'
           },
           {
@@ -677,6 +728,12 @@
             align: 'center'
           }
         ];
+        // 合并所有列
+        return [
+          ...baseColumns,
+          ...additionalColumns,
+          ...remainingColumns
+        ].filter((item) => !item.isNone);
       }
     },
 

+ 4 - 2
src/views/bpm/handleTask/components/adjustNote/detailDialog.vue

@@ -169,6 +169,7 @@
   import { relationTypeList } from '@/enum/dict.js';
   import inventoryTable from './inventoryTable.vue';
   import inventoryTableDetails from '@/BIZComponents/inventoryTableDetails.vue';
+  import { reduce } from 'lodash';
 
   const defForm = {
     name: '',
@@ -207,10 +208,11 @@
       async getInfo(id) {
         let data = await getPunchSlipOrderInfo(id);
         if (data) {
+          // console.log('data~~~~', reduce(data.originalList, (total, item) => total + item.amount, 0));
           const tempdata = {
             // ...data,
-            totalPrice: data.amount,
-            discountTotalPrice: data.discountAmount,
+            totalPrice: reduce(data.originalList, (total, item) => total + item.totalPrice, 0),
+            discountTotalPrice: reduce(data.originalList, (total, item) => total + item.discountTotalPrice, 0),
             productList: data.originalList
           }
           this.businessId = data.id;

+ 2 - 4
src/views/bpm/handleTask/components/mesBatchRecordManage/detailDialog.vue

@@ -1297,14 +1297,12 @@
           return i;
         });
 
-        this.preOutputDetails = preOutputDetails.filter(
-          (i) => i.outputType != 1
-        );
+        this.preOutputDetails = preOutputDetails;
 
         this.sumOutputDetails = materialObject.sumOutputDetails;
 
         this.details.pickDetails = [
-          ...preOutputDetails.filter((i) => i.outputType == 1),
+          ...preOutputDetails.map((i) => i),
           ...pickDetails
         ];
 

+ 211 - 81
src/views/bpm/handleTask/components/mesBatchRecordManage/material.vue

@@ -20,6 +20,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>
@@ -36,6 +68,7 @@
     >
       <template v-slot:reportQuantity="{ row }">
         <div>
+          <!-- {{ reportQuantitymax(row) }} -->
           <el-input-number
             size="small"
             v-model.number="row.reportQuantity"
@@ -75,6 +108,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>
   </div>
 </template>
@@ -86,7 +167,6 @@
   } from '@/api/producetaskrecordrulesrecord/index';
 
   export default {
-    components: {},
     props: {
       // 物料明细
       pickDetails: {
@@ -239,7 +319,7 @@
     computed: {
       // 物料清单(包含上到工序产出明细)
       materialList() {
-        return [...this.preOutputDetails, ...this.localPickDetails];
+        return this.localPickDetails;
       },
       // 物料清单表头
       materialColumns() {
@@ -294,7 +374,8 @@
             minWidth: 120,
             formatter: (row) => {
               return (row.quantity || 0) + (row.unit || '');
-            }
+            },
+            headerSlot: 'feedQuantityHeader'
           },
           {
             label: '当次消耗数量',
@@ -307,10 +388,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标准产出
                 // 查询基数
@@ -342,7 +425,9 @@
                   return '0' + (row.unit || '');
                 }
                 // 当次消耗
-                let needQuantity = outputItem.reportQuantity * count;
+                let needQuantity = this.formatNumber(
+                  outputItem.reportQuantity * count
+                );
                 return needQuantity + (row.unit || '');
               }
             }
@@ -365,38 +450,41 @@
                       (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 += this.formatNumber(
+                          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 += this.formatNumber(
+                          preItem.sumReportQuantity * proportion
+                        );
+                      }
                     }
                   }
                 }
-
+                // debugger;
                 let count = 0;
                 if (outputItem) {
                   if (this.executeStatus === 2) {
@@ -470,7 +558,9 @@
                       this.materialQuotaInfo.standardOutput.categoryCode
                   );
                   if (preItem) {
-                    preCount += preItem.sumReportQuantity * proportion;
+                    preCount += this.formatNumber(
+                      preItem.sumReportQuantity * proportion
+                    );
                   }
                 }
                 // 在制品
@@ -483,7 +573,9 @@
                         item.categoryCode === this.categoryInfo.categoryCode
                     );
                     if (preItem) {
-                      preCount += preItem.sumReportQuantity * proportion;
+                      preCount += this.formatNumber(
+                        preItem.sumReportQuantity * proportion
+                      );
                     }
                   }
                 }
@@ -499,17 +591,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) {
@@ -609,7 +703,8 @@
             minWidth: 120,
             formatter(row) {
               return (row.sumReportQuantity || 0) + row.unit;
-            }
+            },
+            headerSlot: 'sumReportQuantityHeader'
           },
           {
             label: '合格总数',
@@ -617,7 +712,8 @@
             minWidth: 120,
             formatter(row) {
               return (row.sumQualifiedQuantity || 0) + (row.unit || '');
-            }
+            },
+            headerSlot: 'sumQualifiedQuantityHeader'
           },
           {
             label: '不合格总数',
@@ -625,24 +721,13 @@
             minWidth: 120,
             formatter(row) {
               return (row.sumNoQualifiedQuantity || 0) + (row.unit || '');
-            }
+            },
+            headerSlot: 'sumNoQualifiedQuantityHeader'
           }
         ]
       };
     },
     methods: {
-      // 选择物料
-      openMaterialModal() {
-        this.$refs.materialModalRef.open(
-          {
-            workOrderId: this.workOrderId,
-            ruleId: this.ruleId,
-            produceTaskId: this.produceTaskId
-          },
-          // ...this.localPickDetails, ...this.preOutputDetails
-          []
-        );
-      },
       materialConfirm(data) {
         // 选择物料后添加
         console.log('data', data);
@@ -685,7 +770,7 @@
             });
           }
         });
-
+        console.log('this.localPickDetails', this.localPickDetails);
         this.$emit('update:pickDetails', this.localPickDetails);
       },
       // bom标准产出赋值
@@ -744,9 +829,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);
         }
@@ -812,7 +905,7 @@
             (item) => !(item.categoryId === row.categoryId)
           );
         }
-
+        console.log('this.localOutputDetails', this.localOutputDetails);
         this.$emit('update:outputDetails', this.localOutputDetails);
       },
       // getCategoryAndLevelByCategoryId 获取产品 在制品信息
@@ -868,10 +961,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) {
@@ -892,7 +995,9 @@
                     this.materialQuotaInfo.standardOutput.categoryCode
                 );
                 if (preItem) {
-                  preCount += preItem.sumReportQuantity * proportion;
+                  preCount += this.formatNumber(
+                    preItem.sumReportQuantity * proportion
+                  );
                 }
               }
 
@@ -902,22 +1007,27 @@
                   (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) {
-            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;
           }
@@ -928,6 +1038,7 @@
             (item) => item.categoryCode === row.categoryCode
           );
 
+          // debugger;
           // 存在则当前row为在制品或BOM标准产出
           if (preOutputItem) {
             // 区分已执行状态
@@ -952,9 +1063,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;
             }
@@ -978,8 +1097,9 @@
                   this.materialQuotaInfo.standardOutput.categoryCode
               );
               if (preStd) {
-                preOutputConsumedProportion +=
-                  preStd.sumReportQuantity * proportion;
+                preOutputConsumedProportion += this.formatNumber(
+                  preStd.sumReportQuantity * proportion
+                );
               }
             }
 
@@ -992,8 +1112,9 @@
                 (s) => s.categoryCode === this.categoryInfo.categoryCode
               );
               if (preWip) {
-                preOutputConsumedProportion +=
-                  preWip.sumReportQuantity * proportion;
+                preOutputConsumedProportion += this.formatNumber(
+                  preWip.sumReportQuantity * proportion
+                );
               }
             }
 
@@ -1003,7 +1124,9 @@
               : row.sumReportQuantity;
 
             // 已执行的比例换算,换算为需要多少物料数量
-            const consumedProportion = consumedQuantity * proportion;
+            const consumedProportion = this.formatNumber(
+              consumedQuantity * proportion
+            );
 
             // 最大可报工数量
             let maxQuantity =
@@ -1047,15 +1170,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}】未在物料清单中找到`
               );
@@ -1099,6 +1224,11 @@
         } else {
           this.setMaterialQuotaInfo();
         }
+      },
+      // 处理数字精度问题,不使用toFixed,避免4舍5入
+      formatNumber(value, decimalPlaces = 4) {
+        const factor = Math.pow(10, decimalPlaces);
+        return Math.floor(value * factor) / factor;
       }
     }
   };

+ 9 - 8
src/views/bpm/handleTask/components/mesWorkOrderChecklist/detailDialog.vue

@@ -34,11 +34,11 @@
         :columns="ordersColumns"
         :datasource="form.orders"
       >
-        <template v-slot:action="{ row }">
+        <!-- <template v-slot:action="{ row }">
           <el-link icon="el-icon-edit" type="primary" :underline="false"
             >详情</el-link
           >
-        </template>
+        </template> -->
       </ele-pro-table>
 
       <header-title title="生产放行规则"> </header-title>
@@ -332,13 +332,14 @@
             align: 'center',
             minWidth: 110,
             showOverflowTooltip: true
-          },
-          {
-            label: '操作',
-            columnKey: 'action',
-            slot: 'action',
-            minWidth: 120
           }
+          // ,
+          // {
+          //   label: '操作',
+          //   columnKey: 'action',
+          //   slot: 'action',
+          //   minWidth: 120
+          // }
         ];
       },
       // 生产放行规则

+ 1 - 1
src/views/bpm/handleTask/components/selectedCollectionOutbound/boxTabPage.vue

@@ -61,7 +61,7 @@
           {
             label: '出库',
             name: this.isView ? 'tab3' : 'tab2',
-            isShow: true
+            isShow: this.isView || this.taskDefinitionKey == 'storeman'
           }
         ];
         return list.filter((item) => item.isShow);