Przeglądaj źródła

更新后台业务处理代码

oyq28 2 lat temu
rodzic
commit
692411c1b6
15 zmienionych plików z 139 dodań i 50 usunięć
  1. 18 0
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/edgeLibrary/service/StorgeService.java
  2. 1 2
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/edgeLibrary/service/impl/StockInfoServiceImpl.java
  3. 77 0
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/edgeLibrary/service/impl/StorgeServiceImpl.java
  4. 3 4
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/mq/ConsumerHandler.java
  5. 2 36
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/mq/TaskWorkNode.java
  6. 1 1
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/MachineNodeServiceImpl.java
  7. 1 1
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/ProductionresourceBizServiceImpl.java
  8. 1 0
      imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/productionReadyCenter/BomProcedureVersionMapper.xml
  9. 1 1
      imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/productionReadyCenter/TrayMapper.xml
  10. 16 3
      imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/externalApi/SynProductionStatus.java
  11. 3 0
      imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionReadyCenter/dto/TrayPageDTO.java
  12. 3 0
      imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionReadyCenter/dto/TraySaveDTO.java
  13. 3 0
      imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionReadyCenter/dto/TrayUpdateDTO.java
  14. 1 1
      imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionReadyCenter/entity/BomProcedureVersion.java
  15. 8 1
      imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionReadyCenter/entity/Tray.java

+ 18 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/edgeLibrary/service/StorgeService.java

@@ -101,4 +101,22 @@ public interface StorgeService extends SuperCacheService<Storge> {
      */
     int getstorgeByZone(String zoneId);
 
+    /**
+     * 获取立库空闲库位
+     * @return
+     */
+    long getLikuStockInList();
+
+    /**
+     * 获取立库限高空闲库位
+     * @return
+     */
+    long getLikuHeightLimitStock();
+
+    /**
+     * 判断是否子盘限高
+     * @return
+     */
+    boolean isHeightLimit(String completeBatchNo);
+
 }

+ 1 - 2
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/edgeLibrary/service/impl/StockInfoServiceImpl.java

@@ -82,8 +82,6 @@ public class StockInfoServiceImpl extends SuperServiceImpl<StockInfoMapper, Stoc
     @Autowired
     private MToolMeterialSpecsService toolMeterialSpecsService;
 
-    @Autowired
-    private StockInfoService stockInfoService;
 
     @Override
     // 启用属性自动注入
@@ -703,4 +701,5 @@ public class StockInfoServiceImpl extends SuperServiceImpl<StockInfoMapper, Stoc
     public List<Map> getXbkCountByShelves(Map paramsMap) {
         return baseMapper.getXbkCountByShelves(paramsMap);
     }
+
 }

+ 77 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/edgeLibrary/service/impl/StorgeServiceImpl.java

@@ -9,6 +9,7 @@ import com.github.zuihou.authority.entity.common.DictionaryItem;
 import com.github.zuihou.base.service.SuperCacheServiceImpl;
 import com.github.zuihou.business.DemoLine.DemoCacheKey;
 import com.github.zuihou.business.DemoLine.DemoLineConstant;
+import com.github.zuihou.business.edgeLibrary.dao.StockInfoMapper;
 import com.github.zuihou.business.edgeLibrary.dao.StorgeMapper;
 import com.github.zuihou.business.edgeLibrary.dao.StorgeTrayConfMapper;
 import com.github.zuihou.business.edgeLibrary.dto.StorgeSaveDTO;
@@ -19,11 +20,17 @@ import com.github.zuihou.business.edgeLibrary.entity.Storge;
 import com.github.zuihou.business.edgeLibrary.service.StockInfoService;
 import com.github.zuihou.business.edgeLibrary.service.StorgeService;
 import com.github.zuihou.business.operationManagementCenter.entity.TTask;
+import com.github.zuihou.business.operationManagementCenter.entity.TWorkpiece;
+import com.github.zuihou.business.operationManagementCenter.service.WorkpieceService;
 import com.github.zuihou.business.productionReadyCenter.dao.BomProcedureTrayMapper;
 import com.github.zuihou.business.productionReadyCenter.entity.BomProcedureTray;
 import com.github.zuihou.business.productionReadyCenter.entity.Plate;
+import com.github.zuihou.business.productionReadyCenter.entity.Tray;
 import com.github.zuihou.business.productionReadyCenter.service.PlateService;
+import com.github.zuihou.business.productionReadyCenter.service.TrayService;
+import com.github.zuihou.business.productionResourceCenter.dao.ProductionresourceBizMapper;
 import com.github.zuihou.business.productionResourceCenter.dao.ProductionresourcePositionMapper;
+import com.github.zuihou.business.productionResourceCenter.entity.Productionresource;
 import com.github.zuihou.business.productionResourceCenter.entity.ProductionresourcePosition;
 import com.github.zuihou.business.productionResourceCenter.entity.ZZone;
 import com.github.zuihou.business.productionResourceCenter.service.ProductionresourcePositionService;
@@ -89,6 +96,18 @@ public class StorgeServiceImpl extends SuperCacheServiceImpl<StorgeMapper, Storg
     @Autowired
     private MsgUtil msgUtil;
 
+    @Autowired
+    private ProductionresourceBizMapper productionresourceBizMapper;
+
+    @Autowired
+    private StockInfoMapper stockInfoMapper;
+
+    @Autowired
+    private WorkpieceService tWorkpieceService;
+
+    @Autowired
+    private TrayService trayService;
+
     @Override
     protected String getRegion() {
         return TENANT;
@@ -509,4 +528,62 @@ public class StorgeServiceImpl extends SuperCacheServiceImpl<StorgeMapper, Storg
         List list = baseMapper.getstorgeByZone(map);
         return  CollectionUtil.isNotEmpty(list)?list.size():0;
     }
+
+    @Override
+    public long getLikuStockInList() {
+        List <StockInfo> returnList = null;
+
+        List<Productionresource> productionresources = productionresourceBizMapper.selectList(Wraps.<Productionresource>lbQ().like(Productionresource::getCode,DictionaryKey.YJ_ZONE_XBK.get("plateAndClamp")));
+        List<Long> productionresourceIds = productionresources.stream().map(t->t.getId()).collect(Collectors.toList());
+
+        if(CollectionUtil.isEmpty(productionresourceIds)){
+            return -1;
+        }
+        String resourceIds = "";
+        for(int i = 0; i < productionresourceIds.size(); i++){
+            if(i == productionresourceIds.size() - 1){
+                resourceIds = resourceIds + productionresourceIds.get(i);
+            }else{
+                resourceIds = resourceIds + productionresourceIds.get(i)+ ",";
+            }
+        }
+        Map queryMap = new HashMap();
+        queryMap.put("resourceIds",resourceIds);
+
+        // 判断夹具是否有可用的,查询330个库位信息中是否还有夹具
+
+        List<Long> allStockList = stockInfoMapper.getAvailableStorge(queryMap);
+        if(allStockList.size() > 0){
+            return allStockList.get(0);
+        }else{
+            return -1;
+        }
+    }
+
+    /**
+     * 立库获取舱体限高工装的库位(298-330)
+     * @return
+     */
+    public long getLikuHeightLimitStock(){
+        Productionresource  productionresource = productionresourceBizMapper.selectOne(new LbqWrapper<Productionresource>().eq(Productionresource::getCode, DictionaryKey.YJ_ZONE_XBK.get("plateAndClamp")));
+        if(null==productionresource) return -1;
+        List<ProductionresourcePosition> productionresourcePositionList = productionresourcePositionService.getFreeProductionresourcePositionByIds(new String[]{productionresource.getId().toString()});
+        List<Long> storgeIds = productionresourcePositionList.stream().filter(item->{
+            int pointId = Integer.parseInt(item.getPointId());
+            return pointId>=298 && pointId<=330;
+        }).map(item->item.getStorgeId()).collect(Collectors.toList());
+        return storgeIds==null || storgeIds.size()==0 ? -1 : storgeIds.get(0);
+    }
+
+    /**
+     * 判断
+     * @return
+     */
+    @Override
+    public boolean isHeightLimit(String completeBatchNo) {
+        Storge storge = tWorkpieceService.getWorkPieceStock(completeBatchNo, false);
+        StockInfo stockInfo = stockInfoMapper.selectOne(new LbqWrapper<StockInfo>().eq(StockInfo::getStorgeId, storge.getId()).eq(StockInfo::getGoodsType, "1"));
+        Tray tray = trayService.getById(stockInfo.getGoodsId());
+        return tray.getHeightLimit().equals(1) ? true : false;
+    }
 }

+ 3 - 4
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/mq/ConsumerHandler.java

@@ -39,15 +39,14 @@ public class ConsumerHandler implements ChannelAwareMessageListener {
         long deliveryTag = message.getMessageProperties().getDeliveryTag();
         try {
             handleMessage(data, message.getMessageProperties().getConsumerQueue());
-            channel.basicAck(deliveryTag, false);
+            channel.basicAck(deliveryTag, true);
         } catch(Exception e){
-            e.printStackTrace();
-            log.error("MQ异常:"+e.getMessage());
+            log.debug("MQ异常:"+e.getMessage());
             //是否重试请求
             if (StringUtils.isNotBlank(e.getMessage()) && e.getMessage().equals("节点参数异常")) {
                 channel.basicNack(deliveryTag, false, false);//消息消费失败将丢弃该消息
             }else{
-                log.error("消息消费失败重新进入队列");
+                log.debug("消息消费失败重新进入队列");
                 channel.basicNack(deliveryTag, false, true);
             }
         }

+ 2 - 36
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/mq/TaskWorkNode.java

@@ -1370,11 +1370,11 @@ public class TaskWorkNode {
             TaskNode beforTaskNode = taskNodeService.getNextNTaskNode(taskNode,-1);
             TaskNode baitingTaskNode = taskNodeService.getNextNTaskNode(beforTaskNode,-1);
             boolean condition = bomProcedureType.equals("下料") && "04".equals(baitingTaskNode.getInterfaceType());
-            //翻面工装下料,节点特殊处理
+            //替换工装下料,节点特殊处理
             boolean nodeCondition = "4".equals(beforTaskNode.getNodeType()) && bomProcedureType.indexOf("上料")>0 && taskNode.getNodeName().indexOf("立库")>0;
             if(condition || nodeCondition){
                 // 下料特殊处理,动态查找可用立库位子存放下料后的子盘夹具
-                Long storgeId = getLikuStockInList();
+                Long storgeId = storgeService.isHeightLimit(taskNode.getCompleteBatchNo())?storgeService.getLikuHeightLimitStock() : storgeService.getLikuStockInList();
                 targetStorge = storgeService.getById(storgeId);
                 returnMap.put("store",targetStorge);
                 returnMap.put("targetxbk","0");
@@ -1456,40 +1456,6 @@ public class TaskWorkNode {
         return returnMap;
     }
 
-    /**
-     * 立库获取终点位置,取空库位的数据
-     * @return
-     */
-    private long getLikuStockInList(){
-        List <StockInfo> returnList = null;
-
-        List<Productionresource> productionresources = productionresourceBizMapper.selectList(Wraps.<Productionresource>lbQ().like(Productionresource::getCode,DictionaryKey.YJ_ZONE_XBK.get("plateAndClamp")));
-        List<Long> productionresourceIds = productionresources.stream().map(t->t.getId()).collect(Collectors.toList());
-
-        if(CollectionUtil.isEmpty(productionresourceIds)){
-            return -1;
-        }
-        String resourceIds = "";
-        for(int i = 0; i < productionresourceIds.size(); i++){
-            if(i == productionresourceIds.size() - 1){
-                resourceIds = resourceIds + productionresourceIds.get(i);
-            }else{
-                resourceIds = resourceIds + productionresourceIds.get(i)+ ",";
-            }
-        }
-        Map queryMap = new HashMap();
-        queryMap.put("resourceIds",resourceIds);
-
-        // 判断夹具是否有可用的,查询330个库位信息中是否还有夹具
-
-        List<Long> allStockList = stockInfoMapper.getAvailableStorge(queryMap);
-        if(allStockList.size() > 0){
-            return allStockList.get(0);
-        }else{
-            return -1;
-        }
-    }
-
     /**
      * 设备动态逻辑判断处理
      *

+ 1 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/MachineNodeServiceImpl.java

@@ -260,7 +260,7 @@ public class MachineNodeServiceImpl implements NodeOperationService {
                     data.put("taskNo", task.getTaskNo());
                     data.put("productNo", tWorkpiece.getUniqueCode());
                     data.put("batchNo", task.getCompleteBatchNo());
-                    data.put("serialNo", task.getProcedureSort());
+                    data.put("serialNo", task.getProcedureSort().toString());
                     map.put("data", data);
                     map.put("result", true);
                 }

+ 1 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/ProductionresourceBizServiceImpl.java

@@ -79,7 +79,7 @@ public class ProductionresourceBizServiceImpl extends SuperServiceImpl<Productio
            String id = item.get("id").toString();
            String moduleId = item.get("moduleId").toString();
             LbqWrapper<ResourceBusiness> lbqWrapper = new LbqWrapper<ResourceBusiness>();
-            lbqWrapper.in(ResourceBusiness::getResourceId,id);
+            lbqWrapper.eq(ResourceBusiness::getStatus, "1").in(ResourceBusiness::getResourceId,id);
             lbqWrapper.or(wrapper->{
                 wrapper.eq(ResourceBusiness::getModuleId, moduleId).eq(ResourceBusiness::getResourceId, "0");
             }).orderByAsc(ResourceBusiness::getResourceId);

+ 1 - 0
imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/productionReadyCenter/BomProcedureVersionMapper.xml

@@ -23,6 +23,7 @@
         <result column="meterial_conf" jdbcType="VARCHAR" property="meterialConf"/>
         <result column="tray_conf" jdbcType="VARCHAR" property="trayConf"/>
         <result column="program_conf" jdbcType="VARCHAR" property="programConf"/>
+        <result column="opid" jdbcType="INTEGER" property="opid"/>
     </resultMap>
 
     <!-- 通用查询结果列 -->

+ 1 - 1
imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/productionReadyCenter/TrayMapper.xml

@@ -23,7 +23,7 @@
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
         id,create_time,create_user,update_time,update_user,material_type,factory,period,expiry_date,join_date,
-        name, no, zone_id, num, specification,production_type,category_type,five_axis,status,positionSort,org_id
+        name, no, zone_id, num, specification,production_type,category_type,five_axis,height_limit,status,positionSort,org_id
     </sql>
 
     <!-- 分页 -->

+ 16 - 3
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/externalApi/SynProductionStatus.java

@@ -32,6 +32,7 @@ import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.compress.utils.Lists;
 import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.time.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -104,12 +105,24 @@ public class SynProductionStatus {
                 AAutoNodeLog autoNodeLog = AAutoNodeLog.builder().build();
                 //新增全局警报异常
                 String content = StringUtils.isNotEmpty(bizProductionResource.getAlertMsg())? bizProductionResource.getAlertMsg(): "无警告信息";
-                autoNodeLog.setStatus("0").setManual("1").setExeStatus("2").setMethod("GlobalException")
+                autoNodeLog.setStatus("0").setManual("1").setExeStatus("2").setMethod("GlobalException").setExecuteTime(new Date())
                         .setExeResult("0").setFeedback("["+ productionresource.getName() +"] "+content);
                 LbqWrapper<AAutoNodeLog> lbqWrapper = new LbqWrapper<AAutoNodeLog>();
+
                 lbqWrapper.eq(AAutoNodeLog::getMethod, "GlobalException")
-                        .eq(AAutoNodeLog::getFeedback, "["+ productionresource.getName() +"] "+content).eq(AAutoNodeLog::getStatus, "0");
-                autoNodeLogService.saveOrUpdate(autoNodeLog, lbqWrapper);
+                        .eq(AAutoNodeLog::getFeedback, "["+ productionresource.getName() +"] "+content).orderByDesc(AAutoNodeLog::getExecuteTime).last("limit 1");
+
+                AAutoNodeLog historyLog = autoNodeLogService.getOne(lbqWrapper);
+                if(null!=historyLog){
+                    // 同一天同一设备的相同报警记录弹框只处理一次
+                    if(null!=historyLog.getExecuteTime() && DateUtils.isSameDay(historyLog.getExecuteTime(), new Date())) {
+                        UpdateWrapper<AAutoNodeLog> updateWrapper = new UpdateWrapper<AAutoNodeLog>();
+                        updateWrapper.lambda().eq(AAutoNodeLog::getId, historyLog.getId()).set(AAutoNodeLog::getExecuteTime, new Date());
+                        autoNodeLogService.update(null, updateWrapper);
+                    }
+                }else{
+                    autoNodeLogService.save(autoNodeLog);
+                }
             }else{
                 isAlarm = false;
             }

+ 3 - 0
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionReadyCenter/dto/TrayPageDTO.java

@@ -98,4 +98,7 @@ public class TrayPageDTO implements Serializable {
     @ApiModelProperty(value = "是否五轴(0-否1-是)")
     private Integer fiveAxis;
 
+    @ApiModelProperty(value = "是否限高(0-否1-是)")
+    private Integer heightLimit;
+
 }

+ 3 - 0
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionReadyCenter/dto/TraySaveDTO.java

@@ -112,6 +112,9 @@ public class TraySaveDTO implements Serializable {
     @ApiModelProperty(value = "是否五轴(0-否1-是)")
     private Integer fiveAxis;
 
+    @ApiModelProperty(value = "是否限高(0-否1-是)")
+    private Integer heightLimit;
+
     @ApiModelProperty(value = "有效期(月)")
     private Integer expiryDate;
 

+ 3 - 0
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionReadyCenter/dto/TrayUpdateDTO.java

@@ -113,6 +113,9 @@ public class TrayUpdateDTO implements Serializable {
     @ApiModelProperty(value = "是否五轴(0-否1-是)")
     private Integer fiveAxis;
 
+    @ApiModelProperty(value = "是否限高(0-否1-是)")
+    private Integer heightLimit;
+
     @ApiModelProperty(value = "有效期(月)")
     private Integer expiryDate;
 

+ 1 - 1
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionReadyCenter/entity/BomProcedureVersion.java

@@ -317,7 +317,7 @@ public class BomProcedureVersion extends Entity<Long> {
      */
     @ApiModelProperty(value = "工序编号")
     @TableField("opid")
-    @Excel(name = "排序")
+    @Excel(name = "工序编号")
     private Integer opid;
 
     @Builder

+ 8 - 1
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionReadyCenter/entity/Tray.java

@@ -164,6 +164,11 @@ public class Tray extends Entity<Long> {
     @Excel(name = "是否五轴")
     private Integer fiveAxis;
 
+    @ApiModelProperty(value = "是否限高(0-否1-是)")
+    @TableField(value = "height_limit", condition = LIKE)
+    @Excel(name = "是否限高")
+    private Integer heightLimit;
+
     /**
      * 夹紧位置
      */
@@ -176,7 +181,7 @@ public class Tray extends Entity<Long> {
 
 
     @Builder
-    public Tray(Long id, LocalDateTime createTime, Long createUser, LocalDateTime updateTime, Long updateUser, Long zoneId,
+    public Tray(Long id, LocalDateTime createTime, Long createUser, LocalDateTime updateTime, Long updateUser, Long zoneId, int fiveAxis, int heightLimit,
                     String name, String no, RemoteData<String, String> brand, RemoteData<String, String> productionType, String specification, String status) {
         this.id = id;
         this.createTime = createTime;
@@ -190,6 +195,8 @@ public class Tray extends Entity<Long> {
         this.specification = specification;
         this.status = status;
         this.productionType = productionType;
+        this.fiveAxis = fiveAxis;
+        this.heightLimit = heightLimit;
     }
 
 }