瀏覽代碼

Merge remote-tracking branch 'origin/master'

xiahan 1 年之前
父節點
當前提交
6dcd8b0abd
共有 44 個文件被更改,包括 1466 次插入434 次删除
  1. 27 1
      bs-common/src/main/java/com/rongwei/safecommon/utils/SaveConstans.java
  2. 18 5
      cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/dao/ApsBlankOrderDao.java
  3. 8 0
      cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/dao/ApsOrderAlloyCompositionDao.java
  4. 18 2
      cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/dao/ApsProductionOrderDao.java
  5. 1 1
      cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/dao/ApsReportRecordsDao.java
  6. 4 0
      cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/ApsBlankOrderService.java
  7. 8 0
      cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/ApsOrderAlloyCompositionService.java
  8. 9 0
      cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/ApsProductionOrderService.java
  9. 257 23
      cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsBlankOrderServiceImpl.java
  10. 13 0
      cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsOrderAlloyCompositionServiceImpl.java
  11. 36 4
      cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsProcessOperationServiceImpl.java
  12. 203 28
      cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsProductionOrderServiceImpl.java
  13. 2 0
      cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsReportRecordsServiceImpl.java
  14. 2 2
      cx-aps/cx-aps-common/src/main/resources/mybatis/ApsBlankOrderDao.xml
  15. 1 1
      cx-aps/cx-aps-common/src/main/resources/mybatis/ApsProcessOperationDao.xml
  16. 2 39
      cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/domain/ApsAlloyCompositionDo.java
  17. 2 40
      cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/domain/ApsAlloyDo.java
  18. 2 40
      cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/domain/ApsCheckParameterDo.java
  19. 49 0
      cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/domain/ApsOrderAlloyCompositionDo.java
  20. 2 41
      cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/domain/ApsParameterDo.java
  21. 2 41
      cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/domain/ApsProcessOutputProductDo.java
  22. 0 40
      cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/domain/ApsProductionMergeOrderDo.java
  23. 2 41
      cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/domain/ApsReportBlankCompentDo.java
  24. 2 40
      cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/domain/ApsReportCheckoutDo.java
  25. 2 41
      cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/domain/ApsReportMachiningDo.java
  26. 2 0
      cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/vo/ApsBlankOrderVo.java
  27. 3 0
      cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/vo/CheckAndSaveOrUpdateBlankReq.java
  28. 15 0
      cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/vo/DeleteOrderVo.java
  29. 11 0
      cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/vo/Equipment.java
  30. 9 0
      cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/vo/EquipmentRunTime.java
  31. 25 0
      cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/vo/ProductionProcesses.java
  32. 9 0
      cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/vo/ProductionScheduleRetVo.java
  33. 9 0
      cx-aps/cx-aps-server/src/main/java/com/rongwei/bsserver/controller/ApsBlankOrderController.java
  34. 33 0
      cx-aps/cx-aps-server/src/main/java/com/rongwei/bsserver/controller/ApsProductionOrderController.java
  35. 84 0
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/config/EquDieseloilUseManagementListener.java
  36. 8 0
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/dao/EquDieseloilUseManagementDao.java
  37. 121 0
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/excel/EquDieseloilUseManagementTemplate.java
  38. 20 0
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/EquDieseloilUseManagementService.java
  39. 145 0
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/EquDieseloilUseManagementServiceImpl.java
  40. 3 1
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/MaintenanceServiceImpl.java
  41. 190 0
      cx-equipment/cx-equipment-entity/src/main/java/com/rongwei/bsentity/domain/EquDieseloilUseManagementDo.java
  42. 65 0
      cx-equipment/cx-equipment-server/src/main/java/com/rongwei/bsserver/sys/controller/EquDieseloilUseManagementController.java
  43. 11 3
      cx-safe-check/cx-save-check-common/src/main/java/com/rongwei/sfcommon/sys/service/impl/CheckTemplateServiceImpl.java
  44. 31 0
      cx-safe-check/cx-save-check-entity/src/main/java/com/rongwe/scentity/domian/PointCheckNewsVo.java

+ 27 - 1
bs-common/src/main/java/com/rongwei/safecommon/utils/SaveConstans.java

@@ -184,6 +184,14 @@ public class SaveConstans {
          * 订单未及时评审提醒
          */
         public static final String ORDEROUTTIME_AUDIT = "orderouttimeaudit";
+        /**
+         * 辅料申购提醒
+         */
+        public static final String AUXILIARYMATERIAL_REMIND = "auxiliarymaterial";
+        /**
+         * 作业延期提醒
+         */
+        public static final String PROCESSDELAY_REMIND = "processdelay";
     }
 
     public static class NotifyTitle {
@@ -291,6 +299,16 @@ public class SaveConstans {
          * 订单评审提醒
          */
         public static final String ORDEROUTTIMEAUDIT_TITLE = "订单评审提醒";
+
+        /**
+         * 辅料申购提醒
+         */
+        public static final String AUXILIARYMATERIAL_TITLE = "辅料申购提醒";
+
+        /**
+         * 作业延期提醒
+         */
+        public static final String PROCESSDELAY_TITLE = "订单作业未按计划完成";
     }
 
     public static class NotifyContent {
@@ -343,7 +361,7 @@ public class SaveConstans {
         /**
          * 点巡检任务提醒
          */
-        public static final String INSPECTION_CONTENT = "【%s】的【%s】任务请及时完成";
+        public static final String INSPECTION_CONTENT = "【%s】的【%s】【%s】【%s】任务请及时完成";
         /**
          * 保养检修工单提醒内容
          */
@@ -395,6 +413,14 @@ public class SaveConstans {
          * 订单评审提醒内容
          */
         public static final String ORDEROUTTIME_AUDIT_CONTENT = "订单【%s】待评审,请及时处理";
+        /**
+         * 辅料申购提醒
+         */
+        public static final String AUXILIARYMATERIAL_CONTENT = "订单【%s】有辅料计划申购日期临近或到期,请及时申购";
+        /**
+         * 作业延期提醒
+         */
+        public static final String PROCESSDELAY_CONTENT = "订单【%s】有作业未按计划完工,请及时调整计划";
     }
 
     /**

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

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.rongwei.bsentity.domain.AspCheckItemsDo;
 import com.rongwei.bsentity.vo.ApsBlankOrderVo;
 import com.rongwei.bsentity.vo.BlankIdAndProcessStatusVo;
+import org.apache.ibatis.annotations.Delete;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Update;
@@ -27,14 +28,17 @@ public interface ApsBlankOrderDao extends BaseMapper<ApsBlankOrderDo> {
             "where a.DELETED='0' and a.ID in (${ids}) ORDER BY b.PLANENDDATE ASC")
     List<AspCheckItemsDo> eqAscs(@Param("ids") String ids);
 
-    @Select("select a.*,b.DELIVERYDATE from aps_blank_order a LEFT JOIN aps_production_order b on a.PRODUCTIONORDERID=b.ID where a.PRODUCTIONORDERID=#{orderId} and a.DELETED='0' and b.DELETED='0'")
+    @Select("select a.*,b.DELIVERYDATE,b.DELIVERYTIME from aps_blank_order a LEFT JOIN aps_production_order b on a.PRODUCTIONORDERID=b.ID where a.PRODUCTIONORDERID=#{orderId} and a.DELETED='0' and b.DELETED='0'")
     List<ApsBlankOrderVo> getByOrderId(@Param("orderId") String orderId);
 
-    @Select("select a.*,b.DELIVERYDATE from aps_blank_order a LEFT JOIN aps_production_order b on a.PRODUCTIONORDERID=b.ID " +
-            "where (a.LOCKMARK is null or a.LOCKMARK='n') and a.DELETED='0' and b.DELETED='0' and b.PRODUCTIONSTATUS='20' and a.ID not in (${hasIds})")
-    List<ApsBlankOrderVo> getFbNotLock(@Param("hasIds") String hasIds);
+    @Select("<script>select a.*,b.DELIVERYDATE,b.DELIVERYTIME from aps_blank_order a LEFT JOIN aps_production_order b on a.PRODUCTIONORDERID=b.ID " +
+            "where (a.LOCKMARK is null or a.LOCKMARK='n') and a.DELETED='0' and b.DELETED='0' and b.PRODUCTIONSTATUS='20' and a.ID not in (${hasIds}) " +
+            "<if test='tenantId != null and tenantId != &apos;&apos;'> " +
+            "  and  b.TENANTID = #{tenantId} " +
+            "</if></script>")
+    List<ApsBlankOrderVo> getFbNotLock(@Param("hasIds") String hasIds,@Param("tenantId") String tenantId);
 
-    @Select("select a.*,b.DELIVERYDATE from aps_blank_order a LEFT JOIN aps_production_order b on a.PRODUCTIONORDERID=b.ID " +
+    @Select("select a.*,b.DELIVERYDATE,b.DELIVERYTIME from aps_blank_order a LEFT JOIN aps_production_order b on a.PRODUCTIONORDERID=b.ID " +
             "where b.PRODUCTIONSTATUS='20' and (a.LOCKMARK='n' or a.LOCKMARK is null) and a.DELETED='0' and b.DELETED='0' and b.TENANTID = #{tenantId}")
     List<ApsBlankOrderVo> getNotLockOrders(@Param("tenantId") String tenantId);
 
@@ -76,4 +80,13 @@ public interface ApsBlankOrderDao extends BaseMapper<ApsBlankOrderDo> {
 
     @Update("update aps_process_operation_process_equ set BACHMATERIALPROCESS = REPLACE(REPLACE(BACHMATERIALPROCESS,'${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);
+
+    @Delete("delete from aps_process_operation_backup where BLANKID = #{id}")
+    void deleteProcessBackupByBlankId(@Param("id") String id);
+
+    @Delete("delete from aps_process_operation_process_equ_backup where BLANKID = #{id}")
+    void deleteProcessEquBackupByBlankId(@Param("id") String id);
 }

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

@@ -0,0 +1,8 @@
+package com.rongwei.bscommon.sys.dao;
+
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.rongwei.bsentity.domain.ApsOrderAlloyCompositionDo;
+
+public interface ApsOrderAlloyCompositionDao extends BaseMapper<ApsOrderAlloyCompositionDo> {
+}

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

@@ -24,7 +24,7 @@ public interface ApsProductionOrderDao extends BaseMapper<ApsProductionOrderDo>
 
     List<ApsProductionOrderDo> getDataByBlankId(@Param("blankIds")List<String> blankids);
 
-    @Select("select apd.ID,SUM(apop.PLANOUTPUTROLLCOUNT) AS 'PLANOUTPUTROLLCOUNTALL' from aps_product_detail apd LEFT JOIN aps_process_output_product apop ON apd.ID = apop.PRODUCTID AND apop.DELETED = 0 where apd.DELETED = 0 AND apd.MAINID = #{mainid} GROUP BY apd.ID")
+    @Select("select apd.ID AS 'productDetailId',SUM(apop.PLANOUTPUTROLLCOUNT) AS 'PLANOUTPUTROLLCOUNTALL' from aps_product_detail apd LEFT JOIN aps_process_output_product apop ON apd.ID = apop.PRODUCTID AND apop.DELETED = 0 where apd.DELETED = 0 AND apd.MAINID = #{mainid} GROUP BY apd.ID")
     List<ProductDetailIdAndPlanOutPutRollCountAllVo> getProductDetailIdAndPlanOutPutRollCountAll(@Param("mainid") String mainid);
 
     @Select("select b.ID AS 'id',a.PID AS 'pid' from (select * from sys_dict where DICTTYPE = 'productType' AND DELETED = 0) a RIGHT JOIN (select * from sys_dict where DELETED = 0 AND ID in ('${join}')) b ON a.ID = b.PID")
@@ -32,9 +32,25 @@ 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 (o.AUDITSTATUS='待计划评审' or o.AUDITSTATUS='待技术评审') and o.ID='2024f94745144c779fcbd3a9f4d89254'\n" +
+            "where o.DELETED='0' and IFNULL(o.ORDERNO,'')!='' and (o.AUDITSTATUS='待计划评审' or o.AUDITSTATUS='待技术评审')\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();
+
+    @Select("SELECT count(1) FROM aps_production_order apo LEFT JOIN aps_blank_order abo ON apo.ID = abo.PRODUCTIONORDERID  AND abo.DELETED = 0 LEFT JOIN aps_process_operation apo2 ON abo.ID = apo2.BLANKID  AND apo2.DELETED = 0  LEFT JOIN aps_process_operation_process_equ apope ON apo2.ID = apope.PROCESSID AND apope.DELETED = 0 WHERE apo.DELETED = 0  AND apo.ID = #{id} AND (apope.CONFLICTDES is not null or apope.CONFLICTDES != '')")
+    int selectConflictdesCount(@Param("id") String id);
+
+    @Select("select o.ID,o.ORDERNO,o.CREATEUSERID,o.CREATEUSERNAME,u.EMAIL as MODIFYUSERNAME from aps_production_order o 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.MATERIALSTATUS='已评审' \n" +
+            "\tand o.ID in(select distinct MAINID from aps_auxiliary_material where DELETED='0' and SUBDCRIPTIONCODE='未申购' and TIMESTAMPDIFF(DAY,DATE_FORMAT(NOW(),'%Y-%m-%d'),DATE_FORMAT(SUBSCRIPTIONDATE,'%Y-%m-%d'))<8)")
+    List<ApsProductionOrderDo> getAuxiliaryMaterial();
+
+    @Select("select o.ID,o.ORDERNO,o.CREATEUSERID,o.CREATEUSERNAME,u.EMAIL as MODIFYUSERNAME from aps_production_order o 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.ID in(\n" +
+            "\tselect distinct b.PRODUCTIONORDERID from aps_process_operation_process_equ e\n" +
+            "\tleft join aps_process_operation p on p.DELETED='0' and p.ID=e.PROCESSID\n" +
+            "\tleft join aps_blank_order b on b.DELETED='0' and b.ID=p.BLANKID\n" +
+            "\twhere e.DELETED='0' and (p.PROCESSSTATUS='30' or p.PROCESSSTATUS='40') and (e.WORKSTATUS='待开工' or e.WORKSTATUS='加工中') and TIMESTAMPDIFF(DAY,DATE_FORMAT(NOW(),'%Y-%m-%d'),DATE_FORMAT(e.PLANENDDATE,'%Y-%m-%d'))<0)")
+    List<ApsProductionOrderDo> getProcessDelay();
 }
 
 

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

@@ -26,7 +26,7 @@ public interface ApsReportRecordsDao extends BaseMapper<ApsReportRecordsDo> {
     @Update("update aps_process_operation_process_equ set BACHMATERIALPROCESS = REPLACE(REPLACE(BACHMATERIALPROCESS,'${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(BACHMATERIALPROCESS,'${inputBatchNumber},',''),',${inputBatchNumber}','') where PROCESSID in (${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}")

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

@@ -39,4 +39,8 @@ public interface ApsBlankOrderService extends IService<ApsBlankOrderDo> {
     R insertOrder(Map<String, Object> params) throws Exception;
 
     R checkAndSaveOrUpdateBlank(CheckAndSaveOrUpdateBlankReq req);
+    R checkBlankOrder(CheckAndSaveOrUpdateBlankReq req, int i);
+
+    R removeBlankOrder(ApsBlankOrderDo req);
+    void removeBlankOrderAndChild(ApsBlankOrderDo req);
 }

+ 8 - 0
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/ApsOrderAlloyCompositionService.java

@@ -0,0 +1,8 @@
+package com.rongwei.bscommon.sys.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.rongwei.bsentity.domain.ApsOrderAlloyCompositionDo;
+
+
+public interface ApsOrderAlloyCompositionService extends IService<ApsOrderAlloyCompositionDo> {
+}

+ 9 - 0
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/ApsProductionOrderService.java

@@ -3,6 +3,7 @@ package com.rongwei.bscommon.sys.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.rongwei.bsentity.domain.ApsProductionOrderDo;
 import com.rongwei.bsentity.vo.CheckAndSaveOrUpdateOrderReq;
+import com.rongwei.bsentity.vo.DeleteOrderVo;
 import com.rongwei.rwcommon.base.R;
 
 import java.util.List;
@@ -19,4 +20,12 @@ public interface ApsProductionOrderService extends IService<ApsProductionOrderDo
     R checkAndSaveOrUpdateOrder(CheckAndSaveOrUpdateOrderReq req);
 
     void orderOuttimeAudit();
+
+    void auxiliaryMaterial();
+
+    R changeOrder(ApsProductionOrderDo req);
+
+    void processDelay();
+
+    R deleteOrder(DeleteOrderVo req);
 }

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

@@ -88,6 +88,12 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
     private ApsWorkInProgressInventoryService apsWorkInProgressInventoryService;
     @Autowired
     private ApsProcessOutputProductService apsProcessOutputProductService;
+    @Autowired
+    private ApsProcessOperationOutMaterService apsProcessOperationOutMaterService;
+    @Autowired
+    private ApsProcessOperationEquService apsProcessOperationEquService;
+    @Autowired
+    private ApsProcessOperationProcessEquService apsProcessOperationProcessEquService;
 
 
     @Override
@@ -120,7 +126,7 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
         // 校验取消的订单中是否存在已加工的工序作业
         List<String> startWorkOrderNo = apsProcessOperationDao.getStartWorkById(apsProductionOrderIds);
         if (!startWorkOrderNo.isEmpty()) {
-            throw new CustomException(CollUtil.join(startWorkOrderNo, ",") + " 以上客户所对应的订单存在已开工的坯料计划,不可以取消排程=!");
+            throw new CustomException(CollUtil.join(startWorkOrderNo, ",") + " 以上客户所对应的订单存在已开工的坯料计划,不可以取消排程!");
         }
         List<String> blankids = blankOrderDos.stream().map(ApsBlankOrderDo::getId).collect(Collectors.toList());
         //清除排程备份和状态修改
@@ -139,7 +145,7 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
         // 校验取消的订单中是否存在已加工的工序作业
         List<String> startWorkOrderNo = apsProcessOperationDao.getStartWorkByBlankId(apsBlankIds);
         if (!startWorkOrderNo.isEmpty()) {
-            throw new CustomException(CollUtil.join(startWorkOrderNo, ",") + " 以上客户所对应的订单存在已开工的坯料计划,不可以取消排程=!");
+            throw new CustomException(CollUtil.join(startWorkOrderNo, ",") + " 以上客户所对应的订单存在已开工的坯料计划,不可以取消排程!");
         }
         //获取订单ID
         List<ApsBlankOrderDo> blankOrderDoList = this.list(new QueryWrapper<ApsBlankOrderDo>().lambda().in(ApsBlankOrderDo::getId, apsBlankIds));
@@ -469,13 +475,16 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void blankOrderAps(List<ApsBlankOrderVo> apsBlankOrders) {
+        // 当前等路人所属工厂
+        SysUserVo currentUser = CXCommonUtils.getCurrentUser();
+        String tenantId = currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1];
         assert apsBlankOrders != null : "排程订单不能为空";
         // 合并待发布未锁定的订单一起排程
         List<String> hasIds = apsBlankOrders.stream().map(v -> v.getId()).collect(Collectors.toList());
         String idStrs = CollUtil.join(hasIds, "','");
         idStrs = "'" + idStrs + "'";
         // 查询存在未锁定的作业坯料计划
-        List<ApsBlankOrderVo> fbNotLock = apsBlankOrderDao.getFbNotLock(idStrs);
+        List<ApsBlankOrderVo> fbNotLock = apsBlankOrderDao.getFbNotLock(idStrs,tenantId);
         if (fbNotLock != null && fbNotLock.size() > 0) {
             apsBlankOrders.addAll(fbNotLock);
         }
@@ -491,6 +500,9 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
         logger.info("排程数据:" + JSONUtil.toJsonStr(productionScheduleVo, jsonConfig));
         // APS平台排程接口调用
         ProductionScheduleRetVo productionScheduleRetVo = rwApsServer.productionSchedule(productionScheduleVo);
+        if(!"200".equals(productionScheduleRetVo.getCode())){
+            throw new CustomException(productionScheduleRetVo.getMsg());
+        }
         // 排程结果保存
         List<ApsProcessOperationProcessEquDo> apsProcessOperationProcessEquDos = new ArrayList<>();
         // 最后节点集合
@@ -515,6 +527,7 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
                     apsProcessOperationProcessEqu.setConflictdes(process.getConflictDes());
                     apsProcessOperationProcessEqu.setSoftconflictdes(process.getSoftconflictdes());
                     apsProcessOperationProcessEqu.setDeleted("0");
+                    apsProcessOperationProcessEqu.setUnfinishroll(process.getProducePcNum());
                     apsProcessOperationProcessEquDos.add(apsProcessOperationProcessEqu);
                 }
                 // 合并生产工序
@@ -547,6 +560,7 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
                         apsProcessOperationProcessEqu.setConflictdes(process.getConflictDes());
                         apsProcessOperationProcessEqu.setSoftconflictdes(process.getSoftconflictdes());
                         apsProcessOperationProcessEqu.setDeleted("0");
+                        apsProcessOperationProcessEqu.setUnfinishroll(v.size());
                         apsProcessOperationProcessEquDos.add(apsProcessOperationProcessEqu);
                     });
                 }
@@ -650,7 +664,7 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
             Map<String, Integer> roamTime = new HashMap<>();
             Integer workshopin = new BigDecimal(apsScheduleConfig.getWorkshopin()).multiply((looseness.divide(new BigDecimal("100"))).add(new BigDecimal("1")))
                     .setScale(0, RoundingMode.CEILING).intValue();
-            Integer workshopcross = new BigDecimal(apsScheduleConfig.getWorkshopin()).multiply((looseness.divide(new BigDecimal("100"))).add(new BigDecimal("1")))
+            Integer workshopcross = new BigDecimal(apsScheduleConfig.getWorkshopcross()).multiply((looseness.divide(new BigDecimal("100"))).add(new BigDecimal("1")))
                     .setScale(0, RoundingMode.CEILING).intValue();
             roamTime.put("WORKSHOP_IN", workshopin);
             roamTime.put("WORKSHOP_CROSS", workshopcross);
@@ -684,7 +698,7 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
         if (apsBlankOrders != null && apsBlankOrders.size() > 0) {
             for (ApsBlankOrderVo apsBlankOrderVo : apsBlankOrders) {
                 // 坯料计划订单
-                ProduceOrder produceOrder = new ProduceOrder(apsBlankOrderVo.getId(), apsBlankOrderVo.getMaterialname(), apsBlankOrderVo.getDeliverydate());
+                ProduceOrder produceOrder = new ProduceOrder(apsBlankOrderVo.getId(), apsBlankOrderVo.getMaterialname(), DateUtil.offsetHour(apsBlankOrderVo.getDeliverydate(),-apsBlankOrderVo.getDeliverytime()));
                 // 获取所有订单工序
                 List<ApsProcessOperationDo> operationDos = apsProcessOperationService.list(new LambdaQueryWrapper<ApsProcessOperationDo>()
                         .eq(ApsProcessOperationDo::getBlankid, apsBlankOrderVo.getId()));
@@ -721,15 +735,17 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
                                             .orderByAsc(ApsProcessOperationProcessEquDo::getPlanstartdate)
                                     );
                                     // 查询当前设备最后一个生产任务、连续生产需要考虑使用
-                                    List<ApsProcessOperationProcessEquDo> processLastEqus = processOperationProcessEquService.list(new LambdaQueryWrapper<ApsProcessOperationProcessEquDo>()
+                                    List<ApsProcessOperationProcessEquDo> lastpros = processOperationProcessEquService.list(new LambdaQueryWrapper<ApsProcessOperationProcessEquDo>()
                                             .eq(ApsProcessOperationProcessEquDo::getProcessdeviceid, equIds)
                                             .gt(ApsProcessOperationProcessEquDo::getPlanstartdate, productionScheduleVo.getApsPlanStartDate())
-                                            .orderByAsc(ApsProcessOperationProcessEquDo::getPlanstartdate)
+                                            .orderByDesc(ApsProcessOperationProcessEquDo::getPlanstartdate)
                                     );
-                                    if(processLastEqus != null && processLastEqus.size()>0){
-                                        ApsProcessOperationProcessEquDo lastpro = processLastEqus.get(processLastEqus.size()-1);
+                                    if(lastpros != null && lastpros.size()>0){
+                                        ApsProcessOperationProcessEquDo lastpro = lastpros.get(0);
                                         ApsProcessOperationDo lastop = apsProcessOperationService.getById(lastpro.getProcessid());
                                         equipment.setLastProcessType(lastop.getProcess());
+                                        equipment.setLastProcessEndTime(lastpro.getPlanenddate());
+                                        equipment.setLastProcessCutfinishmin(lastop.getCutfinishmin() == null ? null : lastop.getCutfinishmin().intValue());
                                         // 铸轧
                                         if ("铸轧".equals(lastop.getProcess())) {
                                             // 合金+宽度
@@ -740,6 +756,7 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
                                             // 合金+输入物料+宽度
                                             equipment.setLastSeriesProduceMark(lastop.getMetal() + "^_^" + lastop.getPlaninput() + "^_^" + lastop.getProwidth());
                                         }
+                                        equipment.setLastProcessCutfinishmin(lastop.getCutfinishmin() == null ? null : lastop.getCutfinishmin().intValue());
                                     }
                                     // 查询相关工序作业
                                     Set<String> processIds = new HashSet<>();
@@ -748,9 +765,9 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
                                             processIds.add(equs.getProcessid());
                                         }
                                         List<ApsProcessOperationDo> processOperationDos = null;
-                                        if(processIds.size()>0){
+                                        if (processIds.size() > 0) {
                                             processOperationDos = apsProcessOperationService.list(new LambdaQueryWrapper<ApsProcessOperationDo>()
-                                                    .in(ApsProcessOperationDo::getId,processIds));
+                                                    .in(ApsProcessOperationDo::getId, processIds));
                                         }
 
                                         List<EquipmentRunTime> equipmentRunTimes = new ArrayList<>();
@@ -758,11 +775,10 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
                                             EquipmentRunTime er = new EquipmentRunTime();
                                             er.setStartRunTime(equs.getPlanstartdate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
                                             er.setEndRunTime(equs.getPlanenddate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
-                                            equipmentRunTimes.add(er);
                                             // 设备占用时间设置连续生产标识,参与排程
-                                            if(processOperationDos != null){
+                                            if (processOperationDos != null) {
                                                 List<ApsProcessOperationDo> pos = processOperationDos.stream().filter(v -> v.getId().equals(equs.getProcessid())).collect(Collectors.toList());
-                                                if(pos != null && pos.size()>0){
+                                                if (pos != null && pos.size() > 0) {
                                                     ApsProcessOperationDo processesDo = pos.get(0);
                                                     er.setProcessType(processesDo.getProcess());
                                                     // 铸轧
@@ -775,8 +791,11 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
                                                         // 合金+输入物料+宽度
                                                         er.setSeriesProduceMark(operationDo.getMetal() + "^_^" + operationDo.getPlaninput() + "^_^" + operationDo.getProwidth());
                                                     }
+                                                    er.setPrepressworkmin(processesDo.getPrepressworkmin() == null ? null : processesDo.getPrepressworkmin().intValue());
+                                                    er.setCutfinishmin(processesDo.getCutfinishmin() == null ? null : processesDo.getCutfinishmin().intValue());
                                                 }
                                             }
+                                            equipmentRunTimes.add(er);
                                         }
                                         equipment.setEquipmentRunTimes(equipmentRunTimes);
                                     }
@@ -812,7 +831,7 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
                         processes.setUnitProduceTime(operationDo.getOnceprocessmin().intValue());
 //                        processes.setProduceTime(processes.getUnitProduceTime()*processes.getProducePcNum());
                         processes.setProduceTime(operationDo.getProcesstotaltime().intValue());
-                        if(operationDo.getMinflowwaitmin() != null){
+                        if (operationDo.getMinflowwaitmin() != null) {
                             processes.setMinWaitTime(operationDo.getMinflowwaitmin().intValue());
                         }
                         if (operationDo.getMaxflowwaitmin() != null) {
@@ -837,14 +856,15 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
                             // 合金+输入物料+宽度
                             processes.setSeriesProduceMark(operationDo.getMetal() + "^_^" + operationDo.getPlaninput() + "^_^" + operationDo.getProwidth());
                         }
-
+                        processes.setPrepressworkmin(operationDo.getPrepressworkmin() == null ? null : operationDo.getPrepressworkmin().intValue());
+                        processes.setCutfinishmin(operationDo.getCutfinishmin() == null ? null : operationDo.getCutfinishmin().intValue());
                         processesList.add(processes);
                     }
                 }
             }
         }
         // 合并生产工序
-        List<ProductionProcesses> productionProcesses = mergeProcesses(processOperationMs, eqMaps,apsScheduleConfig);
+        List<ProductionProcesses> productionProcesses = mergeProcesses(processOperationMs, eqMaps, apsScheduleConfig);
         processesList.addAll(productionProcesses);
         // 加工时间松散度设置
         /*if(looseness != null){
@@ -864,7 +884,7 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
      * @param processOperationMs
      * @return
      */
-    private List<ProductionProcesses> mergeProcesses(List<ApsProcessOperationVo> processOperationMs, Map<String, AspCheckItemsDo> eqMaps,ApsScheduleConfigDo apsScheduleConfig) {
+    private List<ProductionProcesses> mergeProcesses(List<ApsProcessOperationVo> processOperationMs, Map<String, AspCheckItemsDo> eqMaps, ApsScheduleConfigDo apsScheduleConfig) {
         // 最终的合并工序
         List<ProductionProcesses> processesList = new ArrayList<>();
         if (processOperationMs != null && processOperationMs.size() > 0) {
@@ -895,7 +915,7 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
                 aspCheckItemMap.put(aspCheckItemsDo.getId(), aspCheckItemsDo);
                 aspCheckItemUse.put(aspCheckItemsDo.getId(), 0);
                 // 退火炉套筒间隙扣除
-                if(apsScheduleConfig != null){
+                if (apsScheduleConfig != null) {
                     aspCheckItemsDo.setEquipmentwidth(aspCheckItemsDo.getEquipmentwidth().subtract(apsScheduleConfig.getLooseness()));
                 }
             }
@@ -1158,7 +1178,7 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
         }
     }
 
-    private void checkIfCanMerge(){
+    private void checkIfCanMerge() {
 
     }
 
@@ -1196,8 +1216,8 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
         // 更工序作业生产状态=待排程,是否锁定=否,
         apsProcessOperationService.update(new LambdaUpdateWrapper<ApsProcessOperationDo>()
                 .in(ApsProcessOperationDo::getBlankid, blankids)
-                .set(ApsProcessOperationDo::getProcessstatus,TO_BE_SCHEDULED)
-                .set(ApsProcessOperationDo::getLockmark,LOCKMARK_N)
+                .set(ApsProcessOperationDo::getProcessstatus, TO_BE_SCHEDULED)
+                .set(ApsProcessOperationDo::getLockmark, LOCKMARK_N)
         );
         // 清空作业明细
         processOperationProcessEquService.remove(new LambdaUpdateWrapper<ApsProcessOperationProcessEquDo>()
@@ -1418,7 +1438,7 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
             apsWorkInProgressInventoryService.updateById(apsWorkInProgressInventoryDo);
 
             //借调逻辑
-            if (progressWork.getWorkinprocessstatus().equals(SaveConstans.WorkInProgressStatus.WAIT_WORK)) {
+            if (ObjectUtil.isNotEmpty(progressWork) && ObjectUtil.isNotEmpty(progressWork.getWorkinprocessstatus()) && progressWork.getWorkinprocessstatus().equals(SaveConstans.WorkInProgressStatus.WAIT_WORK)) {
                 //获取该在制品的工序作业ID
                 String processoperationid = progressWork.getProcessoperationid();
                 //获取该在制品的批次号
@@ -1440,4 +1460,218 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
         return R.ok();
     }
 
+
+    public R checkBlankOrder(CheckAndSaveOrUpdateBlankReq req, int j) {
+        //获取坯料计划内容
+        ApsBlankOrderDo apsBlankOrderDo = req.getApsBlankOrderDo();
+        //获取当前用户信息
+        //获取当前用户的所属工厂
+        SysUserVo currentUser = CXCommonUtils.getCurrentUser();
+        String tenantId = currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1];
+
+
+        //=============校验坯料长度=================
+        //如果坯料产品类型对应产品外观类型是铝板或板锭,并且坯料长度为空,则提示:坯料是铝板和板锭时长度必填
+        if (ObjectUtil.isNotEmpty(apsBlankOrderDo.getProducttypeid())) {
+            //目前数据字典存在3层关系,选择只能选择最后一层,二开查询最后一层的父节点对应数据的父节点,判断是否为铝板或板锭的主键ID
+            String pid = this.baseMapper.selectDictAboutProductType(apsBlankOrderDo.getProductionorderid());
+            //如果是铝板或板锭
+            if (ObjectUtil.isNotEmpty(pid) && (pid.equals(SaveConstans.ProductionType.BANDING_ID) || pid.equals(SaveConstans.ProductionType.LVBAN_ID))) {
+                //坯料长度为空
+                if (ObjectUtil.isEmpty(apsBlankOrderDo.getProlength())) {
+                    return R.error("第" + j + "个坯料计划 坯料是铝板和板锭时长度必填");
+                }
+            }
+        }
+        //==============拼接工艺路线输出成品==============
+        //查询坯料计划对应工艺路线的输出成品
+        List<String> processOutputList = this.baseMapper.selectProcessByBlankId(apsBlankOrderDo.getId());
+        if (processOutputList != null && processOutputList.size() > 0) {
+            String outputProcessMaterial = "";
+            //排序
+            processOutputList.sort(String::compareTo);
+            for (int i = 0; i < processOutputList.size(); i++) {
+                outputProcessMaterial += "[" + (i + 1) + "]" + processOutputList.get(i);
+                if (i < processOutputList.size() - 1) {
+                    outputProcessMaterial += ",\r\n";
+                }
+            }
+            apsBlankOrderDo.setOutputmaterial(outputProcessMaterial);
+        } else {
+            return R.error("第" + j + "个坯料计划 工艺路线没有输出成品");
+        }
+
+        //=============校验输出成品==============
+        //产品明细
+        List<ApsProductDetailDo> apsProductDetailDoList = req.getApsProductDetailDoList();
+        //输出成品
+        List<ApsProcessOutputProductDo> apsProcessOutputProductDoList = req.getApsProcessOutputProductDoList();
+
+        //如果坯料计划未开工(生产状态<=30)
+        if (apsBlankOrderDo.getProductstatus().compareTo(TO_BE_STARTED) <= 0) {
+            for (ApsProcessOutputProductDo apsProcessOutputProductDo : apsProcessOutputProductDoList) {
+                boolean haveProductDetail = false;
+                for (ApsProductDetailDo apsProductDetailDo : apsProductDetailDoList) {
+                    //判断是否存在对应的产品明细
+                    if (apsProcessOutputProductDo.getProductid().equals(apsProductDetailDo.getId())) {
+                        haveProductDetail = true;
+
+                        if (apsProductDetailDo.getInputmaterialdescription().equals(apsProcessOutputProductDo.getProductname())) {
+                            //如果输出单卷重<单卷重(起)或 输出单卷重>单卷重(止),错误提示:输出成品:{订单产品} 输出单卷重不符合订单要求
+                            if (apsProcessOutputProductDo.getOutputonerollweigth().compareTo(apsProductDetailDo.getSinglerollweightstart()) < 0
+                                    || apsProcessOutputProductDo.getOutputonerollweigth().compareTo(apsProductDetailDo.getSinglerollweightend()) > 0) {
+                                return R.error("第" + j + "个坯料计划 输出成品:" + apsProcessOutputProductDo.getProductname() + " 输出单卷重不符合订单要求");
+                            }
+                        } else {//如果对应订单产品明细的订单产品字段值不等于输出成品的订单产品字段值,错误提示:输出成品:{订单产品} 对应订单产品已修改或已删除,请重新选择订单产品
+                            return R.error("第" + j + "个坯料计划 输出成品:" + apsProcessOutputProductDo.getProductname() + " 对应订单产品已修改或已删除,请重新选择订单产品");
+                        }
+                        break;
+                    }
+                }
+                //存在对应的产品明细
+                if (haveProductDetail) {
+                    //如果输出单卷重>坯料单卷重,错误提示:输出单卷重不能超过坯料单卷重
+                    //(注意:成品重量和坯料重量单位吨和公斤需要转换后比较)
+                    //转化单卷重 单位统一为 公斤(kg)
+
+                    //输出的单卷重
+                    BigDecimal outputWeight = new BigDecimal(0);
+                    //坯料的单卷重
+                    BigDecimal blankWeight = new BigDecimal(0);
+                    //统一输出的重量
+                    //公斤/千克
+                    if (apsProcessOutputProductDo.getCountunit().equals(SaveConstans.CountUnit.KG)) {
+                        outputWeight = apsProcessOutputProductDo.getOutputonerollweigth();
+                    }
+                    //吨
+                    if (apsProcessOutputProductDo.getCountunit().equals(SaveConstans.CountUnit.TON)) {
+                        outputWeight = apsProcessOutputProductDo.getOutputonerollweigth().multiply(new BigDecimal(1000));
+                    }
+
+                    //统一坯料的重量
+                    if (apsBlankOrderDo.getNumberunit().equals(SaveConstans.CountUnit.KG)) {
+                        blankWeight = apsBlankOrderDo.getSinglerollweight();
+                    }
+                    if (apsBlankOrderDo.getNumberunit().equals(SaveConstans.CountUnit.TON)) {
+                        blankWeight = apsBlankOrderDo.getSinglerollweight().multiply(new BigDecimal(1000));
+                    }
+                    //输出单卷重>坯料单卷重
+                    if (outputWeight.compareTo(blankWeight) > 0) {
+                        return R.error("第" + j + "个坯料计划 输出成品:" + apsProcessOutputProductDo.getProductname() + " 输出单卷重不能超过坯料单卷重");
+                    }
+                } else {//不存在对应的产品明细
+                    return R.error("第" + j + "个坯料计划 输出成品:" + apsProcessOutputProductDo.getProductname() + " 对应订单产品已修改或已删除,请重新选择订单产品");
+                }
+            }
+        }
+
+        //不论坯料计划的状态,需要增加的判断
+        for (ApsProcessOutputProductDo apsProcessOutputProductDo : apsProcessOutputProductDoList) {
+            boolean haveProductDetail = false;
+            for (ApsProductDetailDo apsProductDetailDo : apsProductDetailDoList) {
+                //判断是否存在对应的产品明细
+                if (apsProcessOutputProductDo.getProductid().equals(apsProductDetailDo.getId())) {
+                    haveProductDetail = true;
+                    //计划输出订单重量 > 对应订单产品订单总数量;错误提示:输出成品 {订单产品} 计划输出订单重量 不能大于 订单总数量
+                    if (apsProcessOutputProductDo.getPlanoutputonerollweight().compareTo(apsProductDetailDo.getTotalordercount()) > 0) {
+                        return R.error("第" + j + "个坯料计划 输出成品:" + apsProcessOutputProductDo.getProductname() + " 计划输出订单重量 不能大于 订单总数量");
+                    }
+                }
+            }
+            if (!haveProductDetail && apsProcessOutputProductDo.getPlanoutputonerollweight().compareTo(new BigDecimal(0)) > 0) {
+                return R.error("第" + j + "个坯料计划 输出成品:" + apsProcessOutputProductDo.getProductname() + " 已修改或已删除,并已开工,计划输出订单重量 不能大于 0");
+            }
+        }
+
+
+        //============校验工艺路线=============
+        //如果坯料需求的坯料输出成品字段值不等于坯料需求的工艺输出成品字段值,错误提示:工艺路线输出成品与坯料输出成品不一致
+        if (!apsBlankOrderDo.getOutputfinishproduct().equals(apsBlankOrderDo.getOutputmaterial())) {
+            return R.error("第" + j + "个坯料计划 工艺路线输出成品与坯料输出成品不一致");
+        }
+        //如果坯料需求的是否备料=是,并且首道工序作业的是否坯料工序=是,错误提示:工艺路线错误,首道工序作业是坯料工序,备料不能作为输入物料
+        //是否备料
+        if (apsBlankOrderDo.getPreparematerial().equals("是")) {
+            //查询坯料计划的工序作业
+            List<ApsProcessOperationDo> processOperationList = apsProcessOperationService.list(new QueryWrapper<ApsProcessOperationDo>().lambda().eq(ApsProcessOperationDo::getBlankid, apsBlankOrderDo.getId()));
+            for (ApsProcessOperationDo processOperationDo : processOperationList) {
+                //没有前道工序作业ID
+                if (ObjectUtil.isEmpty(processOperationDo.getPreviousprocessid())) {
+                    if (processOperationDo.getIfblankprocess().equals("是")) {
+                        return R.error("第" + j + "个坯料计划 工艺路线错误,首道工序作业是坯料工序,备料不能作为输入物料");
+                    }
+                    break;
+                }
+            }
+        }
+
+        //============校验工序作业=============
+        Map<String, Object> params = new HashMap<>();
+        params.put("BLANKID", apsBlankOrderDo.getId());
+        if (req.getCheckDevice()) {
+            params.put("checkDeviceAndOrgCode", true);
+        }
+        R r = apsProcessOperationService.checkOperation(params);
+        if (!(r.getCode().equals("200"))) {
+            return R.error("第" + j + "个坯料计划 " + r.getMsg());
+        }
+        return R.ok();
+    }
+
+    @Override
+    @Transactional
+    public R removeBlankOrder(ApsBlankOrderDo req) {
+        if (ObjectUtil.isEmpty(req.getId())) {
+            return R.error("坯料Id不能为空");
+        }
+        ApsBlankOrderDo apsBlankOrderDo = this.getById(req.getId());
+        removeBlankOrderAndChild(apsBlankOrderDo);
+
+        //物理删除相关的工序作业备份
+        this.baseMapper.deleteProcessBackupByBlankId(req.getId());
+        //物理删除相关的作业明细备份
+        this.baseMapper.deleteProcessEquBackupByBlankId(req.getId());
+
+        //查询此订单的其他任一一个坯料计划的Id,重新更新订单的状态
+        CommonUpdateProductionStatusReq commonUpdateProductionStatusReq = new CommonUpdateProductionStatusReq();
+        ApsBlankOrderDo one = this.getOne(new QueryWrapper<ApsBlankOrderDo>().lambda().eq(ApsBlankOrderDo::getProductionorderid, apsBlankOrderDo.getProductionorderid()));
+        if (ObjectUtil.isNotEmpty(one)) {
+            commonUpdateProductionStatusReq.setBlankId(one.getId());
+        } else {
+            commonUpdateProductionStatusReq.setOrderId(apsBlankOrderDo.getProductionorderid());
+        }
+        apsProcessOperationProcessEquService.updateProductionStatus(commonUpdateProductionStatusReq);
+
+        return R.ok();
+    }
+
+    public void removeBlankOrderAndChild(ApsBlankOrderDo req) {
+        //删除坯料计划
+        this.removeById(req.getId());
+
+        //如果是备料,删除计划后,备料的计划ID设置为空
+        if (req.getPreparematerial().equals("是")) {
+            ApsWorkInProgressInventoryDo needUpdate = new ApsWorkInProgressInventoryDo();
+            needUpdate.setPlanmaterialid("");
+            apsWorkInProgressInventoryService.update(needUpdate, new QueryWrapper<ApsWorkInProgressInventoryDo>().lambda().eq(ApsWorkInProgressInventoryDo::getPlanmaterialid, req.getId()));
+        }
+
+        //逻辑删除坯料计划输出成品
+        apsProcessOutputProductService.remove(new QueryWrapper<ApsProcessOutputProductDo>().lambda().eq(ApsProcessOutputProductDo::getBlankid, req.getId()));
+
+        //逻辑删除坯料计划工序作业
+        apsProcessOperationService.remove(new QueryWrapper<ApsProcessOperationDo>().lambda().eq(ApsProcessOperationDo::getBlankid, req.getId()));
+
+        //逻辑删除坯料计划工序作业-输出物料
+        apsProcessOperationOutMaterService.remove(new QueryWrapper<ApsProcessOperationOutMaterDo>().lambda().eq(ApsProcessOperationOutMaterDo::getBlankid, req.getId()));
+
+        //逻辑删除坯料计划工序作业-可选设备
+        apsProcessOperationEquService.remove(new QueryWrapper<ApsProcessOperationEquDo>().lambda().eq(ApsProcessOperationEquDo::getBlankid, req.getId()));
+
+        //逻辑删除坯料计划工序作业-作业明细
+        apsProcessOperationProcessEquService.remove(new QueryWrapper<ApsProcessOperationProcessEquDo>().lambda().eq(ApsProcessOperationProcessEquDo::getBlankid, req.getId()));
+
+        //逻辑删除坯料计划的工艺路线
+        this.baseMapper.removeMindMappingByBlankId(req.getId());
+    }
 }

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

@@ -0,0 +1,13 @@
+package com.rongwei.bscommon.sys.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.rongwei.bscommon.sys.dao.ApsOrderAlloyCompositionDao;
+import com.rongwei.bscommon.sys.service.ApsOrderAlloyCompositionService;
+import com.rongwei.bsentity.domain.ApsOrderAlloyCompositionDo;
+import org.springframework.stereotype.Service;
+
+
+@Service
+public class ApsOrderAlloyCompositionServiceImpl extends ServiceImpl<ApsOrderAlloyCompositionDao, ApsOrderAlloyCompositionDo> implements ApsOrderAlloyCompositionService {
+
+}

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

@@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.json.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.rongwei.bscommon.sys.dao.*;
 import com.rongwei.bscommon.sys.service.*;
@@ -567,6 +568,10 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
     @Override
     public void clearCraftRoute(Map<String, Object> params) {
         String blankid = params.get("BLANKID").toString();
+        //坯料计划去掉选择的工艺路线ID
+        apsBlankOrderService.update(new LambdaUpdateWrapper<ApsBlankOrderDo>()
+                .eq(ApsBlankOrderDo::getId, blankid)
+                .set(ApsBlankOrderDo::getCraftrouteid, null));
         //工序作业
         apsProcessOperationDao.updateProcessOperation(blankid);
         //工序作业输出物料
@@ -669,6 +674,17 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
                 workShopMap.put(sysOrganizationDo.getId(), sysOrganizationDo.getRoption());
             }
 
+
+            /**
+             * 检查所有是否坯料工序=是的工序作业
+             * 如果坯料计划的坯料类型=铸轧,并且(工序作业的加工设备代号为空,或者加工设备代号不是2位),
+             * 则错误提示:铸轧坯料加工设备{加工车间}/{加工设备}的代号需要是2位;
+             * 如果坯料计划的坯料类型=热轧,并且(工序作业的加工设备代号为空,或者加工设备代号不是1位),
+             * 则错误提示:热轧坯料加工设备{加工车间}/{加工设备}的代号需要是1位;
+             * 如果工序作业的加工车间代号为空,或者不是1位,则错误提示:加工车间{加工车间}代号不能为空
+             */
+            //查询坯料计划
+            ApsBlankOrderDo apsBlankOrderDo = apsBlankOrderService.getById(blankId);
             //遍历查询是否有工序没有对应的设备代号和车间代号
             for (ApsProcessOperationProcessEquDo equDo : list) {
                 //查询工序作业
@@ -677,16 +693,32 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
                 //校验设备代号
                 if (ObjectUtil.isNotEmpty(equDo.getProcessdeviceid())) {
                     if (deviceMap.containsKey(equDo.getProcessdeviceid())) {
-                        if (ObjectUtil.isEmpty(deviceMap.get(equDo.getProcessdeviceid()))) {
-                            return R.error(apsProcessOperationDo.getProcess() + apsProcessOperationDo.getProcessname() + "的加工设备" + equDo.getProcessdevice() + "代号不能为空");
+                        String deviceCode = deviceMap.get(equDo.getProcessdeviceid()).toString();
+//                        if (ObjectUtil.isEmpty(deviceMap.get(equDo.getProcessdeviceid()))) {
+//                            return R.error(apsProcessOperationDo.getProcess() + apsProcessOperationDo.getProcessname() + "的加工设备" + equDo.getProcessdevice() + "代号不能为空");
+//                        }
+                        //校验设备代号位数
+                        //检查所有是否坯料工序=是的工序作业
+                        if (apsProcessOperationDo.getIfblankprocess().equals("是")) {
+                            //如果坯料计划的坯料类型=铸轧,并且(工序作业的加工设备代号为空,或者加工设备代号不是2位)
+                            if (apsBlankOrderDo.getBlanktype().equals("铸轧")
+                                    && (ObjectUtil.isEmpty(deviceCode) || deviceCode.length() != 2)) {
+                                return R.error("铸轧坯料加工设备" + equDo.getProcessworkshop() + "/" + equDo.getProcessdevice() + "的代号需要是2位");
+                            }
+                            //如果坯料计划的坯料类型=热轧,并且(工序作业的加工设备代号为空,或者加工设备代号不是1位)
+                            if (apsBlankOrderDo.getBlanktype().equals("热轧")
+                                    && (ObjectUtil.isEmpty(deviceCode) || deviceCode.length() != 1)) {
+                                return R.error("热轧坯料加工设备" + equDo.getProcessworkshop() + "/" + equDo.getProcessdevice() + "的代号需要是1位");
+                            }
                         }
                     }
                 }
                 //校验车间代号
                 if (ObjectUtil.isNotEmpty(equDo.getProcessworkshopid())) {
                     if (workShopMap.containsKey(equDo.getProcessworkshopid())) {
-                        if (ObjectUtil.isEmpty(workShopMap.get(equDo.getProcessworkshopid()))) {
-                            return R.error(apsProcessOperationDo.getProcess() + apsProcessOperationDo.getProcessname() + "的加工车间" + equDo.getProcessworkshop() + "代号不能为空");
+                        String workShopCode = workShopMap.get(equDo.getProcessworkshopid()).toString();
+                        if (ObjectUtil.isEmpty(workShopCode) || workShopCode.length() != 1) {
+                            return R.error("加工车间" + equDo.getProcessworkshop() + "代号不能为空");
                         }
                     }
                 }

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

@@ -1,21 +1,19 @@
 package com.rongwei.bscommon.sys.service.impl;
 
+import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.rongwei.bscommon.sys.dao.*;
-import com.rongwei.bscommon.sys.service.ApsProductionOrderService;
+import com.rongwei.bscommon.sys.service.*;
 import com.rongwei.bscommon.sys.utils.ApsUtils;
-import com.rongwei.bsentity.domain.ApsBlankOrderDo;
-import com.rongwei.bsentity.domain.ApsProductionMergeOrderDo;
-import com.rongwei.bsentity.domain.ApsProductionOrderDo;
-import com.rongwei.bsentity.vo.ApsProductDetailVo;
-import com.rongwei.bsentity.vo.CheckAndSaveOrUpdateOrderReq;
-import com.rongwei.bsentity.vo.ProductDetailIdAndPlanOutPutRollCountAllVo;
-import com.rongwei.bsentity.vo.ProductTypeIdAndPidVo;
+import com.rongwei.bsentity.domain.*;
+import com.rongwei.bsentity.vo.*;
+import com.rongwei.rwadmincommon.system.vo.SysUserVo;
 import com.rongwei.rwcommon.base.R;
+import com.rongwei.rwcommon.utils.StringUtils;
 import com.rongwei.rwcommon.vo.MailDo;
 import com.rongwei.safecommon.fegin.CXCommonFeginClient;
 import com.rongwei.safecommon.utils.CXCommonUtils;
@@ -27,13 +25,14 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.Arrays;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
 import java.util.stream.Collectors;
 
-import static com.rongwei.safecommon.utils.SaveConstans.NotifyContent.ORDEROUTTIME_AUDIT_CONTENT;
-import static com.rongwei.safecommon.utils.SaveConstans.NotifyTitle.ORDEROUTTIMEAUDIT_TITLE;
-import static com.rongwei.safecommon.utils.SaveConstans.NotifyType.ORDEROUTTIME_AUDIT;
+import static com.rongwei.safecommon.utils.SaveConstans.NotifyContent.*;
+import static com.rongwei.safecommon.utils.SaveConstans.NotifyTitle.*;
+import static com.rongwei.safecommon.utils.SaveConstans.NotifyType.*;
 
 /**
  *
@@ -55,7 +54,17 @@ public class ApsProductionOrderServiceImpl extends ServiceImpl<ApsProductionOrde
     @Autowired
     private ApsProcessOperationProcessEquBackupDao apsProcessOperationProcessEquBackupDao;
     @Autowired
+    private ApsBlankOrderService apsBlankOrderService;
+    @Autowired
+    private ApsProcessOutputProductService apsProcessOutputProductService;
+    @Autowired
     private CXCommonFeginClient autoCommonFeginClient;
+    @Autowired
+    private ApsProductDetailService apsProductDetailService;
+    @Autowired
+    private ApsProductionMergeOrderService apsProductionMergeOrderService;
+    @Autowired
+    private ApsOrderAlloyCompositionService apsOrderAlloyCompositionService;
 
     public static final String ERROR_MSG = "%s上诉订单的排程交货期大于承诺交货期";
 
@@ -158,16 +167,24 @@ public class ApsProductionOrderServiceImpl extends ServiceImpl<ApsProductionOrde
                     return R.error("坯料计划 " + apsBlankOrderDo.getInputreportdescribe() + " 还未排程");
                 }
             }
-        }
+            //检查该订单所有作业明细,如果存在冲突,则错误提示:请先解决冲突再发布
+            int count = this.baseMapper.selectConflictdesCount(apsProductionOrderDo.getId());
+            if (count > 0) {
+                return R.error("请先解决冲突再发布");
+            }
 
-        //============校验承诺交期============
-        //如果承诺交货期为空,错误提示:请填写订单{订单号}{客户简称}的承诺交货期
-        if (ObjectUtil.isEmpty(apsProductionOrderDo.getPromisedeliverydate())) {
-            return R.error("请填写订单" + apsProductionOrderDo.getOrderno() + apsProductionOrderDo.getCustomname() + "的承诺交货期");
-        }
-        //如果承诺交货期<排程交货期,错误提示:承诺交货期不能早于排程交货期{排程交货期}
-        if (apsProductionOrderDo.getPromisedeliverydate().compareTo(apsProductionOrderDo.getScheduledeliverydate()) < 0) {
-            return R.error("承诺交货期不能早于排程交货期" + DateUtil.format(apsProductionOrderDo.getScheduledeliverydate(), "yyyy-MM-dd"));
+            //============校验承诺交期============
+            //如果承诺交货期为空,错误提示:请填写订单{订单号}{客户简称}的承诺交货期
+            if (ObjectUtil.isEmpty(apsProductionOrderDo.getPromisedeliverydate())) {
+                return R.error("请填写订单" + apsProductionOrderDo.getOrderno() + apsProductionOrderDo.getCustomname() + "的承诺交货期");
+            }
+            if (ObjectUtil.isEmpty(apsProductionOrderDo.getScheduledeliverydate())) {
+                return R.error("排程交货期不能为空");
+            }
+            //如果承诺交货期<排程交货期,错误提示:承诺交货期不能早于排程交货期{排程交货期}
+            if (apsProductionOrderDo.getPromisedeliverydate().compareTo(apsProductionOrderDo.getScheduledeliverydate()) < 0) {
+                return R.error("承诺交货期不能早于排程交货期" + DateUtil.format(apsProductionOrderDo.getScheduledeliverydate(), "yyyy-MM-dd"));
+            }
         }
 
         //============校验计划输出订单总重量==============
@@ -228,10 +245,54 @@ public class ApsProductionOrderServiceImpl extends ServiceImpl<ApsProductionOrde
             }
         }
 
+        List<ApsProductDetailDo> productDetailDoList = BeanUtil.copyToList(apsProductDetailVoList, ApsProductDetailDo.class);
         //================循环校验坯料计划===============
+        for (int i = 0; i < apsBlankOrderDoList.size(); i++) {
+            CheckAndSaveOrUpdateBlankReq checkAndSaveOrUpdateBlankReq = new CheckAndSaveOrUpdateBlankReq();
+            checkAndSaveOrUpdateBlankReq.setApsBlankOrderDo(apsBlankOrderDoList.get(i));
+            checkAndSaveOrUpdateBlankReq.setApsProcessOutputProductDoList(apsProcessOutputProductService.list(new QueryWrapper<ApsProcessOutputProductDo>().lambda().eq(ApsProcessOutputProductDo::getBlankid, apsBlankOrderDoList.get(i).getId())));
+            checkAndSaveOrUpdateBlankReq.setApsProductDetailDoList(productDetailDoList);
+            if (checkSchedule) {
+                checkAndSaveOrUpdateBlankReq.setCheckDevice(true);
+            }
+            R r = apsBlankOrderService.checkBlankOrder(checkAndSaveOrUpdateBlankReq, i + 1);
+            if (!r.getCode().equals("200")) {
+                return R.error(r.getMsg());
+            }
+        }
+
+        //================校验通过,保存或更新订单相关信息=====================
+        //获取当前用户的所属工厂
+        SysUserVo currentUser = CXCommonUtils.getCurrentUser();
+        String tenantId = currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1];
+
+        //保存主表信息
+        apsProductionOrderDo.setTenantid(tenantId);
+        this.saveOrUpdate(apsProductionOrderDo);
+
+        //保存产品明细子表
+        for (ApsProductDetailVo apsProductDetailVo : apsProductDetailVoList) {
+            apsProductDetailVo.setTenantid(tenantId);
+        }
+        apsProductDetailService.saveOrUpdateBatch(productDetailDoList);
+
+        //保存合并订单子表
+        for (ApsProductionMergeOrderDo apsProductionMergeOrderDo : apsProductionMergeOrderDoList) {
+            apsProductionMergeOrderDo.setTenantid(tenantId);
+        }
+
+        if (checkSchedule) {
+            //=============发布排程================
+            List<String> productOrderIdList = new LinkedList<>();
+            productOrderIdList.add(apsProductionOrderDo.getId());
+            R publish = this.publish(productOrderIdList);
+            if (!publish.getCode().equals("200")) {
+                return R.error(publish.getMsg());
+            }
+        }
 
 
-        return null;
+        return R.ok();
     }
 
     /*
@@ -246,13 +307,127 @@ public class ApsProductionOrderServiceImpl extends ServiceImpl<ApsProductionOrde
             CXCommonUtils.sendNotify(ORDEROUTTIMEAUDIT_TITLE, String.format(ORDEROUTTIME_AUDIT_CONTENT, apsProductionOrderDo.getOrderno()), null, Arrays.asList(apsProductionOrderDo.getCreateuserid().split(",")), apsProductionOrderDo.getId(), ORDEROUTTIME_AUDIT, false);
 
             //邮件提醒
-            MailDo mailDo = new MailDo();
-            mailDo.setReceiveEmail(apsProductionOrderDo.getModifyusername().split(","));
-            mailDo.setNeedTransReceive(false);
-            mailDo.setCcEmail(new String[]{});
-            mailDo.setSubject(ORDEROUTTIMEAUDIT_TITLE);
-            mailDo.setContent(String.format(ORDEROUTTIME_AUDIT_CONTENT, apsProductionOrderDo.getOrderno()));
-            autoCommonFeginClient.sendHtmlMail(mailDo);
+            if (StringUtils.isNotEmpty(apsProductionOrderDo.getModifyusername())) {
+                MailDo mailDo = new MailDo();
+                mailDo.setReceiveEmail(apsProductionOrderDo.getModifyusername().split(","));
+                mailDo.setNeedTransReceive(false);
+                mailDo.setCcEmail(new String[]{});
+                mailDo.setSubject(ORDEROUTTIMEAUDIT_TITLE);
+                mailDo.setContent(String.format(ORDEROUTTIME_AUDIT_CONTENT, apsProductionOrderDo.getOrderno()));
+                autoCommonFeginClient.sendHtmlMail(mailDo);
+            }
+        }
+    }
+
+    /*
+    辅料申购提醒
+     */
+    @Override
+    public void auxiliaryMaterial() {
+        log.info("辅料申购提醒开始");
+        List<ApsProductionOrderDo> apsProductionOrderDos = this.baseMapper.getAuxiliaryMaterial();
+        for (ApsProductionOrderDo apsProductionOrderDo : apsProductionOrderDos) {
+            //系统通知(移动端和PC端个人工作台)
+            CXCommonUtils.sendNotify(AUXILIARYMATERIAL_TITLE, String.format(AUXILIARYMATERIAL_CONTENT, apsProductionOrderDo.getOrderno()), null, Arrays.asList(apsProductionOrderDo.getCreateuserid().split(",")), apsProductionOrderDo.getId(), AUXILIARYMATERIAL_REMIND, false);
+
+            //邮件提醒
+            if (StringUtils.isNotEmpty(apsProductionOrderDo.getModifyusername())) {
+                MailDo mailDo = new MailDo();
+                mailDo.setReceiveEmail(apsProductionOrderDo.getModifyusername().split(","));
+                mailDo.setNeedTransReceive(false);
+                mailDo.setCcEmail(new String[]{});
+                mailDo.setSubject(AUXILIARYMATERIAL_TITLE);
+                mailDo.setContent(String.format(AUXILIARYMATERIAL_CONTENT, apsProductionOrderDo.getOrderno()));
+                autoCommonFeginClient.sendHtmlMail(mailDo);
+            }
+        }
+    }
+
+    @Override
+    @Transactional
+    public R changeOrder(ApsProductionOrderDo req) {
+        if (ObjectUtil.isEmpty(req.getId())) {
+            return R.error("订单Id不能为空");
+        }
+        //订单评审状态=待计划评审,订单调整日期=今天
+        ApsProductionOrderDo apsProductionOrderDo = new ApsProductionOrderDo();
+        apsProductionOrderDo.setId(req.getId());
+        apsProductionOrderDo.setAuditstatus("待计划评审");
+        apsProductionOrderDo.setChangedate(DateUtil.date());
+        this.updateById(apsProductionOrderDo);
+
+        //撤回发布订单所有坯料计划的排程结果,参见【订单排程/一键自动排程/撤回发布排程结果】
+        List<String> orderIdList = new LinkedList<>();
+        orderIdList.add(req.getId());
+        R r = this.publishCancel(orderIdList);
+        if (!r.getCode().equals("200")) {
+            return R.error(r.getMsg());
+        }
+
+        return R.ok();
+    }
+
+    @Override
+    @Transactional
+    public R deleteOrder(DeleteOrderVo req) {
+        if (ObjectUtil.isEmpty(req.getOrderId())) {
+            return R.error("订单ID不能为空");
+        }
+
+        List<ApsBlankOrderDo> blankList = apsBlankOrderService.list(new QueryWrapper<ApsBlankOrderDo>().lambda().eq(ApsBlankOrderDo::getProductionorderid, req.getOrderId()));
+        //清除排程备份
+        if (req.getNeedDelBackup()) {
+            //查询订单下的坯料计划
+
+            List<String> blankIdList = blankList.stream().map(ApsBlankOrderDo::getId).collect(Collectors.toList());
+            SysUserVo currentUser = CXCommonUtils.getCurrentUser();
+            String factoryId = CXCommonUtils.getCurrentUserFactoryId(currentUser);
+            apsProcessOperationBackupDao.deletedByBlankId(blankIdList, factoryId);
+            apsProcessOperationProcessEquBackupDao.deletedByBlankId(blankIdList, factoryId);
+        }
+
+        //删除该订单,包括订单明细,合并订单及明细,坯料计划,工序作业
+        //删除订单
+        this.removeById(req.getOrderId());
+
+        //删除订单明细子表
+        apsProductDetailService.remove(new QueryWrapper<ApsProductDetailDo>().lambda().eq(ApsProductDetailDo::getMainid, req.getOrderId()));
+
+        //删除合并订单子表
+        apsProductionMergeOrderService.remove(new QueryWrapper<ApsProductionMergeOrderDo>().lambda().eq(ApsProductionMergeOrderDo::getMainid, req.getOrderId()));
+
+        //删除合计成分要求子表
+        apsOrderAlloyCompositionService.remove(new QueryWrapper<ApsOrderAlloyCompositionDo>().lambda().eq(ApsOrderAlloyCompositionDo::getProductionorderid, req.getOrderId()));
+
+        //遍历删除坯料计划子表
+        for (ApsBlankOrderDo apsBlankOrderDo : blankList) {
+            apsBlankOrderService.removeBlankOrderAndChild(apsBlankOrderDo);
+        }
+
+        return R.ok();
+    }
+
+    /*
+    作业延期提醒
+     */
+    @Override
+    public void processDelay() {
+        log.info("作业延期提醒开始");
+        List<ApsProductionOrderDo> apsProductionOrderDos = this.baseMapper.getProcessDelay();
+        for (ApsProductionOrderDo apsProductionOrderDo : apsProductionOrderDos) {
+            //系统通知(移动端和PC端个人工作台)
+            CXCommonUtils.sendNotify(PROCESSDELAY_TITLE, String.format(PROCESSDELAY_CONTENT, apsProductionOrderDo.getOrderno()), null, Arrays.asList(apsProductionOrderDo.getCreateuserid().split(",")), apsProductionOrderDo.getId(), PROCESSDELAY_REMIND, false);
+
+            //邮件提醒
+            if (StringUtils.isNotEmpty(apsProductionOrderDo.getModifyusername())) {
+                MailDo mailDo = new MailDo();
+                mailDo.setReceiveEmail(apsProductionOrderDo.getModifyusername().split(","));
+                mailDo.setNeedTransReceive(false);
+                mailDo.setCcEmail(new String[]{});
+                mailDo.setSubject(PROCESSDELAY_TITLE);
+                mailDo.setContent(String.format(PROCESSDELAY_CONTENT, apsProductionOrderDo.getOrderno()));
+                autoCommonFeginClient.sendHtmlMail(mailDo);
+            }
         }
     }
 

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

@@ -402,6 +402,8 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
         int unfinishroll = planprocessrall - needUpdateProcessOperationProcessEquDo.getReportroll();
         if(unfinishroll <= 0 || apsProcessOperationDo.getClosestatus().equals("已完工")){
             needUpdateProcessOperationProcessEquDo.setClosestatus("已完工");
+            //已完工时更新完工时间
+            needUpdateProcessOperationProcessEquDo.setActualfinishdate(DateUtil.date());
         }
         if(unfinishroll > 0 && apsProcessOperationDo.getClosestatus().equals("未完工")){
             needUpdateProcessOperationProcessEquDo.setClosestatus("未完工");

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

@@ -93,7 +93,7 @@
         <if test="productionOrderIds != null and productionOrderIds.size() >0">
             UPDATE aps_blank_order b
             <set>
-                PRODUCTSTATUS= PRODUCTSTATUS=(select
+                PRODUCTSTATUS=(select
                 CASE
                 WHEN GROUP_CONCAT(DISTINCT a.PROCESSSTATUS) = '10' THEN '10'
                 WHEN GROUP_CONCAT(DISTINCT a.PROCESSSTATUS) = '20' THEN '20'
@@ -106,7 +106,7 @@
                 WHEN FIND_IN_SET('20',GROUP_CONCAT(DISTINCT a.PROCESSSTATUS)) THEN '20'
                 ELSE b.PRODUCTSTATUS END
                 from aps_process_operation a where a.BLANKID = b.ID and deleted='0'
-                ),),
+                ),
                 SCHEDULINGSTATUS= "20"
             </set>
             <where>

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

@@ -40,7 +40,7 @@
     </update>
     <update id="updateBatchNumberByProcessList">
         update aps_process_operation_process_equ
-        set BACHMATERIALPROCESS = concat(BACHMATERIALPROCESS,',',#{batchnumber})
+        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=")">

+ 2 - 39
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/domain/ApsAlloyCompositionDo.java

@@ -1,6 +1,7 @@
 package com.rongwei.bsentity.domain;
 
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.rongwei.rwcommon.base.BaseDo;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -13,7 +14,7 @@ import java.util.Date;
  */
 @Data
 @TableName("aps_alloy_composition")
-public class ApsAlloyCompositionDo implements Serializable {
+public class ApsAlloyCompositionDo extends BaseDo {
     /**
      * 主键ID
      */
@@ -26,45 +27,7 @@ public class ApsAlloyCompositionDo implements Serializable {
      */
     private String roption;
 
-    /**
-     * 是否删除Y/N
-     */
-    private String deleted;
-
-    /**
-     * 备注
-     */
-    private String remark;
-
-    /**
-     * 创建时间
-     */
-    private Date createdate;
-
-    /**
-     * 创建用户ID
-     */
-    private String createuserid;
 
-    /**
-     * 修改日期
-     */
-    private Date modifydate;
-
-    /**
-     * 修改用户ID
-     */
-    private String modifyuserid;
-
-    /**
-     * 创建人
-     */
-    private String createusername;
-
-    /**
-     * 修改人
-     */
-    private String modifyusername;
 
     /**
      * 所属工厂

+ 2 - 40
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/domain/ApsAlloyDo.java

@@ -1,6 +1,7 @@
 package com.rongwei.bsentity.domain;
 
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.rongwei.rwcommon.base.BaseDo;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -12,7 +13,7 @@ import java.util.Date;
  */
 @Data
 @TableName("aps_alloy")
-public class ApsAlloyDo implements Serializable {
+public class ApsAlloyDo extends BaseDo {
     /**
      * 主键ID
      */
@@ -25,45 +26,6 @@ public class ApsAlloyDo implements Serializable {
      */
     private String roption;
 
-    /**
-     * 是否删除Y/N
-     */
-    private String deleted;
-
-    /**
-     * 备注
-     */
-    private String remark;
-
-    /**
-     * 创建时间
-     */
-    private Date createdate;
-
-    /**
-     * 创建用户ID
-     */
-    private String createuserid;
-
-    /**
-     * 修改日期
-     */
-    private Date modifydate;
-
-    /**
-     * 修改用户ID
-     */
-    private String modifyuserid;
-
-    /**
-     * 创建人
-     */
-    private String createusername;
-
-    /**
-     * 修改人
-     */
-    private String modifyusername;
 
     /**
      * 所属工厂

+ 2 - 40
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/domain/ApsCheckParameterDo.java

@@ -1,6 +1,7 @@
 package com.rongwei.bsentity.domain;
 
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.rongwei.rwcommon.base.BaseDo;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -12,7 +13,7 @@ import java.util.Date;
  */
 @Data
 @TableName("aps_check_parameter")
-public class ApsCheckParameterDo implements Serializable {
+public class ApsCheckParameterDo extends BaseDo {
     /**
      * 主键ID
      */
@@ -25,45 +26,6 @@ public class ApsCheckParameterDo implements Serializable {
      */
     private String roption;
 
-    /**
-     * 是否删除Y/N
-     */
-    private String deleted;
-
-    /**
-     * 备注
-     */
-    private String remark;
-
-    /**
-     * 创建时间
-     */
-    private Date createdate;
-
-    /**
-     * 创建用户ID
-     */
-    private String createuserid;
-
-    /**
-     * 修改日期
-     */
-    private Date modifydate;
-
-    /**
-     * 修改用户ID
-     */
-    private String modifyuserid;
-
-    /**
-     * 创建人
-     */
-    private String createusername;
-
-    /**
-     * 修改人
-     */
-    private String modifyusername;
 
     /**
      * 检查项

+ 49 - 0
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/domain/ApsOrderAlloyCompositionDo.java

@@ -0,0 +1,49 @@
+package com.rongwei.bsentity.domain;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.rongwei.rwcommon.base.BaseDo;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * aps_order_alloy_composition
+ * @author 
+ */
+@Data
+@TableName("aps_order_alloy_composition")
+public class ApsOrderAlloyCompositionDo extends BaseDo {
+    /**
+     * 主键
+     */
+    private String id;
+
+    /**
+     * 所属租户ID
+     */
+    private String tenantid;
+
+    /**
+     * 扩展json格式配置
+     */
+    private String roption;
+
+
+    /**
+     * 生产订单ID
+     */
+    private String productionorderid;
+
+    /**
+     * 合金
+     */
+    private String alloy;
+
+    /**
+     * 成分要求
+     */
+    private String compontentrequirement;
+
+    private static final long serialVersionUID = 1L;
+}

+ 2 - 41
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/domain/ApsParameterDo.java

@@ -1,6 +1,7 @@
 package com.rongwei.bsentity.domain;
 
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.rongwei.rwcommon.base.BaseDo;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -12,7 +13,7 @@ import java.util.Date;
  */
 @Data
 @TableName("aps_parameter")
-public class ApsParameterDo implements Serializable {
+public class ApsParameterDo extends BaseDo {
     /**
      * 主键ID
      */
@@ -25,46 +26,6 @@ public class ApsParameterDo implements Serializable {
      */
     private String roption;
 
-    /**
-     * 是否删除Y/N
-     */
-    private String deleted;
-
-    /**
-     * 备注
-     */
-    private String remark;
-
-    /**
-     * 创建时间
-     */
-    private Date createdate;
-
-    /**
-     * 创建用户ID
-     */
-    private String createuserid;
-
-    /**
-     * 修改日期
-     */
-    private Date modifydate;
-
-    /**
-     * 修改用户ID
-     */
-    private String modifyuserid;
-
-    /**
-     * 创建人
-     */
-    private String createusername;
-
-    /**
-     * 修改人
-     */
-    private String modifyusername;
-
     /**
      * 参数
      */

+ 2 - 41
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/domain/ApsProcessOutputProductDo.java

@@ -5,6 +5,7 @@ import java.math.BigDecimal;
 import java.util.Date;
 
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.rongwei.rwcommon.base.BaseDo;
 import lombok.Data;
 
 /**
@@ -13,7 +14,7 @@ import lombok.Data;
  */
 @Data
 @TableName("aps_process_output_product")
-public class ApsProcessOutputProductDo implements Serializable {
+public class ApsProcessOutputProductDo extends BaseDo {
     /**
      * 主键ID
      */
@@ -26,46 +27,6 @@ public class ApsProcessOutputProductDo implements Serializable {
      */
     private String roption;
 
-    /**
-     * 是否删除Y/N
-     */
-    private String deleted;
-
-    /**
-     * 备注
-     */
-    private String remark;
-
-    /**
-     * 创建时间
-     */
-    private Date createdate;
-
-    /**
-     * 创建用户ID
-     */
-    private String createuserid;
-
-    /**
-     * 修改日期
-     */
-    private Date modifydate;
-
-    /**
-     * 修改用户ID
-     */
-    private String modifyuserid;
-
-    /**
-     * 创建人
-     */
-    private String createusername;
-
-    /**
-     * 修改人
-     */
-    private String modifyusername;
-
     /**
      * 所属工厂
      */

+ 0 - 40
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/domain/ApsProductionMergeOrderDo.java

@@ -143,46 +143,6 @@ public class ApsProductionMergeOrderDo extends BaseDo implements Serializable {
      */
     private String roption;
 
-    /**
-     * 是否删除
-     */
-    private String deleted;
-
-    /**
-     * 备注
-     */
-    private String remark;
-
-    /**
-     * 创建时间
-     */
-    private Date createdate;
-
-    /**
-     * 创建用户ID
-     */
-    private String createuserid;
-
-    /**
-     * 修改日期
-     */
-    private Date modifydate;
-
-    /**
-     * 修改用户ID
-     */
-    private String modifyuserid;
-
-    /**
-     * 创建人名称
-     */
-    private String createusername;
-
-    /**
-     * 修改人名称
-     */
-    private String modifyusername;
-
     /**
      * 排程交货日期
      */

+ 2 - 41
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/domain/ApsReportBlankCompentDo.java

@@ -1,6 +1,7 @@
 package com.rongwei.bsentity.domain;
 
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.rongwei.rwcommon.base.BaseDo;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -13,7 +14,7 @@ import java.util.Date;
  */
 @Data
 @TableName("aps_report_blank_compent")
-public class ApsReportBlankCompentDo implements Serializable {
+public class ApsReportBlankCompentDo extends BaseDo {
     /**
      * 主键
      */
@@ -29,46 +30,6 @@ public class ApsReportBlankCompentDo implements Serializable {
      */
     private String roption;
 
-    /**
-     * 是否删除
-     */
-    private String deleted;
-
-    /**
-     * 备注
-     */
-    private String remark;
-
-    /**
-     * 创建时间
-     */
-    private Date createdate;
-
-    /**
-     * 创建用户ID
-     */
-    private String createuserid;
-
-    /**
-     * 修改日期
-     */
-    private Date modifydate;
-
-    /**
-     * 修改用户ID
-     */
-    private String modifyuserid;
-
-    /**
-     * 创建人名称
-     */
-    private String createusername;
-
-    /**
-     * 修改人名称
-     */
-    private String modifyusername;
-
     /**
      * 主表ID
      */

+ 2 - 40
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/domain/ApsReportCheckoutDo.java

@@ -1,6 +1,7 @@
 package com.rongwei.bsentity.domain;
 
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.rongwei.rwcommon.base.BaseDo;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -12,7 +13,7 @@ import java.util.Date;
  */
 @TableName(value = "aps_report_checkout")
 @Data
-public class ApsReportCheckoutDo implements Serializable {
+public class ApsReportCheckoutDo extends BaseDo {
     /**
      * 主键ID
      */
@@ -25,45 +26,6 @@ public class ApsReportCheckoutDo implements Serializable {
      */
     private String roption;
 
-    /**
-     * 是否删除Y/N
-     */
-    private String deleted;
-
-    /**
-     * 报工备注
-     */
-    private String remark;
-
-    /**
-     * 创建时间
-     */
-    private Date createdate;
-
-    /**
-     * 创建用户ID
-     */
-    private String createuserid;
-
-    /**
-     * 修改日期
-     */
-    private Date modifydate;
-
-    /**
-     * 修改用户ID
-     */
-    private String modifyuserid;
-
-    /**
-     * 创建人
-     */
-    private String createusername;
-
-    /**
-     * 修改人
-     */
-    private String modifyusername;
 
     /**
      * 主表id(报告记录表主键)

+ 2 - 41
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/domain/ApsReportMachiningDo.java

@@ -1,6 +1,7 @@
 package com.rongwei.bsentity.domain;
 
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.rongwei.rwcommon.base.BaseDo;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -12,7 +13,7 @@ import java.util.Date;
  */
 @TableName(value = "aps_report_machining")
 @Data
-public class ApsReportMachiningDo implements Serializable {
+public class ApsReportMachiningDo extends BaseDo {
     /**
      * 主键ID
      */
@@ -25,46 +26,6 @@ public class ApsReportMachiningDo implements Serializable {
      */
     private String roption;
 
-    /**
-     * 是否删除Y/N
-     */
-    private String deleted;
-
-    /**
-     * 报工备注
-     */
-    private String remark;
-
-    /**
-     * 创建时间
-     */
-    private Date createdate;
-
-    /**
-     * 创建用户ID
-     */
-    private String createuserid;
-
-    /**
-     * 修改日期
-     */
-    private Date modifydate;
-
-    /**
-     * 修改用户ID
-     */
-    private String modifyuserid;
-
-    /**
-     * 创建人
-     */
-    private String createusername;
-
-    /**
-     * 修改人
-     */
-    private String modifyusername;
-
     /**
      * 主表id(报告记录表主键)
      */

+ 2 - 0
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/vo/ApsBlankOrderVo.java

@@ -10,4 +10,6 @@ public class ApsBlankOrderVo extends ApsBlankOrderDo {
 
     private Date deliverydate;
 
+    private Integer deliverytime;
+
 }

+ 3 - 0
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/vo/CheckAndSaveOrUpdateBlankReq.java

@@ -24,4 +24,7 @@ public class CheckAndSaveOrUpdateBlankReq {
 
     //在制品ID
     private String progressId;
+
+    //是否需要检验坯料计划的工序作业的加工设备
+    private Boolean checkDevice = false;
 }

+ 15 - 0
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/vo/DeleteOrderVo.java

@@ -0,0 +1,15 @@
+package com.rongwei.bsentity.vo;
+
+import lombok.Data;
+
+/**
+ * @author :sc
+ * @since :2024/5/14
+ */
+@Data
+public class DeleteOrderVo {
+    //订单ID
+    private String orderId;
+    //是否需要清除排程备份
+    private Boolean needDelBackup = false;
+}

+ 11 - 0
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/vo/Equipment.java

@@ -5,6 +5,7 @@ import lombok.EqualsAndHashCode;
 import lombok.NoArgsConstructor;
 
 import java.math.BigDecimal;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -76,6 +77,16 @@ public class Equipment{
      */
     private String lastProcessType;
 
+    /**
+     * 当前设备最后工序结束时间
+     */
+    private Date lastProcessEndTime;
+
+    /**
+     * 当前设备最后工序的下机收尾时间
+     */
+    private Integer lastProcessCutfinishmin;
+
     /**
      * 设备运行时间段
      */

+ 9 - 0
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/vo/EquipmentRunTime.java

@@ -33,4 +33,13 @@ public class EquipmentRunTime {
      */
     private String processType;
 
+    /**
+     * 上机准备时间(单位:分钟)
+     */
+    private Integer prepressworkmin;
+    /**
+     * 下机收尾时间(单位:分钟)
+     */
+    private Integer cutfinishmin;
+
 }

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

@@ -161,6 +161,15 @@ public class ProductionProcesses{
      */
     private String conflictDes;
 
+    /**
+     * 上机准备时间(单位:分钟)
+     */
+    private Integer prepressworkmin;
+    /**
+     * 下机收尾时间(单位:分钟)
+     */
+    private Integer cutfinishmin;
+
     public String getEquipmentType() {
         return equipmentType;
     }
@@ -395,4 +404,20 @@ public class ProductionProcesses{
     public void setSoftconflictdes(String softconflictdes) {
         this.softconflictdes = softconflictdes;
     }
+
+    public Integer getPrepressworkmin() {
+        return prepressworkmin;
+    }
+
+    public void setPrepressworkmin(Integer prepressworkmin) {
+        this.prepressworkmin = prepressworkmin;
+    }
+
+    public Integer getCutfinishmin() {
+        return cutfinishmin;
+    }
+
+    public void setCutfinishmin(Integer cutfinishmin) {
+        this.cutfinishmin = cutfinishmin;
+    }
 }

+ 9 - 0
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/vo/ProductionScheduleRetVo.java

@@ -7,6 +7,15 @@ import java.util.List;
 @Data
 public class ProductionScheduleRetVo {
 
+    /**
+     * 返回状态码
+     */
+    private String code;
+    /**
+     * 返回错误信息
+     */
+    private String msg;
+
     private String scoreResult;
 
     /**

+ 9 - 0
cx-aps/cx-aps-server/src/main/java/com/rongwei/bsserver/controller/ApsBlankOrderController.java

@@ -2,6 +2,7 @@ package com.rongwei.bsserver.controller;
 
 
 import com.rongwei.bscommon.sys.service.ApsBlankOrderService;
+import com.rongwei.bsentity.domain.ApsBlankOrderDo;
 import com.rongwei.bsentity.vo.ApsPlanVo;
 import com.rongwei.bsentity.vo.CheckAndSaveOrUpdateBlankReq;
 import com.rongwei.bsentity.vo.OrderLockVo;
@@ -139,5 +140,13 @@ public class ApsBlankOrderController {
             return R.error("校验和保存坯料计划异常:"+e.getMessage());
         }
     }
+
+    /**
+     * 取消坯料计划
+     */
+    @PostMapping("/removeBlankOrder")
+    public R removeBlankOrder(@RequestBody ApsBlankOrderDo req){
+        return apsBlankOrderService.removeBlankOrder(req);
+    }
 }
 

+ 33 - 0
cx-aps/cx-aps-server/src/main/java/com/rongwei/bsserver/controller/ApsProductionOrderController.java

@@ -1,7 +1,9 @@
 package com.rongwei.bsserver.controller;
 
 import com.rongwei.bscommon.sys.service.ApsProductionOrderService;
+import com.rongwei.bsentity.domain.ApsProductionOrderDo;
 import com.rongwei.bsentity.vo.CheckAndSaveOrUpdateOrderReq;
+import com.rongwei.bsentity.vo.DeleteOrderVo;
 import com.rongwei.rwcommon.base.R;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -65,4 +67,35 @@ public class ApsProductionOrderController {
         apsProductionOrderService.orderOuttimeAudit();
     }
 
+    /**
+     * 调整订单时打开编辑页之前的操作
+     */
+    @PostMapping("/changeOrder")
+    public R changeOrder(@RequestBody ApsProductionOrderDo req){
+        return apsProductionOrderService.changeOrder(req);
+    }
+
+    /*
+    辅料申购提醒
+     */
+    @PostMapping("/auxiliaryMaterial")
+    public void auxiliaryMaterial() {
+        apsProductionOrderService.auxiliaryMaterial();
+    }
+
+    /*
+    作业延期提醒
+     */
+    @PostMapping("/processDelay")
+    public void processDelay() {
+        apsProductionOrderService.processDelay();
+    }
+
+    /**
+     * 删除订单评审
+     */
+    @PostMapping("/deleteOrder")
+    public R deleteOrder(@RequestBody DeleteOrderVo req){
+        return apsProductionOrderService.deleteOrder(req);
+    }
 }

+ 84 - 0
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/config/EquDieseloilUseManagementListener.java

@@ -0,0 +1,84 @@
+package com.rongwei.bscommon.sys.config;
+
+import com.alibaba.excel.context.AnalysisContext;
+import com.alibaba.excel.event.AnalysisEventListener;
+import com.rongwei.bscommon.sys.excel.EquDieseloilUseManagementTemplate;
+import com.rongwei.bsentity.domain.EquDieseloilUseManagementDo;
+import com.rongwei.bsentity.domain.EquMaintenanceStandardDo;
+import com.rongwei.bsentity.enums.MaintenanceTypeEnum;
+import com.rongwei.bsentity.enums.PlantEnum;
+import com.rongwei.rwcommon.utils.SecurityUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.h2.engine.User;
+import org.springframework.beans.BeanUtils;
+
+import java.lang.reflect.Field;
+import java.util.*;
+
+/**
+ * @author shangmi
+ * @title ExcelListener
+ * @date 2023/12/7 16:09
+ * @description EquMaintenanceStandard监听器
+ */
+@Slf4j
+public class EquDieseloilUseManagementListener extends AnalysisEventListener<EquDieseloilUseManagementTemplate> {
+
+    private static final String[] NON_SET = {"dieseldate","dieselnametype"};
+
+    private List<EquDieseloilUseManagementDo> dieseloilUseManagementDoList = new ArrayList<>();
+
+    private List<String> errorData = new ArrayList<>();
+
+    @Override
+    public void invoke(EquDieseloilUseManagementTemplate dieseloilUseManagementTemplate, AnalysisContext analysisContext) {
+
+
+        try {
+            log.info("解析到一条数据:{}", dieseloilUseManagementTemplate);
+            for (Field field : dieseloilUseManagementTemplate.getClass().getDeclaredFields()) {
+                field.setAccessible(true);
+                String name = field.getName();
+                if (Objects.isNull(field.get(dieseloilUseManagementTemplate)) && Arrays.asList(NON_SET).contains(name)) {
+                    errorData.add((analysisContext.readRowHolder().getRowIndex() + 1) + "行存在必填数据为空的情况,请填写完整!");
+                }
+            }
+            EquDieseloilUseManagementDo e = migrateDate(dieseloilUseManagementTemplate);
+            dieseloilUseManagementDoList.add(e);
+        } catch (Exception e) {
+            log.error(e.getMessage());
+        }
+    }
+
+
+
+    @Override
+    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
+
+    }
+
+    public List<EquDieseloilUseManagementDo> getDieseloilUseManagementDoList() {
+        return this.dieseloilUseManagementDoList;
+    }
+
+
+    public List<String> getErrorData() {
+        return this.errorData;
+    }
+
+
+    /**
+     * 数据转换
+     *
+     * @param equMaintenanceStandardTemplate
+     * @return {@link EquMaintenanceStandardDo}
+     * @date 2023/12/8 10:14
+     * @author shangmi
+     */
+
+    private EquDieseloilUseManagementDo migrateDate(EquDieseloilUseManagementTemplate equMaintenanceStandardTemplate) {
+        EquDieseloilUseManagementDo equDieseloilUseManagementDo = new EquDieseloilUseManagementDo();
+        BeanUtils.copyProperties(equMaintenanceStandardTemplate, equDieseloilUseManagementDo);
+        return equDieseloilUseManagementDo;
+    }
+}

+ 8 - 0
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/dao/EquDieseloilUseManagementDao.java

@@ -0,0 +1,8 @@
+package com.rongwei.bscommon.sys.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.rongwei.bsentity.domain.EquDieseloilUseManagementDo;
+
+public interface EquDieseloilUseManagementDao extends BaseMapper<EquDieseloilUseManagementDo> {
+
+}

+ 121 - 0
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/excel/EquDieseloilUseManagementTemplate.java

@@ -0,0 +1,121 @@
+package com.rongwei.bscommon.sys.excel;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @author  huangpeng
+ * @create 2024-05-13 13:35
+ * 柴油使用管理 导出模板
+ */
+
+@Data
+public class EquDieseloilUseManagementTemplate {
+
+
+
+	/**
+	 * table name:DIESELNAMETYPE
+	 * table type:varchar(200)
+	 * table comment:柴油名称型号
+	 */
+	@ColumnWidth(20)
+	@ExcelProperty(value = "柴油名称型号",index = 0)
+	private String dieselnametype;
+
+	/**
+	 * table name:DIESELDATE
+	 * table type:datetime
+	 * table comment:日期
+	 */
+	@ExcelProperty(value = "日期",index = 1)
+	private Date dieseldate;
+
+	/**
+	 * table name:CASTROLLINGONE
+	 * table type:decimal(18,6)
+	 * table comment:铸轧一
+	 */
+	@ExcelProperty(value = "铸轧一",index = 2)
+	private BigDecimal castrollingone;
+
+	/**
+	 * table name:CASTROLLINGTWO
+	 * table type:decimal(18,6)
+	 * table comment:铸轧二
+	 */
+	@ExcelProperty(value = "铸轧二",index = 3)
+	private BigDecimal castrollingtwo;
+
+	/**
+	 * table name:CASTROLLINGTHREE
+	 * table type:decimal(18)
+	 * table comment:铸轧三
+	 */
+	@ExcelProperty(value = "铸轧三",index = 4)
+	private BigDecimal castrollingthree;
+
+	/**
+	 * table name:COLDROLLINGONE
+	 * table type:decimal(18)
+	 * table comment:冷轧一
+	 */
+	@ExcelProperty(value = "冷轧一",index = 5)
+	private BigDecimal coldrollingone;
+
+	/**
+	 * table name:COLDROLLINGTWO
+	 * table type:decimal(18)
+	 * table comment:冷轧二
+	 */
+	@ExcelProperty(value = "冷轧二",index = 6)
+	private BigDecimal coldrollingtwo;
+
+	/**
+	 * table name:STASH
+	 * table type:decimal(18)
+	 * table comment:仓库
+	 */
+	@ExcelProperty(value = "仓库",index = 7)
+	private BigDecimal stash;
+
+	/**
+	 * table name:CART
+	 * table type:decimal(18)
+	 * table comment:大车
+	 */
+	@ExcelProperty(value = "大车",index = 8)
+	private BigDecimal cart;
+
+	/**
+	 * table name:MAINTENANCEAERIALWORK
+	 * table type:decimal(18)
+	 * table comment:维修/高空作业
+	 */
+	@ExcelProperty(value = "维修/高空作业",index = 9)
+	private BigDecimal maintenanceaerialwork;
+
+	/**
+	 * table name:ALUMINUMFOILBRANCHFACTORY
+	 * table type:decimal(18)
+	 * table comment:铝箔分厂
+	 */
+	@ExcelProperty(value = "铝箔分厂",index = 10)
+	private BigDecimal aluminumfoilbranchfactory;
+
+	/**
+	 * table name:HOTROLLINGBRANCHFACTORY
+	 * table type:decimal(18)
+	 * table comment:热轧分厂
+	 */
+	@ExcelProperty(value = "热轧分厂",index = 11)
+	private BigDecimal hotrollingbranchfactory;
+
+}

+ 20 - 0
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/EquDieseloilUseManagementService.java

@@ -0,0 +1,20 @@
+package com.rongwei.bscommon.sys.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.rongwei.bsentity.domain.EquDieseloilUseManagementDo;
+import com.rongwei.rwcommon.base.R;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.util.List;
+
+public interface EquDieseloilUseManagementService  extends IService<EquDieseloilUseManagementDo> {
+    /**
+     * 导入 柴油使用管理 excel
+     * @param multipartFile
+     * @return
+     */
+    R uploadDieseloil(MultipartFile multipartFile) throws IOException;
+
+    R checkOneDateAndTenantid(List<EquDieseloilUseManagementDo> equDieseloilUseManagementDos);
+}

+ 145 - 0
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/EquDieseloilUseManagementServiceImpl.java

@@ -0,0 +1,145 @@
+package com.rongwei.bscommon.sys.service.impl;
+import cn.hutool.core.date.DateUtil;
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.rongwei.bscommon.sys.config.EquDieseloilUseManagementListener;
+import com.rongwei.bscommon.sys.dao.EquDieseloilUseManagementDao;
+import com.rongwei.bscommon.sys.excel.EquDieseloilUseManagementTemplate;
+import com.rongwei.bscommon.sys.service.EquDieseloilUseManagementService;
+import com.rongwei.bsentity.domain.EquDieseloilUseManagementDo;
+import com.rongwei.rwcommon.base.R;
+import com.rongwei.rwcommon.utils.SecurityUtil;
+import com.rongwei.safecommon.utils.CXCommonUtils;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+import java.io.IOException;
+import java.util.*;
+import java.util.stream.Collectors;
+
+import static com.rongwei.safecommon.utils.SaveConstans.DatePattern.DATE_PATTERN_YMD;
+
+@Service
+public class EquDieseloilUseManagementServiceImpl extends ServiceImpl<EquDieseloilUseManagementDao, EquDieseloilUseManagementDo> implements EquDieseloilUseManagementService {
+
+    @Autowired
+    private EquDieseloilUseManagementDao equDieseloilUseManagementDao;
+
+
+    @Autowired
+    private EquDieseloilUseManagementService equDieseloilUseManagementService;
+    @Override
+    public R uploadDieseloil(MultipartFile multipartFile) throws IOException {
+        // 使用自定义的DataListener来读取数据
+        EquDieseloilUseManagementListener listener = new EquDieseloilUseManagementListener();
+        // 读取数据
+        EasyExcel.read(multipartFile.getInputStream(), EquDieseloilUseManagementTemplate.class, listener).sheet().headRowNumber(2).doRead();
+        // 解析有误信息
+        List<String> errorData = listener.getErrorData();
+        if (!errorData.isEmpty()) {
+            return R.error(JSON.toJSONString(errorData));
+        }
+        // 解析数据
+        List<EquDieseloilUseManagementDo> dieseloilUseManagementDoList = listener.getDieseloilUseManagementDoList();
+        // 唯一性数据
+        R r = checkOneDateAndTenantid(dieseloilUseManagementDoList);
+        if (r.getCode().equals("500")){
+            return r;
+        }
+        //保存数据
+        if (!dieseloilUseManagementDoList.isEmpty()) {
+            equDieseloilUseManagementService.saveBatch(dieseloilUseManagementDoList);
+        }
+        return R.ok("导入成功");
+    }
+
+    /**
+     * 通过  Tenantid 和  dieseldate 确认唯一值 做新增编辑
+     * @param dieseloilUseManagementDoList
+     */
+    public R checkOneDateAndTenantid(List<EquDieseloilUseManagementDo> dieseloilUseManagementDoList) {
+        String tenantid = "";StringBuilder builder = new StringBuilder();
+        String tokenTenantId = CXCommonUtils.getCurrentUser() != null ? CXCommonUtils.getCurrentUser().getTenantid() : "";
+        if (StringUtils.isNotBlank(tokenTenantId)) {
+            tenantid = tokenTenantId;
+        } else {
+            return R.error("token 失效,请联系管理员");
+        };
+
+        //设置查询条件
+        LambdaQueryWrapper<EquDieseloilUseManagementDo> queryWrapper = setqueryWrapper(dieseloilUseManagementDoList,tenantid);
+        List<EquDieseloilUseManagementDo> oldList = equDieseloilUseManagementDao.selectList(queryWrapper);
+
+        List<String> dieseldates = oldList.stream().map(info ->DateUtil.format(info.getDieseldate(),DATE_PATTERN_YMD) ).collect(Collectors.toList());
+
+        //通过时间判断是否有相同的数据
+        for (EquDieseloilUseManagementDo dieseloilUseManagementDo:dieseloilUseManagementDoList){
+            String dieseldate = DateUtil.format(dieseloilUseManagementDo.getDieseldate(), DATE_PATTERN_YMD);
+            if (dieseldates.contains(dieseldate)){
+                builder.append("日期"+dieseldate+"、");
+                continue;
+            };
+            Date date =new Date();
+            dieseloilUseManagementDo.setId(SecurityUtil.getUUID());
+            dieseloilUseManagementDo.setTenantid(tenantid);
+            dieseloilUseManagementDo.setCreatedate(date);
+            dieseloilUseManagementDo.setCreateuserid(CXCommonUtils.getCurrentUser().getId());
+            dieseloilUseManagementDo.setCreateusername(CXCommonUtils.getCurrentUser().getName());
+            dieseloilUseManagementDo.setModifydate(date);
+            dieseloilUseManagementDo.setModifyuserid(CXCommonUtils.getCurrentUser().getId());
+            dieseloilUseManagementDo.setModifyusername(CXCommonUtils.getCurrentUser().getName());
+        };
+
+        //数据拼接错误日志
+        if (StringUtils.isBlank(builder.toString())){
+            return R.ok();
+        }else {
+            builder.append("的使用记录已存在,不可重复导入");
+            String errMsg =builder.toString().replace("、的", "的");
+            return R.error(errMsg);
+        }
+
+    }
+
+    /**
+     * 设置查询条件,筛选出传入参数的最大,最小时间去数据库查询,避免全量查询
+     * @param dieseloilUseManagementDoList
+     * @param tenantid
+     * @return
+     */
+    private LambdaQueryWrapper<EquDieseloilUseManagementDo> setqueryWrapper(List<EquDieseloilUseManagementDo> dieseloilUseManagementDoList, String tenantid) {
+        //默认升序,那个最小最大时间
+        Collections.sort(dieseloilUseManagementDoList, Comparator.comparing(EquDieseloilUseManagementDo::getDieseldate));
+        Date minDate = dieseloilUseManagementDoList.get(0).getDieseldate();
+        Date maxDate = dieseloilUseManagementDoList.get(dieseloilUseManagementDoList.size()-1).getDieseldate();
+        //对时间的设置时分秒
+        Calendar instanceMin = Calendar.getInstance();
+        instanceMin.setTime(minDate);
+        // 设置时、分、秒
+        instanceMin.set(Calendar.HOUR_OF_DAY, 0); // 24小时制
+        instanceMin.set(Calendar.MINUTE, 0);
+        instanceMin.set(Calendar.SECOND, 0);
+        Date timemin = instanceMin.getTime();
+
+        //对时间的设置时分秒
+        Calendar instanceMax = Calendar.getInstance();
+        instanceMax.setTime(maxDate);
+        // 设置时、分、秒
+        instanceMax.set(Calendar.HOUR_OF_DAY, 23); // 24小时制
+        instanceMax.set(Calendar.MINUTE, 59);
+        instanceMax.set(Calendar.SECOND, 59);
+        Date timemax = instanceMax.getTime();
+
+        //系统中已存在的相同的 tenantid 数据
+        LambdaQueryWrapper<EquDieseloilUseManagementDo> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(EquDieseloilUseManagementDo::getTenantid,tenantid)
+                .eq(EquDieseloilUseManagementDo::getDeleted,"0")
+                .ge(EquDieseloilUseManagementDo::getDieseldate,timemin)
+                .le(EquDieseloilUseManagementDo::getDieseldate,timemax);
+        return queryWrapper;
+    }
+
+}

+ 3 - 1
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/MaintenanceServiceImpl.java

@@ -300,6 +300,8 @@ public class MaintenanceServiceImpl implements MaintenanceService {
                     .setCreatedate(date)
                     .setModifydate(date)
                     .setCreateuserid(currentUser.getId())
+                    .setCreateusername(currentUser.getName())
+                    .setModifyusername(currentUser.getName())
                     .setModifyuserid(currentUser.getId());
         }
         maintenanceStandardService.saveBatch(newMaintenanceStandardList, 200);
@@ -378,7 +380,7 @@ public class MaintenanceServiceImpl implements MaintenanceService {
 
     public void jointErrorData(List<EquMaintenanceStandardDo> maintenanceStandardList, List<String> errorData) {
         maintenanceStandardList.forEach(info -> {
-            errorData.add(PlantEnum.nameOf(info.getTenantid()) + ",已存在了" + EquipmentTypeEnum.typeOf(Integer.valueOf(info.getEquipmenttype())) + "-" + MaintenanceTypeEnum.typeOf(info.getMaintenancetype()) + "-" + info.getMaintenancesite() + "部位" + info.getMaintenancecontext() + "的保养标准内容,不可重复导入,请检查");
+            errorData.add(PlantEnum.nameOf(info.getTenantid()) + ",已存在了" + "-" + MaintenanceTypeEnum.typeOf(info.getMaintenancetype()) + "-" + info.getMaintenancesite() + "部位" + info.getMaintenancecontext() + "的保养标准内容,不可重复导入,请检查");
         });
 
     }

+ 190 - 0
cx-equipment/cx-equipment-entity/src/main/java/com/rongwei/bsentity/domain/EquDieseloilUseManagementDo.java

@@ -0,0 +1,190 @@
+package com.rongwei.bsentity.domain;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.NoArgsConstructor;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @author  huangpeng
+ * @create 2024-05-13 13:35 
+ */
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@TableName("equ_dieseloil_use_management")
+public class EquDieseloilUseManagementDo {
+
+	/**
+	 * table name:ID
+	 * table type:varchar(36)
+	 * table comment:主键ID
+	 */
+	private String id;
+
+	/**
+	 * table name:TENANTID
+	 * table type:varchar(36)
+	 * table comment:租户ID
+	 */
+	private String tenantid;
+
+	/**
+	 * table name:ROPTION
+	 * table type:text
+	 * table comment:扩展json格式配置
+	 */
+	private String roption;
+
+	/**
+	 * table name:DELETED
+	 * table type:varchar(1)
+	 * table comment:是否删除Y/N
+	 */
+	private String deleted;
+
+	/**
+	 * table name:REMARK
+	 * table type:varchar(500)
+	 * table comment:备注
+	 */
+	private String remark;
+
+	/**
+	 * table name:CREATEDATE
+	 * table type:datetime
+	 * table comment:创建时间
+	 */
+	private Date createdate;
+
+	/**
+	 * table name:CREATEUSERID
+	 * table type:varchar(36)
+	 * table comment:创建用户ID
+	 */
+	private String createuserid;
+
+	/**
+	 * table name:MODIFYDATE
+	 * table type:datetime
+	 * table comment:修改日期
+	 */
+	private Date modifydate;
+
+	/**
+	 * table name:MODIFYUSERID
+	 * table type:varchar(36)
+	 * table comment:修改用户ID
+	 */
+	private String modifyuserid;
+
+	/**
+	 * table name:CREATEUSERNAME
+	 * table type:varchar(20)
+	 * table comment:创建人
+	 */
+	private String createusername;
+
+	/**
+	 * table name:MODIFYUSERNAME
+	 * table type:varchar(20)
+	 * table comment:修改人
+	 */
+	private String modifyusername;
+
+	/**
+	 * table name:BELONGFACTORY
+	 * table type:varchar(36)
+	 * table comment:所属工厂名称
+	 */
+	private String belongfactory;
+
+	/**
+	 * table name:DIESELNAMETYPE
+	 * table type:varchar(200)
+	 * table comment:柴油名称型号
+	 */
+	private String dieselnametype;
+
+	/**
+	 * table name:DIESELDATE
+	 * table type:datetime
+	 * table comment:日期
+	 */
+	private Date dieseldate;
+
+	/**
+	 * table name:CASTROLLINGONE
+	 * table type:decimal(18,6)
+	 * table comment:铸轧一
+	 */
+	private BigDecimal castrollingone;
+
+	/**
+	 * table name:CASTROLLINGTWO
+	 * table type:decimal(18,6)
+	 * table comment:铸轧二
+	 */
+	private BigDecimal castrollingtwo;
+
+	/**
+	 * table name:CASTROLLINGTHREE
+	 * table type:decimal(18)
+	 * table comment:铸轧三
+	 */
+	private BigDecimal castrollingthree;
+
+	/**
+	 * table name:COLDROLLINGONE
+	 * table type:decimal(18)
+	 * table comment:冷轧一
+	 */
+	private BigDecimal coldrollingone;
+
+	/**
+	 * table name:COLDROLLINGTWO
+	 * table type:decimal(18)
+	 * table comment:冷轧二
+	 */
+	private BigDecimal coldrollingtwo;
+
+	/**
+	 * table name:STASH
+	 * table type:decimal(18)
+	 * table comment:仓库
+	 */
+	private BigDecimal stash;
+
+	/**
+	 * table name:CART
+	 * table type:decimal(18)
+	 * table comment:大车
+	 */
+	private BigDecimal cart;
+
+	/**
+	 * table name:MAINTENANCEAERIALWORK
+	 * table type:decimal(18)
+	 * table comment:维修/高空作业
+	 */
+	private BigDecimal maintenanceaerialwork;
+
+	/**
+	 * table name:ALUMINUMFOILBRANCHFACTORY
+	 * table type:decimal(18)
+	 * table comment:铝箔分厂
+	 */
+	private BigDecimal aluminumfoilbranchfactory;
+
+	/**
+	 * table name:HOTROLLINGBRANCHFACTORY
+	 * table type:decimal(18)
+	 * table comment:热轧分厂
+	 */
+	private BigDecimal hotrollingbranchfactory;
+
+}

+ 65 - 0
cx-equipment/cx-equipment-server/src/main/java/com/rongwei/bsserver/sys/controller/EquDieseloilUseManagementController.java

@@ -0,0 +1,65 @@
+package com.rongwei.bsserver.sys.controller;
+
+import com.rongwei.bscommon.sys.service.EquDieseloilUseManagementService;
+import com.rongwei.bscommon.sys.service.MaintenanceService;
+import com.rongwei.bscommon.sys.utils.ExceptionUtils;
+import com.rongwei.bsentity.domain.EquDieseloilUseManagementDo;
+import com.rongwei.bsentity.dto.EquipmentDisposeDTO;
+import com.rongwei.rwcommon.base.R;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+/**
+ * 柴油使用管理
+ */
+@RestController
+@RequestMapping("/equDieseloilUseManagement")
+public class EquDieseloilUseManagementController {
+
+    private final static Logger log = LoggerFactory.getLogger(EquDieseloilUseManagementController.class);
+
+    @Autowired
+    private EquDieseloilUseManagementService equDieseloilUseManagementService;
+
+
+    /**
+     * excel 上传
+     * @param multipartFile
+     * @return
+     */
+    @PostMapping("importDieseloil")
+    public R uploadDieseloil(@RequestParam("file") MultipartFile multipartFile){
+        try {
+            log.info("进入接口:/equDieseloilUseManagement/importDieseloil,入参:{}", multipartFile);
+            return equDieseloilUseManagementService.uploadDieseloil(multipartFile);
+            // return null;
+        }catch (Exception e){
+            ExceptionUtils.printExceptionDetail(e,"导入失败,请检查后再导入:");
+            return R.error(e.getMessage());
+        }
+    }
+
+    /**
+     * 校验重复值
+     * @param equDieseloilUseManagementDos
+     * @return
+     */
+    @PostMapping("/checkOneDateAndTenantid")
+    public R checkOneDateAndTenantid(@RequestBody List<EquDieseloilUseManagementDo> equDieseloilUseManagementDos){
+        try {
+            log.info("进入接口:/equDieseloilUseManagement/checkOneDateAndTenantid,参数为:{}",equDieseloilUseManagementDos);
+            return equDieseloilUseManagementService.checkOneDateAndTenantid(equDieseloilUseManagementDos);
+        }catch (Exception e){
+            ExceptionUtils.printExceptionDetail(e,"校验失败,异常为:");
+            log.info(e.getMessage());
+            return R.error(e.getMessage());
+        }
+
+    }
+}
+

+ 11 - 3
cx-safe-check/cx-save-check-common/src/main/java/com/rongwei/sfcommon/sys/service/impl/CheckTemplateServiceImpl.java

@@ -312,7 +312,7 @@ public class CheckTemplateServiceImpl extends ServiceImpl<CheckTemplateDao, Chec
         }
         List<PointCheckDo> pointChecks = new ArrayList<>();
         List<PointCheckItemDo> pointCheckItems = new ArrayList<>();
-        Map<PointCheckDo,List<String>> notifyType = new HashMap<>();
+        Map<PointCheckNewsVo,List<String>> notifyType = new HashMap<>();
         // 每班几次就生成几个任务
         for(List<CheckTemplateItemsDo> checkItems:items){
             // 点检名称 班次+模板名称+当前日期
@@ -335,6 +335,7 @@ public class CheckTemplateServiceImpl extends ServiceImpl<CheckTemplateDao, Chec
 
                     // 点检生成
                     PointCheckDo pointCheckDo = new PointCheckDo();
+                    PointCheckNewsVo pointCheckVo = new PointCheckNewsVo();
                     pointCheckDo.setId(SecurityUtil.getUUID());
                     pointCheckDo.setPointcheckname(poName);
                     pointCheckDo.setPointcheckcode(pointcheckcode);
@@ -351,6 +352,10 @@ public class CheckTemplateServiceImpl extends ServiceImpl<CheckTemplateDao, Chec
                     pointCheckDo.setTenantid(checkTemplate.getTenantid());
                     pointCheckDo.setSource("1");
                     pointCheckDo.setTemplatetype(templatetype);
+                    BeanUtil.copyProperties(pointCheckDo,pointCheckVo);
+                    //添加设备名称和设备编号
+                    pointCheckVo.setCheckitemname(checkItemsdo.getCheckitemname());
+                    pointCheckVo.setCheckitemcode(checkItemsdo.getCheckitemcode());
                     //设备负责人
                     List<CheckItemsDutyuserDo> checkItemsDutyusers =checkItemsDutyuserService.list(new LambdaQueryWrapper<CheckItemsDutyuserDo>()
                             .eq(BaseDo::getDeleted,"0")
@@ -359,7 +364,7 @@ public class CheckTemplateServiceImpl extends ServiceImpl<CheckTemplateDao, Chec
 
                     // 组织需要发送德消息
                     if (!checkItemsDutyusers.isEmpty()){
-                        notifyType.put(pointCheckDo,checkItemsDutyusers.stream().map(CheckItemsDutyuserDo::getDutyuserid).distinct().collect(Collectors.toList()));
+                        notifyType.put(pointCheckVo,checkItemsDutyusers.stream().map(CheckItemsDutyuserDo::getDutyuserid).distinct().collect(Collectors.toList()));
                     }
                     //设置点检人
 //                    String pcids = null;
@@ -449,8 +454,11 @@ public class CheckTemplateServiceImpl extends ServiceImpl<CheckTemplateDao, Chec
             notifyType.forEach((k,v)-> {
                 String pointcheckname = k.getPointcheckname();
                 String templatetype = k.getTemplatetype();
+                //发送消息提醒添加设备名称和设备编号拼接
+                String checkitemname = k.getCheckitemname();
+                String checkitemcode = k.getCheckitemcode();
                 SysDictDo sysDictDo = dictsByType.stream().filter(info -> info.getValue().equals(templatetype)).findFirst().orElse(null);
-                CXCommonUtils.sendNotify(INSPECTION_TITLE, String.format(INSPECTION_CONTENT, pointcheckname, sysDictDo == null ? "" : sysDictDo.getName()),
+                CXCommonUtils.sendNotify(INSPECTION_TITLE, String.format(INSPECTION_CONTENT, pointcheckname,checkitemname,checkitemcode, sysDictDo == null ? "" : sysDictDo.getName()),
                         null, v, k.getId(), INSPECTION + "-" + shift, false);
             });
         }

+ 31 - 0
cx-safe-check/cx-save-check-entity/src/main/java/com/rongwe/scentity/domian/PointCheckNewsVo.java

@@ -0,0 +1,31 @@
+package com.rongwe.scentity.domian;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.rongwei.rwcommon.base.BaseDo;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 点检任务表
+ * 
+ * @author chglee
+ * @email 1992lcg@163.com
+ * @date 2020-07-17 09:33:23
+ */
+@Data
+public class PointCheckNewsVo extends PointCheckDo implements Serializable {
+	/**
+	 * 检查项名称
+	 */
+	private String checkitemname;
+
+	/**
+	 * 检查项编号
+	 */
+	private String checkitemcode;
+}