zxz há 1 ano atrás
pai
commit
ae21247e40

+ 30 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/WarehouseBaseInfoController.java

@@ -2,17 +2,24 @@ package com.yh.saas.plugin.yiliangyiyun.controller;
 
 
 import com.baomidou.mybatisplus.plugins.Page;
+import com.winsea.svc.base.security.util.AuthSecurityUtils;
 import com.yh.saas.plugin.yiliangyiyun.entity.ContractManagementInfo;
 import com.yh.saas.plugin.yiliangyiyun.entity.WarehouseBaseInfo;
 import com.yh.saas.plugin.yiliangyiyun.entity.WarehouseInOutInfo;
+import com.yh.saas.plugin.yiliangyiyun.entity.view.BiViewInfo;
 import com.yh.saas.plugin.yiliangyiyun.entity.view.WarehouseNumView;
 import com.yh.saas.plugin.yiliangyiyun.entity.view.WarehouseView;
+import com.yh.saas.plugin.yiliangyiyun.mapper.WarehousePositionStorageInfoMapper;
 import com.yh.saas.plugin.yiliangyiyun.service.IWarehouseBaseInfoService;
+import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -275,5 +282,28 @@ public class WarehouseBaseInfoController {
     public WarehouseBaseInfo selectWarehouseChart(WarehouseBaseInfo warehouseBaseInfo) {
         return warehouseBaseInfoService.selectWarehouseChart(warehouseBaseInfo);
     }
+
+    /**
+     * 折算纯重
+     *
+     * @param baseId
+     * @param
+     * @return
+     */
+    @GetMapping("/getQuantityZhe")
+    public WarehouseBaseInfo getQuantityZhe(String compId,String baseId ) {
+        return warehouseBaseInfoService.getQuantityZhe(compId,baseId);
+    }
+    /**
+     * 实际重量
+     *
+     * @param warehouseName
+     * @param
+     * @return
+     */
+    @GetMapping("/getQuantityReal")
+    public WarehouseBaseInfo getQuantityReal(String compId,String warehouseName ) {
+        return warehouseBaseInfoService.getQuantityReal(compId,warehouseName);
+    }
 }
 

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

@@ -24,6 +24,11 @@ public class WarehouseNumView {
      * 应余量
      */
     private String storage;
+    /**
+     * 应余量
+     */
+    private Double pureWeight;
+
     /**
      * 库内储量
      */

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

@@ -1,8 +1,10 @@
 package com.yh.saas.plugin.yiliangyiyun.mapper;
 
+import com.yh.saas.plugin.yiliangyiyun.entity.WarehouseBaseInfo;
 import com.yh.saas.plugin.yiliangyiyun.entity.WarehousePositionStorageInfo;
 import com.baomidou.mybatisplus.mapper.BaseMapper;
 import com.yh.saas.plugin.yiliangyiyun.entity.view.BiViewInfo;
+import com.yh.saas.plugin.yiliangyiyun.entity.view.WarehouseNumView;
 
 import java.util.List;
 import java.util.Map;
@@ -22,4 +24,5 @@ public interface WarehousePositionStorageInfoMapper extends BaseMapper<Warehouse
     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);
+    List<WarehouseNumView> getQuantityZhe(String compId,String baseId, String flag, String seachMoth);
 }

+ 2 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IWarehouseBaseInfoService.java

@@ -181,4 +181,6 @@ public interface IWarehouseBaseInfoService extends IService<WarehouseBaseInfo> {
      * @param warehouseBaseInfo
      */
     WarehouseBaseInfo selectWarehouseChart(WarehouseBaseInfo warehouseBaseInfo);
+    WarehouseBaseInfo getQuantityZhe(String compId,String baseId );
+    WarehouseBaseInfo getQuantityReal(String compId,String warehouseName );
 }

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

@@ -25,6 +25,7 @@ import com.yh.saas.plugin.yiliangyiyun.entity.view.*;
 import com.yh.saas.plugin.yiliangyiyun.exception.YException;
 import com.yh.saas.plugin.yiliangyiyun.exception.YExceptionEnum;
 import com.yh.saas.plugin.yiliangyiyun.mapper.WarehouseBaseInfoMapper;
+import com.yh.saas.plugin.yiliangyiyun.mapper.WarehousePositionStorageInfoMapper;
 import com.yh.saas.plugin.yiliangyiyun.service.*;
 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
 import com.yh.saas.plugin.yiliangyiyun.util.Const;
@@ -117,6 +118,8 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
     private OSSClient ossClient;
     @Autowired
     private CacheComponent cacheComponent;
+    @Autowired
+    private WarehousePositionStorageInfoMapper warehousePositionStorageInfoMapper;
 
     /**
      * 全部仓库
@@ -430,7 +433,6 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
         pageView.put("compId", compId);
         pageView.put("warehouseName", warehouseName);
         List<WarehouseNumView> dataList = baseMapper.getReservesWarehouseListByCondition(pageView);
-
         warehouseBaseInfos.setWarehouseViewList(warehouseViews);
         warehouseBaseInfos.setWarehouseNumViewList(dataList);
         return warehouseBaseInfos;
@@ -5776,4 +5778,54 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
         return warehouseBaseInfo1;
     }
 
+    @Override
+    public WarehouseBaseInfo getQuantityZhe(String compId, String baseId) {
+        String seachMonth = "2022-10-01";
+        List<WarehouseNumView> warehouseNumViewList = warehousePositionStorageInfoMapper.getQuantityZhe(compId,baseId, "2", seachMonth);
+        List<WarehouseNumView> warehouseNumViewList1 = warehousePositionStorageInfoMapper.getQuantityZhe( compId,baseId, "1", seachMonth);
+        WarehouseBaseInfo warehouseBaseInfo = new WarehouseBaseInfo();
+        List<WarehouseNumView> list = new ArrayList<>();
+        if (org.apache.commons.collections.CollectionUtils.isNotEmpty(warehouseNumViewList)) {
+            for (int i = 0; i < warehouseNumViewList.size(); i++) {
+                WarehouseNumView biViewInfo = new WarehouseNumView();
+                biViewInfo.setGoodsName(warehouseNumViewList.get(i).getGoodsName());
+                biViewInfo.setPureWeight(warehouseNumViewList.get(i).getPureWeight());
+                if (org.apache.commons.collections.CollectionUtils.isNotEmpty(warehouseNumViewList1)) {
+                    for (int j = 0; j < warehouseNumViewList1.size(); j++) {
+                        if (warehouseNumViewList.get(i).getGoodsName().equals(warehouseNumViewList1.get(j).getGoodsName())) {
+                            if(warehouseNumViewList.get(i).getPureWeight() - warehouseNumViewList1.get(j).getPureWeight() <= 0){
+                                biViewInfo.setPureWeight(0d);
+                            }else{
+                                biViewInfo.setPureWeight(warehouseNumViewList.get(i).getPureWeight() - warehouseNumViewList1.get(j).getPureWeight());
+                            }
+                            break;
+                        }
+
+                    }
+
+                }
+                if(biViewInfo.getPureWeight() == 0){
+                    continue;
+                }
+                list.add(biViewInfo);
+            }
+        }
+
+        warehouseBaseInfo.setWarehouseNumViewList(list);
+        return warehouseBaseInfo;
+    }
+
+    @Override
+    public WarehouseBaseInfo getQuantityReal(String compId, String warehouseName) {
+        WarehouseBaseInfo warehouseBaseInfos = new WarehouseBaseInfo();
+        //仓库储量柱形图
+        Map<String, Object> pageView = new HashMap<>();
+        //  公司ID
+        pageView.put("compId", compId);
+        pageView.put("warehouseName", warehouseName);
+        List<WarehouseNumView> dataList = baseMapper.getReservesWarehouseListByCondition(pageView);
+        warehouseBaseInfos.setWarehouseNumViewList(dataList);
+        return warehouseBaseInfos;
+    }
+
 }

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

@@ -115,4 +115,29 @@
         group by
         wioi.goods_name
     </select>
+    <select id="getQuantityZhe" parameterType="Map"
+            resultType="com.yh.saas.plugin.yiliangyiyun.entity.view.WarehouseNumView">
+        SELECT
+        REPLACE(wioi.goods_name,'(潮粮)','') as goodsName,
+        ifnull(sum( case when wioi.goods_name like '%潮粮%' then wioi.pure_weight else wioi.net_weight end ),0) as pureWeight
+        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 wbi.comp_id = #{compId}
+        and
+        wioi.status_flag = '3'
+        <if test="baseId != null">
+            and wbi.id = #{baseId}
+        </if>
+        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
+        REPLACE(wioi.goods_name,'(潮粮)','')
+    </select>
 </mapper>