立讯优化

This commit is contained in:
loujf
2022-07-26 17:21:03 +08:00
parent 11aa0b8528
commit 9f7e4ac78e
15 changed files with 198 additions and 42 deletions

View File

@@ -149,6 +149,16 @@ public class AgvDto implements Serializable {
*/
private String today_odo;
/**
* 本次运行时间(开机后到当前的时间)
*/
private String time;
/**
* 累计运行时间
*/
private String total_time;
/**
* 电压
*/

View File

@@ -565,6 +565,12 @@ public class AgvServiceImpl implements AgvService {
} else if(StrUtil.equals(state,"6")){
state_name = "CANCELED";
}
//本次运行时间(开机后到当前的时间)
String time = rbk_report.getString("time");
//累计运行时间
String total_time = rbk_report.getString("total_time");
//今日累计行驶里程
String today_odo = rbk_report.getString("today_odo");
String energyLevel = String.valueOf(rbk_report.getDouble("battery_level"));
String transportOrder = current_order.getString("id");
@@ -608,6 +614,10 @@ public class AgvServiceImpl implements AgvService {
dto.setVx(vx);
dto.setVy(vy);
dto.setW(w);
dto.setToday_odo(today_odo);
dto.setTotal_time(total_time);
dto.setTime(time);
if (AGVDeviceStatus.containsKey(name)) {
AGVDeviceStatus.remove(name);
AGVDeviceStatus.put(name, dto);

View File

@@ -63,8 +63,9 @@ public class AcsToWmsController {
@PostMapping("/feedbackAgv")
@Log("反馈AGV设备信息")
@ApiOperation("反馈AGV设备信息")
public ResponseEntity<Object> feedbackAgv(@RequestBody JSONArray from) {
return new ResponseEntity<>(acstowmsService.feedbackAgv(from), HttpStatus.OK);
public ResponseEntity<Object> feedbackAgv(@RequestBody String from) {
JSONArray array = JSONArray.fromObject(from);
return new ResponseEntity<>(acstowmsService.feedbackAgv(array), HttpStatus.OK);
}
@PostMapping("/feedbackDeviceStatus")

View File

@@ -139,13 +139,13 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
}
List<RouteLineDto> list = RouteLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
if (ObjectUtil.isEmpty(list)) {
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("message", "路由不通!");
errArr.add(json);
continue;
}
// if (ObjectUtil.isEmpty(list)) {
// JSONObject json = new JSONObject();
// json.put("task_code", task_code);
// json.put("message", "路由不通!");
// errArr.add(json);
// continue;
// }
TaskDto taskDto = TaskService.findByCodeFromCache(task_code);
if (taskDto != null) {
JSONObject json = new JSONObject();
@@ -233,7 +233,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
} catch (Exception e) {
resultJson.put("status", 400);
resultJson.put("status", 200);
resultJson.put("errArr", e.getMessage());
resultJson.put("message", e.getMessage());
resultJson.put("data", new JSONObject());

View File

@@ -137,4 +137,20 @@ public class InstructionController {
public ResponseEntity<Object> queryByTaskId(@RequestBody String taskId) {
return new ResponseEntity<>(instructionService.getByTaskId(taskId), HttpStatus.OK);
}
@Log("取货完成")
@ApiOperation("取货完成")
@PostMapping(value = "/getFinish/{id}")
public ResponseEntity<Object> getFinish(@RequestBody String id) throws Exception {
instructionService.getFinish(id);
return new ResponseEntity<>(HttpStatus.OK);
}
@Log("放货完成")
@ApiOperation("放货完成")
@PostMapping(value = "/putFinish/{id}")
public ResponseEntity<Object> putFinish(@RequestBody String id) throws Exception {
instructionService.putFinish(id);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -249,4 +249,18 @@ public interface InstructionService {
boolean removeByCodeFromCache(String code);
/**
* 取货完成
*
* @param id
*/
void getFinish(String id) throws Exception;
/**
* 放货完成
*
* @param id
*/
void putFinish(String id) throws Exception;
}

View File

@@ -23,6 +23,7 @@ import org.nl.acs.device_driver.standard_conveyor_control_with_scanner.StandardC
import org.nl.acs.device_driver.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.device_driver.standard_storage.StandardStorageDeviceDriver;
import org.nl.acs.device_driver.traffic_light.TrafficLightDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.log.service.LogServer;
@@ -79,6 +80,8 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
TaskService taskService;
@Autowired
LogServer logServer;
@Autowired
AcsToWmsService acsToWmsService;
@Override
@@ -105,7 +108,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
String point_code = (String) whereJson.get("point_code");
String is_over = (String) whereJson.get("is_over");
if (!StrUtil.isEmpty(code)) {
map.put("code", code);
map.put("code", "%" + code + "%");
}
if (!StrUtil.isEmpty(vehicle_code)) {
map.put("vehicle_code", vehicle_code);
@@ -117,7 +120,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
map.put("status", status);
}
if (!StrUtil.isEmpty(point_code)) {
map.put("point_code", point_code);
map.put("point_code", "%" + point_code + "%");
}
if (!StrUtil.isEmpty(is_over)) {
map.put("is_over", is_over);
@@ -140,7 +143,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
String create_time = (String) whereJson.get("createTime");
String end_time = (String) whereJson.get("end_time");
if (!StrUtil.isEmpty(code)) {
map.put("code", code);
map.put("code", "%" + code + "%");
}
if (!StrUtil.isEmpty(vehicle_code)) {
map.put("vehicle_code", vehicle_code);
@@ -152,7 +155,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
map.put("status", status);
}
if (!StrUtil.isEmpty(point_code)) {
map.put("point_code", point_code);
map.put("point_code", "%" + point_code + "%");
}
if (!StrUtil.isEmpty(create_time) && !StrUtil.isEmpty(end_time)) {
map.put("create_time", create_time);
@@ -1227,4 +1230,34 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");
return pattern.matcher(str).matches();
}
@Override
public void getFinish(String id){
Instruction inst = this.findById(id);
JSONObject feedjo = new JSONObject();
feedjo.put("status","1");
feedjo.put("device_code",inst.getStart_device_code());
feedjo.put("vehicle_code",inst.getVehicle_code());
feedjo.put("task_code",inst.getTask_code());
JSONArray feedja = JSONArray.fromObject(feedjo);
acsToWmsService.feedbackActionStatusToWms(feedja);
inst.setFinish_type("1");
this.update(inst);
}
@Override
public void putFinish(String id){
Instruction inst = this.findById(id);
JSONObject feedjo = new JSONObject();
feedjo.put("status","2");
feedjo.put("device_code",inst.getNext_device_code());
feedjo.put("vehicle_code",inst.getVehicle_code());
feedjo.put("task_code",inst.getTask_code());
JSONArray feedja = JSONArray.fromObject(feedjo);
acsToWmsService.feedbackActionStatusToWms(feedja);
inst.setFinish_type("2");
this.update(inst);
}
}

View File

@@ -59,11 +59,11 @@
OPTION 输入.is_over <> "1"
inst.instruction_status < 2
ENDOPTION
OPTION 输入.task_code <> ""
OPTION 输入.code <> ""
(
inst.instruction_code = 输入.code
inst.instruction_code like 输入.code
OR
inst.task_code = 输入.code
inst.task_code like 输入.code
)
ENDOPTION
OPTION 输入.status <> ""
@@ -77,9 +77,9 @@
ENDOPTION
OPTION 输入.point_code <> ""
(
inst.start_point_code = 输入.point_code
inst.start_point_code like 输入.point_code
OR
inst.next_point_code = 输入.point_code
inst.next_point_code like 输入.point_code
)
ENDOPTION
ENDSELECT
@@ -94,11 +94,11 @@
acs_instruction inst
WHERE
is_delete =0
OPTION 输入.task_code <> ""
OPTION 输入.code <> ""
(
inst.instruction_code = 输入.code
inst.instruction_code like 输入.code
OR
inst.task_code = 输入.code
inst.task_code like 输入.code
)
ENDOPTION
OPTION 输入.status <> ""
@@ -112,9 +112,9 @@
ENDOPTION
OPTION 输入.point_code <> ""
(
inst.start_point_code = 输入.point_code
inst.start_point_code like 输入.point_code
OR
inst.next_point_code = 输入.point_code
inst.next_point_code like 输入.point_code
)
ENDOPTION
ENDOPTION

View File

@@ -124,7 +124,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
String point_code = (String) whereJson.get("point_code");
String is_over = (String) whereJson.get("is_over");
if (!StrUtil.isEmpty(task_code)) {
map.put("task_code", task_code);
map.put("task_code", "%" + task_code + "%");
}
if (!StrUtil.isEmpty(vehicle_code)) {
map.put("vehicle_code", vehicle_code);
@@ -136,7 +136,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
map.put("status", status);
}
if (!StrUtil.isEmpty(point_code)) {
map.put("point_code", point_code);
map.put("point_code", "%" + point_code + "%");
}
if (!StrUtil.isEmpty(is_over)) {
map.put("is_over", is_over);
@@ -200,7 +200,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
String create_time = (String) whereJson.get("createTime");
String end_time = (String) whereJson.get("end_time");
if (!StrUtil.isEmpty(task_code)) {
map.put("task_code", task_code);
map.put("task_code", "%" + task_code + "%");
}
if (!StrUtil.isEmpty(vehicle_code)) {
map.put("vehicle_code", vehicle_code);
@@ -212,7 +212,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
map.put("status", status);
}
if (!StrUtil.isEmpty(point_code)) {
map.put("point_code", point_code);
map.put("point_code", "%" + point_code + "%");
}
if (!StrUtil.isEmpty(create_time) && !StrUtil.isEmpty(end_time)) {
map.put("create_time", create_time);

View File

@@ -58,7 +58,7 @@
task.task_status < 2
ENDOPTION
OPTION 输入.task_code <> ""
task.task_code = 输入.task_code
task.task_code like 输入.task_code
ENDOPTION
OPTION 输入.status <> ""
task.task_status = 输入.status
@@ -71,9 +71,9 @@
ENDOPTION
OPTION 输入.point_code <> ""
(
task.start_point_code = 输入.point_code
task.start_point_code like 输入.point_code
OR
task.next_point_code = 输入.point_code
task.next_point_code like 输入.point_code
)
ENDOPTION
ENDSELECT
@@ -89,7 +89,7 @@ IF 输入.flag = "2"
WHERE
1=1
OPTION 输入.task_code <> ""
task.task_code = 输入.task_code
task.task_code like 输入.task_code
ENDOPTION
OPTION 输入.status <> ""
task.task_status = 输入.status
@@ -102,9 +102,9 @@ IF 输入.flag = "2"
ENDOPTION
OPTION 输入.point_code <> ""
(
task.start_point_code = 输入.point_code
task.start_point_code like 输入.point_code
OR
task.next_point_code = 输入.point_code
task.next_point_code like 输入.point_code
)
ENDOPTION
OPTION 输入.create_time <> ""

View File

@@ -11,6 +11,8 @@ import org.nl.acs.agv.server.AgvService;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -32,6 +34,9 @@ public class QueryXZAgvTaskStatus {
@Autowired
AcsToWmsService acsToWmsService;
@Autowired
TaskService taskService;
public void run() throws Exception {
HttpResponse response = agvService.queryXZAgvInstStatus();
@@ -55,7 +60,7 @@ public class QueryXZAgvTaskStatus {
JSONObject feedjo = new JSONObject();
feedjo.put("status","1");
feedjo.put("device_code",device_code);
feedjo.put("vehicle_code ",inst.getVehicle_code());
feedjo.put("vehicle_code",inst.getVehicle_code());
feedjo.put("task_code",inst.getTask_code());
JSONArray feedja = JSONArray.fromObject(feedjo);
acsToWmsService.feedbackActionStatusToWms(feedja);
@@ -68,7 +73,7 @@ public class QueryXZAgvTaskStatus {
feedjo.put("status","2");
feedjo.put("device_code",device_code);
feedjo.put("task_code",inst.getTask_code());
feedjo.put("vehicle_code ",inst.getVehicle_code());
feedjo.put("vehicle_code",inst.getVehicle_code());
JSONArray feedja = JSONArray.fromObject(feedjo);
acsToWmsService.feedbackActionStatusToWms(feedja);
inst.setFinish_type("2");
@@ -107,9 +112,15 @@ public class QueryXZAgvTaskStatus {
inst.setInstruction_status("1");
instructionService.update(inst);
}
} else {
}
// else if ("STOPPED".equals(state)){
// if (inst != null) {
// instructionService.cancel(inst.getInstruction_id());
//
// TaskDto taskDto = taskService.findByCode(inst.getTask_code());
// taskService.cancel(taskDto.getTask_id());
// }
// }
}
}

View File

@@ -54,6 +54,9 @@ public class ToAgvDevice {
row.put("odo", agvDto.getOdo());
row.put("vx", agvDto.getVx());
row.put("w", agvDto.getW());
row.put("today_odo", agvDto.getToday_odo());
row.put("total_time", agvDto.getTotal_time());
row.put("time", agvDto.getTime());
agv_rows.add(row);
}