Commit 64bffb72 authored by 黄自鹏's avatar 黄自鹏

增加设备单元解析,增加AGV电量控制

parent bee745af
...@@ -154,7 +154,7 @@ public class AgvServiceImpl extends BaseEditServiceImpl implements AgvService { ...@@ -154,7 +154,7 @@ public class AgvServiceImpl extends BaseEditServiceImpl implements AgvService {
if(agvExsit !=null && BooleanEnum.equalsYes(agvExsit.getTybz())){ if(agvExsit !=null && BooleanEnum.equalsYes(agvExsit.getTybz())){
continue; continue;
} }
/* //是否启用充电阈值设置 //是否启用充电阈值设置
String isEnable = commonService.getStringOptionValue(JcsjParamEnum.AgvBatteryEnable.id()); String isEnable = commonService.getStringOptionValue(JcsjParamEnum.AgvBatteryEnable.id());
//充电状态,阈值比较 //充电状态,阈值比较
if(StringUtils.equals(isEnable,"Y")){ if(StringUtils.equals(isEnable,"Y")){
...@@ -166,7 +166,7 @@ public class AgvServiceImpl extends BaseEditServiceImpl implements AgvService { ...@@ -166,7 +166,7 @@ public class AgvServiceImpl extends BaseEditServiceImpl implements AgvService {
continue; continue;
} }
} }
}*/ }
//查询Eptask中是否已存在小车,如果存在,返回空,生成任务失败 //查询Eptask中是否已存在小车,如果存在,返回空,生成任务失败
if (eptaskDao.countExecutingHcTask(agvStatus.getRobotCode()) > 0) { if (eptaskDao.countExecutingHcTask(agvStatus.getRobotCode()) > 0) {
logger.error("小车"+agvStatus.getRobotCode()+"已存在执行任务,生成任务失败!"); logger.error("小车"+agvStatus.getRobotCode()+"已存在执行任务,生成任务失败!");
......
...@@ -13,16 +13,18 @@ import com.gavel.persistence.sql.RecordSet; ...@@ -13,16 +13,18 @@ import com.gavel.persistence.sql.RecordSet;
public interface TemplateService extends BaseEditService { public interface TemplateService extends BaseEditService {
public RecordSet<TemplateVO> query(TemplateCondition condition); public RecordSet<TemplateVO> query(TemplateCondition condition);
public List<TemplatedetailVO> queryDetail(String mid); public List<TemplatedetailVO> queryDetail(String mid);
public List<Position> parseTemplate(String agvCode, String code, List<Device> deviceList); public List<Position> parseTemplate(String agvCode, String code, List<Device> deviceList);
public List<Position> parseTemplate(String agvCode, String code, List<Device> deviceList,String equipID);
public List<Position> parseTemplate(String agvCode, String podCode, String code, List<Device> deviceList); public List<Position> parseTemplate(String agvCode, String podCode, String code, List<Device> deviceList);
public Template queryByCode(String tasktype); public Template queryByCode(String tasktype);
public int queryDetailRealCount(String id); public int queryDetailRealCount(String id);
} }
...@@ -159,11 +159,111 @@ public class TemplateServiceImpl extends BaseEditServiceImpl implements Template ...@@ -159,11 +159,111 @@ public class TemplateServiceImpl extends BaseEditServiceImpl implements Template
return list; return list;
} }
@Override @Override
public List<Position> parseTemplate(String agvCode, String code, List<Device> deviceList) { public List<Position> parseTemplate(String agvCode, String code, List<Device> deviceList) {
return parseTemplate(agvCode, null, code, deviceList); return parseTemplate(agvCode, null, code, deviceList);
} }
@Override
public List<Position> parseTemplate(String agvCode, String code, List<Device> deviceList, String equipID) {
if (StringUtils.isEmpty(code)) {
throwReturnMessage("编码不允许为空!");
}
List<Position> list = new ArrayList<>();
//查询模板
Template param = new Template();
param.setCode(code);
Template template = templateDao.queryByEntity(param);
if (template == null) {
throwReturnMessage("参数错误,找不到对应的模板!");
}
List<TemplatedetailVO> templatedetails = templatedetailDao.queryByMid(template.getId());
if (templatedetails == null) {
throwReturnMessage("模板错误,没有正确定义!");
}
List<TemplatedetailVO> fliterList = new ArrayList<>();
for (TemplatedetailVO templatedetail : templatedetails) {
if(StringUtils.equals(templatedetail.getGwlx(),GwlxEnum.E.getId())){
fliterList.add(templatedetail);
}
}
if(fliterList.size()>deviceList.size()){
throwReturnMessage("设备数量小于模板设定设备数量!");
}
//根据AGV查询货架位置点、货架待命点
Pod pod = podDao.findByAgvCode(agvCode);
int deviceIndex = 0;
//解析明细列表
for (TemplatedetailVO templatedetail : templatedetails) {
Position position = new Position();
position.setType(POSITION_TYPE);
/* if (StringUtils.equals(templatedetail.getGwlx(), GwlxEnum.A.getId())) {
if (pod == null) {
throwReturnMessage("无货获取货架信息!");
}
position.setPositionCode(pod.getBerthCode());
list.add(position);
} else*/
if (StringUtils.equals(templatedetail.getGwlx(), GwlxEnum.B.getId())) {
if (pod == null) {
throwReturnMessage("无货获取货架信息!");
}
position.setPositionCode(pod.getWaitCode());
list.add(position);
} else if (StringUtils.equals(templatedetail.getGwlx(), GwlxEnum.F.getId())) {
//货架摆放点
if (pod == null) {
throwReturnMessage("无货获取货架信息!");
}
position.setPositionCode(pod.getDispositionCode());
list.add(position);
} else if (StringUtils.equals(templatedetail.getGwlx(), GwlxEnum.C.getId()) ||
StringUtils.equals(templatedetail.getGwlx(), GwlxEnum.G.getId()) ||
StringUtils.equals(templatedetail.getGwlx(), GwlxEnum.J.getId())||
StringUtils.equals(templatedetail.getGwlx(), GwlxEnum.H.getId())) {
//鹏总说了,只有一个
Gw gwParam = new Gw();
gwParam.setType(templatedetail.getGwlx());
Gw gw = gwDao.queryByEntity(gwParam);
if (gw == null) {
throwReturnMessage("无法获取电子货架待命点!");
}
position.setPositionCode(gw.getMapdatacode());
list.add(position);
} else if (StringUtils.equals(templatedetail.getGwlx(), GwlxEnum.D.getId()) ||
StringUtils.equals(templatedetail.getGwlx(), GwlxEnum.E.getId())) {
if (deviceIndex >= deviceList.size()) {
throwReturnMessage("设备数量大于模板设定设备数量!");//如果发送的设备数大于模板配置的设备数
}
Device device = deviceList.get(deviceIndex);
//机台待命点、机台进入点
Gw gw = gwDao.findByDevice(device.getDevice(), templatedetail.getGwlx());
if (gw == null) {
throwReturnMessage("无法获取设备%s的%s!", device.getDevice(), GwlxEnum.findNameById(templatedetail.getGwlx()));
}
position.setPositionCode(gw.getMapdatacode());
list.add(position);
} else if (StringUtils.equals(templatedetail.getGwlx(), GwlxEnum.Z.getId())) {
deviceIndex++;
} else if (StringUtils.equals(templatedetail.getGwlx(), GwlxEnum.S.getId())) {
//设备单元工位位置点
Gw gw = gwDao.findByDevice(equipID, templatedetail.getGwlx());
if (gw == null) {
throwReturnMessage("无法获取设备%s的%s!", equipID, GwlxEnum.findNameById(templatedetail.getGwlx()));
}
position.setPositionCode(gw.getMapdatacode());
list.add(position);
}
}
return list;
}
@Override @Override
public int queryDetailRealCount(String id) { public int queryDetailRealCount(String id) {
List<TemplatedetailVO> list = queryDetail(id); List<TemplatedetailVO> list = queryDetail(id);
......
...@@ -18,6 +18,7 @@ public enum GwlxEnum { ...@@ -18,6 +18,7 @@ public enum GwlxEnum {
F("货架摆放点", "6"), F("货架摆放点", "6"),
G("取消点内", "7"), G("取消点内", "7"),
H("取消点外", "8"), H("取消点外", "8"),
S("设备单元", "10"),
Z("切换设备◎", "99"); Z("切换设备◎", "99");
private String id; private String id;
......
...@@ -468,8 +468,9 @@ public class RcmsServiceImpl extends BaseEditServiceImpl implements RcmsService ...@@ -468,8 +468,9 @@ public class RcmsServiceImpl extends BaseEditServiceImpl implements RcmsService
// RCS 提交任务 // RCS 提交任务
List<Device> deviceList = agvTask.getDesttask().stream().filter(device -> !"0".equals(device.getDevice())).collect(Collectors.toList()); //过滤设备号为零 List<Device> deviceList = agvTask.getDesttask().stream().filter(device -> !"0".equals(device.getDevice())).collect(Collectors.toList()); //过滤设备号为零
String equipID = agvTask.getEquipID();
//获取位置集合 //获取位置集合
List<Position> positionCodePath = templateService.parseTemplate(eptask.getAgvCode(),agvTask.getTasktype(),deviceList); List<Position> positionCodePath = templateService.parseTemplate(eptask.getAgvCode(),agvTask.getTasktype(),deviceList,equipID);
GenAgvTaskResp genAgvTaskResp = genAgvSchedulingTask(eptask.getTaskTyp(), GenAgvTaskResp genAgvTaskResp = genAgvSchedulingTask(eptask.getTaskTyp(),
positionCodePath, eptask.getPriority(), eptask.getTaskCode(),eptask.getPodCode(),eptask.getAgvCode()); positionCodePath, eptask.getPriority(), eptask.getTaskCode(),eptask.getPodCode(),eptask.getAgvCode());
......
...@@ -26,6 +26,10 @@ public class AgvTask { ...@@ -26,6 +26,10 @@ public class AgvTask {
@JSONField(ordinal = 5) @JSONField(ordinal = 5)
private List<Device> desttask = new ArrayList<>(); //设备信息 private List<Device> desttask = new ArrayList<>(); //设备信息
@JSONField(ordinal = 6)
private String EquipID;
private String agvcode; private String agvcode;
private String time;//时间戳 private String time;//时间戳
...@@ -95,4 +99,12 @@ public class AgvTask { ...@@ -95,4 +99,12 @@ public class AgvTask {
public void setAgvcode(String agvcode) { public void setAgvcode(String agvcode) {
this.agvcode = agvcode; this.agvcode = agvcode;
} }
public String getEquipID() {
return EquipID;
}
public void setEquipID(String equipID) {
EquipID = equipID;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment