Bladeren bron

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

laoyao 2 jaren geleden
bovenliggende
commit
1b5e7fcd06

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

@@ -172,5 +172,7 @@ public interface StockInfoService extends SuperService<StockInfo> {
 
     R manualStockOut(String goodsId, Long storgeId, String category);
 
-    R procedurePlateStockIn(BigDecimal uniqueCode, Long valueOf, Long storgeId);
+    R procedurePlateStockIn(BigDecimal uniqueCode, Long goodsId, Long storgeId);
+
+    R procedureMeterialStockIn(String uniqueCode, Long goodsId, Long storgeId);
 }

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

@@ -378,7 +378,11 @@ public class StockInfoServiceImpl extends SuperServiceImpl<StockInfoMapper, Stoc
 
     /**
      * 工序原材料入库
-     * @param map
+     * @param bomProcedureMeterial
+     * @param storgeId
+     * @param uniqueCode
+     * @param completeBatchNo
+     * @return
      */
     @Override
     public R<String> meterialStockIn(BomProcedureMeterial bomProcedureMeterial,Long storgeId,String uniqueCode,String completeBatchNo) {
@@ -695,4 +699,20 @@ public class StockInfoServiceImpl extends SuperServiceImpl<StockInfoMapper, Stoc
         stockLogService.saveLog(infoBean,BizConstant.STOCK_TYPE_IN,"");
         return R.success();
     }
+
+    @Override
+    public R procedureMeterialStockIn(String uniqueCode, Long goodsId, Long storgeId){
+        StockInfo infoBean = new StockInfo();
+        infoBean.setStorgeId(storgeId);
+        infoBean.setLockStatus("1");
+        infoBean.setGoodsId(goodsId);
+        infoBean.setGoodsType("4");
+        infoBean.setNum(1);
+        infoBean.setUniqueCode(uniqueCode);
+        infoBean.setCompleteBatchNo("");
+        save(infoBean);
+        //库存日志
+        stockLogService.saveLog(infoBean,BizConstant.STOCK_TYPE_IN,"");
+        return R.success();
+    }
 }

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

@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollectionUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.alibaba.ttl.threadpool.agent.TtlAgent;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.github.zuihou.base.R;
@@ -20,7 +21,6 @@ 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.externalApi.dto.ManualInfo;
-import com.github.zuihou.business.mq.TaskWorkNode;
 import com.github.zuihou.business.operationManagementCenter.dao.*;
 import com.github.zuihou.business.operationManagementCenter.dto.TaskNodeCallBackDTO;
 import com.github.zuihou.business.operationManagementCenter.entity.*;
@@ -37,7 +37,6 @@ import com.github.zuihou.business.productionResourceCenter.entity.ResourceAutoCo
 import com.github.zuihou.business.productionResourceCenter.entity.ResourceBusiness;
 import com.github.zuihou.business.productionResourceCenter.service.ProductionresourcePositionService;
 import com.github.zuihou.business.productionResourceCenter.service.ResourceAutoCodeService;
-import com.github.zuihou.business.productionResourceCenter.service.ResourceBusinessService;
 import com.github.zuihou.business.productionResourceCenter.service.ZZoneService;
 import com.github.zuihou.business.util.DynamicRabbitMq;
 import com.github.zuihou.business.util.ManualTaskOperatorUtil;
@@ -58,6 +57,7 @@ import com.github.zuihou.tenant.service.ProductionlineService;
 import com.github.zuihou.tenant.service.ProductionlineUserService;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.ss.formula.functions.T;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -168,6 +168,9 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
     @Autowired
     private PlanMapper planMapper;
 
+    @Autowired
+    private PlanProductMapper planProductMapper;
+
     @Autowired
     private StorgeService storgeService;
 
@@ -189,9 +192,6 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
     @Autowired
     private DynamicRabbitMq dynamicRabbitMq;
 
-    @Autowired
-    private TaskWorkNode taskWorkNode;
-
     @Autowired
     private WorkpieceMapper workpieceMapper;
 
@@ -1993,6 +1993,14 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
                             saveStockLog(stockInfo,BizConstant.STOCK_TYPE_IN);
                             // 更新库位物料信息
                             stockInfoMapper.updateById(stockInfo);
+
+                            // 如果是订单的更新workpiece表的工件所在位子
+                            if(StringUtils.isNotBlank(currentTaskNode.getCompleteBatchNo())){
+                                TWorkpiece workpiece =  workpieceMapper.selectOne(Wraps.<TWorkpiece>lbQ().eq(TWorkpiece::getCompleteBatchNo,currentTaskNode.getCompleteBatchNo()));
+                                workpiece.setStorgeId(targetList.get(0).getStorgeId());
+                                workpieceMapper.updateById(workpiece);
+                            }
+
                         }
                         msgUtil.redis_del(manualInfo.getManualId());
                     }else{
@@ -2199,6 +2207,57 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
                     }
                     result = stockInfoService.procedurePlateStockIn(uniqueCode, Long.valueOf(goodsId), list.get(0).getStorgeId());
 
+                }else if("4".equals(category)){
+
+                    // 原材料
+                    // 判断创是否已经有子盘
+                    List<StockInfo> trayStockInfos = stockInfoMapper.selectList(Wraps.<StockInfo>lbQ().eq(StockInfo::getStorgeId, list.get(0).getStorgeId()).eq(StockInfo::getGoodsType,"2"));
+                    if(CollectionUtil.isEmpty(trayStockInfos)){
+                        return R.fail("请先创建子盘");
+                    }
+
+                    List<StockInfo> clampstockInfos = stockInfoMapper.selectList(Wraps.<StockInfo>lbQ().eq(StockInfo::getStorgeId, list.get(0).getStorgeId()).eq(StockInfo::getGoodsType,"1"));
+                    if(CollectionUtil.isEmpty(clampstockInfos)){
+                        return R.fail("请先创建夹具");
+                    }
+                    long planId = (null == conMap.get("planId") ? -1 : Long.valueOf(conMap.get("planId").toString()));
+                    // 0:上料 1:翻面
+                    long procedureType = (null == conMap.get("procedureType") ? -1 : Long.valueOf(conMap.get("procedureType").toString()));
+                    long completeBatchNo = (null == conMap.get("completeBatchNo") ? -1 : Long.valueOf(conMap.get("completeBatchNo").toString()));
+                    if(-1 != planId){
+                        PlanProduct planProduct = planProductMapper.selectOne(Wraps.<PlanProduct>lbQ().eq(PlanProduct::getPlanId, planId));
+                        Long bomId = planProduct.getBomId();
+                        BBom bom= bomMapper.selectOne(Wraps.<BBom>lbQ().eq(BBom::getId,bomId));
+                        Long meterialmId = bom.getMeterialId();
+                        String uniqueCode = null ==conMap.get("uniqueCode") ? "" : conMap.get("uniqueCode").toString();
+                        result = stockInfoService.procedureMeterialStockIn(uniqueCode, Long.valueOf(meterialmId), list.get(0).getStorgeId());
+
+                        // 翻面登记原材料
+                        if("1".equals(procedureType)){
+                            // 更新该工件节点和工艺工薪信息
+                            TWorkpiece tWorkpiece = workpieceMapper.selectOne(Wraps.<TWorkpiece>lbQ().eq(TWorkpiece::getCompleteBatchNo,completeBatchNo));
+                            // 放到接驳位节点
+                            TaskNode taskNode = baseMapper.selectOne(Wraps.<TaskNode>lbQ().eq(TaskNode::getCompleteBatchNo,completeBatchNo).eq(TaskNode::getExeStatus,"1").orderByAsc(TaskNode::getCompleteBatchSort));
+                            taskNode.setEndTime(Calendar.getInstance().getTime());
+                            taskNode.setExeStatus("3");
+                            taskNode.setExeResult("1");
+                            baseMapper.updateById(taskNode);
+                            TTask task = taskMapper.selectOne(Wraps.<TTask>lbQ().eq(TTask::getCompleteBatchNo,completeBatchNo).eq(TTask::getProcedureId,taskNode.getProcedureId()));
+                            task.setEndTime(Calendar.getInstance().getTime());
+                            task.setStatus("3");
+                            taskMapper.updateById(task);
+
+                            // 如果是订单的更新workpiece表的工件所在位子
+                            if(StringUtils.isNotBlank(taskNode.getCompleteBatchNo())){
+                                TWorkpiece workpiece =  workpieceMapper.selectOne(Wraps.<TWorkpiece>lbQ().eq(TWorkpiece::getCompleteBatchNo,taskNode.getCompleteBatchNo()));
+                                workpiece.setStorgeId(list.get(0).getStorgeId());
+                                workpieceMapper.updateById(workpiece);
+                            }
+                        }
+                    }else{
+                        return R.fail("创建毛料请先指定订单计划");
+                    }
+
                 }
             }
         }

+ 34 - 7
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/WorkpieceServiceImpl.java

@@ -13,13 +13,8 @@ import com.github.zuihou.business.edgeLibrary.entity.StockInfo;
 import com.github.zuihou.business.edgeLibrary.entity.Storge;
 import com.github.zuihou.business.externalApi.dto.ManualInfo;
 import com.github.zuihou.business.mq.HandModeWorkNode;
-import com.github.zuihou.business.operationManagementCenter.dao.PlanMapper;
-import com.github.zuihou.business.operationManagementCenter.dao.TTaskMapper;
-import com.github.zuihou.business.operationManagementCenter.dao.WorkpieceMapper;
-import com.github.zuihou.business.operationManagementCenter.entity.Plan;
-import com.github.zuihou.business.operationManagementCenter.entity.TTask;
-import com.github.zuihou.business.operationManagementCenter.entity.TWorkpiece;
-import com.github.zuihou.business.operationManagementCenter.entity.TaskNode;
+import com.github.zuihou.business.operationManagementCenter.dao.*;
+import com.github.zuihou.business.operationManagementCenter.entity.*;
 import com.github.zuihou.business.operationManagementCenter.service.TaskNodeService;
 import com.github.zuihou.business.operationManagementCenter.service.WorkpieceService;
 import com.github.zuihou.business.productionReadyCenter.dao.BBomMapper;
@@ -122,6 +117,10 @@ public class WorkpieceServiceImpl extends SuperServiceImpl<WorkpieceMapper, TWor
     private DynamicRabbitMq dynamicRabbitMq;
     @Autowired
     private PlanMapper planMapper;
+    @Autowired
+    private OrderMapper orderMapper;
+    @Autowired
+    private OrderProductMapper orderProductMapper;
 
     private static ArrayList<String> robotTaskNodes = new ArrayList<>();
     static {
@@ -344,6 +343,20 @@ public class WorkpieceServiceImpl extends SuperServiceImpl<WorkpieceMapper, TWor
             returnMap.put("name", position0.getName());
             returnMap.put("lockStatus", position0.getLockStatus());
             returnMap.put("resourceId", position0.getResourceId());
+
+            // begin add by yejian on 20221102 手动页面增加库位工件订单信息方便后续单线运行是拖动工件工人能清洗知道是那个工件那个工序
+            List<Storge> pointStorgeList = storgeMapper.selectList(Wraps.<Storge>lbQ().eq(Storge::getPointId, key));
+            // 查找工件订单信息
+            TWorkpiece tWorkpiece = getWorkPiece(pointStorgeList.get(0).getCampId());
+            // 订单、产品、工艺
+            Order order = orderMapper.selectById(tWorkpiece.getOrderNo());
+            returnMap.put("completeBatchNo", tWorkpiece.getCompleteBatchNo());
+            returnMap.put("orderName", order.getOrderName());
+            returnMap.put("bomName", tWorkpiece.getBomName());
+            returnMap.put("procedureName", tWorkpiece.getProcedureName());
+
+            // end add by yejian on 20221102 手动页面增加库位工件订单信息方便后续单线运行是拖动工件工人能清洗知道是那个工件那个工序
+
             List<Map> l = new ArrayList<>();
             for (ProductionresourcePosition p : subList) {
                 if (p.getGoodsId() != null) {
@@ -403,6 +416,20 @@ public class WorkpieceServiceImpl extends SuperServiceImpl<WorkpieceMapper, TWor
             returnMap.put("name", position0.getName());
             returnMap.put("lockStatus", position0.getLockStatus());
             returnMap.put("resourceId", position0.getResourceId());
+
+            // begin add by yejian on 20221102 手动页面增加库位工件订单信息方便后续单线运行是拖动工件工人能清洗知道是那个工件那个工序
+            List<Storge> pointStorgeList = storgeMapper.selectList(Wraps.<Storge>lbQ().eq(Storge::getPointId, key));
+            // 查找工件订单信息
+            TWorkpiece tWorkpiece = getWorkPiece(pointStorgeList.get(0).getCampId());
+            // 订单、产品、工艺
+            Order order = orderMapper.selectById(tWorkpiece.getOrderNo());
+            returnMap.put("completeBatchNo", tWorkpiece.getCompleteBatchNo());
+            returnMap.put("orderName", order.getOrderName());
+            returnMap.put("bomName", tWorkpiece.getBomName());
+            returnMap.put("procedureName", tWorkpiece.getProcedureName());
+
+            // end add by yejian on 20221102 手动页面增加库位工件订单信息方便后续单线运行是拖动工件工人能清洗知道是那个工件那个工序
+
             List<Map> l = new ArrayList<>();
             for (ProductionresourcePosition p : subList) {
                 if (p.getGoodsId() != null) {

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

@@ -235,7 +235,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
         // 装配线边库数量,启用并且无料的库位
         List<BBom> zoneBoms = bBomMapper.selectList(Wraps.<BBom>lbQ().in(BBom::getZoneId, bomZzoneId));
         List<Long> zoneBomIds = zoneBoms.stream().map(p -> p.getId()).collect(Collectors.toList());
-        if (taskNode.getCompleteBatchSort() == 1){
+        if (taskNode.getCompleteBatchSort() == 1 && 0==orderPlan.getSingleRunFlag()){
             List<ProductionresourcePosition> assembleXbkUseableList = productionresourcePositionService.getFreeProductionresourcePositionByNos(assembleZoneXbkNo.split(","));
 
             List<ZZoneProductionresource> assembleZoneProductionresources = zZoneProductionresourceMapper.selectList(Wraps.<ZZoneProductionresource>lbQ().eq(ZZoneProductionresource::getZoneId, zoneId));
@@ -374,11 +374,12 @@ public class RobotNodeServiceImpl implements NodeOperationService {
 
         List<StockInfo> flikustockInfos = null;
 
+        TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
 
-        if(taskNode.getCompleteBatchSort()==1){
+        if(taskNode.getCompleteBatchSort()==1 && count == 0){
             // 判断是否是单线单独运行
             if(1 == orderPlan.getSingleRunFlag()){
-                flikustockInfos = this.getProductionLineXbkStockList(task);
+                flikustockInfos = this.getProductionLineXbkStockList(nextTaskNode,task);
             }else{
                 flikustockInfos = this.getLikuStockList(task);
             }
@@ -394,7 +395,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                     //判断机器人是否为空
                     Map<String, List<ProductionresourcePosition>> jqrMap = robotList.stream().collect(groupingBy(ProductionresourcePosition::getPointId));
 
-                    TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
+
 
                     //获取当前位置
                     if(CollectionUtil.isNotEmpty(flikustockInfos)){//
@@ -443,7 +444,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
 
                                 log.info("节点{}检查机器人缓存位库位数{}",taskNode.getId(),robotHcwList.size());
                                 nextTaskNode = taskNodeService.getNextNTaskNode(taskNode,1);
-                                if (!targetStorgeResourceId.equals(nextTaskNode.getTargetResourceId()) && robotHcwList.size() > 1){
+                                if (null != nextTaskNode.getTargetResourceId() && !targetStorgeResourceId.equals(nextTaskNode.getTargetResourceId()) && robotHcwList.size() > 1){
                                     targetStorge = hcwStorge;
                                     msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_HCW_XBK_FLAG + nextTaskNode.getId(), targetxbk, 1, TimeUnit.DAYS);
                                 }else{
@@ -518,8 +519,6 @@ public class RobotNodeServiceImpl implements NodeOperationService {
 
                 }
             }else if (BizConstant.ROBOT_TYPE_NOCACHE.equals(zoneService.getRobotTypebyZone(zoneName))) {
-                TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
-
                 BomProcedure procedure = bomProcedureService.getById(task.getProcedureId());
                 String zoneType = (null == msgUtil.redis_get(ParameterKey.PARAMETERS)? "": ((Map<String,String>)msgUtil.redis_get(ParameterKey.PARAMETERS)).get(ParameterKey.ZONE_TYPE).toString());
                 if(zoneType.equals(ParameterKey.ZONE_YJ)
@@ -655,13 +654,15 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                         boolean hasJqrhcwPartFlag = false;
                         String jrqHcwPartPoint =  msgUtil.redis_get(deviceArr[0] + "postion") == null ? "": String.valueOf(msgUtil.redis_get(deviceArr[0] + "postion"));
                         log.info("节点{}当前机器人所在位子{}",taskNode.getId(),jrqHcwPartPoint);
+
                         for(Storge jqrHcwStorge : jrqHcwStorges){
                             long jqrHcwStorgeTaskNodeId = jqrHcwStorge.getCampId();
                             TaskNode jqrHcwStorgeTaskNode = taskNodeService.getById(jqrHcwStorgeTaskNodeId);
-                            ProductionresourcePosition jqrHcwStorgeTaskNodeResource = productionresourcePositionMapper.selectOne(Wraps.<ProductionresourcePosition>lbQ().eq(ProductionresourcePosition::getResourceId,jqrHcwStorgeTaskNode.getTargetResourceId()));
-                            log.info("jqrHcwStorgeTaskNode.getCompleteBatchNo()={}",jqrHcwStorgeTaskNode.getCompleteBatchNo());
-                            log.info("taskNode.getCompleteBatchNo()={}",taskNode.getCompleteBatchNo());
                             if(!jqrHcwStorgeTaskNode.getCompleteBatchNo().equals(taskNode.getCompleteBatchNo())){
+                                ProductionresourcePosition jqrHcwStorgeTaskNodeResource = productionresourcePositionMapper.selectOne(Wraps.<ProductionresourcePosition>lbQ().eq(ProductionresourcePosition::getResourceId,jqrHcwStorgeTaskNode.getTargetResourceId()));
+                                log.info("jqrHcwStorgeTaskNode.getCompleteBatchNo()={}",jqrHcwStorgeTaskNode.getCompleteBatchNo());
+                                log.info("taskNode.getCompleteBatchNo()={}",taskNode.getCompleteBatchNo());
+
                                 // 查询缓存位工件目标地址是否是机器人当前位子
                                 log.info("jqrHcwStorgeTaskNodeResource.getPointId()={}",jqrHcwStorgeTaskNodeResource.getPointId());
                                 log.info("jrqHcwPartPoint={}",jrqHcwPartPoint);
@@ -785,9 +786,8 @@ public class RobotNodeServiceImpl implements NodeOperationService {
      * @param task
      * @return
      */
-    private List<StockInfo> getProductionLineXbkStockList(TTask task) {
+    private List<StockInfo> getProductionLineXbkStockList(TaskNode nextTaskNode,TTask task) {
         List<StockInfo> returnList = null;
-        List<StockInfo> oneTray = null;
 
         List<Productionresource> productionresources = productionresourceBizMapper.selectList(Wraps.<Productionresource>lbQ().like(Productionresource::getCode,DictionaryKey.YJ_ZONE_XBK.get(bomzZone.getName())));
         List<Long> productionresourceIds = productionresources.stream().map(t->t.getId()).collect(Collectors.toList());
@@ -803,14 +803,32 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                 k = key;
                 // 只查找物料齐套的(托盘,夹具,原材料)
                 List<StockInfo> stockInfoList = map.get(key);
-                if(stockInfoList!=null && stockInfoList.size() == 3 ){
+                if(stockInfoList!=null && stockInfoList.size() == 1 ){
                     returnList = stockInfoList;
+                    // 更新工件物料所在位子workpiece表
+                    TWorkpiece workpiece = workpieceService.getOne(Wraps.<TWorkpiece>lbQ().eq(TWorkpiece::getCompleteBatchNo,task.getCompleteBatchNo()));
+                    workpiece.setStorgeId(stockInfoList.get(0).getStorgeId());
+                    workpieceService.updateById(workpiece);
+
+                    Storge storge = storgeMapper.selectOne(Wraps.<Storge>lbQ().eq(Storge::getId,returnList.get(0).getStorgeId()));
+                    storge.setCompleteBatchNo(task.getCompleteBatchNo());
+                    storge.setCampId(nextTaskNode.getId());
+                    storgeMapper.updateAllById(storge);
+
+                    List<StockInfo> stockInfos= stockInfoMapper.selectList(Wraps.<StockInfo>lbQ().eq(StockInfo::getStorgeId,stockInfoList.get(0).getStorgeId()));
+                    for(StockInfo stockInfo : stockInfos){
+                        stockInfo.setCompleteBatchNo(task.getCompleteBatchNo());
+                        stockInfoMapper.updateAllById(stockInfo);
+                    }
+
                     break;
                 }else{
                     continue;
                 }
             }
         }
+
+
         return returnList;
     }
 
@@ -887,7 +905,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
 
         if("1".equals(findAgvFlag)){ //需要提前锁定下个接驳位
 
-            if("1".equals(orderPlan.getSingleRunFlag())){
+            if(1==orderPlan.getSingleRunFlag()){
                 // 单线运行,直接不找agv,驱动机器人帮运至线边库存放
 // 判断当前节点设备所属产线,如果是保障平台,区分订单是舱体还是框体
                 if("safeguard".equals(zZone.getNo())){

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

@@ -53,10 +53,7 @@ import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 import static com.github.zuihou.utils.BizAssert.isFalse;
@@ -204,8 +201,7 @@ public class ZZoneServiceImpl extends SuperServiceImpl<ZZoneMapper, ZZone> imple
 //        List<TWorkpiece>workpieceList = workpieceService.list(Wraps.<TWorkpiece>lbQ().eq(TWorkpiece::getIsEnd, "0").in(TWorkpiece::getBomId,bomIdList));
         List<Order> orderList = orderService.list(Wraps.<Order>lbQ().eq(Order::getZoneId, data.getId()));
         List<Long> orderIds =  orderList.stream().map(p -> p.getId()).collect(Collectors.toList());
-
-        List<Plan> plans = planMapper.selectList(Wraps.<Plan>lbQ().eq(Plan::getPlanStatus, "2").eq(Plan::getProduceStatus,"2").in(Plan::getOrderId,orderIds));
+        List<Plan> plans = planMapper.selectList(Wraps.<Plan>lbQ().eq(Plan::getPlanStatus, "2").in(Plan::getProduceStatus, new ArrayList<>(Arrays.asList(1,2))).in(Plan::getOrderId,orderIds));
 
         if(plans.size() > 0){
             List<Long> planIds =  plans.stream().map(p -> p.getId()).collect(Collectors.toList());

+ 32 - 2
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/util/MsgUtil.java

@@ -116,6 +116,9 @@ public class MsgUtil implements ApplicationContextAware {
     @Autowired
     private TTaskTestUnqualifiedBomMapper taskTestUnqualifiedBomMapper;
 
+    @Autowired
+    private TTaskMapper taskMapper;
+
     @Override
     public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
         MsgUtil.applicationContext = applicationContext;
@@ -525,7 +528,22 @@ public class MsgUtil implements ApplicationContextAware {
 
                         jsonObject.put("taskNodeId",nextTaskNode.getId().toString());
                         jsonObject.put("bizType", BizConstant.MQ_TASK_NODE_TYPE_COMMON);
-                        dynamicRabbitMq.sendMsg(nextTaskNode.getResourceId().toString(),jsonObject.toString());
+
+                        if(1 == plan.getSingleRunFlag() && "03".equals(nextTaskNode.getInterfaceType())){
+                            // 更新agv搬运节点已经完成,工序已经完成
+                            nextTaskNode.setEndTime(Calendar.getInstance().getTime());
+                            nextTaskNode.setExeStatus("3");
+                            nextTaskNode.setExeResult("1");
+                            taskNodeService.updateById(nextTaskNode);
+
+                            task.setEndTime(Calendar.getInstance().getTime());
+                            task.setStatus("3");
+                            taskMapper.updateById(task);
+
+                        }else{
+                            dynamicRabbitMq.sendMsg(nextTaskNode.getResourceId().toString(),jsonObject.toString());
+                        }
+
                     }
             }else if(callBackJson.containsKey(BizConstant.MQ_TASK_NODE_TYPE_VIRTUALLY)){//翻面
                 int count =  callBackJson.getString(taskNode.getId().toString()+"count")==null?-1:Integer.parseInt(callBackJson.getString(taskNode.getId().toString()+"count"));
@@ -561,7 +579,19 @@ public class MsgUtil implements ApplicationContextAware {
                     }
                 }
                 jsonObject.put("taskNodeId",nextTaskNode.getId().toString());
-                dynamicRabbitMq.sendMsg(nextTaskNode.getResourceId().toString(),jsonObject.toString());
+                if(1 == plan.getSingleRunFlag() && "03".equals(nextTaskNode.getInterfaceType())){
+                    // 更新agv搬运节点已经完成,工序已经完成
+                    nextTaskNode.setEndTime(Calendar.getInstance().getTime());
+                    nextTaskNode.setExeStatus("3");
+                    nextTaskNode.setExeResult("1");
+                    taskNodeService.updateById(nextTaskNode);
+
+                    task.setEndTime(Calendar.getInstance().getTime());
+                    task.setStatus("3");
+                    taskMapper.updateById(task);
+                }else{
+                    dynamicRabbitMq.sendMsg(nextTaskNode.getResourceId().toString(),jsonObject.toString());
+                }
             }
         }
     }