Browse Source

新需求固化室一键解绑

master
psh 8 months ago
parent
commit
5124b3c782
  1. 3
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_autodoor/StandardAutodoorDeviceDriver.java
  2. 87
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/impl/AcsToWmsServiceImpl.java

3
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_autodoor/StandardAutodoorDeviceDriver.java

@ -121,6 +121,9 @@ public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implem
request.setDevice_code(this.getDeviceCode());
request.setType("1");
acsToWmsService.notify(request);
if(state==4) {
this. writing(ItemProtocol.item_to_state,4);
}
}
last_action = action;
last_mode = mode;

87
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/impl/AcsToWmsServiceImpl.java

@ -22,9 +22,11 @@ import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
import org.nl.wms.sch.point.service.ISchBasePointService;
import org.nl.wms.sch.point.service.dao.SchBasePoint;
import org.nl.wms.sch.point.service.dao.mapper.SchBasePointMapper;
import org.nl.wms.sch.task.service.ISchBaseTaskService;
import org.nl.wms.sch.task.service.dao.SchBaseTask;
import org.nl.wms.sch.task_manage.AbstractTask;
import org.nl.wms.sch.task_manage.GeneralDefinition;
import org.nl.wms.sch.task_manage.enums.GroupBindMaterialStatusEnum;
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
import org.nl.wms.sch.task_manage.enums.PointStatusEnum;
@ -42,11 +44,13 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.PostConstruct;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* @Author: lyd
@ -74,6 +78,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Autowired
private PointMapper pointMapper;
@Autowired
private SchBasePointMapper schBasePointMapper;
// 初始化反射方法
@PostConstruct
public void initCacheMethod() {
@ -91,17 +98,17 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
String requestMethodName = param.getString("request_medthod_name");
BaseResponse result = BaseResponse.build(requestNo);
String device_code = param.getString("device_code");
param.put("config_code",requestMethodCode);
param.put("config_code", requestMethodCode);
try {
if(ObjectUtil.isEmpty(requestMethodCode)){
throw new BadRequestException("任务类型不正确!requestMethodCode:"+requestMethodName+",device_code:"+device_code);
if (ObjectUtil.isEmpty(requestMethodCode)) {
throw new BadRequestException("任务类型不正确!requestMethodCode:" + requestMethodName + ",device_code:" + device_code);
}
AbstractTask task = taskFactory.getTask(requestMethodCode);
// 执行创建任务
task.apply(param);
} catch (Exception e) {
String message = e.getMessage();
log.error("ACS请求LMS出现错误: {}",e.getMessage(),e);
String message = e.getMessage();
log.error("ACS请求LMS出现错误: {}", e.getMessage(), e);
result.setCode(HttpStatus.HTTP_BAD_REQUEST);
result.setMessage(message);
result.setRequestNo(requestNo);
@ -109,7 +116,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
noticeService.createNotice("异常信息:" + message, "acsApply: " + param.getString("request_medthod_code"),
NoticeTypeEnum.EXCEPTION.getCode());
}
return result;
return result;
}
/**
@ -152,7 +159,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
try {
abstractTask.updateTaskStatus(taskObj.getTask_id(), status);
} catch (Exception e) {
log.error("任务状态更新失败: {}", e.getMessage(),e);
log.error("任务状态更新失败: {}", e.getMessage(), e);
return BaseResponse.responseError(requestNo, "任务:[" + taskId + "]状态更新失败," + message);
}
return BaseResponse.responseOk(requestNo, "任务状态反馈成功!");
@ -165,23 +172,53 @@ 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) {
String ghs_device_code;
switch (type) {
case 1:
//自动门反馈设备状态,将对应十个固化室工位的状态修改为传入状态
String ghs_device_code="GHS"+device_code.substring(device_code.length()-2);
pointMapper.updatePointStatus(ghs_device_code,state);
ghs_device_code = "GHS" + device_code.substring(device_code.length() - 2);
pointMapper.updatePointStatus(ghs_device_code, state);
break;
case 2:
//正极板对接位反馈设备有无货
device_code=device_code.substring(0,device_code.length()-2);
pointMapper.updatePointVehicleQty(device_code,state);
device_code = device_code.substring(0, device_code.length() - 2);
pointMapper.updatePointVehicleQty(device_code, state);
break;
case 3:
//正极板空架缓存区人工搬走后显示更新无货
pointMapper.updatePointVehicleQty(device_code,state);
pointMapper.updatePointVehicleQty(device_code, state);
break;
case 4:
//自动门反馈全部人工出库,将对应十个固化室工位的物料状态清空,组盘表解绑
ghs_device_code = "GHS" + device_code.substring(device_code.length() - 2);
List<SchBasePoint> schBasePointList = schBasePointMapper.selectList(new LambdaQueryWrapper<SchBasePoint>()
.like(SchBasePoint::getPoint_code, ghs_device_code));
for (SchBasePoint schBasePoint : schBasePointList) {
List<String> vehicleCodeList = Arrays.stream(schBasePoint.getVehicle_code().split(",")).collect(Collectors.toList());
//组盘全部解绑
for (String vehicleCode : vehicleCodeList) {
SchBaseVehiclematerialgroup groupEntity = vehiclematerialgroupService.getOne(new LambdaQueryWrapper<SchBaseVehiclematerialgroup>()
.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicleCode)
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status,
GroupBindMaterialStatusEnum.BOUND.getValue()));
if (ObjectUtil.isNotEmpty(groupEntity)) {
groupEntity.setGroup_bind_material_status(GroupBindMaterialStatusEnum.UNBOUND.getValue());
groupEntity.setUpdate_id(GeneralDefinition.ACS_ID);
groupEntity.setUpdate_name(GeneralDefinition.ACS_NAME);
groupEntity.setUpdate_time(DateUtil.now());
vehiclematerialgroupService.update(groupEntity);
}
}
//清空点位
schBasePoint.setVehicle_type("");
schBasePoint.setVehicle_code("");
schBasePoint.setVehicle_qty(0);
schBasePoint.setUpdate_time(DateUtil.now());
pointService.update(schBasePoint);
}
break;
default:
break;
@ -192,7 +229,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
/**
* 任务阶段反馈最新点位
* todo
* */
*/
@Override
public BaseResponse feedbackState(JSONObject param) {
@ -200,26 +237,26 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
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);
}
if (Integer.parseInt(schBaseTask.getTask_status()) >= Integer.parseInt(TaskStatus.FINISHED.getCode())) {
throw new BadRequestException("任务已完成或已取消!");
}
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 = e.getMessage();
log.error("ACS请求LMS出现错误: {}{}", e.getMessage(),e);
log.error("ACS请求LMS出现错误: {}{}", e.getMessage(), e);
result.setCode(HttpStatus.HTTP_BAD_REQUEST);
result.setMessage(message);
result.setRequestNo(requestNo);

Loading…
Cancel
Save