rev:更新

This commit is contained in:
2024-01-22 08:55:25 +08:00
parent 720699bdd5
commit ce5dcdf1f4
18 changed files with 243 additions and 134 deletions

View File

@@ -3,6 +3,7 @@ package org.nl.acs.device_driver.basedriver.hailiang_old.hailiang_hr_ssx;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
@@ -80,6 +81,8 @@ public class HailiangHrSsxDeviceDriver extends AbstractOpcDeviceDriver implement
String message = null;
Boolean iserror = false;
private Date instruction_require_time = new Date();
private Date containerArrivedRequestTime = new Date();
private Date inTaskRequestTime = new Date();
private int instruction_require_time_out = 30000;
boolean requireSucess = false;
@@ -113,11 +116,8 @@ public class HailiangHrSsxDeviceDriver extends AbstractOpcDeviceDriver implement
if (last_move == 1 && move == 0) {
this.lastHasContainerTime = System.currentTimeMillis();
}
if (move == 1 && barcode.length() > 0 && !requireSucess) {
String containerArrived = ObjectUtil.isEmpty(this.getDevice().getExtraValue().get("containerArrived")) ? "false" : this.getDevice().getExtraValue().get("apply_task").toString();
if ("true".equals(containerArrived)) {
this.containerArrived();
}
if (move == 1) {
inTaskRequestTime = new Date();
}
}
if (error != last_error) {
@@ -140,10 +140,17 @@ public class HailiangHrSsxDeviceDriver extends AbstractOpcDeviceDriver implement
Instruction instruction = null;
List toInstructions;
if (mode == 3 && move == 1 && barcode.length() > 0 && !"000000000".equals(barcode) && !requireSucess) {
String containerArrived = ObjectUtil.isEmpty(this.getDevice().getExtraValue().get("containerArrived")) ? "false" : this.getDevice().getExtraValue().get("containerArrived").toString();
if ("true".equals(containerArrived)) {
this.containerArrived();
}
}
String applyEmpty = ObjectUtil.isEmpty(this.getDevice().getExtraValue().get("apply_task")) ? "false" : this.getDevice().getExtraValue().get("apply_task").toString();
if (StrUtil.equals("true", applyEmpty)) {
//申请空框任务
if (mode == 2 && move == 0 && !requireSucess) {
if (mode == 3 && move == 0 && !requireSucess) {
this.applyEmptyTask();
}
}
@@ -162,17 +169,29 @@ public class HailiangHrSsxDeviceDriver extends AbstractOpcDeviceDriver implement
* 申请出空框任务 acs->lms
*/
public void applyEmptyTask() {
if (System.currentTimeMillis() - instruction_require_time.getTime()
< this.instruction_require_time_out) {
return;
}
Object apply_empty = this.getDevice().getExtraValue().get("apply_empty");
if (apply_empty == null) {
return;
}
instruction_require_time = new Date();
JSONObject reqParam = new JSONObject();
reqParam.put("device_code", this.getDevice_code());
reqParam.put("device_code1", apply_empty.toString());
reqParam.put("type", StatusEnum.HAIROU_LIKU_REQ.getCode());
reqParam.put("item_type", StatusEnum.HAIROU_EMPTY_OUT_REQ.getCode());
reqParam.put("number", this.getDevice().getExtraValue().get("apply_num"));
HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
if (httpResponse != null && httpResponse.getStatus() == 200) {
JSONObject resp = JSONObject.parseObject(httpResponse.body());
if (resp.getInteger("status") == 200) {
requireSucess = true;
log.info("{}:申请空框任务成功!", this.getDevice_code());
}
}
}
/**
* 容器到达通知 acs->ess
@@ -180,26 +199,27 @@ public class HailiangHrSsxDeviceDriver extends AbstractOpcDeviceDriver implement
* @return
*/
public void containerArrived() throws Exception {
if (System.currentTimeMillis() - containerArrivedRequestTime.getTime()
< this.instruction_require_time_out) {
return;
}
TaskDto vehicle_dto = taskServer.findByContainer(barcode);
if (vehicle_dto == null) {
instruction_require_time = new Date();
if (vehicle_dto != null) {
containerArrivedRequestTime = new Date();
ContainerArrivedRequest containerArrivedRequest = new ContainerArrivedRequest();
NodeStates nodeStates = new NodeStates();
containerArrivedRequest.setSlotCode(device_code);
containerArrivedRequest.setContainerCode(barcode);
Date date = new Date();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd :hh:mm:ss");
nodeStates.setLastHasContainerTime(Long.parseLong(dateFormat.format(date)));
nodeStates.setLastReadTime(Long.parseLong(dateFormat.format(date)));
nodeStates.setLastReportTime(Long.parseLong(dateFormat.format(date)));
nodeStates.setLastHasContainerTime(lastHasContainerTime);
nodeStates.setLastReadTime(lastReadTime);
nodeStates.setLastReportTime(lastReportTime);
Resp<JSONObject> containerArrivedResp = acsToLiKuService.containerArrived(containerArrivedRequest);
JSONObject response = JSONObject.parseObject(String.valueOf(containerArrivedResp));
int code = response.getInteger("code");
String msg = response.getString("msg");
if (code == 0) {
String code = containerArrivedResp.getCode();
String msg = containerArrivedResp.getMsg();
if ("0".equals(code)) {
requireSucess = true;
this.setLastReportTime(System.currentTimeMillis());
log.info("请求成功 请求结果{}", code, msg);
log.info("请求成功,code:{},请求结果{}", code, msg);
}
}
}

View File

@@ -198,53 +198,55 @@ public class WithStationDeviceDriver extends AbstractOpcDeviceDriver implements
TaskDto vehicle_dto = taskServer.findByContainer(hailiangHrSsxDeviceDriver.getBarcode());
if (vehicle_dto == null) {
//如果设备满足请求条件、并且超过等待时间 则就直接请求
if(hailiangHrSsxDeviceDriver.getMove() == 0){
requireSucess =false;
if (hailiangHrSsxDeviceDriver.getMove() == 0) {
requireSucess = false;
}
if (hailiangHrSsxDeviceDriver.getMode() == 2 &&
if (hailiangHrSsxDeviceDriver.getMode() == 3 &&
hailiangHrSsxDeviceDriver.getMove() == 1 &&
ObjectUtil.isNotEmpty(hailiangHrSsxDeviceDriver.getBarcode()) &&
!requireSucess
ObjectUtil.isNotEmpty(hailiangHrSsxDeviceDriver.getBarcode())
&& !"0000000000".equals(hailiangHrSsxDeviceDriver.getBarcode())
&& !requireSucess
) {
//判断是否超过等待时间
if (System.currentTimeMillis() - hailiangHrSsxDeviceDriver.getInstruction_require_time().getTime()
if (System.currentTimeMillis() - hailiangHrSsxDeviceDriver.getInTaskRequestTime().getTime()
> Integer.parseInt(this.getExtraValue().get("apply_time").toString()) * 1000) {
//否则对接位单独申请任务
JSONObject reqParam = new JSONObject();
//半成品入库
if(StrUtil.equals(hailiangHrSsxDeviceDriver.getDevice_code(),"A3_BCP_RM_01")||StrUtil.equals(hailiangHrSsxDeviceDriver.getDevice_code(),"A3_BCP_RM_02")) {
if (StrUtil.equals(hailiangHrSsxDeviceDriver.getDevice_code(), "A3_BCP_RM_01") || StrUtil.equals(hailiangHrSsxDeviceDriver.getDevice_code(), "A3_BCP_RM_02")) {
reqParam.put("type", StatusEnum.HAIROU_LIKU_REQ.getCode());
reqParam.put("item_type", StatusEnum.HAIROU_IN_REQ.getCode());
reqParam.put("device_code1", hailiangHrSsxDeviceDriver.getDevice_code());
reqParam.put("barcode1", hailiangHrSsxDeviceDriver.getBarcode());
}
//空载具入库
if(StrUtil.equals(hailiangHrSsxDeviceDriver.getDevice_code(),"A3_BCP_RK_01")||StrUtil.equals(hailiangHrSsxDeviceDriver.getDevice_code(),"A3_BCP_RK_02")) {
if (StrUtil.equals(hailiangHrSsxDeviceDriver.getDevice_code(), "A3_BCP_RK_01") || StrUtil.equals(hailiangHrSsxDeviceDriver.getDevice_code(), "A3_BCP_RK_02")) {
reqParam.put("type", StatusEnum.HAIROU_LIKU_REQ.getCode());
reqParam.put("item_type", StatusEnum.HAIROU_EMPTY_IN_REQ.getCode());
reqParam.put("device_code1", hailiangHrSsxDeviceDriver.getDevice_code());
reqParam.put("barcode1", hailiangHrSsxDeviceDriver.getBarcode());
}
//联调时加上
// HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
// if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
// requireSucess = true;
// }
log.info("单工位请求成功");
HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
requireSucess = true;
}
log.info("单工位请求成功");
// requireSucess = true;
} else {
//否则判断另一个位置
Device neiRouDevice = deviceAppservice.findDeviceByCode(haiRouDeviceCodeList.get(i+1));
Device neiRouDevice = deviceAppservice.findDeviceByCode(haiRouDeviceCodeList.get(i + 1));
if (neiRouDevice.getDeviceDriver() instanceof HailiangHrSsxDeviceDriver) {
hailiangHrSsxDeviceDriver2 = (HailiangHrSsxDeviceDriver) neiRouDevice.getDeviceDriver();
if (hailiangHrSsxDeviceDriver2.getMode() == 2 &&
if (hailiangHrSsxDeviceDriver2.getMode() == 3 &&
hailiangHrSsxDeviceDriver2.getMove() == 1 &&
ObjectUtil.isNotEmpty(hailiangHrSsxDeviceDriver2.getBarcode())
ObjectUtil.isNotEmpty(hailiangHrSsxDeviceDriver2.getBarcode()) &&
!"0000000000".equals(hailiangHrSsxDeviceDriver.getBarcode())
) {
JSONObject reqParam = new JSONObject();
//半成品入库
if(StrUtil.equals(hailiangHrSsxDeviceDriver.getDevice_code(),"A3_BCP_RM_01")||StrUtil.equals(hailiangHrSsxDeviceDriver.getDevice_code(),"A3_BCP_RM_02")) {
if (StrUtil.equals(hailiangHrSsxDeviceDriver.getDevice_code(), "A3_BCP_RM_01") || StrUtil.equals(hailiangHrSsxDeviceDriver.getDevice_code(), "A3_BCP_RM_02")) {
reqParam.put("type", StatusEnum.HAIROU_LIKU_REQ.getCode());
reqParam.put("item_type", StatusEnum.HAIROU_IN_REQ.getCode());
reqParam.put("device_code1", hailiangHrSsxDeviceDriver.getDevice_code());
@@ -253,7 +255,7 @@ public class WithStationDeviceDriver extends AbstractOpcDeviceDriver implements
reqParam.put("barcode2", hailiangHrSsxDeviceDriver2.getBarcode());
}
//空载具入库
if(StrUtil.equals(hailiangHrSsxDeviceDriver.getDevice_code(),"A3_BCP_RK_01")||StrUtil.equals(hailiangHrSsxDeviceDriver.getDevice_code(),"A3_BCP_RK_02")) {
if (StrUtil.equals(hailiangHrSsxDeviceDriver.getDevice_code(), "A3_BCP_RK_01") || StrUtil.equals(hailiangHrSsxDeviceDriver.getDevice_code(), "A3_BCP_RK_02")) {
reqParam.put("type", StatusEnum.HAIROU_LIKU_REQ.getCode());
reqParam.put("item_type", StatusEnum.HAIROU_EMPTY_IN_REQ.getCode());
reqParam.put("device_code1", hailiangHrSsxDeviceDriver.getDevice_code());
@@ -262,14 +264,14 @@ public class WithStationDeviceDriver extends AbstractOpcDeviceDriver implements
reqParam.put("barcode2", hailiangHrSsxDeviceDriver2.getBarcode());
}
//向lms请求任务
// 联调时加上
// HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
// if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
// requireSucess = true;
// }
log.info("双工位请求成功");
//联调时加上
HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
requireSucess = true;
}
log.info("双工位请求成功");
//requireSucess = true;
}
}
}

View File

@@ -1,14 +1,11 @@
package org.nl.acs.ext.wms;
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.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.log.LokiLog;
import org.nl.acs.log.LokiLogType;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.system.service.impl.ParamServiceImpl;
@@ -20,31 +17,47 @@ import org.nl.modules.wql.util.SpringContextHolder;
@Slf4j
public class AcsUtil {
public static <W> String notifyAcs(String api, W requestParam) {
private static final String IS_CONNECT_LIKU_WCS = "is_connect_liKu_Wcs";
private static final String LIKU_WCS_URL = "liKu_wcs_url";
private static String liKuWcsUrl;
private static boolean isConnect;
static {
ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class);
//判断是否连接立库WCS系统
String isConnect = paramService.findByCode("is_connect_liKu_Wcs").getValue();
if (StrUtil.equals("0", isConnect)) {
log.info("ACS请求ESS,请求路径:{},参数配置表中-is_connect_liKu_Wcs为:0", api);
throw new BadRequestException("参数配置表中-is_connect_liKu_Wcs为:0");
isConnect = "1".equals(paramService.findByCode(IS_CONNECT_LIKU_WCS).getValue());
liKuWcsUrl = paramService.findByCode(LIKU_WCS_URL).getValue();
}
log.info("ACS请求ESS,请求路径:{},请求参数:{}", api, JSON.toJSONString(requestParam));
String liKu_wcs_url = paramService.findByCode("liKu_wcs_url").getValue();
public static <W> String notifyAcs(String api, W requestParam) {
if (isConnect) {
log.info("ACS开始请求ESS, 请求路径: {}, 请求参数: {}", api, JSON.toJSONString(requestParam));
try {
String body = HttpRequest
.post(liKu_wcs_url + api)
HttpResponse response = HttpRequest
.post(liKuWcsUrl + api)
.setConnectionTimeout(5000)
.body(JSON.toJSONString(requestParam))
.execute()
.body();
log.info("ACS请求ESS,请求路径:{},响应参数:{}", api, body);
.execute();
if (response.getStatus() != 200) {
throw new BadRequestException("ACS请求ESS失败, 状态码: " + response.getStatus() + ",原因:" + response.body());
}
String body = response.body();
log.info("ACS请求ESS成功, 请求路径: {}, 响应参数: {}", api, body);
return body;
} catch (Exception e) {
JSONObject result = new JSONObject();
result.put("code", "1");
result.put("msg", e.getMessage());
result.put("data", new JSONObject());
log.error("ACS请求ESS,请求路径:{},响应参数:{}", api, result.toString());
log.error("ACS请求ESS,请求路径:{},响应参数:{}", api, result);
return String.valueOf(result);
}
} else {
JSONObject result = new JSONObject();
result.put("code", "1");
result.put("msg", "ACS未开启连接立库WCS配置项!");
result.put("data", new JSONObject());
log.error("ACS请求ESS,请求路径:{},响应参数:{}", api, result);
return String.valueOf(result);
}
}

View File

@@ -0,0 +1,24 @@
package org.nl.acs.ext.wms;
import io.jsonwebtoken.lang.Maps;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @Description TODO
* @Author Gengby
* @Date 2024/1/19
*/
public class StationPointMapping {
public static Map<String, List<String>> mappings =
Maps.of("STATION-1", Arrays.asList("A3_BCP_RM_01", "A3_BCP_CK_03"))
.and("STATION-2", Arrays.asList("A3_BCP_CM_03", "A3_BCP_RK_01")).build();
public static List<String> getPointMapping(String station) {
return mappings.get(station) == null ? new ArrayList<>() : mappings.get(station);
}
}

View File

@@ -12,7 +12,7 @@ public class LocationQueryRequest {
* 可传多个⼯作位,若不传则查全部
* 若多个字段均填写,则互为且关系
*/
public Map<String,List<String>> locationCodes ;
public List<String> locationCodes ;
/**
* 容器编码
* 查看容器下的所有⼯作位
@@ -23,5 +23,5 @@ public class LocationQueryRequest {
* 可传多个⼯作位,若不传则查全部
* 若多个字段均填写,则互为且关系
*/
public Map<String,List<String>> locationTypeCodes ;
public List<String> locationTypeCodes ;
}

View File

@@ -11,7 +11,7 @@ public class RobotQueryRequest {
* 机器⼈编码
* 可传多个,若不传则查全部
*/
public Map<String,List<String>> robotCodes ;
public List<String> robotCodes ;
//public List<String> robotCodes;
}

View File

@@ -27,5 +27,7 @@ public class OutTaskDescribe extends TaskDescribe {
List<String> toStationCode ;
String toLocationCode;
}

View File

@@ -1,5 +1,6 @@
package org.nl.acs.ext.wms.rest;
import cn.dev33.satoken.annotation.SaIgnore;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
@@ -52,12 +53,14 @@ public class AcsToLiKuController {
@PostMapping("/robot/query")
@Log(value = "机器⼈查询接⼝",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LK)
@ApiOperation("机器⼈查询接⼝")
@SaIgnore
public ResponseEntity<Object> robotQuery(@RequestBody RobotQueryRequest requestParam) throws Exception {
return new ResponseEntity<>(acsToLiKuService.robotQuery(requestParam), HttpStatus.OK);
}
@PostMapping("/location/query")
@Log(value = "⼯作位查询接⼝",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LK)
@ApiOperation("⼯作位查询接⼝")
@SaIgnore
public ResponseEntity<Object> locationQuery(@RequestBody LocationQueryRequest requestParam) throws Exception {
return new ResponseEntity<>(acsToLiKuService.locationQuery(requestParam), HttpStatus.OK);
}

View File

@@ -5,11 +5,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.ext.wms.liKuData.InStoreReportRequest;
import org.nl.acs.ext.wms.liKuData.MoveStoreReportRequest;
import org.nl.acs.ext.wms.liKuData.OutStoreReportRequest;
import org.nl.acs.ext.wms.liKuData.a.*;
import org.nl.acs.ext.wms.liKuData.putEmptyPalletRequest;
import org.nl.acs.ext.wms.service.LiKuToAcsService;
import org.nl.modules.logging.InterfaceLogType;
import org.nl.modules.logging.annotation.Log;
@@ -46,6 +42,15 @@ public class LiKuToACSController {
public ResponseEntity<Object> queryNodeReader(@RequestBody QueryNodeReaderRequest requestParam) throws Exception {
return new ResponseEntity<>(liKuToAcsService.queryNodeReader(requestParam), HttpStatus.OK);
}
@SaIgnore
@PostMapping("/loadContainerRequest")
@Log(value = "取容器请求",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LK_TO_ACS)
@ApiOperation("取容器请求")
public ResponseEntity<Object> loadContainerRequest(@RequestBody LoadContainerFinishRequest requestParam) throws Exception {
return new ResponseEntity<>(liKuToAcsService.loadContainerRequest(requestParam), HttpStatus.OK);
}
@SaIgnore
@PostMapping("/loadContainerFinish")
@Log(value = "取容器完成通知",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LK_TO_ACS)
@@ -75,14 +80,14 @@ public class LiKuToACSController {
return new ResponseEntity<>(liKuToAcsService.moveContainer(requestParam), HttpStatus.OK);
}
@SaIgnore
@PostMapping("/taskstatusreporting")
@PostMapping("/taskStatusReport")
@Log(value = "任务状态上报",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LK_TO_ACS)
@ApiOperation("任务状态上报")
public ResponseEntity<Object> taskstatusreporting(@RequestBody TaskstatusReportingRequest requestParam) throws Exception {
return new ResponseEntity<>(liKuToAcsService.taskstatusreporting(requestParam), HttpStatus.OK);
}
@SaIgnore
@PostMapping("/abnormalreporting")
@PostMapping("/abnormalReport")
@Log(value = "异常上报",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LK_TO_ACS)
@ApiOperation("异常上报")
public ResponseEntity<Object> abnormalreporting(@RequestBody AbnormarReportingRequest requestParam) throws Exception {

View File

@@ -23,6 +23,14 @@ public interface LiKuToAcsService {
*/
public JSONObject queryNodeReader(QueryNodeReaderRequest requestParam) throws Exception;
/**
* 取容器请求
* @param requestParam
* @return
*/
public JSONObject loadContainerRequest(LoadContainerFinishRequest requestParam) throws Exception;
/**
* 取容器完成通知
* @param requestParam

View File

@@ -6,6 +6,7 @@ import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import io.jsonwebtoken.lang.Maps;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.AcsConfig;
@@ -13,6 +14,7 @@ import org.nl.acs.acsEnum.StatusEnum;
import org.nl.acs.device.address.service.AddressService;
import org.nl.acs.device_driver.basedriver.hailiang_old.hailiang_hr_ssx.HailiangHrSsxDeviceDriver;
import org.nl.acs.ext.wms.RespUtil;
import org.nl.acs.ext.wms.StationPointMapping;
import org.nl.acs.ext.wms.liKuData.Resp;
import org.nl.acs.ext.wms.liKuData.a.*;
import org.nl.acs.ext.wms.liKuData.b.AGVTask;
@@ -66,20 +68,23 @@ public class LiKuToAcsServiceImpl implements LiKuToAcsService {
log.info("查询输送线料箱状态-----输入参数{}", JSON.toJSONString(requestParam));
JSONObject result = new JSONObject();
try {
String conveyorCodes = requestParam.getConveyorCodes();
NodeStates nodeStates = new NodeStates();
List<NodeStates> list2 = new ArrayList<>();
Conveyors conveyors = new Conveyors();
Device device = deviceAppService.findDeviceByCode(conveyorCodes);
JSONArray conveyorCodes = JSONArray.parseArray(requestParam.getConveyorCodes());
QueryConveyorResponse queryConveyorResponse = new QueryConveyorResponse();
List<Conveyors> list = new ArrayList<>();
Conveyors conveyors = new Conveyors();
for (int i = 0; i < conveyorCodes.size(); i++) {
conveyors = new Conveyors();
String station = conveyorCodes.getString(i);
List<String> points = StationPointMapping.getPointMapping(station);
conveyors.setCode(station);
List<NodeStates> list2 = new ArrayList<>();
for (int j = 0; j < points.size(); j++) {
NodeStates nodeStates = new NodeStates();
String conveyorCode = points.get(j);
Device device = deviceAppService.findDeviceByCode(conveyorCode);
if (device != null && device.getDeviceDriver() instanceof HailiangHrSsxDeviceDriver) {
HailiangHrSsxDeviceDriver hailiangHrSsxDeviceDriver = (HailiangHrSsxDeviceDriver) device.getDeviceDriver();
if (!ObjectUtil.isEmpty(device.getDevice_code())) {
conveyors.setCode(device.getDevice_code());
}
if (!ObjectUtil.isEmpty(device.getLocation())) {
nodeStates.setSlotCode(device.getDevice_code());
}
nodeStates.setSlotCode(conveyorCode);
if (hailiangHrSsxDeviceDriver.getMove() == 1) {
nodeStates.setHasContainer(true);
} else {
@@ -88,11 +93,13 @@ public class LiKuToAcsServiceImpl implements LiKuToAcsService {
nodeStates.setLastReadTime(hailiangHrSsxDeviceDriver.getLastReadTime());
hailiangHrSsxDeviceDriver.setLastReadTime(System.currentTimeMillis());
nodeStates.setLastReportTime(hailiangHrSsxDeviceDriver.getLastReportTime());
nodeStates.setLastHasContainerTime(hailiangHrSsxDeviceDriver.getLastHasContainerTime());
}
list2.add(nodeStates);
}
conveyors.setNodeStates(list2);
List<Conveyors> list = new ArrayList<>();
list.add(conveyors);
}
queryConveyorResponse.setConveyors(list);
result.put("code", "0");
result.put("msg", "success");
@@ -127,6 +134,39 @@ public class LiKuToAcsServiceImpl implements LiKuToAcsService {
return result;
}
@Override
public JSONObject loadContainerRequest(LoadContainerFinishRequest requestParam) throws Exception {
log.info("取容器请求-----输入参数{}", JSON.toJSONString(requestParam));
JSONObject result = new JSONObject();
UnloadContainerReqResponse unloadContainerReqResponse = new UnloadContainerReqResponse();
try {
String slotCode = requestParam.getSlotCode();
String containerCode = requestParam.getContainerCode();
Device device = deviceAppService.findDeviceByCode(slotCode);
if (device != null && device.getDeviceDriver() instanceof HailiangHrSsxDeviceDriver) {
HailiangHrSsxDeviceDriver hailiangHrSsxDeviceDriver = (HailiangHrSsxDeviceDriver) device.getDeviceDriver();
hailiangHrSsxDeviceDriver.writing("to_command", "2");
//TODO plc没给action信号1 暂时判断光电和条码
if (hailiangHrSsxDeviceDriver.getMove() == 1 && hailiangHrSsxDeviceDriver.getBarcode().equals(containerCode)) {
unloadContainerReqResponse.setAllow(true);
} else {
unloadContainerReqResponse.setAllow(false);
}
}
result.put("code", "0");
result.put("msg", "success");
result.put("data", unloadContainerReqResponse);
} catch (Exception e) {
result = new JSONObject();
result.put("code", "1");
result.put("msg", e.getMessage());
result.put("data", unloadContainerReqResponse);
}
log.info("取容器请求-----输出参数{}", JSON.toJSONString(result));
return result;
}
@Override
public JSONObject loadContainerFinish(LoadContainerFinishRequest requestParam) throws Exception {
log.info("取容器完成通知-----输入参数{}", JSON.toJSONString(requestParam));
@@ -134,13 +174,11 @@ public class LiKuToAcsServiceImpl implements LiKuToAcsService {
try {
String slotCode = requestParam.getSlotCode();
String containerCode = requestParam.getContainerCode();
// LoadContainerFinishResponse loadContainerFinishResponse = new LoadContainerFinishResponse();
Device device = deviceAppService.findDeviceByCode(slotCode);
if (device != null && device.getDeviceDriver() instanceof HailiangHrSsxDeviceDriver) {
HailiangHrSsxDeviceDriver hailiangHrSsxDeviceDriver = (HailiangHrSsxDeviceDriver) device.getDeviceDriver();
//下发输送线电气取货完成
hailiangHrSsxDeviceDriver.writing("to_command", "2");
// JSONObject json = (JSONObject) JSONObject.toJSON(loadContainerFinishResponse);
hailiangHrSsxDeviceDriver.writing("to_command", "3");
result.put("code", "0");
result.put("msg", "success");
result.put("data", new JSONObject());
@@ -170,7 +208,7 @@ public class LiKuToAcsServiceImpl implements LiKuToAcsService {
Device device = deviceAppService.findDeviceByCode(slotCode);
if (device != null && device.getDeviceDriver() instanceof HailiangHrSsxDeviceDriver) {
HailiangHrSsxDeviceDriver hailiangHrSsxDeviceDriver = (HailiangHrSsxDeviceDriver) device.getDeviceDriver();
hailiangHrSsxDeviceDriver.writing("to_command", "3");
hailiangHrSsxDeviceDriver.writing("to_command", "4");
if (hailiangHrSsxDeviceDriver.getAction() == 2) {
unloadContainerReqResponse.setAllow(true);
} else {
@@ -202,7 +240,7 @@ public class LiKuToAcsServiceImpl implements LiKuToAcsService {
Device device = deviceAppService.findDeviceByCode(slotCode);
if (device != null && device.getDeviceDriver() instanceof HailiangHrSsxDeviceDriver) {
HailiangHrSsxDeviceDriver hailiangHrSsxDeviceDriver = (HailiangHrSsxDeviceDriver) device.getDeviceDriver();
hailiangHrSsxDeviceDriver.writing("to_command", "4");
hailiangHrSsxDeviceDriver.writing("to_command", "5");
}
JSONObject json = (JSONObject) JSONObject.toJSON(unloadContainerFinishResponse);
result.put("code", "0");

View File

@@ -163,15 +163,15 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
continue;
}
}
TaskDto start_device_task = taskService.findByStartCode(start_point_code);
if (start_device_task != null) {
JSONObject json = new JSONObject();
json.put("task_id", task_id);
// json.put("message", "已存在该设备的任务,设备号:" + start_point_code + ",对应的任务号:" + task_code);
json.put("message", "已提交过任务!请勿重复点击!");
errArr.add(json);
continue;
}
// TaskDto start_device_task = taskService.findByStartCode(start_point_code);
// if (start_device_task != null) {
// JSONObject json = new JSONObject();
// json.put("task_id", task_id);
//// json.put("message", "已存在该设备的任务,设备号:" + start_point_code + ",对应的任务号:" + task_code);
// json.put("message", "已提交过任务!请勿重复点击!");
// errArr.add(json);
// continue;
// }
//刻字上料任务特殊处理
if (StrUtil.equals(start_point_code,"A1_KZ_SL")) {
Device device = deviceAppService.findDeviceByCode(start_point_code);

View File

@@ -384,7 +384,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
OutTaskDescribe outTaskDescribe = new OutTaskDescribe();
outTaskDescribe.setContainerCode(dto.getVehicle_code());
outTaskDescribe.setFromLocationCode(dto.getStart_point_code());
outTaskDescribe.setToStationCode(new ArrayList<String>(Collections.singleton(dto.getNext_device_code())));
outTaskDescribe.setToLocationCode(dto.getNext_point_code());
AGVTask agvTask = new AGVTask();
agvTask.setTaskDescribe(outTaskDescribe);
@@ -463,10 +463,11 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
Thread.sleep(5000L);
if (StrUtil.equals("1", dto.getAgv_system_type())) {
ndcAgvService.sendAgvTwoInstToNDC(dto, null);
dto.setSend_status("1");
} else if (StrUtil.equals("2", dto.getAgv_system_type())) {
ndcAgvService.sendAgvOneInstToNDC(dto);
}
dto.setSend_status("1");
}
} catch (InterruptedException ex) {
ex.printStackTrace();
} catch (Exception exception) {
@@ -1021,7 +1022,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
this.create(instdto);
} catch (Exception e) {
e.printStackTrace();
log.error("完成并创建下一条指令", e.getMessage());
log.error("完成并创建下一条指令失败:{}", e.getMessage());
}
}

View File

@@ -32,7 +32,7 @@ public class AutoCreateAgvOneInst {
* @throws Exception
*/
public void run() throws Exception {
List<TaskDto> list = taskService.queryAll("task_status = '0' and agv_system_type = '2' or agv_system_type = '3'");
List<TaskDto> list = taskService.queryAll("task_status = '0' and (agv_system_type = '2' or agv_system_type = '3')");
for (int i = 0; i < list.size(); i++) {
TaskDto taskDto = list.get(i);
String link_no = CodeUtil.getNewCode("LINK_NO");

View File

@@ -44,8 +44,7 @@ public class QueryRobot {
list.add(devices.get(i).getDevice_code());
}
}
map.put("robotCodes", list);
robotQueryRequest.setRobotCodes(map);
robotQueryRequest.setRobotCodes(list);
Resp<JSONObject> robotResp = acsToLiKuService.robotQuery(robotQueryRequest);
JSONArray jsonArray = robotResp.getData().getJSONArray("robots");
List<Robots> robotsList = jsonArray.toJavaList(Robots.class);

View File

@@ -136,13 +136,12 @@ file:
avatarMaxSize: 5
logging:
file:
path: /Users/onepiece/myFile/acs_logs
path: C:\acs_log
config: classpath:logback-spring.xml
lucene:
index:
path: /lucene
path: C:\acs\lucene\index
# /Users/onepiece/myFile/lucene/index
# Sa-Token配置
sa-token:

View File

@@ -31,6 +31,7 @@ https://juejin.cn/post/6844903775631572999
<include resource="log/NDCAgvServiceImpl.xml"/>
<include resource="log/AcsToLk.xml"/>
<include resource="log/LkToAcs.xml"/>
<include resource="log/AutoCreateOneInst.xml"/>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>

View File

@@ -106,7 +106,6 @@
<el-select
v-model="form.apply_empty"
filterable
multiple
placeholder="请选择"
>
<el-option
@@ -123,11 +122,6 @@
<el-input v-model="form.apply_num" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="输送线编码" label-width="150px">
<el-input v-model="form.aa" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
@@ -284,7 +278,7 @@ export default {
ignore_release_check: true,
apply_task: true,
apply_num: '',
apply_empty: [],
apply_empty: '',
manual_create_task: true,
is_pickup: true,
is_release: true,