Explorar o código

Merge branch 'dev' into test

longfenglin hai 1 ano
pai
achega
e529c4ea2d

+ 8 - 0
src/api/produce/workOrder.js

@@ -265,6 +265,14 @@ export async function createInProduct(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+export async function createInProductBatchTG(data) {
+  const res = await request.post('/pda/mes/workreport/createInProductBatchTG', data);
+
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
 
 export async function getInventoryTotal(data) {
   const res = await request.post('/wms/stocktwo/getInventoryTotal', data);

+ 63 - 4
src/views/produce/components/jobBooking/components/jobBom.vue

@@ -103,6 +103,13 @@
           </div>
 
         </div>
+
+        <div class="btn-margin" v-if="!isDetails && item.currentTaskDiagram.isFirstTask==1 && item.semiProductList.length==0 && clientEnvironmentId== 3">
+          <div class="lable lable100 rx-cc"></div>
+          <el-button class="" @click="singleQuery" type="primary">
+              创建在制品
+          </el-button>
+        </div>
       </div>
     </div>
 
@@ -129,7 +136,9 @@
   </div>
 </template>
 <script>
-
+import {
+    createInProductBatchTG,
+} from '@/api/produce/workOrder';
 
 
 export default {
@@ -204,7 +213,6 @@ export default {
         };
       });
     }
-    
     // if(item.semiProductList){
     //   let allReportWeight=0
     //    item.semiProductList.map(sitem=>{
@@ -293,7 +301,6 @@ export default {
 
 
     notForme() {
-
       let weight = Number(this.notFormedList[0].notFormedNum) * Number(this.item.singleWeight) * Number(this
         .item.weightMultiple)
       if (this.item.singleWeightUnit == 'G' || this.item.singleWeightUnit == 'g' || this.item.singleWeightUnit ==
@@ -339,7 +346,56 @@ export default {
       }
       // this.notForme();
       // this.blurNum()
-    }
+    },
+    singleQuery() {
+      console.log(this.item.workReportInfo);
+      if (!this.item.workReportInfo.formedNum) return this.$message.info("请输入合格品数")
+      
+      if (this.item.workReportInfo.notFormedNum === '' || this.item.workReportInfo.notFormedNum == null) return this.$message.info(
+          "请输入不合格品数"
+      )
+
+
+      const req = {
+          "formedNum": this.item.workReportInfo.formedNum,
+          "notFormedNum": this.item.workReportInfo.notFormedNum||0,
+          "taskId": this.item.currentTaskDiagram.taskId,
+          "workOrderId": this.item.workReportInfo.workOrderId,
+          "formedWeight": this.item.workReportInfo.formedWeight,
+          "notFormedWeight": this.item.workReportInfo.notFormedWeight
+      };
+
+      createInProductBatchTG(req).then(res => {
+          if (res && res.length) {
+              this.forValue = res[0];
+
+              res.map(v => {
+                  v.selected = true;
+                   v.extInfo.batchReportInfo = [
+                    {
+                      allFeedQuantity: '',
+                      allReportWeight: '',
+                      taskId: '',
+                      taskName: ''
+                    }
+                  ];
+
+                  v.extInfo.notBatchReportInfo = [
+                    {
+                      allFeedQuantity: '',
+                      notType: '',
+                      taskId: '',
+                      taskName: '',
+                      notReason: ''
+                    }
+                  ];
+              })
+              this.list = res;
+              this.item.semiProductList = res;
+          }
+
+      })
+    },
   }
 };
 </script>
@@ -479,4 +535,7 @@ export default {
     background: rgb(21, 122, 44);
   }
 }
+.btn-margin{
+    margin: 10px 0 10px 100px;
+}
 </style>

+ 1 - 1
src/views/produce/components/jobBooking/components/jobDdBom.vue

@@ -108,7 +108,7 @@
                     </div>
                     
                 </div>
-                <div class="btn-margin" v-if="item.currentTaskDiagram.isFirstTask==1 && item.semiProductList.length==0 && clientEnvironmentId!= 3">
+                <div class="btn-margin" v-if="!isDetails && item.currentTaskDiagram.isFirstTask==1 && item.semiProductList.length==0 && clientEnvironmentId!= 3">
                     <div class="lable lable100 rx-cc"></div>
                     <el-button class="" @click="singleQuery" type="primary">
                         创建在制品

+ 18 - 2
src/views/produce/components/jobBooking/components/semiProductJobBom.vue

@@ -250,6 +250,11 @@
           {{ row.brandNum }}
         </template>
       </el-table-column>
+      <el-table-column label="数量" prop="feedQuantity">
+        <template slot-scope="{ row, $index }">
+          {{ row.feedQuantity }}
+        </template>
+      </el-table-column>
 
       <!-- <el-table-column label="包装库存" prop="brandNum">
         <template slot-scope="{ row, $index }">
@@ -381,15 +386,26 @@ export default {
         console.log('aaaaaa',newVal)
         if (newVal.length) {
           console.log(newVal);
-          this.sumweight(newVal);
           this.newList = newVal;
-          this.sunTj();
+          if(this.taskObj.type != 4){
+             this.sumweight(newVal);
+             this.sunTj();
+          }
+          
 
         }
       }
     },
   },
+  computed: {
+    taskObj() {
+      return this.$store.state.user.taskObj;
+    },
 
+    clientEnvironmentId() {
+      return this.$store.state.user.info.clientEnvironmentId;
+    }
+  },
   created() {
     this.getTaskFn();
   },

+ 15 - 5
src/views/produce/components/jobBooking/index.vue

@@ -46,9 +46,9 @@
 
         <!-- //报工信息 -->
 
-        <div v-if="item.singleReport !== 1">
+        <div v-if="item.singleReport != 1">
 
-          <jobBom :item="item" :notFormed="item.notFormedList" :warehouseList="warehouseList"></jobBom>
+          <jobBom :item="item" ref="jobBomRef" :notFormed="item.notFormedList" :warehouseList="warehouseList"></jobBom>
         </div>
         <div v-else>
 
@@ -329,7 +329,7 @@ export default {
                 };
               });
             }
-console.log('agasgasgs',this.taskObj.type)
+
             if ((this.taskObj.type == 6 && obj.singleReport ==1)|| (this.clientEnvironmentId == 3 && obj.singleReport ==0 && this.taskObj.type == 6)) {
               obj.semiProductList = obj.pickOutInList;
               obj.pickOutInList=[]
@@ -408,7 +408,7 @@ console.log('agasgasgs',this.taskObj.type)
               let numCot=0
               if(obj.semiProductList.length>0){
                 obj.semiProductList.map((fitem)=>{
-                  numCot= numCot + fitem.feedQuantity || 1
+                  numCot= numCot + fitem.feedQuantity || 1 
                 })
                 obj.workReportInfo.formedNum = numCot
               }
@@ -429,11 +429,21 @@ console.log('agasgasgs',this.taskObj.type)
                 ...m.extInfo
               };
             });
-            console.log(obj, 444);
 
+            console.log(obj, 4445555);
+
+            if(this.taskObj.type == 4 && obj.singleReport ==0){
+              let numVal=0
+              obj.pickOutInList.map(item=>{
+                numVal=numVal+item.feedQuantity
+              })
+              obj.workReportInfo.formedNum = numVal
+              
+            }
             return {
               ...obj
             };
+            
           });
           
         })