소스 검색

生产计划

quwangxin 2 년 전
부모
커밋
d9d63fd52e

+ 36 - 17
src/api/saleOrder/index.js

@@ -1,16 +1,14 @@
 import request from '@/utils/request';
 
-
 // 批量导入文件
 export async function importFile (data) {
-  const res = await request.post('/aps/salesorder/importFile',data);
+  const res = await request.post('/aps/salesorder/importFile', data);
   if (res.data.code == 0) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
 }
 
-
 // 获取销售订单列表
 export async function getPageList (data) {
   const res = await request.post(`/aps/salesorder/page`, data);
@@ -22,7 +20,10 @@ export async function getPageList (data) {
 
 // 销售订单转生产计划
 export async function productionToPlan (data) {
-  const res = await request.post(`/aps/salesorder/productionPlanGenerator`, data);
+  const res = await request.post(
+    `/aps/salesorder/productionPlanGenerator`,
+    data
+  );
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -39,45 +40,63 @@ export async function productionToPlan (data) {
 //   return Promise.reject(new Error(res.data.message));
 // }
 
-// 刷新销售订单 
+// 刷新销售订单
 export async function pullSalesOrder (params) {
-  const res = await request.get( `/aps/salesorder/pullSalesOrder` );
+  const res = await request.get(`/aps/salesorder/pullSalesOrder`);
   if (res.data.code == 0) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
 }
 
-// 销售订单转生产计划保存 
+// 销售订单转生产计划保存
 export async function saveSaleToPlan (data) {
-  const res = await request.post( `/aps/productionplan/save`,data );
+  const res = await request.post(`/aps/productionplan/save`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// 销售订单转生产计划更新
+export async function updateSaleToPlan (data) {
+  const res = await request.put(`/aps/productionplan/update`, data);
   if (res.data.code == 0) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
 }
 
-//创建更新销售订单 
+//创建更新销售订单
 export async function createOrUpdate (data) {
-  const res = await request.post( `/aps/salesorder/createOrUpdate`,data );
+  const res = await request.post(`/aps/salesorder/createOrUpdate`, data);
   if (res.data.code == 0) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
 }
 
-// 获取生产版本 
+// 获取生产版本
 export async function getProductVersion (code) {
-  const res = await request.get( `/aps/productionplan/getProductVersion/${code}` );
+  const res = await request.get(
+    `/aps/productionplan/getProductVersion/${code}`
+  );
   if (res.data.code == 0) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
 }
 
-// 获取订单详情 
+// 获取订单详情
 export async function getOrderDetail (code) {
-  const res = await request.get( `/aps/salesorder/getByCode/${code}` );
+  const res = await request.get(`/aps/salesorder/getByCode/${code}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// 获取计划详情
+export async function getUpdateInfoById (id) {
+  const res = await request.get(`/aps/productionplan/getUpdateInfoById/${id}`);
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -85,10 +104,10 @@ export async function getOrderDetail (code) {
 }
 
 // 删除
-export async function deleteOrder(data) {
-  const res = await request.delete('/aps/salesorder/delete', {data});
+export async function deleteOrder (data) {
+  const res = await request.delete('/aps/salesorder/delete', { data });
   if (res.data.code == 0) {
     return res.data.message;
   }
   return Promise.reject(new Error(res.data.message));
-}
+}

+ 11 - 2
src/enum/dict.js

@@ -10,7 +10,7 @@ export default {
   金额单位: 'money_unit',
   时间单位: 'time_unit',
   订单来源: 'order_source',
-  订单类型 :'order_type',
+  订单类型: 'order_type',
   生产状态: 'production_status',
   按单按库: 'order_library',
   紧急程度: 'urgent_type',
@@ -18,4 +18,13 @@ export default {
   交付要求: 'require_ments'
 };
 
-export const numberList = ['urgent_type','patrol_cycle','order_library','order_type','require_ments','order_source','production_status'];
+export const numberList = [
+  'urgent_type',
+  'patrol_cycle',
+  'order_library',
+  'order_type',
+  'require_ments',
+  'order_source',
+  'production_status',
+  'plan_type'
+];

+ 4 - 6
src/router/index.js

@@ -10,13 +10,11 @@ import { getToken } from '@/utils/token-util';
 import { routes, getMenuRoutes } from './routes';
 import { SYSTEM_NAME } from '@/config/setting';
 
-
 Vue.use(VueRouter);
-	const originalPush = VueRouter.prototype.push
-	VueRouter.prototype.push = function push (location) {
-	  return originalPush.call(this, location).catch(err => err)
-	}
-
+// const originalPush = VueRouter.prototype.push
+// VueRouter.prototype.push = function push (location) {
+//   return originalPush.call(this, location).catch(err => err)
+// }
 
 const router = new VueRouter({
   base: window.__POWERED_BY_QIANKUN__

+ 39 - 14
src/views/materialPlan/components/plan-edit-dialog.vue

@@ -7,43 +7,49 @@
     <el-form :model="formData" label-width="100px" class="ele-body">
       <el-row :gutter="32">
         <el-col :span="12">
-          <el-form-item label="选择物料">
-            <el-input v-model="formData.aaa"></el-input>
+          <el-form-item label="选择物料" prop="materialName">
+            <el-input
+              v-model="formData.materialName"
+              @click.native="chooseMateriel"
+            ></el-input>
           </el-form-item>
         </el-col>
         <el-col :span="12">
-          <el-form-item label="生产版本">
-            <el-input v-model="formData.aaa"></el-input>
+          <el-form-item label="生产版本" prop="productVersionName">
+            <el-input
+              v-model="formData.productVersionName"
+              @click.native="chooseVersion"
+            ></el-input>
           </el-form-item>
         </el-col>
         <el-col :span="12">
-          <el-form-item label="牌号">
-            <el-input v-model="formData.aaa"></el-input>
+          <el-form-item label="牌号" prop="brandNo">
+            <el-input v-model="formData.brandNo"></el-input>
           </el-form-item>
         </el-col>
         <el-col :span="12">
-          <el-form-item label="工艺路线名称">
+          <el-form-item label="工艺路线名称" prop="brandNo">
             <el-input v-model="formData.aaa"></el-input>
           </el-form-item>
         </el-col>
         <el-col :span="12">
-          <el-form-item label="要求交付日期">
-            <el-input v-model="formData.aaa"></el-input>
+          <el-form-item label="要求交付日期" prop="deliveryTime">
+            <el-input v-model="formData.deliveryTime"></el-input>
           </el-form-item>
         </el-col>
         <el-col :span="12">
-          <el-form-item label="工艺路线版本">
+          <el-form-item label="工艺路线版本" prop="brandNo">
             <el-input v-model="formData.aaa"></el-input>
           </el-form-item>
         </el-col>
         <el-col :span="12">
-          <el-form-item label="生产重量">
-            <el-input v-model="formData.aaa"></el-input>
+          <el-form-item label="生产重量" prop="num">
+            <el-input v-model="formData.num"></el-input>
           </el-form-item>
         </el-col>
         <el-col :span="12">
-          <el-form-item label="计划备注">
-            <el-input v-model="formData.aaa"></el-input>
+          <el-form-item label="计划备注" prop="remark">
+            <el-input v-model="formData.remark"></el-input>
           </el-form-item>
         </el-col>
       </el-row>
@@ -53,11 +59,23 @@
       <el-button>取消</el-button>
       <el-button type="primary">确定</el-button>
     </div>
+
+    <!-- 选择物料 -->
+    <ChooseMaterial ref="chooseRef"></ChooseMaterial>
+    <!-- 选择生产版本 -->
+    <ProductionVersion ref="versionRef"></ProductionVersion>
   </ele-modal>
 </template>
 
 <script>
+  import ChooseMaterial from '@/components/CreatePlan/ChooseMaterial.vue';
+  import ProductionVersion from '@/components/CreatePlan/ProductionVersion.vue';
+
   export default {
+    components: {
+      ChooseMaterial,
+      ProductionVersion
+    },
     data () {
       return {
         visible: false,
@@ -70,6 +88,13 @@
         this.type = type;
         this.formData = row;
         this.visible = true;
+      },
+      chooseMateriel () {
+        this.$refs.chooseRef.open();
+      },
+
+      chooseVersion () {
+        this.$refs.versionRef.open();
       }
     }
   };

+ 11 - 10
src/views/productionPlan/components/plan-view.vue

@@ -168,9 +168,9 @@
         type: Object,
         default: () => ({})
       },
-      orderData: {
-        type: Object,
-        default: () => ({})
+      orderList: {
+        type: Array,
+        default: () => []
       }
     },
     data () {
@@ -239,11 +239,11 @@
       }
     },
     watch: {
-      orderData: {
+      orderList: {
         immediate: true,
         handler () {
-          if (this.orderData?.salesOrders?.length) {
-            this.tableData = this.orderData.salesOrders;
+          if (this.orderList?.length) {
+            this.tableData = this.orderList;
           }
         }
       }
@@ -253,7 +253,7 @@
       handleRelease () {
         this.$refs.formRef.validate((value) => {
           if (value) {
-            this.$confirm('发布工后不可撤回,确定发布吗?', '发布确认').then(
+            this.$confirm('发布工后不可撤回,确定发布吗?', '发布确认').then(
               async () => {
                 await release(this.tableData);
 
@@ -317,13 +317,14 @@
             deviceName: pre.name,
             executorId: '',
             executorName: '',
-            productionPlanId: this.infoData.id,
-            productionPlanCode: this.infoData.code,
             planCompleteTime: '', //当班下班时间,
             planStartTime: pre.planCompleteDate,
             planCompleteDate: pre.planCompleteDate,
             formingNum: pre.formingNum,
-            formingWeight: ''
+            formingWeight: '',
+            productionPlanId: this.infoData.id,
+            productionPlanCode: this.infoData.code,
+            produceVersionId: this.infoData.produceVersionId
           });
         }
       },

+ 9 - 6
src/views/productionPlan/workOrderPublish.vue

@@ -86,7 +86,7 @@
           </div>
         </div>
       </div> -->
-      <planView key="first" :infoData="infoData" :orderData="orderData" />
+      <planView key="first" :infoData="infoData" :orderList="orderList" />
       <!-- <el-tabs v-model="activeName" type="card">
         <el-tab-pane label="默认" name="first"
           ><planView key="first" :infoData="infoData"
@@ -146,7 +146,7 @@
           }
         ],
         infoData: {},
-        orderData: {},
+        orderList: [],
         planType: ['内销计划', '外销计划'],
         id: null
       };
@@ -165,7 +165,8 @@
       async getReleaseInfoById () {
         const data = await getReleaseInfoById(this.id);
 
-        this.orderData = data;
+        this.infoData = data;
+        this.orderList = data.workOrderList;
       }
     },
     created () {
@@ -173,9 +174,11 @@
 
       this.type = query.type;
       this.id = query.id;
-
-      this.getInfo();
-      this.getReleaseInfoById();
+      if (query.type == 2) {
+        this.getReleaseInfoById();
+      } else {
+        this.getInfo();
+      }
     }
   };
 </script>

+ 25 - 9
src/views/saleOrder/salesToProduction.vue

@@ -115,13 +115,13 @@
           <el-table-column
             label="计划生产数"
             align="center"
-            prop="productNum"
+            prop="planProductNum"
             width="120"
           >
             <template slot-scope="scope">
               <el-form-item
                 label-width="0px"
-                :prop="'salesOrders.' + scope.$index + '.productNum'"
+                :prop="'salesOrders.' + scope.$index + '.planProductNum'"
                 :rules="{
                   required: true,
                   message: '请输入计划生产数',
@@ -130,7 +130,7 @@
                 class="table-item"
               >
                 <el-input
-                  v-model.number="scope.row.productNum"
+                  v-model.number="scope.row.planProductNum"
                   size="small"
                   oninput="value=value.replace(/[^\d]/g,'')"
                   style="width: 100%"
@@ -295,7 +295,12 @@
   import AdditionalOrder from './components/AdditionalOrder.vue';
   import PlanSubmit from './components/plan-submit.vue';
   import ProductionVersion from '@/components/CreatePlan/ProductionVersion.vue';
-  import { productionToPlan, saveSaleToPlan } from '@/api/saleOrder';
+  import {
+    productionToPlan,
+    saveSaleToPlan,
+    updateSaleToPlan,
+    getUpdateInfoById
+  } from '@/api/saleOrder';
   import dictMixins from '@/mixins/dictMixins';
   import { deepClone } from '@/utils/index';
   import { finishPageTab, reloadPageTab } from '@/utils/page-tab-util';
@@ -333,6 +338,7 @@
       this.requestDict('订单类型');
       this.requestDict('交付要求');
       if (this.$route.query.type == 'edit') {
+        this.getPlanInfo(this.$route.query.id);
       } else {
         this.selection = JSON.parse(this.$route.query.selection);
         const list = [];
@@ -343,6 +349,11 @@
       }
     },
     methods: {
+      async getPlanInfo (id) {
+        const data = await getUpdateInfoById(id);
+        this.form = data;
+        console.log(data);
+      },
       getSaleInfo (params) {
         productionToPlan(params).then((res) => {
           this.form = deepClone(res);
@@ -458,22 +469,27 @@
         this.changeData();
       },
       changeData () {
-        var productNum = 0;
+        var planProductNum = 0;
         var productWeight = 0;
         this.form.salesOrders.map((item, index) => {
           item.priority = index + 1;
-          productNum = productNum + item.contractNum;
+          planProductNum = planProductNum + item.contractNum;
           productWeight = productWeight + Number(item.productSumWeight);
         });
         this.$set(this.form, 'codeNum', this.form.salesOrders.length);
-        this.$set(this.form, 'contractNum', productNum);
+        this.$set(this.form, 'contractNum', planProductNum);
         this.$set(this.form, 'sumOrderWeight', productWeight.toFixed(2));
       },
 
       publishData (type) {
         let params = deepClone(this.form);
-        delete params.id;
-        saveSaleToPlan(params).then((res) => {
+        let request =
+          this.$route.query.type == 'edit' ? updateSaleToPlan : saveSaleToPlan;
+        if (this.$route.query.type != 'edit') {
+          delete params.id;
+        }
+
+        request(params).then((res) => {
           // reloadPageTab({ fullPath: '/saleOrder' });
           if (type == 1) {
             // 提交