添加看板api请求

master
zpl 3 years ago
parent 33511a25f0
commit 799ef314ca

@ -22,35 +22,214 @@ public class BoardController {
@Autowired
public BoardMapper boardMapper;
@GetMapping("/test")
public R test(String resource, String qty) {
Map<String, Object> result = new HashMap<>();
/**
*
*/
@GetMapping("/resourceRunData")
public R resourceRunData(@RequestParam(required = false) Map paramMap) {
try {
paramMap.put("site", CommonMethods.getSite());
List<Map<String, Object>> result = boardMapper.resourceRunData(paramMap);
return R.ok(result);
} catch (Exception e) {
return R.failed(e.getMessage());
}
}
/**
*
*/
@GetMapping("/resourceRunParamData")
public R resourceRunParamData(@RequestParam(required = false) Map paramMap) {
try {
paramMap.put("site", CommonMethods.getSite());
List<Map<String, Object>> result = boardMapper.resourceRunParamData(paramMap);
return R.ok(result);
} catch (Exception e) {
return R.failed(e.getMessage());
}
}
/**
*
*/
@GetMapping("/resourceFaultDescription")
public R resourceFaultDescription(@RequestParam(required = false) Map paramMap) {
try {
paramMap.put("site", CommonMethods.getSite());
List<Map<String, Object>> result = boardMapper.resourceFaultDescription(paramMap);
return R.ok(result);
} catch (Exception e) {
return R.failed(e.getMessage());
}
}
/**
*
*/
@GetMapping("/monthPlanCompleteData")
public R monthPlanCompleteData(@RequestParam(required = false) Map paramMap) {
try {
paramMap.put("site", CommonMethods.getSite());
List<Map<String, Object>> result = boardMapper.monthPlanCompleteData(paramMap);
return R.ok(result);
} catch (Exception e) {
return R.failed(e.getMessage());
}
}
/**
*
*/
@GetMapping("/monthCompleteData")
public R monthCompleteData(@RequestParam(required = false) Map paramMap) {
try {
paramMap.put("site", CommonMethods.getSite());
List<Map<String, Object>> result = boardMapper.monthCompleteData(paramMap);
return R.ok(result);
} catch (Exception e) {
return R.failed(e.getMessage());
}
}
/**
*
*/
@GetMapping("/monthCompleteAndPlanCompleteData")
public R monthCompleteAndPlanCompleteData(@RequestParam(required = false) Map paramMap) {
try {
paramMap.put("site", CommonMethods.getSite());
List<Map<String, Object>> result = boardMapper.monthCompleteAndPlanCompleteData(paramMap);
return R.ok(result);
} catch (Exception e) {
return R.failed(e.getMessage());
}
}
/**
*
*/
@GetMapping("/percentOfPass")
public R percentOfPass(@RequestParam(required = false) Map paramMap) {
try {
paramMap.put("site", CommonMethods.getSite());
List<Map<String, Object>> result = boardMapper.percentOfPass(paramMap);
return R.ok(result);
} catch (Exception e) {
return R.failed(e.getMessage());
}
}
/**
*
*/
@GetMapping("/resourceRunDataThreeDay")
public R resourceRunDataThreeDay(@RequestParam(required = false) Map paramMap) {
try {
paramMap.put("site", CommonMethods.getSite());
List<Map<String, Object>> result = boardMapper.resourceRunDataThreeDay(paramMap);
return R.ok(result);
} catch (Exception e) {
return R.failed(e.getMessage());
}
}
/**
*
*/
@GetMapping("/onceEspecially")
public R onceEspecially(@RequestParam(required = false) Map paramMap) {
try {
paramMap.put("site", CommonMethods.getSite());
List<Map<String, Object>> result = boardMapper.onceEspecially(paramMap);
return R.ok(result);
} catch (Exception e) {
return R.failed(e.getMessage());
}
}
/**
*
*/
@GetMapping("/scheduleOfCompletion")
public R scheduleOfCompletion(@RequestParam(required = false) Map paramMap) {
try {
paramMap.put("site", CommonMethods.getSite());
List<Map<String, Object>> result = boardMapper.scheduleOfCompletion(paramMap);
return R.ok(result);
} catch (Exception e) {
return R.failed(e.getMessage());
}
}
/**
*
*/
@GetMapping("/abnormalResolveData")
public R abnormalResolveData(@RequestParam(required = false) Map paramMap) {
try {
result.put("RESOURCE", resource);
result.put("SHOP_ORDER", "SO20211011");
result.put("ITEM", "00302354001");
result.put("QTY", 80);
result.put("JJ", 560);
result.put("HJ", 450);
result.put("RCL", 700);
result.put("ZZ", 390);
paramMap.put("site", CommonMethods.getSite());
List<Map<String, Object>> result = boardMapper.abnormalResolveData(paramMap);
return R.ok(result);
} catch (Exception e) {
return R.failed(e.getMessage());
}
}
/**
*
*/
@GetMapping("/abnormalContent")
public R abnormalContent(@RequestParam(required = false) Map paramMap) {
try {
paramMap.put("site", CommonMethods.getSite());
List<Map<String, Object>> result = boardMapper.abnormalContent(paramMap);
return R.ok(result);
} catch (Exception e) {
return R.failed(e.getMessage());
}
}
/**
*
*/
@GetMapping("/planDataFSW")
public R planDataFSW(@RequestParam(required = false) Map paramMap) {
try {
paramMap.put("site", CommonMethods.getSite());
List<Map<String, Object>> result = boardMapper.planDataFSW(paramMap);
return R.ok(result);
} catch (Exception e) {
return R.failed(e.getMessage());
}
}
return R.ok(result);
/**
*
*/
@GetMapping("/completeDataFSW")
public R completeDataFSW(@RequestParam(required = false) Map paramMap) {
try {
paramMap.put("site", CommonMethods.getSite());
List<Map<String, Object>> result = boardMapper.completeDataFSW(paramMap);
return R.ok(result);
} catch (Exception e) {
return R.failed(e.getMessage());
}
}
@GetMapping("/findResourceInfo")
public R findResourceInfo(@RequestParam(required = false) Map paramMap) {
/**
*
*/
@GetMapping("/planAndCompleteDataFSW")
public R planAndCompleteDataFSW(@RequestParam(required = false) Map paramMap) {
try {
paramMap.put("site", CommonMethods.getSite());
List<Map<String, Object>> result = boardMapper.findResourceInfo(paramMap);
List<Map<String, Object>> result = boardMapper.planAndCompleteDataFSW(paramMap);
return R.ok(result);
} catch (Exception e) {
return R.failed(e.getMessage());
}
}
}

@ -6,6 +6,7 @@ package com.foreverwin.mesnac.common.controller;
* @Since 2021-08-23
*/
import com.foreverwin.mesnac.common.mapper.ReportDataMapper;
import com.foreverwin.mesnac.common.service.ReportDataService;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.R;
@ -21,6 +22,8 @@ public class ReportDataController {
@Autowired
public ReportDataService reportDataService;
@Autowired
public ReportDataMapper reportDataMapper;
/**
*
@ -145,5 +148,36 @@ public class ReportDataController {
return R.ok(result);
}
/**
*
* @param paramMap
* @return
*/
@GetMapping("/selectItemMoveData")
public R selectItemMoveData(@RequestParam(required = false) Map paramMap) {
try{
paramMap.put("site", CommonMethods.getSite());
List<Map<String, Object>> result = reportDataMapper.selectItemMoveData(paramMap);
return R.ok(result);
}catch (Exception e){
return R.failed(e.getMessage());
}
}
/**
*
* @param
* @return
*/
@GetMapping("/doItemMove")
public R doItemMove(List<String> list) {
try{
String site = CommonMethods.getSite();
//List<String> list = (List<String>) paramMap.get("list");
reportDataMapper.doItemMove(site , list);
return R.ok("物料流转成功");
}catch (Exception e){
return R.failed(e.getMessage());
}
}
}

@ -7,5 +7,43 @@ import java.util.Map;
@Repository
public interface BoardMapper {
List<Map<String, Object>> findResourceInfo(Map paramMap);
//设备运行状态
List<Map<String, Object>> resourceRunData(Map paramMap);
//设备运行状态参数
List<Map<String, Object>> resourceRunParamData(Map paramMap);
//设备故障描述
List<Map<String, Object>> resourceFaultDescription(Map paramMap);
// 月完成数
List<Map<String, Object>> monthPlanCompleteData(Map paramMap);
// 月完成数
List<Map<String, Object>> monthCompleteData(Map paramMap);
// 月计划完成数和月完成数
List<Map<String, Object>> monthCompleteAndPlanCompleteData(Map paramMap);
// 合格率
List<Map<String, Object>> percentOfPass(Map paramMap);
// 车间设备近三天运行数
List<Map<String, Object>> resourceRunDataThreeDay(Map paramMap);
// 一次交检合格率
List<Map<String, Object>> onceEspecially(Map paramMap);
// 完工进度
List<Map<String, Object>> scheduleOfCompletion(Map paramMap);
// 异常处理情况
List<Map<String, Object>> abnormalResolveData(Map paramMap);
// 异常响应情况
List<Map<String, Object>> abnormalContent(Map paramMap);
// 焊接车间计划数
List<Map<String, Object>> planDataFSW(Map paramMap);
// 完成数
List<Map<String, Object>> completeDataFSW(Map paramMap);
// 焊接车间计划数、完成数
List<Map<String, Object>> planAndCompleteDataFSW(Map paramMap);
}

@ -1,5 +1,6 @@
package com.foreverwin.mesnac.common.mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@ -33,4 +34,8 @@ public interface ReportDataMapper {
List<Map<String, Object>> findInspectionDetailPassRate(Map paramMap);
List<Map<String, Object>> findSectionPassRate(Map paramMap);
List<Map<String, Object>> selectItemMoveData(Map paramMap);
List<Map<String, Object>> doItemMove(@Param("site") String site, @Param("list") List<String> list);
}

@ -1,74 +1,370 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.foreverwin.mesnac.common.mapper.BoardMapper">
<select id="findResourceInfo" resultType="java.util.HashMap" parameterType="java.util.HashMap">
WITH
TE AS (
SELECT DISTINCT R.RESRCE RESRCE , R.HANDLE HANDLE
FROM RESRCE r
INNER JOIN WORK_CENTER_MEMBER wcm ON WCM.WORK_CENTER_OR_RESOURCE_GBO = R.HANDLE
INNER JOIN WORK_CENTER_MEMBER wcm2 ON WCM2.WORK_CENTER_OR_RESOURCE_GBO = WCM.WORK_CENTER_BO
INNER JOIN WORK_CENTER wc ON WC.HANDLE = WCM2.WORK_CENTER_BO
WHERE R.SITE = '1000' --AND WC.WORK_CENTER = 'JJ'
),
TEMP AS (
SELECT ZSD.RESRCE , ZSD.DISPATCH_STATUS , i.ITEM , it.DESCRIPTION , ZSD.ACTUAL_START_DATE,
ZSD.PROD_HOURS ,ZSD.DISPATCH_QTY ,ZSD.STEP_ID , ZSD.ACTUAL_PROD_HOURS
FROM Z_SFC_DISPATCH zsd
INNER JOIN TE ON TE.RESRCE = ZSD.RESRCE
INNER JOIN SHOP_ORDER SO ON SO.SHOP_ORDER = ZSD.SHOP_ORDER
INNER JOIN ITEM i ON I.HANDLE = SO.ITEM_BO
INNER JOIN ITEM_T IT ON IT.ITEM_BO = I.HANDLE AND IT.LOCALE = 'zh'
WHERE ZSD.SITE = '1000'
) ,
MN AS (
SELECT R.RESRCE , R.DESCRIPTION RESOURCE_DESCRIPTION, CF.VALUE || '/' || R.DESCRIPTION NAME ,
--WC.WORK_CENTER ,
--RT.RESOURCE_TYPE,
--RT.DESCRIPTION RESOURCE_TYPE_DESCRIPTION,
CASE WHEN ZRSR.STATUS = 'RUN' THEN '#1afa29'
WHEN ZRSR.STATUS = 'DOW' THEN '#EF4136' --'RGB(255,115,100)'
WHEN ZRSR.STATUS = 'FREE' THEN '#dbdbdb'
WHEN ZRSR.STATUS = 'WARN' THEN '#F4EA2A'
ELSE '#FFF' END STATUS_COLOR,
CASE WHEN ZRSR.STATUS = 'RUN' THEN '运行'
WHEN ZRSR.STATUS = 'DOW' THEN '停机' --'RGB(255,115,100)'
WHEN ZRSR.STATUS = 'FREE' THEN '空闲'
WHEN ZRSR.STATUS = 'WARN' THEN '告警'
ELSE '运行' END STATUS_NAME,
NVL(ZRSR.STATUS,'FREE') STATUS,
CF.VALUE RESOURCE_LOCATION ,
ZEDR.S1 FEED_RATE, ZEDR.S2 FEED_VALUE, ZEDR.S3 SPINDLE_LOAD , ZEDR.S4 SPINDLE_SPEED
FROM RESRCE R
INNER JOIN WORK_CENTER_MEMBER wcm ON WCM.WORK_CENTER_OR_RESOURCE_GBO = R.HANDLE
INNER JOIN WORK_CENTER_MEMBER wcm2 ON WCM2.WORK_CENTER_OR_RESOURCE_GBO = WCM.WORK_CENTER_BO
INNER JOIN WORK_CENTER wc ON WC.HANDLE = WCM2.WORK_CENTER_BO
INNER JOIN RESOURCE_TYPE_RESOURCE RTR ON RTR.RESOURCE_BO = R.HANDLE
INNER JOIN RESOURCE_TYPE RT ON RT.HANDLE = RTR.RESOURCE_TYPE_BO
LEFT JOIN Z_RESOURCE_STATUS_RECEIVE ZRSR ON ZRSR.RESRCE = R.RESRCE
LEFT JOIN CUSTOM_FIELDS cf ON CF.HANDLE = R.HANDLE AND CF."ATTRIBUTE" = 'RESOURCE_LOCATION'
LEFT JOIN Z_EDC_DATA_RESOURCE zedr ON ZEDR.RESRCE = R.RESRCE
WHERE RT.SITE = '1000' AND WC.WORK_CENTER = 'JJ'
ORDER BY ZRSR.RESRCE
)
SELECT T.RESRCE RE_NAME , T.DISPATCH_STATUS , ITEM , DESCRIPTION ITEM_DESCRIPTION, DISPATCH_QTY , PROD_HOURS , WORK_HOUR, ACTUAL_START_DATE, STEP_ID ,ACTUAL_PROD_HOURS,
CASE WHEN PROD_HOURS > WORK_HOUR THEN ROUND(WORK_HOUR /PROD_HOURS,2)
ELSE (CASE WHEN DISPATCH_STATUS = 'START' THEN 90 ELSE 100 END ) END PROGRESS ,
MN.*
<!--设备运行状态-->
<select id="resourceRunData" resultType="java.util.HashMap" parameterType="java.util.HashMap">
SELECT
MAX(CASE WHEN STATUS = 'RUN' THEN QTY ELSE 0 END)RUN,
MAX(CASE WHEN STATUS = 'DOW' THEN QTY ELSE 0 END)"STOP",
MAX(CASE WHEN STATUS = 'WARN' THEN QTY ELSE 0 END)IDLE,
MAX(CASE WHEN STATUS = 'FREE' THEN QTY ELSE 0 END)IDLEA
FROM
(
SELECT *
FROM
(
SELECT ROW_NUMBER() OVER(PARTITION BY RESRCE ORDER BY DISPATCH_STATUS DESC ,ACTUAL_START_DATE DESC ,STEP_ID DESC ) rn,
RESRCE , DISPATCH_STATUS , ITEM , DESCRIPTION , DISPATCH_QTY , PROD_HOURS , ACTUAL_START_DATE , STEP_ID ,ACTUAL_PROD_HOURS ,
CASE WHEN DISPATCH_STATUS = 'START' THEN (SYSDATE - (ACTUAL_START_DATE + 8/24) ) * 24
ELSE NVL(10000,ACTUAL_PROD_HOURS) END WORK_HOUR
FROM TEMP WHERE DISPATCH_STATUS IN ('COMPLETE' ,'START' ) )
WHERE rn = 1
ORDER BY RESRCE , DISPATCH_STATUS DESC
) T
LEFT JOIN MN ON MN.RESRCE = T.RESRCE
ORDER BY MN.RESOURCE_LOCATION ,MN.RESRCE
( SELECT "STATUS", COUNT(1)QTY FROM Z_RESOURCE_STATUS_RECEIVE GROUP BY "STATUS" )
</select>
<!--设备运行状态参数-->
<select id="resourceRunParamData" resultType="java.util.HashMap" parameterType="java.util.HashMap">
WITH TPARAM AS(
SELECT
ZRSR.RESRCE, R.DESCRIPTION RESOURCE_DESCRIPTION,
CF.VALUE, CF.VALUE || '/' || R.DESCRIPTION NAME,
CASE
WHEN ZRSR.STATUS = 'RUN' THEN '#7FB80E'
WHEN ZRSR.STATUS = 'DOW' THEN '#F5A15B'
ELSE '#dbdbdb'
END STATUS_COLOR,
CASE
WHEN ZRSR.STATUS = 'RUN' THEN '运行'
WHEN ZRSR.STATUS = 'DOW' THEN '停机'
ELSE '空闲'
END STATUS_NAME,
ZEDR.S1 FEED_RATE, ZEDR.S2 FEED_VALUE, ZEDR.S3 SPINDLE_LOAD, ZEDR.S4 SPINDLE_SPEED
FROM
Z_RESOURCE_STATUS_RECEIVE ZRSR
LEFT JOIN RESRCE R ON R.RESRCE = ZRSR.RESRCE AND R.SITE = '1000'
LEFT JOIN Z_EDC_DATA_RESOURCE ZEDR ON ZEDR.RESRCE = ZRSR.RESRCE
LEFT JOIN CUSTOM_FIELDS cf ON CF.HANDLE = R.HANDLE AND CF."ATTRIBUTE" = 'RESOURCE_LOCATION'
),
TEMP AS(
SELECT
ZSD.RESRCE, ZSD.DISPATCH_STATUS, i.ITEM, it.DESCRIPTION, ZSD.ACTUAL_START_DATE,
ZSD.PROD_HOURS, ZSD.DISPATCH_QTY, ZSD.STEP_ID, ZSD.ACTUAL_PROD_HOURS
FROM
Z_SFC_DISPATCH zsd
INNER JOIN Z_RESOURCE_STATUS_RECEIVE ZRSR ON ZRSR.RESRCE = ZSD.RESRCE
INNER JOIN SHOP_ORDER SO ON SO.SHOP_ORDER = ZSD.SHOP_ORDER
INNER JOIN ITEM i ON I.HANDLE = SO.ITEM_BO
INNER JOIN ITEM_T IT ON IT.ITEM_BO = I.HANDLE AND IT.LOCALE = 'zh'
WHERE ZSD.SITE = '1000' AND ZSD.DISPATCH_STATUS IN( 'COMPLETE', 'START' )
),
MN AS(
SELECT * FROM SELECT (
SELECT
ROW_NUMBER() OVER(
PARTITION BY RESRCE
ORDER BY
DISPATCH_STATUS DESC, ACTUAL_START_DATE DESC, STEP_ID DESC
) rn,
RESRCE, DISPATCH_STATUS, ITEM, DESCRIPTION, DISPATCH_QTY, PROD_HOURS, ACTUAL_START_DATE, STEP_ID, ACTUAL_PROD_HOURS,
CASE
WHEN DISPATCH_STATUS = 'START' THEN( SYSDATE -( ACTUAL_START_DATE + 8 / 24 ) )* 24
ELSE NVL( 10000, ACTUAL_PROD_HOURS )
END WORK_HOUR
FROM
TEMP
)
WHERE rn = 1
) SELECT
A.*, B.ITEM, B.DESCRIPTION ITEM_DESCRIPTION, B.DISPATCH_QTY,
CASE WHEN B.PROD_HOURS > B.WORK_HOUR THEN ROUND( WORK_HOUR / PROD_HOURS, 2 )
ELSE( CASE WHEN B.DISPATCH_STATUS = 'START' THEN 90 ELSE 100 END )
END PROGRESS
FROM TPARAM A
LEFT JOIN MN B ON B.RESRCE = A.RESRCE
ORDER BY A.VALUE, B.ITEM
</select>
<select id="resourceFaultDescription" resultType="java.util.HashMap" parameterType="java.util.HashMap">
SELECT ROWNUM , T.* FROM (SELECT DISTINCT ZRFR.RESRCE, R.DESCRIPTION, ZRFR.DESCRIPTION FAULT_DESCRIPTION
FROM Z_RESOURCE_FAULT_RECEIVE ZRFR
INNER JOIN RESRCE R ON R.RESRCE = ZRFR.RESRCE AND R.SITE = #{site}
WHERE ZRFR.DESCRIPTION IS NOT NULL AND TO_CHAR(ZRFR.CREATED_DATE_TIME , 'YYYY-MM-DD') = TO_CHAR(SYSDATE ,'YYYY-MM-DD') ) T
WHERE ROWNUM &lt; 20
</select>
<!--月计划完成数-->
<select id="monthPlanCompleteData" resultType="java.util.HashMap" parameterType="java.util.HashMap">
SELECT SUM(ZSD.DISPATCH_QTY) "value" FROM Z_SFC_DISPATCH zsd
WHERE ZSD.DISPATCH_STATUS != 'NEW' AND ZSD.SITE = #{site}
AND TO_CHAR(ZSD.PLANNED_COMP_DATE + 8/24 , 'YYYY-MM') = TO_CHAR(SYSDATE,'YYYY-MM')
<if test="workCenter != null and workCenter != ''">
AND ZSD.WORK_CENTER = #{workCenter}
</if>
</select>
<!--月完成数-->
<select id="monthCompleteData" resultType="java.util.HashMap" parameterType="java.util.HashMap">
SELECT NVL(SUM(ZSD.DISPATCH_QTY),0) "value" FROM Z_SFC_DISPATCH zsd
WHERE ZSD.SITE = #{site} AND ZSD.DISPATCH_STATUS IN ('COMPLETE','CANCEL')
AND TO_CHAR(ZSD.PLANNED_COMP_DATE + 8/24 , 'YYYY-MM') = TO_CHAR(SYSDATE,'YYYY-MM')
AND ZSD.SHOP_ORDER IN (
SELECT SHOP_ORDER FROM SHOP_ORDER SO WHERE TO_CHAR(SO.PLANNED_COMP_DATE + 8/24 , 'YYYY-MM') = TO_CHAR(SYSDATE,'YYYY-MM')
)
<if test="workCenter != null and workCenter != ''">
AND ZSD.WORK_CENTER = #{workCenter}
</if>
</select>
<!--月计划完成数和月完成数-->
<select id="monthCompleteAndPlanCompleteData" resultType="java.util.HashMap" parameterType="java.util.HashMap">
SELECT A.CNT QTY_PLAN , B.CNT QTY_DONE , A.CNT - B.CNT QTY_HAND FROM
(SELECT SUM(ZSD.DISPATCH_QTY) CNT FROM Z_SFC_DISPATCH zsd
WHERE ZSD.DISPATCH_STATUS != 'NEW' AND ZSD.SITE = #{site}
AND TO_CHAR(ZSD.PLANNED_COMP_DATE + 8/24 , 'YYYY-MM') = TO_CHAR(SYSDATE,'YYYY-MM')
<if test="workCenter != null and workCenter != ''">
AND ZSD.WORK_CENTER = #{workCenter}
</if>
) A,
( SELECT NVL(SUM(ZSD.DISPATCH_QTY),0) CNT FROM Z_SFC_DISPATCH zsd
WHERE ZSD.DISPATCH_STATUS IN ('COMPLETE','CANCEL')
AND TO_CHAR(ZSD.PLANNED_COMP_DATE + 8/24 , 'YYYY-MM') = TO_CHAR(SYSDATE,'YYYY-MM')
AND ZSD.SHOP_ORDER IN (
SELECT SHOP_ORDER FROM SHOP_ORDER SO WHERE TO_CHAR(SO.PLANNED_COMP_DATE + 8/24 , 'YYYY-MM') = TO_CHAR(SYSDATE,'YYYY-MM')
)
<if test="workCenter != null and workCenter != ''">
AND ZSD.WORK_CENTER = #{workCenter}
</if>
) B
</select>
<!--合格率-->
<select id="percentOfPass" resultType="java.util.HashMap" parameterType="java.util.HashMap">
SELECT 10 "min", 100 "max", ROUND(SUM(CASE WHEN RESULT = 'OK' THEN QTY ELSE 0 END)/SUM(QTY)*100,2) "value", '%' "unit"
FROM (
SELECT ZT.SITE, ZT.SFC, ZT.RESULT, SC.QTY, RANK() OVER(PARTITION BY ZT.SITE, ZT.SFC ORDER BY ZT.CREATED_DATE_TIME DESC) AS ROW_ID
FROM Z_INSPECTION_TASK ZT
INNER JOIN SFC SC ON ZT.SITE = SC.SITE AND ZT.SFC = SC.SFC
WHERE ZT.SITE = #{site} AND ZT.CATEGORY = 'P' AND STATUS = 'COMPLETE'
AND TO_CHAR(ZT.CREATED_DATE_TIME + 8/24,'YYYY-MM') = TO_CHAR(SYSDATE,'YYYY-MM')
<if test="workCenter != null and workCenter != ''">
AND ZSD.WORK_CENTER = #{workCenter}
</if>
) WHERE ROW_ID = 1
GROUP BY SITE
</select>
<!--车间设备近三天运行数-->
<select id="resourceRunDataThreeDay" resultType="java.util.HashMap" parameterType="java.util.HashMap">
WITH TEMP AS (
SELECT DISTINCT ZSD.RESRCE , TO_CHAR(ZSD.ACTUAL_START_DATE,'MM-DD') DATE_TIME FROM Z_SFC_DISPATCH ZSD
WHERE ZSD.SITE = #{site} AND ZSD.DISPATCH_STATUS IN ('COMPLETE','CANCEL','START')
<if test="workCenter != null and workCenter != ''">
AND ZSD.WORK_CENTER = #{workCenter}
</if>
AND ZSD.ACTUAL_START_DATE > (SELECT TO_DATE( TO_CHAR(SYSDATE-3 ,'YYYY-MM-DD') || ' 16:00:00' , 'YYYY-MM-DD HH24:MI:SS' ) DATE_TIME FROM DUAL )
)
SELECT A.DATE_TIME A_DATE , A.CNT A_CNT ,B.DATE_TIME B_DATE , B.CNT B_CNT ,C.DATE_TIME C_DATE , C.CNT C_CNT
FROM
(SELECT COUNT(RESRCE) CNT , TO_CHAR(SYSDATE-2 ,'MM-DD') DATE_TIME FROM TEMP WHERE DATE_TIME = TO_CHAR(SYSDATE-2 ,'MM-DD') ) A,
(SELECT COUNT(RESRCE) CNT , TO_CHAR(SYSDATE-1 ,'MM-DD') DATE_TIME FROM TEMP WHERE DATE_TIME = TO_CHAR(SYSDATE-1 ,'MM-DD') ) B,
(SELECT COUNT(RESRCE) CNT , TO_CHAR(SYSDATE ,'MM-DD') DATE_TIME FROM TEMP WHERE DATE_TIME = TO_CHAR(SYSDATE ,'MM-DD') ) C
</select>
<!--一次交检合格率-->
<select id="onceEspecially" resultType="java.util.HashMap" parameterType="java.util.HashMap">
SELECT L.MONTHS, L.XS_MONTHS, NVL(P.JJ_QTY,0) JJ_QTY, NVL(P.OK_QTY,0) OK_QTY, ROUND(NVL(P.OK_QTY,0)/NVL(P.JJ_QTY,1)*100,2) OK_RATE
FROM (
SELECT TO_CHAR(ADD_MONTHS(TRUNC(SYSDATE),-4),'YYYYMM') MONTHS, TO_NUMBER(TO_CHAR(ADD_MONTHS(TRUNC(SYSDATE),-4),'MM')) XS_MONTHS FROM DUAL
UNION
SELECT TO_CHAR(ADD_MONTHS(TRUNC(SYSDATE),-3),'YYYYMM') MONTHS, TO_NUMBER(TO_CHAR(ADD_MONTHS(TRUNC(SYSDATE),-3),'MM')) XS_MONTHS FROM DUAL
UNION
SELECT TO_CHAR(ADD_MONTHS(TRUNC(SYSDATE),-2),'YYYYMM') MONTHS, TO_NUMBER(TO_CHAR(ADD_MONTHS(TRUNC(SYSDATE),-2),'MM')) XS_MONTHS FROM DUAL
UNION
SELECT TO_CHAR(ADD_MONTHS(TRUNC(SYSDATE),-1),'YYYYMM') MONTHS, TO_NUMBER(TO_CHAR(ADD_MONTHS(TRUNC(SYSDATE),-1),'MM')) XS_MONTHS FROM DUAL
UNION
SELECT TO_CHAR(SYSDATE, 'YYYYMM') MONTHS, TO_NUMBER(TO_CHAR(SYSDATE,'MM')) XS_MONTHS FROM DUAL
) L
LEFT JOIN (
SELECT TASK_MONTH, SUM(QTY) JJ_QTY, SUM(CASE WHEN RESULT = 'OK' THEN QTY ELSE 0 END) OK_QTY
FROM (
SELECT TO_CHAR(ZT.CREATED_DATE_TIME + 8/24, 'YYYYMM') TASK_MONTH, ZT.SFC, ZT.RESULT, SC.QTY,
ROW_NUMBER() OVER(PARTITION BY TO_CHAR(ZT.CREATED_DATE_TIME + 8/24, 'YYYYMM'),ZT.SFC, SC.QTY ORDER BY ZT.CREATED_DATE_TIME DESC) SEQ
FROM Z_INSPECTION_TASK ZT
INNER JOIN SFC SC ON ZT.SITE = SC.SITE AND SC.SFC = ZT.SFC
WHERE ZT.SITE = #{site} AND ZT.CATEGORY = 'P' AND ZT.STATUS = 'COMPLETE'
<if test="workCenter != null and workCenter != ''">
AND ZSD.WORK_CENTER = #{workCenter}
</if>
) WHERE SEQ = 1
GROUP BY TASK_MONTH
) P ON L.MONTHS = P.TASK_MONTH
ORDER BY L.MONTHS
</select>
<!--完工进度-->
<select id="scheduleOfCompletion" resultType="java.util.HashMap" parameterType="java.util.HashMap">
SELECT K.* ,
CASE WHEN K.RATE_NUM = 0 THEN (K.RATE_NUM + 67) || '%'
ELSE K.RATE_NUM || '%' END COMP_RATE
FROM (
SELECT
T.ITEM_NUMBER,
T.ITEM_DESC,
T.SHOP_ORDER,
T.PLANNED_COMP_DATE,
T.PLANNED_START_DATE,
CASE
WHEN SUM( T.CNT_HOURS)= 0 THEN 0
ELSE ROUND( SUM( T.CNT_HOURS)/ SUM( T.PROD_HOURS),2)* 100
END RATE_NUM
FROM
(
SELECT
CF.VALUE ITEM_NUMBER,
IT.DESCRIPTION ITEM_DESC,
SO.SHOP_ORDER,
SO.PLANNED_COMP_DATE,
SO.PLANNED_START_DATE,
ZSD.SFC,
ZSD.PROD_HOURS,
CASE
WHEN ZSD.ACTUAL_COMPLETE_DATE IS NOT NULL THEN ZSD.PROD_HOURS
WHEN ZSD.ACTUAL_COMPLETE_DATE IS NULL
AND ZSD.ACTUAL_START_DATE IS NOT NULL THEN 0
WHEN ZSD.ACTUAL_START_DATE IS NULL THEN 0
END CNT_HOURS
FROM
Z_SFC_DISPATCH ZSD
INNER JOIN SHOP_ORDER SO ON
SO.SHOP_ORDER = ZSD.SHOP_ORDER
INNER JOIN SFC S ON
S.SHOP_ORDER_BO = SO.HANDLE
INNER JOIN ITEM IM ON
IM.HANDLE = SO.ITEM_BO
LEFT JOIN ITEM_T IT ON
IT.ITEM_BO = IM.HANDLE
AND IT.LOCALE = 'zh'
LEFT JOIN CUSTOM_FIELDS CF ON
SO.HANDLE = CF.HANDLE
AND CF.ATTRIBUTE = 'ITEM_NUMBER'
LEFT JOIN CUSTOM_FIELDS CF1 ON
SO.HANDLE = CF1.HANDLE
AND CF1.ATTRIBUTE = 'FACTORY'
WHERE
ZSD.SITE = #{site} AND CF1.VALUE = '6106'
AND ZSD.DISPATCH_STATUS != 'CANCEL' AND TO_CHAR( SO.PLANNED_COMP_DATE + 8 / 24,'YYYY-MM')= TO_CHAR( SYSDATE,'YYYY-MM')
<if test="workCenter != null and workCenter != ''">
AND ZSD.WORK_CENTER = #{workCenter}
</if>
ORDER BY
ZSD.SHOP_ORDER,
ZSD.SFC
)T
GROUP BY
T.ITEM_NUMBER,
T.ITEM_DESC,
T.SHOP_ORDER,
T.PLANNED_COMP_DATE,
T.PLANNED_START_DATE
ORDER BY
T.PLANNED_COMP_DATE
) K
</select>
<!--异常待解决\异常已解决\异常正在处理-->
<select id="abnormalUnResolve" resultType="java.util.HashMap" parameterType="java.util.HashMap">
SELECT COUNT(1) "value" FROM Z_ABNORMAL_BILL ZB
WHERE SITE = #{site} AND TO_CHAR(ZB.CREATED_DATE_TIME + 8/24,'YYYY-MM') = TO_CHAR(SYSDATE,'YYYY-MM')
<if test="workCenter != null and workCenter != ''">
AND ZSD.WORK_CENTER = #{workCenter}
</if>
<if test="status != null and status != ''">
<choose>
<when test="status.contains('unResolve')">
AND STATUS = 'N'
</when>
<when test="status.contains('resolve')">
AND STATUS = 'G'
</when>
<when test="status.contains('dealing')">
AND STATUS NOT IN ('N', 'G', 'Q')
</when>
</choose>
</if>
</select>
<!--异常响应情况-->
<select id="abnormalContent" resultType="java.util.HashMap" parameterType="java.util.HashMap">
SELECT CONTENT
FROM (
SELECT ZM.CONTENT FROM Z_ABNORMAL_BILL ZB
INNER JOIN Z_MESSAGE ZM ON ZB.HANDLE = ZM.OBJECT_BO
WHERE ZB.SITE = '1000' AND ZB.STATUS = 'N'
AND TO_CHAR(ZB.CREATED_DATE_TIME + 8/24, 'YYYY-MM') = TO_CHAR(SYSDATE, 'YYYY-MM')
<if test="workCenter != null and workCenter != ''">
AND ZSD.WORK_CENTER = #{workCenter}
</if>
ORDER BY ZB.CREATED_DATE_TIME DESC
) WHERE ROWNUM &lt;= 30
</select>
<!--焊接车间-->
<select id="planDataFSW" resultType="java.util.HashMap" parameterType="java.util.HashMap">
SELECT SUM(ZSD.DISPATCH_QTY) "value" FROM Z_SFC_DISPATCH zsd
INNER JOIN OPERATION O ON O.OPERATION = ZSD.OPERATION
INNER JOIN OPERATION_T ot ON OT.OPERATION_BO = O.HANDLE AND OT.LOCALE = 'zh'
WHERE TO_CHAR(ZSD.PLANNED_COMP_DATE + 8/24 , 'YYYY-MM') = TO_CHAR(SYSDATE,'YYYY-MM')
AND ZSD.WORK_CENTER = 'HJ' AND ZSD.SITE = #{site}
<choose>
<when test="operationDescription != null and operationDescription != ''">
AND OT.DESCRIPTION != ('焊接' )
</when>
<otherwise>
AND OT.DESCRIPTION = ('焊接' )
</otherwise>
</choose>
</select>
<select id="completeDataFSW" resultType="java.util.HashMap" parameterType="java.util.HashMap">
SELECT SUM(ZSD.DISPATCH_QTY) "value" FROM Z_SFC_DISPATCH zsd
INNER JOIN OPERATION O ON O.OPERATION = ZSD.OPERATION
INNER JOIN OPERATION_T ot ON OT.OPERATION_BO = O.HANDLE AND OT.LOCALE = 'zh'
WHERE TO_CHAR(ZSD.PLANNED_COMP_DATE + 8/24 , 'YYYY-MM') = TO_CHAR(SYSDATE,'YYYY-MM')
AND ZSD.DISPATCH_STATUS IN ('COMPLETE','CANCEL')
AND ZSD.WORK_CENTER = 'HJ' AND ZSD.SITE = #{site}
<choose>
<when test="operationDescription != null and operationDescription != ''">
AND OT.DESCRIPTION != ('焊接' )
</when>
<otherwise>
AND OT.DESCRIPTION = ('焊接' )
</otherwise>
</choose>
AND ZSD.SHOP_ORDER IN (
SELECT SHOP_ORDER FROM SHOP_ORDER SO WHERE TO_CHAR(SO.PLANNED_COMP_DATE + 8/24 , 'YYYY-MM') = TO_CHAR(SYSDATE,'YYYY-MM')
)
</select>
<!--计划数、完成数-->
<select id="planAndCompleteDataFSW" resultType="java.util.HashMap" parameterType="java.util.HashMap">
SELECT A.CNT QTY_PLAN , B.CNT QTY_DONE , A.CNT - B.CNT QTY_HAND FROM
(
SELECT SUM(ZSD.DISPATCH_QTY) CNT FROM Z_SFC_DISPATCH zsd
INNER JOIN OPERATION O ON O.OPERATION = ZSD.OPERATION
INNER JOIN OPERATION_T ot ON OT.OPERATION_BO = O.HANDLE AND OT.LOCALE = 'zh'
WHERE TO_CHAR(ZSD.PLANNED_COMP_DATE + 8/24 , 'YYYY-MM') = TO_CHAR(SYSDATE,'YYYY-MM')
AND ZSD.WORK_CENTER = 'HJ' AND ZSD.SITE = #{site}
<choose>
<when test="operationDescription != null and operationDescription != ''">
AND OT.DESCRIPTION != ('焊接' )
</when>
<otherwise>
AND OT.DESCRIPTION = ('焊接' )
</otherwise>
</choose> ) A ,
(
SELECT SUM(ZSD.DISPATCH_QTY) CNT FROM Z_SFC_DISPATCH zsd
INNER JOIN OPERATION O ON O.OPERATION = ZSD.OPERATION
INNER JOIN OPERATION_T ot ON OT.OPERATION_BO = O.HANDLE AND OT.LOCALE = 'zh'
WHERE TO_CHAR(ZSD.PLANNED_COMP_DATE + 8/24 , 'YYYY-MM') = TO_CHAR(SYSDATE,'YYYY-MM')
AND ZSD.DISPATCH_STATUS IN ('COMPLETE','CANCEL')
AND ZSD.WORK_CENTER = 'HJ' AND ZSD.SITE = #{site}
<choose>
<when test="operationDescription != null and operationDescription != ''">
AND OT.DESCRIPTION != ('焊接' )
</when>
<otherwise>
AND OT.DESCRIPTION = ('焊接' )
</otherwise>
</choose>
AND ZSD.SHOP_ORDER IN (
SELECT SHOP_ORDER FROM SHOP_ORDER SO WHERE TO_CHAR(SO.PLANNED_COMP_DATE + 8/24 , 'YYYY-MM') = TO_CHAR(SYSDATE,'YYYY-MM') ) ) B
</select>
</mapper>

@ -666,4 +666,42 @@
GROUP BY "MONTH","SECTION"
ORDER BY "SECTION","MONTH"
</select>
<select id="selectItemMoveData" resultType="java.util.HashMap" parameterType="java.util.HashMap">
WITH TEMP AS (SELECT MAX(ZSD.HANDLE) HANDLE FROM Z_SFC_DISPATCH ZSD
WHERE ZSD.SITE = #{site} AND ZSD.OTHER_2 IS NOT NULL
GROUP BY ZSD.SFC )
SELECT ZSD.SHOP_ORDER ,ZSD.SFC , CF.VALUE WORK_ORDER , I.ITEM , IT.DESCRIPTION ITEM_DESCRIPTION ,
ZSD.BLANKING_SIZE , ZSD.DISPATCH_QTY , ZSD.OPERATION , OT.DESCRIPTION OPERATION_DESCRIPTION , ZSD.EMPLOYEE_DESCRIPTION ,
ZSD.OTHER_2 , ZSD.OTHER_3 , ZSD.HANDLE , ZSD.BLANKING_SIZE
FROM Z_SFC_DISPATCH ZSD
LEFT JOIN SHOP_ORDER SO ON SO.SHOP_ORDER = ZSD.SHOP_ORDER
LEFT JOIN CUSTOM_FIELDS CF ON CF.HANDLE = SO.HANDLE AND CF."ATTRIBUTE" = 'WORK_ORDER'
LEFT JOIN OPERATION O ON O.OPERATION = ZSD.OPERATION
LEFT JOIN OPERATION_T OT ON OT.OPERATION_BO = O.HANDLE
LEFT JOIN ITEM_T IT ON IT.ITEM_BO = SO.ITEM_BO
LEFT JOIN ITEM I ON I.HANDLE = SO.ITEM_BO
INNER JOIN TEMP ON TEMP.HANDLE = ZSD.HANDLE
WHERE ZSD.SITE = #{site}
<if test="other2 != null and other2 != ''">
AND ZSD.OTHER_2 = #{other2}
</if>
<if test="other3 != null and other3 != ''">
AND ZSD.OTHER_3 = #{other3}
</if>
<if test="operation != null and operation != ''">
AND ZSD.OPERATION = #{operation}
</if>
<if test="workCenter != null and workCenter != ''">
AND ZSD.WORK_CENTER = #{workCenter}
</if>
</select>
<update id="doItemMove">
UPDATE Z_SFC_DISPATCH ZSD SET ZSD.OTHER_3 = 'true' WHERE ZSD.HANDLE IN
<foreach item="handle" collection="array" separator="," open="(" close=")" index="">
#{handle}
</foreach>
AND ZSD.SITE = #{site}
</update>
</mapper>
Loading…
Cancel
Save