feat(cargospace): 优化货位管理及任务执行逻辑
- 引入 Lombok 注解简化 BasCargoSpace 实体类代码 - 将货位属性 thePlatoon、theColumn、theFloor 类型从 Long 改为 Integer - 在 ApiServiceImpl 和 Ddj1Thread 中注入并使用 IBasCargoSpaceService 服务 - 优化堆垛机任务重分发逻辑,增加货位坐标设置 - 完善任务执行队列状态控制与删除机制 - 改进输送机任务下发逻辑,支持重复任务处理和执行状态更新
This commit is contained in:
@@ -18,6 +18,7 @@ import com.ruoyi.api.domain.agv.genAgvSchedulingTask.PositionCodeData;
|
||||
import com.ruoyi.api.domain.wcs2wms.JobParam;
|
||||
import com.ruoyi.api.domain.wcs2wms.ReceiveJob;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
|
||||
import com.ruoyi.bas.port.domain.WcsPort;
|
||||
import com.ruoyi.bas.port.service.IWcsPortService;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
@@ -55,6 +56,8 @@ public class ApiServiceImpl implements IApiService {
|
||||
private IMydoJobService mydoJobService;
|
||||
@Autowired
|
||||
private IWcsPortService wcsPortService;
|
||||
@Autowired
|
||||
private IBasCargoSpaceService basCargoSpaceService;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.ruoyi.bas.cargospace.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
@@ -11,6 +14,9 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
||||
* @author ruoyi
|
||||
* @date 2025-09-23
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class BasCargoSpace extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -44,15 +50,15 @@ public class BasCargoSpace extends BaseEntity
|
||||
|
||||
/** 排(不允许为空) */
|
||||
@Excel(name = "排", readConverterExp = "不=允许为空")
|
||||
private Long thePlatoon;
|
||||
private Integer thePlatoon;
|
||||
|
||||
/** 列(不允许为空) */
|
||||
@Excel(name = "列", readConverterExp = "不=允许为空")
|
||||
private Long theColumn;
|
||||
private Integer theColumn;
|
||||
|
||||
/** 层(不允许为空) */
|
||||
@Excel(name = "层", readConverterExp = "不=允许为空")
|
||||
private Long theFloor;
|
||||
private Integer theFloor;
|
||||
|
||||
/** 货位状态1空2满 3入库分配 4出库分配 5入库盘点 6出库盘点 */
|
||||
@Excel(name = "货位状态1空2满 3入库分配 4出库分配 5入库盘点 6出库盘点")
|
||||
@@ -96,229 +102,5 @@ Y锁、N开 */
|
||||
@Excel(name = "wms货位id")
|
||||
private String wmsCargoSpaceId;
|
||||
|
||||
public void setCargoSpaceId(String cargoSpaceId)
|
||||
{
|
||||
this.cargoSpaceId = cargoSpaceId;
|
||||
}
|
||||
|
||||
public String getCargoSpaceId()
|
||||
{
|
||||
return cargoSpaceId;
|
||||
}
|
||||
|
||||
public void setWarehouseId(String warehouseId)
|
||||
{
|
||||
this.warehouseId = warehouseId;
|
||||
}
|
||||
|
||||
public String getWarehouseId()
|
||||
{
|
||||
return warehouseId;
|
||||
}
|
||||
|
||||
public void setRoadwayId(String roadwayId)
|
||||
{
|
||||
this.roadwayId = roadwayId;
|
||||
}
|
||||
|
||||
public String getRoadwayId()
|
||||
{
|
||||
return roadwayId;
|
||||
}
|
||||
|
||||
public void setCargoAreaId(String cargoAreaId)
|
||||
{
|
||||
this.cargoAreaId = cargoAreaId;
|
||||
}
|
||||
|
||||
public String getCargoAreaId()
|
||||
{
|
||||
return cargoAreaId;
|
||||
}
|
||||
|
||||
public void setTheType(String theType)
|
||||
{
|
||||
this.theType = theType;
|
||||
}
|
||||
|
||||
public String getTheType()
|
||||
{
|
||||
return theType;
|
||||
}
|
||||
|
||||
public void setTheTypeName(String theTypeName)
|
||||
{
|
||||
this.theTypeName = theTypeName;
|
||||
}
|
||||
|
||||
public String getTheTypeName()
|
||||
{
|
||||
return theTypeName;
|
||||
}
|
||||
|
||||
public void setCargoSpaceName(String cargoSpaceName)
|
||||
{
|
||||
this.cargoSpaceName = cargoSpaceName;
|
||||
}
|
||||
|
||||
public String getCargoSpaceName()
|
||||
{
|
||||
return cargoSpaceName;
|
||||
}
|
||||
|
||||
public void setThePlatoon(Long thePlatoon)
|
||||
{
|
||||
this.thePlatoon = thePlatoon;
|
||||
}
|
||||
|
||||
public Long getThePlatoon()
|
||||
{
|
||||
return thePlatoon;
|
||||
}
|
||||
|
||||
public void setTheColumn(Long theColumn)
|
||||
{
|
||||
this.theColumn = theColumn;
|
||||
}
|
||||
|
||||
public Long getTheColumn()
|
||||
{
|
||||
return theColumn;
|
||||
}
|
||||
|
||||
public void setTheFloor(Long theFloor)
|
||||
{
|
||||
this.theFloor = theFloor;
|
||||
}
|
||||
|
||||
public Long getTheFloor()
|
||||
{
|
||||
return theFloor;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setLocked(String locked)
|
||||
{
|
||||
this.locked = locked;
|
||||
}
|
||||
|
||||
public String getLocked()
|
||||
{
|
||||
return locked;
|
||||
}
|
||||
|
||||
public void setTrayCode(String trayCode)
|
||||
{
|
||||
this.trayCode = trayCode;
|
||||
}
|
||||
|
||||
public String getTrayCode()
|
||||
{
|
||||
return trayCode;
|
||||
}
|
||||
|
||||
public void setCargoHight(String cargoHight)
|
||||
{
|
||||
this.cargoHight = cargoHight;
|
||||
}
|
||||
|
||||
public String getCargoHight()
|
||||
{
|
||||
return cargoHight;
|
||||
}
|
||||
|
||||
public void setIssDouble(String issDouble)
|
||||
{
|
||||
this.issDouble = issDouble;
|
||||
}
|
||||
|
||||
public String getIssDouble()
|
||||
{
|
||||
return issDouble;
|
||||
}
|
||||
|
||||
public void setGroupCodingNo(String groupCodingNo)
|
||||
{
|
||||
this.groupCodingNo = groupCodingNo;
|
||||
}
|
||||
|
||||
public String getGroupCodingNo()
|
||||
{
|
||||
return groupCodingNo;
|
||||
}
|
||||
|
||||
public void setGroupCoding(String groupCoding)
|
||||
{
|
||||
this.groupCoding = groupCoding;
|
||||
}
|
||||
|
||||
public String getGroupCoding()
|
||||
{
|
||||
return groupCoding;
|
||||
}
|
||||
|
||||
public void setCargoSpaceLogo(String cargoSpaceLogo)
|
||||
{
|
||||
this.cargoSpaceLogo = cargoSpaceLogo;
|
||||
}
|
||||
|
||||
public String getCargoSpaceLogo()
|
||||
{
|
||||
return cargoSpaceLogo;
|
||||
}
|
||||
|
||||
public void setThisCargoArea(String thisCargoArea)
|
||||
{
|
||||
this.thisCargoArea = thisCargoArea;
|
||||
}
|
||||
|
||||
public String getThisCargoArea()
|
||||
{
|
||||
return thisCargoArea;
|
||||
}
|
||||
|
||||
public void setWmsCargoSpaceId(String wmsCargoSpaceId)
|
||||
{
|
||||
this.wmsCargoSpaceId = wmsCargoSpaceId;
|
||||
}
|
||||
|
||||
public String getWmsCargoSpaceId()
|
||||
{
|
||||
return wmsCargoSpaceId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("cargoSpaceId", getCargoSpaceId())
|
||||
.append("warehouseId", getWarehouseId())
|
||||
.append("roadwayId", getRoadwayId())
|
||||
.append("cargoAreaId", getCargoAreaId())
|
||||
.append("theType", getTheType())
|
||||
.append("theTypeName", getTheTypeName())
|
||||
.append("cargoSpaceName", getCargoSpaceName())
|
||||
.append("thePlatoon", getThePlatoon())
|
||||
.append("theColumn", getTheColumn())
|
||||
.append("theFloor", getTheFloor())
|
||||
.append("status", getStatus())
|
||||
.append("locked", getLocked())
|
||||
.append("trayCode", getTrayCode())
|
||||
.append("cargoHight", getCargoHight())
|
||||
.append("issDouble", getIssDouble())
|
||||
.append("groupCodingNo", getGroupCodingNo())
|
||||
.append("groupCoding", getGroupCoding())
|
||||
.append("cargoSpaceLogo", getCargoSpaceLogo())
|
||||
.append("thisCargoArea", getThisCargoArea())
|
||||
.append("wmsCargoSpaceId", getWmsCargoSpaceId())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import com.ruoyi.api.domain.wcs2wms.JobParam;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.bas.cargospace.domain.BasCargoSpace;
|
||||
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.device.ddj.domain.MsgDdj;
|
||||
@@ -33,6 +35,7 @@ public class Ddj1Thread implements Runnable {
|
||||
private IDdjDeviceExecutionQueueService ddjDeviceExecutionQueueService;
|
||||
private IDdjDeviceExecutionQueueFinishService ddjDeviceExecutionQueueFinishService;
|
||||
private IMydoJobService mydoJobService;
|
||||
private IBasCargoSpaceService basCargoSpaceService;
|
||||
|
||||
public boolean isRun = true;
|
||||
|
||||
@@ -48,6 +51,7 @@ public class Ddj1Thread implements Runnable {
|
||||
apiService = SpringUtils.getBean(IApiService.class);
|
||||
ddjDeviceExecutionQueueService = SpringUtils.getBean(IDdjDeviceExecutionQueueService.class);
|
||||
ddjDeviceExecutionQueueFinishService = SpringUtils.getBean(IDdjDeviceExecutionQueueFinishService.class);
|
||||
basCargoSpaceService = SpringUtils.getBean(IBasCargoSpaceService.class);
|
||||
mydoJobService = SpringUtils.getBean(IMydoJobService.class);
|
||||
log.info("初始化服务 {},{},{},{}", apiService, ddjDeviceExecutionQueueService, ddjDeviceExecutionQueueFinishService,mydoJobService);
|
||||
}
|
||||
@@ -103,7 +107,7 @@ public class Ddj1Thread implements Runnable {
|
||||
第二部分
|
||||
跟踪队列执行阶段
|
||||
*/
|
||||
if (ddj.getCzfs() == 5 && ddj.getSbzt() == 1 && (ddj.getJdbz() == 2 || ddj.getJdbz() == 3 || ddj.getJdbz() == 4)) {
|
||||
if (ddj.getCzfs() == 5 && ddj.getSbzt() == 1 && ddj.getJdbz() == 2) {
|
||||
//根据堆垛机上任务号,修改任务执行阶段
|
||||
Long rwh = ddj.getRwh();
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh, ddj.getId());
|
||||
@@ -129,8 +133,13 @@ public class Ddj1Thread implements Runnable {
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
AjaxResult ajaxResult = apiService.reAssign(new JobParam(rwh.toString(), null, null));
|
||||
if (ajaxResult.isSuccess()){
|
||||
mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
||||
mydoJob.setFaultFlag("2");
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(mydoJob.getCargoSpaceId());
|
||||
ddjDeviceExecutionQueue.setMbph(basCargoSpace.getThePlatoon());
|
||||
ddjDeviceExecutionQueue.setMblh(basCargoSpace.getTheColumn());
|
||||
ddjDeviceExecutionQueue.setMbch(basCargoSpace.getTheFloor());
|
||||
ddjDeviceExecutionQueue.setSpare1("0");
|
||||
ddjDeviceExecutionQueueService.updateDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||
}
|
||||
@@ -151,6 +160,8 @@ public class Ddj1Thread implements Runnable {
|
||||
if (ajaxResult.isSuccess()) {
|
||||
//作废作业
|
||||
InvalidMydoJob(rwh, ddj.getId());
|
||||
//删除队列
|
||||
ddjDeviceExecutionQueueService.deleteDdjDeviceExecutionQueueByUuid(ddjDeviceExecutionQueue.getUuid());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -166,7 +177,7 @@ public class Ddj1Thread implements Runnable {
|
||||
if (ObjUtil.isNotNull(mydoJob) && "2".equals(mydoJob.getFaultFlag())) {
|
||||
//判断任务是否重分完成
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh,ddj.getId());
|
||||
if (ObjUtil.isNotNull(ddjDeviceExecutionQueue)) {
|
||||
if (ObjUtil.isNotNull(ddjDeviceExecutionQueue) && "0".equals(ddjDeviceExecutionQueue.getSpare1())) {
|
||||
//重新下发堆垛机任务
|
||||
int i = issuedDDJTask(ddj.getId(), ddjDeviceExecutionQueue);
|
||||
if (i == 1) {
|
||||
@@ -188,6 +199,7 @@ public class Ddj1Thread implements Runnable {
|
||||
Long rwh = ddj.getRwh();
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueueRunningParam = new DdjDeviceExecutionQueue();
|
||||
ddjDeviceExecutionQueueRunningParam.setDdjxf("1");
|
||||
ddjDeviceExecutionQueueRunningParam.setSpare1("1");
|
||||
ddjDeviceExecutionQueueRunningParam.setDevId(ddj.getId());
|
||||
List<DdjDeviceExecutionQueue> ddjDeviceExecutionRunningQueues = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueList(ddjDeviceExecutionQueueRunningParam);
|
||||
if (CollUtil.isNotEmpty(ddjDeviceExecutionRunningQueues)) {
|
||||
|
||||
@@ -198,31 +198,60 @@ public class Floor1BothWayInSsjThread implements Runnable {
|
||||
}
|
||||
}
|
||||
}else {
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("size", ssj.getTraySize());
|
||||
AjaxResult ajaxResult = apiService.selectMydoJobByNoTrayCode(paramMap);
|
||||
if (ajaxResult.isSuccess()) {
|
||||
MydoJob mydoJob2 = BeanUtil.toBean(ajaxResult.get("data"), MydoJob.class);
|
||||
mydoJobService.insertMydoJob(mydoJob2);
|
||||
int i = writeToSsj(ssj.getPlcDbWriteAddress(),mydoJob2.getTaskNo(),1,1);
|
||||
//查询下发的任务
|
||||
MydoJob param = new MydoJob();
|
||||
param.setExecutionPhase("1");
|
||||
param.setStatus("1");
|
||||
param.setEntranceId(ssj.getDeviceCode());
|
||||
List<MydoJob> mydoJobs = mydoJobService.selectMydoJobList(param);
|
||||
if (CollUtil.isNotEmpty(mydoJobs)){
|
||||
//已请求wms,生成任务,二次下发
|
||||
MydoJob mydoJob = mydoJobs.get(0);
|
||||
int i = writeToSsj(ssj.getPlcDbWriteAddress(),mydoJob.getTaskNo(),1,1);
|
||||
if (i == 1) {
|
||||
mydoJob2.setExecutionPhase("1");
|
||||
mydoJobService.updateMydoJob(mydoJob2);
|
||||
log.info("{}下发任务号{}成功:",ssj.getDeviceCode(),mydoJob2.getTaskNo());
|
||||
mydoJob.setExecutionPhase("1");
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
log.info("{}已重复下发任务号{}:",ssj.getDeviceCode(),mydoJob.getTaskNo());
|
||||
}
|
||||
} else if (ajaxResult.isError()) {
|
||||
//超大,给plc下发错误信息,等待人工处理
|
||||
//托盘大小对不上,给plc下发错误信息,等待人工处理
|
||||
//码不对,给plc下发错误信息,等待人工处理
|
||||
int i = writeToSsj(ssj.getPlcDbWriteAddress(), "0", Integer.parseInt(ajaxResult.get("code").toString()), 2);
|
||||
if (i == 1) {
|
||||
log.info("{}下发错误信号{}成功:",ssj.getDeviceCode(),Integer.parseInt(ajaxResult.get("code").toString()));
|
||||
}else {
|
||||
//不存在扫不到托盘码的任务
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("size", ssj.getTraySize());
|
||||
paramMap.put("entranceId",ssj.getDeviceCode());
|
||||
AjaxResult ajaxResult = apiService.selectMydoJobByNoTrayCode(paramMap);
|
||||
if (ajaxResult.isSuccess()) {
|
||||
MydoJob mydoJob2 = BeanUtil.toBean(ajaxResult.get("data"), MydoJob.class);
|
||||
mydoJobService.insertMydoJob(mydoJob2);
|
||||
int i = writeToSsj(ssj.getPlcDbWriteAddress(),mydoJob2.getTaskNo(),1,1);
|
||||
if (i == 1) {
|
||||
mydoJob2.setExecutionPhase("1");
|
||||
mydoJobService.updateMydoJob(mydoJob2);
|
||||
log.info("{}已下发任务号{}:",ssj.getDeviceCode(),mydoJob2.getTaskNo());
|
||||
}
|
||||
} else if (ajaxResult.isError()) {
|
||||
//超大,给plc下发错误信息,等待人工处理
|
||||
//托盘大小对不上,给plc下发错误信息,等待人工处理
|
||||
//码不对,给plc下发错误信息,等待人工处理
|
||||
int i = writeToSsj(ssj.getPlcDbWriteAddress(), "0", Integer.parseInt(ajaxResult.get("code").toString()), 2);
|
||||
if (i == 1) {
|
||||
log.info("{}下发错误信号{}:",ssj.getDeviceCode(),Integer.parseInt(ajaxResult.get("code").toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (ssj.getDw() == 1 && ssj.getTaskNo() > 0 && ssj.getTraySize() != 0){
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Convert.toLong(ssj.getTaskNo()));
|
||||
if (ObjUtil.isNotNull(mydoJob) && "1".equals(mydoJob.getStatus()) && "1".equals(mydoJob.getExecutionPhase()) && Convert.toInt(mydoJob.getInOrOut())<20){
|
||||
//修改作业执行状态
|
||||
mydoJob.setStatus("3");
|
||||
mydoJob.setStartTime(DateUtil.formatDateTime(DateUtil.date()));
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user