OCP相关同步兰州
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
package org.nl.wms.ext.acs.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.wms.cockpit.service.dao.DasDeviceFault;
|
||||
import org.nl.wms.cockpit.service.mapper.CockpitMapper;
|
||||
import org.nl.wms.ext.acs.service.AcsToWmsService;
|
||||
import org.nl.wms.ext.acs.service.dto.to.BaseResponse;
|
||||
import org.nl.wms.ext.acs.service.dto.to.acs.AgainApplyResponse;
|
||||
@@ -63,6 +67,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
private PointMapper pointMapper;
|
||||
@Autowired
|
||||
private ISysInteractRecordService interactRecordService;
|
||||
@Autowired
|
||||
private CockpitMapper cockpitMapper;
|
||||
|
||||
/**
|
||||
* 初始化反射方法
|
||||
@@ -85,7 +91,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
BaseResponse result = BaseResponse.build(requestNo);
|
||||
String device_code = param.getString("device_code");
|
||||
SchBasePoint deviceObj = pointService.getById(device_code);
|
||||
param.put("config_code",requestMethodCode);
|
||||
param.put("config_code", requestMethodCode);
|
||||
// if ("6".equals(requestMethodCode)) {
|
||||
// // 送满料
|
||||
// param.put("config_code",deviceObj.getRegion_code() + "MLTask");
|
||||
@@ -97,8 +103,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
// param.put("config_code",deviceObj.getRegion_code() + "SKTask");
|
||||
// }
|
||||
try {
|
||||
if(ObjectUtil.isEmpty(requestMethodCode)){
|
||||
throw new BadRequestException("任务类型不正确!requestMethodCode:"+requestMethodCode+",device_code:"+device_code);
|
||||
if (ObjectUtil.isEmpty(requestMethodCode)) {
|
||||
throw new BadRequestException("任务类型不正确!requestMethodCode:" + requestMethodCode + ",device_code:" + device_code);
|
||||
}
|
||||
AbstractTask task = taskFactory.getTask(requestMethodCode);
|
||||
// 执行创建任务
|
||||
@@ -106,7 +112,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
// acs对接记录
|
||||
interactRecordService.saveRecord(requestMethodName, param, result, GeneralDefinition.ACS_LMS);
|
||||
} catch (Exception e) {
|
||||
String message =e.getMessage();
|
||||
String message = e.getMessage();
|
||||
log.error("ACS请求LMS出现错误: {}", message);
|
||||
result.setCode(HttpStatus.HTTP_BAD_REQUEST);
|
||||
result.setMessage(message);
|
||||
@@ -115,7 +121,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
noticeService.createNotice("异常信息:" + message, "acsApply: " + param.getString("request_medthod_code"),
|
||||
NoticeTypeEnum.EXCEPTION.getCode());
|
||||
}
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -178,18 +184,32 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
public BaseResponse notify(JSONObject param) {
|
||||
String requestNo = param.getString("requestNo");
|
||||
log.info("notifyAcs - 请求参数 {}", param);
|
||||
Integer type=param.getInteger("type");
|
||||
Integer type = param.getInteger("type");
|
||||
String device_code = param.getString("device_code");
|
||||
String state = param.getString("state");
|
||||
switch(type) {
|
||||
switch (type) {
|
||||
case 1:
|
||||
//自动门反馈设备状态,将对应十个固化室工位的状态修改为传入状态
|
||||
String ghs_device_code="GHS"+device_code.substring(device_code.length()-2);
|
||||
pointMapper.updatePointStatus(ghs_device_code,state);
|
||||
//反馈设备状态,将对应固化室修改为传入状态
|
||||
pointMapper.updatePointStatus(device_code, state);
|
||||
break;
|
||||
case 2:
|
||||
//实时反馈点位状态,空架输送线全部点位
|
||||
pointMapper.updatePointQty(device_code,state);
|
||||
pointMapper.updatePointQty(device_code, state);
|
||||
break;
|
||||
case 3:
|
||||
//设备反馈故障
|
||||
try {
|
||||
DasDeviceFault dasDeviceFault = new DasDeviceFault();
|
||||
String now = DateUtil.now();
|
||||
dasDeviceFault.setDevice_code(device_code);
|
||||
dasDeviceFault.setRegion_code(pointService.getById(device_code).getRegion_code());
|
||||
dasDeviceFault.setData_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
dasDeviceFault.setFailure_time(now);
|
||||
dasDeviceFault.setFailure_info(state);
|
||||
cockpitMapper.insertDeviceFault(dasDeviceFault);
|
||||
} catch (Exception exception) {
|
||||
throw new BadRequestException(exception.toString());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -223,26 +243,26 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
/**
|
||||
* 任务阶段反馈最新点位
|
||||
* todo
|
||||
* */
|
||||
*/
|
||||
@Override
|
||||
public BaseResponse feedbackState(JSONObject param) {
|
||||
String requestNo = param.getString("requestNo");
|
||||
String taskId = param.getString("taskId");
|
||||
BaseResponse result = BaseResponse.build(requestNo);
|
||||
try {
|
||||
SchBaseTask schBaseTask=taskService.getById(taskId);
|
||||
if(ObjectUtil.isEmpty(schBaseTask)){
|
||||
throw new BadRequestException("任务不存在!taskId:"+taskId);
|
||||
SchBaseTask schBaseTask = taskService.getById(taskId);
|
||||
if (ObjectUtil.isEmpty(schBaseTask)) {
|
||||
throw new BadRequestException("任务不存在!taskId:" + taskId);
|
||||
}
|
||||
AbstractTask task = taskFactory.getTask(schBaseTask.getConfig_code());
|
||||
// 执行创建任务
|
||||
task.feedbackState(param,schBaseTask,result);
|
||||
task.feedbackState(param, schBaseTask, result);
|
||||
taskService.update(schBaseTask);
|
||||
Map<String, String> map=new HashMap<>();
|
||||
map.put("start_point",schBaseTask.getPoint_code1());
|
||||
map.put("next_point",schBaseTask.getPoint_code2());
|
||||
map.put("start_height",schBaseTask.getPoint_code1_height());
|
||||
map.put("next_height",schBaseTask.getPoint_code2_height());
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("start_point", schBaseTask.getPoint_code1());
|
||||
map.put("next_point", schBaseTask.getPoint_code2());
|
||||
map.put("start_height", schBaseTask.getPoint_code1_height());
|
||||
map.put("next_height", schBaseTask.getPoint_code2_height());
|
||||
result.setParameters(map);
|
||||
} catch (Exception e) {
|
||||
String message = ObjectUtil.isEmpty(e.getMessage())
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
<update id="updatePointStatus">
|
||||
update sch_base_point set point_status = #{state}
|
||||
where point_code like CONCAT('%', #{device_code}, '%')
|
||||
where point_code = #{device_code}
|
||||
</update>
|
||||
|
||||
<update id="updatePointQty">
|
||||
|
||||
Reference in New Issue
Block a user