Browse Source

Merge remote-tracking branch 'origin/master'

xiahan 1 năm trước cách đây
mục cha
commit
5d6443c002

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

@@ -44,7 +44,7 @@ public interface ApsBlankOrderDao extends BaseMapper<ApsBlankOrderDo> {
     List<ApsBlankOrderVo> getNotLockOrders(@Param("tenantId") String tenantId);
 
     @Select("select DISTINCT a.*,c.DELIVERYDATE,c.DELIVERYTIME from aps_blank_order a LEFT JOIN aps_process_operation b on a.ID=b.BLANKID LEFT JOIN aps_production_order c on a.PRODUCTIONORDERID=c.ID\n" +
-            "where a.DELETED='0' and b.DELETED='0' and c.DELETED='0' and (b.LOCKMARK='n' OR b.LOCKMARK is null) and c.TENANTID = #{tenantId} and a.ID not in (${hasIds})")
+            "where a.DELETED='0' and b.DELETED='0' and c.DELETED='0' and (b.LOCKMARK='n' OR b.LOCKMARK is null) and c.TENANTID = #{tenantId} and a.ID not in (${hasIds}) and a.SCHEDULINGSTATUS != '10'")
     List<ApsBlankOrderVo> getOrdersHasNotLockProcess(@Param("hasIds") String hasIds,@Param("tenantId") String tenantId);
 
     @Select("select * FROM (\n" +

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

@@ -46,6 +46,9 @@ public interface ApsReportRecordsDao extends BaseMapper<ApsReportRecordsDo> {
 
     @Select("select aci.EQUIPMENTCODE AS 'deviceCode',so.ROPTION AS 'organizationCode',aci.WAITREPORTID AS 'waitReportId',aci.OWNEDFACTORY AS 'ownedFactory' from asp_check_items aci LEFT JOIN sys_organization so ON aci.USEDEPTID = so.ID AND so.DELETED = 0 where aci.ID = #{processdeviceid} limit 1")
     OrganizationCodeAndDeviceCodeVo selectOrganizationCodeAndDeviceCode(@Param("processdeviceid") String processdeviceid);
+
+    @Select("select arr.ID from aps_process_operation apo LEFT JOIN aps_report_records arr ON arr.DELETED = 0 AND arr.PROCESSOPERATIONID = apo.ID LEFT JOIN aps_report_output aro ON aro.DELETED = 0 AND aro.MAINID = arr.ID where apo.DELETED = 0 AND aro.OUTPUTNUMBER = #{inputBatchNumber} ORDER BY arr.CREATEDATE desc limit 1")
+    String selectLastReoprtRecordByBatchNumber(@Param("inputBatchNumber") String inputBatchNumber);
 }
 
 

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

@@ -100,6 +100,8 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
     private ApsProcessOperationProcessEquService apsProcessOperationProcessEquService;
     @Autowired
     private RedissonClient redissonClient;
+    @Autowired
+    private ApsEquipmentCalendarService apsEquipmentCalendarService;
 
 
     @Override
@@ -713,10 +715,14 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
         List<Equipment> equipmentList = new ArrayList<>();
         // 排程计划工序任务集合
         List<ProductionProcesses> processesList = new ArrayList<>();
+        // 坯料计划ID和所属工序作业ID对应关系
+        Map<String,List<String>> blankProcessIds = new HashMap<>();
         // 待合并生产的订单工序
         List<ApsProcessOperationVo> processOperationMs = new ArrayList<>();
         if (apsBlankOrders != null && apsBlankOrders.size() > 0) {
             for (ApsBlankOrderVo apsBlankOrderVo : apsBlankOrders) {
+                // 父子ID对应关系处理
+                List<String> processIdss = new ArrayList<>();
                 // 坯料计划订单
                 ProduceOrder produceOrder = new ProduceOrder(apsBlankOrderVo.getId(), apsBlankOrderVo.getMaterialname(), DateUtil.offsetHour(apsBlankOrderVo.getDeliverydate(), -apsBlankOrderVo.getDeliverytime()));
                 // 获取所有订单工序
@@ -726,6 +732,7 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
                 Map<String,ProductionProcesses> lockHbPp = new HashMap<>();
                 // 转换工序模型数据
                 for (ApsProcessOperationDo operationDo : operationDos) {
+                    processIdss.add(operationDo.getId());
                     ProductionProcesses processes = new ProductionProcesses();
                     // 工序所属订单
                     processes.setProduceOrder(Arrays.asList(new ProduceOrder[]{produceOrder}));
@@ -819,6 +826,19 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
                                             }
                                             equipmentRunTimes.add(er);
                                         }
+                                        // 设备日历不可用时间段
+                                        List<ApsEquipmentCalendarDo> equipmentCalendarDos = apsEquipmentCalendarService.list(
+                                                new LambdaQueryWrapper<ApsEquipmentCalendarDo>().ge(ApsEquipmentCalendarDo::getSdstarttime, productionScheduleVo.getApsPlanStartDate())
+                                                        .eq(ApsEquipmentCalendarDo::getProcessdeviceid,equipment.getBsEquipmentId()));
+                                        if(equipmentCalendarDos != null && equipmentCalendarDos.size()>0){
+                                            for (ApsEquipmentCalendarDo equipmentCalendarDo : equipmentCalendarDos) {
+                                                EquipmentRunTime er = new EquipmentRunTime();
+                                                er.setStartRunTime(equipmentCalendarDo.getSdstarttime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
+                                                er.setEndRunTime(equipmentCalendarDo.getSdendtime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
+                                                equipmentRunTimes.add(er);
+                                            }
+                                        }
+
                                         equipment.setEquipmentRunTimes(equipmentRunTimes);
                                     }
                                     equipmentList.add(equipment);
@@ -968,6 +988,8 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
                         processesList.add(processes);
                     }
                 }
+
+                blankProcessIds.put(apsBlankOrderVo.getId(),processIdss);
             }
         }
         // 合并生产工序
@@ -982,6 +1004,7 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
         }*/
         productionScheduleVo.setProcesses(processesList);
         productionScheduleVo.setEquipmentList(equipmentList);
+        productionScheduleVo.setBlankProcessIds(blankProcessIds);
         return productionScheduleVo;
     }
 
@@ -1162,10 +1185,10 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
             // 加工设备
             String eq = processes.getOptionalEquipments().get(0);
             AspCheckItemsDo aspCheckItem = aspCheckItemMap.get(eq);
-
-            // 工序类型一致,合金和合金状态要一致
+            // 工序类型一致,合金和合金状态要一致,并且同一坯料计划两个不同合并工序不能合并
+            List<String> blankids = processes.getProduceOrder().stream().map(v -> v.getId()).collect(Collectors.toList());
             if (processes.getProcessType().equals(processOperationM.getProcess()) && processes.getAluminumCoils().get(0).getVolumeMetal().equals(processOperationM.getMetal())
-                    && processes.getAluminumCoils().get(0).getVolumeMetalstate().equals(processOperationM.getMetalstate())) {
+                    && processes.getAluminumCoils().get(0).getVolumeMetalstate().equals(processOperationM.getMetalstate()) && !blankids.contains(processOperationM.getBlankid())) {
                 // 宽度不超过50mm,厚度不超过0.05mm,重量不超过1吨
                 boolean bol = true;
                 BigDecimal totalWidth = null;

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

@@ -63,6 +63,10 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
     private ApsReportBlankCompentService apsReportBlankCompentService;
     @Resource
     private CXAdminFeginClient cxAdminFeginClient;
+    @Autowired
+    private ApsCraftStepService apsCraftStepService;
+    @Autowired
+    private ApsCraftEquService apsCraftEquService;
 
     @Override
     @Transactional
@@ -192,6 +196,20 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
         SysUserVo currentUser = CXCommonUtils.getCurrentUser();
         String tenantId = currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1];
 
+        //查询此工序对应工艺步骤中,对应设备的设备参数
+        String equparames = "";
+        //查询工序步骤
+        String processcode = apsProcessOperationDo.getProcesscode();
+        ApsCraftStepDo craftStepDo = apsCraftStepService.getOne(new QueryWrapper<ApsCraftStepDo>().lambda().eq(ApsCraftStepDo::getProcesscode, processcode));
+        if (ObjectUtil.isNotEmpty(craftStepDo)) {
+            //查询设备参数子表
+            ApsCraftEquDo apsCraftEquDo = apsCraftEquService.getOne(new QueryWrapper<ApsCraftEquDo>().lambda().eq(ApsCraftEquDo::getMainid, craftStepDo.getId()).eq(ApsCraftEquDo::getResourceid, apsProcessOperationProcessEquDo.getProcessdeviceid()));
+            if (ObjectUtil.isNotEmpty(apsCraftEquDo)) {
+                equparames = apsCraftEquDo.getEquparames();
+            }
+        }
+
+
         //新增主表报工记录信息
         ApsReportRecordsDo apsReportRecordsDo = new ApsReportRecordsDo();
         apsReportRecordsDo.setId(SecurityUtil.getUUID());
@@ -214,6 +232,8 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
         //报工状态
         apsReportRecordsDo.setReportworkstatus("已开工");
         apsReportRecordsDo.setCheckstatus("待检验");
+        //设备参数
+        apsReportRecordsDo.setDeviceparm(equparames);
 
         //保存主表
         this.save(apsReportRecordsDo);
@@ -304,46 +324,68 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
 
         }
         //=============坯料成分子表信息=============
-        //工序作业的合金
-        String metal = apsProcessOperationDo.getMetal();
-        //订单的客户ID
-        String customid = apsProductionOrderDo.getCustomid();
-        String alloyId = "";
-        //查询合金对应的所有主表信息
-        List<ApsAlloyDo> apsAlloyDoList = apsAlloyService.list(new QueryWrapper<ApsAlloyDo>().lambda().eq(ApsAlloyDo::getAlloy, metal));
-        if (ObjectUtil.isNotEmpty(apsAlloyDoList)) {
-            //查询客户标准
-            List<ApsAlloyDo> collect = apsAlloyDoList.stream().filter(item -> ObjectUtil.isNotEmpty(item.getCustomerid()) && item.getCustomerid().contains(customid)).collect(Collectors.toList());
-            if (ObjectUtil.isNotEmpty(collect)) {
-                alloyId = collect.get(0).getId();
-            } else {//查询国标
-                List<ApsAlloyDo> collect1 = apsAlloyDoList.stream().filter(item -> ObjectUtil.isEmpty(item.getCustomerid())).collect(Collectors.toList());
-                if (ObjectUtil.isNotEmpty(collect1)) {
-                    alloyId = collect1.get(0).getId();
+        //工序作业的是否坯料工序=是 时,根据客户合金成分设置自动生成
+        if (apsProcessOperationDo.getIfblankprocess().equals("是")) {
+            //工序作业的合金
+            String metal = apsProcessOperationDo.getMetal();
+            //订单的客户ID
+            String customid = apsProductionOrderDo.getCustomid();
+            String alloyId = "";
+            //查询合金对应的所有主表信息
+            List<ApsAlloyDo> apsAlloyDoList = apsAlloyService.list(new QueryWrapper<ApsAlloyDo>().lambda().eq(ApsAlloyDo::getAlloy, metal));
+            if (ObjectUtil.isNotEmpty(apsAlloyDoList)) {
+                //查询客户标准
+                List<ApsAlloyDo> collect = apsAlloyDoList.stream().filter(item -> ObjectUtil.isNotEmpty(item.getCustomerid()) && item.getCustomerid().contains(customid)).collect(Collectors.toList());
+                if (ObjectUtil.isNotEmpty(collect)) {
+                    alloyId = collect.get(0).getId();
+                } else {//查询国标
+                    List<ApsAlloyDo> collect1 = apsAlloyDoList.stream().filter(item -> ObjectUtil.isEmpty(item.getCustomerid())).collect(Collectors.toList());
+                    if (ObjectUtil.isNotEmpty(collect1)) {
+                        alloyId = collect1.get(0).getId();
+                    }
                 }
             }
-        }
-        //查询合金成分要求
-        if (ObjectUtil.isNotEmpty(alloyId)) {
-            List<ApsAlloyCompositionDo> apsAlloyCompositionDoList = apsAlloyCompositionService.list(new QueryWrapper<ApsAlloyCompositionDo>().lambda().eq(ApsAlloyCompositionDo::getAlloyid, alloyId));
-
-            if (ObjectUtil.isNotEmpty(apsAlloyCompositionDoList)) {
-                List<ApsReportBlankCompentDo> needInsertApsReportBlankCompentList = new LinkedList<>();
-                for (ApsAlloyCompositionDo apsAlloyCompositionDo : apsAlloyCompositionDoList) {
-                    ApsReportBlankCompentDo apsReportBlankCompentDo = new ApsReportBlankCompentDo();
-                    apsReportBlankCompentDo.setId(SecurityUtil.getUUID());
-                    apsReportBlankCompentDo.setTenantid(tenantId);
-                    apsReportBlankCompentDo.setMainid(apsReportRecordsDo.getId());
-                    apsReportBlankCompentDo.setCompent(apsAlloyCompositionDo.getIngredient());
-                    apsReportBlankCompentDo.setStartproportion(apsAlloyCompositionDo.getLeftproportion());
-                    apsReportBlankCompentDo.setEndproportion(apsAlloyCompositionDo.getRightproportion());
-                    needInsertApsReportBlankCompentList.add(apsReportBlankCompentDo);
-                }
-                if (ObjectUtil.isNotEmpty(needInsertApsReportBlankCompentList)) {
-                    apsReportBlankCompentService.saveBatch(needInsertApsReportBlankCompentList);
-                }
+            //查询合金成分要求
+            if (ObjectUtil.isNotEmpty(alloyId)) {
+                List<ApsAlloyCompositionDo> apsAlloyCompositionDoList = apsAlloyCompositionService.list(new QueryWrapper<ApsAlloyCompositionDo>().lambda().eq(ApsAlloyCompositionDo::getAlloyid, alloyId));
+
+                if (ObjectUtil.isNotEmpty(apsAlloyCompositionDoList)) {
+                    List<ApsReportBlankCompentDo> needInsertApsReportBlankCompentList = new LinkedList<>();
+                    for (ApsAlloyCompositionDo apsAlloyCompositionDo : apsAlloyCompositionDoList) {
+                        ApsReportBlankCompentDo apsReportBlankCompentDo = new ApsReportBlankCompentDo();
+                        apsReportBlankCompentDo.setId(SecurityUtil.getUUID());
+                        apsReportBlankCompentDo.setTenantid(tenantId);
+                        apsReportBlankCompentDo.setMainid(apsReportRecordsDo.getId());
+                        apsReportBlankCompentDo.setCompent(apsAlloyCompositionDo.getIngredient());
+                        apsReportBlankCompentDo.setStartproportion(apsAlloyCompositionDo.getLeftproportion());
+                        apsReportBlankCompentDo.setEndproportion(apsAlloyCompositionDo.getRightproportion());
+                        needInsertApsReportBlankCompentList.add(apsReportBlankCompentDo);
+                    }
+                    if (ObjectUtil.isNotEmpty(needInsertApsReportBlankCompentList)) {
+                        apsReportBlankCompentService.saveBatch(needInsertApsReportBlankCompentList);
+                    }
 
+                }
+            }
+        } else {//不是坯料工序,根据输入物料批次号,查询来源报工的坯料成分,copy一份
+            String inputBatchNumber = req.getInputBatchNumber();
+            //查询上一个的报工ID
+            String lastReportRecordId = this.baseMapper.selectLastReoprtRecordByBatchNumber(inputBatchNumber);
+            //查询上一个报工的坯料成分
+            List<ApsReportBlankCompentDo> apsReportBlankCompentDoList = apsReportBlankCompentService.list(new QueryWrapper<ApsReportBlankCompentDo>().lambda().eq(ApsReportBlankCompentDo::getMainid, lastReportRecordId));
+            //复制新增
+            List<ApsReportBlankCompentDo> needAddList = new LinkedList<>();
+            for (ApsReportBlankCompentDo apsReportBlankCompentDo : apsReportBlankCompentDoList) {
+                ApsReportBlankCompentDo needAdd = new ApsReportBlankCompentDo();
+                needAdd.setId(SecurityUtil.getUUID());
+                needAdd.setMainid(apsReportRecordsDo.getId());
+                needAdd.setCompent(apsReportBlankCompentDo.getCompent());
+                needAdd.setStartproportion(apsReportBlankCompentDo.getStartproportion());
+                needAdd.setEndproportion(apsReportBlankCompentDo.getEndproportion());
+                needAdd.setActualproportion(apsReportBlankCompentDo.getActualproportion());
+                needAddList.add(needAdd);
             }
+            apsReportBlankCompentService.saveBatch(needAddList);
         }
         //更新生产状态
         CommonUpdateProductionStatusReq req3 = new CommonUpdateProductionStatusReq();

+ 4 - 0
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/vo/ProductionScheduleVo.java

@@ -44,4 +44,8 @@ public class ProductionScheduleVo {
      */
     private Map<String,Integer> roamTime;
 
+    private Integer environmentMode;
+
+    private Map<String,List<String>> blankProcessIds;
+
 }

+ 20 - 0
cx-aps/cx-aps-server/src/main/java/com/rongwei/bsserver/controller/ApsEquipmentCalendarController.java

@@ -0,0 +1,20 @@
+package com.rongwei.bsserver.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 设备日历表 前端控制器
+ * </p>
+ *
+ * @author fpy
+ * @since 2024-05-22
+ */
+@RestController
+@RequestMapping("/apsEquipmentCalendar")
+public class ApsEquipmentCalendarController {
+
+}
+