Browse Source

BI大屏数据接口提供

Sun 3 years ago
parent
commit
2f9b23d25f
16 changed files with 602 additions and 23 deletions
  1. 113 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/reportManagement/TWarehousebillsitemsSummaryController.java
  2. 15 0
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/mapper/TCorpsMapper.java
  3. 14 0
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/ITCorpsService.java
  4. 22 0
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TCorpsServiceImpl.java
  5. 36 0
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TWarehouseServiceImpl.java
  6. 23 0
      ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/mapper/TWhgenlegMapper.java
  7. 37 0
      ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/service/ITWhgenlegService.java
  8. 89 1
      ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/service/impl/TWhgenlegServiceImpl.java
  9. 9 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TWarehousebillsitemsMapper.java
  10. 17 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/ITWarehousebillsitemsService.java
  11. 21 8
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseBillsServiceImpl.java
  12. 25 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehousebillsitemsServiceImpl.java
  13. 16 1
      ruoyi-warehouse/src/main/resources/mapper/basicData/TCorpsMapper.xml
  14. 142 8
      ruoyi-warehouse/src/main/resources/mapper/reportManagement/TWhgenlegMapper.xml
  15. 5 3
      ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsMapper.xml
  16. 18 1
      ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsitemsMapper.xml

+ 113 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/reportManagement/TWarehousebillsitemsSummaryController.java

@@ -1,5 +1,6 @@
 package com.ruoyi.web.controller.warehouse.reportManagement;
 
+import com.ruoyi.basicData.service.ITCorpsService;
 import com.ruoyi.common.annotation.DataScope;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
@@ -10,7 +11,9 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.reportManagement.domain.TWareHouseItemsExcel;
 import com.ruoyi.reportManagement.service.ITWhgenlegService;
 import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
+import com.ruoyi.warehouseBusiness.service.ITWarehouseAgreementService;
 import com.ruoyi.warehouseBusiness.service.ITWarehouseBillsService;
+import com.ruoyi.warehouseBusiness.service.ITWarehousebillsitemsService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -29,12 +32,22 @@ import java.util.Map;
 @RestController
 @RequestMapping("/warehouseBusiness/summary")
 public class TWarehousebillsitemsSummaryController extends BaseController {
+
     @Autowired
     private ITWarehouseBillsService itWarehouseBillsService;
 
     @Autowired
     private ITWhgenlegService itWhgenlegService;
 
+    @Autowired
+    private ITCorpsService itCorpsService;
+
+    @Autowired
+    private ITWarehousebillsitemsService itWarehousebillsitemsService;
+
+    @Autowired
+    private ITWarehouseAgreementService itWarehouseAgreementService;
+
     /**
      * 查询库存总账列表
      */
@@ -54,7 +67,7 @@ public class TWarehousebillsitemsSummaryController extends BaseController {
     @GetMapping("/export")
     public AjaxResult export(TWarehouseBills tWarehouseBills) {
         List<TWareHouseItemsExcel> list = itWarehouseBillsService.selectTWarehousebillsItemsList(tWarehouseBills);
-        ExcelUtil<TWareHouseItemsExcel> util = new ExcelUtil<TWareHouseItemsExcel>(TWareHouseItemsExcel.class);
+        ExcelUtil<TWareHouseItemsExcel> util = new ExcelUtil<>(TWareHouseItemsExcel.class);
         return util.statisticsExportExcel(list, "总账统计");
     }
 
@@ -92,4 +105,103 @@ public class TWarehousebillsitemsSummaryController extends BaseController {
         return getDataTable(itWhgenlegService.stockAfterMonthList());
     }
 
+    /**
+     * bi大屏客户数量
+     */
+    @GetMapping("/biCustomerCount")
+    public AjaxResult biCustomerCount() {
+        return AjaxResult.success(itCorpsService.biCustomerCount());
+    }
+
+    /**
+     * bi大屏客户概况
+     */
+    @GetMapping("/biCustomerInfo")
+    public AjaxResult biCustomerInfo() {
+        return AjaxResult.success(itWhgenlegService.biCustomerInfo());
+    }
+
+    /**
+     * bi当日入库量
+     */
+    @GetMapping("/biTodayInStockCount")
+    public AjaxResult biTodayInStockCount() {
+        return AjaxResult.success(itWarehousebillsitemsService.biTodayInAndOutStockCount("SJRK"));
+    }
+
+    /**
+     * bi当日出库量
+     */
+    @GetMapping("/biTodayOutStockCount")
+    public AjaxResult biTodayOutStockCount() {
+        return AjaxResult.success(itWarehousebillsitemsService.biTodayInAndOutStockCount("SJCK"));
+    }
+
+    /**
+     * bi库存数量
+     */
+    @GetMapping("/biStockCount")
+    public AjaxResult biStockCount() {
+        return AjaxResult.success(itWhgenlegService.biStockCount());
+    }
+
+    /**
+     * bi大屏当月协议数量
+     */
+    @GetMapping("/biMonthContractCount")
+    public AjaxResult biMonthContractCount() {
+        return AjaxResult.success(itCorpsService.biMonthContractCount());
+    }
+
+    /**
+     * bi大屏商品概况
+     */
+    @GetMapping("/biGoodsInfo")
+    public AjaxResult biGoodsInfo() {
+        return AjaxResult.success(itWhgenlegService.biGoodsInfo());
+    }
+
+    /**
+     * bi大屏最大库龄
+     */
+    @GetMapping("/biMaxStockDays")
+    public AjaxResult biMaxStockDays() {
+        return AjaxResult.success(itWhgenlegService.biMaxStockDays());
+    }
+
+    /**
+     * bi大屏库龄概况
+     */
+    @GetMapping("/biStockDaysInfo")
+    public AjaxResult biStockDaysInfo() {
+        return AjaxResult.success(itWhgenlegService.biStockDaysInfo());
+    }
+
+    /**
+     * bi大屏入库列表
+     */
+    @GetMapping("/biInStockList")
+    public TableDataInfo biInStockList() {
+        startPage();
+        return getDataTable(itWarehousebillsitemsService.biInAndOutStockList("SJRK"));
+    }
+
+    /**
+     * bi大屏出库列表
+     */
+    @GetMapping("/biOutStockList")
+    public TableDataInfo biOutStockList() {
+        startPage();
+        return getDataTable(itWarehousebillsitemsService.biInAndOutStockList("SJCK"));
+    }
+
+    /**
+     * bi大屏仓储协议列表
+     */
+    @GetMapping("/biContractList")
+    public TableDataInfo biContractList() {
+        startPage();
+        return getDataTable(itWarehouseAgreementService.biContractList());
+    }
+
 }

+ 15 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/mapper/TCorpsMapper.java

@@ -154,4 +154,19 @@ public interface TCorpsMapper extends BaseMapper<TCorps> {
      * @return
      */
     List<TCorps> selectByIds(@Param("ids") List<Long> ids);
+
+    /**
+     * bi大屏客户数量
+     *
+     * @return
+     */
+    public Map<String, Object> biCustomerCount();
+
+    /**
+     * bi大屏当月协议数量
+     *
+     * @return
+     */
+    public Map<String, Object> biMonthContractCount(@Param("beginDate") String beginDate, @Param("endDate") String endDate);
+
 }

+ 14 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/ITCorpsService.java

@@ -114,4 +114,18 @@ public interface ITCorpsService {
      */
     public List<Map<String,Object>> getClientName(TCorps tCorps);
 
+    /**
+     * bi大屏客户数量
+     *
+     * @return
+     */
+    public Map<String, Object> biCustomerCount();
+
+    /**
+     * bi大屏当月协议数量
+     *
+     * @return
+     */
+    public Map<String, Object> biMonthContractCount();
+
 }

+ 22 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TCorpsServiceImpl.java

@@ -377,4 +377,26 @@ public class TCorpsServiceImpl implements ITCorpsService {
         return tCorpsMapper.getClientName(tCorps);
     }
 
+    /**
+     * bi大屏客户数量
+     *
+     * @return
+     */
+    @Override
+    public Map<String, Object> biCustomerCount() {
+        return tCorpsMapper.biCustomerCount();
+    }
+
+    /**
+     * bi大屏当月协议数量
+     *
+     * @return
+     */
+    @Override
+    public Map<String, Object> biMonthContractCount() {
+        String beginDate = DateUtils.beginOfMonth() + " 00:00:00";
+        String endDate = DateUtils.endOfMonth() + "23:59:59";
+        return tCorpsMapper.biMonthContractCount(beginDate, endDate);
+    }
+
 }

+ 36 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TWarehouseServiceImpl.java

@@ -332,7 +332,10 @@ public class TWarehouseServiceImpl implements ITWarehouseService {
     @Override
     @Transactional
     public int deleteTWarehouseById(Long fId) {
+        TWarehouse warehouse = tWarehouseMapper.selectTWarehouseById(fId);
         tWarehouseMapper.deleteTWarehouseById(fId);
+        updateParentGross(warehouse.getAncestors());
+
         annexMapper.deleteByPid(fId, AnnexActEnum.WAREHOUSE.getType());
         return 1;
     }
@@ -389,6 +392,8 @@ public class TWarehouseServiceImpl implements ITWarehouseService {
         tWarehouse.setfStatus("0");
         tWarehouseMapper.insertTWarehouse(tWarehouse);
 
+        updateParentGross(tWarehouse.getAncestors());
+
         if (CollectionUtils.isNotEmpty(tWarehouse.getAnnexList())) {
             tWarehouse.getAnnexList().forEach(li -> {
                 li.setfPid(tWarehouse.getfId());
@@ -420,6 +425,9 @@ public class TWarehouseServiceImpl implements ITWarehouseService {
 
         tWarehouse.setUpdateBy(username);
         tWarehouseMapper.updateTWarehouse(tWarehouse);
+
+        updateParentGross(tWarehouse.getAncestors());
+
         annexMapper.deleteByPid(tWarehouse.getfId(), AnnexActEnum.WAREHOUSE.getType());
         if (CollectionUtils.isNotEmpty(tWarehouse.getAnnexList())) {
             tWarehouse.getAnnexList().forEach(li -> {
@@ -626,4 +634,32 @@ public class TWarehouseServiceImpl implements ITWarehouseService {
         }
     }
 
+    private void updateParentGross(String ancestors) {
+        String[] split = ancestors.split(",");
+        Collections.reverse(Arrays.asList(split));
+
+        for (String ancestor : split) {
+            if ("0".equals(ancestor) || "100".equals(ancestor)) {
+                break;
+            }
+
+            Long parentId = Long.valueOf(ancestor);
+            List<TWarehouse> tWarehouses = tWarehouseMapper.selectChildrenDeptById(parentId);
+            BigDecimal allGross = new BigDecimal("0");
+
+            for (TWarehouse warehouse : tWarehouses) {
+                if (StringUtils.isNotNull(warehouse.getfTotalgross())) {
+                    allGross = allGross.add(warehouse.getfTotalgross());
+                }
+            }
+
+            if (allGross.compareTo(BigDecimal.ZERO) > 0) {
+                TWarehouse parent = new TWarehouse();
+                parent.setfId(parentId);
+                parent.setfTotalgross(allGross);
+                tWarehouseMapper.updatefTotalgross(parent);
+            }
+        }
+    }
+
 }

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

@@ -120,6 +120,14 @@ public interface TWhgenlegMapper {
     public List<Map<String, Object>> selectInventoryMapList(TWhgenleg tWhgenleg);
 
     /**
+     * App查询库存总账列表
+     *
+     * @param tWhgenleg 库存总账
+     * @return 库存总账集合
+     */
+    public List<Map<String, Object>> selectAppInventoryMapList(TWhgenleg tWhgenleg);
+
+    /**
      * 库存总账导出
      *
      * @param tWhgenleg
@@ -180,4 +188,19 @@ public interface TWhgenlegMapper {
      * @return
      */
     public List<Map<String, Object>> stockAfterMonthList(@Param("external") String external);
+
+    /**
+     * bi大屏客户概况
+     *
+     * @return
+     */
+    public List<Map<String, Object>> biCustomerInfo();
+
+    /**
+     * bi大屏商品概况
+     *
+     * @return
+     */
+    public List<Map<String, Object>> biGoodsInfo();
+
 }

+ 37 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/service/ITWhgenlegService.java

@@ -7,6 +7,7 @@ import com.ruoyi.reportManagement.domain.SingleAnalysisFeesExcel;
 import com.ruoyi.reportManagement.domain.TWhgenleg;
 import com.ruoyi.reportManagement.dto.TWarehousebill;
 import com.ruoyi.reportManagement.excel.Whgenleg;
+import org.springframework.web.bind.annotation.GetMapping;
 
 import java.util.List;
 import java.util.Map;
@@ -164,4 +165,40 @@ public interface ITWhgenlegService {
      * @return
      */
     public List<Map<String, Object>> stockAfterMonthList();
+
+    /**
+     * bi大屏客户概况
+     *
+     * @return
+     */
+    public List<Map<String, Object>> biCustomerInfo();
+
+    /**
+     * bi库存数量
+     *
+     * @return
+     */
+    public Map<String, Object> biStockCount();
+
+    /**
+     * bi大屏商品概况
+     *
+     * @return
+     */
+    public List<Map<String, Object>> biGoodsInfo();
+
+    /**
+     * bi大屏最大库龄
+     *
+     * @return
+     */
+    public Map<String, Object> biMaxStockDays();
+
+    /**
+     * bi大屏库龄概况
+     *
+     * @return
+     */
+    public List<Map<String, Object>> biStockDaysInfo();
+
 }

+ 89 - 1
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/service/impl/TWhgenlegServiceImpl.java

@@ -510,7 +510,7 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
         if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) {
             PageHelper.startPage(pageNum, pageSize);
         }
-        return tWhgenlegMapper.selectInventoryMapList(tWhgenleg);
+        return tWhgenlegMapper.selectAppInventoryMapList(tWhgenleg);
     }
 
     /**
@@ -631,4 +631,92 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
         return tWhgenlegMapper.stockAfterMonthList(external);
     }
 
+    /**
+     * bi大屏客户概况
+     *
+     * @return
+     */
+    @Override
+    public List<Map<String, Object>> biCustomerInfo() {
+        return tWhgenlegMapper.biCustomerInfo();
+    }
+
+    /**
+     * bi库存数量
+     *
+     * @return
+     */
+    @Override
+    public Map<String, Object> biStockCount() {
+        return tWhgenlegMapper.stockStatistics(null, null, null);
+    }
+
+    /**
+     * bi大屏商品概况
+     *
+     * @return
+     */
+    @Override
+    public List<Map<String, Object>> biGoodsInfo() {
+        return tWhgenlegMapper.biGoodsInfo();
+    }
+
+    /**
+     * bi大屏最大库龄
+     *
+     * @return
+     */
+    @Override
+    public Map<String, Object> biMaxStockDays() {
+        return tWhgenlegMapper.stockDays(null);
+    }
+
+    /**
+     * bi大屏库龄概况
+     *
+     * @return
+     */
+    @Override
+    public List<Map<String, Object>> biStockDaysInfo() {
+        List<Map<String, Object>> data = new ArrayList<>();
+        Map<String, Object> item;
+
+        item = tWhgenlegMapper.stockStatistics(DateUtils.offsetDate(-6) + " 00:00:00",
+                null, null);
+        item.put("name", "7天以内");
+        data.add(item);
+
+        item = tWhgenlegMapper.stockStatistics(DateUtils.offsetDate(-14) + " 00:00:00",
+                DateUtils.offsetDate(-6) + " 00:00:00", null);
+        item.put("name", "7~15天");
+        data.add(item);
+
+        item = tWhgenlegMapper.stockStatistics(DateUtils.offsetDate(-29) + " 00:00:00",
+                DateUtils.offsetDate(-14) + " 00:00:00", null);
+        item.put("name", "15~30天");
+        data.add(item);
+
+        item = tWhgenlegMapper.stockStatistics(DateUtils.offsetDate(-59) + " 00:00:00",
+                DateUtils.offsetDate(-29) + " 00:00:00", null);
+        item.put("name", "30~60天");
+        data.add(item);
+
+        item = tWhgenlegMapper.stockStatistics(DateUtils.offsetDate(-89) + " 00:00:00",
+                DateUtils.offsetDate(-59) + " 00:00:00", null);
+        item.put("name", "60~90天");
+        data.add(item);
+
+        item = tWhgenlegMapper.stockStatistics(DateUtils.offsetDate(-179) + " 00:00:00",
+                DateUtils.offsetDate(-89) + " 00:00:00", null);
+        item.put("name", "90~180天");
+        data.add(item);
+
+        item = tWhgenlegMapper.stockStatistics(null,
+                DateUtils.offsetDate(-179) + " 00:00:00", null);
+        item.put("name", "超过180天");
+        data.add(item);
+
+        return data;
+    }
+
 }

+ 9 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TWarehousebillsitemsMapper.java

@@ -299,4 +299,13 @@ public interface TWarehousebillsitemsMapper extends BaseMapper<TWarehousebillsit
                                                        @Param("beginDate") String beginDate,
                                                        @Param("endDate") String endDate,
                                                        @Param("external") String external);
+
+    /**
+     * bi出入库列表
+     *
+     * @param billType 单据类型
+     * @return
+     */
+    public List<Map<String,Object>> biInAndOutStockList(@Param("billType") String billType);
+
 }

+ 17 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/ITWarehousebillsitemsService.java

@@ -83,4 +83,21 @@ public interface ITWarehousebillsitemsService {
      * @return
      */
     AjaxResult warehouseComparison(WarehouseDTO warehouseDto);
+
+    /**
+     * bi当日出入库量
+     *
+     * @param billType 单据类型
+     * @return
+     */
+    public Map<String,Object> biTodayInAndOutStockCount(String billType);
+
+    /**
+     * bi出入库列表
+     *
+     * @param billType 单据类型
+     * @return
+     */
+    public List<Map<String,Object>> biInAndOutStockList(String billType);
+
 }

+ 21 - 8
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseBillsServiceImpl.java

@@ -3080,6 +3080,15 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         if ("SJRK".equals(billsType)) {
             tWarehousebillsitems.setfOriginalbilldate(warehousebillsitems.getfBsdate());//入库时间
             warehousebillsitems.setfOriginalbilldate(warehousebillsitems.getfBsdate());
+
+            // 前端参数先赋值,否则影响库存查询
+            warehousebillsitems.setfQty(tWarehousebillsitems.getfQty());
+            warehousebillsitems.setfGrossweight(tWarehousebillsitems.getfGrossweight());
+            warehousebillsitems.setfNetweight(tWarehousebillsitems.getfNetweight());
+            warehousebillsitems.setfStevedore(tWarehousebillsitems.getfStevedore());
+            warehousebillsitems.setRemark(tWarehousebillsitems.getRemark());
+            warehousebillsitems.setfWarehouselocid(tWarehousebillsitems.getfWarehouselocid());
+
             // 查询库容量  是否可入库
             int m = calculation(warehouseBills.getfWarehouseid(), warehousebillsitems.getfGrossweight());
             if (m == 0) {
@@ -3094,12 +3103,6 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
                     return AjaxResult.error("更新库存总账失败");
                 }
             } else {
-                warehousebillsitems.setfQty(tWarehousebillsitems.getfQty());
-                warehousebillsitems.setfGrossweight(tWarehousebillsitems.getfGrossweight());
-                warehousebillsitems.setfNetweight(tWarehousebillsitems.getfNetweight());
-                warehousebillsitems.setfStevedore(tWarehousebillsitems.getfStevedore());
-                warehousebillsitems.setRemark(tWarehousebillsitems.getRemark());
-                warehousebillsitems.setfWarehouselocid(tWarehousebillsitems.getfWarehouselocid());
                 instalTWhgenleg(warehouseBills, warehousebillsitems);
             }
             tWarehousebillsitems.setfIsInventory(0L);
@@ -5031,6 +5034,16 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             if (tWarehousebillsitemsMapper.selectItemFStatusByFPid(id) != 0) {
                 return AjaxResult.error("删除失败,该单据库存明细已入账");
             }
+
+            AuditItems auditItems = new AuditItems();
+            auditItems.setBillId(id);
+            auditItems.setBillNo(tWarehousebills.getfBillno());
+            auditItems.setRefno3(tWarehousebills.getfMblno());
+            auditItems.setAuditStatus("S");
+            if (auditItemsMapper.selectAuditItemsList(auditItems).size() > 0) {
+                return AjaxResult.error("删除失败,该单据已请核");
+            }
+
             // 2、业务编号、客存编号 放入 billno_del
             BillnoDel billnoDel = new BillnoDel();
             billnoDel.setBillType(tWarehousebills.getfBilltype());
@@ -7725,7 +7738,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 
         Map<String, String> data = new HashMap<>();
         // 库龄
-        data.put("stockDays", String.valueOf(tWhgenlegMapper.stockDays(external).get("days")));
+        data.put("stockDays", String.valueOf(tWhgenlegMapper.stockDays(external).get("stockDays")));
         // 7天
         data.put("stockTotalA", stockStatistics(DateUtils.offsetDate(-6), null, external));
         // 15天
@@ -7758,7 +7771,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             endDate += " 00:00:00";
         }
         Map<String, Object> statistics = tWhgenlegMapper.stockStatistics(beginDate, endDate, external);
-        return String.valueOf(statistics.get("total"));
+        return String.valueOf(statistics.get("quantity"));
     }
 
     /**

+ 25 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehousebillsitemsServiceImpl.java

@@ -231,4 +231,29 @@ public class TWarehousebillsitemsServiceImpl implements ITWarehousebillsitemsSer
         return AjaxResult.success(secondItemsList);
     }
 
+    /**
+     * bi当日出入库量
+     *
+     * @param billType 单据类型
+     * @return
+     */
+    @Override
+    public Map<String,Object> biTodayInAndOutStockCount(String billType){
+        String beginDate = DateUtils.today() + " 00:00:00";
+        String endDate = DateUtils.today() + " 23:59:59";
+
+        return tWarehousebillsitemsMapper.inAndOutStockStatistics(billType, beginDate, endDate, null);
+    }
+
+    /**
+     * bi出入库列表
+     *
+     * @param billType 单据类型
+     * @return
+     */
+    @Override
+    public List<Map<String,Object>> biInAndOutStockList(String billType) {
+        return tWarehousebillsitemsMapper.biInAndOutStockList(billType);
+    }
+
 }

+ 16 - 1
ruoyi-warehouse/src/main/resources/mapper/basicData/TCorpsMapper.xml

@@ -458,4 +458,19 @@
             </foreach>
     </select>
 
-</mapper>
+    <select id="biCustomerCount" resultType="map">
+        select count(f_id) as customerCount
+        from t_corps
+        where f_id in (select distinct f_corpid from t_whgenleg where f_qtyD != 0 and f_qtyblc != 0);
+    </select>
+
+    <select id="biMonthContractCount" resultType="map">
+        select count(f_id) as customerCount
+        from t_corps
+        where
+            f_typename like '%客户%'
+            <if test="beginDate != null and beginDate != ''">and create_time &gt;= #{beginDate}</if>
+            <if test="endDate != null and endDate != ''">and create_time &lt; #{endDate}</if>
+    </select>
+
+</mapper>

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

@@ -746,19 +746,19 @@
             IFNULL(SUM(leg.f_volumnD),0) AS fVolumnD,
             IFNULL(SUM(leg.f_qtyD),0) AS fQtyD,
             leg.f_mblno AS fMblno,
-            ROUND(IFNULL(SUM(leg.f_grossweightD),0) / 1000, 2)  AS fGrossweightD,
-            ROUND(IFNULL(SUM(leg.f_netweightD),0) / 1000, 2) AS fNetweightD,
+            IFNULL(SUM(leg.f_grossweightD),0) AS fGrossweightD,
+            IFNULL(SUM(leg.f_netweightD),0) AS fNetweightD,
             IFNULL(SUM(leg.f_volumnC),0) AS fVolumnC,
             IFNULL(SUM(leg.f_volumnblc),0) AS fVolumnblc,
             SUM(leg.f_qtyC) AS fQtyC,
             leg.f_business_type AS fBusinessType,
-            ROUND(IFNULL(SUM(leg.f_grossweightC),0) / 1000, 2) AS fGrossweightC,
-            ROUND(IFNULL(SUM(leg.f_netweightC),0) / 1000, 2) AS fNetweightC,
+            IFNULL(SUM(leg.f_grossweightC),0) AS fGrossweightC,
+            IFNULL(SUM(leg.f_netweightC),0) AS fNetweightC,
             IFNULL(SUM(leg.f_qtyblc),0) AS fQtyblc,
             leg.f_billingway AS fBillingway,
             leg.f_chargedate AS fChargedate,
-            ROUND(IFNULL(SUM(leg.f_grossweightblc),0) / 1000, 2) AS fGrossweightblc,
-            ROUND(IFNULL(SUM(leg.f_netweightblc),0) / 1000, 2) AS fNetweightblc,
+            IFNULL(SUM(leg.f_grossweightblc),0) AS fGrossweightblc,
+            IFNULL(SUM(leg.f_netweightblc),0) AS fNetweightblc,
             dict.dict_label AS fBusinessTypes,
             leg.f_marks AS fMarks,
             DATE_FORMAT( leg.create_time, '%Y-%m-%d' ) AS createTime,
@@ -836,6 +836,116 @@
         ${params.dataScope}
         order by leg.f_bsdate desc
     </select>
+
+    <select id="selectAppInventoryMapList" parameterType="TWhgenleg" resultType="Map">
+        select
+        DISTINCT
+        leg.f_id AS fId,
+        leg.f_corpid AS fCorpIds,
+        corp.f_name AS fCorpid,
+        ware.f_warehouse_information AS fWarehouseids,
+        area.f_name AS fWarehouseLocationids,
+        leg.f_originalbillno AS fOriginalbillno,
+        leg.f_warehouse_locationid AS fWarehouseLocationid,
+        dict1.dict_label AS fTrademodeid,
+        goods.f_name AS fGoodsids,
+        leg.f_trademodeid AS fTrademodeids,
+        goods.f_packagespecs AS fPackagespecs,
+        leg.f_goodsid AS fGoodsid,
+        IFNULL(SUM(leg.f_volumnD),0) AS fVolumnD,
+        IFNULL(SUM(leg.f_qtyD),0) AS fQtyD,
+        leg.f_mblno AS fMblno,
+        ROUND(IFNULL(SUM(leg.f_grossweightD),0) / 1000, 2)  AS fGrossweightD,
+        ROUND(IFNULL(SUM(leg.f_netweightD),0) / 1000, 2) AS fNetweightD,
+        IFNULL(SUM(leg.f_volumnC),0) AS fVolumnC,
+        IFNULL(SUM(leg.f_volumnblc),0) AS fVolumnblc,
+        SUM(leg.f_qtyC) AS fQtyC,
+        leg.f_business_type AS fBusinessType,
+        ROUND(IFNULL(SUM(leg.f_grossweightC),0) / 1000, 2) AS fGrossweightC,
+        ROUND(IFNULL(SUM(leg.f_netweightC),0) / 1000, 2) AS fNetweightC,
+        IFNULL(SUM(leg.f_qtyblc),0) AS fQtyblc,
+        leg.f_billingway AS fBillingway,
+        leg.f_chargedate AS fChargedate,
+        ROUND(IFNULL(SUM(leg.f_grossweightblc),0) / 1000, 2) AS fGrossweightblc,
+        ROUND(IFNULL(SUM(leg.f_netweightblc),0) / 1000, 2) AS fNetweightblc,
+        dict.dict_label AS fBusinessTypes,
+        leg.f_marks AS fMarks,
+        DATE_FORMAT( leg.create_time, '%Y-%m-%d' ) AS createTime,
+        DATE_FORMAT( leg.f_originalbilldate, '%Y-%m-%d' ) AS fOriginalbilldate,
+        leg.f_cntrno AS fCntrno,
+        leg.f_localcntrno fLocalcntrno
+        FROM
+        t_whgenleg leg
+        left join sys_user u on leg.create_by = u.user_name
+        left join sys_user u1 on leg.create_by = u1.user_name
+        left join sys_dept d on u.dept_id = d.dept_id
+        LEFT JOIN t_corps corp ON corp.f_id = leg.f_corpid
+        LEFT JOIN t_customer_contact tc ON tc.f_pid = corp.f_id
+        LEFT JOIN t_goods goods ON goods.f_id = leg.f_goodsid
+        LEFT JOIN t_warehouse ware ON ware.f_id = leg.f_warehouse_locationid
+        LEFT JOIN sys_dict_data dict ON dict.dict_value = leg.f_business_type
+        LEFT JOIN t_warehouse_area area ON area.f_id = leg.f_warehouse_locationid
+        LEFT JOIN sys_dict_data dict1 ON dict1.dict_value = leg.f_trademodeid
+        <where>
+            dict.status = '0'
+            AND dict1.status = '0'
+            AND leg.f_qtyD != 0
+            AND dict.dict_type = 'storage_type'
+            AND dict1.dict_type = 'data_trademodes'
+            <if test="fOriginalbillno != null  and fOriginalbillno != ''">and leg.f_originalbillno = #{fOriginalbillno}</if>
+            <if test="fTel != null  and fTel != ''">and tc.f_tel = #{fTel}</if>
+            <if test="fPreqty != null ">and leg.f_preqty = #{fPreqty}</if>
+            <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
+            <if test="fMblno != null ">and leg.f_mblno LIKE  concat('%', #{fMblno}, '%') </if>
+            <if test='orgStorageDate != null and orgStorageDate[0] != null and orgStorageDate[0]!= ""'>
+                and leg.f_originalbilldate &gt;= #{orgStorageDate[0]}
+            </if>
+            <if test='orgStorageDate != null and orgStorageDate[1] != null and orgStorageDate[1]!= ""'>
+                and leg.f_originalbilldate &lt;= #{orgStorageDate[1]}
+            </if>
+            <if test="fPregrossweight != null ">and leg.f_pregrossweight = #{fPregrossweight}</if>
+            <if test="fPrenetweight != null ">and leg.f_prenetweight = #{fPrenetweight}</if>
+            <if test="fQtyd != null ">and leg.f_qtyD = #{fQtyd}</if>
+            <if test="fTrademodeid != null ">and leg.f_trademodeid = #{fTrademodeid}</if>
+            <if test="fGoodsid != null ">and leg.f_goodsid = #{fGoodsid}</if>
+            <if test="fVolumnd != null ">and leg.f_volumnD = #{fVolumnd}</if>
+            <if test="fGrossweightd != null ">and leg.f_grossweightD = #{fGrossweightd}</if>
+            <if test="fNetweightd != null ">and leg.f_netweightD = #{fNetweightd}</if>
+            <if test="fVolumnc != null ">and leg.f_volumnC = #{fVolumnc}</if>
+            <if test="fQtyc != null ">and leg.f_qtyC = #{fQtyc}</if>
+            <if test="fOriginalbilldate != null ">and leg.f_originalbilldate = #{fOriginalbilldate}</if>
+            <if test="fMarks != null  and fMarks != ''">and leg.f_marks LIKE  concat('%', #{fMarks}, '%')</if>
+            <if test="fQtyblc != null ">and leg.f_qtyblc = #{fQtyblc}</if>
+            <if test="fGrossweightc != null ">and leg.f_grossweightC = #{fGrossweightc}</if>
+            <if test="fNetweightc != null ">and leg.f_netweightC = #{fNetweightc}</if>
+            <if test="fGrossweightblc != null ">and leg.f_grossweightblc = #{fGrossweightblc}</if>
+            <if test="fNetweightblc != null ">and leg.f_netweightblc = #{fNetweightblc}</if>
+            <if test="fStatus != null  and fStatus != ''">and leg.f_status = #{fStatus}</if>
+            <if test="fWarehouseid != null ">and leg.f_warehouseid = #{fWarehouseid} </if>
+            <if test="fLocation != null and fLocation ==1 ">
+                and leg.f_warehouse_locationid = #{fWarehouseLocationid}
+            </if>
+            <if test="fCntrno != null  and fCntrno != ''">
+                and leg.f_cntrno  LIKE  concat('%', #{fCntrno}, '%')
+            </if>
+            <if test="fLocalcntrno != null  and fLocalcntrno != ''">
+                and leg.f_localcntrno  LIKE  concat('%', #{fLocalcntrno}, '%')
+            </if>
+            <if test="fLocation != null  and fLocation ==0 ">
+                and ware.ancestors  LIKE  concat('%', #{fWarehouseLocationid}, '%')
+            </if>
+            GROUP BY leg.f_corpid,leg.f_originalbillno, leg.f_originalbilldate, leg.f_warehouse_locationid, leg.f_goodsid, leg.f_trademodeid
+            <if test="isCntrno != null and isCntrno == 0 ">
+                ,leg.f_cntrno
+            </if>
+            <if test="isMblno != null and isMblno == 0 ">
+                ,leg.f_mblno
+            </if>
+        </where>
+        ${params.dataScope}
+        order by leg.f_bsdate desc
+    </select>
+
     <select id="selectWhgenlegMessage" parameterType="TWhgenleg" resultType="com.ruoyi.reportManagement.excel.Whgenleg">
         select
         DISTINCT
@@ -1062,7 +1172,7 @@
     </select>
 
     <select id="stockStatistics" resultType="map">
-        select round(ifnull(sum(f_grossweightblc), 0) / 1000) as total
+        select round(ifnull(sum(f_grossweightblc), 0) / 1000) as quantity
         from t_whgenleg
         <where>
             <if test="beginDate != null and beginDate != ''">and f_bsdate &gt;= #{beginDate}</if>
@@ -1074,7 +1184,7 @@
     </select>
 
     <select id="stockDays" resultType="map">
-        select datediff(date_format(now(),'%Y-%m-%d'),date_format(min(f_bsdate),'%Y-%m-%d')) as days
+        select datediff(date_format(now(),'%Y-%m-%d'),date_format(min(f_bsdate),'%Y-%m-%d')) as stockDays
         from t_whgenleg
         where
             f_qtyD != 0
@@ -1104,4 +1214,28 @@
         order by tw.f_bsdate
     </select>
 
+    <select id="biCustomerInfo" resultType="map">
+        select
+            tc.f_name as customerName,
+            round(sum(tw.f_grossweightblc) / 1000, 2) as quantity
+        from t_whgenleg tw left join t_corps tc on tw.f_corpid = tc.f_id
+        where
+            tw.f_qtyD != 0
+            and tw.f_qtyblc != 0
+        group by tc.f_name
+        order by quantity desc limit 10
+    </select>
+
+    <select id="biGoodsInfo" resultType="map">
+        select
+            tg.f_name as goodsName,
+            round(sum(tw.f_grossweightblc) / 1000, 2) as quantity
+        from t_whgenleg tw left join t_goods tg on tw.f_goodsid = tg.f_id
+        where
+            tw.f_qtyD != 0
+            and tw.f_qtyblc != 0
+        group by tg.f_name
+        order by quantity desc limit 10
+    </select>
+
 </mapper>

+ 5 - 3
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsMapper.xml

@@ -2511,9 +2511,11 @@
             left join sys_user u1 on w.f_storekeeper = u1.user_name
             left join sys_dept d on w.f_bsdeptid = d.dept_id
         where
-            IF( w.f_planqty IS NOT NULL, w.f_planqty != w.f_qty, w.f_id != '')
-            and w.f_billtype = #{fBilltype}
-            AND w.f_billstatus != 6
+        w.f_billtype = #{fBilltype}
+        AND w.f_billstatus != 6
+        <if test="fItemsStatus == null and timeInterval == null and fMblno == null">
+            and IF( w.f_planqty IS NOT NULL, w.f_planqty != w.f_qty, w.f_id != '')
+        </if>
         <if test="fMblno != null ">and w.f_mblno like concat('%', #{fMblno}, '%')</if>
         <if test="fItemsStatus != null ">and w.f_items_status = #{fItemsStatus}</if>
         <if test="fBillstatus != null ">and w.f_billstatus = #{fBillstatus}</if>

+ 18 - 1
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsitemsMapper.xml

@@ -958,7 +958,7 @@
         left join t_warehousebills tb on ts.f_mblno = tb.f_mblno and ts.f_billno = tb.f_billno
         where
             ts.f_billstatus = '40'
-            <if test="billType != null and billType != ''">and tb.f_billtype = #{billType}</if>
+            <if test="billType != null and billType != ''">and ts.f_billtype = #{billType}</if>
             <if test="beginDate != null and beginDate != ''">and ts.f_bsdate &gt;= #{beginDate}</if>
             <if test="endDate != null and endDate != ''">and ts.f_bsdate &lt;= #{endDate}</if>
             <if test="external != null and external != ''">
@@ -966,4 +966,21 @@
             </if>
     </select>
 
+    <select id="biInAndOutStockList" resultType="map">
+        select
+            tc.f_name as customerName,
+            ts.f_warehouse_information as warehouseName,
+            tg.f_name as goodsName,
+            round(ts.f_grossweight / 1000, 2) as quantity,
+            date_format(ts.update_time, '%Y-%m-%d %H:%i:%s') as businessTime
+        from t_warehousebillsitems ts
+        left join t_warehousebills tb on ts.f_pid = tb.f_id
+        left join t_corps tc on tb.f_corpid = tc.f_id
+        left join t_goods tg on ts.f_goodsid = tg.f_id
+        where
+            ts.f_billstatus = '40'
+            <if test="billType != null and billType != ''">and ts.f_billtype = #{billType}</if>
+        order by ts.f_bsdate desc
+    </select>
+
 </mapper>