修复更新库位错误

This commit is contained in:
陆一凡 2025-03-07 17:58:17 +08:00
parent 3c454c112c
commit 2c0f6d5bec
5 changed files with 41 additions and 7 deletions

View File

@ -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<AppStock> 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<AppStock> 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());

View File

@ -52,6 +52,8 @@ public interface AppLocationMapper
*/
int updateAppLocation(AppLocation appLocation);
int updateLocationByLocationId(AppLocation appLocation);
/**
* 删除请填写功能名称
*

View File

@ -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<AppStock> selectStockByGoodsId(AppStock appStock);
int updateSts(AppStock appStock);
int updateLocationWithVehicleId(String vehicleId, String location);
int updateLocationWithVehicleId(@Param("vehicleId") String vehicleId,@Param("location") String location);
}

View File

@ -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("库位更新失败");
}

View File

@ -204,6 +204,30 @@
where id = #{id}
</update>
<update id="updateLocationByLocationId" parameterType="AppLocation">
update app_location
<trim prefix="SET" suffixOverrides=",">
<if test="locationType != null">location_type = #{locationType},</if>
<if test="locationStatus != null">location_status = #{locationStatus},</if>
<if test="outerId != null">outer_id = #{outerId},</if>
<if test="areaId != null">area_id = #{areaId},</if>
<if test="tunnelId != null">tunnel_id = #{tunnelId},</if>
<if test="equipmentId != null">equipment_id = #{equipmentId},</if>
<if test="wRow != null">w_row = #{wRow},</if>
<if test="wCol != null">w_col = #{wCol},</if>
<if test="wLayer != null">w_layer = #{wLayer},</if>
<if test="wDepth != null">w_depth = #{wDepth},</if>
<if test="isLock != null">is_lock = #{isLock},</if>
<if test="vehicleId != null">vehicle_id = #{vehicleId},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="isWorking != null">is_working = #{isWorking},</if>
<if test="isEnable != null">is_enable = #{isEnable},</if>
</trim>
where location_id = #{locationId}
</update>
<delete id="deleteAppLocationById" parameterType="String">
delete
from app_location