rev:代码优化

This commit is contained in:
2024-02-23 15:23:39 +08:00
parent 20d2d77a21
commit 2498dea59f
31 changed files with 918 additions and 182 deletions

View File

@@ -435,6 +435,11 @@
<artifactId>poi-ooxml-schemas</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.springframework.retry</groupId>
<artifactId>spring-retry</artifactId>
<version>1.2.5.RELEASE</version>
</dependency>
<!--<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>

View File

@@ -32,7 +32,6 @@ public class MagicAgvController {
*/
@PostMapping("/agvack/{device}")
@Log("AGV请求离开")
public ResponseEntity<Object> requestAck(@PathVariable String device) {
return new ResponseEntity<>(magicAgvService.requestAck(device), HttpStatus.OK);
}

View File

@@ -25,7 +25,6 @@ import java.util.Map;
* @since 2023-12-13
*/
@RestController
@RequestMapping("/api/acsPointAngle")
@Slf4j
public class AcsPointAngleController {
@@ -34,7 +33,6 @@ public class AcsPointAngleController {
@GetMapping
@Log("查询点位角度")
//@PreAuthorize("@el.check('acsPointAngle:list')")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
return new ResponseEntity<>(acsPointAngleService.queryAll(whereJson, page), HttpStatus.OK);
@@ -42,7 +40,6 @@ public class AcsPointAngleController {
@PostMapping
@Log("新增点位角度")
//@PreAuthorize("@el.check('acsPointAngle:add')")
public ResponseEntity<Object> create(@Validated @RequestBody AcsPointAngle dto) {
acsPointAngleService.create(dto);
@@ -51,7 +48,6 @@ public class AcsPointAngleController {
@PutMapping
@Log("修改点位角度")
//@PreAuthorize("@el.check('acsPointAngle:edit')")
public ResponseEntity<Object> update(@Validated @RequestBody AcsPointAngle dto) {
acsPointAngleService.update(dto);
@@ -59,7 +55,6 @@ public class AcsPointAngleController {
}
@Log("删除点位角度")
//@PreAuthorize("@el.check('acsPointAngle:del')")
@DeleteMapping
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
@@ -69,7 +64,6 @@ public class AcsPointAngleController {
@GetMapping("/updateActive")
@Log("是否启用")
public ResponseEntity<Object> updateOn(@RequestParam Long id, @RequestParam String is_active) {
acsPointAngleService.updateOn(id, is_active);
return new ResponseEntity<>(HttpStatus.OK);

View File

@@ -34,7 +34,7 @@ public class AutoRunController {
@Autowired
private AutoRunService autoRunService;
@Log("查询自动线程")
@GetMapping
public ResponseEntity<Object> query(Map map) throws Exception {
@@ -43,7 +43,6 @@ public class AutoRunController {
}
@Log("启动自动线程")
@PutMapping(value = "/start/{code}")
public ResponseEntity<Object> start(@PathVariable String code) {
autoRunService.startThread(code);
@@ -51,7 +50,6 @@ public class AutoRunController {
}
@Log("停止自动线程")
@PutMapping(value = "/stop/{code}")
public ResponseEntity<Object> execution(@PathVariable String code) {
autoRunService.stopThread(code);

View File

@@ -19,7 +19,6 @@ import java.util.Map;
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/customPolicy")
@Slf4j
public class CustomPolicyController {
@@ -41,7 +40,6 @@ public class CustomPolicyController {
@PutMapping
@Log("修改自定义策略")
public ResponseEntity<Object> update(@Validated @RequestBody CustomPolicyDTO dto) {
customPolicyService.update(dto);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);

View File

@@ -20,7 +20,6 @@ import java.util.Set;
**/
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/deviceAssigned")
public class DeviceAssignedController {
@@ -41,7 +40,6 @@ public class DeviceAssignedController {
@PutMapping
@Log("修改设备任务分配信息")
public ResponseEntity update(@Validated @RequestBody Map resources) {
deviceAssignedService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
@@ -49,7 +47,6 @@ public class DeviceAssignedController {
@DeleteMapping
@Log("删除设备任务分配信息")
public ResponseEntity delete(@RequestBody Set<String> ids) {
deviceAssignedService.removeByIds(ids);
return new ResponseEntity<>(HttpStatus.OK);

View File

@@ -20,7 +20,6 @@ import java.util.Set;
**/
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/deviceDbitem")
public class DeviceDbitemController {
@@ -54,7 +53,7 @@ public class DeviceDbitemController {
/*
@Log("导出设备DB项")
@GetMapping(value = "/download")
//@PreAuthorize("@el.check('deviceDbitem:list')")
public void download(HttpServletResponse response, DeviceDbitemQueryParam query) throws IOException {

View File

@@ -21,7 +21,6 @@ import java.util.Set;
**/
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/deviceExtra")
public class DeviceExtraController {
@@ -29,7 +28,6 @@ public class DeviceExtraController {
@GetMapping
@Log("查询设备扩展")
public ResponseEntity query(DeviceExtraQueryParam query, Pageable pageable) {
return new ResponseEntity<>(deviceExtraService.queryAll(query, pageable), HttpStatus.OK);
}
@@ -56,7 +54,7 @@ public class DeviceExtraController {
/*
@Log("导出设备扩展")
@GetMapping(value = "/download")
//@PreAuthorize("@el.check('deviceExtra:list')")
public void download(HttpServletResponse response, DeviceExtraQueryParam query) throws IOException {

View File

@@ -2,6 +2,7 @@ package org.nl.acs.device_driver.agv.ndctwo;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -11,6 +12,8 @@ import org.nl.acs.common.base.CommonFinalParam;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.FeedLmsRealFailed;
import org.nl.acs.device_driver.agv.utils.TwoAgvPhase;
import org.nl.acs.device_driver.conveyor.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.device_driver.paper_tube_pick_site.PaperTubePickSiteDeviceDriver;
@@ -20,10 +23,12 @@ import org.nl.acs.device_driver.two_conveyor.hongxiang_conveyor.HongXiangStation
import org.nl.acs.device_driver.two_conveyor.manipulator_agv_station.ManipulatorAgvStationDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.history.ErrorUtil;
import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
@@ -33,6 +38,8 @@ import org.nl.config.lucene.service.dto.LuceneLogDto;
import org.nl.system.service.param.ISysParamService;
import org.nl.config.SpringContextHolder;
import java.util.Map;
/**
* NDC双工位AGV
@@ -40,7 +47,7 @@ import org.nl.config.SpringContextHolder;
@Slf4j
@Data
@RequiredArgsConstructor
public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements DeviceDriver {
public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements DeviceDriver, DeviceStageMonitor, FeedLmsRealFailed {
ISysParamService ISysParamService = SpringContextHolder.getBean(ISysParamService.class);
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class);
@@ -51,7 +58,9 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class);
DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class);
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
TwoAgvPhase twoAgvPhase = new TwoAgvPhase();
String error_code = "0";
int agvaddr = 0;
int agvaddr_copy = 0;
int weight = 0;
@@ -59,8 +68,25 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
String device_code = "";
int phase = 0;
int region = 0;
int error = 0;
private Instruction instruction;
String message = null;
int x = 0; //x坐标
int y = 0; //y坐标
int angle = 0; //角度
int electric_qty = 0; //电量
int status = 0; //三色灯状态
int last_status = 0; //三色灯状态
String error_message = "";
String error_type = "agv_error_type";
Boolean isonline = true;
Boolean iserror = false;
private synchronized void setErrorInfo(int error, String error_code, String error_message) {
this.error = error;
this.error_code = error_code;
this.error_message = error_message;
}
public synchronized void processSocket(int[] arr) throws Exception {
device_code = this.getDeviceCode();
@@ -1061,19 +1087,45 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
}
//上传AGV电量
else if (phase == 0x73) {
if (ObjectUtil.isEmpty(inst)) {
log.info("未找到指令号{}对应的指令", ikey);
return;
}
agv_power = ikey;
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
else if (phase == 0x70) {
//x坐标
x = ikey;
} else if (phase == 0x71) {
//y坐标
y = ikey;
} else if (phase == 0x72) {
//车辆角度
angle = ikey;
} else if (phase == 0x73) {
//agv电量
electric_qty = ikey;
} else if (phase == 0x74) {
//三色灯状态
status = ikey;
if (status != last_status && status != 6 && status != 7) {
boolean flag = true;
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
if (status == 1) {
param.put("mode", 0);
} else if (status == 2) {
param.put("mode", 3);
} else if ("345".contains(String.valueOf(status))) {
param.put("mode", 2);
} else {
flag = false;
}
if (flag) {
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "4");
param.put("product_area", ISysParamService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
}
}
last_status = status;
} //进入区域phase值
else if (phase == 0x50) {
if (ObjectUtil.isEmpty(inst)) {
@@ -1108,8 +1160,13 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
//不需要WCS反馈
else if (phase == 0x67) {
//故障信息
if (agvaddr == 0) {
if (ikey == 0) {
this.setErrorInfo(ikey, "0", "正常");
} else {
Map<String, String> error = ErrorUtil.getAgvErrorMsg(ikey);
String code = error.get("code");
String info = error.get("info");
this.setErrorInfo(ikey, code, info);
}
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
@@ -1132,4 +1189,48 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
//agv编码
jo.put("car_no", this.getDevice().getDevice_code());
//agv名称
jo.put("device_name", this.getDevice().getDevice_name());
//x坐标
jo.put("x", this.getX());
//y坐标
jo.put("y", this.getY());
//角度
jo.put("angle", this.getAngle());
jo.put("phase", phase);
jo.put("phase_name", twoAgvPhase.getPhaseName(phase));
//电量
jo.put("electricity", this.getElectric_qty());
String status_name = this.status == 1 ? "关机" : this.status == 2 ? "工作中" : this.status == 3 ? "交通管制" : this.status == 4 ? "任务等待" : this.status == 5 ? "充电中" : this.status == 6 ? "故障中" : this.status == 7 ? "电量低" : "正常";
//agv状态
jo.put("status_name", status_name);
//任务号
jo.put("task_code", ObjectUtil.isEmpty(instruction) ? "0" : instruction.getTask_code());
//异常
jo.put("fault", this.getError_message());
jo.put("message", this.getMessage());
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
@Override
public JSONObject feedLmsRealFailedInfo() {
JSONObject jo = new JSONObject();
jo.put("device_code", this.getDevice().getDevice_code());
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("fault_code", String.valueOf(error));
jo.put("fault_info", error == 0 ? "正常" : error_message);
jo.put("fault_type", error_type);
return jo;
}
}

View File

@@ -269,13 +269,13 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
log.info("运行中");
break;
case 4:
if (move == 1 && !requireSucess && task > 0) {
if (move == 1 && !requireSucess) {
//申请套管
apply_casing(mode);
}
break;
case 5:
if (!requireSucess && task > 0) {
if (!requireSucess) {
//套管完成
bushingSucess(mode);
}
@@ -330,15 +330,17 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
private synchronized void apply_casing(int mode) {
ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest();
ApplyPlugPullSitResponse applyPlugPullSitResponse;
Instruction inst1 = instructionService.findByCode(String.valueOf(task));
String task_code1 = inst1.getTask_code();
Instruction inst1 = null;
if(task!=0) {
inst1 = instructionService.findByCode(String.valueOf(task));
String task_code1 = inst1.getTask_code();
applyPlugPullSiteRequest.setTask_code(task_code1);
}
applyPlugPullSiteRequest.setDevice_code(device_code);
applyPlugPullSiteRequest.setTask_code(task_code1);
applyPlugPullSiteRequest.setType("1");
//TODO 气涨轴尺寸反馈
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
if (applyPlugPullSitResponse.getCode() == 200) {
this.writeSignal(mode);
logServer.deviceExecuteLog(this.device_code, "", "", "申请套管,返回参数:" + applyPlugPullSitResponse);
message = "申请套管成功";
@@ -359,10 +361,12 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
private synchronized void bushingSucess(int mode) {
ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest();
ApplyPlugPullSitResponse applyPlugPullSitResponse;
Instruction inst1 = instructionService.findByCode(String.valueOf(task));
String task_code1 = inst1.getTask_code();
if(task!=0) {
Instruction inst1 = instructionService.findByCode(String.valueOf(task));
String task_code1 = inst1.getTask_code();
applyPlugPullSiteRequest.setTask_code(task_code1);
}
applyPlugPullSiteRequest.setDevice_code(device_code);
applyPlugPullSiteRequest.setTask_code(task_code1);
applyPlugPullSiteRequest.setWeight1(String.valueOf(weight1));
applyPlugPullSiteRequest.setMaterial1(String.valueOf(material1));
applyPlugPullSiteRequest.setWeight2(String.valueOf(weight2));

View File

@@ -159,6 +159,11 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
task = this.itemProtocol.getTask();
x_position = this.itemProtocol.getX_position();
y_position = this.itemProtocol.getY_position();
if (mode != last_mode) {
requireSucess = false;
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
}
if (task > 0 && !requireSucess) {
update_instruction_status();
@@ -386,7 +391,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
map.put("to_target1", next_addr);
map.put("to_task", instructionDto.getInstruction_code());
map.put("to_type", taskDto.getTruss_type());
map.put("to_empty_shaft_site", taskDto.getEmpty_shaft_site());
map.put("to_empty_shaft_site", taskDto.getEmpty_site());
if (StrUtil.isNotEmpty(start_device_code2)) {
Device startDevice2 = deviceAppservice.findDeviceByCode(start_device_code2);
@@ -433,7 +438,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
map.put("to_onset1", start_addr);
map.put("to_target1", next_addr);
map.put("to_type", taskDto.getTruss_type());
map.put("to_empty_shaft_site", taskDto.getEmpty_shaft_site());
map.put("to_empty_shaft_site", taskDto.getEmpty_site());
//创建指令
Instruction instdto = new Instruction();
String taskid = taskDto.getTask_id();

View File

@@ -0,0 +1,67 @@
package org.nl.acs.ext.wms;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.retry.annotation.Backoff;
import org.springframework.retry.annotation.Recover;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Component;
@Component
@Slf4j
public class RetryableUtil {
private static ThreadLocal<Integer> retryTimes = new ThreadLocal<>();
@Autowired
private RedisUtils redisUtils;
@Autowired
private AcsToWmsService acsToWmsService;
/**
* 只针对对接系统连接拒绝、连接超时进行重试机制
* 如果系统连接成功 但是对方返回失败不进行重试
*
* @param url
* @param param
*/
@Retryable(maxAttempts = 5, backoff = @Backoff(delay = 15000L, multiplier = 2))
public void retryable(String url, String param, String token) {
HttpResponse httpResponse = null;
String respMessage = null;
try {
httpResponse =
HttpRequest
.post(url)
.header("Authorization", token).body(String.valueOf(param))
.body(param)
.timeout(5000)
.execute();
} catch (Exception e) {
respMessage = e.getMessage();
}
if (retryTimes.get() == null) {
retryTimes.set(1);
} else {
retryTimes.set(retryTimes.get() + 1);
}
if (httpResponse == null) {
log.error("接口进行第{}次重试,请求路径:{},请求参数:{},响应参数:{}", retryTimes.get(), url, JSONObject.parse(param), respMessage);
throw new BadRequestException(url + "_" + param + "_" + retryTimes.get());
}
retryTimes.remove();
log.info("接口重试成功,请求路径:{},请求参数:{},重试次数:{}", url, JSONObject.parse(param), retryTimes.get());
}
@Recover
public void recover(RuntimeException e) {
retryTimes.remove();
String[] excMessage = e.getMessage().split("_");
log.error("请求路径:{},请求参数:{},已达到最大重试次数:{},停止重试!", excMessage[0], excMessage[1], excMessage[2]);
}
}

View File

@@ -1,5 +1,6 @@
package org.nl.acs.ext.wms.data;
import com.alibaba.fastjson.JSONArray;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -37,5 +38,42 @@ public class BaseResponse {
private Map<String, String> parameters = new HashMap();
private Integer status = 0;
private JSONArray errArr = new JSONArray();
public Integer getstatus() {
return this.status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getMessage() {
return this.message;
}
public void setMessage(String message) {
this.message = message;
}
public Map<String, String> getParameters() {
return this.parameters;
}
public void setParameters(Map<String, String> parameters) {
this.parameters = parameters;
}
public Object getParameter(String key) {
return this.parameters.get(key);
}
public void putParameter(String key, String object) {
this.parameters.put(key, object);
}
}

View File

@@ -23,6 +23,9 @@ public class CancelTaskRequest extends BaseRequest {
*/
Map<String, String> params = new HashMap<>();
@Override
public String toString() {
return "CancelTaskRequest{" +

View File

@@ -45,11 +45,12 @@ public class CreateTaskRequest extends BaseRequest {
*/
String vehicle_type;
/**
* 任务类型
* 载具类型
*/
String task_type;
String params2;
/**
@@ -76,4 +77,116 @@ public class CreateTaskRequest extends BaseRequest {
", params=" + params +
'}';
}
/**
* 任务标识
*/
private String ext_task_id;
/**
* 取货点2
*/
String start_device_code2;
/**
* 放货点2
*/
String next_device_code2;
/**
* 烘箱对接位
*/
String put_device_code;
/**
* 路由方案
*/
String route_plan_code;
/**
* 1、生箔
* 2、分切
* 3、普通任务
* 4、叉车任务
* 5、输送任务
* 6、行架
* 7、立库
* 任务类型
*/
String task_type;
/**
* 立库任务类型
*
*/
String dtl_type;
/**
* Agv系统类型
* 1:1楼叉车系统
* 2:2楼1区域AGV系统
* 3:2楼2区域AGV系统
*/
String agv_system_type;
/**
* 烘箱时间
*/
String oven_time;
/**
* 烘箱温度
*/
String temperature;
/**
* agv取货高度
*/
private String start_height;
/**
* agv放货高度
*/
private String next_height;
/**
* 行架任务类型
*/
private String truss_type;
/**
* 空轴位
*/
private String empty_site;
/**
* 气胀轴代数
*/
private String version;
/**
* 是否套管
*/
private String is_bushing;
/**
* 套管数量
*/
private String bushing_num;
private String paper_array;
}

View File

@@ -23,7 +23,6 @@ import org.springframework.web.bind.annotation.RestController;
**/
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/liku")
@Slf4j
public class AcsToLiKuController {
@@ -31,77 +30,66 @@ public class AcsToLiKuController {
@PostMapping("/inStore")
@Log(value = "下发立库入库任务")
public ResponseEntity<Object> inStore(@RequestBody InStoreRequest requestParam) {
return new ResponseEntity<>(acsToLiKuService.inStore(requestParam), HttpStatus.OK);
}
@PostMapping("/outStore")
@Log(value = "下发立库出库任务")
public ResponseEntity<Object> outStore(@RequestBody OutStoreRequest requestParam) {
return new ResponseEntity<>(acsToLiKuService.outStore(requestParam), HttpStatus.OK);
}
@PostMapping("/emptyVehicleOutStore")
@Log(value = "下发立库空盘出库任务")
public ResponseEntity<Object> emptyVehicleOutStore(@RequestBody EmptyVehicleOutStoreRequest requestParam) {
return new ResponseEntity<>(acsToLiKuService.emptyVehicleOutStore(requestParam), HttpStatus.OK);
}
@PostMapping("/moveStore")
@Log(value = "下发立库移库任务")
public ResponseEntity<Object> moveStore(@RequestBody MoveStoreRequest requestParam) {
return new ResponseEntity<>(acsToLiKuService.moveStore(requestParam), HttpStatus.OK);
}
@PostMapping("/inStoreReset")
@Log(value = "下发立库入库任务调整")
public ResponseEntity<Object> inStoreReset(@RequestBody InStoreResetRequest requestParam) {
return new ResponseEntity<>(acsToLiKuService.inStoreReset(requestParam), HttpStatus.OK);
}
@PostMapping("/moveStoreReset")
@Log(value = "下发立库移库任务调整")
public ResponseEntity<Object> moveStoreReset(@RequestBody MoveStoreResetRequest requestParam) {
return new ResponseEntity<>(acsToLiKuService.moveStoreReset(requestParam), HttpStatus.OK);
}
@PostMapping("/roadWayIsLock")
@Log(value = "下发立库巷道锁定或解锁")
public ResponseEntity<Object> roadWayIsLock(@RequestBody RoadWayIsLockRequest requestParam) {
return new ResponseEntity<>(acsToLiKuService.roadWayIsLock(requestParam), HttpStatus.OK);
}
@PostMapping("/cancelTask")
@Log(value = "取消立库任务")
public ResponseEntity<Object> cancelTask(@RequestBody CancelTaskRequest requestParam) {
return new ResponseEntity<>(acsToLiKuService.cancelTask(requestParam), HttpStatus.OK);
}
@PostMapping("/queryCarStatus")
@Log(value = "查询四向车状态")
public ResponseEntity<Object> queryCarStatus(@RequestBody DeviceStatusRequest requestParam) {
return new ResponseEntity<>(acsToLiKuService.queryCarDeviceStatus(requestParam), HttpStatus.OK);
}
@PostMapping("/queryTsjStatus")
@Log(value = "查询提升机状态")
public ResponseEntity<Object> queryTsjStatus(@RequestBody DeviceStatusRequest requestParam) {
return new ResponseEntity<>(acsToLiKuService.queryTsjDeviceStatus(requestParam), HttpStatus.OK);
}
@PostMapping("/querySsxStatus")
@Log(value = "查询提升机状态")
public ResponseEntity<Object> querySsxStatus(@RequestBody DeviceStatusRequest requestParam) {
return new ResponseEntity<>(acsToLiKuService.queryTsjDeviceStatus(requestParam), HttpStatus.OK);
}

View File

@@ -25,7 +25,6 @@ import java.util.Map;
**/
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/wms")
@Slf4j
public class AcsToWmsController {
@@ -33,7 +32,7 @@ public class AcsToWmsController {
// @PostMapping("/applyTask")
// @Log("向WMS申请任务")
//
//
// public ResponseEntity<Object> applyTaskToWms(@RequestBody String device_code, String container_code, int height, int weight) {
// return new ResponseEntity<>(acstowmsService.applyTaskToWms(device_code, container_code, height, weight), HttpStatus.OK);
// }
@@ -41,7 +40,6 @@ public class AcsToWmsController {
@PostMapping("/taskStatusFeedback")
@Log("向WMS反馈任务状态")
public ResponseEntity<Object> feedbackTaskStatusToWms(@RequestBody Map whereJson) {
JSONArray data = JSONArray.parseArray(String.valueOf(whereJson));
return new ResponseEntity<>(acstowmsService.feedbackTaskStatusToWms(data), HttpStatus.OK);
@@ -50,14 +48,12 @@ public class AcsToWmsController {
@PostMapping("/feedbackAgvStatus")
@Log("反馈AGV设备状态")
public ResponseEntity<Object> feedbackAgvStatus(@RequestBody String device_code, String error, String error_message) {
return new ResponseEntity<>(acstowmsService.feedbackAgvStatus(device_code, error, error_message), HttpStatus.OK);
}
@PostMapping("/feedbackAgv")
@Log("反馈AGV设备信息")
public ResponseEntity<Object> feedbackAgv(@RequestBody JSONArray from) {
return new ResponseEntity<>(acstowmsService.feedbackAgv(from), HttpStatus.OK);
}

View File

@@ -27,7 +27,6 @@ import org.springframework.web.bind.annotation.RestController;
**/
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/likuToACS")
@Slf4j
public class LiKuToACSController {
@@ -36,7 +35,6 @@ public class LiKuToACSController {
@SaIgnore
@PostMapping("/inStoreReport")
@Log(value = "立库反馈入库任务状态")
public ResponseEntity<Object> inStoreReport(@RequestBody InStoreReportRequest requestParam) throws Exception {
return new ResponseEntity<>(liKuToAcsService.inStoreReport(requestParam), HttpStatus.OK);
}
@@ -44,7 +42,6 @@ public class LiKuToACSController {
@SaIgnore
@PostMapping("/outStoreReport")
@Log(value = "立库反馈出库任务状态")
public ResponseEntity<Object> outStoreReport(@RequestBody OutStoreReportRequest requestParam) throws Exception {
return new ResponseEntity<>(liKuToAcsService.outStoreReport(requestParam), HttpStatus.OK);
}
@@ -52,7 +49,6 @@ public class LiKuToACSController {
@SaIgnore
@PostMapping("/moveStoreReport")
@Log(value = "立库反馈移库任务状态")
public ResponseEntity<Object> moveStoreReport(@RequestBody MoveStoreReportRequest requestParam) throws Exception {
return new ResponseEntity<>(liKuToAcsService.moveStoreReport(requestParam), HttpStatus.OK);
}
@@ -60,7 +56,6 @@ public class LiKuToACSController {
@SaIgnore
@PostMapping("/putEmptyPallet")
@Log(value = "立库请求放空盘")
public ResponseEntity<Object> putEmptyPallet(@RequestBody putEmptyPalletRequest requestParam) throws Exception {
return new ResponseEntity<>(liKuToAcsService.putEmptyPallet(requestParam), HttpStatus.OK);
}

View File

@@ -28,7 +28,6 @@ import java.util.List;
**/
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/wms")
@Slf4j
public class WmsToAcsController {
@@ -36,15 +35,13 @@ public class WmsToAcsController {
@PostMapping("/task")
@Log(value = "ACS接收WMS任务")
@SaIgnore
public ResponseEntity<Object> createFromWms(@RequestBody List<CreateTaskRequest> reqs) {
return new ResponseEntity<>(wmstoacsService.crateTask(reqs), HttpStatus.OK);
public ResponseEntity<Object> createFromWms(@RequestBody String whereJson) {
return new ResponseEntity<>(wmstoacsService.crateTask(whereJson), HttpStatus.OK);
}
@PostMapping("/cancelTask")
@Log(value = "WMS取消任务")
@SaIgnore
public ResponseEntity<Object> cancelFromWms(@RequestBody List<CancelTaskRequest> reqs) throws Exception {
return new ResponseEntity<>(wmstoacsService.cancelFromWms(reqs), HttpStatus.OK);
@@ -52,21 +49,18 @@ public class WmsToAcsController {
@PostMapping("/updateDeviceGoodsFromWms")
@Log(value = "WMS修改点位状态")
public ResponseEntity<Object> updateDeviceGoodsFromWms(@RequestBody String whereJson) {
return new ResponseEntity<>(wmstoacsService.updateDeviceGoodsFromWms(whereJson), HttpStatus.OK);
}
@PostMapping("/areaControl")
@Log(value = "区域控制")
public ResponseEntity<Object> areaControl(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(wmstoacsService.areaControl(whereJson), HttpStatus.OK);
}
@PostMapping("/action")
@Log(value = "WMS下发点位信号")
@SaIgnore
public ResponseEntity<Object> putAction(@RequestBody String whereJson) throws Exception {
return new ResponseEntity<>(wmstoacsService.putAction(whereJson), HttpStatus.OK);
@@ -74,7 +68,6 @@ public class WmsToAcsController {
@PostMapping("/querydevice")
@Log(value = "WMS查询设备状态")
@SaIgnore
public ResponseEntity<Object> queryDevice(@RequestBody String whereJson) throws Exception {
return new ResponseEntity<>(wmstoacsService.queryDevice(whereJson), HttpStatus.OK);
@@ -82,7 +75,6 @@ public class WmsToAcsController {
@PostMapping("/queryDeviceDBValue")
@Log(value = "WMS查询设备DB值")
@SaIgnore
public ResponseEntity<Object> queryDeviceDBValue(@RequestBody String whereJson) {
return new ResponseEntity<>(wmstoacsService.queryDeviceDBValue(whereJson), HttpStatus.OK);
@@ -91,7 +83,6 @@ public class WmsToAcsController {
@PostMapping("/putPlusPullAction")
@Log(value = "WMS下发插拔轴动作")
@SaIgnore
public ResponseEntity<Object> putPlusPullAction(@RequestBody String whereJson) {
return new ResponseEntity<>(wmstoacsService.putPlusPullAction(whereJson), HttpStatus.OK);
@@ -99,7 +90,6 @@ public class WmsToAcsController {
@PostMapping("/notify")
@Log("wms下发任务动作")
@SaIgnore
public ResponseEntity<Object> notify(@RequestBody JSONObject param) {
return new ResponseEntity<>(wmstoacsService.notifyAcs(param), HttpStatus.OK);

View File

@@ -97,10 +97,10 @@ public interface AcsToWmsService {
/**
* ACS向WMS反馈任务状态
* @param request
* @param arr
* @return
*/
String feedTaskStatus(BaseRequest request);
HttpResponse feedTaskStatus(JSONArray arr);
/**
* ACS向WMS反馈任务状态
@@ -145,4 +145,6 @@ public interface AcsToWmsService {
*/
JSONObject queryStationState(Instruction inst);
void sendDeviceStatus(JSONObject param);
}

View File

@@ -16,6 +16,7 @@ import org.nl.acs.address.service.AddressService;
import org.nl.acs.address.service.dto.AddressDto;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.ext.wms.LmsUtil;
import org.nl.acs.ext.wms.RetryableUtil;
import org.nl.acs.ext.wms.data.*;
import org.nl.acs.ext.wms.data.AcsToWmsData.applyTask.ApplyTaskRequest;
import org.nl.acs.ext.wms.data.AcsToWmsData.applyTask.ApplyTaskResponse;
@@ -37,6 +38,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
@Service
@RequiredArgsConstructor
@@ -60,6 +62,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Autowired
private LuceneExecuteLogService luceneLogService;
@Autowired
private RetryableUtil retryableUtil;
public String token;
@@ -157,8 +162,55 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Override
public String feedTaskStatus(BaseRequest request) {
return null;
public HttpResponse feedTaskStatus(JSONArray data) {
//feedTaskStatus
try {
MDC.put(log_file_type, log_type);
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
String task_code = "";
for (int i = 0; i < data.size(); i++) {
JSONObject json = (JSONObject) data.get(i);
task_code = json.getString("task_code");
}
TaskDto taskDto = taskService.findByCode(task_code);
String vehicle_code = taskDto.getVehicle_code();
HttpResponse result2 = null;
log.info("feedbackTaskStatusToWms-----请求参数{}", data.toString());
AddressDto addressDto = addressService.findByCode("feedTaskStatus");
String methods_url = addressDto.getMethods_url();
try {
result2 = HttpRequest.post(wmsurl + methods_url)
.header("Authorization", token).body(String.valueOf(data))
.execute();
// //System.out.println(result2);
} catch (Exception e) {
String msg = e.getMessage();
//网络不通
// //System.out.println(msg);
log.info("feedbackTaskStatusToWms-----输出参数{}", msg);
CompletableFuture.runAsync(() -> {
retryableUtil.retryable(wmsurl + methods_url, JSON.toJSONString(data), token);
});
}
String type = "";
if (result2.getStatus() == 200) {
type = "info";
} else {
type = "error";
}
JSONObject jo = JSONObject.parseObject(result2.body());
log.info("feedbackTaskStatusToWms-----输出参数{}", jo.toString());
return result2;
} finally {
MDC.remove(log_file_type);
}
}
@Override
@@ -336,6 +388,30 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
return result;
}
}
@Override
// @Async
public void sendDeviceStatus(JSONObject param) {
try {
MDC.put(log_file_type, log_type);
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("sendDeviceStatus");
String methods_url = addressDto.getMethods_url();
String url = wmsUrl + methods_url;
log.info("sendDeviceStatus - 请求参数 {}", param);
HttpResponse response = HttpRequest
.post(url)
.body(param.toString())
.execute();
log.info("sendDeviceStatus - 返回参数 {}", response.body());
}
} catch (Throwable ignored) {
} finally {
MDC.remove(log_file_type);
}
}
}

View File

@@ -1,14 +1,19 @@
package org.nl.acs.ext.wms.service.impl;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import lombok.Builder;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.AcsConfig;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver;
import org.nl.acs.device_driver.one_manipulator.box_package_manipulator.BoxPackageManipulatorDeviceDriver;
@@ -24,16 +29,22 @@ import org.nl.acs.device_driver.two_conveyor.subvolume_weighing_station.Subvolum
import org.nl.acs.device_driver.two_conveyor.waste_foil_weighing_station.WasteFoilWeighingStationDriver;
import org.nl.acs.ext.wms.data.*;
import org.nl.acs.ext.wms.liKuData.Resp;
import org.nl.acs.ext.wms.service.WmsToAcsService;
import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.storage_cell.domain.StorageCell;
import org.nl.acs.storage_cell.service.mapper.StorageCellMapper;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.common.enums.LogTypeEnum;
import org.nl.common.exception.BadRequestException;
import org.nl.config.SpringContextHolder;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
import org.nl.config.lucene.service.impl.LuceneExecuteLogServiceImpl;
import org.nl.system.service.param.ISysParamService;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
@@ -56,12 +67,347 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
@Autowired
private LuceneExecuteLogService luceneExecuteLogService;
@Autowired
private TaskService taskserver;
private String log_file_type = "log_file_type";
private String log_type = "LMS请求ACS";
@Override
public CreateTaskResponse crateTask(String param) {
return null;
try {
MDC.put(log_file_type, log_type);
log.info("crateTask-----输入参数{}", param);
JSONArray datas = JSONArray.parseArray(param);
CreateTaskResponse response = new CreateTaskResponse();
// ParamService paramService = SpringContextHolder.getBean(ParamService.class);
ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class);
// String cancelTaskCheck = paramService.findByCode(AcsConfig.ISALLOWTASK).getValue();
JSONArray errArr = new JSONArray();
// if (StrUtil.equals(cancelTaskCheck, "0")) {
// response.setStatus(400);
// response.setMessage("ACS系统需要更新请稍等");
// response.setErrArr(datas);
// return response;
// }
for (int i = 0; i < datas.size(); i++) {
String data = datas.get(i).toString();
CreateTaskRequest request = JsonUtl.format(data, CreateTaskRequest.class);
String paper_array = request.getPaper_array();
String ext_task_id = request.getExt_task_id();
String task_code = request.getTask_code();
String start_device_code = request.getStart_device_code();
String start_device_code2 = request.getStart_device_code2();
String next_device_code = request.getNext_device_code();
String next_device_code2 = request.getNext_device_code2();
String put_device_code = request.getPut_device_code();
String priority = request.getPriority();
String vehicle_code = request.getVehicle_code();
String vehicle_type = request.getVehicle_type();
String route_plan_code = request.getRoute_plan_code();
String task_type = request.getTask_type();
String truss_type = request.getTruss_type();
String empty_site = request.getEmpty_site();
String is_bushing = request.getIs_bushing();
String version = request.getVersion();
String bushing_num = request.getBushing_num();
String storage_task_type = request.getDtl_type();
String agv_system_type = request.getAgv_system_type();
String remark = request.getRemark();
double oven_time = 0.00d;
if (StrUtil.isNotEmpty(request.getOven_time())) {
oven_time = Double.parseDouble(request.getOven_time());
}
String temperature = request.getTemperature();
String start_height = request.getStart_height();
String next_height = request.getNext_height();
String params2 = request.getParams2();
Map<String, String> params = request.getParams();
String start_point_code = "";
String start_point_code2 = "";
String next_point_code = "";
String next_point_code2 = "";
String put_point_code = "";
if (StrUtil.isEmpty(task_code)) {
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)) {
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)) {
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.equals(task_type, "8")) {
next_device_code = request.getPut_device_code();
put_device_code = request.getNext_device_code();
}
StorageCell start_storageCell = new LambdaQueryChainWrapper<>(storageCellMapper)
.eq(StorageCell::getStorage_code, start_device_code)
.one();
StorageCell next_storageCell = new LambdaQueryChainWrapper<>(storageCellMapper)
.eq(StorageCell::getStorage_code, next_device_code)
.one();
StorageCell start2_storageCell = new LambdaQueryChainWrapper<>(storageCellMapper)
.eq(StorageCell::getStorage_code, start_device_code2)
.one();
StorageCell next2_storageCell = new LambdaQueryChainWrapper<>(storageCellMapper)
.eq(StorageCell::getStorage_code, next_device_code2)
.one();
StorageCell put_storageCell = new LambdaQueryChainWrapper<>(storageCellMapper)
.eq(StorageCell::getStorage_code, put_device_code)
.one();
JSONObject start_device_json = (JSONObject) JSONObject.toJSON(start_storageCell);
if (!ObjectUtil.isEmpty(start_device_json)) {
start_point_code = (String) start_device_json.get("parent_storage_code") == null ? start_device_code : (String) start_device_json.get("storage_code");
}
JSONObject next_device_json =(JSONObject) JSONObject.toJSON(next_storageCell);
if (!ObjectUtil.isEmpty(next_device_json)) {
next_point_code = (String) next_device_json.get("parent_storage_code") == null ? next_point_code : (String) next_device_json.get("storage_code");
}
JSONObject start_device_json2 = (JSONObject) JSONObject.toJSON(start2_storageCell);
if (!ObjectUtil.isEmpty(start_device_json2)) {
start_point_code2 = (String) start_device_json2.get("parent_storage_code") == null ? start_device_code2 : (String) start_device_json2.get("storage_code");
}
JSONObject next_device_json2 = (JSONObject) JSONObject.toJSON(next2_storageCell);
if (!ObjectUtil.isEmpty(next_device_json2)) {
next_point_code2 = (String) next_device_json2.get("parent_storage_code") == null ? next_device_code2 : (String) next_device_json2.get("storage_code");
}
JSONObject put_device_json = (JSONObject) JSONObject.toJSON(put_storageCell);
if (!ObjectUtil.isEmpty(put_device_json)) {
put_point_code = (String) put_device_json.get("parent_storage_code") == null ? put_device_code : (String) put_device_json.get("storage_code");
}
if (StrUtil.isNotEmpty(start_point_code) && start_point_code.indexOf("-") > 0) {
String str[] = start_point_code.split("-");
start_device_code = str[0];
} else {
start_device_code = start_point_code;
}
if (StrUtil.isNotEmpty(next_point_code) && next_point_code.indexOf("-") > 0) {
String str[] = next_point_code.split("-");
next_device_code = str[0];
} else {
next_device_code = next_point_code;
}
if (StrUtil.isNotEmpty(start_point_code2) && start_point_code2.indexOf("-") > 0) {
String str[] = start_point_code2.split("-");
start_device_code2 = str[0];
} else {
start_device_code2 = start_point_code2;
}
if (StrUtil.isNotEmpty(next_point_code2) && next_point_code2.indexOf("-") > 0) {
String str[] = next_point_code2.split("-");
next_device_code2 = str[0];
} else {
next_device_code2 = next_point_code2;
}
if (StrUtil.isNotEmpty(put_point_code) && put_point_code.indexOf("-") > 0) {
String str[] = put_point_code.split("-");
put_device_code = str[0];
} else {
put_device_code = put_point_code;
}
if (StrUtil.isEmpty(route_plan_code)) {
route_plan_code = "normal";
}
if (StrUtil.equals(task_type, "5")) {
Device device = deviceAppService.findDeviceByCode(next_device_code);
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver;
if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
if (ObjectUtil.equal("true", siemensConveyorDeviceDriver.getExtraValue().get("inspect_in_stock"))) {
if (siemensConveyorDeviceDriver.getMove() == 1) {
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("ext_task_id", ext_task_id);
json.put("message", "终点" + siemensConveyorDeviceDriver.getDevice_code() + "有货无法生成任务");
errArr.add(json);
continue;
}
}
}
if (taskserver.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", "已存在相同的起点:" + start_device_code + "终点:" + next_device_code + "未执行的输送任务");
errArr.add(json);
continue;
}
}
TaskDto taskDto = taskserver.findByCodeFromCache(task_code);
if (taskDto != null) {
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("ext_task_id", ext_task_id);
json.put("message", "存在相同的任务号:" + task_code);
errArr.add(json);
continue;
}
if (!StrUtil.isEmpty(vehicle_code)) {
TaskDto vehicle_dto = taskserver.findByContainer(vehicle_code);
if (vehicle_dto != null) {
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("ext_task_id", ext_task_id);
json.put("message", "已存在任务编号为" + vehicle_dto.getTask_code() + "托盘号:" + vehicle_code);
errArr.add(json);
continue;
}
}
if (StrUtil.isEmpty(start_point_code)) {
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("ext_task_id", ext_task_id);
json.put("message", request.getStart_device_code() + " 该设备号未找到对应点位");
errArr.add(json);
continue;
}
if (StrUtil.isEmpty(next_point_code)) {
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("ext_task_id", ext_task_id);
json.put("message", request.getNext_device_code() + " 该设备号未找到对应点位");
errArr.add(json);
continue;
}
JSONObject jo = new JSONObject();
jo.put("task_id", IdUtil.simpleUUID());
jo.put("task_code", task_code);
jo.put("start_point_code", start_point_code);
jo.put("next_point_code", next_point_code);
jo.put("start_point_code2", start_point_code2);
jo.put("next_point_code2", next_point_code2);
jo.put("put_point_code", put_point_code);
jo.put("start_parent_code", start_point_code);
jo.put("next_parent_code", next_point_code);
jo.put("start_device_code", start_device_code);
jo.put("next_device_code", next_device_code);
jo.put("start_device_code2", start_device_code2);
jo.put("next_device_code2", next_device_code2);
jo.put("put_device_code", put_device_code);
jo.put("priority", priority);
jo.put("vehicle_code", vehicle_code);
jo.put("vehicle_type", vehicle_type);
jo.put("storage_task_type", storage_task_type);
jo.put("agv_system_type", agv_system_type);
jo.put("start_height", start_height);
jo.put("next_height", next_height);
jo.put("oven_time", (int) Math.ceil(oven_time));
jo.put("remark", remark);
jo.put("params", params);
jo.put("params2", params2);
jo.put("task_type", StrUtil.isEmpty(task_type) ? 1 : Integer.parseInt(task_type));
jo.put("paper_array", JSONUtil.toJsonStr(paper_array));
jo.put("truss_type", JSONUtil.toJsonStr(truss_type));
jo.put("empty_site", JSONUtil.toJsonStr(empty_site));
jo.put("is_bushing", JSONUtil.toJsonStr(is_bushing));
jo.put("version", JSONUtil.toJsonStr(version));
jo.put("bushing_num", JSONUtil.toJsonStr(bushing_num));
if (!StrUtil.isEmpty(ext_task_id)) {
jo.put("ext_task_id", ext_task_id);
}
TaskDto task_dto = jo.toJavaObject(TaskDto.class);
try {
// task_type=7 则是立库任务需要下刻下发
if (StrUtil.equals(task_dto.getTask_type(), "7")) {
//创建临时指令 不创建、不生成
//等立库反馈成功才能创建任务和指令
Instruction inst = null;
try {
// inst = taskserver.createTemporaryInst(task_dto);
} catch (Exception e) {
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("ext_task_id", ext_task_id);
json.put("message", "起始点:"+ task_dto.getStart_point_code() + ",终点:"+
task_dto.getNext_point_code()+",条码:" + task_dto.getVehicle_code() +
"," + e.getMessage());
errArr.add(json);
continue;
}
// Resp resp = acsToLiKuService.sendInst(task_dto.getStorage_task_type(), inst);
// if (StrUtil.equals(resp.result, "true")) {
// //创建任务和指令
// taskserver.create(task_dto);
// inst.setSend_status("1");
//// taskserver.extCreateInst(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);
// continue;
// }
} else {
taskserver.create(task_dto);
}
} 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);
continue;
}
}
if (ObjectUtil.isEmpty(errArr)) {
response.setStatus(200);
response.setMessage("success");
} else {
response.setStatus(400);
if (ObjectUtil.isNotEmpty(errArr)) {
response.setMessage(errArr.getJSONObject(0).getString("message"));
} else {
response.setMessage("false");
}
response.setErrArr(errArr);
}
log.info("createFromWms--------------:输出参数:" + JSON.toJSONString(response));
return response;
} finally {
MDC.remove(log_file_type);
}
}
@Override

View File

@@ -22,7 +22,6 @@ import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/deviceInfo")
public class DeviceStageMonitorController {

View File

@@ -21,7 +21,6 @@ import java.util.Map;
**/
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/opc")
public class OpcController {
@@ -29,14 +28,12 @@ public class OpcController {
@GetMapping
@Log("查询opc")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
return new ResponseEntity<>(opcService.queryAll(whereJson, page), HttpStatus.OK);
}
@PostMapping
@Log("新增opc")
//@PreAuthorize("@el.check('opc:add')")
public ResponseEntity<Object> create(@Validated @RequestBody OpcDto dto) {
opcService.insert(dto);
@@ -45,7 +42,6 @@ public class OpcController {
@PutMapping
@Log("修改opc")
//@PreAuthorize("@el.check('opc:edit')")
public ResponseEntity<Object> update(@Validated @RequestBody OpcDto dto) {
opcService.update(dto);
@@ -53,7 +49,6 @@ public class OpcController {
}
@Log("删除opc")
//@PreAuthorize("@el.check('opc:del')")
@DeleteMapping
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
@@ -62,7 +57,6 @@ public class OpcController {
}
@Log("导出opc")
@GetMapping(value = "/download")
//@PreAuthorize("@el.check('opc:list')")
public void download(HttpServletResponse response, Map whereJson) throws IOException {
@@ -71,14 +65,12 @@ public class OpcController {
@GetMapping("/selectList")
@Log("下拉选OPC")
//@PreAuthorize("@el.check('routePlan:list')")
public ResponseEntity<Object> selectList() {
return new ResponseEntity<>(opcService.selectList(), HttpStatus.OK);
}
@Log("导出opc")
@PostMapping(value = "/getmeteal")
//@PreAuthorize("@el.check('opc:list')")
public ResponseEntity<Object> getmeteal(@RequestBody Map whereJson) throws IOException {
@@ -86,7 +78,6 @@ public class OpcController {
}
@Log("新增PLC")
@PostMapping(value = "/addPLC")
//@PreAuthorize("@el.check('opc:list')")
public ResponseEntity<Object> createPlc(@RequestBody Map whereJson) throws IOException {
@@ -94,7 +85,7 @@ public class OpcController {
return new ResponseEntity<>(HttpStatus.CREATED);
}
@GetMapping(value = "/queryServerPlc")
//@PreAuthorize("@el.ceck('menu:list','roles:list')")
public ResponseEntity<Object> query(@RequestParam String id) {
@@ -102,7 +93,6 @@ public class OpcController {
}
@Log("删除PLC")
@PostMapping(value = "/delPLC")
//@PreAuthorize("@el.check('opc:list')")
public ResponseEntity<Object> delPLC(@RequestBody Map whereJson) throws IOException {
@@ -111,7 +101,6 @@ public class OpcController {
}
@Log("编辑PLC")
@PostMapping(value = "/editPLC")
//@PreAuthorize("@el.check('opc:list')")
public ResponseEntity<Object> editPLC(@RequestBody JSONObject json) throws IOException {

View File

@@ -34,206 +34,210 @@ import java.io.Serializable;
public class Task extends CommonModel<Task> implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_ID)
private String task_id;
private String ext_task_id;
@NotBlank
private String task_code;
private String vehicle_code;
private String vehicle_type;
@NotBlank
private String task_type;
@NotBlank
private String task_status;
@NotBlank
private String compound_task;
private String compound_task_data;
private String request_again;
private String request_again_success;
private String link_num;
private String is_send;
private String material;
@NotNull
private BigDecimal quantity;
private String priority;
@NotBlank
private String create_type;
@NotBlank
private String finish_type;
private String execute_code;
private String execute_message;
private String start_point_code;
private String start_device_code;
private String put_point_code;
private String put_device_code;
private String start_point_code2;
private String start_device_code2;
private String next_point_code;
private String next_device_code;
private String next_point_code2;
private String next_device_code2;
private String from_x;
private String from_y;
private String from_z;
private String put_x;
private String put_y;
private String put_z;
private String to_x;
private String to_y;
private String to_z;
private String from_x2;
private String from_y2;
private String from_z2;
private String to_x2;
private String to_y2;
private String to_z2;
private String route_plan_name;
private String route_plan_code;
private String is_needfeedback;
private String emptypallet_num;
private String remark;
private String truss_type;
private String empty_site;
@NotBlank
private String is_active;
@NotBlank
private String is_delete;
@NotBlank
@TableField(fill = FieldFill.INSERT)
private String create_by;
@NotBlank
@TableField(fill = FieldFill.INSERT)
private String create_time;
@TableField(fill = FieldFill.INSERT_UPDATE)
private String update_by;
@TableField(fill = FieldFill.INSERT_UPDATE)
private String update_time;
private String weight;
private String agv_system_type;
private String storage_task_type;
private String temperature;
private String oven_time;
private String interaction_json;
public void copyFrom(Task source) {

View File

@@ -446,6 +446,14 @@ public interface TaskService extends CommonService<Task> {
*/
Integer querySameDestinationTask(String code);
/**
* 查询相同起终任务的数量
*
* @param
* @return
*/
Integer querySameDeviceReadyTask(String start_device,String next_device,String status);
/**
* 条件查询任务和指令

View File

@@ -314,8 +314,18 @@ public class TaskDto implements Serializable {
*/
private String truss_type;
/**
* 空轴位
*/
private String empty_site;
/**
* 空轴位
*/
private String empty_shaft_site;
/**
* 是否套管
*/
private String is_bushing;
}

View File

@@ -506,6 +506,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
}
@Override
public void create(TaskDto dto) throws Exception {
dto = foramte(dto);
dto.setInteraction_json(ObjectUtil.isNotEmpty(dto.getInteractionJson()) ? dto.getInteractionJson().toJSONString() : "");
@@ -1447,6 +1448,22 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
.size();
}
@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 String queryAssignedByDeviceCode(String device_code, String task_nextDeice_code) {
List<DeviceAssignedDto> list =
@@ -1523,16 +1540,23 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
*/
private void feedWmsTaskStatus(TaskDto taskDto) {
// 判断是否为WMS下发的任务如果是反馈任务状态给WMS
TaskDto entity = this.findById(taskDto.getTask_id());
String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue();
if (!StrUtil.startWith(taskDto.getTask_code(), CommonFinalParam.HYPHEN_) && StrUtil.equals(hasWms, CommonFinalParam.ONE)) {
FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
request.setTask_id(taskDto.getExt_task_id());
request.setTask_code(taskDto.getTask_code());
request.setTask_status(taskDto.getTask_status());
request.setRequest_medthod_code(RequestMethodEnum.feedback_task_status.getCode());
request.setRequest_medthod_name(RequestMethodEnum.feedback_task_status.getName());
// FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
// request.setTask_id(taskDto.getExt_task_id());
// request.setTask_code(taskDto.getTask_code());
// request.setTask_status(taskDto.getTask_status());
// request.setRequest_medthod_code(RequestMethodEnum.feedback_task_status.getCode());
// request.setRequest_medthod_name(RequestMethodEnum.feedback_task_status.getName());
JSONObject feed_jo = new JSONObject();
feed_jo.put("task_id", entity.getExt_task_id());
feed_jo.put("task_code", entity.getTask_code());
feed_jo.put("task_status", entity.getTask_status());
JSONArray ja = new JSONArray();
ja.add(feed_jo);
//TODO 有需要根据上位系统反馈的信息再做进一步处理
acstowmsService.feedTaskStatus(request);
acstowmsService.feedTaskStatus(ja);
}
}

View File

@@ -37,7 +37,6 @@ public class StageController {
@GetMapping
@Log("查询舞台")
//@SaCheckPermission("stage:list")
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) {
return new ResponseEntity<>(TableDataInfo.build(stageService.queryAll(whereJson, page)), HttpStatus.OK);
@@ -45,7 +44,6 @@ public class StageController {
@PostMapping
@Log("新增舞台")
//@SaCheckPermission("stage:add")
public ResponseEntity<Object> create(@Validated @RequestBody Stage dto) {
stageService.create(dto);
@@ -54,7 +52,6 @@ public class StageController {
@PutMapping
@Log("修改舞台")
//@SaCheckPermission("stage:edit")
public ResponseEntity<Object> update(@Validated @RequestBody Stage dto) {
stageService.update(dto);
@@ -62,7 +59,6 @@ public class StageController {
}
@Log("删除舞台")
//@SaCheckPermission("stage:del")
@DeleteMapping
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
@@ -72,7 +68,6 @@ public class StageController {
@GetMapping("/selectList")
@Log("下拉选舞台")
//@SaCheckPermission("routePlan:list")
public ResponseEntity<Object> selectList() {
return new ResponseEntity<>(stageService.selectList(), HttpStatus.OK);
@@ -80,7 +75,6 @@ public class StageController {
@PostMapping("/addNewStage")
@Log("保存舞台数据")
public ResponseEntity<Object> addNewStage(@Validated @RequestBody Stage dto) {
log.info("dto{}",dto);
stageService.addNewStage(dto);

View File

@@ -36,9 +36,9 @@ class SysParamController {
@Autowired
private ISysParamService paramService;
@GetMapping
@Log("查询系统参数")
//@SaCheckPermission("param:list")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
return new ResponseEntity<>(TableDataInfo.build(paramService.queryPage(whereJson, page)), HttpStatus.OK);
@@ -46,7 +46,6 @@ class SysParamController {
@PostMapping
@Log("新增系统参数")
//@SaCheckPermission("param:add")
public ResponseEntity<Object> create(@Validated @RequestBody Param param){
paramService.create(param);
@@ -55,7 +54,6 @@ class SysParamController {
@PutMapping
@Log("修改系统参数")
//@SaCheckPermission("param:edit")
public ResponseEntity<Object> update(@Validated @RequestBody Param param){
paramService.update(param);
@@ -63,7 +61,6 @@ class SysParamController {
}
@Log("删除系统参数")
//@SaCheckPermission("param:del")
@DeleteMapping
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
@@ -74,7 +71,6 @@ class SysParamController {
@PostMapping("/getValueByCode/{code}")
@Log("根据编码获取值")
@SaIgnore
public ResponseEntity<Object> getValueByCode(@PathVariable String code) {
return new ResponseEntity<>(paramService.findByCode(code), HttpStatus.CREATED);

View File

@@ -232,7 +232,7 @@ export default {
name: 'MonitorDevice',
data() {
return {
stageParam: 'age', // 舞台参数
stageParam: 'stage_code', // 舞台参数
dialogDeviceMsgVisible: false, // 显示设备信息的dialog
device_code: null,
tops: '20vh', // 初始top