Selaa lähdekoodia

禅道bug 2635 2633 修复:新增保存并发布功能及计划时间字段优化

yusheng 9 kuukautta sitten
vanhempi
commit
dbb95aba09

+ 8 - 1
src/api/saleOrder/index.js

@@ -253,7 +253,14 @@ export async function temporaryPlanSave(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
-
+//保存并发布
+export async function saveAndRelease(data) {
+  const res = await request.post(`/aps/productionplan/saveAndRelease`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
 //  分厂临时计划修改
 
 export async function temporarilyUpdate(data) {

+ 49 - 48
src/views/productionPlan/components/factoryAdd/index.vue

@@ -188,17 +188,6 @@
               <!-- placeholder="输入要求生产数量" @input="tableHandleKeyUp(row, 'sum')"></el-input> -->
             </template>
 
-            <template v-slot:blockCount="{ row, $index }">
-              <el-input
-                v-model.number="row.blockCount"
-                size="small"
-                type="number"
-                style="width: 100%"
-                placeholder="输入数量"
-                @input="inputNumber(row, $index)"
-              ></el-input>
-            </template>
-
             <template v-slot:productType="{ row, $index }">
               <el-select
                 v-model="row.productType"
@@ -433,6 +422,9 @@
       <el-button type="primary" @click="save" :loading="loading">
         确定
       </el-button>
+      <el-button type="primary" @click="save('sub')" :loading="loading">
+        发布
+      </el-button>
     </template>
     <ProcessRoute ref="processRouteRef" @changeParent="changeParent" />
   </ele-modal>
@@ -448,14 +440,12 @@
   import {
     bomRoutingList,
     bomListByPlan,
-    saveSaleToPlan,
     getFactoryList,
-    temporarilyUpdate,
+    saveAndRelease,
     temporaryPlanSave,
     getUpdateInfoByCode
   } from '@/api/saleOrder';
   import contactDialog from '@/components/contactDialog/openContactDialog.vue';
-  import awk from 'highlight.js/lib/languages/awk';
 
   export default {
     components: {
@@ -624,6 +614,31 @@
             align: 'center',
             minWidth: 140
           },
+          {
+            slot: 'measuringUnit',
+            prop: 'measuringUnit',
+            label: '计量单位',
+            align: 'center',
+            minWidth: 140
+          },
+          {
+            slot: 'moCount',
+            prop: 'moCount',
+            label: '模数',
+            headerSlot: 'headeRequiredFormingNum',
+            align: 'center',
+            minWidth: 140,
+            show: this.clientEnvironmentId == 4
+          },
+          {
+            slot: 'blockCount',
+            prop: 'blockCount',
+            label: '块数',
+            headerSlot: 'headeRequiredFormingNum',
+            align: 'center',
+            minWidth: 140,
+            show: this.clientEnvironmentId == 4
+          },
           {
             slot: 'productType',
             prop: 'productType',
@@ -649,29 +664,7 @@
             align: 'center',
             minWidth: 240
           },
-          {
-            slot: 'measuringUnit',
-            prop: 'measuringUnit',
-            label: '计量单位',
-            align: 'center',
-            minWidth: 140
-          },
-          {
-            slot: 'moCount',
-            prop: 'moCount',
-            label: '模数',
-            align: 'center',
-            minWidth: 140,
-            show: this.clientEnvironmentId == 4
-          },
-          {
-            slot: 'blockCount',
-            prop: 'blockCount',
-            label: '块数',
-            align: 'center',
-            minWidth: 140,
-            show: this.clientEnvironmentId == 4
-          },
+
           {
             slot: 'factoriesId',
             prop: 'factoriesId',
@@ -1127,7 +1120,7 @@
                   'produceRoutingName',
                   arr[0].produceRoutingName
                 );
-                console.log(arr[0],'arr[0]')
+                console.log(arr[0], 'arr[0]');
                 this.$set(item, 'routingList', arr[0].routingList);
                 this.$set(item, 'bomCategoryName', arr[0].name);
                 this.$set(item, 'bomCategoryVersions', arr[0].versions);
@@ -1280,7 +1273,7 @@
               row.bomVersionList = arr;
               this.form.productInfoList[index].bomVersionList = arr;
               row.bomCategoryId = arr[0].id;
-              this.changeBomId(row, index,arr[0]);
+              this.changeBomId(row, index, arr[0]);
               let arrAll = JSON.parse(JSON.stringify(this.form));
               this.$set(this, 'form', arrAll);
             }
@@ -1331,10 +1324,20 @@
             this.$message.warning('请输入要求生产数量');
             return;
           }
+          if (!v.moCount && this.clientEnvironmentId == 4) {
+            flag = false;
+            this.$message.warning('请输入模数');
+            return;
+          }
+          if (!v.blockCount && this.clientEnvironmentId == 4) {
+            flag = false;
+            this.$message.warning('请输入块数');
+            return;
+          }
         });
         return flag;
       },
-      save() {
+      save(type) {
         this.$refs.form.validate(async (valid) => {
           if (!valid) {
             return false;
@@ -1373,10 +1376,8 @@
             this.form.timeDimensionPlanType = this.type;
             await this.getPlanCode();
             this.loading = true;
-
-            // console.log(this.form,'this.form 1+1 ')
-            // return
-            temporaryPlanSave(this.form)
+            let api = type == 'sub' ? saveAndRelease : temporaryPlanSave;
+            api(this.form)
               .then((res) => {
                 this.$message.success('新增成功!');
                 this.visible = false;
@@ -1388,9 +1389,10 @@
               });
           } else {
             this.loading = true;
-            console.log(this.form.productInfoList, 'this.form.productInfoList');
+            let api = type == 'sub' ? saveAndRelease : temporaryPlanSave;
+
             // return
-            temporaryPlanSave(this.form)
+            api(this.form)
               .then((res) => {
                 this.$message.success('修改成功!');
                 this.visible = false;
@@ -1502,8 +1504,6 @@
             row['requiredFormingNum'] = numNew;
           } else if (name === 'sum') {
             let e = row.requiredFormingNum;
-            //方数
-            row.planProductNum = e;
 
             row.blockCount = Math.floor(
               e / ((modelLong * modeWide * modeHight) / 1000000)
@@ -1572,6 +1572,7 @@
         }
         // 更新绑定值
         row.requiredFormingNum = value;
+        this.tableHandleKeyUp(row, 'sum');
       },
       changeProduceType(e) {
         if (this.clientEnvironmentId !== 4) {

+ 11 - 4
src/views/workOrder/components/releaseDialog.vue

@@ -28,8 +28,15 @@
             :key="item.prop"
           >
             <el-form-item :label="item.label">
-              <!-- <div class="item_label">{{ current[item.prop] }}</div> -->
-              <el-input :value="fieldValue(item.prop)" disabled />
+              <el-date-picker
+                class="w100"
+                v-model="current[item.prop]"
+                type="datetime"
+                value-format="yyyy-MM-dd HH:mm:ss"
+                v-if="item.type == 'date'"
+                placeholder=" "
+              ></el-date-picker>
+              <el-input :value="fieldValue(item.prop)" disabled v-else />
             </el-form-item>
           </el-col>
         </el-row>
@@ -395,8 +402,8 @@
           { label: '型号:', prop: 'model' },
           { label: '要求生产数量:', prop: 'formingNum' },
           { label: '要求生产重量:', prop: 'initialWeight' },
-          { label: '计划开始时间:', prop: 'planStartTime' },
-          { label: '计划结束时间:', prop: 'planCompleteTime' }
+          { label: '计划开始时间:', prop: 'planStartTime', type: 'date' },
+          { label: '计划结束时间:', prop: 'planCompleteTime', type: 'date' }
         ],
         shiftList: [],
         dateValue: '',

+ 6 - 1
src/views/workOrder/mixins/release.js

@@ -503,8 +503,11 @@ export default {
           teamId: this.form.teamId,
           crewIds: data.assignType == 2 ? dispatchArr : [], // 人员 2
           workstationIds: data.assignType == 1 ? dispatchArr : [], // 工位 1
-          id: this.current.id
+          id: this.current.id,
+          planStartTime: this.current.planStartTime,
+          planEndTime: this.current.planEndTime
         };
+
         const response = await releaseWorkOrder(paramsD);
         this.toolbarLoading = false;
         if (response) {
@@ -538,6 +541,8 @@ export default {
         crewIds: [],
         workstationIds: [],
         id: this.current.id,
+        planStartTime: this.current.planStartTime,
+        planCompleteTime: this.current.planCompleteTime,
         factoryLineIds: []
       };
       if (this.form.assignType == 1) {