Jelajahi Sumber

领料成功

ysy 1 tahun lalu
induk
melakukan
ebf0125013

+ 1 - 1
src/api/produce/workOrder.js

@@ -50,7 +50,7 @@ export async function treeByPid(data) {
 // 根据工单ids获取工单列表
 
 export async function workorderList(data) {
-  const res = await request.post('/pda/mes/workorder/list', data);
+  const res = await request.post('/mes/workorder/list', data);
   if (res.data.code == 0) {
     return res.data.data;
   }

+ 16 - 4
src/views/produce/components/picking/details.vue

@@ -5,13 +5,25 @@
 </template>
 
 <script>
-import { pickDetails } from '@/api/produce/picking'
+  import { pickDetails } from '@/api/produce/picking';
   export default {
     name: 'picking-details',
     data() {
-      return {};
+      return {
+        dataList: []
+      };
     },
-    methods: {},
-    created() {}
+    methods: {
+      getList(workListIds) {
+        pickDetails(workListIds).then(res => {
+          console.log(99,res);
+          this.dataList = res.data || [];
+
+        })
+      },
+    },
+    created() {
+
+    }
   };
 </script>

+ 65 - 8
src/views/produce/components/picking/index.vue

@@ -80,11 +80,36 @@
 
             <el-table-column label="编码" prop="assetCode">
               <template slot-scope="{ row, $index }">
-                {{ row.rootCategoryLevelId == 4 ? row.codeNumber : row.code }}
+                <span
+                  v-if="
+                    Object.prototype.hasOwnProperty.call(row, 'isBom') &&
+                    row.isBom == 1
+                  "
+                  style="color: #faad14"
+                >
+                  {{ row.categoryCode }}
+                </span>
+                <span>
+                  {{
+                    row.rootCategoryLevelId == 4 ? row.codeNumber : row.code
+                  }}</span
+                >
               </template>
             </el-table-column>
 
-            <el-table-column label="名称" prop="name"> </el-table-column>
+            <el-table-column label="名称" prop="name">
+              <template slot-scope="{ row, $index }">
+                <span
+                  v-if="
+                    Object.prototype.hasOwnProperty.call(row, 'isBom') &&
+                    row.isBom == 1
+                  "
+                >
+                  {{ row.categoryName }}
+                </span>
+                <span> {{ row.name }}</span>
+              </template>
+            </el-table-column>
             <el-table-column label="型号" prop="modelType"> </el-table-column>
             <el-table-column label="规格" prop="specification">
             </el-table-column>
@@ -116,8 +141,21 @@
 
             <el-table-column label="领料仓库" prop="warehouseId">
               <template slot-scope="{ row, $index }">
-                <div v-if="row.warehouseList">
-                  <el-select></el-select>
+                <div
+                  v-if="
+                    Object.prototype.hasOwnProperty.call(row, 'isBom') &&
+                    row.isBom == 1
+                  "
+                >
+                  <el-select v-model="row.warehouseId" placeholder="请选择">
+                    <el-option
+                      v-for="item in row.warehouseList"
+                      :label="item.name"
+                      :value="item.id"
+                      :key="item.id"
+                    >
+                    </el-option>
+                  </el-select>
                 </div>
 
                 <div v-else>
@@ -194,7 +232,12 @@
           taskId: this.taskObj.id
         };
         workorderList(param).then((res) => {
-          this.workList = res;
+          let arr = res.map((e) => {
+            e.pickList = [...e.bomDetailDTOS];
+            e.bomDetailDTOS = [];
+            return e;
+          });
+          this.workList = arr;
           this.getOrderCode();
           this.$forceUpdate();
         });
@@ -229,6 +272,7 @@
       },
 
       save() {
+        console.log(this.workList);
         if (this.workList.length > 0) {
           let bol;
           let _i;
@@ -271,17 +315,30 @@
 
         let _arr = [];
         _arr = this.workList.map((m) => {
-          m.instanceList = m.pickList;
+          m.instanceList = [];
+          m.bomDetailDTOS = [];
+          m.pickList.forEach((e) => {
+            if (
+              Object.prototype.hasOwnProperty.call(e, 'isBom') &&
+              e.isBom == 1
+            ) {
+              m.bomDetailDTOS.push(e);
+            } else {
+              m.instanceList.push(e);
+            }
+          });
+
           m.workOrderId = m.id;
           delete m.id;
-          delete m.pickList;
+
           return {
             ...m
           };
         });
 
         batchSave(_arr).then((res) => {
-          console.log(res);
+          this.$message.success('领料成功');
+          this.handleClose();
         });
       }
     },

+ 23 - 13
src/views/produce/index.vue

@@ -13,7 +13,9 @@
           </div>
         </div>
         <div class="right_main">
-          <pickDetails></pickDetails>
+          <div v-if="operationType == 'pick'">
+            <pickDetails ref="pickListRef"></pickDetails>
+          </div>
         </div>
       </div>
       <footBtn @footBtn="footBtn"></footBtn>
@@ -67,20 +69,22 @@
 
       footBtn(t) {
         this.operationType = t;
-        if (t == 'pick') {
-          if (
-            Object.keys(this.$store.state.user.taskObj).length === 0 &&
-            this.$store.state.user.taskObj.constructor === Object
-          ) {
-            this.$message.warning('请选择工序');
-            return false;
-          }
 
+        if (
+          Object.keys(this.$store.state.user.taskObj).length === 0 &&
+          this.$store.state.user.taskObj.constructor === Object
+        ) {
+          this.$message.warning('请选择工序');
+          return false;
+        }
+
+        if (t == 'pick') {
           if (this.workListIds.length == 0) {
             this.$message.warning('请选择工单列表');
             return false;
           }
 
+          // this.$refs.pickListRef.getList(this.workListIds);
           this.pickingShow = true;
         }
       },
@@ -139,10 +143,14 @@
 
     min-width: 1280px !important;
     height: calc(100vh - 60px);
-    overflow-x: auto; /* 当内容超出宽度时,允许水平滚动 */
-    white-space: nowrap; /* 防止内部文本换行,确保所有内容都在一行显示 */
-    scrollbar-width: thin; /* 设置滚动条宽度(浏览器兼容性可能有所不同) */
-    scrollbar-color: #40a9ff transparent; /* 设置滚动条颜色和轨道颜色(同样,浏览器兼容性) */
+    overflow-x: auto;
+    /* 当内容超出宽度时,允许水平滚动 */
+    white-space: nowrap;
+    /* 防止内部文本换行,确保所有内容都在一行显示 */
+    scrollbar-width: thin;
+    /* 设置滚动条宽度(浏览器兼容性可能有所不同) */
+    scrollbar-color: #40a9ff transparent;
+    /* 设置滚动条颜色和轨道颜色(同样,浏览器兼容性) */
   }
 
   .main {
@@ -161,11 +169,13 @@
     justify-content: space-around;
     width: 49.4%;
     min-width: 640px;
+
     .top {
       width: 100%;
       height: calc((100vh - 70px - 50px - 80px - 20px) / 2);
       overflow: hidden;
     }
+
     .bottom {
       width: 100%;
       height: calc((100vh - 70px - 50px - 80px - 20px) / 2);