Explorar o código

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-mes into dengfei

695593266@qq.com hai 7 meses
pai
achega
1c2c765c35

+ 22 - 0
src/api/producetaskrecordrulesrecord/index.js

@@ -54,3 +54,25 @@ export async function queryListByWorkOrderId(body) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+// /main/categoryparam/getMaterialQuotaInfo/{bomCategoryId}/{produceTaskId}
+export async function getMaterialQuotaInfo(bomCategoryId, produceTaskId) {
+  const res = await request.get(
+    `/main/categoryparam/getMaterialQuotaInfo/${bomCategoryId}/${produceTaskId}`
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// /main/category/getCategoryAndLevelByCategoryId/{categoryId}
+export async function getCategoryAndLevelByCategoryId(categoryId) {
+  const res = await request.get(
+    `/main/category/getCategoryAndLevelByCategoryId/${categoryId}`
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 11 - 0
src/api/producetaskrulerecord/index.js

@@ -102,3 +102,14 @@ export async function queryAllProduceTaskInstanceInPickOrder(workOrderId) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+// 分页查询 /main/producetaskconfig/page 配置的记录规则
+export async function produceTaskRecordRules(data) {
+  const res = await request.post(`/main/producetaskconfig/page`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+

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

@@ -59,7 +59,7 @@
             </el-form-item>
           </el-col>
           <el-col :span="8">
-            <el-form-item label="执行方式" required prop="executeMethod">
+            <el-form-item label="配置执行方式" required prop="executeMethod">
               <DictSelection
                 dictName="记录规则执行方式"
                 v-model="form.executeMethod"

+ 501 - 0
src/views/produce/components/prenatalExamination/material.vue

@@ -0,0 +1,501 @@
+<template>
+  <div>
+    <header-title title="物料清单"></header-title>
+
+    <ele-pro-table
+      ref="table"
+      row-key="id"
+      :columns="materialColumns"
+      :datasource="materialList"
+      cache-key="prenatal-examination-material-list-table-2511031522"
+      autoAmendPage
+      :needPage="false"
+      @refresh="$emit('refresh', 'material')"
+    >
+      <template v-slot:toolbar>
+        <el-button type="primary" @click="openMaterialModal"
+          >添加物料</el-button
+        >
+      </template>
+
+      <template v-slot:selectColumn="{ row }">
+        <el-checkbox
+          v-model="row.selected"
+          @change="selectedChange(row)"
+        ></el-checkbox>
+      </template>
+    </ele-pro-table>
+
+    <header-title title="产出清单" style="margin-top: 20px"></header-title>
+
+    <ele-pro-table
+      ref="table"
+      row-key="id"
+      :columns="outputDetailsColumns"
+      :datasource="localOutputDetails"
+      cache-key="prenatal-examination-output-list-table-2511031523"
+      autoAmendPage
+      :needPage="false"
+      @refresh="$emit('refresh', 'output')"
+    >
+      <template v-slot:reportQuantity="{ row }">
+        <el-input-number
+          size="small"
+          v-model.number="row.reportQuantity"
+          controls-position="right"
+          :min="0"
+          :max="row.feedQuantity"
+        ></el-input-number>
+      </template>
+      <template v-slot:qualifiedQuantity="{ row }">
+        <el-input-number
+          size="small"
+          v-model.number="row.qualifiedQuantity"
+          controls-position="right"
+          :min="0"
+          :max="qualifiedQuantityMax(row)"
+        ></el-input-number>
+      </template>
+      <template v-slot:noQualifiedQuantity="{ row }">
+        <el-input-number
+          size="small"
+          v-model.number="row.noQualifiedQuantity"
+          controls-position="right"
+          :min="0"
+          :max="noQualifiedQuantityMax(row)"
+        ></el-input-number>
+      </template>
+      <template v-slot:msg="{ row }">
+        <el-input
+          v-model="row.msg"
+          type="textarea"
+          rows="1"
+          autosize
+        ></el-input>
+      </template>
+    </ele-pro-table>
+
+    <materialModal ref="materialModalRef" @confirm="materialConfirm" />
+  </div>
+</template>
+
+<script>
+  import materialModal from './materialModal.vue';
+  import {
+    getMaterialQuotaInfo,
+    getCategoryAndLevelByCategoryId
+  } from '@/api/producetaskrecordrulesrecord/index';
+
+  export default {
+    components: {
+      materialModal
+    },
+    props: {
+      // 物料明细
+      pickDetails: {
+        type: Array,
+        default: () => []
+      },
+      // 本次产出明细
+      outputDetails: {
+        type: Array,
+        default: () => []
+      },
+      // 上到工序产出明细
+      preOutputDetails: {
+        type: Array,
+        default: () => []
+      },
+      // 工单id
+      workOrderId: {
+        type: [String, Number],
+        required: true
+      },
+      // 规则id
+      ruleId: {
+        type: [String, Number],
+        required: true
+      },
+      // 工序id
+      produceTaskId: {
+        type: [String, Number],
+        required: true
+      },
+      // BOM产品分类id
+      bomCategoryId: {
+        type: [String, Number],
+        required: true
+      },
+      // 产出类型 1-物料本身 2-在制品 3-BOM标准产出
+      outputType: {
+        type: [Number],
+        required: true
+      },
+      // 产品分类id
+      categoryId: {
+        type: [String, Number],
+        required: false
+      }
+    },
+    watch: {
+      pickDetails: {
+        handler(newVal) {
+          this.localPickDetails = JSON.parse(JSON.stringify(newVal));
+        },
+        deep: true
+      },
+      outputDetails: {
+        handler(newVal) {
+          this.localOutputDetails = JSON.parse(JSON.stringify(newVal));
+        },
+        deep: true
+      },
+      bomCategoryId: {
+        handler() {
+          this.getMaterialQuotaInfo();
+        }
+      },
+      produceTaskId: {
+        handler() {
+          this.getMaterialQuotaInfo();
+        }
+      },
+      outputType: {
+        handler() {
+          // 重置产出明细
+          this.localOutputDetails = [];
+
+          // 根据不同的类型,重置物料明细
+          if (this.outputType == 1) {
+            this.$emit('update:outputDetails', this.localOutputDetails);
+            // 1-物料本身
+          } else if (this.outputType == 2) {
+            // 2-在制品
+            this.getCategoryAndLevelByCategoryId();
+          } else {
+            // 3 BOM标准产出
+            this.getMaterialQuotaInfo();
+          }
+        }
+      }
+    },
+    computed: {
+      // 物料清单(包含上到工序产出明细)
+      materialList() {
+        return [...this.preOutputDetails, ...this.localPickDetails];
+      },
+      // 物料清单表头
+      materialColumns() {
+        const list = [
+          {
+            width: 45,
+            type: 'index',
+            columnKey: 'index',
+            align: 'center'
+          },
+          {
+            label: '类型',
+            prop: 'categoryLevelNamePath',
+            minWidth: 120
+          },
+          {
+            label: '编码',
+            prop: 'categoryCode',
+            minWidth: 120
+          },
+          {
+            label: '名称',
+            prop: 'categoryName',
+            minWidth: 120
+          },
+          {
+            prop: 'model',
+            label: '型号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'specifications',
+            label: '规格',
+            align: 'center',
+            width: 160,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'brandNo',
+            label: '牌号',
+            align: 'center'
+          },
+          {
+            label: '工序名称',
+            prop: 'produceTaskName',
+            minWidth: 120
+          },
+          {
+            label: '数量',
+            prop: 'feedQuantity',
+            minWidth: 120,
+            formatter: (row) => {
+              return (row.quantity || '') + (row.unit || '');
+            }
+          }
+        ];
+        if (this.outputType == 1) {
+          list.push({
+            prop: '',
+            label: '选择',
+            slot: 'selectColumn',
+            align: 'center',
+            fixed: 'right'
+          });
+        }
+        return list;
+      }
+    },
+
+    data() {
+      return {
+        localPickDetails: JSON.parse(JSON.stringify(this.pickDetails)),
+        localOutputDetails: JSON.parse(JSON.stringify(this.outputDetails)),
+        materialQuotaInfo: null,
+        // 产出清单表头
+        outputDetailsColumns: [
+          {
+            width: 45,
+            type: 'index',
+            columnKey: 'index',
+            align: 'center'
+          },
+          {
+            label: '类型',
+            prop: 'categoryLevelNamePath',
+            minWidth: 120
+          },
+          {
+            label: '编码',
+            prop: 'categoryCode',
+            minWidth: 120
+          },
+          {
+            label: '名称',
+            prop: 'categoryName',
+            minWidth: 120
+          },
+          {
+            prop: 'model',
+            label: '型号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'specifications',
+            label: '规格',
+            align: 'center',
+            width: 160,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'brandNo',
+            label: '牌号',
+            align: 'center'
+          },
+          {
+            label: '工序名称',
+            prop: 'produceTaskName',
+            minWidth: 120
+          },
+          {
+            label: '当次报工数量',
+            prop: 'reportQuantity',
+            minWidth: 160,
+            slot: 'reportQuantity',
+            formatter: (row) => {
+              return (
+                (row.reportQuantity == null ? '' : row.unit) +
+                (row.feedUnit || '')
+              );
+            }
+          },
+          {
+            label: '当次合格数量',
+            prop: 'qualifiedQuantity',
+            minWidth: 160,
+            slot: 'qualifiedQuantity',
+            formatter: (row) => {
+              return (
+                (row.qualifiedQuantity == null ? '' : row.unit) +
+                (row.feedUnit || '')
+              );
+            }
+          },
+          {
+            label: '当次不合格数量',
+            prop: 'noQualifiedQuantity',
+            minWidth: 160,
+            slot: 'noQualifiedQuantity',
+            formatter: (row) => {
+              return (row.noQualifiedQuantity || 0) + (row.unit || '');
+            }
+          },
+          {
+            label: '不合格原因',
+            prop: 'msg',
+            minWidth: 160,
+            slot: 'msg'
+          },
+          {
+            label: '已报工数量',
+            prop: 'sumReportQuantity',
+            minWidth: 120,
+            formatter(row) {
+              return (row.sumReportQuantity || 0) + row.unit;
+            }
+          },
+          {
+            label: '合格总数',
+            prop: 'sumQualifiedQuantity',
+            minWidth: 120,
+            formatter(row) {
+              return (row.sumQualifiedQuantity || 0) + (row.unit || '');
+            }
+          },
+          {
+            label: '不合格总数',
+            prop: 'sumNoQualifiedQuantity',
+            minWidth: 120,
+            formatter(row) {
+              return (row.sumNoQualifiedQuantity || 0) + (row.unit || '');
+            }
+          }
+        ]
+      };
+    },
+    mounted() {
+      if (this.outputType == 2) {
+        this.getCategoryAndLevelByCategoryId();
+      }
+      if (this.outputType == 3) {
+        this.getMaterialQuotaInfo();
+      }
+    },
+    methods: {
+      // 选择物料
+      openMaterialModal() {
+        this.$refs.materialModalRef.open(
+          {
+            workOrderId: this.workOrderId,
+            ruleId: this.ruleId,
+            produceTaskId: this.produceTaskId
+          },
+          []
+        );
+      },
+      materialConfirm(data) {
+        // 选择物料后添加
+        console.log('data', data);
+
+        data.forEach((newItem) => {
+          const index = this.localPickDetails.findIndex(
+            (item) =>
+              item.categoryCode === newItem.categoryCode &&
+              item.produceTaskInstanceId === newItem.produceTaskInstanceId
+          );
+          if (index !== -1) {
+            // 存在则替换数量
+            this.localPickDetails[index].quantity = newItem.quantity;
+          } else {
+            // 不存在则添加
+            this.localPickDetails.push({ ...newItem });
+          }
+        });
+
+        this.$emit('update:pickDetails', this.localPickDetails);
+      },
+      // 获取bom的产出
+      async getMaterialQuotaInfo() {
+        if (this.bomCategoryId && this.produceTaskId) {
+          const data = await getMaterialQuotaInfo(
+            this.bomCategoryId,
+            this.produceTaskId
+          );
+          console.log('this.materialQuotaInfo', data);
+          if (!data.standardOutput) {
+            return this.$message.warning('未配置标准产出物料');
+          }
+          // 赋值产出
+          this.localOutputDetails = [
+            {
+              ...data.standardOutput,
+              reportQuantity: 0,
+              qualifiedQuantity: 0,
+              noQualifiedQuantity: 0,
+              msg: '',
+              sumReportQuantity: 0,
+              sumQualifiedQuantity: 0,
+              sumNoQualifiedQuantity: 0
+            }
+          ];
+          this.$emit('update:outputDetails', this.localOutputDetails);
+          console.log('this.localOutputDetails', this.localOutputDetails);
+        }
+      },
+      // qualifiedQuantityMax 最大合格数量
+      qualifiedQuantityMax(row) {
+        return row.reportQuantity - row.noQualifiedQuantity;
+      },
+      noQualifiedQuantityMax(row) {
+        return row.reportQuantity - row.qualifiedQuantity;
+      },
+      selectedChange(row) {
+        console.log('row', row);
+
+        if (row.selected) {
+          // 判断是否存在
+          const index = this.localOutputDetails.findIndex(
+            (item) =>
+              item.categoryId === row.categoryId &&
+              item.produceTaskInstanceId === row.produceTaskInstanceId
+          );
+
+          if (index === -1) {
+            // 不存在则添加
+            this.localOutputDetails.push({
+              ...row,
+              reportQuantity: 0,
+              qualifiedQuantity: 0,
+              noQualifiedQuantity: 0,
+              msg: '',
+              sumReportQuantity: 0,
+              sumQualifiedQuantity: 0,
+              sumNoQualifiedQuantity: 0
+            });
+          } else {
+            this.$message.warning('该物料已存在于产出清单中');
+          }
+
+          this.$emit('update:outputDetails', this.localOutputDetails);
+        }
+      },
+      // getCategoryAndLevelByCategoryId 获取产品
+      async getCategoryAndLevelByCategoryId() {
+        const data = await getCategoryAndLevelByCategoryId(this.categoryId);
+        this.localOutputDetails = [
+          {
+            ...data,
+            reportQuantity: 0,
+            qualifiedQuantity: 0,
+            noQualifiedQuantity: 0,
+            msg: '',
+            sumReportQuantity: 0,
+            sumQualifiedQuantity: 0,
+            sumNoQualifiedQuantity: 0
+          }
+        ];
+        this.$emit('update:outputDetails', this.localOutputDetails);
+        console.log('this.localOutputDetails', this.localOutputDetails);
+      }
+    }
+  };
+</script>
+
+<style></style>

+ 5 - 40
src/views/produce/components/prenatalExamination/materialModal.vue

@@ -86,24 +86,24 @@
           },
           {
             label: '名称',
-            prop: ' ',
+            prop: 'categoryName',
             minWidth: 120
           },
           {
-            prop: 'modelType',
+            prop: 'model',
             label: '型号',
             align: 'center',
             showOverflowTooltip: true
           },
           {
-            prop: 'specification',
+            prop: 'specifications',
             label: '规格',
             align: 'center',
             width: 160,
             showOverflowTooltip: true
           },
           {
-            prop: 'brandNum',
+            prop: 'brandNo',
             label: '牌号',
             align: 'center'
           },
@@ -117,42 +117,7 @@
             prop: 'feedQuantity',
             minWidth: 120,
             formatter: (row) => {
-              return (row.feedQuantity || 0) + (row.feedUnit || '');
-            }
-          },
-          {
-            label: '已报工数量',
-            prop: 'reportQuantity',
-            minWidth: 120,
-            formatter(row) {
-              return (row.reportQuantity || 0) + row.feedUnit;
-            }
-          },
-          {
-            label: '未报工数量',
-            prop: 'noReportQuantity',
-            minWidth: 120,
-            formatter(row) {
-              if (row.reportQuantity != null) {
-                return row.feedQuantity - row.reportQuantity + row.feedUnit;
-              }
-              return `${row.feedQuantity}${row.feedUnit || ''}`;
-            }
-          },
-          {
-            label: '合格总数',
-            prop: 'qualifiedQuantity',
-            minWidth: 120,
-            formatter(row) {
-              return (row.qualifiedQuantity || 0) + (row.feedUnit || '');
-            }
-          },
-          {
-            label: '不合格总数',
-            prop: 'noQualifiedQuantity',
-            minWidth: 120,
-            formatter(row) {
-              return (row.noQualifiedQuantity || 0) + (row.feedUnit || '');
+              return (row.quantity || 0) + (row.unit || '');
             }
           }
         ],

+ 59 - 259
src/views/produce/components/prenatalExamination/releaseRulesDialog.vue

@@ -198,6 +198,23 @@
             ></el-input>
           </el-form-item>
         </el-col>
+        <el-col :span="8">
+          <el-form-item label="产出物">
+            <el-select
+              v-model="addForm.outputType"
+              placeholder="请选择产出物类型"
+              filterable
+              style="width: 100%"
+            >
+              <el-option
+                v-for="item in outputTypeList"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              />
+            </el-select>
+          </el-form-item>
+        </el-col>
         <el-col :span="8">
           <el-form-item label="结论" required prop="conclusion">
             <el-radio-group v-model="addForm.conclusion">
@@ -209,64 +226,19 @@
       </el-row>
     </el-form>
 
-    <header-title
-      v-if="addForm.reportWorkType == '2' && addForm.produceTaskId"
-      title="物料清单"
-    ></header-title>
-
-    <ele-pro-table
-      v-if="addForm.reportWorkType == '2' && addForm.produceTaskId"
-      ref="table"
-      row-key="id"
-      :columns="materialColumns"
-      :datasource="addForm.pickDetails"
-      cache-key="prenatal-examination-material-list-table-2510231107"
-      autoAmendPage
-      :needPage="false"
+    <material
+      v-if="addForm.produceTaskId"
+      :pickDetails.sync="addForm.pickDetails"
+      :outputDetails.sync="addForm.outputDetails"
+      :preOutputDetails="preOutputDetails"
+      :workOrderId="addForm.workOrderId"
+      :ruleId="addForm.ruleId"
+      :produceTaskId="addForm.produceTaskId"
+      :bomCategoryId="workOrderInfo.bomCategoryId"
+      :outputType="addForm.outputType"
+      :categoryId="workOrderInfo.categoryId"
       @refresh="getListByWorkOrderId"
-    >
-      <template v-slot:toolbar>
-        <el-button type="primary" @click="openMaterialModal"
-          >添加物料</el-button
-        >
-      </template>
-
-      <template v-slot:reportQuantity="{ row }">
-        <el-input-number
-          size="small"
-          v-model.number="row.reportQuantity"
-          controls-position="right"
-          :min="0"
-          :max="row.feedQuantity"
-        ></el-input-number>
-      </template>
-      <template v-slot:qualifiedQuantity="{ row }">
-        <el-input-number
-          size="small"
-          v-model.number="row.qualifiedQuantity"
-          controls-position="right"
-          :min="0"
-          :max="qualifiedQuantityMax(row)"
-        ></el-input-number>
-      </template>
-      <template v-slot:noQualifiedQuantity="{ row }">
-        <el-input-number
-          size="small"
-          v-model.number="row.noQualifiedQuantity"
-          controls-position="right"
-          :min="0"
-          :max="noQualifiedQuantityMax(row)"
-        ></el-input-number>
-      </template>
-      <template v-slot:msg="{ row }">
-        <el-input
-          v-model="row.msg"
-          type="textarea"
-          rows="1"
-          autosize
-        ></el-input>
-      </template>
-    </ele-pro-table>
+    ></material>
 
     <header-title
       title="检查项目"
@@ -423,8 +395,6 @@
     </template>
 
     <toolModal ref="toolModalRef" @chooseModal="chooseModal" />
-
-    <materialModal ref="materialModalRef" @confirm="materialConfirm" />
   </ele-modal>
 </template>
 
@@ -444,13 +414,13 @@
   } from '@/api/producetaskrecordrulesrecord/index';
   import toolModal from '@/views/batchRecord/components/toolModal.vue';
   import { getTeam } from '@/api/produce/job.js';
-  import materialModal from './materialModal.vue';
   import { getFactoryarea } from '@/api/aps/index';
   import dictMixins from '@/mixins/dictMixins';
   import tableColumnsMixin from '@/mixins/tableColumnsMixin';
+  import material from './material.vue';
 
   export default {
-    components: { SelectUser, toolModal, materialModal },
+    components: { SelectUser, toolModal, material },
     mixins: [dictMixins, tableColumnsMixin],
     emits: ['reload'],
     props: {
@@ -523,8 +493,12 @@
         teamId: '',
         // 物料字段name
         pickDetails: [],
+        // 本次产出明细
+        outputDetails: [],
         recordRulesExecuteMethodId: null,
-        recordRulesExecuteMethodName: ''
+        recordRulesExecuteMethodName: '',
+        // 	产出类型 1-原材料,2-在制品,3.BOM标准产出
+        outputType: 1
       };
 
       return {
@@ -609,140 +583,14 @@
         teamUserList: [],
         teamList: [],
         teamAllList: [],
-        // 物料清单表头
-        materialColumns: [
-          {
-            width: 45,
-            type: 'index',
-            columnKey: 'index',
-            align: 'center'
-          },
-          {
-            label: '类型',
-            prop: 'categoryLevelNamePath',
-            minWidth: 120
-          },
-          {
-            label: '编码',
-            prop: 'categoryCode',
-            minWidth: 120
-          },
-          {
-            label: '名称',
-            prop: 'categoryName',
-            minWidth: 120
-          },
-          ,
-          {
-            prop: 'modelType',
-            label: '型号',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'specification',
-            label: '规格',
-            align: 'center',
-            width: 160,
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'brandNum',
-            label: '牌号',
-            align: 'center'
-          },
-          {
-            prop: 'modelType',
-            label: '型号',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'specification',
-            label: '规格',
-            align: 'center',
-            width: 160,
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'brandNum',
-            label: '牌号',
-            align: 'center'
-          },
-          {
-            label: '工序名称',
-            prop: 'produceTaskName',
-            minWidth: 120
-          },
-          {
-            label: '数量',
-            prop: 'feedQuantity',
-            minWidth: 120,
-            formatter: (row) => {
-              return (row.feedQuantity || '') + (row.feedUnit || '');
-            }
-          },
-          {
-            label: '当次报工数量',
-            prop: 'reportQuantity',
-            minWidth: 160,
-            slot: 'reportQuantity'
-          },
-          {
-            label: '当次合格数量',
-            prop: 'qualifiedQuantity',
-            minWidth: 160,
-            slot: 'qualifiedQuantity'
-          },
-          {
-            label: '当次不合格数量',
-            prop: 'noQualifiedQuantity',
-            minWidth: 160,
-            slot: 'noQualifiedQuantity'
-          },
-          {
-            label: '不合格原因',
-            prop: 'msg',
-            minWidth: 160,
-            slot: 'msg'
-          },
-          {
-            label: '已报工数量',
-            prop: 'sumReportQuantity',
-            minWidth: 120,
-            formatter(row) {
-              return (row.sumReportQuantity || 0) + row.feedUnit;
-            }
-          },
-          {
-            label: '未报工数量',
-            prop: 'noReportQuantity',
-            minWidth: 120,
-            formatter(row) {
-              if (row.sumReportQuantity != null) {
-                return row.feedQuantity - row.sumReportQuantity + row.feedUnit;
-              }
-              return `${row.feedQuantity}${row.feedUnit || ''}`;
-            }
-          },
-          {
-            label: '合格总数',
-            prop: 'sumQualifiedQuantity',
-            minWidth: 120,
-            formatter(row) {
-              return (row.sumQualifiedQuantity || 0) + (row.feedUnit || '');
-            }
-          },
-          {
-            label: '不合格总数',
-            prop: 'sumNoQualifiedQuantity',
-            minWidth: 120,
-            formatter(row) {
-              return (row.sumNoQualifiedQuantity || 0) + (row.feedUnit || '');
-            }
-          }
-        ],
-        workshopAreaList: []
+        workshopAreaList: [],
+        // 上到工序的 产出明细
+        preOutputDetails: [],
+        outputTypeList: [
+          { label: '原材料', value: 1 },
+          { label: '在制品', value: 2 },
+          { label: 'BOM标准产出', value: 3 }
+        ]
       };
     },
     computed: {
@@ -937,18 +785,28 @@
         }
       },
       // 物料信息查询
-      async getListByWorkOrderId() {
+      async getListByWorkOrderId(type = '') {
+        console.log('type 物料信息', type);
         if (!this.productionInfo.produceTaskId) return;
         // 查询物料信息
-        const materialList = await queryListByWorkOrderId({
+        const materialObject = await queryListByWorkOrderId({
           workOrderId: this.addForm.workOrderId,
           recordId: this.productionInfo.recordId,
           produceTaskId: this.productionInfo.produceTaskId,
           ruleId: this.addForm.ruleId
         });
 
-        console.log('materialList 物料信息', materialList);
-        this.addForm.pickDetails = materialList;
+        console.log('materialList 物料信息', materialObject);
+
+        if (type == '') {
+          this.addForm.pickDetails = materialObject.pickDetails;
+          this.addForm.outputDetails = materialObject.outputDetails;
+          this.preOutputDetails = materialObject.preOutputDetails;
+        }
+
+        if (type == 'output') {
+          this.addForm.outputDetails = materialObject.outputDetails;
+        }
       },
       // 规则信息
       async getRuleInfo() {
@@ -999,6 +857,7 @@
       },
       // 提交
       submit(type) {
+        console.log('this.addForm', this.addForm);
         // 验证表单
         this.$refs.ruleFormRef.validate(async (valid) => {
           if (!valid) {
@@ -1229,65 +1088,6 @@
 
         console.log('row', row);
       },
-      // 选择物料
-      openMaterialModal() {
-        this.$refs.materialModalRef.open(
-          {
-            workOrderId: this.addForm.workOrderId,
-            ruleId: this.addForm.ruleId,
-            produceTaskId: this.workOrderInfo.produceTaskId
-          },
-          []
-        );
-      },
-      materialConfirm(data) {
-        // 选择物料后添加
-        console.log('data', data);
-
-        // 去重
-        const list = data
-          .filter((i) => {
-            const any = this.addForm.pickDetails.find(
-              (item) =>
-                item.categoryCode === i.categoryCode &&
-                item.produceTaskInstanceId === i.produceTaskInstanceId
-            );
-            return !any;
-          })
-          .map((i) => {
-            i.ruleId = this.addForm.ruleId;
-            return i;
-          });
-
-        // 覆盖部分数据
-        this.addForm.pickDetails = this.addForm.pickDetails.map((i) => {
-          const item = data.find(
-            (item) =>
-              item.categoryCode === i.categoryCode &&
-              item.produceTaskInstanceId === i.produceTaskInstanceId
-          );
-          if (item) {
-            return {
-              ...item,
-              reportQuantity: i.reportQuantity,
-              qualifiedQuantity: i.qualifiedQuantity,
-              noQualifiedQuantity: i.noQualifiedQuantity,
-              msg: i.msg
-            };
-          }
-          return i;
-        });
-        this.addForm.pickDetails = [...this.addForm.pickDetails, ...list];
-        console.log('list', list);
-        console.log('this.addForm.pickDetails', this.addForm.pickDetails);
-      },
-      // qualifiedQuantityMax 最大合格数量
-      qualifiedQuantityMax(row) {
-        return row.reportQuantity - row.noQualifiedQuantity;
-      },
-      noQualifiedQuantityMax(row) {
-        return row.reportQuantity - row.qualifiedQuantity;
-      },
       // 查询车间区域
       async getWorkshopArea() {
         const data = await getFactoryarea({

+ 5 - 1
src/views/produce/index.vue

@@ -1212,7 +1212,11 @@
       },
       //是否完成 产前准备 限制按钮
       async checkProductionResult() {
-        if (this.produceTaskInfo && this.workListIds.length > 0) {
+        if (
+          this.produceTaskInfo &&
+          this.workListIds.length > 0 &&
+          this.produceTaskInfo.id != -1
+        ) {
           // 判断是否要求先完成 产前准备等事项
           const result = await checkProductionResult({
             produceTaskId: this.produceTaskInfo.id,

+ 20 - 2
src/views/produceOrder/components/details/index.vue

@@ -77,6 +77,16 @@
 
           <!-- <el-tab-pane label="退料详情">
           </el-tab-pane> -->
+
+          <el-tab-pane
+            label="记录详情"
+            v-if="sourceTaskId && workOrderInfo.bomCategoryId"
+          >
+            <recordRules
+              :produceTaskId="sourceTaskId"
+              :bomCategoryId="workOrderInfo.bomCategoryId"
+            ></recordRules>
+          </el-tab-pane>
         </el-tabs>
       </div>
     </el-drawer>
@@ -91,6 +101,7 @@
   import { getTaskInstanceList } from '@/api/produce/job';
   import productionDetails from '@/views//workOrderList/components/productionDetails.vue';
   import pickDetails from '../../details.vue';
+  import recordRules from '../recordRules/recordRules.vue';
 
   export default {
     components: {
@@ -98,7 +109,8 @@
       feedDetails,
       jobDetails,
       productionDetails,
-      pickDetails
+      pickDetails,
+      recordRules
     },
     data() {
       return {
@@ -114,7 +126,8 @@
         newId: '',
         routeObj: {
           id: null
-        }
+        },
+        sourceTaskId: ''
       };
     },
 
@@ -133,6 +146,7 @@
         this.workOrderInfo = row;
         this.routeObj.id = this.workOrderInfo.id;
         console.log(this.workOrderInfo.id, 'workOrderInfo.id');
+        console.log('workOrderInfo', this.workOrderInfo);
         this.getTaskFn();
         this.drawer = true;
       },
@@ -151,6 +165,7 @@
           this.desIndex = index;
           console.log(this.routeList, '888888');
           this.newId = this.routeList[this.desIndex]?.taskId || '';
+          this.sourceTaskId = this.routeList[this.desIndex]?.sourceTaskId || '';
 
           if (this.workOrderInfo.taskId != -2) {
             this.curTaskObj = JSON.parse(JSON.stringify(this.routeObj));
@@ -159,6 +174,8 @@
             this.desIndex = 0;
           }
           this.activeIndex = index;
+          console.log('this.curTaskObj', this.curTaskObj);
+          console.log('this.newId', this.newId);
         });
       },
 
@@ -172,6 +189,7 @@
         } else {
           this.desIndex = index;
           this.newId = this.routeList[this.desIndex].taskId || '';
+          this.sourceTaskId = this.routeList[this.desIndex]?.sourceTaskId || '';
         }
       }
     }

+ 118 - 0
src/views/produceOrder/components/recordRules/recordRules.vue

@@ -0,0 +1,118 @@
+<template>
+  <ele-pro-table
+    :columns="columns"
+    :datasource="datasource"
+    cacheKey="mes-recordRules-25113-031018"
+    ref="tableRef"
+  >
+    <template v-slot:toolbar>
+      <el-select v-model="reportWorkType" placeholder="请选择" @change="reload">
+        <el-option
+          v-for="item in reportWorkTypeOptions"
+          :key="item.value"
+          :label="item.label"
+          :value="item.value"
+        ></el-option>
+      </el-select>
+    </template>
+  </ele-pro-table>
+</template>
+
+<script>
+  import tableColumnsMixin from '@/mixins/tableColumnsMixin';
+  import dictMixins from '@/mixins/dictMixins';
+  import { produceTaskRecordRules } from '@/api/producetaskrulerecord/index';
+
+  export default {
+    name: 'recordRules',
+    props: {
+      produceTaskId: {
+        type: String,
+        required: true
+      },
+      bomCategoryId: {
+        type: String,
+        required: true
+      }
+    },
+    mixins: [tableColumnsMixin, dictMixins],
+    data() {
+      return {
+        columns: [
+          {
+            columnKey: 'index',
+            type: 'index',
+            width: 45,
+            align: 'center'
+          },
+          {
+            prop: 'produceTaskName',
+            label: '工序名称',
+            align: 'center'
+          },
+          {
+            prop: 'itemType',
+            label: '类型',
+            align: 'center',
+            formatter: (row) => {
+              return this.getDictValue('记录规则事项类型', row.itemType);
+            }
+          },
+          {
+            prop: 'executeMethod',
+            label: '配置执行方式',
+            align: 'center',
+            formatter: (row) => {
+              return this.getDictValue('记录规则执行方式', row.executeMethod);
+            }
+          },
+          {
+            prop: 'rulesName',
+            label: '名称',
+            align: 'center',
+            formatter: (row) => {
+              return row.rulesName || row.itemTaskName;
+            }
+          }
+        ],
+        reportWorkType: 1,
+        reportWorkTypeOptions: [
+          { label: '产前准备', value: 1 },
+          { label: '过程监测', value: 2 },
+          { label: '产后检查', value: 3 }
+        ]
+      };
+    },
+    watch: {
+      produceTaskId(newVal) {
+        this.reload();
+      }
+    },
+    methods: {
+      datasource({ page, limit, where }) {
+        let body = {
+          ...where,
+          produceTaskId: this.produceTaskId,
+          bomCategoryId: this.bomCategoryId,
+          reportWorkType: this.reportWorkType,
+          pageNum: page,
+          size: limit,
+          bomCategoryId: null
+        };
+
+        if (this.reportWorkType == 2) {
+          body.bomCategoryId = this.bomCategoryId;
+        } else {
+          body.bomCategoryId = null;
+        }
+
+        return produceTaskRecordRules(body);
+      },
+      reload() {
+        this.$refs.tableRef.reload();
+      }
+    }
+  };
+</script>
+
+<style></style>

+ 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',