فهرست منبع

销售订单新增所属工厂

liuyi 1 سال پیش
والد
کامیت
d3e53e00f5

+ 28 - 1
src/views/saleOrder/components/create-order.vue

@@ -243,7 +243,24 @@
           </template>
         </el-table-column>
 
+        <el-table-column label="所属工厂" width="140" align="center" prop="factoriesId">
+          <template slot-scope="scope">
+            <el-form-item
+              label-width="0px"
+            >
 
+              <el-select v-model="scope.row.factoriesId" :key="scope.row.factoriesId" >
+                <el-option
+                  v-for="item of factoryList"
+                  :key="item.id"
+                  :label="item.name"
+                  :value="item.id"
+                ></el-option>
+              </el-select>
+
+            </el-form-item>
+          </template>
+        </el-table-column>
 
 
 
@@ -358,7 +375,7 @@
 import { getCode } from '@/api/codeManagement';
 import EquipmentDialog from '../components/EquipmentDialog.vue';
 import orderHomogeneityInspectDialog from "./orderHomogeneityInspectDialog";
-import { createOrUpdate, getOrderDetail , bomListByPlan, bomRoutingList} from '@/api/saleOrder';
+import { createOrUpdate, getOrderDetail , bomListByPlan, bomRoutingList, getFactoryList} from '@/api/saleOrder';
 
 import dayjs from 'dayjs';
 import { multiply } from '@/utils/math';
@@ -380,6 +397,7 @@ export default {
         productType: 2,
         bomCategoryId: '',
         produceRoutingId: '',
+        factoriesId: '',
         deliveryTime: dayjs(
           new Date().getTime() + 3600 * 1000 * 24 * 10
         ).format('YYYY-MM-DD')
@@ -408,6 +426,7 @@ export default {
 
 
       routingList: [],
+      factoryList: [],
 
 
       title: '创建订单',
@@ -436,9 +455,16 @@ export default {
     }
   },
   created() {},
+  mounted() {
+    this.getFactoryList();
+  },
   methods: {
+    async getFactoryList(){
+      this.factoryList = await getFactoryList();
+    },
     open(row) {
       this.visible = true;
+      console.log('entry,,,,,,,,,,,,,', row);
       if (row) {
         this.title = '修改订单';
         this.getDetail(row.code);
@@ -584,6 +610,7 @@ export default {
           return this.$message.warning('产品列表不能为空!');
         }
         this.loading = true;
+        console.log(this.form);
         createOrUpdate(this.form)
           .then((res) => {
             this.loading = false;

+ 11 - 1
src/views/saleOrder/components/order-search.vue

@@ -534,6 +534,12 @@
         const orderType = this.selection[0].orderType;
         const produceRoutingId = this.selection[0].produceRoutingId;
         const measuringUnit = this.selection[0].measuringUnit;
+        const factoriesId = this.selection[0].factoriesId;
+
+        if(!factoriesId){
+          this.$message.warning('工厂未选择!');
+          return;
+        }
 
         for (var i = 0; i < this.selection.length; i++) {
           if (productCode != this.selection[i].productCode) {
@@ -548,6 +554,9 @@
           if (measuringUnit != this.selection[i].measuringUnit) {
             return this.$message.warning('计量单位不一致!');
           }
+          if (factoriesId != this.selection[i].factoriesId) {
+            return this.$message.warning('所属工厂不一致!');
+          }
         }
         const list = [];
         this.selection.map((item) => {
@@ -558,7 +567,8 @@
           query: {
             selection: JSON.stringify(list),
             produceRoutingId: produceRoutingId,
-            produceRoutingName: this.selection[0].produceRoutingName
+            produceRoutingName: this.selection[0].produceRoutingName,
+            factoriesId: factoriesId,
           }
         });
       },

+ 74 - 46
src/views/saleOrder/salesToProduction.vue

@@ -88,7 +88,7 @@
           </el-col> -->
 
 
-   
+
 
         </el-row>
         <el-row :gutter="24">
@@ -140,7 +140,7 @@
             </el-form-item>
           </el-col>
 
-          
+
           <el-col v-bind="styleResponsive ?  { lg: 5, md: 10 } : { span: 5 }">
             <el-form-item label="计划结束日期:" prop="endTime">
               <el-date-picker
@@ -160,12 +160,30 @@
             </el-form-item>
           </el-col>
 
+          <el-col v-bind="styleResponsive ? { lg: 5, md: 10 } : { span: 5 }">
+            <el-form-item label="所属工厂:" prop="factoriesId">
+              <el-select v-model="form.factoriesId" style="width: 100%" >
+                <el-option
+                  v-for="item of factoryList"
+                  :key="item.id"
+                  :label="item.name"
+                  :value="item.id"
+                ></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
 
 
 
 
 
+
+        </el-row>
+
+        <el-row>
+
         </el-row>
+
         <el-row :gutter="24" class="row-intro">
           <el-col v-bind="styleResponsive ? { lg: 3, md: 12 } : { span: 3 }">
             <el-form-item label="销售单数量:">{{ form.codeNum }}</el-form-item>
@@ -195,7 +213,7 @@
           <el-col v-bind="styleResponsive ?  { lg: 4, md: 12 } : { span: 3 }">
             <el-form-item label="规格:">{{ form.specification }}</el-form-item>
           </el-col>
-<!-- 
+<!--
           <el-col v-bind="styleResponsive ? { lg: 3, md: 12 } : { span: 3 }">
             <el-form-item label="库存数量:">{{
               form.stockCountBase
@@ -466,22 +484,22 @@
                   :pickerOptions="{
                     disabledDate: (time) =>
                       time.getTime() <
-                      new Date(new Date().setHours(0, 0, 0, 0)).getTime() 
-              
+                      new Date(new Date().setHours(0, 0, 0, 0)).getTime()
+
                   }"
                   type="date"
                   placeholder="选择日期"
                   value-format="yyyy-MM-dd"
                 >
                 </el-date-picker>
-   
+
               </el-form-item>
             </template>
           </el-table-column>
 
 
 
- 
+
           <el-table-column label="客户名称" align="center" prop="customerName">
           </el-table-column>
           <el-table-column label="业务员" align="center" prop="salesman">
@@ -584,7 +602,8 @@ import {
   getInventory,
   getUpdateInfoById,
   bomRoutingList,
-  bomListByPlan
+  bomListByPlan,
+  getFactoryList,
 } from '@/api/saleOrder';
 
 import { getByCode } from '@/api/system/dictionary-data';
@@ -633,12 +652,14 @@ export default {
         batchNo: null,
         produceType: 2,
         bomCategoryId: '',
+        factoriesId: '',
       },
 
       marginList: [],
 
       bomVersionList: [],
       routingList: [],
+      factoryList: [],
 
       // 表单验证规则
       rules: {
@@ -653,7 +674,9 @@ export default {
         bomCategoryId: [
           { required: true, message: '请选择BOM版本', trigger: 'blur' }
         ],
-
+        factoriesId: [
+          { required: true, message: '请选择所属工厂', trigger: 'blur' }
+        ],
       },
       // selection: [],
       loading: false
@@ -674,6 +697,7 @@ export default {
     this.requestDict('订单类型');
     this.requestDict('交付要求');
     this.getByCodeFn();
+    this.getFactoryList();
     if (this.type == 'edit') {
       this.getPlanInfo(this.$route.query.id);
 
@@ -683,8 +707,9 @@ export default {
     }
   },
   methods: {
-
-
+    async getFactoryList(){
+      this.factoryList = await getFactoryList();
+    },
     async getPlanInfo(id) {
       const data = await getUpdateInfoById(id);
       this.form = data;
@@ -693,7 +718,7 @@ export default {
         this.bomListVersion()
         this.getPlanRouting()
       }
-     
+
 
 
     },
@@ -716,7 +741,7 @@ export default {
       });
     },
 
- 
+
     getPlanRouting() {
       bomRoutingList(this.form.bomCategoryId).then((res) => {
         this.routingList = res || []
@@ -795,6 +820,9 @@ export default {
           res.produceRoutingName || this.$route.query.produceRoutingName;
         this.form.produceRoutingId =
           res.produceRoutingId || this.$route.query.produceRoutingId;
+        this.form.factoriesId =
+          res.factoriesId || this.$route.query.factoriesId;
+        console.log(this.form.factoriesId)
         if (this.clientEnvironmentId == '4') {
           if (this.form.salesOrders[0].productName.includes('板材')) {
             this.changeProduct({
@@ -1042,7 +1070,7 @@ export default {
       }
 
       row.requiredFormingNum =Number(row.planProductNum *  (this.form.marginCoefficient || 1)).toFixed(5);
- 
+
     },
     confirmChoose(list) {
       // 取出在弹窗中选中并且不在表格中的数据
@@ -1131,38 +1159,38 @@ export default {
               if (this.$route.query.type == 'edit') {
                 data.workOrder.productionPlanId = params.id;
               }
-
-              await releaseSave(data)
-                .then((res) => {
-                  if (res === 1) {
-                    this.$message.success('工单已发布!');
-                    this.$router.push({
-                      path: '/productionPlan'
-                    });
-                  } else {
-                    this.$confirm(
-                      '生产计划创建成功,但工单发布失败。请前往【生产计划】列表【重新发布】工单',
-                      '提示',
-                      {
-                        confirmButtonText: '返回',
-                        cancelButtonText: '立即前往',
-                        type: 'warning'
-                      }
-                    )
-                      .then(() => {
-                        this.$router.push({
-                          path: '/productionPlan'
-                        });
-                      })
-                      .catch(() => {
-                        this.$router.go(-1);
-                      });
-                  }
-                  removePageTab({ key });
-                })
-                .catch(() => {
-                  this.$message.error('发布失败,请重新发布!');
-                });
+              console.log(data);
+              // await releaseSave(data)
+              //   .then((res) => {
+              //     if (res === 1) {
+              //       this.$message.success('工单已发布!');
+              //       this.$router.push({
+              //         path: '/productionPlan'
+              //       });
+              //     } else {
+              //       this.$confirm(
+              //         '生产计划创建成功,但工单发布失败。请前往【生产计划】列表【重新发布】工单',
+              //         '提示',
+              //         {
+              //           confirmButtonText: '返回',
+              //           cancelButtonText: '立即前往',
+              //           type: 'warning'
+              //         }
+              //       )
+              //         .then(() => {
+              //           this.$router.push({
+              //             path: '/productionPlan'
+              //           });
+              //         })
+              //         .catch(() => {
+              //           this.$router.go(-1);
+              //         });
+              //     }
+              //     removePageTab({ key });
+              //   })
+              //   .catch(() => {
+              //     this.$message.error('发布失败,请重新发布!');
+              //   });
             } catch (error) {}
 
             loading.close();