LEFT JOIN ScheduleList SL on S.site=SL.site and S.OrderNo=SL.orderNo and S.ItemNo=SL.ItemNo
LEFT JOIN SORoutingOutput SOP ON a.site=SOP.site and a.OrderNo=SOP.OrderNo and SOP.itemNo=dbo.Get_SORouting_PreviousOperationItemNo(a.site,a.OrderNo,S.itemNo)
<where>
a.E_Levels in (0,2)
a.E_Levels =0
<iftest="site != null and site != ''">
AND a.site = #{site}
</if>
<iftest="orderNo != null and orderNo != ''">
AND a.OrderNo LIKE #{orderNo}
</if>
<iftest="status !=null and status != ''">
AND a.Status IN ${status}
</if>
<!-- <if test="status !=null and status != ''">-->