2 コミット f43baf50a0 ... 7087cfdc30

作者 SHA1 メッセージ 日付
  fangpy 7087cfdc30 Merge remote-tracking branch 'origin/mode-min-unit' into mode-min-unit 2 ヶ月 前
  fangpy b236e963b9 预排程排程开始时间调整 2 ヶ月 前

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

@@ -395,7 +395,7 @@ public class ApsServiceImpl implements ApsService {
         Map<String, Equipment> allEqs = new HashMap<>();
         // 统一排程开始时间
         List<ApsScheduleConfigDo> apsConfigs = apsScheduleConfigService.list();
-        Date apsPlanStartDate = new Date();
+        /*Date apsPlanStartDate = new Date();
         if (apsConfigs != null && apsConfigs.size() > 0) {
             ApsScheduleConfigDo apsScheduleConfig = apsConfigs.get(0);
             int a = 8;
@@ -408,7 +408,9 @@ public class ApsServiceImpl implements ApsService {
                 apsPlanStartDate = DateUtil.date().offset(DateField.HOUR, a);
             }
         }
-        Date finalApsPlanStartDate = apsPlanStartDate;
+        Date finalApsPlanStartDate = apsPlanStartDate;*/
+        Date finalApsPlanStartDate = Date.from(
+                LocalDateTime.now().plusDays(1).withHour(12).withMinute(0).withSecond(0).atZone(ZoneId.systemDefault()).toInstant());
         if (cdorders != null && cdorders.size() > 0) {
             try {
                 apsOrderScheduleApsNew(cdorders, currentUser, allEqs, finalApsPlanStartDate, null, apsType, needUnLockProcessIdList, startTime);
@@ -1788,7 +1790,8 @@ public class ApsServiceImpl implements ApsService {
                         processes.setMinThPcNum(processDetail.getPlanprocessrall());
                         processes.setProducePcNum(preprocess.getPlanprocessrall());
                     }
-                    if (apsBlankOrderVo.getPlanhavematerialdate() != null) {
+                    if (apsBlankOrderVo.getPlanhavematerialdate() != null
+                            && apsBlankOrderVo.getPlanhavematerialdate().compareTo(productionScheduleVo.getApsPlanStartDate())>0) {
                         // 全局配置
                         ApsOverallConfig apsOverallConfig = new ApsOverallConfig();
                         Date startDate = apsBlankOrderVo.getPlanhavematerialdate();
@@ -1841,7 +1844,8 @@ public class ApsServiceImpl implements ApsService {
                                 processes.setCancel(true);
                             }
                             // 全局配置
-                            if (apsBlankOrderVo.getPlanhavematerialdate() != null) {
+                            if (apsBlankOrderVo.getPlanhavematerialdate() != null
+                                    && apsBlankOrderVo.getPlanhavematerialdate().compareTo(productionScheduleVo.getApsPlanStartDate())>0) {
                                 processes.setApsOverallConfig(apsUtils.apsOverallConfigSet(apsBlankOrderVo,productionScheduleVo));
                             }
                             processes.setProducePcNum(processEquDos.size());
@@ -1899,7 +1903,8 @@ public class ApsServiceImpl implements ApsService {
                                 }
                             }
 
-                            if (apsBlankOrderVo.getPlanhavematerialdate() != null) {
+                            if (apsBlankOrderVo.getPlanhavematerialdate() != null
+                                    && apsBlankOrderVo.getPlanhavematerialdate().compareTo(productionScheduleVo.getApsPlanStartDate())>0) {
                                 // 全局配置
                                 ApsOverallConfig apsOverallConfig = new ApsOverallConfig();
                                 Date startDate = apsBlankOrderVo.getPlanhavematerialdate();
@@ -1958,7 +1963,8 @@ public class ApsServiceImpl implements ApsService {
                                 processes.setCancel(true);
                             }
                             // 全局配置
-                            if (apsBlankOrderVo.getPlanhavematerialdate() != null) {
+                            if (apsBlankOrderVo.getPlanhavematerialdate() != null 
+                                    && apsBlankOrderVo.getPlanhavematerialdate().compareTo(productionScheduleVo.getApsPlanStartDate())>0) {
                                 processes.setApsOverallConfig(apsUtils.apsOverallConfigSet(apsBlankOrderVo,productionScheduleVo));
                             }
                             processes.setProducePcNum(processEquDos.size());
@@ -2020,7 +2026,8 @@ public class ApsServiceImpl implements ApsService {
                                     processes.setCancel(true);
                                 }
                             }
-                            if (apsBlankOrderVo.getPlanhavematerialdate() != null) {
+                            if (apsBlankOrderVo.getPlanhavematerialdate() != null
+                                    && apsBlankOrderVo.getPlanhavematerialdate().compareTo(productionScheduleVo.getApsPlanStartDate())>0) {
                                 // 全局配置
                                 ApsOverallConfig apsOverallConfig = new ApsOverallConfig();
                                 Date startDate = apsBlankOrderVo.getPlanhavematerialdate();
@@ -2082,7 +2089,8 @@ public class ApsServiceImpl implements ApsService {
                                 processes.setCancel(true);
                             }
                         }
-                        if (apsBlankOrderVo.getPlanhavematerialdate() != null) {
+                        if (apsBlankOrderVo.getPlanhavematerialdate() != null
+                                && apsBlankOrderVo.getPlanhavematerialdate().compareTo(productionScheduleVo.getApsPlanStartDate())>0) {
                             // 全局配置
                             ApsOverallConfig apsOverallConfig = new ApsOverallConfig();
                             Date startDate = apsBlankOrderVo.getPlanhavematerialdate();