添加出库或移库完成后释放货位

This commit is contained in:
葛林强 2025-03-06 09:02:59 +08:00
parent 18846446cb
commit 05652eb896

View File

@ -2,6 +2,7 @@ package com.ruoyi.quartz.task;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.ruoyi.app.domain.*; import com.ruoyi.app.domain.*;
import com.ruoyi.app.mapper.AppLocationMapper;
import com.ruoyi.quartz.domain.app.*; import com.ruoyi.quartz.domain.app.*;
import com.ruoyi.app.service.*; import com.ruoyi.app.service.*;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
@ -43,6 +44,8 @@ public class TaskExecutor {
put(2, 2);// 出库 put(2, 2);// 出库
put(3, 3);// 移库 put(3, 3);// 移库
}}; }};
@Autowired
private AppLocationMapper appLocationMapper;
/** /**
* 解析wms任务 * 解析wms任务
@ -307,6 +310,19 @@ public class TaskExecutor {
PmsCommonRes pmsCommonRes = JSON.parseObject(HttpUtils.sendPost(url, JSON.toJSONString(recordList)), PmsCommonRes.class); PmsCommonRes pmsCommonRes = JSON.parseObject(HttpUtils.sendPost(url, JSON.toJSONString(recordList)), PmsCommonRes.class);
logger.info("pms出库反馈请求信息{},结果:{}", JSON.toJSONString(recordList), JSON.toJSONString(pmsCommonRes)); logger.info("pms出库反馈请求信息{},结果:{}", JSON.toJSONString(recordList), JSON.toJSONString(pmsCommonRes));
} }
AppStock appStockCheck = new AppStock();
appStockCheck.setLocationId(task.getOrigin());
List<AppStock> appStockCheckData = appStockService.selectAppStockList(appStockCheck);
if(appStockCheckData == null) {
return;
}
if(appStockCheckData.isEmpty()) {
// 这个位置没有库存了直接释放货位
AppLocation location = new AppLocation();
location.setLocationId(task.getOrigin());
location.setLocationStatus(0);
appLocationMapper.updateAppLocation(location);
}
} }
// 如果小于的话就不做处理 // 如果小于的话就不做处理
return; return;
@ -314,6 +330,12 @@ public class TaskExecutor {
if (task.getTaskType().compareTo(9) == 0) { // 移库任务 if (task.getTaskType().compareTo(9) == 0) { // 移库任务
int updateNewLocation = appStockService.updateNewLocation(task.getOrigin(), task.getDestination()); int updateNewLocation = appStockService.updateNewLocation(task.getOrigin(), task.getDestination());
if(updateNewLocation > 0) { if(updateNewLocation > 0) {
// 释放原库位
AppLocation location = new AppLocation();
location.setLocationId(task.getOrigin());
location.setLocationStatus(0);
appLocationMapper.updateAppLocation(location);
AppTask updateRemark = new AppTask(); AppTask updateRemark = new AppTask();
updateRemark.setTaskId(task.getTaskId()); updateRemark.setTaskId(task.getTaskId());
updateRemark.setRemark("移库完成"); updateRemark.setRemark("移库完成");