|
@@ -254,26 +254,59 @@
|
|
|
abo.REMARK AS 'blankRemark',
|
|
|
abo.ID AS 'blankId',
|
|
|
apop.ID AS 'processOutputId',
|
|
|
- apop.PRODUCTID AS 'outputOrderDetailId'
|
|
|
-
|
|
|
+ apop.PRODUCTID AS 'outputOrderDetailId',
|
|
|
+ CASE
|
|
|
+ WHEN IFNULL( detail.ID, '' )!= ''
|
|
|
+ AND IFNULL( detail.MERGEORDERNUMBER, '' )!= '' THEN
|
|
|
+ ( SELECT ORDERNO FROM aps_production_merge_order WHERE ORDERNO = detail.MERGEORDERNUMBER ) ELSE (
|
|
|
+ SELECT
|
|
|
+ apo.ORDERNO
|
|
|
+ FROM
|
|
|
+ aps_blank_order abo
|
|
|
+ LEFT JOIN aps_production_order apo ON apo.ID = abo.PRODUCTIONORDERID
|
|
|
+ WHERE
|
|
|
+ abo.ID = apop.BLANKID
|
|
|
+ )
|
|
|
+ END AS newOrderNo,
|
|
|
+ IF
|
|
|
+ (
|
|
|
+ IFNULL( detail.ID, '' )!= '',
|
|
|
+ detail.CUSTOMORDERNO,(
|
|
|
+ SELECT
|
|
|
+ apo.CUSTOMORDERNO
|
|
|
+ FROM
|
|
|
+ aps_blank_order abo
|
|
|
+ LEFT JOIN aps_production_order apo ON apo.ID = abo.PRODUCTIONORDERID
|
|
|
+ WHERE
|
|
|
+ abo.ID = apop.BLANKID
|
|
|
+ )
|
|
|
+ ) AS newCustomOrderNo,
|
|
|
+ CASE
|
|
|
+ WHEN IFNULL( detail.ID, '' )!= ''
|
|
|
+ AND IFNULL( detail.MERGEORDERNUMBER, '' )!= '' THEN
|
|
|
+ ( SELECT CUSTOMNAME FROM aps_production_merge_order WHERE ORDERNO = detail.MERGEORDERNUMBER ) ELSE (
|
|
|
+ SELECT
|
|
|
+ apo.CUSTOMNAME
|
|
|
+ FROM
|
|
|
+ aps_blank_order abo
|
|
|
+ LEFT JOIN aps_production_order apo ON apo.ID = abo.PRODUCTIONORDERID
|
|
|
+ WHERE
|
|
|
+ abo.ID = apop.BLANKID
|
|
|
+ )
|
|
|
+ END AS newCustomName
|
|
|
FROM
|
|
|
aps_production_order apo
|
|
|
LEFT JOIN aps_blank_order abo ON abo.DELETED = 0
|
|
|
AND apo.ID = abo.PRODUCTIONORDERID
|
|
|
LEFT JOIN aps_process_output_product apop ON apop.DELETED = 0
|
|
|
AND abo.ID = apop.BLANKID
|
|
|
- LEFT JOIN (select apo1.ID,apo1.BLANKID,apo1.PROCESSSTATUS,apoom.OUTPUTFINISHPRODUCT,apoom.PRODOUTROLL from aps_process_operation apo1 LEFT JOIN aps_process_operation_out_mater apoom ON apoom.DELETED = 0 AND apoom.OUTPUTFINISHPRODUCT != '' AND apoom.OUTPUTFINISHPRODUCT is not null AND apo1.ID = apoom.MAINID WHERE apo1.DELETED = 0 AND apoom.OUTPUTFINISHPRODUCT != '' AND apoom.OUTPUTFINISHPRODUCT is not null) b
|
|
|
+ LEFT JOIN aps_product_detail detail ON apop.PRODUCTID = detail.ID AND detail.DELETED = '0'
|
|
|
+ LEFT JOIN (select apo1.ID,apo1.BLANKID,apo1.PROCESSSTATUS,apoom.OUTPUTFINISHPRODUCT,apoom.PRODOUTROLL from aps_process_operation apo1 LEFT JOIN aps_process_operation_out_mater apoom ON apoom.DELETED = 0 AND apoom.OUTPUTFINISHPRODUCT != '' AND apoom.OUTPUTFINISHPRODUCT is not null AND apo1.ID = apoom.MAINID WHERE apo1.DELETED = 0 AND apoom.OUTPUTFINISHPRODUCT != '' AND apoom.OUTPUTFINISHPRODUCT is not null) b
|
|
|
ON b.OUTPUTFINISHPRODUCT = apop.OUTPUTRESULT AND b.BLANKID = apop.BLANKID
|
|
|
WHERE
|
|
|
apo.DELETED = 0
|
|
|
AND apop.ID is not null
|
|
|
AND abo.PRODUCTSTATUS > 20
|
|
|
- <if test="param.customName != ''">
|
|
|
- AND apo.CUSTOMNAME like concat('%',#{param.customName},'%')
|
|
|
- </if>
|
|
|
- <if test="param.customOrderNo != ''">
|
|
|
- AND apo.CUSTOMORDERNO like concat('%',#{param.customOrderNo},'%')
|
|
|
- </if>
|
|
|
<if test="param.startDate != '' and param.endDate != ''">
|
|
|
AND abo.PROMISEDATESTART >= #{param.startDate} AND abo.PROMISEDATESTART <= #{param.endDate}
|
|
|
</if>
|
|
@@ -283,24 +316,29 @@
|
|
|
<if test="param.tenantId != ''">
|
|
|
AND apo.TENANTID = #{param.tenantId}
|
|
|
</if>
|
|
|
- <if test="param.likeSearchAll != ''">
|
|
|
- AND (apo.CUSTOMNAME like concat('%',#{param.likeSearchAll},'%')
|
|
|
- OR apo.CUSTOMORDERNO like concat('%',#{param.likeSearchAll},'%')
|
|
|
- OR abo.BLANKNUMBER like concat('%',#{param.likeSearchAll},'%')
|
|
|
- )
|
|
|
- </if>
|
|
|
-
|
|
|
)a
|
|
|
<where>
|
|
|
<if test="param.productionOrderStatus != ''">
|
|
|
AND a.productionOrderStatus = #{param.productionOrderStatus}
|
|
|
</if>
|
|
|
+ <if test="param.customName != ''">
|
|
|
+ AND a.newCustomName like concat('%',#{param.customName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="param.customOrderNo != ''">
|
|
|
+ AND a.newCustomOrderNo like concat('%',#{param.customOrderNo},'%')
|
|
|
+ </if>
|
|
|
+ <if test="param.likeSearchAll != ''">
|
|
|
+ AND (a.newCustomName like concat('%',#{param.likeSearchAll},'%')
|
|
|
+ OR a.newCustomOrderNo like concat('%',#{param.likeSearchAll},'%')
|
|
|
+ OR a.blankNumber like concat('%',#{param.likeSearchAll},'%')
|
|
|
+ )
|
|
|
+ </if>
|
|
|
</where>
|
|
|
|
|
|
ORDER BY
|
|
|
<if test="param.orders != ''">
|
|
|
${param.orders}
|
|
|
</if>
|
|
|
- a.promiseDateStart, a.CUSTOMORDERNO, a.outPutResult
|
|
|
+ a.promiseDateStart, a.newCustomOrderNo, a.outPutResult
|
|
|
</select>
|
|
|
</mapper>
|