|
|
|
@ -978,41 +978,60 @@
|
|
|
|
|
ORDER BY VIP.WORK_ORDER, VIP.ITEM
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="findCallItemInfoList" resultMap="FullResultMap">
|
|
|
|
|
SELECT CI.HANDLE ,CI.RESRCE ,CF.VALUE SHOP_ORDER ,CI.REQUIRED_QTY , CI.STATUS,
|
|
|
|
|
B.BOM AS ITEM, B.DESCRIPTION ITEM_DESCRIPTION ,
|
|
|
|
|
SD.WORK_CENTER , WCT.DESCRIPTION AS WORK_CENTER_DESCRIPTION, SD.BLANKING_SIZE, SD.REMARK, SD.PLANNED_START_DATE,
|
|
|
|
|
I.ITEM AS COMPONENT ,IT.DESCRIPTION AS COMPONENT_DESCRIPTION
|
|
|
|
|
FROM Z_CALL_ITEM CI
|
|
|
|
|
LEFT JOIN SHOP_ORDER SO ON CI.SHOP_ORDER = SO.SHOP_ORDER
|
|
|
|
|
<select id="findCallItemListPda" resultMap="FullResultMap">
|
|
|
|
|
SELECT MML.*,ZSD.PLANNED_START_DATE FROM
|
|
|
|
|
(
|
|
|
|
|
SELECT ZCI.SITE, CF.VALUE WORK_ORDER, WC.WORK_CENTER, WCT.DESCRIPTION WORK_CENTER_DESCRIPTION,
|
|
|
|
|
ZCI.SHOP_ORDER ,
|
|
|
|
|
IM.ITEM, IT.DESCRIPTION ITEM_DESCRIPTION,
|
|
|
|
|
CP.ITEM COMPONENT, ITT.DESCRIPTION COMPONENT_DESCRIPTION,
|
|
|
|
|
ZSD.BLANKING_SIZE,
|
|
|
|
|
ZCI.RESRCE, ZCI.CALL_TYPE,
|
|
|
|
|
/*MIN(SO.PLANNED_START_DATE) ,*/
|
|
|
|
|
SUM(ZCI.REQUIRED_QTY) REQUIRED_QTY
|
|
|
|
|
FROM Z_CALL_ITEM ZCI
|
|
|
|
|
INNER JOIN Z_SFC_DISPATCH ZSD ON ZSD.HANDLE = ZCI.SFC_DISPATCH_BO
|
|
|
|
|
INNER JOIN SHOP_ORDER SO ON SO.SITE = ZCI.SITE AND SO.SHOP_ORDER = ZCI.SHOP_ORDER
|
|
|
|
|
LEFT JOIN CUSTOM_FIELDS CF ON CF.HANDLE = SO.HANDLE AND CF."ATTRIBUTE" = 'WORK_ORDER'
|
|
|
|
|
INNER JOIN BOM_COMPONENT BC ON CI.COMPONENT_BO = BC.COMPONENT_GBO
|
|
|
|
|
LEFT JOIN BOM B ON BC.BOM_BO = B.HANDLE
|
|
|
|
|
INNER JOIN Z_SFC_DISPATCH SD ON CI.SFC_DISPATCH_BO = SD.HANDLE
|
|
|
|
|
LEFT JOIN WORK_CENTER WC ON WC.WORK_CENTER = SD.WORK_CENTER
|
|
|
|
|
LEFT JOIN WORK_CENTER_T WCT ON WC.HANDLE = WCT.WORK_CENTER_BO
|
|
|
|
|
LEFT JOIN ITEM I ON CI.COMPONENT_BO = I.HANDLE
|
|
|
|
|
LEFT JOIN ITEM_T IT ON I.HANDLE = IT.ITEM_BO
|
|
|
|
|
WHERE CI.SITE = #{site} AND WCT.LOCALE = 'zh'
|
|
|
|
|
<if test="workCenter != null and workCenter != ''">
|
|
|
|
|
AND SD.WORK_CENTER = #{workCenter}
|
|
|
|
|
INNER JOIN WORK_CENTER WC ON WC.HANDLE = SO.PLANNED_WORK_CENTER_BO
|
|
|
|
|
INNER JOIN WORK_CENTER_T WCT ON WCT.WORK_CENTER_BO = WC.HANDLE
|
|
|
|
|
INNER JOIN ITEM IM ON IM.HANDLE = SO.ITEM_BO
|
|
|
|
|
INNER JOIN ITEM_T IT ON IT.ITEM_BO = IM.HANDLE AND IT.LOCALE = #{local}
|
|
|
|
|
INNER JOIN ITEM CP ON CP.HANDLE = ZCI.COMPONENT_BO
|
|
|
|
|
INNER JOIN ITEM_T ITT ON ITT.ITEM_BO = CP.HANDLE AND ITT.LOCALE = #{local}
|
|
|
|
|
WHERE ZCI.SITE = #{site}
|
|
|
|
|
GROUP BY ZCI.SITE, CF.VALUE, WC.WORK_CENTER, IM.ITEM, ZSD.BLANKING_SIZE, CP.ITEM, ZCI.RESRCE, ZCI.CALL_TYPE,ZCI.SHOP_ORDER ,
|
|
|
|
|
WCT.DESCRIPTION ,IT.DESCRIPTION , ITT.DESCRIPTION
|
|
|
|
|
ORDER BY CF.VALUE ,ZCI.RESRCE, IM.ITEM ) MML
|
|
|
|
|
INNER JOIN
|
|
|
|
|
( SELECT ZSD.BLANKING_SIZE ,ZSD.RESRCE ,ZSD.WORK_CENTER ,ZSD.SHOP_ORDER ,
|
|
|
|
|
MIN(ZSD.PLANNED_START_DATE) PLANNED_START_DATE
|
|
|
|
|
FROM WIP.Z_SFC_DISPATCH ZSD
|
|
|
|
|
WHERE ZSD.SITE = #{site}
|
|
|
|
|
<if test="user != null and user != ''">AND ZSD.EMPLOYEE LIKE #{user}</if>
|
|
|
|
|
GROUP BY ZSD.WORK_CENTER ,ZSD.BLANKING_SIZE ,ZSD.SHOP_ORDER ,ZSD.RESRCE
|
|
|
|
|
) ZSD
|
|
|
|
|
ON ZSD.SHOP_ORDER = MML.SHOP_ORDER AND ZSD.BLANKING_SIZE = MML.BLANKING_SIZE
|
|
|
|
|
AND ZSD.RESRCE = MML.RESRCE AND ZSD.WORK_CENTER = MML.WORK_CENTER
|
|
|
|
|
<if test="callItem.workCenter != null and callItem.workCenter != ''">
|
|
|
|
|
AND MML.WORK_CENTER = #{callItem.workCenter}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="resrce != null and resrce != ''">
|
|
|
|
|
AND CI.RESRCE = #{resrce}
|
|
|
|
|
<if test="callItem.resrce != null and callItem.resrce != ''">
|
|
|
|
|
AND MML.RESRCE = #{callItem.resrce}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="component != null and component != ''">
|
|
|
|
|
AND I.ITEM = #{component}
|
|
|
|
|
<if test="callItem.component != null and callItem.component != ''">
|
|
|
|
|
AND MML.COMPONENT = #{callItem.component}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="status != null and status != ''">
|
|
|
|
|
AND CI.STATUS = #{status}
|
|
|
|
|
<if test="callItem.status != null and callItem.status != ''">
|
|
|
|
|
AND MML.STATUS = #{callItem.status}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startFromDate != null">
|
|
|
|
|
AND SD.PLANNED_START_DATE >= #{startFromDate}
|
|
|
|
|
<if test="callItem.startFromDate != null">
|
|
|
|
|
AND ZSD.PLANNED_START_DATE >= #{callItem.startFromDate}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startToDate != null">
|
|
|
|
|
AND SD.PLANNED_START_DATE <= #{startToDate}
|
|
|
|
|
<if test="callItem.startToDate != null">
|
|
|
|
|
AND ZSD.PLANNED_START_DATE <= #{callItem.startToDate}
|
|
|
|
|
</if>
|
|
|
|
|
ORDER BY CF.VALUE ,CI.RESRCE, I.ITEM
|
|
|
|
|
ORDER BY MML.SHOP_ORDER,MML.WORK_CENTER,MML.ITEM,MML.COMPONENT,MML.BLANKING_SIZE,ZSD.PLANNED_START_DATE
|
|
|
|
|
</select>
|
|
|
|
|
<select id="findRefreshCallItemPda" resultMap="FullResultMap">
|
|
|
|
|
SELECT CI.HANDLE ,CI.SFC ,CI.COMPONENT_BO ,BC.QTY REQUIRED_QTY, CF.VALUE STEP_ID
|
|
|
|
|