Ver código fonte

特殊场景异常处理

fangpy 7 meses atrás
pai
commit
a83948fa7b

+ 19 - 5
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsServiceImpl.java

@@ -1197,12 +1197,19 @@ public class ApsServiceImpl implements ApsService {
                 // 已排程的当前作业
                 List<ApsProcessOperationProcessEquDo> processEquDos = proEqus.get(operationDo.getId());
                 if("小卷成退".equals(operationDo.getProcess())){
+                    Integer planprocessrall = null;
                     String previousprocessid = operationDo.getPreviousprocessid();
-                    ApsProcessOperationDo preprocess = apsProcessOperationService.getById(previousprocessid);
-                    if(preprocess == null){
-                        throw new CustomException("小卷成退没有前道工序:"+operationDo.getId());
+                    if(StringUtils.isNotBlank(previousprocessid)){
+                        ApsProcessOperationDo preprocess = apsProcessOperationService.getById(previousprocessid);
+                        if(preprocess == null){
+                            throw new CustomException("小卷成退没有前道工序:"+operationDo.getId());
+                        }
+                        planprocessrall = preprocess.getPlanprocessrall();
+                    }else{
+                        planprocessrall = new BigDecimal(operationDo.getPlanprocessrall())
+                                .divide(new BigDecimal("20").divide(operationDo.getSinglerollweight(),2, BigDecimal.ROUND_HALF_UP)
+                                        ,2, BigDecimal.ROUND_HALF_UP).setScale(0, RoundingMode.CEILING).intValue();
                     }
-                    Integer planprocessrall = preprocess.getPlanprocessrall();
                     Integer ys = operationDo.getPlanprocessrall() % planprocessrall;
                     Integer js = operationDo.getPlanprocessrall() / planprocessrall;
                     for (Integer i = 0; i < planprocessrall; i++) {
@@ -1271,7 +1278,14 @@ public class ApsServiceImpl implements ApsService {
                     if("小卷成退".equals(preprocess.getProcess())){
                         preprocess = apsProcessOperationService.getById(preprocess.getPreviousprocessid());
                     }
-                    Integer planprocessrall = preprocess.getPlanprocessrall();
+                    Integer planprocessrall = null;
+                    if(preprocess == null){
+                        planprocessrall = new BigDecimal(operationDo.getPlanprocessrall())
+                                .divide(new BigDecimal("20").divide(operationDo.getSinglerollweight(),2, BigDecimal.ROUND_HALF_UP)
+                                        ,2, BigDecimal.ROUND_HALF_UP).setScale(0, RoundingMode.CEILING).intValue();
+                    }else{
+                        planprocessrall = preprocess.getPlanprocessrall();
+                    }
                     Integer ys = operationDo.getPlanprocessrall() % planprocessrall;
                     Integer js = operationDo.getPlanprocessrall() / planprocessrall;
                     for (Integer i = 0; i < planprocessrall; i++) {