Преглед изворни кода

aps-编辑工序作业明细时sql增加修改人和修改时间

sucheng пре 5 месеци
родитељ
комит
bfff40c877

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

@@ -73,9 +73,9 @@ public interface ApsBlankOrderDao extends BaseMapper<ApsBlankOrderDo> {
 //            "and PROCESSID NOT IN (select ID from aps_process_operation where DELETED='0' and BLANKID in (${hasIds}) AND LOCKMARK='y')")
 //    void setProDetailLockMark(@Param("hasIds") String hasIds);
 
-    @Select("UPDATE aps_process_operation_process_equ set LOCKMARK='n' where DELETED='0' and BLANKID in (${hasIds}) " +
+    @Select("UPDATE aps_process_operation_process_equ set LOCKMARK='n',MODIFYDATE = NOW(),MODIFYUSERID = #{userId},MODIFYUSERNAME = #{userName} where DELETED='0' and BLANKID in (${hasIds}) " +
             "and (LOCKMARKDETAIL is null or  LOCKMARKDETAIL != 'y')")
-    void setProDetailLockMark(@Param("hasIds") String hasIds);
+    void setProDetailLockMark(@Param("hasIds") String hasIds,@Param("userId") String userId,@Param("userName") String userName);
 
     @Select("select * FROM (\n" +
             "select PROCESSDEVICEID,PLANSTARTDATE,PLANENDDATE,GROUP_CONCAT(PROCESSID) PROCESSID from (select * from aps_process_operation_process_equ " +
@@ -118,8 +118,8 @@ public interface ApsBlankOrderDao extends BaseMapper<ApsBlankOrderDo> {
     @Update("update aps_process_operation set SECONDROLL = SECONDROLL+1 where ID = #{processoperationid}")
     void processAddSecondRoll(@Param("processoperationid") String processoperationid);
 
-    @Update("update aps_process_operation_process_equ set BACHMATERIALPROCESS = REPLACE(REPLACE(REPLACE(BACHMATERIALPROCESS,'${batchnumber},',''),',${batchnumber}',''),'${batchnumber}','') where DELETED = 0 AND PROCESSID IN (select ID from aps_process_operation where DELETED = 0 AND PREVIOUSPROCESSID = #{processoperationid})")
-    void processDeleteBatchNumber(@Param("batchnumber") String batchnumber, @Param("processoperationid") String processoperationid);
+//    @Update("update aps_process_operation_process_equ set BACHMATERIALPROCESS = REPLACE(REPLACE(REPLACE(BACHMATERIALPROCESS,'${batchnumber},',''),',${batchnumber}',''),'${batchnumber}','') where DELETED = 0 AND PROCESSID IN (select ID from aps_process_operation where DELETED = 0 AND PREVIOUSPROCESSID = #{processoperationid})")
+//    void processDeleteBatchNumber(@Param("batchnumber") String batchnumber, @Param("processoperationid") String processoperationid);
 
     @Update("update sys_mind_mapping set DELETED = 1 where BSID = #{id}")
     void removeMindMappingByBlankId(@Param("id") String id);
@@ -136,8 +136,8 @@ public interface ApsBlankOrderDao extends BaseMapper<ApsBlankOrderDo> {
     @Select("SELECT * FROM aps_blank_order WHERE DELETED = 0 AND PRODUCTIONORDERID = #{productionorderId}")
     List<ApsBlankOrderDo> selectBlankOrderByProductionorderId(@Param("productionorderId") String productionorderId);
 
-    @Update("update aps_process_operation_process_equ set BACHMATERIALPROCESS = REPLACE(REPLACE(REPLACE(BACHMATERIALPROCESS,'${batchnumber},',''),',${batchnumber}',''),'${batchnumber}','') where DELETED = 0 AND PREVIOUSPROCESSESIDS = #{processoperationequid} AND PROCESSID IN (select ID from aps_process_operation where DELETED = 0 AND PLANINPUTID = #{joboutputmaterialid})")
-    void updateBatchNumberByBorrow(@Param("batchnumber") String batchnumber, @Param("processoperationequid") String processoperationequid, @Param("joboutputmaterialid") String joboutputmaterialid);
+//    @Update("update aps_process_operation_process_equ set BACHMATERIALPROCESS = REPLACE(REPLACE(REPLACE(BACHMATERIALPROCESS,'${batchnumber},',''),',${batchnumber}',''),'${batchnumber}','') where DELETED = 0 AND PREVIOUSPROCESSESIDS = #{processoperationequid} AND PROCESSID IN (select ID from aps_process_operation where DELETED = 0 AND PLANINPUTID = #{joboutputmaterialid})")
+//    void updateBatchNumberByBorrow(@Param("batchnumber") String batchnumber, @Param("processoperationequid") String processoperationequid, @Param("joboutputmaterialid") String joboutputmaterialid);
 
     List<UpdateBlankDeliveryDateVo> getBlankDeliveryDate(@Param("blankId") String blankId);
 

+ 5 - 5
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/dao/ApsProcessOperationDao.java

@@ -51,10 +51,10 @@ public interface ApsProcessOperationDao extends BaseMapper<ApsProcessOperationDo
 
     List<ProcessIdRelationVo> getAllNextProcessOperationById(@Param("ids") List<String> ids);
 
-    @Update("update aps_process_operation_process_equ set BACHMATERIALPROCESS = concat(BACHMATERIALPROCESS,',',#{batchnumber}) where DELETED = 0 AND ID = #{processoperationid}")
-    void updateBatchNumberByProcessId(@Param("batchnumber") String batchnumber, @Param("processoperationid") String processoperationid);
+//    @Update("update aps_process_operation_process_equ set BACHMATERIALPROCESS = concat(BACHMATERIALPROCESS,',',#{batchnumber}) where DELETED = 0 AND ID = #{processoperationid}")
+//    void updateBatchNumberByProcessId(@Param("batchnumber") String batchnumber, @Param("processoperationid") String processoperationid);
 
-    void updateBatchNumberByProcessList(@Param("batchnumber") String batchnumber, @Param("processIdList") List<String> processIdList);
+//    void updateBatchNumberByProcessList(@Param("batchnumber") String batchnumber, @Param("processIdList") List<String> processIdList);
 
     @Select("select ID,PLANPROCESSRALL from aps_process_operation where DELETED='0' and BLANKID=#{blankid}")
     List<ApsProcessOperationDo> getProcessOperation(@Param("blankid") String blankid);
@@ -89,8 +89,8 @@ public interface ApsProcessOperationDao extends BaseMapper<ApsProcessOperationDo
     @Select("SELECT * FROM aps_process_operation_process_equ WHERE DELETED = 0 AND PREVIOUSPROCESSESIDS=#{equId} order by PLANSTARTDATE desc")
     List<ApsProcessOperationProcessEquDo> getNextProcessOperationEqus(@Param("equId") String equId);
 
-    @Update("update aps_process_operation_process_equ set BACHMATERIALPROCESS = IF(BACHMATERIALPROCESS is null || BACHMATERIALPROCESS = '',#{batchnumber},concat(BACHMATERIALPROCESS,',',#{batchnumber})) where DELETED = 0 AND PREVIOUSPROCESSESIDS = #{previousprocessesids}")
-    void updateBatchNumberByPrevious(@Param("batchnumber") String batchnumber, @Param("previousprocessesids") String previousprocessesids);
+//    @Update("update aps_process_operation_process_equ set BACHMATERIALPROCESS = IF(BACHMATERIALPROCESS is null || BACHMATERIALPROCESS = '',#{batchnumber},concat(BACHMATERIALPROCESS,',',#{batchnumber})) where DELETED = 0 AND PREVIOUSPROCESSESIDS = #{previousprocessesids}")
+//    void updateBatchNumberByPrevious(@Param("batchnumber") String batchnumber, @Param("previousprocessesids") String previousprocessesids);
 
     @Select("SELECT CRAFTROUTEID as ID,ROUTEPRODUCTTYPEID as PRODUCTTYPE,ROUTEMETAL as METAL,ROUTEMETALSTATE as METALSTATE,ROUTETHICKSTR as THICKSTR,ROUTETHICKEND as THICKEND," +
             "ROUTEWIDTHSTR as WIDTHSTR,ROUTEWIDTHEND as WIDTHEND,ROUTELENGTHSTR as LENGTHSTR,ROUTELENGTHEND as LENGTHEND FROM aps_blank_order WHERE ID=#{newblankid}")

+ 23 - 23
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/dao/ApsProcessOperationProcessEquDao.java

@@ -17,25 +17,25 @@ import java.util.List;
  */
 public interface ApsProcessOperationProcessEquDao extends BaseMapper<ApsProcessOperationProcessEquDo> {
 
-    void updateBachmaterialprocessByIds(@Param("ids") List<String> ids, @Param("batchNum") String batchNum,
-                                        @Param("nextIds") List<String> nextProcessesIds);
-
-    /**
-     * 更新 工序明细的 实际完工时间 完工状态 作业状态  已检验卷数 未完工卷数
-     *
-     * @param id                  工序明细表ID aps_process_operation_process_equ
-     * @param currentCheckNum     检验卷数
-     * @param qualifiedQuantity   合格数量
-     * @param unqualifiedQuantity 不合格数量
-     * @param previousprocessid   当前工序的上一个工序ID
-     * @param processOperationId  当前工序的ID
-     */
-    void updateAboutCheckBatchNum(@Param("id") String id,
-                                  @Param("currentCheckNum") Integer currentCheckNum,
-                                  @Param("qualifiedQuantity") Integer qualifiedQuantity,
-                                  @Param("unqualifiedQuantity") Integer unqualifiedQuantity,
-                                  @Param("previousprocessid") String previousprocessid,
-                                  @Param("processOperationId") String processOperationId);
+//    void updateBachmaterialprocessByIds(@Param("ids") List<String> ids, @Param("batchNum") String batchNum,
+//                                        @Param("nextIds") List<String> nextProcessesIds);
+
+//    /**
+//     * 更新 工序明细的 实际完工时间 完工状态 作业状态  已检验卷数 未完工卷数
+//     *
+//     * @param id                  工序明细表ID aps_process_operation_process_equ
+//     * @param currentCheckNum     检验卷数
+//     * @param qualifiedQuantity   合格数量
+//     * @param unqualifiedQuantity 不合格数量
+//     * @param previousprocessid   当前工序的上一个工序ID
+//     * @param processOperationId  当前工序的ID
+//     */
+//    void updateAboutCheckBatchNum(@Param("id") String id,
+//                                  @Param("currentCheckNum") Integer currentCheckNum,
+//                                  @Param("qualifiedQuantity") Integer qualifiedQuantity,
+//                                  @Param("unqualifiedQuantity") Integer unqualifiedQuantity,
+//                                  @Param("previousprocessid") String previousprocessid,
+//                                  @Param("processOperationId") String processOperationId);
 
     List<GanttVos> getGanttDataList(@Param("startTime") Date startTime,
                                     @Param("endTime") Date endTime,
@@ -50,7 +50,7 @@ public interface ApsProcessOperationProcessEquDao extends BaseMapper<ApsProcessO
                                     @Param("equName") String  equName,
                                     @Param("blankNumber")String blankNumber);
 
-    void updateAboutStateByProcessId(@Param("updateIds") List<ProcessIdRelationVo> updateIds);
+//    void updateAboutStateByProcessId(@Param("updateIds") List<ProcessIdRelationVo> updateIds);
 
 
     @Select("select PROCESSID AS 'processOperationId',MAX(CLOSESTATUS) AS 'productionStatus' from aps_process_operation_process_equ where DELETED = 0 AND PROCESSID = (select PROCESSID from aps_process_operation_process_equ where ID = #{processOperationEquId}) GROUP BY PROCESSID")
@@ -76,9 +76,9 @@ public interface ApsProcessOperationProcessEquDao extends BaseMapper<ApsProcessO
     @Select("select apo.ID AS 'blankId',MIN(apo2.PROCESSSTATUS) AS 'minProductionStatus',MAX(apo2.PROCESSSTATUS) AS 'maxProductionStatus' from aps_blank_order apo LEFT JOIN aps_process_operation apo2 ON apo2.DELETED = 0 AND apo.ID = apo2.BLANKID where apo.DELETED = 0 AND apo.PRODUCTIONORDERID = #{orderId} GROUP BY apo.ID")
     List<CommonUpdateProductionStatusReq> selectProcessMinAndmaxStatusList(@Param("orderId") String orderId);
 
-    void publish(@Param("productIdList") List<String> productIdList);
+    void publish(@Param("productIdList") List<String> productIdList,@Param("userId") String userId,@Param("userName")String userName);
 
-    void publishCancel(@Param("productIdList") List<String> productIdList);
+    void publishCancel(@Param("productIdList") List<String> productIdList,@Param("userId") String userId,@Param("userName")String userName);
 
     List<OptionalEquipmentVo> getOptionalEquipmentById(@Param("idList")List<String> id,
                                                        @Param("factoryId") String factoryId,
@@ -131,7 +131,7 @@ public interface ApsProcessOperationProcessEquDao extends BaseMapper<ApsProcessO
 //    @Select("select count(1) from aps_process_operation_process_equ where DELETED = 0 AND PROCESSDEVICEID = #{processdeviceid} AND WORKSTATUS = '已完工'  AND OLDPLANSTARTDATE = #{planStartDate}")
     int selectHaveOtherDevice2(@Param("processdeviceid") String processdeviceid,@Param("heatNumber") String heatNumber,@Param("yearMonth") String yearMonth);
 
-    void repairePlanStartDate();
+    void repairePlanStartDate(@Param("userId") String userId,@Param("userName")String userName);
 }
 
 

+ 4 - 4
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/dao/ApsReportRecordsDao.java

@@ -53,11 +53,11 @@ public interface ApsReportRecordsDao extends BaseMapper<ApsReportRecordsDo> {
     @Select("select arr.ID from aps_process_operation apo LEFT JOIN aps_report_records arr ON arr.DELETED = 0 AND arr.PROCESSOPERATIONID = apo.ID LEFT JOIN aps_report_output aro ON aro.DELETED = 0 AND aro.MAINID = arr.ID where apo.DELETED = 0 AND aro.OUTPUTNUMBER = #{inputBatchNumber} AND aro.CHECKSTATUS = '已检验' ORDER BY arr.CREATEDATE desc limit 1")
     String selectLastReoprtRecordByBatchNumber(@Param("inputBatchNumber") String inputBatchNumber);
 
-    @Update("update aps_process_operation_process_equ set BACHMATERIALPROCESS = REPLACE(REPLACE(REPLACE(BACHMATERIALPROCESS,'${inputBatchNumber},',''),',${inputBatchNumber}',''),'${inputBatchNumber}','') where DELETED = 0 AND PREVIOUSPROCESSESIDS = #{previousprocessesids}")
-    void updateAllProcessEquBatchNumber(@Param("inputBatchNumber") String inputBatchNumber, @Param("previousprocessesids") String previousprocessesids);
+//    @Update("update aps_process_operation_process_equ set BACHMATERIALPROCESS = REPLACE(REPLACE(REPLACE(BACHMATERIALPROCESS,'${inputBatchNumber},',''),',${inputBatchNumber}',''),'${inputBatchNumber}','') where DELETED = 0 AND PREVIOUSPROCESSESIDS = #{previousprocessesids}")
+//    void updateAllProcessEquBatchNumber(@Param("inputBatchNumber") String inputBatchNumber, @Param("previousprocessesids") String previousprocessesids);
 
-    @Update("update aps_process_operation_process_equ set BACHMATERIALPROCESS = REPLACE(REPLACE(REPLACE(BACHMATERIALPROCESS,'${inputBatchNumber},',''),',${inputBatchNumber}',''),'${inputBatchNumber}','') where DELETED = 0 AND ID IN ('${ids}')")
-    void updateAllProcessEquBatchNumberByIds(@Param("inputBatchNumber") String inputBatchNumber, @Param("ids") String ids);
+//    @Update("update aps_process_operation_process_equ set BACHMATERIALPROCESS = REPLACE(REPLACE(REPLACE(BACHMATERIALPROCESS,'${inputBatchNumber},',''),',${inputBatchNumber}',''),'${inputBatchNumber}','') where DELETED = 0 AND ID IN ('${ids}')")
+//    void updateAllProcessEquBatchNumberByIds(@Param("inputBatchNumber") String inputBatchNumber, @Param("ids") String ids);
 
     @Select("select * from aps_process_operation_process_equ where DELETED = 0 AND ID != #{id} AND PROCESSDEVICEID = #{processdeviceid} AND PLANSTARTDATE = #{planstartdate} AND (WAITREPORTID is null or WAITREPORTID = '') AND WORKSTATUS = '待开工'")
     List<ApsProcessOperationProcessEquDo> selectOtherMergeProcessEqu(@Param("id") String id, @Param("processdeviceid") String processdeviceid, @Param("planstartdate") Date planstartdate);

+ 43 - 43
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsProcessOperationProcessEquServiceImpl.java

@@ -92,49 +92,49 @@ public class ApsProcessOperationProcessEquServiceImpl extends ServiceImpl<ApsPro
     @Autowired
     private ApsScheduleConfigService apsScheduleConfigService;
 
-    /**
-     * 更新工序的待加工批次号信息
-     *
-     * @param ids
-     * @param batchNumn
-     */
-    public void updateBachmaterialprocessByIds(List<String> ids, String batchNumn, String nextprocessesids) {
-        if (StringUtils.isNotBlank(batchNumn)) {
-            apsProcessOperationProcessEquDao.updateBachmaterialprocessByIds(ids, batchNumn,
-                    StringUtils.isBlank(nextprocessesids) ? null : Arrays.asList(nextprocessesids.split(","))
-            );
-        }
-    }
-
-    /**
-     * 更新 工序明细的 实际完工时间 完工状态 作业状态  已检验卷数 未完工卷数
-     *
-     * @param id                  工序明细表ID aps_process_operation_process_equ
-     * @param currentCheckNum     检验卷数
-     * @param qualifiedQuantity   合格数量
-     * @param unqualifiedQuantity 不合格数量
-     * @param previousprocessid   当前工序的上一个工序ID
-     * @param processOperationId  当前工序的ID
-     */
-    public void updateAboutCheckBatchNum(String id, Integer currentCheckNum, Integer qualifiedQuantity,
-                                         Integer unqualifiedQuantity, String previousprocessid, String processOperationId) {
-        apsProcessOperationProcessEquDao.updateAboutCheckBatchNum(id, currentCheckNum, qualifiedQuantity,
-                unqualifiedQuantity, previousprocessid, processOperationId);
-    }
-
-    /**
-     * 更新后续工序的
-     *
-     * @param updateIds
-     */
-    public void updateAboutStateByProcessId(List<ProcessIdRelationVo> updateIds) {
-        // 防止sql 过长拆分
-        List<List<ProcessIdRelationVo>> partition = Lists.partition(updateIds, 20);
-        partition.forEach(data -> {
-            apsProcessOperationProcessEquDao.updateAboutStateByProcessId(data);
-        });
-
-    }
+//    /**
+//     * 更新工序的待加工批次号信息
+//     *
+//     * @param ids
+//     * @param batchNumn
+//     */
+//    public void updateBachmaterialprocessByIds(List<String> ids, String batchNumn, String nextprocessesids) {
+//        if (StringUtils.isNotBlank(batchNumn)) {
+//            apsProcessOperationProcessEquDao.updateBachmaterialprocessByIds(ids, batchNumn,
+//                    StringUtils.isBlank(nextprocessesids) ? null : Arrays.asList(nextprocessesids.split(","))
+//            );
+//        }
+//    }
+
+//    /**
+//     * 更新 工序明细的 实际完工时间 完工状态 作业状态  已检验卷数 未完工卷数
+//     *
+//     * @param id                  工序明细表ID aps_process_operation_process_equ
+//     * @param currentCheckNum     检验卷数
+//     * @param qualifiedQuantity   合格数量
+//     * @param unqualifiedQuantity 不合格数量
+//     * @param previousprocessid   当前工序的上一个工序ID
+//     * @param processOperationId  当前工序的ID
+//     */
+//    public void updateAboutCheckBatchNum(String id, Integer currentCheckNum, Integer qualifiedQuantity,
+//                                         Integer unqualifiedQuantity, String previousprocessid, String processOperationId) {
+//        apsProcessOperationProcessEquDao.updateAboutCheckBatchNum(id, currentCheckNum, qualifiedQuantity,
+//                unqualifiedQuantity, previousprocessid, processOperationId);
+//    }
+
+//    /**
+//     * 更新后续工序的
+//     *
+//     * @param updateIds
+//     */
+//    public void updateAboutStateByProcessId(List<ProcessIdRelationVo> updateIds) {
+//        // 防止sql 过长拆分
+//        List<List<ProcessIdRelationVo>> partition = Lists.partition(updateIds, 20);
+//        partition.forEach(data -> {
+//            apsProcessOperationProcessEquDao.updateAboutStateByProcessId(data);
+//        });
+//
+//    }
 
     @Override
     @Transactional

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

@@ -200,7 +200,9 @@ public class ApsProductionOrderServiceImpl extends ServiceImpl<ApsProductionOrde
         // 更新工序作业的生产状态和是否锁定=是
         apsProcessOperationDao.publish(productionOrderIds);
 
-        apsProcessOperationProcessEquDao.publish(productionOrderIds);
+        //当前用户信息
+        SysUserVo currentUser = CXCommonUtils.getCurrentUser();
+        apsProcessOperationProcessEquDao.publish(productionOrderIds,currentUser.getId(),currentUser.getName());
         // 更新坯料计划的生产状态
         apsBlankOrderDao.publish(productionOrderIds);
         // 更新产品明细的生产状态
@@ -225,7 +227,9 @@ public class ApsProductionOrderServiceImpl extends ServiceImpl<ApsProductionOrde
     public R publishCancel(List<String> productionOrderIds) {
         // 更新工序作业的生产状态和是否锁定=是
         apsProcessOperationDao.publishCancel(productionOrderIds);
-        apsProcessOperationProcessEquDao.publishCancel(productionOrderIds);
+        //当前用户信息
+        SysUserVo currentUser = CXCommonUtils.getCurrentUser();
+        apsProcessOperationProcessEquDao.publishCancel(productionOrderIds,currentUser.getId(),currentUser.getName());
         // 更新坯料计划的生产状态
         apsBlankOrderDao.publishCancel(productionOrderIds);
         // 更新产品明细的生产状态

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

@@ -264,7 +264,7 @@ public class ApsServiceImpl implements ApsService {
             // 更新排程明细数据锁定状态为否
             /*processOperationProcessEquService.update(new LambdaUpdateWrapper<ApsProcessOperationProcessEquDo>().set(ApsProcessOperationProcessEquDo::getLockmark,"n")
                     .in(ApsProcessOperationProcessEquDo::getBlankid,blankOrderIds));*/
-            apsBlankOrderDao.setProDetailLockMark(blankidStrs);
+            apsBlankOrderDao.setProDetailLockMark(blankidStrs,currentUser.getId(),currentUser.getName());
         }
         // 排程
         List<ProductionScheduleVo> productionScheduleVos = new ArrayList<>();
@@ -638,7 +638,7 @@ public class ApsServiceImpl implements ApsService {
             // 更新排程明细数据锁定状态为否
             /*processOperationProcessEquService.update(new LambdaUpdateWrapper<ApsProcessOperationProcessEquDo>().set(ApsProcessOperationProcessEquDo::getLockmark,"n")
                     .in(ApsProcessOperationProcessEquDo::getBlankid,blankOrderIds));*/
-            apsBlankOrderDao.setProDetailLockMark(blankidStrs);
+            apsBlankOrderDao.setProDetailLockMark(blankidStrs,currentUser.getId(),currentUser.getName());
         }
         // 排程
         List<ProductionScheduleVo> productionScheduleVos = new ArrayList<>();
@@ -786,7 +786,7 @@ public class ApsServiceImpl implements ApsService {
                     apsBlankOrderService.apsAfter(productionScheduleRetVo, apsBlankOrders, currentUser, apsType);
                 }
                 //还原排程过程中,开工/报工的作业的计划时间
-                apsProcessOperationProcessEquDao.repairePlanStartDate();
+                apsProcessOperationProcessEquDao.repairePlanStartDate(currentUser.getId(),currentUser.getName());
 
                 if (StrUtil.isNotBlank(productionScheduleRetVo.getMsg())) {
                     // 排程异常后恢复历史排程结果为锁定状态

+ 10 - 10
cx-aps/cx-aps-common/src/main/resources/mybatis/ApsProcessOperationDao.xml

@@ -44,16 +44,16 @@
             ID =#{id}
         </where>
     </update>
-    <update id="updateBatchNumberByProcessList">
-        update aps_process_operation_process_equ
-        set BACHMATERIALPROCESS = IF(BACHMATERIALPROCESS is null || BACHMATERIALPROCESS =
-        '',#{batchnumber},concat(BACHMATERIALPROCESS,',',#{batchnumber}))
-        where DELETED = 0
-        AND PROCESSID in
-        <foreach collection="processIdList" separator="," open="(" item="item" close=")">
-            #{item}
-        </foreach>
-    </update>
+<!--    <update id="updateBatchNumberByProcessList">-->
+<!--        update aps_process_operation_process_equ-->
+<!--        set BACHMATERIALPROCESS = IF(BACHMATERIALPROCESS is null || BACHMATERIALPROCESS =-->
+<!--        '',#{batchnumber},concat(BACHMATERIALPROCESS,',',#{batchnumber}))-->
+<!--        where DELETED = 0-->
+<!--        AND PROCESSID in-->
+<!--        <foreach collection="processIdList" separator="," open="(" item="item" close=")">-->
+<!--            #{item}-->
+<!--        </foreach>-->
+<!--    </update>-->
     <resultMap id="ProcessIdRelationMap" type="com.rongwei.bsentity.vo.ProcessIdRelationVo">
         <result property="id" column="ID" jdbcType="VARCHAR"/>
         <result property="nextprocessid" column="NEXTPROCESSID" jdbcType="VARCHAR"/>

+ 147 - 135
cx-aps/cx-aps-common/src/main/resources/mybatis/ApsProcessOperationProcessEquDao.xml

@@ -45,88 +45,88 @@
         REPORTROLL,CHECKOUTROLL,UNFINISHROLL,
         WORKSTATUS,BACHMATERIALPROCESS,WAITREPORTID
     </sql>
-    <update id="updateBachmaterialprocessByIds">
-        update aps_process_operation_process_equ set BACHMATERIALPROCESS =
-        CONCAT_WS(',',BACHMATERIALPROCESS,#{batchNum})
-        <where>
-            PROCESSID in
-            <foreach collection="ids" separator="," open="(" close=")" item="id">
-                #{id}
-            </foreach>
-            <if test="nextIds != null and nextIds.size()>0">
-               and ID in
-                <foreach collection="nextIds" separator="," open="(" close=")" item="id">
-                    #{id}
-                </foreach>
-            </if>
-        </where>
-    </update>
-    <update id="updateAboutCheckBatchNum">
-        update aps_process_operation_process_equ apope
-        <set>
-            <!--  OUTPUTQUALIFIEDNUM = IFNULL(OUTPUTQUALIFIEDNUM,0)+ #{qualifiedQuantity},
-             OUTPUTUNQUALIFIEDNUM = IFNULL(OUTPUTUNQUALIFIEDNUM,0) +#{unqualifiedQuantity},-->
-            apope.CHECKOUTROLL = IFNULL(CHECKOUTROLL,0) +#{currentCheckNum},
-            apope.UNFINISHROLL = PLANPROCESSRALL -#{currentCheckNum}
-            <choose>
-                <when test="previousprocessid == null and previousprocessid == ''">
-                    <!-- 不存在上一个工序 未完工卷数等于0时 更新 为已完工  -->
-                    <!-- 完工状态-->
-#                     apope.CLOSESTATUS= CASE
-#                     WHEN (apope.PLANPROCESSRALL - #{currentCheckNum}) = 0 THEN '已完工'
-#                     ELSE '未完工'
-#                     END,
-                    <!--  作业状态-->
-<!--                    apope.WORKSTATUS= CASE-->
-<!--                    WHEN (apope.PLANPROCESSRALL -#{currentCheckNum}) = 0 THEN '已完工'-->
-<!--                    ELSE apope.WORKSTATUS-->
-<!--                    END,-->
-<!--                    &lt;!&ndash;实际完工时间&ndash;&gt;-->
-<!--                    apope.ACTUALFINISHDATE = CASE-->
-<!--                    WHEN (apope.PLANPROCESSRALL - #{currentCheckNum}) = 0 THEN NOW()-->
-<!--                    ELSE apope.ACTUALFINISHDATE-->
-<!--                    END-->
-                </when>
-                <otherwise>
-                    <!-- 存在上一个工序 上道工序作业已完工 当前工序作业明细的已开工卷数=已检验卷数-->
-<!--                    apope.CLOSESTATUS =-->
-<!--                    CASE-->
-<!--                    &lt;!&ndash;并且当前工序明细的已开工卷数=已检验卷数&ndash;&gt;-->
-<!--                        WHEN-->
-<!--                        (-->
-<!--                        &lt;!&ndash;并且上道工序作业已完工状态=已完工&ndash;&gt;-->
-<!--                         select (select apo.CLOSESTATUS='已完工' from aps_process_operation apo where apo.ID =#{previousprocessid} )-->
-<!--                        &lt;!&ndash;并且作业明细待加工料卷批次号数量-工序作业已取消卷数<=0&ndash;&gt;-->
-<!--                        and (select IFNULL(LENGTH(apope.BACHMATERIALPROCESS) - LENGTH(REPLACE(apope.BACHMATERIALPROCESS, ',',-->
-<!--                        '')) + 1 ,0)-IFNULL(apo.CANCELROLL,0)&lt;=0 from aps_process_operation apo where apo.ID =#{processOperationId}-->
-<!--                        ) and apope.STARTINGROLL = apope.CHECKOUTROLL+#{currentCheckNum}  from dual )THEN '已完工'-->
-<!--                        ELSE '未完工'-->
-<!--                    END,-->
-<!--                    apope.WORKSTATUS =-->
-<!--                    CASE-->
-<!--                        WHEN  (select (select apo.CLOSESTATUS='已完工' from aps_process_operation apo where apo.ID =#{previousprocessid} )-->
-<!--                    &lt;!&ndash;并且作业明细待加工料卷批次号数量-工序作业已取消卷数<=0&ndash;&gt;-->
-<!--                    and (select IFNULL(LENGTH(apope.BACHMATERIALPROCESS) - LENGTH(REPLACE(apope.BACHMATERIALPROCESS, ',',-->
-<!--                    '')) + 1 ,0)-IFNULL(apo.CANCELROLL,0)&lt;=0 from aps_process_operation apo where apo.ID =#{processOperationId}-->
-<!--                    ) and apope.STARTINGROLL = apope.CHECKOUTROLL+#{currentCheckNum}  from dual) THEN '已完工'-->
-<!--                        ELSE apope.WORKSTATUS-->
-<!--                    END,-->
-<!--                    apope.ACTUALFINISHDATE =  CASE-->
-<!--                    WHEN  (select (select apo.CLOSESTATUS='已完工' from aps_process_operation apo where apo.ID =#{previousprocessid} )-->
-<!--                    &lt;!&ndash;并且作业明细待加工料卷批次号数量-工序作业已取消卷数<=0&ndash;&gt;-->
-<!--                    and (select IFNULL(LENGTH(apope.BACHMATERIALPROCESS) - LENGTH(REPLACE(apope.BACHMATERIALPROCESS, ',',-->
-<!--                    '')) + 1 ,0)-IFNULL(apo.CANCELROLL,0)&lt;=0 from aps_process_operation apo where apo.ID =#{processOperationId}-->
-<!--                    ) and apope.STARTINGROLL = apope.CHECKOUTROLL+#{currentCheckNum}  from dual) THEN NOW()-->
-<!--                    ELSE apope.ACTUALFINISHDATE-->
-<!--                    END-->
-                </otherwise>
-            </choose>
+<!--    <update id="updateBachmaterialprocessByIds">-->
+<!--        update aps_process_operation_process_equ set BACHMATERIALPROCESS =-->
+<!--        CONCAT_WS(',',BACHMATERIALPROCESS,#{batchNum})-->
+<!--        <where>-->
+<!--            PROCESSID in-->
+<!--            <foreach collection="ids" separator="," open="(" close=")" item="id">-->
+<!--                #{id}-->
+<!--            </foreach>-->
+<!--            <if test="nextIds != null and nextIds.size()>0">-->
+<!--               and ID in-->
+<!--                <foreach collection="nextIds" separator="," open="(" close=")" item="id">-->
+<!--                    #{id}-->
+<!--                </foreach>-->
+<!--            </if>-->
+<!--        </where>-->
+<!--    </update>-->
+<!--    <update id="updateAboutCheckBatchNum">-->
+<!--        update aps_process_operation_process_equ apope-->
+<!--        <set>-->
+<!--            &lt;!&ndash;  OUTPUTQUALIFIEDNUM = IFNULL(OUTPUTQUALIFIEDNUM,0)+ #{qualifiedQuantity},-->
+<!--             OUTPUTUNQUALIFIEDNUM = IFNULL(OUTPUTUNQUALIFIEDNUM,0) +#{unqualifiedQuantity},&ndash;&gt;-->
+<!--            apope.CHECKOUTROLL = IFNULL(CHECKOUTROLL,0) +#{currentCheckNum},-->
+<!--            apope.UNFINISHROLL = PLANPROCESSRALL -#{currentCheckNum}-->
+<!--            <choose>-->
+<!--                <when test="previousprocessid == null and previousprocessid == ''">-->
+<!--                    &lt;!&ndash; 不存在上一个工序 未完工卷数等于0时 更新 为已完工  &ndash;&gt;-->
+<!--                    &lt;!&ndash; 完工状态&ndash;&gt;-->
+<!--#                     apope.CLOSESTATUS= CASE-->
+<!--#                     WHEN (apope.PLANPROCESSRALL - #{currentCheckNum}) = 0 THEN '已完工'-->
+<!--#                     ELSE '未完工'-->
+<!--#                     END,-->
+<!--                    &lt;!&ndash;  作业状态&ndash;&gt;-->
+<!--&lt;!&ndash;                    apope.WORKSTATUS= CASE&ndash;&gt;-->
+<!--&lt;!&ndash;                    WHEN (apope.PLANPROCESSRALL -#{currentCheckNum}) = 0 THEN '已完工'&ndash;&gt;-->
+<!--&lt;!&ndash;                    ELSE apope.WORKSTATUS&ndash;&gt;-->
+<!--&lt;!&ndash;                    END,&ndash;&gt;-->
+<!--&lt;!&ndash;                    &lt;!&ndash;实际完工时间&ndash;&gt;&ndash;&gt;-->
+<!--&lt;!&ndash;                    apope.ACTUALFINISHDATE = CASE&ndash;&gt;-->
+<!--&lt;!&ndash;                    WHEN (apope.PLANPROCESSRALL - #{currentCheckNum}) = 0 THEN NOW()&ndash;&gt;-->
+<!--&lt;!&ndash;                    ELSE apope.ACTUALFINISHDATE&ndash;&gt;-->
+<!--&lt;!&ndash;                    END&ndash;&gt;-->
+<!--                </when>-->
+<!--                <otherwise>-->
+<!--                    &lt;!&ndash; 存在上一个工序 上道工序作业已完工 当前工序作业明细的已开工卷数=已检验卷数&ndash;&gt;-->
+<!--&lt;!&ndash;                    apope.CLOSESTATUS =&ndash;&gt;-->
+<!--&lt;!&ndash;                    CASE&ndash;&gt;-->
+<!--&lt;!&ndash;                    &lt;!&ndash;并且当前工序明细的已开工卷数=已检验卷数&ndash;&gt;&ndash;&gt;-->
+<!--&lt;!&ndash;                        WHEN&ndash;&gt;-->
+<!--&lt;!&ndash;                        (&ndash;&gt;-->
+<!--&lt;!&ndash;                        &lt;!&ndash;并且上道工序作业已完工状态=已完工&ndash;&gt;&ndash;&gt;-->
+<!--&lt;!&ndash;                         select (select apo.CLOSESTATUS='已完工' from aps_process_operation apo where apo.ID =#{previousprocessid} )&ndash;&gt;-->
+<!--&lt;!&ndash;                        &lt;!&ndash;并且作业明细待加工料卷批次号数量-工序作业已取消卷数<=0&ndash;&gt;&ndash;&gt;-->
+<!--&lt;!&ndash;                        and (select IFNULL(LENGTH(apope.BACHMATERIALPROCESS) - LENGTH(REPLACE(apope.BACHMATERIALPROCESS, ',',&ndash;&gt;-->
+<!--&lt;!&ndash;                        '')) + 1 ,0)-IFNULL(apo.CANCELROLL,0)&lt;=0 from aps_process_operation apo where apo.ID =#{processOperationId}&ndash;&gt;-->
+<!--&lt;!&ndash;                        ) and apope.STARTINGROLL = apope.CHECKOUTROLL+#{currentCheckNum}  from dual )THEN '已完工'&ndash;&gt;-->
+<!--&lt;!&ndash;                        ELSE '未完工'&ndash;&gt;-->
+<!--&lt;!&ndash;                    END,&ndash;&gt;-->
+<!--&lt;!&ndash;                    apope.WORKSTATUS =&ndash;&gt;-->
+<!--&lt;!&ndash;                    CASE&ndash;&gt;-->
+<!--&lt;!&ndash;                        WHEN  (select (select apo.CLOSESTATUS='已完工' from aps_process_operation apo where apo.ID =#{previousprocessid} )&ndash;&gt;-->
+<!--&lt;!&ndash;                    &lt;!&ndash;并且作业明细待加工料卷批次号数量-工序作业已取消卷数<=0&ndash;&gt;&ndash;&gt;-->
+<!--&lt;!&ndash;                    and (select IFNULL(LENGTH(apope.BACHMATERIALPROCESS) - LENGTH(REPLACE(apope.BACHMATERIALPROCESS, ',',&ndash;&gt;-->
+<!--&lt;!&ndash;                    '')) + 1 ,0)-IFNULL(apo.CANCELROLL,0)&lt;=0 from aps_process_operation apo where apo.ID =#{processOperationId}&ndash;&gt;-->
+<!--&lt;!&ndash;                    ) and apope.STARTINGROLL = apope.CHECKOUTROLL+#{currentCheckNum}  from dual) THEN '已完工'&ndash;&gt;-->
+<!--&lt;!&ndash;                        ELSE apope.WORKSTATUS&ndash;&gt;-->
+<!--&lt;!&ndash;                    END,&ndash;&gt;-->
+<!--&lt;!&ndash;                    apope.ACTUALFINISHDATE =  CASE&ndash;&gt;-->
+<!--&lt;!&ndash;                    WHEN  (select (select apo.CLOSESTATUS='已完工' from aps_process_operation apo where apo.ID =#{previousprocessid} )&ndash;&gt;-->
+<!--&lt;!&ndash;                    &lt;!&ndash;并且作业明细待加工料卷批次号数量-工序作业已取消卷数<=0&ndash;&gt;&ndash;&gt;-->
+<!--&lt;!&ndash;                    and (select IFNULL(LENGTH(apope.BACHMATERIALPROCESS) - LENGTH(REPLACE(apope.BACHMATERIALPROCESS, ',',&ndash;&gt;-->
+<!--&lt;!&ndash;                    '')) + 1 ,0)-IFNULL(apo.CANCELROLL,0)&lt;=0 from aps_process_operation apo where apo.ID =#{processOperationId}&ndash;&gt;-->
+<!--&lt;!&ndash;                    ) and apope.STARTINGROLL = apope.CHECKOUTROLL+#{currentCheckNum}  from dual) THEN NOW()&ndash;&gt;-->
+<!--&lt;!&ndash;                    ELSE apope.ACTUALFINISHDATE&ndash;&gt;-->
+<!--&lt;!&ndash;                    END&ndash;&gt;-->
+<!--                </otherwise>-->
+<!--            </choose>-->
 
-        </set>
-        <where>
-            ID =#{id}
-        </where>
-    </update>
+<!--        </set>-->
+<!--        <where>-->
+<!--            ID =#{id}-->
+<!--        </where>-->
+<!--    </update>-->
 
     <!--    <resultMap id="userOrdersResultMap" type="com.rongwei.bsentity.vo.ScheduleGanttVo">-->
     <!--        <id property="processworkshop" column="PROCESSWORKSHOP"/>-->
@@ -303,63 +303,66 @@
     </select>
 
 
-    <sql id="appendSql">
-        (SELECT apo.CLOSESTATUS = '已完工'
-                   AND  IFNULL(LENGTH(apope.BACHMATERIALPROCESS) - LENGTH(REPLACE(apope.BACHMATERIALPROCESS, ',', '')) + 1 ,0)
-                            -IFNULL(apo1.CANCELROLL,0)&lt;=0
-                   AND apope.STARTINGROLL = apope.CHECKOUTROLL
-        FROM
-            aps_process_operation apo INNER JOIN
-            aps_process_operation apo1
-        WHERE
-            apo.ID = #{data.previousprocessid}
-          and apo1.ID=#{data.id})
-    </sql>
-    <update id="updateAboutStateByProcessId">
-        <foreach collection="updateIds" item="data" separator=";">
-            <if  test="data.processdetailids != null and data.processdetailids.size()>0">
-                <foreach collection="data.processdetailids" item="id" >
-                    update aps_process_operation_process_equ apope
-                    <set>
-                        <!--并且当前工序明细的已开工卷数=已检验卷数-->
-                        apope.CLOSESTATUS = CASE  WHEN <include refid="appendSql"/> THEN '已完工' ELSE '未完工'  END,
-                        apope.WORKSTATUS = CASE WHEN <include refid="appendSql"/> THEN '已完工' ELSE apope.WORKSTATUS  END,
-                        apope.ACTUALFINISHDATE=  CASE WHEN <include refid="appendSql"/> THEN NOW() ELSE apope.ACTUALFINISHDATE END
-                    </set>
-                    <where>
-                        apope.ID=#{id}
-                        and apope.CLOSESTATUS='未完工';
-                    </where>
-                </foreach>
-            </if>
+<!--    <sql id="appendSql">-->
+<!--        (SELECT apo.CLOSESTATUS = '已完工'-->
+<!--                   AND  IFNULL(LENGTH(apope.BACHMATERIALPROCESS) - LENGTH(REPLACE(apope.BACHMATERIALPROCESS, ',', '')) + 1 ,0)-->
+<!--                            -IFNULL(apo1.CANCELROLL,0)&lt;=0-->
+<!--                   AND apope.STARTINGROLL = apope.CHECKOUTROLL-->
+<!--        FROM-->
+<!--            aps_process_operation apo INNER JOIN-->
+<!--            aps_process_operation apo1-->
+<!--        WHERE-->
+<!--            apo.ID = #{data.previousprocessid}-->
+<!--          and apo1.ID=#{data.id})-->
+<!--    </sql>-->
+<!--    <update id="updateAboutStateByProcessId">-->
+<!--        <foreach collection="updateIds" item="data" separator=";">-->
+<!--            <if  test="data.processdetailids != null and data.processdetailids.size()>0">-->
+<!--                <foreach collection="data.processdetailids" item="id" >-->
+<!--                    update aps_process_operation_process_equ apope-->
+<!--                    <set>-->
+<!--                        &lt;!&ndash;并且当前工序明细的已开工卷数=已检验卷数&ndash;&gt;-->
+<!--                        apope.CLOSESTATUS = CASE  WHEN <include refid="appendSql"/> THEN '已完工' ELSE '未完工'  END,-->
+<!--                        apope.WORKSTATUS = CASE WHEN <include refid="appendSql"/> THEN '已完工' ELSE apope.WORKSTATUS  END,-->
+<!--                        apope.ACTUALFINISHDATE=  CASE WHEN <include refid="appendSql"/> THEN NOW() ELSE apope.ACTUALFINISHDATE END-->
+<!--                    </set>-->
+<!--                    <where>-->
+<!--                        apope.ID=#{id}-->
+<!--                        and apope.CLOSESTATUS='未完工';-->
+<!--                    </where>-->
+<!--                </foreach>-->
+<!--            </if>-->
 
-            update aps_process_operation
-            <set>
-                <!--实际完工时间-->
-                ACTUALFINISHDATE = (select IF(COUNT(ID) !=0 ,NULL,NOW()) from aps_process_operation_process_equ where
-                PROCESSID =#{data.id} and CLOSESTATUS !='已完工'),
-                <!-- 完工状态-->
-                CLOSESTATUS = (select IF(COUNT(ID) !=0 ,'未完工','已完工') from aps_process_operation_process_equ where
-                PROCESSID =#{data.id} and CLOSESTATUS !='已完工'),
-                <!-- 作业状态-->
-                WORKSTATUS = (select IF(COUNT(ID) !=0 ,'加工中','已完工') from aps_process_operation_process_equ where
-                PROCESSID =#{data.id} and CLOSESTATUS !='已完工'),
-                <!-- 生产状态-->
-                PROCESSSTATUS = (select IF(COUNT(ID) !=0 ,'40','50') from aps_process_operation_process_equ where PROCESSID
-                =#{data.id} and CLOSESTATUS !='已完工')
-            </set>
-            <where>
-                ID =#{data.id}
-                AND CLOSESTATUS !='已完工'
-            </where>
-        </foreach>
+<!--            update aps_process_operation-->
+<!--            <set>-->
+<!--                &lt;!&ndash;实际完工时间&ndash;&gt;-->
+<!--                ACTUALFINISHDATE = (select IF(COUNT(ID) !=0 ,NULL,NOW()) from aps_process_operation_process_equ where-->
+<!--                PROCESSID =#{data.id} and CLOSESTATUS !='已完工'),-->
+<!--                &lt;!&ndash; 完工状态&ndash;&gt;-->
+<!--                CLOSESTATUS = (select IF(COUNT(ID) !=0 ,'未完工','已完工') from aps_process_operation_process_equ where-->
+<!--                PROCESSID =#{data.id} and CLOSESTATUS !='已完工'),-->
+<!--                &lt;!&ndash; 作业状态&ndash;&gt;-->
+<!--                WORKSTATUS = (select IF(COUNT(ID) !=0 ,'加工中','已完工') from aps_process_operation_process_equ where-->
+<!--                PROCESSID =#{data.id} and CLOSESTATUS !='已完工'),-->
+<!--                &lt;!&ndash; 生产状态&ndash;&gt;-->
+<!--                PROCESSSTATUS = (select IF(COUNT(ID) !=0 ,'40','50') from aps_process_operation_process_equ where PROCESSID-->
+<!--                =#{data.id} and CLOSESTATUS !='已完工')-->
+<!--            </set>-->
+<!--            <where>-->
+<!--                ID =#{data.id}-->
+<!--                AND CLOSESTATUS !='已完工'-->
+<!--            </where>-->
+<!--        </foreach>-->
 
-    </update>
+<!--    </update>-->
     <update id="publish">
         UPDATE aps_process_operation_process_equ
         <set>
             LOCKMARK ='y',
-            WORKSTATUS='待开工'
+            WORKSTATUS='待开工',
+            MODIFYDATE = NOW(),
+            MODIFYUSERID = #{userId},
+            MODIFYUSERNAME = #{userName}
         </set>
             <where>
                 BLANKID in (
@@ -375,7 +378,10 @@
         UPDATE aps_process_operation_process_equ
         <set>
             LOCKMARK ='n',
-            WORKSTATUS='待开工'
+            WORKSTATUS='待开工',
+            MODIFYDATE = NOW(),
+            MODIFYUSERID = #{userId},
+            MODIFYUSERNAME = #{userName}
         </set>
         <where>
             BLANKID in (
@@ -390,7 +396,10 @@
     <update id="repairePlanStartDate">
         update aps_process_operation_process_equ set
          PLANENDDATE = ACTUALFINISHDATE,
-         PLANSTARTDATE = DATE_SUB(ACTUALFINISHDATE,INTERVAL TIMESTAMPDIFF(SECOND,OLDPLANSTARTDATE,OLDPLANENDDATE) SECOND)
+         PLANSTARTDATE = DATE_SUB(ACTUALFINISHDATE,INTERVAL TIMESTAMPDIFF(SECOND,OLDPLANSTARTDATE,OLDPLANENDDATE) SECOND),
+         MODIFYDATE = NOW(),
+         MODIFYUSERID = #{userId},
+         MODIFYUSERNAME = #{userName}
         where DELETED = 0
           AND ACTUALFINISHDATE is not null
           AND OLDPLANSTARTDATE is not null
@@ -400,7 +409,10 @@
 
         update aps_process_operation_process_equ set
          PLANSTARTDATE = ACTUALSTARTDATE,
-         PLANENDDATE = DATE_ADD(ACTUALSTARTDATE,INTERVAL TIMESTAMPDIFF(SECOND,OLDPLANSTARTDATE,OLDPLANENDDATE) SECOND)
+         PLANENDDATE = DATE_ADD(ACTUALSTARTDATE,INTERVAL TIMESTAMPDIFF(SECOND,OLDPLANSTARTDATE,OLDPLANENDDATE) SECOND),
+         MODIFYDATE = NOW(),
+         MODIFYUSERID = #{userId},
+         MODIFYUSERNAME = #{userName}
         where DELETED = 0
           AND ACTUALFINISHDATE is null
           AND ACTUALSTARTDATE is not null