Ver código fonte

aps-错误数据挪动

sucheng 4 meses atrás
pai
commit
c88ca8b5ce

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

@@ -182,4 +182,6 @@ public interface ApsBlankOrderDao extends BaseMapper<ApsBlankOrderDo> {
     List<ApsBlankOrderDo> selectBlankByStartNum(@Param("startNum") String startNum);
 
     int moveErrorProcessEqu(@Param("chongpaiStartDate") DateTime chongpaiStartDate, @Param("chongpaiEndDate") DateTime chongpaiEndDate, @Param("tenantId") String tenantId, @Param("workshopin") Integer workshopin, @Param("workshopcross") Integer workshopcross);
+
+    int moveErrorProcessEqu2(@Param("chongpaiStartDate") DateTime chongpaiStartDate, @Param("chongpaiEndDate") DateTime chongpaiEndDate, @Param("tenantId") String tenantId);
 }

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

@@ -4365,6 +4365,18 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
                     break;
                 }
             }
+            int safeCount2 = 0;
+            while (true) {
+                int updateCount2 = this.baseMapper.moveErrorProcessEqu2(chongpaiStartDate, chongpaiEndDate, CXCommonUtils.getCurrentUserFactoryId(currentUser));
+                if (updateCount2 <= 0) {
+                    break;
+                }
+                //安全设置,防止死循环
+                safeCount2 += 1;
+                if (safeCount2 >= 50) {
+                    break;
+                }
+            }
             //锁定所有 未锁定的 作业和作业明细
             apsProcessOperationProcessEquService.update(new LambdaUpdateWrapper<ApsProcessOperationProcessEquDo>()
                     .set(ApsProcessOperationProcessEquDo::getLockmarkdetail, "y")

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

@@ -390,6 +390,24 @@
             )
 
     </update>
+    <update id="moveErrorProcessEqu2">
+        update
+        aps_process_operation_process_equ apope
+        join aps_process_operation apo on apo.ID = apope.PROCESSID
+        join aps_process_operation_process_equ preapope on apope.PREVIOUSPROCESSESIDS = preapope.id
+        set
+        apope.PLANENDDATE=DATE_ADD(preapope.PLANENDDATE,INTERVAL TIMESTAMPdiff(SECOND, apope.PLANSTARTDATE, apope.PLANENDDATE) SECOND),
+        apope.PLANSTARTDATE=preapope.PLANENDDATE
+        WHERE
+        apope.deleted = '0' AND apo.DELETED = '0' AND preapope.DELETED = '0'
+        and apope.TENANTID = #{tenantId}
+        and apo.PROCESS != '铸轧'
+        and apope.WORKSTATUS = '待开工'
+        AND apope.PLANSTARTDATE between #{chongpaiStartDate} and #{chongpaiEndDate} -- 在调度时间范围内开工
+        and apope.PROCESSDEVICEID = preapope.PROCESSDEVICEID
+        and ifnull(apo.MINFLOWWAITMIN,0)=0
+        and preapope.PLANSTARTDATE &lt; #{chongpaiStartDate}
+    </update>
     <select id="checkConflictByBlankId" resultType="java.lang.Integer">
         select count(*) from aps_process_operation_process_equ
             <where>