问题清单 295、296

master
赵嘉伟 3 years ago
parent ffad2d9f34
commit b4e8404ef5

@ -46,7 +46,15 @@
CASE WHEN S2.STATUS = '405' THEN '是' ELSE '否' END DISPATCH_STATUS,
ZSD.EARLIEST_START_DATE EARLIEST_START_DATE,ZSD.LATEST_END_DATE LATEST_END_DATE,
ZSD.ACTUAL_START_DATE ACTUAL_START_DATE,ZSD.ACTUAL_COMPLETE_DATE ACTUAL_COMPLETE_DATE,
CF2.VALUE WORK_ORDER,OT2.DESCRIPTION CURRENT_OPERATION_DESCRIPTION,O2.OPERATION CURRENT_OPERATION
CF2.VALUE WORK_ORDER,OT2.DESCRIPTION CURRENT_OPERATION_DESCRIPTION,O2.OPERATION CURRENT_OPERATION,
CASE WHEN zsd.DISPATCH_STATUS = 'NEW' THEN '新建'
WHEN zsd.DISPATCH_STATUS = 'RELEASE' THEN '发布'
WHEN zsd.DISPATCH_STATUS = 'PAUSE' THEN '暂挂'
WHEN zsd.DISPATCH_STATUS = 'START' ThEN '已开始'
WHEN zsd.DISPATCH_STATUS = 'COMPLETE' THEN '已完成'
WHEN zsd.DISPATCH_STATUS = 'CANCEL' THEN '已取消'
ELSE ''
END OPERATION_STATUS
FROM SFC S
LEFT JOIN SFC_ROUTING SR ON SR.SFC_BO = S.HANDLE
LEFT JOIN SFC_ROUTER ST ON ST.SFC_ROUTING_BO = SR.HANDLE AND ST.IN_USE = 'true'
@ -121,6 +129,7 @@
</if>
</if>
</where>
order by S.SFC DESC
</select>
<select id="surplusReturnTable" resultType="java.util.HashMap">
@ -472,71 +481,84 @@
</select>
<select id="shopOrderSchedule" parameterType="java.util.HashMap" resultType="java.util.HashMap">
SELECT ROWNUM SEQ,wct.DESCRIPTION WORK_CENTER_DESCRIPTION,cf.VALUE ITEM_NUMBER,
COALESCE(dflt.DATA_TAG,cf2.VALUE) PRODUCT_CATEGORY,
zsd.SHOP_ORDER,it.DESCRIPTION ITEM_DESCRIPTION,zsd.PLANNED_START_DATE,zsd.PLANNED_START_DATE PREDICT_COMP_DATE,
zsd.PLANNED_COMP_DATE ,zsd.ACTUAL_START_DATE ,zsd.ACTUAL_COMPLETE_DATE,ot.DESCRIPTION CURRENT_OPERATION_DESCRIPTION,
ot2.DESCRIPTION OPERATION_DESCRIPTION,
CASE WHEN zab.HANDLE IS NOT NULL THEN '是'
ELSE '否'
END IS_ANOMALY,
CASE WHEN zsd.PLANNED_COMP_DATE IS NOT NULL AND zsd.ACTUAL_COMPLETE_DATE IS NULL THEN TO_CHAR(TO_NUMBER(zsd.PLANNED_COMP_DATE + 8/24 - SYSDATE),'FM9999990.000')
ELSE ''
END SURPLUS_DAY,
CASE WHEN zsd.ACTUAL_START_DATE IS NOT NULL AND cf3.VALUE IS NOT NULL AND cf3.VALUE != 0 AND zsd.ACTUAL_COMPLETE_DATE IS NULL
THEN ROUND(TO_NUMBER(SYSDATE - (zsd.ACTUAL_START_DATE+8/24))*24/TO_NUMBER(cf3.VALUE),2)*100 || '%'
WHEN zsd.ACTUAL_START_DATE IS NOT NULL AND cf3.VALUE IS NOT NULL AND cf3.VALUE != 0 AND zsd.ACTUAL_COMPLETE_DATE IS NOT NULL
THEN ROUND(TO_NUMBER((zsd.ACTUAL_COMPLETE_DATE+8/24) - (zsd.ACTUAL_START_DATE+8/24))*24/TO_NUMBER(cf3.VALUE),2)*100 || '%'
ELSE ''
END PROCESS_HOURS
FROM Z_SFC_DISPATCH zsd
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'
LEFT JOIN SHOP_ORDER so ON so.SHOP_ORDER = zsd.SHOP_ORDER AND so.SITE = zsd.SITE
LEFT JOIN CUSTOM_FIELDS cf ON cf.HANDLE = so.HANDLE AND cf."ATTRIBUTE" = 'ITEM_NUMBER'
LEFT JOIN CUSTOM_FIELDS cf2 ON cf2.HANDLE = so.HANDLE AND cf2."ATTRIBUTE" = 'PRODUCT_CATEGORY'
LEFT JOIN ITEM i On i.HANDLE = so.ITEM_BO
LEFT JOIN ITEM_T it ON it.ITEM_BO = so.ITEM_BO
LEFT JOIN RESRCE r ON r.RESRCE = zsd.RESRCE AND r.SITE = zsd.SITE
LEFT JOIN SFC s ON s.SFC = zsd.SFC AND s.SITE = zsd.SITE
LEFT JOIN SFC_ROUTING sr ON sr.SFC_BO = s.HANDLE
LEFT JOIN SFC_ROUTER st ON st.SFC_ROUTING_BO = sr.HANDLE AND st.IN_USE = 'true'
LEFT JOIN SFC_STEP ss ON ss.SFC_ROUTER_BO = st.HANDLE AND (ss.QTY_IN_QUEUE > 0 OR ss.QTY_IN_WORK > 0)
LEFT JOIN OPERATION o ON o.OPERATION = SUBSTR(SS.OPERATION_BO,INSTR(SS.OPERATION_BO,',',1,1)+1,INSTR(SS.OPERATION_BO,',',1,2) - INSTR(SS.OPERATION_BO,',') -1) AND o.SITE = zsd.SITE
LEFT JOIN OPERATION_T ot ON ot.OPERATION_BO = o.HANDLE AND ot.LOCALE = 'zh'
LEFT JOIN OPERATION o2 ON o2.OPERATION = zsd.OPERATION AND o2.SITE = zsd.SITE
LEFT JOIN OPERATION_T ot2 ON ot2.OPERATION_BO = o2.HANDLE AND ot2.LOCALE = 'zh'
LEFT JOIN Z_ABNORMAL_BILL zab ON zab.SFC = zsd.SFC AND zab.OPERATION = zsd.OPERATION AND zab.SITE = zsd.SITE
LEFT JOIN ROUTER_STEP rs ON zsd.ROUTER_BO = rs.ROUTER_BO AND rs.STEP_ID = zsd.STEP_ID
LEFT JOIN ROUTER_OPERATION ro ON ro.ROUTER_STEP_BO = rs.HANDLE AND ro.OPERATION_BO = ss.OPERATION_BO
LEFT JOIN CUSTOM_FIELDS cf3 ON cf3.HANDLE = ro.HANDLE AND cf3."ATTRIBUTE" = 'PROD_TIME'
INNER JOIN DATA_FIELD df ON df.DATA_FIELD = 'PRODUCT_CATEGORY'
LEFT JOIN DATA_FIELD_LIST dfl ON dfl.DATA_FIELD_BO = df.HANDLE AND dfl.DATA_VALUE = zab.PRODUCT_CATEGORY
LEFT JOIN DATA_FIELD_LIST_T dflt ON dflt.DATA_FIELD_LIST_BO = dfl.HANDLE AND dflt.LOCALE = #{locale}
<where>
zsd.SITE = #{site}
<if test="workCenter != null and workCenter != ''">
AND (wc.WORK_CENTER = #{workCenter} OR wct.DESCRIPTION = #{workCenter})
</if>
<if test="itemNumber != null and itemNumber != ''">
AND cf.VALUE = #{itemNumber}
</if>
<if test="productCategory != null and productCategory != ''">
AND (dflt.DATA_TAG = #{productCategory} OR
zab.PRODUCT_CATEGORY = #{productCategory} OR
cf2.VALUE = #{productCategory}
)
</if>
<if test="shopOrder != null and shopOrder != ''">
AND so.SHOP_ORDER LIKE '%${shopOrder}%'
</if>
<if test="startDateTime != null and startDateTime != ''">
AND zsd.PLANNED_COMP_DATE &gt;= TO_DATE(#{startDateTime},'YYYY-MM-DD')-8/24
</if>
<if test="endDateTime != null and endDateTime != ''">
AND zsd.PLANNED_COMP_DATE &lt;= TO_DATE(#{endDateTime}|| '15:59:59','YYYY-MM-DD HH24:MI:SS')
</if>
</where>
ORDER BY zsd.SFC,zsd.STEP_ID
SELECT ROWNUM SEQ,S.* FROM (
SELECT wct.DESCRIPTION WORK_CENTER_DESCRIPTION,cf.VALUE ITEM_NUMBER,
COALESCE(dflt.DATA_TAG,cf2.VALUE) PRODUCT_CATEGORY,
zsd.SHOP_ORDER,it.DESCRIPTION ITEM_DESCRIPTION,zsd.PLANNED_START_DATE,zsd.PLANNED_START_DATE PREDICT_COMP_DATE,
zsd.PLANNED_COMP_DATE ,zsd.ACTUAL_START_DATE ,zsd.ACTUAL_COMPLETE_DATE,
CASE WHEN zsd.DISPATCH_STATUS = 'NEW' THEN '新建'
WHEN zsd.DISPATCH_STATUS = 'RELEASE' THEN '发布'
WHEN zsd.DISPATCH_STATUS = 'PAUSE' THEN '暂挂'
WHEN zsd.DISPATCH_STATUS = 'START' ThEN '已开始'
WHEN zsd.DISPATCH_STATUS = 'COMPLETE' THEN '已完成'
WHEN zsd.DISPATCH_STATUS = 'CANCEL' THEN '已取消'
ELSE ''
END DISPATCH_STATUS,
ot.DESCRIPTION CURRENT_OPERATION_DESCRIPTION,
-- CASE WHEN ss.STEP_ID = zsd.STEP_ID AND zsd.DISPATCH_STATUS != 'START' AND o.OPERATION = zsd.OPERATION THEN ''
-- ELSE ot.DESCRIPTION
-- END CURRENT_OPERATION_DESCRIPTION,
ot2.DESCRIPTION OPERATION_DESCRIPTION,
CASE WHEN zab.HANDLE IS NOT NULL THEN '是'
ELSE '否'
END IS_ANOMALY,
CASE WHEN zsd.PLANNED_COMP_DATE IS NOT NULL AND zsd.ACTUAL_COMPLETE_DATE IS NULL AND zsd.DISPATCH_STATUS != 'CANCEL' THEN TO_CHAR(TO_NUMBER(zsd.PLANNED_COMP_DATE + 8/24 - SYSDATE),'FM9999990.000')
ELSE ''
END SURPLUS_DAY,
CASE WHEN zsd.ACTUAL_START_DATE IS NOT NULL AND cf3.VALUE IS NOT NULL AND cf3.VALUE != 0 AND zsd.ACTUAL_COMPLETE_DATE IS NULL
THEN ROUND(TO_NUMBER(SYSDATE - (zsd.ACTUAL_START_DATE+8/24))*24/TO_NUMBER(cf3.VALUE),2)*100 || '%'
WHEN zsd.ACTUAL_START_DATE IS NOT NULL AND cf3.VALUE IS NOT NULL AND cf3.VALUE != 0 AND zsd.ACTUAL_COMPLETE_DATE IS NOT NULL
THEN ROUND(TO_NUMBER((zsd.ACTUAL_COMPLETE_DATE+8/24) - (zsd.ACTUAL_START_DATE+8/24))*24/TO_NUMBER(cf3.VALUE),2)*100 || '%'
ELSE ''
END PROCESS_HOURS
FROM Z_SFC_DISPATCH zsd
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'
LEFT JOIN SHOP_ORDER so ON so.SHOP_ORDER = zsd.SHOP_ORDER AND so.SITE = zsd.SITE
LEFT JOIN CUSTOM_FIELDS cf ON cf.HANDLE = so.HANDLE AND cf."ATTRIBUTE" = 'ITEM_NUMBER'
LEFT JOIN CUSTOM_FIELDS cf2 ON cf2.HANDLE = so.HANDLE AND cf2."ATTRIBUTE" = 'PRODUCT_CATEGORY'
LEFT JOIN ITEM i On i.HANDLE = so.ITEM_BO
LEFT JOIN ITEM_T it ON it.ITEM_BO = so.ITEM_BO
LEFT JOIN RESRCE r ON r.RESRCE = zsd.RESRCE AND r.SITE = zsd.SITE
LEFT JOIN SFC s ON s.SFC = zsd.SFC AND s.SITE = zsd.SITE
LEFT JOIN SFC_ROUTING sr ON sr.SFC_BO = s.HANDLE
LEFT JOIN SFC_ROUTER st ON st.SFC_ROUTING_BO = sr.HANDLE AND st.IN_USE = 'true'
LEFT JOIN SFC_STEP ss ON ss.SFC_ROUTER_BO = st.HANDLE AND (ss.QTY_IN_QUEUE > 0 OR ss.QTY_IN_WORK > 0)
LEFT JOIN OPERATION o ON o.OPERATION = SUBSTR(SS.OPERATION_BO,INSTR(SS.OPERATION_BO,',',1,1)+1,INSTR(SS.OPERATION_BO,',',1,2) - INSTR(SS.OPERATION_BO,',') -1) AND o.SITE = zsd.SITE
LEFT JOIN OPERATION_T ot ON ot.OPERATION_BO = o.HANDLE AND ot.LOCALE = 'zh'
LEFT JOIN OPERATION o2 ON o2.OPERATION = zsd.OPERATION AND o2.SITE = zsd.SITE
LEFT JOIN OPERATION_T ot2 ON ot2.OPERATION_BO = o2.HANDLE AND ot2.LOCALE = 'zh'
LEFT JOIN Z_ABNORMAL_BILL zab ON zab.SFC = zsd.SFC AND zab.OPERATION = zsd.OPERATION AND zab.SITE = zsd.SITE
LEFT JOIN ROUTER_STEP rs ON zsd.ROUTER_BO = rs.ROUTER_BO AND rs.STEP_ID = zsd.STEP_ID
LEFT JOIN ROUTER_OPERATION ro ON ro.ROUTER_STEP_BO = rs.HANDLE AND ro.OPERATION_BO = ss.OPERATION_BO
LEFT JOIN CUSTOM_FIELDS cf3 ON cf3.HANDLE = ro.HANDLE AND cf3."ATTRIBUTE" = 'PROD_TIME'
INNER JOIN DATA_FIELD df ON df.DATA_FIELD = 'PRODUCT_CATEGORY'
LEFT JOIN DATA_FIELD_LIST dfl ON dfl.DATA_FIELD_BO = df.HANDLE AND dfl.DATA_VALUE = zab.PRODUCT_CATEGORY
LEFT JOIN DATA_FIELD_LIST_T dflt ON dflt.DATA_FIELD_LIST_BO = dfl.HANDLE AND dflt.LOCALE = #{locale}
<where>
zsd.SITE = #{site}
<if test="workCenter != null and workCenter != ''">
AND (wc.WORK_CENTER = #{workCenter} OR wct.DESCRIPTION = #{workCenter})
</if>
<if test="itemNumber != null and itemNumber != ''">
AND cf.VALUE = #{itemNumber}
</if>
<if test="productCategory != null and productCategory != ''">
AND (dflt.DATA_TAG = #{productCategory} OR
zab.PRODUCT_CATEGORY = #{productCategory} OR
cf2.VALUE = #{productCategory}
)
</if>
<if test="shopOrder != null and shopOrder != ''">
AND so.SHOP_ORDER LIKE '%${shopOrder}%'
</if>
<if test="startDateTime != null and startDateTime != ''">
AND zsd.PLANNED_COMP_DATE &gt;= TO_DATE(#{startDateTime},'YYYY-MM-DD')-8/24
</if>
<if test="endDateTime != null and endDateTime != ''">
AND zsd.PLANNED_COMP_DATE &lt;= TO_DATE(#{endDateTime}|| '15:59:59','YYYY-MM-DD HH24:MI:SS')
</if>
</where>
ORDER BY zsd.SFC DESC,zsd.STEP_ID) S
</select>
</mapper>

@ -44,6 +44,8 @@ public interface ResrceMapper extends BaseMapper<Resrce> {
String isInspectByResrce(@Param("site") String site, @Param("resrce") String resrce);
String findCustomFieldByResrce(@Param("site")String site,@Param("resrce")String resrce,@Param("customField")String customField);

@ -619,4 +619,10 @@
WHERE R.RESRCE = #{resrce} AND R.SITE = #{site}
</select>
<!--根据设备找到设备上的自定义字段-->
<select id="findCustomFieldByResrce" resultType="java.lang.String">
SELECT CF.VALUE FROM RESRCE R
LEFT JOIN CUSTOM_FIELDS CF ON CF.HANDLE = R.HANDLE AND CF."ATTRIBUTE" = #{customField}
WHERE R.RESRCE = #{resrce} AND R.SITE = #{site}
</select>
</mapper>

@ -27,6 +27,7 @@ import com.foreverwin.mesnac.integration.service.IntegrationLogService;
import com.foreverwin.mesnac.meapi.dto.BomComponentDto;
import com.foreverwin.mesnac.meapi.dto.SfcDto;
import com.foreverwin.mesnac.meapi.dto.WorkCenterDto;
import com.foreverwin.mesnac.meapi.mapper.ResrceMapper;
import com.foreverwin.mesnac.meapi.model.*;
import com.foreverwin.mesnac.meapi.service.*;
import com.foreverwin.mesnac.production.mapper.SfcCrossMapper;
@ -100,6 +101,8 @@ public class PodTemplateServiceImpl implements PodTemplateService {
private IntegrationLogService integrationLogService;
@Autowired
private SfcDispatchCommonService sfcDispatchCommonService;
@Autowired
private ResrceMapper resrceMapper;
@ -246,7 +249,8 @@ public class PodTemplateServiceImpl implements PodTemplateService {
InspectionTask inspectionTask = list.get(0);
String result = inspectionTask.getResult();
if (!inspectionTask.getStatus().equals(Constants.INSPECTION_TASK_STATUS_COMPLETE)||StringUtil.isBlank(result)||!result.equals(Constants.RSESULT_OK)){
throw new BaseException("请完成专检检验任务");
String checkUser = resrceMapper.findCustomFieldByResrce(site, inspectionTask.getResrce(), "CHECK_USR");
throw new BaseException("请联系"+checkUser+",处理专检任务。");
}
}
try {

Loading…
Cancel
Save