|
|
|
@ -221,6 +221,59 @@ public class AgvStationServiceImpl extends ServiceImpl<AgvStationMapper, AgvStat |
|
|
|
System.out.println("修改AGV站点完成 - rqrq"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 删除AGV站点 - rqrq |
|
|
|
* <p>删除前校验:</p> |
|
|
|
* <ul> |
|
|
|
* <li>站点必须是禁用状态(active='N')</li> |
|
|
|
* <li>站点下不能有栈板</li> |
|
|
|
* </ul> |
|
|
|
* @param data 站点信息(包含stationCode) |
|
|
|
* @author rqrq |
|
|
|
* @date 2025/02/06 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void deleteAgvStation(AgvStationData data) throws Exception { |
|
|
|
System.out.println("开始删除AGV站点 - rqrq,站点编码:" + data.getStationCode()); |
|
|
|
|
|
|
|
// 校验参数 - rqrq |
|
|
|
if (!StringUtils.hasText(data.getStationCode())) { |
|
|
|
throw new RuntimeException("站点编码不能为空"); |
|
|
|
} |
|
|
|
|
|
|
|
String stationCode = data.getStationCode(); |
|
|
|
|
|
|
|
// 查询站点信息 - rqrq |
|
|
|
AgvStation station = this.lambdaQuery() |
|
|
|
.eq(AgvStation::getStationCode, stationCode) |
|
|
|
.one(); |
|
|
|
|
|
|
|
if (station == null) { |
|
|
|
throw new RuntimeException("站点不存在:" + stationCode); |
|
|
|
} |
|
|
|
|
|
|
|
// 1. 校验站点必须是禁用状态 - rqrq |
|
|
|
if (!"N".equals(station.getActive())) { |
|
|
|
String errorMsg = "只有禁用状态的站点才能删除,请先禁用该站点"; |
|
|
|
System.out.println("删除站点失败 - rqrq:" + errorMsg); |
|
|
|
throw new RuntimeException(errorMsg); |
|
|
|
} |
|
|
|
|
|
|
|
// 2. 校验站点下不能有栈板 - rqrq |
|
|
|
Integer palletCount = this.baseMapper.countPalletByLocationCode(stationCode); |
|
|
|
if (palletCount != null && palletCount > 0) { |
|
|
|
String errorMsg = "该站点下还有 " + palletCount + " 个栈板,不允许删除"; |
|
|
|
System.out.println("删除站点失败 - rqrq:" + errorMsg); |
|
|
|
throw new RuntimeException(errorMsg); |
|
|
|
} |
|
|
|
|
|
|
|
// 3. 执行删除 - rqrq |
|
|
|
System.out.println("校验通过,执行删除操作 - rqrq"); |
|
|
|
this.removeById(station.getId()); |
|
|
|
|
|
|
|
System.out.println("删除AGV站点完成 - rqrq"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 获取状态描述 - rqrq |
|
|
|
* @param statusDb 状态值 |
|
|
|
|