2 Commits

Author SHA1 Message Date
3b9843bbd6 add:拼单逻辑 2026-07-20 19:04:28 +08:00
1c6a5b0417 fix:解决创建指令失败不下发电气问题 2026-05-29 10:38:26 +08:00
7 changed files with 109 additions and 22 deletions

View File

@@ -1083,7 +1083,8 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
private void updataTask(Instruction instructionDto, String newPoint) {
TaskDto taskUpdate = new TaskDto();
//TaskDto taskUpdate = new TaskDto();
TaskDto taskUpdate = taskserver.findByCodeFromCache(instructionDto.getTask_code());
if (AgvActionTypeEnum.IN_STOCK.getCode().equals(instructionDto.getAgv_action_type())) {
instructionDto.setStart_point_code(newPoint);
taskUpdate.setStart_point_code(newPoint);

View File

@@ -2,7 +2,9 @@ package org.nl.acs.device_driver.two_conveyor.hongxiang_device;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -14,6 +16,8 @@ import org.nl.acs.device_driver.FeedLmsRealFailed;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.ext.wms.data.one.ApplyLabelingAndBindingRequest;
import org.nl.acs.ext.wms.data.one.ApplyLabelingAndBindingResponse;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.history.ErrorUtil;
@@ -25,6 +29,8 @@ import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.storage_cell.domain.StorageCell;
import org.nl.acs.storage_cell.service.StorageCellService;
import org.nl.acs.task.service.TaskService;
import org.nl.config.SpringContextHolder;
import org.nl.config.language.LangProcess;
@@ -64,6 +70,9 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
@Autowired
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
@Autowired
private StorageCellService storageCellService = SpringContextHolder.getBean(StorageCellService.class);
private String error_type = "hx_error_type";
private Date instruction_require_time = new Date();
@@ -211,7 +220,7 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
if (finish == 1 && !requireSucess) {
//烘箱完成反馈LMS
// apply_finish();
apply_finish();
}
}
@@ -237,6 +246,39 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
last_currentC = currentC;
}
public synchronized boolean apply_finish() {
Date date = new Date();
if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
return false;
} else {
this.instruction_apply_time = date;
message = "烘箱完成反馈LMS...";
ApplyLabelingAndBindingRequest applyLabelingAndBindingRequest = new ApplyLabelingAndBindingRequest();
//JSONObject device_json = WQLObject.getWQLObject("acs_storage_cell").query("storage_code ='" + this.device_code + "'").uniqueResult(0);
StorageCell storageCell = storageCellService.getOne(new LambdaQueryWrapper<StorageCell>()
.eq(StorageCell::getStorage_code, this.device_code));
String start_point_code = null;
if (!ObjectUtil.isEmpty(storageCell)) {
//start_point_code = (String) device_json.get("parent_storage_code") == null ? this.device_code : (String) device_json.get("parent_storage_code");
start_point_code = storageCell.getParent_storage_code() == null ? this.device_code : storageCell.getParent_storage_code();
}
applyLabelingAndBindingRequest.setDevice_code(start_point_code);
applyLabelingAndBindingRequest.setType("3");
ApplyLabelingAndBindingResponse applyLabelingAndBindingResponse = acsToWmsService.applyLabelingAndBindingRequest(applyLabelingAndBindingRequest);
logServer.deviceExecuteLog(this.device_code, "", "", "烘拷完成,请求参数:" + JSON.toJSONString(applyLabelingAndBindingRequest));
if (applyLabelingAndBindingResponse.getstatus() == 200) {
requireSucess = true;
message = "烘箱完成反馈LMS成功...";
logServer.deviceExecuteLog(this.device_code, "", "", "烘拷完成请求成功,响应参数:" + JSON.toJSONString(applyLabelingAndBindingResponse));
} else {
requireSucess = true;
message = "烘箱完成反馈LMS失败" + String.valueOf(applyLabelingAndBindingResponse);
logServer.deviceExecuteLog(this.device_code, "", "", "烘拷完成请求失败,响应参数:" + JSON.toJSONString(applyLabelingAndBindingResponse));
}
return true;
}
}
protected void thingToNothing() {
//this.setRequireSucess(false);

View File

@@ -119,9 +119,9 @@ public class ManipulatorAgvStationDeviceDriver extends AbstractOpcDeviceDriver i
iserror = this.itemProtocol.isError;
if (mode != last_mode) {
this.setRequireSucess(false);
}
// if (mode != last_mode) {
// this.setRequireSucess(false);
// }
} catch (Exception var17) {
this.message = "universal_message14";
LuceneLogDto logDto = LuceneLogDto.builder()
@@ -130,6 +130,12 @@ public class ManipulatorAgvStationDeviceDriver extends AbstractOpcDeviceDriver i
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
LuceneLogDto logDto1 = LuceneLogDto.builder()
.device_code(device_code)
.content(this.device_code + "逻辑异常消息:" + var17.getMessage())
.build();
logDto1.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto1);
}
if (!this.itemProtocol.getIsonline()) {

View File

@@ -60,6 +60,10 @@ public class ItemProtocol {
public static String item_to_empty_shaft_site = "to_empty_shaft_site";
//下发任务类型
public static String item_to_type = "to_type";
//下发分支任务1轴类型
public static String item_to_Task1_Axis_Type = "to_Task1_Axis_Type";
//下发分支任务2轴类型
public static String item_to_Task2_Axis_Type = "to_Task2_Axis_Type";
private SlitTwoManipulatorDeviceDriver driver;
@@ -185,6 +189,8 @@ public class ItemProtocol {
list.add(new ItemDto(item_to_target2, "下发目标站2", "DB16.W14"));
list.add(new ItemDto(item_to_empty_shaft_site, "下发空轴位", "DB16.W16"));
list.add(new ItemDto(item_to_type, "下发任务类型", "DB16.W20"));
list.add(new ItemDto(item_to_Task1_Axis_Type, "下发分支任务1轴类型", "DB16.W24"));
list.add(new ItemDto(item_to_Task2_Axis_Type, "下发分支任务2轴类型", "DB16.W28"));
return list;
}

View File

@@ -392,11 +392,12 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
}
if (!ObjectUtil.isEmpty(task)) {
this.executeReadyTask(task);
boolean flag = this.executeReadyTask(task);
return flag;
} else {
notCreateInstMessage = "universal_notCreateInstMessage";
return false;
}
return true;
}
}
@@ -448,11 +449,12 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
}
}
if (!ObjectUtil.isEmpty(task)) {
this.executeReadyTask(task);
boolean flag1 = this.executeReadyTask(task);
return flag1;
} else {
notCreateInstMessage = "universal_notCreateInstMessage";
return false;
}
return true;
}
}
@@ -491,6 +493,19 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
map.put("to_type", taskDto.getTruss_type());
map.put("to_empty_shaft_site", taskDto.getEmpty_site());
String interactionJson = taskDto.getInteraction_json();
if (StrUtil.isNotEmpty(interactionJson)){
JSONObject jsonObject = JSONObject.parseObject(interactionJson);
String to_Task1_Axis_Type = jsonObject.getString("to_Task1_Axis_Type");
if (StrUtil.isNotEmpty(to_Task1_Axis_Type)){
map.put("to_Task1_Axis_Type",to_Task1_Axis_Type);
}
String to_Task2_Axis_Type = jsonObject.getString("to_Task2_Axis_Type");
if (StrUtil.isNotEmpty(to_Task2_Axis_Type)){
map.put("to_Task2_Axis_Type",to_Task2_Axis_Type);
}
}
if (StrUtil.isNotEmpty(start_device_code2)) {
Device startDevice2 = deviceAppservice.findDeviceByCode(start_device_code2);
Device nextDevice2 = deviceAppservice.findDeviceByCode(next_device_code2);
@@ -593,10 +608,23 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
map.put("to_onset2", start_addr2);
map.put("to_target2", next_addr2);
}
String interactionJson = taskDto.getInteraction_json();
if (StrUtil.isNotEmpty(interactionJson)){
JSONObject jsonObject = JSONObject.parseObject(interactionJson);
String to_Task1_Axis_Type = jsonObject.getString("to_Task1_Axis_Type");
if (StrUtil.isNotEmpty(to_Task1_Axis_Type)){
map.put("to_Task1_Axis_Type",to_Task1_Axis_Type);
}
String to_Task2_Axis_Type = jsonObject.getString("to_Task2_Axis_Type");
if (StrUtil.isNotEmpty(to_Task2_Axis_Type)){
map.put("to_Task2_Axis_Type",to_Task2_Axis_Type);
}
}
try {
instructionService.create(instdto);
} catch (Exception e) {
logServer.deviceExecuteLog(device_code, "", instdto.getInstruction_code(), "->" + e.getMessage());
return false;
}
//创建指令后修改任务状态
taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex());

View File

@@ -1075,11 +1075,14 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
removeByCodeFromCache(dto.getInstruction_code());
String instnextdevice = dto.getNext_device_code();
String insttaskid = dto.getTask_id();
// String insttaskid = dto.getTask_id();
//
// Task task = new LambdaQueryChainWrapper<>(taskMapper)
// .eq(Task::getTask_id, insttaskid)
// .one();
TaskDto task = taskService.findByCodeFromCache(dto.getTask_code());
Task task = new LambdaQueryChainWrapper<>(taskMapper)
.eq(Task::getTask_id, insttaskid)
.one();
// =0 则不用再次请求
if (StrUtil.equals(task.getRequest_again(), "0")) {
if (StrUtil.equals(task.getTask_type(), "8")) {
@@ -1133,10 +1136,11 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
@Transactional(rollbackFor = Exception.class)
public void finishAndCreateNextInst(Instruction dto) {
dto = foramte(dto);
String device_code = dto.getNext_device_code();
Task acsTask = new LambdaQueryChainWrapper<>(taskMapper)
.eq(Task::getTask_id, dto.getTask_id())
.one();
// String device_code = dto.getNext_device_code();
// Task acsTask = new LambdaQueryChainWrapper<>(taskMapper)
// .eq(Task::getTask_id, dto.getTask_id())
// .one();
TaskDto acsTask = taskService.findByCodeFromCache(dto.getTask_code());
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineServiceImpl.class);
List<RouteLineDto> list =
@@ -1191,7 +1195,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
instdto.setRoute_plan_code(acsTask.getRoute_plan_code());
instdto.setRemark(acsTask.getRemark());
instdto.setMaterial(acsTask.getMaterial());
instdto.setQuantity(acsTask.getQuantity().toPlainString());
instdto.setQuantity(acsTask.getQuantity());
instdto.setTask_id(acsTask.getTask_id());
instdto.setTask_code(acsTask.getTask_code());
instdto.setVehicle_code(acsTask.getVehicle_code());

View File

@@ -67,12 +67,12 @@ spring:
rejectedHandlerType: CallerRunsPolicy # 拒绝策略查看RejectedTypeEnum枚举类默认AbortPolicy
keepAliveTime: 30 # 空闲线程等待超时时间默认60
threadNamePrefix: core_thread # 线程名前缀默认dtp
tryInterrupt: true
tryInterrupt: false
allowCoreThreadTimeOut: true # 是否允许核心线程池超时默认false
waitForTasksToCompleteOnShutdown: true # 参考spring线程池设计优雅关闭线程池默认true
awaitTerminationSeconds: 5 # 优雅关闭线程池时阻塞等待线程池中任务执行时间默认3单位s
preStartAllCoreThreads: false # 是否预热所有核心线程默认false
runTimeout: 2000 # 任务执行超时阈值单位ms默认0不统计
runTimeout: 8000 # 任务执行超时阈值单位ms默认0不统计
queueTimeout: 1000 # 任务在队列等待超时阈值单位ms默认0不统计
- threadPoolName: scheduled_pool # 线程池名称,必填
threadPoolAliasName: scheduled_thread # 线程池别名,可选
@@ -84,12 +84,12 @@ spring:
rejectedHandlerType: CallerRunsPolicy # 拒绝策略查看RejectedTypeEnum枚举类默认AbortPolicy
keepAliveTime: 30 # 空闲线程等待超时时间默认60
threadNamePrefix: scheduled_thread # 线程名前缀默认dtp
tryInterrupt: true
tryInterrupt: false
allowCoreThreadTimeOut: true # 是否允许核心线程池超时默认false
waitForTasksToCompleteOnShutdown: true # 参考spring线程池设计优雅关闭线程池默认true
awaitTerminationSeconds: 5 # 优雅关闭线程池时阻塞等待线程池中任务执行时间默认3单位s
preStartAllCoreThreads: false # 是否预热所有核心线程默认false
runTimeout: 2000 # 任务执行超时阈值单位ms默认0不统计
runTimeout: 8000 # 任务执行超时阈值单位ms默认0不统计
queueTimeout: 1000 # 任务在队列等待超时阈值单位ms默认0不统计
task:
pool: