Browse Source

仓库报表

3254194295 3 years ago
parent
commit
d8298def5b

+ 2 - 0
platform-dao/src/main/java/com/platform/dao/vo/query/store/InStoreFormVO.java

@@ -30,6 +30,8 @@ public class InStoreFormVO extends BaseVO implements Serializable {
      * 主键
      */
     private String id;
+
+    private BigDecimal inStoreNum;
     /**
      * 入库单号
      */

+ 2 - 0
platform-dao/src/main/java/com/platform/dao/vo/query/store/OutStoreFormVO.java

@@ -30,6 +30,8 @@ public class OutStoreFormVO extends BaseVO implements Serializable {
      * 主键
      */
     private String id;
+
+    private BigDecimal outStoreNum;
     /**
      * 状态:参考OutStoreStatusEnum
      */

+ 12 - 12
platform-dao/src/main/java/com/platform/dao/vo/query/store/StoreWorkBenchVO.java

@@ -35,31 +35,31 @@ public class StoreWorkBenchVO extends BaseVO implements Serializable {
     /**
      * 待调拨出库数量
      */
-    private Integer outDBNum;
+    private BigDecimal outDBNum;
     /**
      * 待入库总数
      */
-    private Integer inTotalNum;
+    private BigDecimal inTotalNum;
     /**
      * 待出库总数
      */
-    private Integer outTotalNum;
+    private BigDecimal outTotalNum;
     /**
      * 待领用出库数量
      */
-    private Integer lyNum;
+    private BigDecimal lyNum;
     /**
      * 待报废出库数量
      */
-    private Integer bfNum;
+    private BigDecimal bfNum;
     /**
      * 其他待出库数量
      */
-    private Integer otherOutNum;
+    private BigDecimal otherOutNum;
     /**
      * 盘点待出库数量
      */
-    private Integer OutPDNum;
+    private BigDecimal OutPDNum;
     /**
      *
      */
@@ -68,15 +68,15 @@ public class StoreWorkBenchVO extends BaseVO implements Serializable {
     /**
      * 采购申请入库数量
      */
-    private Integer purchaseApplyNum;
+    private BigDecimal purchaseApplyNum;
     /**
      * 待调拨入库数量
      */
-    private Integer applyDBNum;
+    private BigDecimal applyDBNum;
     /**
      * 其他待入库数量
      */
-    private Integer otherNum;
+    private BigDecimal otherNum;
     /**
      * 备件总价值
      */
@@ -91,7 +91,7 @@ public class StoreWorkBenchVO extends BaseVO implements Serializable {
     /**
      * 申请领用出库数量
      */
-    private Integer sparePickApplyNum;
+    private BigDecimal sparePickApplyNum;
     /**
      * 已领用出库数量(近一周内)
      */
@@ -115,7 +115,7 @@ public class StoreWorkBenchVO extends BaseVO implements Serializable {
     /**
      * 闲置入库
      */
-    private Integer spareBackApplyNum;
+    private BigDecimal spareBackApplyNum;
 
 
 }

+ 15 - 5
platform-dao/src/main/resources/mapper/store/InStoreFormMapper.xml

@@ -115,7 +115,7 @@
         <if test="keyword != null and keyword != ''">
             and (
             store.name like concat('%',#{keyword},'%')
-            or  store.no like concat('%',#{keyword},'%')
+            or store.no like concat('%',#{keyword},'%')
             )
         </if>
     </sql>
@@ -152,14 +152,24 @@
         where form.id = #{id}
     </select>
 
+    <!--    <select id="getInStoreDetailVOs" parameterType="com.platform.dao.dto.store.InStoreFormDTO"-->
+    <!--            resultType="com.platform.dao.vo.query.store.InStoreFormVO">-->
+    <!--        select detail.*,form.status-->
+    <!--        from t_in_store_detail detail-->
+    <!--        left join t_in_store_form form on form.id = detail.in_id-->
+
+    <!--    </select>-->
+
     <select id="getInStoreDetailVOs" parameterType="com.platform.dao.dto.store.InStoreFormDTO"
             resultType="com.platform.dao.vo.query.store.InStoreFormVO">
-        select detail.*,form.status
-        from t_in_store_detail detail
-        left join t_in_store_form form on form.id = detail.in_id
+        SELECT detail.type, COUNT(*) instorenum FROM `t_in_store_form` form JOIN `t_in_store_detail` detail
+ON form.id=detail.`in_id`
+WHERE
+STATUS=1
+GROUP BY
+detail.type
 
     </select>
 
 
-
 </mapper>

+ 17 - 6
platform-dao/src/main/resources/mapper/store/OutStoreFormMapper.xml

@@ -118,12 +118,12 @@
         </where>
     </select>
 
-    <select id="selectOutStoreList" parameterType="com.platform.dao.dto.store.OutStoreFormDTO"
-            resultType="com.platform.dao.vo.query.store.OutStoreFormVO">
- select detail.*,form.status
-        from t_out_store_detail detail
-        left join  t_out_store_form form on form.id = detail.out_id
-    </select>
+<!--    <select id="selectOutStoreList" parameterType="com.platform.dao.dto.store.OutStoreFormDTO"-->
+<!--            resultType="com.platform.dao.vo.query.store.OutStoreFormVO">-->
+<!-- select detail.*,form.status-->
+<!--        from t_out_store_detail detail-->
+<!--        left join  t_out_store_form form on form.id = detail.out_id-->
+<!--    </select>-->
 
     <select id="selectDetailList"  resultType="com.platform.dao.vo.query.store.OutStoreDetailVO">
         select detail.*,
@@ -138,4 +138,15 @@
         left join t_spare_part_info spareinfo on spareinfo.id = detail.spare_id
         where form.id = #{id}
     </select>
+
+    <select id="selectOutStoreList" parameterType="com.platform.dao.dto.store.OutStoreFormDTO"
+            resultType="com.platform.dao.vo.query.store.OutStoreFormVO">
+ SELECT form.type, COUNT(*) outstorenum FROM `t_out_store_form` form JOIN `t_out_store_detail` detail
+    ON form.id=detail.`out_id`
+    WHERE
+    STATUS=1
+    GROUP BY
+    form.type
+    </select>
+
 </mapper>

+ 45 - 57
platform-service/src/main/java/com/platform/service/store/impl/InStoreFormServiceImpl.java

@@ -153,69 +153,57 @@ public class InStoreFormServiceImpl extends BaseServiceImpl<InStoreFormMapper, I
         List<OutStoreFormVO> outStoreFormVOS=outStoreFormMapper.selectOutStoreList();
         List<InStoreFormVO> inStoreFormVOS=inStoreFormMapper.getInStoreDetailVOs();
         StoreWorkBenchVO storeWorkBenchVO=new StoreWorkBenchVO();
-        int num=0;
-        int purchaseNum=0;
-        int xzNum=0;
-        int dbNum=0;
-        int otherNum=0;
-        int num1=0;
-        int lyNum=0;
-        int dbNum2=0;
-        int bfNum=0;
-        int otherNum2=0;
-        int pdNum=0;
+        BigDecimal num=new BigDecimal(0);
+        BigDecimal purchaseNum=new BigDecimal(0);
+        BigDecimal xzNum=new BigDecimal(0);
+        BigDecimal dbNum=new BigDecimal(0);
+        BigDecimal otherNum=new BigDecimal(0);
+        BigDecimal num1=new BigDecimal(0);
+        BigDecimal lyNum=new BigDecimal(0);
+        BigDecimal dbNum2=new BigDecimal(0);
+        BigDecimal bfNum=new BigDecimal(0);
+        BigDecimal otherNum2=new BigDecimal(0);
+        BigDecimal pdNum=new BigDecimal(0);
         for(OutStoreFormVO vo:outStoreFormVOS){
-            List<OutStoreDetailVO> outStoreDetailVOS=vo.getDetailList();
-            //待出库
-            if(vo.getStatus()!=null&&vo.getStatus().equals(OutStoreStatusEnum.NOT_EXECUTE)){
-                if(outStoreDetailVOS!=null) {
-                    for (OutStoreDetailVO vo1 : outStoreDetailVOS) {
-                        num1 += vo1.getNum().intValue();
-                        if (vo1.getType() == OutStoreTypeEnum.CHUKU_LINGYONG.getValue()) {
-                            lyNum += vo1.getNum().intValue();
-                        }
-                        if (vo1.getType() == OutStoreTypeEnum.CHUKU_DIAOBO.getValue()) {
-                            dbNum2 += vo1.getNum().intValue();
-                        }
-                        if (vo1.getType() == OutStoreTypeEnum.CHUKU_BAOFEI.getValue()) {
-                            bfNum += vo1.getNum().intValue();
-                        }
-                        if (vo1.getType() == OutStoreTypeEnum.CHUKU_QITA.getValue()) {
-                            otherNum2 += vo1.getNum().intValue();
-                        }
-                        if (vo1.getType() == OutStoreTypeEnum.STORE_CHECK.getValue()) {
-                            pdNum += vo1.getNum().intValue();
-                        }
-                    }
-                }
+            //领用出库
+            if(vo.getType().equals(OutStoreTypeEnum.CHUKU_LINGYONG.getValue())){
+                lyNum=new BigDecimal(lyNum.intValue()+vo.getOutStoreNum().intValue());
+            }
+            //调拨出库
+            if(vo.getType().equals(OutStoreTypeEnum.CHUKU_DIAOBO.getValue())){
+                dbNum2=new BigDecimal(dbNum2.intValue()+vo.getOutStoreNum().intValue());
+            }
+            //报废出库
+            if(vo.getType().equals(OutStoreTypeEnum.CHUKU_BAOFEI.getValue())){
+                bfNum=new BigDecimal(bfNum.intValue()+vo.getOutStoreNum().intValue());
             }
+            if(vo.getType().equals(OutStoreTypeEnum.CHUKU_QITA.getValue()) ||vo.getType().equals(OutStoreTypeEnum.STORE_CHECK.getValue())){
+                otherNum2=new BigDecimal(otherNum2.intValue()+vo.getOutStoreNum().intValue());
+            }
+
+
         }
+        num1=new BigDecimal(lyNum.intValue()+dbNum2.intValue()+bfNum.intValue()+otherNum2.intValue());
         for(InStoreFormVO vo:inStoreFormVOS){
-            List<InStoreDetailVO> inStoreDetailVOS=vo.getDetailList();
-            //待入库数据
-            if(vo.getStatus()!=null&&vo.getStatus().equals(InStoreStatusEnum.NOT_EXECUTE.getValue())){
-                if(inStoreDetailVOS!=null) {
-                    for (InStoreDetailVO vo1 : inStoreDetailVOS) {
-                        num += vo1.getNum().intValue();
-                        //采购
-                        if (vo1.getType() == InStoreTypeEnum.CAIGOU_RUKU.getValue()) {
-                            purchaseNum += vo1.getNum().intValue();
-                        }
-                        //闲置入库
-                        if (vo1.getType() == InStoreTypeEnum.XIANZHI_RUKU.getValue()) {
-                            xzNum += vo1.getNum().intValue();
-                        }
-                        //调拨入库
-                        if (vo1.getType() == InStoreTypeEnum.DIAOBO_RUKU.getValue()) {
-                            dbNum += vo1.getNum().intValue();
-                        }
-                        if (vo1.getType() == InStoreTypeEnum.FAYUN_RUKU.getValue() || vo1.getType() == InStoreTypeEnum.STORE_CHECK.getValue()) {
-                            otherNum += vo1.getNum().intValue();
-                        }
-                    }
-                }
+            //采购入库
+            if(vo.getType().equals(InStoreTypeEnum.CAIGOU_RUKU.getValue())){
+                purchaseNum=new BigDecimal(lyNum.intValue()+vo.getInStoreNum().intValue());
+            }
+            //闲置入库
+            if(vo.getType().equals(InStoreTypeEnum.XIANZHI_RUKU.getValue())){
+                xzNum=new BigDecimal(xzNum.intValue()+vo.getInStoreNum().intValue());
+            }
+            //调拨入库
+            if(vo.getType().equals(InStoreTypeEnum.DIAOBO_RUKU.getValue())){
+                dbNum=new BigDecimal(bfNum.intValue()+vo.getInStoreNum().intValue());
             }
+            if(vo.getType().equals(InStoreTypeEnum.FAYUN_RUKU.getValue()) || vo.getType().equals(InStoreTypeEnum.STORE_CHECK.getValue())){
+                otherNum=new BigDecimal(otherNum.intValue()+vo.getInStoreNum().intValue());
+            }
+
         }
+        num=new BigDecimal(purchaseNum.intValue()+xzNum.intValue()+dbNum.intValue()+otherNum.intValue());
+
         storeWorkBenchVO.setInTotalNum(num);
         storeWorkBenchVO.setPurchaseApplyNum(purchaseNum);
         storeWorkBenchVO.setSpareBackApplyNum(xzNum);