ccjgmwz 3 gadi atpakaļ
vecāks
revīzija
7cd932c58b

+ 11 - 4
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/WarehouseBaseInfoServiceImpl.java

@@ -30,6 +30,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
+import java.text.DecimalFormat;
 import java.util.*;
 
 /**
@@ -150,14 +151,20 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
                                         Float netWeight = 0f;
                                         for (WarehouseInOutInfo warehouse : warehouseInOutInfoAllList) {
                                             //潮粮累计纯重,干粮累计净重
-                                            netWeight = netWeight + (warehouse.getPureWeight()!=null?warehouse.getPureWeight():warehouse.getNetWeight());
-                                        }
+                                            if(warehouse.getType() == null){
+                                                netWeight = Float.valueOf(netWeight) + Float.valueOf(warehouse.getPureWeight() != null?warehouse.getPureWeight():warehouse.getNetWeight());
+                                            }
+                                            else{
+                                                netWeight = Float.valueOf(netWeight) + Float.valueOf(warehouse.getType().equals("潮粮") ?warehouse.getPureWeight():warehouse.getNetWeight());
+                                            }
+                                           }
                                         warehouseNumView.setGoodsName(warehouseInOutInfoAllList.get(0).getGoodsName());
-                                        warehouseNumView.setInNetWeight(String.valueOf(netWeight));
+                                        DecimalFormat decimalFormat=new DecimalFormat(".000");//构造方法的字符格式这里如果小数不足2位,会以0补足.
+                                        warehouseNumView.setInNetWeight(decimalFormat.format(netWeight));
                                         if (StringUtils.isEmpty(inNetWeight)) {
                                             inNetWeight = "0";
                                         }
-                                        inNetWeight = String.valueOf(Float.valueOf(inNetWeight) + netWeight);
+                                        inNetWeight = String.valueOf(Float.valueOf(inNetWeight) + Float.valueOf(decimalFormat.format(netWeight)));
                                     }
                                     // 查询应余量
                                     WarehousePositionStorageInfo warehousePositionStorageInfo = warehousePositionStorageInfoService.selectOne(new EntityWrapper<WarehousePositionStorageInfo>()