rev:科冲接口优化
This commit is contained in:
@@ -65,8 +65,8 @@ public class QueryAGVStatus {
|
||||
String body = result.body();
|
||||
JSONObject json = JSONObject.parseObject(body);
|
||||
JSONObject taskStatus = json.getJSONObject("TaskStatus");
|
||||
String taskNo = taskStatus.getString("TaskNo");
|
||||
if ("true".equals(json.getString("Result")) && taskNo.equals(instruction.getInstruction_code())) {
|
||||
String instructionCode = taskStatus.getString("TaskNo");
|
||||
if ("true".equals(json.getString("Result")) && instructionCode.equals(instruction.getInstruction_code())) {
|
||||
// 已创建=CREATED,
|
||||
// 待分配=TOBEDISPATCHED,
|
||||
// 正在执行=RUNNING,
|
||||
@@ -78,26 +78,16 @@ public class QueryAGVStatus {
|
||||
//执行中
|
||||
String state = json.getString("Status");
|
||||
String carNo = json.getString("VehicleNo");
|
||||
String instructionCode = json.getString("id");
|
||||
if ("running".equals(state)) {
|
||||
if ("1".equals(instruction.getInstruction_status())) {
|
||||
TaskDto task = taskService.findById(instruction.getTask_id());
|
||||
if ("0".equals(instruction.getInstruction_status())&&"1".equals(task.getTask_status())) {
|
||||
instruction.setCarno(carNo);
|
||||
TaskDto task = new TaskDto();
|
||||
instruction.setInstruction_status("1");
|
||||
instructionService.update(instruction);
|
||||
instructionService.update(instruction);
|
||||
task.setCarno(carNo);
|
||||
task.setTask_id(instruction.getTask_id());
|
||||
instructionService.update(instruction);
|
||||
taskService.update(task);
|
||||
// if (StrUtil.isNotEmpty(instructionCode)) {
|
||||
// Device carCode = deviceAppService.findDeviceByCode(instructionCode);
|
||||
// XgAgvCarDeviceDriver xgAgvCarDeviceDriver;
|
||||
// if (null != carCode) {
|
||||
// if (carCode.getDeviceDriver() instanceof XgAgvCarDeviceDriver) {
|
||||
// xgAgvCarDeviceDriver = (XgAgvCarDeviceDriver) carCode.getDeviceDriver();
|
||||
// xgAgvCarDeviceDriver.setTaskType(AgvActionTypeEnum.getStatus(instruction.getAgv_action_type()));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
} else if ("finish".equals(state)) {
|
||||
@@ -113,6 +103,7 @@ public class QueryAGVStatus {
|
||||
} else if ("paused".equals(state) || "aborted".equals(state) || "Error".equals(state)) {
|
||||
if (!"1".equals(instruction.getInstruction_status())) {
|
||||
instruction.setInstruction_status("1");
|
||||
//todo 备注异常信息
|
||||
instructionService.update(instruction);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,16 +22,16 @@ public class KeCongAgvController {
|
||||
@PostMapping("/waitPointRequest")
|
||||
@Log("等待点请求")
|
||||
@SaIgnore
|
||||
public ResponseEntity<AgvResponse> waitPointRequest(@RequestBody JSONObject requestParam) {
|
||||
public ResponseEntity<JSONObject> waitPointRequest(@RequestBody JSONObject requestParam) {
|
||||
return new ResponseEntity<>(keCongAgvService.agvWaitPointRequest(requestParam), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/requestResource")
|
||||
@PostMapping("/applyIn")
|
||||
@Log("请求资源")
|
||||
@SaIgnore
|
||||
public ResponseEntity<AgvResponse> requestResource(@RequestBody JSONObject requestParam) {
|
||||
return new ResponseEntity<>(keCongAgvService.requestResource(requestParam), HttpStatus.OK);
|
||||
public ResponseEntity<Object> applyIn(@RequestBody JSONObject requestParam) {
|
||||
return new ResponseEntity<>(keCongAgvService.applyIn(requestParam), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/releaseResource")
|
||||
@@ -41,4 +41,11 @@ public class KeCongAgvController {
|
||||
return new ResponseEntity<>(keCongAgvService.releaseResource(requestParam), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/requestAction")
|
||||
@Log("AGV请求取放货")
|
||||
@SaIgnore
|
||||
public ResponseEntity<JSONObject> requestAction(@RequestBody JSONObject requestParam) {
|
||||
return new ResponseEntity<>(keCongAgvService.requestAction(requestParam), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import org.nl.acs.instruction.domain.Instruction;
|
||||
|
||||
public interface KeCongAgvService {
|
||||
|
||||
public HttpResponse deleteTask(String instruction_code) throws Exception;
|
||||
|
||||
/**
|
||||
* 下发运单序列
|
||||
*
|
||||
@@ -31,14 +33,16 @@ public interface KeCongAgvService {
|
||||
// */
|
||||
// public HttpResponse queryKZAgvStatus(String vehicleCode);
|
||||
|
||||
AgvResponse agvWaitPointRequest(JSONObject requestParam);
|
||||
JSONObject agvWaitPointRequest(JSONObject requestParam);
|
||||
|
||||
// public AgvResponse updateKZAgvInst(JSONObject requestParam);
|
||||
|
||||
AgvResponse requestResource(JSONObject requestParam);
|
||||
JSONObject applyIn(JSONObject requestParam);
|
||||
|
||||
AgvResponse releaseResource(JSONObject requestParam);
|
||||
|
||||
JSONObject requestAction(JSONObject requestParam);
|
||||
|
||||
// HttpResponse getRobotInfo(String robotCode);
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,8 +4,10 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.AcsConfig;
|
||||
@@ -13,15 +15,28 @@ import org.nl.acs.agv.server.KeCongAgvService;
|
||||
import org.nl.acs.agv.server.MagicAgvService;
|
||||
import org.nl.acs.agv.server.dao.AgvResponse;
|
||||
import org.nl.acs.common.base.CommonFinalParam;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device.service.impl.DeviceServiceImpl;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.storage_cell.domain.StorageCell;
|
||||
import org.nl.acs.storage_cell.service.mapper.StorageCellMapper;
|
||||
import org.nl.acs.task.enums.ActionTypeEnum;
|
||||
import org.nl.acs.task.enums.AgvActionTypeEnum;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
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.system.service.param.ISysParamService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@@ -32,6 +47,52 @@ public class KeCongAgvServiceImpl implements KeCongAgvService {
|
||||
@Autowired
|
||||
private InstructionService instructionService;
|
||||
private final ISysParamService paramService;
|
||||
@Autowired
|
||||
private AcsToWmsService acsToWmsService;
|
||||
@Autowired
|
||||
private TaskService taskserver;
|
||||
@Autowired
|
||||
private StorageCellMapper storageCellMapper;
|
||||
|
||||
@Override
|
||||
public HttpResponse deleteTask(String instCode) throws Exception {
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code("下发科聪任务")
|
||||
.content(instCode)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
log.info("删除科聪任务序列参数:{}", instCode);
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).
|
||||
|
||||
getValue(), CommonFinalParam.ONE)) {
|
||||
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
|
||||
|
||||
agvurl = agvurl + ":" + agvport + "/api/fms/abortTask";
|
||||
|
||||
log.info(agvurl);
|
||||
JSONObject ja = new JSONObject();
|
||||
ja.put("TaskNo", instCode);
|
||||
HttpResponse result = HttpRequest.post(agvurl)
|
||||
//表单内容
|
||||
.body(String.valueOf(ja))
|
||||
//超时,毫秒
|
||||
.timeout(20000)
|
||||
.execute();
|
||||
LuceneLogDto logDto1 = LuceneLogDto.builder()
|
||||
.device_code("删除科聪任务")
|
||||
.content("指令号:" + instCode + ",删除科聪任务序列反馈参数:" + ja)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto1);
|
||||
log.info("指令号{},删除agv订单序列反馈:{}", instCode, result.body());
|
||||
|
||||
return result;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponse addTask(Instruction inst) throws Exception {
|
||||
@@ -39,50 +100,24 @@ public class KeCongAgvServiceImpl implements KeCongAgvService {
|
||||
JSONArray arr = new JSONArray();
|
||||
jo.put("TaskType", inst.getInstruction_type());
|
||||
JSONObject json1 = new JSONObject();
|
||||
json1.put("Key", "TaskId");
|
||||
json1.put("Key", "TaskNo");
|
||||
json1.put("Value", inst.getInstruction_code());
|
||||
arr.add(json1);
|
||||
JSONObject json2 = new JSONObject();
|
||||
json2.put("Key", "VehicleNo");
|
||||
json2.put("Value", "3");
|
||||
arr.add(json2);
|
||||
// JSONObject json2 = new JSONObject();
|
||||
// json2.put("Key", "VehicleNo");
|
||||
// json2.put("Value", "3");
|
||||
// arr.add(json2);
|
||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
|
||||
int startAddress = deviceService.queryAddressBydeviceCode(inst.getStart_point_code());
|
||||
int nextAddress = deviceService.queryAddressBydeviceCode(inst.getNext_point_code());
|
||||
JSONObject json3 = new JSONObject();
|
||||
json3.put("Key", "point1");
|
||||
json3.put("Value", inst.getStart_device_code());
|
||||
json3.put("Key", "Point1");
|
||||
json3.put("Value", String.valueOf(startAddress));
|
||||
arr.add(json3);
|
||||
JSONObject json4 = new JSONObject();
|
||||
json4.put("Key", "point2");
|
||||
json4.put("Value", inst.getNext_device_code());
|
||||
json4.put("Key", "Point2");
|
||||
json4.put("Value", String.valueOf(nextAddress));
|
||||
arr.add(json4);
|
||||
if ("任务1" .equals(inst.getInstruction_type())) {
|
||||
JSONObject json5 = new JSONObject();
|
||||
json5.put("Key", "point3");
|
||||
json5.put("Value", inst.getStart_device_code2());
|
||||
arr.add(json5);
|
||||
JSONObject json6 = new JSONObject();
|
||||
json6.put("Key", "point4");
|
||||
json6.put("Value", inst.getNext_device_code2());
|
||||
arr.add(json6);
|
||||
} else if ("任务11" .equals(inst.getInstruction_type())) {
|
||||
JSONObject json5 = new JSONObject();
|
||||
json5.put("Key", "isget");
|
||||
json5.put("Value", "0");
|
||||
arr.add(json5);
|
||||
} else if ("任务12" .equals(inst.getInstruction_type())) {
|
||||
JSONObject json6 = new JSONObject();
|
||||
json6.put("Key", "isput");
|
||||
json6.put("Value", "0");
|
||||
arr.add(json6);
|
||||
} else if ("任务13" .equals(inst.getInstruction_type())) {
|
||||
JSONObject json5 = new JSONObject();
|
||||
json5.put("Key", "isget");
|
||||
json5.put("Value", "0");
|
||||
arr.add(json5);
|
||||
JSONObject json6 = new JSONObject();
|
||||
json6.put("Key", "isput");
|
||||
json6.put("Value", "0");
|
||||
arr.add(json6);
|
||||
}
|
||||
jo.put("Params", arr);
|
||||
System.out.println(jo);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
@@ -173,108 +208,76 @@ public class KeCongAgvServiceImpl implements KeCongAgvService {
|
||||
// }
|
||||
|
||||
@Override
|
||||
public AgvResponse agvWaitPointRequest(JSONObject requestParam) {
|
||||
System.out.println("请求kc参数:" + requestParam);
|
||||
String taskId = requestParam.getString("TaskId");
|
||||
public JSONObject agvWaitPointRequest(JSONObject requestParam) {
|
||||
log.info("科聪二次分配请求参数:" + requestParam);
|
||||
String instNo = requestParam.getString("TaskNo");
|
||||
String vehicleNo = requestParam.getString("VehicleNo");
|
||||
String type = requestParam.getString("type"); // 1 取货点等待 2 放货点等待
|
||||
Instruction inst = instructionService.findByCodeFromCache(taskId);
|
||||
Instruction inst = instructionService.findByCodeFromCache(instNo);
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
throw new BadRequestException("请求失败,未找到指令!");
|
||||
}
|
||||
JSONObject jo = new JSONObject();
|
||||
JSONArray arr = new JSONArray();
|
||||
jo.put("TaskNo", taskId);
|
||||
if ("任务11" .equals(inst.getInstruction_type())) {
|
||||
//todo :需要跟上位申请新的点位
|
||||
JSONObject json1 = new JSONObject();
|
||||
json1.put("Name", "point1");
|
||||
json1.put("Value", "3");
|
||||
arr.add(json1);
|
||||
} else if ("任务12" .equals(inst.getInstruction_type())) {
|
||||
//todo :需要跟上位申请新的点位
|
||||
JSONObject json1 = new JSONObject();
|
||||
json1.put("Name", "point2");
|
||||
json1.put("Value", "4");
|
||||
arr.add(json1);
|
||||
} else if ("任务13" .equals(inst.getInstruction_type())) {
|
||||
if ("1" .equals(type)) {
|
||||
//todo :需要跟上位申请新的点位
|
||||
JSONObject json1 = new JSONObject();
|
||||
json1.put("Name", "point1");
|
||||
json1.put("Value", "1");
|
||||
arr.add(json1);
|
||||
} else if ("2" .equals(type)) {
|
||||
//todo :需要跟上位申请新的点位
|
||||
JSONObject json1 = new JSONObject();
|
||||
json1.put("Name", "point2");
|
||||
json1.put("Value", "1");
|
||||
arr.add(json1);
|
||||
}
|
||||
if ("1".equals(type)) {
|
||||
String newPointCode = applyNewPoint(vehicleNo, type, inst);
|
||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
|
||||
int startAddress = deviceService.queryAddressBydeviceCode(newPointCode);
|
||||
JSONObject ja = new JSONObject();
|
||||
ja.put("code", "200");
|
||||
ja.put("message", "操作成功");
|
||||
ja.put("point_code", String.valueOf(startAddress));
|
||||
log.info("科聪二次分配返回参数:" + ja);
|
||||
return ja;
|
||||
}
|
||||
if ("任务11" .equals(inst.getInstruction_type())) {
|
||||
JSONObject json2 = new JSONObject();
|
||||
json2.put("Name", "isget");
|
||||
json2.put("Value", "1");
|
||||
arr.add(json2);
|
||||
} else if ("任务12" .equals(inst.getInstruction_type())) {
|
||||
JSONObject json2 = new JSONObject();
|
||||
json2.put("Name", "isput");
|
||||
json2.put("Value", "1");
|
||||
arr.add(json2);
|
||||
} else if ("任务13" .equals(inst.getInstruction_type())) {
|
||||
if ("1" .equals(type)) {
|
||||
JSONObject json3 = new JSONObject();
|
||||
json3.put("Name", "isget");
|
||||
json3.put("Value", "1");
|
||||
arr.add(json3);
|
||||
} else if ("2" .equals(type)) {
|
||||
JSONObject json2 = new JSONObject();
|
||||
json2.put("Name", "isput");
|
||||
json2.put("Value", "1");
|
||||
arr.add(json2);
|
||||
}
|
||||
//如果是放货二次分配
|
||||
if ("2".equals(type)) {
|
||||
String newPointCode = applyNewPoint(vehicleNo, type, inst);
|
||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
|
||||
int nextAddress = deviceService.queryAddressBydeviceCode(newPointCode);
|
||||
JSONObject ja = new JSONObject();
|
||||
ja.put("code", "200");
|
||||
ja.put("message", "操作成功");
|
||||
ja.put("point_code", String.valueOf(nextAddress));
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(vehicleNo)
|
||||
.content("放货二次分配,参数:" + inst.getTask_code() + "--" + ActionTypeEnum.getStatus(Integer.parseInt(inst.getInstruction_type())))
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
return ja;
|
||||
}
|
||||
jo.put("Params", arr);
|
||||
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
|
||||
throw new BadRequestException("请求失败,IN OUT 站点错误!");
|
||||
}
|
||||
|
||||
//更新任务参数
|
||||
agvurl = agvurl + ":" + agvport + "/api/fms/updateTaskParam";
|
||||
|
||||
log.info(agvurl);
|
||||
HttpResponse result = HttpRequest.post(agvurl)
|
||||
//表单内容
|
||||
.body(String.valueOf(jo))
|
||||
//超时,毫秒
|
||||
.timeout(20000)
|
||||
.execute();
|
||||
LuceneLogDto logDto1 = LuceneLogDto.builder()
|
||||
.device_code("下发科聪任务")
|
||||
.content("任务号:" + inst.getTask_code() + ",指令号:" + inst.getInstruction_code() + ",下发科聪任务序列反馈参数:" + jo)
|
||||
private String applyNewPoint(String vehicleNo, String type, Instruction inst) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("taskCode", inst.getTask_code());
|
||||
param.put("actionType", inst.getInstruction_type());
|
||||
param.put("type", type);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(vehicleNo)
|
||||
.content("二次分配请求wms,参数:" + inst.getTask_code() + "--" + ActionTypeEnum.getStatus(Integer.parseInt(inst.getInstruction_type())))
|
||||
.build();
|
||||
logDto1.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto1);
|
||||
log.info("任务号:{},指令号{},状态{},下发agv订单序列反馈:{}", inst.getTask_code(), inst.getInstruction_code(), result.getStatus(), result.body());
|
||||
JSONObject jsonObject = null;
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
String body = result.body();
|
||||
jsonObject = JSONObject.parseObject(body);
|
||||
if (ObjectUtil.isNotNull(jsonObject) && "true" .equals(jsonObject.getString("Result"))) {
|
||||
AgvResponse agvResponse = new AgvResponse();
|
||||
agvResponse.setResult("true");
|
||||
agvResponse.setErrMsg("");
|
||||
return agvResponse;
|
||||
} else {
|
||||
AgvResponse agvResponse = new AgvResponse();
|
||||
agvResponse.setResult("false");
|
||||
agvResponse.setErrMsg("");
|
||||
return agvResponse;
|
||||
}
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
String response = acsToWmsService.secondaryAllocationPoint(param);
|
||||
JSONObject jo = JSON.parseObject(response);
|
||||
if (jo.getInteger("status") == 200) {
|
||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||
.device_code(vehicleNo)
|
||||
.content("二次分配请求lms,参数,接口返回:" + jo)
|
||||
.build();
|
||||
logDto2.setLog_level(4);
|
||||
//二次分配更新点位
|
||||
updataTask(inst, jo.getString("data"));
|
||||
return jo.getString("data");
|
||||
} else {
|
||||
AgvResponse agvResponse = new AgvResponse();
|
||||
agvResponse.setResult("false");
|
||||
agvResponse.setErrMsg("");
|
||||
return agvResponse;
|
||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||
.device_code(vehicleNo)
|
||||
.content("二次分配请求lms,返回参数:" + jo)
|
||||
.build();
|
||||
logDto2.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||
log.info("科聪二次分配请求lms失败,返回参数:" + jo);
|
||||
throw new BadRequestException("二次分配请求lms返回失败" + jo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,12 +294,76 @@ public class KeCongAgvServiceImpl implements KeCongAgvService {
|
||||
// }
|
||||
|
||||
@Override
|
||||
public AgvResponse requestResource(JSONObject requestParam) {
|
||||
//todo: 延迟十秒
|
||||
AgvResponse agvResponse = new AgvResponse();
|
||||
agvResponse.setResult("true");
|
||||
agvResponse.setErrMsg("请求失败");
|
||||
return agvResponse;
|
||||
public JSONObject applyIn(JSONObject requestParam) {
|
||||
String resourceID = requestParam.getString("point_code");
|
||||
String vehicleNo = requestParam.getString("VehicleNo");
|
||||
if (resourceID.equals("659") || resourceID.equals("17")) {
|
||||
log.info("科聪申请离开请求参数:" + requestParam);
|
||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||
.device_code(vehicleNo)
|
||||
.content("agv申请进入请求离开成功")
|
||||
.build();
|
||||
logDto2.setLog_level(4);
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("code", "200");
|
||||
json.put("message", "操作成功");
|
||||
return json;
|
||||
}
|
||||
log.info("科聪申请进入请求参数:" + requestParam);
|
||||
List<StorageCell> storageCells = storageCellMapper.selectList(new LambdaQueryWrapper<StorageCell>().eq(StorageCell::getAddress, resourceID).orderByDesc(StorageCell::getUpdate_time));
|
||||
StorageCell storageCell = storageCells.get(0);
|
||||
String storage_code = storageCell.getStorage_code();
|
||||
JSONObject ja = new JSONObject();
|
||||
ja.put("point_code", storage_code);
|
||||
String response = acsToWmsService.applyIn(ja);
|
||||
|
||||
JSONObject jo = JSON.parseObject(response);
|
||||
if (jo.getInteger("status") == 200) {
|
||||
log.info("agv申请进入请求lms成功,参数,接口返回:" + jo);
|
||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||
.device_code(vehicleNo)
|
||||
.content("agv申请进入请求lms成功,参数,接口返回:" + jo)
|
||||
.build();
|
||||
logDto2.setLog_level(4);
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("code", "200");
|
||||
json.put("message", "操作成功");
|
||||
log.info("科聪申请进入下发返回参数:" + json);
|
||||
return json;
|
||||
} else {
|
||||
log.info("agv申请进入请求lms失败,参数,接口返回:" + jo);
|
||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||
.device_code(vehicleNo)
|
||||
.content("agv申请进入请求lms失败,返回参数:" + jo)
|
||||
.build();
|
||||
logDto2.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("code", "400");
|
||||
json.put("message", "申请进入失败,接口返回:" + jo);
|
||||
log.info("科聪申请进入下发返回参数:" + json);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
|
||||
private void updataTask(Instruction instructionDto, String newPoint) {
|
||||
|
||||
TaskDto taskUpdate = new TaskDto();
|
||||
if (AgvActionTypeEnum.IN_STOCK.getCode().equals(instructionDto.getAgv_action_type())) {
|
||||
instructionDto.setStart_point_code(newPoint);
|
||||
taskUpdate.setStart_point_code(newPoint);
|
||||
instructionDto.setStart_device_code(newPoint);
|
||||
taskUpdate.setStart_device_code(newPoint);
|
||||
}
|
||||
if (AgvActionTypeEnum.OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type())) {
|
||||
instructionDto.setNext_point_code(newPoint);
|
||||
taskUpdate.setNext_point_code(newPoint);
|
||||
instructionDto.setNext_device_code(newPoint);
|
||||
taskUpdate.setNext_device_code(newPoint);
|
||||
}
|
||||
taskUpdate.setTask_id(instructionDto.getTask_id());
|
||||
instructionService.update(instructionDto);
|
||||
taskserver.update(taskUpdate);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -307,6 +374,25 @@ public class KeCongAgvServiceImpl implements KeCongAgvService {
|
||||
return agvResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject requestAction(JSONObject requestParam) {
|
||||
String taskNo = requestParam.getString("TaskNo");
|
||||
Instruction instruction = instructionService.findByCode(taskNo);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("task_code", instruction.getTask_code());
|
||||
LuceneLogDto logDto1 = LuceneLogDto.builder()
|
||||
.device_code(taskNo)
|
||||
.content("取货完成反馈:" + jsonObject.toJSONString() + ";指令号:" + taskNo)
|
||||
.build();
|
||||
logDto1.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto1);
|
||||
acsToWmsService.actionFinishRequest2(jsonObject);
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("code", "200");
|
||||
jo.put("message", "请求成功");
|
||||
return jo;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public HttpResponse getRobotInfo(String robotCode) {
|
||||
// if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) {
|
||||
|
||||
@@ -55,13 +55,21 @@ public class CommonFinalParam {
|
||||
/**
|
||||
* 申请任务type类型
|
||||
*/
|
||||
public static final String TYPE_ONE = "1";
|
||||
public static final String TYPE_TWO = "2";
|
||||
public static final String TYPE_THREE = "3";
|
||||
public static final String TYPE_FOUR = "4";
|
||||
public static final String TYPE_FIVE = "5";
|
||||
public static final String TYPE_SIX = "6";
|
||||
public static final String TYPE_SEVEN = "7";
|
||||
// public static final String TYPE_ONE = "1";
|
||||
// public static final String TYPE_TWO = "2";
|
||||
// public static final String TYPE_THREE = "3";
|
||||
// public static final String TYPE_FOUR = "4";
|
||||
// public static final String TYPE_FIVE = "5";
|
||||
// public static final String TYPE_SIX = "6";
|
||||
// public static final String TYPE_SEVEN = "7";
|
||||
|
||||
/**
|
||||
* 申请任务type类型
|
||||
*/
|
||||
public static final String TYPE_ONE = "ONE";
|
||||
public static final String TYPE_TWO = "TWO";
|
||||
public static final String TYPE_THREE = "THREE";
|
||||
public static final String TYPE_FOUR = "FOUR";
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -132,6 +132,14 @@ public interface DeviceService extends CommonService<Device> {
|
||||
*/
|
||||
DeviceDto findByCode(String code);
|
||||
|
||||
/**
|
||||
* 根据站点号查询
|
||||
*
|
||||
* @param code code
|
||||
* @return Device
|
||||
*/
|
||||
DeviceDto findByAgvCode(String code);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
|
||||
@@ -273,6 +273,14 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
|
||||
return ConvertUtil.convert(device, DeviceDto.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceDto findByAgvCode(String code) {
|
||||
Device device = new LambdaQueryChainWrapper<>(deviceMapper)
|
||||
.eq(Device::getAddress, code)
|
||||
.one();
|
||||
return ConvertUtil.convert(device, DeviceDto.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(DeviceDto dto) {
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.belt_conveyor.BeltConveyorDeviceDriver;
|
||||
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.driver.AbstractDeviceDriver;
|
||||
@@ -165,8 +166,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
|
||||
//普通站点
|
||||
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
||||
//标准-光电检测
|
||||
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
|
||||
|
||||
|
||||
if (phase == 0x02) {
|
||||
@@ -483,11 +482,11 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//当前上报的车号
|
||||
String now_car = String.valueOf(this.agvaddr);
|
||||
//如果配置的车号是诺宝车号
|
||||
if(now_car.equals(is_atuo_car)){
|
||||
if (now_car.equals(is_atuo_car)) {
|
||||
//是否开启自动充电
|
||||
String is_atuo_electric = ISysParamService.findByCode(AcsConfig.IS_ATUO_ELECTRIC).getValue();
|
||||
log.info("接收agv上报信息,is_atuo_electric:" + is_atuo_electric);
|
||||
if("1".equals(is_atuo_electric)){
|
||||
if ("1".equals(is_atuo_electric)) {
|
||||
String electric_begin = ISysParamService.findByCode(AcsConfig.ELECTRIC_BEGIN).getValue();
|
||||
String[] begins = electric_begin.split(":");
|
||||
String electric_end = ISysParamService.findByCode(AcsConfig.ELECTRIC_END).getValue();
|
||||
@@ -499,27 +498,27 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
LocalTime now = LocalTime.now();
|
||||
// 判断当前时间是否在时间段内
|
||||
boolean isInRange = !now.isBefore(startTime) && !now.isAfter(endTime);
|
||||
int electric = 0 ;
|
||||
int electric = 0;
|
||||
//早上8-22点
|
||||
if(isInRange){
|
||||
if (isInRange) {
|
||||
electric = Integer.parseInt(ISysParamService.findByCode(AcsConfig.ELECTRIC).getValue());
|
||||
}else{
|
||||
} else {
|
||||
electric = Integer.parseInt(ISysParamService.findByCode(AcsConfig.ELECTRIC2).getValue());
|
||||
}
|
||||
if (electric_qty>0 && electric_qty < electric) {
|
||||
log.info("当前车辆{}电量为{}低于{},开始判断是否需要充电!", this.agvaddr, electric_qty,electric);
|
||||
if (electric_qty > 0 && electric_qty < electric) {
|
||||
log.info("当前车辆{}电量为{}低于{},开始判断是否需要充电!", this.agvaddr, electric_qty, electric);
|
||||
//判断是否已下发充电任务
|
||||
Dict dict1 = dictService.getDictByName3("station",String.valueOf(this.agvaddr),null);
|
||||
if(ObjectUtil.isNotEmpty(dict1)){
|
||||
log.info("当前车辆{}已分配充电桩{},退出后续判断",this.agvaddr,dict1.getPara1());
|
||||
}else{
|
||||
Dict dict1 = dictService.getDictByName3("station", String.valueOf(this.agvaddr), null);
|
||||
if (ObjectUtil.isNotEmpty(dict1)) {
|
||||
log.info("当前车辆{}已分配充电桩{},退出后续判断", this.agvaddr, dict1.getPara1());
|
||||
} else {
|
||||
//未下发,判断是否有空闲充电桩
|
||||
Dict dict = dictService.getDictByName2("station");
|
||||
if(ObjectUtil.isNotEmpty(dict)){
|
||||
if (ObjectUtil.isNotEmpty(dict)) {
|
||||
ndcAgvService.charge(String.valueOf(this.agvaddr));
|
||||
isCharge =true;
|
||||
}else{
|
||||
log.info("当前车辆{}电量为{}低于{},但无空闲充电桩!", this.agvaddr, electric_qty,electric);
|
||||
isCharge = true;
|
||||
} else {
|
||||
log.info("当前车辆{}电量为{}低于{},但无空闲充电桩!", this.agvaddr, electric_qty, electric);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import java.util.List;
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/wms")
|
||||
@Slf4j
|
||||
@SaIgnore
|
||||
public class WmsToAcsController {
|
||||
private final WmsToAcsService wmstoacsService;
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ public interface AcsToWmsService {
|
||||
* @param arr
|
||||
* @return
|
||||
*/
|
||||
HttpResponse feedTaskStatus(JSONArray arr);
|
||||
HttpResponse feedTaskStatus(JSONObject arr);
|
||||
|
||||
/**
|
||||
* ACS向WMS反馈任务状态
|
||||
@@ -225,4 +225,6 @@ public interface AcsToWmsService {
|
||||
* @return
|
||||
*/
|
||||
ManipulatorApplyPointResponse manipulatorApplyPointRequest(ManipulatorApplyPointRequest param);
|
||||
|
||||
String applyIn(JSONObject ja);
|
||||
}
|
||||
|
||||
@@ -326,20 +326,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
|
||||
|
||||
@Override
|
||||
public HttpResponse feedTaskStatus(JSONArray data) {
|
||||
public HttpResponse feedTaskStatus(JSONObject 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());
|
||||
|
||||
@@ -347,7 +338,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
try {
|
||||
result2 = HttpRequest.post(wmsurl + methods_url)
|
||||
.addInterceptor(tLogHutoolhttpInterceptor)
|
||||
.header(Header.USER_AGENT, "Hutool http")
|
||||
.header("Authorization", token).body(String.valueOf(data))
|
||||
.execute();
|
||||
@@ -744,6 +734,48 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String applyIn(JSONObject param) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("applyIn-----agv申请进入输入参数{}", param);
|
||||
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
AddressDto addressDto = addressService.findByCode("applyIn");
|
||||
String url = wmsurl + addressDto.getMethods_url();
|
||||
HttpResponse result2 = null;
|
||||
try {
|
||||
result2 = HttpRequest.post(url)
|
||||
.addInterceptor(tLogHutoolhttpInterceptor)
|
||||
.header(Header.USER_AGENT, "Hutool http")
|
||||
.header("Authorization", token)
|
||||
.body(String.valueOf(param))
|
||||
.execute();
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
log.info("applyIn-----输出参数{}", msg);
|
||||
//网络不通
|
||||
}
|
||||
if (ObjectUtil.isEmpty(result2)) {
|
||||
log.info("applyIn-----输出参数{}", "返回结果为空");
|
||||
return null;
|
||||
}
|
||||
String type = "";
|
||||
if (result2.getStatus() == 200) {
|
||||
type = "info";
|
||||
} else {
|
||||
type = "error";
|
||||
}
|
||||
log.info("secondaryAllocationPoint-----输出参数{}", result2.body());
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "applyIn", String.valueOf(result2.getStatus()),
|
||||
JSON.toJSONString(param), String.valueOf(result2.body()), "agv申请进入");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
return result2.body();
|
||||
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String forceMove(JSONObject param) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.acs.ext.wms.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -12,7 +13,10 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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.service.impl.DeviceServiceImpl;
|
||||
import org.nl.acs.device_driver.agv.ndctwo.AgvNdcTwoDeviceDriver;
|
||||
import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
||||
@@ -74,91 +78,41 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
JSONArray datas = JSONArray.parseArray(param);
|
||||
JSONObject req = JSONObject.parseObject(param);
|
||||
org.nl.acs.ext.wms.data.WmstoAcsData.createTask.CreateTaskRequest tasks = JSON.toJavaObject(req, org.nl.acs.ext.wms.data.WmstoAcsData.createTask.CreateTaskRequest.class);
|
||||
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_code2 = request.getVehicle_code2();
|
||||
String vehicle_type = request.getVehicle_type();
|
||||
String route_plan_code = request.getRoute_plan_code();
|
||||
String task_type = request.getTask_type();
|
||||
String class_type = request.getClass_type();
|
||||
String truss_type = request.getTruss_type();
|
||||
Integer agv_action_type = request.getAgv_action_type();
|
||||
String empty_site = request.getEmpty_site();
|
||||
String is_bushing = request.getIs_bushing();
|
||||
String is_pulling = request.getIs_pulling();
|
||||
String size = request.getSize();
|
||||
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();
|
||||
for (int i = 0; i < tasks.getList().size(); i++) {
|
||||
TaskDto task = tasks.getList().get(i);
|
||||
String ext_task_uuid = task.getExt_task_uuid();
|
||||
String task_code = task.getTask_code();
|
||||
String start_point_code = task.getStart_device_code();
|
||||
String next_point_code = task.getNext_device_code();
|
||||
String priority = task.getPriority();
|
||||
String vehicle_code = task.getVehicle_code();
|
||||
String vehicle_type = task.getVehicle_type();
|
||||
String route_plan_code = task.getRoute_plan_code();
|
||||
String task_type = task.getTask_type();
|
||||
String remark = task.getRemark();
|
||||
String params = task.getParams();
|
||||
Integer agv_action_type = task.getAgv_action_type();
|
||||
|
||||
String start_point_code = "";
|
||||
String start_point_code2 = "";
|
||||
String next_point_code = "";
|
||||
String next_point_code2 = "";
|
||||
String put_point_code = "";
|
||||
String put_device_code = task.getPut_device_code();
|
||||
String agv_system_type = task.getAgv_system_type();
|
||||
|
||||
String start_device_code2 = task.getStart_device_code2();
|
||||
String next_device_code2 = task.getNext_device_code2();
|
||||
String start_device_code = "";
|
||||
String next_device_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("ext_task_id", ext_task_uuid);
|
||||
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)
|
||||
@@ -166,15 +120,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
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)) {
|
||||
@@ -184,18 +129,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
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];
|
||||
@@ -210,47 +143,16 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
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")) {
|
||||
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("ext_task_id", ext_task_uuid);
|
||||
json.put("message", "存在相同的任务号:" + task_code);
|
||||
errArr.add(json);
|
||||
continue;
|
||||
@@ -260,7 +162,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
if (vehicle_dto != null) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("ext_task_id", ext_task_id);
|
||||
json.put("ext_task_id", ext_task_uuid);
|
||||
json.put("message", "已存在任务编号为" + vehicle_dto.getTask_code() + "托盘号:" + vehicle_code);
|
||||
errArr.add(json);
|
||||
continue;
|
||||
@@ -279,93 +181,57 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
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() + " 该设备号未找到对应点位");
|
||||
json.put("ext_task_id", ext_task_uuid);
|
||||
json.put("message", task.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() + " 该设备号未找到对应点位");
|
||||
json.put("ext_task_id", ext_task_uuid);
|
||||
json.put("message", task.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("ext_task_id", ext_task_uuid);
|
||||
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_point_code2", start_device_code2);
|
||||
jo.put("next_point_code2", next_device_code2);
|
||||
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("agv_action_type", agv_action_type);
|
||||
jo.put("priority", priority);
|
||||
jo.put("vehicle_code", vehicle_code);
|
||||
jo.put("vehicle_code2", vehicle_code2);
|
||||
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("agv_system_type", agv_system_type);
|
||||
jo.put("agv_action_type", agv_action_type);
|
||||
jo.put("task_type", StrUtil.isEmpty(task_type) ? 1 : Integer.parseInt(task_type));
|
||||
jo.put("class_type", class_type);
|
||||
jo.put("route_plan_code", route_plan_code);
|
||||
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("is_pulling", JSONUtil.toJsonStr(is_pulling));
|
||||
jo.put("size", JSONUtil.toJsonStr(size));
|
||||
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);
|
||||
}
|
||||
jo.put("put_device_code", put_device_code);
|
||||
|
||||
TaskDto task_dto = jo.toJavaObject(TaskDto.class);
|
||||
try {
|
||||
if (ObjectUtil.isNotEmpty(request.getInteraction_json())) {
|
||||
task_dto.setInteractionJson(request.getInteraction_json());
|
||||
}
|
||||
// if (ObjectUtil.isNotEmpty(task.getInteraction_json())) {
|
||||
// task_dto.setInteractionJson(task.getInteraction_json());
|
||||
// }
|
||||
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("ext_task_id", ext_task_uuid);
|
||||
json.put("message", e.getMessage());
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
if ("RK1002".equals(task_dto.getStart_device_code())){
|
||||
Device device = deviceAppService.findDeviceByCode("RK1003");
|
||||
BeltConveyorDeviceDriver beltConveyorDeviceDriver1;
|
||||
if (device.getDeviceDriver() instanceof BeltConveyorDeviceDriver) {
|
||||
beltConveyorDeviceDriver1 = (BeltConveyorDeviceDriver) device.getDeviceDriver();
|
||||
List list1 = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
map.put("code", "to_command");
|
||||
map.put("value", "55");
|
||||
list1.add(map);
|
||||
beltConveyorDeviceDriver1.writing(list1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isEmpty(errArr)) {
|
||||
response.setStatus(200);
|
||||
@@ -500,34 +366,26 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PutActionResponse putAction(String jsonObject) throws Exception {
|
||||
log.info("WMS下发点位信号--------------:输入参数" + jsonObject);
|
||||
String date = new Date().toString();
|
||||
public PutActionResponse putAction(String whereJson) throws Exception {
|
||||
log.info("WMS下发点位信号--------------:输入参数" + whereJson);
|
||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code("WMS下发点位信号")
|
||||
.content("WMS下发点位信号-----输入参数:" + jsonObject)
|
||||
.content("WMS下发点位信号-----输入参数:" + whereJson)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
JSONArray datas = JSONArray.parseArray(jsonObject);
|
||||
PutActionResponse response = new PutActionResponse();
|
||||
JSONArray errArr = new JSONArray();
|
||||
for (int i = 0; i < datas.size(); i++) {
|
||||
String data = datas.get(i).toString();
|
||||
PutActionRequest request = JsonUtl.format(data, PutActionRequest.class);
|
||||
String device_code = request.getDevice_code();
|
||||
String code = request.getCode();
|
||||
String value = request.getValue();
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
throw new Exception("未找到对应设备:" + device_code);
|
||||
}
|
||||
BeltConveyorDeviceDriver beltConveyorDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof BeltConveyorDeviceDriver) {
|
||||
beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) device.getDeviceDriver();
|
||||
beltConveyorDeviceDriver.writing(code, value);
|
||||
}
|
||||
}
|
||||
JSONObject jsonObject = JSONObject.parseObject(whereJson);
|
||||
|
||||
String device_code = jsonObject.getString("point_code");
|
||||
//1-进入; 0-离开
|
||||
String option = jsonObject.getString("option");
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
device.setAddress(option);
|
||||
device.setUpdate_time(DateUtil.now());
|
||||
device.setUpdate_by("WMS");
|
||||
deviceService.updateById(device);
|
||||
response.setStatus(200);
|
||||
response.setMessage("success");
|
||||
LuceneLogDto logDto1 = LuceneLogDto.builder()
|
||||
@@ -541,7 +399,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getTubeMes(String jsonObject) throws Exception {
|
||||
log.info("下发管芯信息--------------:输入参数" + jsonObject);
|
||||
@@ -582,8 +439,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
JSONArray datas = JSONArray.parseArray(jsonObject);
|
||||
|
||||
|
||||
|
||||
|
||||
//标准版输送线
|
||||
BeltConveyorDeviceDriver beltConveyorDeviceDriver;
|
||||
|
||||
|
||||
@@ -459,13 +459,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
if (ObjectUtils.isEmpty(shortPathsList)) {
|
||||
throw new Exception(dto.getStart_device_code() + "->" + dto.getNext_device_code() + "路由不通");
|
||||
}
|
||||
// if (StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) {
|
||||
// throw new BadRequestException(dto.getStart_device_code() + "->" + dto.getNext_device_code() + "路由类型不是agv类型");
|
||||
// }
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "2")) {
|
||||
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto);
|
||||
}
|
||||
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "5")) {
|
||||
HttpResponse response = keCongAgvService.addTask(dto);
|
||||
JSONObject jsonObject = null;
|
||||
@@ -476,7 +470,9 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
if (ObjectUtil.isNotNull(jsonObject) && "true" .equals(jsonObject.getString("Result"))) {
|
||||
dto.setSend_status("1");
|
||||
} else {
|
||||
//todo 添加错误日志
|
||||
dto.setSend_status("2");
|
||||
throw new Exception(dto.getStart_device_code() + "->" + dto.getNext_device_code() + "任务下发科聪调度失败!");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -1171,7 +1167,12 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
XianGongAgvService xianGongAgvService = SpringContextHolder.getBean(XianGongAgvService.class);
|
||||
xianGongAgvService.deleteXZAgvInst(entity.getInstruction_code());
|
||||
flag = true;
|
||||
} else {
|
||||
} else if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "5")
|
||||
&& !StrUtil.equals(entity.getSend_status(), "2")) {
|
||||
KeCongAgvService keCongAgvService = SpringContextHolder.getBean(KeCongAgvService.class);
|
||||
keCongAgvService.deleteTask(entity.getInstruction_code());
|
||||
flag = true;
|
||||
}else {
|
||||
flag = true;
|
||||
}
|
||||
if (flag) {
|
||||
|
||||
@@ -1,110 +1,110 @@
|
||||
package org.nl.acs.rfid_manage.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.rfid_manage.service.IbmVehicleRfidService;
|
||||
import org.nl.acs.rfid_manage.service.dto.BmVehicleRfidParam;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/rfid")
|
||||
@Slf4j
|
||||
@SaIgnore
|
||||
public class BmVehicleRfidController {
|
||||
|
||||
@Resource
|
||||
private IbmVehicleRfidService bmVehicleRfidService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param whereJson 查询条件
|
||||
* @param page 分页参数
|
||||
*/
|
||||
@GetMapping
|
||||
//@SaCheckPermission("@el.check(BmVehicleRfid:list")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) {
|
||||
//写入标签
|
||||
//bmVehicleRfidService.writeEpc("1");
|
||||
return new ResponseEntity<>(TableDataInfo.build(bmVehicleRfidService.query(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 条件查询
|
||||
*
|
||||
* @param params 查询条件
|
||||
*/
|
||||
@PostMapping("/selectList")
|
||||
//@SaCheckPermission("@el.check(BmVehicleRfid:list")
|
||||
public ResponseEntity<Object> selectList(@RequestBody BmVehicleRfidParam params) {
|
||||
return new ResponseEntity<>(bmVehicleRfidService.selectList(params), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param params 实体对象
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
//@SaCheckPermission("@el.check(BmVehicleRfid:add")
|
||||
public ResponseEntity<Object> create(@RequestBody BmVehicleRfidParam params) {
|
||||
bmVehicleRfidService.create(params);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 连接测试
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/open")
|
||||
//@SaCheckPermission("@el.check(BmVehicleRfid:add")
|
||||
public ResponseEntity<Object> connectRfid(@RequestBody BmVehicleRfidParam params) {
|
||||
bmVehicleRfidService.connectRfid(params);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param params 实体对象
|
||||
* @return 修改结果
|
||||
*/
|
||||
@PutMapping
|
||||
//@SaCheckPermission("@el.check(BmVehicleRfid:edit')")
|
||||
public ResponseEntity<Object> update(@RequestBody BmVehicleRfidParam params) {
|
||||
bmVehicleRfidService.update(params);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param ids 多个主键Id
|
||||
* @return 删除结果
|
||||
*/
|
||||
//@SaCheckPermission("@el.check(BmVehicleRfid:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
bmVehicleRfidService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
//package org.nl.acs.rfid_manage.controller;
|
||||
//
|
||||
//import cn.dev33.satoken.annotation.SaIgnore;
|
||||
//import lombok.RequiredArgsConstructor;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.nl.acs.rfid_manage.service.IbmVehicleRfidService;
|
||||
//import org.nl.acs.rfid_manage.service.dto.BmVehicleRfidParam;
|
||||
//import org.nl.common.base.TableDataInfo;
|
||||
//import org.nl.common.domain.query.PageQuery;
|
||||
//import org.springframework.http.HttpStatus;
|
||||
//import org.springframework.http.ResponseEntity;
|
||||
//import org.springframework.web.bind.annotation.*;
|
||||
//
|
||||
//import javax.annotation.Resource;
|
||||
//import java.util.Map;
|
||||
//import java.util.Set;
|
||||
//
|
||||
//
|
||||
//@RestController
|
||||
//@RequiredArgsConstructor
|
||||
//@RequestMapping("/api/rfid")
|
||||
//@Slf4j
|
||||
//@SaIgnore
|
||||
//public class BmVehicleRfidController {
|
||||
//
|
||||
// @Resource
|
||||
// private IbmVehicleRfidService bmVehicleRfidService;
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 分页查询
|
||||
// *
|
||||
// * @param whereJson 查询条件
|
||||
// * @param page 分页参数
|
||||
// */
|
||||
// @GetMapping
|
||||
// //@SaCheckPermission("@el.check(BmVehicleRfid:list")
|
||||
// public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) {
|
||||
// //写入标签
|
||||
// //bmVehicleRfidService.writeEpc("1");
|
||||
// return new ResponseEntity<>(TableDataInfo.build(bmVehicleRfidService.query(whereJson, page)), HttpStatus.OK);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 条件查询
|
||||
// *
|
||||
// * @param params 查询条件
|
||||
// */
|
||||
// @PostMapping("/selectList")
|
||||
// //@SaCheckPermission("@el.check(BmVehicleRfid:list")
|
||||
// public ResponseEntity<Object> selectList(@RequestBody BmVehicleRfidParam params) {
|
||||
// return new ResponseEntity<>(bmVehicleRfidService.selectList(params), HttpStatus.OK);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 新增数据
|
||||
// *
|
||||
// * @param params 实体对象
|
||||
// * @return 新增结果
|
||||
// */
|
||||
// @PostMapping
|
||||
// //@SaCheckPermission("@el.check(BmVehicleRfid:add")
|
||||
// public ResponseEntity<Object> create(@RequestBody BmVehicleRfidParam params) {
|
||||
// bmVehicleRfidService.create(params);
|
||||
// return new ResponseEntity<>(HttpStatus.OK);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 连接测试
|
||||
// * @return 结果
|
||||
// */
|
||||
// @PostMapping("/open")
|
||||
// //@SaCheckPermission("@el.check(BmVehicleRfid:add")
|
||||
// public ResponseEntity<Object> connectRfid(@RequestBody BmVehicleRfidParam params) {
|
||||
// bmVehicleRfidService.connectRfid(params);
|
||||
// return new ResponseEntity<>(HttpStatus.OK);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 修改数据
|
||||
// *
|
||||
// * @param params 实体对象
|
||||
// * @return 修改结果
|
||||
// */
|
||||
// @PutMapping
|
||||
// //@SaCheckPermission("@el.check(BmVehicleRfid:edit')")
|
||||
// public ResponseEntity<Object> update(@RequestBody BmVehicleRfidParam params) {
|
||||
// bmVehicleRfidService.update(params);
|
||||
// return new ResponseEntity<>(HttpStatus.OK);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 删除数据
|
||||
// *
|
||||
// * @param ids 多个主键Id
|
||||
// * @return 删除结果
|
||||
// */
|
||||
// //@SaCheckPermission("@el.check(BmVehicleRfid:del')")
|
||||
// @DeleteMapping
|
||||
// public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
// bmVehicleRfidService.deleteAll(ids);
|
||||
// return new ResponseEntity<>(HttpStatus.OK);
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -1,58 +1,58 @@
|
||||
package org.nl.acs.rfid_manage.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.acs.rfid_manage.service.dao.BmVehicleRfid;
|
||||
import org.nl.acs.rfid_manage.service.dto.BmVehicleRfidParam;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public interface IbmVehicleRfidService extends IService<BmVehicleRfid> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param whereJson 查询条件
|
||||
* @return IPage<BmVehicleRfid>
|
||||
*/
|
||||
IPage<BmVehicleRfid> query(Map whereJson, PageQuery page);
|
||||
|
||||
/**
|
||||
* 条件查询
|
||||
*
|
||||
* @param params 查询条件
|
||||
* @return List<BmVehicleRfid>
|
||||
*/
|
||||
List<BmVehicleRfid> selectList(BmVehicleRfidParam params);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param params 对象实体
|
||||
*/
|
||||
void create(BmVehicleRfidParam params);
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param params 对象实体
|
||||
*/
|
||||
void update(BmVehicleRfidParam params);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Set<String> ids);
|
||||
|
||||
|
||||
void connectRfid(BmVehicleRfidParam params);
|
||||
|
||||
void writeEpc(String id);
|
||||
}
|
||||
//package org.nl.acs.rfid_manage.service;
|
||||
//
|
||||
//import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
//import com.baomidou.mybatisplus.extension.service.IService;
|
||||
//import org.nl.acs.rfid_manage.service.dao.BmVehicleRfid;
|
||||
//import org.nl.acs.rfid_manage.service.dto.BmVehicleRfidParam;
|
||||
//import org.nl.common.domain.query.PageQuery;
|
||||
//
|
||||
//import java.util.List;
|
||||
//import java.util.Map;
|
||||
//import java.util.Set;
|
||||
//
|
||||
//public interface IbmVehicleRfidService extends IService<BmVehicleRfid> {
|
||||
//
|
||||
// /**
|
||||
// * 分页查询
|
||||
// *
|
||||
// * @param whereJson 查询条件
|
||||
// * @return IPage<BmVehicleRfid>
|
||||
// */
|
||||
// IPage<BmVehicleRfid> query(Map whereJson, PageQuery page);
|
||||
//
|
||||
// /**
|
||||
// * 条件查询
|
||||
// *
|
||||
// * @param params 查询条件
|
||||
// * @return List<BmVehicleRfid>
|
||||
// */
|
||||
// List<BmVehicleRfid> selectList(BmVehicleRfidParam params);
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 创建
|
||||
// *
|
||||
// * @param params 对象实体
|
||||
// */
|
||||
// void create(BmVehicleRfidParam params);
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 编辑
|
||||
// *
|
||||
// * @param params 对象实体
|
||||
// */
|
||||
// void update(BmVehicleRfidParam params);
|
||||
//
|
||||
// /**
|
||||
// * 多选删除
|
||||
// *
|
||||
// * @param ids /
|
||||
// */
|
||||
// void deleteAll(Set<String> ids);
|
||||
//
|
||||
//
|
||||
// void connectRfid(BmVehicleRfidParam params);
|
||||
//
|
||||
// void writeEpc(String id);
|
||||
//}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -117,7 +117,7 @@ public interface StorageCellService extends CommonService<StorageCell> {
|
||||
* @param code code
|
||||
* @return StorageCell
|
||||
*/
|
||||
// StorageCellDto findByCode(String code);
|
||||
StorageCellDto findByCode(String code);
|
||||
|
||||
/**
|
||||
* 根据地址查询
|
||||
|
||||
@@ -348,7 +348,7 @@ public class TaskDto implements Serializable {
|
||||
/**
|
||||
* 扩展属性
|
||||
*/
|
||||
String params2;
|
||||
String params;
|
||||
|
||||
/**
|
||||
* 是否拔轴 0/1
|
||||
@@ -361,6 +361,11 @@ public class TaskDto implements Serializable {
|
||||
*/
|
||||
private Integer agv_action_type;
|
||||
|
||||
/**
|
||||
* 外部系统标识
|
||||
*/
|
||||
private String ext_task_uuid;
|
||||
|
||||
/**
|
||||
* 任务类型
|
||||
* 9 子卷下线行架任务
|
||||
|
||||
@@ -910,10 +910,6 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
if (!TaskStatusEnum.FINISHED.getIndex().equals(updateTask.getTask_status())) {
|
||||
//反馈上位系统任务状态
|
||||
this.feedWmsTaskStatus(entity);
|
||||
//关闭仙工运单序列
|
||||
if (StrUtil.equals(task.getTask_type(), TaskTypeEnum.Standard_AGV_Task.getCode()) && (StrUtil.equals(task.getAgv_system_type(), AgvSystemTypeEnum.One_NDC_System_Type.getCode()) || StrUtil.equals(task.getAgv_system_type(), AgvSystemTypeEnum.XG_System_Type.getCode()))) {
|
||||
this.markComplete(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1804,17 +1800,17 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
if (ObjectUtil.isNotEmpty(entity.getCarno())) {
|
||||
feed_jo.put("car_no", entity.getCarno());
|
||||
}
|
||||
JSONArray ja = new JSONArray();
|
||||
ja.add(feed_jo);
|
||||
// JSONArray ja = new JSONArray();
|
||||
// ja.add(feed_jo);
|
||||
//TODO 有需要根据上位系统反馈的信息再做进一步处理
|
||||
CompletableFuture.runAsync(() -> {
|
||||
acstowmsService.feedTaskStatus(ja);
|
||||
// CompletableFuture.runAsync(() -> {
|
||||
// 异步更新任务状态
|
||||
try {
|
||||
acstowmsService.feedTaskStatus(feed_jo);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,66 +1,66 @@
|
||||
package org.nl.acs.utils;
|
||||
|
||||
import com.gg.reader.api.utils.BitBuffer;
|
||||
import com.gg.reader.api.utils.HexUtils;
|
||||
|
||||
public class StructUtil {
|
||||
|
||||
public static String getZdPoint(int row,String source_code) {
|
||||
if (row == 2 || row == 3) {
|
||||
return source_code;
|
||||
}
|
||||
int blockRow = row == 1 ? 2 : 3;
|
||||
String replace = source_code.replaceFirst("L0" + row, "L0%s");
|
||||
return String.format(replace, blockRow);
|
||||
}
|
||||
|
||||
public static String getDeepPoint(int row,String source_code) {
|
||||
if (row == 1 || row == 4) {
|
||||
return source_code;
|
||||
}
|
||||
int blockRow = row == 2 ? 1 : 4;
|
||||
String replace = source_code.replaceFirst("L0" + row, "L0%s");
|
||||
return String.format(replace, blockRow);
|
||||
}
|
||||
|
||||
public static String getPc(int pcLen) {
|
||||
int iPc = pcLen << 11;
|
||||
BitBuffer buffer = BitBuffer.allocateDynamic();
|
||||
buffer.put(iPc);
|
||||
buffer.position(16);
|
||||
byte[] bTmp = new byte[2];
|
||||
buffer.get(bTmp);
|
||||
return HexUtils.bytes2HexString(bTmp);
|
||||
}
|
||||
|
||||
public static String getGbPc(int pcLen) {
|
||||
int iPc = pcLen << 8;
|
||||
BitBuffer buffer = BitBuffer.allocateDynamic();
|
||||
buffer.put(iPc);
|
||||
buffer.position(16);
|
||||
byte[] bTmp = new byte[2];
|
||||
buffer.get(bTmp);
|
||||
return HexUtils.bytes2HexString(bTmp);
|
||||
}
|
||||
|
||||
//写入数据不足4位后面补'0' AA00
|
||||
public static String padLeft(String src, int len, char ch) {
|
||||
int diff = len - src.length();
|
||||
if (diff <= 0) {
|
||||
return src;
|
||||
}
|
||||
|
||||
char[] chars = new char[len];
|
||||
System.arraycopy(src.toCharArray(), 0, chars, 0, src.length());
|
||||
for (int i = src.length(); i < len; i++) {
|
||||
chars[i] = ch;
|
||||
}
|
||||
return new String(chars);
|
||||
}
|
||||
|
||||
public static int getValueLen(String data) {
|
||||
data = data.trim();
|
||||
return data.length() % 4 == 0 ? data.length() / 4
|
||||
: (data.length() / 4) + 1;
|
||||
}
|
||||
}
|
||||
//package org.nl.acs.utils;
|
||||
//
|
||||
//import com.gg.reader.api.utils.BitBuffer;
|
||||
//import com.gg.reader.api.utils.HexUtils;
|
||||
//
|
||||
//public class StructUtil {
|
||||
//
|
||||
// public static String getZdPoint(int row,String source_code) {
|
||||
// if (row == 2 || row == 3) {
|
||||
// return source_code;
|
||||
// }
|
||||
// int blockRow = row == 1 ? 2 : 3;
|
||||
// String replace = source_code.replaceFirst("L0" + row, "L0%s");
|
||||
// return String.format(replace, blockRow);
|
||||
// }
|
||||
//
|
||||
// public static String getDeepPoint(int row,String source_code) {
|
||||
// if (row == 1 || row == 4) {
|
||||
// return source_code;
|
||||
// }
|
||||
// int blockRow = row == 2 ? 1 : 4;
|
||||
// String replace = source_code.replaceFirst("L0" + row, "L0%s");
|
||||
// return String.format(replace, blockRow);
|
||||
// }
|
||||
//
|
||||
// public static String getPc(int pcLen) {
|
||||
// int iPc = pcLen << 11;
|
||||
// BitBuffer buffer = BitBuffer.allocateDynamic();
|
||||
// buffer.put(iPc);
|
||||
// buffer.position(16);
|
||||
// byte[] bTmp = new byte[2];
|
||||
// buffer.get(bTmp);
|
||||
// return HexUtils.bytes2HexString(bTmp);
|
||||
// }
|
||||
//
|
||||
// public static String getGbPc(int pcLen) {
|
||||
// int iPc = pcLen << 8;
|
||||
// BitBuffer buffer = BitBuffer.allocateDynamic();
|
||||
// buffer.put(iPc);
|
||||
// buffer.position(16);
|
||||
// byte[] bTmp = new byte[2];
|
||||
// buffer.get(bTmp);
|
||||
// return HexUtils.bytes2HexString(bTmp);
|
||||
// }
|
||||
//
|
||||
// //写入数据不足4位后面补'0' AA00
|
||||
// public static String padLeft(String src, int len, char ch) {
|
||||
// int diff = len - src.length();
|
||||
// if (diff <= 0) {
|
||||
// return src;
|
||||
// }
|
||||
//
|
||||
// char[] chars = new char[len];
|
||||
// System.arraycopy(src.toCharArray(), 0, chars, 0, src.length());
|
||||
// for (int i = src.length(); i < len; i++) {
|
||||
// chars[i] = ch;
|
||||
// }
|
||||
// return new String(chars);
|
||||
// }
|
||||
//
|
||||
// public static int getValueLen(String data) {
|
||||
// data = data.trim();
|
||||
// return data.length() % 4 == 0 ? data.length() / 4
|
||||
// : (data.length() / 4) + 1;
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -57,18 +57,11 @@ public class AutoCreateInst {
|
||||
List<TaskDto> list = taskserver.queryAllByStatus("0");
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
TaskDto acsTask = list.get(i);
|
||||
if (StrUtil.equals(acsTask.getTask_type(), TaskTypeEnum.AGV_Task.getIndex()) && !StrUtil.startWith(acsTask.getTask_code(), "-")) {
|
||||
continue;
|
||||
}
|
||||
if (StrUtil.equals(acsTask.getTask_type(), TaskTypeEnum.Truss_Task.getIndex()) && !StrUtil.startWith(acsTask.getTask_code(), "-")) {
|
||||
continue;
|
||||
}
|
||||
String taskid = acsTask.getTask_id();
|
||||
String taskcode = acsTask.getTask_code();
|
||||
String task_type = acsTask.getTask_type();
|
||||
String vehiclecode = acsTask.getVehicle_code();
|
||||
String vehiclecode2 = acsTask.getVehicle_code2();
|
||||
String storage_task_type = acsTask.getStorage_task_type();
|
||||
String priority = acsTask.getPriority();
|
||||
String is_send = acsTask.getIs_send();
|
||||
|
||||
@@ -101,16 +94,16 @@ public class AutoCreateInst {
|
||||
}
|
||||
|
||||
//校验路由关系
|
||||
// List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
|
||||
// if (ObjectUtils.isEmpty(shortPathsList)) {
|
||||
// acsTask.setRemark("路由不通无法生成指令");
|
||||
// taskserver.updateByCodeFromCache(acsTask);
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// if (!StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) {
|
||||
// continue;
|
||||
// }
|
||||
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
|
||||
if (ObjectUtils.isEmpty(shortPathsList)) {
|
||||
acsTask.setRemark("路由不通无法生成指令");
|
||||
taskserver.updateByCodeFromCache(acsTask);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// RouteLineDto routeLineDto = shortPathsList.get(0);
|
||||
// String path = routeLineDto.getPath();
|
||||
@@ -147,9 +140,6 @@ public class AutoCreateInst {
|
||||
Instruction instdto = new Instruction();
|
||||
instdto.setInstruction_type(task_type);
|
||||
instdto.setInstruction_id(IdUtil.simpleUUID());
|
||||
if (acsTask.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())){
|
||||
instdto.setInstruction_code(CodeUtil.getNewCode("INSTRUCT_NO"));
|
||||
}
|
||||
instdto.setRoute_plan_code(route_plan_code);
|
||||
instdto.setRemark(acsTask.getRemark());
|
||||
instdto.setMaterial(acsTask.getMaterial());
|
||||
@@ -182,34 +172,6 @@ public class AutoCreateInst {
|
||||
instdto.setStart_height(start_height);
|
||||
instdto.setNext_height(next_height);
|
||||
instdto.setAgv_action_type(agvActionType);
|
||||
//判断agv系统
|
||||
//1、1楼叉车系统
|
||||
//2、2楼1区域AGV系统
|
||||
//3、2楼2区域AGV系统 -已废弃
|
||||
if (StrUtil.equals(agv_system_type, CommonFinalParam.TWO)) {
|
||||
// task_type
|
||||
//1、生箔; Itype=1:取空,取满,放空,放满;
|
||||
//2、分切 Itype=3取满、取空、放满、放空;
|
||||
//3、普通任务 Itype=2:取货、放货;
|
||||
//4、叉车任务
|
||||
//5、输送任务
|
||||
//6、行架
|
||||
//7、立库
|
||||
if (StrUtil.equals(task_type, CommonFinalParam.ONE)) {
|
||||
instdto.setAgv_inst_type(CommonFinalParam.ONE);
|
||||
} 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 if (StrUtil.equals(task_type, "8")) {
|
||||
instdto.setAgv_inst_type("2");
|
||||
} else {
|
||||
log.info("未找到对应的AGV指令类型,任务号:" + acsTask.getTask_code() + ",task_type:" + acsTask.getTask_type());
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
instdto.setAgv_inst_type("4");
|
||||
}
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
} catch (Exception e) {
|
||||
@@ -225,8 +187,6 @@ public class AutoCreateInst {
|
||||
}
|
||||
//创建指令后修改任务状态
|
||||
acsTask.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||
acsTask.setUpdate_time(DateUtil.now());
|
||||
acsTask.setRemark(" ");
|
||||
taskserver.update(acsTask);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<included>
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<property name="LOG_HOME" value="${logPath}"/>
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="XianGongAgvServiceImpl" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/科聪agv请求/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>15</maxHistory>
|
||||
<!--单个日志最大容量 至少10MB才能看得出来-->
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<!--所有日志最多占多大容量-->
|
||||
<totalSizeCap>2GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>${log.charset}</charset>
|
||||
</encoder>
|
||||
|
||||
</appender>
|
||||
|
||||
<!-- 打印sql -->
|
||||
<logger name="org.nl.acs.agv.server.impl.KeCongAgvServiceImpl" level="info" additivity="true">
|
||||
<appender-ref ref="KeCongAgvServiceImpl"/>
|
||||
</logger>
|
||||
</included>
|
||||
@@ -68,11 +68,11 @@ https://juejin.cn/post/6844903775631572999
|
||||
<!--开发环境:打印控制台-->
|
||||
<springProfile name="dev">
|
||||
<root level="info">
|
||||
<!-- <appender-ref ref="asyncLuceneAppender"/>-->
|
||||
<!-- <appender-ref ref="asyncFileAppender"/>-->
|
||||
<appender-ref ref="asyncLuceneAppender"/>
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</root>
|
||||
<!-- <logger name="jdbc" level="ERROR" additivity="true">
|
||||
<logger name="jdbc" level="ERROR" additivity="true">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
</logger>
|
||||
<logger name="org.springframework" level="ERROR" additivity="true">
|
||||
@@ -95,7 +95,7 @@ https://juejin.cn/post/6844903775631572999
|
||||
</logger>
|
||||
<logger name="org.jinterop" level="ERROR" additivity="true">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
</logger>-->
|
||||
</logger>
|
||||
</springProfile>
|
||||
|
||||
<!--测试环境:打印控制台-->
|
||||
|
||||
BIN
acs2/nladmin-ui/src/assets/images/ftdl.png
Normal file
BIN
acs2/nladmin-ui/src/assets/images/ftdl.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 39 KiB |
BIN
acs2/nladmin-ui/src/assets/images/miri.png
Normal file
BIN
acs2/nladmin-ui/src/assets/images/miri.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 975 KiB |
@@ -14,7 +14,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Logo from '@/assets/images/newloge.png'
|
||||
import Logo from '@/assets/images/miri.png'
|
||||
import variables from '@/assets/styles/variables.scss'
|
||||
export default {
|
||||
name: 'SidebarLogo',
|
||||
@@ -70,8 +70,8 @@ export default {
|
||||
width: 100%;
|
||||
|
||||
& .sidebar-logo {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
width: 55px;
|
||||
height: 15px;
|
||||
vertical-align: middle;
|
||||
margin-right: 6px;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
<template>
|
||||
<!--agv单工位-->
|
||||
<div>
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">指令相关:</span>
|
||||
</div>
|
||||
<el-form ref="form" :inline="true" :model="form" size="small" label-width="95px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="ip地址" prop="ip_address">
|
||||
<el-input
|
||||
v-model="form.ip_address"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span" />
|
||||
<el-button
|
||||
:loading="false"
|
||||
icon="el-icon-check"
|
||||
size="mini"
|
||||
style="float: right; padding: 6px 9px"
|
||||
type="primary"
|
||||
@click="doSubmit"
|
||||
>保存
|
||||
</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
queryDriverConfig,
|
||||
updateConfig
|
||||
} from '@/api/acs/device/driverConfig'
|
||||
import crud from '@/mixins/crud'
|
||||
|
||||
export default {
|
||||
name: 'StandardConveyorControl',
|
||||
mixins: [crud],
|
||||
props: {
|
||||
parentForm: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
ip_address: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$nextTick(() => {
|
||||
// 从父表单获取设备编码
|
||||
this.device_id = this.$props.parentForm.device_id
|
||||
this.device_code = this.$props.parentForm.device_code
|
||||
queryDriverConfig(this.device_id, this.$props.parentForm.driver_code).then(data => {
|
||||
// 给表单赋值,并且属性不能为空
|
||||
if (data.form) {
|
||||
const arr = Object.keys(data.form)
|
||||
// 不为空
|
||||
if (arr.length > 0) {
|
||||
this.form = data.form
|
||||
}
|
||||
}
|
||||
this.sliceItem()
|
||||
})
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
doSubmit() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.configLoading = true
|
||||
// 根据驱动类型判断是否为路由设备
|
||||
const parentForm = this.parentForm
|
||||
parentForm.is_route = true
|
||||
updateConfig(parentForm, this.form, this.data1, this.data2).then(res => {
|
||||
this.notify('保存成功', 'success')
|
||||
this.configLoading = false
|
||||
}).catch(err => {
|
||||
this.configLoading = false
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
<template>
|
||||
<!--agv双工位-->
|
||||
<div>
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">设备协议:</span>
|
||||
</div>
|
||||
|
||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="扫码器ip:" label-width="150px" prop="x">
|
||||
<el-input v-model.trim="form.ip_address" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span" />
|
||||
<el-button
|
||||
:loading="false"
|
||||
icon="el-icon-check"
|
||||
size="mini"
|
||||
style="float: right; padding: 6px 9px"
|
||||
type="primary"
|
||||
@click="doSubmit"
|
||||
>保存
|
||||
</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import {
|
||||
queryDriverConfig,
|
||||
updateConfig
|
||||
} from '@/api/acs/device/driverConfig'
|
||||
|
||||
import crud from '@/mixins/crud'
|
||||
import deviceCrud from '@/api/acs/device/device'
|
||||
export default {
|
||||
name: 'StandardScanner',
|
||||
mixins: [crud],
|
||||
props: {
|
||||
parentForm: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
scannerIP: ''
|
||||
},
|
||||
rules: {
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$nextTick(() => {
|
||||
// 从父表单获取设备编码
|
||||
this.device_id = this.$props.parentForm.device_id
|
||||
this.device_code = this.$props.parentForm.device_code
|
||||
queryDriverConfig(this.device_id, this.$props.parentForm.driver_code).then(data => {
|
||||
// 给表单赋值,并且属性不能为空
|
||||
if (data.form) {
|
||||
const arr = Object.keys(data.form)
|
||||
// 不为空
|
||||
if (arr.length > 0) {
|
||||
this.form = data.form
|
||||
}
|
||||
}
|
||||
|
||||
// 给表单赋值,并且属性不能为空
|
||||
if (data.parentForm) {
|
||||
const arr = Object.keys(data.parentForm)
|
||||
// 不为空
|
||||
if (arr.length > 0) {
|
||||
this.opc_code = data.parentForm.opc_code
|
||||
this.plc_code = data.parentForm.plc_code
|
||||
}
|
||||
}
|
||||
})
|
||||
deviceCrud.selectDeviceList().then(data => {
|
||||
this.deviceList = data
|
||||
})
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
doSubmit() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.configLoading = true
|
||||
// 根据驱动类型判断是否为路由设备
|
||||
const parentForm = this.parentForm
|
||||
updateConfig(parentForm, this.form, this.data1, this.data2).then(res => {
|
||||
this.notify('保存成功', 'success')
|
||||
this.configLoading = false
|
||||
}).catch(err => {
|
||||
this.configLoading = false
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user