1.ACS与LMS公共交互接口调整

2.满架下料实现及自测
3.固化室放满通知自动门
4.自动门反馈更改点位状态
This commit is contained in:
psh
2023-10-12 11:20:05 +08:00
parent bdd15165d9
commit 4feb72cbb6
25 changed files with 579 additions and 164 deletions

View File

@@ -10,7 +10,7 @@ import com.alibaba.fastjson.JSONObject;
* https://blog.csdn.net/moneyshi/article/details/82978073
*/
public enum RequestMethodEnum {
apply_mjxl(1, "apply_mjxl", "涂板线满架下料","1"),
apply_mjxl(1, "MJXLTask", "涂板线满架下料","1"),
feedback_task_status(2, "feedback_task_status", "反馈任务状态","1");

View File

@@ -5,6 +5,8 @@ import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device_driver.RequestMethodEnum;
import org.nl.acs.ext.wms.data.feedBackTaskStatus.FeedBackTaskStatusRequest;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.utils.ReadUtil;
import org.nl.acs.device.service.DeviceService;
@@ -113,7 +115,11 @@ public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implem
}
if (state != last_state) {
//固化室状态变更后通知lms更新固化室状态
acsToWmsService.feedbackDeviceStatus(this.devicecode,String.valueOf(state));
FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
request.setState(String.valueOf(state));
request.setDevice_code(this.devicecode);
request.setType("1");
acsToWmsService.notify(request);
}
last_action = action;
last_mode = mode;

View File

@@ -443,9 +443,10 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
request.setDevice_code(devicecode);
request.setVehicle_code(String.valueOf(barcode));
request.setTask_type(String.valueOf(type));
request.setRequest_medthod_code(RequestMethodEnum.feedback_task_status.getCode());
request.setRequest_medthod_name(RequestMethodEnum.feedback_task_status.getName());
if (devicecode.startsWith("TBX")) {
request.setRequest_medthod_code(RequestMethodEnum.apply_mjxl.getCode());
request.setRequest_medthod_name(RequestMethodEnum.apply_mjxl.getName());
}
String resp = acsToWmsService.applyTask(request);
JSONObject res_jo = JSONObject.parseObject(resp);
if (StrUtil.equals(res_jo.getString("status"), "200")) {

View File

@@ -53,5 +53,16 @@ public class BaseRequest {
private Map<String, String> parameters = new HashMap();
/**
* 任务类型
*/
private String type;
/**
* 设备状态
*/
private String state;
}

View File

@@ -3,6 +3,7 @@ package org.nl.acs.ext.wms.rest;
import cn.dev33.satoken.annotation.SaIgnore;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -97,4 +98,12 @@ public class WmsToAcsController {
return new ResponseEntity<>(wmstoacsService.putPlusPullAction(whereJson), HttpStatus.OK);
}
@PostMapping("/notify")
@Log("wms下发任务动作")
@ApiOperation("wms下发任务动作")
@SaIgnore
public ResponseEntity<Object> notify(@RequestBody JSONObject param) {
return new ResponseEntity<>(wmstoacsService.notifyAcs(param), HttpStatus.OK);
}
}

View File

@@ -114,7 +114,17 @@ public interface AcsToWmsService {
HttpResponse feedAgvTaskStatus(JSONArray from);
/**
* ACS向WMS申请晟华任务
* ACS向WMS申请任务
*/
public String applyTask(BaseRequest request);
String applyTask(BaseRequest request);
/**
* ACS向WMS反馈任务状态
*/
String feedTaskStatus(BaseRequest request);
/**
* ACS向WMS反馈任务状态
*/
String notify(BaseRequest request);
}

View File

@@ -2,6 +2,7 @@ package org.nl.acs.ext.wms.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.nl.acs.ext.wms.data.*;
@@ -83,4 +84,13 @@ public interface WmsToAcsService {
Map<String, Object> putPlusPullAction(String whereJson);
/**
* 下发wms任务动作
*
* @param param 条件
* @return Map<String, Object>
*/
JSONObject notifyAcs(JSONObject param);
}

View File

@@ -563,6 +563,33 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
} finally {
MDC.remove(log_file_type);
}
}
@Override
public String feedTaskStatus(BaseRequest requestParam) {
try {
MDC.put(log_file_type, log_type);
String api = addressService.findByCode("feedTaskStatus").getMethods_url();
log.info("feedTaskStatus-----输入参数{}", JSON.toJSONString(requestParam, SerializerFeature.DisableCircularReferenceDetect));
String result = LmsUtil.notifyAcs(api, requestParam);
log.info("feedTaskStatus-----输出参数{}", result);
return result;
} finally {
MDC.remove(log_file_type);
}
}
@Override
public String notify(BaseRequest requestParam) {
try {
MDC.put(log_file_type, log_type);
String api = addressService.findByCode("notify").getMethods_url();
log.info("notify-----输入参数{}", JSON.toJSONString(requestParam, SerializerFeature.DisableCircularReferenceDetect));
String result = LmsUtil.notifyAcs(api, requestParam);
log.info("notify-----输出参数{}", result);
return result;
} finally {
MDC.remove(log_file_type);
}
}
}

View File

@@ -16,6 +16,7 @@ import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.basedriver.hongxiang_conveyor.HongXiangStationDeviceDriver;
import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver;
import org.nl.acs.device_driver.basedriver.plug_pull_device_site.PlugPullDeviceSiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_autodoor.StandardAutodoorDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
import org.nl.acs.ext.wms.data.*;
import org.nl.acs.ext.wms.service.AcsToLiKuService;
@@ -624,5 +625,38 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
}
@Override
public JSONObject notifyAcs(JSONObject param) {
log.info("notifyAcs - 请求参数 {}", param);
JSONObject result = new JSONObject();
Integer type=param.getInteger("type");
String device_code=param.getString("device_code");
Device device;
switch(type){
case 1:
//wms通知固化室满料开始固化
device = deviceAppService.findDeviceByCode(device_code);
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
StandardAutodoorDeviceDriver standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
standardAutodoorDeviceDriver.writing("to_state",1);
}
break;
case 2:
//wms通知固化室取料完毕重新开放可使用
device = deviceAppService.findDeviceByCode(device_code);
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
StandardAutodoorDeviceDriver standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
standardAutodoorDeviceDriver.writing("to_state",2);
}
break;
default:
break;
}
result.put("status", HttpStatus.OK.value());
result.put("message", "通知成功!");
log.info("notifyAcs - 返回参数 {}", result);
return result;
}
}

View File

@@ -875,7 +875,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
boolean flag = false;
String resp = null;
try {
resp = acstowmsService.applyTask(request);
resp = acstowmsService.feedTaskStatus(request);
log.info("任务号:{},反馈wms任务状态完成成功,响应信息:{}!", entity.getTask_code(), resp);
} catch (Exception e) {
log.error("任务号:{},反馈wms任务状态失败,原因:{}!", entity.getTask_code(), e.getMessage());
@@ -924,7 +924,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
boolean flag = false;
String resp = null;
try {
resp = acstowmsService.applyTask(request);
resp = acstowmsService.feedTaskStatus(request);
log.info("任务号:{},反馈wms任务状态完成成功,响应信息:{}!", entity.getTask_code(), resp);
} catch (Exception e) {
log.error("任务号:{},反馈wms任务状态失败,原因:{}!", entity.getTask_code(), e.getMessage());
@@ -991,7 +991,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
boolean flag = false;
String resp = null;
try {
resp = acstowmsService.applyTask(request);
resp = acstowmsService.feedTaskStatus(request);
log.info("任务号:{},反馈wms任务状态完成成功,响应信息:{}!", entity.getTask_code(), resp);
} catch (Exception e) {
log.error("任务号:{},反馈wms任务状态失败,原因:{}!", entity.getTask_code(), e.getMessage());

View File

@@ -71,22 +71,10 @@ spring:
baseline-on-migrate: true
redis:
#数据库索引
database: ${REDIS_DB:2}
host: ${REDIS_HOST:127.0.0.1}
port: ${REDIS_PORT:6379}
# password: ${REDIS_PWD:}
#连接超时时间
timeout: 5000
redisson:
config: |
threads: 4
nettyThreads: 4
singleServerConfig:
database: 3
connectionMinimumIdleSize: 8
connectionPoolSize: 8
address: redis://127.0.0.1:6379
idleConnectionTimeout: 10000
timeout: 3000
# 登录相关配置
login: