role: user

type: text

text:
<user_query>
I need to find the following in the codebase at /Users/kazusa/IdeaProjects/baoshi/wms/:

1. Find and read the MachineTaskChainDTO class - search for it in baoshi-api or baoshi-common-data modules
2. Find and read the BasicEntity base class
3. Find examples of QO (Query Object) classes used for admin page queries - look for classes ending in "QO" and show a few examples of their structure
4. Find examples of existing admin controllers that implement page/list queries to understand the pattern
5. Find the ResultsVO class and read it
6. Find and read the BasePage class
7. Find and read the PageResult class
8. Find the ElevatorLoadBalancer class and read it to understand elevator management methods

Return all file contents found.
</user_query>


role: assistant

text: 并行搜索这些类和相关文件。


text: 读取找到的文件内容：


text: 读取 BasePage 类和几个 QO 类示例：


text: 查看 QO 类的基类：


text: 读取 BaseQueryQO 和 PaginationQO 类：


text:
以下是找到的文件内容：

## 1. MachineTaskChainDTO 类

**文件路径**: `/Users/kazusa/IdeaProjects/baoshi/wms/baoshi-api/robot/src/main/java/com/baoshi/api/robot/model/dto/res/MachineTaskChainDTO.java`

```java
package com.baoshi.api.robot.model.dto.res;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baoshi.data.machineTask.enums.MachineTargetTypeEnum;
import com.baoshi.data.machineTask.enums.MachineTaskChainStatusEnum;
import com.baoshi.data.machineTask.enums.MachineTaskChainTypeEnum;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

@Data
public class MachineTaskChainDTO implements Serializable {
    private static final long serialVersionUID = 1L;
    private String code;
    private String warehouse;
    @TableField("`status`")
    private MachineTaskChainStatusEnum status;
    @TableField("`type`")
    private MachineTaskChainTypeEnum type;
    private String businessNo;
    private String description;
    private String sourceLocation;
    private String sourcePoint;
    private String sourceContainer;
    private String sku;
    private MachineTargetTypeEnum targetType;
    private String targetCode;
    private String targetLocation;
    private String targetPoint;
    private Integer priority;
    private Date completionTime;
    private String cancelReason;
    private Date cancelTime;
    private Date createTime;
}
```

## 2. BasicEntity 基类

**文件路径**: `/Users/kazusa/IdeaProjects/baoshi/wms/baoshi-common/common/src/main/java/com/baoshi/common/model/base/BasicEntity.java`

```java
package com.baoshi.common.model.base;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

@Data
public class BasicEntity implements Serializable {
    private static final long serialVersionUID = -4947023415154495841L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    @TableField(fill = FieldFill.INSERT)
    private Long creatorId;

    @TableField(fill = FieldFill.UPDATE)
    private Date updateTime;

    @TableField(fill = FieldFill.UPDATE)
    private Long updaterId;

    @Version
    private Integer version;

    @TableLogic(value = "0", delval = "UNIX_TIMESTAMP()")
    private Long deleted;
}
```

## 3. QO (Query Object) 类示例

### 3.1 PaginationQO（基类）

**文件路径**: `/Users/kazusa/IdeaProjects/baoshi/wms/baoshi-common-data/src/main/java/com/baoshi/PaginationQO.java`

```java
package com.baoshi;

public class PaginationQO {
    private int page;
    private int size;
    private Boolean searchCount;
    private transient Page pagination;
    // ... 包含分页相关方法
}
```

### 3.2 BaseQueryQO（扩展基类）

**文件路径**: `/Users/kazusa/IdeaProjects/baoshi/wms/baoshi-common-data/src/main/java/com/baoshi/BaseQueryQO.java`

```java
package com.baoshi;

@EqualsAndHashCode(callSuper = true)
@Data
public class BaseQueryQO extends PaginationQO {
    @ApiModelProperty("开始时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date startTime;

    @ApiModelProperty("结束时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date endTime;
}
```

### 3.3 MoveTaskQueryQO 示例

**文件路径**: `/Users/kazusa/IdeaProjects/baoshi/wms/baoshi-common-data/src/main/java/com/baoshi/data/allocate/qo/MoveTaskQueryQO.java`

```java
@EqualsAndHashCode(callSuper = true)
@Data
public class MoveTaskQueryQO extends BaseQueryQO {
    @ApiModelProperty("任务号")
    private String code;
    @ApiModelProperty("仓库编码")
    private String warehouseCode;
    @ApiModelProperty("状态 CREATED:创建, IN_PROGRESS:进行中, FINISHED:已完成")
    private MoveTaskStatusEnum status;
    @ApiModelProperty("货主id")
    private List<String> customerIdList;
}
```

### 3.4 OrderTaskQO 示例

**文件路径**: `/Users/kazusa/IdeaProjects/baoshi/wms/baoshi-common-data/src/main/java/com/baoshi/data/order/qo/OrderTaskQO.java`

```java
@Data
public class OrderTaskQO extends PaginationQO {
    private List<String> owners;
    private String warehouse;
    private String signType;
    private String orderNo;
    private String status;
    private String platform;
    private String shop;
    private String waveNo;
    private String deliveryNo;
    private String startPickingTime;
    private String endPickingTime;
    private String container;
    private List<String> orderNos;
    private List<String> customNos;
    private List<String> carriers;
}
```

### 3.5 InboundSelfReceiveQO 示例

**文件路径**: `/Users/kazusa/IdeaProjects/baoshi/wms/baoshi-common-data/src/main/java/com/baoshi/data/inboundself/qo/InboundSelfReceiveQO.java`

```java
@EqualsAndHashCode(callSuper = true)
@Data
public class InboundSelfReceiveQO extends BaseQueryQO {
    @ApiModelProperty("仓库编码")
    private String warehouse;
    @ApiModelProperty("货主编码")
    private String customer;
    @ApiModelProperty("收货状态: RECEIVED-已收货, COMPLETED-上架完成, CANCEL-已取消")
    private InboundReceiveDetailStatusEnum status;
    @ApiModelProperty("业务跟踪号")
    private String businessNo;
    @ApiModelProperty("ASN单号")
    private String asnNo;
    @ApiModelProperty("条码")
    private String barcode;
    @ApiModelProperty("匹单状态")
    private InboundReceiveDetailMatchStatusEnum matchStatus;
    @ApiModelProperty("匹单状态批量")
    private List<InboundReceiveDetailMatchStatusEnum> matchStatusList;
    @ApiModelProperty(value = "数据权限", hidden = true)
    private DataPermission dataPermission;
}
```

### 3.6 InventoryFreezeQO 示例

**文件路径**: `/Users/kazusa/IdeaProjects/baoshi/wms/baoshi-wms/src/main/java/com/baoshi/wms/model/qo/InventoryFreezeQO.java`

```java
@Data
public class InventoryFreezeQO extends PaginationQO {
    private DataPermission dataPermission;
    private List<String> warehouseCodes;
    private List<String> ownerCodes;
    private String code;
    private String sku;
    private String location;
    private String lotNum;
    private String operationType;
    private String sources;
    private String basisCode;
    private Long operator;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date[] operateTime;
    private String noteText;
    private Long reviewer;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date[] reviewTime;
}
```

## 4. Admin Controllers 示例

### 4.1 MoveTaskAdminController

**文件路径**: `/Users/kazusa/IdeaProjects/baoshi/wms/baoshi-wms/src/main/java/com/baoshi/wms/controller/admin/MachineTaskController.java`

```java
@Api(tags = "移库任务接口-后台")
@Slf4j
@RestController
@RequestMapping("/api/wms/admin/move-task")
public class MoveTaskAdminController {
    private final IMoveTaskService moveTaskService;

    @ApiOperation("分页查询")
    @GetMapping("/page")
    public ResultsVO<IPage<MoveTaskAdminListVO>> page(MoveTaskQueryQO query) {
        return ResultsVO.success(moveTaskService.adminPage(query));
    }

    @ApiOperation("详情")
    @GetMapping("{id}")
    public ResultsVO<MoveTaskAdminDetailVO> detail(@PathVariable("id") Long id) {
        return ResultsVO.success(moveTaskService.adminDetail(id));
    }
}
```

### 4.2 AllocateOrderAdminController

**文件路径**: `/Users/kazusa/IdeaProjects/baoshi/wms/baoshi-wms/src/main/java/com/baoshi/wms/controller/admin/AllocateOrderAdminController.java`

```java
@Api(tags = "调拨接口-后台")
@Slf4j
@RestController
@RequestMapping("/api/wms/admin/allocate-order")
public class AllocateOrderAdminController {
    private final IAllocateOrderService allocateOrderService;

    @ApiOperation("分页查询")
    @GetMapping("/page")
    public ResultsVO<IPage<AllocateOrderListVO>> page(AllocateOrderQueryQO query) {
        return ResultsVO.success(allocateOrderService.adminPage(query));
    }

    @ApiOperation("详情")
    @GetMapping("{id}")
    public ResultsVO<AllocateOrderDetailVO> detail(@PathVariable("id") Long id) {
        return ResultsVO.success(allocateOrderService.detail(id));
    }
}
```

### 4.3 InventoryFreezeController

**文件路径**: `/Users/kazusa/IdeaProjects/baoshi/wms/baoshi-wms/src/main/java/com/baoshi/wms/controller/InventoryFreezeController.java`

```java
@RestController
@Api(tags = "库存冻结接口")
@RequestMapping("/api/wms/inventory/freeze")
public class InventoryFreezeController {
    @ApiOperation("库存冻结记录")
    @GetMapping("paginate")
    public ResultsVO<Page<InventoryFreezeVO>> paginateFreeze(@ModelAttribute InventoryFreezeQO query) {
        query.setDataPermission(AuthContext.getDataPermission());
        return ResultsVO.success(inventoryFreezeService.paginateFreeze(query));
    }

    @ApiOperation("库存冻结申请单")
    @GetMapping("application/paginate")
    public ResultsVO<Page<InventoryFreezeApplicationVO>> paginateFreezeApplication(@ModelAttribute InventoryFreezeQO query) {
        query.setDataPermission(AuthContext.getDataPermission());
        return ResultsVO.success(inventoryFreezeService.paginateFreezeApplication(query));
    }
}
```

## 5. ResultsVO 类

**文件路径**: `/Users/kazusa/IdeaProjects/baoshi/wms/baoshi-common/common/src/main/java/com/baoshi/common/pojo/ResultsVO.java`

```java
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ResultsVO<T> {
    protected final Integer code;
    protected final T data;
    protected final String message;
    protected Object[] args;
    protected final String traceId;

    // 成功方法
    public static <T> ResultsVO<T> success() { ... }
    public static <T> ResultsVO<T> success(Object body) { ... }
    public static <T> ResultsVO<T> success(String message, T body) { ... }
    public static <T> ResultsVO<PageResult<T>> success(PageResult<T> body) { ... }
    public static <T> ResultsVO<T> success(List<T> list, BasePage page) { ... }

    // 失败方法
    public static <T> ResultsVO<T> fail(BsException e) { ... }
    public static <T> ResultsVO<T> operatorFail(String errorMessage) { ... }
    public static <T> ResultsVO<T> searchFail(String errorMessage) { ... }
    public static <T> ResultsVO<T> error(String message) { ... }
}
```

## 6. BasePage 类

**文件路径**: `/Users/kazusa/IdeaProjects/baoshi/wms/baoshi-common/common/src/main/java/com/baoshi/common/model/base/BasePage.java`

```java
@Data
public class BasePage implements Serializable {
    @ApiModelProperty(value = "当前页码", example = "1")
    private Integer pageNum = 1;

    @ApiModelProperty(value = "每页条数，如果设置每页条数为0，为查询全部", example = "10")
    private Integer pageSize = 10;

    private Long total = 0L;
    private Integer pages = 0;

    @JsonIgnore
    private Integer size = 0;

    @JsonIgnore
    private String orderBy;

    @JsonIgnore
    private Boolean count = true;

    public BasePage() { }
    public BasePage(long total) { this.total = total; }
    public BasePage(int pageNum, int pageSize) { ... }
    public BasePage(int pageNum, int pageSize, boolean count) { ... }
    public BasePage(int pageNum, int pageSize, long total) { ... }
}
```

## 7. PageResult 类

**文件路径**: `/Users/kazusa/IdeaProjects/baoshi/wms/baoshi-common/common/src/main/java/com/baoshi/common/pojo/PageResult.java`

```java
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class PageResult<T> implements Serializable {
    private List<T> list;
    private T extra;
    private BasePage page;
    private Object data;

    public static <T> PageResult<T> getEmptyPageResult(T t) { ... }
    public static <T> PageResult<T> build(List<T> t, Long pageNum, Long pageSize, Long pages, Long total) { ... }
    public static <T> PageResult<T> build(List<T> t, Long pageNum, Long pageSize, Long total) { ... }
    public static <T> PageResult<T> build(List<T> t, BasePage page) { ... }
    public static <T> PageResult<T> build(List<T> t, T extra, BasePage page) { ... }
    public static <T> PageResult<T> build(List<T> t, long total) { ... }
    public static <T> PageResult<T> empty() { ... }
}
```

## 8. ElevatorLoadBalancer 类

**文件路径**: `/Users/kazusa/IdeaProjects/baoshi/wms/baoshi-robot/baoshi-robot-core/src/main/java/com/baoshi/robot/core/ElevatorLoadBalancer.java`

```java
@Service
public class ElevatorLoadBalancer {
    private final Map<Long, Elevator> elevatorStates = new HashMap<>();
    private final IMachineTaskChainService machineTaskChainService;
    private final IMachineTaskService machineTaskService;
    private final MachineTaskExecutionService executionService;

    @PostConstruct
    public void init() { ... }

    public Elevator getElevatorState(Long elevatorId) { ... }
    public synchronized Elevator selectAndEnqueue(String taskChainCode) { ... }
    public void setCurrentInboundTask(Long elevatorId, String taskChainCode) { ... }
    public void setCurrentOutboundTask(Long elevatorId, String taskChainCode) { ... }
    public boolean tryAcquireWorkingTask(Long elevatorId, String taskChainCode) { ... }
    public boolean releaseAndDequeue(Long elevatorId, String taskChainCode) { ... }
    private void wakeNextTask(Long elevatorId, Elevator state) { ... }
    private MachineTaskChain selectHigherPriorityChain(MachineTaskChain chain1, MachineTaskChain chain2) { ... }
    private long calculateCompositePriority(MachineTaskChain chain) { ... }
    public void clear(Long id) { ... }
}
```

---

## 总结

- QO 类通常继承 `PaginationQO` 或 `BaseQueryQO`，包含查询条件和分页参数
- Admin Controllers 使用 `@GetMapping("/page")` 或 `@GetMapping("paginate")` 进行分页查询
- 返回类型通常为 `ResultsVO<IPage<VO>>` 或 `ResultsVO<Page<VO>>`
- `ResultsVO` 用于统一响应封装
- `BasePage` 和 `PageResult` 用于分页信息封装
- `ElevatorLoadBalancer` 负责提升机负载均衡和任务队列管理

以上为找到的文件内容。