gongdecai 2 years ago
parent
commit
dea33ad5ce

+ 57 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/BiInfoController.java

@@ -1304,6 +1304,8 @@ public class BiInfoController {
         }
         List<BiViewInfo> biViewInfoList1 = warehousePositionStorageInfoMapper.selectSumWareNewByGoods(companyId, null, "2", seachMonth, jointVentureParties);
         List<BiViewInfo> biViewInfoList2 = warehousePositionStorageInfoMapper.selectSumWareNewByGoods(companyId, null, "1", seachMonth, jointVentureParties);
+        List<BiViewInfo> biViewInfochaoList1 = warehousePositionStorageInfoMapper.selectSumWareChaoByGoods(companyId, null, "2", seachMonth, jointVentureParties);
+        List<BiViewInfo> biViewInfochaoList2 = warehousePositionStorageInfoMapper.selectSumWareChaoByGoods(companyId, null, "1", seachMonth, jointVentureParties);
         List<BiViewInfo> biViewInfos = new ArrayList<>();
         if (CollectionUtils.isNotEmpty(biViewInfoList1)) {
             for (int i = 0; i < biViewInfoList1.size(); i++) {
@@ -1330,9 +1332,63 @@ public class BiInfoController {
                 biViewInfos.add(biViewInfo);
             }
         }
+
+        // 计算潮粮折干后的剩余量
+        List<BiViewInfo> biViewInfos1 = new ArrayList<>();
+        if (CollectionUtils.isNotEmpty(biViewInfochaoList1)) {
+            for (int i = 0; i < biViewInfochaoList1.size(); i++) {
+                BiViewInfo biViewInfo = new BiViewInfo();
+                biViewInfo.setName(biViewInfochaoList1.get(i).getName());
+                biViewInfo.setWeight(biViewInfochaoList1.get(i).getWeight());
+                if (CollectionUtils.isNotEmpty(biViewInfochaoList2)) {
+                    for (int j = 0; j < biViewInfochaoList2.size(); j++) {
+                        if (biViewInfochaoList1.get(i).getName().equals(biViewInfochaoList2.get(j).getName())) {
+                            if(biViewInfochaoList1.get(i).getWeight() - (biViewInfochaoList2.get(j).getWeight() != null?biViewInfochaoList2.get(j).getWeight():0) <= 0){
+                                biViewInfo.setWeight(0d);
+                            }else{
+                                biViewInfo.setWeight(biViewInfochaoList1.get(i).getWeight() - (biViewInfochaoList2.get(j).getWeight() != null?biViewInfochaoList2.get(j).getWeight():0));
+                            }
+                            break;
+                        }
+
+                    }
+
+                }
+                if(biViewInfo.getWeight() == 0){
+                    continue;
+                }
+                biViewInfos1.add(biViewInfo);
+            }
+        }
+
+        List<BiViewInfo> biViewInfos2 = new ArrayList<>(biViewInfos);
         BiViewInfo biViewInfo = new BiViewInfo();
         biViewInfo.setName("库存储量");
-        biViewInfo.setBiViewInfoList(biViewInfos);
+        biViewInfo.setBiViewInfoList(biViewInfos2);
+
+
+        if(CollectionUtils.isNotEmpty(biViewInfos)){
+            for(int i=0;i<biViewInfos.size();i++){
+                if(biViewInfos.get(i).getName().contains("潮粮")){
+                    biViewInfos.remove(i);
+                    continue;
+                }
+                if(CollectionUtils.isNotEmpty(biViewInfos1)){
+                    for(int j=0;j<biViewInfos1.size();j++){
+                        if(biViewInfos1.get(j).getName().contains(biViewInfos.get(i).getName())){
+                            biViewInfos.get(i).setWeight(biViewInfos.get(i).getWeight()+biViewInfos1.get(j).getWeight());
+                        }
+                    }
+
+                }
+            }
+
+        }
+
+        BiViewInfo biViewInfo1 = new BiViewInfo();
+        biViewInfo1.setName("折算存重");
+        biViewInfo1.setBiViewInfoList(biViewInfos);
+        biViewInfo.setBiViewInfo(biViewInfo1);
         biViewInfoList.add(biViewInfo);
         return biViewInfoList;
     }

+ 4 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/view/BiViewInfo.java

@@ -64,6 +64,10 @@ public class BiViewInfo  {
      * 集合
      */
     private List<BiViewInfo> biViewInfoList;
+    /**
+     * 集合
+     */
+    private BiViewInfo biViewInfo;
 
     List<ContractManagementInfo> contractManagementInfos;
 

+ 1 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/WarehousePositionStorageInfoMapper.java

@@ -21,4 +21,5 @@ public interface WarehousePositionStorageInfoMapper extends BaseMapper<Warehouse
     Double selectSumWare(String compId,String baseId);
     Double selectSumWareNew(String compId,String baseId,String flag,String seachMoth,String jointVentureParties);
     List<BiViewInfo> selectSumWareNewByGoods(String compId, String baseId, String flag, String seachMoth, String jointVentureParties);
+    List<BiViewInfo> selectSumWareChaoByGoods(String compId, String baseId, String flag, String seachMoth, String jointVentureParties);
 }

+ 32 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/WarehousePositionStorageInfoMapper.xml

@@ -83,4 +83,36 @@
         group by
         wioi.goods_name
     </select>
+
+
+    <select id="selectSumWareChaoByGoods" parameterType="Map"
+            resultType="com.yh.saas.plugin.yiliangyiyun.entity.view.BiViewInfo">
+        SELECT
+        wioi.goods_name as name,
+        sum( wioi.pure_weight ) as weight
+        FROM
+        warehouse_in_out_info wioi
+        LEFT JOIN warehouse_base_info wbi ON wbi.id = wioi.base_id
+        AND wbi.delete_flag = 0
+        WHERE
+        wioi.delete_flag = 0
+        and
+        wioi.status_flag = '3'
+        and
+        locate('潮粮', wioi.goods_name)
+        <if test="baseId != null">
+            and wbi.id = #{baseId}
+        </if>
+        <if test="jointVentureParties != null">
+            and wbi.joint_venture_parties = #{jointVentureParties}
+        </if>
+        and wbi.comp_id = #{compId}
+        and wioi.in_out_flag = #{flag}
+        <if test="seachMoth != null and seachMoth != ''">
+            and wioi.create_date >= #{seachMoth}
+            and wbi.create_date >= #{seachMoth}
+        </if>
+        group by
+        wioi.goods_name
+    </select>
 </mapper>