Kaynağa Gözat

处理大屏显示、完成工艺复制和其他功能

oyq28 2 yıl önce
ebeveyn
işleme
f3db25cb5c
16 değiştirilmiş dosya ile 215 ekleme ve 67 silme
  1. 2 0
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/DemoLine/DemoLineConstant.java
  2. 2 0
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/edgeLibrary/dao/StockInfoMapper.java
  3. 2 0
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/edgeLibrary/service/StockInfoService.java
  4. 5 0
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/edgeLibrary/service/impl/StockInfoServiceImpl.java
  5. 1 1
      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/operationManagementCenter/dao/OrderMapper.java
  7. 2 0
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/dao/TTaskMapper.java
  8. 4 0
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/OrderService.java
  9. 4 0
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/TaskService.java
  10. 113 0
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/OrderServiceImpl.java
  11. 52 53
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/TaskServiceImpl.java
  12. 2 2
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionReadyCenter/service/BomProcedureVersionService.java
  13. 1 1
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/ZZoneService.java
  14. 3 1
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/MachineNodeServiceImpl.java
  15. 10 8
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/RobotNodeServiceImpl.java
  16. 11 0
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/ZZoneServiceImpl.java

+ 2 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/DemoLine/DemoLineConstant.java

@@ -297,4 +297,6 @@ public interface DemoLineConstant {
 
     String DEMOLINE_HEIDENHAIN_FILE_URL= "DEMOLINE_HEIDENHAIN_FILE_URL";
 
+    String DEMOLINE_RESOURCE_DY_CHANGE = "DEMOLINE_RESOURCE_DY_CHANGE";
+
 }

+ 2 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/edgeLibrary/dao/StockInfoMapper.java

@@ -61,4 +61,6 @@ public interface StockInfoMapper extends SuperMapper<StockInfo> {
     List<Long> getAvailableStorge(Map queryMap);
 
     void updateStockInfoByStorgeId(Map updateLockStatusParams);
+
+    List<Map> getXbkCountByShelves(Map paramsMap);
 }

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

@@ -175,4 +175,6 @@ public interface StockInfoService extends SuperService<StockInfo> {
     R procedurePlateStockIn(BigDecimal uniqueCode, Long goodsId, Long storgeId);
 
     R procedureMeterialStockIn(String uniqueCode, Long goodsId, Long storgeId);
+
+    List<Map> getXbkCountByShelves(Map paramsMap);
 }

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

@@ -698,4 +698,9 @@ public class StockInfoServiceImpl extends SuperServiceImpl<StockInfoMapper, Stoc
         stockLogService.saveLog(infoBean,BizConstant.STOCK_TYPE_IN,"");
         return R.success();
     }
+
+    @Override
+    public List<Map> getXbkCountByShelves(Map paramsMap) {
+        return baseMapper.getXbkCountByShelves(paramsMap);
+    }
 }

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

@@ -201,7 +201,7 @@ public class TaskWorkNode {
                 List<Long> operationTaskNodeIds = operationTaskNodes.stream().map(operationTaskNode -> operationTaskNode.getId()).collect(Collectors.toList());
                 for(Long operationTaskNodeId : operationTaskNodeIds){
                     // 清除redis里面的内容
-                    msgUtil.redis_del(YunjianConstant.YUNJIAN_CALLBACK_PARAM + "_" + operationTaskNodeId);
+                    //msgUtil.redis_del(YunjianConstant.YUNJIAN_CALLBACK_PARAM + "_" + operationTaskNodeId);
                     msgUtil.redis_del(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_JXS + operationTaskNodeId);
                     msgUtil.redis_del(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_HCW + operationTaskNodeId);
                     msgUtil.redis_del(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_XBK_FLAG + operationTaskNodeId);

+ 1 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/dao/OrderMapper.java

@@ -34,7 +34,7 @@ public interface OrderMapper extends SuperMapper<Order> {
 
     int updateproduceStatusBegin();
 
-
     List<Map> orderStatitcs();
 
+    List<Map> timeSpanStatistics();
 }

+ 2 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/dao/TTaskMapper.java

@@ -61,4 +61,6 @@ public interface TTaskMapper extends SuperMapper<TTask> {
     int selectTotalMachineUseTime(Map params);
 
     List<Map> query3dResourceData(Map<String, String> data);
+
+    List<String> getTaskResourceName(Map<String, String> params);
 }

+ 4 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/OrderService.java

@@ -99,4 +99,8 @@ public interface OrderService extends SuperService<Order> {
     R reschedulingPlanTasks();
 
     Boolean check(OrderSaveDTO model);
+
+    Map timeSpanStatistics();
+
+    Map validTimeSpanStatistics();
 }

+ 4 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/TaskService.java

@@ -105,4 +105,8 @@ public interface TaskService extends SuperService<TTask> {
     R confirmProcedure(Map<String, Object> map);
 
     List<Tray> getValidTrayCount(Map<String, Object> map);
+
+    TTask getNNextTask(TTask task, int n);
+
+    boolean checkStockNode(Map<String, Object> map);
 }

+ 113 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/OrderServiceImpl.java

@@ -4,8 +4,10 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.convert.Convert;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
 import com.github.zuihou.authority.dao.auth.StationUserLoginInfoMapper;
 import com.github.zuihou.authority.dao.auth.UserMapper;
 import com.github.zuihou.authority.entity.auth.StationUserLoginInfo;
@@ -51,6 +53,8 @@ import com.github.zuihou.common.constant.CodeRuleModule;
 import com.github.zuihou.common.constant.ParameterKey;
 import com.github.zuihou.common.constant.RepeatCacheKey;
 import com.github.zuihou.common.util.DateUtil;
+import com.github.zuihou.common.util.ForEachUtil;
+import com.github.zuihou.common.util.TimeUtils;
 import com.github.zuihou.database.mybatis.auth.DataScope;
 import com.github.zuihou.database.mybatis.conditions.Wraps;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
@@ -61,7 +65,10 @@ import com.github.zuihou.tenant.service.CodeRuleService;
 import com.github.zuihou.utils.BeanPlusUtil;
 import com.google.common.collect.Maps;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections.MapUtils;
+import org.apache.commons.compress.utils.Lists;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.time.DateUtils;
 import org.apache.poi.hssf.usermodel.*;
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.ss.util.CellRangeAddress;
@@ -77,10 +84,15 @@ import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
+import java.math.BigDecimal;
+import java.text.ParseException;
 import java.time.LocalDateTime;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
+import java.util.function.Consumer;
+import java.util.stream.Collector;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 import static com.github.zuihou.utils.BizAssert.isFalse;
 import static java.util.stream.Collectors.groupingBy;
@@ -1061,6 +1073,107 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
         return super.count(Wraps.<Order>lbQ().eq(Order::getOrderName, model.getOrderName())) > 0;
     }
 
+    /**
+     * 统计设备总加工时长
+     *
+     * @return
+     */
+    @Override
+    public Map timeSpanStatistics() {
+        List<Map> timeList = baseMapper.timeSpanStatistics();
+        List<Map<String, Object>> dataList = zZoneMapper.selectMaps(new QueryWrapper<ZZone>().select("0 as timeMinute, name as zoneName, id as zoneId").groupBy("id"));
+        if(timeList!=null){
+            Map dataMap = timeList.stream().collect(Collectors.toMap(item->item.get("zoneName"),item->item.get("timeMinute")));
+            dataList.stream().forEach(item -> dataMap.merge(item.get("zoneName"), item.get("timeMinute"),(v1, v2)->{
+                return item.put("timeMinute", v1);
+            }));
+        }
+        Map map = dataList.stream().collect(Collectors.toMap(item->item.get("zoneName"),item->Integer.parseInt(item.get("timeMinute").toString())));
+        return map;
+    }
+
+    /**
+     *  统计加工有效时长
+     * @return
+     */
+    @Override
+    public Map validTimeSpanStatistics() {
+        Date date = new Date();
+        String strStartTime = DateUtil.dateToString(date);
+        date = DateUtil.stringToDate3(strStartTime);
+
+        //Date startTime = DateUtils.addDays(date, -64);
+        Date startTime = date;
+        Date endTime = DateUtils.addDays(startTime, 1);
+        LambdaQueryWrapper<TTask> queryWrapper = new LambdaQueryWrapper<TTask>()
+                .eq(TTask::getStatus, "3").ge(TTask::getStartTime,startTime).lt(TTask::getEndTime, endTime);
+                //.func(startTime != null && endTime != null, timeIntersection(
+                //        TTask::getStartTime, TTask::getEndTime, startTime, endTime));
+        List<TTask> taskList = taskService.list(queryWrapper);
+        //处理相交时间
+        List<TTask> intersectionList = Lists.newArrayList();
+
+        Map<Date, Date> dateMap = this.getTimePeriodsUnion(false, taskList);
+
+        double minutes = dateMap.entrySet().stream().mapToDouble(item ->{
+            long strMinute = 0;
+            try {
+                strMinute = DateUtil.minuteDiff(DateUtil.dateToStringPattern(item.getKey(), "yyyy-MM-dd HH:mm:ss"), DateUtil.dateToStringPattern(item.getValue(),"yyyy-MM-dd HH:mm:ss"));
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+            return Float.valueOf(strMinute);
+        }).sum();
+
+        int iMinutes= (int)Math.round(minutes) ;
+        Map map = Maps.newHashMap();
+        map.put("minutes", iMinutes);
+        return map;
+    }
+
+    /**
+     *
+     * @param mixedOrUnion true:交集 | false:并集
+     * @param periods
+     * @return
+     */
+    public Map<Date, Date> getTimePeriodsUnion(Boolean mixedOrUnion, List<TTask> periods) {
+        periods.sort(Comparator.comparing(TTask::getStartTime));
+        Map<Date, Date> dateMap = new TreeMap<>();
+        for (TTask period : periods) {
+            Date startTime = period.getStartTime();
+            Date endTime = period.getEndTime();
+            if (MapUtils.isEmpty(dateMap)) {
+                dateMap.put(startTime, endTime);
+            }
+            Map<Date, Date> tempMap = new TreeMap<>();
+            //TreeMap能自动根据Key排序,只需要合并交集
+            //1.有交集则合并或取交集
+            //2.没有交集则添加
+            Iterator<Map.Entry<Date, Date>> iterator = dateMap.entrySet().iterator();
+            while (iterator.hasNext()) {
+                Map.Entry<Date, Date> entry = iterator.next();
+                Date start = entry.getKey();
+                Date end = entry.getValue();
+                //两个时间段 [A, B)、[X, Y),X < B && A < Y 或者 A < Y && X < B则有交集
+                if ((startTime.before(end) && endTime.after(start)) || (start.before(endTime) && end.after(startTime))){
+                    iterator.remove();
+                    if (mixedOrUnion){
+                        tempMap.put(TimeUtils.getExtremumDate(true,startTime,start),TimeUtils.getExtremumDate(false,endTime,end));
+                    }else {
+                        tempMap.put(TimeUtils.getExtremumDate(false,startTime,start),TimeUtils.getExtremumDate(true,endTime,end));
+                    }
+                }else{
+                    if (!iterator.hasNext()){
+                        tempMap.put(startTime, endTime);
+                    }
+                }
+            }
+            dateMap.putAll(tempMap);
+        }
+        return dateMap;
+    }
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Boolean deleteOrder(Order model){

+ 52 - 53
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/TaskServiceImpl.java

@@ -1122,8 +1122,18 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
     @Override
     public R getStationTasks(Map<String, Object> map){
         List<Map> stationTasks = baseMapper.getStationTasks(map);
-        for(int i = 1; i<= stationTasks.size() ; i++){
-            stationTasks.get(i-1).put("step",i);
+        int len = stationTasks.size()<3 ? stationTasks.size():3;
+        if(len>0) {
+            List<String> deviceNames = stationTasks.subList(0, len).stream().map(item -> {
+                TTask task = baseMapper.selectOne(new LbqWrapper<TTask>().eq(TTask::getCompleteBatchNo, item.get("completeBatchNo")).eq(TTask::getProcedureSort, (int) item.get("procedureSort") + 1));
+                return (task != null)? productionresourceBizMapper.selectOne(new LbqWrapper<Productionresource>().eq(Productionresource::getId, task.getResourceId())).getName() : "";
+            }).collect(Collectors.toList());
+            for (int i = 1; i <= stationTasks.size(); i++) {
+                stationTasks.get(i - 1).put("step", i);
+                if (deviceNames.size() >= i) {
+                    stationTasks.get(i - 1).put("deviceName", deviceNames.get(i - 1));
+                }
+            }
         }
         return  R.success(stationTasks);
     }
@@ -1306,54 +1316,6 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
                         baseMapper.updateAllById(nextTask);
                     }
                     taskNodeService.taskNodeCallbackBiz(taskNode, tTask, taskNodeList, lg, jsonObject.toJSONString());
-                }else if("7".equals(processType)){
-                    //工序换料(下料当前工序零件且继续上料下一工序零件或当前工序未加工零件)
-                    String uniqueCode = map.get("uniqueCode").toString();
-                    jsonObject.put("uniqueCode", uniqueCode);
-                    int count = Integer.parseInt(map.get("count").toString());
-                    if(count>0 || StringUtil.isEmpty(uniqueCode)){
-                        //零件未上料,本零件执行零件下料释放资源
-                        jsonObject.put("srcPosition", currstorge.getId());
-                        jsonObject.put("targetPostion", "");
-                        jsonObject.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_METERIAL_CK);
-                        //未上料零件批量更新工序节点(跳过立库取工装的步骤,从1执行到3)
-                        /*
-                        List<TaskNode> dataList = taskNodeService.list(new LbqWrapper<TaskNode>().eq(TaskNode::getOrderId, taskNode.getOrderId()).eq(TaskNode::getCompleteBatchSort, 1).eq(TaskNode::getExeStatus, 2));
-                        dataList.stream().forEach(item->{
-                            List<TaskNode> nodeList = new ArrayList<TaskNode>();
-                            item.setExeStatus("3").setExeResult("1").setEndTime(new Date());
-                            TaskNode item2 = taskNodeService.getNextNTaskNode(item, 1);
-                            item2.setExeStatus("3").setExeResult("1").setEndTime(new Date());
-                            TaskNode item3 = taskNodeService.getNextNTaskNode(item2, 1);
-                            item3.setExeStatus("2").setEndTime(new Date());
-                            Collections.addAll(nodeList, item, item2, item3);
-                            taskNodeService.saveOrUpdateBatch(nodeList);
-
-                            TWorkpiece tWorkpiece = workpieceService.getOne(new LbqWrapper<TWorkpiece>().eq(TWorkpiece::getCompleteBatchNo, item.getCompleteBatchNo()).eq(TWorkpiece::getIsEnd, "0").eq(TWorkpiece::getCompleteBatchSort, 1));
-                            ProductionresourcePosition itemPosition = productionresourcePositionService.getOne(new LbqWrapper<ProductionresourcePosition>().eq(ProductionresourcePosition::getResourceId, item3.getResourceId()));
-
-                            tWorkpiece.setCompleteBatchSort(3).setStorgeId(itemPosition.getStorgeId()).setPointId(itemPosition.getPointId()).setTaskNodeId(item3.getId());
-                            workpieceService.updateById(tWorkpiece);
-
-                            JSONObject itemObject = new JSONObject();
-                            itemObject.put("bizType", BizConstant.MQ_TASK_NODE_TYPE_COMMON);
-                            itemObject.put("taskNodeId",item3.getId().toString());
-                            dynamicRabbitMq.sendMsg(item3.getResourceId().toString(),itemObject.toString());
-
-                        }); */
-                    }else{
-                        //零件替换上料
-                        /*
-                        ProductionresourcePosition position = productionresourcePositionService.getOne(new LbqWrapper<ProductionresourcePosition>().eq(ProductionresourcePosition::getName, "伺服舵机"));
-                        jsonObject.put("storeResourceId", position.getResourceId());
-                        jsonObject.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_METERIAL_RK);
-                        jsonObject.put("targetxbk", "0"); */
-                        //
-                        jsonObject.put("targetPostion", currstorge.getId());
-                        jsonObject.put("srcPosition", currstorge.getId());
-                        jsonObject.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_METERIAL_CRK);
-                    }
-                    taskNodeService.taskNodeCallbackBiz(taskNode, tTask, taskNodeList, lg, jsonObject.toJSONString());
                 }
             }
             msgUtil.redis_del(id);
@@ -1469,12 +1431,14 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
     public R confirmCode(Map<String, Object> map) {
         TWorkpiece tWorkpiece = workpieceMapper.selectOne(Wraps.<TWorkpiece>lbQ().eq(TWorkpiece::getOrderId, map.get("orderId").toString()).eq(TWorkpiece::getCompleteBatchNo, map.get("completeBatchNo").toString()).eq(TWorkpiece::getIsEnd, "0"));
         if(null == tWorkpiece) return R.fail("零件不存在");
+        Map data = new HashMap();
+        data.put("uniqueCode", tWorkpiece.getUniqueCode());
         TaskNode taskNode = taskNodeService.getById(tWorkpiece.getTaskNodeId());
+        //呼叫动态节点 无需验证次序
+        if(taskNode.getNodeType().equals("4")) return R.success(data);
         //序列保持前后顺次一致
         int procedureSort = Integer.parseInt(map.get("procedureSort").toString());
         TTask task = this.getById(taskNode.getTaskId());
-        Map data = new HashMap();
-        data.put("uniqueCode", tWorkpiece.getUniqueCode());
         return (procedureSort-1 == task.getProcedureSort())? R.success(data) : R.fail("执行任务与计划不一致");
     }
 
@@ -1505,6 +1469,19 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
             tray = trayService.getById(map.get("trayId").toString());
         }
 
+        //线边库资源是否足够
+        boolean xbkValid = true;
+        Map paramMap = Maps.newHashMap();
+        paramMap.put("no", DictionaryKey.YJ_ZONE_XBK.get("plateAndClamp"));
+        String orgIdsStr = CommonUtil.getOrgIdsStr();
+        if(StringUtil.isNotEmpty(orgIdsStr)) {
+            paramMap.put("orgIds", orgIdsStr);
+        }
+        List<Map> xbkValidList = stockInfoService.getXbkCountByShelves(paramMap);
+        xbkValidList = xbkValidList.stream().filter(item->item.containsKey("cnt") && (long)item.get("cnt")<=3).collect(Collectors.toList());
+        if(xbkValidList.size()>0){
+            xbkValid = false;
+        }
         //OP10工序未上料零件数量
         int unFeedingCount = workpieceMapper.selectCount(new LbqWrapper<TWorkpiece>().eq(TWorkpiece::getOrderId, taskNode.getOrderId()).isNull(TWorkpiece::getUniqueCode).eq(TWorkpiece::getIsEnd, "0"));
         //订单加工零件数
@@ -1514,6 +1491,10 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
 
         // 上下料站工装是否存在
         Long storgeId = productionresourcePositionMapper.getStorgeIdByResource(new HashMap<String, String>(){ { put("resourceId", taskNode.getResourceId().toString());}}).get(0).getStorgeId();
+        boolean locked = false;
+        Storge storge = storgeService.getById(storgeId);
+        //判断上下料站是否已经被任务锁定
+        locked = storge.getLockStatus().equals("0") && StringUtil.isNotEmpty(storge.getCompleteBatchNo()) && storge.getCampId()!=null;
 
         List<StockInfo> stockInfoList = stockInfoService.list(new LbqWrapper<StockInfo>().eq(StockInfo::getStorgeId, storgeId).orderByAsc(StockInfo::getGoodsType));
         int existed  = stockInfoList.size();
@@ -1527,12 +1508,30 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
         Map data = new HashMap();
         data.put("unFeedingCount", unFeedingCount);
         int count = materialCount - produceCount;
+        data.put("xbkValid", xbkValid);
         data.put("count", count);
         data.put("existed",  existed);
         data.put("matched",  matched);
+        data.put("locked",  locked);
         return R.success(data);
     }
 
+    @Override
+    public TTask getNNextTask(TTask task, int n) {
+        TTask nTask = baseMapper.selectOne(new LbqWrapper<TTask>().eq(TTask::getCompleteBatchNo, task.getCompleteBatchNo()).eq(TTask::getProcedureSort, task.getProcedureSort() + n ));
+        return nTask;
+    }
+
+    @Override
+    public boolean checkStockNode(Map<String, Object> map) {
+        TaskNode taskNode = taskNodeService.getById(map.get("taskNodeId").toString());
+        TaskNode nextNode = taskNodeService.getNextNTaskNode(taskNode, 1);
+        if(null == nextNode || null == nextNode.getTaskId()) return false;
+        // true: 后续已经配置入库节点  false: 该任务后续无节点
+        boolean bool = taskNode.getTaskId().equals(nextNode.getTaskId());
+        return bool;
+    }
+
     @Override
     //获取立库中可使用子盘工装数量
     public List<Tray> getValidTrayCount(Map map) {
@@ -1545,7 +1544,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
         //获取设备点位
         List<Long> startProductionresourcePositionIds = productionresourcePositionMapper.selectList(new LbqWrapper<ProductionresourcePosition>().in(ProductionresourcePosition::getResourceId, productionresourceIds).eq(ProductionresourcePosition::getStatus,"0")).stream().map(ProductionresourcePosition::getStorgeId).collect(Collectors.toList());
         //获取设备库位
-        List<Long> stockIds = stockInfoMapper.selectList(new LbqWrapper<StockInfo>().in(StockInfo::getStorgeId,startProductionresourcePositionIds).eq(StockInfo::getGoodsType, "1")).stream().map(StockInfo::getGoodsId).collect(Collectors.toList());
+        List<Long> stockIds = stockInfoMapper.selectList(new LbqWrapper<StockInfo>().in(StockInfo::getStorgeId,startProductionresourcePositionIds).eq(StockInfo::getGoodsType, "1").eq(StockInfo::getLockStatus, "1")).stream().map(StockInfo::getGoodsId).collect(Collectors.toList());
         //获取可用子盘
         List<Tray> trayList = trayService.list(new LbqWrapper<Tray>().eq(Tray::getCategoryType, tray.getCategoryType()).eq(Tray::getProductionType, tray.getProductionType()).eq(Tray::getFiveAxis, tray.getFiveAxis()).in(Tray::getId, stockIds));
         return trayList;

+ 2 - 2
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionReadyCenter/service/BomProcedureVersionService.java

@@ -41,7 +41,7 @@ public interface BomProcedureVersionService extends SuperService<BomProcedureVer
     /**
      * 保存
      *
-     * @param data
+     * @param bean
      * @return
      */
     List<Map<String,Object>> saveProcedure(BomProcedureVersion bean);
@@ -82,5 +82,5 @@ public interface BomProcedureVersionService extends SuperService<BomProcedureVer
 
     BomProcedureVersion getPreTrayProcedureVersion(BomProcedureVersion procedure);
 
-
+    List<BomProcedureVersion> cloneProcedure(BomProcedureVersion bean);
 }

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

@@ -60,5 +60,5 @@ public interface ZZoneService extends SuperService<ZZone> {
 
     String getRobotTypebyZone(String zoneName);
 
-
+    Map getTimeSpanList(Map map);
 }

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

@@ -286,6 +286,7 @@ public class MachineNodeServiceImpl implements NodeOperationService {
                         map.put("method", "UploadFile");
                         JSONObject data = new JSONObject();
                         data.put("fileName", fileList.get(0).get("fileName"));
+                        msgUtil.redis_set("UploadFile_Path"+"_"+task.getId(), uriPath+","+storagePath+","+fileList.get(0).get("fileName"), 1, TimeUnit.DAYS);
                         Module module  = moduleService.getOne(new LbqWrapper<Module>().eq(Module::getId, productionresource.getModuleId()));
                         data.put("remotePath", module.getCncFilePath());
                         //msgUtil.redis_set(DemoCacheKey.DEMOLINE_PROGRAME_NAMES + task.getCompleteBatchNo(), fileName, 1, TimeUnit.DAYS);
@@ -295,7 +296,7 @@ public class MachineNodeServiceImpl implements NodeOperationService {
                             uploadInfo.put("url",  productionresource.getIp());
                             uploadInfo.put("port", productionresource.getPort());
                             uploadInfo.put("data", data);
-                            msgUtil.redis_set(DemoLineConstant.DEMOLINE_HEIDENHAIN_FILE_URL+"_"+task.getId(), uploadInfo.toJSONString());
+                            msgUtil.redis_set(DemoLineConstant.DEMOLINE_HEIDENHAIN_FILE_URL+"_"+task.getId(), uploadInfo.toJSONString(), 30, TimeUnit.DAYS);
                             data.put("fileName", "");
                         }
                         map.put("data", data);
@@ -318,6 +319,7 @@ public class MachineNodeServiceImpl implements NodeOperationService {
                     map.put("data", data);
                     map.put("method", "StartNCProgram");
                     map.put("result", true);
+
                 }
                 else if ("3".equals(functionType)){
                      // 加工前写入工件坐标系 根据taskid查找工件三坐标测量的工件坐标系,可能存在装夹一次未果的情况,所以取最后一条数据

+ 10 - 8
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/RobotNodeServiceImpl.java

@@ -390,7 +390,9 @@ public class RobotNodeServiceImpl implements NodeOperationService {
 
         //新增是否替换工装
         //if((taskNode.getCompleteBatchSort()==2 && taskNode.getNodeType().equals("4"))||(taskNode.getPrority()==4 && taskNode.getNodeType().equals("4"))){
-        if( taskNode.getNodeType().equals("4") && (taskNode.getCompleteBatchSort()==2 || taskNode.getPrority()==4 )){
+        boolean getCondition = taskNode.getNodeType().equals("4") && (taskNode.getCompleteBatchSort()==2 || taskNode.getPrority()==4) ;
+        boolean checkCondition = taskNode.getNodeName().indexOf("立库取")>-1;
+        if(getCondition || checkCondition){
                 // 判断是否是单线单独运行
             if(1 == orderPlan.getSingleRunFlag()){
                 flikustockInfos = this.getProductionLineXbkStockList(nextTaskNode,task);
@@ -715,9 +717,9 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                             JSONObject jsonObject  = JSONObject.parseObject(uploadInfo);
                             //异步发送哈默预处理编号
                             boolean bool = this.asyncPost(jsonObject);
-                            if(bool){
-                                msgUtil.redis_del(DemoLineConstant.DEMOLINE_HEIDENHAIN_FILE_URL+"_"+task.getId());
-                            }
+                            //if(bool){
+                            //    msgUtil.redis_del(DemoLineConstant.DEMOLINE_HEIDENHAIN_FILE_URL+"_"+task.getId());
+                            //}
                         }
 
                         Map locationMap = new HashMap();
@@ -1089,7 +1091,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
             // begin modify by yejian on 20220515 for 下料库位问题修改
             TaskNode beforTaskNode = taskNodeService.getNextNTaskNode(taskNode,-1);
             TaskNode baitingTaskNode = taskNodeService.getNextNTaskNode(beforTaskNode,-1);
-            boolean condition = bomProcedureType.equals("下料") && "04".equals(baitingTaskNode.getInterfaceType());
+            boolean condition = (bomProcedureType.equals("下料") || bomProcedureType.equals("热处理下料")) && "04".equals(baitingTaskNode.getInterfaceType());
             //翻面工装下料,节点特殊处理
             boolean nodeCondition = "4".equals(beforTaskNode.getNodeType()) && bomProcedureType.indexOf("上料")>0 && taskNode.getNodeName().indexOf("立库")>0;
             if(condition || nodeCondition){
@@ -1236,7 +1238,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
         List<BomProcedureTray>trayList = procedureTrayService.list(Wraps.<BomProcedureTray>lbQ().eq(BomProcedureTray::getProcedureId, task.getProcedureId()).orderByAsc(BomProcedureTray::getBizType));
         List<Long>trayIdList = trayList.stream().map(t->t.getTrayId()).collect(Collectors.toList());
         // 判断夹具是否有可用的,查询330个库位信息中是否还有夹具
-        List<StockInfo> allStockInfos = stockInfoMapper.selectList(Wraps.<StockInfo>lbQ().in(StockInfo::getGoodsId,trayIdList).in(StockInfo::getStorgeId,startProductionresourcePositionIds).orderByAsc(StockInfo::getGoodsType));
+        List<StockInfo> allStockInfos = stockInfoMapper.selectList(Wraps.<StockInfo>lbQ().in(StockInfo::getGoodsId,trayIdList).in(StockInfo::getStorgeId,startProductionresourcePositionIds).eq(StockInfo::getLockStatus, "1").orderByAsc(StockInfo::getGoodsType));
 
         MToolClamp clamp = toolClampService.getById(trayIdList.get(1));
         Tray currTray = trayService.getOne(new LbqWrapper<Tray>().eq(Tray::getNo, clamp.getNo()).last("limit 1"));
@@ -1270,7 +1272,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                 // 获取三轴同类型子盘和工装
                 //Tray otherTray = trayService.list(new LbqWrapper<Tray>().eq(Tray::getProductionType, currTray.getProductionType()).ne(Tray::getId, stockTray.getId()).eq(Tray::getFiveAxis, 0)).get(0);
                 List<Long> otherTrayIds = trayService.list(new LbqWrapper<Tray>().eq(Tray::getProductionType, currTray.getProductionType()).eq(Tray::getCategoryType, currTray.getCategoryType().getKey()).eq(Tray::getFiveAxis, 0).ne(Tray::getId, currTray.getId())).stream().map(t->t.getId()).collect(Collectors.toList());;
-                StockInfo otherStock = stockInfoMapper.selectOne(new LbqWrapper<StockInfo>().in(StockInfo::getGoodsId, otherTrayIds).in(StockInfo::getStorgeId,startProductionresourcePositionIds).last("limit 1"));
+                StockInfo otherStock = stockInfoMapper.selectOne(new LbqWrapper<StockInfo>().eq(StockInfo::getLockStatus, "1").in(StockInfo::getGoodsId, otherTrayIds).in(StockInfo::getStorgeId,startProductionresourcePositionIds).last("limit 1"));
                 if(otherStock!=null){
                     returnList = stockInfoMapper.selectList(new LbqWrapper<StockInfo>().eq(StockInfo::getStorgeId, otherStock.getStorgeId()));
                 }
@@ -1278,7 +1280,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                 //翻面获取五轴同类型子盘和工装
                 //Tray axisTray = trayService.list(new LbqWrapper<Tray>().eq(Tray::getProductionType, currTray.getProductionType()).ne(Tray::getId, stockTray.getId()).eq(Tray::getFiveAxis, 1)).get(0);
                 List<Long> axisTrayIds = trayService.list(new LbqWrapper<Tray>().eq(Tray::getProductionType, currTray.getProductionType()).eq(Tray::getCategoryType, "C").eq(Tray::getFiveAxis, 1).ne(Tray::getId, currTray.getId())).stream().map(t->t.getId()).collect(Collectors.toList());;
-                StockInfo axisStock = stockInfoMapper.selectOne(new LbqWrapper<StockInfo>().in(StockInfo::getGoodsId, axisTrayIds).in(StockInfo::getStorgeId,startProductionresourcePositionIds).last("limit 1"));
+                StockInfo axisStock = stockInfoMapper.selectOne(new LbqWrapper<StockInfo>().eq(StockInfo::getLockStatus, "1").in(StockInfo::getGoodsId, axisTrayIds).in(StockInfo::getStorgeId,startProductionresourcePositionIds).last("limit 1"));
                 if(axisStock!=null) {
                     returnList = stockInfoMapper.selectList(new LbqWrapper<StockInfo>().eq(StockInfo::getStorgeId, axisStock.getStorgeId()));
                 }

+ 11 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/ZZoneServiceImpl.java

@@ -46,6 +46,7 @@ import com.github.zuihou.tenant.service.CodeRuleService;
 import com.github.zuihou.tenant.service.ProductionresourceService;
 import com.github.zuihou.utils.BeanPlusUtil;
 import com.github.zuihou.utils.MapHelper;
+import com.google.common.collect.Maps;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.map.LinkedMap;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -692,4 +693,14 @@ public class ZZoneServiceImpl extends SuperServiceImpl<ZZoneMapper, ZZone> imple
         }
         return "";
     }
+
+    @Override
+    public Map getTimeSpanList(Map map) {
+        Map dataMap = Maps.newHashMap();
+        Map timeSpanStatistics = orderService.timeSpanStatistics();
+        Map validTimeSpanStatistics = orderService.validTimeSpanStatistics();
+        dataMap.put("timeSpanStatistics", timeSpanStatistics);
+        dataMap.put("validTimeSpanStatistics", validTimeSpanStatistics);
+        return dataMap;
+    }
 }