瀏覽代碼

BI大屏新增毛重比接口

Sun 3 年之前
父節點
當前提交
6266d2244a

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

@@ -174,6 +174,14 @@ public class TWarehousebillsitemsSummaryController extends BaseController {
     }
 
     /**
+     * bi大屏毛重概况
+     */
+    @GetMapping("/biWeightInfo")
+    public AjaxResult biWeightInfo(Long warehouseId) {
+        return AjaxResult.success(itWhgenlegService.biWeightInfo(warehouseId));
+    }
+
+    /**
      * bi大屏最大库龄
      */
     @GetMapping("/biMaxStockDays")

+ 21 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java

@@ -464,6 +464,27 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         return dateTime(cale.getTime());
     }
 
+    public static String offsetOnlyMonth(int num) {
+        SimpleDateFormat sf = new SimpleDateFormat("M");
+        Calendar cale = Calendar.getInstance();
+        cale.add(Calendar.MONTH, num);
+        return sf.format(cale.getTime());
+    }
+
+    public static String beginOfOffsetMonth(int num) {
+        Calendar cale = Calendar.getInstance();
+        cale.add(Calendar.MONTH, num);
+        cale.set(Calendar.DAY_OF_MONTH, 1);
+        return dateTime(cale.getTime());
+    }
+
+    public static String endOfOffsetMonth(int num) {
+        Calendar cale = Calendar.getInstance();
+        cale.add(Calendar.MONTH, num + 1);
+        cale.set(Calendar.DAY_OF_MONTH, 0);
+        return dateTime(cale.getTime());
+    }
+
     public static Date todayBegin() {
         Calendar calendar = new GregorianCalendar();
         calendar.set(Calendar.HOUR_OF_DAY, 0);

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

@@ -206,4 +206,13 @@ public interface TWhgenlegMapper {
      */
     public List<Map<String, Object>> biGoodsInfo(Long warehouseId);
 
+    /**
+     * bi大屏毛重概况
+     *
+     * @return
+     */
+    public Map<String, Object> biWeightInfo(@Param("beginDate") String beginDate,
+                                                  @Param("endDate") String endDate,
+                                                  @Param("warehouseId") Long warehouseId);
+
 }

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

@@ -188,6 +188,13 @@ public interface ITWhgenlegService {
     public List<Map<String, Object>> biGoodsInfo(Long warehouseId);
 
     /**
+     * bi大屏毛重概况
+     *
+     * @return
+     */
+    public Map<String, Object> biWeightInfo(Long warehouseId);
+
+    /**
      * bi大屏最大库龄
      *
      * @return

+ 39 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/service/impl/TWhgenlegServiceImpl.java

@@ -662,6 +662,45 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
     }
 
     /**
+     * bi大屏毛重概况
+     *
+     * @return
+     */
+    @Override
+    public Map<String, Object> biWeightInfo(Long warehouseId) {
+        Map<String, Object> data = new HashMap<>();
+        List<Map<String, Object>> series = new ArrayList<>();
+        Map<String, Object> seriesMap;
+
+        List<String> categories = new ArrayList<>();
+        List<Object> quantityInList = new ArrayList<>();
+        List<Object> quantityList = new ArrayList<>();
+        Map<String, Object> weightMap;
+
+        for (int i = -6; i < 0; i++) {
+            categories.add(DateUtils.offsetOnlyMonth(i) + "月");
+
+            weightMap = tWhgenlegMapper.biWeightInfo(DateUtils.beginOfOffsetMonth(i) + " 00:00:00",
+                    DateUtils.endOfOffsetMonth(i) + " 23:59:59", warehouseId);
+            quantityInList.add(weightMap.get("quantityIn"));
+            quantityList.add(weightMap.get("quantity"));
+        }
+
+        seriesMap = new HashMap<>();
+        seriesMap.put("name", "入库毛重");
+        seriesMap.put("data", quantityInList);
+        series.add(seriesMap);
+        seriesMap = new HashMap<>();
+        seriesMap.put("name", "库存毛重");
+        seriesMap.put("data", quantityList);
+        series.add(seriesMap);
+
+        data.put("categories", categories);
+        data.put("series", series);
+        return data;
+    }
+
+    /**
      * bi大屏最大库龄
      *
      * @return

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

@@ -1176,7 +1176,7 @@
         from t_whgenleg
         <where>
             <if test="beginDate != null and beginDate != ''">and f_bsdate &gt;= #{beginDate}</if>
-            <if test="endDate != null and endDate != ''">and f_bsdate &lt; #{endDate}</if>
+            <if test="endDate != null and endDate != ''">and f_bsdate &lt;= #{endDate}</if>
             <if test="external != null and external != ''">
                 and f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})
             </if>
@@ -1242,4 +1242,17 @@
         order by quantity desc limit 10
     </select>
 
+    <select id="biWeightInfo" resultType="map">
+        select
+            round(sum(f_grossweightD) / 1000, 2) as quantityIn,
+            round(sum(f_grossweightblc) / 1000, 2) as quantity
+        from t_whgenleg
+        where
+            f_qtyD != 0
+            and f_qtyblc != 0
+            <if test="warehouseId != null and warehouseId != ''">and f_warehouseid = #{warehouseId}</if>
+            <if test="beginDate != null and beginDate != ''">and f_bsdate &gt;= #{beginDate}</if>
+            <if test="endDate != null and endDate != ''">and f_bsdate &lt;= #{endDate}</if>
+    </select>
+
 </mapper>

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

@@ -285,7 +285,7 @@
 
     <select id="biContractList" resultType="map">
         select
-            tc.f_name AS customerName,
+            ifnull(tc.f_cname, tc.f_name) as customerName,
             ta.f_begindate AS beginDate,
             ta.f_enddate AS endDate
         from t_warehouse_agreement ta left join t_corps tc on tc.f_id = ta.f_corpid

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

@@ -969,11 +969,11 @@
 
     <select id="biInAndOutStockList" resultType="map">
         select
-            tc.f_name as customerName,
+            ifnull(tc.f_cname, 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
+            date_format(ts.f_bsdate, '%Y-%m-%d') 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