add:拼单逻辑
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -493,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);
|
||||
@@ -595,6 +608,18 @@ 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) {
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user