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 VBF.MAINID EQUIPMENT_CODE,
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,
(CASE
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,
NVL(MAX(SD.PLAN_SUM), 0) PLAN_SUM,
SUM(VBF.ANHOUR + VBF.TWOHOUR + VBF.THREEHOUR + VBF.FOURHOUR + VBF.FIVEHOUR + VBF.SIXHOUR +
VBF.SEVENHOUR +
VBF.EIGHTHOUR +
@ -96,16 +91,37 @@
FROM VIEW_BOX_FOAMDATA VBF
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 (SELECT BF.MAINID, BF.FIXTUREBOXTYPE FIXTUREBOXTYPE
LEFT JOIN (SELECT BF.MAINID, BF.FIXTUREBOXTYPE FIXTUREBOXTYPE, BF.FIXTURESTATUS
FROM VIEW_BOX_FOAMDATA BF
JOIN
(
SELECT MAINID, MAX(UPDATETIME) UPDATETIME
SELECT MAINID
, MAX(UPDATETIME) UPDATETIME
FROM VIEW_BOX_FOAMDATA
WHERE PRODUCT_LINE_CODE = #{PRODUCT_LINE_CODE}
GROUP BY MAINID
) SV ON SV.MAINID = BF.MAINID AND SV.UPDATETIME = BF.UPDATETIME) TP
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}
GROUP BY VBF.MAINID, TO_NUMBER(BCD.CUSTOM_DATA)
ORDER BY VBF.MAINID

@ -48,16 +48,16 @@
<select id="qualityDefectsStatisticalAnalysisList" resultType="java.util.HashMap" parameterType="java.util.HashMap">
SELECT FY.FACTORY_NAME,
BPP.PRODUCT_LINE_NAME,
BP.PRODUCT_LINE_CODE,
BP.PRODUCT_LINE_NAME STATION_NAME,
COUNT(*) INSPECTION_NUMBER,
SUM(REWORK_NUMBER) REWORK_NUMBER,
ROUND((1 - SUM(REWORK_NUMBER) / COUNT(*)) * 100, 0) || '%' RATE
BPP.PRODUCT_LINE_NAME,
BP.PRODUCT_LINE_CODE STATION_CODE,
BP.PRODUCT_LINE_NAME STATION_NAME,
COUNT(*) INSPECTION_NUMBER,
SUM(REWORK_NUMBER) REWORK_NUMBER,
ROUND((1 - SUM(REWORK_NUMBER) / COUNT(*)) * 100, 0) || '%' RATE
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
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>
<if test="PRODUCT_LINE_CODE != null and PRODUCT_LINE_CODE != ''">
AND BPP.PRODUCT_LINE_CODE = #{PRODUCT_LINE_CODE}
@ -70,11 +70,39 @@
</if>
</where>
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 id="fewerMistakesReportList" resultType="java.util.HashMap" parameterType="java.util.HashMap">
SELECT *
FROM VIEW_MATERIAL_COMPLETION
SELECT FY.FACTORY_NAME,
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 id="qualityIssuesReportList" resultType="java.util.HashMap" parameterType="java.util.HashMap">
SELECT *
@ -103,8 +131,20 @@
</select>
<select id="qualityDefectsDetailList" resultType="java.util.HashMap" parameterType="java.util.HashMap">
SELECT *
FROM VIEW_PERFUSION_RECORD
SELECT ROWNUM SEQ, SD.QUALITY_DEFECT_NAME, SD.DEFECT_NUMBER, ROUND(DEFECT_NUMBER / ALL_DEFECT * 100, 0) || '%' RATE
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>

Loading…
Cancel
Save