695593266@qq.com 6 месяцев назад
Родитель
Сommit
fe289343e9

+ 17 - 0
src/api/productionPlan/index.js

@@ -390,3 +390,20 @@ export async function taskReleaseWork(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+//任务齐套性检查
+export async function updatePreRelease(data) {
+  const res = await request.post(`/aps/productionplan/updatePreRelease`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+//任务齐套性检查 订单
+export async function updatePreReleaseOrder(data) {
+  const res = await request.post(`/aps/workorder/updatePreRelease`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 82 - 68
src/views/productionPlan/components/checkProductionPreparations.vue

@@ -14,8 +14,12 @@
     <ele-pro-table
       ref="table"
       :columns="columns"
-      :initLoad="false"
-      :datasource="datasource"
+      :datasource="
+        type == 'plan'
+          ? preReleaseList.filter((item) => item.preType != 6)
+          : preReleaseList
+      "
+      :needPage="false"
       :selection.sync="selection"
       row-key="id"
       @columns-change="handleColumnChange"
@@ -23,7 +27,11 @@
       :page-size="20"
     >
       <template v-slot:toolbar>
-        <el-button type="primary" size="mini" @click="batchKittingComplete"
+        <el-button
+          v-if="type != 'order' && type != 'plan'"
+          type="primary"
+          size="mini"
+          @click="batchKittingComplete"
           >批量齐套检查</el-button
         >
       </template>
@@ -36,18 +44,16 @@
         <span v-if="row.statusStr == '缺料'" style="color: red">{{
           row.statusStr
         }}</span>
-        <span v-else-if="row.statusStr == '不齐套'" style="color: orange">{{
-          row.statusStr
-        }}</span>
         <span v-else style="color: green">{{ row.statusStr }}</span>
       </template>
 
-      <template v-slot:action="{ row, $index }">
+      <template v-slot:action="{ row }">
         <el-link
           type="primary"
           :underline="false"
-          @click="kittingComplete(row, $index)"
+          @click="kittingComplete(row)"
         >
+          <!-- v-if="type == 'plan' || row.preType == '6'" -->
           齐套检查
         </el-link>
 
@@ -55,7 +61,7 @@
           type="primary"
           :underline="false"
           @click="taskAssignment"
-          v-if="row.statusStr == '缺料' && row.preType == '6'"
+          v-if="row.statusStr == '缺料' && type == 'plan' && row.preType == '5'"
         >
           任务派单
         </el-link>
@@ -123,11 +129,22 @@
 </template>
 
 <script>
-  import { completenessCheck, taskReleaseWork } from '@/api/productionPlan';
+  import {
+    completenessCheck,
+    taskReleaseWork,
+    updatePreRelease,
+    updatePreReleaseOrder
+  } from '@/api/productionPlan';
   import { listOrganizations, getUserPage } from '@/api/system/organization';
   import kittingComplete from './kittingComplete.vue';
   export default {
     components: { kittingComplete },
+    props: {
+      type: {
+        type: String,
+        default: ''
+      }
+    },
     data() {
       // 1主材料 2辅材料 3工装 4工艺文件 5NC代码 6人员
       return {
@@ -135,6 +152,7 @@
         cacheKeyUrl: 'checkProductionPreparationsKey',
         selection: [],
         planId: '',
+        preReleaseList: [],
         typeList: [
           {
             value: 1,
@@ -181,7 +199,6 @@
     },
 
     created() {
-      console.log(this.$store.state.user.info, '用户信息');
       this.getGs();
     },
 
@@ -216,17 +233,17 @@
             align: 'center',
             label: '状态'
           },
-          {
-            prop: 'approveDate',
-            align: 'center',
-            label: '校验时间'
-          },
-          {
-            prop: 'approveName',
-            align: 'center',
-            label: '校验人',
-            showOverflowTooltip: true
-          },
+          // {
+          //   prop: 'approveDate',
+          //   align: 'center',
+          //   label: '校验时间'
+          // },
+          // {
+          //   prop: 'approveName',
+          //   align: 'center',
+          //   label: '校验人',
+          //   showOverflowTooltip: true
+          // },
           {
             columnKey: 'action',
             label: '操作',
@@ -241,21 +258,22 @@
     },
 
     methods: {
-      datasource({ page, where, limit }) {
-        let pageNum = page;
-        let size = limit;
-        where.planId = this.planId;
-        const res = completenessCheck({ ...where, pageNum, size });
-
-        return res;
+      async completenessCheck(planId, apsWorkOrderId) {
+        const params = {
+          planId
+        };
+        if (apsWorkOrderId) {
+          params.apsWorkOrderId = apsWorkOrderId;
+        }
+        this.preReleaseList = await completenessCheck(params);
       },
 
-      reload(where) {
-        this.$nextTick(() => {
-          if (this.$refs.table && this.$refs.table.reload)
-            this.$refs.table.reload({ page: 1, where: where });
-        });
-      },
+      // reload(where) {
+      //   this.$nextTick(() => {
+      //     if (this.$refs.table && this.$refs.table.reload)
+      //       this.$refs.table.reload({ page: 1, where: where });
+      //   });
+      // },
 
       async getGs() {
         await listOrganizations().then((list) => {
@@ -275,63 +293,59 @@
       open(item) {
         this.visible = true;
         this.itemData = item;
-        this.planId = item.id;
-
-        if (this.planId) {
-          this.reload();
+        this.preReleaseList = [];
+        if (item.preRelease.length) {
+          this.preReleaseList = item.preRelease;
+        } else {
+          if (item.id && this.type == 'plan') {
+            this.completenessCheck(item.id);
+          } else if (this.type == 'order') {
+            this.completenessCheck(item.productionPlanId, item.id);
+          }
         }
       },
 
       handleColumnChange() {},
 
       onClose() {
-        this.planId = '';
         this.visible = false;
       },
 
       handleClose() {
         this.dialogVisible = false;
       },
-      kittingComplete(item, index) {
+      updatePreRelease(item) {
+        if (this.type == 'plan') {
+          updatePreRelease(item);
+        } else if (this.type == 'order') {
+          item.apsWorkOrderId = this.itemData.id;
+          updatePreReleaseOrder(item);
+        }
+        this.$emit('update');
+      },
+      kittingComplete(item) {
         if (item.preType == '5' || item.preType == '6') {
           this.$confirm('是否确认齐套?', '提示', {
             confirmButtonText: '齐套',
             cancelButtonText: '不齐套',
-            type: 'warning'
+            type: 'warning',
+            distinguishCancelAndClose: true
           })
             .then(() => {
-              // approveDate: null;
-              // approveId: '';
-              // approveName: '';
-              item.approveDate = this.getNowDate();
               item.statusStr = '齐套';
-              this.$forceUpdate();
+              this.updatePreRelease(item);
             })
-            .catch(() => {
-              item.approveDate = this.getNowDate();
-              item.statusStr = '不齐套';
-              this.$forceUpdate();
+            .catch((action) => {
+              if (action == 'cancel') {
+                item.statusStr = '缺料';
+                this.updatePreRelease(item);
+              }
             });
         } else {
           const list = [this.itemData];
           this.$refs.kittingCompleteRef.open(list);
         }
       },
-
-      getNowDate() {
-        const now = new Date();
-        const year = now.getFullYear();
-        const month = String(now.getMonth() + 1).padStart(2, '0');
-        const day = String(now.getDate()).padStart(2, '0');
-        const hour = String(now.getHours()).padStart(2, '0');
-        const minute = String(now.getMinutes()).padStart(2, '0');
-        const second = String(now.getSeconds()).padStart(2, '0');
-
-        const currentTime = `${year}-${month}-${day} ${hour}:${minute}:${second}`;
-
-        return currentTime;
-      },
-
       taskAssignment() {
         this.dialogVisible = true;
       },
@@ -385,7 +399,7 @@
 
         await taskReleaseWork({
           ...this.form,
-          productionPlanId: this.itemData.id,
+          productionPlanId: this.itemData.productionPlanId || this.itemData.id,
           eventType: 1
         })
           .then(() => {
@@ -398,7 +412,7 @@
               remake: ''
             };
             this.dialogVisible = false;
-            this.reload();
+            // this.reload();
           })
           .catch(() => {
             loading.close();

+ 1 - 1
src/views/productionPlan/index.vue

@@ -429,7 +429,7 @@
 
     <processDetail ref="processDetailRef" />
 
-    <checkProductionPreparations ref="checkProductionPreparationsRef" />
+    <checkProductionPreparations ref="checkProductionPreparationsRef" type="plan" @update="reload" />
   </div>
 </template>
 

+ 21 - 3
src/views/workOrder/index.vue

@@ -172,6 +172,13 @@
           >
             拆单
           </el-link>
+          <el-link
+            type="primary"
+            :underline="false"
+            @click="productionPreparations(row)"
+          >
+            生产前准备
+          </el-link>
           <el-popconfirm
             class="ele-action"
             title="确定要删除此子单吗?"
@@ -204,6 +211,11 @@
     />
 
     <AssetsDialog ref="assetsRef" :treeIds="treeId"></AssetsDialog>
+    <checkProductionPreparations
+      ref="checkProductionPreparationsRef"
+      type="order"
+      @update="reload"
+    />
   </div>
 </template>
 
@@ -230,6 +242,9 @@
   import BatchDialog from '@/views/workOrder/components/batchDialog.vue';
   import Details from './components/details.vue';
   import AssetsDialog from './components/AssetsDialog.vue';
+  import checkProductionPreparations from '@/views/productionPlan/components/checkProductionPreparations.vue';
+  import { getProductPlanDetail } from '@/api/productionPlan/index';
+
   export default {
     mixins: [tabMixins],
     components: {
@@ -239,7 +254,8 @@
       releaseDialog,
       BatchDialog,
       Details,
-      AssetsDialog
+      AssetsDialog,
+      checkProductionPreparations
     },
     data() {
       return {
@@ -813,7 +829,7 @@
             {
               columnKey: 'action',
               label: '操作',
-              width: 200,
+              width: 260,
               align: 'center',
               resizable: false,
               fixed: 'right',
@@ -836,7 +852,9 @@
           // this.$forceUpdate();
         });
       },
-
+      productionPreparations(row) {
+        this.$refs.checkProductionPreparationsRef.open(row);
+      },
       // 下达
       toRelease(row) {
         this.current = row;