修复库位随机送,变成优先送内层,最后送外层

liweidong
绫Umbrella 1 month ago
parent 06d2df67a1
commit b184306558
  1. 5
      blade-service/blade-desk/src/main/java/org/springblade/desk/logistics/controller/OrderBindController.java
  2. 23
      blade-service/blade-desk/src/main/java/org/springblade/desk/logistics/service/impl/IOrderBoxServiceImpl.java
  3. 18
      blade-service/blade-desk/src/test/java/org/springblade/desk/quality/service/LiquidTankTaskServiceTest.java

@ -82,11 +82,6 @@ public class OrderBindController {
return iOrderBindService.getBoxcodelist(); return iOrderBindService.getBoxcodelist();
} }
@GetMapping("/demo")
@ApiOperationSupport(order = 6)
public R demo(@RequestParam String boxCode) throws BusinessException {
return iOrderBoxService.getWcId(boxCode);
}
} }

@ -700,12 +700,23 @@ public class IOrderBoxServiceImpl implements IOrderBoxService {
} }
// 2. 尝试分配空闲库位 // 2. 尝试分配空闲库位
List<Location> freeLocationList = locationService.list( List<Location> freeLocationList = null;
new LambdaQueryWrapper<Location>() QueryWrapper<Location> wrapper2 = new QueryWrapper<Location>()
.ne(Location::getStatus, ORIGINAL_RACK) .ne("status", ORIGINAL_RACK)
.eq(Location::getLocationStatus, STATUS_FREE) .eq("location_status", STATUS_FREE)
.orderByDesc((sql -> "RIGHT(LOCATION_CODE, 1) = '2'") .apply("SUBSTR(LOCATION_CODE, -1) = '2'");
)); List<Location> list2 = locationService.list(wrapper2);
if (!list2.isEmpty()) {
// 优先返回尾号为2的位置
freeLocationList = list2;
} else {
// 无尾号2的,查询所有符合条件的空闲位置
freeLocationList = locationService.list(
new QueryWrapper<Location>()
.ne("status", ORIGINAL_RACK)
.eq("location_status", STATUS_FREE)
);
}
if (!CollectionUtils.isEmpty(freeLocationList)) { if (!CollectionUtils.isEmpty(freeLocationList)) {
Location location = freeLocationList.get(0); Location location = freeLocationList.get(0);
task.setLocationId(location.getId()); task.setLocationId(location.getId());

@ -1,15 +1,29 @@
package org.springblade.desk.quality.service; package org.springblade.desk.quality.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springblade.desk.logistics.pojo.entity.Location;
import org.springblade.desk.logistics.service.ILocationService;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import java.util.List;
import static org.springblade.desk.logistics.pojo.entity.Location.ORIGINAL_RACK;
import static org.springblade.desk.logistics.pojo.entity.Station.STATUS_FREE;
@SpringBootApplication @SpringBootApplication
class LiquidTankTaskServiceTest { class LiquidTankTaskServiceTest {
@Resource @Resource
private LiquidTankTaskService222 liquidTankTaskService; private ILocationService locationService;
void contextLoads() { void contextLoads() {
List<Location> freeLocationList = locationService.list(
new LambdaQueryWrapper<Location>()
.ne(Location::getStatus, ORIGINAL_RACK)
.eq(Location::getLocationStatus, STATUS_FREE)
.orderByDesc((sql -> "RIGHT(LOCATION_CODE, 1) = '2'")
));
System.out.println(freeLocationList);
} }
} }

Loading…
Cancel
Save