产品报废检索所有

master
philip 3 years ago
parent ce00e5e1c8
commit 1e8589f8fc

@ -48,4 +48,6 @@ public interface AbnormalBillMapper extends BaseMapper<AbnormalBill> {
IPage getAbnormalSFCPage(IPage page, @Param("paramMap")Map<String,String> paramMap,@Param("keyword")String keyword); IPage getAbnormalSFCPage(IPage page, @Param("paramMap")Map<String,String> paramMap,@Param("keyword")String keyword);
Map<String,String> findReplaceMessageByAbnormal(@Param("abnormalBill")AbnormalBill abnormalBill); Map<String,String> findReplaceMessageByAbnormal(@Param("abnormalBill")AbnormalBill abnormalBill);
List<ScrapDto> findScrapDtoList(String site);
} }

@ -1553,67 +1553,71 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
if(StringUtil.isBlank(site)){ if(StringUtil.isBlank(site)){
site = CommonMethods.getSite(); site = CommonMethods.getSite();
} }
List<ScrapDto> scrapDtoBySfc = null;
//根据用户提报上来的sfc和异常单查找主SFC //根据用户提报上来的sfc和异常单查找主SFC
Map<String, String> map = this.jgProductionIsScrap(abnormalNo, site, sfc); if (StringUtils.notBlank(abnormalNo)||StringUtils.notBlank(sfc)){
String mainSfc = null; Map<String, String> map = this.jgProductionIsScrap(abnormalNo, site, sfc);
String abnormalBo = null; String mainSfc = null;
if(map != null){ String abnormalBo = null;
mainSfc = map.get("SFC"); if(map != null){
abnormalBo = map.get("HANDLE"); mainSfc = map.get("SFC");
} abnormalBo = map.get("HANDLE");
}
List<SplitSfc> splitSfcs = null; List<SplitSfc> splitSfcs = null;
SplitSfc splitSfc = new SplitSfc(); SplitSfc splitSfc = new SplitSfc();
splitSfc.setSite(site); splitSfc.setSite(site);
//判断能否找到该主sfc。 //判断能否找到该主sfc。
if(StringUtil.isBlank(mainSfc)){ if(StringUtil.isBlank(mainSfc)){
//判断该用户提报上来的sfc是否为空 //判断该用户提报上来的sfc是否为空
if(StringUtil.isBlank(sfc)) { if(StringUtil.isBlank(sfc)) {
throw new BaseException("该异常单下没有报废的产品条码"); throw new BaseException("该异常单下没有报废的产品条码");
} }
//如果不为空则判断根据这个sfc能从Z_SPLIT_SFC表中查找到主SFC吗然后在判断主SFC是否已经报废 //如果不为空则判断根据这个sfc能从Z_SPLIT_SFC表中查找到主SFC吗然后在判断主SFC是否已经报废
splitSfc.setSplitSfc(sfc); splitSfc.setSplitSfc(sfc);
splitSfcs = splitSfcService.selectList(splitSfc); splitSfcs = splitSfcService.selectList(splitSfc);
if(splitSfcs.size()>0){ if(splitSfcs.size()>0){
Map<String, String> map1 = this.jgProductionIsScrap(abnormalNo, site, splitSfcs.get(0).getSfc()); Map<String, String> map1 = this.jgProductionIsScrap(abnormalNo, site, splitSfcs.get(0).getSfc());
mainSfc = map1.get("SFC"); mainSfc = map1.get("SFC");
abnormalBo = map1.get("HANDLE"); abnormalBo = map1.get("HANDLE");
}else{ }else{
if(!StringUtil.isBlank(sfc) && !StringUtil.isBlank(abnormalNo)){ if(!StringUtil.isBlank(sfc) && !StringUtil.isBlank(abnormalNo)){
throw new BaseException("该异常单下的产品条码不是报废"); throw new BaseException("该异常单下的产品条码不是报废");
}
throw new BaseException("该产品条码的异常方案不是报废");
} }
throw new BaseException("该产品条码的异常方案不是报废"); }else if(StringUtil.isBlank(sfc)){
//根据异常单找到了主sfc并且sfc参数为空找到异常单主sfc下拆分的次sfc
splitSfc.setSfc(mainSfc);
splitSfcs = splitSfcService.selectList(splitSfc);
} }
}else if(StringUtil.isBlank(sfc)){ scrapDtoBySfc = abnormalBillMapper.findScrapDtoBySfc(site, mainSfc,splitSfcs);
//根据异常单找到了主sfc并且sfc参数为空找到异常单主sfc下拆分的次sfc
splitSfc.setSfc(mainSfc); //如果用户提报上来的sfc不为空并且不是主sfc则把主sfc从scrapDtoBySfc去掉
splitSfcs = splitSfcService.selectList(splitSfc); if(!StringUtil.isBlank(sfc) && !sfc.equals(mainSfc)){
} for (int i = 0; i < scrapDtoBySfc.size(); i++) {
List<ScrapDto> scrapDtoBySfc = abnormalBillMapper.findScrapDtoBySfc(site, mainSfc,splitSfcs); if(scrapDtoBySfc.get(i).getSfc().equals(mainSfc)){
scrapDtoBySfc.remove(scrapDtoBySfc.get(i));
//如果用户提报上来的sfc不为空并且不是主sfc则把主sfc从scrapDtoBySfc去掉 continue;
if(!StringUtil.isBlank(sfc) && !sfc.equals(mainSfc)){ }
for (int i = 0; i < scrapDtoBySfc.size(); i++) {
if(scrapDtoBySfc.get(i).getSfc().equals(mainSfc)){
scrapDtoBySfc.remove(scrapDtoBySfc.get(i));
continue;
} }
} }
} if(scrapDtoBySfc.size() <= 0){
if(scrapDtoBySfc.size() <= 0){ throw new BaseException("该产品条码的异常方案不是报废");
throw new BaseException("该产品条码的异常方案不是报废"); }
} //查找到责任人,放到表里
AbnormalBillDispose abnormalBillDispose = new AbnormalBillDispose();
//查找到责任人,放到表里 abnormalBillDispose.setAbnormalBillBo(abnormalBo);
AbnormalBillDispose abnormalBillDispose = new AbnormalBillDispose(); List<AbnormalBillDispose> abnormalBillDisposes = abnormalBillDisposeService.selectList(abnormalBillDispose);
abnormalBillDispose.setAbnormalBillBo(abnormalBo); if(abnormalBillDisposes.size() > 0){
List<AbnormalBillDispose> abnormalBillDisposes = abnormalBillDisposeService.selectList(abnormalBillDispose); for (int i = 0; i < scrapDtoBySfc.size(); i++) {
if(abnormalBillDisposes.size() > 0){ scrapDtoBySfc.get(i).setDutyUser(abnormalBillDisposes.get(0).getPrincipalUser());
for (int i = 0; i < scrapDtoBySfc.size(); i++) { }
scrapDtoBySfc.get(i).setDutyUser(abnormalBillDisposes.get(0).getPrincipalUser());
} }
}else {
scrapDtoBySfc = abnormalBillMapper.findScrapDtoList(site);
} }
return scrapDtoBySfc; return scrapDtoBySfc;
} }

@ -76,6 +76,7 @@
<result column="BOM" property="bom"/> <result column="BOM" property="bom"/>
<result column="REASON" property="reason"/> <result column="REASON" property="reason"/>
<result column="TYPE" property="type"/> <result column="TYPE" property="type"/>
<result column="DUTY_USER" property="dutyUser"/>
</resultMap> </resultMap>
<!-- 通用查询结果列 --> <!-- 通用查询结果列 -->
@ -1234,6 +1235,50 @@
</where> </where>
</select> </select>
<select id="findScrapDtoList" resultMap="scrapDto">
SELECT NVL(ZSSF.SPLIT_SfC,S.SFC ) SFC,ZABD.PRINCIPAL_USER DUTY_USER,
S2.STATUS STATUS,
CASE WHEN ZAB.OPERATION IS NOT NULL AND ZAB.STEP_ID IS NOT NULL THEN ZAB.OPERATION || '/' || ZAB.STEP_ID
ELSE SUBSTR(SS.OPERATION_BO ,INSTR(SS.OPERATION_BO ,',',1)+1,(INSTR(SS.OPERATION_BO ,'#',1)-1)-(INSTR(SS.OPERATION_BO ,',',1)+1)) || '/' || SS.STEP_ID
END OPERATION,
CASE WHEN ZAB.RESRCE IS NOT NULL THEN ZAB.RESRCE
ELSE ZSD2.RESRCE
END RESRCE,
CASE WHEN ZAB.SHOP_ORDER IS NOT NULL THEN ZAB.SHOP_ORDER
ELSE SO.SHOP_ORDER
END SHOP_ORDER,
CASE WHEN I.ITEM != 'NULL' THEN I.ITEM || '/' || I.REVISION END ITEM,
CASE WHEN R.ROUTER != 'NULL' THEN R.ROUTER || '/' || R.REVISION END ROUTER ,
CASE WHEN B.BOM != 'NULL' THEN B.BOM || '/' || B.REVISION END BOM,
CASE WHEN ZSS.HANDLE != 'NULL' THEN ZSS.REASON
ELSE ZABV.PB_DESCRIPTION
END REASON,
ZSS.TYPE TYPE
FROM SFC S
JOIN SFC_ROUTING SR ON SR.SFC_BO = S.HANDLE
JOIN SFC_ROUTER ST ON ST.SFC_ROUTING_BO = SR.HANDLE AND ST.IN_USE = 'true'
JOIN SFC_STEP SS ON SS.SFC_ROUTER_BO = ST.HANDLE AND (SS.QTY_IN_QUEUE > 0 OR SS.QTY_IN_WORK > 0)
INNER JOIN STATUS S2 ON S2.HANDLE = S.STATUS_BO
JOIN Z_SFC_DISPATCH ZSD2 ON ZSD2.DISPATCH_NO = S.SFC || '-' || SS.STEP_ID
INNER JOIN SHOP_ORDER SO ON SO.HANDLE = S.SHOP_ORDER_BO AND SO.SITE = S.SITE
INNER JOIN ITEM I ON I.HANDLE = SO.PLANNED_ITEM_BO
JOIN ROUTER R ON R.HANDLE = ST.ROUTER_BO
LEFT JOIN Z_SFC_SCRAP ZSS ON ZSS.SFC = S.SFC AND ZSS.SITE = S.SITE
JOIN BOM B ON B.HANDLE = SO.PLANNED_BOM_BO
JOIN (
SELECT ZABV.*
FROM Z_ABNORMAL_BILL_VIEW ZABV
JOIN (SELECT MAX(HANDLE) handle
FROM Z_ABNORMAL_BILL_VIEW ZABV2
GROUP BY sfc ) ma ON ZABV.HANDLE = ma.HANDLE
) ZABV
ON ZABV.SFC = S.SFC AND ZABV.SITE= S.SITE
JOIN Z_ABNORMAL_BILL ZAB ON ZAB.HANDLE = ZABV.HANDLE
JOIN Z_ABNORMAL_BILL_DISPOSE ZABD ON ZABD.ABNORMAL_BILL_BO= ZAB.HANDLE
LEFT JOIN Z_SPLIT_SFC ZSSF ON s.site=ZSSF.site and ZSSF.sfc=s.SFC
LEFT JOIN SFC SPSFC ON SPSFC.site=ZSSF.site and ZSSF.sfc=SPSFC.SFC AND spsfc.STATUS_BO!='StatusBO:'||#{site}||',407'
WHERE s.STATUS_BO!='StatusBO:'||#{site}||',407'
</select>
<select id="getQCAbnormalList" resultMap="BaseResultMap"> <select id="getQCAbnormalList" resultMap="BaseResultMap">
SELECT * FROM Z_ABNORMAL_BILL zab SELECT * FROM Z_ABNORMAL_BILL zab
JOIN sfc s ON zab.SITE=s.SITE AND zab.SFC=s.SFC JOIN sfc s ON zab.SITE=s.SITE AND zab.SFC=s.SFC

Loading…
Cancel
Save