ysy 1 жил өмнө
parent
commit
06965b32f1

+ 10 - 0
src/api/produce/feeding.js

@@ -20,5 +20,15 @@ export async function batchSave(data) {
       }
     return Promise.reject(new Error(res.data.message));
   }
+
+
+  export async function feedGetCache(data) {
+    const res = await request.post(`/pda/mes/feed/getCache`, data);
+    if (res.data.code == 0) {
+        return res.data.data;
+      }
+    return Promise.reject(new Error(res.data.message));
+  }
+  
   
  

+ 94 - 57
src/views/produce/components/feeding/index.vue

@@ -4,9 +4,7 @@
       <el-button type="primary" size="mini" @click="save(2)"
         >一键投料(报工)</el-button
       >
-      <el-button type="primary" size="mini" 
-        >清空缓存</el-button
-      >
+      <el-button type="primary" size="mini">清空缓存</el-button>
       <el-button type="primary" size="mini" @click="save(1)">缓存</el-button>
     </div>
 
@@ -99,7 +97,11 @@
 
 <script>
   import { workorderList } from '@/api/produce/workOrder';
-  import { batchSave, feedSaveCache } from '@/api/produce/feeding';
+  import {
+    batchSave,
+    feedSaveCache,
+    feedGetCache
+  } from '@/api/produce/feeding';
 
   import pickingList from '../picking/pickingList.vue';
 
@@ -157,71 +159,77 @@
     },
     data() {
       return {
-        List: []
+        List: [],
+        idsList: []
       };
     },
 
     methods: {
       getList(ids) {
+        this.idsList = ids || [];
         let param = {
           ids: ids,
           taskId: this.taskObj.id
         };
-        workorderList(param).then((res) => {
-          this.List = res.map((m) => {
-            m.workOrderId = m.id;
-            m.paramDetailList = [];
-
-            m.instanceList = []; // 物料
-            m.equipmentList = []; // 设备
-            m.modelList = []; // 模具
-            m.aridRegionList = []; // 干燥区
-            m.packingList = []; // 包装
-            m.palletList = []; // 舟皿
-            m.revolvingDiskList = []; // 周转盘
-            m.semiProductList = []; //半成品
-
-            if (m.pickOutInList.length > 0) {
-              m.pickOutInList.forEach((f) => {
-                if (f.rootCategoryLevelId == 1) {
-                  m.instanceList.push(f);
-                } else if (f.rootCategoryLevelId == 4) {
-                  m.modelList.push(f);
-                } else if (f.rootCategoryLevelId == 5) {
-                  m.modelList.push(f);
-                } else if (f.rootCategoryLevelId == 11) {
-                  m.aridRegionList.push(f);
-                } else if (f.rootCategoryLevelId == 13) {
-                  m.packingList.push(f);
-                } else if (f.rootCategoryLevelId == 8) {
-                  m.palletList.push(f);
-                } else if (f.rootCategoryLevelId == 26) {
-                  m.revolvingDiskList.push(f);
-                } else if (
-                  [23, 2, 9, 28].includes(Number(f.rootCategoryLevelId))
-                ) {
-                  m.semiProductList.push(f);
-                }
-              });
-            }
+        workorderList(param)
+          .then((res) => {
+            this.List = res.map((m) => {
+              m.workOrderId = m.id;
+              m.paramDetailList = [];
+
+              m.instanceList = []; // 物料
+              m.equipmentList = []; // 设备
+              m.modelList = []; // 模具
+              m.aridRegionList = []; // 干燥区
+              m.packingList = []; // 包装
+              m.palletList = []; // 舟皿
+              m.revolvingDiskList = []; // 周转盘
+              m.semiProductList = []; //半成品
+
+              if (m.pickOutInList.length > 0) {
+                m.pickOutInList.forEach((f) => {
+                  if (f.rootCategoryLevelId == 1) {
+                    m.instanceList.push(f);
+                  } else if (f.rootCategoryLevelId == 4) {
+                    m.modelList.push(f);
+                  } else if (f.rootCategoryLevelId == 5) {
+                    m.modelList.push(f);
+                  } else if (f.rootCategoryLevelId == 11) {
+                    m.aridRegionList.push(f);
+                  } else if (f.rootCategoryLevelId == 13) {
+                    m.packingList.push(f);
+                  } else if (f.rootCategoryLevelId == 8) {
+                    m.palletList.push(f);
+                  } else if (f.rootCategoryLevelId == 26) {
+                    m.revolvingDiskList.push(f);
+                  } else if (
+                    [23, 2, 9, 28].includes(Number(f.rootCategoryLevelId))
+                  ) {
+                    m.semiProductList.push(f);
+                  }
+                });
+              }
 
-            // 处理字段
-            m.quality == '' ? (m.quality = {}) : '';
+              // 处理字段
+              m.quality == '' ? (m.quality = {}) : '';
 
-            if (!Object.prototype.hasOwnProperty.call(m, 'product')) {
-              m.product = '{}';
-            }
+              if (!Object.prototype.hasOwnProperty.call(m, 'product')) {
+                m.product = '{}';
+              }
 
-            delete m.id;
-            if (this.taskObj.id) {
-              m.taskId = this.taskObj.id;
-              m.taskName = this.taskObj.name;
-            }
-            return {
-              ...m
-            };
+              delete m.id;
+              if (this.taskObj.id) {
+                m.taskId = this.taskObj.id;
+                m.taskName = this.taskObj.name;
+              }
+              return {
+                ...m
+              };
+            });
+          })
+          .finally(() => {
+            this.getCacheFn();
           });
-        });
 
         this.$forceUpdate();
       },
@@ -279,6 +287,36 @@
         });
       },
 
+      getCacheFn() {
+        let parma = {
+          workOrderIds: this.idsList,
+          taskId: this.taskObj.id,
+          type: 2
+        };
+
+        feedGetCache(parma).then((res) => {
+          if (res.length == 0) {
+            return false;
+          }
+          let objList = res[0].extInfo.objList;
+          this.List.forEach((f) => {
+            objList.forEach((o) => {
+              if (f.workOrderId == o.workOrderId && f.taskId == o.taskId) {
+                f['instanceList'] = o.instanceList || [];
+                f['equipmentList'] = o.equipmentList || [];
+                f['modelList'] = o.modelList || [];
+                f['aridRegionList'] = o.aridRegionList || [];
+                f['packingList'] = o.packingList || [];
+                f['palletList'] = o.palletList || [];
+                f['revolvingDiskList'] = o.revolvingDiskList || [];
+                f['semiProductList'] = o.semiProductList || [];
+                this.$forceUpdate();
+              }
+            });
+          });
+        });
+      },
+
       async save(type) {
         this.List.forEach((f) => {
           f.instanceList.forEach((e) => {
@@ -301,7 +339,6 @@
       },
 
       checkCache(type) {
-       
         return new Promise((resolve) => {
           if (type == 1) {
             feedSaveCache(this.List).then((rr) => {

+ 42 - 52
src/views/produce/components/picking/pickingList.vue

@@ -65,7 +65,7 @@
             </template>
 
             <template v-slot:code="{ row }">
-          {{ row.rootCategoryLevelId == 4 ? row.codeNumber : row.code }}
+              {{ row.rootCategoryLevelId == 4 ? row.codeNumber : row.code }}
             </template>
 
             <template v-slot:runStatus="{ row }">
@@ -401,6 +401,7 @@
         };
         if (this.isType == 'pick') {
           param.dimension = 1;
+          console.log(888, param);
           URL = pageeLedgerMain;
         } else if (this.isType == 'feed') {
           if ([4, 7, 14].includes(Number(this.rootCategoryLevelId))) {
@@ -417,57 +418,45 @@
           }
         }
 
-        if (this.isCategory) {
-          return URL(param);
-        } else {
-          const res = await URL({
-            ...where,
-            pageNum: page,
-            categoryLevelId: this.categoryLevelId,
-            size: limit
+        const res = await URL(param);
+
+        if (this.rootCategoryLevelId == '11') {
+          let _res = res;
+          let _list = [];
+          _res.list.forEach((e) => {
+            if (e.aridRegionList && e.aridRegionList.length != 0) {
+              e.aridRegionList.map((i) => {
+                let obj = {
+                  name: e.name,
+                  region: e.extInfo.region,
+                  rootCategoryLevelId: e.rootCategoryLevelId,
+                  ...i,
+                  instanceId: i.id
+                };
+                _list.push(obj);
+              });
+            }
           });
-
-          if (this.rootCategoryLevelId == '11') {
-            let _res = res
-            let _list = []
-            _res.list.forEach(e => {
-							if (e.aridRegionList && e.aridRegionList.length != 0) {
-								e.aridRegionList.map(i => {
-									let obj = {
-										name: e.name,
-										region: e.extInfo.region,
-										rootCategoryLevelId: e.rootCategoryLevelId,
-										...i,
-										instanceId: i.id,
-									}
-									_list.push(obj)
-
-								})
-							}
-						})
-            res.list = _list
-            return res;
-
-          } else {
-            let _res = res
-            let _list = []
-
-            _list.push(
-							..._res.list.map(i => {
-								const warehouseId = i.pathIds && i.pathIds.split(',')[0]
-
-								return {
-									warehouseId,
-									...i,
-									instanceId: i.id,
-								}
-							})
-						)
-
-
-            res.list = _list
-            return res;
-          }
+          res.list = _list;
+          return res;
+        } else {
+          let _res = res;
+          let _list = [];
+
+          _list.push(
+            ..._res.list.map((i) => {
+              const warehouseId = i.pathIds && i.pathIds.split(',')[0];
+
+              return {
+                warehouseId,
+                ...i,
+                instanceId: i.id
+              };
+            })
+          );
+
+          res.list = _list;
+          return res;
         }
       },
 
@@ -534,8 +523,9 @@
             ...item.revolvingDiskList,
             ...item.semiProductList
           ];
-
+          this.allSelection = feedList || [];
           this.visible = true;
+
           this.$nextTick(() => {
             feedList.forEach((item) => {
               this.$refs.table.toggleRowSelection(item, true);