wpi.erp_status, wpi.erp_amount,mbmi.material_code,mbmi.material_name,mbmi.material_spec from wms_product_instock wpi left join mes_base_material_info mbmi on wpi.product_id=mbmi.material_id
<where>
<iftest="taskCode != null and taskCode != ''"> and wpi.task_code = #{taskCode}</if>
<iftest="warehouseId != null "> and wpi.warehouse_id = #{warehouseId}</if>
<iftest="locationCode != null and locationCode != ''"> and wpi.location_code like concat('%', #{locationCode}, '%')</if>
<iftest="saleorderCode != null and saleorderCode != ''"> and wpi.saleorder_code like concat('%', #{saleorderCode}, '%')</if>
<iftest="productType != null and productType != ''"> and wpi.product_type = #{productType}</if>
<iftest="operationType != null and operationType != ''"> and wpi.operation_type = #{operationType}</if>
<iftest="erpStatus != null and erpStatus != ''"> and wpi.erp_status = #{erpStatus}</if>
<iftest="productBatch != null and productBatch != ''"> and wpi.product_batch like concat('%', #{productBatch}, '%')</if>
<iftest="planCode != null "> and wpi.plan_code like concat('%', #{planCode}, '%')</if>
<iftest="planDetailCode != null "> and wpi.plan_detail_code like concat('%', #{planDetailCode}, '%')</if>
<iftest="instockType != null and instockType != ''"> and wpi.instock_type = #{instockType}</if>
<iftest="executeStatus != null and executeStatus != ''"> and wpi.execute_status = #{executeStatus}</if>
<iftest="applyBy != null and applyBy != ''"> and wpi.apply_by = #{applyBy}</if>
<iftest="applyDate != null "> and wpi.apply_date = #{applyDate}</if>
<iftest="materialCode != null and materialCode != ''"> and mbmi.material_code like concat('%', #{materialCode}, '%')</if>
<iftest="materialName != null and materialName != ''"> and mbmi.material_name like concat('%', #{materialName}, '%')</if>
<iftest="materialSpec != null and materialSpec != ''">and replace(mbmi.material_spec,' ','') like concat('%', #{materialSpec},
from wms_product_outstock wpo left join wms_base_warehouse wbw on wpo.warehouse_id =wbw.warehouse_id
from wms_product_outstock wpo left join wms_base_warehouse wbw on wpo.warehouse_id =wbw.warehouse_id
left join mes_base_material_info mbmi on wpo.product_id = mbmi.material_id
left join mes_base_material_info mbmi on wpo.product_id = mbmi.material_id
<where>
<where>
@ -259,11 +261,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<iftest="productType != null and productType != ''"> and wpo.product_type = #{productType}</if>
<iftest="productType != null and productType != ''"> and wpo.product_type = #{productType}</if>
<iftest="operationType != null and operationType != ''"> and wpo.operation_type = #{operationType}</if>
<iftest="operationType != null and operationType != ''"> and wpo.operation_type = #{operationType}</if>
<iftest="outstockType != null and outstockType != ''"> and wpo.outstock_type = #{outstockType}</if>
<iftest="outstockType != null and outstockType != ''"> and wpo.outstock_type = #{outstockType}</if>
<iftest="planCode != null "> and wpo.plan_code = #{planCode}</if>
<iftest="planCode != null and planCode != ''"> and wpo.plan_code like concat('%', #{planCode}, '%')</if>
<iftest="planDetailCode != null "> and wpo.plan_detail_code = #{planDetailCode}</if>
<iftest="planDetailCode != null and planDetailCode != ''"> and wpo.plan_detail_code like concat('%', #{planDetailCode}, '%')</if>
<iftest="applyReason != null and applyReason != ''"> and wpo.apply_reason = #{applyReason}</if>
<iftest="saleorderCode != null and saleorderCode != ''"> and wpo.saleorder_code like concat('%', #{saleorderCode}, '%')</if>
<iftest="auditReason != null and auditReason != ''"> and wpo.audit_reason = #{auditReason}</if>
<iftest="auditStatus != null and auditStatus != ''"> and wpo.audit_status = #{auditStatus}</if>
<iftest="auditStatus != null and auditStatus != ''"> and wpo.audit_status = #{auditStatus}</if>
<iftest="erpStatus != null and erpStatus != ''"> and wpo.erp_status = #{erpStatus}</if>
<iftest="executeStatus != null and executeStatus != '' and executeStatus != 'notFinish'"> and wpo.execute_status = #{executeStatus}</if>
<iftest="executeStatus != null and executeStatus != '' and executeStatus != 'notFinish'"> and wpo.execute_status = #{executeStatus}</if>
<iftest="executeStatus != null and executeStatus != '' and executeStatus == 'notFinish'"> and (wpo.execute_status = '0' or wpo.execute_status = '1')</if>
<iftest="executeStatus != null and executeStatus != '' and executeStatus == 'notFinish'"> and (wpo.execute_status = '0' or wpo.execute_status = '1')</if>
<iftest="applyBy != null and applyBy != ''"> and wpo.apply_by = #{applyBy}</if>
<iftest="applyBy != null and applyBy != ''"> and wpo.apply_by = #{applyBy}</if>
@ -273,7 +275,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<iftest="updateDate != null "> and wpo.update_date = #{updateDate}</if>
<iftest="updateDate != null "> and wpo.update_date = #{updateDate}</if>
<iftest="beginTime != null "> and wpo.begin_time = #{beginTime}</if>
<iftest="beginTime != null "> and wpo.begin_time = #{beginTime}</if>
<iftest="endTime != null "> and wpo.end_time = #{endTime}</if>
<iftest="endTime != null "> and wpo.end_time = #{endTime}</if>
<iftest="materialCode != null and materialCode != ''"> and mbmi.material_code like concat('%', #{materialCode}, '%')</if>
<iftest="materialName != null and materialName != ''"> and mbmi.material_name like concat('%', #{materialName}, '%')</if>
<iftest="materialSpec != null and materialSpec != ''">and replace(mbmi.material_spec,' ','') like concat('%', #{materialSpec},
<iftest="saleOrderId != null ">and (wst.sale_order_id = #{saleOrderId} or wst.safe_flag='1')</if>
<iftest="saleOrderId != null and virtualFlag==null and virtualFlag==''">and (wst.sale_order_id = #{saleOrderId} or wst.safe_flag='1')</if>
<iftest="saleOrderId != null and virtualFlag!=null and virtualFlag!=''">and (exists (select 1 from mes_sale_order_relate msor where wst.sale_order_id=msor.relate_sale_order_id and msor.sale_order_id=#{saleOrderId}) or wst.safe_flag='1')</if>