m.is_del,m.is_activity,m.branch_id,m.update_by,m.create_by,m.update_time,m.create_time,bar_code as mold_barcode
m.mold_no,
,c.container_name
m.mold_name,
from base_mold m
m.type,
inner join sys_stock_detail s on m.id=s.mold_id
m.model,
left join base_container c on c.id =s.container_id
m.length,
where
m.width,
m.is_activity = 1
m.height,
and m.is_del = 0
m.volume,
m.service_interval,
m.service_life,
m.is_del,
m.is_activity,
m.branch_id,
m.update_by,
m.create_by,
m.update_time,
m.create_time,
bar_code AS mold_barcode,
c.container_name
FROM
base_mold m
INNER JOIN sys_stock_detail s ON m.id = s.mold_id AND s.qty - s.out_qty > 0
INNER JOIN base_container c on c.id =s.container_id
LEFT JOIN ( SELECT plan.mold_id FROM busin_out_in_plan plan WHERE plan_status NOT IN ( '2', '3' ) AND plan.type = 'out' ) AS planout ON planout.mold_id = m.id
WHERE
planout.mold_id IS NULL
AND m.is_activity = 1
AND m.is_del = 0
<iftest="moldBarcode != null and moldBarcode != ''">
<iftest="moldBarcode != null and moldBarcode != ''">
and m.bar_code like CONCAT('%', #{moldBarcode},'%')
and m.bar_code like CONCAT('%', #{moldBarcode},'%')
</if>
</if>
@ -120,11 +141,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and m.type =#{moldType}
and m.type =#{moldType}
</if>
</if>
and EXISTS (select 1 from sys_stock_detail s where s.barcode = m.bar_code and s.qty - s.out_qty > 0)
and not exists(select 1 from busin_out_in_plan p where type ='out' and plan_status not in('2','3') and p.mold_barcode=m.bar_code)