@ -254,26 +254,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mbmi.material_code,
mbmi.material_name,
mbmi.material_spec,
mbmi.always_flag,
mpo.aux_prop_id,
mpo.specification_parameter,
mpo.order_amount,
(select ifnull(sum(mob.bind_amount), 0)
from mes_order_bind mob
where mob.purchase_order_id = mpo.purchase_order_id
and mob.safe_flag = '0') bound_amount,
(select ifnull(sum(mob.bind_amount), 0)
from mes_order_bind mob
where mob.purchase_order_id = mpo.purchase_order_id
and sale_order_id = #{saleOrderId}
and mob.safe_flag = '0') sale_bind_amount,
(select ifnull(sum(mob.bind_amount), 0) from mes_order_bind mob
where mob.purchase_order_id = mpo.purchase_order_id and mob.safe_flag = '0') bound_amount, <!-- 此采购订单一共绑定的数量 -->
(select concat(ifnull(sum(bind_amount),0),'-',ifnull(sum(barcode_amount),0)) from mes_order_bind mob
where mob.purchase_order_id = mpo.purchase_order_id and sale_order_id = #{saleOrderId} and mob.safe_flag = '0') order_bind_barcode_amount,<!-- 此采购订单绑定当前销售订单的数量和生成条码的数量 -->
(select ifnull(sum(bind_amount), 0)
from mes_order_bind mob
where mob.purchase_order_id = mpo.purchase_order_id
and mob.safe_flag = '1') safe_amount,
(select ifnull(sum(mob.barcode_amount), 0)
from mes_order_bind mob
where mob.purchase_order_id = mpo.purchase_order_id
and mob.safe_flag = '1') barcode_amount
and mob.safe_flag = '1') safe_amount <!-- 此采购订单一共的安全库存数量 -->
from mes_purchase_order mpo
left join mes_base_material_info mbmi on mbmi.erp_id = mpo.material_id
<where>
@ -282,10 +277,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<iftest="materialName != null and materialName != ''"> and mbmi.material_name like concat('%', #{materialName}, '%')</if>
<iftest="specificationParameter != null and specificationParameter != ''"> and mpo.specification_parameter like concat('%', #{specificationParameter}, '%')</if>
<iftest="materialSpec != null and materialSpec != ''"> and mbmi.material_spec like concat('%', #{materialSpec}, '%')</if>
<iftest="alwaysFlag != null and alwaysFlag != ''"> and mbmi.always_flag = #{alwaysFlag}</if>
</where>
order by mpo.erp_modify_date desc,mpo.po_no ,mpo.material_name
(select ifnull(sum(mob.bind_amount), 0) from mes_order_bind mob
where mob.purchase_order_id = mpo.purchase_order_id and mob.safe_flag = '0') bound_amount, <!-- 此采购订单一共绑定的数量 -->
(select concat(ifnull(sum(bind_amount),0),'-',ifnull(sum(barcode_amount),0)) from mes_order_bind mob
where mob.purchase_order_id = mpo.purchase_order_id and sale_order_id = #{saleOrderId} and mob.safe_flag = '0') order_bind_barcode_amount,<!-- 此采购订单绑定当前销售订单的数量和生成条码的数量 -->
(select ifnull(sum(bind_amount), 0)
from mes_order_bind mob
where mob.purchase_order_id = mpo.purchase_order_id
and mob.safe_flag = '1') safe_amount <!-- 此采购订单一共的安全库存数量 -->
from mes_purchase_order mpo
left join mes_base_material_info mbmi on mbmi.erp_id = mpo.material_id