Bladeren bron

修改分厂计划

chencc 1 jaar geleden
bovenliggende
commit
5df30ff20f
3 gewijzigde bestanden met toevoegingen van 246 en 42 verwijderingen
  1. 239 39
      src/views/productionPlan/components/factoryAdd/index.vue
  2. 5 1
      src/views/saleOrder/salesToProduction.vue
  3. 2 2
      vue.config.js

+ 239 - 39
src/views/productionPlan/components/factoryAdd/index.vue

@@ -1,36 +1,37 @@
 <template>
   <!-- :close-on-click-modal="false" -->
-  <ele-modal width="80vw" :visible.sync="visible" custom-class="ele-dialog-form" :title="title" :maxable="true">
+  <ele-modal width="70vw" :visible.sync="visible" custom-class="ele-dialog-form" :title="title" :maxable="true">
     <div class="form-wrapper">
       <el-form ref="form" :model="form" :rules="rules" label-width="90px" class="formbox">
         <el-row :gutter="24">
-          <el-col :span="8">
+          <el-col :span="6">
             <el-form-item label="产品名称:" prop="productName">
               <el-input @click.native="handleAdd" placeholder="请选择物料" v-model="form.productName" size="mini"></el-input>
             </el-form-item>
           </el-col>
 
-          <el-col :span="8">
+          <el-col :span="6">
             <el-form-item label="编码:" prop="productCode">
               <el-input placeholder="" size="mini" disabled v-model="form.productCode"></el-input>
             </el-form-item>
           </el-col>
 
-          <el-col :span="8">
+          <el-col :span="6">
             <el-form-item label="牌号:" prop="brandNum">
               <el-input placeholder="" size="mini" disabled v-model="form.brandNum"></el-input>
             </el-form-item>
           </el-col>
-        </el-row>
-
-        <el-row :gutter="24">
-          <el-col :span="8">
+          <el-col :span="6">
             <el-form-item label="型号:" prop="modelType">
               <el-input placeholder="" size="mini" disabled v-model="form.modelType"></el-input>
             </el-form-item>
           </el-col>
 
-          <el-col :span="8">
+        </el-row>
+
+        <el-row :gutter="24">
+          
+          <el-col :span="6">
             <el-form-item label="规格:" prop="specification">
               <el-input placeholder="" size="mini" disabled v-model="form.specification"></el-input>
             </el-form-item>
@@ -40,7 +41,7 @@
         <headerTitle title="计划信息"> </headerTitle>
 
         <el-row :gutter="24">
-          <el-col :span="8">
+          <el-col :span="6">
             <el-form-item label="加工方式:" prop="produceType">
               <el-select v-model="form.produceType" style="width: 100%" @change="changeProduceType" size="mini">
                 <el-option v-for="item of producedList" :key="item.code" :label="item.name"
@@ -49,7 +50,7 @@
             </el-form-item>
           </el-col>
 
-          <el-col :span="8">
+          <el-col :span="6">
             <el-form-item label="BOM版本:" prop="bomCategoryId" v-if="clientEnvironmentId != 4">
               <el-select v-model="form.bomCategoryId" style="width: 100%" @change="changeBomId" size="mini">
                 <el-option v-for="item of bomVersionList" :key="item.id"
@@ -58,7 +59,7 @@
             </el-form-item>
           </el-col>
 
-          <el-col :span="8">
+          <el-col :span="6">
             <el-form-item label="工艺路线:" prop="produceRoutingId" v-if="clientEnvironmentId !== 4">
               <el-select v-model="form.produceRoutingId" style="width: 100%" @change="changeRoute" size="mini">
                 <el-option v-for="item of routingList" :key="item.id" :label="item.name" :value="item.id">
@@ -68,31 +69,78 @@
             </el-form-item>
           </el-col>
 
-          <el-col :span="8">
+          <el-col :span="6">
             <el-form-item label="工艺路线:" prop="produceRoutingId" v-if="clientEnvironmentId == 4">
-              <el-input v-model="form.produceRoutingName" style="width: 100%" readonly></el-input>
+              <el-input v-model="form.produceRoutingName" style="width: 100%" readonly size="mini"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label="生产数量:" prop="requiredFormingNum">
+              <el-input v-model.number="form.requiredFormingNum" @input="tableHandleKeyUp(form, 'sum')" size="mini"
+                oninput="value=value.replace(/[^\d]/g,'')" style="width: 100%" placeholder="输入数量">
+                <template slot="append">{{ form.measuringUnit }} </template>
+              </el-input>
             </el-form-item>
           </el-col>
-
         </el-row>
 
         <el-row :gutter="24">
-          <el-col :span="8">
-            <el-form-item label="生产数量:" prop="requiredFormingNum">
-              <el-input v-model.number="form.requiredFormingNum" size="mini" oninput="value=value.replace(/[^\d]/g,'')"
-                style="width: 100%" placeholder="输入数量">
-                <template slot="append">{{ form.measuringUnit }} </template>
+         
+        <div v-if="clientEnvironmentId==4">
+          <el-col :span="6">
+            <el-form-item label="模数:" prop="requiredFormingNum">
+              <el-input v-model.number="form.moCount" @input="tableHandleKeyUp(form, 'moCount')" size="mini"
+                oninput="value=value.replace(/[^\d]/g,'')" style="width: 100%" placeholder="输入模数">
+                <!-- <template slot="append">{{ form.measuringUnit }} </template> -->
               </el-input>
             </el-form-item>
           </el-col>
 
-          <el-col :span="8">
+          <el-col :span="6">
+            <el-form-item label="块数:" prop="requiredFormingNum">
+              <el-input v-model.number="form.blockCount" @input="tableHandleKeyUp(form, 'blockCount')" size="mini"
+                oninput="value=value.replace(/[^\d]/g,'')" style="width: 100%" placeholder="输入块数">
+                <!-- <template slot="append">{{ form.measuringUnit }} </template> -->
+              </el-input>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="6">
+            <el-form-item label="权重等级:" prop="weight">
+              <el-select v-model="form.weight" style="width: 100%" @change="changeProduceType" size="mini">
+                <el-option v-for="item of weightList" :key="item.code" :label="item.name"
+                  :value="item.code"></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label="是否开槽:" prop="isSlotting">
+              <el-select v-model="form.isSlotting" style="width: 100%" @change="changeProduceType" size="mini">
+                <el-option v-for="item of isSlotting" :key="item.code" :label="item.name"
+                  :value="item.code"></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="6" v-if="form.isSlotting == 1">
+            <el-form-item label="开槽类型:" prop="slottingType">
+              <DictSelection
+                dictName="开槽类型"
+                v-model="form.slottingType"
+                size="mini"
+              >
+              </DictSelection>
+            </el-form-item>
+          </el-col>
+        </div>
+
+
+          <el-col :span="6">
             <el-form-item label="批次号:" prop="batchNo">
               <el-input v-model="form.batchNo" size="mini" style="width: 100%" placeholder="输入批次号"></el-input>
             </el-form-item>
           </el-col>
 
-          <el-col :span="8">
+          <el-col :span="6">
             <el-form-item label="要求完成日期:" label-width="110px" prop="reqMoldTime">
               <el-date-picker style="width: 100%" size="mini" v-model="form.reqMoldTime" :pickerOptions="{
                 disabledDate: (time) =>
@@ -105,7 +153,7 @@
         </el-row>
 
         <el-row :gutter="24">
-          <el-col :span="8">
+          <el-col :span="6">
             <el-form-item label="计划开始日期:" label-width="110px" prop="startTime">
               <el-date-picker style="width: 100%" size="mini" v-model="form.startTime" :pickerOptions="{
                 disabledDate: (time) =>
@@ -116,7 +164,7 @@
             </el-form-item>
           </el-col>
 
-          <el-col :span="8">
+          <el-col :span="6">
             <el-form-item label="计划结束日期:" label-width="110px" prop="endTime">
               <el-date-picker style="width: 100%" size="mini" v-model="form.endTime" :pickerOptions="{
                 disabledDate: (time) =>
@@ -205,13 +253,27 @@ export default {
       visible: false,
       title: '',
       type: 3,
-
+      weightList: [
+        { code: 1, name: 'A' },
+        { code: 2, name: 'B' },
+        { code: 3, name: 'C' }
+      ],
+      isSlotting: [
+        { code: 1, name: '是' },
+        { code: 2, name: '否' }
+      ], //是否开槽
       loading: false,
       form: {
         timeDimensionPlanType: 3,
         categoryId: '',
         productName: '',
         planType: 1,
+        moCount: '', // 模具数量
+        blockCount: 0, // 块数
+        noWordCount: '',// 无字数量
+        weight:'',
+        isSlotting:'',//是否开槽
+        slottingType:'',//开槽类型
         id: '',
         produceType: 2,
         bomCategoryId: '',
@@ -262,7 +324,6 @@ export default {
     open() {
 
       this.visible = true;
-      console.log(this.clientEnvironmentId, '999999999');
 
       //this.clientEnvironmentId 环境判断 宝悦环境
       if (this.clientEnvironmentId == 4) {
@@ -279,7 +340,7 @@ export default {
     confirmChoose(list) {
 
       console.log(list, '6666666666666666');
-      if (this.clientEnvironmentId == '4') {
+      if (this.clientEnvironmentId == 4) {
         let data = {};
         if (list[0].name.includes('板材')) {
 
@@ -331,6 +392,12 @@ export default {
         categoryId: '',
         productName: '',
         planType: 1,
+        moCount: '', // 模具数量
+        blockCount: 0, // 块数
+        noWordCount: '',// 无字数量
+        weight:'',
+        isSlotting:'',//是否开槽
+        slottingType:'',//开槽类型
         id: '',
         produceType: 2,
         bomCategoryId: '',
@@ -343,8 +410,6 @@ export default {
         if (!valid) {
           return false;
         }
-        // 
-        console.log(this.form.id, 'this.form.idthis.form.idthis.form.idthis.form.id');
 
         if (!this.form.id) {
           this.form.timeDimensionPlanType = this.type;
@@ -406,18 +471,153 @@ export default {
     },
 
 
-    changeProduceType() {
-      this.form.bomCategoryId = '';
-      this.form['bomCategoryName'] = '';
-      this.form['bomCategoryVersions'] = '';
+    tableHandleKeyUp(row, name) {
+      // return
+      // , index, e, name
+      if (this.form.specification && this.clientEnvironmentId == 4) {
+
+        let modelArr = this.form.specification.split('*');
+        let modelLong = modelArr[0]; // model规格长度
+        let modeWide = modelArr[1]; // model规格宽度
+        let modeHight = modelArr[2].substr(0, modelArr[2].indexOf('cm')); // model规格高度
+        modeHight = Number(modeHight);
+
+        if (name === 'moCount') {
+          // 模数
+
+          this.$set(this.form, 'moCount', row.moCount);
+          // 计算块数的公式:
+          // (一模6米长度 / model规格长度) * (一模1.2米宽度 / model规格宽度) = 每一模的块数
+          // 每一模的块数*模数moCount = 总块数
+          if (row.productName.includes('板材')) {
+            // 块数
+            let blockCount =
+
+              Math.floor(600 / modelLong) *
+              Math.floor(120 / modeHight) *
+              Math.floor(60 / modeWide) *
+              row.moCount;
+
+            this.$set(this.form, 'blockCount', blockCount);
+
+
+          } else if (row.productName.includes('砌块')) {
+            console.log(1);
+
+            let modelLongFixed = (600 / modelLong).toFixed(2);
+            modelLongFixed = modelLongFixed.substring(
+              0,
+              modelLongFixed.length - 1
+            );
+            let modeWideFixed = (120 / modeWide).toFixed(2);
+            modeWideFixed = modeWideFixed.substring(
+              0,
+              modeWideFixed.length - 1
+            );
+            let modeHightFixed = (60 / modeHight).toFixed(2);
+            modeHightFixed = modeHightFixed.substring(
+              0,
+              modeHightFixed.length - 1
+            );
+            let num =
+              Math.floor(modelLongFixed * modeWideFixed * modeHightFixed) *
+              row.moCount;
+
+            this.$set(this.form, 'blockCount', num);
+          }
 
-      this.bomVersionList = [];
+          let numNew =
+            (Number((modelLong * modeWide * modeHight) / 1000000).toFixed(5) *
+            row.blockCount).toFixed(5);
 
-      this.routingList = [];
-      this.form.produceRoutingId = '';
-      this.form.produceRoutingName = '';
-      this.form.produceVersionName = '';
-      this.bomListVersion();
+
+          this.$set(this.form, 'requiredFormingNum', numNew);
+
+        } else if (name === 'sum') {
+          let e = this.form.requiredFormingNum
+          console.log('方数');
+
+          //方数
+          this.form.planProductNum = e;
+
+          this.form.blockCount = Math.floor(
+            e / ((modelLong * modeWide * modeHight) / 1000000)
+          );
+
+          if (this.form.productName.includes('板材')) {
+
+
+            let num = Math.ceil(
+              this.form.blockCount /
+              (Math.floor(600 / modelLong) *
+                Math.floor(120 / modeHight) *
+                Math.floor(60 / modeWide))
+            );
+
+            // 48 480  4807 480
+            this.$set(this.form, 'moCount', num)
+          } else if (row.productName.includes('砌块')) {
+
+            row.moCount = Math.ceil(
+              row.blockCount /
+              Math.floor(
+                (600 / modelLong) * (120 / modeHight) * (60 / modeWide)
+              )
+            );
+
+          }
+        } else if (name === 'blockCount') {
+          //块数
+          // row.blockCount = row.moCount;
+
+          this.$set(this.form, 'blockCount', row.blockCount);
+
+          if (row.productName.includes('板材')) {
+
+            let moCount = Math.ceil(
+              row.blockCount /
+              (Math.floor(600 / modelLong) *
+                Math.floor(120 / modeHight) *
+                Math.floor(60 / modeWide))
+            );
+            this.$set(this.form, 'moCount', moCount);
+
+          } else if (row.productName.includes('砌块')) {
+            let moCount = Math.ceil(
+              row.blockCount /
+              Math.floor(
+                (600 / modelLong) * (120 / modeHight) * (60 / modeWide)
+              )
+            );
+            this.$set(this.form, 'moCount', moCount);
+          }
+
+          let a =
+            ((Number(this.form.blockCount) * modelLong * modeWide * modeHight) / 1000000).toFixed(5);
+
+            
+          this.$set(this.form, 'requiredFormingNum', a);
+
+        }
+      }
+
+    },
+
+
+    changeProduceType() {
+      if (this.clientEnvironmentId !== 4) {
+        this.form.bomCategoryId = '';
+        this.form['bomCategoryName'] = '';
+        this.form['bomCategoryVersions'] = '';
+
+        this.bomVersionList = [];
+
+        this.routingList = [];
+        this.form.produceRoutingId = '';
+        this.form.produceRoutingName = '';
+        this.form.produceVersionName = '';
+        this.bomListVersion();
+      }
     },
 
     changeBomId() {

+ 5 - 1
src/views/saleOrder/salesToProduction.vue

@@ -285,6 +285,7 @@
             prop="lackNum"
           >
           </el-table-column>
+
           <el-table-column
             :label="'计划生产数量' + (clientEnvironmentId == '4' ? '(方)' : '')"
             align="center"
@@ -901,6 +902,8 @@ export default {
           }
         }
         this.form.salesOrders.map((item, index) => {
+          
+
           if (this.clientEnvironmentId == '4') {
             this.tableHandleKeyUp(item, '', item.lackNum, 'sum');
           } else {
@@ -1088,9 +1091,10 @@ export default {
           }
 
           row.planProductNum =
-            Nu((modelLong * modeWide * modeHight) / 1000000).toFixed(5) *
+          Number((modelLong * modeWide * modeHight) / 1000000).toFixed(5) *
             row.blockCount;
         } else if (name === 'sum') {
+          
           //方数
           row.planProductNum = e;
 

+ 2 - 2
vue.config.js

@@ -32,10 +32,10 @@ module.exports = {
       // 当我们的本地的请求 有/api的时候,就会代理我们的请求地址向另外一个服务器发出请求
       '/api': {
         // target: 'http://192.168.1.210:86/',
-        // target: 'http://192.168.1.116:18086',
+        target: 'http://192.168.1.103:18086',
         // target: 'http://192.168.1.158:18086',
         // target: 'http://192.168.158:18086',
-        target: 'http://192.168.1.125:18086',
+        // target: 'http://192.168.1.125:18086',
         // target: 'http://192.168.1.251:18086',
 
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域