diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/TaskExecutor.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/TaskExecutor.java index 10ec572a..37839593 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/TaskExecutor.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/TaskExecutor.java @@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import java.math.BigDecimal; import java.util.*; @@ -164,7 +165,6 @@ public class TaskExecutor { return wcsStackerTaskReq; } - @Transactional public void completeWmsTask() { //completeNormalTask(); completeNormalInTask(); // 通常入库任务 @@ -376,6 +376,7 @@ public class TaskExecutor { AppStock appStockCheck = new AppStock(); appStockCheck.setLocationId(task.getOrigin()); List appStockCheckData = appStockService.selectAppStockList(appStockCheck); + logger.info("剩余库存条目{}",appStockCheckData.size()); if(appStockCheckData == null) { return; } @@ -384,17 +385,23 @@ public class TaskExecutor { AppLocation location = new AppLocation(); location.setLocationId(task.getOrigin()); location.setLocationStatus(0); - appLocationMapper.updateAppLocation(location); + appLocationMapper.updateLocationByLocationId(location); } } else { // 如果小于的话就属于捡货任务 // 删除库存内的绑定的库位号,释放库位 + AppStock appStock = new AppStock(); + appStock.setLocationId(task.getOrigin()); + List appStocks = appStockService.selectAppStockList(appStock); + if (CollectionUtils.isEmpty(appStocks)) { + continue; + } int updateNewLocation = appStockService.updateNewLocation(task.getOrigin(), ""); logger.info("捡选出库清除库存绑定的货位,数据:{},清除结果:{}", JSON.toJSONString(task), updateNewLocation); AppLocation location = new AppLocation(); location.setLocationId(task.getOrigin()); location.setLocationStatus(0); - appLocationMapper.updateAppLocation(location); + appLocationMapper.updateLocationByLocationId(location); } return; } @@ -491,7 +498,7 @@ public class TaskExecutor { AppLocation location = new AppLocation(); location.setLocationId(task.getOrigin()); location.setLocationStatus(0); - appLocationMapper.updateAppLocation(location); + appLocationMapper.updateLocationByLocationId(location); AppTask updateRemark = new AppTask(); updateRemark.setTaskId(task.getTaskId()); diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppLocationMapper.java b/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppLocationMapper.java index 9002ea46..4e8747dd 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppLocationMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppLocationMapper.java @@ -52,6 +52,8 @@ public interface AppLocationMapper */ int updateAppLocation(AppLocation appLocation); + + int updateLocationByLocationId(AppLocation appLocation); /** * 删除【请填写功能名称】 * diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppStockMapper.java b/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppStockMapper.java index 8e8e995e..6682f44d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppStockMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppStockMapper.java @@ -1,6 +1,7 @@ package com.ruoyi.app.mapper; import com.ruoyi.app.domain.AppStock; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -60,10 +61,10 @@ public interface AppStockMapper */ public int deleteAppStockByStockIds(String[] stockIds); - public int updateNewLocation(String oldLocation, String newLocation); + public int updateNewLocation(@Param("oldLocation") String oldLocation,@Param("newLocation") String newLocation); List selectStockByGoodsId(AppStock appStock); int updateSts(AppStock appStock); - int updateLocationWithVehicleId(String vehicleId, String location); + int updateLocationWithVehicleId(@Param("vehicleId") String vehicleId,@Param("location") String location); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/service/impl/AppLocationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/app/service/impl/AppLocationServiceImpl.java index edb024e3..aee27075 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/app/service/impl/AppLocationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/app/service/impl/AppLocationServiceImpl.java @@ -172,7 +172,7 @@ public class AppLocationServiceImpl implements IAppLocationService { location.setLocationId(locationId); location.setLocationStatus(1); //更新库位为任务中 - int i = appLocationMapper.updateAppLocation(location); + int i = appLocationMapper.updateLocationByLocationId(location); if (i == 0) { throw new RuntimeException("库位更新失败"); } diff --git a/ruoyi-system/src/main/resources/mapper/app/AppLocationMapper.xml b/ruoyi-system/src/main/resources/mapper/app/AppLocationMapper.xml index 81172562..8595fd38 100644 --- a/ruoyi-system/src/main/resources/mapper/app/AppLocationMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/app/AppLocationMapper.xml @@ -204,6 +204,30 @@ where id = #{id} + + + update app_location + + location_type = #{locationType}, + location_status = #{locationStatus}, + outer_id = #{outerId}, + area_id = #{areaId}, + tunnel_id = #{tunnelId}, + equipment_id = #{equipmentId}, + w_row = #{wRow}, + w_col = #{wCol}, + w_layer = #{wLayer}, + w_depth = #{wDepth}, + is_lock = #{isLock}, + vehicle_id = #{vehicleId}, + remark = #{remark}, + is_working = #{isWorking}, + is_enable = #{isEnable}, + + where location_id = #{locationId} + + + delete from app_location