ysy 1 rok temu
rodzic
commit
0101850858

+ 9 - 1
src/api/materialPlan/index.js

@@ -88,7 +88,7 @@ export async function getMaterialList(data) {
 //   return Promise.reject(new Error(res.data.message));
 // }
 
-
+// 销售订单
 export async function listBomBySalesOrderIdsOverride(data) {
   const res = await request.post(`/aps/batchingplandetail/listBomBySalesOrderIdsOverride`,data);
   if (res.data.code == 0) {
@@ -97,6 +97,14 @@ export async function listBomBySalesOrderIdsOverride(data) {
   return Promise.reject(new Error(res.data.message));
 }
 
+// 生产订单
+export async function listBomByPlanIdsOverride(data) {
+  const res = await request.post(`/aps/batchingplandetail/listBomByPlanIdsOverride`,data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
 
 
 // 根据销售订单计算bom列表信息

+ 33 - 15
src/views/materialPlan/components/plan-edit-dialog.vue

@@ -19,6 +19,7 @@
       <el-row :gutter="24">
         <el-col :span="8">
           <el-form-item label="需求类型" prop="demandType">
+          
             <el-select
               v-model="formData.demandType"
               placeholder="请选择"
@@ -527,18 +528,34 @@
           ]
         },
         formData: {
+          demandType: '',
           name: '',
           remark: '',
           detailRemoveIds: [],
-          materialRemoveIds: []
-        },
+          materialRemoveIds: [],
+          orderType: 1
 
-        demandTypeList: []
+        },
+        demandTypeList: [
+      
+            {
+              dictCode: '1',
+              dictValue: '生产性物资采购'
+            },
+            {
+              dictCode: '6',
+              dictValue: '外协自供料采购'
+            },
+            {
+              dictCode: '7',
+              dictValue: '外协客供料采购'
+            }
+       
+        ]
+   
       };
     },
-    created() {
-
-    },
+    created() {},
 
     methods: {
       async open(type, row) {
@@ -558,20 +575,21 @@
       typeList() {
         this.requestDict('需求类型').then((res) => {
           console.log(res, 999);
-          this.demandTypeList = [];
-          res.forEach((f) => {
-            console.log(f.dictCode);
-            if (f.dictCode == 1 || f.dictCode == 6 || f.dictCode == 7) {
-              this.demandTypeList.push(f);
-            }
-          });
-
-          this.$forceUpdate();
+          // this.demandTypeList = [];
+          // res.forEach((f) => {
+
+          //   if (f.dictCode == 1 || f.dictCode == 6 || f.dictCode == 7) {
+          //     this.demandTypeList.push(f);
+          //   }
+          // });
+ 
+          // this.$forceUpdate();
         });
       },
 
       getDetail(id) {
         getById(id).then((res) => {
+          this.$set(this.formData, 'demandType',  res.demandType);
           this.$set(this.formData, 'name', res.name);
           this.$set(this.formData, 'remark', res.remark);
           this.formData['id'] = res.id;

+ 32 - 17
src/views/materialPlan/components/producePlan.vue

@@ -275,7 +275,7 @@
     import produceOrder from './produceOrder.vue';
     import ProductModal from './ProductModal.vue';
     import {
-      listBomBySalesOrderIds,
+      listBomByPlanIdsOverride,
       listBomBySalesOrderId,
       save,
       getById
@@ -533,10 +533,24 @@
             name: '',
             remark: '',
             detailRemoveIds: [],
-            materialRemoveIds: []
+            materialRemoveIds: [],
+            orderType: 2
           },
   
-          demandTypeList: []
+          demandTypeList: [
+          {
+              dictCode: '1',
+              dictValue: '生产性物资采购'
+            },
+            {
+              dictCode: '6',
+              dictValue: '外协自供料采购'
+            },
+            {
+              dictCode: '7',
+              dictValue: '外协客供料采购'
+            }
+          ]
         };
       },
   
@@ -558,21 +572,22 @@
         },
   
         typeList() {
-          this.requestDict('需求类型').then((res) => {
-          this.demandTypeList = [];
-          res.forEach((f) => {
-            console.log(f.dictCode);
-            if (f.dictCode == 1 || f.dictCode == 6 || f.dictCode == 7) {
-              this.demandTypeList.push(f);
-            }
-          });
+        //   this.requestDict('需求类型').then((res) => {
+        //   this.demandTypeList = [];
+        //   res.forEach((f) => {
+        //     console.log(f.dictCode);
+        //     if (f.dictCode == 1 || f.dictCode == 6 || f.dictCode == 7) {
+        //       this.demandTypeList.push(f);
+        //     }
+        //   });
 
-          this.$forceUpdate();
-        });
+        //   this.$forceUpdate();
+        // });
         },
   
         getDetail(id) {
           getById(id).then((res) => {
+            this.$set(this.formData, 'demandType',  res.demandType);
             this.$set(this.formData, 'name', res.name);
             this.$set(this.formData, 'remark', res.remark);
             this.formData['id'] = res.id;
@@ -647,16 +662,16 @@
 
   
         chooseOrder(list) {
-          let salesOrderIds = [];
+          let planIds = [];
           list.map((m) => {
-            salesOrderIds.push(m.id);
+            planIds.push(m.id);
             return {
               ...m
             };
           });
   
-          if (salesOrderIds.length > 0) {
-            listBomBySalesOrderIds({ salesOrderIds: salesOrderIds }).then(
+          if (planIds.length > 0) {
+            listBomByPlanIdsOverride({ planIds: planIds }).then(
               (res) => {
                 res.forEach((m) => {
                   if (m.materialList.length > 0) {

+ 25 - 7
src/views/materialPlan/index.vue

@@ -37,6 +37,13 @@
           </span>
         </template>
 
+        <template v-slot:orderType="{ row }">
+          <span >
+            {{ row.orderType == 1 ? '销售计划' : row.orderType ==  2  ?'生产计划' : '' }}
+          </span>
+        </template>
+
+
         <template v-slot:approvalStatus="{ row }">
           <el-link
             type="primary"
@@ -77,7 +84,7 @@
       </ele-pro-table>
     </el-card>
     <planEditDialog ref="planEditDialogRef" @success="reload" />
-    <producePlan ref="produceRef"></producePlan>
+    <producePlan ref="produceRef"></producePlan @success="reload">
 
     <detail ref="detailRef"></detail>
   </div>
@@ -166,6 +173,14 @@
             action: 'approvalStatus'
           },
 
+          {
+            prop: 'orderType',
+            label: '来源类型',
+            align: 'center',
+            slot: 'orderType',
+            action: 'orderType'
+          },
+
           {
             prop: 'createUserName',
             label: '创建人',
@@ -214,7 +229,12 @@
         });
       },
       handleEdit(type, row) {
-        this.$refs.planEditDialogRef.open(type, row);
+        if(row.orderType == 1) {
+          this.$refs.planEditDialogRef.open(type, row);
+        } else  if(row.orderType == 2) {
+          this.$refs.produceRef.open(type, row);
+        }
+        
       },
       handleDel({ id }) {
         this.$confirm('确认删除当前数据!', '提示').then(async () => {
@@ -226,11 +246,11 @@
 
       handleClick(tab) {
         if(tab == 1) {
-          this.handleEdit('add')
+          this.$refs.planEditDialogRef.open('add');
         
         }
         else if(tab == 2){
-          this.produceAdd('add')
+          this.$refs.produceRef.open('add');
         }
       },
 
@@ -247,9 +267,7 @@
         this.$refs.searchRef.reset();
       },
 
-      produceAdd(type, row) {
-        this.$refs.produceRef.open(type, row);
-      },
+    
 
       /* 刷新表格 */
       reload(where = {}) {