|
|
@@ -37,10 +37,10 @@
|
|
|
a.create_by_id as createBy,
|
|
|
a.create_time as createDate,
|
|
|
a.ware_house_type,
|
|
|
- a.trade_name,
|
|
|
- a.brand,
|
|
|
- a.specification,
|
|
|
- a.company,
|
|
|
+ c.name as trade_name,
|
|
|
+ c.brand,
|
|
|
+ c.specification,
|
|
|
+ c.company,
|
|
|
b.NAME AS wareHouseTypeName,
|
|
|
sum( trade_number ) AS allNumber,
|
|
|
b.collect_number AS borrowNumber,
|
|
|
@@ -50,25 +50,32 @@
|
|
|
psi_management_warehouse_detailed a
|
|
|
LEFT JOIN (
|
|
|
SELECT
|
|
|
- sum( g.collect_number ) AS collect_number,
|
|
|
- e.goods_name,
|
|
|
+ sum(
|
|
|
+ CASE
|
|
|
+ WHEN r.status = '5' AND d.id IS NULL THEN IFNULL(e.not_surplus_stock, 0)
|
|
|
+ WHEN r.status = '5' AND d.is_return = '2' THEN IFNULL(e.not_surplus_stock, e.collect_number)
|
|
|
+ WHEN r.status = '5' AND d.is_return = '1' THEN 0
|
|
|
+ ELSE IFNULL(e.not_surplus_stock, e.collect_number)
|
|
|
+ END
|
|
|
+ ) AS collect_number,
|
|
|
+ e.collect_type,
|
|
|
c.NAME as name,
|
|
|
- e.basic_id as mmcId,
|
|
|
- STATUS
|
|
|
+ min(e.basic_id) as mmcId
|
|
|
FROM
|
|
|
- psi_management_collect_detailed e
|
|
|
+ psi_management_collect_detailed_record e
|
|
|
LEFT JOIN psi_management_collect_basics f ON e.basic_id = f.id
|
|
|
AND f.del_flag = 0
|
|
|
+ LEFT JOIN psi_management_collect_detailed d ON e.detail_id = d.id
|
|
|
+ LEFT JOIN psi_management_collect_basics_return r ON r.basic_id = e.basic_id AND r.del_flag = 0
|
|
|
LEFT JOIN psi_management_type c ON e.collect_type = c.id
|
|
|
- left join psi_management_collect_detailed g on e.goods_name = g.goods_name and g.del_flag = 0
|
|
|
WHERE
|
|
|
f.`status` = 5 AND e.del_flag = 0
|
|
|
GROUP BY
|
|
|
- e.id
|
|
|
- ) b ON a.trade_name = b.goods_name
|
|
|
+ e.collect_type, c.NAME
|
|
|
+ ) b ON a.ware_house_type = b.collect_type
|
|
|
LEFT JOIN psi_management_type c ON a.ware_house_type = c.id
|
|
|
${ew.customSqlSegment}
|
|
|
- GROUP BY a.trade_name,a.ware_house_type
|
|
|
+ GROUP BY a.ware_house_type
|
|
|
HAVING sum( trade_number ) - IFNULL(collect_number,0) <= 5
|
|
|
ORDER BY a.update_time DESC
|
|
|
</select>
|
|
|
@@ -79,10 +86,10 @@
|
|
|
a.create_by_id as createBy,
|
|
|
a.create_time as createDate,
|
|
|
a.ware_house_type,
|
|
|
- a.trade_name,
|
|
|
- a.brand,
|
|
|
- a.specification,
|
|
|
- a.company,
|
|
|
+ c.name as trade_name,
|
|
|
+ c.brand,
|
|
|
+ c.specification,
|
|
|
+ c.company,
|
|
|
c.name as wareHouseTypeName,
|
|
|
sum( trade_number ) AS allNumber,
|
|
|
b.collect_number AS borrowNumber,
|
|
|
@@ -101,45 +108,50 @@
|
|
|
left join
|
|
|
(
|
|
|
select
|
|
|
- sum(collect_number) as collect_number,
|
|
|
- goods_name,
|
|
|
- status
|
|
|
- from psi_management_collect_detailed e
|
|
|
+ sum(
|
|
|
+ CASE
|
|
|
+ WHEN r.status = '5' AND d.id IS NULL THEN IFNULL(e.not_surplus_stock, 0)
|
|
|
+ WHEN r.status = '5' AND d.is_return = '2' THEN IFNULL(e.not_surplus_stock, e.collect_number)
|
|
|
+ WHEN r.status = '5' AND d.is_return = '1' THEN 0
|
|
|
+ ELSE IFNULL(e.not_surplus_stock, e.collect_number)
|
|
|
+ END
|
|
|
+ ) as collect_number,
|
|
|
+ e.collect_type
|
|
|
+ from psi_management_collect_detailed_record e
|
|
|
left join psi_management_collect_basics f on e.basic_id = f.id and f.del_flag = 0
|
|
|
- WHERE f.`status` = 5 and e.del_flag = 0 and e.is_return = '0'
|
|
|
- GROUP BY e.goods_name
|
|
|
+ left join psi_management_collect_detailed d on e.detail_id = d.id
|
|
|
+ left join psi_management_collect_basics_return r on r.basic_id = e.basic_id and r.del_flag = 0
|
|
|
+ WHERE f.`status` = 5 and e.del_flag = 0
|
|
|
+ GROUP BY e.collect_type
|
|
|
) b
|
|
|
- on a.trade_name = b.goods_name
|
|
|
+ on a.ware_house_type = b.collect_type
|
|
|
left join
|
|
|
(
|
|
|
select
|
|
|
sum(loss_number) as loss_number,
|
|
|
- goods_name,
|
|
|
- status
|
|
|
+ collect_type
|
|
|
from psi_management_loss_detailed e
|
|
|
left join psi_management_loss_basics f on e.basic_id = f.id and f.del_flag = 0
|
|
|
WHERE f.`status` = 5 and e.del_flag = 0
|
|
|
- GROUP BY e.goods_name
|
|
|
+ GROUP BY e.collect_type
|
|
|
) loss
|
|
|
- on a.trade_name = loss.goods_name
|
|
|
+ on a.ware_house_type = loss.collect_type
|
|
|
left join
|
|
|
(
|
|
|
select
|
|
|
sum(returned_num) AS returned_num,
|
|
|
sum(not_surplus_stock) AS not_surplus_stock,
|
|
|
- inventory_id,
|
|
|
- goods_name,
|
|
|
- status
|
|
|
+ collect_type
|
|
|
from psi_management_collect_detailed_record e
|
|
|
left join psi_management_collect_basics pmcba on e.basic_id = pmcba.id and pmcba.del_flag = 0
|
|
|
WHERE pmcba.`status` = 5 and e.del_flag = 0
|
|
|
- group BY e.goods_name
|
|
|
+ group BY e.collect_type
|
|
|
) pmcdra
|
|
|
- on a.trade_name = pmcdra.goods_name
|
|
|
+ on a.ware_house_type = pmcdra.collect_type
|
|
|
LEFT JOIN psi_management_warehouse_basics bas on a.basic_id = bas.id
|
|
|
left join psi_management_type c on a.ware_house_type = c.id
|
|
|
${ew.customSqlSegment}
|
|
|
- GROUP BY a.trade_name,a.ware_house_type
|
|
|
+ GROUP BY a.ware_house_type
|
|
|
ORDER BY a.ware_house_type DESC,a.trade_name
|
|
|
</select>
|
|
|
|
|
|
@@ -150,8 +162,8 @@
|
|
|
a.create_by_id as createBy,
|
|
|
a.create_time as createDate,
|
|
|
a.ware_house_type,
|
|
|
- a.trade_name,
|
|
|
- a.company,
|
|
|
+ c.name as trade_name,
|
|
|
+ c.company,
|
|
|
c.name as wareHouseTypeName,
|
|
|
IFNULL(his_detail.trade_number,0) AS allNumber,
|
|
|
b.collect_number AS borrowNumber,
|
|
|
@@ -174,28 +186,32 @@
|
|
|
left join
|
|
|
(
|
|
|
select
|
|
|
- sum(collect_number) as collect_number,
|
|
|
- goods_name,
|
|
|
- collect_type,
|
|
|
- status
|
|
|
- from psi_management_collect_detailed e
|
|
|
+ sum(
|
|
|
+ CASE
|
|
|
+ WHEN r.status = '5' AND d.id IS NULL THEN IFNULL(e.not_surplus_stock, 0)
|
|
|
+ WHEN r.status = '5' AND d.is_return = '2' THEN IFNULL(e.not_surplus_stock, e.collect_number)
|
|
|
+ WHEN r.status = '5' AND d.is_return = '1' THEN 0
|
|
|
+ ELSE IFNULL(e.not_surplus_stock, e.collect_number)
|
|
|
+ END
|
|
|
+ ) as collect_number,
|
|
|
+ e.collect_type
|
|
|
+ from psi_management_collect_detailed_record e
|
|
|
left join psi_management_collect_basics f on e.basic_id = f.id and f.del_flag = 0
|
|
|
+ left join psi_management_collect_detailed d on e.detail_id = d.id
|
|
|
+ left join psi_management_collect_basics_return r on r.basic_id = e.basic_id and r.del_flag = 0
|
|
|
WHERE f.`status` = 5
|
|
|
and e.del_flag = 0
|
|
|
- and e.is_return = '0'
|
|
|
<if test="dto != null and dto.dateRange != null and dto.dateRange.length == 2">
|
|
|
and f.collect_date >= #{dto.dateRange[0]} AND f.collect_date <= #{dto.dateRange[1]}
|
|
|
</if>
|
|
|
- GROUP BY e.goods_name, e.collect_type
|
|
|
+ GROUP BY e.collect_type
|
|
|
) b
|
|
|
- on a.trade_name = b.goods_name AND a.ware_house_type = b.collect_type
|
|
|
+ on a.ware_house_type = b.collect_type
|
|
|
left join
|
|
|
(
|
|
|
select
|
|
|
sum(loss_number) as loss_number,
|
|
|
- goods_name,
|
|
|
- collect_type,
|
|
|
- status
|
|
|
+ collect_type
|
|
|
from psi_management_loss_detailed e
|
|
|
left join psi_management_loss_basics f on e.basic_id = f.id and f.del_flag = 0
|
|
|
WHERE f.`status` = 5
|
|
|
@@ -203,15 +219,13 @@
|
|
|
<if test="dto != null and dto.dateRange != null and dto.dateRange.length == 2">
|
|
|
and f.collect_date >= #{dto.dateRange[0]} AND f.collect_date <= #{dto.dateRange[1]}
|
|
|
</if>
|
|
|
- GROUP BY e.goods_name, e.collect_type
|
|
|
+ GROUP BY e.collect_type
|
|
|
) loss
|
|
|
- on a.trade_name = loss.goods_name AND a.ware_house_type = loss.collect_type
|
|
|
+ on a.ware_house_type = loss.collect_type
|
|
|
left join(
|
|
|
select
|
|
|
sum(loss_number) as loss_number,
|
|
|
- goods_name,
|
|
|
- collect_type,
|
|
|
- status
|
|
|
+ collect_type
|
|
|
from psi_management_loss_detailed e
|
|
|
left join psi_management_loss_basics f on e.basic_id = f.id and f.del_flag = 0
|
|
|
WHERE f.`status` = 5
|
|
|
@@ -219,15 +233,14 @@
|
|
|
<if test="dto != null and dto.dateRange != null and dto.dateRange.length == 2">
|
|
|
and f.collect_date >= #{dto.dateRange[1]}
|
|
|
</if>
|
|
|
- GROUP BY e.goods_name, e.collect_type
|
|
|
+ GROUP BY e.collect_type
|
|
|
) loss_after
|
|
|
- on a.trade_name = loss_after.goods_name AND a.ware_house_type = loss_after.collect_type
|
|
|
+ on a.ware_house_type = loss_after.collect_type
|
|
|
left join
|
|
|
(
|
|
|
select
|
|
|
sum(returned_num) AS returned_num,
|
|
|
sum(not_surplus_stock) AS not_surplus_stock,
|
|
|
- goods_name,
|
|
|
collect_type
|
|
|
from psi_management_collect_detailed_record e
|
|
|
left join psi_management_collect_basics pmcba on e.basic_id = pmcba.id and pmcba.del_flag = 0
|
|
|
@@ -236,14 +249,13 @@
|
|
|
<if test=" dto != null and dto.dateRange != null and dto.dateRange.length == 2">
|
|
|
and pmcba.collect_date >= #{dto.dateRange[0]} AND pmcba.collect_date <= #{dto.dateRange[1]}
|
|
|
</if>
|
|
|
- group BY e.goods_name, e.collect_type
|
|
|
+ group BY e.collect_type
|
|
|
) pmcdra
|
|
|
- on a.trade_name = pmcdra.goods_name AND a.ware_house_type = pmcdra.collect_type
|
|
|
+ on a.ware_house_type = pmcdra.collect_type
|
|
|
LEFT JOIN (
|
|
|
select
|
|
|
sum(returned_num) AS returned_num,
|
|
|
sum(not_surplus_stock) AS not_surplus_stock,
|
|
|
- goods_name,
|
|
|
collect_type
|
|
|
from psi_management_collect_detailed_record e
|
|
|
left join psi_management_collect_basics pmcba on e.basic_id = pmcba.id and pmcba.del_flag = 0
|
|
|
@@ -252,21 +264,19 @@
|
|
|
<if test=" dto != null and dto.dateRange != null and dto.dateRange.length == 2">
|
|
|
and pmcba.collect_date >= #{dto.dateRange[1]}
|
|
|
</if>
|
|
|
- group BY e.goods_name, e.collect_type
|
|
|
+ group BY e.collect_type
|
|
|
) after_pmcdra
|
|
|
- on a.trade_name = after_pmcdra.goods_name AND a.ware_house_type = after_pmcdra.collect_type
|
|
|
+ on a.ware_house_type = after_pmcdra.collect_type
|
|
|
LEFT JOIN (
|
|
|
SELECT
|
|
|
- trade_name,
|
|
|
ware_house_type,
|
|
|
SUM(current_inventory) AS allCurrentInventory
|
|
|
FROM psi_management_warehouse_detailed
|
|
|
WHERE del_flag = 0
|
|
|
- GROUP BY trade_name, ware_house_type
|
|
|
- ) all_stock ON a.trade_name = all_stock.trade_name AND a.ware_house_type = all_stock.ware_house_type
|
|
|
+ GROUP BY ware_house_type
|
|
|
+ ) all_stock ON a.ware_house_type = all_stock.ware_house_type
|
|
|
LEFT JOIN (
|
|
|
SELECT
|
|
|
- pwd.trade_name,
|
|
|
pwd.ware_house_type,
|
|
|
SUM(pwd.trade_number) AS trade_number
|
|
|
FROM psi_management_warehouse_detailed pwd
|
|
|
@@ -275,11 +285,10 @@
|
|
|
<if test=" dto != null and dto.dateRange != null and dto.dateRange.length == 2">
|
|
|
and pmcba.ware_house_date >= #{dto.dateRange[0]} AND pmcba.ware_house_date <= #{dto.dateRange[1]}
|
|
|
</if>
|
|
|
- GROUP BY pwd.trade_name, pwd.ware_house_type
|
|
|
- ) his_detail ON a.trade_name = his_detail.trade_name AND a.ware_house_type = his_detail.ware_house_type
|
|
|
+ GROUP BY pwd.ware_house_type
|
|
|
+ ) his_detail ON a.ware_house_type = his_detail.ware_house_type
|
|
|
LEFT JOIN (
|
|
|
SELECT
|
|
|
- ab.trade_name,
|
|
|
ab.ware_house_type,
|
|
|
SUM(ab.trade_number) AS trade_number
|
|
|
FROM psi_management_warehouse_detailed ab
|
|
|
@@ -288,12 +297,12 @@
|
|
|
<if test="dto != null and dto.dateRange != null and dto.dateRange.length == 2">
|
|
|
and pmcba.ware_house_date >= #{dto.dateRange[1]}
|
|
|
</if>
|
|
|
- GROUP BY ab.trade_name, ab.ware_house_type
|
|
|
- ) after_pmwd ON a.trade_name = after_pmwd.trade_name AND a.ware_house_type = after_pmwd.ware_house_type
|
|
|
+ GROUP BY ab.ware_house_type
|
|
|
+ ) after_pmwd ON a.ware_house_type = after_pmwd.ware_house_type
|
|
|
LEFT JOIN psi_management_warehouse_basics bas on a.basic_id = bas.id
|
|
|
left join psi_management_type c on a.ware_house_type = c.id
|
|
|
${ew.customSqlSegment}
|
|
|
- GROUP BY a.trade_name,a.ware_house_type
|
|
|
+ GROUP BY a.ware_house_type
|
|
|
ORDER BY a.ware_house_type DESC,a.trade_name
|
|
|
</select>
|
|
|
|
|
|
@@ -305,7 +314,7 @@
|
|
|
a.create_by_id as createBy,
|
|
|
a.create_time as createDate,
|
|
|
a.ware_house_type,
|
|
|
- a.trade_name,
|
|
|
+ c.name as trade_name,
|
|
|
a.company,
|
|
|
c.name as wareHouseTypeName,
|
|
|
sum( trade_number ) AS allNumber,
|
|
|
@@ -323,18 +332,17 @@
|
|
|
(
|
|
|
select
|
|
|
sum(collect_number) as collect_number,
|
|
|
- goods_name,
|
|
|
- status
|
|
|
+ collect_type
|
|
|
from psi_management_collect_detailed e
|
|
|
left join psi_management_collect_basics f on e.basic_id = f.id and f.del_flag = 0
|
|
|
WHERE f.`status` = 5 and e.del_flag = 0
|
|
|
- GROUP BY e.goods_name
|
|
|
+ GROUP BY e.collect_type
|
|
|
) b
|
|
|
- on a.trade_name = b.goods_name
|
|
|
+ on a.ware_house_type = b.collect_type
|
|
|
LEFT JOIN psi_management_warehouse_basics bas on a.basic_id = bas.id
|
|
|
left join psi_management_type c on a.ware_house_type = c.id
|
|
|
${ew.customSqlSegment}
|
|
|
- GROUP BY a.trade_name,a.ware_house_type
|
|
|
+ GROUP BY a.ware_house_type
|
|
|
ORDER BY a.ware_house_type DESC,a.trade_name
|
|
|
</select>
|
|
|
|
|
|
@@ -344,7 +352,7 @@
|
|
|
a.id,
|
|
|
a.produce_date as produce_date,
|
|
|
a.ware_house_type,
|
|
|
- a.trade_name,
|
|
|
+ c.name as trade_name,
|
|
|
a.spec,
|
|
|
a.specification,
|
|
|
a.company,
|
|
|
@@ -368,7 +376,7 @@
|
|
|
SELECT
|
|
|
a.id,
|
|
|
a.produce_date as produce_date,
|
|
|
- a.trade_name,
|
|
|
+ c.name as trade_name,
|
|
|
a.spec,
|
|
|
a.company,
|
|
|
a.current_inventory,
|
|
|
@@ -383,7 +391,7 @@
|
|
|
left join psi_management_type c on a.ware_house_type = c.id
|
|
|
${ew.customSqlSegment}
|
|
|
|
|
|
- GROUP BY a.trade_name,a.ware_house_type,a.produce_date
|
|
|
+ GROUP BY a.ware_house_type,a.produce_date
|
|
|
ORDER BY a.produce_date asc
|
|
|
</select>
|
|
|
|
|
|
@@ -442,7 +450,6 @@
|
|
|
sy.name as collectHandleBy,
|
|
|
so.name as collectHandleByOff,
|
|
|
a.collect_date,
|
|
|
- b.goods_name,
|
|
|
b.collect_number,
|
|
|
b.current_inventory,
|
|
|
pmwd.spec,
|
|
|
@@ -472,23 +479,23 @@
|
|
|
c.name as wareHouseTypeName,
|
|
|
sum(trade_number) as allNumber,
|
|
|
b.collect_number as borrowNumber,
|
|
|
- a.current_inventory as tradeNumber,
|
|
|
+ sum(a.current_inventory) as tradeNumber,
|
|
|
a.warn_num,
|
|
|
a.warn_flag
|
|
|
FROM
|
|
|
psi_management_warehouse_detailed a
|
|
|
left join
|
|
|
- (select sum(collect_number) as collect_number,goods_name,status from psi_management_collect_detailed e
|
|
|
+ (select sum(collect_number) as collect_number,collect_type from psi_management_collect_detailed e
|
|
|
left join psi_management_collect_basics f on e.basic_id = f.id and f.del_flag = 0
|
|
|
WHERE f.`status` = 5 and e.collect_type = #{collectTypeId}
|
|
|
- GROUP BY e.goods_name) b
|
|
|
- on a.trade_name = b.goods_name
|
|
|
+ GROUP BY e.collect_type) b
|
|
|
+ on a.ware_house_type = b.collect_type
|
|
|
LEFT JOIN psi_management_warehouse_basics bas on a.basic_id = bas.id
|
|
|
left join psi_management_type c on a.ware_house_type = c.id
|
|
|
where a.trade_name = #{goodsName}
|
|
|
and a.ware_house_type = #{collectTypeId}
|
|
|
and a.del_flag = 0
|
|
|
- GROUP BY a.trade_name
|
|
|
+ GROUP BY a.ware_house_type
|
|
|
ORDER BY a.update_time DESC
|
|
|
</select>
|
|
|
<select id="getByTypeAndGoodsNameByProduceDate"
|
|
|
@@ -507,11 +514,11 @@
|
|
|
FROM
|
|
|
psi_management_warehouse_detailed a
|
|
|
left join
|
|
|
- (select sum(collect_number) as collect_number,goods_name,status from psi_management_collect_detailed e
|
|
|
+ (select sum(collect_number) as collect_number,collect_type from psi_management_collect_detailed e
|
|
|
left join psi_management_collect_basics f on e.basic_id = f.id and f.del_flag = 0
|
|
|
WHERE f.`status` = 5 and e.collect_type = #{collectTypeId}
|
|
|
- GROUP BY e.goods_name) b
|
|
|
- on a.trade_name = b.goods_name
|
|
|
+ GROUP BY e.collect_type) b
|
|
|
+ on a.ware_house_type = b.collect_type
|
|
|
|
|
|
LEFT JOIN psi_management_warehouse_basics bas on a.basic_id = bas.id
|
|
|
left join psi_management_type c on a.ware_house_type = c.id
|
|
|
@@ -519,7 +526,7 @@
|
|
|
and a.ware_house_type = #{collectTypeId}
|
|
|
and a.produce_date = #{produceDate}
|
|
|
and a.del_flag = 0
|
|
|
- GROUP BY a.trade_name
|
|
|
+ GROUP BY a.ware_house_type,a.produce_date
|
|
|
ORDER BY a.produce_date asc
|
|
|
</select>
|
|
|
|
|
|
@@ -538,11 +545,11 @@
|
|
|
FROM
|
|
|
psi_management_warehouse_detailed a
|
|
|
left join
|
|
|
- (select sum(collect_number) as collect_number,goods_name,status from psi_management_collect_detailed e
|
|
|
+ (select sum(collect_number) as collect_number,collect_type from psi_management_collect_detailed e
|
|
|
left join psi_management_collect_basics f on e.basic_id = f.id and f.del_flag = 0
|
|
|
WHERE f.`status` = 5 and e.collect_type = #{collectTypeId}
|
|
|
- GROUP BY e.goods_name) b
|
|
|
- on a.trade_name = b.goods_name
|
|
|
+ GROUP BY e.collect_type) b
|
|
|
+ on a.ware_house_type = b.collect_type
|
|
|
LEFT JOIN psi_management_warehouse_basics bas on a.basic_id = bas.id
|
|
|
left join psi_management_type c on a.ware_house_type = c.id
|
|
|
where a.trade_name = #{goodsName}
|
|
|
@@ -575,16 +582,17 @@
|
|
|
left join psi_management_type c on a.ware_house_type = c.id
|
|
|
|
|
|
left join
|
|
|
- (select sum(collect_number) as collect_number,goods_name,status from psi_management_collect_detailed e
|
|
|
+ (select sum(collect_number) as collect_number,collect_type from psi_management_collect_detailed e
|
|
|
left join psi_management_collect_basics f on e.basic_id = f.id and f.del_flag = 0
|
|
|
- WHERE f.`status` = 5 and e.del_flag = 0 and e.produce_date <= #{produceDate} and e.collect_type = #{wareHouseType} and e.goods_name = #{tradeName}) b
|
|
|
- on a.trade_name = b.goods_name
|
|
|
+ WHERE f.`status` = 5 and e.del_flag = 0 and e.produce_date <= #{produceDate} and e.collect_type = #{wareHouseType} and e.goods_name = #{tradeName}
|
|
|
+ GROUP BY e.collect_type) b
|
|
|
+ on a.ware_house_type = b.collect_type
|
|
|
|
|
|
WHERE a.ware_house_type = #{wareHouseType}
|
|
|
and a.del_flag = 0
|
|
|
and a.trade_name = #{tradeName}
|
|
|
and a.produce_date <= #{produceDate}
|
|
|
- GROUP BY a.trade_name,a.ware_house_type
|
|
|
+ GROUP BY a.ware_house_type
|
|
|
ORDER BY a.ware_house_type DESC
|
|
|
</select>
|
|
|
<select id="getCollectInfoByTime" resultType="java.lang.String">
|
|
|
@@ -595,16 +603,17 @@
|
|
|
left join psi_management_type c on a.ware_house_type = c.id
|
|
|
|
|
|
left join
|
|
|
- (select sum(collect_number) as collect_number,goods_name,status from psi_management_collect_detailed e
|
|
|
+ (select sum(collect_number) as collect_number,collect_type from psi_management_collect_detailed e
|
|
|
left join psi_management_collect_basics f on e.basic_id = f.id and f.del_flag = 0
|
|
|
- WHERE f.`status` = 5 and e.del_flag = 0 and e.create_time <= #{createDate} and e.collect_type = #{wareHouseType} and e.goods_name = #{tradeName}) b
|
|
|
- on a.trade_name = b.goods_name
|
|
|
+ WHERE f.`status` = 5 and e.del_flag = 0 and e.create_time <= #{createDate} and e.collect_type = #{wareHouseType} and e.goods_name = #{tradeName}
|
|
|
+ GROUP BY e.collect_type) b
|
|
|
+ on a.ware_house_type = b.collect_type
|
|
|
|
|
|
WHERE a.ware_house_type = #{wareHouseType}
|
|
|
and a.del_flag = 0
|
|
|
and a.trade_name = #{tradeName}
|
|
|
and a.create_time <= #{createDate}
|
|
|
- GROUP BY a.trade_name,a.ware_house_type
|
|
|
+ GROUP BY a.ware_house_type
|
|
|
ORDER BY a.ware_house_type DESC
|
|
|
</select>
|
|
|
<select id="getCollectNumByType" resultType="java.lang.String">
|