|
@@ -352,81 +352,96 @@
|
|
|
<select id="getWarehouseByNo" parameterType="String" resultMap="TWarehouseResult">
|
|
|
<include refid="selectTWarehouseVo"/>
|
|
|
<where>
|
|
|
- f_no = #{fNo} and del_flag = '0' limit 1
|
|
|
+ f_id = #{fNo} and del_flag = '0' limit 1
|
|
|
</where>
|
|
|
</select>
|
|
|
|
|
|
<select id="queryGoodsAccountByPageV1" resultType="map">
|
|
|
SELECT
|
|
|
- TW.f_no AS warehouseCode,
|
|
|
+ TW.f_id AS warehouseCode,
|
|
|
TW.f_name AS warehouseName,
|
|
|
TC.f_no AS ownerCode,
|
|
|
- 'xxx有限公司' AS ownerName,
|
|
|
+ TC.f_name AS ownerName,
|
|
|
TG.f_name AS goodsName,
|
|
|
TG.f_packagespecs AS specifications,
|
|
|
'' AS producing,
|
|
|
TWG.f_marks AS materialQuality,
|
|
|
- '' AS level,
|
|
|
- TWG.f_qtyblc AS totalQuantity,
|
|
|
- TWG.f_qtyD AS availableQuantity,
|
|
|
+ '' AS LEVEL,
|
|
|
+ SUM(TWG.f_qtyD) AS totalQuantity,
|
|
|
+ SUM(TWG.f_qtyblc) AS availableQuantity,
|
|
|
'袋' AS quantityUnit,
|
|
|
- IFNULL( ROUND( TWG.f_netweightblc / 1000, 2 ), 0 ) AS totalNetWeight,
|
|
|
- IFNULL( ROUND( TWG.f_netweightD / 1000, 2 ), 0 ) AS availableWeight,
|
|
|
+ IFNULL( ROUND( SUM(TWG.f_netweightD) / 1000, 2 ), 0 ) AS totalNetWeight,
|
|
|
+ IFNULL( ROUND( SUM(TWG.f_netweightblc) / 1000, 2 ), 0 ) AS availableWeight,
|
|
|
'吨' AS weightUnit,
|
|
|
- TG.f_name + '-' + TG.f_packagespecs + '/袋' + '-' + TWG.f_marks AS spu
|
|
|
+ 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
|
|
|
LEFT JOIN t_goods TG ON TG.f_id = TWG.f_goodsid
|
|
|
<where>
|
|
|
TW.del_flag = '0'
|
|
|
- AND TW.f_no = #{warehouseCode}
|
|
|
+ AND TW.f_id = #{warehouseCode}
|
|
|
<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>
|
|
|
</where>
|
|
|
+ GROUP BY
|
|
|
+ TW.f_id,TC.f_no,TG.f_name,TG.f_packagespecs,TWG.f_marks
|
|
|
</select>
|
|
|
|
|
|
<select id="queryGoodsAccountDetailByPageV1" resultType="map">
|
|
|
SELECT
|
|
|
- TW.f_id AS id,
|
|
|
+ DISTINCT
|
|
|
+ TWG.f_id AS id,
|
|
|
TW.f_no AS warehouseCode,
|
|
|
TW.f_name AS warehouseName,
|
|
|
- TW.f_name AS areaName,
|
|
|
- TW.f_no AS areaCode,
|
|
|
- '' AS slotName,
|
|
|
- '' AS slotCode,
|
|
|
+ ware.f_name AS areaName,
|
|
|
+ ware.f_no AS areaCode,
|
|
|
+ ware.f_name AS slotName,
|
|
|
+ ware.f_no AS slotCode,
|
|
|
TWG.f_originalbillno AS receiptDoc,
|
|
|
TWG.f_mblno AS billOfLading,
|
|
|
TC.f_no AS ownerCode,
|
|
|
- 'XXX有限公司' AS ownerName,
|
|
|
+ TC.f_name AS ownerName,
|
|
|
TG.f_name AS goodsName,
|
|
|
TG.f_packagespecs AS specifications,
|
|
|
'' AS producing,
|
|
|
TWG.f_marks AS materialQuality,
|
|
|
'' AS LEVEL,
|
|
|
- TWG.f_qtyblc AS totalQuantity,
|
|
|
- TWG.f_qtyD AS availableQuantity,
|
|
|
+ TWG.f_qtyD AS totalQuantity,
|
|
|
+ TWG.f_qtyblc AS availableQuantity,
|
|
|
'袋' AS quantityUnit,
|
|
|
- IFNULL( ROUND( TWG.f_netweightblc / 1000, 2 ), 0 ) AS totalNetWeight,
|
|
|
- IFNULL( ROUND( TWG.f_netweightD / 1000, 2 ), 0 ) AS availableWeight,
|
|
|
+ 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_warehouse TW
|
|
|
- LEFT JOIN t_whgenleg TWG ON TWG.f_warehouseid = TW.f_id
|
|
|
+ FROM
|
|
|
+ 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
|
|
|
LEFT JOIN t_goods TG ON TG.f_id = TWG.f_goodsid
|
|
|
- LEFT JOIN t_warehousebills TWB ON TW.f_id = TWB.f_warehouseid
|
|
|
+ LEFT JOIN t_warehousebills TWB ON TWG.f_originalbillno = TWB.f_billno
|
|
|
<where>
|
|
|
- TW.f_no = #{warehouseCode}
|
|
|
+ TW.del_flag = '0'
|
|
|
+ and TWG.f_warehouseid = #{warehouseCode}
|
|
|
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>
|
|
|
+ <if test="ownerName != null and ownerName != ''"> and TC.f_name like concat('%', #{ownerName}, '%')</if>
|
|
|
+ <if test="ownerCode != null and ownerCode != ''"> and TC.f_no = #{ownerCode}</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="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_no = #{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_no = #{slotCode}</if>
|
|
|
</where>
|
|
|
</select>
|
|
|
|
|
@@ -456,12 +471,12 @@
|
|
|
|
|
|
<select id="getTimeStorageInfo" resultType="map">
|
|
|
SELECT
|
|
|
- IFNULL( f_bsdate, '' ) as time,
|
|
|
- IFNULL( ROUND( SUM(f_grossweight) / 1000, 2 ), 0 ) as value
|
|
|
+ f_bsdate as time,
|
|
|
+ ROUND( SUM(f_grossweight) / 1000, 2 ) as value
|
|
|
FROM t_warehousebills
|
|
|
<where>
|
|
|
del_flag = '0'
|
|
|
- AND f_id = #{wareHouseId}
|
|
|
+ AND f_warehouseid = #{wareHouseId}
|
|
|
<if test="startTime != null and startTime != ''">
|
|
|
and f_bsdate >= #{startTime}
|
|
|
</if>
|
|
@@ -476,12 +491,12 @@
|
|
|
|
|
|
<select id="getTimeThroughputInfo" resultType="map">
|
|
|
SELECT
|
|
|
- IFNULL( f_bsdate, '' ) as time,
|
|
|
- IFNULL( ROUND( SUM(f_grossweight) / 1000, 2 ), 0 ) as value
|
|
|
+ f_bsdate as time,
|
|
|
+ ROUND( SUM(f_grossweight) / 1000, 2 ) as value
|
|
|
FROM t_warehousebills
|
|
|
<where>
|
|
|
del_flag = '0'
|
|
|
- AND f_id = #{wareHouseId}
|
|
|
+ AND f_warehouseid = #{wareHouseId}
|
|
|
and f_billtype in ('SJRK','SJCK')
|
|
|
<if test="startTime != null and startTime != ''">
|
|
|
and f_bsdate >= #{startTime}
|
|
@@ -497,16 +512,18 @@
|
|
|
|
|
|
<select id="getCargoInfo" resultType="map">
|
|
|
SELECT
|
|
|
- IFNULL( ROUND( SUM(f_grossweight) / 1000, 2 ), 0 ) as FGrossweight
|
|
|
+ ROUND( SUM(f_grossweight) / 1000, 2 ) as FGrossweight
|
|
|
FROM t_warehousebills
|
|
|
<where>
|
|
|
- is_pledge = #{isPledge}
|
|
|
- AND f_id = #{wareHouseId}
|
|
|
+ f_warehouseid = #{wareHouseId}
|
|
|
+ <if test="isPledge != null and isPledge != ''">
|
|
|
+ and is_pledge = #{isPledge}
|
|
|
+ </if>
|
|
|
<if test="startTime != null and startTime != ''">
|
|
|
and f_bsdate >= #{startTime}
|
|
|
</if>
|
|
|
<if test="endTime != null and endTime != ''">
|
|
|
- and f_bsdate >= #{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)
|
|
@@ -517,7 +534,7 @@
|
|
|
<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) / 1000, 2 ) as count,
|
|
|
round(
|
|
|
SUM(TW.f_grossweight) * 100 /(
|
|
|
SELECT
|
|
@@ -529,15 +546,14 @@
|
|
|
) 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
|
|
|
+ LEFT JOIN sys_dict_data SDD ON SDD.dict_type = 'data_trademodes' AND SDD.dict_value = TW.f_trademodeid
|
|
|
<where>
|
|
|
- TW.f_id = #{wareHouseId}
|
|
|
- and is_pledge = '1'
|
|
|
+ TW.f_warehouseid = #{wareHouseId}
|
|
|
<if test="startTime != null and startTime != ''">
|
|
|
and TW.f_bsdate >= #{startTime}
|
|
|
</if>
|
|
|
<if test="endTime != null and endTime != ''">
|
|
|
- and TW.f_bsdate >= #{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)
|
|
@@ -549,20 +565,20 @@
|
|
|
|
|
|
<select id="getCargoInfoTrend" resultType="map">
|
|
|
SELECT
|
|
|
- IFNULL( f_bsdate, '' ) as time,
|
|
|
- IFNULL( ROUND( SUM(TW.f_grossweight) / 1000, 2 ), 0 ) 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 = 't_trademodels' AND SDD.dict_value = TW.f_trademodeid
|
|
|
+ LEFT JOIN sys_dict_data SDD ON SDD.dict_type = 'data_trademodes' AND SDD.dict_value = TW.f_trademodeid
|
|
|
<where>
|
|
|
TW.del_flag = '0'
|
|
|
- AND TW.f_id = #{wareHouseId}
|
|
|
+ AND TW.f_warehouseid = #{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}
|
|
|
+ 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)
|
|
@@ -574,16 +590,15 @@
|
|
|
|
|
|
<select id="getStorageTop" resultType="map">
|
|
|
SELECT
|
|
|
- '' AS top,
|
|
|
TG.f_name AS goodsName,
|
|
|
- IFNULL( ROUND( SUM(TW.f_grossweight) / 1000, 2 ), 0 ) as normalCnt,
|
|
|
+ ROUND( SUM(TW.f_grossweight) / 1000, 2 ) 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}
|
|
|
+ AND TW.f_warehouseid = #{wareHouseId}
|
|
|
<if test="countType != null and countType != '' and countType == 2">
|
|
|
and TW.f_billtype in ('SJRK','SJCK')
|
|
|
</if>
|
|
@@ -591,19 +606,19 @@
|
|
|
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
|
|
|
+ ROUND( SUM(TW.f_grossweight) / 1000, 2 ) 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}
|
|
|
+ AND TW.f_warehouseid = #{wareHouseId}
|
|
|
<if test="countType != null and countType != '' and countType == 2">
|
|
|
and TW.f_billtype in ('SJRK','SJCK')
|
|
|
</if>
|
|
@@ -615,18 +630,18 @@
|
|
|
|
|
|
<select id="getTransferTransaction" resultType="map">
|
|
|
SELECT
|
|
|
- IFNULL( f_bsdate, '' ) as time,
|
|
|
- IFNULL( ROUND( SUM(f_grossweight) / 1000, 2 ), 0 ) as value
|
|
|
+ f_bsdate as time,
|
|
|
+ ROUND( SUM(f_grossweight) / 1000, 2 ) as value
|
|
|
FROM
|
|
|
t_warehousebills
|
|
|
<where>
|
|
|
del_flag = '0'
|
|
|
- AND f_id = #{wareHouseId}
|
|
|
+ AND f_warehouseid = #{wareHouseId}
|
|
|
<if test="startTime != null and startTime != ''">
|
|
|
and f_bsdate >= #{startTime}
|
|
|
</if>
|
|
|
<if test="endTime != null and endTime != ''">
|
|
|
- and f_bsdate >= #{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)
|
|
@@ -636,13 +651,13 @@
|
|
|
|
|
|
<select id="getWorkInfo" resultType="map">
|
|
|
SELECT
|
|
|
- IFNULL( ROUND( SUM( TW.f_grossweight ) / 1000, 2 ), 0 ) AS Fgrossweight,
|
|
|
+ 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}
|
|
|
+ AND TW.f_warehouseid = #{wareHouseId}
|
|
|
<if test="countType != null and countType != '' and countType == 'SJRK'">
|
|
|
and TW.f_billtype = #{countType}
|
|
|
</if>
|
|
@@ -651,13 +666,13 @@
|
|
|
|
|
|
<select id="getWorkTrend" resultType="map">
|
|
|
SELECT
|
|
|
- IFNULL( f_bsdate, '' ) as time,
|
|
|
- IFNULL( ROUND( SUM( TW.f_grossweight ) / 1000, 2 ), 0 ) AS value
|
|
|
+ f_bsdate as time,
|
|
|
+ ROUND( SUM( TW.f_grossweight ) / 1000, 2 ) AS value
|
|
|
FROM
|
|
|
t_warehousebills TW
|
|
|
<where>
|
|
|
TW.del_flag = '0'
|
|
|
- AND TW.f_id = #{wareHouseId}
|
|
|
+ AND TW.f_warehouseid = #{wareHouseId}
|
|
|
<if test="countType != null and countType != ''">
|
|
|
and TW.f_billtype = #{countType}
|
|
|
</if>
|
|
@@ -665,7 +680,7 @@
|
|
|
and TW.f_bsdate >= #{startTime}
|
|
|
</if>
|
|
|
<if test="endTime != null and endTime != ''">
|
|
|
- and TW.f_bsdate >= #{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)
|