This commit is contained in:
2022-11-29 16:25:16 +08:00
parent d57dd9d3dc
commit ce325a6e38
9 changed files with 161 additions and 25 deletions

View File

@@ -108,6 +108,14 @@ public class InstructionController {
return new ResponseEntity<>(HttpStatus.OK);
}
@Log("强制取消指令")
@ApiOperation("强制取消指令")
@PostMapping(value = "/forceCancel/{id}")
public ResponseEntity<Object> forceCancel(@RequestBody String id) throws Exception {
instructionService.cancelNOSendAgv(id);
return new ResponseEntity<>(HttpStatus.OK);
}
@Log("导出指令")
@ApiOperation("导出指令")
@GetMapping(value = "/download")

View File

@@ -363,8 +363,8 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
}
try {
String start_device_code = task.getStart_device_code();
String next_device_code = task.getNext_device_code();
String start_device_code = dto.getStart_device_code();
String next_device_code = dto.getNext_device_code();
String route_plan_code = task.getRoute_plan_code();
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
RouteLineDto route = null;

View File

@@ -1,6 +1,7 @@
package org.nl.hand.rest;
import cn.dev33.satoken.annotation.SaIgnore;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
@@ -9,10 +10,7 @@ import org.nl.hand.service.HFHandService;
import org.nl.modules.logging.annotation.Log;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@@ -172,4 +170,14 @@ public class HFHandController {
return new ResponseEntity<>(HandService.queryDevice(), HttpStatus.OK);
}
@PostMapping("/queryStorageExtra")
@Log("查询货架扩展信息")
@ApiOperation("查询货架扩展信息")
@SaIgnore
//@PreAuthorize("@el.check('sect:list')")
//@RequestBody JSONObject json
public ResponseEntity<Object> queryStorageExtra(@RequestBody JSONObject storage_code) {
return new ResponseEntity<>(HandService.queryStorageExtra(storage_code.getString("storage_code")), HttpStatus.OK);
}
}

View File

@@ -2,6 +2,8 @@
package org.nl.hand.service;
import com.alibaba.fastjson.JSONObject;
import java.util.Map;
/**
@@ -114,4 +116,9 @@ public interface HFHandService {
Map<String, Object> createTask2(Map<String, String> whereJson);
Map<String, Object> queryDevice();
/**
* 根据货架号,查询扩展信息
*/
JSONObject queryStorageExtra(String device_code);
}

View File

@@ -292,6 +292,10 @@ public class HFHandServiceImpl implements HFHandService {
String priority = jsonObject.get("priority");
String carrier = jsonObject.get("carrier");
String emptypallet_num = jsonObject.get("emptypallet_num");
String form_y = jsonObject.get("form_y");
String form_z = jsonObject.get("form_z");
String to_y = jsonObject.get("to_y");
String to_z = jsonObject.get("to_z");
JSONObject resultJson = new JSONObject();
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
@@ -360,11 +364,19 @@ public class HFHandServiceImpl implements HFHandService {
dto.setMaterial(material_type);
dto.setStart_point_code(start_devicecode);
dto.setNext_point_code(next_devicecode);
dto.setStart_device_code(start_devicecode);
dto.setNext_device_code(next_devicecode);
dto.setMaterial(material_type);
dto.setTask_type(task_type);
dto.setPriority(priority);
dto.setVehicle_code(carrier);
dto.setEmptypallet_num(emptypallet_num);
dto.setFrom_x("1");
dto.setFrom_y(form_y);
dto.setFrom_z(form_z);
dto.setTo_x("1");
dto.setTo_y(to_y);
dto.setTo_z(to_z);
try {
taskService.create(dto);
// startDevice.setIslock("true");
@@ -772,10 +784,34 @@ public class HFHandServiceImpl implements HFHandService {
public Map<String, Object> queryDevice() {
WQLObject wo = WQLObject.getWQLObject("acs_device");
JSONArray resultJSONArray = wo.query("1 = 1", "device_code").getResultJSONArray(0);
JSONArray js = new JSONArray();
for (int i = 0; i < resultJSONArray.size(); i++) {
JSONObject jsonObject = resultJSONArray.getJSONObject(i);
JSONObject map = new JSONObject();
map.put("device_id",jsonObject.getString("device_id"));
map.put("device_code",jsonObject.getString("device_code"));
map.put("device_name",jsonObject.getString("device_name"));
map.put("device_type",jsonObject.getString("device_type"));
js.add(map);
}
JSONObject jo = new JSONObject();
jo.put("code", "1");
jo.put("desc", "查询成功");
jo.put("result", resultJSONArray);
jo.put("result", js);
return jo;
}
@Override
public JSONObject queryStorageExtra(String device_code) {
JSONObject device = WQLObject.getWQLObject("acs_device").query("device_code = '" + device_code + "'").uniqueResult(0);
String device_id = device.getString("device_id");
WQLObject wo = WQLObject.getWQLObject("acs_device_extra");
JSONObject jo = new JSONObject();
jo.put("maxY", wo.query("device_id = '" + device_id + "' AND extra_code = 'maxY'").uniqueResult(0).getString("extra_value"));
jo.put("minY", wo.query("device_id = '" + device_id + "' AND extra_code = 'minY'").uniqueResult(0).getString("extra_value"));
jo.put("maxZ", wo.query("device_id = '" + device_id + "' AND extra_code = 'maxZ'").uniqueResult(0).getString("extra_value"));
jo.put("minZ", wo.query("device_id = '" + device_id + "' AND extra_code = 'minZ'").uniqueResult(0).getString("extra_value"));
//jo.put("tunnel", wo.query("device_id = '" + device_id + "' AND extra_code = 'tunnel'").uniqueResult(0).getString("extra_value"));
return jo;
}
}

View File

@@ -7,6 +7,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.route.service.RouteLineService;
@@ -58,19 +59,46 @@ public class AutoCreateInst {
if(StrUtil.equals(is_send,"0")){
continue;
}
if(StrUtil.equals(acsTask.getTask_type(),"1") || StrUtil.equals(acsTask.getTask_type(),"2")){
//校验路由关系
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
if (ObjectUtils.isEmpty(shortPathsList)) {
acsTask.setRemark("路由不通无法生成指令");
taskserver.updateByCodeFromCache(acsTask);
continue;
}
if (!StrUtil.equals(shortPathsList.get(0).getType(), "1")) {
continue;
}
// if(StrUtil.equals(acsTask.getTask_type(),"1") || StrUtil.equals(acsTask.getTask_type(),"2")){
// //校验路由关系
// List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
// if (ObjectUtils.isEmpty(shortPathsList)) {
// acsTask.setRemark("路由不通无法生成指令");
// taskserver.updateByCodeFromCache(acsTask);
// continue;
// }
//
// if (!StrUtil.equals(shortPathsList.get(0).getType(), "1")) {
// continue;
// }
//
// RouteLineDto routeLineDto = shortPathsList.get(0);
// String path = routeLineDto.getPath();
// String type = routeLineDto.getType();
// String[] str = path.split("->");
// List<String> pathlist = Arrays.asList(str);
// int index = 0;
// for (int m = 0; m < pathlist.size(); m++) {
// if (pathlist.get(m).equals(start_device_code)) {
// index = m + 1;
// break;
// }
// }
// next_device_code = pathlist.get(index);
//
// if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) {
// next_point_code = next_device_code + "-" + acsTask.getTo_y() + "-" + acsTask.getTo_z();
// } else {
// next_point_code = next_device_code;
// }
// }
/**
* 开始平均分解校验
*/
String this_device_code = taskserver.queryAssignedByDevice(acsTask.getStart_device_code(), acsTask.getNext_device_code());
if (StrUtil.isEmpty(this_device_code)) {
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, acsTask.getNext_device_code(), route_plan_code);
RouteLineDto routeLineDto = shortPathsList.get(0);
String path = routeLineDto.getPath();
String type = routeLineDto.getType();
@@ -84,12 +112,34 @@ public class AutoCreateInst {
}
}
next_device_code = pathlist.get(index);
} else {
next_device_code = this_device_code;
}
//校验路由关系
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
if (ObjectUtils.isEmpty(shortPathsList)) {
acsTask.setRemark("路由不通无法生成指令");
taskserver.updateByCodeFromCache(acsTask);
continue;
}
if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) {
next_point_code = next_device_code + "-" + acsTask.getTo_y() + "-" + acsTask.getTo_z();
} else {
next_point_code = next_device_code;
}
if (!StrUtil.equals(shortPathsList.get(0).getType(), "1")) {
continue;
}
Device startdevice = appService.findDeviceByCode(start_device_code);
Device nextdevice = appService.findDeviceByCode(next_device_code);
if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) {
next_point_code = next_device_code + "-" + acsTask.getTo_y() + "-" + acsTask.getTo_z();
} else {
next_point_code = next_device_code;
}
if (ObjectUtils.isEmpty(appService)) {
log.info("地址对应设备未找到");
continue;
}
if (ObjectUtils.isEmpty(startdevice)) {
log.info("地址对应设备未找到");
continue;
}
Instruction instdto = new Instruction();