|
|
|
|
@ -609,11 +609,34 @@ |
|
|
|
|
-- 原有:左连接锁料表,保留工单关联(必须加,否则查错锁料量) |
|
|
|
|
LEFT JOIN ST_REALTIME_STOCK_LOCK l ON s.id = l.rls_id |
|
|
|
|
-- 调整:goods_code从关联的STGOODS表匹配,而非库存表 |
|
|
|
|
WHERE s.print_mark = #{isPrint} |
|
|
|
|
AND s.powder_weight = #{powderWeight} |
|
|
|
|
AND s.material_no = #{materialNo} |
|
|
|
|
AND s.thickness = #{thickness} |
|
|
|
|
AND g.goods_code = #{goodsCode} |
|
|
|
|
WHERE g.goods_code = #{goodsCode} |
|
|
|
|
<if test="materialNo == null"> |
|
|
|
|
AND s.material_no IS NULL |
|
|
|
|
</if> |
|
|
|
|
<if test="materialNo != null"> |
|
|
|
|
AND s.material_no = #{materialNo} |
|
|
|
|
</if> |
|
|
|
|
|
|
|
|
|
<if test="powderWeight == null"> |
|
|
|
|
AND s.powder_weight IS NULL |
|
|
|
|
</if> |
|
|
|
|
<if test="powderWeight != null"> |
|
|
|
|
AND s.powder_weight = #{powderWeight} |
|
|
|
|
</if> |
|
|
|
|
|
|
|
|
|
<if test="thickness == null"> |
|
|
|
|
AND s.thickness IS NULL |
|
|
|
|
</if> |
|
|
|
|
<if test="thickness != null"> |
|
|
|
|
AND s.thickness = #{thickness} |
|
|
|
|
</if> |
|
|
|
|
|
|
|
|
|
<if test="isPrint == null"> |
|
|
|
|
AND s.print_mark IS NULL |
|
|
|
|
</if> |
|
|
|
|
<if test="isPrint != null"> |
|
|
|
|
AND s.print_mark = #{isPrint} |
|
|
|
|
</if> |
|
|
|
|
-- 原有:按可用量(库存数量-已占用数量)倒序,空占用按0计算 |
|
|
|
|
ORDER BY (s.quantity - NVL(l.occupy_quantity, 0)) DESC |
|
|
|
|
) t |
|
|
|
|
@ -648,5 +671,25 @@ |
|
|
|
|
AND s.is_deleted = 0 |
|
|
|
|
AND g.is_deleted = 0 |
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
<!-- <select id="queryByShIdAndSlId" resultType="java.lang.Object">--> |
|
|
|
|
<!-- SELECT--> |
|
|
|
|
<!-- a.ID,--> |
|
|
|
|
<!-- b.GOODS_ID,--> |
|
|
|
|
<!-- b.GOODS_CODE,--> |
|
|
|
|
<!-- b.GOODS_NAME--> |
|
|
|
|
<!-- FROM ST_REALTIME_STOCK a--> |
|
|
|
|
<!-- INNER JOIN ST_GOODS b ON a.GOODS_ID = b.ID--> |
|
|
|
|
<!-- INNER JOIN ST_STORAGE_LOCATION c ON a.SL_ID = c.ID--> |
|
|
|
|
<!-- WHERE--> |
|
|
|
|
<!-- a.QUANTITY = #{quantity}--> |
|
|
|
|
<!-- AND b.GOODS_CODE = #{goodsCode}--> |
|
|
|
|
<!-- AND a.SH_ID = #{shId}--> |
|
|
|
|
<!-- AND a.SL_ID = #{slId}--> |
|
|
|
|
<!-- AND a.IS_DELETED = 0--> |
|
|
|
|
<!-- AND b.IS_DELETED = 0--> |
|
|
|
|
<!-- AND c.IS_DELETED = 0--> |
|
|
|
|
<!-- AND ROWNUM = 1--> |
|
|
|
|
<!-- </select>--> |
|
|
|
|
</mapper> |
|
|
|
|
|
|
|
|
|
|