Browse Source

2023年12月22日09:55:48

纪新园 1 year ago
parent
commit
a7c32505bd

+ 5 - 4
ruoyi-plugin/src/main/java/com/ruoyi/ccb/service/impl/ForeignHttpServiceImpl.java

@@ -13,7 +13,6 @@ import com.ruoyi.common.core.domain.entity.TWarehouse;
 import com.ruoyi.reportManagement.domain.TWhgenleg;
 import com.ruoyi.reportManagement.mapper.TWhgenlegMapper;
 import com.ruoyi.reportManagement.service.ITWhgenlegService;
-import com.ruoyi.warehouseBusiness.domain.CollateralGoods;
 import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
 import com.ruoyi.warehouseBusiness.domain.vo.CollateralGoodsVO;
 import com.ruoyi.warehouseBusiness.domain.vo.SkuItem;
@@ -133,9 +132,9 @@ public class ForeignHttpServiceImpl implements ForeignHttpService {
     @Override
     public List<Map<String, Object>> queryGoodsAccountDetailByPageV1(String warehouseCode, String ownerName, String ownerCode, String ownerSocialIdentifier, String goodsName, String specifications,
                                                                      String producing, String materialQuality, String level, String receiptDoc, String billOfLading,
-                                                                     String areaName, String areaCode, String slotName, String slotCode,String goodsCode, Integer pageNo, Integer pageSize) {
+                                                                     String areaName, String areaCode, String slotName, String slotCode, String goodsCode, Integer pageNo, Integer pageSize) {
         return itWarehouseService.queryGoodsAccountDetailByPageV1(warehouseCode, ownerName, ownerCode, ownerSocialIdentifier, goodsName, specifications,
-                producing, materialQuality, level, receiptDoc, billOfLading, areaName, areaCode, slotName, slotCode,goodsCode, pageNo, pageSize);
+                producing, materialQuality, level, receiptDoc, billOfLading, areaName, areaCode, slotName, slotCode, goodsCode, pageNo, pageSize);
     }
 
     /**
@@ -479,7 +478,7 @@ public class ForeignHttpServiceImpl implements ForeignHttpService {
     @Override
     @Transactional
     public AjaxResult receiptApply(WarehouseVO warehouseVO) {
-
+        System.out.println("抵押数据:" + warehouseVO.toString());
         AjaxResult ajaxResult = null;
 
         TCorps tCorps = new TCorps();
@@ -522,6 +521,8 @@ public class ForeignHttpServiceImpl implements ForeignHttpService {
                     // 重量 毛重
                     Object fGrossweightd = stringObjectMap.get("fGrossweightD");
                     sums = sums.add(new BigDecimal(fGrossweightd.toString()));
+
+                    tWhgenlegMapper.lockTheGoods(stringObjectMap.get("fId").toString());
                 }
             }
 

+ 228 - 173
ruoyi-warehouse/src/main/resources/mapper/basicData/TWarehouseMapper.xml

@@ -82,10 +82,14 @@
             <if test="fCharg != null ">and f_charg = #{fCharg}</if>
             <if test="fStatus != null  and fStatus != ''">and f_status = #{fStatus}</if>
             <if test="supervise != null and supervise != ''">and supervise = #{supervise}</if>
-            <if test="fProperties != null and fProperties != ''">and f_properties like concat('%', #{fProperties}, '%')</if>
+            <if test="fProperties != null and fProperties != ''">and f_properties like concat('%', #{fProperties},
+                '%')
+            </if>
             <if test="fType != null and fType != ''">and f_type like concat('%', #{fType}, '%')</if>
-            <if test="fGoodsType != null and fGoodsType != ''">and f_goods_type like concat('%', #{fGoodsType}, '%')</if>
-            <if test="fCoverArea != null and fCoverArea != ''">and f_cover_area like concat('%', #{fCoverArea}, '%')</if>
+            <if test="fGoodsType != null and fGoodsType != ''">and f_goods_type like concat('%', #{fGoodsType}, '%')
+            </if>
+            <if test="fCoverArea != null and fCoverArea != ''">and f_cover_area like concat('%', #{fCoverArea}, '%')
+            </if>
         </where>
         <!-- 数据范围过滤 -->
         ${params.dataScope}
@@ -94,17 +98,19 @@
 
     <select id="lazyList" parameterType="TWarehouse" resultMap="TWarehouseResult">
         select
-            ware.f_id, ware.parent_id, ware.ancestors, ware.order_num, ware.f_no, ware.f_name, ware.f_cname, ware.f_totalgross, ware.f_location,
-               ware.f_addr, ware.f_contacts, ware.f_tel, ware.f_charg, ware.f_is_bonded, ware.remark, ware.supervise, ware.f_status,
-               ware.f_properties, ware.f_type, ware.f_goods_type, ware.f_cover_area,
-            (
-            SELECT
-                CASE WHEN count( * ) > 0 THEN 1 ELSE 0 END
-            FROM
-                t_warehouse tw
-            WHERE
-                tw.parent_id = ware.f_id AND tw.del_flag = '0'
-            ) AS "has_children"
+        ware.f_id, ware.parent_id, ware.ancestors, ware.order_num, ware.f_no, ware.f_name, ware.f_cname,
+        ware.f_totalgross, ware.f_location,
+        ware.f_addr, ware.f_contacts, ware.f_tel, ware.f_charg, ware.f_is_bonded, ware.remark, ware.supervise,
+        ware.f_status,
+        ware.f_properties, ware.f_type, ware.f_goods_type, ware.f_cover_area,
+        (
+        SELECT
+        CASE WHEN count( * ) > 0 THEN 1 ELSE 0 END
+        FROM
+        t_warehouse tw
+        WHERE
+        tw.parent_id = ware.f_id AND tw.del_flag = '0'
+        ) AS "has_children"
         from t_warehouse ware
         <where>
             <if test="parentId != null">and ware.parent_id = #{parentId}</if>
@@ -113,10 +119,14 @@
             <if test="fCname != null  and fCname != ''">and ware.f_cname like concat('%', #{fCname}, '%')</if>
             <if test="fStatus != null  and fStatus != ''">and ware.f_status = #{fStatus}</if>
             <if test="supervise != null and supervise != ''">and ware.supervise = #{supervise}</if>
-            <if test="fProperties != null and fProperties != ''">and f_properties like concat('%', #{fProperties}, '%')</if>
+            <if test="fProperties != null and fProperties != ''">and f_properties like concat('%', #{fProperties},
+                '%')
+            </if>
             <if test="fType != null and fType != ''">and f_type like concat('%', #{fType}, '%')</if>
-            <if test="fGoodsType != null and fGoodsType != ''">and f_goods_type like concat('%', #{fGoodsType}, '%')</if>
-            <if test="fCoverArea != null and fCoverArea != ''">and f_cover_area like concat('%', #{fCoverArea}, '%')</if>
+            <if test="fGoodsType != null and fGoodsType != ''">and f_goods_type like concat('%', #{fGoodsType}, '%')
+            </if>
+            <if test="fCoverArea != null and fCoverArea != ''">and f_cover_area like concat('%', #{fCoverArea}, '%')
+            </if>
             <if test="fAddr != null  and fAddr != ''">and f_addr like concat('%', #{fAddr}, '%')</if>
         </where>
         <!-- 数据范围过滤 -->
@@ -133,8 +143,8 @@
 
     <select id="appGetWarehouseList" resultType="map">
         SELECT
-            f_id AS fId,
-            f_name AS fName
+        f_id AS fId,
+        f_name AS fName
         FROM t_warehouse
         WHERE parent_id = 100
         <if test="corpId != null and corpId != ''">
@@ -257,22 +267,19 @@
     <select id="checkFNoUnique" parameterType="String" resultMap="TWarehouseResult">
         select f_id, f_no
         from t_warehouse
-        where f_no = #{fNo}
-        limit 1
+        where f_no = #{fNo} limit 1
     </select>
 
     <select id="checkUFNnameUnique" parameterType="String" resultMap="TWarehouseResult">
         select f_id, f_name
         from t_warehouse
-        where f_name = #{fAame}
-        limit 1
+        where f_name = #{fAame} limit 1
     </select>
 
     <select id="checkUFAaddrUnique" parameterType="String" resultMap="TWarehouseResult">
         select f_id, f_addr
         from t_warehouse
-        where f_addr = #{fAddr}
-        limit 1
+        where f_addr = #{fAddr} limit 1
     </select>
 
     <select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
@@ -291,8 +298,7 @@
     <select id="selectTWarehousById" resultMap="TWarehouseResult">
         select f_id
         from t_warehouse
-        where parent_id = #{fId}
-        limit 1
+        where parent_id = #{fId} limit 1
     </select>
 
     <update id="updateDeptChildren" parameterType="java.util.List">
@@ -340,8 +346,7 @@
         select count(1)
         from t_warehouse
         where del_flag = '0'
-          and parent_id = #{fId}
-        limit 1
+          and parent_id = #{fId} limit 1
     </select>
     <select id="checkDeptExistarehouse" parameterType="Long" resultType="int">
         select count(1)
@@ -358,7 +363,7 @@
 
     <select id="selectByIds" resultMap="TWarehouseResult">
         <include refid="selectTWarehouseVo"/>
-          where f_id in
+        where f_id in
         <foreach item="id" collection="ids" open="(" separator="," close=")">
             #{id}
         </foreach>
@@ -366,15 +371,15 @@
 
     <select id="biWarehouseList" resultType="map">
         select
-            f_id as warehouseId,
-            f_name as warehouseName
+        f_id as warehouseId,
+        f_name as warehouseName
         from t_warehouse
         where parent_id = 100
         <if test="external != null and external != ''">
             and f_id in (
-                select distinct f_warehouseid
-                from t_customer_contact t1 left join t_whgenleg t2 on t1.f_pid = t2.f_corpid
-                where f_tel = #{external})
+            select distinct f_warehouseid
+            from t_customer_contact t1 left join t_whgenleg t2 on t1.f_pid = t2.f_corpid
+            where f_tel = #{external})
         </if>
         order by convert(f_name using gbk)
     </select>
@@ -388,27 +393,28 @@
 
     <select id="queryGoodsAccountByPageV1" resultType="map">
         SELECT
-            TW.f_id AS warehouseCode,
-            TW.f_name AS warehouseName,
-            TC.uscc AS ownerSocialIdentifier,
-            TC.f_id AS ownerCode,
-            TC.f_name AS ownerName,
-            TG.f_name AS goodsName,
-            TG.f_packagespecs AS specifications,
-            '' AS producing,
-            TWG.f_marks AS materialQuality,
-            '' AS level,
-            SUM(TWG.f_qtyD) AS totalQuantity,
-            SUM(TWG.f_qtyblc) AS availableQuantity,
-
-            TG.f_no AS goodsCode,
-            TG.f_typeid AS goodsType,
-
-            '袋' AS quantityUnit,
-            IFNULL( ROUND( SUM(TWG.f_netweightD) / 1000, 2 ), 0 ) AS totalNetWeight,
-            IFNULL( ROUND( SUM(TWG.f_netweightblc) / 1000, 2 ), 0 ) AS availableWeight,
-            '吨' AS weightUnit,
-            CONCAT_WS('-',IFNULL( TG.f_name, '' ),CONCAT_WS( IFNULL( TG.f_packagespecs, '' ), '/袋' ),IFNULL( TWG.f_marks, '' )) AS spu
+        TW.f_id AS warehouseCode,
+        TW.f_name AS warehouseName,
+        TC.uscc AS ownerSocialIdentifier,
+        TC.f_id AS ownerCode,
+        TC.f_name AS ownerName,
+        TG.f_name AS goodsName,
+        TG.f_packagespecs AS specifications,
+        '' AS producing,
+        TWG.f_marks AS materialQuality,
+        '' AS level,
+        SUM(TWG.f_qtyD) AS totalQuantity,
+        SUM(TWG.f_qtyblc) AS availableQuantity,
+
+        TG.f_no AS goodsCode,
+        TG.f_typeid AS goodsType,
+
+        '袋' AS quantityUnit,
+        IFNULL( ROUND( SUM(TWG.f_netweightD) / 1000, 2 ), 0 ) AS totalNetWeight,
+        IFNULL( ROUND( SUM(TWG.f_netweightblc) / 1000, 2 ), 0 ) AS availableWeight,
+        '吨' AS weightUnit,
+        CONCAT_WS('-',IFNULL( TG.f_name, '' ),CONCAT_WS( IFNULL( TG.f_packagespecs, '' ), '/袋' ),IFNULL( TWG.f_marks, ''
+        )) AS spu
         FROM t_warehouse TW
         LEFT JOIN t_whgenleg TWG ON TWG.f_warehouseid = TW.f_id
         LEFT JOIN t_corps TC ON TC.f_id = TWG.f_corpid
@@ -416,13 +422,20 @@
         <where>
             TW.del_flag = '0'
             and TWG.f_qtyblc > 0
-            <if test="warehouseCode != null  and warehouseCode != ''"> and TW.f_id = #{warehouseCode}</if>
-            <if test="ownerName != null  and ownerName != ''"> and TC.f_name like concat('%', #{ownerName}, '%')</if>
-            <if test="goodsName != null  and goodsName != ''"> and TG.f_name like concat('%', #{goodsName}, '%')</if>
-            <if test="specifications != null  and specifications != ''"> and TG.f_packagespecs like concat('%', #{specifications}, '%')</if>
-            <if test="materialQuality != null  and materialQuality != ''"> and TWG.f_marks like concat('%', #{materialQuality}, '%')</if>
-            <if test="ownerSocialIdentifier != null  and ownerSocialIdentifier != ''"> and TC.uscc = #{ownerSocialIdentifier}</if>
-            <if test="ownerCode != null  and ownerCode != ''"> and TC.f_id = #{ownerCode}</if>
+            and TWG.lock_status ='0'
+            <if test="warehouseCode != null  and warehouseCode != ''">and TW.f_id = #{warehouseCode}</if>
+            <if test="ownerName != null  and ownerName != ''">and TC.f_name like concat('%', #{ownerName}, '%')</if>
+            <if test="goodsName != null  and goodsName != ''">and TG.f_name like concat('%', #{goodsName}, '%')</if>
+            <if test="specifications != null  and specifications != ''">and TG.f_packagespecs like concat('%',
+                #{specifications}, '%')
+            </if>
+            <if test="materialQuality != null  and materialQuality != ''">and TWG.f_marks like concat('%',
+                #{materialQuality}, '%')
+            </if>
+            <if test="ownerSocialIdentifier != null  and ownerSocialIdentifier != ''">and TC.uscc =
+                #{ownerSocialIdentifier}
+            </if>
+            <if test="ownerCode != null  and ownerCode != ''">and TC.f_id = #{ownerCode}</if>
         </where>
         GROUP BY
         TW.f_id,TC.f_no,TG.f_name,TG.f_packagespecs,TWG.f_marks
@@ -430,41 +443,41 @@
 
     <select id="queryGoodsAccountDetailByPageV1" resultType="map">
         SELECT
-            DISTINCT
-            TWG.f_id AS id,
-            TW.f_id AS warehouseCode,
-            TW.f_name AS warehouseName,
-            ware.f_name AS areaName,
-            ware.f_id AS areaCode,
-            ware.f_name AS slotName,
-            ware.f_id AS slotCode,
-            TWG.f_originalbillno AS receiptDoc,
-            TWG.f_mblno AS billOfLading,
-            TC.f_id AS ownerCode,
-            TC.f_name AS ownerName,
-            TC.uscc AS ownerSocialIdentifier,
-            TG.f_name AS goodsName,
-
-            TG.f_no AS goodsCode,
-            TG.f_typeid AS goodsType,
-
-            TG.f_packagespecs AS specifications,
-            '' AS producing,
-            TWG.f_marks AS materialQuality,
-            '' AS level,
-            TWG.f_qtyD AS totalQuantity,
-            TWG.f_qtyblc AS availableQuantity,
-            '袋' AS quantityUnit,
-            IFNULL( ROUND( TWG.f_netweightD / 1000, 2 ), 0 ) AS totalNetWeight,
-            IFNULL( ROUND( TWG.f_netweightblc / 1000, 2 ), 0 ) AS availableWeight,
-            '吨' AS weightUnit,
-            TWG.f_originalbilldate AS storesTime,
-            '' AS productionTime,
-            TWB.f_truckno AS plateNumber,
-            '' AS batchNo,
-            '' AS warehouseReceiptNo
+        DISTINCT
+        TWG.f_id AS id,
+        TW.f_id AS warehouseCode,
+        TW.f_name AS warehouseName,
+        ware.f_name AS areaName,
+        ware.f_id AS areaCode,
+        ware.f_name AS slotName,
+        ware.f_id AS slotCode,
+        TWG.f_originalbillno AS receiptDoc,
+        TWG.f_mblno AS billOfLading,
+        TC.f_id AS ownerCode,
+        TC.f_name AS ownerName,
+        TC.uscc AS ownerSocialIdentifier,
+        TG.f_name AS goodsName,
+
+        TG.f_no AS goodsCode,
+        TG.f_typeid AS goodsType,
+
+        TG.f_packagespecs AS specifications,
+        '' AS producing,
+        TWG.f_marks AS materialQuality,
+        '' AS level,
+        TWG.f_qtyD AS totalQuantity,
+        TWG.f_qtyblc AS availableQuantity,
+        '袋' AS quantityUnit,
+        IFNULL( ROUND( TWG.f_netweightD / 1000, 2 ), 0 ) AS totalNetWeight,
+        IFNULL( ROUND( TWG.f_netweightblc / 1000, 2 ), 0 ) AS availableWeight,
+        '吨' AS weightUnit,
+        TWG.f_originalbilldate AS storesTime,
+        '' AS productionTime,
+        TWB.f_truckno AS plateNumber,
+        '' AS batchNo,
+        '' AS warehouseReceiptNo
         FROM
-            t_whgenleg TWG
+        t_whgenleg TWG
         LEFT JOIN t_warehouse TW ON TWG.f_warehouseid = TW.f_id
         LEFT JOIN t_warehouse ware ON ware.f_id = TWG.f_warehouse_locationid
         LEFT JOIN t_corps TC ON TC.f_id = TWG.f_corpid
@@ -473,20 +486,32 @@
         <where>
             TW.del_flag = '0'
             and TWG.f_qtyblc > 0
-            <if test="warehouseCode != null  and warehouseCode != ''"> and TWG.f_warehouseid = #{warehouseCode}</if>
-            <if test="ownerName != null  and ownerName != ''"> and TC.f_name like concat('%', #{ownerName}, '%')</if>
-            <if test="ownerCode != null  and ownerCode != ''"> and TC.f_id = #{ownerCode}</if>
-            <if test="ownerSocialIdentifier != null  and ownerSocialIdentifier != ''"> and TC.uscc = #{ownerSocialIdentifier}</if>
-            <if test="goodsName != null  and goodsName != ''"> and TG.f_name like concat('%', #{goodsName}, '%')</if>
-            <if test="goodsCode != null  and goodsCode != ''"> and TG.f_no = #{goodsCode}</if>
-            <if test="specifications != null  and specifications != ''"> and TG.f_packagespecs like concat('%', #{specifications}, '%')</if>
-            <if test="materialQuality != null  and materialQuality != ''"> and TWG.f_marks like concat('%', #{materialQuality}, '%')</if>
-            <if test="receiptDoc != null  and receiptDoc != ''"> and TWG.f_originalbillno like concat('%', #{receiptDoc}, '%')</if>
-            <if test="billOfLading != null  and billOfLading != ''"> and TWG.f_mblno like concat('%', #{billOfLading}, '%')</if>
-            <if test="areaName != null  and areaName != ''"> and ware.f_name like concat('%', #{areaName}, '%')</if>
-            <if test="areaCode != null  and areaCode != ''"> and ware.f_id = #{areaCode}</if>
-            <if test="slotName != null  and slotName != ''"> and ware.f_name like concat('%', #{slotName}, '%')</if>
-            <if test="slotCode != null  and slotCode != ''"> and ware.f_id = #{slotCode}</if>
+            and TWG.lock_status ='0'
+            and TWB.del_flag = '0'
+            <if test="warehouseCode != null  and warehouseCode != ''">and TWG.f_warehouseid = #{warehouseCode}</if>
+            <if test="ownerName != null  and ownerName != ''">and TC.f_name like concat('%', #{ownerName}, '%')</if>
+            <if test="ownerCode != null  and ownerCode != ''">and TC.f_id = #{ownerCode}</if>
+            <if test="ownerSocialIdentifier != null  and ownerSocialIdentifier != ''">and TC.uscc =
+                #{ownerSocialIdentifier}
+            </if>
+            <if test="goodsName != null  and goodsName != ''">and TG.f_name like concat('%', #{goodsName}, '%')</if>
+            <if test="goodsCode != null  and goodsCode != ''">and TG.f_no = #{goodsCode}</if>
+            <if test="specifications != null  and specifications != ''">and TG.f_packagespecs like concat('%',
+                #{specifications}, '%')
+            </if>
+            <if test="materialQuality != null  and materialQuality != ''">and TWG.f_marks like concat('%',
+                #{materialQuality}, '%')
+            </if>
+            <if test="receiptDoc != null  and receiptDoc != ''">and TWG.f_originalbillno like concat('%', #{receiptDoc},
+                '%')
+            </if>
+            <if test="billOfLading != null  and billOfLading != ''">and TWG.f_mblno like concat('%', #{billOfLading},
+                '%')
+            </if>
+            <if test="areaName != null  and areaName != ''">and ware.f_name like concat('%', #{areaName}, '%')</if>
+            <if test="areaCode != null  and areaCode != ''">and ware.f_id = #{areaCode}</if>
+            <if test="slotName != null  and slotName != ''">and ware.f_name like concat('%', #{slotName}, '%')</if>
+            <if test="slotCode != null  and slotCode != ''">and ware.f_id = #{slotCode}</if>
         </where>
     </select>
 
@@ -499,22 +524,22 @@
 
     <select id="getStorageInfo" resultType="map">
         SELECT
-            cast(IFNULL( ROUND( TW.f_totalgross / 1000, 2 ), 0 ) as DECIMAL(20,2)) AS capacity,
-            IFNULL( ROUND( TWB.f_netweight / 1000, 2 ), 0 ) AS storage,
-            TTL.value AS throughput,
-            count(distinct(TWB.f_corpid)) AS customers
+        cast(IFNULL( ROUND( TW.f_totalgross / 1000, 2 ), 0 ) as DECIMAL(20,2)) AS capacity,
+        IFNULL( ROUND( TWB.f_netweight / 1000, 2 ), 0 ) AS storage,
+        TTL.value AS throughput,
+        count(distinct(TWB.f_corpid)) AS customers
         FROM
-            t_warehouse TW
+        t_warehouse TW
         LEFT JOIN t_warehousebills TWB ON TW.f_id = TWB.f_warehouseid
         LEFT JOIN (
-            SELECT
-                f_warehouseid,
-                ROUND( SUM(f_grossweight) / 1000, 2 ) as value
-            FROM t_warehousebills
-            where
-            del_flag = '0'
+        SELECT
+        f_warehouseid,
+        ROUND( SUM(f_grossweight) / 1000, 2 ) as value
+        FROM t_warehousebills
+        where
+        del_flag = '0'
 
-            GROUP BY
+        GROUP BY
         f_warehouseid
         ) TTL ON TTL.f_warehouseid = TW.f_id
         <where>
@@ -522,13 +547,13 @@
             AND TW.f_id = #{wareHouseId}
         </where>
         GROUP BY
-            TW.f_id
+        TW.f_id
     </select>
 
     <select id="getTimeStorageInfo" resultType="map">
         SELECT
-            f_bsdate as time,
-            ROUND( SUM(f_grossweight) / 1000, 2 ) as value
+        f_bsdate as time,
+        ROUND( SUM(f_grossweight) / 1000, 2 ) as value
         FROM t_warehousebills
         <where>
             del_flag = '0'
@@ -547,8 +572,8 @@
 
     <select id="getTimeThroughputInfo" resultType="map">
         SELECT
-            f_bsdate as time,
-            ROUND( SUM(f_grossweight) / 1000, 2 ) as value
+        f_bsdate as time,
+        ROUND( SUM(f_grossweight) / 1000, 2 ) as value
         FROM t_warehousebills
         <where>
             del_flag = '0'
@@ -568,7 +593,7 @@
 
     <select id="getCargoInfo" resultType="map">
         SELECT
-            ROUND( SUM(f_grossweight) / 1000, 2 ) as FGrossweight
+        ROUND( SUM(f_grossweight) / 1000, 2 ) as FGrossweight
         FROM t_warehousebills
         <where>
             f_warehouseid = #{wareHouseId}
@@ -590,17 +615,18 @@
     <select id="getGoodsList" resultType="map">
         SELECT
         SDD.dict_label AS goodsType,
-        IF(da.count,da.count,0.00)  AS count,
+        IF(da.count,da.count,0.00) AS count,
         IF(da.rate ,da.rate ,0.00) AS rate
         FROM
         sys_dict_data SDD
         LEFT JOIN (SELECT
         SD.dict_code AS dict_code,
         ROUND( SUM( TW.f_grossweight ) / 1000, 2 ) AS count,
-        round( SUM( TW.f_grossweight ) * 100 /( SELECT SUM( f_grossweight ) AS total FROM t_warehousebills ), 2 ) AS rate
+        round( SUM( TW.f_grossweight ) * 100 /( SELECT SUM( f_grossweight ) AS total FROM t_warehousebills ), 2 ) AS
+        rate
         FROM
         sys_dict_data SD
-        JOIN t_warehousebills TW  ON  SD.dict_value = TW.f_trademodeid
+        JOIN t_warehousebills TW ON SD.dict_value = TW.f_trademodeid
         WHERE
         TW.f_warehouseid = #{wareHouseId}
         <if test="startTime != null and startTime != ''">
@@ -623,8 +649,8 @@
 
     <select id="getCargoInfoTrend" resultType="map">
         SELECT
-            f_bsdate as time,
-            ROUND( SUM(TW.f_grossweight) / 1000, 2 ) as value
+        f_bsdate as time,
+        ROUND( SUM(TW.f_grossweight) / 1000, 2 ) as value
         FROM
         t_warehousebills TW
         LEFT JOIN sys_dict_data SDD ON SDD.dict_type = 'data_trademodes' AND SDD.dict_value = TW.f_trademodeid
@@ -648,9 +674,9 @@
 
     <select id="getStorageTop" resultType="map">
         SELECT
-            TG.f_name AS goodsName,
-            ROUND( SUM(TW.f_grossweight) / 1000, 2 ) as normalCnt,
-            '' AS receiptCnt
+        TG.f_name AS goodsName,
+        ROUND( SUM(TW.f_grossweight) / 1000, 2 ) as normalCnt,
+        '' AS receiptCnt
         FROM
         t_warehousebillsitems TW
         LEFT JOIN t_goods TG ON TG.f_id = TW.f_goodsid
@@ -707,12 +733,12 @@
         </where>
     </select>
 
-    <select id="getWorkInfo"  resultType="map">
+    <select id="getWorkInfo" resultType="map">
         SELECT
-            IFNULL( ROUND( SUM( TW.f_grossweight ) / 1000, 2 ),0) AS Fgrossweight,
-            COUNT(f_id) AS count
+        IFNULL( ROUND( SUM( TW.f_grossweight ) / 1000, 2 ),0) AS Fgrossweight,
+        COUNT(f_id) AS count
         FROM
-            t_warehousebills TW
+        t_warehousebills TW
         <where>
             TW.del_flag = '0'
             AND TW.f_warehouseid = #{wareHouseId}
@@ -722,10 +748,10 @@
         </where>
     </select>
 
-    <select id="getWorkTrend"  resultType="map">
+    <select id="getWorkTrend" resultType="map">
         SELECT
-            TW.f_bsdate as time,
-            count(*) AS value
+        TW.f_bsdate as time,
+        count(*) AS value
         FROM
         t_warehousebills TW
         inner join t_warehousebillsitems TWI on TW.f_id = TWI.f_pid
@@ -848,16 +874,16 @@
         IFNULL( ROUND( SUM( TW.f_netweightblc ) / 1000, 2 ), 0 ) AS netWeight,
         IFNULL( ROUND( SUM( TW.f_grossweightblc ) / 1000, 2 ), 0 ) AS grossWeight,
         SUM( TW.f_qtyblc ) AS cargoQuantity,
-                    '' AS storageRate,
-                    TW.f_marks AS mark,
-                    SUM( TW.f_qtyblc ) AS number,
-                    '' AS manufacturer,
-                    '' AS trademark,
-                    '' AS grade,
-                    TG.f_packagespecs AS packing,
-                    '' AS country,
-                    '' AS process,
-                    '' AS location
+        '' AS storageRate,
+        TW.f_marks AS mark,
+        SUM( TW.f_qtyblc ) AS number,
+        '' AS manufacturer,
+        '' AS trademark,
+        '' AS grade,
+        TG.f_packagespecs AS packing,
+        '' AS country,
+        '' AS process,
+        '' AS location
         FROM t_whgenleg TW
         LEFT JOIN t_goods TG ON TG.f_id = TW.f_goodsid
         LEFT JOIN t_warehouse TWH ON TW.f_warehouseid = TWH.f_id
@@ -906,7 +932,7 @@
                 and TC.uscc = #{identifier}
             </if>
             <if test="numbers != null and numbers != ''">
-                and  TW.f_mblno = #{numbers}
+                and TW.f_mblno = #{numbers}
             </if>
         </where>
     </update>
@@ -924,7 +950,7 @@
                 and TC.uscc = #{identifier}
             </if>
             <if test="numbers != null and numbers != ''">
-                and  TW.f_mblno = #{numbers}
+                and TW.f_mblno = #{numbers}
             </if>
         </where>
     </update>
@@ -956,32 +982,61 @@
         <where>
             parent_id = 100 and
             <if test="warehouseIdList != null and warehouseIdList != ''">
-                 f_id in
+                f_id in
                 <foreach item="number" collection="warehouseIdList" open="(" separator="," close=")">
                     #{number}
                 </foreach>
                 or
-                <foreach collection="warehouseIdList" item="item" index="index"  separator="OR">
+                <foreach collection="warehouseIdList" item="item" index="index" separator="OR">
                     ancestors LIKE CONCAT('%',#{item},'%')
                 </foreach>
             </if>
-            <if test="tWarehouse.parentId != null  and tWarehouse.parentId != ''">and parent_id = #{tWarehouse.parentId}</if>
-            <if test="tWarehouse.fIsBonded != null  and tWarehouse.fIsBonded != ''">and f_is_bonded = #{tWarehouse.fIsBonded}</if>
-            <if test="tWarehouse.ancestors != null  and tWarehouse.ancestors != ''">and ancestors like concat('%', #{tWarehouse.ancestors}, '%')</if>
-            <if test="tWarehouse.fNo != null  and tWarehouse.fNo != ''">and f_no like concat('%', #{tWarehouse.fNo}, '%')</if>
-            <if test="tWarehouse.fName != null  and tWarehouse.fName != ''">and f_name like concat('%', #{tWarehouse.fName}, '%')</if>
-            <if test="tWarehouse.fCname != null  and tWarehouse.fCname != ''">and f_cname like concat('%', #{tWarehouse.fCname}, '%')</if>
-            <if test="tWarehouse.fAddr != null  and tWarehouse.fAddr != ''">and f_addr like concat('%', #{tWarehouse.fAddr}, '%')</if>
-            <if test="tWarehouse.fTotalgross != null ">and f_totalgross like concat('%', #{tWarehouse.fTotalgross}, '%')</if>
-            <if test="tWarehouse.fContacts != null  and tWarehouse.fContacts != ''">and f_contacts = #{tWarehouse.fContacts}</if>
+            <if test="tWarehouse.parentId != null  and tWarehouse.parentId != ''">and parent_id =
+                #{tWarehouse.parentId}
+            </if>
+            <if test="tWarehouse.fIsBonded != null  and tWarehouse.fIsBonded != ''">and f_is_bonded =
+                #{tWarehouse.fIsBonded}
+            </if>
+            <if test="tWarehouse.ancestors != null  and tWarehouse.ancestors != ''">and ancestors like concat('%',
+                #{tWarehouse.ancestors}, '%')
+            </if>
+            <if test="tWarehouse.fNo != null  and tWarehouse.fNo != ''">and f_no like concat('%', #{tWarehouse.fNo},
+                '%')
+            </if>
+            <if test="tWarehouse.fName != null  and tWarehouse.fName != ''">and f_name like concat('%',
+                #{tWarehouse.fName}, '%')
+            </if>
+            <if test="tWarehouse.fCname != null  and tWarehouse.fCname != ''">and f_cname like concat('%',
+                #{tWarehouse.fCname}, '%')
+            </if>
+            <if test="tWarehouse.fAddr != null  and tWarehouse.fAddr != ''">and f_addr like concat('%',
+                #{tWarehouse.fAddr}, '%')
+            </if>
+            <if test="tWarehouse.fTotalgross != null ">and f_totalgross like concat('%', #{tWarehouse.fTotalgross},
+                '%')
+            </if>
+            <if test="tWarehouse.fContacts != null  and tWarehouse.fContacts != ''">and f_contacts =
+                #{tWarehouse.fContacts}
+            </if>
             <if test="tWarehouse.fTel != null  and tWarehouse.fTel != ''">and f_tel = #{tWarehouse.fTel}</if>
             <if test="tWarehouse.fCharg != null ">and f_charg = #{tWarehouse.fCharg}</if>
-            <if test="tWarehouse.fStatus != null  and tWarehouse.fStatus != ''">and f_status = #{tWarehouse.fStatus}</if>
-            <if test="tWarehouse.supervise != null and tWarehouse.supervise != ''">and supervise = #{tWarehouse.supervise}</if>
-            <if test="tWarehouse.fProperties != null and tWarehouse.fProperties != ''">and f_properties like concat('%', #{tWarehouse.fProperties}, '%')</if>
-            <if test="tWarehouse.fType != null and tWarehouse.fType != ''">and f_type like concat('%', #{tWarehouse.fType}, '%')</if>
-            <if test="tWarehouse.fGoodsType != null and tWarehouse.fGoodsType != ''">and f_goods_type like concat('%', #{tWarehouse.fGoodsType}, '%')</if>
-            <if test="tWarehouse.fCoverArea != null and tWarehouse.fCoverArea != ''">and f_cover_area like concat('%', #{tWarehouse.fCoverArea}, '%')</if>
+            <if test="tWarehouse.fStatus != null  and tWarehouse.fStatus != ''">and f_status = #{tWarehouse.fStatus}
+            </if>
+            <if test="tWarehouse.supervise != null and tWarehouse.supervise != ''">and supervise =
+                #{tWarehouse.supervise}
+            </if>
+            <if test="tWarehouse.fProperties != null and tWarehouse.fProperties != ''">and f_properties like concat('%',
+                #{tWarehouse.fProperties}, '%')
+            </if>
+            <if test="tWarehouse.fType != null and tWarehouse.fType != ''">and f_type like concat('%',
+                #{tWarehouse.fType}, '%')
+            </if>
+            <if test="tWarehouse.fGoodsType != null and tWarehouse.fGoodsType != ''">and f_goods_type like concat('%',
+                #{tWarehouse.fGoodsType}, '%')
+            </if>
+            <if test="tWarehouse.fCoverArea != null and tWarehouse.fCoverArea != ''">and f_cover_area like concat('%',
+                #{tWarehouse.fCoverArea}, '%')
+            </if>
         </where>
         <!-- 数据范围过滤 -->
         order by parent_id, order_num, convert(f_name using gbk)

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

@@ -931,7 +931,7 @@
     <select id="selectInventoryMapListV2" parameterType="TWhgenleg" resultType="Map">
         select
         DISTINCT
-
+        leg.f_id as fId,
         # 总数
         SUM(leg.f_qtyD) AS fQtyD,
         # 毛重