1. 增加fifo控制配置
2. 增加异常信息捕获
This commit is contained in:
parent
64546c8c6f
commit
a7d616fcb7
|
|
@ -39,7 +39,8 @@ public enum ConfigMapKeyEnum {
|
|||
RATE_TYPE("RATE_TYPE"),
|
||||
USE_REQUIRE_DATE("USE_REQUIRE_DATE"),// 是否使用需求时间
|
||||
USE_DEFAULT_ADJUST("USE_DEFAULT_ADJUST"),// 使用默认调整天数
|
||||
START_DATE_ADJUST("START_DATE_ADJUST");// 开工日期调整天数
|
||||
START_DATE_ADJUST("START_DATE_ADJUST"),// 开工日期调整天数
|
||||
FIFO_CONTROL("FIFO_CONTROL");// fifo控制
|
||||
private final String configKey;
|
||||
ConfigMapKeyEnum(String configKey) {
|
||||
this.configKey = configKey;
|
||||
|
|
|
|||
|
|
@ -11,8 +11,12 @@ import com.wms.entity.app.dto.PageDto;
|
|||
import com.wms.entity.app.request.StandQuery;
|
||||
import com.wms.entity.app.vo.StandVo;
|
||||
import com.wms.entity.app.wcs.DdjStatusChangeRequest;
|
||||
import com.wms.entity.table.PickTask;
|
||||
import com.wms.entity.table.Stand;
|
||||
import com.wms.entity.table.WorkFlow;
|
||||
import com.wms.service.PickTaskService;
|
||||
import com.wms.service.StandService;
|
||||
import com.wms.service.WorkFlowService;
|
||||
import com.wms.utils.HttpUtils;
|
||||
import com.wms.utils.StringUtils;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
|
@ -45,6 +49,14 @@ public class StandController {
|
|||
* 站台服务
|
||||
*/
|
||||
private final StandService standService;
|
||||
/**
|
||||
* 拣选任务服务
|
||||
*/
|
||||
private final PickTaskService pickTaskService;
|
||||
/**
|
||||
* 工作流服务
|
||||
*/
|
||||
private final WorkFlowService workFlowService;
|
||||
/**
|
||||
* 请求头部信息
|
||||
*/
|
||||
|
|
@ -137,6 +149,58 @@ public class StandController {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询站台错误信息
|
||||
*/
|
||||
@PostMapping("/getStandErrMsg")
|
||||
@ResponseBody
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String getStandErrMsg(@RequestBody StandQuery standQuery){
|
||||
ResponseEntity response = new ResponseEntity();
|
||||
try {
|
||||
if (StringUtils.isEmpty(standQuery.getStandId())) {
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
response.setMessage("请求中缺少站台号,返回空。");
|
||||
response.setReturnData("");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
// 查询对应站台的信息
|
||||
Stand stand = standService.getById(standQuery.getStandId());
|
||||
if (StringUtils.isNotEmpty(stand.getErrMsg())) {
|
||||
// 查询该站台的拣选任务
|
||||
List<PickTask> pickTasks = pickTaskService.list(new LambdaQueryWrapper<PickTask>()
|
||||
.eq(PickTask::getStandId, stand.getStandId()));
|
||||
// 判断该站台是否存在未完成的工作流
|
||||
boolean exsitDoingWorkFlow = workFlowService.exists(new LambdaQueryWrapper<WorkFlow>()
|
||||
.eq(WorkFlow::getWorkStation, stand.getStandId())
|
||||
.ne(WorkFlow::getWorkStatus, 2));
|
||||
if (!exsitDoingWorkFlow || !pickTasks.isEmpty()) {
|
||||
// 未在工作或有拣选任务,消除报错信息
|
||||
standService.update(new LambdaUpdateWrapper<Stand>()
|
||||
.set(Stand::getErrMsg, ""));
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
response.setMessage("站台存在拣选任务,不检查报错信息。");
|
||||
response.setReturnData("");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
response.setCode(ResponseCode.WARNING.getCode());
|
||||
response.setMessage("站台存在报警信息。");
|
||||
response.setReturnData(stand.getErrMsg());
|
||||
} else {
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
response.setMessage("无错误信息。");
|
||||
response.setReturnData("");
|
||||
}
|
||||
return convertJsonString(response);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("查询站台报错信息发生异常");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 一键切换至创建工作状态
|
||||
*
|
||||
|
|
|
|||
|
|
@ -107,4 +107,9 @@ public class StandVo {
|
|||
*/
|
||||
@JsonProperty("allowMg")
|
||||
private Integer allowMg;
|
||||
/**
|
||||
* 报错信息
|
||||
*/
|
||||
@JsonProperty("errMsg")
|
||||
private String errMsg;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,4 +106,9 @@ public class Stand {
|
|||
*/
|
||||
@TableField("allow_mg")
|
||||
private Integer allowMg;
|
||||
/**
|
||||
* 报错信息
|
||||
*/
|
||||
@TableField("err_msg")
|
||||
private String errMsg;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -265,7 +265,6 @@ public class WorkServiceImplements implements IWorkService {
|
|||
.in(KateOrders::getSupplyArea, smallBoxes)
|
||||
.eq(KateOrders::getOrderStatus, 1));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("执行站台:{}工作发生异常:{}", workStation, e.getMessage());
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
|
|
@ -282,6 +281,8 @@ public class WorkServiceImplements implements IWorkService {
|
|||
String max_vehicle_nums_before = configMap.get(ConfigMapKeyEnum.MAX_VEHICLE_BEFORE.getConfigKey());
|
||||
String max_vehicle_nums_after = configMap.get(ConfigMapKeyEnum.MAX_VEHICLE_AFTER.getConfigKey());
|
||||
String max_stand_vehicle_nums = configMap.get(ConfigMapKeyEnum.MAX_STAND_VEHICLE_NUMS.getConfigKey());
|
||||
String fifoControl = configMap.get(ConfigMapKeyEnum.FIFO_CONTROL.getConfigKey());
|
||||
boolean fifoControlFlag = "1".equals(fifoControl);
|
||||
if (!"1".equals(configMap.get(ConfigMapKeyEnum.SAME_AREA.getConfigKey()))) {
|
||||
if (StringUtils.isEmpty(max_vehicle_nums) || StringUtils.isEmpty(max_stand_vehicle_nums)) {
|
||||
logger.info("允许不同区域时配置未生成。");
|
||||
|
|
@ -378,13 +379,15 @@ public class WorkServiceImplements implements IWorkService {
|
|||
List<Stock> allStockList = stockService.list();
|
||||
// 第一次循环,分出已经出库的物料。
|
||||
Map<String, Integer> outedGoodsIdMap = new HashMap<>();
|
||||
for (Stock stock : allStockList) {
|
||||
if (Objects.equals(stock.getStockStatus(), StockStatus.OK.getCode()) || Objects.equals(stock.getStockStatus(), StockStatus.BACK.getCode()) || Objects.equals(stock.getStockStatus(), StockStatus.LOCK.getCode())) {
|
||||
continue;
|
||||
}
|
||||
String goodsId = stock.getGoodsRelated().getGoodsId();
|
||||
if (!outedGoodsIdMap.containsKey(goodsId)) {
|
||||
outedGoodsIdMap.put(goodsId, 1);
|
||||
if (fifoControlFlag) {
|
||||
for (Stock stock : allStockList) {
|
||||
if (Objects.equals(stock.getStockStatus(), StockStatus.OK.getCode()) || Objects.equals(stock.getStockStatus(), StockStatus.BACK.getCode()) || Objects.equals(stock.getStockStatus(), StockStatus.LOCK.getCode())) {
|
||||
continue;
|
||||
}
|
||||
String goodsId = stock.getGoodsRelated().getGoodsId();
|
||||
if (!outedGoodsIdMap.containsKey(goodsId)) {
|
||||
outedGoodsIdMap.put(goodsId, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 查询出当前所有的出库任务(拣选)
|
||||
|
|
@ -414,14 +417,20 @@ public class WorkServiceImplements implements IWorkService {
|
|||
// 只允许在库库存操作
|
||||
continue;
|
||||
}
|
||||
// 这个载具本次不允许出库
|
||||
if (thisTimeCannotOutVehicleIds.contains(stock.getVehicleId())) {
|
||||
continue;
|
||||
}
|
||||
// 同一物料同一时间只能在外面一个箱子
|
||||
if (outedGoodsIdMap.containsKey(stock.getGoodsRelated().getGoodsId())) {
|
||||
thisTimeCannotOutVehicleIds.add(stock.getVehicleId());
|
||||
continue;
|
||||
if (fifoControlFlag) {
|
||||
// 这个载具本次不允许出库
|
||||
if (thisTimeCannotOutVehicleIds.contains(stock.getVehicleId())) {
|
||||
continue;
|
||||
}
|
||||
// 同一物料同一时间只能在外面一个箱子
|
||||
if (outedGoodsIdMap.containsKey(stock.getGoodsRelated().getGoodsId())) {
|
||||
// 更新信息
|
||||
standService.update(new LambdaUpdateWrapper<Stand>()
|
||||
.set(Stand::getErrMsg, "载具号:" + stock.getVehicleId() + "物料号:" + stock.getGoodsRelated().getGoodsId() + "存在其他箱子干涉。")
|
||||
.eq(Stand::getStandId, standId));
|
||||
thisTimeCannotOutVehicleIds.add(stock.getVehicleId());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// 如果载具在本次出库的载具列表中,那么修改库存状态
|
||||
if (thisTimeOutVehicleIds.contains(stock.getVehicleId())) {
|
||||
|
|
@ -692,6 +701,7 @@ public class WorkServiceImplements implements IWorkService {
|
|||
}
|
||||
}
|
||||
List<WorkFlow> needUpdateWorkFlowList = new ArrayList<>();
|
||||
List<PickTask> allPickTaskList = pickTaskService.list();
|
||||
for (WorkFlow workFlow : unfinishedWorkFlowList) {
|
||||
if (workFlow.getPickedNum().compareTo(workFlow.getNeedNum()) >= 0) {
|
||||
// 实际已经完成但未标记为完成的工作流
|
||||
|
|
@ -717,6 +727,20 @@ public class WorkServiceImplements implements IWorkService {
|
|||
// 更新已分配数量
|
||||
workFlow.setDistributedNum(workFlow.getPickedNum());
|
||||
needUpdateWorkFlowList.add(workFlow);
|
||||
continue;
|
||||
}
|
||||
// 没有在库但是有非在库时
|
||||
if (!onStockGoodsIdToVehicleIdsMap.containsKey(workFlow.getGoodsId()) && notOnStockGoodsIdToVehicleIdsMap.containsKey(workFlow.getGoodsId())) {
|
||||
// 判断这些箱子是否存在去这个站台的拣选任务
|
||||
List<PickTask> pickTaskList = allPickTaskList.stream()
|
||||
.filter(pickTask -> notOnStockGoodsIdToVehicleIdsMap.get(workFlow.getGoodsId()).contains(pickTask.getVehicleId()))
|
||||
.toList();
|
||||
if (pickTaskList.isEmpty() || pickTaskList.stream().map(PickTask::getStandId).distinct().toList().isEmpty()) {
|
||||
// 料箱异常,标记
|
||||
standService.update(new LambdaUpdateWrapper<Stand>()
|
||||
.set(Stand::getErrMsg, "物料号:" + workFlow.getGoodsId() + "存在异常。")
|
||||
.eq(Stand::getStandId, workFlow.getWorkStation()));
|
||||
}
|
||||
}
|
||||
}
|
||||
// 更新工作流
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user