Jelajahi Sumber

aps-调度调整数据sql修改

sucheng 2 bulan lalu
induk
melakukan
488b0cdd69

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

@@ -186,4 +186,6 @@ public interface ApsBlankOrderDao extends BaseMapper<ApsBlankOrderDo> {
     int moveErrorProcessEqu2(@Param("chongpaiStartDate") DateTime chongpaiStartDate, @Param("chongpaiEndDate") DateTime chongpaiEndDate, @Param("tenantId") String tenantId);
 
     ApsProcessOperationProcessEquDo selectFirstPrepareEqu(@Param("blankId") String blankId);
+
+    int moveErrorNoPreviousProcessEqu(@Param("chongpaiStartDate") DateTime chongpaiStartDate, @Param("chongpaiEndDate") DateTime chongpaiEndDate, @Param("tenantId") String tenantId, @Param("type")String type);
 }

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

@@ -4846,6 +4846,7 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
 
     private void tuihuoChongpai(DateTime chongpaiStartDate, DateTime chongpaiEndDate, ApsScheduleConfigDo apsScheduleConfigDo, SysUserVo currentUser, List<String> blankIdsList) {
         //错误数据纠正挪动
+        this.baseMapper.moveErrorNoPreviousProcessEqu(chongpaiStartDate, chongpaiEndDate, CXCommonUtils.getCurrentUserFactoryId(currentUser), "退火");
         int safeCount = 0;
         while (true) {
             int updateCount = this.baseMapper.moveErrorProcessEqu(chongpaiStartDate, chongpaiEndDate, CXCommonUtils.getCurrentUserFactoryId(currentUser), apsScheduleConfigDo.getWorkshopin(), apsScheduleConfigDo.getWorkshopcross(), "退火");
@@ -4959,6 +4960,7 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
 
     private void lenzhaChongpai(DateTime chongpaiStartDate, DateTime chongpaiEndDate, ApsScheduleConfigDo apsScheduleConfigDo, SysUserVo currentUser, List<String> blankIdsList) {
         //错误数据纠正挪动
+        this.baseMapper.moveErrorNoPreviousProcessEqu(chongpaiStartDate, chongpaiEndDate, CXCommonUtils.getCurrentUserFactoryId(currentUser), "冷轧");
         int safeCount = 0;
         while (true) {
             int updateCount = this.baseMapper.moveErrorProcessEqu(chongpaiStartDate, chongpaiEndDate, CXCommonUtils.getCurrentUserFactoryId(currentUser), apsScheduleConfigDo.getWorkshopin(), apsScheduleConfigDo.getWorkshopcross(), "冷轧");

+ 26 - 0
cx-aps/cx-aps-common/src/main/resources/mybatis/ApsBlankOrderDao.xml

@@ -432,6 +432,32 @@
         and ifnull(apo.MINFLOWWAITMIN,0)=0
         and preapope.PLANSTARTDATE &lt; #{chongpaiStartDate}
     </update>
+    <update id="moveErrorNoPreviousProcessEqu">
+        -- 如果没有前道,
+        -- 如果预计来料时间在调度结束时间之前,并且调度开始时间之后3天内的作业挪到调度开始时间
+        update
+        aps_process_operation_process_equ apope
+        join aps_process_operation apo on apo.ID = apope.PROCESSID
+        join aps_blank_order abo on apo.BLANKID = abo.id
+        left join aps_process_operation_process_equ preapope on apope.PREVIOUSPROCESSESIDS = preapope.id AND preapope.DELETED = '0'
+        set
+        apope.PLANENDDATE=DATE_ADD(#{chongpaiStartDate},INTERVAL TIMESTAMPdiff(SECOND, apope.PLANSTARTDATE, apope.PLANENDDATE) SECOND),
+        apope.PLANSTARTDATE=#{chongpaiStartDate}
+        WHERE
+        apope.deleted = '0' AND apo.DELETED = '0'
+        and apope.TENANTID = #{tenantId}
+        and apo.PROCESS != '铸轧'
+        <if test="type != '' and type != null and type == '冷轧'">
+            AND apo.PROCESS NOT IN ('铸轧','中退','成退','小卷成退')
+        </if>
+        <if test="type != '' and type != null and type == '退火'">
+            AND apo.PROCESS IN ('中退','成退','小卷成退')
+        </if>
+        and apope.WORKSTATUS = '待开工'
+        and ifnull(apope.PREVIOUSPROCESSESIDS,'')='' -- 没有前道
+        and (abo.PLANHAVEMATERIALDATE &lt; #{chongpaiEndDate} OR abo.PLANHAVEMATERIALDATE is null)-- 预计来料时间在调度结束时间之前
+        and apope.PLANSTARTDATE between #{chongpaiStartDate} and DATE_ADD(#{chongpaiStartDate}, INTERVAL 5 DAY) -- 调度开始时间+5天内计划开工
+    </update>
     <select id="checkConflictByBlankId" resultType="java.lang.Integer">
         select count(*) from aps_process_operation_process_equ
             <where>