Browse Source

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

fangpy 1 year ago
parent
commit
09b4d1b1ae

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

@@ -2,7 +2,9 @@ package com.rongwei.bscommon.sys.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.rongwei.bsentity.domain.ApsProcessOperationBackupDo;
+import com.rongwei.bsentity.vo.CheckScheduleVo;
 import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 
 import java.util.List;
 
@@ -18,6 +20,11 @@ public interface ApsProcessOperationBackupDao extends BaseMapper<ApsProcessOpera
 
     void processOperationCopy(@Param("userId") String userId,
                               @Param("userName") String userName);
+
+    @Select("select count(ID) as count,BACKUPUSERID as backUpUserId,BACKUPUSER as backUpUserName from aps_process_operation_backup where DELETED = 0 AND BLANKID in (select ID from aps_blank_order where DELETED ='0' and  PRODUCTIONORDERID = #{orderId} ) GROUP BY BACKUPUSERID,BACKUPUSER limit 1")
+    CheckScheduleVo selectBackByOrderId(@Param("orderId") String orderId);
+
+    CheckScheduleVo selectBackByBlankIdList(@Param("blankIdList") List<String> blankIdList);
 }
 
 

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

@@ -63,8 +63,8 @@ public interface ApsProcessOperationProcessEquDao extends BaseMapper<ApsProcessO
     @Update("update aps_process_operation_process_equ set STARTINGROLL = STARTINGROLL - 1,WAITREPORTID = null,DOINGBATCHNUMBER = '' where ID = #{processequid}")
     void updateByCancelRecord(@Param("processequid") String processequid);
 
-    @Update("update asp_check_items set WAITREPORTID = REPLACE(REPLACE(REPLACE(WAITREPORTID,'${recordId},',''),',${recordId}',''),'${recordId}','') where ID = #{deviceId}")
-    void updateEquByCancelRecord(@Param("recordId") String recordId,@Param("deviceId") String deviceId);
+//    @Update("update asp_check_items set WAITREPORTID = REPLACE(REPLACE(REPLACE(WAITREPORTID,'${recordId},',''),',${recordId}',''),'${recordId}','') where ID = #{deviceId}")
+//    void updateEquByCancelRecord(@Param("recordId") String recordId,@Param("deviceId") String deviceId);
 
     List<CommonUpdateProductionStatusReq> selectNeedUpdate(@Param("productIdList") List<String> productIdList);
 

+ 1 - 1
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/dao/ApsProductionOrderDao.java

@@ -33,7 +33,7 @@ public interface ApsProductionOrderDao extends BaseMapper<ApsProductionOrderDo>
 
     @Select("select o.ID,o.ORDERNO,o.CREATEUSERID,o.CREATEUSERNAME,u.EMAIL as MODIFYUSERNAME from aps_production_order o\n" +
             "left join sys_user u on o.CREATEUSERID=u.ID and u.DELETED='0'\n" +
-            "where o.DELETED='0' and IFNULL(o.ORDERNO,'')!='' and o.AUDITSTATUS!='已发布计划' and o.AUDITSTATUS!='已完工关闭'\n" +
+            "where o.DELETED='0' and IFNULL(o.ORDERNO,'')!='' and o.AUDITSTATUS!='已发布计划' and o.AUDITSTATUS!='已完工关闭' and o.ORDERNO='DD20240518205'\n" +
             "\tand ((IFNULL(o.CHANGEDATE,'')='' and TIMESTAMPDIFF(HOUR,o.ORDERDATE,NOW())>48) or (IFNULL(o.CHANGEDATE,'')!='' and TIMESTAMPDIFF(HOUR,o.CHANGEDATE,NOW())>48))")
     List<ApsProductionOrderDo> getOrderOuttimeAudit();
 

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

@@ -23,11 +23,11 @@ public interface ApsReportRecordsDao extends BaseMapper<ApsReportRecordsDo> {
     @Update("update asp_check_items set WAITREPORTID = #{id} where ID = #{processdeviceid}")
     void updateDeviceWaitReportId(@Param("id") String id, @Param("processdeviceid") String processdeviceid);
 
-    @Update("update aps_process_operation_process_equ set BACHMATERIALPROCESS = REPLACE(REPLACE(REPLACE(BACHMATERIALPROCESS,'${inputBatchNumber},',''),',${inputBatchNumber}',''),'${inputBatchNumber}','') where PROCESSID = #{id}")
-    void updateBatchMaterialProcess(@Param("inputBatchNumber") String inputBatchNumber, @Param("id") String id);
+//    @Update("update aps_process_operation_process_equ set BACHMATERIALPROCESS = REPLACE(REPLACE(REPLACE(BACHMATERIALPROCESS,'${inputBatchNumber},',''),',${inputBatchNumber}',''),'${inputBatchNumber}','') where PROCESSID = #{id}")
+//    void updateBatchMaterialProcess(@Param("inputBatchNumber") String inputBatchNumber, @Param("id") String id);
 
-    @Update("update aps_process_operation_process_equ set BACHMATERIALPROCESS = REPLACE(REPLACE(REPLACE(BACHMATERIALPROCESS,'${inputBatchNumber},',''),',${inputBatchNumber}',''),'${inputBatchNumber}','') where PROCESSID in (${processIds})")
-    void updateBatchMaterialProcessBatch(@Param("inputBatchNumber") String inputBatchNumber, @Param("processIds") String processIds);
+//    @Update("update aps_process_operation_process_equ set BACHMATERIALPROCESS = REPLACE(REPLACE(REPLACE(BACHMATERIALPROCESS,'${inputBatchNumber},',''),',${inputBatchNumber}',''),'${inputBatchNumber}','') where PROCESSID in (${processIds})")
+//    void updateBatchMaterialProcessBatch(@Param("inputBatchNumber") String inputBatchNumber, @Param("processIds") String processIds);
 
     @Select("select ap.ID AS 'id',ap.PARAMETER AS 'parameter' from aps_production_processes app LEFT JOIN aps_parameter ap ON app.ID = ap.MAINID AND ap.DELETED = 0 where app.PRODUCTPROCESSNAME = #{process}")
     List<ApsParameterDo> selectApsParameterByProcess(@Param("process") String process);

+ 1 - 1
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/ApsBlankOrderService.java

@@ -51,6 +51,6 @@ public interface ApsBlankOrderService extends IService<ApsBlankOrderDo> {
     R checkAndUpdateBlankAndOutput(ApsProductionTechnicalRequirementDo req);
     void updateBlankSplicingColumn(String blankId);
 
-    R checkSchedule(List<String> blankIdList);
+    R checkSchedule(CheckScheduleReq req);
 
 }

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

@@ -2336,13 +2336,40 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
     }
 
     @Override
-    public R checkSchedule(List<String> blankIdList) {
+    public R checkSchedule(CheckScheduleReq req) {
         //是否正在排程
         ApsUtils.checkScheduling(null);
+        CheckScheduleVo checkScheduleVo = null;
+        //根据订单ID查询
+        if (ObjectUtil.isNotEmpty(req.getOrderId())) {
+            checkScheduleVo = apsProcessOperationBackupDao.selectBackByOrderId(req.getOrderId());
+        }
+        if (ObjectUtil.isNotEmpty(req.getBlankIdList())) {
+            checkScheduleVo = apsProcessOperationBackupDao.selectBackByBlankIdList(req.getBlankIdList());
+        }
+        CheckScheduleResponse checkScheduleResponse = new CheckScheduleResponse();
+        if (ObjectUtil.isEmpty(checkScheduleVo)) {
+            checkScheduleResponse.setNeedWarning(true);
+            checkScheduleResponse.setWarningMessage("修改坯料计划后需要重新排程,确认修改吗?");
+            return R.ok(checkScheduleResponse);
+        }
+        //获取当前用户
+        SysUserVo currentUser = CXCommonUtils.getCurrentUser();
 
-        //判断当前坯料计划是否存在排程备份
-
+        if (ObjectUtil.isNotEmpty(checkScheduleVo.getCount()) && checkScheduleVo.getCount().equals(0)) {
+            checkScheduleResponse.setNeedWarning(true);
+            checkScheduleResponse.setWarningMessage("修改坯料计划后需要重新排程,确认修改吗?");
+            return R.ok(checkScheduleResponse);
+        }
+        if (ObjectUtil.isNotEmpty(checkScheduleVo.getBackUpUserId()) && checkScheduleVo.getBackUpUserId().equals(currentUser.getId())) {
+            checkScheduleResponse.setNeedWarning(true);
+            checkScheduleResponse.setWarningMessage("该操作会导致您的排程结果备份不可恢复,确认继续吗?");
+            return R.ok(checkScheduleResponse);
+        } else {
+            checkScheduleResponse.setNeedWarning(true);
+            checkScheduleResponse.setWarningMessage(checkScheduleVo.getBackUpUserName() + "正在排程,该操作会导致其排程结果备份不可恢复,确认继续吗?");
+            return R.ok(checkScheduleResponse);
+        }
 
-        return null;
     }
 }

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

@@ -220,11 +220,11 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
 //                        .isNotNull(ApsProcessOperationProcessEquDo::getWaitreportid)//待报工记录ID不为空
 //        );
         //存在已使用,判断是否是合并作业 (计划开工时间相同)
-        if(ObjectUtil.isNotEmpty(list)){
+        if (ObjectUtil.isNotEmpty(list)) {
             //已开工的作业明细的计划开工时间
             Date planstartdate = list.get(0).getPlanstartdate();
             //开工时间不用
-            if(planstartdate.compareTo(apsProcessOperationProcessEquDo.getPlanstartdate()) != 0){
+            if (planstartdate.compareTo(apsProcessOperationProcessEquDo.getPlanstartdate()) != 0) {
                 return R.error("该设备当前加工中的作业还未报工,不能开工新的作业");
             }
         }
@@ -290,6 +290,8 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
         apsReportRecordsDo.setCheckstatus("待检验");
         //设备参数
         apsReportRecordsDo.setDeviceparm(equparames);
+        //注意事项
+        apsReportRecordsDo.setAttention(apsProcessOperationDo.getRemark());
 
         //保存主表
         this.save(apsReportRecordsDo);

+ 12 - 0
cx-aps/cx-aps-common/src/main/resources/mybatis/ApsProcessOperationBackupDao.xml

@@ -194,6 +194,18 @@
                 </if>
             </where>
     </delete>
+    <select id="selectBackByBlankIdList" resultType="com.rongwei.bsentity.vo.CheckScheduleVo">
+        select count(ID) as count,
+            BACKUPUSERID as backUpUserId,
+            BACKUPUSER as backUpUserName
+        from aps_process_operation_backup
+        where DELETED = 0
+            AND BLANKID in
+            <foreach collection="blankIdList" item="item" separator="," open="(" close=")">
+                #{item}
+            </foreach>
+        GROUP BY BACKUPUSERID,BACKUPUSER limit 1
+    </select>
     <insert id="processOperationCopy">
         INSERT INTO aps_process_operation_backup (<include refid="Base_Column_List"/>)
         SELECT

+ 10 - 0
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/domain/ApsProductionOrderDo.java

@@ -617,6 +617,16 @@ public class ApsProductionOrderDo extends BaseDo implements Serializable {
      */
     private String processstatustext;
 
+    /**
+     * 内部客户ID
+     */
+    private String internalcustomerid;
+
+    /**
+     * 内部客户名称
+     */
+    private String internalcustomername;
+
     @TableField(exist = false)
     private static final long serialVersionUID = 1L;
 }

+ 5 - 0
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/domain/ApsReportRecordsDo.java

@@ -123,6 +123,11 @@ public class ApsReportRecordsDo extends BaseDo implements Serializable {
      */
     private String deviceparm;
 
+    /**
+     * 注意事项
+     */
+    private String attention;
+
     @TableField(exist = false)
     private static final long serialVersionUID = 1L;
 }

+ 18 - 0
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/vo/CheckScheduleReq.java

@@ -0,0 +1,18 @@
+package com.rongwei.bsentity.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author :sc
+ * @since :2024/7/9
+ */
+@Data
+public class CheckScheduleReq {
+    //坯料计划ID集合
+    private List<String> blankIdList;
+
+    //订单ID
+    private String orderId;
+}

+ 20 - 0
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/vo/CheckScheduleResponse.java

@@ -0,0 +1,20 @@
+package com.rongwei.bsentity.vo;
+
+import lombok.Data;
+
+/**
+ * @author :sc
+ * @since :2024/7/10
+ */
+@Data
+public class CheckScheduleResponse {
+    /**
+     * 是否需要弱提示
+     */
+    private Boolean needWarning = false;
+
+    /**
+     * 提示内容
+     */
+    private String warningMessage;
+}

+ 25 - 0
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/vo/CheckScheduleVo.java

@@ -0,0 +1,25 @@
+package com.rongwei.bsentity.vo;
+
+import lombok.Data;
+
+/**
+ * @author :sc
+ * @since :2024/7/9
+ */
+@Data
+public class CheckScheduleVo {
+    /**
+     * 备份的数量
+     */
+    private Integer count;
+
+    /**
+     * 备份人ID
+     */
+    private String backUpUserId;
+
+    /**
+     * 备份人名称
+     */
+    private String backUpUserName;
+}

+ 4 - 3
cx-aps/cx-aps-server/src/main/java/com/rongwei/bsserver/controller/ApsBlankOrderController.java

@@ -6,6 +6,7 @@ import com.rongwei.bsentity.domain.ApsBlankOrderDo;
 import com.rongwei.bsentity.domain.ApsProductionTechnicalRequirementDo;
 import com.rongwei.bsentity.vo.ApsPlanVo;
 import com.rongwei.bsentity.vo.CheckAndSaveOrUpdateBlankReq;
+import com.rongwei.bsentity.vo.CheckScheduleReq;
 import com.rongwei.bsentity.vo.OrderLockVo;
 import com.rongwei.rwcommon.base.R;
 import lombok.extern.slf4j.Slf4j;
@@ -172,9 +173,9 @@ public class ApsBlankOrderController {
      * 根据坯料计划ID查询排程相关提醒
      */
     @PostMapping("/checkSchedule")
-    public R checkSchedule(@RequestBody List<String> blankIdList) {
-        log.info("checkSchedule 检查排程相关提醒,入参为:{}", blankIdList);
-        return apsBlankOrderService.checkSchedule(blankIdList);
+    public R checkSchedule(@RequestBody CheckScheduleReq req) {
+        log.info("checkSchedule 检查排程相关提醒,入参为:{}", req);
+        return apsBlankOrderService.checkSchedule(req);
     }
 }