拆分派工加参数,报表

master
philip 3 years ago
parent 37a42e3ed5
commit 5bc909d374

@ -89,5 +89,32 @@ public class ReportDataController {
return R.failed(e.getMessage()); return R.failed(e.getMessage());
} }
} }
/**
*
*
* @param paramMap
* @return
*/
@GetMapping("/workShopPassRate")
public R findWorkShopPassRate(@RequestParam(required = false) Map paramMap) {
try {
paramMap.put("site", CommonMethods.getSite());
List<Map<String, Object>> result = reportDataService.findWorkShopPassRate(paramMap);
return R.ok(result);
} catch (Exception e) {
return R.failed(e.getMessage());
}
}
@GetMapping("/checkUserPassRate")
public R findCheckUserPassRate(@RequestParam(required = false) Map paramMap) {
try {
paramMap.put("site", CommonMethods.getSite());
List<Map<String, Object>> result = reportDataService.findCheckUserPassRate(paramMap);
return R.ok(result);
} catch (Exception e) {
return R.failed(e.getMessage());
}
}
} }

@ -17,5 +17,8 @@ public interface ReportDataMapper {
List<Map<String, Object>> findProductStateInfo(Map paramMap); List<Map<String, Object>> findProductStateInfo(Map paramMap);
List<Map<String, Object>> findWorkShopPassRate(Map paramMap);
List<Map<String, Object>> findCheckUserPassRate(Map paramMap);
} }

@ -34,4 +34,9 @@ public interface ReportDataService {
*/ */
List<Map<String, Object>> findProductStateInfo(Map paramMap); List<Map<String, Object>> findProductStateInfo(Map paramMap);
List<Map<String, Object>> findWorkShopPassRate(Map paramMap);
List<Map<String, Object>> findCheckUserPassRate(Map paramMap);
} }

@ -15,7 +15,6 @@ public interface SfcDispatchCommonService {
/** /**
* *
*
* @param site * @param site
* @param user * @param user
* @param category N|; R| * @param category N|; R|
@ -25,8 +24,9 @@ public interface SfcDispatchCommonService {
* @param stepId * @param stepId
* @param splitSfc * @param splitSfc
* @param routerBo * @param routerBo
* @param stepSequence
*/ */
void saveSplitSfcDispatch(String site, String user, String category, String shopOrder, String sfc, String operation, String stepId, String splitSfc, String routerBo); void saveSplitSfcDispatch(String site, String user, String category, String shopOrder, String sfc, String operation, String stepId, String splitSfc, String routerBo, String stepSequence);
/** /**
* *

@ -35,4 +35,14 @@ public class ReportDataServiceImpl implements ReportDataService{
public List<Map<String, Object>> findProductStateInfo(Map paramMap) { public List<Map<String, Object>> findProductStateInfo(Map paramMap) {
return reportDataMapper.findProductStateInfo(paramMap); return reportDataMapper.findProductStateInfo(paramMap);
} }
@Override
public List<Map<String, Object>> findWorkShopPassRate(Map paramMap) {
return reportDataMapper.findWorkShopPassRate(paramMap);
}
@Override
public List<Map<String, Object>> findCheckUserPassRate(Map paramMap) {
return reportDataMapper.findCheckUserPassRate(paramMap);
}
} }

@ -631,7 +631,7 @@
</delete> </delete>
<!-- BaseMapper标准查询/修改/删除 --> <!-- BaseMapper标准查询/修改/删除 -->
<select id="getTaskList" resultMap="BaseResultMap"> <select id="getTaskList" resultMap="BaseResultMap">
SELECT zsd.PROD_HOURS,S.QTY,c3.value TEXTURE,c4.value MAT_SPEC,zsd.BLANKING_SIZE,PREZSD.EMPLOYEE_DESCRIPTION,CASE WHEN TO_NUMBER(zsd.DISPATCH_SEQ)=1 THEN NULL SELECT zsd.PROD_HOURS,S.QTY,CF.TEXTURE,CF.MAT_SPEC,zsd.BLANKING_SIZE,PREZSD.EMPLOYEE_DESCRIPTION,CASE WHEN TO_NUMBER(zsd.DISPATCH_SEQ)=1 THEN NULL
WHEN SS.STEP_SEQUENCE>TO_NUMBER(zsd.DISPATCH_SEQ)-1 THEN '完成' WHEN SS.STEP_SEQUENCE>TO_NUMBER(zsd.DISPATCH_SEQ)-1 THEN '完成'
ELSE '未完成' END LAST_OPERATION_STATUS ELSE '未完成' END LAST_OPERATION_STATUS
,PREOT.DESCRIPTION LAST_OPERATION,zprt.*,zsd.DISPATCH_NO,zsd.RESOURCE_TYPE,RES.DESCRIPTION RESRCE_DESC,ITT.DESCRIPTION ITEM_DESC,OT.DESCRIPTION OPERATION_DESC ,PREOT.DESCRIPTION LAST_OPERATION,zprt.*,zsd.DISPATCH_NO,zsd.RESOURCE_TYPE,RES.DESCRIPTION RESRCE_DESC,ITT.DESCRIPTION ITEM_DESC,OT.DESCRIPTION OPERATION_DESC
@ -645,13 +645,24 @@
LEFT JOIN OPERATION PREOP ON PREOP.OPERATION = zsd.PREPOSITION_OPERATION AND OP.SITE = zprt.SITE AND OP.CURRENT_REVISION = 'true' LEFT JOIN OPERATION PREOP ON PREOP.OPERATION = zsd.PREPOSITION_OPERATION AND OP.SITE = zprt.SITE AND OP.CURRENT_REVISION = 'true'
LEFT JOIN OPERATION_T PREOT ON PREOT.OPERATION_BO = PREOP.HANDLE AND OT.LOCALE =#{locale} LEFT JOIN OPERATION_T PREOT ON PREOT.OPERATION_BO = PREOP.HANDLE AND OT.LOCALE =#{locale}
LEFT JOIN ITEM_T ITT ON ITT.ITEM_BO = I.HANDLE AND ITT.LOCALE =#{locale} LEFT JOIN ITEM_T ITT ON ITT.ITEM_BO = I.HANDLE AND ITT.LOCALE =#{locale}
LEFT JOIN CUSTOM_FIELDS C3 ON C3.HANDLE = I.HANDLE AND C3.ATTRIBUTE = 'TEXTTURE'
LEFT JOIN CUSTOM_FIELDS C4 ON C4.HANDLE = I.HANDLE AND C4.ATTRIBUTE = 'MAT_SPEC'
JOIN RESRCE RES ON RES.RESRCE = zprt.RESRCE AND RES.SITE = zprt.SITE JOIN RESRCE RES ON RES.RESRCE = zprt.RESRCE AND RES.SITE = zprt.SITE
JOIN SFC S ON S.SFC=ZSD.SFC AND S.SITE=ZSD.SITE JOIN SFC S ON S.SFC=ZSD.SFC AND S.SITE=ZSD.SITE
JOIN SFC_ROUTING SR ON SR.SFC_BO=S.HANDLE JOIN SFC_ROUTING SR ON SR.SFC_BO=S.HANDLE
JOIN SFC_ROUTER SR2 ON SR.HANDLE =SR2.SFC_ROUTING_BO AND SR2.IN_USE = 'true' JOIN SFC_ROUTER SR2 ON SR.HANDLE =SR2.SFC_ROUTING_BO AND SR2.IN_USE = 'true'
LEFT JOIN SFC_STEP SS ON SR2.HANDLE =SS.SFC_ROUTER_BO AND (SS.QTY_IN_QUEUE>0 or SS.QTY_IN_WORK>0) LEFT JOIN SFC_STEP SS ON SR2.HANDLE =SS.SFC_ROUTER_BO AND (SS.QTY_IN_QUEUE>0 or SS.QTY_IN_WORK>0)
LEFT JOIN (
SELECT zprt.HANDLE,C3.VALUE TEXTURE,c4.VALUE MAT_SPEC, ROW_NUMBER() OVER(PARTITION BY zprt.HANDLE ORDER BY C3.VALUE,c4.VALUE ) SEQ
FROM Z_PROD_READY_TASK zprt
JOIN SFC S ON ZPRT.SFC=S.SFC AND s.SITE=ZPRT.SITE
JOIN SFC_BOM SB ON S.HANDLE=SB.SFC_BO
JOIN BOM_COMPONENT BC ON BC.BOM_BO = SB.BOM_BO
LEFT JOIN ITEM CP ON CP.HANDLE = BC.COMPONENT_GBO
LEFT JOIN ITEM_T CT ON CT.ITEM_BO = CP.HANDLE AND CT.LOCALE = 'zh'
LEFT JOIN CUSTOM_FIELDS C3 ON C3.HANDLE = CP.HANDLE AND C3.ATTRIBUTE = 'TEXTTURE'
LEFT JOIN CUSTOM_FIELDS C4 ON C4.HANDLE = CP.HANDLE AND C4.ATTRIBUTE = 'MAT_SPEC'
<if test="entity.matSpec!=null and entity.matSpec!='' "> AND C4.VALUE =#{entity.matSpec} </if>
<if test="entity.texture!=null and entity.texture!='' "> AND C3.VALUE LIKE '%${entity.texture}%'</if>
) CF on CF.HANDLE=zprt.HANDLE AND CF.SEQ='1'
WHERE ZPRT.SITE=#{entity.site} WHERE ZPRT.SITE=#{entity.site}
<if test="admin == 0"> AND ZSD.EMPLOYEE LIKE '%${user}%' </if> <if test="admin == 0"> AND ZSD.EMPLOYEE LIKE '%${user}%' </if>
<if test="entity.workCenter!=null and entity.workCenter!='' "> AND ZPRT.WORK_CENTER=#{entity.workCenter}</if> <if test="entity.workCenter!=null and entity.workCenter!='' "> AND ZPRT.WORK_CENTER=#{entity.workCenter}</if>
@ -667,8 +678,6 @@
<if test="entity.shopOrder!=null and entity.shopOrder!='' "> AND ZPRT.SHOP_ORDER=#{entity.shopOrder}</if> <if test="entity.shopOrder!=null and entity.shopOrder!='' "> AND ZPRT.SHOP_ORDER=#{entity.shopOrder}</if>
<if test="entity.item!=null and entity.item!='' "> AND ZPRT.ITEM=#{entity.item}</if> <if test="entity.item!=null and entity.item!='' "> AND ZPRT.ITEM=#{entity.item}</if>
<if test="entity.blankingSize!=null and entity.blankingSize!='' "> AND zsd.BLANKING_SIZE LIKE '%${entity.blankingSize}%'</if> <if test="entity.blankingSize!=null and entity.blankingSize!='' "> AND zsd.BLANKING_SIZE LIKE '%${entity.blankingSize}%'</if>
<if test="entity.matSpec!=null and entity.matSpec!='' "> AND C4.VALUE LIKE '%${entity.matSpec}%'</if>
<if test="entity.texture!=null and entity.texture!='' "> AND C3.VALUE LIKE '%${entity.texture}%'</if>
<if test="entity.planStartDate!=null and entity.planStartDate!='' "> AND TO_CHAR(ZSD.PLANNED_START_DATE,'YYYY-MM-DD')=#{entity.planStartDate}</if> <if test="entity.planStartDate!=null and entity.planStartDate!='' "> AND TO_CHAR(ZSD.PLANNED_START_DATE,'YYYY-MM-DD')=#{entity.planStartDate}</if>
ORDER BY zprt.CREATED_DATE_TIME DESC ORDER BY zprt.CREATED_DATE_TIME DESC
</select> </select>

@ -64,4 +64,63 @@
</select> </select>
<select id="findWorkShopPassRate" resultType="java.util.HashMap" parameterType="java.util.HashMap">
SELECT DESCRIPTION WORK_CENTER_DESCRIPTION, "MONTH",sum(NG_QTY) NC_QTY, sum(OK_QTY) OK_QTY,sum(CHECK_QTY) CHECK_QTY,round(sum(OK_QTY)*100/sum(DISPATCH_QTY),2)||'% ' OK_RATE FROM
(
SELECT CASE WHEN ROW_NUMBER() OVER(PARTITION BY zit.sfc ,zit.OPERATION,zit.STEP_ID ORDER BY zit.CREATED_DATE_TIME DESC)=1 AND zit."RESULT"='OK' THEN 0
WHEN ROW_NUMBER() OVER(PARTITION BY zit.sfc ,zit.OPERATION,zit.STEP_ID ORDER BY zit.CREATED_DATE_TIME DESC)=1 AND zit."RESULT"='NG' THEN TO_NUMBER(zab.NC_QTY)
ELSE 0 END NG_QTY , TO_CHAR(zit.CREATED_DATE_TIME,'YYYY-MM') "MONTH",
CASE WHEN ROW_NUMBER() OVER(PARTITION BY zit.sfc ,zit.OPERATION,zit.STEP_ID ORDER BY zit.CREATED_DATE_TIME DESC)=1 AND zit."RESULT"='OK' THEN zsd.DISPATCH_QTY
WHEN ROW_NUMBER() OVER(PARTITION BY zit.sfc ,zit.OPERATION,zit.STEP_ID ORDER BY zit.CREATED_DATE_TIME DESC)=1 AND zit."RESULT"='NG' THEN 0
ELSE 0 END OK_QTY
,ZSD.DISPATCH_QTY, WT.DESCRIPTION,
ROW_NUMBER() OVER(PARTITION BY zit.sfc ,zit.OPERATION,zit.STEP_ID ORDER BY zit.CREATED_DATE_TIME DESC) seq,
zit."RESULT",COUNT(ZIT.HANDLE) check_qty, zit.sfc ,zit.OPERATION,zit.STEP_ID FROM Z_INSPECTION_TASK zit
JOIN sfc S ON S.SFC=zit.SFC AND s.SITE=zit.SITE
JOIN Z_SFC_DISPATCH ZSD ON ZSD.SFC=zit.SFC AND ZSD.SITE=zit.SITE AND zit.STEP_ID=ZSD.STEP_ID
JOIN WORK_CENTER WC ON WC.SITE = zit.SITE AND WC.WORK_CENTER = zit.WORK_CENTER
LEFT JOIN WORK_CENTER_T WT ON WT.WORK_CENTER_BO = WC.HANDLE AND WT.LOCALE = 'zh'
LEFT JOIN Z_ABNORMAL_BILL ZAB ON zit.SFC=ZAB.SFC AND zit.SITE=ZAB.SITE AND zit.STEP_ID=ZAB.STEP_ID AND zab."TYPE"='Z'
WHERE zit.SITE= #{site} AND zit.CATEGORY='P' AND zit.STATUS='COMPLETE'
<if test="workCenter != null and workCenter != ''" >
AND zit.WORK_CENTER = #{workCenter}
</if>
<if test="startFromDate != null and startFromDate != ''" >
AND TO_CHAR(zit.CREATED_DATE_TIME,'YYYY-MM') >=#{startFromDate}
</if>
<if test="startToDate != null and startToDate != ''" >
AND TO_CHAR(zit.CREATED_DATE_TIME,'YYYY-MM') &lt;= #{startToDate}
</if>
GROUP BY zit."RESULT",zit.sfc ,zit.OPERATION,zit.STEP_ID, zit.CREATED_DATE_TIME,zit.RESRCE,zab.NC_QTY, WT.DESCRIPTION,ZSD.DISPATCH_QTY
) GROUP BY DESCRIPTION, "MONTH"
</select>
<select id="findCheckUserPassRate" resultType="java.util.HashMap" parameterType="java.util.HashMap">
SELECT DESCRIPTION WORK_CENTER_DESCRIPTION, FULL_NAME,"MONTH",sum(NG_QTY) NC_QTY, sum(CHECK_QTY) CHECK_QTY FROM
(
SELECT CASE WHEN ROW_NUMBER() OVER(PARTITION BY zit.sfc ,zit.OPERATION,zit.STEP_ID ORDER BY zit.CREATED_DATE_TIME DESC)=1 AND zit."RESULT"='OK' THEN 0
WHEN ROW_NUMBER() OVER(PARTITION BY zit.sfc ,zit.OPERATION,zit.STEP_ID ORDER BY zit.CREATED_DATE_TIME DESC)=1 AND zit."RESULT"='NG' THEN TO_NUMBER(zab.NC_QTY)
ELSE 0 END NG_QTY , TO_CHAR(zit.CREATED_DATE_TIME,'YYYY-MM') "MONTH"
, WT.DESCRIPTION,ZNU.FULL_NAME,
ROW_NUMBER() OVER(PARTITION BY zit.sfc ,zit.OPERATION,zit.STEP_ID ORDER BY zit.CREATED_DATE_TIME DESC) seq,
zit."RESULT",COUNT(ZIT.HANDLE) check_qty, zit.sfc ,zit.OPERATION,zit.STEP_ID FROM Z_INSPECTION_TASK zit
JOIN sfc S ON S.SFC=zit.SFC AND s.SITE=zit.SITE
JOIN Z_SFC_DISPATCH ZSD ON ZSD.SFC=zit.SFC AND ZSD.SITE=zit.SITE AND zit.STEP_ID=ZSD.STEP_ID
JOIN WORK_CENTER WC ON WC.SITE = zit.SITE AND WC.WORK_CENTER = zit.WORK_CENTER
LEFT JOIN WORK_CENTER_T WT ON WT.WORK_CENTER_BO = WC.HANDLE AND WT.LOCALE = 'zh'
LEFT JOIN Z_ABNORMAL_BILL ZAB ON zit.SFC=ZAB.SFC AND zit.SITE=ZAB.SITE AND zit.STEP_ID=ZAB.STEP_ID AND zab."TYPE"='Z'
LEFT JOIN Z_NWA_USER ZNU ON ZNU.SITE = ZIT.SITE AND ZNU.USER_NAME = ZIT.MODIFY_USER
WHERE zit.SITE= #{site} AND zit.CATEGORY='P' AND zit.STATUS='COMPLETE'
<if test="workCenter != null and workCenter != ''" >
AND zit.WORK_CENTER = #{workCenter}
</if>
<if test="startFromDate != null and startFromDate != ''" >
AND TO_CHAR(zit.CREATED_DATE_TIME,'YYYY-MM') >=#{startFromDate}
</if>
<if test="startToDate != null and startToDate != ''" >
AND TO_CHAR(zit.CREATED_DATE_TIME,'YYYY-MM') &lt;= #{startToDate}
</if>
GROUP BY zit."RESULT",zit.sfc ,zit.OPERATION,zit.STEP_ID, zit.CREATED_DATE_TIME,zit.RESRCE,zab.NC_QTY, ZNU.FULL_NAME,WT.DESCRIPTION
) GROUP BY DESCRIPTION, "MONTH",FULL_NAME
</select>
</mapper> </mapper>

@ -602,7 +602,7 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
@Override @Override
public void saveSplitSfcDispatch(String site, String user, String category, String shopOrder, String sfc, String operation, String stepId, String splitSfc, String routerBo) { public void saveSplitSfcDispatch(String site, String user, String category, String shopOrder, String sfc, String operation, String stepId, String splitSfc, String routerBo, String stepSequence) {
LocalDateTime nowDate = LocalDateTime.now(); LocalDateTime nowDate = LocalDateTime.now();
//查询工单信息 //查询工单信息

@ -18,11 +18,20 @@ public class SfcDto extends Sfc {
private String stepId; private String stepId;
private String plannedStartDate; private String plannedStartDate;
private String plannedCompDate; private String plannedCompDate;
private String stepSequence;
//工作令号 //工作令号
private String workOrder; private String workOrder;
private String employeeDescription; private String employeeDescription;
private String lastOperationStatus; private String lastOperationStatus;
public String getStepSequence() {
return stepSequence;
}
public void setStepSequence(String stepSequence) {
this.stepSequence = stepSequence;
}
public String getEmployeeDescription() { public String getEmployeeDescription() {
return employeeDescription; return employeeDescription;
} }

@ -162,7 +162,7 @@ public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> i
splitSfc.setCreatedDateTime(LocalDateTime.now()); splitSfc.setCreatedDateTime(LocalDateTime.now());
save(splitSfc); save(splitSfc);
Router routerBySfcBo = routerService.getRouterBySfcBo(HandleEnum.SFC.getHandle(site, sfc)); Router routerBySfcBo = routerService.getRouterBySfcBo(HandleEnum.SFC.getHandle(site, sfc));
sfcDispatchCommonService.saveSplitSfcDispatch(site, CommonMethods.getUser(), "N", sfcData.getShopOrder(), sfc, operation, sfcData.getStepId(),newSfc, routerBySfcBo.getHandle()); sfcDispatchCommonService.saveSplitSfcDispatch(site, CommonMethods.getUser(), "N", sfcData.getShopOrder(), sfc, operation, sfcData.getStepId(),newSfc, routerBySfcBo.getHandle(),sfcData.getStepSequence());
return splitSfc; return splitSfc;
} catch (Exception e) { } catch (Exception e) {
ExceptionUtil.throwException(e); ExceptionUtil.throwException(e);
@ -259,7 +259,7 @@ public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> i
if (routerOperationByRouterBo.isEmpty()){ if (routerOperationByRouterBo.isEmpty()){
throw new BaseException("处置工艺路线没有步骤"); throw new BaseException("处置工艺路线没有步骤");
} }
sfcDispatchCommonService.saveSplitSfcDispatch(site, CommonMethods.getUser(),"R", sfcData.getShopOrder(), sfc, operation, sfcDispatchBySfc.getStepId(),newSfc, maxRevisionRouter.getHandle()); sfcDispatchCommonService.saveSplitSfcDispatch(site, CommonMethods.getUser(),"R", sfcData.getShopOrder(), sfc, operation, sfcDispatchBySfc.getStepId(),newSfc, maxRevisionRouter.getHandle(), sfcData.getStepSequence());
} }
SplitSfc splitSfc=new SplitSfc(); SplitSfc splitSfc=new SplitSfc();
splitSfc.setHandle(HandleEnum.SPLIT_SFC.getHandle(site,newSfc)); splitSfc.setHandle(HandleEnum.SPLIT_SFC.getHandle(site,newSfc));

@ -367,7 +367,7 @@
</delete> </delete>
<!-- BaseMapper标准查询/修改/删除 --> <!-- BaseMapper标准查询/修改/删除 -->
<select id="getSfcData" resultType="com.foreverwin.mesnac.meapi.dto.SfcDto"> <select id="getSfcData" resultType="com.foreverwin.mesnac.meapi.dto.SfcDto">
SELECT SO.SHOP_ORDER,cf.VALUE WORK_ORDER,OP.OPERATION,ss.STEP_ID,s.QTY,ST.STATUS FROM SFC S SELECT SO.SHOP_ORDER,cf.VALUE WORK_ORDER,OP.OPERATION,ss.STEP_ID,s.QTY,ST.STATUS,STEP_SEQUENCE FROM SFC S
JOIN SHOP_ORDER SO ON so.HANDLE=S.SHOP_ORDER_BO JOIN SHOP_ORDER SO ON so.HANDLE=S.SHOP_ORDER_BO
JOIN STATUS ST ON ST.HANDLE = S.STATUS_BO JOIN STATUS ST ON ST.HANDLE = S.STATUS_BO
LEFT JOIN CUSTOM_FIELDS CF ON cf.HANDLE=s.SHOP_ORDER_BO AND CF."ATTRIBUTE"='WORK_ORDER' LEFT JOIN CUSTOM_FIELDS CF ON cf.HANDLE=s.SHOP_ORDER_BO AND CF."ATTRIBUTE"='WORK_ORDER'

Loading…
Cancel
Save