rev:需求变更
This commit is contained in:
@@ -2,6 +2,7 @@ package org.nl.acs.device_driver.basedriver.agv.ndcone;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -371,7 +372,12 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
log.info("agv进入" + device_code + "取货完成"+"指令号:"+ikey);
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if ("CZJT01,CZJT02,CZJT03,CZJT04".contains(inst.getStart_point_code())) {
|
||||
// 调用wms 告知取货完成
|
||||
JSONObject resultWms = new JSONObject();
|
||||
resultWms.put("task_code", inst.getTask_code());
|
||||
acsToWmsService.getConfirm(resultWms);
|
||||
}
|
||||
} else if (phase == 0x06) {
|
||||
data = getData(data, index, inst, task);
|
||||
//到达放货点
|
||||
|
||||
@@ -105,6 +105,24 @@ public interface AcsToWmsService {
|
||||
*/
|
||||
HttpResponse applyTask(JSONObject request);
|
||||
|
||||
/**
|
||||
* ACS向WMS反馈取货完成
|
||||
* @param request {
|
||||
* task_code:任务编码
|
||||
* }
|
||||
* @return HttpResponse
|
||||
*/
|
||||
HttpResponse getConfirm(JSONObject request);
|
||||
|
||||
/**
|
||||
* ACS向WMS申请是否可以创建指令
|
||||
* @param request {
|
||||
* device_code:设备编码
|
||||
* }
|
||||
* @return HttpResponse
|
||||
*/
|
||||
HttpResponse checkTask(JSONObject request);
|
||||
|
||||
/**
|
||||
* ACS向WMS反馈任务状态
|
||||
* @param arr
|
||||
|
||||
@@ -164,6 +164,94 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponse getConfirm(JSONObject request) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
|
||||
HttpResponse result2 = null;
|
||||
log.info("getConfirm-----请求参数{}", request.toString());
|
||||
|
||||
AddressDto addressDto = addressService.findByCode("getConfirm");
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
try {
|
||||
result2 = HttpRequest.post(wmsurl + methods_url)
|
||||
.addInterceptor(tLogHutoolhttpInterceptor)
|
||||
.header(Header.USER_AGENT, "Hutool http")
|
||||
.header("Authorization", token).body(String.valueOf(request))
|
||||
.execute();
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4,"getConfirm", String.valueOf(result2.getStatus()),
|
||||
String.valueOf(request), String.valueOf(result2.body()), "ACS向WMS反馈取货完成");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
//网络不通
|
||||
log.info("getConfirm-----输出参数{}", msg);
|
||||
}
|
||||
|
||||
String type = "";
|
||||
if (ObjectUtil.isNotEmpty(result2) && result2.getStatus() == 200) {
|
||||
type = "info";
|
||||
JSONObject jo = JSONObject.parseObject(result2.body());
|
||||
log.info("getConfirm-----输出参数{}", jo.toString());
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4,"getConfirm", String.valueOf(result2.getStatus()),
|
||||
String.valueOf(request), String.valueOf(result2.body()), "ACS向WMS反馈取货完成");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
return result2;
|
||||
} else {
|
||||
type = "error";
|
||||
}
|
||||
return null;
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponse checkTask(JSONObject request) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
|
||||
HttpResponse result2 = null;
|
||||
log.info("checkTask-----请求参数{}", request.toString());
|
||||
|
||||
AddressDto addressDto = addressService.findByCode("checkTask");
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
try {
|
||||
result2 = HttpRequest.post(wmsurl + methods_url)
|
||||
.addInterceptor(tLogHutoolhttpInterceptor)
|
||||
.header(Header.USER_AGENT, "Hutool http")
|
||||
.header("Authorization", token).body(String.valueOf(request))
|
||||
.execute();
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4,"checkTask", String.valueOf(result2.getStatus()),
|
||||
String.valueOf(request), String.valueOf(result2.body()), "ACS向WMS申请是否可以创建指令");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
//网络不通
|
||||
log.info("checkTask-----输出参数{}", msg);
|
||||
}
|
||||
|
||||
String type = "";
|
||||
if (ObjectUtil.isNotEmpty(result2) && result2.getStatus() == 200) {
|
||||
type = "info";
|
||||
JSONObject jo = JSONObject.parseObject(result2.body());
|
||||
log.info("checkTask-----输出参数{}", jo.toString());
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4,"checkTask", String.valueOf(result2.getStatus()),
|
||||
String.valueOf(request), String.valueOf(result2.body()), "ACS向WMS申请是否可以创建指令");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
return result2;
|
||||
} else {
|
||||
type = "error";
|
||||
}
|
||||
return null;
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponse feedTaskStatus(JSONObject data) {
|
||||
//feedTaskStatus
|
||||
|
||||
@@ -168,6 +168,13 @@ public interface TaskService extends CommonService<Task> {
|
||||
*/
|
||||
List<TaskDto> queryAllUnfinished(Map whereJson);
|
||||
|
||||
/**
|
||||
* 查询执行中状态下的任务
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<TaskDto> findReadyExTask();
|
||||
|
||||
/**
|
||||
* 根据状态查询
|
||||
*
|
||||
|
||||
@@ -362,6 +362,14 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
return ConvertUtil.convertList(taskList, TaskDto.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskDto> findReadyExTask() {
|
||||
return this.tasks
|
||||
.stream()
|
||||
.filter(taskDto -> "1".equals(taskDto.getTask_status()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskDto findByCode(String code) {
|
||||
Task task = new LambdaQueryChainWrapper<>(taskMapper)
|
||||
@@ -1330,6 +1338,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
map.put("备注", jsonObject.getString("remark"));
|
||||
map.put("创建者", jsonObject.getString("create_by"));
|
||||
map.put("创建时间", jsonObject.getString("create_time"));
|
||||
map.put("完成时间", jsonObject.getString("update_time"));
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
@@ -1356,6 +1365,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
ins.put("remark", task.getRemark());
|
||||
ins.put("create_by", task.getCreate_by());
|
||||
ins.put("create_time", task.getCreate_time());
|
||||
ins.put("update_time", task.getUpdate_time());
|
||||
return ins;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
@@ -3,11 +3,15 @@ package org.nl.system.service.quartz.task;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.nl.acs.common.base.CommonFinalParam;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device_driver.basedriver.pallet_dispenser.PalletDispenseDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
@@ -47,6 +51,7 @@ public class AutoCreateInst {
|
||||
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogServiceImpl.class);
|
||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
|
||||
List<TaskDto> list = taskserver.queryAllByStatus("0");
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
TaskDto acsTask = list.get(i);
|
||||
@@ -56,6 +61,19 @@ public class AutoCreateInst {
|
||||
if (StrUtil.equals(acsTask.getTask_type(), TaskTypeEnum.Truss_Task.getIndex()) && !StrUtil.startWith(acsTask.getTask_code(), "-")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 判断缠绕机是否有任务
|
||||
if (acsTask.getStart_device_code().equals("CRJ01") || acsTask.getNext_device_code().equals("CRJ01")) {
|
||||
// 查询所有执行中的任务
|
||||
List<TaskDto> readyExTask = taskserver.findReadyExTask();
|
||||
// 判断执行中的任务是否有缠绕机
|
||||
boolean is_like = readyExTask.stream()
|
||||
.anyMatch(row -> row.getStart_device_code().equals("CRJ01") || row.getNext_device_code().equals("CRJ01"));
|
||||
if (is_like) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// 判断是否是拆盘机
|
||||
if (acsTask.getStart_device_code().equals("CPJ01")) {
|
||||
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class);
|
||||
@@ -66,6 +84,45 @@ public class AutoCreateInst {
|
||||
}
|
||||
}
|
||||
|
||||
// 判断是否是内部终点称重机台:CZJT01
|
||||
if (acsTask.getNext_device_code().equals("CZJT01")) {
|
||||
// 查询所有执行中的任务
|
||||
List<TaskDto> readyExTask = taskserver.findReadyExTask();
|
||||
boolean is_like = readyExTask.stream()
|
||||
.anyMatch(row -> row.getStart_device_code().equals("CZJT01") || row.getNext_device_code().equals("CZJT01"));
|
||||
if (is_like) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 向WMS申请是否可以创建指令
|
||||
JSONObject paramTask = new JSONObject().fluentPut("device_code", acsTask.getNext_device_code());
|
||||
HttpResponse httpResponse = acsToWmsService.checkTask(paramTask);
|
||||
JSONObject jo = JSONObject.parseObject(httpResponse.body());
|
||||
JSONObject data = jo.getJSONObject("data");
|
||||
if (!data.getString("is_create").equals("1")) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// 判断是否是内部终点称重机台:CZJT02
|
||||
if (acsTask.getNext_device_code().equals("CZJT02")) {
|
||||
// 查询所有执行中的任务
|
||||
List<TaskDto> readyExTask = taskserver.findReadyExTask();
|
||||
boolean is_like = readyExTask.stream()
|
||||
.anyMatch(row -> row.getStart_device_code().equals("CZJT02") || row.getNext_device_code().equals("CZJT02"));
|
||||
if (is_like) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 向WMS申请是否可以创建指令
|
||||
JSONObject paramTask = new JSONObject().fluentPut("device_code", acsTask.getNext_device_code());
|
||||
HttpResponse httpResponse = acsToWmsService.checkTask(paramTask);
|
||||
JSONObject jo = JSONObject.parseObject(httpResponse.body());
|
||||
if (!jo.getString("is_create").equals("1")) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
String taskid = acsTask.getTask_id();
|
||||
String taskcode = acsTask.getTask_code();
|
||||
String task_type = acsTask.getTask_type();
|
||||
|
||||
Reference in New Issue
Block a user