添加捡货回库相关逻辑

This commit is contained in:
葛林强 2025-03-07 09:25:12 +08:00
parent f9ca2384c8
commit ef140156fe
6 changed files with 99 additions and 1 deletions

View File

@ -273,6 +273,55 @@ public class AppTaskController extends BaseController
ObjectUtil.isEmpty(wcsStackerTask.getVehicleNo())){
return error("缺少请求数据");
}
// 检查是不是有库存有库存并且货位是空的是捡货完回库的
AppStock appStock = new AppStock();
appStock.setVehicleId(wcsStackerTask.getVehicleNo());
appStock.setLocationId("");
List<AppStock> appStocks = appStockService.selectAppStockList(appStock);
if(appStocks == null){
return error("数据服务异常");
}
if(!appStocks.isEmpty()){
AppTask appTask = new AppTask();
appTask.setVehicleId(wcsStackerTask.getVehicleNo());
AppTask appTask2 = new AppTask();
BeanUtils.copyProperties(wcsStackerTask, appTask2);
appTask2.setTaskId("RK"+System.currentTimeMillis());
appTask2.setWcsTaskId("RK"+System.currentTimeMillis());
appTask2.setTaskStatus(1);
appTask2.setTaskType(1);
appTask2.setOrigin(wcsStackerTask.getPoint());
appTask2.setTaskPriority(1);
String location = appLocationService.sendLocation();
appTask2.setDestination(location);
appTask2.setVehicleId(wcsStackerTask.getVehicleNo());
int i1 = appTaskService.insertAppTask(appTask2);
if(i1 == 0 ){
return error("wms生成入库任务异常");
}
AppWcsTask appTask1 = new AppWcsTask();
BeanUtils.copyProperties(wcsStackerTask, appTask);
appTask1.setWcsTaskId(appTask2.getTaskId());
appTask1.setWcsTaskStatus(1);
appTask1.setWcsTaskType(appTask2.getTaskType());
appTask1.setOrigin("101");
appTask1.setTaskPriority(appTask2.getTaskPriority());
appTask1.setDestination(location);
appTask1.setSendTime(new Date());
appTask1.setVehicleId(appTask2.getVehicleId());
int i = appWcsTaskService.insertAppWcsTask(appTask1);
if(i == 0 ){
return error("wcs生成入库任务异常");
}
WcsDate wcsDate = new WcsDate();
wcsDate.setTaskId(appTask2.getTaskId());
wcsDate.setUser("WMS");
wcsDate.setVehicleNo(wcsStackerTask.getVehicleNo());
wcsDate.setDestination(location);
return success(wcsDate);
}
// 没有库存表示可能是新入库的
AppPendingStorage appPendingStorage = new AppPendingStorage();
appPendingStorage.setVehicleNo(wcsStackerTask.getVehicleNo());
List<AppPendingStorage> appPendingStorages = appPendingStorageService.selectAppPendingStorageList(appPendingStorage);
@ -863,7 +912,7 @@ public class AppTaskController extends BaseController
}
}
/**
* 请求出库
* @param outRequest 出库请求

View File

@ -184,6 +184,41 @@ public class TaskExecutor {
return;
}
for (AppTask task : appTasks) {
// 检查是否存在库存
AppStock appStockCheck = new AppStock();
appStockCheck.setVehicleId(task.getVehicleId());
List<AppStock> appStocks = appStockService.selectAppStockList(appStockCheck);
if (appStocks == null) {
continue;
}
if (!appStocks.isEmpty()) { // 存在库存可能是回库任务
int updateLocationWithVehicleId = appStockService.updateLocationWithVehicleId(task.getVehicleId(), task.getDestination());
logger.info("重新回库更新库存成功,更新条数:{}", updateLocationWithVehicleId);
AppTask updateRemark = new AppTask();
updateRemark.setTaskId(task.getTaskId());
updateRemark.setRemark("已更新库存库位");
appTaskService.updateAppTask(updateRemark); // 更新备注信息
AppTaskBak appTaskBak = new AppTaskBak();
appTaskBak.setTaskId(task.getTaskId());
appTaskBak.setTaskStatus(task.getTaskStatus());
appTaskBak.setRemark(updateRemark.getRemark());
appTaskBak.setTaskType(task.getTaskType());
appTaskBak.setTaskPriority(task.getTaskPriority());
appTaskBak.setVehicleId(task.getVehicleId());
appTaskBak.setOrigin(task.getOrigin());
appTaskBak.setDestination(task.getDestination());
appTaskBak.setWcsTaskId(task.getWcsTaskId());
appTaskBak.setFinishTime(task.getFinishTime());
appTaskBak.setGoodsId(task.getGoodsId());
appTaskBak.setOpNum(task.getOpNum());
appTaskBak.setStockNum(task.getStockNum());
appTaskBak.setOpUser(task.getOpUser());
appTaskBak.setPreTask(task.getPreTask());
logger.info("入库任务数据归档成功(回库)。{}", JSON.toJSONString(appTaskBak));
appTaskBakService.insertAppTaskBak(appTaskBak);// 数据归档
appTaskService.deleteAppTaskByTaskId(task.getTaskId()); // 删除旧数据
return;
}
// 从码盘表内拉出数据
AppPendingStorage appPendingStorage = new AppPendingStorage();
appPendingStorage.setVehicleNo(task.getVehicleId());

View File

@ -64,4 +64,6 @@ public interface AppStockMapper
List<AppStock> selectStockByGoodsId(AppStock appStock);
int updateSts(AppStock appStock);
int updateLocationWithVehicleId(String vehicleId, String location);
}

View File

@ -62,6 +62,9 @@ public interface IAppStockService
public int updateNewLocation(String oldLocation, String newLocation);
int updateLocationWithVehicleId(String vehicleId, String location);
List<AppStock> selectStockByGoodsId(AppStock tMiStock);
int updateSts(AppStock tMiStock3);

View File

@ -98,6 +98,12 @@ public class AppStockServiceImpl implements IAppStockService
public int updateNewLocation(String oldLocation, String newLocation) {
return appStockMapper.updateNewLocation(oldLocation,newLocation);
}
@Override
public int updateLocationWithVehicleId(String vehicleId, String location) {
return appStockMapper.updateLocationWithVehicleId(vehicleId,location);
}
@Override
public List<AppStock> selectStockByGoodsId(AppStock appStock) {
return appStockMapper.selectStockByGoodsId(appStock);

View File

@ -169,6 +169,9 @@
<update id="updateNewLocation">
update app_stock set location_id = #{newLocation} where location_id = #{oldLocation}
</update>
<update id="updateLocationWithVehicleId">
update app_stock set location_id = #{location} where vehicle_id = #{vehicleId}
</update>
<delete id="deleteAppStockByStockId" parameterType="String">
delete from app_stock where stock_id = #{stockId}