gjy преди 2 години
родител
ревизия
b9ddd29cda
променени са 3 файла, в които са добавени 65 реда и са изтрити 19 реда
  1. 3 1
      src/api/V2/warehouse/index.js
  2. 5 2
      src/model/warehouse/index.js
  3. 57 16
      src/views/warehousenew/warehousingOrder.vue

+ 3 - 1
src/api/V2/warehouse/index.js

@@ -130,4 +130,6 @@ export const API_DRYOUT='/warehousingOrder/dryOut'
 //入库单利率查看
 export const API_GET_ENABLEDINFO='/enabledInfo/getEnabledInfo'
 //入库单利率修改
-export const API_SET_ENABLEDINFO='/enabledInfo/api/setEnabledInfo'
+export const API_SET_ENABLEDINFO='/enabledInfo/api/setEnabledInfo'
+//获取扣重比
+export const API_GET_BYNAME='/purchasePrice/selectByName'

+ 5 - 2
src/model/warehouse/index.js

@@ -63,7 +63,8 @@ import {
     API_GET_WAREHOUSEPOSITIONINFO,
     API_DRYOUT,
     API_GET_ENABLEDINFO,
-    API_SET_ENABLEDINFO
+    API_SET_ENABLEDINFO,
+    API_GET_BYNAME
     // API_GET_EXPENSEINFO
 } from '@/api/V2/warehouse'
 // import { app } from 'electron'
@@ -195,4 +196,6 @@ export const dryout = appRx.post(API_DRYOUT,errorCatcher, errorHandle, filter)
 //入库单利率查看
 export const getenabledinfo = appRx.get(API_GET_ENABLEDINFO,errorCatcher, errorHandle, filter)
 //入库单利率修改
-export const setenabledinfo = appRx.post(API_SET_ENABLEDINFO,errorCatcher, errorHandle, filter)
+export const setenabledinfo = appRx.post(API_SET_ENABLEDINFO,errorCatcher, errorHandle, filter)
+//获取扣重比
+export const getbyname = appRx.get(API_GET_BYNAME,errorCatcher, errorHandle, filter)

+ 57 - 16
src/views/warehousenew/warehousingOrder.vue

@@ -109,9 +109,9 @@
              <span @click='lookcustomer(scope.row)'>{{scope.row.customer}}</span>
             </template>
         </el-table-column> -->
-        <el-table-column prop="goodsName" label="货名" width="50">
+        <el-table-column prop="goodsName" label="货名" width="120">
         </el-table-column>
-        <!-- <el-table-column prop="inWarehouseWeight1"  width="110" class="table_td" label="加权水分">
+        <el-table-column prop="inWarehouseWeight1"  width="170" class="table_td" label="加权水分">
           <template scope="scope">
             <span v-if='scope.row.edit==false'>{{scope.row.weightedMoisture}}</span>
             <el-input style='width:80%;' v-if='scope.row.edit' v-model='scope.row.weightedMoisture'></el-input>
@@ -120,7 +120,7 @@
             <img v-if="!scope.row.edit" width="17" height="18" style="vertical-align: text-top; position: relative; top: -1px"
               src="../../../public/img/edit.png" @click="editMoisture(scope.row)" alt="" />
           </template>
-        </el-table-column> -->
+        </el-table-column>
         <el-table-column prop="inWarehouseWeight1"  width="110" class="table_td" label="入库重量">
           <template scope="scope">
             <span v-if='scope.row.weightedit==false&&scope.row.warehouseType==2||scope.row.warehouseType==1'>{{scope.row.inWarehouseWeight1}}</span>
@@ -361,7 +361,7 @@
             </el-form-item>
              <!-- <el-form-item label="折干前成本(元/吨)">
               <el-input disabled placeholder="自动计算,不可编辑" v-model="fieldrationsList.beforeCost"></el-input>
-            </el-form-item>
+            </el-form-item>-->
             <el-form-item label="折干前仓位">
               <el-select @focus="warehousefocus" @change="warehousechange" v-model="fieldrationsList.beforeBinNo" filterable placeholder="请选择">
                 <el-option
@@ -371,7 +371,7 @@
                   :value="item.binNumber">
                 </el-option>
               </el-select>
-            </el-form-item> -->
+            </el-form-item> 
             <el-form-item label="折干后重量(吨)">
               <el-input @input="afterWeightchange" v-model="fieldrationsList.afterWeight"></el-input>
             </el-form-item>
@@ -495,7 +495,8 @@
   getposition,
   dryout,
   getenabledinfo,
-  setenabledinfo
+  setenabledinfo,
+  getbyname
 } from '@/model/warehouse/index'
 import {
   selectWarehouseSelf,
@@ -871,6 +872,7 @@ import { findLastIndexOfIterate } from 'xe-utils/methods'
       },
       editMoisture(row){
         row.edit=true
+        this.$forceUpdate()
       },
       changeWeight(row){
         if(row.inWarehouseWeight1<row.outWarehouseWeight){
@@ -901,7 +903,7 @@ import { findLastIndexOfIterate } from 'xe-utils/methods'
           });
           return 
         }
-        this.$confirm('确定提交入库重量?', {
+        this.$confirm('确定提交加权水分?', {
             confirmButtonText: '确定',
             cancelButtonText: '取消',
             type: 'warning',
@@ -1052,10 +1054,8 @@ import { findLastIndexOfIterate } from 'xe-utils/methods'
               }
             }
           }
-          if(array.length>0){
-            currectData=array
-          }
         }
+        currectData=arr
         if(currectData.length==0){
           this.$message({
               message: '请选择一条数据!',
@@ -1065,9 +1065,23 @@ import { findLastIndexOfIterate } from 'xe-utils/methods'
         }
         // console.log(arr1)
         
+       
+      let map = new Map();
+      for (let item of currectData) {
+          map.set(item.goodsName, item);
+      }
+
+      var data = [...map.values()];
+        if(data.length>1){
+          this.$message({
+              message: '请选择同一个货名的数据进行折干!',
+              type: 'warning'
+            });
+            return
+        }
         if(arr3.length>1){
           this.$message({
-              message: '请选择一个仓库的数据进行折干!',
+              message: '请选择一个仓库的数据进行折干!',
               type: 'warning'
             });
             return
@@ -1075,6 +1089,13 @@ import { findLastIndexOfIterate } from 'xe-utils/methods'
         // console.log(currectData)
         var arr1=currectData
         for (let i = 0; i < arr1.length; i++) {
+          if(arr1[i].warehouseType!=1){
+            this.$message({
+              message: '请选择常用库潮粮进行折干!',
+              type: 'warning'
+            });
+            return
+          }
           if(arr1[i].goodsName.indexOf('潮粮')==-1){
             this.$message({
               message: '只有潮粮可以折干!',
@@ -1082,21 +1103,41 @@ import { findLastIndexOfIterate } from 'xe-utils/methods'
             });
             return
           }
-
+          if(!arr1[i].weightedMoisture||arr1[i].weightedMoisture<14){
+            this.$message({
+              message: '加权水分不可小于干粮水分!',
+              type: 'warning'
+            });
+            return
+          }
           // _this.dialogTitle=arr1[i].contractNo
         }
         var weight=0
-        for (let i = 0; i < this.currectdata.length; i++) {
-          weight+=this.currectdata[i].surplusWeight
-          
+        var weight2=0
+        for (let i = 0; i < arr1.length; i++) {
+          console.log(arr1[i].surplusWeight)
+          weight+=arr1[i].surplusWeight
         }
         // this.currectdata=item
         this.currectdata=arr1
         this.fieldrationsList.warehousingOrderList=this.currectdata
         this.fieldrationsList.baseId=this.currectdata[0].baseId
         this.fieldrationsList.beforeWeight=weight
+        getbyname({warehouseId:this.currectdata[0].baseId,goodsName:this.currectdata[0].goodsName}).toPromise()
+          .then((response) => {
+            if(response){
+              for (let i = 0; i < this.currectdata.length; i++) {
+                var weightedMoisture=(this.currectdata[i].weightedMoisture-14)
+                var deductWeight=100-(weightedMoisture*response.deductWeight)
+                // console.log(deductWeight,111111111)
+                weight2+=((deductWeight/100)*this.currectdata[i].surplusWeight)
+              }
+              this.fieldrationsList.afterWeight=weight2.toFixed(2)
+              this.fieldrationsshow=true
+            }
+          })
         // this.fieldrationsList.beforeCost=this.currectdata[0].avgCost
-        this.fieldrationsshow=true
+        
       },
       distribution(){
         let _this= this