瀏覽代碼

Merge remote-tracking branch 'origin/master' into master

yejian 3 年之前
父節點
當前提交
4d64c52477

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

@@ -267,5 +267,8 @@ public interface YunjianConstant {
     String YUNJIAN_CALLBACK_PARAM = "YUNJIAN_CALLBACK_PARAM";
 
 
+    String YUNJIAN_SHEDULE_FLAG = "YUNJIAN_SHEDULE_FLAG";
+
+
 
 }

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

@@ -231,6 +231,11 @@ public class TaskWorkNode {
                 ZZoneProductionresource zoneProductionresource = zZoneProductionresourceMapper.selectOne(Wraps.<ZZoneProductionresource>lbQ().eq(ZZoneProductionresource::getResourceId, taskNode.getResourceId()));
                 ZZone zZone = zoneService.getById(zoneProductionresource.getZoneId());
                 queryMap.put("zone", zZone);
+
+
+                BBom bom = bBomMapper.selectById(tTask.getBomId());
+                ZZone bomzZone = zoneService.getById(bom.getId());
+                queryMap.put("bomzZone", bomzZone);
                 //运行条件验证
                 Map conMap = checkCon(taskNode, tTask, queryMap);
                 if (null == conMap) {
@@ -556,6 +561,7 @@ public class TaskWorkNode {
         map.put("instructions", moduleInstructions);
         map.put("moduleName", module.getName());
         map.put("zone", dataMap.get("zone"));
+        map.put("bomzZone", dataMap.get("bomzZone"));
 
         if ("1".equals(category)) {
             nodeOperationService = MsgUtil.getBean(MachineNodeServiceImpl.class);
@@ -638,7 +644,7 @@ public class TaskWorkNode {
 
                 Storge startStore = workpieceService.getWorkPieceStock(taskNode.getCompleteBatchNo(), false);
 
-                ProductionresourcePosition po = logical(robotList, targetStorge, zone);
+                ProductionresourcePosition po = logical(robotList, targetStorge,dataMap);
                 //机器人手抓没被锁定,并且有空闲未知
                 if (po != null) {
                     jqrStorge = storgeService.getById(jqrMap.get(DemoLineConstant.DEMOLINE_RJQR_ZS).get(0).getStorgeId());
@@ -742,7 +748,7 @@ public class TaskWorkNode {
                 jqrStorge = storgeService.getById(robotList.get(0).getStorgeId());
 
                 dataMap.put("method", "GetServoStacker");
-                if (logical(robotList, targetStorge, zone) != null) {
+                if (logical(robotList, targetStorge, dataMap) != null) {
                     Storge startStore = workpieceService.getWorkPieceStock(taskNode.getCompleteBatchNo(), false);
 
                     dataMap.put("fromStorge", startStore);
@@ -832,7 +838,14 @@ public class TaskWorkNode {
      * @param robotList
      * @return
      */
-    public ProductionresourcePosition logical(List<ProductionresourcePosition> robotList, Storge targetStorge, ZZone zone) {
+    public ProductionresourcePosition logical(List<ProductionresourcePosition> robotList, Storge targetStorge, Map<String, Object> dataMap) {
+        ZZone zone = dataMap.get("zone") == null ? null : (ZZone) dataMap.get("zone");
+        ZZone bomzZone = dataMap.get("bomzZone") == null ? null : (ZZone) dataMap.get("bomzZone");
+        //自动模式下,如果下个节点是上下料站,不让走下去
+        if(bomzZone!=null&&"1".equals(bomzZone.getRunMode())){//自动模式,
+            return null;
+        }
+
         //设备不存在
         if (checkRobot(robotList, zone.getName())) {
             return null;
@@ -878,12 +891,24 @@ public class TaskWorkNode {
         String exchangeZoneFlag = workpiece.getExchangeZoneFlag();
         Long exchangeProcedureId = workpiece.getExchangeProcedureId();
         if(StringUtil.isNotEmpty(exchangeZoneFlag)&&exchangeProcedureId!=null){//正在切换产线
-            if(exchangeProcedureId.longValue()!=taskNode.getProcedureId().longValue()){
+            if(exchangeProcedureId.longValue()!=taskNode.getProcedureId().longValue()&&isSchedule()){
                 dataMap.put("result", false);
                 dataMap.put("msg", DictionaryKey.NodeException.RE_SCHEDURE);
             }
         }
         return dataMap;
     }
+
+    /**
+     *
+     * @return
+     */
+    public boolean isSchedule(){
+        //根据排产的缓存来判断是否在排产中
+        if(msgUtil.redis_get(YunjianConstant.YUNJIAN_SHEDULE_FLAG)!=null){
+            return true;
+        }
+        return false;
+    }
 }
 

+ 4 - 2
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/InspectionServiceImpl.java

@@ -122,13 +122,15 @@ public class InspectionServiceImpl extends SuperServiceImpl<InspectionMapper, In
 
     private List<TaskNode> addSupportNodes(List<TaskNode> supportNodes, boolean isHeader, Long taskId, List<TaskNode> taskNodeList,TaskNode lastNode, String zoneName){
         List<TaskNode> dataList = dozer.mapList(supportNodes, TaskNode.class);
+
         dataList.forEach(item->{
             item.setTaskId(taskId).setTaskNodeNo(codeRuleService.getBillCode(CodeRuleModule.CODE_RULE_TASK_NODE))
                     .setExeStatus("1").setPrority(lastNode.getPrority()+1+taskNodeList.size());
             if(isHeader){
                 item.setNodeName("抽检:"+item.getNodeName());
             }else{
-                if(item.getAutoNode().isFinal()){
+                TaskNode finalNode = dataList.get(dataList.size()-1);
+                if(item == finalNode){
                     item.setNodeName("抽检:运到"+ zoneName +"线接驳位");
                 }else{
                     item.setNodeName("抽检:"+item.getNodeName());
@@ -168,7 +170,7 @@ public class InspectionServiceImpl extends SuperServiceImpl<InspectionMapper, In
 
         //获取产线名称
         String zoneNo = zoneService.getById(model.getZoneId()).getNo();
-        String zoneName = (zoneNo=="capsule")? "舱体":((zoneNo=="framework")? "框体": "保障中心");
+        String zoneName = zoneNo.equals("capsule")? "舱体":((zoneNo.equals("framework")? "框体": "保障中心"));
 
         BomProcedure bomProcedure = bomProcedureService.getById(task.getProcedureId());
 

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

@@ -15,6 +15,7 @@ import com.github.zuihou.base.R;
 import com.github.zuihou.base.service.SuperServiceImpl;
 import com.github.zuihou.business.DemoLine.DemoCacheKey;
 import com.github.zuihou.business.DemoLine.DemoLineConstant;
+import com.github.zuihou.business.DemoLine.YunjianConstant;
 import com.github.zuihou.business.aps.algorithm.ga.GAScheduler;
 import com.github.zuihou.business.aps.instance.domain.basicdata.CandidateProcess;
 import com.github.zuihou.business.aps.instance.domain.basicdata.Instance;
@@ -41,6 +42,7 @@ import com.github.zuihou.business.productionResourceCenter.entity.Productionreso
 import com.github.zuihou.business.productionResourceCenter.entity.ZZone;
 import com.github.zuihou.business.productionResourceCenter.service.RepairService;
 import com.github.zuihou.business.util.DynamicRabbitMq;
+import com.github.zuihou.business.util.MsgUtil;
 import com.github.zuihou.common.constant.BizConstant;
 import com.github.zuihou.common.constant.CodeRuleModule;
 import com.github.zuihou.common.constant.ParameterKey;
@@ -153,6 +155,8 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
     private ProductionresourceBizMapper productionresourceBizMapper;
     @Autowired
     private MMeterialReceiveLogMapper mMeterialReceiveLogMapper;
+    @Autowired
+    private MsgUtil msgUtil;
 
     @Override
     public IPage<Order> pageList(IPage page,String sustDesc, LbqWrapper<Order> wrapper) {
@@ -760,6 +764,7 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
 
     @Override
     public R reschedulingPlanTasks() {
+        msgUtil.redis_set(YunjianConstant.YUNJIAN_SHEDULE_FLAG,YunjianConstant.YUNJIAN_SHEDULE_FLAG);
         // 找出当前所有的订单计划还未开始加工的工件进行重排
         QueryWrapper<Plan> planWrapper = new QueryWrapper<Plan>();
         planWrapper.eq("plan_status", "2");
@@ -921,6 +926,7 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
             taskList.add(task);
         }
         taskService.updateBatchById(taskList);
+        msgUtil.redis_del(YunjianConstant.YUNJIAN_SHEDULE_FLAG);
         return R.success();
     }
 

+ 6 - 2
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/TaskNodeServiceImpl.java

@@ -1262,12 +1262,16 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
         if (n > 0) {//
             List<TaskNode> taskNodeList = baseMapper.selectList(Wraps.<TaskNode>lbQ().eq(TaskNode::getCompleteBatchNo, taskNode.getCompleteBatchNo()).orderByAsc(TaskNode::getCompleteBatchSort).gt(TaskNode::getCompleteBatchSort, taskNode.getCompleteBatchSort()));
             if (CollectionUtil.isNotEmpty(taskNodeList)) {
-                nextTaskNode = taskNodeList.get(n - 1);
+                if(taskNodeList.size()>n-1){
+                    nextTaskNode = taskNodeList.get(n - 1);
+                }
             }
         } else {//取前面
             List<TaskNode> taskNodeList = baseMapper.selectList(Wraps.<TaskNode>lbQ().eq(TaskNode::getCompleteBatchNo, taskNode.getCompleteBatchNo()).orderByDesc(TaskNode::getCompleteBatchSort).lt(TaskNode::getCompleteBatchSort, taskNode.getCompleteBatchSort()));
             if (CollectionUtil.isNotEmpty(taskNodeList)) {
-                nextTaskNode = taskNodeList.get(-n - 1);
+                if(taskNodeList.size()>(-n - 1)) {
+                    nextTaskNode = taskNodeList.get(-n - 1);
+                }
             }
         }
         taskNode.setNextNode(nextTaskNode);

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

@@ -564,6 +564,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                 xbkFlag = "1";
             }
         }else {
+            //
             if(bomProcedureType.equals("下料")){
                 // 下料特殊处理,动态查找可用立库位子存放下料后的子盘夹具
                 Long storgeId = getLikuStockInList();
@@ -578,6 +579,13 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                         targetStorge = storgeService.getById(targetList.get(0).getStorgeId());
                         returnMap.put("store",targetStorge);
                         returnMap.put("targetxbk","0");
+
+                        if("1".equals(bomzZone.getRunMode())){//自动模式下,
+                            TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode,1);
+                            if("04".equals(nextTaskNode.getInterfaceType())){//上料、下料、翻面
+                                xbkFlag = "1";
+                            }
+                        }
                     }else{//需要放到线边库
                         xbkFlag = "1";
                     }

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

@@ -9,6 +9,7 @@ import com.github.zuihou.business.operationManagementCenter.dao.TTaskMapper;
 import com.github.zuihou.business.operationManagementCenter.dao.WorkpieceMapper;
 import com.github.zuihou.business.operationManagementCenter.entity.TTask;
 import com.github.zuihou.business.operationManagementCenter.entity.TWorkpiece;
+import com.github.zuihou.business.operationManagementCenter.service.OrderService;
 import com.github.zuihou.business.operationManagementCenter.service.WorkpieceService;
 import com.github.zuihou.business.productionResourceCenter.dao.ZZoneMapper;
 import com.github.zuihou.business.productionResourceCenter.dao.ZZoneProductionresourceMapper;
@@ -69,6 +70,9 @@ public class ZZoneServiceImpl extends SuperServiceImpl<ZZoneMapper, ZZone> imple
     @Autowired
     private ZZoneService zoneService;
 
+    @Autowired
+    private OrderService orderService;
+
     @Autowired
     private ZZoneProductionresourceService zoneProductionresourceService;
 
@@ -138,6 +142,9 @@ public class ZZoneServiceImpl extends SuperServiceImpl<ZZoneMapper, ZZone> imple
 
         updateById(zZone);
 
+        //重新排产
+        orderService.reschedulingPlanTasks();
+
         //修改workpiece当前正在执行的工序
         //先查出
         List<TWorkpiece>workpieceList = workpieceService.list(Wraps.<TWorkpiece>lbQ().eq(TWorkpiece::getIsEnd, "0"));

+ 1 - 1
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/operationManagementCenter/InspectionController.java

@@ -65,7 +65,7 @@ public class InspectionController extends SuperController<InspectionService, Lon
         LbqWrapper<Inspection> wrapper = wrap.lambda();
         Inspection inspection = BeanUtil.toBean(data, Inspection.class);
 
-        wrapper.eq(Inspection::getPlanId, inspection.getPlanId()).orderByDesc(Inspection::getCreateTime);
+        wrapper.eq(Inspection::getPlanId, inspection.getPlanId()).orderByAsc(Inspection::getCreateTime);
         baseService.pageList(page, wrapper);
     }