|
@@ -154,7 +154,7 @@
|
|
|
select sum(shelvesCount) as shelvesCount,sum(storgeCount) as storgeCount,sum(instockCount) as instockCount,
|
|
|
(sum(storgeCount)-sum(instockCount)) as freestockCount,sum(lockstockCount) as lockstockCount from (
|
|
|
-- 货架
|
|
|
- select count(1) as shelvesCount,0 as storgeCount,0 as instockCount,0 as lockstockCount from (select s.name, z.org_id from imcs_s_shelves s left join imcs_z_zone z on locate(z.abbreviate, s.name) where s.type= '1' and s.status= '1'
|
|
|
+ select count(1) as shelvesCount,0 as storgeCount,0 as instockCount,0 as lockstockCount from (select s.name, z.org_id from imcs_s_shelves s left join imcs_z_zone z on locate(z.abbreviate, left(s.name, 5) ) where s.type= '1' and s.status= '1'
|
|
|
<if test="orgIds != null and orgIds != ''">
|
|
|
and z.org_id in (${orgIds})
|
|
|
</if>
|
|
@@ -162,21 +162,21 @@
|
|
|
union all
|
|
|
-- 库位
|
|
|
select 0 as shelvesCount,count(1) as storgeCount,0 as instockCount,0 as lockstockCount from imcs_s_storge s LEFT JOIN ( SELECT h.id, h.parent_id, h.name as bname, h1.name as aname, h1.status as storgeStatus FROM imcs_s_shelves h LEFT JOIN imcs_s_shelves h1 ON h.parent_id = h1.id
|
|
|
- ) b ON s.shelves_id = b.id LEFT JOIN imcs_z_zone z ON Locate(z.abbreviate, b.aname) where b.storgeStatus = 1
|
|
|
+ ) b ON s.shelves_id = b.id LEFT JOIN imcs_z_zone z ON Locate(z.abbreviate, left(b.aname,5)) where b.storgeStatus = 1
|
|
|
<if test="orgIds != null and orgIds != ''">
|
|
|
and z.org_id in (${orgIds})
|
|
|
</if>
|
|
|
union all
|
|
|
-- 已存库位
|
|
|
select 0 as shelvesCount,0 as storgeCount,count(1) as instockCount,0 as lockstockCount from imcs_s_storge s LEFT JOIN ( SELECT h.id, h.parent_id, h.name as bname, h1.name as aname, h1.status as instockStatus FROM imcs_s_shelves h LEFT JOIN imcs_s_shelves h1 ON h.parent_id = h1.id
|
|
|
- ) b ON s.shelves_id = b.id LEFT JOIN imcs_z_zone z ON Locate(z.abbreviate, b.aname) where s.id in (select storge_id from imcs_s_stock_info) and b.instockStatus = 1
|
|
|
+ ) b ON s.shelves_id = b.id LEFT JOIN imcs_z_zone z ON Locate(z.abbreviate, left(b.aname,5)) where s.id in (select storge_id from imcs_s_stock_info) and b.instockStatus = 1
|
|
|
<if test="orgIds != null and orgIds != ''">
|
|
|
and z.org_id in (${orgIds})
|
|
|
</if>
|
|
|
union all
|
|
|
-- 锁定库位
|
|
|
select 0 as shelvesCount,0 as storgeCount,0 as instockCount,count(1) as lockstockCount from imcs_s_storge s LEFT JOIN ( SELECT h.id, h.parent_id, h.name as bname, h1.name as aname, h1.status as lockStaus FROM imcs_s_shelves h LEFT JOIN imcs_s_shelves h1 ON h.parent_id = h1.id
|
|
|
- ) b ON s.shelves_id = b.id LEFT JOIN imcs_z_zone z ON Locate(z.abbreviate, b.aname) where s.lock_status = '0' and b.lockStaus
|
|
|
+ ) b ON s.shelves_id = b.id LEFT JOIN imcs_z_zone z ON Locate(z.abbreviate, left(b.aname,5)) where s.lock_status = '0' and b.lockStaus
|
|
|
<if test="orgIds != null and orgIds != ''">
|
|
|
and z.org_id in (${orgIds})
|
|
|
</if>
|