This commit is contained in:
USER-20220102CG\noblelift
2022-11-28 13:52:12 +08:00
parent 00d2e352fb
commit d37d0cf602
7 changed files with 207 additions and 25 deletions

View File

@@ -122,10 +122,10 @@ public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implem
public synchronized String getStatus() {
JSONObject jo = new JSONObject();
if (action == 1 && mode == 2) {
if (action == 1 ) {
jo.put("name", this.getDevice().getDevice_code());
jo.put("status", "OPEN");
} else if (action == 2 && mode == 2) {
} else if (action == 2) {
jo.put("name", this.getDevice().getDevice_code());
jo.put("status", "CLOSE");
} else {

View File

@@ -95,15 +95,60 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Override
public HttpResponse feedbackTaskStatusToWms(JSONArray data) {
// String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
//
// String task_code = "";
// for (int i = 0; i < data.size(); i++) {
// JSONObject json = (JSONObject) data.get(i);
// task_code = json.optString("ext_task_code");
// }
// TaskDto taskDto = taskService.findByCode(task_code);
// String vehicle_code = taskDto.getVehicle_code();
//
// HttpResponse result2 = null;
// log.info("feedbackTaskStatusToWms-----请求参数{}", data.toString());
//
// AddressDto addressDto = addressService.findByCode("feedbackTaskStatusToWms");
// String methods_url = addressDto.getMethods_url();
// try {
// result2 = HttpRequest.post(wmsurl + methods_url)
// .header("Authorization", token).body(String.valueOf(data))
// .execute();
// System.out.println(result2);
// log.info("feedbackTaskStatusToWms-----返回参数{}", result2.body());
// } catch (Exception e) {
// String msg = e.getMessage();
// //网络不通
// System.out.println(msg);
// log.info("feedbackTaskStatusToWms-----异常{}", msg);
// }
//
// String type = "";
// if (result2.getStatus() == 200) {
// type = "info";
// } else {
// type = "error";
// }
//
// logServer.log(task_code, "feedbackTaskStatusToWms", type, data.toString(), result2.body(), String.valueOf(result2.getStatus()), wmsurl + methods_url, vehicle_code);
// JSONObject jo = JSONObject.fromObject(result2.body());
// log.info("feedbackTaskStatusToWms-----输出参数{}", jo.toString());
// return result2;
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
String task_code = "";
String vehicle_code = "";
String remark = "";
for (int i = 0; i < data.size(); i++) {
JSONObject json = (JSONObject) data.get(i);
task_code = json.optString("task_code");
TaskDto taskDto = taskService.findByCode(task_code);
vehicle_code = taskDto.getVehicle_code();
remark = taskDto.getRemark();
json.put("remark",remark);
}
TaskDto taskDto = taskService.findByCode(task_code);
String vehicle_code = taskDto.getVehicle_code();
HttpResponse result2 = null;
log.info("feedbackTaskStatusToWms-----请求参数{}", data.toString());

View File

@@ -48,7 +48,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
JSONArray errArr = new JSONArray();
for (int i = 0; i < tasks.size(); i++) {
JSONObject task = tasks.getJSONObject(i);
String task_uuid = task.optString("task_uuid");
String ext_task_uuid = task.optString("ext_task_uuid");
String task_code = task.optString("task_code");
String start_point_code = task.optString("start_device_code");
String next_point_code = task.optString("next_device_code");
@@ -120,8 +120,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("remark", remark);
jo.put("params", params);
jo.put("task_type", StrUtil.isEmpty(task_type)?1:Integer.parseInt(task_type));
if(!StrUtil.isEmpty(task_uuid)){
jo.put("task_id", task_uuid);
if(!StrUtil.isEmpty(ext_task_uuid)){
jo.put("ext_task_uuid", ext_task_uuid);
}
// 如果是无光电的设备 指令完成变更起点、终点状态
JSONObject startjo = new JSONObject();
@@ -147,7 +147,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
e.printStackTrace();
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("task_uuid", task_uuid);
json.put("ext_task_uuid", ext_task_uuid);
json.put("message", e.getMessage());
errArr.add(json);
}

View File

@@ -2,7 +2,6 @@
package org.nl.acs.task.service;
import net.sf.json.JSONObject;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.task.service.dto.TaskDto;
import org.springframework.data.domain.Pageable;
@@ -27,11 +26,15 @@ public interface TaskService {
*/
Map<String, Object> queryAll(Map whereJson, Pageable page);
/**
* 数据同步
*/
void reload();
/**
* 在缓存中查询所有任务列表
*
* @param whereJson 条件
* @param page 分页参数
* @param page 分页参数
* @return
*/
Map<String, Object> queryAllByCache(Map whereJson, Pageable page);
@@ -47,11 +50,25 @@ public interface TaskService {
/**
* 查询所有数据不分页
*
* @param whereJson 条件参数
* @return List<TaskDto>
*/
List<TaskDto> queryAll(String whereJson);
/**
* 取消任务
*
* @param code
*/
void cancelByCode(String code) throws Exception;
/**
* 检测任务号是否重复
* @param code
* @return
*/
Boolean checkSameTaskByCode(String code);
/**
* 查询所有数据不分页
@@ -95,7 +112,6 @@ public interface TaskService {
/**
* 根据设备号查询未执行的任务
*
*/
List<TaskDto> queryTaskByDeviceCode(String device_code);
@@ -106,6 +122,27 @@ public interface TaskService {
*/
void create(TaskDto dto) throws Exception;
/**
* 惠氏任务生成
*
* @param /
*/
void hssavetask(JSONObject json) throws Exception;
/**
* 常规任务保存
*
* @param /
*/
void ordinaryTaskCreate(JSONObject json) throws Exception;
/**
* 特殊任务保存
*
* @param /
*/
void specialTaskCreate(JSONObject json) throws Exception;
/**
* 编辑
*
@@ -134,6 +171,13 @@ public interface TaskService {
*/
void cancel(String ids) throws Exception;
/**
* 手动创建指令
*
* @param ids
*/
void createInst(String ids) throws Exception;
/**
* 导出数据
*
@@ -162,6 +206,7 @@ public interface TaskService {
/**
* 根据目的地设备编号查询当前是否有设备
*
* @param device_code
* @return
*/
@@ -169,14 +214,59 @@ public interface TaskService {
/**
* 根据起点设备编号查询当前是否有设备
*
* @param device_code
* @return
*/
TaskDto findByStartCode(String device_code);
/**
* 查询内存任务
*
* @return
*/
List<TaskDto> findAllTaskFromCache();
TaskDto foramte(TaskDto task);
/**
* 修改内存中任务
*
* @param dto
*/
void updateByCodeFromCache(TaskDto dto);
/**
* 平均分配查询设备
*
* @param device_code
* @param task_nextdevice_code
* @return
*/
String queryAssignedByDevice(String device_code, String task_nextdevice_code);
/**
* 查询相同任务类型的数量
*
* @param taskType
* @return
*/
Integer querySameTaskByType(String taskType);
/**
* 查询相同终任务的数量
*
* @param code
* @return
*/
Integer querySameDestinationTask(String code);
/**
* 查询相同起任务的数量
*
* @param code
* @return
*/
Integer querySameOriginTask(String code);
}

View File

@@ -160,7 +160,7 @@ public class TaskFeedbackServiceImpl implements TaskFeedbackService {
TaskFeedbackDto dto = this.findById(id);
TaskDto entity = taskService.findById(dto.getTask_id());
JSONObject feed_jo = new JSONObject();
feed_jo.put("task_uuid", entity.getTask_id());
feed_jo.put("ext_task_uuid", entity.getExt_task_uuid());
feed_jo.put("task_code", entity.getTask_code());
feed_jo.put("task_status", entity.getTask_status());

View File

@@ -94,6 +94,16 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
return list;
}
@Override
public void cancelByCode(String code) throws Exception {
}
@Override
public Boolean checkSameTaskByCode(String code) {
return null;
}
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
@@ -273,12 +283,12 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
@Transactional(rollbackFor = Exception.class)
public void create(TaskDto dto) throws Exception {
dto = foramte(dto);
if(!StrUtil.isEmpty(dto.getVehicle_code())){
TaskDto vehicle_dto = this.findByContainer(dto.getVehicle_code());
if (vehicle_dto != null) {
throw new WDKException("已存在该载具号的任务!");
}
}
// if(!StrUtil.isEmpty(dto.getVehicle_code())){
// TaskDto vehicle_dto = this.findByContainer(dto.getVehicle_code());
// if (vehicle_dto != null) {
// throw new WDKException("已存在该载具号的任务!");
// }
// }
String currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now();
String task_uuid = dto.getTask_id();
@@ -430,6 +440,21 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
tasks.add(dto);
}
@Override
public void hssavetask(JSONObject json) throws Exception {
}
@Override
public void ordinaryTaskCreate(JSONObject json) throws Exception {
}
@Override
public void specialTaskCreate(JSONObject json) throws Exception {
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TaskDto dto) {
@@ -458,7 +483,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
//判断是否为WMS下发的任务如果是反馈任务状态给WMS
if (!StrUtil.startWith( dto.getTask_code(),"-")) {
JSONObject feed_jo = new JSONObject();
feed_jo.put("task_uuid", dto.getTask_id());
feed_jo.put("ext_task_uuid", dto.getExt_task_uuid());
feed_jo.put("task_code", dto.getTask_code());
feed_jo.put("task_status", dto.getTask_status());
JSONArray ja = new JSONArray();
@@ -496,7 +521,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
//判断是否为WMS下发的任务如果是反馈任务状态给WMS
if (!StrUtil.startWith( entity.getTask_code(),"-")) {
JSONObject feed_jo = new JSONObject();
feed_jo.put("task_uuid", entity.getTask_id());
feed_jo.put("ext_task_uuid", entity.getExt_task_uuid());
feed_jo.put("task_code", entity.getTask_code());
feed_jo.put("task_status", entity.getTask_status());
JSONArray ja = new JSONArray();
@@ -543,7 +568,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
//判断是否为WMS下发的任务如果是反馈任务状态给WMS
if (!StrUtil.startWith( entity.getTask_code(),"-")) {
JSONObject feed_jo = new JSONObject();
feed_jo.put("task_uuid", entity.getTask_id());
feed_jo.put("ext_task_uuid", entity.getExt_task_uuid());
feed_jo.put("task_code", entity.getTask_code());
feed_jo.put("task_status", entity.getTask_status());
JSONArray ja = new JSONArray();
@@ -560,6 +585,11 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
}
}
@Override
public void createInst(String ids) throws Exception {
}
@Override
public void download(List<TaskDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
@@ -838,4 +868,24 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
}
tasks.add(dto);
}
@Override
public String queryAssignedByDevice(String device_code, String task_nextdevice_code) {
return null;
}
@Override
public Integer querySameTaskByType(String taskType) {
return null;
}
@Override
public Integer querySameDestinationTask(String code) {
return null;
}
@Override
public Integer querySameOriginTask(String code) {
return null;
}
}

View File

@@ -18,14 +18,11 @@ public class AutoCleanLog {
AcsConfigService acsConfigService;
public void run() throws Exception {
System.out.println("111");
// 0 0/10 0,1 * * ? 每天0-1点执行间隔10分钟一次
//sys_log
//delete from sys_log where DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL 30 day)) limit 10;
WQLObject logTab = WQLObject.getWQLObject("sys_log");
int days = Integer.parseInt(acsConfigService.findConfigFromCache().get(AcsConfig.AutoCleanDays));
logTab.delete("DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL " + days + " day)) limit 50");
logTab.delete("DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL " + days + " day))");
log.info("自动清理日志执行成功...!");
}