瀏覽代碼

Merge remote-tracking branch 'origin/mode-min-unit' into mode-min-unit

fangpy 5 月之前
父節點
當前提交
84fe434d68

+ 3 - 0
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/dao/ApsBlankOrderDao.java

@@ -165,4 +165,7 @@ public interface ApsBlankOrderDao extends BaseMapper<ApsBlankOrderDo> {
     List<ApsProcessOperationProcessEquDo> selectNeedRescheduleEqu2(@Param("chongpaiStartDate") DateTime chongpaiStartDate, @Param("chongpaiEndDate") DateTime chongpaiEndDate, @Param("tenantId") String tenantId, @Param("workshopin") Integer workshopin, @Param("workshopcross") Integer workshopcross);
 
     List<ApsProcessOperationProcessEquDo> selectNeedRescheduleEqu3(@Param("chongpaiStartDate") DateTime chongpaiStartDate, @Param("chongpaiEndDate") DateTime chongpaiEndDate, @Param("tenantId") String tenantId, @Param("workshopin") Integer workshopin, @Param("workshopcross") Integer workshopcross);
+
+    void setLenZhaNextDay(@Param("tenantId") String tenantId, @Param("chongpaiStartDate") DateTime chongpaiStartDate, @Param("chongpaiEndDate") DateTime chongpaiEndDate);
+    void setTuiHuoNextDay(@Param("tenantId") String tenantId, @Param("chongpaiStartDate") DateTime chongpaiStartDate, @Param("chongpaiEndDate") DateTime chongpaiEndDate);
 }

+ 13 - 0
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsBlankOrderServiceImpl.java

@@ -4174,6 +4174,13 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
 
             //将实际完工时间大于明天的作业挪到实际完工时间
             this.baseMapper.updateFinishDateAboutProcessEqu(needScheduleDate);
+            //锁定所有 未锁定的 作业和作业明细
+            apsProcessOperationProcessEquService.update(new LambdaUpdateWrapper<ApsProcessOperationProcessEquDo>()
+                    .set(ApsProcessOperationProcessEquDo::getLockmarkdetail,"y")
+                    .eq(ApsProcessOperationProcessEquDo::getLockmarkdetail,"n"));
+            apsProcessOperationService.update(new LambdaUpdateWrapper<ApsProcessOperationDo>()
+                    .set(ApsProcessOperationDo::getLockmark,"y")
+                    .eq(ApsProcessOperationDo::getLockmark,"n"));
 //            //查询在重排时间前一天之后的所有作业明细信息,不包括:铸轧、成退、中退、小卷成退
 //            List<ApsProcessOperationProcessEquChongpaiVo> list = this.baseMapper.selectNeedRescheduleEqu(needScheduleDate, CXCommonUtils.getCurrentUserFactoryId(null));
             //排程设置
@@ -4272,6 +4279,9 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
                         .in(ApsProcessOperationDo::getId, needUnLockProcessIdList)
         );
 
+//        //将调度时间范围内还未解锁的退火作业全部往后推一天
+//        this.baseMapper.setTuiHuoNextDay(CXCommonUtils.getCurrentUserFactoryId(null),chongpaiStartDate,chongpaiEndDate);
+
         //重新排程
         String scheduletype = apsScheduleConfigDo.getScheduletype();
         ApsTypeVo apsTypeVo = BeanUtil.toBean(scheduletype, ApsTypeVo.class);
@@ -4432,6 +4442,9 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
                         .in(ApsProcessOperationDo::getId, needUnLockProcessIdList)
         );
 
+//        //将调度时间范围内还未解锁的冷轧作业全部往后推一天
+//        this.baseMapper.setLenZhaNextDay(CXCommonUtils.getCurrentUserFactoryId(null),chongpaiStartDate,chongpaiEndDate);
+
         String scheduletype = apsScheduleConfigDo.getScheduletype();
         ApsTypeVo apsTypeVo = BeanUtil.toBean(scheduletype, ApsTypeVo.class);
         apsTypeVo.setMixIf("default");

+ 53 - 13
cx-aps/cx-aps-common/src/main/resources/mybatis/ApsBlankOrderDao.xml

@@ -232,6 +232,36 @@
         and apo.PROCESS != '铸轧' and apope.WORKSTATUS = '待开工'
         and apope.PLANSTARTDATE >= DATE_ADD(#{needScheduleDate},INTERVAL 1 DAY) and apope.PLANSTARTDATE &lt; DATE_ADD(#{needScheduleDate},INTERVAL 2 DAY)
     </update>
+    <update id="setLenZhaNextDay">
+        update
+            aps_process_operation apo
+                JOIN aps_process_operation_process_equ apope ON apo.ID = apope.PROCESSID AND apope.DELETED = 0
+        set
+            apope.PLANSTARTDATE=DATE_ADD(apope.PLANSTARTDATE, INTERVAL 1 DAY),
+            apope.PLANENDDATE=DATE_ADD(apope.PLANENDDATE, INTERVAL 1 DAY)
+        WHERE
+            apo.DELETED = '0'
+          and apope.TENANTID = #{tenantId}
+          and apo.PROCESS not in ('铸轧','中退','成退','小卷成退')
+          and apope.WORKSTATUS = '待开工'
+          and apope.PLANSTARTDATE between #{chongpaiStartDate} and #{chongpaiEndDate} -- 调度开始时间之后计划开工
+          and apope.LOCKMARKDETAIL = 'y'
+    </update>
+    <update id="setTuiHuoNextDay">
+        update
+            aps_process_operation apo
+                JOIN aps_process_operation_process_equ apope ON apo.ID = apope.PROCESSID AND apope.DELETED = 0
+        set
+            apope.PLANSTARTDATE=DATE_ADD(apope.PLANSTARTDATE, INTERVAL 1 DAY),
+            apope.PLANENDDATE=DATE_ADD(apope.PLANENDDATE, INTERVAL 1 DAY)
+        WHERE
+            apo.DELETED = '0'
+          and apope.TENANTID = #{tenantId}
+          and apo.PROCESS in ('中退','成退','小卷成退')
+          and apope.WORKSTATUS = '待开工'
+          and apope.PLANSTARTDATE between #{chongpaiStartDate} and #{chongpaiEndDate} -- 调度开始时间之后计划开工
+          and apope.LOCKMARKDETAIL = 'y'
+    </update>
     <select id="checkConflictByBlankId" resultType="java.lang.Integer">
         select count(*) from aps_process_operation_process_equ
             <where>
@@ -426,7 +456,7 @@
     <select id="selectNeedRescheduleEqu2"
             resultType="com.rongwei.bsentity.domain.ApsProcessOperationProcessEquDo">
         SELECT apope.*
-        FROM
+        from
             aps_process_operation_process_equ apope
                 join aps_process_operation apo on apo.ID = apope.PROCESSID
                 left join aps_process_operation_process_equ preapope on apope.PREVIOUSPROCESSESIDS = preapope.id AND preapope.DELETED = '0'
@@ -435,19 +465,24 @@
           and apope.TENANTID = #{tenantId}
           and apo.PROCESS in ('中退','成退','小卷成退')
           and apope.WORKSTATUS = '待开工'
-          and apope.PLANSTARTDATE >= #{chongpaiStartDate} -- 调度开始时间之后开工
-          AND (apope.PLANSTARTDATE &lt;= #{chongpaiEndDate} -- 调度结束时间之前开工
-            OR date_add(preapope.PLANENDDATE, -- 前道计划完工时间 + 流转时间
-            INTERVAL GREATEST(ifnull(apo.MINFLOWWAITMIN,0), -- 最小流转等待时间
-            if(apope.PROCESSWORKSHOPID!=preapope.PROCESSWORKSHOPID,#{workshopcross}, -- 车间流转时间
-            if(apope.PROCESSDEVICEID!=preapope.PROCESSDEVICEID,#{workshopin},0))) MINUTE -- 机台流转时间
-            ) &lt;= #{chongpaiEndDate} -- 调度结束时间之前可以开工
+          and apope.PLANSTARTDATE >= #{chongpaiStartDate} -- 调度开始时间之后计划开工
+          AND (
+            apope.PLANSTARTDATE &lt;= #{chongpaiEndDate} OR
+            (ifnull(apope.PREVIOUSPROCESSESIDS,'')='' -- 没有前道
+                and apope.PLANSTARTDATE &lt; DATE_ADD(#{chongpaiStartDate}, INTERVAL 3 DAY)) -- 调度开始时间+5天内计划开工
+                OR (ifnull(apope.PREVIOUSPROCESSESIDS,'')!='' -- 有前道
+                and preapope.PLANSTARTDATE &lt;= #{chongpaiStartDate} -- 前道计划开工时间在调度开始时间之前,表示该作业是需要调度的作业的第一道
+                and date_add(preapope.PLANENDDATE, -- 前道计划完工时间 + 流转时间 小于 调度结束时间
+                             INTERVAL GREATEST(ifnull(apo.MINFLOWWAITMIN,0), -- 最小流转等待时间
+                                               if(apope.PROCESSWORKSHOPID!=preapope.PROCESSWORKSHOPID,#{workshopcross}, -- 车间流转时间
+                                                  if(apope.PROCESSDEVICEID!=preapope.PROCESSDEVICEID,#{workshopin},0))) MINUTE -- 机台流转时间
+                    ) &lt;= #{chongpaiEndDate}) -- 调度结束时间之前可以开工
             )
     </select>
     <select id="selectNeedRescheduleEqu3"
             resultType="com.rongwei.bsentity.domain.ApsProcessOperationProcessEquDo">
         SELECT apope.*
-        FROM
+        from
         aps_process_operation_process_equ apope
         join aps_process_operation apo on apo.ID = apope.PROCESSID
         left join aps_process_operation_process_equ preapope on apope.PREVIOUSPROCESSESIDS = preapope.id AND preapope.DELETED = '0'
@@ -456,13 +491,18 @@
         and apope.TENANTID = #{tenantId}
         and apo.PROCESS not in ('铸轧','中退','成退','小卷成退')
         and apope.WORKSTATUS = '待开工'
-        and apope.PLANSTARTDATE >= #{chongpaiStartDate} -- 调度开始时间之后开工
-        AND (apope.PLANSTARTDATE &lt;= #{chongpaiEndDate} -- 调度结束时间之前开工
-        OR date_add(preapope.PLANENDDATE, -- 前道计划完工时间 + 流转时间
+        and apope.PLANSTARTDATE >= #{chongpaiStartDate} -- 调度开始时间之后计划开工
+        AND (
+            apope.PLANSTARTDATE &lt;= #{chongpaiEndDate} OR
+            (ifnull(apope.PREVIOUSPROCESSESIDS,'')='' -- 没有前道
+        and apope.PLANSTARTDATE &lt; DATE_ADD(#{chongpaiStartDate}, INTERVAL 3 DAY)) -- 调度开始时间+5天内计划开工
+        OR (ifnull(apope.PREVIOUSPROCESSESIDS,'')!='' -- 有前道
+        and preapope.PLANSTARTDATE &lt;= #{chongpaiStartDate} -- 前道计划开工时间在调度开始时间之前,表示该作业是需要调度的作业的第一道
+        and date_add(preapope.PLANENDDATE, -- 前道计划完工时间 + 流转时间 小于 调度结束时间
         INTERVAL GREATEST(ifnull(apo.MINFLOWWAITMIN,0), -- 最小流转等待时间
         if(apope.PROCESSWORKSHOPID!=preapope.PROCESSWORKSHOPID,#{workshopcross}, -- 车间流转时间
         if(apope.PROCESSDEVICEID!=preapope.PROCESSDEVICEID,#{workshopin},0))) MINUTE -- 机台流转时间
-        ) &lt;= #{chongpaiEndDate} -- 调度结束时间之前可以开工
+        ) &lt;= #{chongpaiEndDate}) -- 调度结束时间之前可以开工
         )
     </select>
 </mapper>