|
|
|
@ -210,11 +210,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
left join wms_base_warehouse wbw on wbw.warehouse_id = wri.warehouse_id
|
|
|
|
|
left join mes_base_material_info mbmi on mbmi.material_id = wri.material_id
|
|
|
|
|
left join mes_base_unit_info mbui on mbui.erp_id = mbmi.material_unit_id
|
|
|
|
|
left join (select po_no, material_id, max(specification_parameter) specification_parameter
|
|
|
|
|
from mes_purchase_order
|
|
|
|
|
group by po_no, material_id) mpo on mpo.po_no = wri.po_no and mpo.material_id = wri.material_id
|
|
|
|
|
join (select po_no, material_id, max(specification_parameter) specification_parameter
|
|
|
|
|
from mes_purchase_order
|
|
|
|
|
group by po_no, material_id) mpo on mpo.po_no = wri.po_no and mpo.material_id = wri.material_id
|
|
|
|
|
where wri.execute_status = 2
|
|
|
|
|
and wri.erp_status != 1
|
|
|
|
|
and (wri.erp_status != 1 or wri.erp_status is null)
|
|
|
|
|
and wri.instock_type in (1, 3)
|
|
|
|
|
and wri.instock_amount > if(wri.erp_amount is null, 0, wri.erp_amount)
|
|
|
|
|
</select>
|
|
|
|
|