change - 产品追溯报表样品机、降级品筛选查询

master
yinq 7 months ago
parent 57dfb7e91d
commit 504f0284a5

@ -334,6 +334,10 @@
FROM C##AUCMA_SCADA.PRODUCT_OFFLINE PO FROM C##AUCMA_SCADA.PRODUCT_OFFLINE PO
LEFT JOIN BASE_ORDERINFO BO ON BO.ORDER_CODE = SUBSTR(PO.PRODUCT_ORDER_NO, -8) LEFT JOIN BASE_ORDERINFO BO ON BO.ORDER_CODE = SUBSTR(PO.PRODUCT_ORDER_NO, -8)
LEFT JOIN BASE_PRODUCTLINE PL ON PL.WORK_CENTER_CODE = BO.WORK_CENTER_CODE LEFT JOIN BASE_PRODUCTLINE PL ON PL.WORK_CENTER_CODE = BO.WORK_CENTER_CODE
LEFT JOIN (SELECT BAR_CODE
FROM REPORT_QUALITY_INSPECTION
WHERE PROCESS_RESULT = 'KA'
GROUP BY BAR_CODE) KA ON KA.BAR_CODE = PO.BOX_CODE
<where> <where>
<if test="PRODUCT_LINE_CODE != null and PRODUCT_LINE_CODE != ''">and PO.PRODUCT_LINE_CODE = <if test="PRODUCT_LINE_CODE != null and PRODUCT_LINE_CODE != ''">and PO.PRODUCT_LINE_CODE =
#{PRODUCT_LINE_CODE} #{PRODUCT_LINE_CODE}
@ -350,6 +354,18 @@
<if test="beginBeginTime != null and beginBeginTime != '' and endBeginTime != null and endBeginTime != ''"> <if test="beginBeginTime != null and beginBeginTime != '' and endBeginTime != null and endBeginTime != ''">
AND TO_CHAR(PO.PRODUCT_SCANTIME, 'YYYY-MM-DD HH24:MI:SS') BETWEEN #{beginBeginTime} AND #{endBeginTime} AND TO_CHAR(PO.PRODUCT_SCANTIME, 'YYYY-MM-DD HH24:MI:SS') BETWEEN #{beginBeginTime} AND #{endBeginTime}
</if> </if>
<if test="isSample != null and isSample == 1 ">
AND SUBSTR(PO.PRODUCT_SNCODE, -4, 1) = 'A'
</if>
<if test="isSample != null and isSample == 2 ">
AND SUBSTR(PO.PRODUCT_SNCODE, -4, 1) != 'A'
</if>
<if test="isDowngrade != null and isDowngrade == 1 ">
AND KA.BAR_CODE IS NOT NULL
</if>
<if test="isDowngrade != null and isDowngrade == 2 ">
AND KA.BAR_CODE IS NULL
</if>
</where> </where>
</select> </select>

Loading…
Cancel
Save