add工时看板接口

master
yinq 2 years ago
parent 091584d992
commit 308d6d1d07

@ -513,6 +513,20 @@ public class ReportController {
}
}
/**
*
* @param
* @return
*/
@GetMapping("/workHoursBoard")
public R workHoursBoard(String workCenter){
try {
return R.ok(reportService.workHoursBoard(workCenter));
} catch (Exception e) {
return R.failed(e.getMessage());
}
}
/**
*
* @param

@ -166,6 +166,8 @@ public interface ReportMapper {
List<Map<String, String>> departmentForNonconformity(String workCenter);
List<Map<String, String>> workingHoursEachWorkshop(String workCenter);
List<Map<String, String>> workshopDeliveryRateList(String workCenter);
List<Map<String, String>> NCTop5RateList(String workCenter);
@ -246,4 +248,7 @@ public interface ReportMapper {
* @return
*/
List<Map<String, String>> customerDimensionFinishedTimeReport(Map paramMap);
List<Map<String, String>> workHoursCompletedBusinessUnit(String workCenter);
}

@ -258,4 +258,10 @@ public interface ReportService {
*/
List<Map<String, String>> customerDimensionFinishedTimeReport(Map paramMap);
/**
*
* @param user
* @return
*/
Map<String, Object> workHoursBoard(String user);
}

@ -688,7 +688,9 @@ public class ReportServiceImpl implements ReportService {
List<Map<String, String>> result = reportMapper.monthLoadRateReport(paramMap);
Integer monthRemainingDays = getMonthRemainingDays();
for (Map<String, String> map : result) {
Float number = Float.valueOf(String.valueOf(map.get("workHours" + month))) + Float.valueOf(String.valueOf(map.get("tardinessWork")));
Float number = Float.valueOf(String.valueOf(map.get("workHours" + month)))
+ Float.valueOf(String.valueOf(map.get("tardinessWork")))
- Float.valueOf(String.valueOf(map.get("monthToNow")));
map.put("workHours" + month, String.format("%.2f",number));
if ((map.containsKey("dayCapacity"))){
Float dayCapacity= (Float.valueOf(String.valueOf(map.get("dayCapacity")))) * monthRemainingDays;
@ -1329,21 +1331,21 @@ public class ReportServiceImpl implements ReportService {
tardinessWork += Float.valueOf(String.valueOf(map.get("tardinessWork")));
totalWorkingHours += Float.valueOf(String.valueOf(map.get("totalWorkingHours")));
}
countMap.put("tardinessWork",String.format("%.2f",tardinessWork));
countMap.put("monthCapacity",String.format("%.2f",monthCapacity));
countMap.put("workHours1",String.format("%.2f",workHours1));
countMap.put("workHours2",String.format("%.2f",workHours2));
countMap.put("workHours3",String.format("%.2f",workHours3));
countMap.put("workHours4",String.format("%.2f",workHours4));
countMap.put("workHours5",String.format("%.2f",workHours5));
countMap.put("workHours6",String.format("%.2f",workHours6));
countMap.put("workHours7",String.format("%.2f",workHours7));
countMap.put("workHours8",String.format("%.2f",workHours8));
countMap.put("workHours9",String.format("%.2f",workHours9));
countMap.put("workHours10",String.format("%.2f",workHours10));
countMap.put("workHours11",String.format("%.2f",workHours11));
countMap.put("workHours12",String.format("%.2f",workHours12));
countMap.put("totalWorkingHours",String.format("%.2f",totalWorkingHours));
countMap.put("tardinessWork",String.format("%.3f",tardinessWork));
countMap.put("monthCapacity",String.format("%.3f",monthCapacity));
countMap.put("workHours1",String.format("%.3f",workHours1));
countMap.put("workHours2",String.format("%.3f",workHours2));
countMap.put("workHours3",String.format("%.3f",workHours3));
countMap.put("workHours4",String.format("%.3f",workHours4));
countMap.put("workHours5",String.format("%.3f",workHours5));
countMap.put("workHours6",String.format("%.3f",workHours6));
countMap.put("workHours7",String.format("%.3f",workHours7));
countMap.put("workHours8",String.format("%.3f",workHours8));
countMap.put("workHours9",String.format("%.3f",workHours9));
countMap.put("workHours10",String.format("%.3f",workHours10));
countMap.put("workHours11",String.format("%.3f",workHours11));
countMap.put("workHours12",String.format("%.3f",workHours12));
countMap.put("totalWorkingHours",String.format("%.3f",totalWorkingHours));
result.add(countMap);
return result;
}
@ -1391,24 +1393,75 @@ public class ReportServiceImpl implements ReportService {
tardinessWork += Float.valueOf(String.valueOf(map.get("tardinessWork")));
totalWorkingHours += Float.valueOf(String.valueOf(map.get("totalWorkingHours")));
}
countMap.put("tardinessWork",String.format("%.2f",tardinessWork));
countMap.put("workHours1",String.format("%.2f",workHours1));
countMap.put("workHours2",String.format("%.2f",workHours2));
countMap.put("workHours3",String.format("%.2f",workHours3));
countMap.put("workHours4",String.format("%.2f",workHours4));
countMap.put("workHours5",String.format("%.2f",workHours5));
countMap.put("workHours6",String.format("%.2f",workHours6));
countMap.put("workHours7",String.format("%.2f",workHours7));
countMap.put("workHours8",String.format("%.2f",workHours8));
countMap.put("workHours9",String.format("%.2f",workHours9));
countMap.put("workHours10",String.format("%.2f",workHours10));
countMap.put("workHours11",String.format("%.2f",workHours11));
countMap.put("workHours12",String.format("%.2f",workHours12));
countMap.put("totalWorkingHours",String.format("%.2f",totalWorkingHours));
countMap.put("tardinessWork",String.format("%.3f",tardinessWork));
countMap.put("workHours1",String.format("%.3f",workHours1));
countMap.put("workHours2",String.format("%.3f",workHours2));
countMap.put("workHours3",String.format("%.3f",workHours3));
countMap.put("workHours4",String.format("%.3f",workHours4));
countMap.put("workHours5",String.format("%.3f",workHours5));
countMap.put("workHours6",String.format("%.3f",workHours6));
countMap.put("workHours7",String.format("%.3f",workHours7));
countMap.put("workHours8",String.format("%.3f",workHours8));
countMap.put("workHours9",String.format("%.3f",workHours9));
countMap.put("workHours10",String.format("%.3f",workHours10));
countMap.put("workHours11",String.format("%.3f",workHours11));
countMap.put("workHours12",String.format("%.3f",workHours12));
countMap.put("totalWorkingHours",String.format("%.3f",totalWorkingHours));
result.add(countMap);
return result;
}
/**
*
* @param workCenter
* @return
*/
@Override
public Map<String, Object> workHoursBoard(String workCenter) {
HashMap<String, Object> result = new HashMap<>();
//各车间总工时完成情况(单轴多折线图)
List<Map<String, String>> WorkshopList = reportMapper.workingHoursEachWorkshop(workCenter);
List<String> monthOldList = WorkshopList.stream().map(e -> { return e.get("MONTH"); })
.distinct().sorted().collect(Collectors.toList());
ArrayList<String> monthList = new ArrayList<>();
monthList.addAll(monthOldList);
Map<String, List<Map<String, String>>> descriptionMap = WorkshopList.stream().
collect(Collectors.groupingBy(e -> e.get("WORK_CENTER")));
ArrayList<HashMap<String, Object>> descriptionValueList = new ArrayList<>();
for (String description : descriptionMap.keySet()) {
List<Map<String, String>> maps = descriptionMap.get(description);
HashMap<String, Object> map = new HashMap<>();
ArrayList<Float> QTYList = new ArrayList<>();
maps.forEach(e -> {
QTYList.add(Float.valueOf(String.valueOf(e.get("QTY"))));
});
map.put("name",description);
map.put("value",QTYList);
descriptionValueList.add(map);
}
result.put("monthList",monthList);
result.put("descriptionValueList",descriptionValueList);
//事业部完工工时占比(双环形图)
HashMap<String, Object> dutyCauseMap = new HashMap<>();
List<Map<String, String>> workHoursCompletedList = reportMapper.workHoursCompletedBusinessUnit(workCenter);
ArrayList<String> nameList = new ArrayList<>();
ArrayList<HashMap<String, Object>> nameAndValueList = new ArrayList<>();
for (Map<String, String> map : workHoursCompletedList) {
nameList.add(map.get("workOrder"));
HashMap<String, Object> NVMap = new HashMap<>();
NVMap.put("name",map.get("workOrder"));
NVMap.put("value",map.get("workHours"));
nameAndValueList.add(NVMap);
}
dutyCauseMap.put("causeTypeDescription",nameList);
dutyCauseMap.put("distributionMapList",nameAndValueList);
result.put("dutyCause",dutyCauseMap);
return result;
}
/**
*
* @param paramMap

@ -1629,6 +1629,11 @@
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS
ELSE 0 END) "tardinessWork",
SUM(CASE
WHEN to_date(trunc(add_months(last_day(sysdate), -1) + 1)) &lt; (ZSD.PLANNED_COMP_DATE + 8 / 24)
AND (ZSD.PLANNED_COMP_DATE + 8 / 24) &lt; TO_DATE(TRUNC(SYSDATE))
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS
ELSE 0 END) "monthToNow",--当月初至nowTime差值
SUM(CASE
WHEN (ZSD.PLANNED_COMP_DATE + 8/24) >= TO_DATE(MONTH.month0) AND (ZSD.PLANNED_COMP_DATE + 8/24) &lt; TO_DATE(MONTH.month1)
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "workHours1",
SUM(CASE
@ -1723,6 +1728,7 @@
AND WIP."operationDescription" = #{operationDescription}
</if>
</where>
ORDER BY WIP.WORK_CENTER_DESCRIPTION,WIP."operation"
</select>
<select id="weekDeliveryRateReport" resultType="java.util.HashMap" parameterType="java.util.HashMap">
SELECT WIP.WORK_CENTER "workCenter",
@ -2634,6 +2640,8 @@ SELECT zab.CREATED_DATE_TIME,
WHEN INSTR(WIP."workOrder", '橡塑') > 0 THEN '橡塑'
WHEN INSTR(WIP."workOrder", '非公路') > 0 THEN '非公路'
WHEN INSTR(WIP."workOrder", '研究院') > 0 THEN '研究院'
WHEN INSTR(WIP."workOrder", '粉体') > 0 THEN '粉体'
WHEN WIP."workOrder" IS NULL THEN '其他'
ELSE '其他' END "shortHandWorkOrder",
WIP."workHours1" + WIP."workHours2" + WIP."workHours3" + WIP."workHours4" + WIP."workHours5" +
WIP."workHours6" +
@ -2742,7 +2750,6 @@ SELECT zab.CREATED_DATE_TIME,
LEFT JOIN WORK_CENTER WC ON WC.WORK_CENTER = ZSD.WORK_CENTER
LEFT JOIN WORK_CENTER_T WCT ON WCT.WORK_CENTER_BO = WC.HANDLE AND WCT.LOCALE = 'zh'
CROSS JOIN MONTH
WHERE cf2.VALUE IS NOT NULL
<if test="workCenter != null and workCenter != ''">
AND ZSD.WORK_CENTER = #{workCenter}
</if>
@ -2751,5 +2758,54 @@ SELECT zab.CREATED_DATE_TIME,
GROUP BY KHW."workCenterDescription", KHW."shortHandWorkOrder"
ORDER BY KHW."workCenterDescription" DESC, KHW."shortHandWorkOrder"
</select>
<select id="workingHoursEachWorkshop" resultType="java.util.Map" parameterType="java.util.HashMap">
-- 工时看板(各车间总工时完成情况)
WITH M_MONTH AS (
SELECT TO_CHAR(ADD_MONTHS(TRUNC(SYSDATE), + ROWNUM - 12), 'yyyy-MM') MONTH
FROM DUAL
CONNECT BY 12 >= ROWNUM)
SELECT WCT.DESCRIPTION WORK_CENTER,
M_MONTH.MONTH,
SUM(ROUND(CASE
WHEN M_MONTH.MONTH = TO_CHAR(ZSD.ACTUAL_COMPLETE_DATE, 'yyyy-mm') THEN
ZSD.DISPATCH_QTY * ZSD.PROD_HOURS
ELSE 0 END, 2)) QTY
FROM Z_SFC_DISPATCH ZSD
JOIN WORK_CENTER WC ON WC.WORK_CENTER = ZSD.WORK_CENTER
LEFT JOIN WORK_CENTER_T WCT ON WCT.WORK_CENTER_BO = WC.HANDLE
CROSS JOIN M_MONTH
GROUP BY WCT.DESCRIPTION, M_MONTH.MONTH
ORDER BY WCT.DESCRIPTION, M_MONTH.MONTH
</select>
<select id="workHoursCompletedBusinessUnit" resultType="java.util.Map" parameterType="java.util.HashMap">
-- 事业部完工工时占比(双环形图)
SELECT WIP."shortHandWorkOrder" "workOrder",
SUM(WIP."workHours") "workHours"
FROM (SELECT cf2.VALUE "workOrder",
CASE
WHEN INSTR(cf2.VALUE, '硫化') > 0 THEN '硫化'
WHEN INSTR(cf2.VALUE, '全钢') > 0 THEN '全钢'
WHEN INSTR(cf2.VALUE, '半钢') > 0 THEN '半钢'
WHEN INSTR(cf2.VALUE, '鼓') > 0 THEN '鼓'
WHEN INSTR(cf2.VALUE, '裁断') > 0 THEN '裁断'
WHEN INSTR(cf2.VALUE, '检测') > 0 THEN '检测'
WHEN INSTR(cf2.VALUE, '橡塑') > 0 THEN '橡塑'
WHEN INSTR(cf2.VALUE, '非公路') > 0 THEN '非公路'
WHEN INSTR(cf2.VALUE, '研究院') > 0 THEN '研究院'
WHEN INSTR(cf2.VALUE, '粉体') > 0 THEN '粉体'
ELSE '其他' END "shortHandWorkOrder",
SUM(CASE
WHEN ZSD.DISPATCH_STATUS = 'COMPLETE'
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS
ELSE 0 END) "workHours"
FROM Z_SFC_DISPATCH ZSD
LEFT JOIN SHOP_ORDER so ON so.SHOP_ORDER = zsd.SHOP_ORDER AND so.SITE = zsd.SITE
LEFT JOIN CUSTOM_FIELDS cf2 ON cf2.HANDLE = so.HANDLE AND cf2."ATTRIBUTE" = 'WORK_ORDER'
WHERE cf2.VALUE IS NOT NULL
GROUP BY cf2.VALUE
) WIP
GROUP BY WIP."shortHandWorkOrder"
ORDER BY WIP."shortHandWorkOrder"
</select>
</mapper>
Loading…
Cancel
Save