Browse Source

[CODE]: 首页需求变更

maxianghua 4 years ago
parent
commit
a31ed5849b

+ 1 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/mapper/TWhgenlegMapper.java

@@ -85,6 +85,7 @@ public interface TWhgenlegMapper {
     List<Map<String, Object>> selectGoodsListWhouse(Long fId);
 
     List<Map<String, Object>> selectWareHouseList();
+    List<Map<String, Object>> selectWareHouseListWhouse(Long fId);
 
     List<Map<String, Object>> selectCorpsList();
     List<Map<String, Object>> selectCorpsListWhouse(Long fId);

+ 60 - 15
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/service/impl/TWhgenlegServiceImpl.java

@@ -119,24 +119,25 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
     @Override
     public Map<String, Object> selectGoodsList(Long fId) {
         Map<String, Object> map = new HashMap<>();
-        List<Map<String, Object>> goodslist=tWhgenlegMapper.selectGoodsList();
-        map.put("goodslist", goodslist);
-        if(goodslist!=null){
-            Long fid = null;
-            for(Map<String, Object> m : goodslist){
+        // 查询仓库
+        List<Map<String, Object>> whouseList;
+        if(null!= fId &&  fId!=0){
+            whouseList= tWhgenlegMapper.selectWareHouseListWhouse(fId);
+        }else {
+            whouseList= tWhgenlegMapper.selectWareHouseList();
+        }
+        if(null!=whouseList && whouseList.size()>0){
+            String fid = null; //获取 第一个 仓库ID
+            for(Map<String, Object> m : whouseList){
                 for (String k : m.keySet()){
-                    if(k.equals("fGoodsid")){
-                        fid= (Long) m.get(k);
+                    if(k.equals("fWarehouseid")){
+                        fid= m.get(k).toString();
                     }
-                    break;
                 }
+                break;
             }
-            List<Map<String, Object>> goodslistWhouse;
-            if(null!= fId ){
-                goodslistWhouse=tWhgenlegMapper.selectGoodsListWhouse(fId);
-            }else{
-                goodslistWhouse=tWhgenlegMapper.selectGoodsListWhouse(fid);
-            }
+            //通过ID 查询仓库下 所有的 商品
+            List<Map<String, Object>> goodslistWhouse=tWhgenlegMapper.selectGoodsListWhouse(Long.parseLong(fid));
             for (Map<String, Object> m : goodslistWhouse){
                 String  fTotalgross = null;
                 String fGrossweightblc = null;
@@ -149,10 +150,41 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
                         fGrossweightblc=  m.get(k).toString();
                     }
                 }
-                m.put("percentage",calculation(fGrossweightblc,fTotalgross));
+                m.put("balance",calculation1(fTotalgross,fGrossweightblc));
+                m.put("fGrossweightD",new BigDecimal(fGrossweightblc).setScale(2,BigDecimal.ROUND_HALF_UP) );
             }
             map.put("goodslistWhouse", goodslistWhouse);
+            // 查询仓库下 所有的 客户
+            List<Map<String, Object>> corpsListWhouse=tWhgenlegMapper.selectCorpsListWhouse(Long.parseLong(fid));
+            // 计算库容 总剩余
+            for (Map<String, Object> m : corpsListWhouse){
+                String  fTotalgross = null;
+                String fGrossweightblc = null;
+                for (String k : m.keySet()){
+                    // 获取毛重库容
+                    if(k.equals("fTotalgross")){
+                        fTotalgross= m.get(k).toString();
+                    }
+                    if(k.equals("fGrossweightD")){
+                        fGrossweightblc=  m.get(k).toString();
+                    }
+                }
+                m.put("balance",calculation1(fTotalgross,fGrossweightblc));
+                m.put("fGrossweightD",new BigDecimal(fGrossweightblc).setScale(2,BigDecimal.ROUND_HALF_UP) );
+            }
+            map.put("corpsListWhouse", corpsListWhouse);
+            // 仓库
+            for(Map<String, Object> m : whouseList){
+                String fGrossweightblc = null;
+                for (String k : m.keySet()){
+                    if(k.equals("fGrossweightD")){
+                        fGrossweightblc=  m.get(k).toString();
+                    }
+                }
+                m.put("fGrossweightD",new BigDecimal(fGrossweightblc).setScale(2,BigDecimal.ROUND_HALF_UP) );
+            }
         }
+        map.put("whouseList", whouseList);
         return map;
     }
 
@@ -319,5 +351,18 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
         return str;
     }
 
+    /**
+     *   库容-结余毛重
+     * @param fTotalgross
+     * @param fGrossweightblc
+     * @return
+     */
+    public static BigDecimal  calculation1(String  fTotalgross, String fGrossweightblc){
+        BigDecimal num1 = new BigDecimal(fTotalgross);
+        BigDecimal num2 = new BigDecimal(fGrossweightblc);
+        BigDecimal result = num1.subtract(num2);
+        return result.setScale(2,BigDecimal.ROUND_HALF_UP);
+    }
+
 
 }

+ 2 - 2
ruoyi-warehouse/src/main/resources/mapper/reportManagement/TWhgenlegMapper.xml

@@ -372,7 +372,7 @@
             ) t ON g.f_id = t.f_goodsid
 			LEFT JOIN  t_warehouse w ON w.f_id = t.f_warehouseid
         <where>
-            <if test="fId != null ">and g.f_id = #{fId}</if>
+            <if test="fId != null ">and w.f_id = #{fId}</if>
         </where>
     </select>
 
@@ -459,7 +459,7 @@
             ) t ON g.f_id = t.f_corpid
         LEFT JOIN  t_warehouse w ON w.f_id = t.f_warehouseid
         <where>
-            <if test="fId != null ">and g.f_id = #{fId}</if>
+            <if test="fId != null ">and w.f_id = #{fId}</if>
         </where>
     </select>