|
|
@ -64,17 +64,12 @@
|
|
|
|
<select id="boxFoamingProductionInterface" resultType="java.util.HashMap" parameterType="java.util.HashMap">
|
|
|
|
<select id="boxFoamingProductionInterface" resultType="java.util.HashMap" parameterType="java.util.HashMap">
|
|
|
|
SELECT VBF.MAINID EQUIPMENT_CODE,
|
|
|
|
SELECT VBF.MAINID EQUIPMENT_CODE,
|
|
|
|
MAX(TP.FIXTUREBOXTYPE) FIXTUREBOXTYPE,
|
|
|
|
MAX(TP.FIXTUREBOXTYPE) FIXTUREBOXTYPE,
|
|
|
|
CASE WHEN MAX(VBF.FIXTURESTATUS) = 1 THEN '正常生产' ELSE '暂停生产' END FIXTURESTATUS,
|
|
|
|
CASE
|
|
|
|
|
|
|
|
WHEN MAX(TP.FIXTUREBOXTYPE) = '0' THEN '暂停生产'
|
|
|
|
|
|
|
|
WHEN MAX(TP.FIXTURESTATUS) IN (1, 2) THEN '正常生产'
|
|
|
|
|
|
|
|
ELSE '暂停生产' END FIXTURESTATUS,
|
|
|
|
TO_NUMBER(BCD.CUSTOM_DATA) TARGET,
|
|
|
|
TO_NUMBER(BCD.CUSTOM_DATA) TARGET,
|
|
|
|
(CASE
|
|
|
|
NVL(MAX(SD.PLAN_SUM), 0) PLAN_SUM,
|
|
|
|
WHEN '20:00' > TO_CHAR(SYSDATE, 'HH24:MI') AND TO_CHAR(SYSDATE, 'HH24:MI') >= '08:00'
|
|
|
|
|
|
|
|
THEN round(TO_NUMBER(BCD.CUSTOM_DATA) / 12, 0) * (TO_CHAR(SYSDATE, 'HH24') - 7)
|
|
|
|
|
|
|
|
WHEN TO_CHAR(SYSDATE, 'HH24:MI') >= '20:00'
|
|
|
|
|
|
|
|
THEN round(TO_NUMBER(BCD.CUSTOM_DATA) / 12, 0) * (TO_CHAR(SYSDATE, 'HH24') - 19)
|
|
|
|
|
|
|
|
WHEN '08:00' > TO_CHAR(SYSDATE, 'HH24:MI')
|
|
|
|
|
|
|
|
THEN round(TO_NUMBER(BCD.CUSTOM_DATA) / 12, 0) * (TO_CHAR(SYSDATE, 'HH24') + 5)
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
) PLAN_SUM,
|
|
|
|
|
|
|
|
SUM(VBF.ANHOUR + VBF.TWOHOUR + VBF.THREEHOUR + VBF.FOURHOUR + VBF.FIVEHOUR + VBF.SIXHOUR +
|
|
|
|
SUM(VBF.ANHOUR + VBF.TWOHOUR + VBF.THREEHOUR + VBF.FOURHOUR + VBF.FIVEHOUR + VBF.SIXHOUR +
|
|
|
|
VBF.SEVENHOUR +
|
|
|
|
VBF.SEVENHOUR +
|
|
|
|
VBF.EIGHTHOUR +
|
|
|
|
VBF.EIGHTHOUR +
|
|
|
@ -96,16 +91,37 @@
|
|
|
|
FROM VIEW_BOX_FOAMDATA VBF
|
|
|
|
FROM VIEW_BOX_FOAMDATA VBF
|
|
|
|
LEFT JOIN VIEW_BOX_DEVICEINFO BD ON BD.OBJ_ID = VBF.MAINID
|
|
|
|
LEFT JOIN VIEW_BOX_DEVICEINFO BD ON BD.OBJ_ID = VBF.MAINID
|
|
|
|
LEFT JOIN BASE_CUSTOM_DATA BCD ON BCD.CUSTOM_CODE = 'XTFP_TARGET_' || #{PRODUCT_LINE_CODE}
|
|
|
|
LEFT JOIN BASE_CUSTOM_DATA BCD ON BCD.CUSTOM_CODE = 'XTFP_TARGET_' || #{PRODUCT_LINE_CODE}
|
|
|
|
LEFT JOIN (SELECT BF.MAINID, BF.FIXTUREBOXTYPE FIXTUREBOXTYPE
|
|
|
|
LEFT JOIN (SELECT BF.MAINID, BF.FIXTUREBOXTYPE FIXTUREBOXTYPE, BF.FIXTURESTATUS
|
|
|
|
FROM VIEW_BOX_FOAMDATA BF
|
|
|
|
FROM VIEW_BOX_FOAMDATA BF
|
|
|
|
JOIN
|
|
|
|
JOIN
|
|
|
|
(
|
|
|
|
(
|
|
|
|
SELECT MAINID, MAX(UPDATETIME) UPDATETIME
|
|
|
|
SELECT MAINID
|
|
|
|
|
|
|
|
, MAX(UPDATETIME) UPDATETIME
|
|
|
|
FROM VIEW_BOX_FOAMDATA
|
|
|
|
FROM VIEW_BOX_FOAMDATA
|
|
|
|
WHERE PRODUCT_LINE_CODE = #{PRODUCT_LINE_CODE}
|
|
|
|
WHERE PRODUCT_LINE_CODE = #{PRODUCT_LINE_CODE}
|
|
|
|
GROUP BY MAINID
|
|
|
|
GROUP BY MAINID
|
|
|
|
) SV ON SV.MAINID = BF.MAINID AND SV.UPDATETIME = BF.UPDATETIME) TP
|
|
|
|
) SV ON SV.MAINID = BF.MAINID AND SV.UPDATETIME = BF.UPDATETIME) TP
|
|
|
|
ON TP.MAINID = VBF.MAINID
|
|
|
|
ON TP.MAINID = VBF.MAINID
|
|
|
|
|
|
|
|
LEFT JOIN (SELECT B2.FIXTUREBOXTYPE,
|
|
|
|
|
|
|
|
COUNT(*) TYPE_SUM,
|
|
|
|
|
|
|
|
MAX(PLAN_AMOUNT) PLAN_AMOUNT,
|
|
|
|
|
|
|
|
ROUND(MAX(PLAN_AMOUNT) / COUNT(*), 0) PLAN_SUM
|
|
|
|
|
|
|
|
FROM (
|
|
|
|
|
|
|
|
SELECT MAINID, MAX(UPDATETIME) UPDATETIME
|
|
|
|
|
|
|
|
FROM VIEW_BOX_FOAMDATA
|
|
|
|
|
|
|
|
WHERE PRODUCT_LINE_CODE = #{PRODUCT_LINE_CODE}
|
|
|
|
|
|
|
|
GROUP BY MAINID
|
|
|
|
|
|
|
|
) BF
|
|
|
|
|
|
|
|
JOIN VIEW_BOX_FOAMDATA B2 ON B2.MAINID = BF.MAINID AND B2.UPDATETIME = BF.UPDATETIME
|
|
|
|
|
|
|
|
JOIN (SELECT get_short_material_type(BOX_MATERIALNAME) BOX_MATERIALNAME,
|
|
|
|
|
|
|
|
SUM(PLAN_AMOUNT) PLAN_AMOUNT
|
|
|
|
|
|
|
|
FROM VIEW_BOX_FOAMPLAN
|
|
|
|
|
|
|
|
WHERE PRODUCT_LINE_CODE = #{PRODUCT_LINE_CODE}
|
|
|
|
|
|
|
|
AND SHIFTTYPE = 1
|
|
|
|
|
|
|
|
GROUP BY get_short_material_type(BOX_MATERIALNAME)) F2
|
|
|
|
|
|
|
|
ON F2.BOX_MATERIALNAME LIKE B2.FIXTUREBOXTYPE || '%'
|
|
|
|
|
|
|
|
WHERE B2.FIXTUREBOXTYPE != 0
|
|
|
|
|
|
|
|
GROUP BY B2.FIXTUREBOXTYPE) SD ON TP.FIXTUREBOXTYPE = SD.FIXTUREBOXTYPE
|
|
|
|
WHERE VBF.PRODUCT_LINE_CODE = #{PRODUCT_LINE_CODE}
|
|
|
|
WHERE VBF.PRODUCT_LINE_CODE = #{PRODUCT_LINE_CODE}
|
|
|
|
GROUP BY VBF.MAINID, TO_NUMBER(BCD.CUSTOM_DATA)
|
|
|
|
GROUP BY VBF.MAINID, TO_NUMBER(BCD.CUSTOM_DATA)
|
|
|
|
ORDER BY VBF.MAINID
|
|
|
|
ORDER BY VBF.MAINID
|
|
|
|