فهرست منبع

工序报工-物料添加部分

lucw 7 ماه پیش
والد
کامیت
b0e528d512

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

@@ -42,3 +42,15 @@ export async function getById(id) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+// /mes/producetaskrulerecordpickdetail/queryListByWorkOrderId post
+export async function queryListByWorkOrderId(body) {
+  const res = await request.post(
+    '/mes/producetaskrulerecordpickdetail/queryListByWorkOrderId',
+    body
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

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

@@ -79,3 +79,26 @@ export async function logicDeleteById(id) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+// /mes/producetaskrulerecordpickdetail/queryPickAndFeedByWorkOrderId
+export async function queryPickAndFeedByWorkOrderId(body) {
+  const res = await request.post(
+    '/mes/producetaskrulerecordpickdetail/queryPickAndFeedByWorkOrderId',
+    body
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// GET /mes/producetaskrulerecordpickdetail/queryAllProduceTaskInstanceInPickOrder/{workOrderId}
+export async function queryAllProduceTaskInstanceInPickOrder(workOrderId) {
+  const res = await request.get(
+    `/mes/producetaskrulerecordpickdetail/queryAllProduceTaskInstanceInPickOrder/${workOrderId}`
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 239 - 0
src/views/produce/components/prenatalExamination/materialModal.vue

@@ -0,0 +1,239 @@
+<template>
+  <el-dialog
+    v-if="visible"
+    :title="title"
+    :visible.sync="visible"
+    :before-close="handleClose"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    width="70%"
+    :fullscreen="fullscreen"
+    class="fullscreen"
+  >
+    <el-card shadow="never">
+      <seek-page :seekList="seekList"></seek-page>
+      <ele-pro-table
+        style="min-height: 400px"
+        ref="table"
+        :columns="columns"
+        :datasource="datasource"
+        :selection.sync="selection"
+        :need-page="false"
+        row-key="index"
+      >
+      </ele-pro-table>
+    </el-card>
+
+    <div class="rx-sc">
+      <el-button type="primary" size="small" @click="selected">选择</el-button>
+      <el-button size="small" @click="handleClose">关闭</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+  import SeekPage from '@/components/common/seekPage.vue';
+  import {
+    queryPickAndFeedByWorkOrderId,
+    queryAllProduceTaskInstanceInPickOrder
+  } from '@/api/producetaskrulerecord/index.js';
+
+  export default {
+    components: {
+      SeekPage
+    },
+    data() {
+      return {
+        fullscreen: false,
+        visible: false,
+        title: '选择物品',
+        type: null,
+
+        // 表格列配置
+        columns: [
+          {
+            columnKey: 'selection',
+            type: 'selection',
+            width: 45,
+            align: 'center',
+            reserveSelection: true,
+            fixed: 'left',
+            selectable: (row, index) => {
+              // 已选物料不可再选
+              return !this.pickDetails.some(
+                (item) =>
+                  item.categoryCode === row.categoryCode &&
+                  item.produceTaskInstanceId === row.produceTaskInstanceId
+              );
+            }
+          },
+          {
+            width: 45,
+            type: 'index',
+            columnKey: 'index',
+            align: 'center'
+          },
+          {
+            label: '批次号',
+            prop: 'batchNo',
+            minWidth: 120
+          },
+
+          {
+            label: '领料类型',
+            prop: 'categoryLevelNamePath',
+            minWidth: 120
+          },
+          {
+            label: '物料编码',
+            prop: 'categoryCode',
+            minWidth: 120
+          },
+          {
+            label: '物料名称',
+            prop: 'categoryName',
+            minWidth: 120
+          },
+          {
+            label: '工序名称',
+            prop: 'produceTaskName',
+            minWidth: 120
+          },
+          {
+            label: '领料数量',
+            prop: 'pickQuantity',
+            minWidth: 120,
+            formatter: (row) => {
+              return (row.pickQuantity || '') + (row.pickUnit || '');
+            }
+          },
+          {
+            label: '出库数量',
+            prop: 'outStorageQuantity',
+            minWidth: 120,
+            formatter: (row) => {
+              return (
+                (row.outStorageQuantity || '') + (row.outStorageUnit || '')
+              );
+            }
+          },
+          {
+            label: '投料数量',
+            prop: 'feedQuantity',
+            minWidth: 120,
+            formatter: (row) => {
+              return (row.feedQuantity || '') + (row.feedUnit || '');
+            }
+          },
+          {
+            label: '已报工数量',
+            prop: 'reportQuantity',
+            minWidth: 120
+          },
+          {
+            label: '未报工数量',
+            prop: 'noReportQuantity',
+            minWidth: 120
+          },
+          {
+            label: '合格总数',
+            prop: 'qualifiedQuantity',
+            minWidth: 120
+          },
+          {
+            label: '不合格总数',
+            prop: 'noQualifiedQuantity',
+            minWidth: 120
+          }
+        ],
+
+        // 表格选中数据
+        selection: [],
+        taskPlanList: [],
+        workOrderId: '',
+        // 已选物料
+        pickDetails: []
+      };
+    },
+    computed: {
+      seekList() {
+        return [
+          {
+            label: '关键词:',
+            value: 'keyword',
+            type: 'input',
+            placeholder: '物料编码、物料名称、批次号'
+          },
+          {
+            label: '工序名称:',
+            value: 'produceTaskInstanceId',
+            type: 'select',
+            placeholder: '选择工序',
+            planList: this.taskPlanList
+          }
+        ];
+      }
+    },
+    created() {},
+    methods: {
+      /* 表格数据源 */
+      async datasource({ page, limit, where }) {
+        const res = await queryPickAndFeedByWorkOrderId({
+          ...where,
+          workOrderId: this.workOrderId
+          // pageNum: page,
+          // size: limit
+        });
+        return res;
+      },
+      /* 刷新表格 */
+      reload(where) {
+        this.$refs.table.reload({ page: 1, where: where });
+      },
+      handleClose() {
+        this.$refs.table.setSelectedRows([]);
+        this.selection = [];
+        this.visible = false;
+      },
+      open(workOrderId, pickDetails) {
+        this.workOrderId = workOrderId;
+        this.pickDetails = pickDetails;
+        this.$nextTick(() => {
+          // this.reload({ workOrderId });
+          this.queryAllProduceTaskList(workOrderId);
+        });
+        this.visible = true;
+      },
+      selected() {
+        if (this.selection.length === 0) {
+          this.$message.warning('请至少选择一条数据');
+          return;
+        }
+        this.$emit('confirm', this.selection);
+        this.handleClose();
+      },
+      async queryAllProduceTaskList(workOrderId) {
+        const res = await queryAllProduceTaskInstanceInPickOrder(workOrderId);
+        this.taskPlanList = res.map((item) => {
+          return {
+            label: item.taskName,
+            value: item.taskId
+          };
+        });
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .rx-sc {
+    flex: 0 0 50px;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+  }
+  .ml60 {
+    margin-left: 60px;
+  }
+</style>

+ 172 - 16
src/views/produce/components/prenatalExamination/releaseRulesDialog.vue

@@ -195,11 +195,47 @@
       ref="table"
       row-key="id"
       :columns="materialColumns"
-      :datasource="[]"
+      :datasource="addForm.pickDetails"
       cache-key="prenatal-examination-material-list-table-2510231107"
       autoAmendPage
       :needPage="false"
+      @refresh="getListByWorkOrderId"
     >
+      <template v-slot:toolbar>
+        <el-button type="primary" @click="openMaterialModal"
+          >添加物料</el-button
+        >
+      </template>
+
+      <template v-slot:reportQuantity="{ row }">
+        <el-input
+          v-model.number="row.reportQuantity"
+          type="text"
+          min="0"
+        ></el-input>
+      </template>
+      <template v-slot:qualifiedQuantity="{ row }">
+        <el-input
+          v-model.number="row.qualifiedQuantity"
+          type="text"
+          min="0"
+        ></el-input>
+      </template>
+      <template v-slot:noQualifiedQuantity="{ row }">
+        <el-input
+          v-model.number="row.noQualifiedQuantity"
+          type="text"
+          min="0"
+        ></el-input>
+      </template>
+      <template v-slot:msg="{ row }">
+        <el-input
+          v-model="row.msg"
+          type="textarea"
+          rows="1"
+          autosize
+        ></el-input>
+      </template>
     </ele-pro-table>
 
     <header-title title="检查项目"></header-title>
@@ -355,6 +391,8 @@
     </template>
 
     <toolModal ref="toolModalRef" @chooseModal="chooseModal" />
+
+    <materialModal ref="materialModalRef" @confirm="materialConfirm" />
   </ele-modal>
 </template>
 
@@ -369,14 +407,15 @@
     saveOrUpdateAndSubmit,
     saveOrUpdate,
     logicDelete,
-    getById
+    getById,
+    queryListByWorkOrderId
   } from '@/api/producetaskrecordrulesrecord/index';
   import toolModal from '@/views/batchRecord/components/toolModal.vue';
   import { getTeam } from '@/api/produce/job.js';
-  import { det, row } from 'mathjs';
+  import materialModal from './materialModal.vue';
 
   export default {
-    components: { SelectUser, toolModal },
+    components: { SelectUser, toolModal, materialModal },
     emits: ['reload'],
     props: {
       isTempRecord: {
@@ -430,7 +469,9 @@
           // }
         ],
         // 班组id
-        teamId: ''
+        teamId: '',
+        // 物料字段name
+        pickDetails: []
       };
 
       return {
@@ -534,7 +575,94 @@
         checked: false,
         teamUserList: [],
         teamList: [],
-        teamAllList: []
+        teamAllList: [],
+        // 物料清单表头
+        materialColumns: [
+          {
+            width: 45,
+            type: 'index',
+            columnKey: 'index',
+            align: 'center'
+          },
+          {
+            label: '批次号',
+            prop: 'batchNo',
+            minWidth: 120
+          },
+
+          {
+            label: '领料类型',
+            prop: 'categoryLevelNamePath',
+            minWidth: 120
+          },
+          {
+            label: '物料编码',
+            prop: 'categoryCode',
+            minWidth: 120
+          },
+          {
+            label: '物料名称',
+            prop: 'categoryName',
+            minWidth: 120
+          },
+          {
+            label: '工序名称',
+            prop: 'produceTaskName',
+            minWidth: 120
+          },
+          {
+            label: '领料数量',
+            prop: 'pickQuantity',
+            minWidth: 120,
+            formatter: (row) => {
+              return (row.pickQuantity || '') + (row.pickUnit || '');
+            }
+          },
+          {
+            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
+          },
+          {
+            label: '未报工数量',
+            prop: 'noReportQuantity',
+            minWidth: 120
+          },
+          {
+            label: '合格总数',
+            prop: 'sumQualifiedQuantity',
+            minWidth: 120
+          },
+          {
+            label: '不合格总数',
+            prop: 'sumNoQualifiedQuantity',
+            minWidth: 120
+          }
+        ]
       };
     },
     computed: {
@@ -556,16 +684,7 @@
         return this.teamUserList.filter((user) =>
           this.addForm.executeUsersIds.includes(user.id)
         );
-      },
-      // 物料清单表头
-      materialColumns: [
-        {
-          width: 45,
-          type: 'index',
-          columnKey: 'index',
-          align: 'center'
-        }
-      ]
+      }
     },
     mounted() {
       if (localStorage.getItem('singleUserInfo') == '1') {
@@ -667,11 +786,25 @@
             this.teamUserList = this.teamAllList[index];
           }
 
+          this.getListByWorkOrderId();
+
           this.loading = false;
         } catch (error) {
           this.loading = false;
         }
       },
+      // 物料信息查询
+      async getListByWorkOrderId() {
+        // 查询物料信息
+        const materialList = await queryListByWorkOrderId({
+          workOrderId: this.addForm.workOrderId,
+          recordId: this.productionInfo.recordId,
+          produceTaskInstanceId: this.workOrderInfo.taskId
+        });
+
+        console.log('materialList 物料信息', materialList);
+        this.addForm.pickDetails = materialList;
+      },
       // 规则信息
       async getRuleInfo() {
         const data = await getRecordRulesDetail(this.productionInfo.ruleId);
@@ -942,6 +1075,29 @@
         });
 
         console.log('row', row);
+      },
+      // 选择物料
+      openMaterialModal() {
+        this.$refs.materialModalRef.open(
+          this.addForm.workOrderId,
+          this.addForm.pickDetails
+        );
+      },
+      materialConfirm(data) {
+        // 选择物料后添加
+
+        this.addForm.pickDetails = [
+          ...this.addForm.pickDetails,
+          ...data.map((i) => {
+            return {
+              ...i,
+              sumReportQuantity: i.reportQuantity,
+              sumNoReportQuantity: i.noReportQuantity,
+              sumQualifiedQuantity: i.qualifiedQuantity,
+              sumNoQualifiedQuantity: i.noQualifiedQuantity
+            };
+          })
+        ];
       }
     }
   };

+ 2 - 2
src/views/produce/index.vue

@@ -118,8 +118,8 @@
               </el-popover></template
             >
 
-            <!-- <span
-              >支持工单编码,产品编码,产品名称,产品规格,牌号,型号,批次号查询</span
+            <!--
+            <span>支持工单编码,产品编码,产品名称,产品规格,牌号,型号,批次号查询</span
             > -->
           </div>
           <div