更新
This commit is contained in:
@@ -54,4 +54,6 @@ public interface AcsConfig {
|
||||
String AutoCleanDays = "AutoCleanDays";
|
||||
//最大任务下发时间
|
||||
String MAXSENDTASKTIME = "maxSendTaskTime";
|
||||
//指令下发立库
|
||||
String INSTSENDLK = "instSendLk";
|
||||
}
|
||||
|
||||
@@ -299,6 +299,11 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
} else if (this.getMode() == 3) {
|
||||
mode = "运行中";
|
||||
}
|
||||
String requireSucess = "0";
|
||||
if (this.requireSucess) {
|
||||
requireSucess = "1";
|
||||
}
|
||||
jo.put("requireSucess", requireSucess);
|
||||
|
||||
if (this.getMove() == 0) {
|
||||
move = "无货";
|
||||
|
||||
@@ -222,5 +222,18 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
|
||||
}
|
||||
|
||||
public void writing(String param, String value) {
|
||||
|
||||
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + param;
|
||||
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
Server server = ReadUtil.getServer(opcservcerid);
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
|
||||
itemMap.put(to_param, value);
|
||||
// itemMap.put(to_param, Integer.parseInt(value));
|
||||
ReadUtil.write(itemMap, server);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -134,7 +134,8 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
String message = null;
|
||||
try {
|
||||
device_code = this.getDeviceCode();
|
||||
mode = this.itemProtocol.getMode();move = this.itemProtocol.getMove();
|
||||
mode = this.itemProtocol.getMode();
|
||||
move = this.itemProtocol.getMove();
|
||||
carrier_direction = this.itemProtocol.getCarrier_direction();
|
||||
error = this.itemProtocol.getError();
|
||||
task = this.itemProtocol.getTask();
|
||||
@@ -187,44 +188,60 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号task:" + last_task + "->" + task);
|
||||
}
|
||||
|
||||
if (task > 0) {
|
||||
Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||
if (ObjectUtil.isNotEmpty(instruction)) {
|
||||
// if (task > 0) {
|
||||
// Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||
// if (ObjectUtil.isNotEmpty(instruction)) {
|
||||
//
|
||||
// if (StrUtil.equals(this.getDeviceCode(), instruction.getStart_device_code())) {
|
||||
//
|
||||
// if (StrUtil.equals(instruction.getInstruction_status(), "0")) {
|
||||
// instruction.setInstruction_status("1");
|
||||
// instructionService.update(instruction);
|
||||
// }
|
||||
//
|
||||
// String next_device_code = instruction.getNext_device_code();
|
||||
// Device device = deviceAppservice.findDeviceByCode(next_device_code);
|
||||
// if (ObjectUtil.isEmpty(device)) {
|
||||
// logServer.deviceExecuteLog(this.device_code, "", "", "任务号:" + task + "输送线任务未完成,目标站设备为空!");
|
||||
// return;
|
||||
// }
|
||||
// SiemensConveyorDeviceDriver siemensConveyorDeviceDriver;
|
||||
// if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
||||
// if(mode ==2 ){
|
||||
// siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
|
||||
// int nextTask = siemensConveyorDeviceDriver.getTask();
|
||||
// if (nextTask == task) {
|
||||
// inst_message = "指令号:" + instruction.getInstruction_code() + " " + instruction.getStart_point_code() + "->" + instruction.getNext_point_code() + " 载具号:" + instruction.getVehicle_code();
|
||||
// if (StrUtil.equals(instruction.getInstruction_status(), "1")) {
|
||||
// inst = instruction;
|
||||
// finish_instruction();
|
||||
// this.clearWrite();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
if (StrUtil.equals(this.getDeviceCode(), instruction.getStart_device_code())) {
|
||||
|
||||
if (StrUtil.equals(instruction.getInstruction_status(), "0")) {
|
||||
instruction.setInstruction_status("1");
|
||||
instructionService.update(instruction);
|
||||
}
|
||||
|
||||
String next_device_code = instruction.getNext_device_code();
|
||||
Device device = deviceAppservice.findDeviceByCode(next_device_code);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "任务号:" + task + "输送线任务未完成,目标站设备为空!");
|
||||
return;
|
||||
}
|
||||
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
||||
if(mode ==2 ){
|
||||
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
|
||||
int nextTask = siemensConveyorDeviceDriver.getTask();
|
||||
if (nextTask == task) {
|
||||
inst_message = "指令号:" + instruction.getInstruction_code() + " " + instruction.getStart_point_code() + "->" + instruction.getNext_point_code() + " 载具号:" + instruction.getVehicle_code();
|
||||
if (StrUtil.equals(instruction.getInstruction_status(), "1")) {
|
||||
inst = instruction;
|
||||
finish_instruction();
|
||||
this.clearWrite();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (mode == 2 && move != 0 && task > 0) {
|
||||
//inst_message
|
||||
inst = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||
if (inst != null) {
|
||||
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code();
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "1") && StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
|
||||
finish_instruction();
|
||||
}
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
|
||||
inst.setInstruction_status("1");
|
||||
instructionService.update(inst);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception var17) {
|
||||
inst_message = var17.getMessage();
|
||||
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "读取信号值时出现异常:" + var17.getMessage());
|
||||
@@ -646,22 +663,19 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
applyLabelingAndBindingRequest.setType("1");
|
||||
applyLabelingAndBindingRequest.setVehicle_code(vehicle_code);
|
||||
ApplyLabelingAndBindingResponse applyLabelingAndBindingResponse = acsToWmsService.applyLabelingAndBindingRequest(applyLabelingAndBindingRequest);
|
||||
if(ObjectUtil.isNotEmpty( applyLabelingAndBindingResponse.getData())){
|
||||
Map datas = applyLabelingAndBindingResponse.getData();
|
||||
String length = datas.get("box_length").toString();
|
||||
String width = datas.get("box_width").toString();
|
||||
String box_high = datas.get("box_high").toString();
|
||||
String bundle_times = datas.get("bundle_times").toString();
|
||||
|
||||
if(applyLabelingAndBindingResponse.getstatus() == 200){
|
||||
List list = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
map.put("code","to_command");
|
||||
map.put("value","5");
|
||||
list.add(map);
|
||||
this.writing(list);
|
||||
|
||||
message ="申请贴标成功";
|
||||
requireApplyLabelingSuccess = true;
|
||||
} else {
|
||||
message = applyLabelingAndBindingResponse.getMessage();
|
||||
}
|
||||
requireApplyLabelingSuccess = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -698,39 +712,46 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
applyLabelingAndBindingRequest.setType("2");
|
||||
applyLabelingAndBindingRequest.setVehicle_code(vehicle_code);
|
||||
ApplyLabelingAndBindingResponse applyLabelingAndBindingResponse = acsToWmsService.applyLabelingAndBindingRequest(applyLabelingAndBindingRequest);
|
||||
if(ObjectUtil.isNotEmpty( applyLabelingAndBindingResponse.getData())){
|
||||
Map datas = applyLabelingAndBindingResponse.getData();
|
||||
String length = datas.get("box_length").toString();
|
||||
String width = datas.get("box_width").toString();
|
||||
String box_high = datas.get("box_high").toString();
|
||||
String bundle_times = datas.get("bundle_times").toString();
|
||||
if(applyLabelingAndBindingResponse.getstatus() == 200) {
|
||||
if(ObjectUtil.isNotEmpty( applyLabelingAndBindingResponse.getData())){
|
||||
Map datas = applyLabelingAndBindingResponse.getData();
|
||||
String length = datas.get("box_length").toString();
|
||||
String width = datas.get("box_width").toString();
|
||||
String box_high = datas.get("box_high").toString();
|
||||
String bundle_times = datas.get("bundle_times").toString();
|
||||
|
||||
List list = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
map.put("code","to_length");
|
||||
map.put("value",length);
|
||||
list.add(map);
|
||||
Map map2 = new HashMap();
|
||||
map2.put("code","to_weight");
|
||||
map2.put("value",width);
|
||||
list.add(map2);
|
||||
Map map3 = new HashMap();
|
||||
map3.put("code","to_height");
|
||||
map3.put("value",box_high);
|
||||
list.add(map3);
|
||||
Map map4 = new HashMap();
|
||||
map4.put("code","to_strap_times");
|
||||
map4.put("value",bundle_times);
|
||||
list.add(map4);
|
||||
Map map5 = new HashMap();
|
||||
map5.put("code","to_command");
|
||||
map5.put("value","4");
|
||||
list.add(map5);
|
||||
this.writing(list);
|
||||
List list = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
map.put("code","to_length");
|
||||
map.put("value",length);
|
||||
list.add(map);
|
||||
Map map2 = new HashMap();
|
||||
map2.put("code","to_weight");
|
||||
map2.put("value",width);
|
||||
list.add(map2);
|
||||
Map map3 = new HashMap();
|
||||
map3.put("code","to_height");
|
||||
map3.put("value",box_high);
|
||||
list.add(map3);
|
||||
Map map4 = new HashMap();
|
||||
map4.put("code","to_strap_times");
|
||||
map4.put("value",bundle_times);
|
||||
list.add(map4);
|
||||
Map map5 = new HashMap();
|
||||
map5.put("code","to_command");
|
||||
map5.put("value","4");
|
||||
list.add(map5);
|
||||
this.writing(list);
|
||||
message ="申请贴标成功";
|
||||
requireApplyLaStrangulationSuccess = true;
|
||||
} else {
|
||||
message = "未返回尺寸信息";
|
||||
}
|
||||
|
||||
} else {
|
||||
message = applyLabelingAndBindingResponse.getMessage();
|
||||
}
|
||||
|
||||
requireApplyLaStrangulationSuccess = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -268,6 +268,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
this.setBarcode(null);
|
||||
this.setRequireSucess(false);
|
||||
this.setApplySucess(false);
|
||||
applySucess = false;
|
||||
clearBarcode();
|
||||
this.set_last_container(container);
|
||||
List list = new ArrayList();
|
||||
@@ -300,7 +301,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
map7.put("value","0");
|
||||
list.add(map7);
|
||||
this.writing(list);
|
||||
|
||||
message = null;
|
||||
}
|
||||
|
||||
public void set_last_container(String barcode) {
|
||||
@@ -384,122 +385,40 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
//container_code
|
||||
TaskDto task = taskserver.findByContainer(container_code);
|
||||
if (!ObjectUtil.isEmpty(task)) {
|
||||
String taskid = task.getTask_id();
|
||||
String taskcode = task.getTask_code();
|
||||
String vehiclecode = task.getVehicle_code();
|
||||
String priority = task.getPriority();
|
||||
String start_point_code = task.getStart_point_code();
|
||||
String start_device_code = task.getStart_device_code();
|
||||
String route_plan_code = task.getRoute_plan_code();
|
||||
String next_device_code = "";
|
||||
Instruction instdto = instructionService.findByTaskcodeAndStatus(task.getTask_code());
|
||||
if(ObjectUtil.isNotEmpty(instdto)){
|
||||
List list = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
|
||||
/**
|
||||
* 开始平均分配
|
||||
*/
|
||||
String this_coevice_code = taskserver.queryAssignedByDevice(device_code, task.getNext_device_code());
|
||||
if (StrUtil.isEmpty(this_coevice_code)) {
|
||||
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, task.getNext_device_code(), route_plan_code);
|
||||
RouteLineDto routeLineDto = shortPathsList.get(0);
|
||||
|
||||
String path = routeLineDto.getPath();
|
||||
String type = routeLineDto.getType();
|
||||
String[] str = path.split("->");
|
||||
// if (!StrUtil.equals(type, "0")) {
|
||||
// return false;
|
||||
// }
|
||||
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;
|
||||
if(StrUtil.isNotEmpty(task.getTo_z())){
|
||||
if(StrUtil.equals(task.getTo_z(),"01")){
|
||||
map.put("code","to_target");
|
||||
map.put("value","102");
|
||||
} else if(StrUtil.equals(task.getTo_z(),"02")){
|
||||
map.put("code","to_target");
|
||||
map.put("value","201");
|
||||
} else if(StrUtil.equals(task.getTo_z(),"03")){
|
||||
map.put("code","to_target");
|
||||
map.put("value","301");
|
||||
}
|
||||
}
|
||||
next_device_code = pathlist.get(index);
|
||||
list.add(map);
|
||||
Map map2 = new HashMap();
|
||||
map2.put("code","to_task");
|
||||
map2.put("value",instdto.getInstruction_code());
|
||||
list.add(map2);
|
||||
Map map3 = new HashMap();
|
||||
map3.put("code","to_command");
|
||||
map3.put("value","1");
|
||||
list.add(map3);
|
||||
this.writing(list);
|
||||
message = "下发电气任务号成功";
|
||||
requireSucess = true;
|
||||
applySucess = true;
|
||||
} else {
|
||||
next_device_code = this_coevice_code;
|
||||
}
|
||||
//校验路由关系
|
||||
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
|
||||
if (ObjectUtils.isEmpty(shortPathsList)) {
|
||||
throw new RuntimeException("路由不通!");
|
||||
message = "任务号:"+ task.getTask_code()+"未找到指令";
|
||||
}
|
||||
|
||||
Device startdevice = deviceAppservice.findDeviceByCode(start_device_code);
|
||||
Device nextdevice = deviceAppservice.findDeviceByCode(next_device_code);
|
||||
String next_point_code;
|
||||
if (StrUtil.equals(deviceAppservice.findDeviceTypeByCode(next_device_code), "storage")) {
|
||||
next_point_code = task.getTo_x() + "-" + task.getTo_y() + "-" + task.getTo_z();
|
||||
} else {
|
||||
next_point_code = next_device_code;
|
||||
}
|
||||
Instruction instdto = new Instruction();
|
||||
instdto.setInstruction_id(IdUtil.simpleUUID());
|
||||
instdto.setRoute_plan_code(route_plan_code);
|
||||
instdto.setRemark(task.getRemark());
|
||||
instdto.setMaterial(task.getMaterial());
|
||||
instdto.setQuantity(task.getQuantity());
|
||||
instdto.setTask_id(taskid);
|
||||
instdto.setTask_code(taskcode);
|
||||
instdto.setVehicle_code(vehiclecode);
|
||||
String now = DateUtil.now();
|
||||
instdto.setCreate_time(now);
|
||||
instdto.setCreate_by("auto");
|
||||
instdto.setStart_device_code(start_device_code);
|
||||
instdto.setNext_device_code(next_device_code);
|
||||
instdto.setStart_point_code(start_point_code);
|
||||
instdto.setNext_point_code(next_point_code);
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
instructionService.create(instdto);
|
||||
//创建指令后修改任务状态
|
||||
WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
||||
task.setTask_status("1");
|
||||
//创建指令后修改任务状态
|
||||
task.setTask_status("1");
|
||||
taskserver.update(task);
|
||||
// this.writing("to_command","1");
|
||||
// if(StrUtil.isNotEmpty(task.getTo_z())){
|
||||
// if(StrUtil.equals(task.getTo_z(),"01")){
|
||||
// this.writing("to_target","102");
|
||||
// } else if(StrUtil.equals(task.getTo_z(),"02")){
|
||||
// this.writing("to_target","201");
|
||||
// } else if(StrUtil.equals(task.getTo_z(),"03")){
|
||||
// this.writing("to_target","301");
|
||||
// }
|
||||
// }
|
||||
// this.writing("to_command","1");
|
||||
// this.writing("to_task",instdto.getInstruction_code());
|
||||
|
||||
List list = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
|
||||
if(StrUtil.isNotEmpty(task.getTo_z())){
|
||||
if(StrUtil.equals(task.getTo_z(),"01")){
|
||||
map.put("code","to_target");
|
||||
map.put("value","102");
|
||||
} else if(StrUtil.equals(task.getTo_z(),"02")){
|
||||
map.put("code","to_target");
|
||||
map.put("value","201");
|
||||
} else if(StrUtil.equals(task.getTo_z(),"03")){
|
||||
map.put("code","to_target");
|
||||
map.put("value","301");
|
||||
}
|
||||
}
|
||||
list.add(map);
|
||||
Map map2 = new HashMap();
|
||||
map2.put("code","to_task");
|
||||
map2.put("value",instdto.getInstruction_code());
|
||||
list.add(map2);
|
||||
Map map3 = new HashMap();
|
||||
map3.put("code","to_command");
|
||||
map3.put("value","1");
|
||||
list.add(map3);
|
||||
this.writing(list);
|
||||
|
||||
requireSucess = true;
|
||||
applySucess = true;
|
||||
} else {
|
||||
log.info("未找到载具号{}对应任务", container_code);
|
||||
}
|
||||
@@ -509,7 +428,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
|
||||
/**
|
||||
* 请求指令
|
||||
*
|
||||
* 定点任务时请求这里
|
||||
* @param container_code
|
||||
* @param container_type
|
||||
*/
|
||||
@@ -600,20 +519,6 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
taskserver.update(task);
|
||||
|
||||
|
||||
|
||||
// this.writing("to_command","1");
|
||||
// if(StrUtil.isNotEmpty(task.getTo_z())){
|
||||
// if(StrUtil.equals(task.getTo_z(),"01")){
|
||||
// this.writing("to_target","102");
|
||||
// } else if(StrUtil.equals(task.getTo_z(),"02")){
|
||||
// this.writing("to_target","201");
|
||||
// } else if(StrUtil.equals(task.getTo_z(),"03")){
|
||||
// this.writing("to_target","301");
|
||||
// }
|
||||
// }
|
||||
// this.writing("to_command","1");
|
||||
// this.writing("to_task",instdto.getInstruction_code());
|
||||
|
||||
List list = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
|
||||
@@ -655,13 +560,16 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
message = "接口不通";
|
||||
} else {
|
||||
if (jo.getInteger("status") == 200) {
|
||||
message = "申请任务成功";
|
||||
requireSucess = true;
|
||||
applySucess = false;
|
||||
} else {
|
||||
requireSucess = false;
|
||||
message = jo.get("message").toString();
|
||||
}
|
||||
}
|
||||
|
||||
// requireSucess = true;
|
||||
// message = "申请任务成功";
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -753,6 +661,11 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
requireSucess = "1";
|
||||
}
|
||||
jo.put("requireSucess", requireSucess);
|
||||
String applySucess = "0";
|
||||
if (this.applySucess) {
|
||||
applySucess = "1";
|
||||
}
|
||||
jo.put("applySucess", applySucess);
|
||||
|
||||
return jo;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class AcsUtil {
|
||||
logServer.extLog(LokiLogType.ACS_TO_LK.name(),"下发立库任务请求参数:{}"+JSON.toJSONString(requestParam) );
|
||||
log.info("下发立库任务请求参数:{}", JSON.toJSONString(requestParam));
|
||||
String body = HttpRequest
|
||||
.post(liKu_wcs_url + api)
|
||||
.post(liKu_wcs_url + api).setConnectionTimeout(3000)
|
||||
.body(JSON.toJSONString(requestParam))
|
||||
.execute()
|
||||
.body();
|
||||
@@ -46,7 +46,7 @@ public class AcsUtil {
|
||||
} catch (Exception e) {
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("result", "false");
|
||||
result.put("code", "");
|
||||
result.put("code", "1");
|
||||
result.put("comment", e.getMessage());
|
||||
log.info("下发立库任务异常返回参数:{}", String.valueOf(result));
|
||||
return String.valueOf(result);
|
||||
|
||||
@@ -85,4 +85,12 @@ public class WmsToAcsController {
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/putPlusPullAction")
|
||||
@Log("下发插拔轴动作")
|
||||
@ApiOperation("下发插拔轴动作")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> putPlusPullAction(@RequestBody String whereJson){
|
||||
return new ResponseEntity<>(wmstoacsService.putPlusPullAction(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package org.nl.acs.ext.wms.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.acs.ext.wms.liKuData.*;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
|
||||
/**
|
||||
* @author: geng by
|
||||
@@ -8,6 +10,9 @@ import org.nl.acs.ext.wms.liKuData.*;
|
||||
*/
|
||||
public interface AcsToLiKuService {
|
||||
|
||||
|
||||
public Resp sendInst(String type, Instruction inst);
|
||||
|
||||
/**
|
||||
* 入库任务下发
|
||||
* @param requestParam
|
||||
|
||||
@@ -75,4 +75,13 @@ public interface WmsToAcsService {
|
||||
Map<String, Object> querydevice(String whereJson);
|
||||
|
||||
|
||||
/**
|
||||
* 下发插拔轴动作
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> putPlusPullAction(String whereJson);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,15 +1,26 @@
|
||||
package org.nl.acs.ext.wms.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.device.address.service.AddressService;
|
||||
import org.nl.acs.ext.wms.RespUtil;
|
||||
import org.nl.acs.ext.wms.AcsUtil;
|
||||
import org.nl.acs.ext.wms.liKuData.*;
|
||||
import org.nl.acs.ext.wms.service.AcsToLiKuService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.modules.system.service.ParamService;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 立库WCS接口
|
||||
*
|
||||
@@ -26,12 +37,13 @@ public class AcsToLiKuServiceImpl implements AcsToLiKuService {
|
||||
private String log_file_type="log_file_type";
|
||||
private String log_type="ACS请求立库";
|
||||
|
||||
|
||||
@Override
|
||||
public Resp<InStoreResponse> inStore(InStoreRequest requestParam) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
String api = addressService.findByCode("inStore").getMethods_url();
|
||||
log.info("inStore-----输入参数{}", requestParam);
|
||||
log.info("inStore-----输入参数{}", JSON.toJSONString(requestParam));
|
||||
String result = AcsUtil.notifyAcs(api, requestParam);
|
||||
log.info("inStore-----输出参数{}", result);
|
||||
return RespUtil.getResp(result, new InStoreResponse());
|
||||
@@ -45,7 +57,7 @@ public class AcsToLiKuServiceImpl implements AcsToLiKuService {
|
||||
public Resp<OutStoreResponse> outStore(OutStoreRequest requestParam) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("outStore-----输入参数{}", requestParam);
|
||||
log.info("outStore-----输入参数{}", JSON.toJSONString(requestParam));
|
||||
String api = addressService.findByCode("outStore").getMethods_url();
|
||||
String result = AcsUtil.notifyAcs(api, requestParam);
|
||||
log.info("outStore-----输出参数{}", result);
|
||||
@@ -60,7 +72,7 @@ public class AcsToLiKuServiceImpl implements AcsToLiKuService {
|
||||
public Resp<EmptyVehicleOutStoreResponse> emptyVehicleOutStore(EmptyVehicleOutStoreRequest requestParam) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("emptyVehicleOutStore-----输入参数{}", requestParam);
|
||||
log.info("emptyVehicleOutStore-----输入参数{}", JSON.toJSONString(requestParam));
|
||||
String api = addressService.findByCode("emptyVehicleOutStore").getMethods_url();
|
||||
String result = AcsUtil.notifyAcs(api, requestParam);
|
||||
log.info("emptyVehicleOutStore-----输出参数{}", result);
|
||||
@@ -75,7 +87,7 @@ public class AcsToLiKuServiceImpl implements AcsToLiKuService {
|
||||
public Resp<MoveStoreResponse> moveStore(MoveStoreRequest requestParam) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("moveStore-----输入参数{}", requestParam);
|
||||
log.info("moveStore-----输入参数{}", JSON.toJSONString(requestParam));
|
||||
String api = addressService.findByCode("moveStore").getMethods_url();
|
||||
String result = AcsUtil.notifyAcs(api, requestParam);
|
||||
log.info("moveStore-----输出参数{}", result);
|
||||
@@ -90,7 +102,7 @@ public class AcsToLiKuServiceImpl implements AcsToLiKuService {
|
||||
public Resp<InStoreResetResponse> inStoreReset(InStoreResetRequest requestParam) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("inStoreReset-----输入参数{}", requestParam);
|
||||
log.info("inStoreReset-----输入参数{}", JSON.toJSONString(requestParam));
|
||||
String api = addressService.findByCode("inStoreReset").getMethods_url();
|
||||
String result = AcsUtil.notifyAcs(api, requestParam);
|
||||
log.info("inStoreReset-----输出参数{}", result);
|
||||
@@ -105,7 +117,7 @@ public class AcsToLiKuServiceImpl implements AcsToLiKuService {
|
||||
public Resp<MoveStoreResetResponse> moveStoreReset(MoveStoreResetRequest requestParam) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("moveStoreReset-----输入参数{}", requestParam);
|
||||
log.info("moveStoreReset-----输入参数{}", JSON.toJSONString(requestParam));
|
||||
String api = addressService.findByCode("moveStoreReset").getMethods_url();
|
||||
String result = AcsUtil.notifyAcs(api, requestParam);
|
||||
log.info("moveStoreReset-----输出参数{}", result);
|
||||
@@ -121,7 +133,7 @@ public class AcsToLiKuServiceImpl implements AcsToLiKuService {
|
||||
public Resp<RoadWayIsLockResponse> roadWayIsLock(RoadWayIsLockRequest requestParam) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("roadWayIsLock-----输入参数{}", requestParam);
|
||||
log.info("roadWayIsLock-----输入参数{}", JSON.toJSONString(requestParam));
|
||||
String api = addressService.findByCode("roadWayIsLock").getMethods_url();
|
||||
String result = AcsUtil.notifyAcs(api, requestParam);
|
||||
log.info("roadWayIsLock-----输出参数{}", result);
|
||||
@@ -138,7 +150,7 @@ public class AcsToLiKuServiceImpl implements AcsToLiKuService {
|
||||
public Resp<CancelTaskResponse> cancelTask(CancelTaskRequest requestParam) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("cancelTask-----输入参数{}", requestParam);
|
||||
log.info("cancelTask-----输入参数{}", JSON.toJSONString(requestParam));
|
||||
String api = addressService.findByCode("cancelTask").getMethods_url();
|
||||
String result = AcsUtil.notifyAcs(api, requestParam);
|
||||
log.info("cancelTask-----输出参数{}", result);
|
||||
@@ -154,7 +166,7 @@ public class AcsToLiKuServiceImpl implements AcsToLiKuService {
|
||||
public Resp<DeviceStatusResponse> queryCarDeviceStatus(DeviceStatusRequest requestParam) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("queryCarDeviceStatus-----输入参数{}", requestParam);
|
||||
log.info("queryCarDeviceStatus-----输入参数{}", JSON.toJSONString(requestParam));
|
||||
String api = addressService.findByCode("queryCarDeviceStatus").getMethods_url();
|
||||
String result = AcsUtil.notifyAcs(api, requestParam);
|
||||
log.info("queryCarDeviceStatus-----输出参数{}", result);
|
||||
@@ -168,7 +180,7 @@ public class AcsToLiKuServiceImpl implements AcsToLiKuService {
|
||||
public Resp<DeviceStatusResponse> queryTsjDeviceStatus(DeviceStatusRequest requestParam) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("queryTsjDeviceStatus-----输入参数{}", requestParam);
|
||||
log.info("queryTsjDeviceStatus-----输入参数{}", JSON.toJSONString(requestParam));
|
||||
String api = addressService.findByCode("queryTsjDeviceStatus").getMethods_url();
|
||||
String result = AcsUtil.notifyAcs(api, requestParam);
|
||||
log.info("queryTsjDeviceStatus-----输出参数{}", result);
|
||||
@@ -182,7 +194,7 @@ public class AcsToLiKuServiceImpl implements AcsToLiKuService {
|
||||
public Resp<DeviceStatusResponse> querySsxDeviceStatus(DeviceStatusRequest requestParam) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("querySsxDeviceStatus-----输入参数{}", requestParam);
|
||||
log.info("querySsxDeviceStatus-----输入参数{}", JSON.toJSONString(requestParam));
|
||||
String api = addressService.findByCode("querySsxDeviceStatus").getMethods_url();
|
||||
String result = AcsUtil.notifyAcs(api, requestParam);
|
||||
log.info("querySsxDeviceStatus-----输出参数{}", result);
|
||||
@@ -192,4 +204,86 @@ public class AcsToLiKuServiceImpl implements AcsToLiKuService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Resp sendInst(String type, Instruction dto){
|
||||
AcsToLiKuService acsToLiKuService = SpringContextHolder.getBean(AcsToLiKuService.class);
|
||||
ParamService paramService = SpringContextHolder.getBean(ParamService.class);
|
||||
|
||||
Resp resp = new Resp();
|
||||
String instSendLk = paramService.findByCode(AcsConfig.INSTSENDLK).getValue();
|
||||
|
||||
try {
|
||||
if(StrUtil.equals(instSendLk, "1")){
|
||||
if(StrUtil.equals(type,"1")){
|
||||
InStoreRequest request = new InStoreRequest();
|
||||
request.setFloorNo(Integer.parseInt(dto.getTo_z()));
|
||||
request.setType(1);
|
||||
request.setPalletCode(dto.getVehicle_code());
|
||||
request.setOrderId(dto.getInstruction_code());
|
||||
request.setSrcLocation(dto.getStart_point_code());
|
||||
request.setDestLocation(dto.getNext_point_code());
|
||||
resp = acsToLiKuService.inStore(request);
|
||||
//空托入库
|
||||
} else if (StrUtil.equals(type,"2")){
|
||||
InStoreRequest request = new InStoreRequest();
|
||||
request.setFloorNo(Integer.parseInt(dto.getTo_z()));
|
||||
request.setType(2);
|
||||
request.setPalletCode(dto.getVehicle_code());
|
||||
request.setOrderId(dto.getInstruction_code());
|
||||
request.setSrcLocation(dto.getStart_point_code());
|
||||
request.setDestLocation(dto.getNext_point_code());
|
||||
resp = acsToLiKuService.inStore(request);
|
||||
//出库
|
||||
} else if (StrUtil.equals(type,"3")){
|
||||
OutStoreRequest outStore = new OutStoreRequest();
|
||||
BaseStoreRequest baseReq = new BaseStoreRequest();
|
||||
List<BaseStoreRequest> list = new ArrayList();
|
||||
baseReq.setOrderId(dto.getInstruction_code());
|
||||
baseReq.setSrcLocation(dto.getStart_point_code());
|
||||
baseReq.setDestLocation(dto.getNext_point_code());
|
||||
baseReq.setFloorNo(Integer.parseInt(dto.getFrom_z()));
|
||||
baseReq.setPalletCode(dto.getVehicle_code());
|
||||
list.add(baseReq);
|
||||
outStore.setOrderInfos(list);
|
||||
outStore.setGroupId(dto.getInstruction_code());
|
||||
resp = acsToLiKuService.outStore(outStore);
|
||||
//空托出库
|
||||
} else if (StrUtil.equals(type,"4")) {
|
||||
EmptyVehicleOutStoreRequest emptyVehicleOutStoreRequest = new EmptyVehicleOutStoreRequest();
|
||||
emptyVehicleOutStoreRequest.setOrderId(dto.getInstruction_code());
|
||||
emptyVehicleOutStoreRequest.setFloorNo(Integer.parseInt(dto.getFrom_z()));
|
||||
emptyVehicleOutStoreRequest.setSrcLocation(dto.getStart_point_code());
|
||||
emptyVehicleOutStoreRequest.setDestLocation(dto.getNext_point_code());
|
||||
emptyVehicleOutStoreRequest.setPalletCode(dto.getVehicle_code());
|
||||
resp = acsToLiKuService.emptyVehicleOutStore(emptyVehicleOutStoreRequest);
|
||||
//转库
|
||||
} else if (StrUtil.equals(type,"5")) {
|
||||
MoveStoreRequest moveStoreRequest = new MoveStoreRequest();
|
||||
BaseStoreRequest baseReq = new BaseStoreRequest();
|
||||
List<BaseStoreRequest> list = new ArrayList();
|
||||
baseReq.setFloorNo(Integer.parseInt(dto.getFrom_z()));
|
||||
baseReq.setPalletCode(dto.getVehicle_code());
|
||||
baseReq.setOrderId(dto.getInstruction_code());
|
||||
baseReq.setSrcLocation(dto.getStart_point_code());
|
||||
baseReq.setDestLocation(dto.getNext_point_code());
|
||||
list.add(baseReq);
|
||||
moveStoreRequest.setGroupId(dto.getInstruction_code());
|
||||
moveStoreRequest.setOrderInfos(list);
|
||||
resp = acsToLiKuService.moveStore(moveStoreRequest);
|
||||
}
|
||||
} else {
|
||||
resp.setCode("0");
|
||||
resp.setResult("true");
|
||||
resp.setComment("ACS模拟下发成功");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
resp.setCode("1");
|
||||
resp.setResult("false");
|
||||
resp.setComment(e.getMessage());
|
||||
}
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.acs.ext.wms.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -57,13 +58,15 @@ public class LiKuToAcsServiceImpl implements LiKuToAcsService {
|
||||
public Resp<InStoreReportResponse> inStoreReport(InStoreReportRequest requestParam) throws Exception {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("入库任务状态反馈-----输入参数{}", requestParam.toString());
|
||||
log.info("入库任务状态反馈-----输入参数{}", JSON.toJSONString(requestParam));
|
||||
String inst_code = requestParam.getOrderId();
|
||||
String status = requestParam.getState();
|
||||
Instruction inst = instructionService.findByCodeFromCache(inst_code);
|
||||
TaskDto task = taskService.findByCodeFromCache(inst.getTask_code());
|
||||
// 1 已接收 2 开始执行 3执行完成 4 阻挡 5 空洞
|
||||
if(StrUtil.equals(status,"1") || StrUtil.equals(status,"2") ){
|
||||
task.setTask_status("1");
|
||||
taskService.update(task);
|
||||
inst.setInstruction_status("1");
|
||||
instructionService.update(inst);
|
||||
} else if(StrUtil.equals(status,"3")){
|
||||
@@ -132,7 +135,7 @@ public class LiKuToAcsServiceImpl implements LiKuToAcsService {
|
||||
public Resp<OutStoreReportResponse> outStoreReport(OutStoreReportRequest requestParam) throws Exception {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("出库任务状态反馈-----输入参数{}", requestParam.toString());
|
||||
log.info("出库任务状态反馈-----输入参数{}", JSON.toJSONString(requestParam));
|
||||
String inst_code = requestParam.getOrderId();
|
||||
String status = requestParam.getState();
|
||||
Instruction inst = instructionService.findByCodeFromCache(inst_code);
|
||||
@@ -140,6 +143,8 @@ public class LiKuToAcsServiceImpl implements LiKuToAcsService {
|
||||
|
||||
// 1 已接收 2 开始执行 3执行完成 4 阻挡 5 空洞
|
||||
if(StrUtil.equals(status,"1") || StrUtil.equals(status,"2") ){
|
||||
task.setTask_status("1");
|
||||
taskService.update(task);
|
||||
inst.setInstruction_status("1");
|
||||
instructionService.update(inst);
|
||||
} else if(StrUtil.equals(status,"3")){
|
||||
@@ -190,13 +195,15 @@ public class LiKuToAcsServiceImpl implements LiKuToAcsService {
|
||||
public Resp<MoveStoreReportResponse> moveStoreReport(MoveStoreReportRequest requestParam) throws Exception {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("移库任务上报-----输入参数{}", requestParam.toString());
|
||||
log.info("移库任务上报-----输入参数{}", JSON.toJSONString(requestParam));
|
||||
String inst_code = requestParam.getOrderId();
|
||||
String status = requestParam.getState();
|
||||
Instruction inst = instructionService.findByCodeFromCache(inst_code);
|
||||
TaskDto task = taskService.findByCodeFromCache(inst.getTask_code());
|
||||
// 1 已接收 2 开始执行 3执行完成 4 阻挡 5 空洞
|
||||
if(StrUtil.equals(status,"1") || StrUtil.equals(status,"2") ){
|
||||
task.setTask_status("1");
|
||||
taskService.update(task);
|
||||
inst.setInstruction_status("1");
|
||||
instructionService.update(inst);
|
||||
|
||||
@@ -272,7 +279,7 @@ public class LiKuToAcsServiceImpl implements LiKuToAcsService {
|
||||
public Resp<DeviceStatusResponse> putEmptyPallet(putEmptyPalletRequest requestParam) throws Exception {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("请求放空盘-----输入参数{}", requestParam.toString());
|
||||
log.info("请求放空盘-----输入参数{}", JSON.toJSONString(requestParam));
|
||||
String device_code = requestParam.getDeviceId();
|
||||
String type = requestParam.getType();
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
@@ -283,7 +290,7 @@ public class LiKuToAcsServiceImpl implements LiKuToAcsService {
|
||||
if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
||||
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
|
||||
if(StrUtil.equals(type,"1")){
|
||||
if(siemensConveyorDeviceDriver.getMode() ==2 && siemensConveyorDeviceDriver.getMove() ==0){
|
||||
if((siemensConveyorDeviceDriver.getMode() ==2 || siemensConveyorDeviceDriver.getMode() ==7 )&& siemensConveyorDeviceDriver.getMove() ==0){
|
||||
result.put("result", "true");
|
||||
result.put("comment", "");
|
||||
} else {
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.acs.ext.wms.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -13,8 +14,11 @@ import org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.CargoLiftConveyor
|
||||
import org.nl.acs.device_driver.basedriver.empty_vehicle_stacking_position.EmptyVehicleStackingPositionDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.hongxiang_conveyor.HongXiangStationDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.plug_pull_device_site.PlugPullDeviceSiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
|
||||
import org.nl.acs.ext.wms.data.*;
|
||||
import org.nl.acs.ext.wms.liKuData.Resp;
|
||||
import org.nl.acs.ext.wms.service.AcsToLiKuService;
|
||||
import org.nl.acs.ext.wms.service.WmsToAcsService;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
@@ -34,6 +38,8 @@ import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -49,6 +55,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
private final DeviceService deviceService;
|
||||
private final DeviceAppService deviceAppService;
|
||||
private final RouteLineService routeLineService;
|
||||
private final AcsToLiKuService acsToLiKuService;
|
||||
|
||||
|
||||
private String log_file_type="log_file_type";
|
||||
private String log_type="LMS请求ACS";
|
||||
@@ -157,10 +165,14 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
throw new Exception("未找到对应设备:" + device_code);
|
||||
}
|
||||
HongXiangStationDeviceDriver hongXiangStationDeviceDriver;
|
||||
PlugPullDeviceSiteDeviceDriver plugPullDeviceSiteDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
|
||||
hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver();
|
||||
hongXiangStationDeviceDriver.writing(code, value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
response.setStatus(200);
|
||||
response.setMessage("success");
|
||||
@@ -219,6 +231,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
jo.put("countdown_house", hongXiangConveyorDeviceDriver.getCountdown_house());
|
||||
jo.put("countdown_min", hongXiangConveyorDeviceDriver.getCountdown_min());
|
||||
jo.put("countdown_sec", hongXiangConveyorDeviceDriver.getCountdown_sec());
|
||||
//温度需要除以100 待实现
|
||||
jo.put("temperature", hongXiangConveyorDeviceDriver.getTemperature());
|
||||
jo.put("door", hongXiangConveyorDeviceDriver.getDoor());
|
||||
jo.put("finish", hongXiangConveyorDeviceDriver.getFinish());
|
||||
@@ -291,6 +304,160 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> putPlusPullAction(String param) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("putPlusPullAction-----输入参数{}", param);
|
||||
JSONObject jo = JSON.parseObject(param);
|
||||
String device_code = jo.getString("device_code");
|
||||
String size = jo.getString("size");
|
||||
String type = jo.getString("type");
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "未找到对应的设备:"+device_code);
|
||||
return resultJson;
|
||||
}
|
||||
PlugPullDeviceSiteDeviceDriver plugPullDeviceSiteDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
|
||||
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) device.getDeviceDriver();
|
||||
// 0 穿轴 1拔轴
|
||||
if(StrUtil.equals(type,"1")){
|
||||
|
||||
if(plugPullDeviceSiteDeviceDriver.getMode() == 1){
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "请求拔轴,当前设备工作模式未自动");
|
||||
return resultJson;
|
||||
}
|
||||
if(plugPullDeviceSiteDeviceDriver.getAction() == 0){
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "请求拔轴,当前设备未全自动");
|
||||
return resultJson;
|
||||
}
|
||||
if(plugPullDeviceSiteDeviceDriver.getStatus() != 0){
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "请求拔轴,当前设备未待机");
|
||||
return resultJson;
|
||||
}
|
||||
if(plugPullDeviceSiteDeviceDriver.getControl() != 0){
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "请求拔轴,当前设备未远程控制");
|
||||
return resultJson;
|
||||
}
|
||||
if(plugPullDeviceSiteDeviceDriver.getMove() != 0){
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "请求拔轴,当前设备有轴");
|
||||
return resultJson;
|
||||
}
|
||||
if(plugPullDeviceSiteDeviceDriver.getMode() == 0 && plugPullDeviceSiteDeviceDriver.getAction() ==1
|
||||
&& plugPullDeviceSiteDeviceDriver.getStatus() ==0 && plugPullDeviceSiteDeviceDriver.getMove() ==0
|
||||
&& plugPullDeviceSiteDeviceDriver.getControl() ==0 ){
|
||||
|
||||
List list = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
map.put("code","to_size");
|
||||
map.put("value",size);
|
||||
list.add(map);
|
||||
Map map2 = new HashMap();
|
||||
map2.put("code","to_type");
|
||||
map2.put("value",type);
|
||||
list.add(map2);
|
||||
Map map3 = new HashMap();
|
||||
map3.put("code","to_command");
|
||||
map3.put("value","1");
|
||||
list.add(map3);
|
||||
plugPullDeviceSiteDeviceDriver.writing(list);
|
||||
|
||||
} else {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "当前设备状态不满足下发条件");
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
} else if (StrUtil.equals(type,"0")){
|
||||
|
||||
if(plugPullDeviceSiteDeviceDriver.getMode() == 1){
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "请求插轴,当前设备工作模式未自动");
|
||||
return resultJson;
|
||||
}
|
||||
if(plugPullDeviceSiteDeviceDriver.getAction() == 0){
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "请求插轴,当前设备未全自动");
|
||||
return resultJson;
|
||||
}
|
||||
if(plugPullDeviceSiteDeviceDriver.getStatus() != 0){
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "请求插轴,当前设备未待机");
|
||||
return resultJson;
|
||||
}
|
||||
if(plugPullDeviceSiteDeviceDriver.getControl() != 0){
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "请求插轴,当前设备未远程控制");
|
||||
return resultJson;
|
||||
}
|
||||
if(plugPullDeviceSiteDeviceDriver.getMove() != 1){
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "请求插轴,当前设备没有轴");
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
if(plugPullDeviceSiteDeviceDriver.getMode() == 0 && plugPullDeviceSiteDeviceDriver.getAction() ==1
|
||||
&& plugPullDeviceSiteDeviceDriver.getStatus() ==0 && plugPullDeviceSiteDeviceDriver.getMove() ==1
|
||||
&& plugPullDeviceSiteDeviceDriver.getControl() ==0 ){
|
||||
|
||||
List list = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
map.put("code","to_size");
|
||||
map.put("value",size);
|
||||
list.add(map);
|
||||
Map map2 = new HashMap();
|
||||
map2.put("code","to_type");
|
||||
map2.put("value",type);
|
||||
list.add(map2);
|
||||
Map map3 = new HashMap();
|
||||
map3.put("code","to_command");
|
||||
map3.put("value","1");
|
||||
list.add(map3);
|
||||
plugPullDeviceSiteDeviceDriver.writing(list);
|
||||
|
||||
} else {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "当前设备状态不满足下发条件");
|
||||
return resultJson;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.OK.value());
|
||||
resultJson.put("message", "操作成功");
|
||||
log.info("putPlusPullAction--------------:输出参数" + resultJson.toString());
|
||||
return resultJson;
|
||||
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public CreateTaskResponse crateTask(String param) {
|
||||
try {
|
||||
@@ -330,13 +497,28 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
String next_point_code2 = "";
|
||||
String put_point_code = "";
|
||||
if (StrUtil.isEmpty(task_code)) {
|
||||
throw new WDKException("任务号不能为空");
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("ext_task_id", ext_task_id);
|
||||
json.put("message", "任务号不能为空");
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
if (StrUtil.isEmpty(start_device_code)) {
|
||||
throw new WDKException("起点不能为空");
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("ext_task_id", ext_task_id);
|
||||
json.put("message", "起点不能为空");
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
if (StrUtil.isEmpty(next_device_code)) {
|
||||
throw new WDKException("终点不能为空");
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("ext_task_id", ext_task_id);
|
||||
json.put("message", "终点不能为空");
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -399,14 +581,32 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
route_plan_code = "normal";
|
||||
}
|
||||
|
||||
if( StrUtil.equals(task_type,"5") && taskService.querySameDeviceReadyTask(start_device_code,next_device_code,"0") > 1){
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("ext_task_id", ext_task_id);
|
||||
json.put("message", "已存在相同的起点终点未执行的输送任务");
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
TaskDto taskDto = taskService.findByCodeFromCache(task_code);
|
||||
if (taskDto != null) {
|
||||
throw new WDKException("不能存在相同的任务号!");
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("ext_task_id", ext_task_id);
|
||||
json.put("message", "不能存在相同的任务号");
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
if (!StrUtil.isEmpty(vehicle_code)) {
|
||||
TaskDto vehicle_dto = taskService.findByContainer(vehicle_code);
|
||||
if (vehicle_dto != null) {
|
||||
throw new WDKException("已存在该载具号的任务!");
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("ext_task_id", ext_task_id);
|
||||
json.put("message", "不能存在相同的托盘号");
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -460,12 +660,44 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
try {
|
||||
// task_type=7 则是立库任务需要下刻下发
|
||||
if (StrUtil.equals(task_dto.getTask_type(), "7")) {
|
||||
taskService.create(task_dto);
|
||||
// taskService.create(task_dto);
|
||||
// try{
|
||||
// taskService.createInst(task_dto.getTask_id());
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// JSONObject json = new JSONObject();
|
||||
// json.put("task_code", task_code);
|
||||
// json.put("ext_task_id", ext_task_id);
|
||||
// json.put("message", "创建指令失败:"+e.getMessage());
|
||||
// errArr.add(json);
|
||||
// }
|
||||
|
||||
//创建临时指令 不创建、不生成
|
||||
//等立库反馈成功才能创建任务和指令
|
||||
Instruction inst = taskService.createTemporaryInst(task_dto);
|
||||
Resp resp = acsToLiKuService.sendInst(task_dto.getStorage_task_type(),inst);
|
||||
|
||||
if(StrUtil.equals(resp.result,"true")){
|
||||
//创建任务和指令
|
||||
taskService.create(task_dto);
|
||||
inst.setSend_status("1");
|
||||
taskService.createInst(inst);
|
||||
|
||||
} else {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("ext_task_id", ext_task_id);
|
||||
json.put("message", resp.getComment());
|
||||
json.put("code", resp.code);
|
||||
json.put("data", data);
|
||||
errArr.add(json);
|
||||
}
|
||||
|
||||
} else {
|
||||
taskService.create(task_dto);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
// e.printStackTrace();
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("ext_task_id", ext_task_id);
|
||||
@@ -480,7 +712,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
}
|
||||
response.setMessage("success");
|
||||
response.setErrArr(errArr);
|
||||
log.info("createFromWms--------------:输出参数:" + response);
|
||||
log.info("createFromWms--------------:输出参数:" + JSON.toJSONString(response));
|
||||
|
||||
return response;
|
||||
} finally {
|
||||
|
||||
@@ -103,6 +103,7 @@ public interface InstructionService {
|
||||
*/
|
||||
void create(Instruction dto) throws Exception;
|
||||
|
||||
void create2(Instruction dto) throws Exception;
|
||||
/**
|
||||
* 再次创建
|
||||
*
|
||||
@@ -270,4 +271,8 @@ public interface InstructionService {
|
||||
|
||||
boolean removeByCodeFromCache(String code);
|
||||
|
||||
|
||||
boolean createLkInst(String type,Instruction inst);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -254,7 +254,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(Instruction dto) throws Exception {
|
||||
dto = foramte(dto);
|
||||
String task_code = dto.getTask_code();
|
||||
@@ -345,74 +344,12 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(),dto);
|
||||
} else {
|
||||
//入库
|
||||
AcsToLiKuService acsToLiKuService = SpringContextHolder.getBean(AcsToLiKuService.class);
|
||||
Resp resp = null;
|
||||
if(StrUtil.equals(task.getStorage_task_type(),"1")){
|
||||
InStoreRequest request = new InStoreRequest();
|
||||
request.setFloorNo(Integer.parseInt(dto.getTo_z()));
|
||||
request.setType(1);
|
||||
request.setPalletCode(dto.getVehicle_code());
|
||||
request.setOrderId(dto.getInstruction_code());
|
||||
request.setSrcLocation(dto.getStart_point_code());
|
||||
request.setDestLocation(dto.getNext_point_code());
|
||||
resp = acsToLiKuService.inStore(request);
|
||||
//空托入库
|
||||
} else if (StrUtil.equals(task.getStorage_task_type(),"2")){
|
||||
InStoreRequest request = new InStoreRequest();
|
||||
request.setFloorNo(Integer.parseInt(dto.getTo_z()));
|
||||
request.setType(2);
|
||||
request.setPalletCode(dto.getVehicle_code());
|
||||
request.setOrderId(dto.getInstruction_code());
|
||||
request.setSrcLocation(dto.getStart_point_code());
|
||||
request.setDestLocation(dto.getNext_point_code());
|
||||
resp = acsToLiKuService.inStore(request);
|
||||
//出库
|
||||
} else if (StrUtil.equals(task.getStorage_task_type(),"3")){
|
||||
OutStoreRequest outStore = new OutStoreRequest();
|
||||
BaseStoreRequest baseReq = new BaseStoreRequest();
|
||||
List<BaseStoreRequest> list = new ArrayList();
|
||||
baseReq.setOrderId(dto.getInstruction_code());
|
||||
baseReq.setSrcLocation(dto.getStart_point_code());
|
||||
baseReq.setDestLocation(dto.getNext_point_code());
|
||||
baseReq.setFloorNo(Integer.parseInt(dto.getFrom_z()));
|
||||
baseReq.setPalletCode(dto.getVehicle_code());
|
||||
list.add(baseReq);
|
||||
outStore.setOrderInfos(list);
|
||||
outStore.setGroupId(dto.getInstruction_code());
|
||||
resp = acsToLiKuService.outStore(outStore);
|
||||
//空托出库
|
||||
} else if (StrUtil.equals(task.getStorage_task_type(),"4")) {
|
||||
EmptyVehicleOutStoreRequest emptyVehicleOutStoreRequest = new EmptyVehicleOutStoreRequest();
|
||||
emptyVehicleOutStoreRequest.setOrderId(dto.getInstruction_code());
|
||||
emptyVehicleOutStoreRequest.setFloorNo(Integer.parseInt(dto.getFrom_z()));
|
||||
emptyVehicleOutStoreRequest.setSrcLocation(dto.getStart_point_code());
|
||||
emptyVehicleOutStoreRequest.setDestLocation(dto.getNext_point_code());
|
||||
emptyVehicleOutStoreRequest.setPalletCode(dto.getVehicle_code());
|
||||
resp = acsToLiKuService.emptyVehicleOutStore(emptyVehicleOutStoreRequest);
|
||||
//转库
|
||||
} else if (StrUtil.equals(task.getStorage_task_type(),"5")) {
|
||||
MoveStoreRequest moveStoreRequest = new MoveStoreRequest();
|
||||
BaseStoreRequest baseReq = new BaseStoreRequest();
|
||||
List<BaseStoreRequest> list = new ArrayList();
|
||||
baseReq.setFloorNo(Integer.parseInt(dto.getFrom_z()));
|
||||
baseReq.setPalletCode(dto.getVehicle_code());
|
||||
baseReq.setOrderId(dto.getInstruction_code());
|
||||
baseReq.setSrcLocation(dto.getStart_point_code());
|
||||
baseReq.setDestLocation(dto.getNext_point_code());
|
||||
list.add(baseReq);
|
||||
moveStoreRequest.setGroupId(dto.getInstruction_code());
|
||||
moveStoreRequest.setOrderInfos(list);
|
||||
resp = acsToLiKuService.moveStore(moveStoreRequest);
|
||||
}
|
||||
|
||||
if(ObjectUtil.isNotEmpty(resp)){
|
||||
if(StrUtil.equals(resp.getResult(),"true")){
|
||||
dto.setSend_status("1");
|
||||
} else {
|
||||
dto.setSend_status("2");
|
||||
dto.setRemark(resp.getData().toString());
|
||||
}
|
||||
// Boolean result = createLkInst(task.getStorage_task_type(),dto);
|
||||
Resp resp = acsToLiKuService.sendInst(task.getStorage_task_type(),dto);
|
||||
if(StrUtil.equals(resp.result,"true")){
|
||||
dto.setSend_status("1");
|
||||
} else {
|
||||
dto.setSend_status("2");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -429,6 +366,114 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void create2(Instruction dto) throws Exception {
|
||||
dto = foramte(dto);
|
||||
String task_code = dto.getTask_code();
|
||||
TaskDto task = taskService.findByCodeFromCache(task_code);
|
||||
|
||||
WQLObject instwo = WQLObject.getWQLObject("acs_instruction");
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
if (StrUtil.isEmpty(dto.getRoute_plan_code())) {
|
||||
dto.setRoute_plan_code(task.getRoute_plan_code());
|
||||
}
|
||||
if (StrUtil.isEmpty(dto.getPriority())) {
|
||||
dto.setPriority(task.getPriority());
|
||||
}
|
||||
if (StrUtil.isEmpty(dto.getInstruction_code())) {
|
||||
dto.setInstruction_code(CodeUtil.getNewCode("INSTRUCT_NO"));
|
||||
}
|
||||
if (StrUtil.isEmpty(dto.getInstruction_id())) {
|
||||
dto.setInstruction_id(IdUtil.simpleUUID());
|
||||
}
|
||||
if (StrUtil.isEmpty(dto.getIs_send())) {
|
||||
dto.setIs_send(task.getIs_send());
|
||||
}
|
||||
if (StrUtil.isEmpty(dto.getLink_num())) {
|
||||
dto.setIs_send(task.getLink_num());
|
||||
}
|
||||
if (task.getTask_type().equals("1") || task.getTask_type().equals("2")) {
|
||||
dto.setInstruction_type(task.getTask_type());
|
||||
} else if (false) {
|
||||
|
||||
} else {
|
||||
dto.setInstruction_type("3");
|
||||
}
|
||||
|
||||
|
||||
//起点设备与终点设备相同则为初始指令
|
||||
if (StrUtil.equals(task.getStart_device_code(), dto.getStart_device_code())) {
|
||||
if (!StrUtil.equals(dto.getCompound_inst(), "0") && StrUtil.equals(task.getCompound_task(), "1")) {
|
||||
dto.setCompound_inst("1");
|
||||
dto.setCompound_inst_data(task.getCompound_task_data());
|
||||
}
|
||||
}
|
||||
|
||||
dto.setCreate_by(currentUsername);
|
||||
dto.setUpdate_by(currentUsername);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
dto.setStart_parent_code(task.getStart_parent_code());
|
||||
dto.setNext_parent_code(task.getNext_parent_code());
|
||||
|
||||
if (ObjectUtil.isNotEmpty(task.getTask_type())) {
|
||||
dto.setInstruction_type(task.getTask_type());
|
||||
}
|
||||
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
Device startdevice = appService.findDeviceByCode(dto.getStart_device_code());
|
||||
Device nextdevice = appService.findDeviceByCode(dto.getNext_device_code());
|
||||
|
||||
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
||||
StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver;
|
||||
|
||||
if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver();
|
||||
hongXiangConveyorDeviceDriver.writing(3, Integer.valueOf(dto.getInstruction_code()));
|
||||
}
|
||||
|
||||
try {
|
||||
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;
|
||||
for (int i = 0; i < shortPathsList.size(); i++) {
|
||||
RouteLineDto routeLineDto = shortPathsList.get(i);
|
||||
String route_device = routeLineDto.getDevice_code();
|
||||
String route_next_device = routeLineDto.getNext_device_code();
|
||||
if (route_device.equals(dto.getStart_device_code()) && route_next_device.equals(dto.getNext_device_code())) {
|
||||
route = routeLineDto;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isEmpty(route)) {
|
||||
throw new BadRequestException("未查询到相关路由!");
|
||||
}
|
||||
if (StrUtil.equals(shortPathsList.get(0).getType(), "1")){
|
||||
// 0为输送、立库任务 1 1楼叉车系统 2 2楼1区域AGV系统 3 2楼2区域AGV系统
|
||||
if (!StrUtil.equals(task.getAgv_system_type(), "0") && ObjectUtil.isNotEmpty(task.getAgv_system_type())) {
|
||||
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(),dto);
|
||||
} else {
|
||||
// Boolean result = createLkInst(task.getStorage_task_type(),dto);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
dto.setSend_status("2");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
|
||||
wo.insert(json);
|
||||
instructions.add(dto);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void createAgain(Instruction dto) throws Exception {
|
||||
@@ -1201,6 +1246,89 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean createLkInst(String type, Instruction dto) {
|
||||
//入库
|
||||
AcsToLiKuService acsToLiKuService = SpringContextHolder.getBean(AcsToLiKuService.class);
|
||||
Resp resp = null;
|
||||
if(StrUtil.equals(type,"1")){
|
||||
InStoreRequest request = new InStoreRequest();
|
||||
request.setFloorNo(Integer.parseInt(dto.getTo_z()));
|
||||
request.setType(1);
|
||||
request.setPalletCode(dto.getVehicle_code());
|
||||
request.setOrderId(dto.getInstruction_code());
|
||||
request.setSrcLocation(dto.getStart_point_code());
|
||||
request.setDestLocation(dto.getNext_point_code());
|
||||
resp = acsToLiKuService.inStore(request);
|
||||
//空托入库
|
||||
} else if (StrUtil.equals(type,"2")){
|
||||
InStoreRequest request = new InStoreRequest();
|
||||
request.setFloorNo(Integer.parseInt(dto.getTo_z()));
|
||||
request.setType(2);
|
||||
request.setPalletCode(dto.getVehicle_code());
|
||||
request.setOrderId(dto.getInstruction_code());
|
||||
request.setSrcLocation(dto.getStart_point_code());
|
||||
request.setDestLocation(dto.getNext_point_code());
|
||||
resp = acsToLiKuService.inStore(request);
|
||||
//出库
|
||||
} else if (StrUtil.equals(type,"3")){
|
||||
OutStoreRequest outStore = new OutStoreRequest();
|
||||
BaseStoreRequest baseReq = new BaseStoreRequest();
|
||||
List<BaseStoreRequest> list = new ArrayList();
|
||||
baseReq.setOrderId(dto.getInstruction_code());
|
||||
baseReq.setSrcLocation(dto.getStart_point_code());
|
||||
baseReq.setDestLocation(dto.getNext_point_code());
|
||||
baseReq.setFloorNo(Integer.parseInt(dto.getFrom_z()));
|
||||
baseReq.setPalletCode(dto.getVehicle_code());
|
||||
list.add(baseReq);
|
||||
outStore.setOrderInfos(list);
|
||||
outStore.setGroupId(dto.getInstruction_code());
|
||||
resp = acsToLiKuService.outStore(outStore);
|
||||
//空托出库
|
||||
} else if (StrUtil.equals(type,"4")) {
|
||||
EmptyVehicleOutStoreRequest emptyVehicleOutStoreRequest = new EmptyVehicleOutStoreRequest();
|
||||
emptyVehicleOutStoreRequest.setOrderId(dto.getInstruction_code());
|
||||
emptyVehicleOutStoreRequest.setFloorNo(Integer.parseInt(dto.getFrom_z()));
|
||||
emptyVehicleOutStoreRequest.setSrcLocation(dto.getStart_point_code());
|
||||
emptyVehicleOutStoreRequest.setDestLocation(dto.getNext_point_code());
|
||||
emptyVehicleOutStoreRequest.setPalletCode(dto.getVehicle_code());
|
||||
resp = acsToLiKuService.emptyVehicleOutStore(emptyVehicleOutStoreRequest);
|
||||
//转库
|
||||
} else if (StrUtil.equals(type,"5")) {
|
||||
MoveStoreRequest moveStoreRequest = new MoveStoreRequest();
|
||||
BaseStoreRequest baseReq = new BaseStoreRequest();
|
||||
List<BaseStoreRequest> list = new ArrayList();
|
||||
baseReq.setFloorNo(Integer.parseInt(dto.getFrom_z()));
|
||||
baseReq.setPalletCode(dto.getVehicle_code());
|
||||
baseReq.setOrderId(dto.getInstruction_code());
|
||||
baseReq.setSrcLocation(dto.getStart_point_code());
|
||||
baseReq.setDestLocation(dto.getNext_point_code());
|
||||
list.add(baseReq);
|
||||
moveStoreRequest.setGroupId(dto.getInstruction_code());
|
||||
moveStoreRequest.setOrderInfos(list);
|
||||
resp = acsToLiKuService.moveStore(moveStoreRequest);
|
||||
}
|
||||
|
||||
if(ObjectUtil.isNotEmpty(resp)){
|
||||
if(StrUtil.equals(resp.getResult(),"true")){
|
||||
dto.setSend_status("1");
|
||||
} else {
|
||||
dto.setSend_status("2");
|
||||
dto.setRemark(resp.getData().toString());
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
dto.setSend_status("2");
|
||||
dto.setRemark("ERROR");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public Instruction findByContainer(String container_code) {
|
||||
Iterator var3 = instructions.iterator();
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.nl.acs.task.service;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
@@ -191,7 +192,12 @@ public interface TaskService {
|
||||
*
|
||||
* @param ids
|
||||
*/
|
||||
void createInst(String ids) throws Exception;
|
||||
Instruction createInst(String ids) throws Exception;
|
||||
|
||||
Instruction createInst(Instruction inst) throws Exception;
|
||||
|
||||
|
||||
Instruction createTemporaryInst(TaskDto dto);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
@@ -219,6 +225,7 @@ public interface TaskService {
|
||||
|
||||
TaskDto findByCodeFromCache(String task_code);
|
||||
|
||||
|
||||
/**
|
||||
* 根据目的地设备编号查询当前是否有设备
|
||||
*
|
||||
@@ -298,4 +305,12 @@ public interface TaskService {
|
||||
*/
|
||||
Integer querySameDestinationTask(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 查询相同起终任务的数量
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
Integer querySameDeviceReadyTask(String start_device,String next_device,String status);
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
}
|
||||
|
||||
public synchronized void reload() {
|
||||
this.tasks = this.queryAll("task_status <2 and is_delete =0");
|
||||
this.tasks = this.queryAll("task_status <2 and is_delete =0 order by create_time");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -890,8 +890,138 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void createInst(String ids) throws Exception {
|
||||
public Instruction createTemporaryInst(TaskDto acsTask){
|
||||
if (acsTask == null) {
|
||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
}
|
||||
acsTask = foramte(acsTask);
|
||||
ParamService paramService = SpringContextHolder.getBean(ParamService.class);
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl");
|
||||
// InstructionDto inst = instructionservice.findByTaskid(acsTask, "instruction_status < 2 ");
|
||||
// if (inst != null) {
|
||||
// throw new BadRequestException("有指令未完成!");
|
||||
// }
|
||||
|
||||
String taskid = acsTask.getTask_id();
|
||||
String taskcode = acsTask.getTask_code();
|
||||
String vehiclecode = acsTask.getVehicle_code();
|
||||
String priority = acsTask.getPriority();
|
||||
String start_point_code = acsTask.getStart_point_code();
|
||||
String start_device_code = acsTask.getStart_device_code();
|
||||
String route_plan_code = acsTask.getRoute_plan_code();
|
||||
String vehicleType = acsTask.getVehicle_type();
|
||||
//是否复合任务 =0非复合任务
|
||||
String compound_task = acsTask.getCompound_task();
|
||||
String next_point_code = acsTask.getNext_point_code();
|
||||
String next_device_code = acsTask.getNext_device_code();
|
||||
String start_point_code2 = acsTask.getStart_point_code2();
|
||||
String next_point_code2 = acsTask.getNext_point_code2();
|
||||
String agv_system_type = acsTask.getAgv_system_type();
|
||||
String task_type = acsTask.getTask_type();
|
||||
String from_x = acsTask.getFrom_x();
|
||||
String from_y = acsTask.getFrom_y();
|
||||
String from_z = acsTask.getFrom_z();
|
||||
String to_x = acsTask.getTo_x();
|
||||
String to_y = acsTask.getTo_y();
|
||||
String to_z = acsTask.getTo_z();
|
||||
|
||||
|
||||
/**
|
||||
* 开始平均分解校验
|
||||
*/
|
||||
String this_device_code = this.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();
|
||||
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);
|
||||
} else {
|
||||
next_device_code = this_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;
|
||||
}
|
||||
|
||||
Instruction instdto = new Instruction();
|
||||
if (StrUtil.isEmpty(instdto.getInstruction_code())) {
|
||||
instdto.setInstruction_code(CodeUtil.getNewCode("INSTRUCT_NO"));
|
||||
}
|
||||
instdto.setInstruction_type(task_type);
|
||||
instdto.setInstruction_id(IdUtil.simpleUUID());
|
||||
instdto.setRoute_plan_code(route_plan_code);
|
||||
instdto.setRemark(acsTask.getRemark());
|
||||
instdto.setMaterial(acsTask.getMaterial());
|
||||
instdto.setQuantity(acsTask.getQuantity());
|
||||
instdto.setTask_id(taskid);
|
||||
instdto.setTask_code(taskcode);
|
||||
instdto.setVehicle_code(vehiclecode);
|
||||
String now = DateUtil.now();
|
||||
instdto.setCreate_time(now);
|
||||
instdto.setCreate_by("auto");
|
||||
instdto.setStart_device_code(start_device_code);
|
||||
instdto.setNext_device_code(next_device_code);
|
||||
instdto.setStart_point_code(start_point_code);
|
||||
instdto.setNext_point_code(next_point_code);
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
instdto.setVehicle_type(vehicleType);
|
||||
instdto.setStart_point_code2(start_point_code2);
|
||||
instdto.setStart_device_code2(start_point_code2);
|
||||
instdto.setNext_device_code2(next_point_code2);
|
||||
instdto.setNext_point_code2(next_point_code2);
|
||||
instdto.setAgv_system_type(agv_system_type);
|
||||
instdto.setFrom_x(from_x);
|
||||
instdto.setFrom_y(from_y);
|
||||
instdto.setFrom_z(from_z);
|
||||
instdto.setTo_x(to_x);
|
||||
instdto.setTo_y(to_y);
|
||||
instdto.setTo_z(to_z);
|
||||
|
||||
//判断agv系统
|
||||
//1、1楼叉车系统
|
||||
//2、2楼1区域AGV系统
|
||||
//3、2楼2区域AGV系统
|
||||
if (!StrUtil.equals(agv_system_type, "1")) {
|
||||
// task_type
|
||||
//1、生箔; Itype=1:取空,取满,放空,放满;
|
||||
//2、分切 Itype=3取满、取空、放满、放空;
|
||||
//3、普通任务 Itype=2:取货、放货;
|
||||
//4、叉车任务
|
||||
//5、输送任务
|
||||
//6、行架
|
||||
//7、立库
|
||||
if (StrUtil.equals(task_type, "1")) {
|
||||
instdto.setAgv_inst_type("1");
|
||||
} else if (StrUtil.equals(task_type, "3")) {
|
||||
instdto.setAgv_inst_type("2");
|
||||
} else if (StrUtil.equals(task_type, "2")) {
|
||||
instdto.setAgv_inst_type("3");
|
||||
}
|
||||
} else {
|
||||
instdto.setAgv_inst_type("4");
|
||||
}
|
||||
return instdto;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Instruction createInst(String ids) throws Exception {
|
||||
TaskDto acsTask = this.findById(ids);
|
||||
if (acsTask == null) {
|
||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
@@ -998,12 +1128,24 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
} else {
|
||||
instdto.setAgv_inst_type("4");
|
||||
}
|
||||
instructionservice.create(instdto);
|
||||
instructionservice.create2(instdto);
|
||||
|
||||
acsTask.setTask_status("1");
|
||||
this.update(acsTask);
|
||||
// acsTask.setTask_status("1");
|
||||
// this.update(acsTask);
|
||||
return instdto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instruction createInst(Instruction inst) throws Exception {
|
||||
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl");
|
||||
|
||||
instructionservice.create2(inst);
|
||||
return inst;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void download(List<TaskDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
@@ -1183,6 +1325,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
if (Integer.parseInt(start_point[2]) < 10 && start_point[2].length() == 1) {
|
||||
from_z = "0" + start_point[2];
|
||||
task.setFrom_z(from_z);
|
||||
} else if (start_point[2].length() == 2 ){
|
||||
from_z = start_point[2];
|
||||
task.setFrom_z(start_point[2]);
|
||||
} else {
|
||||
from_z = start_point[2];
|
||||
}
|
||||
@@ -1208,6 +1353,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
if (Integer.parseInt(task.getFrom_z()) < 10 && task.getFrom_z().length() == 1) {
|
||||
from_z = "0" + task.getFrom_z();
|
||||
task.setFrom_z(from_z);
|
||||
} else if (task.getFrom_z().length() == 2 ) {
|
||||
from_z = task.getFrom_z();
|
||||
task.setFrom_z(from_z);
|
||||
} else {
|
||||
from_z = task.getFrom_z();
|
||||
}
|
||||
@@ -1234,6 +1382,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
if (Integer.parseInt(next_point[2]) < 10 && next_point[2].length() == 1) {
|
||||
to_z = "0" + next_point[2];
|
||||
task.setTo_z(to_z);
|
||||
} else if ( next_point[2].length() == 2){
|
||||
to_z = next_point[2];
|
||||
task.setTo_z(to_z);
|
||||
} else {
|
||||
to_z = next_point[2];
|
||||
task.setTo_z(to_z);
|
||||
@@ -1259,6 +1410,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
if (Integer.parseInt(task.getTo_z()) < 10 && task.getTo_z().length() == 1) {
|
||||
to_z = "0" + task.getTo_z();
|
||||
task.setTo_z(to_z);
|
||||
} else if (task.getTo_z().length() == 2){
|
||||
to_z = task.getTo_z();
|
||||
task.setTo_z(to_z);
|
||||
} else {
|
||||
to_z = task.getTo_z();
|
||||
}
|
||||
@@ -1328,6 +1482,23 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Integer querySameDeviceReadyTask(String start_device,String next_device,String status ) {
|
||||
int num = 0;
|
||||
Iterator<TaskDto> iterator = tasks.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
TaskDto task = iterator.next();
|
||||
if (StrUtil.equals(task.getStart_device_code(),start_device) && StrUtil.equals(task.getNext_device_code(),next_device)
|
||||
&& StrUtil.equals(task.getTask_status(),status)) {
|
||||
num++;
|
||||
}
|
||||
}
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Integer querySameTaskByType(String taskType) {
|
||||
int num = 0;
|
||||
@@ -1352,4 +1523,5 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -39,6 +39,9 @@ public class AutoCreateInst {
|
||||
List<TaskDto> list = taskserver.queryAll("task_status = '0'");
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
TaskDto acsTask = list.get(i);
|
||||
if(StrUtil.equals(acsTask.getTask_type(),"7") && !StrUtil.startWith(acsTask.getTask_code(), "-") ){
|
||||
continue;
|
||||
}
|
||||
String taskid = acsTask.getTask_id();
|
||||
String taskcode = acsTask.getTask_code();
|
||||
String task_type = acsTask.getTask_type();
|
||||
@@ -71,9 +74,7 @@ public class AutoCreateInst {
|
||||
if (StrUtil.equals(is_send, "0")) {
|
||||
continue;
|
||||
}
|
||||
if(StrUtil.equals(storage_task_type,"1") || StrUtil.equals(storage_task_type,"2") ){
|
||||
continue;
|
||||
}
|
||||
|
||||
//校验路由关系
|
||||
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
|
||||
if (ObjectUtils.isEmpty(shortPathsList)) {
|
||||
|
||||
Reference in New Issue
Block a user