add:增加区域点位状态看板,看板在docs/点位状态查看.html

This commit is contained in:
zhangzq
2026-12-05 10:34:27 +08:00
parent a437538cfa
commit 03e5846eda
4 changed files with 532 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
package org.nl.wms.sch_manage.controller;
import cn.dev33.satoken.annotation.SaIgnore;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@@ -118,4 +119,18 @@ public class SchBasePointController {
schBasePointService.changeLock(points);
return ResponseData.build();
}
@Log("手动维护点位状态")
@PostMapping("/maintainStatus")
@SaIgnore
public ResponseEntity<Object> maintainStatus(@RequestBody JSONObject body) {
schBasePointService.maintainStatus(body);
return ResponseData.build();
}
@PostMapping("/listByRegions")
@SaIgnore
public ResponseEntity<Object> listByRegions(@RequestBody List<String> regionCodes) {
return ResponseData.build(schBasePointService.listByRegionCodes(regionCodes));
}
}

View File

@@ -121,6 +121,19 @@ public interface ISchBasePointService extends IService<SchBasePoint> {
*/
String getPointRegionMapperSect(String pointCode);
/**
* 手动维护点位有无货。有货必须传托盘号;点位存在未完成任务时不允许维护。
*
* @param body point_code、has_goods、vehicle_code
*/
void maintainStatus(JSONObject body);
/**
* 根据点位区域编码列表查询点位
*
* @param regionCodes 区域编码
* @return 点位信息
*/
List<SchBasePoint> listByRegionCodes(List<String> regionCodes);
}

View File

@@ -18,6 +18,7 @@ import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.SecurityUtils;
import org.nl.wms.sch_manage.enums.PointStatusEnum;
import org.nl.wms.sch_manage.enums.StatusEnum;
import org.nl.wms.sch_manage.enums.TaskStatus;
import org.nl.wms.sch_manage.service.ISchBasePointService;
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
import org.nl.wms.sch_manage.service.dao.SchBaseRegion;
@@ -269,4 +270,66 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
}
return this.baseMapper.getPointRegionMapperSect(pointCode);
}
@Override
public void maintainStatus(JSONObject body) {
if (body == null || StringUtils.isEmpty(body.getString("point_code")) ||!body.containsKey("has_goods")) {
throw new BadRequestException("请求参数不能为空");
}
String pointCode = StringUtils.trimToNull(body.getString("point_code"));
boolean hasGoods = body.getBooleanValue("has_goods");
String vehicleCode = StringUtils.trimToNull(body.getString("vehicle_code"));
if (hasGoods && vehicleCode == null) {
throw new BadRequestException("有货必须传托盘号");
}
SchBasePoint point = this.selectByCode(pointCode);
if (point == null) {
throw new BadRequestException("点位不存在:" + pointCode);
}
Integer count = schBaseTaskMapper.selectCount(new LambdaQueryWrapper<SchBaseTask>()
.eq(SchBaseTask::getIs_delete, false)
.notIn(SchBaseTask::getTask_status,
Arrays.asList(TaskStatus.FINISHED.getCode(), TaskStatus.CANCELED.getCode()))
.and(wrapper -> wrapper.eq(SchBaseTask::getPoint_code1, pointCode)
.or().eq(SchBaseTask::getPoint_code2, pointCode)
.or().eq(SchBaseTask::getPoint_code3, pointCode)
.or().eq(SchBaseTask::getPoint_code4, pointCode)));
if (count != null && count > 0) {
throw new BadRequestException("当前点位存在未完成的任务,不允许维护状态");
}
String now = DateUtil.now();
UpdateWrapper<SchBasePoint> update = new UpdateWrapper<>();
update.lambda()
.eq(SchBasePoint::getPoint_code, pointCode)
.set(SchBasePoint::getPoint_status, hasGoods
? PointStatusEnum.EMPTY_VEHICLE.getCode()
: PointStatusEnum.EMPTY_POINT.getCode())
.set(SchBasePoint::getVehicle_code, hasGoods ? vehicleCode : null)
.set(SchBasePoint::getVehicle_qty, hasGoods ? 1 : 0)
.set(SchBasePoint::getUpdate_id, SecurityUtils.getCurrentUserId())
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName())
.set(SchBasePoint::getUpdate_time, now);
this.update(update);
}
@Override
public List<SchBasePoint> listByRegionCodes(List<String> regionCodes) {
if (ObjectUtil.isEmpty(regionCodes)) {
throw new BadRequestException("点位区域列表不能为空");
}
List<String> codes = regionCodes.stream()
.filter(StringUtils::isNotBlank)
.map(String::trim)
.distinct()
.collect(Collectors.toList());
if (codes.isEmpty()) {
throw new BadRequestException("点位区域列表不能为空");
}
return this.list(new LambdaQueryWrapper<SchBasePoint>()
.in(SchBasePoint::getRegion_code, codes)
.orderByAsc(SchBasePoint::getRegion_code)
.orderByAsc(SchBasePoint::getRow_num)
.orderByAsc(SchBasePoint::getCol_num)
.orderByAsc(SchBasePoint::getPoint_code));
}
}