货位信息初始化

This commit is contained in:
liuhanqing
2025-09-23 14:10:14 +08:00
parent 543c7a6feb
commit 00e807f71c
11 changed files with 845 additions and 29 deletions

View File

@@ -0,0 +1,104 @@
package com.ruoyi.bas.cargospace.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.bas.cargospace.domain.BasCargoSpace;
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 库存信息Controller
*
* @author ruoyi
* @date 2025-09-23
*/
@RestController
@RequestMapping("/bas/cargoSpace")
public class BasCargoSpaceController extends BaseController
{
@Autowired
private IBasCargoSpaceService basCargoSpaceService;
/**
* 查询库存信息列表
*/
@PreAuthorize("@ss.hasPermi('bas:cargoSpace:list')")
@GetMapping("/list")
public TableDataInfo list(BasCargoSpace basCargoSpace)
{
startPage();
List<BasCargoSpace> list = basCargoSpaceService.selectBasCargoSpaceList(basCargoSpace);
return getDataTable(list);
}
/**
* 导出库存信息列表
*/
@PreAuthorize("@ss.hasPermi('bas:cargoSpace:export')")
@Log(title = "库存信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BasCargoSpace basCargoSpace)
{
List<BasCargoSpace> list = basCargoSpaceService.selectBasCargoSpaceList(basCargoSpace);
ExcelUtil<BasCargoSpace> util = new ExcelUtil<BasCargoSpace>(BasCargoSpace.class);
util.exportExcel(response, list, "库存信息数据");
}
/**
* 获取库存信息详细信息
*/
@PreAuthorize("@ss.hasPermi('bas:cargoSpace:query')")
@GetMapping(value = "/{cargoSpaceId}")
public AjaxResult getInfo(@PathVariable("cargoSpaceId") String cargoSpaceId)
{
return success(basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(cargoSpaceId));
}
/**
* 新增库存信息
*/
@PreAuthorize("@ss.hasPermi('bas:cargoSpace:add')")
@Log(title = "库存信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BasCargoSpace basCargoSpace)
{
return toAjax(basCargoSpaceService.insertBasCargoSpace(basCargoSpace));
}
/**
* 修改库存信息
*/
@PreAuthorize("@ss.hasPermi('bas:cargoSpace:edit')")
@Log(title = "库存信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BasCargoSpace basCargoSpace)
{
return toAjax(basCargoSpaceService.updateBasCargoSpace(basCargoSpace));
}
/**
* 删除库存信息
*/
@PreAuthorize("@ss.hasPermi('bas:cargoSpace:remove')")
@Log(title = "库存信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{cargoSpaceIds}")
public AjaxResult remove(@PathVariable String[] cargoSpaceIds)
{
return toAjax(basCargoSpaceService.deleteBasCargoSpaceByCargoSpaceIds(cargoSpaceIds));
}
}

View File

@@ -0,0 +1,324 @@
package com.ruoyi.bas.cargospace.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 库存信息对象 bas_cargo_space
*
* @author ruoyi
* @date 2025-09-23
*/
public class BasCargoSpace extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 货位id 主键 */
private String cargoSpaceId;
/** 仓库id(不允许为空) */
@Excel(name = "仓库id", readConverterExp = "不=允许为空")
private String warehouseId;
/** 巷道id(允许为空) */
@Excel(name = "巷道id", readConverterExp = "允=许为空")
private String roadwayId;
/** 货区id(允许为空) */
@Excel(name = "货区id", readConverterExp = "允=许为空")
private String cargoAreaId;
/** 货位类型(允许为空) */
@Excel(name = "货位类型", readConverterExp = "允=许为空")
private String theType;
/** 货位类型名称 */
@Excel(name = "货位类型名称")
private String theTypeName;
/** 货位名称(不允许为空) */
@Excel(name = "货位名称", readConverterExp = "不=允许为空")
private String cargoSpaceName;
/** 排(不允许为空) */
@Excel(name = "排", readConverterExp = "不=允许为空")
private Long thePlatoon;
/** 列(不允许为空) */
@Excel(name = "列", readConverterExp = "不=允许为空")
private Long theColumn;
/** 层(不允许为空) */
@Excel(name = "层", readConverterExp = "不=允许为空")
private Long theFloor;
/** 货位状态1空2满 3入库分配 4出库分配 5入库盘点 6出库盘点 */
@Excel(name = "货位状态1空2满 3入库分配 4出库分配 5入库盘点 6出库盘点")
private String status;
/** 是否锁定(不允许为空)
Y锁、N开 */
@Excel(name = "是否锁定", readConverterExp = "不=允许为空")
private String locked;
/** 托盘条码(允许为空) */
@Excel(name = "托盘条码", readConverterExp = "允=许为空")
private String trayCode;
/** 货位高度 */
@Excel(name = "货位高度")
private String cargoHight;
/** 是否双伸 Y N */
@Excel(name = "是否双伸 Y N ")
private String issDouble;
/** 双货位分组编码(标识区分) */
@Excel(name = "双货位分组编码", readConverterExp = "标=识区分")
private String groupCodingNo;
/** 双货位分组编码1、2… */
@Excel(name = "双货位分组编码1、2… ")
private String groupCoding;
/** 双货位标识 0 外1内 */
@Excel(name = "双货位标识 0 外1内")
private String cargoSpaceLogo;
/** 本仓库区域 1--8 A
9--15 B */
@Excel(name = "本仓库区域")
private String thisCargoArea;
/** wms货位id */
@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();
}
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.bas.cargospace.mapper;
import java.util.List;
import com.ruoyi.bas.cargospace.domain.BasCargoSpace;
/**
* 库存信息Mapper接口
*
* @author ruoyi
* @date 2025-09-23
*/
public interface BasCargoSpaceMapper
{
/**
* 查询库存信息
*
* @param cargoSpaceId 库存信息主键
* @return 库存信息
*/
public BasCargoSpace selectBasCargoSpaceByCargoSpaceId(String cargoSpaceId);
/**
* 查询库存信息列表
*
* @param basCargoSpace 库存信息
* @return 库存信息集合
*/
public List<BasCargoSpace> selectBasCargoSpaceList(BasCargoSpace basCargoSpace);
/**
* 新增库存信息
*
* @param basCargoSpace 库存信息
* @return 结果
*/
public int insertBasCargoSpace(BasCargoSpace basCargoSpace);
/**
* 修改库存信息
*
* @param basCargoSpace 库存信息
* @return 结果
*/
public int updateBasCargoSpace(BasCargoSpace basCargoSpace);
/**
* 删除库存信息
*
* @param cargoSpaceId 库存信息主键
* @return 结果
*/
public int deleteBasCargoSpaceByCargoSpaceId(String cargoSpaceId);
/**
* 批量删除库存信息
*
* @param cargoSpaceIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteBasCargoSpaceByCargoSpaceIds(String[] cargoSpaceIds);
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.bas.cargospace.service;
import java.util.List;
import com.ruoyi.bas.cargospace.domain.BasCargoSpace;
/**
* 库存信息Service接口
*
* @author ruoyi
* @date 2025-09-23
*/
public interface IBasCargoSpaceService
{
/**
* 查询库存信息
*
* @param cargoSpaceId 库存信息主键
* @return 库存信息
*/
public BasCargoSpace selectBasCargoSpaceByCargoSpaceId(String cargoSpaceId);
/**
* 查询库存信息列表
*
* @param basCargoSpace 库存信息
* @return 库存信息集合
*/
public List<BasCargoSpace> selectBasCargoSpaceList(BasCargoSpace basCargoSpace);
/**
* 新增库存信息
*
* @param basCargoSpace 库存信息
* @return 结果
*/
public int insertBasCargoSpace(BasCargoSpace basCargoSpace);
/**
* 修改库存信息
*
* @param basCargoSpace 库存信息
* @return 结果
*/
public int updateBasCargoSpace(BasCargoSpace basCargoSpace);
/**
* 批量删除库存信息
*
* @param cargoSpaceIds 需要删除的库存信息主键集合
* @return 结果
*/
public int deleteBasCargoSpaceByCargoSpaceIds(String[] cargoSpaceIds);
/**
* 删除库存信息信息
*
* @param cargoSpaceId 库存信息主键
* @return 结果
*/
public int deleteBasCargoSpaceByCargoSpaceId(String cargoSpaceId);
}

View File

@@ -0,0 +1,93 @@
package com.ruoyi.bas.cargospace.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.bas.cargospace.mapper.BasCargoSpaceMapper;
import com.ruoyi.bas.cargospace.domain.BasCargoSpace;
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
/**
* 库存信息Service业务层处理
*
* @author ruoyi
* @date 2025-09-23
*/
@Service
public class BasCargoSpaceServiceImpl implements IBasCargoSpaceService
{
@Autowired
private BasCargoSpaceMapper basCargoSpaceMapper;
/**
* 查询库存信息
*
* @param cargoSpaceId 库存信息主键
* @return 库存信息
*/
@Override
public BasCargoSpace selectBasCargoSpaceByCargoSpaceId(String cargoSpaceId)
{
return basCargoSpaceMapper.selectBasCargoSpaceByCargoSpaceId(cargoSpaceId);
}
/**
* 查询库存信息列表
*
* @param basCargoSpace 库存信息
* @return 库存信息
*/
@Override
public List<BasCargoSpace> selectBasCargoSpaceList(BasCargoSpace basCargoSpace)
{
return basCargoSpaceMapper.selectBasCargoSpaceList(basCargoSpace);
}
/**
* 新增库存信息
*
* @param basCargoSpace 库存信息
* @return 结果
*/
@Override
public int insertBasCargoSpace(BasCargoSpace basCargoSpace)
{
return basCargoSpaceMapper.insertBasCargoSpace(basCargoSpace);
}
/**
* 修改库存信息
*
* @param basCargoSpace 库存信息
* @return 结果
*/
@Override
public int updateBasCargoSpace(BasCargoSpace basCargoSpace)
{
return basCargoSpaceMapper.updateBasCargoSpace(basCargoSpace);
}
/**
* 批量删除库存信息
*
* @param cargoSpaceIds 需要删除的库存信息主键
* @return 结果
*/
@Override
public int deleteBasCargoSpaceByCargoSpaceIds(String[] cargoSpaceIds)
{
return basCargoSpaceMapper.deleteBasCargoSpaceByCargoSpaceIds(cargoSpaceIds);
}
/**
* 删除库存信息信息
*
* @param cargoSpaceId 库存信息主键
* @return 结果
*/
@Override
public int deleteBasCargoSpaceByCargoSpaceId(String cargoSpaceId)
{
return basCargoSpaceMapper.deleteBasCargoSpaceByCargoSpaceId(cargoSpaceId);
}
}

View File

@@ -3,6 +3,7 @@ package com.ruoyi.job.mapper;
import java.util.HashMap;
import java.util.List;
import com.ruoyi.job.domain.MydoJob;
import org.apache.ibatis.annotations.Param;
/**
* 作业信息Mapper接口
@@ -63,4 +64,6 @@ public interface MydoJobMapper
void ddjTaskFinish(HashMap<String, Object> map);
void InvalidMydoJob(HashMap<String, Object> map);
MydoJob selectMydoJobByExitList(@Param("exitList") List<String> exitList);
}

View File

@@ -64,4 +64,6 @@ public interface IMydoJobService
boolean ddjTaskFinish(Long rwh, Integer id);
boolean InvalidMydoJob(Long rwh, Integer id);
MydoJob selectMydoJobByExitList(List<String> exitList);
}

View File

@@ -126,4 +126,9 @@ public class MydoJobServiceImpl implements IMydoJobService
throw new RuntimeException(map.get("v_result").toString());
}
}
@Override
public MydoJob selectMydoJobByExitList(List<String> exitList) {
return mydoJobMapper.selectMydoJobByExitList(exitList);
}
}

View File

@@ -1,7 +1,10 @@
package com.ruoyi.schedule.scheduleTask.ssj.floor1;
import cn.hutool.core.util.ObjUtil;
import com.ruoyi.api.service.IApiService;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.job.domain.MydoJob;
import com.ruoyi.job.service.IMydoJobService;
import com.ruoyi.queue.agv.service.IAgvQueueService;
import com.ruoyi.device.ssj.domain.DeviceSsj;
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
@@ -10,6 +13,7 @@ import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 一楼单向出库线程 循环出库作业+巷道口空闲 生成堆垛机出库队列
@@ -20,20 +24,26 @@ public class Floor1SingleSsjThread implements Runnable {
public HashMap<String, List<String>> ssjCodeList;
private IApiService apiService;
private IAgvQueueService agvQueueService;
private IMydoJobService mydoJobService;
public boolean isRun = true;
private Map<String,String> exitRoadwayMap = new HashMap<>();
public void init() {
ssjCodeList = new HashMap<>();
ArrayList<String> ssjCodes = new ArrayList<>();
ssjCodes.add("L1002");
ssjCodes.add("L1004");
ssjCodeList.put("in", ssjCodes);
ssjCodes.add("L2001");
ssjCodes.add("L2007");
ssjCodeList.put("outRoadwaySsj", ssjCodes);
apiService = SpringUtils.getBean(IApiService.class);
agvQueueService = SpringUtils.getBean(IAgvQueueService.class);
log.info("初始化服务 {},{}", apiService, agvQueueService);
mydoJobService = SpringUtils.getBean(IMydoJobService.class);
exitRoadwayMap.put("L2001","L2011");
exitRoadwayMap.put("L2007","L2014");
log.info("初始化服务 {},{}", apiService, mydoJobService);
}
@Override
@@ -41,23 +51,20 @@ public class Floor1SingleSsjThread implements Runnable {
init();
while (isRun){
for (String type : ssjCodeList.keySet()) {
switch ( type){
case "in":
//生产线入库
for (String ssjCode : ssjCodeList.get(type)) {
try {
if (PlcSsjRead.deviceSsjMap.containsKey(ssjCode)) {
inDispatch(PlcSsjRead.deviceSsjMap.get(ssjCode));
} else {
log.error("设备不存在 ssjCode{}", ssjCode);
}
} catch (RuntimeException e) {
log.error(e.getMessage(),e);
//一楼单向出库口
if ("outRoadwaySsj".equals(type)) {
for (String ssjCode : ssjCodeList.get(type)) {
try {
if (PlcSsjRead.deviceSsjMap.containsKey(ssjCode)) {
dispatch(PlcSsjRead.deviceSsjMap.get(ssjCode));
} else {
log.error("设备不存在 ssjCode{}", ssjCode);
}
} catch (RuntimeException e) {
log.error(e.getMessage(), e);
}
break;
}
}
}
try {
@@ -70,15 +77,14 @@ public class Floor1SingleSsjThread implements Runnable {
}
public void inDispatch(DeviceSsj inSsjDevice) {
public void dispatch(DeviceSsj ssj) {
//如果入库请求1 并且 托盘码不为空
if (inSsjDevice.getDw() == 1 && inSsjDevice.getTaskNo() > 0 && inSsjDevice.getRkqq() == 1) {
//查询货位 排列层
//查询入口 排列层
//生成堆垛机队列
if (ssj.getKx()==1){
String exitId = exitRoadwayMap.get(ssj.getDeviceCode());
MydoJob mydoJob = mydoJobService.selectMydoJobByExitList(List.of(exitId));
if (ObjUtil.isNotNull(mydoJob)){
//生成队列
}
}
}