add:新增拔前行架二次分配逻辑

This commit is contained in:
2025-03-26 14:09:48 +08:00
parent 7a67790ca8
commit 760fe868c1
15 changed files with 512 additions and 185 deletions

View File

@@ -139,10 +139,12 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
private Date instruction_require_time = new Date();
private Date require_apply_labeling_time = new Date();
private Date require_apply_strangulation_time = new Date();
private Date require_apply_manipulatorTask_time = new Date();
private Date require_empty_in_time = new Date();
private Date require_empty_out_time = new Date();
private int instruction_require_time_out = 3000;
private int require_apply_manipulatorTask_time_out = 3000;
//行架机械手申请任务成功标识
boolean requireSucess = false;
boolean requireEmptyInSuccess = false;
@@ -363,10 +365,11 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
private void applyManipulatorTask() {
Date date = new Date();
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
if (date.getTime() - this.require_apply_manipulatorTask_time.getTime() < (long) this.require_apply_manipulatorTask_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.require_apply_manipulatorTask_time_out);
return;
} else {
this.require_apply_manipulatorTask_time = date;
JSONObject param = new JSONObject();
param.put("device_code", device_code);
param.put("material_barcode", material_barcode);

View File

@@ -655,7 +655,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
}
private void erroBlock() {
private void erroBlock() throws Exception {
message = "universal_message3";
//指定库位满入
@@ -672,7 +672,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
if (error == 6) {
try {
updateEXcuteMessage(error.toString());
applyUpdatePointCode(StandarStirageErroEnum.VOIDANCE.getType());
applyUpdatePointCode1(StandarStirageErroEnum.VOIDANCE.getType());
} catch (Exception e) {
throw new RuntimeException(e);
}
@@ -711,7 +711,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
*
* @param type
*/
private void applyUpdatePointCode(String type) {
private void applyUpdatePointCode(String type) throws Exception {
Date date = new Date();
if (date.getTime() - this.update_point_require_time.getTime() < (long) this.update_point_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.update_point_require_time_out);
@@ -794,16 +794,108 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
}
}
/**
* 申请更新点位
*
* @param type
*/
private void applyUpdatePointCode1(String type) throws Exception {
Date date = new Date();
if (date.getTime() - this.update_point_require_time.getTime() < (long) this.update_point_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.update_point_require_time_out);
return;
} else {
this.update_point_require_time = new Date();
Instruction instruction = checkInst();
if (ObjectUtil.isEmpty(instruction)) {
message = "one_message9";
return;
}
JSONObject param = new JSONObject();
param.put("task_code", instruction.getTask_code());
param.put("task_id", instruction.getTask_id());
param.put("type", type);
LuceneLogDto logDto1 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请更新点位,参数:" + param)
.build();
logDto1.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto1);
String response = acsToWmsService.applyUpdatePointCode(param);
JSONObject jo = JSON.parseObject(response);
if (jo.getInteger("status") == 200) {
try {
verifyPoint(type,jo);
//清警
cleanErro();
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请更新点位,参数,接口返回:" + jo)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);
String poinCode = jo.getString("point_code");
String vehicleCode = jo.getString("vehicle_code");
if (StrUtil.isNotEmpty(poinCode)) {
String[] split = poinCode.split("-");
Device point = deviceAppService.findDeviceByCode(split[0]);
if (ObjectUtil.isEmpty(point)) {
message = "one_message18";
}
if (type.equals(StandarStirageErroEnum.BLOCK_IN.getType()) || type.equals(StandarStirageErroEnum.FILL.getType())) {
updateData2(poinCode, point, split, vehicleCode);
List list = new ArrayList();
String x = point.getExtraValue().get("x").toString();
String y = split[1];
String z = split[2];
pakagePLCData(list, x, y, z, "2", task.toString());
}
if (type.equals(StandarStirageErroEnum.VOIDANCE.getType())) {
updateData1(poinCode, point, split, vehicleCode);
List list = new ArrayList();
String x = point.getExtraValue().get("x").toString();
String y = split[1];
String z = split[2];
pakagePLCData(list, x, y, z, "1", task.toString());
}
}
//取货潜货位阻挡做完移库任务
if (type.equals(StandarStirageErroEnum.BLOCK_OUT.getType())) {
errorInst = checkInst();
}
} catch (Exception e) {
this.errorRequireSucess = false;
e.printStackTrace();
}
this.errorRequireSucess = true;
} else {
instructionService.cancel(instruction.getInstruction_id());
//清警
cleanErro();
this.errorRequireSucess = false;
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请更新点位,返回参数:" + jo)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);
}
}
}
/**
* 校验点位是否存在路由
* @param jo
*/
private void verifyPoint(String type,JSONObject jo) {
Instruction instruction = checkInst();
String[] point_codes = jo.getString("point_code").split("-");
String point_code = jo.getString("point_code");
String[] split = point_code.split("-");
if (type.equals(StandarStirageErroEnum.BLOCK_IN.getType()) || type.equals(StandarStirageErroEnum.FILL.getType())) {
List<RouteLineDto> routeLineDtos = routeLineService.getShortPathLines(instruction.getStart_device_code(),
point_codes[0], instruction.getRoute_plan_code());
split[0], instruction.getRoute_plan_code());
if(CollUtil.isEmpty(routeLineDtos)){
errorPoint(jo, instruction);
}
@@ -813,7 +905,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
errorPoint(jo, instruction);
}
} else if(type.equals(StandarStirageErroEnum.VOIDANCE.getType())){
List<RouteLineDto> routeLineDtos = routeLineService.getShortPathLines(point_codes[0],instruction.getNext_device_code(),
List<RouteLineDto> routeLineDtos = routeLineService.getShortPathLines(split[0],instruction.getNext_device_code(),
instruction.getRoute_plan_code());
if(CollUtil.isEmpty(routeLineDtos)){
errorPoint(jo, instruction);

View File

@@ -77,6 +77,10 @@ public class ItemProtocol {
public static String item_to_size3 = "to_size3";
//套拔轴纸管2尺寸
public static String item_to_size4 = "to_size4";
//下发新取货点
public static String item_to_getpoint = "to_getpoint";
//下发新放货点
public static String item_to_putpoint = "to_putpoint";
private PullHeadManipulatorDeviceDriver driver;
@@ -142,6 +146,14 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_to_command);
}
public int getTo_getpoint() {
return this.getOpcIntegerValue(item_to_getpoint);
}
public int getTo_putpoint() {
return this.getOpcIntegerValue(item_to_putpoint);
}
public int getTo_target() {
return this.getOpcIntegerValue(item_to_target);
}
@@ -238,6 +250,8 @@ public class ItemProtocol {
list.add(new ItemDto(item_to_qty2, "拔轴纸管数量", "DB12.W20"));
list.add(new ItemDto(item_to_size3, "拔轴纸管1尺寸", "DB12.W22"));
list.add(new ItemDto(item_to_size4, "拔轴纸管2尺寸", "DB12.W24"));
list.add(new ItemDto(item_to_getpoint, "下发新取货点", "DB12.W26"));
list.add(new ItemDto(item_to_putpoint, "下发新放货点", "DB12.W28"));
return list;
}

View File

@@ -24,6 +24,10 @@ import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.device_driver.one_manipulator.box_storage_manipulator.InteractionJsonDTO;
import org.nl.acs.device_driver.two_conveyor.plug_pull_device_site.PlugPullDeviceSiteDeviceDriver;
import org.nl.acs.device_driver.two_conveyor.pull_head_manipulator.ItemProtocol;
import org.nl.acs.ext.wms.data.ManipulatorApplyPointRequest;
import org.nl.acs.ext.wms.data.ManipulatorApplyPointResponse;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.history.ErrorUtil;
import org.nl.acs.history.service.DeviceErrorLogService;
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
@@ -77,6 +81,8 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
DeviceErrorLogService errorLogServer = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
@Autowired
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
@Autowired
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
//工作模式
int mode = 0;
int lastMode = 0;
@@ -110,6 +116,12 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
int toTarget = 0;
int lastToTarget = 0;
int to_getpoint = 0;
int last_to_getpoint = 0;
int to_putpoint = 0;
int last_to_putpoint = 0;
int toTask = 0;
int lastToTask = 0;
@@ -134,7 +146,11 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
String message = null;
Boolean iserror = false;
private Date instruction_update_time = new Date();
private int instruction_update_time_out = 1000;
private Date apply_action_time = new Date();
private Date apply_action_time1 = new Date();
private int instruction_update_time_out = 3000;
private int apply_action_time_out = 3000;
private int apply_action_time_out1 = 3000;
Integer heartbeat_tag;
private Date instruction_require_time = new Date();
@@ -162,6 +178,8 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
String notCreateTaskMessage = "";
String notCreateInstMessage = "";
String feedMessage = "";
//反馈成功表示
boolean feedbackSucess = false;
List<String> getDeviceCodeList = null;
@@ -194,11 +212,16 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
toOnset = this.itemProtocol.getTo_onset();
xPosition = this.itemProtocol.getX_position();
yPosition = this.itemProtocol.getY_position();
to_getpoint = this.itemProtocol.getTo_getpoint();
to_putpoint = this.itemProtocol.getTo_putpoint();
if (mode != lastMode) {
requireSucess = false;
}
if (mode == 3 && !requireSucess) {
if (action != lastAction) {
this.setFeedbackSucess(false);
}
if (task > 0 && !feedbackSucess) {
inst = checkInst();
if (null != inst) {
TaskDto dto = taskserver.findByCode(inst.getTask_code());
@@ -212,6 +235,83 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
update_instruction_status();
}
//申请取货点
if (mode == 3 && action == 6) {
Date date = new Date();
if (date.getTime() - this.apply_action_time.getTime() < (long) this.apply_action_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.apply_action_time_out);
} else {
this.apply_action_time = date;
ManipulatorApplyPointRequest manipulatorApplyPointRequest = new ManipulatorApplyPointRequest();
ManipulatorApplyPointResponse manipulatorApplyPointResponse;
inst = checkInst();
String task_code = inst.getTask_code();
manipulatorApplyPointRequest.setType("1");
manipulatorApplyPointRequest.setTask_code(task_code);
if (toCommand != 6) {
manipulatorApplyPointResponse = acsToWmsService.manipulatorApplyPointRequest(manipulatorApplyPointRequest);
if (manipulatorApplyPointResponse.getstatus() == 200) {
LuceneLogDto logDto1 = LuceneLogDto.builder()
.device_code(device_code)
.content("向LMS申请气胀轴库取货点位返回参数" + manipulatorApplyPointResponse)
.build();
logDto1.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto1);
String get_device_code = manipulatorApplyPointResponse.getDevice_code();
Device device = deviceAppService.findDeviceByCode(get_device_code);
String to_new_getpoint = device.getExtraValue().get("address").toString();
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", "6");
map.put("to_getpoint", Integer.parseInt(to_new_getpoint));
this.writing(map);
message = "申请新取货点成功";
} else {
message = "申请新取货点失败";
}
}
}
}
//申请放货点
if (mode == 3 && action == 7) {
Date date = new Date();
if (date.getTime() - this.apply_action_time1.getTime() < (long) this.apply_action_time_out1) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.apply_action_time_out1);
} else {
this.apply_action_time1 = date;
ManipulatorApplyPointRequest manipulatorApplyPointRequest = new ManipulatorApplyPointRequest();
ManipulatorApplyPointResponse manipulatorApplyPointResponse;
inst = checkInst();
String task_code = inst.getTask_code();
manipulatorApplyPointRequest.setType("2");
manipulatorApplyPointRequest.setTask_code(task_code);
if (toCommand != 7) {
manipulatorApplyPointResponse = acsToWmsService.manipulatorApplyPointRequest(manipulatorApplyPointRequest);
if (manipulatorApplyPointResponse.getstatus() == 200) {
LuceneLogDto logDto1 = LuceneLogDto.builder()
.device_code(device_code)
.content("向LMS申请气胀轴库放货点位返回参数" + manipulatorApplyPointResponse)
.build();
logDto1.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto1);
String put_device_code = manipulatorApplyPointResponse.getDevice_code();
Device device = deviceAppService.findDeviceByCode(put_device_code);
String to_new_putpoint = device.getExtraValue().get("address").toString();
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", "7");
map.put("to_putpoint", Integer.parseInt(to_new_putpoint));
this.writing(map);
message = "申请新放货点成功";
} else {
message = "申请新放货点失败";
}
}
}
}
} catch (Exception var17) {
var17.printStackTrace();
@@ -285,6 +385,8 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
lastToSleeve = toSleeve;
lastToSize = toSize;
lastToBarcode = toBarcode;
last_to_getpoint = to_getpoint;
last_to_putpoint = to_putpoint;
}
public synchronized void update_instruction_status() throws Exception {
@@ -295,7 +397,6 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
} else {
this.instruction_update_time = date;
// 更新指令状态
if (task > 0) {
Instruction inst = checkInst();
if (inst != null) {
if (StrUtil.equals(inst.getInstruction_status(), "0")) {
@@ -305,7 +406,6 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
instructionService.update(inst);
}
}
}
//任务完成
@@ -319,8 +419,10 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
message = "universal_message1";
try {
finish_instruction(inst2);
feedbackSucess = true;
} catch (Exception e) {
e.printStackTrace();
feedbackSucess = false;
}
feedMessage = "";
}
@@ -339,6 +441,8 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
}
}
}
}
}
@@ -450,22 +554,27 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
taskDtosReady = this.sortTask(taskDtosReady);
for (int j = 0; j < taskDtosReady.size(); j++) {
//按照优先级排序 优先级相等按照创建时间排序
task = taskDtosReady.get(j);
// 6 行架任务 8烘箱任务
if (!StrUtil.equals(task.getTask_type(), "6")) {
task = null;
continue;
}
if (ObjectUtil.isNotEmpty(task)) {
Device nextdevice = deviceAppService.findDeviceByCode(task.getNext_device_code());
Device startdevice = deviceAppService.findDeviceByCode(task.getStart_device_code());
TaskDto taskReady = taskDtosReady.get(j);
String start_device_code = taskReady.getStart_device_code();
String next_device_code = taskReady.getNext_device_code();
Device nextdevice = deviceAppService.findDeviceByCode(taskReady.getNext_device_code());
Device startdevice = deviceAppService.findDeviceByCode(taskReady.getStart_device_code());
if (startdevice.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) startdevice.getDeviceDriver();
if (plugPullDeviceSiteDeviceDriver.getAction() != 1 && plugPullDeviceSiteDeviceDriver.getMove() != 1) {
notCreateInstMessage = "就绪任务未创建指令原因->" + task.getStart_device_code() + "工位状态为不允许取或者无货,无法生成指令";
if (plugPullDeviceSiteDeviceDriver.getAction() == 1 && plugPullDeviceSiteDeviceDriver.getMove() == 1) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(notCreateInstMessage + task.getStart_device_code() + "工位action值:" + plugPullDeviceSiteDeviceDriver.getAction() + "move值:" + plugPullDeviceSiteDeviceDriver.getMove())
.content("当前任务号:" + taskReady.getTask_code() + " " + start_device_code + "当前move值为" + plugPullDeviceSiteDeviceDriver.getMove() + "当前action值为" + plugPullDeviceSiteDeviceDriver.getAction())
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
task = taskReady;
break start;
} else {
notCreateInstMessage = "就绪任务未创建指令原因->" + taskReady.getStart_device_code() + "工位状态为不允许取或者无货,无法生成指令";
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("当前任务号:" + taskReady.getTask_code() + " " + start_device_code + "当前move值为" + plugPullDeviceSiteDeviceDriver.getMove() + "当前action值为" + plugPullDeviceSiteDeviceDriver.getAction())
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
@@ -475,53 +584,32 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
if (nextdevice.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) nextdevice.getDeviceDriver();
if (plugPullDeviceSiteDeviceDriver.getAction() != 2 && plugPullDeviceSiteDeviceDriver.getMove() != 0) {
notCreateInstMessage = "就绪任务未创建指令原因->" + task.getNext_device_code() + "工位状态为不允许放或者有货,无法生成指令";
if (plugPullDeviceSiteDeviceDriver.getAction() == 2 && plugPullDeviceSiteDeviceDriver.getMove() == 0) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(notCreateInstMessage + task.getStart_device_code() + "工位action值:" + plugPullDeviceSiteDeviceDriver.getAction() + "move值:" + plugPullDeviceSiteDeviceDriver.getMove())
.content("当前任务号:" + taskReady.getTask_code() + " " + start_device_code + "当前move值为" + plugPullDeviceSiteDeviceDriver.getMove() + "当前action值为" + plugPullDeviceSiteDeviceDriver.getAction())
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
task = taskReady;
break start;
} else {
notCreateInstMessage = "就绪任务未创建指令原因->" + taskReady.getNext_device_code() + "工位状态为不允许放或者有货,无法生成指令";
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("当前任务号:" + taskReady.getTask_code() + " " + next_device_code + "当前move值为" + plugPullDeviceSiteDeviceDriver.getMove() + "当前action值为" + plugPullDeviceSiteDeviceDriver.getAction())
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
continue;
}
}
break start;
}
}
}
}
}
if (!ObjectUtil.isEmpty(task)) {
Device nextdevice = deviceAppService.findDeviceByCode(task.getNext_device_code());
Device startdevice = deviceAppService.findDeviceByCode(task.getStart_device_code());
if (startdevice.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) startdevice.getDeviceDriver();
if (plugPullDeviceSiteDeviceDriver.getAction() != 1 && plugPullDeviceSiteDeviceDriver.getMove() != 1) {
notCreateInstMessage = "就绪任务未创建指令原因->" + task.getStart_device_code() + "工位状态为不允许取或者无货,无法生成指令";
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(notCreateInstMessage + task.getStart_device_code() + "工位action值:" + plugPullDeviceSiteDeviceDriver.getAction() + "move值:" + plugPullDeviceSiteDeviceDriver.getMove())
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
return false;
}
}
if (nextdevice.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) nextdevice.getDeviceDriver();
if (plugPullDeviceSiteDeviceDriver.getAction() != 2 && plugPullDeviceSiteDeviceDriver.getMove() != 0) {
notCreateInstMessage = "就绪任务未创建指令原因->" + task.getNext_device_code() + "工位状态为不允许放或者有货,无法生成指令";
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(notCreateInstMessage + task.getStart_device_code() + "工位action值:" + plugPullDeviceSiteDeviceDriver.getAction() + "move值:" + plugPullDeviceSiteDeviceDriver.getMove())
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
return false;
}
}
String taskId = task.getTask_id();
String taskCode = task.getTask_code();
String vehicleCode = task.getVehicle_code();

View File

@@ -0,0 +1,17 @@
package org.nl.acs.ext.wms.data;
import lombok.Data;
@Data
public class ManipulatorApplyPointRequest extends BaseRequest{
/**
* 1-申请取货点
* 2-申请放货点
*/
private String type;
/**
* 任务号
*/
private String task_code;
}

View File

@@ -0,0 +1,16 @@
package org.nl.acs.ext.wms.data;
import lombok.Data;
import java.util.HashMap;
import java.util.Map;
@Data
public class ManipulatorApplyPointResponse extends BaseResponse{
private Map<String, String> data = new HashMap();
/**
* 取放货点
*/
private String device_code;
}

View File

@@ -119,5 +119,12 @@ public class WmsToAcsController {
return new ResponseEntity<>(wmstoacsService.getTubeMes(whereJson), HttpStatus.OK);
}
@PostMapping("/returnBox")
@Log("lms下发退木箱流程")
@SaIgnore
public ResponseEntity<Object> returnBox(@RequestBody JSONObject param) throws Exception {
return new ResponseEntity<>(wmstoacsService.returnBox(param), HttpStatus.OK);
}
}

View File

@@ -218,4 +218,11 @@ public interface AcsToWmsService {
void actionFinishRequest2(JSONObject jsonObject);
String forceMove(JSONObject param);
/**
* 向LMS申请气胀轴库点位
* @param param
* @return
*/
ManipulatorApplyPointResponse manipulatorApplyPointRequest(ManipulatorApplyPointRequest param);
}

View File

@@ -118,4 +118,6 @@ public interface WmsToAcsService {
Map<String, Object> putWeightAction(String jsonObject) throws Exception;
Map<String, Object> getTubeMes(String whereJson) throws Exception;
JSONObject returnBox(JSONObject param);
}

View File

@@ -325,8 +325,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
}
@Override
public HttpResponse feedTaskStatus(JSONArray data) {
//feedTaskStatus
@@ -704,8 +702,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
}
@Override
public String secondaryAllocationPoint(JSONObject param) {
try {
@@ -790,6 +786,42 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
MDC.remove(log_file_type);
}
}
@Override
public ManipulatorApplyPointResponse manipulatorApplyPointRequest(ManipulatorApplyPointRequest param) {
log.info("向LMS申请气胀轴库点位,请求参数{}", JSONObject.toJSONString(param));
String result = "";
ManipulatorApplyPointResponse manipulatorApplyPointResponse = new ManipulatorApplyPointResponse();
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("manipulatorApplyPointRequest");
String methods_url = addressDto.getMethods_url();
String url = wmsUrl + methods_url;
try {
result = HttpRequest.post(url)
.addInterceptor(tLogHutoolhttpInterceptor)
.header(Header.USER_AGENT, "Hutool http")
.body(JSON.toJSONString(param))
.execute().body();
JSONObject jsonObject = JSONObject.parseObject(result);
log.info("向LMS申请气胀轴库点位----返回参数{}", result);
manipulatorApplyPointResponse = JSONObject.toJavaObject(jsonObject, ManipulatorApplyPointResponse.class);
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "manipulatorApplyPointRequest", String.valueOf(manipulatorApplyPointResponse.getCode()),
JSON.toJSONString(param), String.valueOf(result), "向LMS申请气胀轴库" + ("1".equals(param.getType()) ? "取货点位" : "放货点位"));
luceneLogService.interfaceExecuteLog(luceneLogDto);
} catch (Exception e) {
String message = e.getMessage();
JSONObject jsonObject = JSONObject.parseObject(result);
log.info("向LMS申请气胀轴库点位----返回参数{}", result);
manipulatorApplyPointResponse = JSONObject.toJavaObject(jsonObject, ManipulatorApplyPointResponse.class);
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "manipulatorApplyPointRequest", String.valueOf(manipulatorApplyPointResponse.getCode()),
JSON.toJSONString(param), String.valueOf(result), "向LMS申请气胀轴库点位失败");
luceneLogService.interfaceExecuteLog(luceneLogDto);
}
}
return manipulatorApplyPointResponse;
}
@Override
public void actionFinishRequest2(JSONObject jsonObject) {
HttpResponse execute = null;
@@ -925,6 +957,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
return result;
}
}
@Override
// @Async
public void sendDeviceStatus(JSONObject param) {

View File

@@ -748,6 +748,11 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
return resultJson;
}
@Override
public JSONObject returnBox(JSONObject whereJson) {
return null;
}
@Override
public Map<String, Object> queryDevice(String jsonObject) throws Exception {
try {

View File

@@ -1318,6 +1318,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
entity.setUpdate_time(now);
entity.setUpdate_by(currentUsername);
entity.setInstruction_status(InstructionStatusEnum.CANCEL.getIndex());
entity.setRemark("堆垛机空出取消指令");
InstructionMybatis ins = ConvertUtil.convert(entity, InstructionMybatis.class);
instructionMapper.updateById(ins);
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);

View File

@@ -327,6 +327,15 @@ public interface TaskService extends CommonService<Task> {
void cancelAndInst(String ids) throws Exception;
/**
* 强制取消任务和指令
*
* @param ids
* @throws Exception
*/
void forceCancelAndInst(String ids) throws Exception;
/**
* 手动创建指令
*

View File

@@ -247,7 +247,8 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
String task_code = (String) whereJson.get("task_code");
String vehicle_code = (String) whereJson.get("vehicle_code2");
String vehicle_code = (String) whereJson.get("vehicle_code");
String vehicle_code2 = (String) whereJson.get("vehicle_code2");
String material_type = (String) whereJson.get("material_type");
String status = (String) whereJson.get("status");
String point_code = (String) whereJson.get("point_code");
@@ -262,6 +263,9 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
if (!StrUtil.isEmpty(vehicle_code)) {
wrapper.eq(Task::getVehicle_code, vehicle_code);
}
if (!StrUtil.isEmpty(vehicle_code2)) {
wrapper.like(Task::getVehicle_code2, vehicle_code2);
}
if (!StrUtil.isEmpty(material_type)) {
wrapper.eq(Task::getMaterial, material_type);
}
@@ -292,6 +296,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
public Map<String, Object> queryAllByCache(Map whereJson, Pageable page) {
String task_code = (String) whereJson.get("task_code");
String vehicle_code = (String) whereJson.get("vehicle_code");
String vehicle_code2 = (String) whereJson.get("vehicle_code2");
String material_type = (String) whereJson.get("material_type");
String status = (String) whereJson.get("status");
String point_code = (String) whereJson.get("point_code");
@@ -933,6 +938,38 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
}
}
@Override
public void forceCancelAndInst(String id) throws Exception {
TaskDto entity = this.findById(id);
if (entity == null) {
throw new BadRequestException(LangProcess.msg("error_sysAuth"));
}
InstructionDto instdto = instructionService.findByTaskid(id, "instruction_status <2 ");
if (instdto != null) {
instructionService.cancel(instdto.getInstruction_id());
}
String currentUsername = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
entity.setUpdate_time(now);
entity.setUpdate_by(currentUsername);
entity.setTask_status(TaskStatusEnum.CANCEL.getIndex());
entity.setRemark("堆垛机空出");
Task task = ConvertUtil.convert(entity, Task.class);
taskMapper.updateById(task);
//移除任务缓存信息
this.removeByCodeFromCache(entity.getTask_code());
//反馈上位系统任务状态
// this.feedWmsTaskStatus(entity);
//关闭仙工运单序列
if(StrUtil.equals(task.getTask_type(),TaskTypeEnum.Standard_AGV_Task.getCode()) && (StrUtil.equals(task.getAgv_system_type(), AgvSystemTypeEnum.One_NDC_System_Type.getCode())||StrUtil.equals(task.getAgv_system_type(), AgvSystemTypeEnum.XG_System_Type.getCode()))) {
this.markComplete(entity);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void cancelAndInst(String id) throws Exception {

View File

@@ -6,7 +6,7 @@ spring:
freemarker:
check-template-location: false
profiles:
active: dev
active: prod
jackson:
time-zone: GMT+8
data:
@@ -70,9 +70,9 @@ spring:
tryInterrupt: true
allowCoreThreadTimeOut: true # 是否允许核心线程池超时默认false
waitForTasksToCompleteOnShutdown: true # 参考spring线程池设计优雅关闭线程池默认true
awaitTerminationSeconds: 15 # 优雅关闭线程池时阻塞等待线程池中任务执行时间默认3单位s
awaitTerminationSeconds: 5 # 优雅关闭线程池时阻塞等待线程池中任务执行时间默认3单位s
preStartAllCoreThreads: false # 是否预热所有核心线程默认false
runTimeout: 10000 # 任务执行超时阈值单位ms默认0不统计
runTimeout: 2000 # 任务执行超时阈值单位ms默认0不统计
queueTimeout: 1000 # 任务在队列等待超时阈值单位ms默认0不统计
- threadPoolName: scheduled_pool # 线程池名称,必填
threadPoolAliasName: scheduled_thread # 线程池别名,可选
@@ -89,7 +89,7 @@ spring:
waitForTasksToCompleteOnShutdown: true # 参考spring线程池设计优雅关闭线程池默认true
awaitTerminationSeconds: 5 # 优雅关闭线程池时阻塞等待线程池中任务执行时间默认3单位s
preStartAllCoreThreads: false # 是否预热所有核心线程默认false
runTimeout: 5000 # 任务执行超时阈值单位ms默认0不统计
runTimeout: 2000 # 任务执行超时阈值单位ms默认0不统计
queueTimeout: 1000 # 任务在队列等待超时阈值单位ms默认0不统计
task:
pool:
@@ -158,8 +158,4 @@ mybatis-plus:
lucene:
index:
path: C:\acs\lucene\indexl
tlog:
pattern: "[$preApp][$preIp][$spanId][$traceId]"
enable-invoke-time-print: true
id-generator: org.nl.config.TlogIdGenerator