change - 质量报表

master
yinq 10 months ago
parent 0077e26cc6
commit 7c1544c131

@ -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

@ -48,16 +48,16 @@
<select id="qualityDefectsStatisticalAnalysisList" resultType="java.util.HashMap" parameterType="java.util.HashMap"> <select id="qualityDefectsStatisticalAnalysisList" resultType="java.util.HashMap" parameterType="java.util.HashMap">
SELECT FY.FACTORY_NAME, SELECT FY.FACTORY_NAME,
BPP.PRODUCT_LINE_NAME, BPP.PRODUCT_LINE_NAME,
BP.PRODUCT_LINE_CODE, BP.PRODUCT_LINE_CODE STATION_CODE,
BP.PRODUCT_LINE_NAME STATION_NAME, BP.PRODUCT_LINE_NAME STATION_NAME,
COUNT(*) INSPECTION_NUMBER, COUNT(*) INSPECTION_NUMBER,
SUM(REWORK_NUMBER) REWORK_NUMBER, SUM(REWORK_NUMBER) REWORK_NUMBER,
ROUND((1 - SUM(REWORK_NUMBER) / COUNT(*)) * 100, 0) || '%' RATE ROUND((1 - SUM(REWORK_NUMBER) / COUNT(*)) * 100, 0) || '%' RATE
FROM REPORT_QUALITY_INSPECTION RQI FROM REPORT_QUALITY_INSPECTION RQI
LEFT JOIN BASE_PRODUCTLINE BP ON BP.PRODUCT_LINE_CODE = RQI.STATION_CODE LEFT JOIN BASE_PRODUCTLINE BP ON BP.PRODUCT_LINE_CODE = RQI.STATION_CODE
LEFT JOIN BASE_PRODUCTLINE BPP ON BPP.PRODUCT_LINE_CODE = BP.PARENT_ID LEFT JOIN BASE_PRODUCTLINE BPP ON BPP.PRODUCT_LINE_CODE = BP.PARENT_ID
LEFT JOIN BASE_FACTORY FY ON FY.FACTORY_CODE = BPP.PLANT_CODE LEFT JOIN BASE_FACTORY FY ON FY.FACTORY_CODE = BPP.PLANT_CODE
<where> <where>
<if test="PRODUCT_LINE_CODE != null and PRODUCT_LINE_CODE != ''"> <if test="PRODUCT_LINE_CODE != null and PRODUCT_LINE_CODE != ''">
AND BPP.PRODUCT_LINE_CODE = #{PRODUCT_LINE_CODE} AND BPP.PRODUCT_LINE_CODE = #{PRODUCT_LINE_CODE}
@ -70,11 +70,39 @@
</if> </if>
</where> </where>
GROUP BY FY.FACTORY_NAME, BPP.PRODUCT_LINE_NAME, BP.PRODUCT_LINE_CODE, BP.PRODUCT_LINE_NAME GROUP BY FY.FACTORY_NAME, BPP.PRODUCT_LINE_NAME, BP.PRODUCT_LINE_CODE, BP.PRODUCT_LINE_NAME
ORDER BY PRODUCT_LINE_CODE ORDER BY BP.PRODUCT_LINE_CODE
</select> </select>
<select id="fewerMistakesReportList" resultType="java.util.HashMap" parameterType="java.util.HashMap"> <select id="fewerMistakesReportList" resultType="java.util.HashMap" parameterType="java.util.HashMap">
SELECT * SELECT FY.FACTORY_NAME,
FROM VIEW_MATERIAL_COMPLETION BPP.PRODUCT_LINE_NAME,
TO_CHAR(RQI.INSPECTOR_TIME, 'YYYY-MM-DD') INSPECTOR_TIME,
RQI.STATION_CODE,
BP.PRODUCT_LINE_NAME STATION_NAME,
GET_MATERIAL_TYPE(RQI.MATERIAL_NAME) MATERIAL_MODEL,
RQI.QUALITY_DEFECT_CODE,
RQI.QUALITY_DEFECT_NAME,
COUNT(*) DEFECT_NUMBER
FROM REPORT_QUALITY_INSPECTION RQI
LEFT JOIN BASE_PRODUCTLINE BP ON BP.PRODUCT_LINE_CODE = RQI.STATION_CODE
LEFT JOIN BASE_PRODUCTLINE BPP ON BPP.PRODUCT_LINE_CODE = BP.PARENT_ID
LEFT JOIN BASE_FACTORY FY ON FY.FACTORY_CODE = BPP.PLANT_CODE
WHERE RQI.TREATMENT_MEASURE = 1
<if test="PRODUCT_LINE_CODE != null and PRODUCT_LINE_CODE != ''">
AND BPP.PRODUCT_LINE_CODE = #{PRODUCT_LINE_CODE}
</if>
<if test="STATION_CODE != null and STATION_CODE != ''">
AND RQI.STATION_CODE = #{STATION_CODE}
</if>
<if test="MATERIAL_MODEL != null and MATERIAL_MODEL != ''">
AND RQI.MATERIAL_NAME LIKE '%' || #{MATERIAL_MODEL} || '%'
</if>
<if test="beginBeginTime != null and beginBeginTime != '' and endBeginTime != null and endBeginTime != ''">
AND TO_CHAR(RQI.INSPECTOR_TIME, 'YYYY-MM-DD') BETWEEN #{beginBeginTime} AND #{endBeginTime}
</if>
GROUP BY FY.FACTORY_NAME, BPP.PRODUCT_LINE_NAME, TO_CHAR(RQI.INSPECTOR_TIME, 'YYYY-MM-DD'),
RQI.STATION_CODE, BP.PRODUCT_LINE_NAME, GET_MATERIAL_TYPE(RQI.MATERIAL_NAME),
RQI.QUALITY_DEFECT_CODE, RQI.QUALITY_DEFECT_NAME
ORDER BY INSPECTOR_TIME DESC
</select> </select>
<select id="qualityIssuesReportList" resultType="java.util.HashMap" parameterType="java.util.HashMap"> <select id="qualityIssuesReportList" resultType="java.util.HashMap" parameterType="java.util.HashMap">
SELECT * SELECT *
@ -103,8 +131,20 @@
</select> </select>
<select id="qualityDefectsDetailList" resultType="java.util.HashMap" parameterType="java.util.HashMap"> <select id="qualityDefectsDetailList" resultType="java.util.HashMap" parameterType="java.util.HashMap">
SELECT * SELECT ROWNUM SEQ, SD.QUALITY_DEFECT_NAME, SD.DEFECT_NUMBER, ROUND(DEFECT_NUMBER / ALL_DEFECT * 100, 0) || '%' RATE
FROM VIEW_PERFUSION_RECORD FROM (
SELECT RQI.QUALITY_DEFECT_NAME,
COUNT(*) DEFECT_NUMBER,
SUM(COUNT(*)) OVER () ALL_DEFECT
FROM REPORT_QUALITY_INSPECTION RQI
WHERE RQI.TREATMENT_MEASURE = 1
<if test="stationCode != null and stationCode != ''">
AND RQI.STATION_CODE = #{stationCode}
</if>
<if test="beginBeginTime != null and beginBeginTime != '' and endBeginTime != null and endBeginTime != ''">
AND TO_CHAR(RQI.INSPECTOR_TIME, 'YYYY-MM-DD HH24:MI:SS') BETWEEN #{beginBeginTime} AND #{endBeginTime}
</if>
GROUP BY RQI.QUALITY_DEFECT_NAME) SD
</select> </select>

Loading…
Cancel
Save