|
@@ -432,6 +432,32 @@
|
|
|
and ifnull(apo.MINFLOWWAITMIN,0)=0
|
|
|
and preapope.PLANSTARTDATE < #{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 < #{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>
|