|
@@ -9,29 +9,24 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.github.zuihou.base.R;
|
|
|
-import com.github.zuihou.base.controller.QueryController;
|
|
|
import com.github.zuihou.base.controller.SuperSimpleController;
|
|
|
import com.github.zuihou.base.request.PageParams;
|
|
|
-import com.github.zuihou.business.dispatchRecord.entity.DispatchException;
|
|
|
-import com.github.zuihou.business.dispatchRecord.entity.DispatchRecord;
|
|
|
-import com.github.zuihou.business.dispatchRecord.service.DispatchExceptionService;
|
|
|
-import com.github.zuihou.business.dispatchRecord.service.DispatchRecordService;
|
|
|
import com.github.zuihou.business.externalApi.service.AgvHikOrderInfoService;
|
|
|
-import com.github.zuihou.business.operationManagementCenter.entity.Order;
|
|
|
+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.service.TaskNodeService;
|
|
|
+import com.github.zuihou.business.operationManagementCenter.service.TaskService;
|
|
|
import com.github.zuihou.business.operationManagementCenter.service.WorkpieceService;
|
|
|
+import com.github.zuihou.business.productionReadyCenter.dao.BBomMapper;
|
|
|
import com.github.zuihou.business.productionReadyCenter.entity.AAutoNodeLog;
|
|
|
+import com.github.zuihou.business.productionReadyCenter.entity.BBom;
|
|
|
import com.github.zuihou.business.productionReadyCenter.service.AAutoNodeLogService;
|
|
|
import com.github.zuihou.business.productionResourceCenter.dao.ZZoneProductionresourceMapper;
|
|
|
import com.github.zuihou.business.productionResourceCenter.entity.ZZone;
|
|
|
-import com.github.zuihou.business.productionResourceCenter.entity.ZZoneProductionresource;
|
|
|
import com.github.zuihou.business.productionResourceCenter.service.ZZoneService;
|
|
|
import com.github.zuihou.business.util.MsgUtil;
|
|
|
import com.github.zuihou.common.constant.CacheKey;
|
|
|
-import com.github.zuihou.common.constant.DictionaryKey;
|
|
|
-import com.github.zuihou.common.constant.ParameterKey;
|
|
|
import com.github.zuihou.common.util.DateUtil;
|
|
|
import com.github.zuihou.context.BaseContextHandler;
|
|
|
import com.github.zuihou.database.mybatis.conditions.Wraps;
|
|
@@ -51,15 +46,11 @@ import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
-import java.lang.invoke.MethodType;
|
|
|
import java.lang.reflect.Field;
|
|
|
-import java.lang.reflect.Method;
|
|
|
-import java.time.LocalDateTime;
|
|
|
import java.util.Date;
|
|
|
import java.util.Iterator;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
@Slf4j
|
|
|
@Validated
|
|
@@ -84,6 +75,9 @@ public class DispatchExceptionController extends SuperSimpleController<AAutoNode
|
|
|
@Autowired
|
|
|
private TaskNodeService taskNodeService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private TaskService taskService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private ZZoneProductionresourceMapper zZoneProductionresourceMapper;
|
|
|
|
|
@@ -92,6 +86,8 @@ public class DispatchExceptionController extends SuperSimpleController<AAutoNode
|
|
|
@Autowired
|
|
|
private AgvHikOrderInfoService agvHikOrderInfoService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private BBomMapper bBomMapper;
|
|
|
|
|
|
@ApiOperation(value = "查询对话调度异常", notes = "查询对话调度异常")
|
|
|
@PostMapping("/page")
|
|
@@ -188,9 +184,13 @@ public class DispatchExceptionController extends SuperSimpleController<AAutoNode
|
|
|
return R.fail("指令请求不存在");
|
|
|
}
|
|
|
TaskNode taskNode = taskNodeService.getById(taskNodeId);
|
|
|
- ZZoneProductionresource zoneProductionresource = zZoneProductionresourceMapper.selectOne(Wraps.<ZZoneProductionresource>lbQ().eq(ZZoneProductionresource::getResourceId,taskNode.getResourceId()));
|
|
|
- ZZone zZone = zoneService.getById(zoneProductionresource.getZoneId());
|
|
|
- if(zZone.getRunMode().equals("2")){
|
|
|
+ //ZZoneProductionresource zoneProductionresource = zZoneProductionresourceMapper.selectOne(Wraps.<ZZoneProductionresource>lbQ().eq(ZZoneProductionresource::getResourceId,taskNode.getResourceId()));
|
|
|
+ //ZZone zZone = zoneService.getById(zoneProductionresource.getZoneId());
|
|
|
+ TTask task = taskService.getById(taskNode.getTaskId());
|
|
|
+ BBom bom = bBomMapper.selectById(task.getBomId());
|
|
|
+ ZZone zZone = zoneService.getById(bom.getZoneId());
|
|
|
+
|
|
|
+ if(!zZone.getRunMode().equals("2")){
|
|
|
return R.fail("指令模式必须在手动模式下才可以执行,请确认产线模式");
|
|
|
}
|
|
|
//清除资源锁定
|
|
@@ -202,17 +202,6 @@ public class DispatchExceptionController extends SuperSimpleController<AAutoNode
|
|
|
return R.fail("指令重发失败");
|
|
|
}
|
|
|
}else{
|
|
|
-// taskNodeService.freeLock(taskNode.getCompleteBatchNo());
|
|
|
-
|
|
|
- // 判断该节点使用那条线的plc
|
|
|
-// Map<String, String> plcInfo = DictionaryKey.PLC_CATEGORY.get(zZone.getNo());
|
|
|
-// String paramKey = zZone.getNo() + "_plc";
|
|
|
-// String plcUrl = (null == msgUtil.redis_get(ParameterKey.PARAMETERS)? "": ((Map<String,String>)msgUtil.redis_get(ParameterKey.PARAMETERS)).get(paramKey).toString());
|
|
|
-//
|
|
|
-// // TODO 后续删除代码,目前条用模拟接口
|
|
|
-// plcUrl = plcUrl.replace("8081","8083");
|
|
|
- //String plcUrl =
|
|
|
- //String plcUrl = conMap.get("instructionUrl") + "/api/" + conMap.get("method").toString();
|
|
|
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8"));
|
|
@@ -228,9 +217,10 @@ public class DispatchExceptionController extends SuperSimpleController<AAutoNode
|
|
|
return R.fail("指令重发失败");
|
|
|
}else{
|
|
|
//将同一节点的指令请求日志状态批量改为处理
|
|
|
- List<Long> ids = aAutoNodeLogService.list(new LbqWrapper<AAutoNodeLog>().eq(AAutoNodeLog::getTaskNodeId, taskNodeId).eq(AAutoNodeLog::getStatus, "0").orderByAsc(AAutoNodeLog::getCreateTime)).stream().map(AAutoNodeLog::getId).collect(Collectors.toList());
|
|
|
+ //List<Long> ids = aAutoNodeLogService.list(new LbqWrapper<AAutoNodeLog>().eq(AAutoNodeLog::getTaskNodeId, taskNodeId).eq(AAutoNodeLog::getStatus, "0").orderByAsc(AAutoNodeLog::getCreateTime)).stream().map(AAutoNodeLog::getId).collect(Collectors.toList());
|
|
|
UpdateWrapper<AAutoNodeLog> updateWrapper = new UpdateWrapper<AAutoNodeLog>();
|
|
|
- updateWrapper.lambda().in(AAutoNodeLog::getId, ids.toArray()).set(AAutoNodeLog::getStatus, "1");
|
|
|
+ //updateWrapper.lambda().in(AAutoNodeLog::getId, ids.toArray()).set(AAutoNodeLog::getStatus, "1");
|
|
|
+ updateWrapper.lambda().eq(AAutoNodeLog::getId, id).set(AAutoNodeLog::getStatus, "1");
|
|
|
aAutoNodeLogService.update(updateWrapper);
|
|
|
}
|
|
|
}
|