Commit fba451afa26bf3d0d8bc061efbc6c333f1cc1667
Merge branch 'wms' of https://gitee.com/zhijiantianya/ruoyi-vue-pro into master-jdk17
Showing
170 changed files
with
14498 additions
and
1 deletions
Too many changes.
To preserve performance only 100 of 170 files are displayed.
pom.xml
| ... | ... | @@ -25,6 +25,7 @@ |
| 25 | 25 | <!-- <module>yudao-module-erp</module>--> |
| 26 | 26 | <!-- <module>yudao-module-iot</module>--> |
| 27 | 27 | <!-- <module>yudao-module-mes</module>--> |
| 28 | + <module>yudao-module-wms</module> | |
| 28 | 29 | <!-- 请参考 https://doc.iocoder.cn/ai/build/ 文档,完成 AI 模块的启动!!! --> |
| 29 | 30 | <!-- <module>yudao-module-ai</module>--> |
| 30 | 31 | </modules> | ... | ... |
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/LocalDateTimeUtils.java
| ... | ... | @@ -303,6 +303,17 @@ public class LocalDateTimeUtils { |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | /** |
| 306 | + * 获取从开始日期起的日期列表 | |
| 307 | + * | |
| 308 | + * @param startDate 开始日期 | |
| 309 | + * @param days 天数 | |
| 310 | + * @return 日期列表,包含开始日期 | |
| 311 | + */ | |
| 312 | + public static List<LocalDate> getDateList(LocalDate startDate, int days) { | |
| 313 | + return startDate.datesUntil(startDate.plusDays(days)).toList(); | |
| 314 | + } | |
| 315 | + | |
| 316 | + /** | |
| 306 | 317 | * 格式化时间范围 |
| 307 | 318 | * |
| 308 | 319 | * @param startTime 开始时间 | ... | ... |
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/mapper/BaseMapperX.java
| ... | ... | @@ -120,6 +120,31 @@ public interface BaseMapperX<T> extends MPJBaseMapper<T> { |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
| 123 | + * 获得满足条件的一条记录,并使用 FOR UPDATE 锁定。 | |
| 124 | + * | |
| 125 | + * 注意:需要在事务中调用,否则锁会立即释放。 | |
| 126 | + * | |
| 127 | + * @param queryWrapper 查询条件 | |
| 128 | + * @return 实体 | |
| 129 | + */ | |
| 130 | + default T selectOneForUpdate(LambdaQueryWrapper<T> queryWrapper) { | |
| 131 | + return selectOne(queryWrapper.last("FOR UPDATE")); | |
| 132 | + } | |
| 133 | + | |
| 134 | + default T selectOneForUpdate(SFunction<T, ?> field, Object value) { | |
| 135 | + return selectOneForUpdate(new LambdaQueryWrapper<T>().eq(field, value)); | |
| 136 | + } | |
| 137 | + | |
| 138 | + default T selectOneForUpdate(SFunction<T, ?> field1, Object value1, SFunction<T, ?> field2, Object value2) { | |
| 139 | + return selectOneForUpdate(new LambdaQueryWrapper<T>().eq(field1, value1).eq(field2, value2)); | |
| 140 | + } | |
| 141 | + | |
| 142 | + default T selectOneForUpdate(SFunction<T, ?> field1, Object value1, SFunction<T, ?> field2, Object value2, | |
| 143 | + SFunction<T, ?> field3, Object value3) { | |
| 144 | + return selectOneForUpdate(new LambdaQueryWrapper<T>().eq(field1, value1).eq(field2, value2).eq(field3, value3)); | |
| 145 | + } | |
| 146 | + | |
| 147 | + /** | |
| 123 | 148 | * 获取满足条件的第 1 条记录 |
| 124 | 149 | * |
| 125 | 150 | * 目的:解决并发场景下,插入多条记录后,使用 selectOne 会报错的问题 | ... | ... |
yudao-module-wms/pom.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | |
| 3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| 4 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
| 5 | + <parent> | |
| 6 | + <groupId>cn.iocoder.boot</groupId> | |
| 7 | + <artifactId>yudao</artifactId> | |
| 8 | + <version>${revision}</version> | |
| 9 | + </parent> | |
| 10 | + <modelVersion>4.0.0</modelVersion> | |
| 11 | + <artifactId>yudao-module-wms</artifactId> | |
| 12 | + <packaging>jar</packaging> | |
| 13 | + | |
| 14 | + <name>${project.artifactId}</name> | |
| 15 | + <description> | |
| 16 | + wms 模块下,仓库管理系统(Warehouse Management System)。 | |
| 17 | + 例如说:仓库、物料、库存、入库、出库、移库、盘库等等 | |
| 18 | + </description> | |
| 19 | + | |
| 20 | + <dependencies> | |
| 21 | + <dependency> | |
| 22 | + <groupId>cn.iocoder.boot</groupId> | |
| 23 | + <artifactId>yudao-module-system</artifactId> | |
| 24 | + <version>${revision}</version> | |
| 25 | + </dependency> | |
| 26 | + | |
| 27 | + <!-- 业务组件 --> | |
| 28 | + | |
| 29 | + <!-- Web 相关 --> | |
| 30 | + <dependency> | |
| 31 | + <groupId>cn.iocoder.boot</groupId> | |
| 32 | + <artifactId>yudao-spring-boot-starter-web</artifactId> | |
| 33 | + </dependency> | |
| 34 | + | |
| 35 | + <dependency> | |
| 36 | + <groupId>cn.iocoder.boot</groupId> | |
| 37 | + <artifactId>yudao-spring-boot-starter-security</artifactId> | |
| 38 | + </dependency> | |
| 39 | + | |
| 40 | + <!-- DB 相关 --> | |
| 41 | + <dependency> | |
| 42 | + <groupId>cn.iocoder.boot</groupId> | |
| 43 | + <artifactId>yudao-spring-boot-starter-mybatis</artifactId> | |
| 44 | + </dependency> | |
| 45 | + | |
| 46 | + <dependency> | |
| 47 | + <groupId>cn.iocoder.boot</groupId> | |
| 48 | + <artifactId>yudao-spring-boot-starter-redis</artifactId> | |
| 49 | + </dependency> | |
| 50 | + | |
| 51 | + <!-- 工具类相关 --> | |
| 52 | + <dependency> | |
| 53 | + <groupId>cn.iocoder.boot</groupId> | |
| 54 | + <artifactId>yudao-spring-boot-starter-excel</artifactId> | |
| 55 | + </dependency> | |
| 56 | + | |
| 57 | + <!-- Test 测试相关 --> | |
| 58 | + <dependency> | |
| 59 | + <groupId>cn.iocoder.boot</groupId> | |
| 60 | + <artifactId>yudao-spring-boot-starter-test</artifactId> | |
| 61 | + </dependency> | |
| 62 | + | |
| 63 | + </dependencies> | |
| 64 | + | |
| 65 | +</project> | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/home/WmsHomeStatisticsController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.home; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 4 | +import cn.iocoder.yudao.module.wms.controller.admin.home.vo.WmsHomeInventorySummaryRespVO; | |
| 5 | +import cn.iocoder.yudao.module.wms.controller.admin.home.vo.WmsHomeOrderSummaryRespVO; | |
| 6 | +import cn.iocoder.yudao.module.wms.controller.admin.home.vo.WmsHomeOrderTrendRespVO; | |
| 7 | +import cn.iocoder.yudao.module.wms.service.home.WmsHomeStatisticsService; | |
| 8 | +import io.swagger.v3.oas.annotations.Operation; | |
| 9 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 10 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 11 | +import jakarta.annotation.Resource; | |
| 12 | +import jakarta.validation.constraints.Max; | |
| 13 | +import jakarta.validation.constraints.Min; | |
| 14 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 15 | +import org.springframework.validation.annotation.Validated; | |
| 16 | +import org.springframework.web.bind.annotation.GetMapping; | |
| 17 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 18 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 19 | +import org.springframework.web.bind.annotation.RestController; | |
| 20 | + | |
| 21 | +import java.util.List; | |
| 22 | + | |
| 23 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 24 | + | |
| 25 | +@Tag(name = "管理后台 - WMS 首页统计") | |
| 26 | +@RestController | |
| 27 | +@RequestMapping("/wms/home-statistics") | |
| 28 | +@Validated | |
| 29 | +public class WmsHomeStatisticsController { | |
| 30 | + | |
| 31 | + @Resource | |
| 32 | + private WmsHomeStatisticsService homeStatisticsService; | |
| 33 | + | |
| 34 | + @GetMapping("/order-summary") | |
| 35 | + @Operation(summary = "获得首页单据汇总统计") | |
| 36 | + @Parameter(name = "warehouseId", description = "仓库编号", example = "1024") | |
| 37 | + @PreAuthorize("@ss.hasPermission('wms:home:query')") | |
| 38 | + public CommonResult<List<WmsHomeOrderSummaryRespVO>> getOrderSummary( | |
| 39 | + @RequestParam(value = "warehouseId", required = false) Long warehouseId) { | |
| 40 | + return success(homeStatisticsService.getOrderSummary(warehouseId)); | |
| 41 | + } | |
| 42 | + | |
| 43 | + @GetMapping("/order-trend") | |
| 44 | + @Operation(summary = "获得首页单据趋势") | |
| 45 | + @Parameter(name = "days", description = "天数", example = "7") | |
| 46 | + @PreAuthorize("@ss.hasPermission('wms:home:query')") | |
| 47 | + public CommonResult<List<WmsHomeOrderTrendRespVO>> getOrderTrend( | |
| 48 | + @RequestParam(value = "days", defaultValue = "7") @Min(1) @Max(90) Integer days, | |
| 49 | + @RequestParam(value = "warehouseId", required = false) Long warehouseId) { | |
| 50 | + return success(homeStatisticsService.getOrderTrend(days, warehouseId)); | |
| 51 | + } | |
| 52 | + | |
| 53 | + @GetMapping("/inventory-summary") | |
| 54 | + @Operation(summary = "获得首页库存汇总统计") | |
| 55 | + @Parameter(name = "warehouseId", description = "仓库编号", example = "1024") | |
| 56 | + @PreAuthorize("@ss.hasPermission('wms:home:query')") | |
| 57 | + public CommonResult<WmsHomeInventorySummaryRespVO> getInventorySummary( | |
| 58 | + @RequestParam(value = "warehouseId", required = false) Long warehouseId, | |
| 59 | + @RequestParam(value = "goodsLimit", defaultValue = "5") @Min(1) @Max(20) Integer goodsLimit, | |
| 60 | + @RequestParam(value = "warehouseLimit", defaultValue = "8") @Min(1) @Max(20) Integer warehouseLimit) { | |
| 61 | + return success(homeStatisticsService.getInventorySummary(warehouseId, goodsLimit, warehouseLimit)); | |
| 62 | + } | |
| 63 | + | |
| 64 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/home/vo/WmsHomeInventorySummaryRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.home.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +import java.math.BigDecimal; | |
| 7 | +import java.util.List; | |
| 8 | + | |
| 9 | +@Schema(description = "管理后台 - WMS 首页库存汇总统计 Response VO") | |
| 10 | +@Data | |
| 11 | +public class WmsHomeInventorySummaryRespVO { | |
| 12 | + | |
| 13 | + @Schema(description = "总库存数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000.00") | |
| 14 | + private BigDecimal totalQuantity; | |
| 15 | + | |
| 16 | + @Schema(description = "商品库存占比列表") | |
| 17 | + private List<ItemRank> goodsShareList; | |
| 18 | + | |
| 19 | + @Schema(description = "仓库库存分布列表") | |
| 20 | + private List<WarehouseRank> warehouseDistributionList; | |
| 21 | + | |
| 22 | + @Schema(description = "管理后台 - WMS 首页商品库存排行 Response VO") | |
| 23 | + @Data | |
| 24 | + public static class ItemRank { | |
| 25 | + | |
| 26 | + @Schema(description = "商品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 27 | + private Long id; | |
| 28 | + | |
| 29 | + @Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "A4 复印纸") | |
| 30 | + private String name; | |
| 31 | + | |
| 32 | + @Schema(description = "库存数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00") | |
| 33 | + private BigDecimal quantity; | |
| 34 | + | |
| 35 | + } | |
| 36 | + | |
| 37 | + @Schema(description = "管理后台 - WMS 首页仓库库存排行 Response VO") | |
| 38 | + @Data | |
| 39 | + public static class WarehouseRank { | |
| 40 | + | |
| 41 | + @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 42 | + private Long id; | |
| 43 | + | |
| 44 | + @Schema(description = "仓库名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "上海仓") | |
| 45 | + private String name; | |
| 46 | + | |
| 47 | + @Schema(description = "库存数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00") | |
| 48 | + private BigDecimal quantity; | |
| 49 | + | |
| 50 | + } | |
| 51 | + | |
| 52 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/home/vo/WmsHomeOrderStatusRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.home.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +@Schema(description = "管理后台 - WMS 首页单据状态统计 Response VO") | |
| 7 | +@Data | |
| 8 | +public class WmsHomeOrderStatusRespVO { | |
| 9 | + | |
| 10 | + @Schema(description = "状态值", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | |
| 11 | + private Integer status; | |
| 12 | + | |
| 13 | + @Schema(description = "单据数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "12") | |
| 14 | + private Long count; | |
| 15 | + | |
| 16 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/home/vo/WmsHomeOrderSummaryRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.home.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +import java.util.List; | |
| 7 | + | |
| 8 | +@Schema(description = "管理后台 - WMS 首页单据汇总统计 Response VO") | |
| 9 | +@Data | |
| 10 | +public class WmsHomeOrderSummaryRespVO { | |
| 11 | + | |
| 12 | + @Schema(description = "单据类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 13 | + private Integer type; | |
| 14 | + | |
| 15 | + @Schema(description = "单据总数", requiredMode = Schema.RequiredMode.REQUIRED, example = "12") | |
| 16 | + private Long total; | |
| 17 | + | |
| 18 | + @Schema(description = "状态分布") | |
| 19 | + private List<WmsHomeOrderStatusRespVO> statuses; | |
| 20 | + | |
| 21 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/home/vo/WmsHomeOrderTrendRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.home.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +import java.time.LocalDateTime; | |
| 7 | + | |
| 8 | +@Schema(description = "管理后台 - WMS 首页单据趋势 Response VO") | |
| 9 | +@Data | |
| 10 | +public class WmsHomeOrderTrendRespVO { | |
| 11 | + | |
| 12 | + @Schema(description = "时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1778169600000") | |
| 13 | + private LocalDateTime time; | |
| 14 | + | |
| 15 | + @Schema(description = "入库单数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "12") | |
| 16 | + private Long receiptCount; | |
| 17 | + | |
| 18 | + @Schema(description = "出库单数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "8") | |
| 19 | + private Long shipmentCount; | |
| 20 | + | |
| 21 | + @Schema(description = "移库单数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "3") | |
| 22 | + private Long movementCount; | |
| 23 | + | |
| 24 | + @Schema(description = "盘库单数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | |
| 25 | + private Long checkCount; | |
| 26 | + | |
| 27 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/inventory/WmsInventoryController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.inventory; | |
| 2 | + | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | |
| 7 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 8 | +import cn.iocoder.yudao.module.wms.controller.admin.inventory.vo.WmsInventoryListReqVO; | |
| 9 | +import cn.iocoder.yudao.module.wms.controller.admin.inventory.vo.WmsInventoryPageReqVO; | |
| 10 | +import cn.iocoder.yudao.module.wms.controller.admin.inventory.vo.WmsInventoryRespVO; | |
| 11 | +import cn.iocoder.yudao.module.wms.dal.dataobject.inventory.WmsInventoryDO; | |
| 12 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemDO; | |
| 13 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemSkuDO; | |
| 14 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.warehouse.WmsWarehouseDO; | |
| 15 | +import cn.iocoder.yudao.module.wms.service.inventory.WmsInventoryService; | |
| 16 | +import cn.iocoder.yudao.module.wms.service.md.item.WmsItemService; | |
| 17 | +import cn.iocoder.yudao.module.wms.service.md.item.WmsItemSkuService; | |
| 18 | +import cn.iocoder.yudao.module.wms.service.md.warehouse.WmsWarehouseService; | |
| 19 | +import io.swagger.v3.oas.annotations.Operation; | |
| 20 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 21 | +import jakarta.annotation.Resource; | |
| 22 | +import jakarta.validation.Valid; | |
| 23 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 24 | +import org.springframework.validation.annotation.Validated; | |
| 25 | +import org.springframework.web.bind.annotation.GetMapping; | |
| 26 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 27 | +import org.springframework.web.bind.annotation.RestController; | |
| 28 | + | |
| 29 | +import java.util.Collections; | |
| 30 | +import java.util.List; | |
| 31 | +import java.util.Map; | |
| 32 | + | |
| 33 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 34 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | |
| 35 | + | |
| 36 | +@Tag(name = "管理后台 - WMS 库存统计") | |
| 37 | +@RestController | |
| 38 | +@RequestMapping("/wms/inventory") | |
| 39 | +@Validated | |
| 40 | +public class WmsInventoryController { | |
| 41 | + | |
| 42 | + @Resource | |
| 43 | + private WmsInventoryService inventoryService; | |
| 44 | + @Resource | |
| 45 | + private WmsItemService itemService; | |
| 46 | + @Resource | |
| 47 | + private WmsItemSkuService itemSkuService; | |
| 48 | + @Resource | |
| 49 | + private WmsWarehouseService warehouseService; | |
| 50 | + | |
| 51 | + @GetMapping("/page") | |
| 52 | + @Operation(summary = "获得库存统计分页") | |
| 53 | + @PreAuthorize("@ss.hasPermission('wms:inventory:query')") | |
| 54 | + public CommonResult<PageResult<WmsInventoryRespVO>> getInventoryPage(@Valid WmsInventoryPageReqVO pageReqVO) { | |
| 55 | + PageResult<WmsInventoryDO> pageResult = inventoryService.getInventoryPage(pageReqVO); | |
| 56 | + return success(new PageResult<>(buildInventoryRespVOList(pageResult.getList()), pageResult.getTotal())); | |
| 57 | + } | |
| 58 | + | |
| 59 | + @GetMapping("/list") | |
| 60 | + @Operation(summary = "获得库存统计列表") | |
| 61 | + @PreAuthorize("@ss.hasPermission('wms:inventory:query')") | |
| 62 | + public CommonResult<List<WmsInventoryRespVO>> getInventoryList(@Valid WmsInventoryListReqVO listReqVO) { | |
| 63 | + List<WmsInventoryDO> list = inventoryService.getInventoryList(listReqVO); | |
| 64 | + return success(buildInventoryRespVOList(list)); | |
| 65 | + } | |
| 66 | + | |
| 67 | + // ==================== 拼接 VO ==================== | |
| 68 | + | |
| 69 | + private List<WmsInventoryRespVO> buildInventoryRespVOList(List<WmsInventoryDO> list) { | |
| 70 | + if (CollUtil.isEmpty(list)) { | |
| 71 | + return Collections.emptyList(); | |
| 72 | + } | |
| 73 | + Map<Long, WmsItemSkuDO> skuMap = itemSkuService.getItemSkuMap(convertSet(list, WmsInventoryDO::getSkuId)); | |
| 74 | + Map<Long, WmsItemDO> itemMap = itemService.getItemMap(convertSet(skuMap.values(), WmsItemSkuDO::getItemId)); | |
| 75 | + Map<Long, WmsWarehouseDO> warehouseMap = warehouseService.getWarehouseMap( | |
| 76 | + convertSet(list, WmsInventoryDO::getWarehouseId)); | |
| 77 | + return BeanUtils.toBean(list, WmsInventoryRespVO.class, vo -> { | |
| 78 | + MapUtils.findAndThen(skuMap, vo.getSkuId(), sku -> { | |
| 79 | + vo.setSkuCode(sku.getCode()).setSkuName(sku.getName()).setItemId(sku.getItemId()); | |
| 80 | + MapUtils.findAndThen(itemMap, sku.getItemId(), item -> vo.setItemCode(item.getCode()) | |
| 81 | + .setItemName(item.getName()).setUnit(item.getUnit())); | |
| 82 | + }); | |
| 83 | + MapUtils.findAndThen(warehouseMap, vo.getWarehouseId(), warehouse -> vo.setWarehouseName(warehouse.getName())); | |
| 84 | + }); | |
| 85 | + } | |
| 86 | + | |
| 87 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/inventory/WmsInventoryHistoryController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.inventory; | |
| 2 | + | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | |
| 7 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 8 | +import cn.iocoder.yudao.module.wms.controller.admin.inventory.vo.history.WmsInventoryHistoryPageReqVO; | |
| 9 | +import cn.iocoder.yudao.module.wms.controller.admin.inventory.vo.history.WmsInventoryHistoryRespVO; | |
| 10 | +import cn.iocoder.yudao.module.wms.dal.dataobject.inventory.WmsInventoryHistoryDO; | |
| 11 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemDO; | |
| 12 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemSkuDO; | |
| 13 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.warehouse.WmsWarehouseDO; | |
| 14 | +import cn.iocoder.yudao.module.wms.service.inventory.WmsInventoryHistoryService; | |
| 15 | +import cn.iocoder.yudao.module.wms.service.md.item.WmsItemService; | |
| 16 | +import cn.iocoder.yudao.module.wms.service.md.item.WmsItemSkuService; | |
| 17 | +import cn.iocoder.yudao.module.wms.service.md.warehouse.WmsWarehouseService; | |
| 18 | +import io.swagger.v3.oas.annotations.Operation; | |
| 19 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 20 | +import jakarta.annotation.Resource; | |
| 21 | +import jakarta.validation.Valid; | |
| 22 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 23 | +import org.springframework.validation.annotation.Validated; | |
| 24 | +import org.springframework.web.bind.annotation.GetMapping; | |
| 25 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 26 | +import org.springframework.web.bind.annotation.RestController; | |
| 27 | + | |
| 28 | +import java.util.Collections; | |
| 29 | +import java.util.List; | |
| 30 | +import java.util.Map; | |
| 31 | + | |
| 32 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 33 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | |
| 34 | + | |
| 35 | +@Tag(name = "管理后台 - WMS 库存流水") | |
| 36 | +@RestController | |
| 37 | +@RequestMapping("/wms/inventory-history") | |
| 38 | +@Validated | |
| 39 | +public class WmsInventoryHistoryController { | |
| 40 | + | |
| 41 | + @Resource | |
| 42 | + private WmsInventoryHistoryService inventoryHistoryService; | |
| 43 | + @Resource | |
| 44 | + private WmsItemService itemService; | |
| 45 | + @Resource | |
| 46 | + private WmsItemSkuService itemSkuService; | |
| 47 | + @Resource | |
| 48 | + private WmsWarehouseService warehouseService; | |
| 49 | + | |
| 50 | + @GetMapping("/page") | |
| 51 | + @Operation(summary = "获得库存流水分页") | |
| 52 | + @PreAuthorize("@ss.hasPermission('wms:inventory-history:query')") | |
| 53 | + public CommonResult<PageResult<WmsInventoryHistoryRespVO>> getInventoryHistoryPage( | |
| 54 | + @Valid WmsInventoryHistoryPageReqVO pageReqVO) { | |
| 55 | + PageResult<WmsInventoryHistoryDO> pageResult = inventoryHistoryService.getInventoryHistoryPage(pageReqVO); | |
| 56 | + return success(new PageResult<>(buildInventoryHistoryRespVOList(pageResult.getList()), pageResult.getTotal())); | |
| 57 | + } | |
| 58 | + | |
| 59 | + // ==================== 拼接 VO ==================== | |
| 60 | + | |
| 61 | + private List<WmsInventoryHistoryRespVO> buildInventoryHistoryRespVOList(List<WmsInventoryHistoryDO> list) { | |
| 62 | + if (CollUtil.isEmpty(list)) { | |
| 63 | + return Collections.emptyList(); | |
| 64 | + } | |
| 65 | + Map<Long, WmsItemSkuDO> skuMap = itemSkuService.getItemSkuMap(convertSet(list, WmsInventoryHistoryDO::getSkuId)); | |
| 66 | + Map<Long, WmsItemDO> itemMap = itemService.getItemMap(convertSet(skuMap.values(), WmsItemSkuDO::getItemId)); | |
| 67 | + Map<Long, WmsWarehouseDO> warehouseMap = warehouseService.getWarehouseMap( | |
| 68 | + convertSet(list, WmsInventoryHistoryDO::getWarehouseId)); | |
| 69 | + return BeanUtils.toBean(list, WmsInventoryHistoryRespVO.class, vo -> { | |
| 70 | + MapUtils.findAndThen(skuMap, vo.getSkuId(), sku -> { | |
| 71 | + vo.setSkuCode(sku.getCode()).setSkuName(sku.getName()).setItemId(sku.getItemId()); | |
| 72 | + MapUtils.findAndThen(itemMap, sku.getItemId(), item -> vo.setItemCode(item.getCode()) | |
| 73 | + .setItemName(item.getName()).setUnit(item.getUnit())); | |
| 74 | + }); | |
| 75 | + MapUtils.findAndThen(warehouseMap, vo.getWarehouseId(), warehouse -> vo.setWarehouseName(warehouse.getName())); | |
| 76 | + }); | |
| 77 | + } | |
| 78 | + | |
| 79 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/inventory/vo/WmsInventoryListReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.inventory.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import jakarta.validation.constraints.NotNull; | |
| 5 | +import lombok.Data; | |
| 6 | + | |
| 7 | +@Schema(description = "管理后台 - WMS 库存统计列表 Request VO") | |
| 8 | +@Data | |
| 9 | +public class WmsInventoryListReqVO { | |
| 10 | + | |
| 11 | + @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") | |
| 12 | + @NotNull(message = "仓库编号不能为空") | |
| 13 | + private Long warehouseId; | |
| 14 | + | |
| 15 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/inventory/vo/WmsInventoryPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.inventory.vo; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | +import jakarta.validation.constraints.NotBlank; | |
| 6 | +import lombok.Data; | |
| 7 | +import lombok.EqualsAndHashCode; | |
| 8 | +import lombok.ToString; | |
| 9 | + | |
| 10 | +import java.math.BigDecimal; | |
| 11 | + | |
| 12 | +@Schema(description = "管理后台 - WMS 库存统计分页 Request VO") | |
| 13 | +@Data | |
| 14 | +@EqualsAndHashCode(callSuper = true) | |
| 15 | +@ToString(callSuper = true) | |
| 16 | +public class WmsInventoryPageReqVO extends PageParam { | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * 按仓库维度统计 | |
| 20 | + */ | |
| 21 | + public static final String TYPE_WAREHOUSE = "warehouse"; | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * 按商品维度统计 | |
| 25 | + */ | |
| 26 | + public static final String TYPE_ITEM = "item"; | |
| 27 | + | |
| 28 | + @Schema(description = "统计维度", requiredMode = Schema.RequiredMode.REQUIRED, example = "warehouse") | |
| 29 | + @NotBlank(message = "统计维度不能为空") | |
| 30 | + private String type; | |
| 31 | + | |
| 32 | + @Schema(description = "商品编号", example = "ITEM001") | |
| 33 | + private String itemCode; | |
| 34 | + | |
| 35 | + @Schema(description = "商品名称", example = "红富士苹果") | |
| 36 | + private String itemName; | |
| 37 | + | |
| 38 | + @Schema(description = "商品 SKU 编号", example = "1024") | |
| 39 | + private Long skuId; | |
| 40 | + | |
| 41 | + @Schema(description = "规格编号", example = "SKU001") | |
| 42 | + private String skuCode; | |
| 43 | + | |
| 44 | + @Schema(description = "规格名称", example = "10kg 箱装") | |
| 45 | + private String skuName; | |
| 46 | + | |
| 47 | + @Schema(description = "仓库编号", example = "2048") | |
| 48 | + private Long warehouseId; | |
| 49 | + | |
| 50 | + @Schema(description = "最小库存数量", example = "0.01") | |
| 51 | + private BigDecimal minQuantity; | |
| 52 | + | |
| 53 | + @Schema(description = "是否只查询正库存", example = "true") | |
| 54 | + private Boolean onlyPositiveQuantity; | |
| 55 | + | |
| 56 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/inventory/vo/WmsInventoryRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.inventory.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +import java.math.BigDecimal; | |
| 7 | +import java.time.LocalDateTime; | |
| 8 | + | |
| 9 | +@Schema(description = "管理后台 - WMS 库存统计 Response VO") | |
| 10 | +@Data | |
| 11 | +public class WmsInventoryRespVO { | |
| 12 | + | |
| 13 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 14 | + private Long id; | |
| 15 | + | |
| 16 | + @Schema(description = "商品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") | |
| 17 | + private Long itemId; | |
| 18 | + @Schema(description = "商品编码", example = "ITEM001") | |
| 19 | + private String itemCode; | |
| 20 | + @Schema(description = "商品名称", example = "红富士苹果") | |
| 21 | + private String itemName; | |
| 22 | + @Schema(description = "商品单位", example = "箱") | |
| 23 | + private String unit; | |
| 24 | + | |
| 25 | + @Schema(description = "商品 SKU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "4096") | |
| 26 | + private Long skuId; | |
| 27 | + @Schema(description = "规格编号", example = "SKU001") | |
| 28 | + private String skuCode; | |
| 29 | + @Schema(description = "规格名称", example = "10kg 箱装") | |
| 30 | + private String skuName; | |
| 31 | + | |
| 32 | + @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8192") | |
| 33 | + private Long warehouseId; | |
| 34 | + @Schema(description = "仓库名称", example = "成品仓") | |
| 35 | + private String warehouseName; | |
| 36 | + | |
| 37 | + @Schema(description = "库存数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00") | |
| 38 | + private BigDecimal quantity; | |
| 39 | + @Schema(description = "备注", example = "备注") | |
| 40 | + private String remark; | |
| 41 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 42 | + private LocalDateTime createTime; | |
| 43 | + | |
| 44 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/inventory/vo/history/WmsInventoryHistoryPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.inventory.vo.history; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | +import lombok.Data; | |
| 6 | +import lombok.EqualsAndHashCode; | |
| 7 | +import lombok.ToString; | |
| 8 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 9 | + | |
| 10 | +import java.time.LocalDateTime; | |
| 11 | + | |
| 12 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 13 | + | |
| 14 | +@Schema(description = "管理后台 - WMS 库存流水分页 Request VO") | |
| 15 | +@Data | |
| 16 | +@EqualsAndHashCode(callSuper = true) | |
| 17 | +@ToString(callSuper = true) | |
| 18 | +public class WmsInventoryHistoryPageReqVO extends PageParam { | |
| 19 | + | |
| 20 | + @Schema(description = "商品编号", example = "ITEM001") | |
| 21 | + private String itemCode; | |
| 22 | + | |
| 23 | + @Schema(description = "商品名称", example = "红富士苹果") | |
| 24 | + private String itemName; | |
| 25 | + | |
| 26 | + @Schema(description = "商品 SKU 编号", example = "1024") | |
| 27 | + private Long skuId; | |
| 28 | + | |
| 29 | + @Schema(description = "规格编号", example = "SKU001") | |
| 30 | + private String skuCode; | |
| 31 | + | |
| 32 | + @Schema(description = "规格名称", example = "10kg 箱装") | |
| 33 | + private String skuName; | |
| 34 | + | |
| 35 | + @Schema(description = "仓库编号", example = "2048") | |
| 36 | + private Long warehouseId; | |
| 37 | + | |
| 38 | + @Schema(description = "单据号", example = "RK202605110001") | |
| 39 | + private String orderNo; | |
| 40 | + | |
| 41 | + @Schema(description = "单据类型", example = "1") | |
| 42 | + private Integer orderType; | |
| 43 | + | |
| 44 | + @Schema(description = "操作时间") | |
| 45 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 46 | + private LocalDateTime[] createTime; | |
| 47 | + | |
| 48 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/inventory/vo/history/WmsInventoryHistoryRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.inventory.vo.history; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +import java.math.BigDecimal; | |
| 7 | +import java.time.LocalDateTime; | |
| 8 | + | |
| 9 | +@Schema(description = "管理后台 - WMS 库存流水 Response VO") | |
| 10 | +@Data | |
| 11 | +public class WmsInventoryHistoryRespVO { | |
| 12 | + | |
| 13 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 14 | + private Long id; | |
| 15 | + | |
| 16 | + @Schema(description = "商品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") | |
| 17 | + private Long itemId; | |
| 18 | + @Schema(description = "商品编码", example = "ITEM001") | |
| 19 | + private String itemCode; | |
| 20 | + @Schema(description = "商品名称", example = "红富士苹果") | |
| 21 | + private String itemName; | |
| 22 | + @Schema(description = "商品单位", example = "箱") | |
| 23 | + private String unit; | |
| 24 | + | |
| 25 | + @Schema(description = "商品 SKU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "4096") | |
| 26 | + private Long skuId; | |
| 27 | + @Schema(description = "规格编号", example = "SKU001") | |
| 28 | + private String skuCode; | |
| 29 | + @Schema(description = "规格名称", example = "10kg 箱装") | |
| 30 | + private String skuName; | |
| 31 | + | |
| 32 | + @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8192") | |
| 33 | + private Long warehouseId; | |
| 34 | + @Schema(description = "仓库名称", example = "成品仓") | |
| 35 | + private String warehouseName; | |
| 36 | + | |
| 37 | + @Schema(description = "库存变化数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "10.00") | |
| 38 | + private BigDecimal quantity; | |
| 39 | + @Schema(description = "变化前库存数量", example = "90.00") | |
| 40 | + private BigDecimal beforeQuantity; | |
| 41 | + @Schema(description = "变化后库存数量", example = "100.00") | |
| 42 | + private BigDecimal afterQuantity; | |
| 43 | + @Schema(description = "单价", example = "1000.00") | |
| 44 | + private BigDecimal price; | |
| 45 | + @Schema(description = "库存变化金额", example = "10000.00") | |
| 46 | + private BigDecimal totalPrice; | |
| 47 | + @Schema(description = "备注", example = "备注") | |
| 48 | + private String remark; | |
| 49 | + | |
| 50 | + @Schema(description = "单据编号", example = "1024") | |
| 51 | + private Long orderId; | |
| 52 | + @Schema(description = "单据号", example = "RK202605110001") | |
| 53 | + private String orderNo; | |
| 54 | + @Schema(description = "单据类型", example = "1") | |
| 55 | + private Integer orderType; | |
| 56 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 57 | + private LocalDateTime createTime; | |
| 58 | + | |
| 59 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/md/item/WmsItemBrandController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.md.item; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 6 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 7 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 8 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | |
| 9 | +import cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.brand.WmsItemBrandPageReqVO; | |
| 10 | +import cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.brand.WmsItemBrandRespVO; | |
| 11 | +import cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.brand.WmsItemBrandSaveReqVO; | |
| 12 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemBrandDO; | |
| 13 | +import cn.iocoder.yudao.module.wms.service.md.item.WmsItemBrandService; | |
| 14 | +import io.swagger.v3.oas.annotations.Operation; | |
| 15 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 16 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 17 | +import jakarta.annotation.Resource; | |
| 18 | +import jakarta.servlet.http.HttpServletResponse; | |
| 19 | +import jakarta.validation.Valid; | |
| 20 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 21 | +import org.springframework.validation.annotation.Validated; | |
| 22 | +import org.springframework.web.bind.annotation.*; | |
| 23 | + | |
| 24 | +import java.io.IOException; | |
| 25 | +import java.util.List; | |
| 26 | + | |
| 27 | +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | |
| 28 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 29 | + | |
| 30 | +@Tag(name = "管理后台 - WMS 商品品牌") | |
| 31 | +@RestController | |
| 32 | +@RequestMapping("/wms/item-brand") | |
| 33 | +@Validated | |
| 34 | +public class WmsItemBrandController { | |
| 35 | + | |
| 36 | + @Resource | |
| 37 | + private WmsItemBrandService brandService; | |
| 38 | + | |
| 39 | + @PostMapping("/create") | |
| 40 | + @Operation(summary = "创建商品品牌") | |
| 41 | + @PreAuthorize("@ss.hasPermission('wms:item-brand:create')") | |
| 42 | + public CommonResult<Long> createItemBrand(@Valid @RequestBody WmsItemBrandSaveReqVO createReqVO) { | |
| 43 | + return success(brandService.createItemBrand(createReqVO)); | |
| 44 | + } | |
| 45 | + | |
| 46 | + @PutMapping("/update") | |
| 47 | + @Operation(summary = "更新商品品牌") | |
| 48 | + @PreAuthorize("@ss.hasPermission('wms:item-brand:update')") | |
| 49 | + public CommonResult<Boolean> updateItemBrand(@Valid @RequestBody WmsItemBrandSaveReqVO updateReqVO) { | |
| 50 | + brandService.updateItemBrand(updateReqVO); | |
| 51 | + return success(true); | |
| 52 | + } | |
| 53 | + | |
| 54 | + @DeleteMapping("/delete") | |
| 55 | + @Operation(summary = "删除商品品牌") | |
| 56 | + @Parameter(name = "id", description = "编号", required = true) | |
| 57 | + @PreAuthorize("@ss.hasPermission('wms:item-brand:delete')") | |
| 58 | + public CommonResult<Boolean> deleteItemBrand(@RequestParam("id") Long id) { | |
| 59 | + brandService.deleteItemBrand(id); | |
| 60 | + return success(true); | |
| 61 | + } | |
| 62 | + | |
| 63 | + @GetMapping("/get") | |
| 64 | + @Operation(summary = "获得商品品牌") | |
| 65 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 66 | + @PreAuthorize("@ss.hasPermission('wms:item-brand:query')") | |
| 67 | + public CommonResult<WmsItemBrandRespVO> getItemBrand(@RequestParam("id") Long id) { | |
| 68 | + WmsItemBrandDO brand = brandService.getItemBrand(id); | |
| 69 | + return success(BeanUtils.toBean(brand, WmsItemBrandRespVO.class)); | |
| 70 | + } | |
| 71 | + | |
| 72 | + @GetMapping("/page") | |
| 73 | + @Operation(summary = "获得商品品牌分页") | |
| 74 | + @PreAuthorize("@ss.hasPermission('wms:item-brand:query')") | |
| 75 | + public CommonResult<PageResult<WmsItemBrandRespVO>> getItemBrandPage(@Valid WmsItemBrandPageReqVO pageReqVO) { | |
| 76 | + PageResult<WmsItemBrandDO> pageResult = brandService.getItemBrandPage(pageReqVO); | |
| 77 | + return success(BeanUtils.toBean(pageResult, WmsItemBrandRespVO.class)); | |
| 78 | + } | |
| 79 | + | |
| 80 | + @GetMapping("/simple-list") | |
| 81 | + @Operation(summary = "获得商品品牌精简列表", description = "主要用于前端下拉") | |
| 82 | + @PreAuthorize("@ss.hasPermission('wms:item-brand:query')") | |
| 83 | + public CommonResult<List<WmsItemBrandRespVO>> getItemBrandSimpleList() { | |
| 84 | + List<WmsItemBrandDO> list = brandService.getItemBrandList(); | |
| 85 | + return success(BeanUtils.toBean(list, WmsItemBrandRespVO.class)); | |
| 86 | + } | |
| 87 | + | |
| 88 | + @GetMapping("/export-excel") | |
| 89 | + @Operation(summary = "导出商品品牌 Excel") | |
| 90 | + @PreAuthorize("@ss.hasPermission('wms:item-brand:export')") | |
| 91 | + @ApiAccessLog(operateType = EXPORT) | |
| 92 | + public void exportItemBrandExcel(@Valid WmsItemBrandPageReqVO pageReqVO, | |
| 93 | + HttpServletResponse response) throws IOException { | |
| 94 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 95 | + List<WmsItemBrandDO> list = brandService.getItemBrandPage(pageReqVO).getList(); | |
| 96 | + ExcelUtils.write(response, "商品品牌.xls", "数据", WmsItemBrandRespVO.class, | |
| 97 | + BeanUtils.toBean(list, WmsItemBrandRespVO.class)); | |
| 98 | + } | |
| 99 | + | |
| 100 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/md/item/WmsItemCategoryController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.md.item; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 4 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 5 | +import cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.category.WmsItemCategoryListReqVO; | |
| 6 | +import cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.category.WmsItemCategoryRespVO; | |
| 7 | +import cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.category.WmsItemCategorySaveReqVO; | |
| 8 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemCategoryDO; | |
| 9 | +import cn.iocoder.yudao.module.wms.service.md.item.WmsItemCategoryService; | |
| 10 | +import io.swagger.v3.oas.annotations.Operation; | |
| 11 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 12 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 13 | +import jakarta.annotation.Resource; | |
| 14 | +import jakarta.validation.Valid; | |
| 15 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 16 | +import org.springframework.validation.annotation.Validated; | |
| 17 | +import org.springframework.web.bind.annotation.*; | |
| 18 | + | |
| 19 | +import java.util.List; | |
| 20 | + | |
| 21 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 22 | + | |
| 23 | +@Tag(name = "管理后台 - WMS 商品分类") | |
| 24 | +@RestController | |
| 25 | +@RequestMapping("/wms/item-category") | |
| 26 | +@Validated | |
| 27 | +public class WmsItemCategoryController { | |
| 28 | + | |
| 29 | + @Resource | |
| 30 | + private WmsItemCategoryService categoryService; | |
| 31 | + | |
| 32 | + @PostMapping("/create") | |
| 33 | + @Operation(summary = "创建商品分类") | |
| 34 | + @PreAuthorize("@ss.hasPermission('wms:item-category:create')") | |
| 35 | + public CommonResult<Long> createItemCategory(@Valid @RequestBody WmsItemCategorySaveReqVO createReqVO) { | |
| 36 | + return success(categoryService.createItemCategory(createReqVO)); | |
| 37 | + } | |
| 38 | + | |
| 39 | + @PutMapping("/update") | |
| 40 | + @Operation(summary = "更新商品分类") | |
| 41 | + @PreAuthorize("@ss.hasPermission('wms:item-category:update')") | |
| 42 | + public CommonResult<Boolean> updateItemCategory(@Valid @RequestBody WmsItemCategorySaveReqVO updateReqVO) { | |
| 43 | + categoryService.updateItemCategory(updateReqVO); | |
| 44 | + return success(true); | |
| 45 | + } | |
| 46 | + | |
| 47 | + @DeleteMapping("/delete") | |
| 48 | + @Operation(summary = "删除商品分类") | |
| 49 | + @Parameter(name = "id", description = "编号", required = true) | |
| 50 | + @PreAuthorize("@ss.hasPermission('wms:item-category:delete')") | |
| 51 | + public CommonResult<Boolean> deleteItemCategory(@RequestParam("id") Long id) { | |
| 52 | + categoryService.deleteItemCategory(id); | |
| 53 | + return success(true); | |
| 54 | + } | |
| 55 | + | |
| 56 | + @GetMapping("/get") | |
| 57 | + @Operation(summary = "获得商品分类") | |
| 58 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 59 | + @PreAuthorize("@ss.hasPermission('wms:item-category:query')") | |
| 60 | + public CommonResult<WmsItemCategoryRespVO> getItemCategory(@RequestParam("id") Long id) { | |
| 61 | + WmsItemCategoryDO category = categoryService.getItemCategory(id); | |
| 62 | + return success(BeanUtils.toBean(category, WmsItemCategoryRespVO.class)); | |
| 63 | + } | |
| 64 | + | |
| 65 | + @GetMapping("/list") | |
| 66 | + @Operation(summary = "获得商品分类列表") | |
| 67 | + @PreAuthorize("@ss.hasPermission('wms:item-category:query')") | |
| 68 | + public CommonResult<List<WmsItemCategoryRespVO>> getItemCategoryList(@Valid WmsItemCategoryListReqVO listReqVO) { | |
| 69 | + List<WmsItemCategoryDO> list = categoryService.getItemCategoryList(listReqVO); | |
| 70 | + return success(BeanUtils.toBean(list, WmsItemCategoryRespVO.class)); | |
| 71 | + } | |
| 72 | + | |
| 73 | + @GetMapping("/simple-list") | |
| 74 | + @Operation(summary = "获得商品分类精简列表", description = "主要用于前端下拉") | |
| 75 | + @PreAuthorize("@ss.hasPermission('wms:item-category:query')") | |
| 76 | + public CommonResult<List<WmsItemCategoryRespVO>> getItemCategorySimpleList() { | |
| 77 | + List<WmsItemCategoryDO> list = categoryService.getItemCategoryList(new WmsItemCategoryListReqVO()); | |
| 78 | + return success(BeanUtils.toBean(list, WmsItemCategoryRespVO.class)); | |
| 79 | + } | |
| 80 | + | |
| 81 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/md/item/WmsItemController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.md.item; | |
| 2 | + | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 4 | +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; | |
| 5 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 6 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 7 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 8 | +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | |
| 9 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 10 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | |
| 11 | +import cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.item.WmsItemListReqVO; | |
| 12 | +import cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.item.WmsItemPageReqVO; | |
| 13 | +import cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.item.WmsItemRespVO; | |
| 14 | +import cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.item.WmsItemSaveReqVO; | |
| 15 | +import cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.sku.WmsItemSkuRespVO; | |
| 16 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemBrandDO; | |
| 17 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemCategoryDO; | |
| 18 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemDO; | |
| 19 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemSkuDO; | |
| 20 | +import cn.iocoder.yudao.module.wms.service.md.item.WmsItemBrandService; | |
| 21 | +import cn.iocoder.yudao.module.wms.service.md.item.WmsItemCategoryService; | |
| 22 | +import cn.iocoder.yudao.module.wms.service.md.item.WmsItemService; | |
| 23 | +import cn.iocoder.yudao.module.wms.service.md.item.WmsItemSkuService; | |
| 24 | +import io.swagger.v3.oas.annotations.Operation; | |
| 25 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 26 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 27 | +import jakarta.annotation.Resource; | |
| 28 | +import jakarta.servlet.http.HttpServletResponse; | |
| 29 | +import jakarta.validation.Valid; | |
| 30 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 31 | +import org.springframework.validation.annotation.Validated; | |
| 32 | +import org.springframework.web.bind.annotation.*; | |
| 33 | + | |
| 34 | +import java.io.IOException; | |
| 35 | +import java.util.Collections; | |
| 36 | +import java.util.List; | |
| 37 | +import java.util.Map; | |
| 38 | + | |
| 39 | +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | |
| 40 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 41 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; | |
| 42 | + | |
| 43 | +@Tag(name = "管理后台 - WMS 商品") | |
| 44 | +@RestController | |
| 45 | +@RequestMapping("/wms/item") | |
| 46 | +@Validated | |
| 47 | +public class WmsItemController { | |
| 48 | + | |
| 49 | + @Resource | |
| 50 | + private WmsItemService itemService; | |
| 51 | + @Resource | |
| 52 | + private WmsItemCategoryService categoryService; | |
| 53 | + @Resource | |
| 54 | + private WmsItemBrandService brandService; | |
| 55 | + @Resource | |
| 56 | + private WmsItemSkuService itemSkuService; | |
| 57 | + | |
| 58 | + @PostMapping("/create") | |
| 59 | + @Operation(summary = "创建商品") | |
| 60 | + @PreAuthorize("@ss.hasPermission('wms:item:create')") | |
| 61 | + public CommonResult<Long> createItem(@Valid @RequestBody WmsItemSaveReqVO createReqVO) { | |
| 62 | + return success(itemService.createItem(createReqVO)); | |
| 63 | + } | |
| 64 | + | |
| 65 | + @PutMapping("/update") | |
| 66 | + @Operation(summary = "更新商品") | |
| 67 | + @PreAuthorize("@ss.hasPermission('wms:item:update')") | |
| 68 | + public CommonResult<Boolean> updateItem(@Valid @RequestBody WmsItemSaveReqVO updateReqVO) { | |
| 69 | + itemService.updateItem(updateReqVO); | |
| 70 | + return success(true); | |
| 71 | + } | |
| 72 | + | |
| 73 | + @DeleteMapping("/delete") | |
| 74 | + @Operation(summary = "删除商品") | |
| 75 | + @Parameter(name = "id", description = "编号", required = true) | |
| 76 | + @PreAuthorize("@ss.hasPermission('wms:item:delete')") | |
| 77 | + public CommonResult<Boolean> deleteItem(@RequestParam("id") Long id) { | |
| 78 | + itemService.deleteItem(id); | |
| 79 | + return success(true); | |
| 80 | + } | |
| 81 | + | |
| 82 | + @GetMapping("/get") | |
| 83 | + @Operation(summary = "获得商品") | |
| 84 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 85 | + @PreAuthorize("@ss.hasPermission('wms:item:query')") | |
| 86 | + public CommonResult<WmsItemRespVO> getItem(@RequestParam("id") Long id) { | |
| 87 | + WmsItemDO item = itemService.getItem(id); | |
| 88 | + return success(buildItemRespVO(item)); | |
| 89 | + } | |
| 90 | + | |
| 91 | + @GetMapping("/page") | |
| 92 | + @Operation(summary = "获得商品分页") | |
| 93 | + @PreAuthorize("@ss.hasPermission('wms:item:query')") | |
| 94 | + public CommonResult<PageResult<WmsItemRespVO>> getItemPage(@Valid WmsItemPageReqVO pageReqVO) { | |
| 95 | + PageResult<WmsItemDO> pageResult = itemService.getItemPage(pageReqVO); | |
| 96 | + return success(new PageResult<>(buildItemRespVOList(pageResult.getList()), pageResult.getTotal())); | |
| 97 | + } | |
| 98 | + | |
| 99 | + @GetMapping("/simple-list") | |
| 100 | + @Operation(summary = "获得商品精简列表") | |
| 101 | + @PreAuthorize("@ss.hasPermission('wms:item:query')") | |
| 102 | + public CommonResult<List<WmsItemRespVO>> getItemSimpleList(@Valid WmsItemListReqVO listReqVO) { | |
| 103 | + List<WmsItemDO> list = itemService.getItemList(listReqVO); | |
| 104 | + return success(buildItemRespVOList(list)); | |
| 105 | + } | |
| 106 | + | |
| 107 | + @GetMapping("/export-excel") | |
| 108 | + @Operation(summary = "导出商品 Excel") | |
| 109 | + @PreAuthorize("@ss.hasPermission('wms:item:export')") | |
| 110 | + @ApiAccessLog(operateType = EXPORT) | |
| 111 | + public void exportItemExcel(@Valid WmsItemPageReqVO pageReqVO, | |
| 112 | + HttpServletResponse response) throws IOException { | |
| 113 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 114 | + List<WmsItemDO> list = itemService.getItemPage(pageReqVO).getList(); | |
| 115 | + ExcelUtils.write(response, "商品.xls", "数据", WmsItemRespVO.class, | |
| 116 | + buildItemRespVOList(list)); | |
| 117 | + } | |
| 118 | + | |
| 119 | + // ==================== 拼接 VO ==================== | |
| 120 | + | |
| 121 | + private WmsItemRespVO buildItemRespVO(WmsItemDO item) { | |
| 122 | + if (item == null) { | |
| 123 | + return null; | |
| 124 | + } | |
| 125 | + return getFirst(buildItemRespVOList(Collections.singletonList(item))); | |
| 126 | + } | |
| 127 | + | |
| 128 | + private List<WmsItemRespVO> buildItemRespVOList(List<WmsItemDO> list) { | |
| 129 | + if (CollUtil.isEmpty(list)) { | |
| 130 | + return Collections.emptyList(); | |
| 131 | + } | |
| 132 | + // 查询关联数据 | |
| 133 | + Map<Long, WmsItemCategoryDO> categoryMap = categoryService.getItemCategoryMap( | |
| 134 | + convertSet(list, WmsItemDO::getCategoryId)); | |
| 135 | + Map<Long, WmsItemBrandDO> brandMap = brandService.getItemBrandMap( | |
| 136 | + convertSet(list, WmsItemDO::getBrandId)); | |
| 137 | + Map<Long, List<WmsItemSkuDO>> skuMap = itemSkuService.getItemSkuMultiMap( | |
| 138 | + convertSet(list, WmsItemDO::getId)); | |
| 139 | + // 拼接 VO | |
| 140 | + return BeanUtils.toBean(list, WmsItemRespVO.class, vo -> { | |
| 141 | + MapUtils.findAndThen(categoryMap, vo.getCategoryId(), category -> | |
| 142 | + vo.setCategoryName(category.getName())); | |
| 143 | + MapUtils.findAndThen(brandMap, vo.getBrandId(), brand -> | |
| 144 | + vo.setBrandName(brand.getName())); | |
| 145 | + vo.setSkus(BeanUtils.toBean(skuMap.getOrDefault(vo.getId(), Collections.emptyList()), | |
| 146 | + WmsItemSkuRespVO.class)); | |
| 147 | + }); | |
| 148 | + } | |
| 149 | + | |
| 150 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/md/item/WmsItemSkuController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.md.item; | |
| 2 | + | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | |
| 7 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 8 | +import cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.sku.WmsItemSkuPageReqVO; | |
| 9 | +import cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.sku.WmsItemSkuRespVO; | |
| 10 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemBrandDO; | |
| 11 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemCategoryDO; | |
| 12 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemDO; | |
| 13 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemSkuDO; | |
| 14 | +import cn.iocoder.yudao.module.wms.service.md.item.WmsItemBrandService; | |
| 15 | +import cn.iocoder.yudao.module.wms.service.md.item.WmsItemCategoryService; | |
| 16 | +import cn.iocoder.yudao.module.wms.service.md.item.WmsItemService; | |
| 17 | +import cn.iocoder.yudao.module.wms.service.md.item.WmsItemSkuService; | |
| 18 | +import io.swagger.v3.oas.annotations.Operation; | |
| 19 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 20 | +import jakarta.annotation.Resource; | |
| 21 | +import jakarta.validation.Valid; | |
| 22 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 23 | +import org.springframework.validation.annotation.Validated; | |
| 24 | +import org.springframework.web.bind.annotation.GetMapping; | |
| 25 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 26 | +import org.springframework.web.bind.annotation.RestController; | |
| 27 | + | |
| 28 | +import java.util.Collections; | |
| 29 | +import java.util.List; | |
| 30 | +import java.util.Map; | |
| 31 | + | |
| 32 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 33 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | |
| 34 | + | |
| 35 | +/** | |
| 36 | + * WMS 商品 SKU Controller。 | |
| 37 | + * | |
| 38 | + * <p>SKU 维度的查询入口:弹窗 / 选择器场景使用,按 SKU 一行展开,支持商品 / 品牌 / 分类多表联查筛选。 | |
| 39 | + * 复用商品权限 {@code wms:item:query},不单独建权限点(lite 也是商品/SKU 共用 {@code wms:item:list})。 | |
| 40 | + * | |
| 41 | + * <p>SKU 的新增 / 修改 / 删除仍随商品弹窗一并维护,不在本 Controller 暴露。 | |
| 42 | + */ | |
| 43 | +@Tag(name = "管理后台 - WMS 商品 SKU") | |
| 44 | +@RestController | |
| 45 | +@RequestMapping("/wms/item-sku") | |
| 46 | +@Validated | |
| 47 | +public class WmsItemSkuController { | |
| 48 | + | |
| 49 | + @Resource | |
| 50 | + private WmsItemSkuService itemSkuService; | |
| 51 | + @Resource | |
| 52 | + private WmsItemService itemService; | |
| 53 | + @Resource | |
| 54 | + private WmsItemCategoryService categoryService; | |
| 55 | + @Resource | |
| 56 | + private WmsItemBrandService brandService; | |
| 57 | + | |
| 58 | + @GetMapping("/page") | |
| 59 | + @Operation(summary = "获得商品 SKU 分页", description = "按 SKU 维度分页,支持商品 / 品牌 / 分类多表联查筛选") | |
| 60 | + @PreAuthorize("@ss.hasPermission('wms:item:query')") | |
| 61 | + public CommonResult<PageResult<WmsItemSkuRespVO>> getItemSkuPage(@Valid WmsItemSkuPageReqVO pageReqVO) { | |
| 62 | + PageResult<WmsItemSkuDO> pageResult = itemSkuService.getItemSkuPage(pageReqVO); | |
| 63 | + return success(new PageResult<>(buildItemSkuRespVOList(pageResult.getList()), pageResult.getTotal())); | |
| 64 | + } | |
| 65 | + | |
| 66 | + // ==================== 拼接 VO ==================== | |
| 67 | + | |
| 68 | + private List<WmsItemSkuRespVO> buildItemSkuRespVOList(List<WmsItemSkuDO> list) { | |
| 69 | + if (CollUtil.isEmpty(list)) { | |
| 70 | + return Collections.emptyList(); | |
| 71 | + } | |
| 72 | + // 查询关联数据 | |
| 73 | + Map<Long, WmsItemDO> itemMap = itemService.getItemMap(convertSet(list, WmsItemSkuDO::getItemId)); | |
| 74 | + Map<Long, WmsItemCategoryDO> categoryMap = categoryService.getItemCategoryMap( | |
| 75 | + convertSet(itemMap.values(), WmsItemDO::getCategoryId)); | |
| 76 | + Map<Long, WmsItemBrandDO> brandMap = brandService.getItemBrandMap( | |
| 77 | + convertSet(itemMap.values(), WmsItemDO::getBrandId)); | |
| 78 | + // 拼接 VO | |
| 79 | + return BeanUtils.toBean(list, WmsItemSkuRespVO.class, vo -> MapUtils.findAndThen(itemMap, vo.getItemId(), item -> { | |
| 80 | + vo.setItemCode(item.getCode()).setItemName(item.getName()).setUnit(item.getUnit()) | |
| 81 | + .setCategoryId(item.getCategoryId()).setBrandId(item.getBrandId()); | |
| 82 | + MapUtils.findAndThen(categoryMap, item.getCategoryId(), category -> | |
| 83 | + vo.setCategoryName(category.getName())); | |
| 84 | + MapUtils.findAndThen(brandMap, item.getBrandId(), brand -> | |
| 85 | + vo.setBrandName(brand.getName())); | |
| 86 | + })); | |
| 87 | + } | |
| 88 | + | |
| 89 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/md/item/vo/brand/WmsItemBrandPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.brand; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | +import lombok.Data; | |
| 6 | +import lombok.EqualsAndHashCode; | |
| 7 | +import lombok.ToString; | |
| 8 | + | |
| 9 | +@Schema(description = "管理后台 - WMS 商品品牌分页 Request VO") | |
| 10 | +@Data | |
| 11 | +@EqualsAndHashCode(callSuper = true) | |
| 12 | +@ToString(callSuper = true) | |
| 13 | +public class WmsItemBrandPageReqVO extends PageParam { | |
| 14 | + | |
| 15 | + @Schema(description = "品牌编号", example = "B00000001") | |
| 16 | + private String code; | |
| 17 | + | |
| 18 | + @Schema(description = "品牌名称", example = "华为") | |
| 19 | + private String name; | |
| 20 | + | |
| 21 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/md/item/vo/brand/WmsItemBrandRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.brand; | |
| 2 | + | |
| 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; | |
| 4 | +import cn.idev.excel.annotation.ExcelProperty; | |
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | +import lombok.Data; | |
| 7 | + | |
| 8 | +import java.time.LocalDateTime; | |
| 9 | + | |
| 10 | +@Schema(description = "管理后台 - WMS 商品品牌 Response VO") | |
| 11 | +@Data | |
| 12 | +@ExcelIgnoreUnannotated | |
| 13 | +public class WmsItemBrandRespVO { | |
| 14 | + | |
| 15 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 16 | + @ExcelProperty("编号") | |
| 17 | + private Long id; | |
| 18 | + | |
| 19 | + @Schema(description = "品牌编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "B00000001") | |
| 20 | + @ExcelProperty("品牌编号") | |
| 21 | + private String code; | |
| 22 | + | |
| 23 | + @Schema(description = "品牌名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "华为") | |
| 24 | + @ExcelProperty("品牌名称") | |
| 25 | + private String name; | |
| 26 | + | |
| 27 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 28 | + @ExcelProperty("创建时间") | |
| 29 | + private LocalDateTime createTime; | |
| 30 | + | |
| 31 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/md/item/vo/brand/WmsItemBrandSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.brand; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import jakarta.validation.constraints.NotEmpty; | |
| 5 | +import jakarta.validation.constraints.Size; | |
| 6 | +import lombok.Data; | |
| 7 | + | |
| 8 | +@Schema(description = "管理后台 - WMS 商品品牌新增/修改 Request VO") | |
| 9 | +@Data | |
| 10 | +public class WmsItemBrandSaveReqVO { | |
| 11 | + | |
| 12 | + @Schema(description = "编号", example = "1024") | |
| 13 | + private Long id; | |
| 14 | + | |
| 15 | + @Schema(description = "品牌编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "B00000001") | |
| 16 | + @NotEmpty(message = "品牌编号不能为空") | |
| 17 | + @Size(max = 20, message = "品牌编号长度不能超过 20 个字符") | |
| 18 | + private String code; | |
| 19 | + | |
| 20 | + @Schema(description = "品牌名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "华为") | |
| 21 | + @NotEmpty(message = "品牌名称不能为空") | |
| 22 | + @Size(max = 30, message = "品牌名称长度不能超过 30 个字符") | |
| 23 | + private String name; | |
| 24 | + | |
| 25 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/md/item/vo/category/WmsItemCategoryListReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.category; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | |
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | +import lombok.Data; | |
| 7 | + | |
| 8 | +@Schema(description = "管理后台 - WMS 商品分类列表 Request VO") | |
| 9 | +@Data | |
| 10 | +public class WmsItemCategoryListReqVO { | |
| 11 | + | |
| 12 | + @Schema(description = "父级编号", example = "1") | |
| 13 | + private Long parentId; | |
| 14 | + | |
| 15 | + @Schema(description = "分类编号", example = "C00000001") | |
| 16 | + private String code; | |
| 17 | + | |
| 18 | + @Schema(description = "分类名称", example = "原料") | |
| 19 | + private String name; | |
| 20 | + | |
| 21 | + @Schema(description = "状态", example = "0") | |
| 22 | + @InEnum(value = CommonStatusEnum.class, message = "状态必须是 {value}") | |
| 23 | + private Integer status; | |
| 24 | + | |
| 25 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/md/item/vo/category/WmsItemCategoryRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.category; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +import java.time.LocalDateTime; | |
| 7 | + | |
| 8 | +@Schema(description = "管理后台 - WMS 商品分类 Response VO") | |
| 9 | +@Data | |
| 10 | +public class WmsItemCategoryRespVO { | |
| 11 | + | |
| 12 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 13 | + private Long id; | |
| 14 | + | |
| 15 | + @Schema(description = "父级编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | |
| 16 | + private Long parentId; | |
| 17 | + | |
| 18 | + @Schema(description = "分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "C00000001") | |
| 19 | + private String code; | |
| 20 | + | |
| 21 | + @Schema(description = "分类名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "原料") | |
| 22 | + private String name; | |
| 23 | + | |
| 24 | + @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 25 | + private Integer sort; | |
| 26 | + | |
| 27 | + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | |
| 28 | + private Integer status; | |
| 29 | + | |
| 30 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 31 | + private LocalDateTime createTime; | |
| 32 | + | |
| 33 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/md/item/vo/category/WmsItemCategorySaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.category; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | |
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | +import jakarta.validation.constraints.NotEmpty; | |
| 7 | +import jakarta.validation.constraints.NotNull; | |
| 8 | +import jakarta.validation.constraints.Size; | |
| 9 | +import lombok.Data; | |
| 10 | + | |
| 11 | +@Schema(description = "管理后台 - WMS 商品分类新增/修改 Request VO") | |
| 12 | +@Data | |
| 13 | +public class WmsItemCategorySaveReqVO { | |
| 14 | + | |
| 15 | + @Schema(description = "编号", example = "1024") | |
| 16 | + private Long id; | |
| 17 | + | |
| 18 | + @Schema(description = "父级编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | |
| 19 | + @NotNull(message = "父级编号不能为空") | |
| 20 | + private Long parentId; | |
| 21 | + | |
| 22 | + @Schema(description = "分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "C00000001") | |
| 23 | + @NotEmpty(message = "分类编号不能为空") | |
| 24 | + @Size(max = 20, message = "分类编号长度不能超过 20 个字符") | |
| 25 | + private String code; | |
| 26 | + | |
| 27 | + @Schema(description = "分类名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "原料") | |
| 28 | + @NotEmpty(message = "分类名称不能为空") | |
| 29 | + @Size(max = 30, message = "分类名称长度不能超过 30 个字符") | |
| 30 | + private String name; | |
| 31 | + | |
| 32 | + @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 33 | + @NotNull(message = "排序不能为空") | |
| 34 | + private Integer sort; | |
| 35 | + | |
| 36 | + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | |
| 37 | + @NotNull(message = "状态不能为空") | |
| 38 | + @InEnum(value = CommonStatusEnum.class, message = "状态必须是 {value}") | |
| 39 | + private Integer status; | |
| 40 | + | |
| 41 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/md/item/vo/item/WmsItemListReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.item; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 6 | + | |
| 7 | +import java.time.LocalDateTime; | |
| 8 | + | |
| 9 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 10 | + | |
| 11 | +@Schema(description = "管理后台 - WMS 商品列表 Request VO") | |
| 12 | +@Data | |
| 13 | +public class WmsItemListReqVO { | |
| 14 | + | |
| 15 | + @Schema(description = "商品编号", example = "ITEM001") | |
| 16 | + private String code; | |
| 17 | + | |
| 18 | + @Schema(description = "商品名称", example = "华为 nova flip") | |
| 19 | + private String name; | |
| 20 | + | |
| 21 | + @Schema(description = "商品分类编号", example = "1024") | |
| 22 | + private Long categoryId; | |
| 23 | + | |
| 24 | + @Schema(description = "商品品牌编号", example = "2048") | |
| 25 | + private Long brandId; | |
| 26 | + | |
| 27 | + @Schema(description = "创建时间") | |
| 28 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 29 | + private LocalDateTime[] createTime; | |
| 30 | + | |
| 31 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/md/item/vo/item/WmsItemPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.item; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | +import lombok.Data; | |
| 6 | +import lombok.EqualsAndHashCode; | |
| 7 | +import lombok.ToString; | |
| 8 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 9 | + | |
| 10 | +import java.time.LocalDateTime; | |
| 11 | + | |
| 12 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 13 | + | |
| 14 | +@Schema(description = "管理后台 - WMS 商品分页 Request VO") | |
| 15 | +@Data | |
| 16 | +@EqualsAndHashCode(callSuper = true) | |
| 17 | +@ToString(callSuper = true) | |
| 18 | +public class WmsItemPageReqVO extends PageParam { | |
| 19 | + | |
| 20 | + @Schema(description = "商品编号", example = "ITEM001") | |
| 21 | + private String code; | |
| 22 | + | |
| 23 | + @Schema(description = "商品名称", example = "华为 nova flip") | |
| 24 | + private String name; | |
| 25 | + | |
| 26 | + @Schema(description = "商品分类编号", example = "1024") | |
| 27 | + private Long categoryId; | |
| 28 | + | |
| 29 | + @Schema(description = "商品品牌编号", example = "2048") | |
| 30 | + private Long brandId; | |
| 31 | + | |
| 32 | + @Schema(description = "创建时间") | |
| 33 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 34 | + private LocalDateTime[] createTime; | |
| 35 | + | |
| 36 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/md/item/vo/item/WmsItemRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.item; | |
| 2 | + | |
| 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; | |
| 4 | +import cn.idev.excel.annotation.ExcelProperty; | |
| 5 | +import cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.sku.WmsItemSkuRespVO; | |
| 6 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 7 | +import lombok.Data; | |
| 8 | + | |
| 9 | +import java.time.LocalDateTime; | |
| 10 | +import java.util.List; | |
| 11 | + | |
| 12 | +@Schema(description = "管理后台 - WMS 商品 Response VO") | |
| 13 | +@Data | |
| 14 | +@ExcelIgnoreUnannotated | |
| 15 | +public class WmsItemRespVO { | |
| 16 | + | |
| 17 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 18 | + @ExcelProperty("编号") | |
| 19 | + private Long id; | |
| 20 | + | |
| 21 | + @Schema(description = "商品编号", example = "ITEM001") | |
| 22 | + @ExcelProperty("商品编号") | |
| 23 | + private String code; | |
| 24 | + | |
| 25 | + @Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "华为 nova flip") | |
| 26 | + @ExcelProperty("商品名称") | |
| 27 | + private String name; | |
| 28 | + | |
| 29 | + @Schema(description = "商品分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 30 | + private Long categoryId; | |
| 31 | + | |
| 32 | + @Schema(description = "商品分类名称", example = "手机") | |
| 33 | + @ExcelProperty("商品分类") | |
| 34 | + private String categoryName; | |
| 35 | + | |
| 36 | + @Schema(description = "单位", example = "台") | |
| 37 | + @ExcelProperty("单位") | |
| 38 | + private String unit; | |
| 39 | + | |
| 40 | + @Schema(description = "商品品牌编号", example = "1") | |
| 41 | + private Long brandId; | |
| 42 | + | |
| 43 | + @Schema(description = "商品品牌名称", example = "华为") | |
| 44 | + @ExcelProperty("商品品牌") | |
| 45 | + private String brandName; | |
| 46 | + | |
| 47 | + @Schema(description = "备注", example = "备注") | |
| 48 | + @ExcelProperty("备注") | |
| 49 | + private String remark; | |
| 50 | + | |
| 51 | + @Schema(description = "规格列表") | |
| 52 | + private List<WmsItemSkuRespVO> skus; | |
| 53 | + | |
| 54 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 55 | + @ExcelProperty("创建时间") | |
| 56 | + private LocalDateTime createTime; | |
| 57 | + | |
| 58 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/md/item/vo/item/WmsItemSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.item; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.sku.WmsItemSkuSaveReqVO; | |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | +import jakarta.validation.Valid; | |
| 6 | +import jakarta.validation.constraints.NotBlank; | |
| 7 | +import jakarta.validation.constraints.NotEmpty; | |
| 8 | +import jakarta.validation.constraints.NotNull; | |
| 9 | +import jakarta.validation.constraints.Size; | |
| 10 | +import lombok.Data; | |
| 11 | + | |
| 12 | +import java.util.List; | |
| 13 | + | |
| 14 | +@Schema(description = "管理后台 - WMS 商品创建/更新 Request VO") | |
| 15 | +@Data | |
| 16 | +public class WmsItemSaveReqVO { | |
| 17 | + | |
| 18 | + @Schema(description = "编号", example = "1024") | |
| 19 | + private Long id; | |
| 20 | + | |
| 21 | + @Schema(description = "商品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "ITEM001") | |
| 22 | + @NotBlank(message = "商品编号不能为空") | |
| 23 | + @Size(max = 20, message = "商品编号长度不能超过 20 个字符") | |
| 24 | + private String code; | |
| 25 | + | |
| 26 | + @Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "华为 nova flip") | |
| 27 | + @NotBlank(message = "商品名称不能为空") | |
| 28 | + @Size(max = 60, message = "商品名称长度不能超过 60 个字符") | |
| 29 | + private String name; | |
| 30 | + | |
| 31 | + @Schema(description = "商品分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 32 | + @NotNull(message = "商品分类不能为空") | |
| 33 | + private Long categoryId; | |
| 34 | + | |
| 35 | + @Schema(description = "单位", example = "台") | |
| 36 | + @Size(max = 20, message = "单位长度不能超过 20 个字符") | |
| 37 | + private String unit; | |
| 38 | + | |
| 39 | + @Schema(description = "商品品牌编号", example = "1") | |
| 40 | + private Long brandId; | |
| 41 | + | |
| 42 | + @Schema(description = "备注", example = "备注") | |
| 43 | + @Size(max = 255, message = "备注长度不能超过 255 个字符") | |
| 44 | + private String remark; | |
| 45 | + | |
| 46 | + @Schema(description = "规格列表") | |
| 47 | + @Valid | |
| 48 | + @NotEmpty(message = "至少包含一个商品规格") | |
| 49 | + private List<WmsItemSkuSaveReqVO> skus; | |
| 50 | + | |
| 51 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/md/item/vo/sku/WmsItemSkuPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.sku; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | +import lombok.Data; | |
| 6 | +import lombok.EqualsAndHashCode; | |
| 7 | +import lombok.ToString; | |
| 8 | + | |
| 9 | +@Schema(description = "管理后台 - WMS 商品 SKU 分页 Request VO") | |
| 10 | +@Data | |
| 11 | +@EqualsAndHashCode(callSuper = true) | |
| 12 | +@ToString(callSuper = true) | |
| 13 | +public class WmsItemSkuPageReqVO extends PageParam { | |
| 14 | + | |
| 15 | + @Schema(description = "商品编号", example = "I00000001") | |
| 16 | + private String itemCode; | |
| 17 | + | |
| 18 | + @Schema(description = "商品名称", example = "华为 nova flip") | |
| 19 | + private String itemName; | |
| 20 | + | |
| 21 | + @Schema(description = "商品分类编号", example = "1") | |
| 22 | + private Long categoryId; | |
| 23 | + | |
| 24 | + @Schema(description = "商品品牌编号", example = "1") | |
| 25 | + private Long brandId; | |
| 26 | + | |
| 27 | + @Schema(description = "规格编号", example = "S00000001") | |
| 28 | + private String code; | |
| 29 | + | |
| 30 | + @Schema(description = "规格名称", example = "黑色") | |
| 31 | + private String name; | |
| 32 | + | |
| 33 | + @Schema(description = "条码", example = "12345678") | |
| 34 | + private String barCode; | |
| 35 | + | |
| 36 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/md/item/vo/sku/WmsItemSkuRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.sku; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +import java.math.BigDecimal; | |
| 7 | +import java.time.LocalDateTime; | |
| 8 | + | |
| 9 | +@Schema(description = "管理后台 - WMS 商品 SKU Response VO") | |
| 10 | +@Data | |
| 11 | +public class WmsItemSkuRespVO { | |
| 12 | + | |
| 13 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 14 | + private Long id; | |
| 15 | + | |
| 16 | + @Schema(description = "规格名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "黑色") | |
| 17 | + private String name; | |
| 18 | + | |
| 19 | + @Schema(description = "商品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 20 | + private Long itemId; | |
| 21 | + | |
| 22 | + @Schema(description = "商品编码", example = "ITEM001") | |
| 23 | + private String itemCode; | |
| 24 | + | |
| 25 | + @Schema(description = "商品名称", example = "华为 nova flip") | |
| 26 | + private String itemName; | |
| 27 | + | |
| 28 | + @Schema(description = "商品分类编号", example = "1") | |
| 29 | + private Long categoryId; | |
| 30 | + | |
| 31 | + @Schema(description = "商品分类名称", example = "手机") | |
| 32 | + private String categoryName; | |
| 33 | + | |
| 34 | + @Schema(description = "单位", example = "台") | |
| 35 | + private String unit; | |
| 36 | + | |
| 37 | + @Schema(description = "商品品牌编号", example = "1") | |
| 38 | + private Long brandId; | |
| 39 | + | |
| 40 | + @Schema(description = "商品品牌名称", example = "华为") | |
| 41 | + private String brandName; | |
| 42 | + | |
| 43 | + @Schema(description = "条码", example = "690000000001") | |
| 44 | + private String barCode; | |
| 45 | + | |
| 46 | + @Schema(description = "规格编号", example = "SKU001") | |
| 47 | + private String code; | |
| 48 | + | |
| 49 | + @Schema(description = "长,单位 cm", example = "10.0") | |
| 50 | + private BigDecimal length; | |
| 51 | + | |
| 52 | + @Schema(description = "宽,单位 cm", example = "8.0") | |
| 53 | + private BigDecimal width; | |
| 54 | + | |
| 55 | + @Schema(description = "高,单位 cm", example = "1.0") | |
| 56 | + private BigDecimal height; | |
| 57 | + | |
| 58 | + @Schema(description = "毛重,单位 kg", example = "1.000") | |
| 59 | + private BigDecimal grossWeight; | |
| 60 | + | |
| 61 | + @Schema(description = "净重,单位 kg", example = "0.900") | |
| 62 | + private BigDecimal netWeight; | |
| 63 | + | |
| 64 | + @Schema(description = "成本价,单位元", example = "5000.00") | |
| 65 | + private BigDecimal costPrice; | |
| 66 | + | |
| 67 | + @Schema(description = "销售价,单位元", example = "5288.00") | |
| 68 | + private BigDecimal sellingPrice; | |
| 69 | + | |
| 70 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 71 | + private LocalDateTime createTime; | |
| 72 | + | |
| 73 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/md/item/vo/sku/WmsItemSkuSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.sku; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import jakarta.validation.constraints.DecimalMin; | |
| 5 | +import jakarta.validation.constraints.NotBlank; | |
| 6 | +import jakarta.validation.constraints.Size; | |
| 7 | +import lombok.Data; | |
| 8 | + | |
| 9 | +import java.math.BigDecimal; | |
| 10 | + | |
| 11 | +@Schema(description = "管理后台 - WMS 商品 SKU 创建/更新 Request VO") | |
| 12 | +@Data | |
| 13 | +public class WmsItemSkuSaveReqVO { | |
| 14 | + | |
| 15 | + @Schema(description = "编号", example = "1024") | |
| 16 | + private Long id; | |
| 17 | + | |
| 18 | + @Schema(description = "规格名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "黑色") | |
| 19 | + @NotBlank(message = "规格名称不能为空") | |
| 20 | + @Size(max = 255, message = "规格名称长度不能超过 255 个字符") | |
| 21 | + private String name; | |
| 22 | + | |
| 23 | + @Schema(description = "商品编号", example = "1") | |
| 24 | + private Long itemId; | |
| 25 | + | |
| 26 | + @Schema(description = "条码", example = "690000000001") | |
| 27 | + @Size(max = 64, message = "条码长度不能超过 64 个字符") | |
| 28 | + private String barCode; | |
| 29 | + | |
| 30 | + @Schema(description = "规格编号", example = "SKU001") | |
| 31 | + @Size(max = 64, message = "规格编号长度不能超过 64 个字符") | |
| 32 | + private String code; | |
| 33 | + | |
| 34 | + @Schema(description = "长,单位 cm", example = "10.0") | |
| 35 | + @DecimalMin(value = "0", message = "长不能小于 0") | |
| 36 | + private BigDecimal length; | |
| 37 | + | |
| 38 | + @Schema(description = "宽,单位 cm", example = "8.0") | |
| 39 | + @DecimalMin(value = "0", message = "宽不能小于 0") | |
| 40 | + private BigDecimal width; | |
| 41 | + | |
| 42 | + @Schema(description = "高,单位 cm", example = "1.0") | |
| 43 | + @DecimalMin(value = "0", message = "高不能小于 0") | |
| 44 | + private BigDecimal height; | |
| 45 | + | |
| 46 | + @Schema(description = "毛重,单位 kg", example = "1.000") | |
| 47 | + @DecimalMin(value = "0", message = "毛重不能小于 0") | |
| 48 | + private BigDecimal grossWeight; | |
| 49 | + | |
| 50 | + @Schema(description = "净重,单位 kg", example = "0.900") | |
| 51 | + @DecimalMin(value = "0", message = "净重不能小于 0") | |
| 52 | + private BigDecimal netWeight; | |
| 53 | + | |
| 54 | + @Schema(description = "成本价,单位元", example = "5000.00") | |
| 55 | + @DecimalMin(value = "0", message = "成本价不能小于 0") | |
| 56 | + private BigDecimal costPrice; | |
| 57 | + | |
| 58 | + @Schema(description = "销售价,单位元", example = "5288.00") | |
| 59 | + @DecimalMin(value = "0", message = "销售价不能小于 0") | |
| 60 | + private BigDecimal sellingPrice; | |
| 61 | + | |
| 62 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/md/merchant/WmsMerchantController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.md.merchant; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 6 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 7 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 8 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | |
| 9 | +import cn.iocoder.yudao.module.wms.controller.admin.md.merchant.vo.WmsMerchantListReqVO; | |
| 10 | +import cn.iocoder.yudao.module.wms.controller.admin.md.merchant.vo.WmsMerchantPageReqVO; | |
| 11 | +import cn.iocoder.yudao.module.wms.controller.admin.md.merchant.vo.WmsMerchantRespVO; | |
| 12 | +import cn.iocoder.yudao.module.wms.controller.admin.md.merchant.vo.WmsMerchantSaveReqVO; | |
| 13 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.merchant.WmsMerchantDO; | |
| 14 | +import cn.iocoder.yudao.module.wms.service.md.merchant.WmsMerchantService; | |
| 15 | +import io.swagger.v3.oas.annotations.Operation; | |
| 16 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 17 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 18 | +import jakarta.annotation.Resource; | |
| 19 | +import jakarta.servlet.http.HttpServletResponse; | |
| 20 | +import jakarta.validation.Valid; | |
| 21 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 22 | +import org.springframework.validation.annotation.Validated; | |
| 23 | +import org.springframework.web.bind.annotation.*; | |
| 24 | + | |
| 25 | +import java.io.IOException; | |
| 26 | +import java.util.List; | |
| 27 | + | |
| 28 | +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | |
| 29 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 30 | + | |
| 31 | +@Tag(name = "管理后台 - WMS 往来企业") | |
| 32 | +@RestController | |
| 33 | +@RequestMapping("/wms/merchant") | |
| 34 | +@Validated | |
| 35 | +public class WmsMerchantController { | |
| 36 | + | |
| 37 | + @Resource | |
| 38 | + private WmsMerchantService merchantService; | |
| 39 | + | |
| 40 | + @PostMapping("/create") | |
| 41 | + @Operation(summary = "创建往来企业") | |
| 42 | + @PreAuthorize("@ss.hasPermission('wms:merchant:create')") | |
| 43 | + public CommonResult<Long> createMerchant(@Valid @RequestBody WmsMerchantSaveReqVO createReqVO) { | |
| 44 | + return success(merchantService.createMerchant(createReqVO)); | |
| 45 | + } | |
| 46 | + | |
| 47 | + @PutMapping("/update") | |
| 48 | + @Operation(summary = "更新往来企业") | |
| 49 | + @PreAuthorize("@ss.hasPermission('wms:merchant:update')") | |
| 50 | + public CommonResult<Boolean> updateMerchant(@Valid @RequestBody WmsMerchantSaveReqVO updateReqVO) { | |
| 51 | + merchantService.updateMerchant(updateReqVO); | |
| 52 | + return success(true); | |
| 53 | + } | |
| 54 | + | |
| 55 | + @DeleteMapping("/delete") | |
| 56 | + @Operation(summary = "删除往来企业") | |
| 57 | + @Parameter(name = "id", description = "编号", required = true) | |
| 58 | + @PreAuthorize("@ss.hasPermission('wms:merchant:delete')") | |
| 59 | + public CommonResult<Boolean> deleteMerchant(@RequestParam("id") Long id) { | |
| 60 | + merchantService.deleteMerchant(id); | |
| 61 | + return success(true); | |
| 62 | + } | |
| 63 | + | |
| 64 | + @GetMapping("/get") | |
| 65 | + @Operation(summary = "获得往来企业") | |
| 66 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 67 | + @PreAuthorize("@ss.hasPermission('wms:merchant:query')") | |
| 68 | + public CommonResult<WmsMerchantRespVO> getMerchant(@RequestParam("id") Long id) { | |
| 69 | + WmsMerchantDO merchant = merchantService.getMerchant(id); | |
| 70 | + return success(BeanUtils.toBean(merchant, WmsMerchantRespVO.class)); | |
| 71 | + } | |
| 72 | + | |
| 73 | + @GetMapping("/page") | |
| 74 | + @Operation(summary = "获得往来企业分页") | |
| 75 | + @PreAuthorize("@ss.hasPermission('wms:merchant:query')") | |
| 76 | + public CommonResult<PageResult<WmsMerchantRespVO>> getMerchantPage(@Valid WmsMerchantPageReqVO pageReqVO) { | |
| 77 | + PageResult<WmsMerchantDO> pageResult = merchantService.getMerchantPage(pageReqVO); | |
| 78 | + return success(BeanUtils.toBean(pageResult, WmsMerchantRespVO.class)); | |
| 79 | + } | |
| 80 | + | |
| 81 | + @GetMapping("/simple-list") | |
| 82 | + @Operation(summary = "获得往来企业精简列表", description = "主要用于前端下拉") | |
| 83 | + @PreAuthorize("@ss.hasPermission('wms:merchant:query')") | |
| 84 | + public CommonResult<List<WmsMerchantRespVO>> getMerchantSimpleList(@Valid WmsMerchantListReqVO listReqVO) { | |
| 85 | + List<WmsMerchantDO> list = merchantService.getMerchantList(listReqVO); | |
| 86 | + return success(BeanUtils.toBean(list, WmsMerchantRespVO.class)); | |
| 87 | + } | |
| 88 | + | |
| 89 | + @GetMapping("/export-excel") | |
| 90 | + @Operation(summary = "导出往来企业 Excel") | |
| 91 | + @PreAuthorize("@ss.hasPermission('wms:merchant:export')") | |
| 92 | + @ApiAccessLog(operateType = EXPORT) | |
| 93 | + public void exportMerchantExcel(@Valid WmsMerchantPageReqVO pageReqVO, | |
| 94 | + HttpServletResponse response) throws IOException { | |
| 95 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 96 | + List<WmsMerchantDO> list = merchantService.getMerchantPage(pageReqVO).getList(); | |
| 97 | + ExcelUtils.write(response, "往来企业.xls", "数据", WmsMerchantRespVO.class, | |
| 98 | + BeanUtils.toBean(list, WmsMerchantRespVO.class)); | |
| 99 | + } | |
| 100 | + | |
| 101 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/md/merchant/vo/WmsMerchantListReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.md.merchant.vo; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | |
| 4 | +import cn.iocoder.yudao.module.wms.enums.md.WmsMerchantTypeEnum; | |
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | +import lombok.Data; | |
| 7 | + | |
| 8 | +import java.util.List; | |
| 9 | + | |
| 10 | +@Schema(description = "管理后台 - WMS 往来企业列表 Request VO") | |
| 11 | +@Data | |
| 12 | +public class WmsMerchantListReqVO { | |
| 13 | + | |
| 14 | + @Schema(description = "往来企业编号", example = "MER001") | |
| 15 | + private String code; | |
| 16 | + | |
| 17 | + @Schema(description = "往来企业名称", example = "华为") | |
| 18 | + private String name; | |
| 19 | + | |
| 20 | + @Schema(description = "往来企业类型", example = "2") | |
| 21 | + @InEnum(value = WmsMerchantTypeEnum.class, message = "往来企业类型必须是 {value}") | |
| 22 | + private Integer type; | |
| 23 | + | |
| 24 | + @Schema(description = "往来企业类型数组", example = "2,3") | |
| 25 | + @InEnum(value = WmsMerchantTypeEnum.class, message = "往来企业类型必须是 {value}") | |
| 26 | + private List<Integer> types; | |
| 27 | + | |
| 28 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/md/merchant/vo/WmsMerchantPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.md.merchant.vo; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | |
| 5 | +import cn.iocoder.yudao.module.wms.enums.md.WmsMerchantTypeEnum; | |
| 6 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 7 | +import lombok.Data; | |
| 8 | +import lombok.EqualsAndHashCode; | |
| 9 | +import lombok.ToString; | |
| 10 | + | |
| 11 | +import java.util.List; | |
| 12 | + | |
| 13 | +@Schema(description = "管理后台 - WMS 往来企业分页 Request VO") | |
| 14 | +@Data | |
| 15 | +@EqualsAndHashCode(callSuper = true) | |
| 16 | +@ToString(callSuper = true) | |
| 17 | +public class WmsMerchantPageReqVO extends PageParam { | |
| 18 | + | |
| 19 | + @Schema(description = "往来企业编号", example = "MER001") | |
| 20 | + private String code; | |
| 21 | + | |
| 22 | + @Schema(description = "往来企业名称", example = "华为") | |
| 23 | + private String name; | |
| 24 | + | |
| 25 | + @Schema(description = "往来企业类型", example = "2") | |
| 26 | + @InEnum(value = WmsMerchantTypeEnum.class, message = "往来企业类型必须是 {value}") | |
| 27 | + private Integer type; | |
| 28 | + | |
| 29 | + @Schema(description = "往来企业类型数组", example = "2,3") | |
| 30 | + @InEnum(value = WmsMerchantTypeEnum.class, message = "往来企业类型必须是 {value}") | |
| 31 | + private List<Integer> types; | |
| 32 | + | |
| 33 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/md/merchant/vo/WmsMerchantRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.md.merchant.vo; | |
| 2 | + | |
| 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; | |
| 4 | +import cn.idev.excel.annotation.ExcelProperty; | |
| 5 | +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | |
| 6 | +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | |
| 7 | +import cn.iocoder.yudao.module.wms.enums.DictTypeConstants; | |
| 8 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 9 | +import lombok.Data; | |
| 10 | + | |
| 11 | +import java.time.LocalDateTime; | |
| 12 | + | |
| 13 | +@Schema(description = "管理后台 - WMS 往来企业 Response VO") | |
| 14 | +@Data | |
| 15 | +@ExcelIgnoreUnannotated | |
| 16 | +public class WmsMerchantRespVO { | |
| 17 | + | |
| 18 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 19 | + @ExcelProperty("编号") | |
| 20 | + private Long id; | |
| 21 | + | |
| 22 | + @Schema(description = "往来企业编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "MER001") | |
| 23 | + @ExcelProperty("往来企业编号") | |
| 24 | + private String code; | |
| 25 | + | |
| 26 | + @Schema(description = "往来企业名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "华为") | |
| 27 | + @ExcelProperty("往来企业名称") | |
| 28 | + private String name; | |
| 29 | + | |
| 30 | + @Schema(description = "往来企业类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | |
| 31 | + @ExcelProperty(value = "往来企业类型", converter = DictConvert.class) | |
| 32 | + @DictFormat(DictTypeConstants.MERCHANT_TYPE) | |
| 33 | + private Integer type; | |
| 34 | + | |
| 35 | + @Schema(description = "级别", example = "A") | |
| 36 | + @ExcelProperty("级别") | |
| 37 | + private String level; | |
| 38 | + | |
| 39 | + @Schema(description = "开户行", example = "招商银行") | |
| 40 | + private String bankName; | |
| 41 | + | |
| 42 | + @Schema(description = "银行账户", example = "6225888888888888") | |
| 43 | + private String bankAccount; | |
| 44 | + | |
| 45 | + @Schema(description = "地址", example = "深圳市南山区") | |
| 46 | + private String address; | |
| 47 | + | |
| 48 | + @Schema(description = "手机号", example = "15601691300") | |
| 49 | + private String mobile; | |
| 50 | + | |
| 51 | + @Schema(description = "座机号", example = "0755-88888888") | |
| 52 | + private String telephone; | |
| 53 | + | |
| 54 | + @Schema(description = "联系人", example = "王五") | |
| 55 | + @ExcelProperty("联系人") | |
| 56 | + private String contact; | |
| 57 | + | |
| 58 | + @Schema(description = "Email", example = "wms@example.com") | |
| 59 | + private String email; | |
| 60 | + | |
| 61 | + @Schema(description = "备注", example = "备注") | |
| 62 | + @ExcelProperty("备注") | |
| 63 | + private String remark; | |
| 64 | + | |
| 65 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 66 | + private LocalDateTime createTime; | |
| 67 | + | |
| 68 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/md/merchant/vo/WmsMerchantSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.md.merchant.vo; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | |
| 4 | +import cn.iocoder.yudao.module.wms.enums.md.WmsMerchantTypeEnum; | |
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | +import jakarta.validation.constraints.NotBlank; | |
| 7 | +import jakarta.validation.constraints.NotNull; | |
| 8 | +import jakarta.validation.constraints.Size; | |
| 9 | +import lombok.Data; | |
| 10 | + | |
| 11 | +@Schema(description = "管理后台 - WMS 往来企业创建/更新 Request VO") | |
| 12 | +@Data | |
| 13 | +public class WmsMerchantSaveReqVO { | |
| 14 | + | |
| 15 | + @Schema(description = "编号", example = "1024") | |
| 16 | + private Long id; | |
| 17 | + | |
| 18 | + @Schema(description = "往来企业编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "MER001") | |
| 19 | + @NotBlank(message = "往来企业编号不能为空") | |
| 20 | + @Size(max = 20, message = "往来企业编号长度不能超过 20 个字符") | |
| 21 | + private String code; | |
| 22 | + | |
| 23 | + @Schema(description = "往来企业名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "华为") | |
| 24 | + @NotBlank(message = "往来企业名称不能为空") | |
| 25 | + @Size(max = 60, message = "往来企业名称长度不能超过 60 个字符") | |
| 26 | + private String name; | |
| 27 | + | |
| 28 | + @Schema(description = "往来企业类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | |
| 29 | + @NotNull(message = "往来企业类型不能为空") | |
| 30 | + @InEnum(value = WmsMerchantTypeEnum.class, message = "往来企业类型必须是 {value}") | |
| 31 | + private Integer type; | |
| 32 | + | |
| 33 | + @Schema(description = "级别", example = "A") | |
| 34 | + @Size(max = 10, message = "级别长度不能超过 10 个字符") | |
| 35 | + private String level; | |
| 36 | + | |
| 37 | + @Schema(description = "开户行", example = "招商银行") | |
| 38 | + @Size(max = 255, message = "开户行长度不能超过 255 个字符") | |
| 39 | + private String bankName; | |
| 40 | + | |
| 41 | + @Schema(description = "银行账户", example = "6225888888888888") | |
| 42 | + @Size(max = 40, message = "银行账户长度不能超过 40 个字符") | |
| 43 | + private String bankAccount; | |
| 44 | + | |
| 45 | + @Schema(description = "地址", example = "深圳市南山区") | |
| 46 | + @Size(max = 200, message = "地址长度不能超过 200 个字符") | |
| 47 | + private String address; | |
| 48 | + | |
| 49 | + @Schema(description = "手机号", example = "15601691300") | |
| 50 | + @Size(max = 13, message = "手机号长度不能超过 13 个字符") | |
| 51 | + private String mobile; | |
| 52 | + | |
| 53 | + @Schema(description = "座机号", example = "0755-88888888") | |
| 54 | + @Size(max = 13, message = "座机号长度不能超过 13 个字符") | |
| 55 | + private String telephone; | |
| 56 | + | |
| 57 | + @Schema(description = "联系人", example = "王五") | |
| 58 | + @Size(max = 30, message = "联系人长度不能超过 30 个字符") | |
| 59 | + private String contact; | |
| 60 | + | |
| 61 | + @Schema(description = "Email", example = "wms@example.com") | |
| 62 | + @Size(max = 50, message = "Email 长度不能超过 50 个字符") | |
| 63 | + private String email; | |
| 64 | + | |
| 65 | + @Schema(description = "备注", example = "备注") | |
| 66 | + @Size(max = 255, message = "备注长度不能超过 255 个字符") | |
| 67 | + private String remark; | |
| 68 | + | |
| 69 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/md/warehouse/WmsWarehouseController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.md.warehouse; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 6 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 7 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 8 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | |
| 9 | +import cn.iocoder.yudao.module.wms.controller.admin.md.warehouse.vo.WmsWarehousePageReqVO; | |
| 10 | +import cn.iocoder.yudao.module.wms.controller.admin.md.warehouse.vo.WmsWarehouseRespVO; | |
| 11 | +import cn.iocoder.yudao.module.wms.controller.admin.md.warehouse.vo.WmsWarehouseSaveReqVO; | |
| 12 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.warehouse.WmsWarehouseDO; | |
| 13 | +import cn.iocoder.yudao.module.wms.service.md.warehouse.WmsWarehouseService; | |
| 14 | +import io.swagger.v3.oas.annotations.Operation; | |
| 15 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 16 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 17 | +import jakarta.annotation.Resource; | |
| 18 | +import jakarta.servlet.http.HttpServletResponse; | |
| 19 | +import jakarta.validation.Valid; | |
| 20 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 21 | +import org.springframework.validation.annotation.Validated; | |
| 22 | +import org.springframework.web.bind.annotation.*; | |
| 23 | + | |
| 24 | +import java.io.IOException; | |
| 25 | +import java.util.List; | |
| 26 | + | |
| 27 | +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | |
| 28 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 29 | + | |
| 30 | +@Tag(name = "管理后台 - WMS 仓库") | |
| 31 | +@RestController | |
| 32 | +@RequestMapping("/wms/warehouse") | |
| 33 | +@Validated | |
| 34 | +public class WmsWarehouseController { | |
| 35 | + | |
| 36 | + @Resource | |
| 37 | + private WmsWarehouseService warehouseService; | |
| 38 | + | |
| 39 | + @PostMapping("/create") | |
| 40 | + @Operation(summary = "创建仓库") | |
| 41 | + @PreAuthorize("@ss.hasPermission('wms:warehouse:create')") | |
| 42 | + public CommonResult<Long> createWarehouse(@Valid @RequestBody WmsWarehouseSaveReqVO createReqVO) { | |
| 43 | + return success(warehouseService.createWarehouse(createReqVO)); | |
| 44 | + } | |
| 45 | + | |
| 46 | + @PutMapping("/update") | |
| 47 | + @Operation(summary = "更新仓库") | |
| 48 | + @PreAuthorize("@ss.hasPermission('wms:warehouse:update')") | |
| 49 | + public CommonResult<Boolean> updateWarehouse(@Valid @RequestBody WmsWarehouseSaveReqVO updateReqVO) { | |
| 50 | + warehouseService.updateWarehouse(updateReqVO); | |
| 51 | + return success(true); | |
| 52 | + } | |
| 53 | + | |
| 54 | + @DeleteMapping("/delete") | |
| 55 | + @Operation(summary = "删除仓库") | |
| 56 | + @Parameter(name = "id", description = "编号", required = true) | |
| 57 | + @PreAuthorize("@ss.hasPermission('wms:warehouse:delete')") | |
| 58 | + public CommonResult<Boolean> deleteWarehouse(@RequestParam("id") Long id) { | |
| 59 | + warehouseService.deleteWarehouse(id); | |
| 60 | + return success(true); | |
| 61 | + } | |
| 62 | + | |
| 63 | + @GetMapping("/get") | |
| 64 | + @Operation(summary = "获得仓库") | |
| 65 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 66 | + @PreAuthorize("@ss.hasPermission('wms:warehouse:query')") | |
| 67 | + public CommonResult<WmsWarehouseRespVO> getWarehouse(@RequestParam("id") Long id) { | |
| 68 | + WmsWarehouseDO warehouse = warehouseService.getWarehouse(id); | |
| 69 | + return success(BeanUtils.toBean(warehouse, WmsWarehouseRespVO.class)); | |
| 70 | + } | |
| 71 | + | |
| 72 | + @GetMapping("/page") | |
| 73 | + @Operation(summary = "获得仓库分页") | |
| 74 | + @PreAuthorize("@ss.hasPermission('wms:warehouse:query')") | |
| 75 | + public CommonResult<PageResult<WmsWarehouseRespVO>> getWarehousePage(@Valid WmsWarehousePageReqVO pageReqVO) { | |
| 76 | + PageResult<WmsWarehouseDO> pageResult = warehouseService.getWarehousePage(pageReqVO); | |
| 77 | + return success(BeanUtils.toBean(pageResult, WmsWarehouseRespVO.class)); | |
| 78 | + } | |
| 79 | + | |
| 80 | + @GetMapping("/simple-list") | |
| 81 | + @Operation(summary = "获得仓库精简列表", description = "主要用于前端下拉") | |
| 82 | + @PreAuthorize("@ss.hasPermission('wms:warehouse:query')") | |
| 83 | + public CommonResult<List<WmsWarehouseRespVO>> getWarehouseSimpleList() { | |
| 84 | + List<WmsWarehouseDO> list = warehouseService.getWarehouseList(); | |
| 85 | + return success(BeanUtils.toBean(list, WmsWarehouseRespVO.class)); | |
| 86 | + } | |
| 87 | + | |
| 88 | + @GetMapping("/export-excel") | |
| 89 | + @Operation(summary = "导出仓库 Excel") | |
| 90 | + @PreAuthorize("@ss.hasPermission('wms:warehouse:export')") | |
| 91 | + @ApiAccessLog(operateType = EXPORT) | |
| 92 | + public void exportWarehouseExcel(@Valid WmsWarehousePageReqVO pageReqVO, | |
| 93 | + HttpServletResponse response) throws IOException { | |
| 94 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 95 | + List<WmsWarehouseDO> list = warehouseService.getWarehousePage(pageReqVO).getList(); | |
| 96 | + ExcelUtils.write(response, "仓库.xls", "数据", WmsWarehouseRespVO.class, | |
| 97 | + BeanUtils.toBean(list, WmsWarehouseRespVO.class)); | |
| 98 | + } | |
| 99 | + | |
| 100 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/md/warehouse/vo/WmsWarehousePageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.md.warehouse.vo; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | +import lombok.Data; | |
| 6 | +import lombok.EqualsAndHashCode; | |
| 7 | +import lombok.ToString; | |
| 8 | + | |
| 9 | +@Schema(description = "管理后台 - WMS 仓库分页 Request VO") | |
| 10 | +@Data | |
| 11 | +@EqualsAndHashCode(callSuper = true) | |
| 12 | +@ToString(callSuper = true) | |
| 13 | +public class WmsWarehousePageReqVO extends PageParam { | |
| 14 | + | |
| 15 | + @Schema(description = "仓库编号", example = "WH001") | |
| 16 | + private String code; | |
| 17 | + | |
| 18 | + @Schema(description = "仓库名称", example = "原料仓") | |
| 19 | + private String name; | |
| 20 | + | |
| 21 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/md/warehouse/vo/WmsWarehouseRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.md.warehouse.vo; | |
| 2 | + | |
| 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; | |
| 4 | +import cn.idev.excel.annotation.ExcelProperty; | |
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | +import lombok.Data; | |
| 7 | + | |
| 8 | +import java.time.LocalDateTime; | |
| 9 | + | |
| 10 | +@Schema(description = "管理后台 - WMS 仓库 Response VO") | |
| 11 | +@Data | |
| 12 | +@ExcelIgnoreUnannotated | |
| 13 | +public class WmsWarehouseRespVO { | |
| 14 | + | |
| 15 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 16 | + @ExcelProperty("编号") | |
| 17 | + private Long id; | |
| 18 | + | |
| 19 | + @Schema(description = "仓库编号", example = "WH001") | |
| 20 | + @ExcelProperty("仓库编号") | |
| 21 | + private String code; | |
| 22 | + | |
| 23 | + @Schema(description = "仓库名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "原料仓") | |
| 24 | + @ExcelProperty("仓库名称") | |
| 25 | + private String name; | |
| 26 | + | |
| 27 | + @Schema(description = "备注", example = "备注") | |
| 28 | + @ExcelProperty("备注") | |
| 29 | + private String remark; | |
| 30 | + | |
| 31 | + @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 32 | + @ExcelProperty("排序") | |
| 33 | + private Integer sort; | |
| 34 | + | |
| 35 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 36 | + @ExcelProperty("创建时间") | |
| 37 | + private LocalDateTime createTime; | |
| 38 | + | |
| 39 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/md/warehouse/vo/WmsWarehouseSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.md.warehouse.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import jakarta.validation.constraints.NotEmpty; | |
| 5 | +import jakarta.validation.constraints.NotNull; | |
| 6 | +import jakarta.validation.constraints.Size; | |
| 7 | +import lombok.Data; | |
| 8 | + | |
| 9 | +@Schema(description = "管理后台 - WMS 仓库新增/修改 Request VO") | |
| 10 | +@Data | |
| 11 | +public class WmsWarehouseSaveReqVO { | |
| 12 | + | |
| 13 | + @Schema(description = "编号", example = "1024") | |
| 14 | + private Long id; | |
| 15 | + | |
| 16 | + @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "WH001") | |
| 17 | + @NotEmpty(message = "仓库编号不能为空") | |
| 18 | + @Size(max = 20, message = "仓库编号长度不能超过 20 个字符") | |
| 19 | + private String code; | |
| 20 | + | |
| 21 | + @Schema(description = "仓库名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "原料仓") | |
| 22 | + @NotEmpty(message = "仓库名称不能为空") | |
| 23 | + private String name; | |
| 24 | + | |
| 25 | + @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 26 | + @NotNull(message = "排序不能为空") | |
| 27 | + private Integer sort; | |
| 28 | + | |
| 29 | + @Schema(description = "备注", example = "备注") | |
| 30 | + private String remark; | |
| 31 | + | |
| 32 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/order/check/WmsCheckOrderController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.order.check; | |
| 2 | + | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 4 | +import cn.hutool.core.util.NumberUtil; | |
| 5 | +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; | |
| 6 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 7 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 8 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 9 | +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | |
| 10 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 11 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | |
| 12 | +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | |
| 13 | +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | |
| 14 | +import cn.iocoder.yudao.module.wms.controller.admin.order.check.vo.detail.WmsCheckOrderDetailRespVO; | |
| 15 | +import cn.iocoder.yudao.module.wms.controller.admin.order.check.vo.order.WmsCheckOrderPageReqVO; | |
| 16 | +import cn.iocoder.yudao.module.wms.controller.admin.order.check.vo.order.WmsCheckOrderRespVO; | |
| 17 | +import cn.iocoder.yudao.module.wms.controller.admin.order.check.vo.order.WmsCheckOrderSaveReqVO; | |
| 18 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemDO; | |
| 19 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemSkuDO; | |
| 20 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.warehouse.WmsWarehouseDO; | |
| 21 | +import cn.iocoder.yudao.module.wms.dal.dataobject.order.check.WmsCheckOrderDO; | |
| 22 | +import cn.iocoder.yudao.module.wms.dal.dataobject.order.check.WmsCheckOrderDetailDO; | |
| 23 | +import cn.iocoder.yudao.module.wms.service.md.item.WmsItemService; | |
| 24 | +import cn.iocoder.yudao.module.wms.service.md.item.WmsItemSkuService; | |
| 25 | +import cn.iocoder.yudao.module.wms.service.md.warehouse.WmsWarehouseService; | |
| 26 | +import cn.iocoder.yudao.module.wms.service.order.check.WmsCheckOrderDetailService; | |
| 27 | +import cn.iocoder.yudao.module.wms.service.order.check.WmsCheckOrderService; | |
| 28 | +import io.swagger.v3.oas.annotations.Operation; | |
| 29 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 30 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 31 | +import jakarta.annotation.Resource; | |
| 32 | +import jakarta.servlet.http.HttpServletResponse; | |
| 33 | +import jakarta.validation.Valid; | |
| 34 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 35 | +import org.springframework.validation.annotation.Validated; | |
| 36 | +import org.springframework.web.bind.annotation.*; | |
| 37 | + | |
| 38 | +import java.io.IOException; | |
| 39 | +import java.util.Collections; | |
| 40 | +import java.util.List; | |
| 41 | +import java.util.Map; | |
| 42 | +import java.util.stream.Stream; | |
| 43 | + | |
| 44 | +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | |
| 45 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 46 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | |
| 47 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSetByFlatMap; | |
| 48 | + | |
| 49 | +@Tag(name = "管理后台 - WMS 盘库单") | |
| 50 | +@RestController | |
| 51 | +@RequestMapping("/wms/check-order") | |
| 52 | +@Validated | |
| 53 | +public class WmsCheckOrderController { | |
| 54 | + | |
| 55 | + @Resource | |
| 56 | + private WmsCheckOrderService checkOrderService; | |
| 57 | + @Resource | |
| 58 | + private WmsCheckOrderDetailService checkOrderDetailService; | |
| 59 | + @Resource | |
| 60 | + private WmsWarehouseService warehouseService; | |
| 61 | + @Resource | |
| 62 | + private WmsItemService itemService; | |
| 63 | + @Resource | |
| 64 | + private WmsItemSkuService itemSkuService; | |
| 65 | + | |
| 66 | + @Resource | |
| 67 | + private AdminUserApi adminUserApi; | |
| 68 | + | |
| 69 | + @PostMapping("/create") | |
| 70 | + @Operation(summary = "创建盘库单") | |
| 71 | + @PreAuthorize("@ss.hasPermission('wms:check-order:create')") | |
| 72 | + public CommonResult<Long> createCheckOrder(@Valid @RequestBody WmsCheckOrderSaveReqVO createReqVO) { | |
| 73 | + return success(checkOrderService.createCheckOrder(createReqVO)); | |
| 74 | + } | |
| 75 | + | |
| 76 | + @PutMapping("/update") | |
| 77 | + @Operation(summary = "更新盘库单") | |
| 78 | + @PreAuthorize("@ss.hasPermission('wms:check-order:update')") | |
| 79 | + public CommonResult<Boolean> updateCheckOrder(@Valid @RequestBody WmsCheckOrderSaveReqVO updateReqVO) { | |
| 80 | + checkOrderService.updateCheckOrder(updateReqVO); | |
| 81 | + return success(true); | |
| 82 | + } | |
| 83 | + | |
| 84 | + @DeleteMapping("/delete") | |
| 85 | + @Operation(summary = "删除盘库单") | |
| 86 | + @Parameter(name = "id", description = "编号", required = true) | |
| 87 | + @PreAuthorize("@ss.hasPermission('wms:check-order:delete')") | |
| 88 | + public CommonResult<Boolean> deleteCheckOrder(@RequestParam("id") Long id) { | |
| 89 | + checkOrderService.deleteCheckOrder(id); | |
| 90 | + return success(true); | |
| 91 | + } | |
| 92 | + | |
| 93 | + @PutMapping("/complete") | |
| 94 | + @Operation(summary = "完成盘库") | |
| 95 | + @Parameter(name = "id", description = "编号", required = true) | |
| 96 | + @PreAuthorize("@ss.hasPermission('wms:check-order:complete')") | |
| 97 | + public CommonResult<Boolean> completeCheckOrder(@RequestParam("id") Long id) { | |
| 98 | + checkOrderService.completeCheckOrder(id); | |
| 99 | + return success(true); | |
| 100 | + } | |
| 101 | + | |
| 102 | + @PutMapping("/cancel") | |
| 103 | + @Operation(summary = "作废盘库单") | |
| 104 | + @Parameter(name = "id", description = "编号", required = true) | |
| 105 | + @PreAuthorize("@ss.hasPermission('wms:check-order:cancel')") | |
| 106 | + public CommonResult<Boolean> cancelCheckOrder(@RequestParam("id") Long id) { | |
| 107 | + checkOrderService.cancelCheckOrder(id); | |
| 108 | + return success(true); | |
| 109 | + } | |
| 110 | + | |
| 111 | + @GetMapping("/get") | |
| 112 | + @Operation(summary = "获得盘库单") | |
| 113 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 114 | + @PreAuthorize("@ss.hasPermission('wms:check-order:query')") | |
| 115 | + public CommonResult<WmsCheckOrderRespVO> getCheckOrder(@RequestParam("id") Long id) { | |
| 116 | + WmsCheckOrderDO order = checkOrderService.getCheckOrder(id); | |
| 117 | + if (order == null) { | |
| 118 | + return success(null); | |
| 119 | + } | |
| 120 | + // 获得盘库单的明细列表 | |
| 121 | + List<WmsCheckOrderDetailDO> detailList = checkOrderDetailService.getCheckOrderDetailList(id); | |
| 122 | + // 拼接结果返回 | |
| 123 | + WmsCheckOrderRespVO respVO = buildCheckOrderRespVO(order) | |
| 124 | + .setDetails(buildCheckOrderDetailRespVOList(detailList)); | |
| 125 | + return success(respVO); | |
| 126 | + } | |
| 127 | + | |
| 128 | + @GetMapping("/page") | |
| 129 | + @Operation(summary = "获得盘库单分页") | |
| 130 | + @PreAuthorize("@ss.hasPermission('wms:check-order:query')") | |
| 131 | + public CommonResult<PageResult<WmsCheckOrderRespVO>> getCheckOrderPage(@Valid WmsCheckOrderPageReqVO pageReqVO) { | |
| 132 | + PageResult<WmsCheckOrderDO> pageResult = checkOrderService.getCheckOrderPage(pageReqVO); | |
| 133 | + return success(new PageResult<>(buildCheckOrderRespVOList(pageResult.getList()), pageResult.getTotal())); | |
| 134 | + } | |
| 135 | + | |
| 136 | + @GetMapping("/export-excel") | |
| 137 | + @Operation(summary = "导出盘库单 Excel") | |
| 138 | + @PreAuthorize("@ss.hasPermission('wms:check-order:export')") | |
| 139 | + @ApiAccessLog(operateType = EXPORT) | |
| 140 | + public void exportCheckOrderExcel(@Valid WmsCheckOrderPageReqVO pageReqVO, | |
| 141 | + HttpServletResponse response) throws IOException { | |
| 142 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 143 | + List<WmsCheckOrderDO> list = checkOrderService.getCheckOrderPage(pageReqVO).getList(); | |
| 144 | + ExcelUtils.write(response, "盘库单.xls", "数据", WmsCheckOrderRespVO.class, | |
| 145 | + buildCheckOrderRespVOList(list)); | |
| 146 | + } | |
| 147 | + | |
| 148 | + // ==================== 拼接 VO ==================== | |
| 149 | + | |
| 150 | + private WmsCheckOrderRespVO buildCheckOrderRespVO(WmsCheckOrderDO order) { | |
| 151 | + if (order == null) { | |
| 152 | + return null; | |
| 153 | + } | |
| 154 | + List<WmsCheckOrderRespVO> list = buildCheckOrderRespVOList(Collections.singletonList(order)); | |
| 155 | + return CollUtil.getFirst(list); | |
| 156 | + } | |
| 157 | + | |
| 158 | + private List<WmsCheckOrderRespVO> buildCheckOrderRespVOList(List<WmsCheckOrderDO> list) { | |
| 159 | + if (CollUtil.isEmpty(list)) { | |
| 160 | + return Collections.emptyList(); | |
| 161 | + } | |
| 162 | + // 获取相关的仓库、用户等数据 | |
| 163 | + Map<Long, WmsWarehouseDO> warehouseMap = warehouseService.getWarehouseMap(convertSet(list, WmsCheckOrderDO::getWarehouseId)); | |
| 164 | + Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertSetByFlatMap(list, | |
| 165 | + order -> Stream.of(parseUserId(order.getCreator()), parseUserId(order.getUpdater())))); | |
| 166 | + // 拼接数据 | |
| 167 | + return BeanUtils.toBean(list, WmsCheckOrderRespVO.class, vo -> { | |
| 168 | + MapUtils.findAndThen(warehouseMap, vo.getWarehouseId(), warehouse -> vo.setWarehouseName(warehouse.getName())); | |
| 169 | + MapUtils.findAndThen(userMap, parseUserId(vo.getCreator()), user -> vo.setCreatorName(user.getNickname())); | |
| 170 | + MapUtils.findAndThen(userMap, parseUserId(vo.getUpdater()), user -> vo.setUpdaterName(user.getNickname())); | |
| 171 | + }); | |
| 172 | + } | |
| 173 | + | |
| 174 | + private Long parseUserId(String userId) { | |
| 175 | + return NumberUtil.parseLong(userId, null); | |
| 176 | + } | |
| 177 | + | |
| 178 | + private List<WmsCheckOrderDetailRespVO> buildCheckOrderDetailRespVOList(List<WmsCheckOrderDetailDO> list) { | |
| 179 | + if (CollUtil.isEmpty(list)) { | |
| 180 | + return Collections.emptyList(); | |
| 181 | + } | |
| 182 | + // 获取相关的商品、SKU、仓库等数据 | |
| 183 | + Map<Long, WmsItemSkuDO> skuMap = itemSkuService.getItemSkuMap(convertSet(list, WmsCheckOrderDetailDO::getSkuId)); | |
| 184 | + Map<Long, WmsItemDO> itemMap = itemService.getItemMap(convertSet(skuMap.values(), WmsItemSkuDO::getItemId)); | |
| 185 | + Map<Long, WmsWarehouseDO> warehouseMap = warehouseService.getWarehouseMap( | |
| 186 | + convertSet(list, WmsCheckOrderDetailDO::getWarehouseId)); | |
| 187 | + // 拼接数据 | |
| 188 | + return BeanUtils.toBean(list, WmsCheckOrderDetailRespVO.class, vo -> { | |
| 189 | + MapUtils.findAndThen(skuMap, vo.getSkuId(), sku -> { | |
| 190 | + vo.setSkuCode(sku.getCode()).setSkuName(sku.getName()).setItemId(sku.getItemId()); | |
| 191 | + MapUtils.findAndThen(itemMap, sku.getItemId(), item -> vo.setItemCode(item.getCode()) | |
| 192 | + .setItemName(item.getName()).setUnit(item.getUnit())); | |
| 193 | + }); | |
| 194 | + MapUtils.findAndThen(warehouseMap, vo.getWarehouseId(), warehouse -> vo.setWarehouseName(warehouse.getName())); | |
| 195 | + }); | |
| 196 | + } | |
| 197 | + | |
| 198 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/order/check/WmsCheckOrderDetailController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.order.check; | |
| 2 | + | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 5 | +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | |
| 6 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 7 | +import cn.iocoder.yudao.module.wms.controller.admin.order.check.vo.detail.WmsCheckOrderDetailRespVO; | |
| 8 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemDO; | |
| 9 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemSkuDO; | |
| 10 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.warehouse.WmsWarehouseDO; | |
| 11 | +import cn.iocoder.yudao.module.wms.dal.dataobject.order.check.WmsCheckOrderDetailDO; | |
| 12 | +import cn.iocoder.yudao.module.wms.service.md.item.WmsItemService; | |
| 13 | +import cn.iocoder.yudao.module.wms.service.md.item.WmsItemSkuService; | |
| 14 | +import cn.iocoder.yudao.module.wms.service.md.warehouse.WmsWarehouseService; | |
| 15 | +import cn.iocoder.yudao.module.wms.service.order.check.WmsCheckOrderDetailService; | |
| 16 | +import io.swagger.v3.oas.annotations.Operation; | |
| 17 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 18 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 19 | +import jakarta.annotation.Resource; | |
| 20 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 21 | +import org.springframework.validation.annotation.Validated; | |
| 22 | +import org.springframework.web.bind.annotation.GetMapping; | |
| 23 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 24 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 25 | +import org.springframework.web.bind.annotation.RestController; | |
| 26 | + | |
| 27 | +import java.util.Collections; | |
| 28 | +import java.util.List; | |
| 29 | +import java.util.Map; | |
| 30 | + | |
| 31 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 32 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | |
| 33 | + | |
| 34 | +@Tag(name = "管理后台 - WMS 盘库单明细") | |
| 35 | +@RestController | |
| 36 | +@RequestMapping("/wms/check-order-detail") | |
| 37 | +@Validated | |
| 38 | +public class WmsCheckOrderDetailController { | |
| 39 | + | |
| 40 | + @Resource | |
| 41 | + private WmsCheckOrderDetailService checkOrderDetailService; | |
| 42 | + @Resource | |
| 43 | + private WmsItemService itemService; | |
| 44 | + @Resource | |
| 45 | + private WmsItemSkuService itemSkuService; | |
| 46 | + @Resource | |
| 47 | + private WmsWarehouseService warehouseService; | |
| 48 | + | |
| 49 | + @GetMapping("/list-by-order-id") | |
| 50 | + @Operation(summary = "获得盘库单明细列表") | |
| 51 | + @Parameter(name = "orderId", description = "盘库单编号", required = true, example = "1024") | |
| 52 | + @PreAuthorize("@ss.hasPermission('wms:check-order:query')") | |
| 53 | + public CommonResult<List<WmsCheckOrderDetailRespVO>> getCheckOrderDetailListByOrderId( | |
| 54 | + @RequestParam("orderId") Long orderId) { | |
| 55 | + List<WmsCheckOrderDetailDO> list = checkOrderDetailService.getCheckOrderDetailList(orderId); | |
| 56 | + return success(buildCheckOrderDetailRespVOList(list)); | |
| 57 | + } | |
| 58 | + | |
| 59 | + // ==================== 拼接 VO ==================== | |
| 60 | + | |
| 61 | + private List<WmsCheckOrderDetailRespVO> buildCheckOrderDetailRespVOList(List<WmsCheckOrderDetailDO> list) { | |
| 62 | + if (CollUtil.isEmpty(list)) { | |
| 63 | + return Collections.emptyList(); | |
| 64 | + } | |
| 65 | + // 查询关联数据 | |
| 66 | + Map<Long, WmsItemSkuDO> skuMap = itemSkuService.getItemSkuMap(convertSet(list, WmsCheckOrderDetailDO::getSkuId)); | |
| 67 | + Map<Long, WmsItemDO> itemMap = itemService.getItemMap(convertSet(skuMap.values(), WmsItemSkuDO::getItemId)); | |
| 68 | + Map<Long, WmsWarehouseDO> warehouseMap = warehouseService.getWarehouseMap( | |
| 69 | + convertSet(list, WmsCheckOrderDetailDO::getWarehouseId)); | |
| 70 | + // 拼接数据 | |
| 71 | + return BeanUtils.toBean(list, WmsCheckOrderDetailRespVO.class, vo -> { | |
| 72 | + MapUtils.findAndThen(skuMap, vo.getSkuId(), sku -> { | |
| 73 | + vo.setSkuCode(sku.getCode()).setSkuName(sku.getName()).setItemId(sku.getItemId()); | |
| 74 | + MapUtils.findAndThen(itemMap, sku.getItemId(), item -> vo.setItemCode(item.getCode()) | |
| 75 | + .setItemName(item.getName()).setUnit(item.getUnit())); | |
| 76 | + }); | |
| 77 | + MapUtils.findAndThen(warehouseMap, vo.getWarehouseId(), warehouse -> vo.setWarehouseName(warehouse.getName())); | |
| 78 | + }); | |
| 79 | + } | |
| 80 | + | |
| 81 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/order/check/vo/detail/WmsCheckOrderDetailRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.order.check.vo.detail; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +import java.math.BigDecimal; | |
| 7 | +import java.time.LocalDateTime; | |
| 8 | + | |
| 9 | +@Schema(description = "管理后台 - WMS 盘库单明细 Response VO") | |
| 10 | +@Data | |
| 11 | +public class WmsCheckOrderDetailRespVO { | |
| 12 | + | |
| 13 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 14 | + private Long id; | |
| 15 | + | |
| 16 | + @Schema(description = "盘库单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 17 | + private Long orderId; | |
| 18 | + | |
| 19 | + @Schema(description = "商品编号", example = "2048") | |
| 20 | + private Long itemId; | |
| 21 | + | |
| 22 | + @Schema(description = "商品编号", example = "SPU-APPLE") | |
| 23 | + private String itemCode; | |
| 24 | + | |
| 25 | + @Schema(description = "商品名称", example = "红富士苹果") | |
| 26 | + private String itemName; | |
| 27 | + | |
| 28 | + @Schema(description = "商品单位", example = "箱") | |
| 29 | + private String unit; | |
| 30 | + | |
| 31 | + @Schema(description = "SKU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") | |
| 32 | + private Long skuId; | |
| 33 | + | |
| 34 | + @Schema(description = "规格编号", example = "SKU-APPLE-10KG") | |
| 35 | + private String skuCode; | |
| 36 | + | |
| 37 | + @Schema(description = "规格名称", example = "10kg 箱装") | |
| 38 | + private String skuName; | |
| 39 | + | |
| 40 | + @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 41 | + private Long warehouseId; | |
| 42 | + | |
| 43 | + @Schema(description = "仓库名称", example = "北京仓") | |
| 44 | + private String warehouseName; | |
| 45 | + | |
| 46 | + @Schema(description = "库存编号", example = "1024") | |
| 47 | + private Long inventoryId; | |
| 48 | + | |
| 49 | + @Schema(description = "入库时间") | |
| 50 | + private LocalDateTime receiptTime; | |
| 51 | + | |
| 52 | + @Schema(description = "账面数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00") | |
| 53 | + private BigDecimal quantity; | |
| 54 | + | |
| 55 | + @Schema(description = "实盘数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "98.00") | |
| 56 | + private BigDecimal checkQuantity; | |
| 57 | + | |
| 58 | + @Schema(description = "单价", example = "1000.00") | |
| 59 | + private BigDecimal price; | |
| 60 | + | |
| 61 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 62 | + private LocalDateTime createTime; | |
| 63 | + | |
| 64 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/order/check/vo/detail/WmsCheckOrderDetailSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.order.check.vo.detail; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import jakarta.validation.constraints.DecimalMin; | |
| 5 | +import jakarta.validation.constraints.NotNull; | |
| 6 | +import lombok.Data; | |
| 7 | + | |
| 8 | +import java.math.BigDecimal; | |
| 9 | +import java.time.LocalDateTime; | |
| 10 | + | |
| 11 | +@Schema(description = "管理后台 - WMS 盘库单明细保存 Request VO") | |
| 12 | +@Data | |
| 13 | +public class WmsCheckOrderDetailSaveReqVO { | |
| 14 | + | |
| 15 | + @Schema(description = "编号", example = "1024") | |
| 16 | + private Long id; | |
| 17 | + | |
| 18 | + @Schema(description = "SKU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") | |
| 19 | + @NotNull(message = "SKU 不能为空") | |
| 20 | + private Long skuId; | |
| 21 | + | |
| 22 | + @Schema(description = "库存编号", example = "1024") | |
| 23 | + private Long inventoryId; | |
| 24 | + | |
| 25 | + @Schema(description = "入库时间") | |
| 26 | + private LocalDateTime receiptTime; | |
| 27 | + | |
| 28 | + @Schema(description = "账面数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00") | |
| 29 | + @NotNull(message = "账面数量不能为空") | |
| 30 | + @DecimalMin(value = "0", message = "账面数量不能小于 0") | |
| 31 | + private BigDecimal quantity; | |
| 32 | + | |
| 33 | + @Schema(description = "实盘数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "98.00") | |
| 34 | + @NotNull(message = "实盘数量不能为空") | |
| 35 | + @DecimalMin(value = "0", message = "实盘数量不能小于 0") | |
| 36 | + private BigDecimal checkQuantity; | |
| 37 | + | |
| 38 | + @Schema(description = "单价", example = "1000.00") | |
| 39 | + @DecimalMin(value = "0", message = "单价不能小于 0") | |
| 40 | + private BigDecimal price; | |
| 41 | + | |
| 42 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/order/check/vo/order/WmsCheckOrderPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.order.check.vo.order; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | |
| 5 | +import cn.iocoder.yudao.module.wms.enums.order.WmsOrderStatusEnum; | |
| 6 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 7 | +import lombok.Data; | |
| 8 | +import lombok.EqualsAndHashCode; | |
| 9 | +import lombok.ToString; | |
| 10 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 11 | + | |
| 12 | +import java.math.BigDecimal; | |
| 13 | +import java.time.LocalDateTime; | |
| 14 | + | |
| 15 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 16 | + | |
| 17 | +@Schema(description = "管理后台 - WMS 盘库单分页 Request VO") | |
| 18 | +@Data | |
| 19 | +@EqualsAndHashCode(callSuper = true) | |
| 20 | +@ToString(callSuper = true) | |
| 21 | +public class WmsCheckOrderPageReqVO extends PageParam { | |
| 22 | + | |
| 23 | + @Schema(description = "盘库单号", example = "PK202605110001") | |
| 24 | + private String no; | |
| 25 | + | |
| 26 | + @Schema(description = "单据状态", example = "0") | |
| 27 | + @InEnum(WmsOrderStatusEnum.class) | |
| 28 | + private Integer status; | |
| 29 | + | |
| 30 | + @Schema(description = "仓库编号", example = "1024") | |
| 31 | + private Long warehouseId; | |
| 32 | + | |
| 33 | + @Schema(description = "单据日期") | |
| 34 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 35 | + private LocalDateTime[] orderTime; | |
| 36 | + | |
| 37 | + @Schema(description = "最小盈亏数量", example = "-10.00") | |
| 38 | + private BigDecimal totalQuantityMin; | |
| 39 | + | |
| 40 | + @Schema(description = "最大盈亏数量", example = "100.00") | |
| 41 | + private BigDecimal totalQuantityMax; | |
| 42 | + | |
| 43 | + @Schema(description = "最小总金额", example = "1.00") | |
| 44 | + private BigDecimal totalPriceMin; | |
| 45 | + | |
| 46 | + @Schema(description = "最大总金额", example = "1000.00") | |
| 47 | + private BigDecimal totalPriceMax; | |
| 48 | + | |
| 49 | + @Schema(description = "最小实际金额", example = "1.00") | |
| 50 | + private BigDecimal actualPriceMin; | |
| 51 | + | |
| 52 | + @Schema(description = "最大实际金额", example = "1000.00") | |
| 53 | + private BigDecimal actualPriceMax; | |
| 54 | + | |
| 55 | + @Schema(description = "创建用户", example = "1") | |
| 56 | + private String creator; | |
| 57 | + | |
| 58 | + @Schema(description = "更新用户", example = "1") | |
| 59 | + private String updater; | |
| 60 | + | |
| 61 | + @Schema(description = "创建时间") | |
| 62 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 63 | + private LocalDateTime[] createTime; | |
| 64 | + | |
| 65 | + @Schema(description = "更新时间") | |
| 66 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 67 | + private LocalDateTime[] updateTime; | |
| 68 | + | |
| 69 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/order/check/vo/order/WmsCheckOrderRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.order.check.vo.order; | |
| 2 | + | |
| 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; | |
| 4 | +import cn.idev.excel.annotation.ExcelProperty; | |
| 5 | +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | |
| 6 | +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | |
| 7 | +import cn.iocoder.yudao.module.wms.controller.admin.order.check.vo.detail.WmsCheckOrderDetailRespVO; | |
| 8 | +import cn.iocoder.yudao.module.wms.enums.DictTypeConstants; | |
| 9 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 10 | +import lombok.Data; | |
| 11 | + | |
| 12 | +import java.math.BigDecimal; | |
| 13 | +import java.time.LocalDateTime; | |
| 14 | +import java.util.List; | |
| 15 | + | |
| 16 | +@Schema(description = "管理后台 - WMS 盘库单 Response VO") | |
| 17 | +@Data | |
| 18 | +@ExcelIgnoreUnannotated | |
| 19 | +public class WmsCheckOrderRespVO { | |
| 20 | + | |
| 21 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 22 | + private Long id; | |
| 23 | + | |
| 24 | + @Schema(description = "盘库单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "PK202605110001") | |
| 25 | + @ExcelProperty("盘库单号") | |
| 26 | + private String no; | |
| 27 | + | |
| 28 | + @Schema(description = "单据日期", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 29 | + @ExcelProperty("单据日期") | |
| 30 | + private LocalDateTime orderTime; | |
| 31 | + | |
| 32 | + @Schema(description = "盘库状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | |
| 33 | + @ExcelProperty(value = "盘库状态", converter = DictConvert.class) | |
| 34 | + @DictFormat(DictTypeConstants.ORDER_STATUS) | |
| 35 | + private Integer status; | |
| 36 | + | |
| 37 | + @Schema(description = "备注", example = "备注") | |
| 38 | + private String remark; | |
| 39 | + | |
| 40 | + @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 41 | + private Long warehouseId; | |
| 42 | + | |
| 43 | + @Schema(description = "仓库名称", example = "北京仓") | |
| 44 | + @ExcelProperty("仓库") | |
| 45 | + private String warehouseName; | |
| 46 | + | |
| 47 | + @Schema(description = "盈亏数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00") | |
| 48 | + @ExcelProperty("盈亏数量") | |
| 49 | + private BigDecimal totalQuantity; | |
| 50 | + | |
| 51 | + @Schema(description = "总金额(账面金额)", example = "1000.00") | |
| 52 | + @ExcelProperty("总金额") | |
| 53 | + private BigDecimal totalPrice; | |
| 54 | + | |
| 55 | + @Schema(description = "实际金额", example = "980.00") | |
| 56 | + @ExcelProperty("实际金额") | |
| 57 | + private BigDecimal actualPrice; | |
| 58 | + | |
| 59 | + @Schema(description = "盘库明细") | |
| 60 | + private List<WmsCheckOrderDetailRespVO> details; | |
| 61 | + | |
| 62 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 63 | + @ExcelProperty("创建时间") | |
| 64 | + private LocalDateTime createTime; | |
| 65 | + | |
| 66 | + @Schema(description = "创建者", example = "1") | |
| 67 | + private String creator; | |
| 68 | + @Schema(description = "创建者名称", example = "芋道") | |
| 69 | + private String creatorName; | |
| 70 | + | |
| 71 | + @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 72 | + private LocalDateTime updateTime; | |
| 73 | + | |
| 74 | + @Schema(description = "更新者", example = "1") | |
| 75 | + private String updater; | |
| 76 | + @Schema(description = "更新者名称", example = "芋道") | |
| 77 | + private String updaterName; | |
| 78 | + | |
| 79 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/order/check/vo/order/WmsCheckOrderSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.order.check.vo.order; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.wms.controller.admin.order.check.vo.detail.WmsCheckOrderDetailSaveReqVO; | |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | +import jakarta.validation.Valid; | |
| 6 | +import jakarta.validation.constraints.NotBlank; | |
| 7 | +import jakarta.validation.constraints.NotNull; | |
| 8 | +import jakarta.validation.constraints.Size; | |
| 9 | +import lombok.Data; | |
| 10 | + | |
| 11 | +import java.time.LocalDateTime; | |
| 12 | +import java.util.List; | |
| 13 | + | |
| 14 | +@Schema(description = "管理后台 - WMS 盘库单保存 Request VO") | |
| 15 | +@Data | |
| 16 | +public class WmsCheckOrderSaveReqVO { | |
| 17 | + | |
| 18 | + @Schema(description = "编号", example = "1024") | |
| 19 | + private Long id; | |
| 20 | + | |
| 21 | + @Schema(description = "盘库单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "PK202605110001") | |
| 22 | + @NotBlank(message = "盘库单号不能为空") | |
| 23 | + @Size(max = 64, message = "盘库单号长度不能超过 64 个字符") | |
| 24 | + private String no; | |
| 25 | + | |
| 26 | + @Schema(description = "单据日期", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 27 | + @NotNull(message = "单据日期不能为空") | |
| 28 | + private LocalDateTime orderTime; | |
| 29 | + | |
| 30 | + @Schema(description = "备注", example = "备注") | |
| 31 | + @Size(max = 255, message = "备注长度不能超过 255 个字符") | |
| 32 | + private String remark; | |
| 33 | + | |
| 34 | + @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 35 | + @NotNull(message = "仓库不能为空") | |
| 36 | + private Long warehouseId; | |
| 37 | + | |
| 38 | + @Schema(description = "盘库明细") | |
| 39 | + @Valid | |
| 40 | + private List<WmsCheckOrderDetailSaveReqVO> details; | |
| 41 | + | |
| 42 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/order/movement/WmsMovementOrderController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.order.movement; | |
| 2 | + | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 4 | +import cn.hutool.core.util.NumberUtil; | |
| 5 | +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; | |
| 6 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 7 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 8 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 9 | +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | |
| 10 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 11 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | |
| 12 | +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | |
| 13 | +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | |
| 14 | +import cn.iocoder.yudao.module.wms.controller.admin.order.movement.vo.detail.WmsMovementOrderDetailRespVO; | |
| 15 | +import cn.iocoder.yudao.module.wms.controller.admin.order.movement.vo.order.WmsMovementOrderPageReqVO; | |
| 16 | +import cn.iocoder.yudao.module.wms.controller.admin.order.movement.vo.order.WmsMovementOrderRespVO; | |
| 17 | +import cn.iocoder.yudao.module.wms.controller.admin.order.movement.vo.order.WmsMovementOrderSaveReqVO; | |
| 18 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemDO; | |
| 19 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemSkuDO; | |
| 20 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.warehouse.WmsWarehouseDO; | |
| 21 | +import cn.iocoder.yudao.module.wms.dal.dataobject.order.movement.WmsMovementOrderDO; | |
| 22 | +import cn.iocoder.yudao.module.wms.dal.dataobject.order.movement.WmsMovementOrderDetailDO; | |
| 23 | +import cn.iocoder.yudao.module.wms.service.md.item.WmsItemService; | |
| 24 | +import cn.iocoder.yudao.module.wms.service.md.item.WmsItemSkuService; | |
| 25 | +import cn.iocoder.yudao.module.wms.service.md.warehouse.WmsWarehouseService; | |
| 26 | +import cn.iocoder.yudao.module.wms.service.order.movement.WmsMovementOrderDetailService; | |
| 27 | +import cn.iocoder.yudao.module.wms.service.order.movement.WmsMovementOrderService; | |
| 28 | +import io.swagger.v3.oas.annotations.Operation; | |
| 29 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 30 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 31 | +import jakarta.annotation.Resource; | |
| 32 | +import jakarta.servlet.http.HttpServletResponse; | |
| 33 | +import jakarta.validation.Valid; | |
| 34 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 35 | +import org.springframework.validation.annotation.Validated; | |
| 36 | +import org.springframework.web.bind.annotation.*; | |
| 37 | + | |
| 38 | +import java.io.IOException; | |
| 39 | +import java.util.Collections; | |
| 40 | +import java.util.List; | |
| 41 | +import java.util.Map; | |
| 42 | +import java.util.stream.Stream; | |
| 43 | + | |
| 44 | +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | |
| 45 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 46 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | |
| 47 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSetByFlatMap; | |
| 48 | + | |
| 49 | +@Tag(name = "管理后台 - WMS 移库单") | |
| 50 | +@RestController | |
| 51 | +@RequestMapping("/wms/movement-order") | |
| 52 | +@Validated | |
| 53 | +public class WmsMovementOrderController { | |
| 54 | + | |
| 55 | + @Resource | |
| 56 | + private WmsMovementOrderService movementOrderService; | |
| 57 | + @Resource | |
| 58 | + private WmsMovementOrderDetailService movementOrderDetailService; | |
| 59 | + @Resource | |
| 60 | + private WmsWarehouseService warehouseService; | |
| 61 | + @Resource | |
| 62 | + private WmsItemService itemService; | |
| 63 | + @Resource | |
| 64 | + private WmsItemSkuService itemSkuService; | |
| 65 | + | |
| 66 | + @Resource | |
| 67 | + private AdminUserApi adminUserApi; | |
| 68 | + | |
| 69 | + @PostMapping("/create") | |
| 70 | + @Operation(summary = "创建移库单") | |
| 71 | + @PreAuthorize("@ss.hasPermission('wms:movement-order:create')") | |
| 72 | + public CommonResult<Long> createMovementOrder(@Valid @RequestBody WmsMovementOrderSaveReqVO createReqVO) { | |
| 73 | + return success(movementOrderService.createMovementOrder(createReqVO)); | |
| 74 | + } | |
| 75 | + | |
| 76 | + @PutMapping("/update") | |
| 77 | + @Operation(summary = "更新移库单") | |
| 78 | + @PreAuthorize("@ss.hasPermission('wms:movement-order:update')") | |
| 79 | + public CommonResult<Boolean> updateMovementOrder(@Valid @RequestBody WmsMovementOrderSaveReqVO updateReqVO) { | |
| 80 | + movementOrderService.updateMovementOrder(updateReqVO); | |
| 81 | + return success(true); | |
| 82 | + } | |
| 83 | + | |
| 84 | + @DeleteMapping("/delete") | |
| 85 | + @Operation(summary = "删除移库单") | |
| 86 | + @Parameter(name = "id", description = "编号", required = true) | |
| 87 | + @PreAuthorize("@ss.hasPermission('wms:movement-order:delete')") | |
| 88 | + public CommonResult<Boolean> deleteMovementOrder(@RequestParam("id") Long id) { | |
| 89 | + movementOrderService.deleteMovementOrder(id); | |
| 90 | + return success(true); | |
| 91 | + } | |
| 92 | + | |
| 93 | + @PutMapping("/complete") | |
| 94 | + @Operation(summary = "完成移库") | |
| 95 | + @Parameter(name = "id", description = "编号", required = true) | |
| 96 | + @PreAuthorize("@ss.hasPermission('wms:movement-order:complete')") | |
| 97 | + public CommonResult<Boolean> completeMovementOrder(@RequestParam("id") Long id) { | |
| 98 | + movementOrderService.completeMovementOrder(id); | |
| 99 | + return success(true); | |
| 100 | + } | |
| 101 | + | |
| 102 | + @PutMapping("/cancel") | |
| 103 | + @Operation(summary = "作废移库单") | |
| 104 | + @Parameter(name = "id", description = "编号", required = true) | |
| 105 | + @PreAuthorize("@ss.hasPermission('wms:movement-order:cancel')") | |
| 106 | + public CommonResult<Boolean> cancelMovementOrder(@RequestParam("id") Long id) { | |
| 107 | + movementOrderService.cancelMovementOrder(id); | |
| 108 | + return success(true); | |
| 109 | + } | |
| 110 | + | |
| 111 | + @GetMapping("/get") | |
| 112 | + @Operation(summary = "获得移库单") | |
| 113 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 114 | + @PreAuthorize("@ss.hasPermission('wms:movement-order:query')") | |
| 115 | + public CommonResult<WmsMovementOrderRespVO> getMovementOrder(@RequestParam("id") Long id) { | |
| 116 | + WmsMovementOrderDO order = movementOrderService.getMovementOrder(id); | |
| 117 | + if (order == null) { | |
| 118 | + return success(null); | |
| 119 | + } | |
| 120 | + // 获得移库单的明细列表 | |
| 121 | + List<WmsMovementOrderDetailDO> detailList = movementOrderDetailService.getMovementOrderDetailList(id); | |
| 122 | + // 拼接结果返回 | |
| 123 | + WmsMovementOrderRespVO respVO = buildMovementOrderRespVO(order) | |
| 124 | + .setDetails(buildMovementOrderDetailRespVOList(detailList)); | |
| 125 | + return success(respVO); | |
| 126 | + } | |
| 127 | + | |
| 128 | + @GetMapping("/page") | |
| 129 | + @Operation(summary = "获得移库单分页") | |
| 130 | + @PreAuthorize("@ss.hasPermission('wms:movement-order:query')") | |
| 131 | + public CommonResult<PageResult<WmsMovementOrderRespVO>> getMovementOrderPage( | |
| 132 | + @Valid WmsMovementOrderPageReqVO pageReqVO) { | |
| 133 | + PageResult<WmsMovementOrderDO> pageResult = movementOrderService.getMovementOrderPage(pageReqVO); | |
| 134 | + return success(new PageResult<>(buildMovementOrderRespVOList(pageResult.getList()), pageResult.getTotal())); | |
| 135 | + } | |
| 136 | + | |
| 137 | + @GetMapping("/export-excel") | |
| 138 | + @Operation(summary = "导出移库单 Excel") | |
| 139 | + @PreAuthorize("@ss.hasPermission('wms:movement-order:export')") | |
| 140 | + @ApiAccessLog(operateType = EXPORT) | |
| 141 | + public void exportMovementOrderExcel(@Valid WmsMovementOrderPageReqVO pageReqVO, | |
| 142 | + HttpServletResponse response) throws IOException { | |
| 143 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 144 | + List<WmsMovementOrderDO> list = movementOrderService.getMovementOrderPage(pageReqVO).getList(); | |
| 145 | + ExcelUtils.write(response, "移库单.xls", "数据", WmsMovementOrderRespVO.class, | |
| 146 | + buildMovementOrderRespVOList(list)); | |
| 147 | + } | |
| 148 | + | |
| 149 | + // ==================== 拼接 VO ==================== | |
| 150 | + | |
| 151 | + private WmsMovementOrderRespVO buildMovementOrderRespVO(WmsMovementOrderDO order) { | |
| 152 | + if (order == null) { | |
| 153 | + return null; | |
| 154 | + } | |
| 155 | + List<WmsMovementOrderRespVO> list = buildMovementOrderRespVOList(Collections.singletonList(order)); | |
| 156 | + return CollUtil.getFirst(list); | |
| 157 | + } | |
| 158 | + | |
| 159 | + private List<WmsMovementOrderRespVO> buildMovementOrderRespVOList(List<WmsMovementOrderDO> list) { | |
| 160 | + if (CollUtil.isEmpty(list)) { | |
| 161 | + return Collections.emptyList(); | |
| 162 | + } | |
| 163 | + // 获取相关的仓库、用户等数据 | |
| 164 | + Map<Long, WmsWarehouseDO> warehouseMap = warehouseService.getWarehouseMap(convertSetByFlatMap(list, | |
| 165 | + order -> Stream.of(order.getSourceWarehouseId(), order.getTargetWarehouseId()))); | |
| 166 | + Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertSetByFlatMap(list, | |
| 167 | + order -> Stream.of(parseUserId(order.getCreator()), parseUserId(order.getUpdater())))); | |
| 168 | + // 拼接数据 | |
| 169 | + return BeanUtils.toBean(list, WmsMovementOrderRespVO.class, vo -> { | |
| 170 | + MapUtils.findAndThen(warehouseMap, vo.getSourceWarehouseId(), | |
| 171 | + warehouse -> vo.setSourceWarehouseName(warehouse.getName())); | |
| 172 | + MapUtils.findAndThen(warehouseMap, vo.getTargetWarehouseId(), | |
| 173 | + warehouse -> vo.setTargetWarehouseName(warehouse.getName())); | |
| 174 | + MapUtils.findAndThen(userMap, parseUserId(vo.getCreator()), user -> vo.setCreatorName(user.getNickname())); | |
| 175 | + MapUtils.findAndThen(userMap, parseUserId(vo.getUpdater()), user -> vo.setUpdaterName(user.getNickname())); | |
| 176 | + }); | |
| 177 | + } | |
| 178 | + | |
| 179 | + private Long parseUserId(String userId) { | |
| 180 | + return NumberUtil.parseLong(userId, null); | |
| 181 | + } | |
| 182 | + | |
| 183 | + private List<WmsMovementOrderDetailRespVO> buildMovementOrderDetailRespVOList(List<WmsMovementOrderDetailDO> list) { | |
| 184 | + if (CollUtil.isEmpty(list)) { | |
| 185 | + return Collections.emptyList(); | |
| 186 | + } | |
| 187 | + // 获取相关的商品、SKU、仓库等数据 | |
| 188 | + Map<Long, WmsItemSkuDO> skuMap = itemSkuService.getItemSkuMap(convertSet(list, WmsMovementOrderDetailDO::getSkuId)); | |
| 189 | + Map<Long, WmsItemDO> itemMap = itemService.getItemMap(convertSet(skuMap.values(), WmsItemSkuDO::getItemId)); | |
| 190 | + Map<Long, WmsWarehouseDO> warehouseMap = warehouseService.getWarehouseMap(convertSetByFlatMap(list, | |
| 191 | + detail -> Stream.of(detail.getSourceWarehouseId(), detail.getTargetWarehouseId()))); | |
| 192 | + // 拼接数据 | |
| 193 | + return BeanUtils.toBean(list, WmsMovementOrderDetailRespVO.class, vo -> { | |
| 194 | + MapUtils.findAndThen(skuMap, vo.getSkuId(), sku -> { | |
| 195 | + vo.setSkuCode(sku.getCode()).setSkuName(sku.getName()).setItemId(sku.getItemId()); | |
| 196 | + MapUtils.findAndThen(itemMap, sku.getItemId(), item -> vo.setItemCode(item.getCode()) | |
| 197 | + .setItemName(item.getName()).setUnit(item.getUnit())); | |
| 198 | + }); | |
| 199 | + MapUtils.findAndThen(warehouseMap, vo.getSourceWarehouseId(), | |
| 200 | + warehouse -> vo.setSourceWarehouseName(warehouse.getName())); | |
| 201 | + MapUtils.findAndThen(warehouseMap, vo.getTargetWarehouseId(), | |
| 202 | + warehouse -> vo.setTargetWarehouseName(warehouse.getName())); | |
| 203 | + }); | |
| 204 | + } | |
| 205 | + | |
| 206 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/order/movement/WmsMovementOrderDetailController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.order.movement; | |
| 2 | + | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 5 | +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | |
| 6 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 7 | +import cn.iocoder.yudao.module.wms.controller.admin.order.movement.vo.detail.WmsMovementOrderDetailRespVO; | |
| 8 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemDO; | |
| 9 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemSkuDO; | |
| 10 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.warehouse.WmsWarehouseDO; | |
| 11 | +import cn.iocoder.yudao.module.wms.dal.dataobject.order.movement.WmsMovementOrderDetailDO; | |
| 12 | +import cn.iocoder.yudao.module.wms.service.md.item.WmsItemService; | |
| 13 | +import cn.iocoder.yudao.module.wms.service.md.item.WmsItemSkuService; | |
| 14 | +import cn.iocoder.yudao.module.wms.service.md.warehouse.WmsWarehouseService; | |
| 15 | +import cn.iocoder.yudao.module.wms.service.order.movement.WmsMovementOrderDetailService; | |
| 16 | +import io.swagger.v3.oas.annotations.Operation; | |
| 17 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 18 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 19 | +import jakarta.annotation.Resource; | |
| 20 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 21 | +import org.springframework.validation.annotation.Validated; | |
| 22 | +import org.springframework.web.bind.annotation.GetMapping; | |
| 23 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 24 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 25 | +import org.springframework.web.bind.annotation.RestController; | |
| 26 | + | |
| 27 | +import java.util.Collections; | |
| 28 | +import java.util.List; | |
| 29 | +import java.util.Map; | |
| 30 | +import java.util.stream.Stream; | |
| 31 | + | |
| 32 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 33 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | |
| 34 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSetByFlatMap; | |
| 35 | + | |
| 36 | +@Tag(name = "管理后台 - WMS 移库单明细") | |
| 37 | +@RestController | |
| 38 | +@RequestMapping("/wms/movement-order-detail") | |
| 39 | +@Validated | |
| 40 | +public class WmsMovementOrderDetailController { | |
| 41 | + | |
| 42 | + @Resource | |
| 43 | + private WmsMovementOrderDetailService movementOrderDetailService; | |
| 44 | + @Resource | |
| 45 | + private WmsItemService itemService; | |
| 46 | + @Resource | |
| 47 | + private WmsItemSkuService itemSkuService; | |
| 48 | + @Resource | |
| 49 | + private WmsWarehouseService warehouseService; | |
| 50 | + | |
| 51 | + @GetMapping("/list-by-order-id") | |
| 52 | + @Operation(summary = "获得移库单明细列表") | |
| 53 | + @Parameter(name = "orderId", description = "移库单编号", required = true, example = "1024") | |
| 54 | + @PreAuthorize("@ss.hasPermission('wms:movement-order:query')") | |
| 55 | + public CommonResult<List<WmsMovementOrderDetailRespVO>> getMovementOrderDetailListByOrderId( | |
| 56 | + @RequestParam("orderId") Long orderId) { | |
| 57 | + List<WmsMovementOrderDetailDO> list = movementOrderDetailService.getMovementOrderDetailList(orderId); | |
| 58 | + return success(buildMovementOrderDetailRespVOList(list)); | |
| 59 | + } | |
| 60 | + | |
| 61 | + // ==================== 拼接 VO ==================== | |
| 62 | + | |
| 63 | + private List<WmsMovementOrderDetailRespVO> buildMovementOrderDetailRespVOList(List<WmsMovementOrderDetailDO> list) { | |
| 64 | + if (CollUtil.isEmpty(list)) { | |
| 65 | + return Collections.emptyList(); | |
| 66 | + } | |
| 67 | + // 查询关联数据 | |
| 68 | + Map<Long, WmsItemSkuDO> skuMap = itemSkuService.getItemSkuMap(convertSet(list, WmsMovementOrderDetailDO::getSkuId)); | |
| 69 | + Map<Long, WmsItemDO> itemMap = itemService.getItemMap(convertSet(skuMap.values(), WmsItemSkuDO::getItemId)); | |
| 70 | + Map<Long, WmsWarehouseDO> warehouseMap = warehouseService.getWarehouseMap(convertSetByFlatMap(list, | |
| 71 | + detail -> Stream.of(detail.getSourceWarehouseId(), detail.getTargetWarehouseId()))); | |
| 72 | + // 拼接数据 | |
| 73 | + return BeanUtils.toBean(list, WmsMovementOrderDetailRespVO.class, vo -> { | |
| 74 | + MapUtils.findAndThen(skuMap, vo.getSkuId(), sku -> { | |
| 75 | + vo.setSkuCode(sku.getCode()).setSkuName(sku.getName()).setItemId(sku.getItemId()); | |
| 76 | + MapUtils.findAndThen(itemMap, sku.getItemId(), item -> vo.setItemCode(item.getCode()) | |
| 77 | + .setItemName(item.getName()).setUnit(item.getUnit())); | |
| 78 | + }); | |
| 79 | + MapUtils.findAndThen(warehouseMap, vo.getSourceWarehouseId(), | |
| 80 | + warehouse -> vo.setSourceWarehouseName(warehouse.getName())); | |
| 81 | + MapUtils.findAndThen(warehouseMap, vo.getTargetWarehouseId(), | |
| 82 | + warehouse -> vo.setTargetWarehouseName(warehouse.getName())); | |
| 83 | + }); | |
| 84 | + } | |
| 85 | + | |
| 86 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/order/movement/vo/detail/WmsMovementOrderDetailRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.order.movement.vo.detail; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +import java.math.BigDecimal; | |
| 7 | +import java.time.LocalDateTime; | |
| 8 | + | |
| 9 | +@Schema(description = "管理后台 - WMS 移库单明细 Response VO") | |
| 10 | +@Data | |
| 11 | +public class WmsMovementOrderDetailRespVO { | |
| 12 | + | |
| 13 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 14 | + private Long id; | |
| 15 | + | |
| 16 | + @Schema(description = "移库单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 17 | + private Long orderId; | |
| 18 | + | |
| 19 | + @Schema(description = "商品编号", example = "2048") | |
| 20 | + private Long itemId; | |
| 21 | + | |
| 22 | + @Schema(description = "商品编号", example = "SPU-APPLE") | |
| 23 | + private String itemCode; | |
| 24 | + | |
| 25 | + @Schema(description = "商品名称", example = "红富士苹果") | |
| 26 | + private String itemName; | |
| 27 | + | |
| 28 | + @Schema(description = "商品单位", example = "箱") | |
| 29 | + private String unit; | |
| 30 | + | |
| 31 | + @Schema(description = "SKU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") | |
| 32 | + private Long skuId; | |
| 33 | + | |
| 34 | + @Schema(description = "规格编号", example = "SKU-APPLE-10KG") | |
| 35 | + private String skuCode; | |
| 36 | + | |
| 37 | + @Schema(description = "规格名称", example = "10kg 箱装") | |
| 38 | + private String skuName; | |
| 39 | + | |
| 40 | + @Schema(description = "来源仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 41 | + private Long sourceWarehouseId; | |
| 42 | + | |
| 43 | + @Schema(description = "来源仓库名称", example = "北京仓") | |
| 44 | + private String sourceWarehouseName; | |
| 45 | + | |
| 46 | + @Schema(description = "目标仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") | |
| 47 | + private Long targetWarehouseId; | |
| 48 | + | |
| 49 | + @Schema(description = "目标仓库名称", example = "上海仓") | |
| 50 | + private String targetWarehouseName; | |
| 51 | + | |
| 52 | + @Schema(description = "移库数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00") | |
| 53 | + private BigDecimal quantity; | |
| 54 | + | |
| 55 | + @Schema(description = "单价", example = "100.00") | |
| 56 | + private BigDecimal price; | |
| 57 | + | |
| 58 | + @Schema(description = "行金额", example = "1000.00") | |
| 59 | + private BigDecimal totalPrice; | |
| 60 | + | |
| 61 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 62 | + private LocalDateTime createTime; | |
| 63 | + | |
| 64 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/order/movement/vo/detail/WmsMovementOrderDetailSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.order.movement.vo.detail; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import jakarta.validation.constraints.DecimalMin; | |
| 5 | +import jakarta.validation.constraints.NotNull; | |
| 6 | +import lombok.Data; | |
| 7 | + | |
| 8 | +import java.math.BigDecimal; | |
| 9 | + | |
| 10 | +@Schema(description = "管理后台 - WMS 移库单明细保存 Request VO") | |
| 11 | +@Data | |
| 12 | +public class WmsMovementOrderDetailSaveReqVO { | |
| 13 | + | |
| 14 | + @Schema(description = "编号", example = "1024") | |
| 15 | + private Long id; | |
| 16 | + | |
| 17 | + @Schema(description = "SKU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") | |
| 18 | + @NotNull(message = "SKU 不能为空") | |
| 19 | + private Long skuId; | |
| 20 | + | |
| 21 | + @Schema(description = "移库数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00") | |
| 22 | + @NotNull(message = "移库数量不能为空") | |
| 23 | + @DecimalMin(value = "0", inclusive = false, message = "移库数量必须大于 0") | |
| 24 | + private BigDecimal quantity; | |
| 25 | + | |
| 26 | + @Schema(description = "单价", example = "100.00") | |
| 27 | + @DecimalMin(value = "0", message = "单价不能小于 0") | |
| 28 | + private BigDecimal price; | |
| 29 | + | |
| 30 | + @Schema(description = "行金额", example = "1000.00") | |
| 31 | + @DecimalMin(value = "0", message = "行金额不能小于 0") | |
| 32 | + private BigDecimal totalPrice; | |
| 33 | + | |
| 34 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/order/movement/vo/order/WmsMovementOrderPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.order.movement.vo.order; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | |
| 5 | +import cn.iocoder.yudao.module.wms.enums.order.WmsOrderStatusEnum; | |
| 6 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 7 | +import lombok.Data; | |
| 8 | +import lombok.EqualsAndHashCode; | |
| 9 | +import lombok.ToString; | |
| 10 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 11 | + | |
| 12 | +import java.math.BigDecimal; | |
| 13 | +import java.time.LocalDateTime; | |
| 14 | + | |
| 15 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 16 | + | |
| 17 | +@Schema(description = "管理后台 - WMS 移库单分页 Request VO") | |
| 18 | +@Data | |
| 19 | +@EqualsAndHashCode(callSuper = true) | |
| 20 | +@ToString(callSuper = true) | |
| 21 | +public class WmsMovementOrderPageReqVO extends PageParam { | |
| 22 | + | |
| 23 | + @Schema(description = "移库单号", example = "YK202605110001") | |
| 24 | + private String no; | |
| 25 | + | |
| 26 | + @Schema(description = "单据状态", example = "0") | |
| 27 | + @InEnum(WmsOrderStatusEnum.class) | |
| 28 | + private Integer status; | |
| 29 | + | |
| 30 | + @Schema(description = "来源仓库编号", example = "1024") | |
| 31 | + private Long sourceWarehouseId; | |
| 32 | + | |
| 33 | + @Schema(description = "目标仓库编号", example = "2048") | |
| 34 | + private Long targetWarehouseId; | |
| 35 | + | |
| 36 | + @Schema(description = "单据日期") | |
| 37 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 38 | + private LocalDateTime[] orderTime; | |
| 39 | + | |
| 40 | + @Schema(description = "最小数量", example = "1.00") | |
| 41 | + private BigDecimal totalQuantityMin; | |
| 42 | + | |
| 43 | + @Schema(description = "最大数量", example = "100.00") | |
| 44 | + private BigDecimal totalQuantityMax; | |
| 45 | + | |
| 46 | + @Schema(description = "最小总金额", example = "1.00") | |
| 47 | + private BigDecimal totalPriceMin; | |
| 48 | + | |
| 49 | + @Schema(description = "最大总金额", example = "1000.00") | |
| 50 | + private BigDecimal totalPriceMax; | |
| 51 | + | |
| 52 | + @Schema(description = "创建用户", example = "1") | |
| 53 | + private String creator; | |
| 54 | + | |
| 55 | + @Schema(description = "更新用户", example = "1") | |
| 56 | + private String updater; | |
| 57 | + | |
| 58 | + @Schema(description = "创建时间") | |
| 59 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 60 | + private LocalDateTime[] createTime; | |
| 61 | + | |
| 62 | + @Schema(description = "更新时间") | |
| 63 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 64 | + private LocalDateTime[] updateTime; | |
| 65 | + | |
| 66 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/order/movement/vo/order/WmsMovementOrderRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.order.movement.vo.order; | |
| 2 | + | |
| 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; | |
| 4 | +import cn.idev.excel.annotation.ExcelProperty; | |
| 5 | +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | |
| 6 | +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | |
| 7 | +import cn.iocoder.yudao.module.wms.controller.admin.order.movement.vo.detail.WmsMovementOrderDetailRespVO; | |
| 8 | +import cn.iocoder.yudao.module.wms.enums.DictTypeConstants; | |
| 9 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 10 | +import lombok.Data; | |
| 11 | + | |
| 12 | +import java.math.BigDecimal; | |
| 13 | +import java.time.LocalDateTime; | |
| 14 | +import java.util.List; | |
| 15 | + | |
| 16 | +@Schema(description = "管理后台 - WMS 移库单 Response VO") | |
| 17 | +@Data | |
| 18 | +@ExcelIgnoreUnannotated | |
| 19 | +public class WmsMovementOrderRespVO { | |
| 20 | + | |
| 21 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 22 | + private Long id; | |
| 23 | + | |
| 24 | + @Schema(description = "移库单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "YK202605110001") | |
| 25 | + @ExcelProperty("移库单号") | |
| 26 | + private String no; | |
| 27 | + | |
| 28 | + @Schema(description = "单据日期", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 29 | + @ExcelProperty("单据日期") | |
| 30 | + private LocalDateTime orderTime; | |
| 31 | + | |
| 32 | + @Schema(description = "移库状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | |
| 33 | + @ExcelProperty(value = "移库状态", converter = DictConvert.class) | |
| 34 | + @DictFormat(DictTypeConstants.ORDER_STATUS) | |
| 35 | + private Integer status; | |
| 36 | + | |
| 37 | + @Schema(description = "备注", example = "备注") | |
| 38 | + private String remark; | |
| 39 | + | |
| 40 | + @Schema(description = "来源仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 41 | + private Long sourceWarehouseId; | |
| 42 | + | |
| 43 | + @Schema(description = "来源仓库名称", example = "北京仓") | |
| 44 | + @ExcelProperty("来源仓库") | |
| 45 | + private String sourceWarehouseName; | |
| 46 | + | |
| 47 | + @Schema(description = "目标仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") | |
| 48 | + private Long targetWarehouseId; | |
| 49 | + | |
| 50 | + @Schema(description = "目标仓库名称", example = "上海仓") | |
| 51 | + @ExcelProperty("目标仓库") | |
| 52 | + private String targetWarehouseName; | |
| 53 | + | |
| 54 | + @Schema(description = "移库数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00") | |
| 55 | + @ExcelProperty("移库数量") | |
| 56 | + private BigDecimal totalQuantity; | |
| 57 | + | |
| 58 | + @Schema(description = "总金额", example = "1000.00") | |
| 59 | + @ExcelProperty("总金额") | |
| 60 | + private BigDecimal totalPrice; | |
| 61 | + | |
| 62 | + @Schema(description = "移库明细") | |
| 63 | + private List<WmsMovementOrderDetailRespVO> details; | |
| 64 | + | |
| 65 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 66 | + @ExcelProperty("创建时间") | |
| 67 | + private LocalDateTime createTime; | |
| 68 | + | |
| 69 | + @Schema(description = "创建者", example = "1") | |
| 70 | + private String creator; | |
| 71 | + @Schema(description = "创建者名称", example = "芋道") | |
| 72 | + private String creatorName; | |
| 73 | + | |
| 74 | + @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 75 | + private LocalDateTime updateTime; | |
| 76 | + | |
| 77 | + @Schema(description = "更新者", example = "1") | |
| 78 | + private String updater; | |
| 79 | + @Schema(description = "更新者名称", example = "芋道") | |
| 80 | + private String updaterName; | |
| 81 | + | |
| 82 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/order/movement/vo/order/WmsMovementOrderSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.order.movement.vo.order; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.wms.controller.admin.order.movement.vo.detail.WmsMovementOrderDetailSaveReqVO; | |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | +import jakarta.validation.Valid; | |
| 6 | +import jakarta.validation.constraints.NotBlank; | |
| 7 | +import jakarta.validation.constraints.NotNull; | |
| 8 | +import jakarta.validation.constraints.Size; | |
| 9 | +import lombok.Data; | |
| 10 | + | |
| 11 | +import java.time.LocalDateTime; | |
| 12 | +import java.util.List; | |
| 13 | + | |
| 14 | +@Schema(description = "管理后台 - WMS 移库单保存 Request VO") | |
| 15 | +@Data | |
| 16 | +public class WmsMovementOrderSaveReqVO { | |
| 17 | + | |
| 18 | + @Schema(description = "编号", example = "1024") | |
| 19 | + private Long id; | |
| 20 | + | |
| 21 | + @Schema(description = "移库单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "YK202605110001") | |
| 22 | + @NotBlank(message = "移库单号不能为空") | |
| 23 | + @Size(max = 64, message = "移库单号长度不能超过 64 个字符") | |
| 24 | + private String no; | |
| 25 | + | |
| 26 | + @Schema(description = "单据日期", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 27 | + @NotNull(message = "单据日期不能为空") | |
| 28 | + private LocalDateTime orderTime; | |
| 29 | + | |
| 30 | + @Schema(description = "备注", example = "备注") | |
| 31 | + @Size(max = 255, message = "备注长度不能超过 255 个字符") | |
| 32 | + private String remark; | |
| 33 | + | |
| 34 | + @Schema(description = "来源仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 35 | + @NotNull(message = "来源仓库不能为空") | |
| 36 | + private Long sourceWarehouseId; | |
| 37 | + | |
| 38 | + @Schema(description = "目标仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") | |
| 39 | + @NotNull(message = "目标仓库不能为空") | |
| 40 | + private Long targetWarehouseId; | |
| 41 | + | |
| 42 | + @Schema(description = "移库明细") | |
| 43 | + @Valid | |
| 44 | + private List<WmsMovementOrderDetailSaveReqVO> details; | |
| 45 | + | |
| 46 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/order/receipt/WmsReceiptOrderController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.order.receipt; | |
| 2 | + | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 4 | +import cn.hutool.core.util.NumberUtil; | |
| 5 | +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; | |
| 6 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 7 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 8 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 9 | +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | |
| 10 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 11 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | |
| 12 | +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | |
| 13 | +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | |
| 14 | +import cn.iocoder.yudao.module.wms.controller.admin.order.receipt.vo.detail.WmsReceiptOrderDetailRespVO; | |
| 15 | +import cn.iocoder.yudao.module.wms.controller.admin.order.receipt.vo.order.WmsReceiptOrderPageReqVO; | |
| 16 | +import cn.iocoder.yudao.module.wms.controller.admin.order.receipt.vo.order.WmsReceiptOrderRespVO; | |
| 17 | +import cn.iocoder.yudao.module.wms.controller.admin.order.receipt.vo.order.WmsReceiptOrderSaveReqVO; | |
| 18 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemDO; | |
| 19 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemSkuDO; | |
| 20 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.merchant.WmsMerchantDO; | |
| 21 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.warehouse.WmsWarehouseDO; | |
| 22 | +import cn.iocoder.yudao.module.wms.dal.dataobject.order.receipt.WmsReceiptOrderDO; | |
| 23 | +import cn.iocoder.yudao.module.wms.dal.dataobject.order.receipt.WmsReceiptOrderDetailDO; | |
| 24 | +import cn.iocoder.yudao.module.wms.service.md.item.WmsItemService; | |
| 25 | +import cn.iocoder.yudao.module.wms.service.md.item.WmsItemSkuService; | |
| 26 | +import cn.iocoder.yudao.module.wms.service.md.merchant.WmsMerchantService; | |
| 27 | +import cn.iocoder.yudao.module.wms.service.md.warehouse.WmsWarehouseService; | |
| 28 | +import cn.iocoder.yudao.module.wms.service.order.receipt.WmsReceiptOrderDetailService; | |
| 29 | +import cn.iocoder.yudao.module.wms.service.order.receipt.WmsReceiptOrderService; | |
| 30 | +import io.swagger.v3.oas.annotations.Operation; | |
| 31 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 32 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 33 | +import jakarta.annotation.Resource; | |
| 34 | +import jakarta.servlet.http.HttpServletResponse; | |
| 35 | +import jakarta.validation.Valid; | |
| 36 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 37 | +import org.springframework.validation.annotation.Validated; | |
| 38 | +import org.springframework.web.bind.annotation.*; | |
| 39 | + | |
| 40 | +import java.io.IOException; | |
| 41 | +import java.util.Collections; | |
| 42 | +import java.util.List; | |
| 43 | +import java.util.Map; | |
| 44 | +import java.util.stream.Stream; | |
| 45 | + | |
| 46 | +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | |
| 47 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 48 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | |
| 49 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSetByFlatMap; | |
| 50 | + | |
| 51 | +@Tag(name = "管理后台 - WMS 入库单") | |
| 52 | +@RestController | |
| 53 | +@RequestMapping("/wms/receipt-order") | |
| 54 | +@Validated | |
| 55 | +public class WmsReceiptOrderController { | |
| 56 | + | |
| 57 | + @Resource | |
| 58 | + private WmsReceiptOrderService receiptOrderService; | |
| 59 | + @Resource | |
| 60 | + private WmsReceiptOrderDetailService receiptOrderDetailService; | |
| 61 | + @Resource | |
| 62 | + private WmsMerchantService merchantService; | |
| 63 | + @Resource | |
| 64 | + private WmsWarehouseService warehouseService; | |
| 65 | + @Resource | |
| 66 | + private WmsItemService itemService; | |
| 67 | + @Resource | |
| 68 | + private WmsItemSkuService itemSkuService; | |
| 69 | + | |
| 70 | + @Resource | |
| 71 | + private AdminUserApi adminUserApi; | |
| 72 | + | |
| 73 | + @PostMapping("/create") | |
| 74 | + @Operation(summary = "创建入库单") | |
| 75 | + @PreAuthorize("@ss.hasPermission('wms:receipt-order:create')") | |
| 76 | + public CommonResult<Long> createReceiptOrder(@Valid @RequestBody WmsReceiptOrderSaveReqVO createReqVO) { | |
| 77 | + return success(receiptOrderService.createReceiptOrder(createReqVO)); | |
| 78 | + } | |
| 79 | + | |
| 80 | + @PutMapping("/update") | |
| 81 | + @Operation(summary = "更新入库单") | |
| 82 | + @PreAuthorize("@ss.hasPermission('wms:receipt-order:update')") | |
| 83 | + public CommonResult<Boolean> updateReceiptOrder(@Valid @RequestBody WmsReceiptOrderSaveReqVO updateReqVO) { | |
| 84 | + receiptOrderService.updateReceiptOrder(updateReqVO); | |
| 85 | + return success(true); | |
| 86 | + } | |
| 87 | + | |
| 88 | + @DeleteMapping("/delete") | |
| 89 | + @Operation(summary = "删除入库单") | |
| 90 | + @Parameter(name = "id", description = "编号", required = true) | |
| 91 | + @PreAuthorize("@ss.hasPermission('wms:receipt-order:delete')") | |
| 92 | + public CommonResult<Boolean> deleteReceiptOrder(@RequestParam("id") Long id) { | |
| 93 | + receiptOrderService.deleteReceiptOrder(id); | |
| 94 | + return success(true); | |
| 95 | + } | |
| 96 | + | |
| 97 | + @PutMapping("/complete") | |
| 98 | + @Operation(summary = "完成入库") | |
| 99 | + @Parameter(name = "id", description = "编号", required = true) | |
| 100 | + @PreAuthorize("@ss.hasPermission('wms:receipt-order:complete')") | |
| 101 | + public CommonResult<Boolean> completeReceiptOrder(@RequestParam("id") Long id) { | |
| 102 | + receiptOrderService.completeReceiptOrder(id); | |
| 103 | + return success(true); | |
| 104 | + } | |
| 105 | + | |
| 106 | + @PutMapping("/cancel") | |
| 107 | + @Operation(summary = "作废入库单") | |
| 108 | + @Parameter(name = "id", description = "编号", required = true) | |
| 109 | + @PreAuthorize("@ss.hasPermission('wms:receipt-order:cancel')") | |
| 110 | + public CommonResult<Boolean> cancelReceiptOrder(@RequestParam("id") Long id) { | |
| 111 | + receiptOrderService.cancelReceiptOrder(id); | |
| 112 | + return success(true); | |
| 113 | + } | |
| 114 | + | |
| 115 | + @GetMapping("/get") | |
| 116 | + @Operation(summary = "获得入库单") | |
| 117 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 118 | + @PreAuthorize("@ss.hasPermission('wms:receipt-order:query')") | |
| 119 | + public CommonResult<WmsReceiptOrderRespVO> getReceiptOrder(@RequestParam("id") Long id) { | |
| 120 | + WmsReceiptOrderDO order = receiptOrderService.getReceiptOrder(id); | |
| 121 | + if (order == null) { | |
| 122 | + return success(null); | |
| 123 | + } | |
| 124 | + // 获得入库单的明细列表 | |
| 125 | + List<WmsReceiptOrderDetailDO> detailList = receiptOrderDetailService.getReceiptOrderDetailList(id); | |
| 126 | + // 拼接结果返回 | |
| 127 | + WmsReceiptOrderRespVO respVO = buildReceiptOrderRespVO(order) | |
| 128 | + .setDetails(buildReceiptOrderDetailRespVOList(detailList)); | |
| 129 | + return success(respVO); | |
| 130 | + } | |
| 131 | + | |
| 132 | + @GetMapping("/page") | |
| 133 | + @Operation(summary = "获得入库单分页") | |
| 134 | + @PreAuthorize("@ss.hasPermission('wms:receipt-order:query')") | |
| 135 | + public CommonResult<PageResult<WmsReceiptOrderRespVO>> getReceiptOrderPage(@Valid WmsReceiptOrderPageReqVO pageReqVO) { | |
| 136 | + PageResult<WmsReceiptOrderDO> pageResult = receiptOrderService.getReceiptOrderPage(pageReqVO); | |
| 137 | + return success(new PageResult<>(buildReceiptOrderRespVOList(pageResult.getList()), pageResult.getTotal())); | |
| 138 | + } | |
| 139 | + | |
| 140 | + @GetMapping("/export-excel") | |
| 141 | + @Operation(summary = "导出入库单 Excel") | |
| 142 | + @PreAuthorize("@ss.hasPermission('wms:receipt-order:export')") | |
| 143 | + @ApiAccessLog(operateType = EXPORT) | |
| 144 | + public void exportReceiptOrderExcel(@Valid WmsReceiptOrderPageReqVO pageReqVO, | |
| 145 | + HttpServletResponse response) throws IOException { | |
| 146 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 147 | + List<WmsReceiptOrderDO> list = receiptOrderService.getReceiptOrderPage(pageReqVO).getList(); | |
| 148 | + ExcelUtils.write(response, "入库单.xls", "数据", WmsReceiptOrderRespVO.class, | |
| 149 | + buildReceiptOrderRespVOList(list)); | |
| 150 | + } | |
| 151 | + | |
| 152 | + // ==================== 拼接 VO ==================== | |
| 153 | + | |
| 154 | + private WmsReceiptOrderRespVO buildReceiptOrderRespVO(WmsReceiptOrderDO order) { | |
| 155 | + if (order == null) { | |
| 156 | + return null; | |
| 157 | + } | |
| 158 | + List<WmsReceiptOrderRespVO> list = buildReceiptOrderRespVOList(Collections.singletonList(order)); | |
| 159 | + return CollUtil.getFirst(list); | |
| 160 | + } | |
| 161 | + | |
| 162 | + private List<WmsReceiptOrderRespVO> buildReceiptOrderRespVOList(List<WmsReceiptOrderDO> list) { | |
| 163 | + if (CollUtil.isEmpty(list)) { | |
| 164 | + return Collections.emptyList(); | |
| 165 | + } | |
| 166 | + // 获取相关的商户、仓库、用户等数据 | |
| 167 | + Map<Long, WmsMerchantDO> merchantMap = merchantService.getMerchantMap(convertSet(list, WmsReceiptOrderDO::getMerchantId)); | |
| 168 | + Map<Long, WmsWarehouseDO> warehouseMap = warehouseService.getWarehouseMap(convertSet(list, WmsReceiptOrderDO::getWarehouseId)); | |
| 169 | + Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertSetByFlatMap(list, | |
| 170 | + order -> Stream.of(parseUserId(order.getCreator()), parseUserId(order.getUpdater())))); | |
| 171 | + // 拼接数据 | |
| 172 | + return BeanUtils.toBean(list, WmsReceiptOrderRespVO.class, vo -> { | |
| 173 | + MapUtils.findAndThen(merchantMap, vo.getMerchantId(), merchant -> vo.setMerchantName(merchant.getName())); | |
| 174 | + MapUtils.findAndThen(warehouseMap, vo.getWarehouseId(), warehouse -> vo.setWarehouseName(warehouse.getName())); | |
| 175 | + MapUtils.findAndThen(userMap, parseUserId(vo.getCreator()), user -> vo.setCreatorName(user.getNickname())); | |
| 176 | + MapUtils.findAndThen(userMap, parseUserId(vo.getUpdater()), user -> vo.setUpdaterName(user.getNickname())); | |
| 177 | + }); | |
| 178 | + } | |
| 179 | + | |
| 180 | + private Long parseUserId(String userId) { | |
| 181 | + return NumberUtil.parseLong(userId, null); | |
| 182 | + } | |
| 183 | + | |
| 184 | + private List<WmsReceiptOrderDetailRespVO> buildReceiptOrderDetailRespVOList(List<WmsReceiptOrderDetailDO> list) { | |
| 185 | + if (CollUtil.isEmpty(list)) { | |
| 186 | + return Collections.emptyList(); | |
| 187 | + } | |
| 188 | + // 获取相关的商品、SKU、仓库等数据 | |
| 189 | + Map<Long, WmsItemSkuDO> skuMap = itemSkuService.getItemSkuMap(convertSet(list, WmsReceiptOrderDetailDO::getSkuId)); | |
| 190 | + Map<Long, WmsItemDO> itemMap = itemService.getItemMap(convertSet(skuMap.values(), WmsItemSkuDO::getItemId)); | |
| 191 | + Map<Long, WmsWarehouseDO> warehouseMap = warehouseService.getWarehouseMap( | |
| 192 | + convertSet(list, WmsReceiptOrderDetailDO::getWarehouseId)); | |
| 193 | + // 拼接数据 | |
| 194 | + return BeanUtils.toBean(list, WmsReceiptOrderDetailRespVO.class, vo -> { | |
| 195 | + MapUtils.findAndThen(skuMap, vo.getSkuId(), sku -> { | |
| 196 | + vo.setSkuCode(sku.getCode()).setSkuName(sku.getName()).setItemId(sku.getItemId()); | |
| 197 | + MapUtils.findAndThen(itemMap, sku.getItemId(), item -> vo.setItemCode(item.getCode()) | |
| 198 | + .setItemName(item.getName()).setUnit(item.getUnit())); | |
| 199 | + }); | |
| 200 | + MapUtils.findAndThen(warehouseMap, vo.getWarehouseId(), warehouse -> vo.setWarehouseName(warehouse.getName())); | |
| 201 | + }); | |
| 202 | + } | |
| 203 | + | |
| 204 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/order/receipt/WmsReceiptOrderDetailController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.order.receipt; | |
| 2 | + | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 5 | +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | |
| 6 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 7 | +import cn.iocoder.yudao.module.wms.controller.admin.order.receipt.vo.detail.WmsReceiptOrderDetailRespVO; | |
| 8 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemDO; | |
| 9 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemSkuDO; | |
| 10 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.warehouse.WmsWarehouseDO; | |
| 11 | +import cn.iocoder.yudao.module.wms.dal.dataobject.order.receipt.WmsReceiptOrderDetailDO; | |
| 12 | +import cn.iocoder.yudao.module.wms.service.md.item.WmsItemService; | |
| 13 | +import cn.iocoder.yudao.module.wms.service.md.item.WmsItemSkuService; | |
| 14 | +import cn.iocoder.yudao.module.wms.service.md.warehouse.WmsWarehouseService; | |
| 15 | +import cn.iocoder.yudao.module.wms.service.order.receipt.WmsReceiptOrderDetailService; | |
| 16 | +import io.swagger.v3.oas.annotations.Operation; | |
| 17 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 18 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 19 | +import jakarta.annotation.Resource; | |
| 20 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 21 | +import org.springframework.validation.annotation.Validated; | |
| 22 | +import org.springframework.web.bind.annotation.GetMapping; | |
| 23 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 24 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 25 | +import org.springframework.web.bind.annotation.RestController; | |
| 26 | + | |
| 27 | +import java.util.Collections; | |
| 28 | +import java.util.List; | |
| 29 | +import java.util.Map; | |
| 30 | + | |
| 31 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 32 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | |
| 33 | + | |
| 34 | +@Tag(name = "管理后台 - WMS 入库单明细") | |
| 35 | +@RestController | |
| 36 | +@RequestMapping("/wms/receipt-order-detail") | |
| 37 | +@Validated | |
| 38 | +public class WmsReceiptOrderDetailController { | |
| 39 | + | |
| 40 | + @Resource | |
| 41 | + private WmsReceiptOrderDetailService receiptOrderDetailService; | |
| 42 | + @Resource | |
| 43 | + private WmsItemService itemService; | |
| 44 | + @Resource | |
| 45 | + private WmsItemSkuService itemSkuService; | |
| 46 | + @Resource | |
| 47 | + private WmsWarehouseService warehouseService; | |
| 48 | + | |
| 49 | + @GetMapping("/list-by-order-id") | |
| 50 | + @Operation(summary = "获得入库单明细列表") | |
| 51 | + @Parameter(name = "orderId", description = "入库单编号", required = true, example = "1024") | |
| 52 | + @PreAuthorize("@ss.hasPermission('wms:receipt-order:query')") | |
| 53 | + public CommonResult<List<WmsReceiptOrderDetailRespVO>> getReceiptOrderDetailListByOrderId( | |
| 54 | + @RequestParam("orderId") Long orderId) { | |
| 55 | + List<WmsReceiptOrderDetailDO> list = receiptOrderDetailService.getReceiptOrderDetailList(orderId); | |
| 56 | + return success(buildReceiptOrderDetailRespVOList(list)); | |
| 57 | + } | |
| 58 | + | |
| 59 | + // ==================== 拼接 VO ==================== | |
| 60 | + | |
| 61 | + private List<WmsReceiptOrderDetailRespVO> buildReceiptOrderDetailRespVOList(List<WmsReceiptOrderDetailDO> list) { | |
| 62 | + if (CollUtil.isEmpty(list)) { | |
| 63 | + return Collections.emptyList(); | |
| 64 | + } | |
| 65 | + // 查询关联数据 | |
| 66 | + Map<Long, WmsItemSkuDO> skuMap = itemSkuService.getItemSkuMap(convertSet(list, WmsReceiptOrderDetailDO::getSkuId)); | |
| 67 | + Map<Long, WmsItemDO> itemMap = itemService.getItemMap(convertSet(skuMap.values(), WmsItemSkuDO::getItemId)); | |
| 68 | + Map<Long, WmsWarehouseDO> warehouseMap = warehouseService.getWarehouseMap( | |
| 69 | + convertSet(list, WmsReceiptOrderDetailDO::getWarehouseId)); | |
| 70 | + // 拼接数据 | |
| 71 | + return BeanUtils.toBean(list, WmsReceiptOrderDetailRespVO.class, vo -> { | |
| 72 | + MapUtils.findAndThen(skuMap, vo.getSkuId(), sku -> { | |
| 73 | + vo.setSkuCode(sku.getCode()).setSkuName(sku.getName()).setItemId(sku.getItemId()); | |
| 74 | + MapUtils.findAndThen(itemMap, sku.getItemId(), item -> vo.setItemCode(item.getCode()) | |
| 75 | + .setItemName(item.getName()).setUnit(item.getUnit())); | |
| 76 | + }); | |
| 77 | + MapUtils.findAndThen(warehouseMap, vo.getWarehouseId(), warehouse -> vo.setWarehouseName(warehouse.getName())); | |
| 78 | + }); | |
| 79 | + } | |
| 80 | + | |
| 81 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/order/receipt/vo/detail/WmsReceiptOrderDetailRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.order.receipt.vo.detail; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +import java.math.BigDecimal; | |
| 7 | +import java.time.LocalDateTime; | |
| 8 | + | |
| 9 | +@Schema(description = "管理后台 - WMS 入库单明细 Response VO") | |
| 10 | +@Data | |
| 11 | +public class WmsReceiptOrderDetailRespVO { | |
| 12 | + | |
| 13 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 14 | + private Long id; | |
| 15 | + | |
| 16 | + @Schema(description = "入库单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 17 | + private Long orderId; | |
| 18 | + | |
| 19 | + @Schema(description = "商品编号", example = "2048") | |
| 20 | + private Long itemId; | |
| 21 | + | |
| 22 | + @Schema(description = "商品编号", example = "SPU-APPLE") | |
| 23 | + private String itemCode; | |
| 24 | + | |
| 25 | + @Schema(description = "商品名称", example = "红富士苹果") | |
| 26 | + private String itemName; | |
| 27 | + | |
| 28 | + @Schema(description = "商品单位", example = "箱") | |
| 29 | + private String unit; | |
| 30 | + | |
| 31 | + @Schema(description = "SKU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") | |
| 32 | + private Long skuId; | |
| 33 | + | |
| 34 | + @Schema(description = "规格编号", example = "SKU-APPLE-10KG") | |
| 35 | + private String skuCode; | |
| 36 | + | |
| 37 | + @Schema(description = "规格名称", example = "10kg 箱装") | |
| 38 | + private String skuName; | |
| 39 | + | |
| 40 | + @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 41 | + private Long warehouseId; | |
| 42 | + | |
| 43 | + @Schema(description = "仓库名称", example = "北京仓") | |
| 44 | + private String warehouseName; | |
| 45 | + | |
| 46 | + @Schema(description = "入库数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00") | |
| 47 | + private BigDecimal quantity; | |
| 48 | + | |
| 49 | + @Schema(description = "单价", example = "1000.00") | |
| 50 | + private BigDecimal price; | |
| 51 | + | |
| 52 | + @Schema(description = "行金额", example = "1500.00") | |
| 53 | + private BigDecimal totalPrice; | |
| 54 | + | |
| 55 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 56 | + private LocalDateTime createTime; | |
| 57 | + | |
| 58 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/order/receipt/vo/detail/WmsReceiptOrderDetailSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.order.receipt.vo.detail; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import jakarta.validation.constraints.DecimalMin; | |
| 5 | +import jakarta.validation.constraints.NotNull; | |
| 6 | +import lombok.Data; | |
| 7 | + | |
| 8 | +import java.math.BigDecimal; | |
| 9 | + | |
| 10 | +@Schema(description = "管理后台 - WMS 入库单明细保存 Request VO") | |
| 11 | +@Data | |
| 12 | +public class WmsReceiptOrderDetailSaveReqVO { | |
| 13 | + | |
| 14 | + @Schema(description = "编号", example = "1024") | |
| 15 | + private Long id; | |
| 16 | + | |
| 17 | + @Schema(description = "SKU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") | |
| 18 | + @NotNull(message = "SKU 不能为空") | |
| 19 | + private Long skuId; | |
| 20 | + | |
| 21 | + @Schema(description = "入库数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00") | |
| 22 | + @NotNull(message = "入库数量不能为空") | |
| 23 | + @DecimalMin(value = "0", inclusive = false, message = "入库数量必须大于 0") | |
| 24 | + private BigDecimal quantity; | |
| 25 | + | |
| 26 | + @Schema(description = "单价", example = "1000.00") | |
| 27 | + @DecimalMin(value = "0", message = "单价不能小于 0") | |
| 28 | + private BigDecimal price; | |
| 29 | + | |
| 30 | + @Schema(description = "行金额", example = "1500.00") | |
| 31 | + @DecimalMin(value = "0", message = "行金额不能小于 0") | |
| 32 | + private BigDecimal totalPrice; | |
| 33 | + | |
| 34 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/order/receipt/vo/order/WmsReceiptOrderPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.order.receipt.vo.order; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | |
| 5 | +import cn.iocoder.yudao.module.wms.enums.order.WmsOrderStatusEnum; | |
| 6 | +import cn.iocoder.yudao.module.wms.enums.order.WmsReceiptOrderTypeEnum; | |
| 7 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 8 | +import lombok.Data; | |
| 9 | +import lombok.EqualsAndHashCode; | |
| 10 | +import lombok.ToString; | |
| 11 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 12 | + | |
| 13 | +import java.math.BigDecimal; | |
| 14 | +import java.time.LocalDateTime; | |
| 15 | + | |
| 16 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 17 | + | |
| 18 | +@Schema(description = "管理后台 - WMS 入库单分页 Request VO") | |
| 19 | +@Data | |
| 20 | +@EqualsAndHashCode(callSuper = true) | |
| 21 | +@ToString(callSuper = true) | |
| 22 | +public class WmsReceiptOrderPageReqVO extends PageParam { | |
| 23 | + | |
| 24 | + @Schema(description = "入库单号", example = "RK202605110001") | |
| 25 | + private String no; | |
| 26 | + | |
| 27 | + @Schema(description = "单据状态", example = "0") | |
| 28 | + @InEnum(WmsOrderStatusEnum.class) | |
| 29 | + private Integer status; | |
| 30 | + | |
| 31 | + @Schema(description = "仓库编号", example = "1024") | |
| 32 | + private Long warehouseId; | |
| 33 | + | |
| 34 | + @Schema(description = "供应商编号", example = "1024") | |
| 35 | + private Long merchantId; | |
| 36 | + | |
| 37 | + @Schema(description = "单据日期") | |
| 38 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 39 | + private LocalDateTime[] orderTime; | |
| 40 | + | |
| 41 | + @Schema(description = "最小数量", example = "1.00") | |
| 42 | + private BigDecimal totalQuantityMin; | |
| 43 | + | |
| 44 | + @Schema(description = "最大数量", example = "100.00") | |
| 45 | + private BigDecimal totalQuantityMax; | |
| 46 | + | |
| 47 | + @Schema(description = "最小总金额", example = "1.00") | |
| 48 | + private BigDecimal totalPriceMin; | |
| 49 | + | |
| 50 | + @Schema(description = "最大总金额", example = "1000.00") | |
| 51 | + private BigDecimal totalPriceMax; | |
| 52 | + | |
| 53 | + @Schema(description = "入库类型", example = "101") | |
| 54 | + @InEnum(WmsReceiptOrderTypeEnum.class) | |
| 55 | + private Integer type; | |
| 56 | + | |
| 57 | + @Schema(description = "业务单号", example = "PO202605110001") | |
| 58 | + private String bizOrderNo; | |
| 59 | + | |
| 60 | + @Schema(description = "创建用户", example = "1") | |
| 61 | + private String creator; | |
| 62 | + | |
| 63 | + @Schema(description = "更新用户", example = "1") | |
| 64 | + private String updater; | |
| 65 | + | |
| 66 | + @Schema(description = "创建时间") | |
| 67 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 68 | + private LocalDateTime[] createTime; | |
| 69 | + | |
| 70 | + @Schema(description = "更新时间") | |
| 71 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 72 | + private LocalDateTime[] updateTime; | |
| 73 | + | |
| 74 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/order/receipt/vo/order/WmsReceiptOrderRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.order.receipt.vo.order; | |
| 2 | + | |
| 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; | |
| 4 | +import cn.idev.excel.annotation.ExcelProperty; | |
| 5 | +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | |
| 6 | +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | |
| 7 | +import cn.iocoder.yudao.module.wms.controller.admin.order.receipt.vo.detail.WmsReceiptOrderDetailRespVO; | |
| 8 | +import cn.iocoder.yudao.module.wms.enums.DictTypeConstants; | |
| 9 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 10 | +import lombok.Data; | |
| 11 | + | |
| 12 | +import java.math.BigDecimal; | |
| 13 | +import java.time.LocalDateTime; | |
| 14 | +import java.util.List; | |
| 15 | + | |
| 16 | +@Schema(description = "管理后台 - WMS 入库单 Response VO") | |
| 17 | +@Data | |
| 18 | +@ExcelIgnoreUnannotated | |
| 19 | +public class WmsReceiptOrderRespVO { | |
| 20 | + | |
| 21 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 22 | + private Long id; | |
| 23 | + | |
| 24 | + @Schema(description = "入库单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "RK202605110001") | |
| 25 | + @ExcelProperty("入库单号") | |
| 26 | + private String no; | |
| 27 | + | |
| 28 | + @Schema(description = "入库类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "101") | |
| 29 | + @ExcelProperty(value = "入库类型", converter = DictConvert.class) | |
| 30 | + @DictFormat(DictTypeConstants.RECEIPT_ORDER_TYPE) | |
| 31 | + private Integer type; | |
| 32 | + | |
| 33 | + @Schema(description = "单据日期", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 34 | + @ExcelProperty("单据日期") | |
| 35 | + private LocalDateTime orderTime; | |
| 36 | + | |
| 37 | + @Schema(description = "入库状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | |
| 38 | + @ExcelProperty(value = "入库状态", converter = DictConvert.class) | |
| 39 | + @DictFormat(DictTypeConstants.ORDER_STATUS) | |
| 40 | + private Integer status; | |
| 41 | + | |
| 42 | + @Schema(description = "业务单号", example = "PO202605110001") | |
| 43 | + @ExcelProperty("业务单号") | |
| 44 | + private String bizOrderNo; | |
| 45 | + | |
| 46 | + @Schema(description = "供应商编号", example = "1024") | |
| 47 | + private Long merchantId; | |
| 48 | + | |
| 49 | + @Schema(description = "供应商名称", example = "某某公司") | |
| 50 | + @ExcelProperty("供应商") | |
| 51 | + private String merchantName; | |
| 52 | + | |
| 53 | + @Schema(description = "备注", example = "备注") | |
| 54 | + private String remark; | |
| 55 | + | |
| 56 | + @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 57 | + private Long warehouseId; | |
| 58 | + | |
| 59 | + @Schema(description = "仓库名称", example = "北京仓") | |
| 60 | + @ExcelProperty("仓库") | |
| 61 | + private String warehouseName; | |
| 62 | + | |
| 63 | + @Schema(description = "入库数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00") | |
| 64 | + @ExcelProperty("入库数量") | |
| 65 | + private BigDecimal totalQuantity; | |
| 66 | + | |
| 67 | + @Schema(description = "总金额", example = "1000.00") | |
| 68 | + @ExcelProperty("总金额") | |
| 69 | + private BigDecimal totalPrice; | |
| 70 | + | |
| 71 | + @Schema(description = "入库明细") | |
| 72 | + private List<WmsReceiptOrderDetailRespVO> details; | |
| 73 | + | |
| 74 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 75 | + @ExcelProperty("创建时间") | |
| 76 | + private LocalDateTime createTime; | |
| 77 | + | |
| 78 | + @Schema(description = "创建者", example = "1") | |
| 79 | + private String creator; | |
| 80 | + @Schema(description = "创建者名称", example = "芋道") | |
| 81 | + private String creatorName; | |
| 82 | + | |
| 83 | + @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 84 | + private LocalDateTime updateTime; | |
| 85 | + | |
| 86 | + @Schema(description = "更新者", example = "1") | |
| 87 | + private String updater; | |
| 88 | + @Schema(description = "更新者名称", example = "芋道") | |
| 89 | + private String updaterName; | |
| 90 | + | |
| 91 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/order/receipt/vo/order/WmsReceiptOrderSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.order.receipt.vo.order; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | |
| 4 | +import cn.iocoder.yudao.module.wms.controller.admin.order.receipt.vo.detail.WmsReceiptOrderDetailSaveReqVO; | |
| 5 | +import cn.iocoder.yudao.module.wms.enums.order.WmsReceiptOrderTypeEnum; | |
| 6 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 7 | +import jakarta.validation.Valid; | |
| 8 | +import jakarta.validation.constraints.NotBlank; | |
| 9 | +import jakarta.validation.constraints.NotNull; | |
| 10 | +import jakarta.validation.constraints.Size; | |
| 11 | +import lombok.Data; | |
| 12 | + | |
| 13 | +import java.time.LocalDateTime; | |
| 14 | +import java.util.List; | |
| 15 | + | |
| 16 | +@Schema(description = "管理后台 - WMS 入库单保存 Request VO") | |
| 17 | +@Data | |
| 18 | +public class WmsReceiptOrderSaveReqVO { | |
| 19 | + | |
| 20 | + @Schema(description = "编号", example = "1024") | |
| 21 | + private Long id; | |
| 22 | + | |
| 23 | + @Schema(description = "入库单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "RK202605110001") | |
| 24 | + @NotBlank(message = "入库单号不能为空") | |
| 25 | + @Size(max = 64, message = "入库单号长度不能超过 64 个字符") | |
| 26 | + private String no; | |
| 27 | + | |
| 28 | + @Schema(description = "入库类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "101") | |
| 29 | + @NotNull(message = "入库类型不能为空") | |
| 30 | + @InEnum(WmsReceiptOrderTypeEnum.class) | |
| 31 | + private Integer type; | |
| 32 | + | |
| 33 | + @Schema(description = "单据日期", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 34 | + @NotNull(message = "单据日期不能为空") | |
| 35 | + private LocalDateTime orderTime; | |
| 36 | + | |
| 37 | + @Schema(description = "业务单号", example = "PO202605110001") | |
| 38 | + @Size(max = 64, message = "业务单号长度不能超过 64 个字符") | |
| 39 | + private String bizOrderNo; | |
| 40 | + | |
| 41 | + @Schema(description = "供应商编号", example = "1024") | |
| 42 | + private Long merchantId; | |
| 43 | + | |
| 44 | + @Schema(description = "备注", example = "备注") | |
| 45 | + @Size(max = 255, message = "备注长度不能超过 255 个字符") | |
| 46 | + private String remark; | |
| 47 | + | |
| 48 | + @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 49 | + @NotNull(message = "仓库不能为空") | |
| 50 | + private Long warehouseId; | |
| 51 | + | |
| 52 | + @Schema(description = "入库明细") | |
| 53 | + @Valid | |
| 54 | + private List<WmsReceiptOrderDetailSaveReqVO> details; | |
| 55 | + | |
| 56 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/order/shipment/WmsShipmentOrderController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.order.shipment; | |
| 2 | + | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 4 | +import cn.hutool.core.util.NumberUtil; | |
| 5 | +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; | |
| 6 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 7 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 8 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 9 | +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | |
| 10 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 11 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | |
| 12 | +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | |
| 13 | +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | |
| 14 | +import cn.iocoder.yudao.module.wms.controller.admin.order.shipment.vo.detail.WmsShipmentOrderDetailRespVO; | |
| 15 | +import cn.iocoder.yudao.module.wms.controller.admin.order.shipment.vo.order.WmsShipmentOrderPageReqVO; | |
| 16 | +import cn.iocoder.yudao.module.wms.controller.admin.order.shipment.vo.order.WmsShipmentOrderRespVO; | |
| 17 | +import cn.iocoder.yudao.module.wms.controller.admin.order.shipment.vo.order.WmsShipmentOrderSaveReqVO; | |
| 18 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemDO; | |
| 19 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemSkuDO; | |
| 20 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.merchant.WmsMerchantDO; | |
| 21 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.warehouse.WmsWarehouseDO; | |
| 22 | +import cn.iocoder.yudao.module.wms.dal.dataobject.order.shipment.WmsShipmentOrderDO; | |
| 23 | +import cn.iocoder.yudao.module.wms.dal.dataobject.order.shipment.WmsShipmentOrderDetailDO; | |
| 24 | +import cn.iocoder.yudao.module.wms.service.md.item.WmsItemService; | |
| 25 | +import cn.iocoder.yudao.module.wms.service.md.item.WmsItemSkuService; | |
| 26 | +import cn.iocoder.yudao.module.wms.service.md.merchant.WmsMerchantService; | |
| 27 | +import cn.iocoder.yudao.module.wms.service.md.warehouse.WmsWarehouseService; | |
| 28 | +import cn.iocoder.yudao.module.wms.service.order.shipment.WmsShipmentOrderDetailService; | |
| 29 | +import cn.iocoder.yudao.module.wms.service.order.shipment.WmsShipmentOrderService; | |
| 30 | +import io.swagger.v3.oas.annotations.Operation; | |
| 31 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 32 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 33 | +import jakarta.annotation.Resource; | |
| 34 | +import jakarta.servlet.http.HttpServletResponse; | |
| 35 | +import jakarta.validation.Valid; | |
| 36 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 37 | +import org.springframework.validation.annotation.Validated; | |
| 38 | +import org.springframework.web.bind.annotation.*; | |
| 39 | + | |
| 40 | +import java.io.IOException; | |
| 41 | +import java.util.Collections; | |
| 42 | +import java.util.List; | |
| 43 | +import java.util.Map; | |
| 44 | +import java.util.stream.Stream; | |
| 45 | + | |
| 46 | +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | |
| 47 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 48 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | |
| 49 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSetByFlatMap; | |
| 50 | + | |
| 51 | +@Tag(name = "管理后台 - WMS 出库单") | |
| 52 | +@RestController | |
| 53 | +@RequestMapping("/wms/shipment-order") | |
| 54 | +@Validated | |
| 55 | +public class WmsShipmentOrderController { | |
| 56 | + | |
| 57 | + @Resource | |
| 58 | + private WmsShipmentOrderService shipmentOrderService; | |
| 59 | + @Resource | |
| 60 | + private WmsShipmentOrderDetailService shipmentOrderDetailService; | |
| 61 | + @Resource | |
| 62 | + private WmsMerchantService merchantService; | |
| 63 | + @Resource | |
| 64 | + private WmsWarehouseService warehouseService; | |
| 65 | + @Resource | |
| 66 | + private WmsItemService itemService; | |
| 67 | + @Resource | |
| 68 | + private WmsItemSkuService itemSkuService; | |
| 69 | + | |
| 70 | + @Resource | |
| 71 | + private AdminUserApi adminUserApi; | |
| 72 | + | |
| 73 | + @PostMapping("/create") | |
| 74 | + @Operation(summary = "创建出库单") | |
| 75 | + @PreAuthorize("@ss.hasPermission('wms:shipment-order:create')") | |
| 76 | + public CommonResult<Long> createShipmentOrder(@Valid @RequestBody WmsShipmentOrderSaveReqVO createReqVO) { | |
| 77 | + return success(shipmentOrderService.createShipmentOrder(createReqVO)); | |
| 78 | + } | |
| 79 | + | |
| 80 | + @PutMapping("/update") | |
| 81 | + @Operation(summary = "更新出库单") | |
| 82 | + @PreAuthorize("@ss.hasPermission('wms:shipment-order:update')") | |
| 83 | + public CommonResult<Boolean> updateShipmentOrder(@Valid @RequestBody WmsShipmentOrderSaveReqVO updateReqVO) { | |
| 84 | + shipmentOrderService.updateShipmentOrder(updateReqVO); | |
| 85 | + return success(true); | |
| 86 | + } | |
| 87 | + | |
| 88 | + @DeleteMapping("/delete") | |
| 89 | + @Operation(summary = "删除出库单") | |
| 90 | + @Parameter(name = "id", description = "编号", required = true) | |
| 91 | + @PreAuthorize("@ss.hasPermission('wms:shipment-order:delete')") | |
| 92 | + public CommonResult<Boolean> deleteShipmentOrder(@RequestParam("id") Long id) { | |
| 93 | + shipmentOrderService.deleteShipmentOrder(id); | |
| 94 | + return success(true); | |
| 95 | + } | |
| 96 | + | |
| 97 | + @PutMapping("/complete") | |
| 98 | + @Operation(summary = "完成出库") | |
| 99 | + @Parameter(name = "id", description = "编号", required = true) | |
| 100 | + @PreAuthorize("@ss.hasPermission('wms:shipment-order:complete')") | |
| 101 | + public CommonResult<Boolean> completeShipmentOrder(@RequestParam("id") Long id) { | |
| 102 | + shipmentOrderService.completeShipmentOrder(id); | |
| 103 | + return success(true); | |
| 104 | + } | |
| 105 | + | |
| 106 | + @PutMapping("/cancel") | |
| 107 | + @Operation(summary = "作废出库单") | |
| 108 | + @Parameter(name = "id", description = "编号", required = true) | |
| 109 | + @PreAuthorize("@ss.hasPermission('wms:shipment-order:cancel')") | |
| 110 | + public CommonResult<Boolean> cancelShipmentOrder(@RequestParam("id") Long id) { | |
| 111 | + shipmentOrderService.cancelShipmentOrder(id); | |
| 112 | + return success(true); | |
| 113 | + } | |
| 114 | + | |
| 115 | + @GetMapping("/get") | |
| 116 | + @Operation(summary = "获得出库单") | |
| 117 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 118 | + @PreAuthorize("@ss.hasPermission('wms:shipment-order:query')") | |
| 119 | + public CommonResult<WmsShipmentOrderRespVO> getShipmentOrder(@RequestParam("id") Long id) { | |
| 120 | + WmsShipmentOrderDO order = shipmentOrderService.getShipmentOrder(id); | |
| 121 | + if (order == null) { | |
| 122 | + return success(null); | |
| 123 | + } | |
| 124 | + // 获得出库单的明细列表 | |
| 125 | + List<WmsShipmentOrderDetailDO> detailList = shipmentOrderDetailService.getShipmentOrderDetailList(id); | |
| 126 | + // 拼接结果返回 | |
| 127 | + WmsShipmentOrderRespVO respVO = buildShipmentOrderRespVO(order) | |
| 128 | + .setDetails(buildShipmentOrderDetailRespVOList(detailList)); | |
| 129 | + return success(respVO); | |
| 130 | + } | |
| 131 | + | |
| 132 | + @GetMapping("/page") | |
| 133 | + @Operation(summary = "获得出库单分页") | |
| 134 | + @PreAuthorize("@ss.hasPermission('wms:shipment-order:query')") | |
| 135 | + public CommonResult<PageResult<WmsShipmentOrderRespVO>> getShipmentOrderPage(@Valid WmsShipmentOrderPageReqVO pageReqVO) { | |
| 136 | + PageResult<WmsShipmentOrderDO> pageResult = shipmentOrderService.getShipmentOrderPage(pageReqVO); | |
| 137 | + return success(new PageResult<>(buildShipmentOrderRespVOList(pageResult.getList()), pageResult.getTotal())); | |
| 138 | + } | |
| 139 | + | |
| 140 | + @GetMapping("/export-excel") | |
| 141 | + @Operation(summary = "导出出库单 Excel") | |
| 142 | + @PreAuthorize("@ss.hasPermission('wms:shipment-order:export')") | |
| 143 | + @ApiAccessLog(operateType = EXPORT) | |
| 144 | + public void exportShipmentOrderExcel(@Valid WmsShipmentOrderPageReqVO pageReqVO, | |
| 145 | + HttpServletResponse response) throws IOException { | |
| 146 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 147 | + List<WmsShipmentOrderDO> list = shipmentOrderService.getShipmentOrderPage(pageReqVO).getList(); | |
| 148 | + ExcelUtils.write(response, "出库单.xls", "数据", WmsShipmentOrderRespVO.class, | |
| 149 | + buildShipmentOrderRespVOList(list)); | |
| 150 | + } | |
| 151 | + | |
| 152 | + // ==================== 拼接 VO ==================== | |
| 153 | + | |
| 154 | + private WmsShipmentOrderRespVO buildShipmentOrderRespVO(WmsShipmentOrderDO order) { | |
| 155 | + if (order == null) { | |
| 156 | + return null; | |
| 157 | + } | |
| 158 | + List<WmsShipmentOrderRespVO> list = buildShipmentOrderRespVOList(Collections.singletonList(order)); | |
| 159 | + return CollUtil.getFirst(list); | |
| 160 | + } | |
| 161 | + | |
| 162 | + private List<WmsShipmentOrderRespVO> buildShipmentOrderRespVOList(List<WmsShipmentOrderDO> list) { | |
| 163 | + if (CollUtil.isEmpty(list)) { | |
| 164 | + return Collections.emptyList(); | |
| 165 | + } | |
| 166 | + // 获取相关的商户、仓库、用户等数据 | |
| 167 | + Map<Long, WmsMerchantDO> merchantMap = merchantService.getMerchantMap(convertSet(list, WmsShipmentOrderDO::getMerchantId)); | |
| 168 | + Map<Long, WmsWarehouseDO> warehouseMap = warehouseService.getWarehouseMap(convertSet(list, WmsShipmentOrderDO::getWarehouseId)); | |
| 169 | + Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertSetByFlatMap(list, | |
| 170 | + order -> Stream.of(parseUserId(order.getCreator()), parseUserId(order.getUpdater())))); | |
| 171 | + // 拼接数据 | |
| 172 | + return BeanUtils.toBean(list, WmsShipmentOrderRespVO.class, vo -> { | |
| 173 | + MapUtils.findAndThen(merchantMap, vo.getMerchantId(), merchant -> vo.setMerchantName(merchant.getName())); | |
| 174 | + MapUtils.findAndThen(warehouseMap, vo.getWarehouseId(), warehouse -> vo.setWarehouseName(warehouse.getName())); | |
| 175 | + MapUtils.findAndThen(userMap, parseUserId(vo.getCreator()), user -> vo.setCreatorName(user.getNickname())); | |
| 176 | + MapUtils.findAndThen(userMap, parseUserId(vo.getUpdater()), user -> vo.setUpdaterName(user.getNickname())); | |
| 177 | + }); | |
| 178 | + } | |
| 179 | + | |
| 180 | + private Long parseUserId(String userId) { | |
| 181 | + return NumberUtil.parseLong(userId, null); | |
| 182 | + } | |
| 183 | + | |
| 184 | + private List<WmsShipmentOrderDetailRespVO> buildShipmentOrderDetailRespVOList(List<WmsShipmentOrderDetailDO> list) { | |
| 185 | + if (CollUtil.isEmpty(list)) { | |
| 186 | + return Collections.emptyList(); | |
| 187 | + } | |
| 188 | + // 获取相关的商品、SKU、仓库等数据 | |
| 189 | + Map<Long, WmsItemSkuDO> skuMap = itemSkuService.getItemSkuMap(convertSet(list, WmsShipmentOrderDetailDO::getSkuId)); | |
| 190 | + Map<Long, WmsItemDO> itemMap = itemService.getItemMap(convertSet(skuMap.values(), WmsItemSkuDO::getItemId)); | |
| 191 | + Map<Long, WmsWarehouseDO> warehouseMap = warehouseService.getWarehouseMap( | |
| 192 | + convertSet(list, WmsShipmentOrderDetailDO::getWarehouseId)); | |
| 193 | + // 拼接数据 | |
| 194 | + return BeanUtils.toBean(list, WmsShipmentOrderDetailRespVO.class, vo -> { | |
| 195 | + MapUtils.findAndThen(skuMap, vo.getSkuId(), sku -> { | |
| 196 | + vo.setSkuCode(sku.getCode()).setSkuName(sku.getName()).setItemId(sku.getItemId()); | |
| 197 | + MapUtils.findAndThen(itemMap, sku.getItemId(), item -> vo.setItemCode(item.getCode()) | |
| 198 | + .setItemName(item.getName()).setUnit(item.getUnit())); | |
| 199 | + }); | |
| 200 | + MapUtils.findAndThen(warehouseMap, vo.getWarehouseId(), warehouse -> vo.setWarehouseName(warehouse.getName())); | |
| 201 | + }); | |
| 202 | + } | |
| 203 | + | |
| 204 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/order/shipment/WmsShipmentOrderDetailController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.order.shipment; | |
| 2 | + | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 5 | +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | |
| 6 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 7 | +import cn.iocoder.yudao.module.wms.controller.admin.order.shipment.vo.detail.WmsShipmentOrderDetailRespVO; | |
| 8 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemDO; | |
| 9 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemSkuDO; | |
| 10 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.warehouse.WmsWarehouseDO; | |
| 11 | +import cn.iocoder.yudao.module.wms.dal.dataobject.order.shipment.WmsShipmentOrderDetailDO; | |
| 12 | +import cn.iocoder.yudao.module.wms.service.md.item.WmsItemService; | |
| 13 | +import cn.iocoder.yudao.module.wms.service.md.item.WmsItemSkuService; | |
| 14 | +import cn.iocoder.yudao.module.wms.service.md.warehouse.WmsWarehouseService; | |
| 15 | +import cn.iocoder.yudao.module.wms.service.order.shipment.WmsShipmentOrderDetailService; | |
| 16 | +import io.swagger.v3.oas.annotations.Operation; | |
| 17 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 18 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 19 | +import jakarta.annotation.Resource; | |
| 20 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 21 | +import org.springframework.validation.annotation.Validated; | |
| 22 | +import org.springframework.web.bind.annotation.GetMapping; | |
| 23 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 24 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 25 | +import org.springframework.web.bind.annotation.RestController; | |
| 26 | + | |
| 27 | +import java.util.Collections; | |
| 28 | +import java.util.List; | |
| 29 | +import java.util.Map; | |
| 30 | + | |
| 31 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 32 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | |
| 33 | + | |
| 34 | +@Tag(name = "管理后台 - WMS 出库单明细") | |
| 35 | +@RestController | |
| 36 | +@RequestMapping("/wms/shipment-order-detail") | |
| 37 | +@Validated | |
| 38 | +public class WmsShipmentOrderDetailController { | |
| 39 | + | |
| 40 | + @Resource | |
| 41 | + private WmsShipmentOrderDetailService shipmentOrderDetailService; | |
| 42 | + @Resource | |
| 43 | + private WmsItemService itemService; | |
| 44 | + @Resource | |
| 45 | + private WmsItemSkuService itemSkuService; | |
| 46 | + @Resource | |
| 47 | + private WmsWarehouseService warehouseService; | |
| 48 | + | |
| 49 | + @GetMapping("/list-by-order-id") | |
| 50 | + @Operation(summary = "获得出库单明细列表") | |
| 51 | + @Parameter(name = "orderId", description = "出库单编号", required = true, example = "1024") | |
| 52 | + @PreAuthorize("@ss.hasPermission('wms:shipment-order:query')") | |
| 53 | + public CommonResult<List<WmsShipmentOrderDetailRespVO>> getShipmentOrderDetailListByOrderId( | |
| 54 | + @RequestParam("orderId") Long orderId) { | |
| 55 | + List<WmsShipmentOrderDetailDO> list = shipmentOrderDetailService.getShipmentOrderDetailList(orderId); | |
| 56 | + return success(buildShipmentOrderDetailRespVOList(list)); | |
| 57 | + } | |
| 58 | + | |
| 59 | + // ==================== 拼接 VO ==================== | |
| 60 | + | |
| 61 | + private List<WmsShipmentOrderDetailRespVO> buildShipmentOrderDetailRespVOList(List<WmsShipmentOrderDetailDO> list) { | |
| 62 | + if (CollUtil.isEmpty(list)) { | |
| 63 | + return Collections.emptyList(); | |
| 64 | + } | |
| 65 | + // 查询关联数据 | |
| 66 | + Map<Long, WmsItemSkuDO> skuMap = itemSkuService.getItemSkuMap(convertSet(list, WmsShipmentOrderDetailDO::getSkuId)); | |
| 67 | + Map<Long, WmsItemDO> itemMap = itemService.getItemMap(convertSet(skuMap.values(), WmsItemSkuDO::getItemId)); | |
| 68 | + Map<Long, WmsWarehouseDO> warehouseMap = warehouseService.getWarehouseMap( | |
| 69 | + convertSet(list, WmsShipmentOrderDetailDO::getWarehouseId)); | |
| 70 | + // 拼接数据 | |
| 71 | + return BeanUtils.toBean(list, WmsShipmentOrderDetailRespVO.class, vo -> { | |
| 72 | + MapUtils.findAndThen(skuMap, vo.getSkuId(), sku -> { | |
| 73 | + vo.setSkuCode(sku.getCode()).setSkuName(sku.getName()).setItemId(sku.getItemId()); | |
| 74 | + MapUtils.findAndThen(itemMap, sku.getItemId(), item -> vo.setItemCode(item.getCode()) | |
| 75 | + .setItemName(item.getName()).setUnit(item.getUnit())); | |
| 76 | + }); | |
| 77 | + MapUtils.findAndThen(warehouseMap, vo.getWarehouseId(), warehouse -> vo.setWarehouseName(warehouse.getName())); | |
| 78 | + }); | |
| 79 | + } | |
| 80 | + | |
| 81 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/order/shipment/vo/detail/WmsShipmentOrderDetailRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.order.shipment.vo.detail; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +import java.math.BigDecimal; | |
| 7 | +import java.time.LocalDateTime; | |
| 8 | + | |
| 9 | +@Schema(description = "管理后台 - WMS 出库单明细 Response VO") | |
| 10 | +@Data | |
| 11 | +public class WmsShipmentOrderDetailRespVO { | |
| 12 | + | |
| 13 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 14 | + private Long id; | |
| 15 | + | |
| 16 | + @Schema(description = "出库单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 17 | + private Long orderId; | |
| 18 | + | |
| 19 | + @Schema(description = "商品编号", example = "2048") | |
| 20 | + private Long itemId; | |
| 21 | + | |
| 22 | + @Schema(description = "商品编号", example = "SPU-APPLE") | |
| 23 | + private String itemCode; | |
| 24 | + | |
| 25 | + @Schema(description = "商品名称", example = "红富士苹果") | |
| 26 | + private String itemName; | |
| 27 | + | |
| 28 | + @Schema(description = "商品单位", example = "箱") | |
| 29 | + private String unit; | |
| 30 | + | |
| 31 | + @Schema(description = "SKU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") | |
| 32 | + private Long skuId; | |
| 33 | + | |
| 34 | + @Schema(description = "规格编号", example = "SKU-APPLE-10KG") | |
| 35 | + private String skuCode; | |
| 36 | + | |
| 37 | + @Schema(description = "规格名称", example = "10kg 箱装") | |
| 38 | + private String skuName; | |
| 39 | + | |
| 40 | + @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 41 | + private Long warehouseId; | |
| 42 | + | |
| 43 | + @Schema(description = "仓库名称", example = "北京仓") | |
| 44 | + private String warehouseName; | |
| 45 | + | |
| 46 | + @Schema(description = "出库数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00") | |
| 47 | + private BigDecimal quantity; | |
| 48 | + | |
| 49 | + @Schema(description = "单价", example = "100.00") | |
| 50 | + private BigDecimal price; | |
| 51 | + | |
| 52 | + @Schema(description = "行金额", example = "1000.00") | |
| 53 | + private BigDecimal totalPrice; | |
| 54 | + | |
| 55 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 56 | + private LocalDateTime createTime; | |
| 57 | + | |
| 58 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/order/shipment/vo/detail/WmsShipmentOrderDetailSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.order.shipment.vo.detail; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import jakarta.validation.constraints.DecimalMin; | |
| 5 | +import jakarta.validation.constraints.NotNull; | |
| 6 | +import lombok.Data; | |
| 7 | + | |
| 8 | +import java.math.BigDecimal; | |
| 9 | + | |
| 10 | +@Schema(description = "管理后台 - WMS 出库单明细保存 Request VO") | |
| 11 | +@Data | |
| 12 | +public class WmsShipmentOrderDetailSaveReqVO { | |
| 13 | + | |
| 14 | + @Schema(description = "编号", example = "1024") | |
| 15 | + private Long id; | |
| 16 | + | |
| 17 | + @Schema(description = "SKU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") | |
| 18 | + @NotNull(message = "SKU 不能为空") | |
| 19 | + private Long skuId; | |
| 20 | + | |
| 21 | + @Schema(description = "出库数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00") | |
| 22 | + @NotNull(message = "出库数量不能为空") | |
| 23 | + @DecimalMin(value = "0", inclusive = false, message = "出库数量必须大于 0") | |
| 24 | + private BigDecimal quantity; | |
| 25 | + | |
| 26 | + @Schema(description = "单价", example = "100.00") | |
| 27 | + @DecimalMin(value = "0", message = "单价不能小于 0") | |
| 28 | + private BigDecimal price; | |
| 29 | + | |
| 30 | + @Schema(description = "行金额", example = "1000.00") | |
| 31 | + @DecimalMin(value = "0", message = "行金额不能小于 0") | |
| 32 | + private BigDecimal totalPrice; | |
| 33 | + | |
| 34 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/order/shipment/vo/order/WmsShipmentOrderPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.order.shipment.vo.order; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | |
| 5 | +import cn.iocoder.yudao.module.wms.enums.order.WmsOrderStatusEnum; | |
| 6 | +import cn.iocoder.yudao.module.wms.enums.order.WmsShipmentOrderTypeEnum; | |
| 7 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 8 | +import lombok.Data; | |
| 9 | +import lombok.EqualsAndHashCode; | |
| 10 | +import lombok.ToString; | |
| 11 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 12 | + | |
| 13 | +import java.math.BigDecimal; | |
| 14 | +import java.time.LocalDateTime; | |
| 15 | + | |
| 16 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 17 | + | |
| 18 | +@Schema(description = "管理后台 - WMS 出库单分页 Request VO") | |
| 19 | +@Data | |
| 20 | +@EqualsAndHashCode(callSuper = true) | |
| 21 | +@ToString(callSuper = true) | |
| 22 | +public class WmsShipmentOrderPageReqVO extends PageParam { | |
| 23 | + | |
| 24 | + @Schema(description = "出库单号", example = "CK202605110001") | |
| 25 | + private String no; | |
| 26 | + | |
| 27 | + @Schema(description = "单据状态", example = "0") | |
| 28 | + @InEnum(WmsOrderStatusEnum.class) | |
| 29 | + private Integer status; | |
| 30 | + | |
| 31 | + @Schema(description = "仓库编号", example = "1024") | |
| 32 | + private Long warehouseId; | |
| 33 | + | |
| 34 | + @Schema(description = "客户编号", example = "1024") | |
| 35 | + private Long merchantId; | |
| 36 | + | |
| 37 | + @Schema(description = "单据日期") | |
| 38 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 39 | + private LocalDateTime[] orderTime; | |
| 40 | + | |
| 41 | + @Schema(description = "最小数量", example = "1.00") | |
| 42 | + private BigDecimal totalQuantityMin; | |
| 43 | + | |
| 44 | + @Schema(description = "最大数量", example = "100.00") | |
| 45 | + private BigDecimal totalQuantityMax; | |
| 46 | + | |
| 47 | + @Schema(description = "最小总金额", example = "1.00") | |
| 48 | + private BigDecimal totalPriceMin; | |
| 49 | + | |
| 50 | + @Schema(description = "最大总金额", example = "1000.00") | |
| 51 | + private BigDecimal totalPriceMax; | |
| 52 | + | |
| 53 | + @Schema(description = "出库类型", example = "201") | |
| 54 | + @InEnum(WmsShipmentOrderTypeEnum.class) | |
| 55 | + private Integer type; | |
| 56 | + | |
| 57 | + @Schema(description = "业务单号", example = "SO202605110001") | |
| 58 | + private String bizOrderNo; | |
| 59 | + | |
| 60 | + @Schema(description = "创建用户", example = "1") | |
| 61 | + private String creator; | |
| 62 | + | |
| 63 | + @Schema(description = "更新用户", example = "1") | |
| 64 | + private String updater; | |
| 65 | + | |
| 66 | + @Schema(description = "创建时间") | |
| 67 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 68 | + private LocalDateTime[] createTime; | |
| 69 | + | |
| 70 | + @Schema(description = "更新时间") | |
| 71 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 72 | + private LocalDateTime[] updateTime; | |
| 73 | + | |
| 74 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/order/shipment/vo/order/WmsShipmentOrderRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.order.shipment.vo.order; | |
| 2 | + | |
| 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; | |
| 4 | +import cn.idev.excel.annotation.ExcelProperty; | |
| 5 | +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | |
| 6 | +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | |
| 7 | +import cn.iocoder.yudao.module.wms.controller.admin.order.shipment.vo.detail.WmsShipmentOrderDetailRespVO; | |
| 8 | +import cn.iocoder.yudao.module.wms.enums.DictTypeConstants; | |
| 9 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 10 | +import lombok.Data; | |
| 11 | + | |
| 12 | +import java.math.BigDecimal; | |
| 13 | +import java.time.LocalDateTime; | |
| 14 | +import java.util.List; | |
| 15 | + | |
| 16 | +@Schema(description = "管理后台 - WMS 出库单 Response VO") | |
| 17 | +@Data | |
| 18 | +@ExcelIgnoreUnannotated | |
| 19 | +public class WmsShipmentOrderRespVO { | |
| 20 | + | |
| 21 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 22 | + private Long id; | |
| 23 | + | |
| 24 | + @Schema(description = "出库单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "CK202605110001") | |
| 25 | + @ExcelProperty("出库单号") | |
| 26 | + private String no; | |
| 27 | + | |
| 28 | + @Schema(description = "出库类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "201") | |
| 29 | + @ExcelProperty(value = "出库类型", converter = DictConvert.class) | |
| 30 | + @DictFormat(DictTypeConstants.SHIPMENT_ORDER_TYPE) | |
| 31 | + private Integer type; | |
| 32 | + | |
| 33 | + @Schema(description = "单据日期", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 34 | + @ExcelProperty("单据日期") | |
| 35 | + private LocalDateTime orderTime; | |
| 36 | + | |
| 37 | + @Schema(description = "出库状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | |
| 38 | + @ExcelProperty(value = "出库状态", converter = DictConvert.class) | |
| 39 | + @DictFormat(DictTypeConstants.ORDER_STATUS) | |
| 40 | + private Integer status; | |
| 41 | + | |
| 42 | + @Schema(description = "业务单号", example = "SO202605110001") | |
| 43 | + @ExcelProperty("业务单号") | |
| 44 | + private String bizOrderNo; | |
| 45 | + | |
| 46 | + @Schema(description = "客户编号", example = "1024") | |
| 47 | + private Long merchantId; | |
| 48 | + | |
| 49 | + @Schema(description = "客户名称", example = "某某公司") | |
| 50 | + @ExcelProperty("客户") | |
| 51 | + private String merchantName; | |
| 52 | + | |
| 53 | + @Schema(description = "备注", example = "备注") | |
| 54 | + private String remark; | |
| 55 | + | |
| 56 | + @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 57 | + private Long warehouseId; | |
| 58 | + | |
| 59 | + @Schema(description = "仓库名称", example = "北京仓") | |
| 60 | + @ExcelProperty("仓库") | |
| 61 | + private String warehouseName; | |
| 62 | + | |
| 63 | + @Schema(description = "出库数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00") | |
| 64 | + @ExcelProperty("出库数量") | |
| 65 | + private BigDecimal totalQuantity; | |
| 66 | + | |
| 67 | + @Schema(description = "总金额", example = "1000.00") | |
| 68 | + @ExcelProperty("总金额") | |
| 69 | + private BigDecimal totalPrice; | |
| 70 | + | |
| 71 | + @Schema(description = "出库明细") | |
| 72 | + private List<WmsShipmentOrderDetailRespVO> details; | |
| 73 | + | |
| 74 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 75 | + @ExcelProperty("创建时间") | |
| 76 | + private LocalDateTime createTime; | |
| 77 | + | |
| 78 | + @Schema(description = "创建者", example = "1") | |
| 79 | + private String creator; | |
| 80 | + @Schema(description = "创建者名称", example = "芋道") | |
| 81 | + private String creatorName; | |
| 82 | + | |
| 83 | + @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 84 | + private LocalDateTime updateTime; | |
| 85 | + | |
| 86 | + @Schema(description = "更新者", example = "1") | |
| 87 | + private String updater; | |
| 88 | + @Schema(description = "更新者名称", example = "芋道") | |
| 89 | + private String updaterName; | |
| 90 | + | |
| 91 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/order/shipment/vo/order/WmsShipmentOrderSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.controller.admin.order.shipment.vo.order; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | |
| 4 | +import cn.iocoder.yudao.module.wms.controller.admin.order.shipment.vo.detail.WmsShipmentOrderDetailSaveReqVO; | |
| 5 | +import cn.iocoder.yudao.module.wms.enums.order.WmsShipmentOrderTypeEnum; | |
| 6 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 7 | +import jakarta.validation.Valid; | |
| 8 | +import jakarta.validation.constraints.NotBlank; | |
| 9 | +import jakarta.validation.constraints.NotNull; | |
| 10 | +import jakarta.validation.constraints.Size; | |
| 11 | +import lombok.Data; | |
| 12 | + | |
| 13 | +import java.time.LocalDateTime; | |
| 14 | +import java.util.List; | |
| 15 | + | |
| 16 | +@Schema(description = "管理后台 - WMS 出库单保存 Request VO") | |
| 17 | +@Data | |
| 18 | +public class WmsShipmentOrderSaveReqVO { | |
| 19 | + | |
| 20 | + @Schema(description = "编号", example = "1024") | |
| 21 | + private Long id; | |
| 22 | + | |
| 23 | + @Schema(description = "出库单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "CK202605110001") | |
| 24 | + @NotBlank(message = "出库单号不能为空") | |
| 25 | + @Size(max = 64, message = "出库单号长度不能超过 64 个字符") | |
| 26 | + private String no; | |
| 27 | + | |
| 28 | + @Schema(description = "出库类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "201") | |
| 29 | + @NotNull(message = "出库类型不能为空") | |
| 30 | + @InEnum(WmsShipmentOrderTypeEnum.class) | |
| 31 | + private Integer type; | |
| 32 | + | |
| 33 | + @Schema(description = "单据日期", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 34 | + @NotNull(message = "单据日期不能为空") | |
| 35 | + private LocalDateTime orderTime; | |
| 36 | + | |
| 37 | + @Schema(description = "业务单号", example = "SO202605110001") | |
| 38 | + @Size(max = 64, message = "业务单号长度不能超过 64 个字符") | |
| 39 | + private String bizOrderNo; | |
| 40 | + | |
| 41 | + @Schema(description = "客户编号", example = "1024") | |
| 42 | + private Long merchantId; | |
| 43 | + | |
| 44 | + @Schema(description = "备注", example = "备注") | |
| 45 | + @Size(max = 255, message = "备注长度不能超过 255 个字符") | |
| 46 | + private String remark; | |
| 47 | + | |
| 48 | + @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 49 | + @NotNull(message = "仓库不能为空") | |
| 50 | + private Long warehouseId; | |
| 51 | + | |
| 52 | + @Schema(description = "出库明细") | |
| 53 | + @Valid | |
| 54 | + private List<WmsShipmentOrderDetailSaveReqVO> details; | |
| 55 | + | |
| 56 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/package-info.java
0 → 100644
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/controller/package-info.java
0 → 100644
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/dal/dataobject/inventory/WmsInventoryDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.dal.dataobject.inventory; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemSkuDO; | |
| 5 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.warehouse.WmsWarehouseDO; | |
| 6 | +import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 7 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 8 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 9 | +import lombok.*; | |
| 10 | + | |
| 11 | +import java.math.BigDecimal; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * WMS 库存 DO | |
| 15 | + * | |
| 16 | + * @author 芋道源码 | |
| 17 | + */ | |
| 18 | +@TableName("wms_inventory") | |
| 19 | +@KeySequence("wms_inventory_seq") | |
| 20 | +@Data | |
| 21 | +@EqualsAndHashCode(callSuper = true) | |
| 22 | +@ToString(callSuper = true) | |
| 23 | +@Builder | |
| 24 | +@NoArgsConstructor | |
| 25 | +@AllArgsConstructor | |
| 26 | +public class WmsInventoryDO extends BaseDO { | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * 主键编号 | |
| 30 | + */ | |
| 31 | + @TableId | |
| 32 | + private Long id; | |
| 33 | + /** | |
| 34 | + * 商品 SKU 编号 | |
| 35 | + * | |
| 36 | + * 关联 {@link WmsItemSkuDO#getId()} | |
| 37 | + */ | |
| 38 | + private Long skuId; | |
| 39 | + /** | |
| 40 | + * 仓库编号 | |
| 41 | + * | |
| 42 | + * 关联 {@link WmsWarehouseDO#getId()} | |
| 43 | + */ | |
| 44 | + private Long warehouseId; | |
| 45 | + /** | |
| 46 | + * 库存数量 | |
| 47 | + */ | |
| 48 | + private BigDecimal quantity; | |
| 49 | + /** | |
| 50 | + * 备注 | |
| 51 | + */ | |
| 52 | + private String remark; | |
| 53 | + | |
| 54 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/dal/dataobject/inventory/WmsInventoryHistoryDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.dal.dataobject.inventory; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemSkuDO; | |
| 5 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.warehouse.WmsWarehouseDO; | |
| 6 | +import cn.iocoder.yudao.module.wms.enums.order.WmsOrderTypeEnum; | |
| 7 | +import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 8 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 9 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 10 | +import lombok.*; | |
| 11 | + | |
| 12 | +import java.math.BigDecimal; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * WMS 库存流水 DO | |
| 16 | + * | |
| 17 | + * @author 芋道源码 | |
| 18 | + */ | |
| 19 | +@TableName("wms_inventory_history") | |
| 20 | +@KeySequence("wms_inventory_history_seq") | |
| 21 | +@Data | |
| 22 | +@EqualsAndHashCode(callSuper = true) | |
| 23 | +@ToString(callSuper = true) | |
| 24 | +@Builder | |
| 25 | +@NoArgsConstructor | |
| 26 | +@AllArgsConstructor | |
| 27 | +public class WmsInventoryHistoryDO extends BaseDO { | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * 主键编号 | |
| 31 | + */ | |
| 32 | + @TableId | |
| 33 | + private Long id; | |
| 34 | + | |
| 35 | + // ========= 库存维度相关字段 ========= | |
| 36 | + | |
| 37 | + /** | |
| 38 | + * 仓库编号 | |
| 39 | + * | |
| 40 | + * 关联 {@link WmsWarehouseDO#getId()} | |
| 41 | + */ | |
| 42 | + private Long warehouseId; | |
| 43 | + /** | |
| 44 | + * 商品 SKU 编号 | |
| 45 | + * | |
| 46 | + * 关联 {@link WmsItemSkuDO#getId()} | |
| 47 | + */ | |
| 48 | + private Long skuId; | |
| 49 | + /** | |
| 50 | + * 库存变化数量 | |
| 51 | + */ | |
| 52 | + private BigDecimal quantity; | |
| 53 | + /** | |
| 54 | + * 变化前库存数量 | |
| 55 | + */ | |
| 56 | + private BigDecimal beforeQuantity; | |
| 57 | + /** | |
| 58 | + * 变化后库存数量 | |
| 59 | + */ | |
| 60 | + private BigDecimal afterQuantity; | |
| 61 | + | |
| 62 | + // ========= 单价备注相关字段 ========= | |
| 63 | + | |
| 64 | + /** | |
| 65 | + * 单价 | |
| 66 | + */ | |
| 67 | + private BigDecimal price; | |
| 68 | + /** | |
| 69 | + * 库存变化金额 | |
| 70 | + */ | |
| 71 | + private BigDecimal totalPrice; | |
| 72 | + /** | |
| 73 | + * 备注 | |
| 74 | + */ | |
| 75 | + private String remark; | |
| 76 | + | |
| 77 | + // ========= 来源单据相关字段 ========= | |
| 78 | + | |
| 79 | + /** | |
| 80 | + * 单据编号 | |
| 81 | + */ | |
| 82 | + private Long orderId; | |
| 83 | + /** | |
| 84 | + * 单据号 | |
| 85 | + */ | |
| 86 | + private String orderNo; | |
| 87 | + /** | |
| 88 | + * 单据类型 | |
| 89 | + * | |
| 90 | + * 枚举 {@link WmsOrderTypeEnum#getType()} | |
| 91 | + */ | |
| 92 | + private Integer orderType; | |
| 93 | + | |
| 94 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/dal/dataobject/md/item/WmsItemBrandDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.dal.dataobject.md.item; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | +import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 5 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 6 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 7 | +import lombok.*; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * WMS 商品品牌 DO | |
| 11 | + * | |
| 12 | + * @author 芋道源码 | |
| 13 | + */ | |
| 14 | +@TableName("wms_item_brand") | |
| 15 | +@KeySequence("wms_item_brand_seq") | |
| 16 | +@Data | |
| 17 | +@EqualsAndHashCode(callSuper = true) | |
| 18 | +@ToString(callSuper = true) | |
| 19 | +@Builder | |
| 20 | +@NoArgsConstructor | |
| 21 | +@AllArgsConstructor | |
| 22 | +public class WmsItemBrandDO extends BaseDO { | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * 主键编号 | |
| 26 | + */ | |
| 27 | + @TableId | |
| 28 | + private Long id; | |
| 29 | + /** | |
| 30 | + * 品牌编号 | |
| 31 | + */ | |
| 32 | + private String code; | |
| 33 | + /** | |
| 34 | + * 品牌名称 | |
| 35 | + */ | |
| 36 | + private String name; | |
| 37 | + | |
| 38 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/dal/dataobject/md/item/WmsItemCategoryDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.dal.dataobject.md.item; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 5 | +import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 6 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 7 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 8 | +import lombok.*; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * WMS 商品分类 DO | |
| 12 | + * | |
| 13 | + * @author 芋道源码 | |
| 14 | + */ | |
| 15 | +@TableName("wms_item_category") | |
| 16 | +@KeySequence("wms_item_category_seq") | |
| 17 | +@Data | |
| 18 | +@EqualsAndHashCode(callSuper = true) | |
| 19 | +@ToString(callSuper = true) | |
| 20 | +@Builder | |
| 21 | +@NoArgsConstructor | |
| 22 | +@AllArgsConstructor | |
| 23 | +public class WmsItemCategoryDO extends BaseDO { | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 父级编号 - 根节点 | |
| 27 | + */ | |
| 28 | + public static final Long PARENT_ID_ROOT = 0L; | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * 主键编号 | |
| 32 | + */ | |
| 33 | + @TableId | |
| 34 | + private Long id; | |
| 35 | + /** | |
| 36 | + * 父级编号 | |
| 37 | + * | |
| 38 | + * 关联 {@link #id} | |
| 39 | + */ | |
| 40 | + private Long parentId; | |
| 41 | + /** | |
| 42 | + * 分类编号 | |
| 43 | + */ | |
| 44 | + private String code; | |
| 45 | + /** | |
| 46 | + * 分类名称 | |
| 47 | + */ | |
| 48 | + private String name; | |
| 49 | + /** | |
| 50 | + * 排序 | |
| 51 | + */ | |
| 52 | + private Integer sort; | |
| 53 | + /** | |
| 54 | + * 状态 | |
| 55 | + * | |
| 56 | + * 枚举 {@link CommonStatusEnum} | |
| 57 | + */ | |
| 58 | + private Integer status; | |
| 59 | + | |
| 60 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/dal/dataobject/md/item/WmsItemDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.dal.dataobject.md.item; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | +import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 5 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 6 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 7 | +import lombok.*; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * WMS 商品 DO | |
| 11 | + * | |
| 12 | + * @author 芋道源码 | |
| 13 | + */ | |
| 14 | +@TableName("wms_item") | |
| 15 | +@KeySequence("wms_item_seq") | |
| 16 | +@Data | |
| 17 | +@EqualsAndHashCode(callSuper = true) | |
| 18 | +@ToString(callSuper = true) | |
| 19 | +@Builder | |
| 20 | +@NoArgsConstructor | |
| 21 | +@AllArgsConstructor | |
| 22 | +public class WmsItemDO extends BaseDO { | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * 主键编号 | |
| 26 | + */ | |
| 27 | + @TableId | |
| 28 | + private Long id; | |
| 29 | + /** | |
| 30 | + * 商品编号 | |
| 31 | + */ | |
| 32 | + private String code; | |
| 33 | + /** | |
| 34 | + * 商品名称 | |
| 35 | + */ | |
| 36 | + private String name; | |
| 37 | + /** | |
| 38 | + * 单位 | |
| 39 | + */ | |
| 40 | + private String unit; | |
| 41 | + /** | |
| 42 | + * 商品分类编号 | |
| 43 | + * | |
| 44 | + * 关联 {@link WmsItemCategoryDO#getId()} | |
| 45 | + */ | |
| 46 | + private Long categoryId; | |
| 47 | + /** | |
| 48 | + * 商品品牌编号 | |
| 49 | + * | |
| 50 | + * 关联 {@link WmsItemBrandDO#getId()} | |
| 51 | + */ | |
| 52 | + private Long brandId; | |
| 53 | + /** | |
| 54 | + * 备注 | |
| 55 | + */ | |
| 56 | + private String remark; | |
| 57 | + | |
| 58 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/dal/dataobject/md/item/WmsItemSkuDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.dal.dataobject.md.item; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | +import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 5 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 6 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 7 | +import lombok.*; | |
| 8 | + | |
| 9 | +import java.math.BigDecimal; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * WMS 商品 SKU DO | |
| 13 | + * | |
| 14 | + * @author 芋道源码 | |
| 15 | + */ | |
| 16 | +@TableName("wms_item_sku") | |
| 17 | +@KeySequence("wms_item_sku_seq") | |
| 18 | +@Data | |
| 19 | +@EqualsAndHashCode(callSuper = true) | |
| 20 | +@ToString(callSuper = true) | |
| 21 | +@Builder | |
| 22 | +@NoArgsConstructor | |
| 23 | +@AllArgsConstructor | |
| 24 | +public class WmsItemSkuDO extends BaseDO { | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * 主键编号 | |
| 28 | + */ | |
| 29 | + @TableId | |
| 30 | + private Long id; | |
| 31 | + /** | |
| 32 | + * 规格名称 | |
| 33 | + */ | |
| 34 | + private String name; | |
| 35 | + /** | |
| 36 | + * 商品编号 | |
| 37 | + * | |
| 38 | + * 关联 {@link WmsItemDO#getId()} | |
| 39 | + */ | |
| 40 | + private Long itemId; | |
| 41 | + /** | |
| 42 | + * 条码 | |
| 43 | + */ | |
| 44 | + private String barCode; | |
| 45 | + /** | |
| 46 | + * 规格编号 | |
| 47 | + */ | |
| 48 | + private String code; | |
| 49 | + | |
| 50 | + /** | |
| 51 | + * 长,单位 cm | |
| 52 | + */ | |
| 53 | + private BigDecimal length; | |
| 54 | + /** | |
| 55 | + * 宽,单位 cm | |
| 56 | + */ | |
| 57 | + private BigDecimal width; | |
| 58 | + /** | |
| 59 | + * 高,单位 cm | |
| 60 | + */ | |
| 61 | + private BigDecimal height; | |
| 62 | + | |
| 63 | + /** | |
| 64 | + * 毛重,单位 kg | |
| 65 | + */ | |
| 66 | + private BigDecimal grossWeight; | |
| 67 | + /** | |
| 68 | + * 净重,单位 kg | |
| 69 | + */ | |
| 70 | + private BigDecimal netWeight; | |
| 71 | + | |
| 72 | + /** | |
| 73 | + * 成本价,单位元 | |
| 74 | + */ | |
| 75 | + private BigDecimal costPrice; | |
| 76 | + /** | |
| 77 | + * 销售价,单位元 | |
| 78 | + */ | |
| 79 | + private BigDecimal sellingPrice; | |
| 80 | + | |
| 81 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/dal/dataobject/md/merchant/WmsMerchantDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.dal.dataobject.md.merchant; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | +import cn.iocoder.yudao.module.wms.enums.md.WmsMerchantTypeEnum; | |
| 5 | +import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 6 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 7 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 8 | +import lombok.*; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * WMS 往来企业 DO | |
| 12 | + * | |
| 13 | + * @author 芋道源码 | |
| 14 | + */ | |
| 15 | +@TableName("wms_merchant") | |
| 16 | +@KeySequence("wms_merchant_seq") | |
| 17 | +@Data | |
| 18 | +@EqualsAndHashCode(callSuper = true) | |
| 19 | +@ToString(callSuper = true) | |
| 20 | +@Builder | |
| 21 | +@NoArgsConstructor | |
| 22 | +@AllArgsConstructor | |
| 23 | +public class WmsMerchantDO extends BaseDO { | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 主键编号 | |
| 27 | + */ | |
| 28 | + @TableId | |
| 29 | + private Long id; | |
| 30 | + /** | |
| 31 | + * 往来企业编号 | |
| 32 | + */ | |
| 33 | + private String code; | |
| 34 | + /** | |
| 35 | + * 往来企业名称 | |
| 36 | + */ | |
| 37 | + private String name; | |
| 38 | + /** | |
| 39 | + * 往来企业类型 | |
| 40 | + * | |
| 41 | + * 枚举 {@link WmsMerchantTypeEnum} | |
| 42 | + */ | |
| 43 | + private Integer type; | |
| 44 | + /** | |
| 45 | + * 级别 | |
| 46 | + */ | |
| 47 | + private String level; | |
| 48 | + /** | |
| 49 | + * 开户行 | |
| 50 | + */ | |
| 51 | + private String bankName; | |
| 52 | + /** | |
| 53 | + * 银行账户 | |
| 54 | + */ | |
| 55 | + private String bankAccount; | |
| 56 | + /** | |
| 57 | + * 地址 | |
| 58 | + */ | |
| 59 | + private String address; | |
| 60 | + /** | |
| 61 | + * 手机号 | |
| 62 | + */ | |
| 63 | + private String mobile; | |
| 64 | + /** | |
| 65 | + * 座机号 | |
| 66 | + */ | |
| 67 | + private String telephone; | |
| 68 | + /** | |
| 69 | + * 联系人 | |
| 70 | + */ | |
| 71 | + private String contact; | |
| 72 | + /** | |
| 73 | ||
| 74 | + */ | |
| 75 | + private String email; | |
| 76 | + /** | |
| 77 | + * 备注 | |
| 78 | + */ | |
| 79 | + private String remark; | |
| 80 | + | |
| 81 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/dal/dataobject/md/warehouse/WmsWarehouseDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.dal.dataobject.md.warehouse; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | +import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 5 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 6 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 7 | +import lombok.*; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * WMS 仓库 DO | |
| 11 | + * | |
| 12 | + * @author 芋道源码 | |
| 13 | + */ | |
| 14 | +@TableName("wms_warehouse") | |
| 15 | +@KeySequence("wms_warehouse_seq") | |
| 16 | +@Data | |
| 17 | +@EqualsAndHashCode(callSuper = true) | |
| 18 | +@ToString(callSuper = true) | |
| 19 | +@Builder | |
| 20 | +@NoArgsConstructor | |
| 21 | +@AllArgsConstructor | |
| 22 | +public class WmsWarehouseDO extends BaseDO { | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * 主键编号 | |
| 26 | + */ | |
| 27 | + @TableId | |
| 28 | + private Long id; | |
| 29 | + /** | |
| 30 | + * 仓库编号 | |
| 31 | + */ | |
| 32 | + private String code; | |
| 33 | + /** | |
| 34 | + * 名称 | |
| 35 | + */ | |
| 36 | + private String name; | |
| 37 | + /** | |
| 38 | + * 备注 | |
| 39 | + */ | |
| 40 | + private String remark; | |
| 41 | + /** | |
| 42 | + * 排序 | |
| 43 | + */ | |
| 44 | + private Integer sort; | |
| 45 | + | |
| 46 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/dal/dataobject/order/check/WmsCheckOrderDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.dal.dataobject.order.check; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.warehouse.WmsWarehouseDO; | |
| 5 | +import cn.iocoder.yudao.module.wms.enums.DictTypeConstants; | |
| 6 | +import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 7 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 8 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 9 | +import lombok.*; | |
| 10 | + | |
| 11 | +import java.math.BigDecimal; | |
| 12 | +import java.time.LocalDateTime; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * WMS 盘库单 DO | |
| 16 | + * | |
| 17 | + * @author 芋道源码 | |
| 18 | + */ | |
| 19 | +@TableName("wms_check_order") | |
| 20 | +@KeySequence("wms_check_order_seq") | |
| 21 | +@Data | |
| 22 | +@EqualsAndHashCode(callSuper = true) | |
| 23 | +@ToString(callSuper = true) | |
| 24 | +@Builder | |
| 25 | +@NoArgsConstructor | |
| 26 | +@AllArgsConstructor | |
| 27 | +public class WmsCheckOrderDO extends BaseDO { | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * 主键编号 | |
| 31 | + */ | |
| 32 | + @TableId | |
| 33 | + private Long id; | |
| 34 | + /** | |
| 35 | + * 盘库单号 | |
| 36 | + */ | |
| 37 | + private String no; | |
| 38 | + /** | |
| 39 | + * 单据日期 | |
| 40 | + */ | |
| 41 | + private LocalDateTime orderTime; | |
| 42 | + /** | |
| 43 | + * 盘库状态 | |
| 44 | + * | |
| 45 | + * 字典 {@link DictTypeConstants#ORDER_STATUS} | |
| 46 | + */ | |
| 47 | + private Integer status; | |
| 48 | + /** | |
| 49 | + * 备注 | |
| 50 | + */ | |
| 51 | + private String remark; | |
| 52 | + | |
| 53 | + // ========= 仓库字段 ========= | |
| 54 | + | |
| 55 | + /** | |
| 56 | + * 仓库编号 | |
| 57 | + * | |
| 58 | + * 关联 {@link WmsWarehouseDO#getId()} | |
| 59 | + */ | |
| 60 | + private Long warehouseId; | |
| 61 | + | |
| 62 | + // ========= 汇总金额字段 ========= | |
| 63 | + | |
| 64 | + /** | |
| 65 | + * 盈亏数量(实盘数量 - 账面数量) | |
| 66 | + */ | |
| 67 | + private BigDecimal totalQuantity; | |
| 68 | + /** | |
| 69 | + * 总金额(账面数量 * 单价) | |
| 70 | + */ | |
| 71 | + private BigDecimal totalPrice; | |
| 72 | + /** | |
| 73 | + * 实际金额(实盘数量 * 单价) | |
| 74 | + */ | |
| 75 | + private BigDecimal actualPrice; | |
| 76 | + | |
| 77 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/dal/dataobject/order/check/WmsCheckOrderDetailDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.dal.dataobject.order.check; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | +import cn.iocoder.yudao.module.wms.dal.dataobject.inventory.WmsInventoryDO; | |
| 5 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemSkuDO; | |
| 6 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.warehouse.WmsWarehouseDO; | |
| 7 | +import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 8 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 9 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 10 | +import lombok.*; | |
| 11 | + | |
| 12 | +import java.math.BigDecimal; | |
| 13 | +import java.time.LocalDateTime; | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * WMS 盘库单明细 DO | |
| 17 | + * | |
| 18 | + * @author 芋道源码 | |
| 19 | + */ | |
| 20 | +@TableName("wms_check_order_detail") | |
| 21 | +@KeySequence("wms_check_order_detail_seq") | |
| 22 | +@Data | |
| 23 | +@EqualsAndHashCode(callSuper = true) | |
| 24 | +@ToString(callSuper = true) | |
| 25 | +@Builder | |
| 26 | +@NoArgsConstructor | |
| 27 | +@AllArgsConstructor | |
| 28 | +public class WmsCheckOrderDetailDO extends BaseDO { | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * 主键编号 | |
| 32 | + */ | |
| 33 | + @TableId | |
| 34 | + private Long id; | |
| 35 | + // ========= 单据商品字段 ========= | |
| 36 | + | |
| 37 | + /** | |
| 38 | + * 盘库单编号 | |
| 39 | + * | |
| 40 | + * 关联 {@link WmsCheckOrderDO#getId()} | |
| 41 | + */ | |
| 42 | + private Long orderId; | |
| 43 | + /** | |
| 44 | + * 商品 SKU 编号 | |
| 45 | + * | |
| 46 | + * 关联 {@link WmsItemSkuDO#getId()} | |
| 47 | + */ | |
| 48 | + private Long skuId; | |
| 49 | + | |
| 50 | + // ========= 仓库字段 ========= | |
| 51 | + | |
| 52 | + /** | |
| 53 | + * 仓库编号 | |
| 54 | + * | |
| 55 | + * 关联 {@link WmsWarehouseDO#getId()} | |
| 56 | + */ | |
| 57 | + private Long warehouseId; | |
| 58 | + /** | |
| 59 | + * 库存编号 | |
| 60 | + * | |
| 61 | + * 关联 {@link WmsInventoryDO#getId()} | |
| 62 | + */ | |
| 63 | + private Long inventoryId; | |
| 64 | + | |
| 65 | + /** | |
| 66 | + * 入库时间 | |
| 67 | + */ | |
| 68 | + private LocalDateTime receiptTime; | |
| 69 | + | |
| 70 | + // ========= 数量金额字段 ========= | |
| 71 | + | |
| 72 | + /** | |
| 73 | + * 账面数量 | |
| 74 | + */ | |
| 75 | + private BigDecimal quantity; | |
| 76 | + /** | |
| 77 | + * 实盘数量 | |
| 78 | + */ | |
| 79 | + private BigDecimal checkQuantity; | |
| 80 | + /** | |
| 81 | + * 单价 | |
| 82 | + */ | |
| 83 | + private BigDecimal price; | |
| 84 | + | |
| 85 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/dal/dataobject/order/movement/WmsMovementOrderDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.dal.dataobject.order.movement; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.warehouse.WmsWarehouseDO; | |
| 5 | +import cn.iocoder.yudao.module.wms.enums.DictTypeConstants; | |
| 6 | +import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 7 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 8 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 9 | +import lombok.*; | |
| 10 | + | |
| 11 | +import java.math.BigDecimal; | |
| 12 | +import java.time.LocalDateTime; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * WMS 移库单 DO | |
| 16 | + * | |
| 17 | + * @author 芋道源码 | |
| 18 | + */ | |
| 19 | +@TableName("wms_movement_order") | |
| 20 | +@KeySequence("wms_movement_order_seq") | |
| 21 | +@Data | |
| 22 | +@EqualsAndHashCode(callSuper = true) | |
| 23 | +@ToString(callSuper = true) | |
| 24 | +@Builder | |
| 25 | +@NoArgsConstructor | |
| 26 | +@AllArgsConstructor | |
| 27 | +public class WmsMovementOrderDO extends BaseDO { | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * 主键编号 | |
| 31 | + */ | |
| 32 | + @TableId | |
| 33 | + private Long id; | |
| 34 | + /** | |
| 35 | + * 移库单号 | |
| 36 | + */ | |
| 37 | + private String no; | |
| 38 | + /** | |
| 39 | + * 单据日期 | |
| 40 | + */ | |
| 41 | + private LocalDateTime orderTime; | |
| 42 | + /** | |
| 43 | + * 移库状态 | |
| 44 | + * | |
| 45 | + * 字典 {@link DictTypeConstants#ORDER_STATUS} | |
| 46 | + */ | |
| 47 | + private Integer status; | |
| 48 | + /** | |
| 49 | + * 备注 | |
| 50 | + */ | |
| 51 | + private String remark; | |
| 52 | + | |
| 53 | + // ========= 来源仓库字段 ========= | |
| 54 | + | |
| 55 | + /** | |
| 56 | + * 来源仓库编号 | |
| 57 | + * | |
| 58 | + * 关联 {@link WmsWarehouseDO#getId()} | |
| 59 | + */ | |
| 60 | + private Long sourceWarehouseId; | |
| 61 | + | |
| 62 | + // ========= 目标仓库字段 ========= | |
| 63 | + | |
| 64 | + /** | |
| 65 | + * 目标仓库编号 | |
| 66 | + * | |
| 67 | + * 关联 {@link WmsWarehouseDO#getId()} | |
| 68 | + */ | |
| 69 | + private Long targetWarehouseId; | |
| 70 | + | |
| 71 | + // ========= 汇总金额字段 ========= | |
| 72 | + | |
| 73 | + /** | |
| 74 | + * 总数量 | |
| 75 | + */ | |
| 76 | + private BigDecimal totalQuantity; | |
| 77 | + /** | |
| 78 | + * 总金额 | |
| 79 | + */ | |
| 80 | + private BigDecimal totalPrice; | |
| 81 | + | |
| 82 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/dal/dataobject/order/movement/WmsMovementOrderDetailDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.dal.dataobject.order.movement; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemSkuDO; | |
| 5 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.warehouse.WmsWarehouseDO; | |
| 6 | +import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 7 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 8 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 9 | +import lombok.*; | |
| 10 | + | |
| 11 | +import java.math.BigDecimal; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * WMS 移库单明细 DO | |
| 15 | + * | |
| 16 | + * @author 芋道源码 | |
| 17 | + */ | |
| 18 | +@TableName("wms_movement_order_detail") | |
| 19 | +@KeySequence("wms_movement_order_detail_seq") | |
| 20 | +@Data | |
| 21 | +@EqualsAndHashCode(callSuper = true) | |
| 22 | +@ToString(callSuper = true) | |
| 23 | +@Builder | |
| 24 | +@NoArgsConstructor | |
| 25 | +@AllArgsConstructor | |
| 26 | +public class WmsMovementOrderDetailDO extends BaseDO { | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * 主键编号 | |
| 30 | + */ | |
| 31 | + @TableId | |
| 32 | + private Long id; | |
| 33 | + // ========= 单据商品字段 ========= | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * 移库单编号 | |
| 37 | + * | |
| 38 | + * 关联 {@link WmsMovementOrderDO#getId()} | |
| 39 | + */ | |
| 40 | + private Long orderId; | |
| 41 | + /** | |
| 42 | + * 商品 SKU 编号 | |
| 43 | + * | |
| 44 | + * 关联 {@link WmsItemSkuDO#getId()} | |
| 45 | + */ | |
| 46 | + private Long skuId; | |
| 47 | + | |
| 48 | + // ========= 来源仓库字段 ========= | |
| 49 | + | |
| 50 | + /** | |
| 51 | + * 来源仓库编号 | |
| 52 | + * | |
| 53 | + * 关联 {@link WmsWarehouseDO#getId()} | |
| 54 | + */ | |
| 55 | + private Long sourceWarehouseId; | |
| 56 | + | |
| 57 | + // ========= 目标仓库字段 ========= | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * 目标仓库编号 | |
| 61 | + * | |
| 62 | + * 关联 {@link WmsWarehouseDO#getId()} | |
| 63 | + */ | |
| 64 | + private Long targetWarehouseId; | |
| 65 | + | |
| 66 | + // ========= 数量金额字段 ========= | |
| 67 | + | |
| 68 | + /** | |
| 69 | + * 移库数量 | |
| 70 | + */ | |
| 71 | + private BigDecimal quantity; | |
| 72 | + /** | |
| 73 | + * 单价 | |
| 74 | + */ | |
| 75 | + private BigDecimal price; | |
| 76 | + /** | |
| 77 | + * 行金额(数量 * 单价) | |
| 78 | + */ | |
| 79 | + private BigDecimal totalPrice; | |
| 80 | + | |
| 81 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/dal/dataobject/order/receipt/WmsReceiptOrderDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.dal.dataobject.order.receipt; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.merchant.WmsMerchantDO; | |
| 5 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.warehouse.WmsWarehouseDO; | |
| 6 | +import cn.iocoder.yudao.module.wms.enums.DictTypeConstants; | |
| 7 | +import cn.iocoder.yudao.module.wms.enums.order.WmsReceiptOrderTypeEnum; | |
| 8 | +import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 9 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 10 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 11 | +import lombok.*; | |
| 12 | + | |
| 13 | +import java.math.BigDecimal; | |
| 14 | +import java.time.LocalDateTime; | |
| 15 | + | |
| 16 | +/** | |
| 17 | + * WMS 入库单 DO | |
| 18 | + * | |
| 19 | + * @author 芋道源码 | |
| 20 | + */ | |
| 21 | +@TableName("wms_receipt_order") | |
| 22 | +@KeySequence("wms_receipt_order_seq") | |
| 23 | +@Data | |
| 24 | +@EqualsAndHashCode(callSuper = true) | |
| 25 | +@ToString(callSuper = true) | |
| 26 | +@Builder | |
| 27 | +@NoArgsConstructor | |
| 28 | +@AllArgsConstructor | |
| 29 | +public class WmsReceiptOrderDO extends BaseDO { | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * 主键编号 | |
| 33 | + */ | |
| 34 | + @TableId | |
| 35 | + private Long id; | |
| 36 | + /** | |
| 37 | + * 入库单号 | |
| 38 | + */ | |
| 39 | + private String no; | |
| 40 | + /** | |
| 41 | + * 入库类型 | |
| 42 | + * | |
| 43 | + * 枚举 {@link WmsReceiptOrderTypeEnum} | |
| 44 | + * 字典 {@link DictTypeConstants#RECEIPT_ORDER_TYPE} | |
| 45 | + */ | |
| 46 | + private Integer type; | |
| 47 | + /** | |
| 48 | + * 单据日期 | |
| 49 | + */ | |
| 50 | + private LocalDateTime orderTime; | |
| 51 | + /** | |
| 52 | + * 入库状态 | |
| 53 | + * | |
| 54 | + * 字典 {@link DictTypeConstants#ORDER_STATUS} | |
| 55 | + */ | |
| 56 | + private Integer status; | |
| 57 | + /** | |
| 58 | + * 业务订单号 | |
| 59 | + */ | |
| 60 | + private String bizOrderNo; | |
| 61 | + /** | |
| 62 | + * 供应商编号 | |
| 63 | + * | |
| 64 | + * 关联 {@link WmsMerchantDO#getId()} | |
| 65 | + */ | |
| 66 | + private Long merchantId; | |
| 67 | + /** | |
| 68 | + * 备注 | |
| 69 | + */ | |
| 70 | + private String remark; | |
| 71 | + | |
| 72 | + // ========= 仓库字段 ========= | |
| 73 | + | |
| 74 | + /** | |
| 75 | + * 仓库编号 | |
| 76 | + * | |
| 77 | + * 关联 {@link WmsWarehouseDO#getId()} | |
| 78 | + */ | |
| 79 | + private Long warehouseId; | |
| 80 | + | |
| 81 | + // ========= 汇总金额字段 ========= | |
| 82 | + | |
| 83 | + /** | |
| 84 | + * 总数量 | |
| 85 | + */ | |
| 86 | + private BigDecimal totalQuantity; | |
| 87 | + /** | |
| 88 | + * 总金额 | |
| 89 | + */ | |
| 90 | + private BigDecimal totalPrice; | |
| 91 | + | |
| 92 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/dal/dataobject/order/receipt/WmsReceiptOrderDetailDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.dal.dataobject.order.receipt; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemSkuDO; | |
| 5 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.warehouse.WmsWarehouseDO; | |
| 6 | +import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 7 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 8 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 9 | +import lombok.*; | |
| 10 | + | |
| 11 | +import java.math.BigDecimal; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * WMS 入库单明细 DO | |
| 15 | + * | |
| 16 | + * @author 芋道源码 | |
| 17 | + */ | |
| 18 | +@TableName("wms_receipt_order_detail") | |
| 19 | +@KeySequence("wms_receipt_order_detail_seq") | |
| 20 | +@Data | |
| 21 | +@EqualsAndHashCode(callSuper = true) | |
| 22 | +@ToString(callSuper = true) | |
| 23 | +@Builder | |
| 24 | +@NoArgsConstructor | |
| 25 | +@AllArgsConstructor | |
| 26 | +public class WmsReceiptOrderDetailDO extends BaseDO { | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * 主键编号 | |
| 30 | + */ | |
| 31 | + @TableId | |
| 32 | + private Long id; | |
| 33 | + // ========= 单据商品字段 ========= | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * 入库单编号 | |
| 37 | + * | |
| 38 | + * 关联 {@link WmsReceiptOrderDO#getId()} | |
| 39 | + */ | |
| 40 | + private Long orderId; | |
| 41 | + /** | |
| 42 | + * 商品 SKU 编号 | |
| 43 | + * | |
| 44 | + * 关联 {@link WmsItemSkuDO#getId()} | |
| 45 | + */ | |
| 46 | + private Long skuId; | |
| 47 | + | |
| 48 | + // ========= 仓库字段 ========= | |
| 49 | + | |
| 50 | + /** | |
| 51 | + * 仓库编号 | |
| 52 | + * | |
| 53 | + * 关联 {@link WmsWarehouseDO#getId()} | |
| 54 | + */ | |
| 55 | + private Long warehouseId; | |
| 56 | + | |
| 57 | + // ========= 数量金额字段 ========= | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * 入库数量 | |
| 61 | + */ | |
| 62 | + private BigDecimal quantity; | |
| 63 | + /** | |
| 64 | + * 单价 | |
| 65 | + */ | |
| 66 | + private BigDecimal price; | |
| 67 | + /** | |
| 68 | + * 行金额(数量 * 单价) | |
| 69 | + */ | |
| 70 | + private BigDecimal totalPrice; | |
| 71 | + | |
| 72 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/dal/dataobject/order/shipment/WmsShipmentOrderDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.dal.dataobject.order.shipment; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.merchant.WmsMerchantDO; | |
| 5 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.warehouse.WmsWarehouseDO; | |
| 6 | +import cn.iocoder.yudao.module.wms.enums.DictTypeConstants; | |
| 7 | +import cn.iocoder.yudao.module.wms.enums.order.WmsShipmentOrderTypeEnum; | |
| 8 | +import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 9 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 10 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 11 | +import lombok.*; | |
| 12 | + | |
| 13 | +import java.math.BigDecimal; | |
| 14 | +import java.time.LocalDateTime; | |
| 15 | + | |
| 16 | +/** | |
| 17 | + * WMS 出库单 DO | |
| 18 | + * | |
| 19 | + * @author 芋道源码 | |
| 20 | + */ | |
| 21 | +@TableName("wms_shipment_order") | |
| 22 | +@KeySequence("wms_shipment_order_seq") | |
| 23 | +@Data | |
| 24 | +@EqualsAndHashCode(callSuper = true) | |
| 25 | +@ToString(callSuper = true) | |
| 26 | +@Builder | |
| 27 | +@NoArgsConstructor | |
| 28 | +@AllArgsConstructor | |
| 29 | +public class WmsShipmentOrderDO extends BaseDO { | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * 主键编号 | |
| 33 | + */ | |
| 34 | + @TableId | |
| 35 | + private Long id; | |
| 36 | + /** | |
| 37 | + * 出库单号 | |
| 38 | + */ | |
| 39 | + private String no; | |
| 40 | + /** | |
| 41 | + * 出库类型 | |
| 42 | + * | |
| 43 | + * 枚举 {@link WmsShipmentOrderTypeEnum} | |
| 44 | + * 字典 {@link DictTypeConstants#SHIPMENT_ORDER_TYPE} | |
| 45 | + */ | |
| 46 | + private Integer type; | |
| 47 | + /** | |
| 48 | + * 单据日期 | |
| 49 | + */ | |
| 50 | + private LocalDateTime orderTime; | |
| 51 | + /** | |
| 52 | + * 出库状态 | |
| 53 | + * | |
| 54 | + * 字典 {@link DictTypeConstants#ORDER_STATUS} | |
| 55 | + */ | |
| 56 | + private Integer status; | |
| 57 | + /** | |
| 58 | + * 业务订单号 | |
| 59 | + */ | |
| 60 | + private String bizOrderNo; | |
| 61 | + /** | |
| 62 | + * 客户编号 | |
| 63 | + * | |
| 64 | + * 关联 {@link WmsMerchantDO#getId()} | |
| 65 | + */ | |
| 66 | + private Long merchantId; | |
| 67 | + /** | |
| 68 | + * 备注 | |
| 69 | + */ | |
| 70 | + private String remark; | |
| 71 | + | |
| 72 | + // ========= 仓库字段 ========= | |
| 73 | + | |
| 74 | + /** | |
| 75 | + * 仓库编号 | |
| 76 | + * | |
| 77 | + * 关联 {@link WmsWarehouseDO#getId()} | |
| 78 | + */ | |
| 79 | + private Long warehouseId; | |
| 80 | + | |
| 81 | + // ========= 汇总金额字段 ========= | |
| 82 | + | |
| 83 | + /** | |
| 84 | + * 总数量 | |
| 85 | + */ | |
| 86 | + private BigDecimal totalQuantity; | |
| 87 | + /** | |
| 88 | + * 总金额 | |
| 89 | + */ | |
| 90 | + private BigDecimal totalPrice; | |
| 91 | + | |
| 92 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/dal/dataobject/order/shipment/WmsShipmentOrderDetailDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.dal.dataobject.order.shipment; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemSkuDO; | |
| 5 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.warehouse.WmsWarehouseDO; | |
| 6 | +import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 7 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 8 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 9 | +import lombok.*; | |
| 10 | + | |
| 11 | +import java.math.BigDecimal; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * WMS 出库单明细 DO | |
| 15 | + * | |
| 16 | + * @author 芋道源码 | |
| 17 | + */ | |
| 18 | +@TableName("wms_shipment_order_detail") | |
| 19 | +@KeySequence("wms_shipment_order_detail_seq") | |
| 20 | +@Data | |
| 21 | +@EqualsAndHashCode(callSuper = true) | |
| 22 | +@ToString(callSuper = true) | |
| 23 | +@Builder | |
| 24 | +@NoArgsConstructor | |
| 25 | +@AllArgsConstructor | |
| 26 | +public class WmsShipmentOrderDetailDO extends BaseDO { | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * 主键编号 | |
| 30 | + */ | |
| 31 | + @TableId | |
| 32 | + private Long id; | |
| 33 | + // ========= 单据商品字段 ========= | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * 出库单编号 | |
| 37 | + * | |
| 38 | + * 关联 {@link WmsShipmentOrderDO#getId()} | |
| 39 | + */ | |
| 40 | + private Long orderId; | |
| 41 | + /** | |
| 42 | + * 商品 SKU 编号 | |
| 43 | + * | |
| 44 | + * 关联 {@link WmsItemSkuDO#getId()} | |
| 45 | + */ | |
| 46 | + private Long skuId; | |
| 47 | + | |
| 48 | + // ========= 仓库字段 ========= | |
| 49 | + | |
| 50 | + /** | |
| 51 | + * 仓库编号 | |
| 52 | + * | |
| 53 | + * 关联 {@link WmsWarehouseDO#getId()} | |
| 54 | + */ | |
| 55 | + private Long warehouseId; | |
| 56 | + | |
| 57 | + // ========= 数量金额字段 ========= | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * 出库数量 | |
| 61 | + */ | |
| 62 | + private BigDecimal quantity; | |
| 63 | + /** | |
| 64 | + * 单价 | |
| 65 | + */ | |
| 66 | + private BigDecimal price; | |
| 67 | + /** | |
| 68 | + * 行金额(数量 * 单价) | |
| 69 | + */ | |
| 70 | + private BigDecimal totalPrice; | |
| 71 | + | |
| 72 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/dal/mysql/home/WmsHomeStatisticsMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.dal.mysql.home; | |
| 2 | + | |
| 3 | +import org.apache.ibatis.annotations.Mapper; | |
| 4 | +import org.apache.ibatis.annotations.Param; | |
| 5 | + | |
| 6 | +import java.math.BigDecimal; | |
| 7 | +import java.time.LocalDateTime; | |
| 8 | +import java.util.List; | |
| 9 | +import java.util.Map; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * WMS 首页统计 Mapper | |
| 13 | + * | |
| 14 | + * @author 芋道源码 | |
| 15 | + */ | |
| 16 | +@Mapper | |
| 17 | +public interface WmsHomeStatisticsMapper { | |
| 18 | + | |
| 19 | + /** | |
| 20 | + * 按单据类型和状态统计单据数量 | |
| 21 | + * | |
| 22 | + * @param warehouseId 仓库编号 | |
| 23 | + * @return [{ "orderType": 1, "status": 0, "count": 5 }, ...] | |
| 24 | + */ | |
| 25 | + List<Map<String, Object>> selectOrderCountGroupByTypeAndStatus(@Param("warehouseId") Long warehouseId); | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * 按天聚合单据数量 | |
| 29 | + * | |
| 30 | + * @param beginTime >= 开始时间 | |
| 31 | + * @param endTime < 结束时间 | |
| 32 | + * @param warehouseId 仓库编号 | |
| 33 | + * @return [{ "date": "2026-05-14", "orderType": 1, "count": 5 }, ...] | |
| 34 | + */ | |
| 35 | + List<Map<String, Object>> selectDailyOrderTrend(@Param("beginTime") LocalDateTime beginTime, | |
| 36 | + @Param("endTime") LocalDateTime endTime, | |
| 37 | + @Param("warehouseId") Long warehouseId); | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * 统计库存总数量 | |
| 41 | + * | |
| 42 | + * @param warehouseId 仓库编号 | |
| 43 | + * @return 库存总数量 | |
| 44 | + */ | |
| 45 | + BigDecimal selectInventoryTotalQuantity(@Param("warehouseId") Long warehouseId); | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * 按商品统计库存数量排行 | |
| 49 | + * | |
| 50 | + * @param warehouseId 仓库编号 | |
| 51 | + * @param limit 数量限制 | |
| 52 | + * @return [{ "id": 1, "name": "A4 复印纸", "quantity": 100 }, ...] | |
| 53 | + */ | |
| 54 | + List<Map<String, Object>> selectInventoryItemRank(@Param("warehouseId") Long warehouseId, | |
| 55 | + @Param("limit") Integer limit); | |
| 56 | + | |
| 57 | + /** | |
| 58 | + * 按仓库统计库存数量排行 | |
| 59 | + * | |
| 60 | + * @param warehouseId 仓库编号 | |
| 61 | + * @param limit 数量限制 | |
| 62 | + * @return [{ "id": 1, "name": "上海仓", "quantity": 100 }, ...] | |
| 63 | + */ | |
| 64 | + List<Map<String, Object>> selectInventoryWarehouseRank(@Param("warehouseId") Long warehouseId, | |
| 65 | + @Param("limit") Integer limit); | |
| 66 | + | |
| 67 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/dal/mysql/inventory/WmsInventoryHistoryMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.dal.mysql.inventory; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.MPJLambdaWrapperX; | |
| 6 | +import cn.iocoder.yudao.module.wms.controller.admin.inventory.vo.history.WmsInventoryHistoryPageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.wms.dal.dataobject.inventory.WmsInventoryHistoryDO; | |
| 8 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemDO; | |
| 9 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemSkuDO; | |
| 10 | +import org.apache.ibatis.annotations.Mapper; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * WMS 库存流水 Mapper | |
| 14 | + * | |
| 15 | + * @author 芋道源码 | |
| 16 | + */ | |
| 17 | +@Mapper | |
| 18 | +public interface WmsInventoryHistoryMapper extends BaseMapperX<WmsInventoryHistoryDO> { | |
| 19 | + | |
| 20 | + default PageResult<WmsInventoryHistoryDO> selectPage(WmsInventoryHistoryPageReqVO reqVO) { | |
| 21 | + MPJLambdaWrapperX<WmsInventoryHistoryDO> query = new MPJLambdaWrapperX<WmsInventoryHistoryDO>() | |
| 22 | + .selectAll(WmsInventoryHistoryDO.class) | |
| 23 | + .leftJoin(WmsItemSkuDO.class, WmsItemSkuDO::getId, WmsInventoryHistoryDO::getSkuId) | |
| 24 | + .leftJoin(WmsItemDO.class, WmsItemDO::getId, WmsItemSkuDO::getItemId) | |
| 25 | + .likeIfPresent(WmsItemDO::getCode, reqVO.getItemCode()) | |
| 26 | + .likeIfPresent(WmsItemDO::getName, reqVO.getItemName()) | |
| 27 | + .eqIfPresent(WmsInventoryHistoryDO::getSkuId, reqVO.getSkuId()) | |
| 28 | + .likeIfPresent(WmsItemSkuDO::getCode, reqVO.getSkuCode()) | |
| 29 | + .likeIfPresent(WmsItemSkuDO::getName, reqVO.getSkuName()) | |
| 30 | + .eqIfPresent(WmsInventoryHistoryDO::getWarehouseId, reqVO.getWarehouseId()) | |
| 31 | + .eqIfPresent(WmsInventoryHistoryDO::getOrderNo, reqVO.getOrderNo()) | |
| 32 | + .eqIfPresent(WmsInventoryHistoryDO::getOrderType, reqVO.getOrderType()) | |
| 33 | + .betweenIfPresent(WmsInventoryHistoryDO::getCreateTime, reqVO.getCreateTime()) | |
| 34 | + .orderByDesc(WmsInventoryHistoryDO::getCreateTime) | |
| 35 | + .orderByDesc(WmsInventoryHistoryDO::getId); | |
| 36 | + return selectJoinPage(reqVO, WmsInventoryHistoryDO.class, query); | |
| 37 | + } | |
| 38 | + | |
| 39 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/dal/mysql/inventory/WmsInventoryMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.dal.mysql.inventory; | |
| 2 | + | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 4 | +import cn.hutool.core.util.StrUtil; | |
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 7 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 8 | +import cn.iocoder.yudao.framework.mybatis.core.query.MPJLambdaWrapperX; | |
| 9 | +import cn.iocoder.yudao.module.wms.controller.admin.inventory.vo.WmsInventoryListReqVO; | |
| 10 | +import cn.iocoder.yudao.module.wms.controller.admin.inventory.vo.WmsInventoryPageReqVO; | |
| 11 | +import cn.iocoder.yudao.module.wms.dal.dataobject.inventory.WmsInventoryDO; | |
| 12 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemDO; | |
| 13 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemSkuDO; | |
| 14 | +import org.apache.ibatis.annotations.Mapper; | |
| 15 | + | |
| 16 | +import java.math.BigDecimal; | |
| 17 | +import java.util.Collection; | |
| 18 | +import java.util.Collections; | |
| 19 | +import java.util.List; | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * WMS 库存 Mapper | |
| 23 | + * | |
| 24 | + * @author 芋道源码 | |
| 25 | + */ | |
| 26 | +@Mapper | |
| 27 | +public interface WmsInventoryMapper extends BaseMapperX<WmsInventoryDO> { | |
| 28 | + | |
| 29 | + default PageResult<WmsInventoryDO> selectPage(WmsInventoryPageReqVO reqVO) { | |
| 30 | + MPJLambdaWrapperX<WmsInventoryDO> query = new MPJLambdaWrapperX<WmsInventoryDO>() | |
| 31 | + .selectAll(WmsInventoryDO.class) | |
| 32 | + .innerJoin(WmsItemSkuDO.class, WmsItemSkuDO::getId, WmsInventoryDO::getSkuId) | |
| 33 | + .innerJoin(WmsItemDO.class, WmsItemDO::getId, WmsItemSkuDO::getItemId) | |
| 34 | + .likeIfPresent(WmsItemDO::getCode, reqVO.getItemCode()) | |
| 35 | + .likeIfPresent(WmsItemDO::getName, reqVO.getItemName()) | |
| 36 | + .eqIfPresent(WmsInventoryDO::getSkuId, reqVO.getSkuId()) | |
| 37 | + .likeIfPresent(WmsItemSkuDO::getCode, reqVO.getSkuCode()) | |
| 38 | + .likeIfPresent(WmsItemSkuDO::getName, reqVO.getSkuName()) | |
| 39 | + .eqIfPresent(WmsInventoryDO::getWarehouseId, reqVO.getWarehouseId()) | |
| 40 | + .geIfPresent(WmsInventoryDO::getQuantity, reqVO.getMinQuantity()); | |
| 41 | + if (Boolean.TRUE.equals(reqVO.getOnlyPositiveQuantity())) { | |
| 42 | + query.gt(WmsInventoryDO::getQuantity, BigDecimal.ZERO); | |
| 43 | + } | |
| 44 | + appendDimensionOrder(query, reqVO.getType()); | |
| 45 | + return selectJoinPage(reqVO, WmsInventoryDO.class, query); | |
| 46 | + } | |
| 47 | + | |
| 48 | + default Long selectCountBySkuId(Long skuId) { | |
| 49 | + return selectCount(WmsInventoryDO::getSkuId, skuId); | |
| 50 | + } | |
| 51 | + | |
| 52 | + default Long selectCountByWarehouseId(Long warehouseId) { | |
| 53 | + return selectCount(WmsInventoryDO::getWarehouseId, warehouseId); | |
| 54 | + } | |
| 55 | + | |
| 56 | + default List<WmsInventoryDO> selectList(WmsInventoryListReqVO reqVO) { | |
| 57 | + return selectList(new LambdaQueryWrapperX<WmsInventoryDO>() | |
| 58 | + .eq(WmsInventoryDO::getWarehouseId, reqVO.getWarehouseId()) | |
| 59 | + .orderByAsc(WmsInventoryDO::getSkuId) | |
| 60 | + .orderByAsc(WmsInventoryDO::getId)); | |
| 61 | + } | |
| 62 | + | |
| 63 | + default WmsInventoryDO selectBySkuIdAndWarehouseId(Long skuId, Long warehouseId) { | |
| 64 | + return selectOne(WmsInventoryDO::getSkuId, skuId, | |
| 65 | + WmsInventoryDO::getWarehouseId, warehouseId); | |
| 66 | + } | |
| 67 | + | |
| 68 | + default WmsInventoryDO selectByIdForUpdate(Long id) { | |
| 69 | + return selectOne(new LambdaQueryWrapperX<WmsInventoryDO>() | |
| 70 | + .eq(WmsInventoryDO::getId, id) | |
| 71 | + .last("FOR UPDATE")); | |
| 72 | + } | |
| 73 | + | |
| 74 | + /** | |
| 75 | + * 根据多个唯一键,批量查询库存列表 | |
| 76 | + * | |
| 77 | + * @param keys 唯一键列表:由 SKU 编号 + 仓库编号组成 | |
| 78 | + * @return 库存列表 | |
| 79 | + */ | |
| 80 | + default List<WmsInventoryDO> selectListByKeys(Collection<WmsInventoryDO> keys) { | |
| 81 | + if (CollUtil.isEmpty(keys)) { | |
| 82 | + return Collections.emptyList(); | |
| 83 | + } | |
| 84 | + return selectList(new LambdaQueryWrapperX<WmsInventoryDO>() | |
| 85 | + .and(query -> { | |
| 86 | + boolean first = true; | |
| 87 | + for (WmsInventoryDO key : keys) { | |
| 88 | + if (!first) { | |
| 89 | + query.or(); | |
| 90 | + } | |
| 91 | + query.eq(WmsInventoryDO::getSkuId, key.getSkuId()) | |
| 92 | + .eq(WmsInventoryDO::getWarehouseId, key.getWarehouseId()); | |
| 93 | + first = false; | |
| 94 | + } | |
| 95 | + })); | |
| 96 | + } | |
| 97 | + | |
| 98 | + default List<WmsInventoryDO> selectListByIdsForUpdate(Collection<Long> ids) { | |
| 99 | + if (CollUtil.isEmpty(ids)) { | |
| 100 | + return Collections.emptyList(); | |
| 101 | + } | |
| 102 | + return selectList(new LambdaQueryWrapperX<WmsInventoryDO>() | |
| 103 | + .in(WmsInventoryDO::getId, ids) | |
| 104 | + .orderByAsc(WmsInventoryDO::getId) | |
| 105 | + .last("FOR UPDATE")); | |
| 106 | + } | |
| 107 | + | |
| 108 | + static void appendDimensionOrder(MPJLambdaWrapperX<WmsInventoryDO> query, String type) { | |
| 109 | + if (StrUtil.equals(WmsInventoryPageReqVO.TYPE_WAREHOUSE, type)) { | |
| 110 | + query.orderByAsc(WmsInventoryDO::getWarehouseId) | |
| 111 | + .orderByAsc(WmsItemSkuDO::getItemId) | |
| 112 | + .orderByAsc(WmsInventoryDO::getSkuId) | |
| 113 | + .orderByAsc(WmsInventoryDO::getId); | |
| 114 | + return; | |
| 115 | + } | |
| 116 | + if (StrUtil.equals(WmsInventoryPageReqVO.TYPE_ITEM, type)) { | |
| 117 | + query.orderByAsc(WmsItemSkuDO::getItemId) | |
| 118 | + .orderByAsc(WmsInventoryDO::getSkuId) | |
| 119 | + .orderByAsc(WmsInventoryDO::getWarehouseId) | |
| 120 | + .orderByAsc(WmsInventoryDO::getId); | |
| 121 | + return; | |
| 122 | + } | |
| 123 | + throw new IllegalArgumentException("未知库存统计维度:" + type); | |
| 124 | + } | |
| 125 | + | |
| 126 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/dal/mysql/md/item/WmsItemBrandMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.dal.mysql.md.item; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | +import cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.brand.WmsItemBrandPageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemBrandDO; | |
| 8 | +import org.apache.ibatis.annotations.Mapper; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * WMS 商品品牌 Mapper | |
| 12 | + * | |
| 13 | + * @author 芋道源码 | |
| 14 | + */ | |
| 15 | +@Mapper | |
| 16 | +public interface WmsItemBrandMapper extends BaseMapperX<WmsItemBrandDO> { | |
| 17 | + | |
| 18 | + default PageResult<WmsItemBrandDO> selectPage(WmsItemBrandPageReqVO reqVO) { | |
| 19 | + return selectPage(reqVO, new LambdaQueryWrapperX<WmsItemBrandDO>() | |
| 20 | + .likeIfPresent(WmsItemBrandDO::getCode, reqVO.getCode()) | |
| 21 | + .likeIfPresent(WmsItemBrandDO::getName, reqVO.getName()) | |
| 22 | + .orderByDesc(WmsItemBrandDO::getId)); | |
| 23 | + } | |
| 24 | + | |
| 25 | + default WmsItemBrandDO selectByCode(String code) { | |
| 26 | + return selectOne(WmsItemBrandDO::getCode, code); | |
| 27 | + } | |
| 28 | + | |
| 29 | + default WmsItemBrandDO selectByName(String name) { | |
| 30 | + return selectOne(WmsItemBrandDO::getName, name); | |
| 31 | + } | |
| 32 | + | |
| 33 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/dal/mysql/md/item/WmsItemCategoryMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.dal.mysql.md.item; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 5 | +import cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.category.WmsItemCategoryListReqVO; | |
| 6 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemCategoryDO; | |
| 7 | +import org.apache.ibatis.annotations.Mapper; | |
| 8 | + | |
| 9 | +import java.util.Collection; | |
| 10 | +import java.util.List; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * WMS 商品分类 Mapper | |
| 14 | + * | |
| 15 | + * @author 芋道源码 | |
| 16 | + */ | |
| 17 | +@Mapper | |
| 18 | +public interface WmsItemCategoryMapper extends BaseMapperX<WmsItemCategoryDO> { | |
| 19 | + | |
| 20 | + default List<WmsItemCategoryDO> selectList(WmsItemCategoryListReqVO reqVO) { | |
| 21 | + return selectList(new LambdaQueryWrapperX<WmsItemCategoryDO>() | |
| 22 | + .eqIfPresent(WmsItemCategoryDO::getParentId, reqVO.getParentId()) | |
| 23 | + .likeIfPresent(WmsItemCategoryDO::getCode, reqVO.getCode()) | |
| 24 | + .likeIfPresent(WmsItemCategoryDO::getName, reqVO.getName()) | |
| 25 | + .eqIfPresent(WmsItemCategoryDO::getStatus, reqVO.getStatus()) | |
| 26 | + .orderByAsc(WmsItemCategoryDO::getSort) | |
| 27 | + .orderByAsc(WmsItemCategoryDO::getId)); | |
| 28 | + } | |
| 29 | + | |
| 30 | + default WmsItemCategoryDO selectByParentIdAndName(Long parentId, String name) { | |
| 31 | + return selectOne(WmsItemCategoryDO::getParentId, parentId, WmsItemCategoryDO::getName, name); | |
| 32 | + } | |
| 33 | + | |
| 34 | + default WmsItemCategoryDO selectByCode(String code) { | |
| 35 | + return selectOne(WmsItemCategoryDO::getCode, code); | |
| 36 | + } | |
| 37 | + | |
| 38 | + default List<WmsItemCategoryDO> selectListByParentIds(Collection<Long> parentIds) { | |
| 39 | + return selectList(new LambdaQueryWrapperX<WmsItemCategoryDO>() | |
| 40 | + .in(WmsItemCategoryDO::getParentId, parentIds) | |
| 41 | + .orderByAsc(WmsItemCategoryDO::getSort) | |
| 42 | + .orderByAsc(WmsItemCategoryDO::getId)); | |
| 43 | + } | |
| 44 | + | |
| 45 | + default Long selectCountByParentId(Long parentId) { | |
| 46 | + return selectCount(WmsItemCategoryDO::getParentId, parentId); | |
| 47 | + } | |
| 48 | + | |
| 49 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/dal/mysql/md/item/WmsItemMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.dal.mysql.md.item; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | +import cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.item.WmsItemListReqVO; | |
| 7 | +import cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.item.WmsItemPageReqVO; | |
| 8 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemDO; | |
| 9 | +import org.apache.ibatis.annotations.Mapper; | |
| 10 | + | |
| 11 | +import java.util.Collection; | |
| 12 | +import java.util.List; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * WMS 商品 Mapper | |
| 16 | + * | |
| 17 | + * @author 芋道源码 | |
| 18 | + */ | |
| 19 | +@Mapper | |
| 20 | +public interface WmsItemMapper extends BaseMapperX<WmsItemDO> { | |
| 21 | + | |
| 22 | + default PageResult<WmsItemDO> selectPage(WmsItemPageReqVO reqVO, Collection<Long> categoryIds) { | |
| 23 | + return selectPage(reqVO, new LambdaQueryWrapperX<WmsItemDO>() | |
| 24 | + .likeIfPresent(WmsItemDO::getCode, reqVO.getCode()) | |
| 25 | + .likeIfPresent(WmsItemDO::getName, reqVO.getName()) | |
| 26 | + .inIfPresent(WmsItemDO::getCategoryId, categoryIds) | |
| 27 | + .eqIfPresent(WmsItemDO::getBrandId, reqVO.getBrandId()) | |
| 28 | + .betweenIfPresent(WmsItemDO::getCreateTime, reqVO.getCreateTime()) | |
| 29 | + .orderByDesc(WmsItemDO::getId)); | |
| 30 | + } | |
| 31 | + | |
| 32 | + default List<WmsItemDO> selectList(WmsItemListReqVO reqVO, Collection<Long> categoryIds) { | |
| 33 | + return selectList(new LambdaQueryWrapperX<WmsItemDO>() | |
| 34 | + .likeIfPresent(WmsItemDO::getCode, reqVO.getCode()) | |
| 35 | + .likeIfPresent(WmsItemDO::getName, reqVO.getName()) | |
| 36 | + .inIfPresent(WmsItemDO::getCategoryId, categoryIds) | |
| 37 | + .eqIfPresent(WmsItemDO::getBrandId, reqVO.getBrandId()) | |
| 38 | + .betweenIfPresent(WmsItemDO::getCreateTime, reqVO.getCreateTime()) | |
| 39 | + .orderByDesc(WmsItemDO::getId)); | |
| 40 | + } | |
| 41 | + | |
| 42 | + default WmsItemDO selectByName(String name) { | |
| 43 | + return selectOne(WmsItemDO::getName, name); | |
| 44 | + } | |
| 45 | + | |
| 46 | + default WmsItemDO selectByCode(String code) { | |
| 47 | + return selectOne(WmsItemDO::getCode, code); | |
| 48 | + } | |
| 49 | + | |
| 50 | + default Long selectCountByCategoryId(Long categoryId) { | |
| 51 | + return selectCount(WmsItemDO::getCategoryId, categoryId); | |
| 52 | + } | |
| 53 | + | |
| 54 | + default Long selectCountByBrandId(Long brandId) { | |
| 55 | + return selectCount(WmsItemDO::getBrandId, brandId); | |
| 56 | + } | |
| 57 | + | |
| 58 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/dal/mysql/md/item/WmsItemSkuMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.dal.mysql.md.item; | |
| 2 | + | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 6 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 7 | +import cn.iocoder.yudao.framework.mybatis.core.query.MPJLambdaWrapperX; | |
| 8 | +import cn.iocoder.yudao.module.wms.controller.admin.md.item.vo.sku.WmsItemSkuPageReqVO; | |
| 9 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemDO; | |
| 10 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.item.WmsItemSkuDO; | |
| 11 | +import org.apache.ibatis.annotations.Mapper; | |
| 12 | + | |
| 13 | +import java.util.Collection; | |
| 14 | +import java.util.Collections; | |
| 15 | +import java.util.List; | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * WMS 商品 SKU Mapper | |
| 19 | + * | |
| 20 | + * @author 芋道源码 | |
| 21 | + */ | |
| 22 | +@Mapper | |
| 23 | +public interface WmsItemSkuMapper extends BaseMapperX<WmsItemSkuDO> { | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 按 SKU 维度分页查询,支持商品 / 品牌 / 分类多表联查筛选。 | |
| 27 | + * | |
| 28 | + * 使用 {@link MPJLambdaWrapperX} 替代 lite 的手写 XML JOIN(见 lite | |
| 29 | + * {@code ItemSkuMapper.selectByBo}),范式参照本模块 {@code WmsInventoryMapper.selectPage}。 | |
| 30 | + */ | |
| 31 | + default PageResult<WmsItemSkuDO> selectPage(WmsItemSkuPageReqVO reqVO) { | |
| 32 | + MPJLambdaWrapperX<WmsItemSkuDO> query = new MPJLambdaWrapperX<WmsItemSkuDO>() | |
| 33 | + .selectAll(WmsItemSkuDO.class) | |
| 34 | + .innerJoin(WmsItemDO.class, WmsItemDO::getId, WmsItemSkuDO::getItemId) | |
| 35 | + .likeIfPresent(WmsItemDO::getCode, reqVO.getItemCode()) | |
| 36 | + .likeIfPresent(WmsItemDO::getName, reqVO.getItemName()) | |
| 37 | + .eqIfPresent(WmsItemDO::getCategoryId, reqVO.getCategoryId()) | |
| 38 | + .eqIfPresent(WmsItemDO::getBrandId, reqVO.getBrandId()) | |
| 39 | + .likeIfPresent(WmsItemSkuDO::getCode, reqVO.getCode()) | |
| 40 | + .likeIfPresent(WmsItemSkuDO::getName, reqVO.getName()) | |
| 41 | + .likeIfPresent(WmsItemSkuDO::getBarCode, reqVO.getBarCode()) | |
| 42 | + .orderByDesc(WmsItemSkuDO::getId); | |
| 43 | + return selectJoinPage(reqVO, WmsItemSkuDO.class, query); | |
| 44 | + } | |
| 45 | + | |
| 46 | + default List<WmsItemSkuDO> selectListByItemId(Long itemId) { | |
| 47 | + return selectList(new LambdaQueryWrapperX<WmsItemSkuDO>() | |
| 48 | + .eq(WmsItemSkuDO::getItemId, itemId) | |
| 49 | + .orderByAsc(WmsItemSkuDO::getId)); | |
| 50 | + } | |
| 51 | + | |
| 52 | + default List<WmsItemSkuDO> selectListByItemIds(Collection<Long> itemIds) { | |
| 53 | + if (CollUtil.isEmpty(itemIds)) { | |
| 54 | + return Collections.emptyList(); | |
| 55 | + } | |
| 56 | + return selectList(new LambdaQueryWrapperX<WmsItemSkuDO>() | |
| 57 | + .inIfPresent(WmsItemSkuDO::getItemId, itemIds) | |
| 58 | + .orderByAsc(WmsItemSkuDO::getId)); | |
| 59 | + } | |
| 60 | + | |
| 61 | + default List<WmsItemSkuDO> selectList(Collection<Long> itemIds, String code, String name) { | |
| 62 | + if (itemIds != null && CollUtil.isEmpty(itemIds)) { | |
| 63 | + return Collections.emptyList(); | |
| 64 | + } | |
| 65 | + return selectList(new LambdaQueryWrapperX<WmsItemSkuDO>() | |
| 66 | + .inIfPresent(WmsItemSkuDO::getItemId, itemIds) | |
| 67 | + .likeIfPresent(WmsItemSkuDO::getCode, code) | |
| 68 | + .likeIfPresent(WmsItemSkuDO::getName, name) | |
| 69 | + .orderByAsc(WmsItemSkuDO::getId)); | |
| 70 | + } | |
| 71 | + | |
| 72 | + default void deleteByItemId(Long itemId) { | |
| 73 | + delete(WmsItemSkuDO::getItemId, itemId); | |
| 74 | + } | |
| 75 | + | |
| 76 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/dal/mysql/md/merchant/WmsMerchantMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.dal.mysql.md.merchant; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | +import cn.iocoder.yudao.module.wms.controller.admin.md.merchant.vo.WmsMerchantListReqVO; | |
| 7 | +import cn.iocoder.yudao.module.wms.controller.admin.md.merchant.vo.WmsMerchantPageReqVO; | |
| 8 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.merchant.WmsMerchantDO; | |
| 9 | +import org.apache.ibatis.annotations.Mapper; | |
| 10 | + | |
| 11 | +import java.util.List; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * WMS 往来企业 Mapper | |
| 15 | + * | |
| 16 | + * @author 芋道源码 | |
| 17 | + */ | |
| 18 | +@Mapper | |
| 19 | +public interface WmsMerchantMapper extends BaseMapperX<WmsMerchantDO> { | |
| 20 | + | |
| 21 | + default PageResult<WmsMerchantDO> selectPage(WmsMerchantPageReqVO reqVO) { | |
| 22 | + return selectPage(reqVO, new LambdaQueryWrapperX<WmsMerchantDO>() | |
| 23 | + .eqIfPresent(WmsMerchantDO::getCode, reqVO.getCode()) | |
| 24 | + .likeIfPresent(WmsMerchantDO::getName, reqVO.getName()) | |
| 25 | + .eqIfPresent(WmsMerchantDO::getType, reqVO.getType()) | |
| 26 | + .inIfPresent(WmsMerchantDO::getType, reqVO.getTypes()) | |
| 27 | + .orderByDesc(WmsMerchantDO::getId)); | |
| 28 | + } | |
| 29 | + | |
| 30 | + default List<WmsMerchantDO> selectList(WmsMerchantListReqVO reqVO) { | |
| 31 | + return selectList(new LambdaQueryWrapperX<WmsMerchantDO>() | |
| 32 | + .eqIfPresent(WmsMerchantDO::getCode, reqVO.getCode()) | |
| 33 | + .likeIfPresent(WmsMerchantDO::getName, reqVO.getName()) | |
| 34 | + .eqIfPresent(WmsMerchantDO::getType, reqVO.getType()) | |
| 35 | + .inIfPresent(WmsMerchantDO::getType, reqVO.getTypes()) | |
| 36 | + .orderByDesc(WmsMerchantDO::getId)); | |
| 37 | + } | |
| 38 | + | |
| 39 | + default WmsMerchantDO selectByCode(String code) { | |
| 40 | + return selectOne(WmsMerchantDO::getCode, code); | |
| 41 | + } | |
| 42 | + | |
| 43 | + default WmsMerchantDO selectByName(String name) { | |
| 44 | + return selectOne(WmsMerchantDO::getName, name); | |
| 45 | + } | |
| 46 | + | |
| 47 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/dal/mysql/md/warehouse/WmsWarehouseMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.dal.mysql.md.warehouse; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | +import cn.iocoder.yudao.module.wms.controller.admin.md.warehouse.vo.WmsWarehousePageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.wms.dal.dataobject.md.warehouse.WmsWarehouseDO; | |
| 8 | +import org.apache.ibatis.annotations.Mapper; | |
| 9 | + | |
| 10 | +import java.util.List; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * WMS 仓库 Mapper | |
| 14 | + * | |
| 15 | + * @author 芋道源码 | |
| 16 | + */ | |
| 17 | +@Mapper | |
| 18 | +public interface WmsWarehouseMapper extends BaseMapperX<WmsWarehouseDO> { | |
| 19 | + | |
| 20 | + default PageResult<WmsWarehouseDO> selectPage(WmsWarehousePageReqVO reqVO) { | |
| 21 | + return selectPage(reqVO, new LambdaQueryWrapperX<WmsWarehouseDO>() | |
| 22 | + .eqIfPresent(WmsWarehouseDO::getCode, reqVO.getCode()) | |
| 23 | + .likeIfPresent(WmsWarehouseDO::getName, reqVO.getName()) | |
| 24 | + .orderByAsc(WmsWarehouseDO::getSort) | |
| 25 | + .orderByDesc(WmsWarehouseDO::getId)); | |
| 26 | + } | |
| 27 | + | |
| 28 | + default WmsWarehouseDO selectByCode(String code) { | |
| 29 | + return selectOne(WmsWarehouseDO::getCode, code); | |
| 30 | + } | |
| 31 | + | |
| 32 | + default WmsWarehouseDO selectByName(String name) { | |
| 33 | + return selectOne(WmsWarehouseDO::getName, name); | |
| 34 | + } | |
| 35 | + | |
| 36 | + default List<WmsWarehouseDO> selectSimpleList() { | |
| 37 | + return selectList(new LambdaQueryWrapperX<WmsWarehouseDO>() | |
| 38 | + .orderByAsc(WmsWarehouseDO::getSort) | |
| 39 | + .orderByDesc(WmsWarehouseDO::getId)); | |
| 40 | + } | |
| 41 | + | |
| 42 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/dal/mysql/order/check/WmsCheckOrderDetailMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.dal.mysql.order.check; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 5 | +import cn.iocoder.yudao.module.wms.dal.dataobject.order.check.WmsCheckOrderDetailDO; | |
| 6 | +import org.apache.ibatis.annotations.Mapper; | |
| 7 | + | |
| 8 | +import java.util.Collection; | |
| 9 | +import java.util.List; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * WMS 盘库单明细 Mapper | |
| 13 | + * | |
| 14 | + * @author 芋道源码 | |
| 15 | + */ | |
| 16 | +@Mapper | |
| 17 | +public interface WmsCheckOrderDetailMapper extends BaseMapperX<WmsCheckOrderDetailDO> { | |
| 18 | + | |
| 19 | + default List<WmsCheckOrderDetailDO> selectListByOrderId(Long orderId) { | |
| 20 | + return selectList(WmsCheckOrderDetailDO::getOrderId, orderId); | |
| 21 | + } | |
| 22 | + | |
| 23 | + default List<WmsCheckOrderDetailDO> selectListByOrderIds(Collection<Long> orderIds) { | |
| 24 | + return selectList(new LambdaQueryWrapperX<WmsCheckOrderDetailDO>() | |
| 25 | + .inIfPresent(WmsCheckOrderDetailDO::getOrderId, orderIds) | |
| 26 | + .orderByAsc(WmsCheckOrderDetailDO::getOrderId) | |
| 27 | + .orderByAsc(WmsCheckOrderDetailDO::getId)); | |
| 28 | + } | |
| 29 | + | |
| 30 | + default void deleteByOrderId(Long orderId) { | |
| 31 | + delete(WmsCheckOrderDetailDO::getOrderId, orderId); | |
| 32 | + } | |
| 33 | + | |
| 34 | + default Long selectCountBySkuId(Long skuId) { | |
| 35 | + return selectCount(WmsCheckOrderDetailDO::getSkuId, skuId); | |
| 36 | + } | |
| 37 | + | |
| 38 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/dal/mysql/order/check/WmsCheckOrderMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.dal.mysql.order.check; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | +import cn.iocoder.yudao.module.wms.controller.admin.order.check.vo.order.WmsCheckOrderPageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.wms.dal.dataobject.order.check.WmsCheckOrderDO; | |
| 8 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
| 9 | +import org.apache.ibatis.annotations.Mapper; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * WMS 盘库单 Mapper | |
| 13 | + * | |
| 14 | + * @author 芋道源码 | |
| 15 | + */ | |
| 16 | +@Mapper | |
| 17 | +public interface WmsCheckOrderMapper extends BaseMapperX<WmsCheckOrderDO> { | |
| 18 | + | |
| 19 | + default PageResult<WmsCheckOrderDO> selectPage(WmsCheckOrderPageReqVO reqVO) { | |
| 20 | + return selectPage(reqVO, new LambdaQueryWrapperX<WmsCheckOrderDO>() | |
| 21 | + .likeIfPresent(WmsCheckOrderDO::getNo, reqVO.getNo()) | |
| 22 | + .eqIfPresent(WmsCheckOrderDO::getStatus, reqVO.getStatus()) | |
| 23 | + .eqIfPresent(WmsCheckOrderDO::getWarehouseId, reqVO.getWarehouseId()) | |
| 24 | + .betweenIfPresent(WmsCheckOrderDO::getOrderTime, reqVO.getOrderTime()) | |
| 25 | + .geIfPresent(WmsCheckOrderDO::getTotalQuantity, reqVO.getTotalQuantityMin()) | |
| 26 | + .leIfPresent(WmsCheckOrderDO::getTotalQuantity, reqVO.getTotalQuantityMax()) | |
| 27 | + .geIfPresent(WmsCheckOrderDO::getTotalPrice, reqVO.getTotalPriceMin()) | |
| 28 | + .leIfPresent(WmsCheckOrderDO::getTotalPrice, reqVO.getTotalPriceMax()) | |
| 29 | + .geIfPresent(WmsCheckOrderDO::getActualPrice, reqVO.getActualPriceMin()) | |
| 30 | + .leIfPresent(WmsCheckOrderDO::getActualPrice, reqVO.getActualPriceMax()) | |
| 31 | + .eqIfPresent(WmsCheckOrderDO::getCreator, reqVO.getCreator()) | |
| 32 | + .eqIfPresent(WmsCheckOrderDO::getUpdater, reqVO.getUpdater()) | |
| 33 | + .betweenIfPresent(WmsCheckOrderDO::getCreateTime, reqVO.getCreateTime()) | |
| 34 | + .betweenIfPresent(WmsCheckOrderDO::getUpdateTime, reqVO.getUpdateTime()) | |
| 35 | + .orderByDesc(WmsCheckOrderDO::getId)); | |
| 36 | + } | |
| 37 | + | |
| 38 | + default WmsCheckOrderDO selectByNo(String no) { | |
| 39 | + return selectOne(WmsCheckOrderDO::getNo, no); | |
| 40 | + } | |
| 41 | + | |
| 42 | + default Long selectCountByWarehouseId(Long warehouseId) { | |
| 43 | + return selectCount(WmsCheckOrderDO::getWarehouseId, warehouseId); | |
| 44 | + } | |
| 45 | + | |
| 46 | + default int updateByIdAndStatus(Long id, Integer status, WmsCheckOrderDO updateObj) { | |
| 47 | + return update(updateObj, new LambdaQueryWrapper<WmsCheckOrderDO>() | |
| 48 | + .eq(WmsCheckOrderDO::getId, id) | |
| 49 | + .eq(WmsCheckOrderDO::getStatus, status)); | |
| 50 | + } | |
| 51 | + | |
| 52 | +} | ... | ... |
yudao-module-wms/src/main/java/cn/iocoder/yudao/module/wms/dal/mysql/order/movement/WmsMovementOrderDetailMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.wms.dal.mysql.order.movement; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 5 | +import cn.iocoder.yudao.module.wms.dal.dataobject.order.movement.WmsMovementOrderDetailDO; | |
| 6 | +import org.apache.ibatis.annotations.Mapper; | |
| 7 | + | |
| 8 | +import java.util.Collection; | |
| 9 | +import java.util.List; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * WMS 移库单明细 Mapper | |
| 13 | + * | |
| 14 | + * @author 芋道源码 | |
| 15 | + */ | |
| 16 | +@Mapper | |
| 17 | +public interface WmsMovementOrderDetailMapper extends BaseMapperX<WmsMovementOrderDetailDO> { | |
| 18 | + | |
| 19 | + default List<WmsMovementOrderDetailDO> selectListByOrderId(Long orderId) { | |
| 20 | + return selectList(WmsMovementOrderDetailDO::getOrderId, orderId); | |
| 21 | + } | |
| 22 | + | |
| 23 | + default List<WmsMovementOrderDetailDO> selectListByOrderIds(Collection<Long> orderIds) { | |
| 24 | + return selectList(new LambdaQueryWrapperX<WmsMovementOrderDetailDO>() | |
| 25 | + .inIfPresent(WmsMovementOrderDetailDO::getOrderId, orderIds) | |
| 26 | + .orderByAsc(WmsMovementOrderDetailDO::getOrderId) | |
| 27 | + .orderByAsc(WmsMovementOrderDetailDO::getId)); | |
| 28 | + } | |
| 29 | + | |
| 30 | + default void deleteByOrderId(Long orderId) { | |
| 31 | + delete(WmsMovementOrderDetailDO::getOrderId, orderId); | |
| 32 | + } | |
| 33 | + | |
| 34 | + default Long selectCountBySkuId(Long skuId) { | |
| 35 | + return selectCount(WmsMovementOrderDetailDO::getSkuId, skuId); | |
| 36 | + } | |
| 37 | + | |
| 38 | +} | ... | ... |