|
@@ -152,6 +152,7 @@
|
|
|
left join psi_management_type c on a.ware_house_type = c.id
|
|
left join psi_management_type c on a.ware_house_type = c.id
|
|
|
${ew.customSqlSegment}
|
|
${ew.customSqlSegment}
|
|
|
GROUP BY a.ware_house_type
|
|
GROUP BY a.ware_house_type
|
|
|
|
|
+ HAVING SUM(CAST(IFNULL(NULLIF(a.current_inventory, ''), '0') AS DECIMAL(18,4))) > 0
|
|
|
ORDER BY a.ware_house_type DESC,a.trade_name
|
|
ORDER BY a.ware_house_type DESC,a.trade_name
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
@@ -166,8 +167,8 @@
|
|
|
c.company,
|
|
c.company,
|
|
|
c.name as wareHouseTypeName,
|
|
c.name as wareHouseTypeName,
|
|
|
IFNULL(his_detail.trade_number,0) AS allNumber,
|
|
IFNULL(his_detail.trade_number,0) AS allNumber,
|
|
|
- b.collect_number AS borrowNumber,
|
|
|
|
|
- loss.loss_number AS lossNumber,
|
|
|
|
|
|
|
+ IFNULL(b.collect_number,0) AS borrowNumber,
|
|
|
|
|
+ IFNULL(loss.loss_number,0) AS lossNumber,
|
|
|
IFNULL(loss_after.loss_number, 0) AS afterLossNumber,
|
|
IFNULL(loss_after.loss_number, 0) AS afterLossNumber,
|
|
|
IFNULL(after_pmwd.trade_number, 0) AS afterTradeNumber,
|
|
IFNULL(after_pmwd.trade_number, 0) AS afterTradeNumber,
|
|
|
IFNULL(after_pmcdra.not_surplus_stock, 0) AS afterNotSurplusStock,
|
|
IFNULL(after_pmcdra.not_surplus_stock, 0) AS afterNotSurplusStock,
|
|
@@ -303,6 +304,7 @@
|
|
|
left join psi_management_type c on a.ware_house_type = c.id
|
|
left join psi_management_type c on a.ware_house_type = c.id
|
|
|
${ew.customSqlSegment}
|
|
${ew.customSqlSegment}
|
|
|
GROUP BY a.ware_house_type
|
|
GROUP BY a.ware_house_type
|
|
|
|
|
+ HAVING SUM(CAST(IFNULL(NULLIF(all_stock.allCurrentInventory, ''), '0') AS DECIMAL(18,4))) > 0
|
|
|
ORDER BY a.ware_house_type DESC,a.trade_name
|
|
ORDER BY a.ware_house_type DESC,a.trade_name
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
@@ -422,7 +424,7 @@
|
|
|
a.ware_house_date,
|
|
a.ware_house_date,
|
|
|
sy.name as wareHouseHandledBy,
|
|
sy.name as wareHouseHandledBy,
|
|
|
so.name as wareHouseHandledByOff,
|
|
so.name as wareHouseHandledByOff,
|
|
|
- b.trade_name,
|
|
|
|
|
|
|
+ t.name as tradeName,
|
|
|
b.trade_number,
|
|
b.trade_number,
|
|
|
b.current_inventory,
|
|
b.current_inventory,
|
|
|
b.ware_house_type,
|
|
b.ware_house_type,
|
|
@@ -434,6 +436,7 @@
|
|
|
psi_management_warehouse_basics a
|
|
psi_management_warehouse_basics a
|
|
|
LEFT JOIN
|
|
LEFT JOIN
|
|
|
psi_management_warehouse_detailed b on a.id = b.basic_id and b.del_flag = 0
|
|
psi_management_warehouse_detailed b on a.id = b.basic_id and b.del_flag = 0
|
|
|
|
|
+ LEFT JOIN psi_management_type t ON b.ware_house_type = t.id
|
|
|
|
|
|
|
|
left join sys_user sy on sy.id = a.handled_by
|
|
left join sys_user sy on sy.id = a.handled_by
|
|
|
left join sys_office so on sy.office_id = so.id
|
|
left join sys_office so on sy.office_id = so.id
|
|
@@ -451,7 +454,8 @@
|
|
|
so.name as collectHandleByOff,
|
|
so.name as collectHandleByOff,
|
|
|
a.collect_date,
|
|
a.collect_date,
|
|
|
b.collect_number,
|
|
b.collect_number,
|
|
|
- b.current_inventory,
|
|
|
|
|
|
|
+ b.current_inventory as currentInventory,
|
|
|
|
|
+ c.name AS goodsName,
|
|
|
pmwd.spec,
|
|
pmwd.spec,
|
|
|
pmcdr.not_surplus_stock as notSurplusStock,
|
|
pmcdr.not_surplus_stock as notSurplusStock,
|
|
|
b.collect_type as collectType
|
|
b.collect_type as collectType
|
|
@@ -461,6 +465,7 @@
|
|
|
psi_management_collect_detailed b on a.id = b.basic_id and b.del_flag = 0
|
|
psi_management_collect_detailed b on a.id = b.basic_id and b.del_flag = 0
|
|
|
LEFT JOIN psi_management_collect_detailed_record pmcdr ON b.id = pmcdr.detail_id
|
|
LEFT JOIN psi_management_collect_detailed_record pmcdr ON b.id = pmcdr.detail_id
|
|
|
LEFT JOIN psi_management_warehouse_detailed pmwd ON pmcdr.inventory_id = pmwd.id
|
|
LEFT JOIN psi_management_warehouse_detailed pmwd ON pmcdr.inventory_id = pmwd.id
|
|
|
|
|
+ LEFT JOIN psi_management_type c ON b.collect_type = c.id
|
|
|
left join sys_user sy on sy.id = a.handled_by
|
|
left join sys_user sy on sy.id = a.handled_by
|
|
|
left join sys_office so on sy.office_id = so.id
|
|
left join sys_office so on sy.office_id = so.id
|
|
|
|
|
|
|
@@ -605,13 +610,12 @@
|
|
|
left join
|
|
left join
|
|
|
(select sum(collect_number) as collect_number,collect_type 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
|
|
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}
|
|
|
|
|
|
|
+ WHERE f.`status` = 5 and e.del_flag = 0 and e.create_time <= #{createDate} and e.collect_type = #{wareHouseType}
|
|
|
GROUP BY e.collect_type) b
|
|
GROUP BY e.collect_type) b
|
|
|
on a.ware_house_type = b.collect_type
|
|
on a.ware_house_type = b.collect_type
|
|
|
|
|
|
|
|
WHERE a.ware_house_type = #{wareHouseType}
|
|
WHERE a.ware_house_type = #{wareHouseType}
|
|
|
and a.del_flag = 0
|
|
and a.del_flag = 0
|
|
|
- and a.trade_name = #{tradeName}
|
|
|
|
|
and a.create_time <= #{createDate}
|
|
and a.create_time <= #{createDate}
|
|
|
GROUP BY a.ware_house_type
|
|
GROUP BY a.ware_house_type
|
|
|
ORDER BY a.ware_house_type DESC
|
|
ORDER BY a.ware_house_type DESC
|