ysy 2 lat temu
rodzic
commit
ff8ad3bdcd

+ 10 - 0
src/api/materialPlan/index.js

@@ -97,3 +97,13 @@ export async function listBomBySalesOrderIds(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+
+// 根据销售订单计算bom列表信息
+export async function listBomBySalesOrderId(data) {
+  const res = await request.post(`/aps/batchingplandetail/listBomBySalesOrderId`,data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 58 - 9
src/views/materialPlan/components/plan-edit-dialog.vue

@@ -38,6 +38,13 @@
           <el-input placeholder="备注" v-model="row.remark"></el-input>
         </template>
 
+        <template v-slot:productionPlanId="{ row }">
+          <el-link type="primary" v-if="!row.productionPlanId" :underline="false"
+            @click.native="openVersion(row)">获取物料</el-link>
+        </template>
+
+
+
         <template v-slot:action="{ row, $index }">
           <template>
             <el-link type="primary" :underline="false" @click="categorySelect(row)">
@@ -114,6 +121,8 @@
 
     <ProductModal ref="productRefs" @chooseModal="chooseModal" />
 
+    <ProductionVersion ref="versionRefs" @changeProduct="changeProduct"></ProductionVersion>
+
   </ele-modal>
 </template>
 
@@ -121,12 +130,13 @@
 
 import saleOrderPop from './saleOrderPop.vue'
 import ProductModal from './ProductModal.vue'
-import { listBomBySalesOrderIds, save } from '@/api/materialPlan/index';
-
+import { listBomBySalesOrderIds, listBomBySalesOrderId, save } from '@/api/materialPlan/index';
+import ProductionVersion from '@/components/CreatePlan/ProductionVersion2.vue';
 export default {
   components: {
     saleOrderPop,
-    ProductModal
+    ProductModal,
+    ProductionVersion
 
 
   },
@@ -138,6 +148,8 @@ export default {
 
       tableData: [],
 
+      xsId: null,
+
 
       // 表格列配置
       columns: [
@@ -222,11 +234,21 @@ export default {
           minWidth: 110
         },
 
+        {
+          prop: 'productionPlanId',
+          label: '工艺路线物料',
+          slot: 'productionPlanId',
+
+          align: 'center',
+          minWidth: 110
+        },
+
+
 
         {
           columnKey: 'action',
           label: '操作',
-          width: 260,
+          width: 150,
           align: 'center',
           resizable: false,
           slot: 'action',
@@ -290,7 +312,7 @@ export default {
         {
           columnKey: 'action',
           label: '操作',
-
+          width: 70,
           align: 'center',
           resizable: false,
           slot: 'action',
@@ -311,6 +333,7 @@ export default {
       },
       formData: {
         materialName: '',
+        type: 1,
 
       },
 
@@ -377,6 +400,8 @@ export default {
       if (salesOrderIds.length > 0) {
         listBomBySalesOrderIds({ salesOrderIds: salesOrderIds }).then((res) => {
           this.$refs.table.setData([...this.tableData, ...res]);
+
+          this.$refs.table.toggleRowExpansionAll()
         })
       }
     },
@@ -439,12 +464,36 @@ export default {
 
 
 
-    chooseVersion() {
-      if (!this.formData.materialName) {
-        return this.$message.error('请选择物料');
+    openVersion(row) {
+      this.xsId = row.id
+      this.$refs.versionRefs.open();
+    },
+    changeProduct(data) {
+      let param = {
+        salesOrderIds: [this.xsId],
+        produceRoutingId: data.id
       }
 
-    }
+      listBomBySalesOrderId(param).then((res) => {
+
+
+        let tableList = []
+        tableList = this.$refs.table.getData()
+
+        tableList.forEach(e => {
+          if (e.id == this.xsId) {
+            e.materialList = res
+
+            this.$nextTick(() => {
+              this.$refs.table.setData([...tableList]);
+            this.$refs.table.toggleRowExpansionAll()
+            })
+          }
+        })
+
+      })
+
+    },
   }
 };
 </script>