ソースを参照

新增箱量统计

Sun 3 年 前
コミット
91905a194b

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

@@ -79,16 +79,16 @@ public class TWarehousebillsitemsSummaryController extends BaseController {
      * 出入库、库存统计
      */
     @GetMapping("/stockStatistics")
-    public AjaxResult stockStatistics() {
-        return AjaxResult.success(itWarehouseBillsService.stockStatistics());
+    public AjaxResult stockStatistics(String mode) {
+        return AjaxResult.success(itWarehouseBillsService.stockStatistics(mode));
     }
 
     /**
      * 周期库存统计
      */
     @GetMapping("/cycleStockStatistics")
-    public AjaxResult cycleStockStatistics() {
-        return AjaxResult.success(itWarehouseBillsService.cycleStockStatistics());
+    public AjaxResult cycleStockStatistics(String mode) {
+        return AjaxResult.success(itWarehouseBillsService.cycleStockStatistics(mode));
     }
 
     /**

+ 1 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/warehouseBusiness/TOtherFeesController.java

@@ -38,9 +38,7 @@ public class TOtherFeesController extends BaseController {
         startPage();
         // 仓库其他账务
         tWarehouseBills.setfBilltype("QTZW");
-        List<Map<String, Object>> list = itWarehouseBillsService.getWarehouseBusinessList(tWarehouseBills);
-        list.forEach(map -> map.put("fBilltype", "其他账务"));
-        return getDataTable(list);
+        return getDataTable(itWarehouseBillsService.getWarehouseBusinessList(tWarehouseBills));
     }
 
     /**

+ 26 - 4
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/mapper/TWhgenlegMapper.java

@@ -170,10 +170,6 @@ public interface TWhgenlegMapper {
 
     /**
      * 库存统计
-     * @param beginDate 起始时间
-     * @param endDate 截止时间
-     * @param external 外部用户
-     * @return
      */
     public Map<String, Object> stockStatistics(@Param("beginDate") String beginDate,
                                                @Param("endDate") String endDate,
@@ -183,6 +179,15 @@ public interface TWhgenlegMapper {
                                                @Param("mode") String mode);
 
     /**
+     * 库存Teu统计
+     */
+    public Map<String, Object> stockTeuStatistics(@Param("beginDate") String beginDate,
+                                               @Param("endDate") String endDate,
+                                               @Param("external") String external,
+                                               @Param("warehouseId") Long warehouseId,
+                                               @Param("customerId") Long customerId);
+
+    /**
      * 库龄
      * @param external 外部用户
      * @return
@@ -216,4 +221,21 @@ public interface TWhgenlegMapper {
     public List<Map<String, Object>> biWarehouseInfo(@Param("external") String external,
                                                      @Param("customerId") Long customerId,
                                                      @Param("mode") String mode);
+
+    /**
+     * bi大屏客户概况
+     *
+     * @return
+     */
+    public List<Map<String, Object>> biCustomerTeuInfo(@Param("external") String external,
+                                                    @Param("warehouseId") Long warehouseId,
+                                                    @Param("customerId") Long customerId);
+
+    /**
+     * bi大屏仓库概况
+     *
+     * @return
+     */
+    public List<Map<String, Object>> biWarehouseTeuInfo(@Param("external") String external,
+                                                     @Param("customerId") Long customerId);
 }

+ 28 - 7
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/service/impl/TWhgenlegServiceImpl.java

@@ -659,8 +659,15 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
         }
 
         if (warehouseId == null && customerId != null) {
+            if ("4".equals(mode)) {
+                return tWhgenlegMapper.biWarehouseTeuInfo(external, customerId);
+            }
             return tWhgenlegMapper.biWarehouseInfo(external, customerId, mode);
         }
+
+        if ("4".equals(mode)) {
+            return tWhgenlegMapper.biCustomerTeuInfo(external, warehouseId, customerId);
+        }
         return tWhgenlegMapper.biCustomerInfo(external, warehouseId, customerId, mode);
     }
 
@@ -677,6 +684,9 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
             external = user.getUserName();
         }
 
+        if ("4".equals(mode)) {
+            return tWhgenlegMapper.stockTeuStatistics(null, null, external, warehouseId, customerId);
+        }
         return tWhgenlegMapper.stockStatistics(null, null, external, warehouseId, customerId, mode);
     }
 
@@ -694,7 +704,9 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
         }
 
         List<String> names = new ArrayList<>();
-        if ("3".equals(mode)) {
+        if ("4".equals(mode)) {
+            Collections.addAll(names, "入库箱量", "出库箱量");
+        } else if ("3".equals(mode)) {
             Collections.addAll(names, "入库尺码", "出库尺码");
         } else if ("2".equals(mode)) {
             Collections.addAll(names, "入库重量", "出库重量");
@@ -715,12 +727,21 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
         for (int i = -5; i <= 0; i++) {
             categories.add(DateUtils.offsetFormatMonth(i, "M") + "月");
 
-            weightMap = tWarehousebillsitemsMapper.inAndOutStockStatistics("SJRK", DateUtils.beginOfOffsetMonth(i) + " 00:00:00",
-                    DateUtils.endOfOffsetMonth(i) + " 23:59:59", external, warehouseId, customerId, mode);
-            quantityInList.add(weightMap.get("total"));
-            weightMap = tWarehousebillsitemsMapper.inAndOutStockStatistics("SJCK", DateUtils.beginOfOffsetMonth(i) + " 00:00:00",
-                    DateUtils.endOfOffsetMonth(i) + " 23:59:59", external, warehouseId, customerId, mode);
-            quantityOutList.add(weightMap.get("total"));
+            if ("4".equals(mode)) {
+                weightMap = tWarehousebillsitemsMapper.inAndOutStockTeuStatistics("SJRK", DateUtils.beginOfOffsetMonth(i) + " 00:00:00",
+                        DateUtils.endOfOffsetMonth(i) + " 23:59:59", external, warehouseId, customerId);
+                quantityInList.add(weightMap.get("total"));
+                weightMap = tWarehousebillsitemsMapper.inAndOutStockTeuStatistics("SJCK", DateUtils.beginOfOffsetMonth(i) + " 00:00:00",
+                        DateUtils.endOfOffsetMonth(i) + " 23:59:59", external, warehouseId, customerId);
+                quantityOutList.add(weightMap.get("total"));
+            } else {
+                weightMap = tWarehousebillsitemsMapper.inAndOutStockStatistics("SJRK", DateUtils.beginOfOffsetMonth(i) + " 00:00:00",
+                        DateUtils.endOfOffsetMonth(i) + " 23:59:59", external, warehouseId, customerId, mode);
+                quantityInList.add(weightMap.get("total"));
+                weightMap = tWarehousebillsitemsMapper.inAndOutStockStatistics("SJCK", DateUtils.beginOfOffsetMonth(i) + " 00:00:00",
+                        DateUtils.endOfOffsetMonth(i) + " 23:59:59", external, warehouseId, customerId, mode);
+                quantityOutList.add(weightMap.get("total"));
+            }
         }
 
         seriesMap = new HashMap<>();

+ 10 - 5
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TWarehousebillsitemsMapper.java

@@ -289,11 +289,6 @@ public interface TWarehousebillsitemsMapper extends BaseMapper<TWarehousebillsit
 
     /**
      * 出入库统计
-     * @param beginDate 起始时间
-     * @param endDate 截止时间
-     * @param billType 单据类型
-     * @param external 外部用户
-     * @return
      */
     public Map<String, Object> inAndOutStockStatistics(@Param("billType") String billType,
                                                        @Param("beginDate") String beginDate,
@@ -304,6 +299,16 @@ public interface TWarehousebillsitemsMapper extends BaseMapper<TWarehousebillsit
                                                        @Param("mode") String mode);
 
     /**
+     * 出入库Teu统计
+     */
+    public Map<String, Object> inAndOutStockTeuStatistics(@Param("billType") String billType,
+                                                       @Param("beginDate") String beginDate,
+                                                       @Param("endDate") String endDate,
+                                                       @Param("external") String external,
+                                                       @Param("warehouseId") Long warehouseId,
+                                                       @Param("customerId") Long customerId);
+
+    /**
      * bi出入库列表
      *
      * @param billType 单据类型

+ 2 - 2
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/ITWarehouseBillsService.java

@@ -812,14 +812,14 @@ public interface ITWarehouseBillsService {
      *
      * @return
      */
-    public Map<String, String> stockStatistics();
+    public Map<String, String> stockStatistics(String mode);
 
     /**
      * 周期库存统计
      *
      * @return
      */
-    public Map<String, String> cycleStockStatistics();
+    public Map<String, String> cycleStockStatistics(String mode);
 
     /**
      * 出入库列表

+ 47 - 28
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseBillsServiceImpl.java

@@ -481,7 +481,13 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
      */
     @Override
     public List<Map<String, Object>> getWarehouseBusinessList(TWarehouseBills tWarehousebills) {
-        return tWarehouseBillsMapper.selectWarehouseBusinessList(tWarehousebills);
+        List<Map<String, Object>> list = tWarehouseBillsMapper.selectWarehouseBusinessList(tWarehousebills);
+        list.forEach(map -> {
+            map.put("fBilltype", "其他账务");
+            map.put("shipsName", tVesselMapper.selectTVesselById(((Integer) map.get("fVslid")).longValue()).getfName());
+            map.put("voyage", tVoyageMapper.selectTVoyageById(((Integer) map.get("fVoyid")).longValue()).getfNo());
+        });
+        return list;
     }
 
     /**
@@ -2025,7 +2031,8 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
     @Transactional
     public AjaxResult saveOtherFees(String tWarehouseBills, String feesCr, String feesDr, String type) {
         TWarehouseBills warehouseBills = JSONArray.parseObject(tWarehouseBills, TWarehouseBills.class);
-        warehouseBills.setfBilltype("QTZW");
+        String billsType = "QTZW";
+        warehouseBills.setfBilltype(billsType);
         // 判断提单号是否存在
         if (StringUtils.isNull(warehouseBills.getfId()) && tWarehouseBillsMapper.selectContainMblno(warehouseBills) > 0) {
             return AjaxResult.error("该参看编号已存在");
@@ -2041,6 +2048,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             }
         }
         if (StringUtils.isNull(warehouseBills.getfId())) {
+            warehouseBills.setfBillno(billnoSerialServiceImpl.getBillNo(billsType, warehouseBills.getfBsdate()));
             warehouseBills.setCreateTime(new Date());
             warehouseBills.setCreateBy(SecurityUtils.getUsername());
             warehouseBills.setfDeptid(SecurityUtils.getLoginUser().getUser().getDeptId());
@@ -8023,7 +8031,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
      * @return
      */
     @Override
-    public Map<String, String> stockStatistics() {
+    public Map<String, String> stockStatistics(String mode) {
         String external = null;
         String customerName;
         SysUser user = SecurityUtils.getLoginUser().getUser();
@@ -8040,26 +8048,26 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         // 客户名称
         data.put("customerName", customerName);
         // 全部库存
-        data.put("stockTotal", stockStatistics(null, null, external));
+        data.put("stockTotal", stockStatistics(null, null, external, mode));
 
         // 今天
-        data.put("inStockTotalToday", inAndOutStockStatistics("SJRK", DateUtils.today(), DateUtils.today(), external));
-        data.put("outStockTotalToday", inAndOutStockStatistics("SJCK", DateUtils.today(), DateUtils.today(), external));
+        data.put("inStockTotalToday", inAndOutStockStatistics("SJRK", DateUtils.today(), DateUtils.today(), external, mode));
+        data.put("outStockTotalToday", inAndOutStockStatistics("SJCK", DateUtils.today(), DateUtils.today(), external, mode));
         // 昨天
-        data.put("inStockTotalYesterday", inAndOutStockStatistics("SJRK", DateUtils.yesterday(), DateUtils.yesterday(), external));
-        data.put("outStockTotalYesterday", inAndOutStockStatistics("SJCK", DateUtils.yesterday(), DateUtils.yesterday(), external));
+        data.put("inStockTotalYesterday", inAndOutStockStatistics("SJRK", DateUtils.yesterday(), DateUtils.yesterday(), external, mode));
+        data.put("outStockTotalYesterday", inAndOutStockStatistics("SJCK", DateUtils.yesterday(), DateUtils.yesterday(), external, mode));
         // 本周
-        data.put("inStockTotalWeek", inAndOutStockStatistics("SJRK", DateUtils.beginOfWeek(), DateUtils.endOfWeek(), external));
-        data.put("outStockTotalWeek", inAndOutStockStatistics("SJCK", DateUtils.beginOfWeek(), DateUtils.endOfWeek(), external));
+        data.put("inStockTotalWeek", inAndOutStockStatistics("SJRK", DateUtils.beginOfWeek(), DateUtils.endOfWeek(), external, mode));
+        data.put("outStockTotalWeek", inAndOutStockStatistics("SJCK", DateUtils.beginOfWeek(), DateUtils.endOfWeek(), external, mode));
         // 上周
-        data.put("inStockTotalLastWeek", inAndOutStockStatistics("SJRK", DateUtils.beginOfLastWeek(), DateUtils.endOfLastWeek(), external));
-        data.put("outStockTotalLastWeek", inAndOutStockStatistics("SJCK", DateUtils.beginOfLastWeek(), DateUtils.endOfLastWeek(), external));
+        data.put("inStockTotalLastWeek", inAndOutStockStatistics("SJRK", DateUtils.beginOfLastWeek(), DateUtils.endOfLastWeek(), external, mode));
+        data.put("outStockTotalLastWeek", inAndOutStockStatistics("SJCK", DateUtils.beginOfLastWeek(), DateUtils.endOfLastWeek(), external, mode));
         // 本月
-        data.put("inStockTotalMonth", inAndOutStockStatistics("SJRK", DateUtils.beginOfMonth(), DateUtils.endOfMonth(), external));
-        data.put("outStockTotalMonth", inAndOutStockStatistics("SJCK", DateUtils.beginOfMonth(), DateUtils.endOfMonth(), external));
+        data.put("inStockTotalMonth", inAndOutStockStatistics("SJRK", DateUtils.beginOfMonth(), DateUtils.endOfMonth(), external, mode));
+        data.put("outStockTotalMonth", inAndOutStockStatistics("SJCK", DateUtils.beginOfMonth(), DateUtils.endOfMonth(), external, mode));
         // 上个月
-        data.put("inStockTotalLastMonth", inAndOutStockStatistics("SJRK", DateUtils.beginOfLastMonth(), DateUtils.endOfLastMonth(), external));
-        data.put("outStockTotalLastMonth", inAndOutStockStatistics("SJCK", DateUtils.beginOfLastMonth(), DateUtils.endOfLastMonth(), external));
+        data.put("inStockTotalLastMonth", inAndOutStockStatistics("SJRK", DateUtils.beginOfLastMonth(), DateUtils.endOfLastMonth(), external, mode));
+        data.put("outStockTotalLastMonth", inAndOutStockStatistics("SJCK", DateUtils.beginOfLastMonth(), DateUtils.endOfLastMonth(), external, mode));
         return data;
     }
 
@@ -8069,7 +8077,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
      * @return
      */
     @Override
-    public Map<String, String> cycleStockStatistics() {
+    public Map<String, String> cycleStockStatistics(String mode) {
         String external = null;
         SysUser user = SecurityUtils.getLoginUser().getUser();
         if ("外部用户".equals(user.getDept().getDeptName())) {
@@ -8080,37 +8088,48 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         // 库龄
         data.put("stockDays", String.valueOf(tWhgenlegMapper.stockDays(external, null, null).get("stockDays")));
         // 7天
-        data.put("stockTotalA", stockStatistics(DateUtils.offsetDate(-6), null, external));
+        data.put("stockTotalA", stockStatistics(DateUtils.offsetDate(-6), null, external, mode));
         // 15天
-        data.put("stockTotalB", stockStatistics(DateUtils.offsetDate(-14), DateUtils.offsetDate(-6), external));
+        data.put("stockTotalB", stockStatistics(DateUtils.offsetDate(-14), DateUtils.offsetDate(-6), external, mode));
         // 30天
-        data.put("stockTotalC", stockStatistics(DateUtils.offsetDate(-29), DateUtils.offsetDate(-14), external));
+        data.put("stockTotalC", stockStatistics(DateUtils.offsetDate(-29), DateUtils.offsetDate(-14), external, mode));
         // 60天
-        data.put("stockTotalD", stockStatistics(DateUtils.offsetDate(-59), DateUtils.offsetDate(-29), external));
+        data.put("stockTotalD", stockStatistics(DateUtils.offsetDate(-59), DateUtils.offsetDate(-29), external, mode));
         // 90天
-        data.put("stockTotalE", stockStatistics(DateUtils.offsetDate(-89), DateUtils.offsetDate(-59), external));
+        data.put("stockTotalE", stockStatistics(DateUtils.offsetDate(-89), DateUtils.offsetDate(-59), external, mode));
         // 180天
-        data.put("stockTotalF", stockStatistics(DateUtils.offsetDate(-179), DateUtils.offsetDate(-89), external));
+        data.put("stockTotalF", stockStatistics(DateUtils.offsetDate(-179), DateUtils.offsetDate(-89), external, mode));
         // 180天+
-        data.put("stockTotalG", stockStatistics(null, DateUtils.offsetDate(-179), external));
+        data.put("stockTotalG", stockStatistics(null, DateUtils.offsetDate(-179), external, mode));
         return data;
     }
 
-    private String inAndOutStockStatistics(String billType, String beginDate, String endDate, String external) {
+    private String inAndOutStockStatistics(String billType, String beginDate, String endDate, String external, String mode) {
         beginDate += " 00:00:00";
         endDate += " 23:59:59";
-        Map<String, Object> statistics = tWarehousebillsitemsMapper.inAndOutStockStatistics(billType, beginDate, endDate, external, null, null, null);
+        Map<String, Object> statistics;
+        if ("4".equals(mode)) {
+            statistics = tWarehousebillsitemsMapper.inAndOutStockTeuStatistics(billType, beginDate, endDate, external, null, null);
+            return String.valueOf(((Double) statistics.get("total")).longValue());
+        }
+        statistics = tWarehousebillsitemsMapper.inAndOutStockStatistics(billType, beginDate, endDate, external, null, null, mode);
         return String.valueOf(statistics.get("total"));
     }
 
-    private String stockStatistics(String beginDate, String endDate, String external) {
+    private String stockStatistics(String beginDate, String endDate, String external, String mode) {
         if (StringUtils.isNotEmpty(beginDate)) {
             beginDate += " 00:00:00";
         }
         if (StringUtils.isNotEmpty(endDate)) {
             endDate += " 00:00:00";
         }
-        Map<String, Object> statistics = tWhgenlegMapper.stockStatistics(beginDate, endDate, external, null, null, null);
+
+        Map<String, Object> statistics;
+        if ("4".equals(mode)) {
+            statistics = tWhgenlegMapper.stockTeuStatistics(beginDate, endDate, external, null, null);
+            return String.valueOf(((Double) statistics.get("quantity")).longValue());
+        }
+        statistics = tWhgenlegMapper.stockStatistics(beginDate, endDate, external, null, null, mode);
         return String.valueOf(statistics.get("quantity"));
     }
 

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

@@ -248,6 +248,9 @@ public class TWarehousebillsitemsServiceImpl implements ITWarehousebillsitemsSer
             external = user.getUserName();
         }
 
+        if ("4".equals(mode)) {
+            return tWarehousebillsitemsMapper.inAndOutStockTeuStatistics(billType, beginDate, endDate, external, warehouseId, customerId);
+        }
         return tWarehousebillsitemsMapper.inAndOutStockStatistics(billType, beginDate, endDate, external, warehouseId, customerId, mode);
     }
 

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

@@ -1215,6 +1215,23 @@
             <if test="customerId != null"> and f_corpid = #{customerId}</if>
     </select>
 
+    <select id="stockTeuStatistics" resultType="map">
+        select
+            ifnull(sum(case tb.f_billtype when 'SJRK' then f_cntrcount end * tr.f_teu), 0) -
+            ifnull(sum(case tb.f_billtype when 'SJCK' then f_cntrcount end * tr.f_teu), 0) as quantity
+        from t_warehousebills_cntr twc
+        left join t_warehousebills tb on twc.f_pid = tb.f_id
+        left join t_cntr tr on twc.f_cntrid = tr.f_id
+        where tb.f_items_status = '4'
+            <if test="beginDate != null and beginDate != ''">and tb.f_bsdate &gt;= #{beginDate}</if>
+            <if test="endDate != null and endDate != ''">and tb.f_bsdate &lt;= #{endDate}</if>
+            <if test="external != null and external != ''">
+                and tb.f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})
+            </if>
+            <if test="warehouseId != null"> and tb.f_warehouseid = #{warehouseId}</if>
+            <if test="customerId != null">and tb.f_corpid = #{customerId}</if>
+    </select>
+
     <select id="stockDays" resultType="map">
         select datediff(date_format(now(),'%Y-%m-%d'),date_format(min(f_bsdate),'%Y-%m-%d')) as stockDays
         from t_whgenleg
@@ -1274,7 +1291,7 @@
 
     <select id="biWarehouseInfo" resultType="map">
         select
-            t.f_name as customerName,
+            t.f_cname as customerName,
             <if test="mode == null or mode == ''">round(ifnull(sum(tw.f_grossweightblc), 0) / 1000) as quantity</if>
             <if test="mode != null and mode != ''">
                 case #{mode}
@@ -1295,4 +1312,42 @@
         order by quantity desc limit 10
     </select>
 
+    <select id="biCustomerTeuInfo" resultType="map">
+        select
+            ifnull(tb.f_shipper, tc.f_cname) as customerName,
+            ifnull(sum(case tb.f_billtype when 'SJRK' then f_cntrcount end * tr.f_teu), 0) -
+            ifnull(sum(case tb.f_billtype when 'SJCK' then f_cntrcount end * tr.f_teu), 0) as quantity
+        from t_warehousebills_cntr twc
+        left join t_warehousebills tb on twc.f_pid = tb.f_id
+        left join t_corps tc on tb.f_corpid = tc.f_id
+        left join t_cntr tr on twc.f_cntrid = tr.f_id
+        where tb.f_items_status = '4'
+            <if test="external != null and external != ''">
+                and tb.f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})
+            </if>
+            <if test="warehouseId != null"> and tb.f_warehouseid = #{warehouseId}</if>
+            <if test="customerId != null">and tb.f_corpid = #{customerId}</if>
+        group by customerName
+        order by quantity desc limit 10
+    </select>
+
+    <select id="biWarehouseTeuInfo" resultType="map">
+        select
+            t.f_cname as customerName,
+            ifnull(sum(case tb.f_billtype when 'SJRK' then f_cntrcount end * tr.f_teu), 0) -
+            ifnull(sum(case tb.f_billtype when 'SJCK' then f_cntrcount end * tr.f_teu), 0) as quantity
+        from t_warehousebills_cntr twc
+        left join t_warehousebills tb on twc.f_pid = tb.f_id
+        left join t_warehouse t on tb.f_warehouseid = t.f_id
+        left join t_cntr tr on twc.f_cntrid = tr.f_id
+        where tb.f_items_status = '4'
+            <if test="external != null and external != ''">
+                and tb.f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})
+            </if>
+            <if test="warehouseId != null"> and tb.f_warehouseid = #{warehouseId}</if>
+            <if test="customerId != null">and tb.f_corpid = #{customerId}</if>
+        group by customerName
+        order by quantity desc limit 10
+    </select>
+
 </mapper>

+ 2 - 0
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsMapper.xml

@@ -319,6 +319,8 @@
             END AS fItemsStatus,
             bill.f_billno AS fBillno,
             g.f_name AS fGoodsid,
+            bill.f_vslid AS fVslid,
+            bill.f_voyid AS fVoyid,
             bill.f_storekeeper AS fStorekeeper,
             bill.f_remarks_fees AS fRemarksFees
         FROM

+ 17 - 0
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsitemsMapper.xml

@@ -993,6 +993,23 @@
             <if test="customerId != null">and tb.f_corpid = #{customerId}</if>
     </select>
 
+    <select id="inAndOutStockTeuStatistics" resultType="map">
+        select
+            ifnull(sum(twc.f_cntrcount * tr.f_teu), 0) as total
+        from t_warehousebills_cntr twc
+        left join t_warehousebills tb on twc.f_pid = tb.f_id
+        left join t_cntr tr on twc.f_cntrid = tr.f_id
+        where tb.f_items_status = '4'
+            <if test="billType != null and billType != ''">and tb.f_billtype = #{billType}</if>
+            <if test="beginDate != null and beginDate != ''">and tb.f_bsdate &gt;= #{beginDate}</if>
+            <if test="endDate != null and endDate != ''">and tb.f_bsdate &lt;= #{endDate}</if>
+            <if test="external != null and external != ''">
+                and tb.f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})
+            </if>
+            <if test="warehouseId != null"> and tb.f_warehouseid = #{warehouseId}</if>
+            <if test="customerId != null">and tb.f_corpid = #{customerId}</if>
+    </select>
+
     <select id="biInAndOutStockList" resultType="map">
         select
             ifnull(tc.f_cname, tc.f_name) as customerName,