代码更新;

1. 修复库存充足时的缺料问题
2. 整理盒子界面增加大盒子列表
This commit is contained in:
梁州 2024-10-14 18:44:44 +08:00
parent 1562dc5b1d
commit 2215a9bd46
5 changed files with 183 additions and 49 deletions

View File

@ -82,6 +82,14 @@ public class KateWorkQueryController {
* 看板服务 * 看板服务
*/ */
private final KanbanService kanbanService; private final KanbanService kanbanService;
/**
* 站台服务
*/
private final StandService standService;
/**
* 库位配置服务
*/
private final ELocationConfigLastService eLocationConfigLastService;
/** /**
* 请求头部信息 * 请求头部信息
*/ */
@ -788,4 +796,91 @@ public class KateWorkQueryController {
return convertJsonString(response); return convertJsonString(response);
} }
} }
/**
* 查询整理大盒子列表
*/
@PostMapping("/getBigBoxList")
@ResponseBody
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
@MyLog(logTitle = "查询整理大盒子列表", logMethod = "getBigBoxList")
public String getBigBoxList(@RequestBody BigBoxQuery bigBoxQuery) {
logger.info("接收到查询整理大盒子列表请求:{}请求ip{}", convertJsonString(bigBoxQuery), HttpUtils.getIpAddr(servletRequest));
ResponseEntity response = new ResponseEntity();
try {
// 获取站台号
String standId = "";
if (StringUtils.isNotEmpty(bigBoxQuery.getStandId())) {
// 站台号从请求参数中获取
standId = bigBoxQuery.getStandId();
} else {
// 站台号从ip获取
Stand standOfIp = standService.getOne(new LambdaQueryWrapper<Stand>()
.eq(Stand::getStandIp, HttpUtils.getIpAddr(servletRequest))
.eq(Stand::getStandType, 2)
.last("limit 1"));
if (standOfIp != null && StringUtils.isNotEmpty(standOfIp.getStandId())) {
standId = standOfIp.getStandId();
}
}
if (StringUtils.isEmpty(standId)) {
logger.error("请求参数缺少站台号。");
response.setCode(ResponseCode.ERROR.getCode());
response.setMessage("请求参数缺少站台号。");
return convertJsonString(response);
}
// 返回结果
Map<String, BigBoxVo> bigBoxVoMap = new HashMap<>();
// 查询到当前站台所有的大盒子
List<WorkStationConfig> stationConfigs = workStationConfigService.list(new LambdaQueryWrapper<WorkStationConfig>()
.eq(WorkStationConfig::getWorkStation, standId));
for (WorkStationConfig currentBigBoxConfig : stationConfigs) {
// 当前配置的工单数/大盒子
int orderQuantity = currentBigBoxConfig.getOrderQuantity();
// 查询这个大盒子对应的小盒子
List<String> smallBoxListOfAll = stationConfigs.stream().map(WorkStationConfig::getSmallBox).distinct().toList();
// 找出本次工作中的标签位
List<ELocationConfigLast> eConfigLastList = eLocationConfigLastService.list(new LambdaQueryWrapper<ELocationConfigLast>()
.eq(ELocationConfigLast::getWorkStation, standId)
.in(ELocationConfigLast::getWorkCenter, smallBoxListOfAll));
if (eConfigLastList.isEmpty()) {
continue;
}
// 设置返回结果
int boxQuantity = 0;
if (orderQuantity <= 0) {
boxQuantity = 1;
} else {
// 根据这些小盒子号找到对应的工单
List<String> orderIds = eConfigLastList.stream().map(ELocationConfigLast::getWorkOrder).distinct().toList();
boxQuantity = boxQuantity + (orderIds.size() / orderQuantity);
}
//
String key = currentBigBoxConfig.getWorkStation() + "_" + currentBigBoxConfig.getBigBox();
if (bigBoxVoMap.containsKey(key)) {
BigBoxVo bigBoxVo = bigBoxVoMap.get(key);
bigBoxVo.setBoxQuantity(bigBoxVo.getBoxQuantity() + boxQuantity);
bigBoxVoMap.replace(key, bigBoxVo);
} else {
BigBoxVo bigBoxVo = new BigBoxVo();
bigBoxVo.setStandId(standId);
bigBoxVo.setBigBoxNo(currentBigBoxConfig.getBigBox());
bigBoxVo.setBoxQuantity(boxQuantity);
bigBoxVoMap.put(key, bigBoxVo);
}
}
response.setCode(ResponseCode.OK.getCode());
response.setMessage("查询整理大盒子列表成功。");
response.setReturnData(bigBoxVoMap.values());
return convertJsonString(response);
} catch (Exception e) {
// 回滚事务
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
logger.error("查询整理大盒子列表发生异常:{}", convertJsonString(e));
response.setCode(ResponseCode.ERROR.getCode());
response.setMessage("查询整理大盒子列表发生异常");
return convertJsonString(response);
}
}
} }

View File

@ -215,6 +215,10 @@ public class StockController {
.eq(Vehicle::getIsEmpty, 0)); .eq(Vehicle::getIsEmpty, 0));
} }
stockUpdateRecordService.addStockUpdateRecord(stockBefore, null, StockUpdateReasonEnum.DELETE_CLIENT.getReason(), stockQuery.getUserName(), stockBefore.getGoodsRelated().getRemainNum()); stockUpdateRecordService.addStockUpdateRecord(stockBefore, null, StockUpdateReasonEnum.DELETE_CLIENT.getReason(), stockQuery.getUserName(), stockBefore.getGoodsRelated().getRemainNum());
// 删除这个料箱对应的outside_vehicles
outsideVehiclesService.remove(new LambdaQueryWrapper<OutsideVehicles>()
.eq(OutsideVehicles::getVehicleId, stockBefore.getVehicleId())
.eq(OutsideVehicles::getGoodsId, stockBefore.getGoodsRelated().getGoodsId()));
// 返回成功 // 返回成功
logger.info("数量为0删除库存成功"); logger.info("数量为0删除库存成功");
rsp.setCode(ResponseCode.OK.getCode()); rsp.setCode(ResponseCode.OK.getCode());

View File

@ -1259,19 +1259,9 @@ public class TaskController {
workFlow.setWorkStatus(1);// 正在做 workFlow.setWorkStatus(1);// 正在做
} else { } else {
if (workFlow.getPickedNum().compareTo(workFlow.getNeedNum()) < 0) { if (workFlow.getPickedNum().compareTo(workFlow.getNeedNum()) < 0) {
// 判断后续有无物料进此站台 // 缺料未完成
List<PickTask> pickedTasks = pickTaskService.list(new LambdaQueryWrapper<PickTask>()
.eq(PickTask::getStandId, workFlow.getWorkStation())
.ne(PickTask::getPickStatus, PickTaskStatusEnum.FINISH.getCode()));
if (!pickedTasks.isEmpty()) {
List<String> vehicleIds = pickedTasks.stream().map(PickTask::getVehicleId).distinct().toList();
if (outsideVehiclesService.exists(new LambdaQueryWrapper<OutsideVehicles>()
.eq(OutsideVehicles::getGoodsId, workFlow.getGoodsId())
.in(OutsideVehicles::getVehicleId, vehicleIds))) {
workFlow.setLightStatus(0);// 未亮灯 workFlow.setLightStatus(0);// 未亮灯
workFlow.setWorkStatus(1);// 正在做 workFlow.setWorkStatus(1);// 正在做
}
}
} else { } else {
workFlow.setLightStatus(2);// 已拍灯 workFlow.setLightStatus(2);// 已拍灯
workFlow.setWorkStatus(2);// 已完成 workFlow.setWorkStatus(2);// 已完成
@ -1429,42 +1419,42 @@ public class TaskController {
if (currentGoodsVehicle != null) { if (currentGoodsVehicle != null) {
currentGoodsVehicle.setRemainNum(BigDecimal.ZERO); currentGoodsVehicle.setRemainNum(BigDecimal.ZERO);
outsideVehiclesService.updateById(currentGoodsVehicle); outsideVehiclesService.updateById(currentGoodsVehicle);
// 已经分配的数量 // // 已经分配的数量
BigDecimal distributedNum = workConfirmRequest.getRemainNumOrigin().subtract(workConfirmRequest.getRemainNumReal()); // BigDecimal distributedNum = workConfirmRequest.getRemainNumOrigin().subtract(workConfirmRequest.getRemainNumReal());
// 将当前物料的所有goodsToStation // // 将当前物料的所有goodsToStation
List<GoodsToStation> goodsToStations = goodsToStationService.list(new LambdaQueryWrapper<GoodsToStation>() // List<GoodsToStation> goodsToStations = goodsToStationService.list(new LambdaQueryWrapper<GoodsToStation>()
.eq(GoodsToStation::getGoodsId, currentGoodsVehicle.getGoodsId())); // .eq(GoodsToStation::getGoodsId, currentGoodsVehicle.getGoodsId()));
List<GoodsToStation> updatedGoodsToStationList = new ArrayList<>(); // List<GoodsToStation> updatedGoodsToStationList = new ArrayList<>();
for (GoodsToStation goodsToStation : goodsToStations) { // for (GoodsToStation goodsToStation : goodsToStations) {
if (distributedNum.compareTo(BigDecimal.ZERO) > 0) { // if (distributedNum.compareTo(BigDecimal.ZERO) > 0) {
// 查询这个料对应的当前站台未完成工作流 // // 查询这个料对应的当前站台未完成工作流
List<WorkFlow> workFlows = workFlowService.list(new LambdaQueryWrapper<WorkFlow>() // List<WorkFlow> workFlows = workFlowService.list(new LambdaQueryWrapper<WorkFlow>()
.eq(WorkFlow::getWorkStation, goodsToStation.getWorkStation()) // .eq(WorkFlow::getWorkStation, goodsToStation.getWorkStation())
.eq(WorkFlow::getGoodsId, goodsToStation.getGoodsId()) // .eq(WorkFlow::getGoodsId, goodsToStation.getGoodsId())
.eq(WorkFlow::getWorkStatus, 1)); // .eq(WorkFlow::getWorkStatus, 1));
BigDecimal recallNum = BigDecimal.ZERO; // BigDecimal recallNum = BigDecimal.ZERO;
for (WorkFlow workFlow : workFlows) { // for (WorkFlow workFlow : workFlows) {
// 分配数量无了 // // 分配数量无了
if (distributedNum.compareTo(BigDecimal.ZERO) <= 0) { // if (distributedNum.compareTo(BigDecimal.ZERO) <= 0) {
break; // break;
} // }
BigDecimal needNum = workFlow.getNeedNum().subtract(workFlow.getPickedNum()); // BigDecimal needNum = workFlow.getNeedNum().subtract(workFlow.getPickedNum());
if (needNum.compareTo(BigDecimal.ZERO) > 0) { // if (needNum.compareTo(BigDecimal.ZERO) > 0) {
recallNum = recallNum.add(needNum); // recallNum = recallNum.add(needNum);
distributedNum = distributedNum.subtract(needNum); // distributedNum = distributedNum.subtract(needNum);
} // }
} // }
if (recallNum.compareTo(BigDecimal.ZERO) >0) { // if (recallNum.compareTo(BigDecimal.ZERO) >0) {
goodsToStation.setDistributedNum(goodsToStation.getDistributedNum().subtract(recallNum)); // goodsToStation.setDistributedNum(goodsToStation.getDistributedNum().subtract(recallNum));
goodsToStation.setDistributeStatus(1); // goodsToStation.setDistributeStatus(1);
updatedGoodsToStationList.add(goodsToStation); // updatedGoodsToStationList.add(goodsToStation);
} // }
} // }
} // }
// 更新站台要料表 // // 更新站台要料表
if (!updatedGoodsToStationList.isEmpty()) { // if (!updatedGoodsToStationList.isEmpty()) {
goodsToStationService.updateBatchById(updatedGoodsToStationList); // goodsToStationService.updateBatchById(updatedGoodsToStationList);
} // }
} }
} else { } else {
// 更新流转载具表剩余数量 // 更新流转载具表剩余数量
@ -1526,6 +1516,7 @@ public class TaskController {
} else { } else {
// 存储拣选记录 // 存储拣选记录
PickTaskRecord pickTaskRecord = BeanUtil.copyProperties(pickTask, PickTaskRecord.class); PickTaskRecord pickTaskRecord = BeanUtil.copyProperties(pickTask, PickTaskRecord.class);
pickTaskRecord.setPickTaskId(generateId(pickTaskRecord.getPickTaskId()));
pickTaskRecord.setLastUpdateTime(LocalDateTime.now()); pickTaskRecord.setLastUpdateTime(LocalDateTime.now());
pickTaskRecordService.save(pickTaskRecord); pickTaskRecordService.save(pickTaskRecord);
// 删除当前拣选任务 // 删除当前拣选任务
@ -1564,6 +1555,7 @@ public class TaskController {
} else { } else {
// 存储拣选记录 // 存储拣选记录
PickTaskRecord pickTaskRecord = BeanUtil.copyProperties(pickTask, PickTaskRecord.class); PickTaskRecord pickTaskRecord = BeanUtil.copyProperties(pickTask, PickTaskRecord.class);
pickTaskRecord.setPickTaskId(generateId(pickTaskRecord.getPickTaskId()));
pickTaskRecord.setLastUpdateTime(LocalDateTime.now()); pickTaskRecord.setLastUpdateTime(LocalDateTime.now());
pickTaskRecordService.save(pickTaskRecord); pickTaskRecordService.save(pickTaskRecord);
// 删除当前拣选任务 // 删除当前拣选任务
@ -1701,6 +1693,7 @@ public class TaskController {
} else { } else {
// 存储拣选记录 // 存储拣选记录
PickTaskRecord pickTaskRecord = BeanUtil.copyProperties(pickTask, PickTaskRecord.class); PickTaskRecord pickTaskRecord = BeanUtil.copyProperties(pickTask, PickTaskRecord.class);
pickTaskRecord.setPickTaskId(generateId(pickTaskRecord.getPickTaskId()));
pickTaskRecord.setLastUpdateTime(LocalDateTime.now()); pickTaskRecord.setLastUpdateTime(LocalDateTime.now());
pickTaskRecordService.save(pickTaskRecord); pickTaskRecordService.save(pickTaskRecord);
// 删除当前拣选任务 // 删除当前拣选任务
@ -1736,6 +1729,7 @@ public class TaskController {
} else { } else {
// 存储拣选记录 // 存储拣选记录
PickTaskRecord pickTaskRecord = BeanUtil.copyProperties(pickTask, PickTaskRecord.class); PickTaskRecord pickTaskRecord = BeanUtil.copyProperties(pickTask, PickTaskRecord.class);
pickTaskRecord.setPickTaskId(generateId(pickTaskRecord.getPickTaskId()));
pickTaskRecord.setLastUpdateTime(LocalDateTime.now()); pickTaskRecord.setLastUpdateTime(LocalDateTime.now());
pickTaskRecordService.save(pickTaskRecord); pickTaskRecordService.save(pickTaskRecord);
// 删除当前拣选任务 // 删除当前拣选任务

View File

@ -0,0 +1,18 @@
package com.wms.entity.app.request;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 大盒子查询请求
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class BigBoxQuery extends PageQuery{
/**
* 站台号
*/
@JsonProperty
private String standId;
}

View File

@ -0,0 +1,23 @@
package com.wms.entity.app.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
@Data
public class BigBoxVo {
/**
* 站台号
*/
@JsonProperty("standId")
private String standId;
/**
* 大盒子号
*/
@JsonProperty("bigBoxNo")
private String bigBoxNo;
/**
* 盒子数量
*/
@JsonProperty("boxQuantity")
private Integer boxQuantity;
}