|
@@ -365,70 +365,290 @@
|
|
|
TG.f_name AS goodsName,
|
|
TG.f_name AS goodsName,
|
|
|
TG.f_packagespecs AS specifications,
|
|
TG.f_packagespecs AS specifications,
|
|
|
'' AS producing,
|
|
'' AS producing,
|
|
|
- '' AS materialQuality,
|
|
|
|
|
|
|
+ TWG.f_marks AS materialQuality,
|
|
|
'' AS level,
|
|
'' AS level,
|
|
|
- '' AS totalQuantity,
|
|
|
|
|
- '' AS availableQuantity,
|
|
|
|
|
- '' AS quantityUnit,
|
|
|
|
|
- '' AS totalNetWeight,
|
|
|
|
|
- '' AS availableWeight,
|
|
|
|
|
- '' AS weightUnit,
|
|
|
|
|
- '' AS spu
|
|
|
|
|
|
|
+ TWG.f_qtyblc AS totalQuantity,
|
|
|
|
|
+ TWG.f_qtyD AS availableQuantity,
|
|
|
|
|
+ '袋' AS quantityUnit,
|
|
|
|
|
+ IFNULL( ROUND( TWG.f_netweightblc / 1000, 2 ), 0 ) AS totalNetWeight,
|
|
|
|
|
+ IFNULL( ROUND( TWG.f_netweightD / 1000, 2 ), 0 ) AS availableWeight,
|
|
|
|
|
+ '吨' AS weightUnit,
|
|
|
|
|
+ TG.f_name + '-' + TG.f_packagespecs + '/袋' + '-' + TWG.f_marks AS spu
|
|
|
FROM t_warehouse TW
|
|
FROM t_warehouse TW
|
|
|
LEFT JOIN t_whgenleg TWG ON TWG.f_warehouseid = TW.f_id
|
|
LEFT JOIN t_whgenleg TWG ON TWG.f_warehouseid = TW.f_id
|
|
|
LEFT JOIN t_corps TC ON TC.f_id = TWG.f_corpid
|
|
LEFT JOIN t_corps TC ON TC.f_id = TWG.f_corpid
|
|
|
LEFT JOIN t_goods TG ON TG.f_id = TWG.f_goodsid
|
|
LEFT JOIN t_goods TG ON TG.f_id = TWG.f_goodsid
|
|
|
<where>
|
|
<where>
|
|
|
- del_flag = '0'
|
|
|
|
|
|
|
+ TW.del_flag = '0'
|
|
|
|
|
+ AND TW.f_no = #{warehouseCode}
|
|
|
<if test="ownerName != null and ownerName != ''"> and TC.f_name like concat('%', #{ownerName}, '%')</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="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="specifications != null and specifications != ''"> and TG.f_packagespecs like concat('%', #{specifications}, '%')</if>
|
|
|
- <if test="producing != null and producing != ''"> and '' like concat('%', #{producing}, '%')</if>
|
|
|
|
|
- <if test="materialQuality != null and materialQuality != ''"> and '' like concat('%', #{materialQuality}, '%')</if>
|
|
|
|
|
- <if test="level != null and level != ''"> and '' like concat('%', #{level}, '%')</if>
|
|
|
|
|
|
|
+ <if test="materialQuality != null and materialQuality != ''"> and TWG.f_marks like concat('%', #{materialQuality}, '%')</if>
|
|
|
</where>
|
|
</where>
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="queryGoodsAccountDetailByPageV1" resultType="map">
|
|
<select id="queryGoodsAccountDetailByPageV1" resultType="map">
|
|
|
SELECT
|
|
SELECT
|
|
|
- '' AS id,
|
|
|
|
|
|
|
+ TW.f_id AS id,
|
|
|
TW.f_no AS warehouseCode,
|
|
TW.f_no AS warehouseCode,
|
|
|
TW.f_name AS warehouseName,
|
|
TW.f_name AS warehouseName,
|
|
|
- '' AS areaName,
|
|
|
|
|
- '' AS areaCode,
|
|
|
|
|
|
|
+ TW.f_name AS areaName,
|
|
|
|
|
+ TW.f_no AS areaCode,
|
|
|
'' AS slotName,
|
|
'' AS slotName,
|
|
|
'' AS slotCode,
|
|
'' AS slotCode,
|
|
|
- '' AS receiptDoc,
|
|
|
|
|
- '' AS billOfLading,
|
|
|
|
|
|
|
+ TWG.f_originalbillno AS receiptDoc,
|
|
|
|
|
+ TWG.f_mblno AS billOfLading,
|
|
|
TC.f_no AS ownerCode,
|
|
TC.f_no AS ownerCode,
|
|
|
TC.f_name AS ownerName,
|
|
TC.f_name AS ownerName,
|
|
|
TG.f_name AS goodsName,
|
|
TG.f_name AS goodsName,
|
|
|
TG.f_packagespecs AS specifications,
|
|
TG.f_packagespecs AS specifications,
|
|
|
'' AS producing,
|
|
'' AS producing,
|
|
|
- '' AS materialQuality,
|
|
|
|
|
- '' AS level,
|
|
|
|
|
- '' AS totalQuantity,
|
|
|
|
|
- '' AS availableQuantity,
|
|
|
|
|
- '' AS quantityUnit,
|
|
|
|
|
- '' AS totalNetWeight,
|
|
|
|
|
- '' AS availableWeight,
|
|
|
|
|
- '' AS weightUnit,
|
|
|
|
|
- '' AS storesTime,
|
|
|
|
|
|
|
+ TWG.f_marks AS materialQuality,
|
|
|
|
|
+ '' AS LEVEL,
|
|
|
|
|
+ TWG.f_qtyblc AS totalQuantity,
|
|
|
|
|
+ TWG.f_qtyD AS availableQuantity,
|
|
|
|
|
+ '袋' AS quantityUnit,
|
|
|
|
|
+ IFNULL( ROUND( TWG.f_netweightblc / 1000, 2 ), 0 ) AS totalNetWeight,
|
|
|
|
|
+ IFNULL( ROUND( TWG.f_netweightD / 1000, 2 ), 0 ) AS availableWeight,
|
|
|
|
|
+ '吨' AS weightUnit,
|
|
|
|
|
+ TWG.f_originalbilldate AS storesTime,
|
|
|
'' AS productionTime,
|
|
'' AS productionTime,
|
|
|
- '' AS plateNumber,
|
|
|
|
|
|
|
+ TWB.f_truckno AS plateNumber,
|
|
|
'' AS batchNo,
|
|
'' AS batchNo,
|
|
|
'' AS warehouseReceiptNo
|
|
'' AS warehouseReceiptNo
|
|
|
FROM t_warehouse TW
|
|
FROM t_warehouse TW
|
|
|
LEFT JOIN t_whgenleg TWG ON TWG.f_warehouseid = TW.f_id
|
|
LEFT JOIN t_whgenleg TWG ON TWG.f_warehouseid = TW.f_id
|
|
|
LEFT JOIN t_corps TC ON TC.f_id = TWG.f_corpid
|
|
LEFT JOIN t_corps TC ON TC.f_id = TWG.f_corpid
|
|
|
LEFT JOIN t_goods TG ON TG.f_id = TWG.f_goodsid
|
|
LEFT JOIN t_goods TG ON TG.f_id = TWG.f_goodsid
|
|
|
|
|
+ LEFT JOIN t_warehousebills TWB ON TW.f_id = TWB.f_warehouseid
|
|
|
<where>
|
|
<where>
|
|
|
TW.f_no = #{warehouseCode}
|
|
TW.f_no = #{warehouseCode}
|
|
|
- AND del_flag = '0'
|
|
|
|
|
- <if test="areaName != null and areaName != ''"> and '' like concat('%', #{areaName}, '%')</if>
|
|
|
|
|
- <if test="areaCode != null and areaCode != ''"> and '' = #{areaCode}</if>
|
|
|
|
|
- <if test="slotName != null and slotName != ''"> and '' like concat('%', #{slotName}, '%')</if>
|
|
|
|
|
- <if test="slotCode != null and slotCode != ''"> and '' = #{slotCode}</if>
|
|
|
|
|
|
|
+ AND TW.del_flag = '0'
|
|
|
|
|
+ <if test="areaName != null and areaName != ''"> and TW.f_name like concat('%', #{areaName}, '%')</if>
|
|
|
|
|
+ <if test="areaCode != null and areaCode != ''"> and TW.f_no = #{areaCode}</if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="getWareHouseInfo" parameterType="String" resultMap="TWarehouseResult">
|
|
|
|
|
+ <include refid="selectTWarehouseVo"/>
|
|
|
|
|
+ <where>
|
|
|
|
|
+ f_id = #{wareHouseId} and del_flag = '0' limit 1
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="getStorageInfo" resultType="map">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ IFNULL( ROUND( TW.f_totalgross / 1000, 2 ), 0 ) AS capacity,
|
|
|
|
|
+ IFNULL( ROUND( TWB.f_netweight / 1000, 2 ), 0 ) AS storage,
|
|
|
|
|
+ '' AS throughput,
|
|
|
|
|
+ '' AS customers
|
|
|
|
|
+ FROM
|
|
|
|
|
+ t_warehouse TW
|
|
|
|
|
+ LEFT JOIN t_warehousebills TWB ON TW.f_id = TWB.f_warehouseid
|
|
|
|
|
+ <where>
|
|
|
|
|
+ TW.del_flag = '0'
|
|
|
|
|
+ AND TW.f_id = #{wareHouseId}
|
|
|
|
|
+ </where>
|
|
|
|
|
+ GROUP BY
|
|
|
|
|
+ TW.f_id
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="getTimeStorageInfo" resultType="map">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ IFNULL( f_bsdate, '' ) as time,
|
|
|
|
|
+ IFNULL( ROUND( SUM(f_grossweight) / 1000, 2 ), 0 ) as value
|
|
|
|
|
+ FROM t_warehousebills
|
|
|
|
|
+ <where>
|
|
|
|
|
+ del_flag = '0'
|
|
|
|
|
+ AND f_id = #{wareHouseId}
|
|
|
|
|
+ <if test="startTime != null and startTime != ''">
|
|
|
|
|
+ and f_bsdate >= #{startTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="endTime != null and endTime != ''">
|
|
|
|
|
+ and f_bsdate <= #{endTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="startTime == null and endTime == null and startTime == '' and endTime == ''">
|
|
|
|
|
+ and f_bsdate>=date(now()) and f_bsdate < DATE_ADD(date(now()),INTERVAL 1 DAY)
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="getTimeThroughputInfo" resultType="map">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ IFNULL( f_bsdate, '' ) as time,
|
|
|
|
|
+ IFNULL( ROUND( SUM(f_grossweight) / 1000, 2 ), 0 ) as value
|
|
|
|
|
+ FROM t_warehousebills
|
|
|
|
|
+ <where>
|
|
|
|
|
+ del_flag = '0'
|
|
|
|
|
+ AND f_id = #{wareHouseId}
|
|
|
|
|
+ and f_billtype in ('SJRK','SJCK')
|
|
|
|
|
+ <if test="startTime != null and startTime != ''">
|
|
|
|
|
+ and f_bsdate >= #{startTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="endTime != null and endTime != ''">
|
|
|
|
|
+ and f_bsdate <= #{endTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="startTime == null and endTime == null and startTime == '' and endTime == ''">
|
|
|
|
|
+ and f_bsdate>=date(now()) and f_bsdate < DATE_ADD(date(now()),INTERVAL 1 DAY)
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="getCargoInfo" resultType="map">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ IFNULL( ROUND( SUM(f_grossweight) / 1000, 2 ), 0 ) as FGrossweight
|
|
|
|
|
+ FROM t_warehousebills
|
|
|
|
|
+ <where>
|
|
|
|
|
+ is_pledge = #{isPledge}
|
|
|
|
|
+ AND f_id = #{wareHouseId}
|
|
|
|
|
+ <if test="startTime != null and startTime != ''">
|
|
|
|
|
+ and f_bsdate >= #{startTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="endTime != null and endTime != ''">
|
|
|
|
|
+ and f_bsdate >= #{endTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="startTime == null and endTime == null and startTime == '' and endTime == ''">
|
|
|
|
|
+ and DATE_SUB( CURDATE(), INTERVAL 7 DAY ) <= date(f_bsdate)
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="getGoodsList" resultType="map">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ SDD.dict_label AS goodsType,
|
|
|
|
|
+ IFNULL( ROUND( SUM(TW.f_grossweight) / 1000, 2 ), 0 ) as count,
|
|
|
|
|
+ round(
|
|
|
|
|
+ SUM(TW.f_grossweight) * 100 /(
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ SUM(f_grossweight) as total
|
|
|
|
|
+ FROM
|
|
|
|
|
+ t_warehousebills
|
|
|
|
|
+ ),
|
|
|
|
|
+ 2
|
|
|
|
|
+ ) as rate
|
|
|
|
|
+ FROM
|
|
|
|
|
+ t_warehousebills TW
|
|
|
|
|
+ LEFT JOIN sys_dict_data SDD ON SDD.dict_type = 't_trademodels' AND SDD.dict_value = TW.f_trademodeid
|
|
|
|
|
+ <where>
|
|
|
|
|
+ TW.f_id = #{wareHouseId}
|
|
|
|
|
+ and is_pledge = '1'
|
|
|
|
|
+ <if test="startTime != null and startTime != ''">
|
|
|
|
|
+ and TW.f_bsdate >= #{startTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="endTime != null and endTime != ''">
|
|
|
|
|
+ and TW.f_bsdate >= #{endTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="startTime == null and endTime == null and startTime == '' and endTime == ''">
|
|
|
|
|
+ and DATE_SUB( CURDATE(), INTERVAL 7 DAY ) <= date(TW.f_bsdate)
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ GROUP BY
|
|
|
|
|
+ SDD.dict_label
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="getCargoInfoTrend" resultType="map">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ IFNULL( f_bsdate, '' ) as time,
|
|
|
|
|
+ IFNULL( ROUND( SUM(TW.f_grossweight) / 1000, 2 ), 0 ) as value
|
|
|
|
|
+ FROM
|
|
|
|
|
+ t_warehousebills TW
|
|
|
|
|
+ LEFT JOIN sys_dict_data SDD ON SDD.dict_type = 't_trademodels' AND SDD.dict_value = TW.f_trademodeid
|
|
|
|
|
+ <where>
|
|
|
|
|
+ TW.del_flag = '0'
|
|
|
|
|
+ AND TW.f_id = #{wareHouseId}
|
|
|
|
|
+ AND SDD.dict_value = #{FTradeModeId}
|
|
|
|
|
+ <if test="startTime != null and startTime != ''">
|
|
|
|
|
+ and TW.f_bsdate >= #{startTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="endTime != null and endTime != ''">
|
|
|
|
|
+ and TW.f_bsdate >= #{endTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="startTime == null and endTime == null and startTime == '' and endTime == ''">
|
|
|
|
|
+ and DATE_SUB( CURDATE(), INTERVAL 7 DAY ) <= date(TW.f_bsdate)
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ GROUP BY
|
|
|
|
|
+ SDD.dict_label
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="getStorageTop" resultType="map">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ '' AS top,
|
|
|
|
|
+ TG.f_name AS goodsName,
|
|
|
|
|
+ IFNULL( ROUND( SUM(TW.f_grossweight) / 1000, 2 ), 0 ) as normalCnt,
|
|
|
|
|
+ '' AS receiptCnt
|
|
|
|
|
+ FROM
|
|
|
|
|
+ t_warehousebills TW
|
|
|
|
|
+ LEFT JOIN t_goods TG ON TG.f_id = TW.f_goodsid
|
|
|
|
|
+ <where>
|
|
|
|
|
+ TW.del_flag = '0'
|
|
|
|
|
+ AND TW.f_id = #{wareHouseId}
|
|
|
|
|
+ <if test="countType != null and countType != '' and countType == 2">
|
|
|
|
|
+ and TW.f_billtype in ('SJRK','SJCK')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ GROUP BY TW.f_goodsid
|
|
|
|
|
+ ORDER BY IFNULL( ROUND( SUM(TW.f_grossweight) / 1000, 2 ), 0 ) DESC
|
|
|
|
|
+ LIMIT #{topCnt}
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="getGoodsTop" resultType="map">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ '' AS top,
|
|
|
|
|
+ TC.f_name AS ownerName,
|
|
|
|
|
+ IFNULL( ROUND( SUM(TW.f_grossweight) / 1000, 2 ), 0 ) as count
|
|
|
|
|
+ FROM
|
|
|
|
|
+ t_warehousebills TW
|
|
|
|
|
+ LEFT JOIN t_corps TC ON TC.f_id = TW.f_corpid
|
|
|
|
|
+ <where>
|
|
|
|
|
+ TW.del_flag = '0'
|
|
|
|
|
+ AND TW.f_id = #{wareHouseId}
|
|
|
|
|
+ <if test="countType != null and countType != '' and countType == 2">
|
|
|
|
|
+ and TW.f_billtype in ('SJRK','SJCK')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ GROUP BY TW.f_corpid
|
|
|
|
|
+ ORDER BY IFNULL( ROUND( SUM(TW.f_grossweight) / 1000, 2 ), 0 ) DESC
|
|
|
|
|
+ LIMIT #{topCnt}
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="getWorkInfo" resultType="map">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ IFNULL( ROUND( SUM( TW.f_grossweight ) / 1000, 2 ), 0 ) AS Fgrossweight,
|
|
|
|
|
+ COUNT(f_id) AS count
|
|
|
|
|
+ FROM
|
|
|
|
|
+ t_warehousebills TW
|
|
|
|
|
+ <where>
|
|
|
|
|
+ TW.del_flag = '0'
|
|
|
|
|
+ AND TW.f_id = #{wareHouseId}
|
|
|
|
|
+ <if test="countType != null and countType != '' and countType == 'SJRK'">
|
|
|
|
|
+ and TW.f_billtype = #{countType}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="getWorkTrend" resultType="map">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ IFNULL( f_bsdate, '' ) as time,
|
|
|
|
|
+ IFNULL( ROUND( SUM( TW.f_grossweight ) / 1000, 2 ), 0 ) AS value
|
|
|
|
|
+ FROM
|
|
|
|
|
+ t_warehousebills TW
|
|
|
|
|
+ <where>
|
|
|
|
|
+ TW.del_flag = '0'
|
|
|
|
|
+ AND TW.f_id = #{wareHouseId}
|
|
|
|
|
+ <if test="countType != null and countType != ''">
|
|
|
|
|
+ and TW.f_billtype = #{countType}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="startTime != null and startTime != ''">
|
|
|
|
|
+ and TW.f_bsdate >= #{startTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="endTime != null and endTime != ''">
|
|
|
|
|
+ and TW.f_bsdate >= #{endTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="startTime == null and endTime == null and startTime == '' and endTime == ''">
|
|
|
|
|
+ and DATE_SUB( CURDATE(), INTERVAL 7 DAY ) <= date(TW.f_bsdate)
|
|
|
|
|
+ </if>
|
|
|
</where>
|
|
</where>
|
|
|
</select>
|
|
</select>
|
|
|
</mapper>
|
|
</mapper>
|