Commit 7936e27ea44d6ac73f9cc952f1d2db4c8e9e4927

Authored by dhb52
2 parents 3b612b2e 9e3858ae

Merge remote-tracking branch 'upstream/develop' into develop

Showing 156 changed files with 12233 additions and 703 deletions

Too many changes.

To preserve performance only 100 of 156 files are displayed.

yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/collection/CollectionUtils.java
... ... @@ -288,11 +288,16 @@ public class CollectionUtils {
288 288  
289 289 public static <T, V extends Comparable<? super V>> V getSumValue(List<T> from, Function<T, V> valueFunc,
290 290 BinaryOperator<V> accumulator) {
  291 + return getSumValue(from, valueFunc, accumulator, null);
  292 + }
  293 +
  294 + public static <T, V extends Comparable<? super V>> V getSumValue(Collection<T> from, Function<T, V> valueFunc,
  295 + BinaryOperator<V> accumulator, V defaultValue) {
291 296 if (CollUtil.isEmpty(from)) {
292   - return null;
  297 + return defaultValue;
293 298 }
294   - assert from.size() > 0; // 断言,避免告警
295   - return from.stream().map(valueFunc).reduce(accumulator).get();
  299 + assert !from.isEmpty(); // 断言,避免告警
  300 + return from.stream().map(valueFunc).filter(Objects::nonNull).reduce(accumulator).orElse(defaultValue);
296 301 }
297 302  
298 303 public static <T> void addIfNotNull(Collection<T> coll, T item) {
... ... @@ -302,8 +307,12 @@ public class CollectionUtils {
302 307 coll.add(item);
303 308 }
304 309  
305   - public static <T> Collection<T> singleton(T deptId) {
306   - return deptId == null ? Collections.emptyList() : Collections.singleton(deptId);
  310 + public static <T> Collection<T> singleton(T obj) {
  311 + return obj == null ? Collections.emptyList() : Collections.singleton(obj);
  312 + }
  313 +
  314 + public static <T> List<T> newArrayList(List<List<T>> list) {
  315 + return list.stream().flatMap(Collection::stream).collect(Collectors.toList());
307 316 }
308 317  
309 318 }
... ...
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/number/MoneyUtils.java
... ... @@ -14,6 +14,16 @@ import java.math.RoundingMode;
14 14 public class MoneyUtils {
15 15  
16 16 /**
  17 + * 金额的小数位数
  18 + */
  19 + private static final int PRICE_SCALE = 2;
  20 +
  21 + /**
  22 + * 百分比对应的 BigDecimal 对象
  23 + */
  24 + public static final BigDecimal PERCENT_100 = BigDecimal.valueOf(100);
  25 +
  26 + /**
17 27 * 计算百分比金额,四舍五入
18 28 *
19 29 * @param price 金额
... ... @@ -86,4 +96,36 @@ public class MoneyUtils {
86 96 return new Money(0, fen).toString();
87 97 }
88 98  
  99 + /**
  100 + * 金额相乘,默认进行四舍五入
  101 + *
  102 + * 位数:{@link #PRICE_SCALE}
  103 + *
  104 + * @param price 金额
  105 + * @param count 数量
  106 + * @return 金额相乘结果
  107 + */
  108 + public static BigDecimal priceMultiply(BigDecimal price, BigDecimal count) {
  109 + if (price == null || count == null) {
  110 + return null;
  111 + }
  112 + return price.multiply(count).setScale(PRICE_SCALE, RoundingMode.HALF_UP);
  113 + }
  114 +
  115 + /**
  116 + * 金额相乘(百分比),默认进行四舍五入
  117 + *
  118 + * 位数:{@link #PRICE_SCALE}
  119 + *
  120 + * @param price 金额
  121 + * @param percent 百分比
  122 + * @return 金额相乘结果
  123 + */
  124 + public static BigDecimal priceMultiplyPercent(BigDecimal price, BigDecimal percent) {
  125 + if (price == null || percent == null) {
  126 + return null;
  127 + }
  128 + return price.multiply(percent).divide(PERCENT_100, PRICE_SCALE, RoundingMode.HALF_UP);
  129 + }
  130 +
89 131 }
... ...
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/number/NumberUtils.java
1 1 package cn.iocoder.yudao.framework.common.util.number;
2 2  
  3 +import cn.hutool.core.util.NumberUtil;
3 4 import cn.hutool.core.util.StrUtil;
4 5  
  6 +import java.math.BigDecimal;
  7 +
5 8 /**
6 9 * 数字的工具类,补全 {@link cn.hutool.core.util.NumberUtil} 的功能
7 10 *
... ... @@ -37,4 +40,21 @@ public class NumberUtils {
37 40 return distance;
38 41 }
39 42  
  43 + /**
  44 + * 提供精确的乘法运算
  45 + *
  46 + * 和 hutool {@link NumberUtil#mul(BigDecimal...)} 的差别是,如果存在 null,则返回 null
  47 + *
  48 + * @param values 多个被乘值
  49 + * @return 积
  50 + */
  51 + public static BigDecimal mul(BigDecimal... values) {
  52 + for (BigDecimal value : values) {
  53 + if (value == null) {
  54 + return null;
  55 + }
  56 + }
  57 + return NumberUtil.mul(values);
  58 + }
  59 +
40 60 }
... ...
yudao-module-erp/yudao-module-erp-api/src/main/java/cn/iocoder/yudao/module/erp/enums/ErrorCodeConstants.java
... ... @@ -13,8 +13,73 @@ public interface ErrorCodeConstants {
13 13 ErrorCode SUPPLIER_NOT_EXISTS = new ErrorCode(1_030_100_000, "供应商不存在");
14 14 ErrorCode SUPPLIER_NOT_ENABLE = new ErrorCode(1_030_100_000, "供应商({})未启用");
15 15  
16   - // ========== 销售订单(1-030-200-000) ==========
17   - ErrorCode SALE_ORDER_NOT_EXISTS = new ErrorCode(1_020_200_000, "销售订单不存在");
  16 + // ========== ERP 采购订单(1-030-101-000) ==========
  17 + ErrorCode PURCHASE_ORDER_NOT_EXISTS = new ErrorCode(1_030_101_000, "采购订单不存在");
  18 + ErrorCode PURCHASE_ORDER_DELETE_FAIL_APPROVE = new ErrorCode(1_030_101_001, "采购订单({})已审核,无法删除");
  19 + ErrorCode PURCHASE_ORDER_PROCESS_FAIL = new ErrorCode(1_030_101_002, "反审核失败,只有已审核的采购订单才能反审核");
  20 + ErrorCode PURCHASE_ORDER_APPROVE_FAIL = new ErrorCode(1_030_101_003, "审核失败,只有未审核的采购订单才能审核");
  21 + ErrorCode PURCHASE_ORDER_NO_EXISTS = new ErrorCode(1_030_101_004, "生成采购单号失败,请重新提交");
  22 + ErrorCode PURCHASE_ORDER_UPDATE_FAIL_APPROVE = new ErrorCode(1_030_101_005, "采购订单({})已审核,无法修改");
  23 + ErrorCode PURCHASE_ORDER_NOT_APPROVE = new ErrorCode(1_030_101_006, "采购订单未审核,无法操作");
  24 + ErrorCode PURCHASE_ORDER_ITEM_IN_FAIL_PRODUCT_EXCEED = new ErrorCode(1_030_101_007, "采购订单项({})超过最大允许入库数量({})");
  25 + ErrorCode PURCHASE_ORDER_PROCESS_FAIL_EXISTS_IN = new ErrorCode(1_030_101_008, "反审核失败,已存在对应的采购入库单");
  26 +ErrorCode PURCHASE_ORDER_ITEM_RETURN_FAIL_IN_EXCEED = new ErrorCode(1_030_101_009, "采购订单项({})超过最大允许退货数量({})");
  27 + ErrorCode PURCHASE_ORDER_PROCESS_FAIL_EXISTS_RETURN = new ErrorCode(1_030_101_010, "反审核失败,已存在对应的采购退货单");
  28 +
  29 + // ========== ERP 采购入库(1-030-102-000) ==========
  30 + ErrorCode PURCHASE_IN_NOT_EXISTS = new ErrorCode(1_030_102_000, "采购入库单不存在");
  31 + ErrorCode PURCHASE_IN_DELETE_FAIL_APPROVE = new ErrorCode(1_030_102_001, "采购入库单({})已审核,无法删除");
  32 + ErrorCode PURCHASE_IN_PROCESS_FAIL = new ErrorCode(1_030_102_002, "反审核失败,只有已审核的入库单才能反审核");
  33 + ErrorCode PURCHASE_IN_APPROVE_FAIL = new ErrorCode(1_030_102_003, "审核失败,只有未审核的入库单才能审核");
  34 + ErrorCode PURCHASE_IN_NO_EXISTS = new ErrorCode(1_030_102_004, "生成入库单失败,请重新提交");
  35 + ErrorCode PURCHASE_IN_UPDATE_FAIL_APPROVE = new ErrorCode(1_030_102_005, "采购入库单({})已审核,无法修改");
  36 + ErrorCode PURCHASE_IN_NOT_APPROVE = new ErrorCode(1_030_102_006, "采购入库单未审核,无法操作");
  37 + ErrorCode PURCHASE_IN_FAIL_PAYMENT_PRICE_EXCEED = new ErrorCode(1_030_102_007, "付款金额({})超过采购入库单总金额({})");
  38 + ErrorCode PURCHASE_IN_PROCESS_FAIL_EXISTS_PAYMENT = new ErrorCode(1_030_102_008, "反审核失败,已存在对应的付款单");
  39 +
  40 + // ========== ERP 采购退货(1-030-103-000) ==========
  41 + ErrorCode PURCHASE_RETURN_NOT_EXISTS = new ErrorCode(1_030_103_000, "采购退货单不存在");
  42 + ErrorCode PURCHASE_RETURN_DELETE_FAIL_APPROVE = new ErrorCode(1_030_103_001, "采购退货单({})已审核,无法删除");
  43 + ErrorCode PURCHASE_RETURN_PROCESS_FAIL = new ErrorCode(1_030_103_002, "反审核失败,只有已审核的退货单才能反审核");
  44 + ErrorCode PURCHASE_RETURN_APPROVE_FAIL = new ErrorCode(1_030_103_003, "审核失败,只有未审核的退货单才能审核");
  45 + ErrorCode PURCHASE_RETURN_NO_EXISTS = new ErrorCode(1_030_103_004, "生成退货单失败,请重新提交");
  46 + ErrorCode PURCHASE_RETURN_UPDATE_FAIL_APPROVE = new ErrorCode(1_030_103_005, "采购退货单({})已审核,无法修改");
  47 + ErrorCode PURCHASE_RETURN_NOT_APPROVE = new ErrorCode(1_030_103_006, "采购退货单未审核,无法操作");
  48 + ErrorCode PURCHASE_RETURN_FAIL_REFUND_PRICE_EXCEED = new ErrorCode(1_030_103_007, "退款金额({})超过采购退货单总金额({})");
  49 + ErrorCode PURCHASE_RETURN_PROCESS_FAIL_EXISTS_REFUND = new ErrorCode(1_030_103_008, "反审核失败,已存在对应的退款单");
  50 +
  51 + // ========== ERP 客户(1-030-200-000)==========
  52 + ErrorCode CUSTOMER_NOT_EXISTS = new ErrorCode(1_020_200_000, "客户不存在");
  53 + ErrorCode CUSTOMER_NOT_ENABLE = new ErrorCode(1_020_200_001, "客户({})未启用");
  54 +
  55 + // ========== ERP 销售订单(1-030-201-000) ==========
  56 + ErrorCode SALE_ORDER_NOT_EXISTS = new ErrorCode(1_020_201_000, "销售订单不存在");
  57 + ErrorCode SALE_ORDER_DELETE_FAIL_APPROVE = new ErrorCode(1_020_201_001, "销售订单({})已审核,无法删除");
  58 + ErrorCode SALE_ORDER_PROCESS_FAIL = new ErrorCode(1_020_201_002, "反审核失败,只有已审核的销售订单才能反审核");
  59 + ErrorCode SALE_ORDER_APPROVE_FAIL = new ErrorCode(1_020_201_003, "审核失败,只有未审核的销售订单才能审核");
  60 + ErrorCode SALE_ORDER_NO_EXISTS = new ErrorCode(1_020_201_004, "生成销售单号失败,请重新提交");
  61 + ErrorCode SALE_ORDER_UPDATE_FAIL_APPROVE = new ErrorCode(1_020_201_005, "销售订单({})已审核,无法修改");
  62 + ErrorCode SALE_ORDER_NOT_APPROVE = new ErrorCode(1_020_201_006, "销售订单未审核,无法操作");
  63 + ErrorCode SALE_ORDER_ITEM_OUT_FAIL_PRODUCT_EXCEED = new ErrorCode(1_020_201_007, "销售订单项({})超过最大允许出库数量({})");
  64 + ErrorCode SALE_ORDER_PROCESS_FAIL_EXISTS_OUT = new ErrorCode(1_020_201_008, "反审核失败,已存在对应的销售出库单");
  65 + ErrorCode SALE_ORDER_ITEM_RETURN_FAIL_OUT_EXCEED = new ErrorCode(1_020_201_009, "销售订单项({})超过最大允许退货数量({})");
  66 + ErrorCode SALE_ORDER_PROCESS_FAIL_EXISTS_RETURN = new ErrorCode(1_020_201_010, "反审核失败,已存在对应的销售退货单");
  67 +
  68 + // ========== ERP 销售出库(1-030-202-000) ==========
  69 + ErrorCode SALE_OUT_NOT_EXISTS = new ErrorCode(1_020_202_000, "销售出库单不存在");
  70 + ErrorCode SALE_OUT_DELETE_FAIL_APPROVE = new ErrorCode(1_020_202_001, "销售出库单({})已审核,无法删除");
  71 + ErrorCode SALE_OUT_PROCESS_FAIL = new ErrorCode(1_020_202_002, "反审核失败,只有已审核的出库单才能反审核");
  72 + ErrorCode SALE_OUT_APPROVE_FAIL = new ErrorCode(1_020_202_003, "审核失败,只有未审核的出库单才能审核");
  73 + ErrorCode SALE_OUT_NO_EXISTS = new ErrorCode(1_020_202_004, "生成出库单失败,请重新提交");
  74 + ErrorCode SALE_OUT_UPDATE_FAIL_APPROVE = new ErrorCode(1_020_202_005, "销售出库单({})已审核,无法修改");
  75 +
  76 + // ========== ERP 销售退货(1-030-203-000) ==========
  77 + ErrorCode SALE_RETURN_NOT_EXISTS = new ErrorCode(1_020_203_000, "销售退货单不存在");
  78 + ErrorCode SALE_RETURN_DELETE_FAIL_APPROVE = new ErrorCode(1_020_203_001, "销售退货单({})已审核,无法删除");
  79 + ErrorCode SALE_RETURN_PROCESS_FAIL = new ErrorCode(1_020_203_002, "反审核失败,只有已审核的退货单才能反审核");
  80 + ErrorCode SALE_RETURN_APPROVE_FAIL = new ErrorCode(1_020_203_003, "审核失败,只有未审核的退货单才能审核");
  81 + ErrorCode SALE_RETURN_NO_EXISTS = new ErrorCode(1_020_203_004, "生成退货单失败,请重新提交");
  82 + ErrorCode SALE_RETURN_UPDATE_FAIL_APPROVE = new ErrorCode(1_020_203_005, "销售退货单({})已审核,无法修改");
18 83  
19 84 // ========== ERP 仓库 1-030-400-000 ==========
20 85 ErrorCode WAREHOUSE_NOT_EXISTS = new ErrorCode(1_030_400_000, "仓库不存在");
... ... @@ -22,6 +87,39 @@ public interface ErrorCodeConstants {
22 87  
23 88 // ========== ERP 其它入库单 1-030-401-000 ==========
24 89 ErrorCode STOCK_IN_NOT_EXISTS = new ErrorCode(1_030_401_000, "其它入库单不存在");
  90 + ErrorCode STOCK_IN_DELETE_FAIL_APPROVE = new ErrorCode(1_030_401_001, "其它入库单({})已审核,无法删除");
  91 + ErrorCode STOCK_IN_PROCESS_FAIL = new ErrorCode(1_030_401_002, "反审核失败,只有已审核的入库单才能反审核");
  92 + ErrorCode STOCK_IN_APPROVE_FAIL = new ErrorCode(1_030_401_003, "审核失败,只有未审核的入库单才能审核");
  93 + ErrorCode STOCK_IN_NO_EXISTS = new ErrorCode(1_030_401_004, "生成入库单失败,请重新提交");
  94 + ErrorCode STOCK_IN_UPDATE_FAIL_APPROVE = new ErrorCode(1_030_401_005, "其它入库单({})已审核,无法修改");
  95 +
  96 + // ========== ERP 其它出库单 1-030-402-000 ==========
  97 + ErrorCode STOCK_OUT_NOT_EXISTS = new ErrorCode(1_030_402_000, "其它出库单不存在");
  98 + ErrorCode STOCK_OUT_DELETE_FAIL_APPROVE = new ErrorCode(1_030_402_001, "其它出库单({})已审核,无法删除");
  99 + ErrorCode STOCK_OUT_PROCESS_FAIL = new ErrorCode(1_030_402_002, "反审核失败,只有已审核的出库单才能反审核");
  100 + ErrorCode STOCK_OUT_APPROVE_FAIL = new ErrorCode(1_030_402_003, "审核失败,只有未审核的出库单才能审核");
  101 + ErrorCode STOCK_OUT_NO_EXISTS = new ErrorCode(1_030_402_004, "生成出库单失败,请重新提交");
  102 + ErrorCode STOCK_OUT_UPDATE_FAIL_APPROVE = new ErrorCode(1_030_402_005, "其它出库单({})已审核,无法修改");
  103 +
  104 + // ========== ERP 库存调拨单 1-030-403-000 ==========
  105 + ErrorCode STOCK_MOVE_NOT_EXISTS = new ErrorCode(1_030_402_000, "库存调拨单不存在");
  106 + ErrorCode STOCK_MOVE_DELETE_FAIL_APPROVE = new ErrorCode(1_030_402_001, "库存调拨单({})已审核,无法删除");
  107 + ErrorCode STOCK_MOVE_PROCESS_FAIL = new ErrorCode(1_030_402_002, "反审核失败,只有已审核的调拨单才能反审核");
  108 + ErrorCode STOCK_MOVE_APPROVE_FAIL = new ErrorCode(1_030_402_003, "审核失败,只有未审核的调拨单才能审核");
  109 + ErrorCode STOCK_MOVE_NO_EXISTS = new ErrorCode(1_030_402_004, "生成调拨号失败,请重新提交");
  110 + ErrorCode STOCK_MOVE_UPDATE_FAIL_APPROVE = new ErrorCode(1_030_402_005, "库存调拨单({})已审核,无法修改");
  111 +
  112 + // ========== ERP 库存盘点单 1-030-403-000 ==========
  113 + ErrorCode STOCK_CHECK_NOT_EXISTS = new ErrorCode(1_030_403_000, "库存盘点单不存在");
  114 + ErrorCode STOCK_CHECK_DELETE_FAIL_APPROVE = new ErrorCode(1_030_403_001, "库存盘点单({})已审核,无法删除");
  115 + ErrorCode STOCK_CHECK_PROCESS_FAIL = new ErrorCode(1_030_403_002, "反审核失败,只有已审核的盘点单才能反审核");
  116 + ErrorCode STOCK_CHECK_APPROVE_FAIL = new ErrorCode(1_030_403_003, "审核失败,只有未审核的盘点单才能审核");
  117 + ErrorCode STOCK_CHECK_NO_EXISTS = new ErrorCode(1_030_403_004, "生成盘点号失败,请重新提交");
  118 + ErrorCode STOCK_CHECK_UPDATE_FAIL_APPROVE = new ErrorCode(1_030_403_005, "库存盘点单({})已审核,无法修改");
  119 +
  120 + // ========== ERP 产品库存 1-030-404-000 ==========
  121 + ErrorCode STOCK_COUNT_NEGATIVE = new ErrorCode(1_030_404_000, "操作失败,产品({})所在仓库({})的库存:{},小于变更数量:{}");
  122 + ErrorCode STOCK_COUNT_NEGATIVE2 = new ErrorCode(1_030_404_001, "操作失败,产品({})所在仓库({})的库存不足");
25 123  
26 124 // ========== ERP 产品 1-030-500-000 ==========
27 125 ErrorCode PRODUCT_NOT_EXISTS = new ErrorCode(1_030_500_000, "产品不存在");
... ... @@ -41,4 +139,16 @@ public interface ErrorCodeConstants {
41 139 ErrorCode PRODUCT_UNIT_NAME_DUPLICATE = new ErrorCode(1_030_502_001, "已存在该名字的产品单位");
42 140 ErrorCode PRODUCT_UNIT_EXITS_PRODUCT = new ErrorCode(1_030_502_002, "存在产品使用该单位,无法删除");
43 141  
  142 + // ========== ERP 结算账户 1-030-600-000 ==========
  143 + ErrorCode ACCOUNT_NOT_EXISTS = new ErrorCode(1_030_600_000, "结算账户不存在");
  144 + ErrorCode ACCOUNT_NOT_ENABLE = new ErrorCode(1_030_600_001, "结算账户({})未启用");
  145 +
  146 + // ========== ERP 付款单 1-030-601-000 ==========
  147 + ErrorCode FINANCE_PAYMENT_NOT_EXISTS = new ErrorCode(1_030_601_000, "付款单不存在");
  148 + ErrorCode FINANCE_PAYMENT_DELETE_FAIL_APPROVE = new ErrorCode(1_030_601_001, "付款单({})已审核,无法删除");
  149 + ErrorCode FINANCE_PAYMENT_PROCESS_FAIL = new ErrorCode(1_030_601_002, "反审核失败,只有已审核的付款单才能反审核");
  150 + ErrorCode FINANCE_PAYMENT_APPROVE_FAIL = new ErrorCode(1_030_601_003, "审核失败,只有未审核的付款单才能审核");
  151 + ErrorCode FINANCE_PAYMENT_NO_EXISTS = new ErrorCode(1_030_601_004, "生成付款单号失败,请重新提交");
  152 + ErrorCode FINANCE_PAYMENT_UPDATE_FAIL_APPROVE = new ErrorCode(1_030_601_005, "付款单({})已审核,无法修改");
  153 +
44 154 }
... ...
yudao-module-erp/yudao-module-erp-api/src/main/java/cn/iocoder/yudao/module/erp/enums/sale/ErpSaleOrderStatusEnum.java renamed to yudao-module-erp/yudao-module-erp-api/src/main/java/cn/iocoder/yudao/module/erp/enums/common/ErpBizTypeEnum.java
1   -package cn.iocoder.yudao.module.erp.enums.sale;
  1 +package cn.iocoder.yudao.module.erp.enums.common;
2 2  
3 3 import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
4   -import lombok.AllArgsConstructor;
5 4 import lombok.Getter;
  5 +import lombok.RequiredArgsConstructor;
6 6  
7 7 import java.util.Arrays;
8 8  
9 9 /**
10   - * ERP 销售订单的状态枚举
  10 + * ERP 业务类型枚举
11 11 *
12   - * @author 芋道源码
  12 + * @author HUIHUI
13 13 */
14   -@AllArgsConstructor
  14 +@RequiredArgsConstructor
15 15 @Getter
16   -public enum ErpSaleOrderStatusEnum implements IntArrayValuable {
  16 +public enum ErpBizTypeEnum implements IntArrayValuable {
17 17  
18   - AUDIT_NONE(0, "未审核"),
19   - AUDIT_PASS(10, "已审核"),
20   - SALE_PART(20, "部分销售"),
21   - SALE_ALL(21, "完成销售"),
  18 + PURCHASE_ORDER(10, "采购订单"),
  19 + PURCHASE_IN(11, "采购入库"),
  20 + PURCHASE_RETURN(12, "采购退货"),
  21 +
  22 + SALE_ORDER(20, "销售订单"),
  23 + SALE_OUT(21, "销售订单"),
  24 + SALE_RETURN(22, "销售退货"),
22 25 ;
23 26  
24   - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ErpSaleOrderStatusEnum::getStatus).toArray();
  27 + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ErpBizTypeEnum::getType).toArray();
25 28  
26 29 /**
27   - * 状态
  30 + * 类型
28 31 */
29   - private final Integer status;
  32 + private final Integer type;
30 33 /**
31   - * 状态名
  34 + * 名称
32 35 */
33 36 private final String name;
34 37  
... ...
yudao-module-erp/yudao-module-erp-api/src/main/java/cn/iocoder/yudao/module/erp/enums/stock/ErpStockRecordBizTypeEnum.java
... ... @@ -20,6 +20,28 @@ public enum ErpStockRecordBizTypeEnum implements IntArrayValuable {
20 20  
21 21 OTHER_OUT(20, "其它出库"),
22 22 OTHER_OUT_CANCEL(21, "其它出库(作废)"),
  23 +
  24 + MOVE_IN(30, "调拨入库"),
  25 + MOVE_IN_CANCEL(31, "调拨入库(作废)"),
  26 + MOVE_OUT(32, "调拨出库"),
  27 + MOVE_OUT_CANCEL(33, "调拨出库(作废)"),
  28 +
  29 + CHECK_MORE_IN(40, "盘盈入库"),
  30 + CHECK_MORE_IN_CANCEL(41, "盘盈入库(作废)"),
  31 + CHECK_LESS_OUT(42, "盘亏出库"),
  32 + CHECK_LESS_OUT_CANCEL(43, "盘亏出库(作废)"),
  33 +
  34 + SALE_OUT(50, "销售出库"),
  35 + SALE_OUT_CANCEL(51, "销售出库(作废)"),
  36 +
  37 + SALE_RETURN(60, "销售退货入库"),
  38 + SALE_RETURN_CANCEL(61, "销售退货入库(作废)"),
  39 +
  40 + PURCHASE_IN(70, "采购入库"),
  41 + PURCHASE_IN_CANCEL(71, "采购入库(作废)"),
  42 +
  43 + PURCHASE_RETURN(80, "采购退货出库"),
  44 + PURCHASE_RETURN_CANCEL(81, "采购退货出库(作废)"),
23 45 ;
24 46  
25 47 public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ErpStockRecordBizTypeEnum::getType).toArray();
... ...
yudao-module-erp/yudao-module-erp-biz/pom.xml
... ... @@ -51,6 +51,11 @@
51 51 <artifactId>yudao-spring-boot-starter-mybatis</artifactId>
52 52 </dependency>
53 53  
  54 + <dependency>
  55 + <groupId>cn.iocoder.boot</groupId>
  56 + <artifactId>yudao-spring-boot-starter-redis</artifactId>
  57 + </dependency>
  58 +
54 59 <!-- 工具类相关 -->
55 60 <dependency>
56 61 <groupId>cn.iocoder.boot</groupId>
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/finance/ErpAccountController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.finance;
  2 +
  3 +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
  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.framework.operatelog.core.annotations.OperateLog;
  10 +import cn.iocoder.yudao.module.erp.controller.admin.finance.vo.account.ErpAccountPageReqVO;
  11 +import cn.iocoder.yudao.module.erp.controller.admin.finance.vo.account.ErpAccountRespVO;
  12 +import cn.iocoder.yudao.module.erp.controller.admin.finance.vo.account.ErpAccountSaveReqVO;
  13 +import cn.iocoder.yudao.module.erp.dal.dataobject.finance.ErpAccountDO;
  14 +import cn.iocoder.yudao.module.erp.service.finance.ErpAccountService;
  15 +import io.swagger.v3.oas.annotations.Operation;
  16 +import io.swagger.v3.oas.annotations.Parameter;
  17 +import io.swagger.v3.oas.annotations.Parameters;
  18 +import io.swagger.v3.oas.annotations.tags.Tag;
  19 +import jakarta.annotation.Resource;
  20 +import jakarta.servlet.http.HttpServletResponse;
  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.*;
  25 +
  26 +import java.io.IOException;
  27 +import java.util.List;
  28 +
  29 +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  30 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
  31 +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
  32 +
  33 +@Tag(name = "管理后台 - ERP 结算账户")
  34 +@RestController
  35 +@RequestMapping("/erp/account")
  36 +@Validated
  37 +public class ErpAccountController {
  38 +
  39 + @Resource
  40 + private ErpAccountService accountService;
  41 +
  42 + @PostMapping("/create")
  43 + @Operation(summary = "创建结算账户")
  44 + @PreAuthorize("@ss.hasPermission('erp:account:create')")
  45 + public CommonResult<Long> createAccount(@Valid @RequestBody ErpAccountSaveReqVO createReqVO) {
  46 + return success(accountService.createAccount(createReqVO));
  47 + }
  48 +
  49 + @PutMapping("/update")
  50 + @Operation(summary = "更新结算账户")
  51 + @PreAuthorize("@ss.hasPermission('erp:account:update')")
  52 + public CommonResult<Boolean> updateAccount(@Valid @RequestBody ErpAccountSaveReqVO updateReqVO) {
  53 + accountService.updateAccount(updateReqVO);
  54 + return success(true);
  55 + }
  56 +
  57 + @PutMapping("/update-default-status")
  58 + @Operation(summary = "更新结算账户默认状态")
  59 + @Parameters({
  60 + @Parameter(name = "id", description = "编号", required = true),
  61 + @Parameter(name = "status", description = "状态", required = true)
  62 + })
  63 + public CommonResult<Boolean> updateAccountDefaultStatus(@RequestParam("id") Long id,
  64 + @RequestParam("defaultStatus") Boolean defaultStatus) {
  65 + accountService.updateAccountDefaultStatus(id, defaultStatus);
  66 + return success(true);
  67 + }
  68 +
  69 + @DeleteMapping("/delete")
  70 + @Operation(summary = "删除结算账户")
  71 + @Parameter(name = "id", description = "编号", required = true)
  72 + @PreAuthorize("@ss.hasPermission('erp:account:delete')")
  73 + public CommonResult<Boolean> deleteAccount(@RequestParam("id") Long id) {
  74 + accountService.deleteAccount(id);
  75 + return success(true);
  76 + }
  77 +
  78 + @GetMapping("/get")
  79 + @Operation(summary = "获得结算账户")
  80 + @Parameter(name = "id", description = "编号", required = true, example = "1024")
  81 + @PreAuthorize("@ss.hasPermission('erp:account:query')")
  82 + public CommonResult<ErpAccountRespVO> getAccount(@RequestParam("id") Long id) {
  83 + ErpAccountDO account = accountService.getAccount(id);
  84 + return success(BeanUtils.toBean(account, ErpAccountRespVO.class));
  85 + }
  86 +
  87 + @GetMapping("/simple-list")
  88 + @Operation(summary = "获得结算账户精简列表", description = "只包含被开启的结算账户,主要用于前端的下拉选项")
  89 + public CommonResult<List<ErpAccountRespVO>> getWarehouseSimpleList() {
  90 + List<ErpAccountDO> list = accountService.getAccountListByStatus(CommonStatusEnum.ENABLE.getStatus());
  91 + return success(convertList(list, account -> new ErpAccountRespVO().setId(account.getId())
  92 + .setName(account.getName()).setDefaultStatus(account.getDefaultStatus())));
  93 + }
  94 +
  95 + @GetMapping("/page")
  96 + @Operation(summary = "获得结算账户分页")
  97 + @PreAuthorize("@ss.hasPermission('erp:account:query')")
  98 + public CommonResult<PageResult<ErpAccountRespVO>> getAccountPage(@Valid ErpAccountPageReqVO pageReqVO) {
  99 + PageResult<ErpAccountDO> pageResult = accountService.getAccountPage(pageReqVO);
  100 + return success(BeanUtils.toBean(pageResult, ErpAccountRespVO.class));
  101 + }
  102 +
  103 + @GetMapping("/export-excel")
  104 + @Operation(summary = "导出结算账户 Excel")
  105 + @PreAuthorize("@ss.hasPermission('erp:account:export')")
  106 + @OperateLog(type = EXPORT)
  107 + public void exportAccountExcel(@Valid ErpAccountPageReqVO pageReqVO,
  108 + HttpServletResponse response) throws IOException {
  109 + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
  110 + List<ErpAccountDO> list = accountService.getAccountPage(pageReqVO).getList();
  111 + // 导出 Excel
  112 + ExcelUtils.write(response, "结算账户.xls", "数据", ErpAccountRespVO.class,
  113 + BeanUtils.toBean(list, ErpAccountRespVO.class));
  114 + }
  115 +
  116 +}
0 117 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/finance/ErpFinancePaymentController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.finance;
  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.PageParam;
  6 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  7 +import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
  8 +import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
  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.framework.operatelog.core.annotations.OperateLog;
  12 +import cn.iocoder.yudao.module.erp.controller.admin.finance.vo.payment.ErpFinancePaymentPageReqVO;
  13 +import cn.iocoder.yudao.module.erp.controller.admin.finance.vo.payment.ErpFinancePaymentRespVO;
  14 +import cn.iocoder.yudao.module.erp.controller.admin.finance.vo.payment.ErpFinancePaymentSaveReqVO;
  15 +import cn.iocoder.yudao.module.erp.dal.dataobject.finance.ErpAccountDO;
  16 +import cn.iocoder.yudao.module.erp.dal.dataobject.finance.ErpFinancePaymentDO;
  17 +import cn.iocoder.yudao.module.erp.dal.dataobject.finance.ErpFinancePaymentItemDO;
  18 +import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpSupplierDO;
  19 +import cn.iocoder.yudao.module.erp.service.finance.ErpAccountService;
  20 +import cn.iocoder.yudao.module.erp.service.finance.ErpFinancePaymentService;
  21 +import cn.iocoder.yudao.module.erp.service.purchase.ErpSupplierService;
  22 +import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
  23 +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
  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.List;
  36 +import java.util.Map;
  37 +import java.util.stream.Stream;
  38 +
  39 +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  40 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
  41 +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
  42 +
  43 +@Tag(name = "管理后台 - ERP 付款单")
  44 +@RestController
  45 +@RequestMapping("/erp/finance-payment")
  46 +@Validated
  47 +public class ErpFinancePaymentController {
  48 +
  49 + @Resource
  50 + private ErpFinancePaymentService financePaymentService;
  51 + @Resource
  52 + private ErpSupplierService supplierService;
  53 + @Resource
  54 + private ErpAccountService accountService;
  55 +
  56 + @Resource
  57 + private AdminUserApi adminUserApi;
  58 +
  59 + @PostMapping("/create")
  60 + @Operation(summary = "创建付款单")
  61 + @PreAuthorize("@ss.hasPermission('erp:finance-payment:create')")
  62 + public CommonResult<Long> createFinancePayment(@Valid @RequestBody ErpFinancePaymentSaveReqVO createReqVO) {
  63 + return success(financePaymentService.createFinancePayment(createReqVO));
  64 + }
  65 +
  66 + @PutMapping("/update")
  67 + @Operation(summary = "更新付款单")
  68 + @PreAuthorize("@ss.hasPermission('erp:finance-payment:update')")
  69 + public CommonResult<Boolean> updateFinancePayment(@Valid @RequestBody ErpFinancePaymentSaveReqVO updateReqVO) {
  70 + financePaymentService.updateFinancePayment(updateReqVO);
  71 + return success(true);
  72 + }
  73 +
  74 + @PutMapping("/update-status")
  75 + @Operation(summary = "更新付款单的状态")
  76 + @PreAuthorize("@ss.hasPermission('erp:finance-payment:update-status')")
  77 + public CommonResult<Boolean> updateFinancePaymentStatus(@RequestParam("id") Long id,
  78 + @RequestParam("status") Integer status) {
  79 + financePaymentService.updateFinancePaymentStatus(id, status);
  80 + return success(true);
  81 + }
  82 +
  83 + @DeleteMapping("/delete")
  84 + @Operation(summary = "删除付款单")
  85 + @Parameter(name = "ids", description = "编号数组", required = true)
  86 + @PreAuthorize("@ss.hasPermission('erp:finance-payment:delete')")
  87 + public CommonResult<Boolean> deleteFinancePayment(@RequestParam("ids") List<Long> ids) {
  88 + financePaymentService.deleteFinancePayment(ids);
  89 + return success(true);
  90 + }
  91 +
  92 + @GetMapping("/get")
  93 + @Operation(summary = "获得付款单")
  94 + @Parameter(name = "id", description = "编号", required = true, example = "1024")
  95 + @PreAuthorize("@ss.hasPermission('erp:finance-payment:query')")
  96 + public CommonResult<ErpFinancePaymentRespVO> getFinancePayment(@RequestParam("id") Long id) {
  97 + ErpFinancePaymentDO payment = financePaymentService.getFinancePayment(id);
  98 + if (payment == null) {
  99 + return success(null);
  100 + }
  101 + List<ErpFinancePaymentItemDO> paymentItemList = financePaymentService.getFinancePaymentItemListByPaymentId(id);
  102 + return success(BeanUtils.toBean(payment, ErpFinancePaymentRespVO.class, financePaymentVO ->
  103 + financePaymentVO.setItems(BeanUtils.toBean(paymentItemList, ErpFinancePaymentRespVO.Item.class))));
  104 + }
  105 +
  106 + @GetMapping("/page")
  107 + @Operation(summary = "获得付款单分页")
  108 + @PreAuthorize("@ss.hasPermission('erp:finance-payment:query')")
  109 + public CommonResult<PageResult<ErpFinancePaymentRespVO>> getFinancePaymentPage(@Valid ErpFinancePaymentPageReqVO pageReqVO) {
  110 + PageResult<ErpFinancePaymentDO> pageResult = financePaymentService.getFinancePaymentPage(pageReqVO);
  111 + return success(buildFinancePaymentVOPageResult(pageResult));
  112 + }
  113 +
  114 + @GetMapping("/export-excel")
  115 + @Operation(summary = "导出付款单 Excel")
  116 + @PreAuthorize("@ss.hasPermission('erp:finance-payment:export')")
  117 + @OperateLog(type = EXPORT)
  118 + public void exportFinancePaymentExcel(@Valid ErpFinancePaymentPageReqVO pageReqVO,
  119 + HttpServletResponse response) throws IOException {
  120 + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
  121 + List<ErpFinancePaymentRespVO> list = buildFinancePaymentVOPageResult(financePaymentService.getFinancePaymentPage(pageReqVO)).getList();
  122 + // 导出 Excel
  123 + ExcelUtils.write(response, "付款单.xls", "数据", ErpFinancePaymentRespVO.class, list);
  124 + }
  125 +
  126 + private PageResult<ErpFinancePaymentRespVO> buildFinancePaymentVOPageResult(PageResult<ErpFinancePaymentDO> pageResult) {
  127 + if (CollUtil.isEmpty(pageResult.getList())) {
  128 + return PageResult.empty(pageResult.getTotal());
  129 + }
  130 + // 1.1 付款项
  131 + List<ErpFinancePaymentItemDO> paymentItemList = financePaymentService.getFinancePaymentItemListByPaymentIds(
  132 + convertSet(pageResult.getList(), ErpFinancePaymentDO::getId));
  133 + Map<Long, List<ErpFinancePaymentItemDO>> financePaymentItemMap = convertMultiMap(paymentItemList, ErpFinancePaymentItemDO::getPaymentId);
  134 + // 1.2 供应商信息
  135 + Map<Long, ErpSupplierDO> supplierMap = supplierService.getSupplierMap(
  136 + convertSet(pageResult.getList(), ErpFinancePaymentDO::getSupplierId));
  137 + // 1.3 结算账户信息
  138 + Map<Long, ErpAccountDO> accountMap = accountService.getAccountMap(
  139 + convertSet(pageResult.getList(), ErpFinancePaymentDO::getAccountId));
  140 + // 1.4 管理员信息
  141 + Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertListByFlatMap(pageResult.getList(),
  142 + contact -> Stream.of(NumberUtils.parseLong(contact.getCreator()), contact.getFinanceUserId())));
  143 + // 2. 开始拼接
  144 + return BeanUtils.toBean(pageResult, ErpFinancePaymentRespVO.class, payment -> {
  145 + payment.setItems(BeanUtils.toBean(financePaymentItemMap.get(payment.getId()), ErpFinancePaymentRespVO.Item.class));
  146 + MapUtils.findAndThen(supplierMap, payment.getSupplierId(), supplier -> payment.setSupplierName(supplier.getName()));
  147 + MapUtils.findAndThen(accountMap, payment.getAccountId(), account -> payment.setAccountName(account.getName()));
  148 + MapUtils.findAndThen(userMap, Long.parseLong(payment.getCreator()), user -> payment.setCreatorName(user.getNickname()));
  149 + MapUtils.findAndThen(userMap, payment.getFinanceUserId(), user -> payment.setFinanceUserName(user.getNickname()));
  150 + });
  151 + }
  152 +
  153 +}
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/finance/vo/account/ErpAccountPageReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.finance.vo.account;
  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 = "管理后台 - ERP 结算账户分页 Request VO")
  10 +@Data
  11 +@EqualsAndHashCode(callSuper = true)
  12 +@ToString(callSuper = true)
  13 +public class ErpAccountPageReqVO extends PageParam {
  14 +
  15 + @Schema(description = "账户编码", example = "A88")
  16 + private String no;
  17 +
  18 + @Schema(description = "账户名称", example = "张三")
  19 + private String name;
  20 +
  21 + @Schema(description = "备注", example = "随便")
  22 + private String remark;
  23 +
  24 +}
0 25 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/finance/vo/account/ErpAccountRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.finance.vo.account;
  2 +
  3 +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
  4 +import cn.iocoder.yudao.module.system.enums.DictTypeConstants;
  5 +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
  6 +import com.alibaba.excel.annotation.ExcelProperty;
  7 +import io.swagger.v3.oas.annotations.media.Schema;
  8 +import lombok.Data;
  9 +
  10 +import java.time.LocalDateTime;
  11 +
  12 +@Schema(description = "管理后台 - ERP 结算账户 Response VO")
  13 +@Data
  14 +@ExcelIgnoreUnannotated
  15 +public class ErpAccountRespVO {
  16 +
  17 + @Schema(description = "结算账户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "28684")
  18 + @ExcelProperty("结算账户编号")
  19 + private Long id;
  20 +
  21 + @Schema(description = "账户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
  22 + @ExcelProperty("账户名称")
  23 + private String name;
  24 +
  25 + @Schema(description = "账户编码", example = "A88")
  26 + @ExcelProperty("账户编码")
  27 + private String no;
  28 +
  29 + @Schema(description = "备注", example = "随便")
  30 + @ExcelProperty("备注")
  31 + private String remark;
  32 +
  33 + @Schema(description = "开启状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
  34 + @ExcelProperty("开启状态")
  35 + @DictFormat(DictTypeConstants.COMMON_STATUS)
  36 + private Integer status;
  37 +
  38 + @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
  39 + @ExcelProperty("排序")
  40 + private Integer sort;
  41 +
  42 + @Schema(description = "是否默认", example = "1")
  43 + @ExcelProperty("是否默认")
  44 + private Boolean defaultStatus;
  45 +
  46 + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
  47 + @ExcelProperty("创建时间")
  48 + private LocalDateTime createTime;
  49 +
  50 +}
0 51 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/finance/vo/account/ErpAccountSaveReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.finance.vo.account;
  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 lombok.Data;
  9 +
  10 +@Schema(description = "管理后台 - ERP 结算账户新增/修改 Request VO")
  11 +@Data
  12 +public class ErpAccountSaveReqVO {
  13 +
  14 + @Schema(description = "结算账户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "28684")
  15 + private Long id;
  16 +
  17 + @Schema(description = "账户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
  18 + @NotEmpty(message = "账户名称不能为空")
  19 + private String name;
  20 +
  21 + @Schema(description = "账户编码", example = "A88")
  22 + private String no;
  23 +
  24 + @Schema(description = "备注", example = "随便")
  25 + private String remark;
  26 +
  27 + @Schema(description = "开启状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
  28 + @NotNull(message = "开启状态不能为空")
  29 + @InEnum(value = CommonStatusEnum.class)
  30 + private Integer status;
  31 +
  32 + @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
  33 + @NotNull(message = "排序不能为空")
  34 + private Integer sort;
  35 +
  36 +}
0 37 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/finance/vo/payment/ErpFinancePaymentPageReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.finance.vo.payment;
  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 = "管理后台 - ERP 付款单分页 Request VO")
  15 +@Data
  16 +@EqualsAndHashCode(callSuper = true)
  17 +@ToString(callSuper = true)
  18 +public class ErpFinancePaymentPageReqVO extends PageParam {
  19 +
  20 + @Schema(description = "采购单编号", example = "XS001")
  21 + private String no;
  22 +
  23 + @Schema(description = "付款时间")
  24 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  25 + private LocalDateTime[] paymentTime;
  26 +
  27 + @Schema(description = "供应商编号", example = "1724")
  28 + private Long supplierId;
  29 +
  30 + @Schema(description = "创建者", example = "666")
  31 + private String creator;
  32 +
  33 + @Schema(description = "财务人员编号", example = "888")
  34 + private String financeUserId;
  35 +
  36 + @Schema(description = "结算账户编号", example = "31189")
  37 + private Long accountId;
  38 +
  39 + @Schema(description = "付款状态", example = "2")
  40 + private Integer status;
  41 +
  42 + @Schema(description = "备注", example = "你猜")
  43 + private String remark;
  44 +
  45 + @Schema(description = "业务编号", example = "123")
  46 + private String bizNo;
  47 +
  48 +}
0 49 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/finance/vo/payment/ErpFinancePaymentRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.finance.vo.payment;
  2 +
  3 +import com.alibaba.excel.annotation.ExcelProperty;
  4 +import io.swagger.v3.oas.annotations.media.Schema;
  5 +import jakarta.validation.constraints.NotNull;
  6 +import lombok.Data;
  7 +
  8 +import java.math.BigDecimal;
  9 +import java.time.LocalDateTime;
  10 +import java.util.List;
  11 +
  12 +@Schema(description = "管理后台 - ERP 付款单 Response VO")
  13 +@Data
  14 +public class ErpFinancePaymentRespVO {
  15 +
  16 + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "23752")
  17 + private Long id;
  18 +
  19 + @Schema(description = "付款单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "FKD888")
  20 + private String no;
  21 +
  22 + @Schema(description = "付款状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
  23 + private Integer status;
  24 +
  25 + @Schema(description = "付款时间", requiredMode = Schema.RequiredMode.REQUIRED)
  26 + private LocalDateTime paymentTime;
  27 +
  28 + @Schema(description = "财务人员编号", example = "19690")
  29 + private Long financeUserId;
  30 + @Schema(description = "财务人员名称", example = "张三")
  31 + private String financeUserName;
  32 +
  33 + @Schema(description = "供应商编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "29399")
  34 + private Long supplierId;
  35 + @Schema(description = "供应商名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "小番茄公司")
  36 + private String supplierName;
  37 +
  38 + @Schema(description = "付款账户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "28989")
  39 + private Long accountId;
  40 + @Schema(description = "付款账户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
  41 + private String accountName;
  42 +
  43 + @Schema(description = "合计价格,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "13832")
  44 + private BigDecimal totalPrice;
  45 +
  46 + @Schema(description = "优惠金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "11600")
  47 + private BigDecimal discountPrice;
  48 +
  49 + @Schema(description = "实际价格,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "10000")
  50 + private BigDecimal paymentPrice;
  51 +
  52 + @Schema(description = "备注", example = "你猜")
  53 + private String remark;
  54 +
  55 + @Schema(description = "创建人", example = "芋道")
  56 + private String creator;
  57 + @Schema(description = "创建人名称", example = "芋道")
  58 + private String creatorName;
  59 +
  60 + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
  61 + @ExcelProperty("创建时间")
  62 + private LocalDateTime createTime;
  63 +
  64 + @Schema(description = "付款项列表", requiredMode = Schema.RequiredMode.REQUIRED)
  65 + private List<Item> items;
  66 +
  67 + @Data
  68 + public static class Item {
  69 +
  70 + @Schema(description = "付款项编号", example = "11756")
  71 + private Long id;
  72 +
  73 + @Schema(description = "业务类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
  74 + private Integer bizType;
  75 +
  76 + @Schema(description = "业务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
  77 + private Long bizId;
  78 +
  79 + @Schema(description = "业务单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
  80 + private String bizNo;
  81 +
  82 + @Schema(description = "应付欠款,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "10000")
  83 + private BigDecimal totalPrice;
  84 +
  85 + @Schema(description = "已付欠款,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "10000")
  86 + private BigDecimal paidPrice;
  87 +
  88 + @Schema(description = "本次付款,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "10000")
  89 + @NotNull(message = "本次付款不能为空")
  90 + private BigDecimal paymentPrice;
  91 +
  92 + @Schema(description = "备注", example = "随便")
  93 + private String remark;
  94 +
  95 + }
  96 +
  97 +}
0 98 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/finance/vo/payment/ErpFinancePaymentSaveReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.finance.vo.payment;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import jakarta.validation.Valid;
  5 +import jakarta.validation.constraints.NotEmpty;
  6 +import jakarta.validation.constraints.NotNull;
  7 +import lombok.Data;
  8 +
  9 +import java.math.BigDecimal;
  10 +import java.time.LocalDateTime;
  11 +import java.util.List;
  12 +
  13 +@Schema(description = "管理后台 - ERP 付款单新增/修改 Request VO")
  14 +@Data
  15 +public class ErpFinancePaymentSaveReqVO {
  16 +
  17 + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "23752")
  18 + private Long id;
  19 +
  20 + @Schema(description = "付款时间", requiredMode = Schema.RequiredMode.REQUIRED)
  21 + @NotNull(message = "付款时间不能为空")
  22 + private LocalDateTime paymentTime;
  23 +
  24 + @Schema(description = "财务人员编号", example = "19690")
  25 + private Long financeUserId;
  26 +
  27 + @Schema(description = "供应商编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "29399")
  28 + @NotNull(message = "供应商编号不能为空")
  29 + private Long supplierId;
  30 +
  31 + @Schema(description = "付款账户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "28989")
  32 + @NotNull(message = "付款账户编号不能为空")
  33 + private Long accountId;
  34 +
  35 + @Schema(description = "优惠金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "11600")
  36 + @NotNull(message = "优惠金额不能为空")
  37 + private BigDecimal discountPrice;
  38 +
  39 + @Schema(description = "备注", example = "你猜")
  40 + private String remark;
  41 +
  42 + @Schema(description = "付款项列表", requiredMode = Schema.RequiredMode.REQUIRED)
  43 + @NotEmpty(message = "付款项列表不能为空")
  44 + @Valid
  45 + private List<Item> items;
  46 +
  47 + @Data
  48 + public static class Item {
  49 +
  50 + @Schema(description = "付款项编号", example = "11756")
  51 + private Long id;
  52 +
  53 + @Schema(description = "业务类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
  54 + @NotNull(message = "业务类型不能为空")
  55 + private Integer bizType;
  56 +
  57 + @Schema(description = "业务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
  58 + @NotNull(message = "业务编号不能为空")
  59 + private Long bizId;
  60 +
  61 + @Schema(description = "已付欠款,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "10000")
  62 + @NotNull(message = "已付欠款不能为空")
  63 + private BigDecimal paidPrice;
  64 +
  65 + @Schema(description = "本次付款,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "10000")
  66 + @NotNull(message = "本次付款不能为空")
  67 + private BigDecimal paymentPrice;
  68 +
  69 + @Schema(description = "备注", example = "随便")
  70 + private String remark;
  71 +
  72 + }
  73 +
  74 +}
0 75 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/ErpPurchaseInController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.purchase;
  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.PageParam;
  6 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  7 +import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
  8 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
  9 +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
  10 +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
  11 +import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO;
  12 +import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.in.ErpPurchaseInPageReqVO;
  13 +import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.in.ErpPurchaseInRespVO;
  14 +import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.in.ErpPurchaseInSaveReqVO;
  15 +import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchaseInDO;
  16 +import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchaseInItemDO;
  17 +import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpSupplierDO;
  18 +import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockDO;
  19 +import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
  20 +import cn.iocoder.yudao.module.erp.service.purchase.ErpPurchaseInService;
  21 +import cn.iocoder.yudao.module.erp.service.purchase.ErpSupplierService;
  22 +import cn.iocoder.yudao.module.erp.service.stock.ErpStockService;
  23 +import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
  24 +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
  25 +import io.swagger.v3.oas.annotations.Operation;
  26 +import io.swagger.v3.oas.annotations.Parameter;
  27 +import io.swagger.v3.oas.annotations.tags.Tag;
  28 +import jakarta.annotation.Resource;
  29 +import jakarta.servlet.http.HttpServletResponse;
  30 +import jakarta.validation.Valid;
  31 +import org.springframework.security.access.prepost.PreAuthorize;
  32 +import org.springframework.validation.annotation.Validated;
  33 +import org.springframework.web.bind.annotation.*;
  34 +
  35 +import java.io.IOException;
  36 +import java.math.BigDecimal;
  37 +import java.util.List;
  38 +import java.util.Map;
  39 +
  40 +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  41 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap;
  42 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
  43 +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
  44 +
  45 +@Tag(name = "管理后台 - ERP 采购入库")
  46 +@RestController
  47 +@RequestMapping("/erp/purchase-in")
  48 +@Validated
  49 +public class ErpPurchaseInController {
  50 +
  51 + @Resource
  52 + private ErpPurchaseInService purchaseInService;
  53 + @Resource
  54 + private ErpStockService stockService;
  55 + @Resource
  56 + private ErpProductService productService;
  57 + @Resource
  58 + private ErpSupplierService supplierService;
  59 +
  60 + @Resource
  61 + private AdminUserApi adminUserApi;
  62 +
  63 + @PostMapping("/create")
  64 + @Operation(summary = "创建采购入库")
  65 + @PreAuthorize("@ss.hasPermission('erp:purchase-in:create')")
  66 + public CommonResult<Long> createPurchaseIn(@Valid @RequestBody ErpPurchaseInSaveReqVO createReqVO) {
  67 + return success(purchaseInService.createPurchaseIn(createReqVO));
  68 + }
  69 +
  70 + @PutMapping("/update")
  71 + @Operation(summary = "更新采购入库")
  72 + @PreAuthorize("@ss.hasPermission('erp:purchase-in:update')")
  73 + public CommonResult<Boolean> updatePurchaseIn(@Valid @RequestBody ErpPurchaseInSaveReqVO updateReqVO) {
  74 + purchaseInService.updatePurchaseIn(updateReqVO);
  75 + return success(true);
  76 + }
  77 +
  78 + @PutMapping("/update-status")
  79 + @Operation(summary = "更新采购入库的状态")
  80 + @PreAuthorize("@ss.hasPermission('erp:purchase-in:update-status')")
  81 + public CommonResult<Boolean> updatePurchaseInStatus(@RequestParam("id") Long id,
  82 + @RequestParam("status") Integer status) {
  83 + purchaseInService.updatePurchaseInStatus(id, status);
  84 + return success(true);
  85 + }
  86 +
  87 + @DeleteMapping("/delete")
  88 + @Operation(summary = "删除采购入库")
  89 + @Parameter(name = "ids", description = "编号数组", required = true)
  90 + @PreAuthorize("@ss.hasPermission('erp:purchase-in:delete')")
  91 + public CommonResult<Boolean> deletePurchaseIn(@RequestParam("ids") List<Long> ids) {
  92 + purchaseInService.deletePurchaseIn(ids);
  93 + return success(true);
  94 + }
  95 +
  96 + @GetMapping("/get")
  97 + @Operation(summary = "获得采购入库")
  98 + @Parameter(name = "id", description = "编号", required = true, example = "1024")
  99 + @PreAuthorize("@ss.hasPermission('erp:purchase-in:query')")
  100 + public CommonResult<ErpPurchaseInRespVO> getPurchaseIn(@RequestParam("id") Long id) {
  101 + ErpPurchaseInDO purchaseIn = purchaseInService.getPurchaseIn(id);
  102 + if (purchaseIn == null) {
  103 + return success(null);
  104 + }
  105 + List<ErpPurchaseInItemDO> purchaseInItemList = purchaseInService.getPurchaseInItemListByInId(id);
  106 + Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
  107 + convertSet(purchaseInItemList, ErpPurchaseInItemDO::getProductId));
  108 + return success(BeanUtils.toBean(purchaseIn, ErpPurchaseInRespVO.class, purchaseInVO ->
  109 + purchaseInVO.setItems(BeanUtils.toBean(purchaseInItemList, ErpPurchaseInRespVO.Item.class, item -> {
  110 + ErpStockDO stock = stockService.getStock(item.getProductId(), item.getWarehouseId());
  111 + item.setStockCount(stock != null ? stock.getCount() : BigDecimal.ZERO);
  112 + MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
  113 + .setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()));
  114 + }))));
  115 + }
  116 +
  117 + @GetMapping("/page")
  118 + @Operation(summary = "获得采购入库分页")
  119 + @PreAuthorize("@ss.hasPermission('erp:purchase-in:query')")
  120 + public CommonResult<PageResult<ErpPurchaseInRespVO>> getPurchaseInPage(@Valid ErpPurchaseInPageReqVO pageReqVO) {
  121 + PageResult<ErpPurchaseInDO> pageResult = purchaseInService.getPurchaseInPage(pageReqVO);
  122 + return success(buildPurchaseInVOPageResult(pageResult));
  123 + }
  124 +
  125 + @GetMapping("/export-excel")
  126 + @Operation(summary = "导出采购入库 Excel")
  127 + @PreAuthorize("@ss.hasPermission('erp:purchase-in:export')")
  128 + @OperateLog(type = EXPORT)
  129 + public void exportPurchaseInExcel(@Valid ErpPurchaseInPageReqVO pageReqVO,
  130 + HttpServletResponse response) throws IOException {
  131 + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
  132 + List<ErpPurchaseInRespVO> list = buildPurchaseInVOPageResult(purchaseInService.getPurchaseInPage(pageReqVO)).getList();
  133 + // 导出 Excel
  134 + ExcelUtils.write(response, "采购入库.xls", "数据", ErpPurchaseInRespVO.class, list);
  135 + }
  136 +
  137 + private PageResult<ErpPurchaseInRespVO> buildPurchaseInVOPageResult(PageResult<ErpPurchaseInDO> pageResult) {
  138 + if (CollUtil.isEmpty(pageResult.getList())) {
  139 + return PageResult.empty(pageResult.getTotal());
  140 + }
  141 + // 1.1 入库项
  142 + List<ErpPurchaseInItemDO> purchaseInItemList = purchaseInService.getPurchaseInItemListByInIds(
  143 + convertSet(pageResult.getList(), ErpPurchaseInDO::getId));
  144 + Map<Long, List<ErpPurchaseInItemDO>> purchaseInItemMap = convertMultiMap(purchaseInItemList, ErpPurchaseInItemDO::getInId);
  145 + // 1.2 产品信息
  146 + Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
  147 + convertSet(purchaseInItemList, ErpPurchaseInItemDO::getProductId));
  148 + // 1.3 供应商信息
  149 + Map<Long, ErpSupplierDO> supplierMap = supplierService.getSupplierMap(
  150 + convertSet(pageResult.getList(), ErpPurchaseInDO::getSupplierId));
  151 + // 1.4 管理员信息
  152 + Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
  153 + convertSet(pageResult.getList(), purchaseIn -> Long.parseLong(purchaseIn.getCreator())));
  154 + // 2. 开始拼接
  155 + return BeanUtils.toBean(pageResult, ErpPurchaseInRespVO.class, purchaseIn -> {
  156 + purchaseIn.setItems(BeanUtils.toBean(purchaseInItemMap.get(purchaseIn.getId()), ErpPurchaseInRespVO.Item.class,
  157 + item -> MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
  158 + .setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()))));
  159 + purchaseIn.setProductNames(CollUtil.join(purchaseIn.getItems(), ",", ErpPurchaseInRespVO.Item::getProductName));
  160 + MapUtils.findAndThen(supplierMap, purchaseIn.getSupplierId(), supplier -> purchaseIn.setSupplierName(supplier.getName()));
  161 + MapUtils.findAndThen(userMap, Long.parseLong(purchaseIn.getCreator()), user -> purchaseIn.setCreatorName(user.getNickname()));
  162 + });
  163 + }
  164 +
  165 +}
0 166 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/ErpPurchaseOrderController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.purchase;
  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.PageParam;
  6 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  7 +import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
  8 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
  9 +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
  10 +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
  11 +import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO;
  12 +import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.order.ErpPurchaseOrderPageReqVO;
  13 +import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.order.ErpPurchaseOrderRespVO;
  14 +import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.order.ErpPurchaseOrderSaveReqVO;
  15 +import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchaseOrderDO;
  16 +import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchaseOrderItemDO;
  17 +import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpSupplierDO;
  18 +import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
  19 +import cn.iocoder.yudao.module.erp.service.purchase.ErpPurchaseOrderService;
  20 +import cn.iocoder.yudao.module.erp.service.purchase.ErpSupplierService;
  21 +import cn.iocoder.yudao.module.erp.service.stock.ErpStockService;
  22 +import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
  23 +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
  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.math.BigDecimal;
  36 +import java.util.List;
  37 +import java.util.Map;
  38 +
  39 +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  40 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap;
  41 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
  42 +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
  43 +
  44 +@Tag(name = "管理后台 - ERP 采购订单")
  45 +@RestController
  46 +@RequestMapping("/erp/purchase-order")
  47 +@Validated
  48 +public class ErpPurchaseOrderController {
  49 +
  50 + @Resource
  51 + private ErpPurchaseOrderService purchaseOrderService;
  52 + @Resource
  53 + private ErpStockService stockService;
  54 + @Resource
  55 + private ErpProductService productService;
  56 + @Resource
  57 + private ErpSupplierService supplierService;
  58 +
  59 + @Resource
  60 + private AdminUserApi adminUserApi;
  61 +
  62 + @PostMapping("/create")
  63 + @Operation(summary = "创建采购订单")
  64 + @PreAuthorize("@ss.hasPermission('erp:purchase-create:create')")
  65 + public CommonResult<Long> createPurchaseOrder(@Valid @RequestBody ErpPurchaseOrderSaveReqVO createReqVO) {
  66 + return success(purchaseOrderService.createPurchaseOrder(createReqVO));
  67 + }
  68 +
  69 + @PutMapping("/update")
  70 + @Operation(summary = "更新采购订单")
  71 + @PreAuthorize("@ss.hasPermission('erp:purchase-create:update')")
  72 + public CommonResult<Boolean> updatePurchaseOrder(@Valid @RequestBody ErpPurchaseOrderSaveReqVO updateReqVO) {
  73 + purchaseOrderService.updatePurchaseOrder(updateReqVO);
  74 + return success(true);
  75 + }
  76 +
  77 + @PutMapping("/update-status")
  78 + @Operation(summary = "更新采购订单的状态")
  79 + @PreAuthorize("@ss.hasPermission('erp:purchase-create:update-status')")
  80 + public CommonResult<Boolean> updatePurchaseOrderStatus(@RequestParam("id") Long id,
  81 + @RequestParam("status") Integer status) {
  82 + purchaseOrderService.updatePurchaseOrderStatus(id, status);
  83 + return success(true);
  84 + }
  85 +
  86 + @DeleteMapping("/delete")
  87 + @Operation(summary = "删除采购订单")
  88 + @Parameter(name = "ids", description = "编号数组", required = true)
  89 + @PreAuthorize("@ss.hasPermission('erp:purchase-create:delete')")
  90 + public CommonResult<Boolean> deletePurchaseOrder(@RequestParam("ids") List<Long> ids) {
  91 + purchaseOrderService.deletePurchaseOrder(ids);
  92 + return success(true);
  93 + }
  94 +
  95 + @GetMapping("/get")
  96 + @Operation(summary = "获得采购订单")
  97 + @Parameter(name = "id", description = "编号", required = true, example = "1024")
  98 + @PreAuthorize("@ss.hasPermission('erp:purchase-create:query')")
  99 + public CommonResult<ErpPurchaseOrderRespVO> getPurchaseOrder(@RequestParam("id") Long id) {
  100 + ErpPurchaseOrderDO purchaseOrder = purchaseOrderService.getPurchaseOrder(id);
  101 + if (purchaseOrder == null) {
  102 + return success(null);
  103 + }
  104 + List<ErpPurchaseOrderItemDO> purchaseOrderItemList = purchaseOrderService.getPurchaseOrderItemListByOrderId(id);
  105 + Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
  106 + convertSet(purchaseOrderItemList, ErpPurchaseOrderItemDO::getProductId));
  107 + return success(BeanUtils.toBean(purchaseOrder, ErpPurchaseOrderRespVO.class, purchaseOrderVO ->
  108 + purchaseOrderVO.setItems(BeanUtils.toBean(purchaseOrderItemList, ErpPurchaseOrderRespVO.Item.class, item -> {
  109 + BigDecimal purchaseCount = stockService.getStockCount(item.getProductId());
  110 + item.setStockCount(purchaseCount != null ? purchaseCount : BigDecimal.ZERO);
  111 + MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
  112 + .setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()));
  113 + }))));
  114 + }
  115 +
  116 + @GetMapping("/page")
  117 + @Operation(summary = "获得采购订单分页")
  118 + @PreAuthorize("@ss.hasPermission('erp:purchase-create:query')")
  119 + public CommonResult<PageResult<ErpPurchaseOrderRespVO>> getPurchaseOrderPage(@Valid ErpPurchaseOrderPageReqVO pageReqVO) {
  120 + PageResult<ErpPurchaseOrderDO> pageResult = purchaseOrderService.getPurchaseOrderPage(pageReqVO);
  121 + return success(buildPurchaseOrderVOPageResult(pageResult));
  122 + }
  123 +
  124 + @GetMapping("/export-excel")
  125 + @Operation(summary = "导出采购订单 Excel")
  126 + @PreAuthorize("@ss.hasPermission('erp:purchase-create:export')")
  127 + @OperateLog(type = EXPORT)
  128 + public void exportPurchaseOrderExcel(@Valid ErpPurchaseOrderPageReqVO pageReqVO,
  129 + HttpServletResponse response) throws IOException {
  130 + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
  131 + List<ErpPurchaseOrderRespVO> list = buildPurchaseOrderVOPageResult(purchaseOrderService.getPurchaseOrderPage(pageReqVO)).getList();
  132 + // 导出 Excel
  133 + ExcelUtils.write(response, "采购订单.xls", "数据", ErpPurchaseOrderRespVO.class, list);
  134 + }
  135 +
  136 + private PageResult<ErpPurchaseOrderRespVO> buildPurchaseOrderVOPageResult(PageResult<ErpPurchaseOrderDO> pageResult) {
  137 + if (CollUtil.isEmpty(pageResult.getList())) {
  138 + return PageResult.empty(pageResult.getTotal());
  139 + }
  140 + // 1.1 订单项
  141 + List<ErpPurchaseOrderItemDO> purchaseOrderItemList = purchaseOrderService.getPurchaseOrderItemListByOrderIds(
  142 + convertSet(pageResult.getList(), ErpPurchaseOrderDO::getId));
  143 + Map<Long, List<ErpPurchaseOrderItemDO>> purchaseOrderItemMap = convertMultiMap(purchaseOrderItemList, ErpPurchaseOrderItemDO::getOrderId);
  144 + // 1.2 产品信息
  145 + Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
  146 + convertSet(purchaseOrderItemList, ErpPurchaseOrderItemDO::getProductId));
  147 + // 1.3 供应商信息
  148 + Map<Long, ErpSupplierDO> supplierMap = supplierService.getSupplierMap(
  149 + convertSet(pageResult.getList(), ErpPurchaseOrderDO::getSupplierId));
  150 + // 1.4 管理员信息
  151 + Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
  152 + convertSet(pageResult.getList(), purchaseOrder -> Long.parseLong(purchaseOrder.getCreator())));
  153 + // 2. 开始拼接
  154 + return BeanUtils.toBean(pageResult, ErpPurchaseOrderRespVO.class, purchaseOrder -> {
  155 + purchaseOrder.setItems(BeanUtils.toBean(purchaseOrderItemMap.get(purchaseOrder.getId()), ErpPurchaseOrderRespVO.Item.class,
  156 + item -> MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
  157 + .setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()))));
  158 + purchaseOrder.setProductNames(CollUtil.join(purchaseOrder.getItems(), ",", ErpPurchaseOrderRespVO.Item::getProductName));
  159 + MapUtils.findAndThen(supplierMap, purchaseOrder.getSupplierId(), supplier -> purchaseOrder.setSupplierName(supplier.getName()));
  160 + MapUtils.findAndThen(userMap, Long.parseLong(purchaseOrder.getCreator()), user -> purchaseOrder.setCreatorName(user.getNickname()));
  161 + });
  162 + }
  163 +
  164 +}
0 165 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/ErpPurchaseReturnController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.purchase;
  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.PageParam;
  6 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  7 +import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
  8 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
  9 +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
  10 +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
  11 +import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO;
  12 +import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.returns.ErpPurchaseReturnPageReqVO;
  13 +import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.returns.ErpPurchaseReturnRespVO;
  14 +import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.returns.ErpPurchaseReturnSaveReqVO;
  15 +import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchaseReturnDO;
  16 +import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchaseReturnItemDO;
  17 +import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpSupplierDO;
  18 +import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockDO;
  19 +import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
  20 +import cn.iocoder.yudao.module.erp.service.purchase.ErpPurchaseReturnService;
  21 +import cn.iocoder.yudao.module.erp.service.purchase.ErpSupplierService;
  22 +import cn.iocoder.yudao.module.erp.service.stock.ErpStockService;
  23 +import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
  24 +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
  25 +import io.swagger.v3.oas.annotations.Operation;
  26 +import io.swagger.v3.oas.annotations.Parameter;
  27 +import io.swagger.v3.oas.annotations.tags.Tag;
  28 +import jakarta.annotation.Resource;
  29 +import jakarta.servlet.http.HttpServletResponse;
  30 +import jakarta.validation.Valid;
  31 +import org.springframework.security.access.prepost.PreAuthorize;
  32 +import org.springframework.validation.annotation.Validated;
  33 +import org.springframework.web.bind.annotation.*;
  34 +
  35 +import java.io.IOException;
  36 +import java.math.BigDecimal;
  37 +import java.util.List;
  38 +import java.util.Map;
  39 +
  40 +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  41 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap;
  42 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
  43 +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
  44 +
  45 +@Tag(name = "管理后台 - ERP 采购退货")
  46 +@RestController
  47 +@RequestMapping("/erp/purchase-return")
  48 +@Validated
  49 +public class ErpPurchaseReturnController {
  50 +
  51 + @Resource
  52 + private ErpPurchaseReturnService purchaseReturnService;
  53 + @Resource
  54 + private ErpStockService stockService;
  55 + @Resource
  56 + private ErpProductService productService;
  57 + @Resource
  58 + private ErpSupplierService supplierService;
  59 +
  60 + @Resource
  61 + private AdminUserApi adminUserApi;
  62 +
  63 + @PostMapping("/create")
  64 + @Operation(summary = "创建采购退货")
  65 + @PreAuthorize("@ss.hasPermission('erp:purchase-return:create')")
  66 + public CommonResult<Long> createPurchaseReturn(@Valid @RequestBody ErpPurchaseReturnSaveReqVO createReqVO) {
  67 + return success(purchaseReturnService.createPurchaseReturn(createReqVO));
  68 + }
  69 +
  70 + @PutMapping("/update")
  71 + @Operation(summary = "更新采购退货")
  72 + @PreAuthorize("@ss.hasPermission('erp:purchase-return:update')")
  73 + public CommonResult<Boolean> updatePurchaseReturn(@Valid @RequestBody ErpPurchaseReturnSaveReqVO updateReqVO) {
  74 + purchaseReturnService.updatePurchaseReturn(updateReqVO);
  75 + return success(true);
  76 + }
  77 +
  78 + @PutMapping("/update-status")
  79 + @Operation(summary = "更新采购退货的状态")
  80 + @PreAuthorize("@ss.hasPermission('erp:purchase-return:update-status')")
  81 + public CommonResult<Boolean> updatePurchaseReturnStatus(@RequestParam("id") Long id,
  82 + @RequestParam("status") Integer status) {
  83 + purchaseReturnService.updatePurchaseReturnStatus(id, status);
  84 + return success(true);
  85 + }
  86 +
  87 + @DeleteMapping("/delete")
  88 + @Operation(summary = "删除采购退货")
  89 + @Parameter(name = "ids", description = "编号数组", required = true)
  90 + @PreAuthorize("@ss.hasPermission('erp:purchase-return:delete')")
  91 + public CommonResult<Boolean> deletePurchaseReturn(@RequestParam("ids") List<Long> ids) {
  92 + purchaseReturnService.deletePurchaseReturn(ids);
  93 + return success(true);
  94 + }
  95 +
  96 + @GetMapping("/get")
  97 + @Operation(summary = "获得采购退货")
  98 + @Parameter(name = "id", description = "编号", required = true, example = "1024")
  99 + @PreAuthorize("@ss.hasPermission('erp:purchase-return:query')")
  100 + public CommonResult<ErpPurchaseReturnRespVO> getPurchaseReturn(@RequestParam("id") Long id) {
  101 + ErpPurchaseReturnDO purchaseReturn = purchaseReturnService.getPurchaseReturn(id);
  102 + if (purchaseReturn == null) {
  103 + return success(null);
  104 + }
  105 + List<ErpPurchaseReturnItemDO> purchaseReturnItemList = purchaseReturnService.getPurchaseReturnItemListByReturnId(id);
  106 + Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
  107 + convertSet(purchaseReturnItemList, ErpPurchaseReturnItemDO::getProductId));
  108 + return success(BeanUtils.toBean(purchaseReturn, ErpPurchaseReturnRespVO.class, purchaseReturnVO ->
  109 + purchaseReturnVO.setItems(BeanUtils.toBean(purchaseReturnItemList, ErpPurchaseReturnRespVO.Item.class, item -> {
  110 + ErpStockDO stock = stockService.getStock(item.getProductId(), item.getWarehouseId());
  111 + item.setStockCount(stock != null ? stock.getCount() : BigDecimal.ZERO);
  112 + MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
  113 + .setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()));
  114 + }))));
  115 + }
  116 +
  117 + @GetMapping("/page")
  118 + @Operation(summary = "获得采购退货分页")
  119 + @PreAuthorize("@ss.hasPermission('erp:purchase-return:query')")
  120 + public CommonResult<PageResult<ErpPurchaseReturnRespVO>> getPurchaseReturnPage(@Valid ErpPurchaseReturnPageReqVO pageReqVO) {
  121 + PageResult<ErpPurchaseReturnDO> pageResult = purchaseReturnService.getPurchaseReturnPage(pageReqVO);
  122 + return success(buildPurchaseReturnVOPageResult(pageResult));
  123 + }
  124 +
  125 + @GetMapping("/export-excel")
  126 + @Operation(summary = "导出采购退货 Excel")
  127 + @PreAuthorize("@ss.hasPermission('erp:purchase-return:export')")
  128 + @OperateLog(type = EXPORT)
  129 + public void exportPurchaseReturnExcel(@Valid ErpPurchaseReturnPageReqVO pageReqVO,
  130 + HttpServletResponse response) throws IOException {
  131 + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
  132 + List<ErpPurchaseReturnRespVO> list = buildPurchaseReturnVOPageResult(purchaseReturnService.getPurchaseReturnPage(pageReqVO)).getList();
  133 + // 导出 Excel
  134 + ExcelUtils.write(response, "采购退货.xls", "数据", ErpPurchaseReturnRespVO.class, list);
  135 + }
  136 +
  137 + private PageResult<ErpPurchaseReturnRespVO> buildPurchaseReturnVOPageResult(PageResult<ErpPurchaseReturnDO> pageResult) {
  138 + if (CollUtil.isEmpty(pageResult.getList())) {
  139 + return PageResult.empty(pageResult.getTotal());
  140 + }
  141 + // 1.1 退货项
  142 + List<ErpPurchaseReturnItemDO> purchaseReturnItemList = purchaseReturnService.getPurchaseReturnItemListByReturnIds(
  143 + convertSet(pageResult.getList(), ErpPurchaseReturnDO::getId));
  144 + Map<Long, List<ErpPurchaseReturnItemDO>> purchaseReturnItemMap = convertMultiMap(purchaseReturnItemList, ErpPurchaseReturnItemDO::getReturnId);
  145 + // 1.2 产品信息
  146 + Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
  147 + convertSet(purchaseReturnItemList, ErpPurchaseReturnItemDO::getProductId));
  148 + // 1.3 供应商信息
  149 + Map<Long, ErpSupplierDO> supplierMap = supplierService.getSupplierMap(
  150 + convertSet(pageResult.getList(), ErpPurchaseReturnDO::getSupplierId));
  151 + // 1.4 管理员信息
  152 + Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
  153 + convertSet(pageResult.getList(), purchaseReturn -> Long.parseLong(purchaseReturn.getCreator())));
  154 + // 2. 开始拼接
  155 + return BeanUtils.toBean(pageResult, ErpPurchaseReturnRespVO.class, purchaseReturn -> {
  156 + purchaseReturn.setItems(BeanUtils.toBean(purchaseReturnItemMap.get(purchaseReturn.getId()), ErpPurchaseReturnRespVO.Item.class,
  157 + item -> MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
  158 + .setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()))));
  159 + purchaseReturn.setProductNames(CollUtil.join(purchaseReturn.getItems(), ",", ErpPurchaseReturnRespVO.Item::getProductName));
  160 + MapUtils.findAndThen(supplierMap, purchaseReturn.getSupplierId(), supplier -> purchaseReturn.setSupplierName(supplier.getName()));
  161 + MapUtils.findAndThen(userMap, Long.parseLong(purchaseReturn.getCreator()), user -> purchaseReturn.setCreatorName(user.getNickname()));
  162 + });
  163 + }
  164 +
  165 +}
0 166 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/ErpSupplierController.java
... ... @@ -10,7 +10,7 @@ import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
10 10 import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.supplier.ErpSupplierPageReqVO;
11 11 import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.supplier.ErpSupplierRespVO;
12 12 import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.supplier.ErpSupplierSaveReqVO;
13   -import cn.iocoder.yudao.module.erp.dal.dataobject.supplier.ErpSupplierDO;
  13 +import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpSupplierDO;
14 14 import cn.iocoder.yudao.module.erp.service.purchase.ErpSupplierService;
15 15 import io.swagger.v3.oas.annotations.Operation;
16 16 import io.swagger.v3.oas.annotations.Parameter;
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/in/ErpPurchaseInPageReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.in;
  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 = "管理后台 - ERP 采购入库分页 Request VO")
  15 +@Data
  16 +@EqualsAndHashCode(callSuper = true)
  17 +@ToString(callSuper = true)
  18 +public class ErpPurchaseInPageReqVO extends PageParam {
  19 +
  20 + public static final Integer PAYMENT_STATUS_NONE = 0;
  21 + public static final Integer PAYMENT_STATUS_PART = 1;
  22 + public static final Integer PAYMENT_STATUS_ALL = 2;
  23 +
  24 + @Schema(description = "采购单编号", example = "XS001")
  25 + private String no;
  26 +
  27 + @Schema(description = "供应商编号", example = "1724")
  28 + private Long supplierId;
  29 +
  30 + @Schema(description = "入库时间")
  31 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  32 + private LocalDateTime[] inTime;
  33 +
  34 + @Schema(description = "备注", example = "你猜")
  35 + private String remark;
  36 +
  37 + @Schema(description = "入库状态", example = "2")
  38 + private Integer status;
  39 +
  40 + @Schema(description = "创建者")
  41 + private String creator;
  42 +
  43 + @Schema(description = "产品编号", example = "1")
  44 + private Long productId;
  45 +
  46 + @Schema(description = "仓库编号", example = "1")
  47 + private Long warehouseId;
  48 +
  49 + @Schema(description = "结算账号编号", example = "1")
  50 + private Long accountId;
  51 +
  52 + @Schema(description = "付款状态", example = "1")
  53 + private Integer paymentStatus;
  54 +
  55 + @Schema(description = "是否可付款", example = "true")
  56 + private Boolean paymentEnable; // 对应 paymentStatus = [0, 1]
  57 +
  58 + @Schema(description = "采购单号", example = "1")
  59 + private String orderNo;
  60 +
  61 +}
0 62 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/in/ErpPurchaseInRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.in;
  2 +
  3 +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
  4 +import com.alibaba.excel.annotation.ExcelProperty;
  5 +import io.swagger.v3.oas.annotations.media.Schema;
  6 +import jakarta.validation.constraints.NotNull;
  7 +import lombok.Data;
  8 +
  9 +import java.math.BigDecimal;
  10 +import java.time.LocalDateTime;
  11 +import java.util.List;
  12 +
  13 +@Schema(description = "管理后台 - ERP 采购入库 Response VO")
  14 +@Data
  15 +@ExcelIgnoreUnannotated
  16 +public class ErpPurchaseInRespVO {
  17 +
  18 + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17386")
  19 + @ExcelProperty("编号")
  20 + private Long id;
  21 +
  22 + @Schema(description = "入库单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "XS001")
  23 + @ExcelProperty("入库单编号")
  24 + private String no;
  25 +
  26 + @Schema(description = "入库状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
  27 + @ExcelProperty("入库状态")
  28 + private Integer status;
  29 +
  30 + @Schema(description = "供应商编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1724")
  31 + private Long supplierId;
  32 + @Schema(description = "供应商名称", example = "芋道")
  33 + @ExcelProperty("供应商名称")
  34 + private String supplierName;
  35 +
  36 + @Schema(description = "结算账户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "311.89")
  37 + @ExcelProperty("结算账户编号")
  38 + private Long accountId;
  39 +
  40 + @Schema(description = "入库时间", requiredMode = Schema.RequiredMode.REQUIRED)
  41 + @ExcelProperty("入库时间")
  42 + private LocalDateTime inTime;
  43 +
  44 + @Schema(description = "采购订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17386")
  45 + private Long orderId;
  46 + @Schema(description = "采购订单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "XS001")
  47 + private String orderNo;
  48 +
  49 + @Schema(description = "合计数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "15663")
  50 + @ExcelProperty("合计数量")
  51 + private BigDecimal totalCount;
  52 + @Schema(description = "最终合计价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
  53 + @ExcelProperty("最终合计价格")
  54 + private BigDecimal totalPrice;
  55 + @Schema(description = "已付款金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
  56 + private BigDecimal paymentPrice;
  57 +
  58 + @Schema(description = "合计产品价格,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
  59 + private BigDecimal totalProductPrice;
  60 +
  61 + @Schema(description = "合计税额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
  62 + private BigDecimal totalTaxPrice;
  63 +
  64 + @Schema(description = "优惠率,百分比", requiredMode = Schema.RequiredMode.REQUIRED, example = "99.88")
  65 + private BigDecimal discountPercent;
  66 +
  67 + @Schema(description = "优惠金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
  68 + private BigDecimal discountPrice;
  69 +
  70 + @Schema(description = "定金金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
  71 + private BigDecimal otherPrice;
  72 +
  73 + @Schema(description = "附件地址", example = "https://www.iocoder.cn")
  74 + @ExcelProperty("附件地址")
  75 + private String fileUrl;
  76 +
  77 + @Schema(description = "备注", example = "你猜")
  78 + @ExcelProperty("备注")
  79 + private String remark;
  80 +
  81 + @Schema(description = "创建人", example = "芋道")
  82 + private String creator;
  83 + @Schema(description = "创建人名称", example = "芋道")
  84 + private String creatorName;
  85 +
  86 + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
  87 + @ExcelProperty("创建时间")
  88 + private LocalDateTime createTime;
  89 +
  90 + @Schema(description = "入库项列表", requiredMode = Schema.RequiredMode.REQUIRED)
  91 + private List<Item> items;
  92 +
  93 + @Schema(description = "产品信息", requiredMode = Schema.RequiredMode.REQUIRED)
  94 + @ExcelProperty("产品信息")
  95 + private String productNames;
  96 +
  97 + @Data
  98 + public static class Item {
  99 +
  100 + @Schema(description = "入库项编号", example = "11756")
  101 + private Long id;
  102 +
  103 + @Schema(description = "采购订单项编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
  104 + private Long orderItemId;
  105 +
  106 + @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  107 + private Long warehouseId;
  108 +
  109 + @Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  110 + private Long productId;
  111 +
  112 + @Schema(description = "产品单位单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  113 + private Long productUnitId;
  114 +
  115 + @Schema(description = "产品单价", example = "100.00")
  116 + private BigDecimal productPrice;
  117 +
  118 + @Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  119 + @NotNull(message = "产品数量不能为空")
  120 + private BigDecimal count;
  121 +
  122 + @Schema(description = "税率,百分比", example = "99.88")
  123 + private BigDecimal taxPercent;
  124 +
  125 + @Schema(description = "税额,单位:元", example = "100.00")
  126 + private BigDecimal taxPrice;
  127 +
  128 + @Schema(description = "备注", example = "随便")
  129 + private String remark;
  130 +
  131 + // ========== 关联字段 ==========
  132 +
  133 + @Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "巧克力")
  134 + private String productName;
  135 + @Schema(description = "产品条码", requiredMode = Schema.RequiredMode.REQUIRED, example = "A9985")
  136 + private String productBarCode;
  137 + @Schema(description = "产品单位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "盒")
  138 + private String productUnitName;
  139 +
  140 + @Schema(description = "库存数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  141 + private BigDecimal stockCount; // 该字段仅仅在“详情”和“编辑”时使用
  142 +
  143 + }
  144 +
  145 +}
0 146 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/in/ErpPurchaseInSaveReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.in;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import jakarta.validation.constraints.NotNull;
  5 +import lombok.Data;
  6 +
  7 +import java.math.BigDecimal;
  8 +import java.time.LocalDateTime;
  9 +import java.util.List;
  10 +
  11 +@Schema(description = "管理后台 - ERP 采购入库新增/修改 Request VO")
  12 +@Data
  13 +public class ErpPurchaseInSaveReqVO {
  14 +
  15 + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17386")
  16 + private Long id;
  17 +
  18 + @Schema(description = "结算账户编号", example = "31189")
  19 + private Long accountId;
  20 +
  21 + @Schema(description = "入库时间", requiredMode = Schema.RequiredMode.REQUIRED)
  22 + @NotNull(message = "入库时间不能为空")
  23 + private LocalDateTime inTime;
  24 +
  25 + @Schema(description = "采购订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17386")
  26 + @NotNull(message = "采购订单编号不能为空")
  27 + private Long orderId;
  28 +
  29 + @Schema(description = "优惠率,百分比", requiredMode = Schema.RequiredMode.REQUIRED, example = "99.88")
  30 + private BigDecimal discountPercent;
  31 +
  32 + @Schema(description = "其它金额,单位:元", example = "7127")
  33 + private BigDecimal otherPrice;
  34 +
  35 + @Schema(description = "附件地址", example = "https://www.iocoder.cn")
  36 + private String fileUrl;
  37 +
  38 + @Schema(description = "备注", example = "你猜")
  39 + private String remark;
  40 +
  41 + @Schema(description = "入库清单列表")
  42 + private List<Item> items;
  43 +
  44 + @Data
  45 + public static class Item {
  46 +
  47 + @Schema(description = "入库项编号", example = "11756")
  48 + private Long id;
  49 +
  50 + @Schema(description = "采购订单项编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
  51 + @NotNull(message = "采购订单项编号不能为空")
  52 + private Long orderItemId;
  53 +
  54 + @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  55 + @NotNull(message = "仓库编号不能为空")
  56 + private Long warehouseId;
  57 +
  58 + @Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  59 + @NotNull(message = "产品编号不能为空")
  60 + private Long productId;
  61 +
  62 + @Schema(description = "产品单位单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  63 + @NotNull(message = "产品单位单位不能为空")
  64 + private Long productUnitId;
  65 +
  66 + @Schema(description = "产品单价", example = "100.00")
  67 + private BigDecimal productPrice;
  68 +
  69 + @Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  70 + @NotNull(message = "产品数量不能为空")
  71 + private BigDecimal count;
  72 +
  73 + @Schema(description = "税率,百分比", example = "99.88")
  74 + private BigDecimal taxPercent;
  75 +
  76 + @Schema(description = "备注", example = "随便")
  77 + private String remark;
  78 +
  79 + }
  80 +
  81 +}
0 82 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/order/ErpPurchaseOrderPageReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.order;
  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 = "管理后台 - ERP 采购订单分页 Request VO")
  15 +@Data
  16 +@EqualsAndHashCode(callSuper = true)
  17 +@ToString(callSuper = true)
  18 +public class ErpPurchaseOrderPageReqVO extends PageParam {
  19 +
  20 + /**
  21 + * 入库状态 - 无
  22 + */
  23 + public static final Integer IN_STATUS_NONE = 0;
  24 + /**
  25 + * 入库状态 - 部分
  26 + */
  27 + public static final Integer IN_STATUS_PART = 1;
  28 + /**
  29 + * 入库状态 - 全部
  30 + */
  31 + public static final Integer IN_STATUS_ALL = 2;
  32 +
  33 + /**
  34 + * 退货状态 - 无
  35 + */
  36 + public static final Integer RETURN_STATUS_NONE = 0;
  37 + /**
  38 + * 退货状态 - 部分
  39 + */
  40 + public static final Integer RETURN_STATUS_PART = 1;
  41 + /**
  42 + * 退货状态 - 全部
  43 + */
  44 + public static final Integer RETURN_STATUS_ALL = 2;
  45 +
  46 + @Schema(description = "采购单编号", example = "XS001")
  47 + private String no;
  48 +
  49 + @Schema(description = "供应商编号", example = "1724")
  50 + private Long supplierId;
  51 +
  52 + @Schema(description = "采购时间")
  53 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  54 + private LocalDateTime[] orderTime;
  55 +
  56 + @Schema(description = "备注", example = "你猜")
  57 + private String remark;
  58 +
  59 + @Schema(description = "采购状态", example = "2")
  60 + private Integer status;
  61 +
  62 + @Schema(description = "创建者")
  63 + private String creator;
  64 +
  65 + @Schema(description = "产品编号", example = "1")
  66 + private Long productId;
  67 +
  68 + @Schema(description = "入库状态", example = "2")
  69 + private Integer inStatus;
  70 +
  71 + @Schema(description = "退货状态", example = "2")
  72 + private Integer returnStatus;
  73 +
  74 + @Schema(description = "是否可入库", example = "true")
  75 + private Boolean inEnable;
  76 +
  77 + @Schema(description = "是否可退货", example = "true")
  78 + private Boolean returnEnable;
  79 +
  80 +}
0 81 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/order/ErpPurchaseOrderRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.order;
  2 +
  3 +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
  4 +import com.alibaba.excel.annotation.ExcelProperty;
  5 +import io.swagger.v3.oas.annotations.media.Schema;
  6 +import jakarta.validation.constraints.NotNull;
  7 +import lombok.Data;
  8 +
  9 +import java.math.BigDecimal;
  10 +import java.time.LocalDateTime;
  11 +import java.util.List;
  12 +
  13 +@Schema(description = "管理后台 - ERP 采购订单 Response VO")
  14 +@Data
  15 +@ExcelIgnoreUnannotated
  16 +public class ErpPurchaseOrderRespVO {
  17 +
  18 + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17386")
  19 + @ExcelProperty("编号")
  20 + private Long id;
  21 +
  22 + @Schema(description = "采购单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "XS001")
  23 + @ExcelProperty("采购单编号")
  24 + private String no;
  25 +
  26 + @Schema(description = "采购状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
  27 + @ExcelProperty("采购状态")
  28 + private Integer status;
  29 +
  30 + @Schema(description = "供应商编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1724")
  31 + private Long supplierId;
  32 + @Schema(description = "供应商名称", example = "芋道")
  33 + @ExcelProperty("供应商名称")
  34 + private String supplierName;
  35 +
  36 + @Schema(description = "结算账户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "311.89")
  37 + @ExcelProperty("结算账户编号")
  38 + private Long accountId;
  39 +
  40 + @Schema(description = "采购时间", requiredMode = Schema.RequiredMode.REQUIRED)
  41 + @ExcelProperty("采购时间")
  42 + private LocalDateTime orderTime;
  43 +
  44 + @Schema(description = "合计数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "15663")
  45 + @ExcelProperty("合计数量")
  46 + private BigDecimal totalCount;
  47 + @Schema(description = "最终合计价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
  48 + @ExcelProperty("最终合计价格")
  49 + private BigDecimal totalPrice;
  50 +
  51 + @Schema(description = "合计产品价格,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
  52 + private BigDecimal totalProductPrice;
  53 +
  54 + @Schema(description = "合计税额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
  55 + private BigDecimal totalTaxPrice;
  56 +
  57 + @Schema(description = "优惠率,百分比", requiredMode = Schema.RequiredMode.REQUIRED, example = "99.88")
  58 + private BigDecimal discountPercent;
  59 +
  60 + @Schema(description = "优惠金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
  61 + private BigDecimal discountPrice;
  62 +
  63 + @Schema(description = "定金金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
  64 + private BigDecimal depositPrice;
  65 +
  66 + @Schema(description = "附件地址", example = "https://www.iocoder.cn")
  67 + @ExcelProperty("附件地址")
  68 + private String fileUrl;
  69 +
  70 + @Schema(description = "备注", example = "你猜")
  71 + @ExcelProperty("备注")
  72 + private String remark;
  73 +
  74 + @Schema(description = "创建人", example = "芋道")
  75 + private String creator;
  76 + @Schema(description = "创建人名称", example = "芋道")
  77 + private String creatorName;
  78 +
  79 + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
  80 + @ExcelProperty("创建时间")
  81 + private LocalDateTime createTime;
  82 +
  83 + @Schema(description = "订单项列表", requiredMode = Schema.RequiredMode.REQUIRED)
  84 + private List<Item> items;
  85 +
  86 + @Schema(description = "产品信息", requiredMode = Schema.RequiredMode.REQUIRED)
  87 + @ExcelProperty("产品信息")
  88 + private String productNames;
  89 +
  90 + // ========== 采购入库 ==========
  91 +
  92 + @Schema(description = "采购入库数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  93 + private BigDecimal inCount;
  94 +
  95 + // ========== 采购退货(出库)) ==========
  96 +
  97 + @Schema(description = "采购退货数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  98 + private BigDecimal returnCount;
  99 +
  100 + @Data
  101 + public static class Item {
  102 +
  103 + @Schema(description = "订单项编号", example = "11756")
  104 + private Long id;
  105 +
  106 + @Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  107 + private Long productId;
  108 +
  109 + @Schema(description = "产品单位单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  110 + private Long productUnitId;
  111 +
  112 + @Schema(description = "产品单价", example = "100.00")
  113 + private BigDecimal productPrice;
  114 +
  115 + @Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  116 + @NotNull(message = "产品数量不能为空")
  117 + private BigDecimal count;
  118 +
  119 + @Schema(description = "税率,百分比", example = "99.88")
  120 + private BigDecimal taxPercent;
  121 +
  122 + @Schema(description = "税额,单位:元", example = "100.00")
  123 + private BigDecimal taxPrice;
  124 +
  125 + @Schema(description = "备注", example = "随便")
  126 + private String remark;
  127 +
  128 + // ========== 采购入库 ==========
  129 +
  130 + @Schema(description = "采购入库数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  131 + private BigDecimal inCount;
  132 +
  133 + // ========== 采购退货(入库)) ==========
  134 +
  135 + @Schema(description = "采购退货数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  136 + private BigDecimal returnCount;
  137 +
  138 + // ========== 关联字段 ==========
  139 +
  140 + @Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "巧克力")
  141 + private String productName;
  142 + @Schema(description = "产品条码", requiredMode = Schema.RequiredMode.REQUIRED, example = "A9985")
  143 + private String productBarCode;
  144 + @Schema(description = "产品单位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "盒")
  145 + private String productUnitName;
  146 +
  147 + @Schema(description = "库存数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  148 + private BigDecimal stockCount; // 该字段仅仅在“详情”和“编辑”时使用
  149 +
  150 + }
  151 +
  152 +}
0 153 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/order/ErpPurchaseOrderSaveReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.order;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import jakarta.validation.constraints.NotNull;
  5 +import lombok.Data;
  6 +
  7 +import java.math.BigDecimal;
  8 +import java.time.LocalDateTime;
  9 +import java.util.List;
  10 +
  11 +@Schema(description = "管理后台 - ERP 采购订单新增/修改 Request VO")
  12 +@Data
  13 +public class ErpPurchaseOrderSaveReqVO {
  14 +
  15 + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17386")
  16 + private Long id;
  17 +
  18 + @Schema(description = "供应商编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1724")
  19 + @NotNull(message = "供应商编号不能为空")
  20 + private Long supplierId;
  21 +
  22 + @Schema(description = "结算账户编号", example = "31189")
  23 + private Long accountId;
  24 +
  25 + @Schema(description = "采购时间", requiredMode = Schema.RequiredMode.REQUIRED)
  26 + @NotNull(message = "采购时间不能为空")
  27 + private LocalDateTime orderTime;
  28 +
  29 + @Schema(description = "优惠率,百分比", requiredMode = Schema.RequiredMode.REQUIRED, example = "99.88")
  30 + private BigDecimal discountPercent;
  31 +
  32 + @Schema(description = "定金金额,单位:元", example = "7127")
  33 + private BigDecimal depositPrice;
  34 +
  35 + @Schema(description = "附件地址", example = "https://www.iocoder.cn")
  36 + private String fileUrl;
  37 +
  38 + @Schema(description = "备注", example = "你猜")
  39 + private String remark;
  40 +
  41 + @Schema(description = "订单清单列表")
  42 + private List<Item> items;
  43 +
  44 + @Data
  45 + public static class Item {
  46 +
  47 + @Schema(description = "订单项编号", example = "11756")
  48 + private Long id;
  49 +
  50 + @Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  51 + @NotNull(message = "产品编号不能为空")
  52 + private Long productId;
  53 +
  54 + @Schema(description = "产品单位单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  55 + @NotNull(message = "产品单位单位不能为空")
  56 + private Long productUnitId;
  57 +
  58 + @Schema(description = "产品单价", example = "100.00")
  59 + private BigDecimal productPrice;
  60 +
  61 + @Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  62 + @NotNull(message = "产品数量不能为空")
  63 + private BigDecimal count;
  64 +
  65 + @Schema(description = "税率,百分比", example = "99.88")
  66 + private BigDecimal taxPercent;
  67 +
  68 + @Schema(description = "备注", example = "随便")
  69 + private String remark;
  70 +
  71 + }
  72 +
  73 +}
0 74 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/returns/ErpPurchaseReturnPageReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.returns;
  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 = "管理后台 - ERP 采购退货分页 Request VO")
  15 +@Data
  16 +@EqualsAndHashCode(callSuper = true)
  17 +@ToString(callSuper = true)
  18 +public class ErpPurchaseReturnPageReqVO extends PageParam {
  19 +
  20 + public static final Integer REFUND_STATUS_NONE = 0;
  21 + public static final Integer REFUND_STATUS_PART = 1;
  22 + public static final Integer REFUND_STATUS_ALL = 2;
  23 +
  24 + @Schema(description = "采购单编号", example = "XS001")
  25 + private String no;
  26 +
  27 + @Schema(description = "供应商编号", example = "1724")
  28 + private Long supplierId;
  29 +
  30 + @Schema(description = "退货时间")
  31 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  32 + private LocalDateTime[] returnTime;
  33 +
  34 + @Schema(description = "备注", example = "你猜")
  35 + private String remark;
  36 +
  37 + @Schema(description = "退货状态", example = "2")
  38 + private Integer status;
  39 +
  40 + @Schema(description = "创建者")
  41 + private String creator;
  42 +
  43 + @Schema(description = "产品编号", example = "1")
  44 + private Long productId;
  45 +
  46 + @Schema(description = "仓库编号", example = "1")
  47 + private Long warehouseId;
  48 +
  49 + @Schema(description = "结算账号编号", example = "1")
  50 + private Long accountId;
  51 +
  52 + @Schema(description = "采购单号", example = "1")
  53 + private String orderNo;
  54 +
  55 + @Schema(description = "退款状态", example = "1")
  56 + private Integer refundStatus;
  57 +
  58 + @Schema(description = "是否可退款", example = "true")
  59 + private Boolean refundEnable; // 对应 refundStatus = [0, 1]
  60 +
  61 +}
0 62 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/returns/ErpPurchaseReturnRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.returns;
  2 +
  3 +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
  4 +import com.alibaba.excel.annotation.ExcelProperty;
  5 +import io.swagger.v3.oas.annotations.media.Schema;
  6 +import jakarta.validation.constraints.NotNull;
  7 +import lombok.Data;
  8 +
  9 +import java.math.BigDecimal;
  10 +import java.time.LocalDateTime;
  11 +import java.util.List;
  12 +
  13 +@Schema(description = "管理后台 - ERP 采购退货 Response VO")
  14 +@Data
  15 +@ExcelIgnoreUnannotated
  16 +public class ErpPurchaseReturnRespVO {
  17 +
  18 + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17386")
  19 + @ExcelProperty("编号")
  20 + private Long id;
  21 +
  22 + @Schema(description = "退货单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "XS001")
  23 + @ExcelProperty("退货单编号")
  24 + private String no;
  25 +
  26 + @Schema(description = "退货状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
  27 + @ExcelProperty("退货状态")
  28 + private Integer status;
  29 +
  30 + @Schema(description = "供应商编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1724")
  31 + private Long supplierId;
  32 + @Schema(description = "供应商名称", example = "芋道")
  33 + @ExcelProperty("供应商名称")
  34 + private String supplierName;
  35 +
  36 + @Schema(description = "结算账户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "311.89")
  37 + @ExcelProperty("结算账户编号")
  38 + private Long accountId;
  39 +
  40 + @Schema(description = "退货时间", requiredMode = Schema.RequiredMode.REQUIRED)
  41 + @ExcelProperty("退货时间")
  42 + private LocalDateTime returnTime;
  43 +
  44 + @Schema(description = "采购订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17386")
  45 + private Long orderId;
  46 + @Schema(description = "采购订单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "XS001")
  47 + private String orderNo;
  48 +
  49 + @Schema(description = "合计数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "15663")
  50 + @ExcelProperty("合计数量")
  51 + private BigDecimal totalCount;
  52 + @Schema(description = "最终合计价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
  53 + @ExcelProperty("最终合计价格")
  54 + private BigDecimal totalPrice;
  55 + @Schema(description = "已退款金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
  56 + private BigDecimal refundPrice;
  57 +
  58 + @Schema(description = "合计产品价格,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
  59 + private BigDecimal totalProductPrice;
  60 +
  61 + @Schema(description = "合计税额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
  62 + private BigDecimal totalTaxPrice;
  63 +
  64 + @Schema(description = "优惠率,百分比", requiredMode = Schema.RequiredMode.REQUIRED, example = "99.88")
  65 + private BigDecimal discountPercent;
  66 +
  67 + @Schema(description = "优惠金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
  68 + private BigDecimal discountPrice;
  69 +
  70 + @Schema(description = "定金金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
  71 + private BigDecimal otherPrice;
  72 +
  73 + @Schema(description = "附件地址", example = "https://www.iocoder.cn")
  74 + @ExcelProperty("附件地址")
  75 + private String fileUrl;
  76 +
  77 + @Schema(description = "备注", example = "你猜")
  78 + @ExcelProperty("备注")
  79 + private String remark;
  80 +
  81 + @Schema(description = "创建人", example = "芋道")
  82 + private String creator;
  83 + @Schema(description = "创建人名称", example = "芋道")
  84 + private String creatorName;
  85 +
  86 + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
  87 + @ExcelProperty("创建时间")
  88 + private LocalDateTime createTime;
  89 +
  90 + @Schema(description = "退货项列表", requiredMode = Schema.RequiredMode.REQUIRED)
  91 + private List<Item> items;
  92 +
  93 + @Schema(description = "产品信息", requiredMode = Schema.RequiredMode.REQUIRED)
  94 + @ExcelProperty("产品信息")
  95 + private String productNames;
  96 +
  97 + @Data
  98 + public static class Item {
  99 +
  100 + @Schema(description = "退货项编号", example = "11756")
  101 + private Long id;
  102 +
  103 + @Schema(description = "采购订单项编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
  104 + private Long orderItemId;
  105 +
  106 + @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  107 + private Long warehouseId;
  108 +
  109 + @Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  110 + private Long productId;
  111 +
  112 + @Schema(description = "产品单位单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  113 + private Long productUnitId;
  114 +
  115 + @Schema(description = "产品单价", example = "100.00")
  116 + private BigDecimal productPrice;
  117 +
  118 + @Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  119 + @NotNull(message = "产品数量不能为空")
  120 + private BigDecimal count;
  121 +
  122 + @Schema(description = "税率,百分比", example = "99.88")
  123 + private BigDecimal taxPercent;
  124 +
  125 + @Schema(description = "税额,单位:元", example = "100.00")
  126 + private BigDecimal taxPrice;
  127 +
  128 + @Schema(description = "备注", example = "随便")
  129 + private String remark;
  130 +
  131 + // ========== 关联字段 ==========
  132 +
  133 + @Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "巧克力")
  134 + private String productName;
  135 + @Schema(description = "产品条码", requiredMode = Schema.RequiredMode.REQUIRED, example = "A9985")
  136 + private String productBarCode;
  137 + @Schema(description = "产品单位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "盒")
  138 + private String productUnitName;
  139 +
  140 + @Schema(description = "库存数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  141 + private BigDecimal stockCount; // 该字段仅仅在“详情”和“编辑”时使用
  142 +
  143 + }
  144 +
  145 +}
0 146 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/returns/ErpPurchaseReturnSaveReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.returns;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import jakarta.validation.constraints.NotNull;
  5 +import lombok.Data;
  6 +
  7 +import java.math.BigDecimal;
  8 +import java.time.LocalDateTime;
  9 +import java.util.List;
  10 +
  11 +@Schema(description = "管理后台 - ERP 采购退货新增/修改 Request VO")
  12 +@Data
  13 +public class ErpPurchaseReturnSaveReqVO {
  14 +
  15 + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17386")
  16 + private Long id;
  17 +
  18 + @Schema(description = "结算账户编号", example = "31189")
  19 + private Long accountId;
  20 +
  21 + @Schema(description = "退货时间", requiredMode = Schema.RequiredMode.REQUIRED)
  22 + @NotNull(message = "退货时间不能为空")
  23 + private LocalDateTime returnTime;
  24 +
  25 + @Schema(description = "采购订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17386")
  26 + @NotNull(message = "采购订单编号不能为空")
  27 + private Long orderId;
  28 +
  29 + @Schema(description = "优惠率,百分比", requiredMode = Schema.RequiredMode.REQUIRED, example = "99.88")
  30 + private BigDecimal discountPercent;
  31 +
  32 + @Schema(description = "其它金额,单位:元", example = "7127")
  33 + private BigDecimal otherPrice;
  34 +
  35 + @Schema(description = "附件地址", example = "https://www.iocoder.cn")
  36 + private String fileUrl;
  37 +
  38 + @Schema(description = "备注", example = "你猜")
  39 + private String remark;
  40 +
  41 + @Schema(description = "退货清单列表")
  42 + private List<Item> items;
  43 +
  44 + @Data
  45 + public static class Item {
  46 +
  47 + @Schema(description = "退货项编号", example = "11756")
  48 + private Long id;
  49 +
  50 + @Schema(description = "采购订单项编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
  51 + @NotNull(message = "采购订单项编号不能为空")
  52 + private Long orderItemId;
  53 +
  54 + @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  55 + @NotNull(message = "仓库编号不能为空")
  56 + private Long warehouseId;
  57 +
  58 + @Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  59 + @NotNull(message = "产品编号不能为空")
  60 + private Long productId;
  61 +
  62 + @Schema(description = "产品单位单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  63 + @NotNull(message = "产品单位单位不能为空")
  64 + private Long productUnitId;
  65 +
  66 + @Schema(description = "产品单价", example = "100.00")
  67 + private BigDecimal productPrice;
  68 +
  69 + @Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  70 + @NotNull(message = "产品数量不能为空")
  71 + private BigDecimal count;
  72 +
  73 + @Schema(description = "税率,百分比", example = "99.88")
  74 + private BigDecimal taxPercent;
  75 +
  76 + @Schema(description = "备注", example = "随便")
  77 + private String remark;
  78 +
  79 + }
  80 +
  81 +}
0 82 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/sale/ErpCustomerController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.sale;
  2 +
  3 +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
  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.framework.operatelog.core.annotations.OperateLog;
  10 +import cn.iocoder.yudao.module.erp.controller.admin.sale.vo.customer.ErpCustomerPageReqVO;
  11 +import cn.iocoder.yudao.module.erp.controller.admin.sale.vo.customer.ErpCustomerRespVO;
  12 +import cn.iocoder.yudao.module.erp.controller.admin.sale.vo.customer.ErpCustomerSaveReqVO;
  13 +import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpCustomerDO;
  14 +import cn.iocoder.yudao.module.erp.service.sale.ErpCustomerService;
  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.common.pojo.CommonResult.success;
  29 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
  30 +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
  31 +
  32 +@Tag(name = "管理后台 - ERP 客户")
  33 +@RestController
  34 +@RequestMapping("/erp/customer")
  35 +@Validated
  36 +public class ErpCustomerController {
  37 +
  38 + @Resource
  39 + private ErpCustomerService customerService;
  40 +
  41 + @PostMapping("/create")
  42 + @Operation(summary = "创建客户")
  43 + @PreAuthorize("@ss.hasPermission('erp:customer:create')")
  44 + public CommonResult<Long> createCustomer(@Valid @RequestBody ErpCustomerSaveReqVO createReqVO) {
  45 + return success(customerService.createCustomer(createReqVO));
  46 + }
  47 +
  48 + @PutMapping("/update")
  49 + @Operation(summary = "更新客户")
  50 + @PreAuthorize("@ss.hasPermission('erp:customer:update')")
  51 + public CommonResult<Boolean> updateCustomer(@Valid @RequestBody ErpCustomerSaveReqVO updateReqVO) {
  52 + customerService.updateCustomer(updateReqVO);
  53 + return success(true);
  54 + }
  55 +
  56 + @DeleteMapping("/delete")
  57 + @Operation(summary = "删除客户")
  58 + @Parameter(name = "id", description = "编号", required = true)
  59 + @PreAuthorize("@ss.hasPermission('erp:customer:delete')")
  60 + public CommonResult<Boolean> deleteCustomer(@RequestParam("id") Long id) {
  61 + customerService.deleteCustomer(id);
  62 + return success(true);
  63 + }
  64 +
  65 + @GetMapping("/get")
  66 + @Operation(summary = "获得客户")
  67 + @Parameter(name = "id", description = "编号", required = true, example = "1024")
  68 + @PreAuthorize("@ss.hasPermission('erp:customer:query')")
  69 + public CommonResult<ErpCustomerRespVO> getCustomer(@RequestParam("id") Long id) {
  70 + ErpCustomerDO customer = customerService.getCustomer(id);
  71 + return success(BeanUtils.toBean(customer, ErpCustomerRespVO.class));
  72 + }
  73 +
  74 + @GetMapping("/page")
  75 + @Operation(summary = "获得客户分页")
  76 + @PreAuthorize("@ss.hasPermission('erp:customer:query')")
  77 + public CommonResult<PageResult<ErpCustomerRespVO>> getCustomerPage(@Valid ErpCustomerPageReqVO pageReqVO) {
  78 + PageResult<ErpCustomerDO> pageResult = customerService.getCustomerPage(pageReqVO);
  79 + return success(BeanUtils.toBean(pageResult, ErpCustomerRespVO.class));
  80 + }
  81 +
  82 + @GetMapping("/simple-list")
  83 + @Operation(summary = "获得客户精简列表", description = "只包含被开启的客户,主要用于前端的下拉选项")
  84 + public CommonResult<List<ErpCustomerRespVO>> getCustomerSimpleList() {
  85 + List<ErpCustomerDO> list = customerService.getCustomerListByStatus(CommonStatusEnum.ENABLE.getStatus());
  86 + return success(convertList(list, customer -> new ErpCustomerRespVO().setId(customer.getId()).setName(customer.getName())));
  87 + }
  88 +
  89 + @GetMapping("/export-excel")
  90 + @Operation(summary = "导出客户 Excel")
  91 + @PreAuthorize("@ss.hasPermission('erp:customer:export')")
  92 + @OperateLog(type = EXPORT)
  93 + public void exportCustomerExcel(@Valid ErpCustomerPageReqVO pageReqVO,
  94 + HttpServletResponse response) throws IOException {
  95 + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
  96 + List<ErpCustomerDO> list = customerService.getCustomerPage(pageReqVO).getList();
  97 + // 导出 Excel
  98 + ExcelUtils.write(response, "客户.xls", "数据", ErpCustomerRespVO.class,
  99 + BeanUtils.toBean(list, ErpCustomerRespVO.class));
  100 + }
  101 +
  102 +}
0 103 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/sale/ErpSaleOrderController.http deleted
1   -### 请求 /transfer
2   -GET {{baseUrl}}/erp/sale-order/demo
3   -Authorization: Bearer {{token}}
4   -tenant-id: {{adminTenentId}}
5 0 \ No newline at end of file
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/sale/ErpSaleOrderController.java
1 1 package cn.iocoder.yudao.module.erp.controller.admin.sale;
2 2  
  3 +import cn.hutool.core.collection.CollUtil;
3 4 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
4 5 import cn.iocoder.yudao.framework.common.pojo.PageParam;
5 6 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  7 +import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
6 8 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
7 9 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
8 10 import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
  11 +import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO;
9 12 import cn.iocoder.yudao.module.erp.controller.admin.sale.vo.order.ErpSaleOrderPageReqVO;
10 13 import cn.iocoder.yudao.module.erp.controller.admin.sale.vo.order.ErpSaleOrderRespVO;
11 14 import cn.iocoder.yudao.module.erp.controller.admin.sale.vo.order.ErpSaleOrderSaveReqVO;
  15 +import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpCustomerDO;
12 16 import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpSaleOrderDO;
  17 +import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpSaleOrderItemDO;
  18 +import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
  19 +import cn.iocoder.yudao.module.erp.service.sale.ErpCustomerService;
13 20 import cn.iocoder.yudao.module.erp.service.sale.ErpSaleOrderService;
  21 +import cn.iocoder.yudao.module.erp.service.stock.ErpStockService;
  22 +import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
  23 +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
14 24 import io.swagger.v3.oas.annotations.Operation;
15 25 import io.swagger.v3.oas.annotations.Parameter;
16 26 import io.swagger.v3.oas.annotations.tags.Tag;
... ... @@ -22,9 +32,13 @@ import org.springframework.validation.annotation.Validated;
22 32 import org.springframework.web.bind.annotation.*;
23 33  
24 34 import java.io.IOException;
  35 +import java.math.BigDecimal;
25 36 import java.util.List;
  37 +import java.util.Map;
26 38  
27 39 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  40 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap;
  41 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
28 42 import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
29 43  
30 44  
... ... @@ -36,65 +50,116 @@ public class ErpSaleOrderController {
36 50  
37 51 @Resource
38 52 private ErpSaleOrderService saleOrderService;
  53 + @Resource
  54 + private ErpStockService stockService;
  55 + @Resource
  56 + private ErpProductService productService;
  57 + @Resource
  58 + private ErpCustomerService customerService;
  59 +
  60 + @Resource
  61 + private AdminUserApi adminUserApi;
39 62  
40   - // TODO 芋艿:待 review
41 63 @PostMapping("/create")
42   - @Operation(summary = "创建ERP 销售订单")
43   - @PreAuthorize("@ss.hasPermission('erp:sale-order:create')")
  64 + @Operation(summary = "创建销售订单")
  65 + @PreAuthorize("@ss.hasPermission('erp:sale-out:create')")
44 66 public CommonResult<Long> createSaleOrder(@Valid @RequestBody ErpSaleOrderSaveReqVO createReqVO) {
45 67 return success(saleOrderService.createSaleOrder(createReqVO));
46 68 }
47 69  
48   - // TODO 芋艿:待 review
49 70 @PutMapping("/update")
50   - @Operation(summary = "更新ERP 销售订单")
51   - @PreAuthorize("@ss.hasPermission('erp:sale-order:update')")
  71 + @Operation(summary = "更新销售订单")
  72 + @PreAuthorize("@ss.hasPermission('erp:sale-out:update')")
52 73 public CommonResult<Boolean> updateSaleOrder(@Valid @RequestBody ErpSaleOrderSaveReqVO updateReqVO) {
53 74 saleOrderService.updateSaleOrder(updateReqVO);
54 75 return success(true);
55 76 }
56 77  
57   - // TODO 芋艿:待 review
  78 + @PutMapping("/update-status")
  79 + @Operation(summary = "更新销售订单的状态")
  80 + @PreAuthorize("@ss.hasPermission('erp:sale-out:update-status')")
  81 + public CommonResult<Boolean> updateSaleOrderStatus(@RequestParam("id") Long id,
  82 + @RequestParam("status") Integer status) {
  83 + saleOrderService.updateSaleOrderStatus(id, status);
  84 + return success(true);
  85 + }
  86 +
58 87 @DeleteMapping("/delete")
59   - @Operation(summary = "删除ERP 销售订单")
60   - @Parameter(name = "id", description = "编号", required = true)
61   - @PreAuthorize("@ss.hasPermission('erp:sale-order:delete')")
62   - public CommonResult<Boolean> deleteSaleOrder(@RequestParam("id") Long id) {
63   - saleOrderService.deleteSaleOrder(id);
  88 + @Operation(summary = "删除销售订单")
  89 + @Parameter(name = "ids", description = "编号数组", required = true)
  90 + @PreAuthorize("@ss.hasPermission('erp:sale-out:delete')")
  91 + public CommonResult<Boolean> deleteSaleOrder(@RequestParam("ids") List<Long> ids) {
  92 + saleOrderService.deleteSaleOrder(ids);
64 93 return success(true);
65 94 }
66 95  
67   - // TODO 芋艿:待 review
68 96 @GetMapping("/get")
69   - @Operation(summary = "获得ERP 销售订单")
  97 + @Operation(summary = "获得销售订单")
70 98 @Parameter(name = "id", description = "编号", required = true, example = "1024")
71   - @PreAuthorize("@ss.hasPermission('erp:sale-order:query')")
  99 + @PreAuthorize("@ss.hasPermission('erp:sale-out:query')")
72 100 public CommonResult<ErpSaleOrderRespVO> getSaleOrder(@RequestParam("id") Long id) {
73 101 ErpSaleOrderDO saleOrder = saleOrderService.getSaleOrder(id);
74   - return success(BeanUtils.toBean(saleOrder, ErpSaleOrderRespVO.class));
  102 + if (saleOrder == null) {
  103 + return success(null);
  104 + }
  105 + List<ErpSaleOrderItemDO> saleOrderItemList = saleOrderService.getSaleOrderItemListByOrderId(id);
  106 + Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
  107 + convertSet(saleOrderItemList, ErpSaleOrderItemDO::getProductId));
  108 + return success(BeanUtils.toBean(saleOrder, ErpSaleOrderRespVO.class, saleOrderVO ->
  109 + saleOrderVO.setItems(BeanUtils.toBean(saleOrderItemList, ErpSaleOrderRespVO.Item.class, item -> {
  110 + BigDecimal stockCount = stockService.getStockCount(item.getProductId());
  111 + item.setStockCount(stockCount != null ? stockCount : BigDecimal.ZERO);
  112 + MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
  113 + .setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()));
  114 + }))));
75 115 }
76 116  
77   - // TODO 芋艿:待 review
78 117 @GetMapping("/page")
79   - @Operation(summary = "获得ERP 销售订单分页")
80   - @PreAuthorize("@ss.hasPermission('erp:sale-order:query')")
  118 + @Operation(summary = "获得销售订单分页")
  119 + @PreAuthorize("@ss.hasPermission('erp:sale-out:query')")
81 120 public CommonResult<PageResult<ErpSaleOrderRespVO>> getSaleOrderPage(@Valid ErpSaleOrderPageReqVO pageReqVO) {
82 121 PageResult<ErpSaleOrderDO> pageResult = saleOrderService.getSaleOrderPage(pageReqVO);
83   - return success(BeanUtils.toBean(pageResult, ErpSaleOrderRespVO.class));
  122 + return success(buildSaleOrderVOPageResult(pageResult));
84 123 }
85 124  
86   - // TODO 芋艿:待 review
87 125 @GetMapping("/export-excel")
88   - @Operation(summary = "导出ERP 销售订单 Excel")
89   - @PreAuthorize("@ss.hasPermission('erp:sale-order:export')")
  126 + @Operation(summary = "导出销售订单 Excel")
  127 + @PreAuthorize("@ss.hasPermission('erp:sale-out:export')")
90 128 @OperateLog(type = EXPORT)
91 129 public void exportSaleOrderExcel(@Valid ErpSaleOrderPageReqVO pageReqVO,
92   - HttpServletResponse response) throws IOException {
  130 + HttpServletResponse response) throws IOException {
93 131 pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
94   - List<ErpSaleOrderDO> list = saleOrderService.getSaleOrderPage(pageReqVO).getList();
  132 + List<ErpSaleOrderRespVO> list = buildSaleOrderVOPageResult(saleOrderService.getSaleOrderPage(pageReqVO)).getList();
95 133 // 导出 Excel
96   - ExcelUtils.write(response, "ERP 销售订单.xls", "数据", ErpSaleOrderRespVO.class,
97   - BeanUtils.toBean(list, ErpSaleOrderRespVO.class));
  134 + ExcelUtils.write(response, "销售订单.xls", "数据", ErpSaleOrderRespVO.class, list);
  135 + }
  136 +
  137 + private PageResult<ErpSaleOrderRespVO> buildSaleOrderVOPageResult(PageResult<ErpSaleOrderDO> pageResult) {
  138 + if (CollUtil.isEmpty(pageResult.getList())) {
  139 + return PageResult.empty(pageResult.getTotal());
  140 + }
  141 + // 1.1 订单项
  142 + List<ErpSaleOrderItemDO> saleOrderItemList = saleOrderService.getSaleOrderItemListByOrderIds(
  143 + convertSet(pageResult.getList(), ErpSaleOrderDO::getId));
  144 + Map<Long, List<ErpSaleOrderItemDO>> saleOrderItemMap = convertMultiMap(saleOrderItemList, ErpSaleOrderItemDO::getOrderId);
  145 + // 1.2 产品信息
  146 + Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
  147 + convertSet(saleOrderItemList, ErpSaleOrderItemDO::getProductId));
  148 + // 1.3 客户信息
  149 + Map<Long, ErpCustomerDO> customerMap = customerService.getCustomerMap(
  150 + convertSet(pageResult.getList(), ErpSaleOrderDO::getCustomerId));
  151 + // 1.4 管理员信息
  152 + Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
  153 + convertSet(pageResult.getList(), saleOrder -> Long.parseLong(saleOrder.getCreator())));
  154 + // 2. 开始拼接
  155 + return BeanUtils.toBean(pageResult, ErpSaleOrderRespVO.class, saleOrder -> {
  156 + saleOrder.setItems(BeanUtils.toBean(saleOrderItemMap.get(saleOrder.getId()), ErpSaleOrderRespVO.Item.class,
  157 + item -> MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
  158 + .setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()))));
  159 + saleOrder.setProductNames(CollUtil.join(saleOrder.getItems(), ",", ErpSaleOrderRespVO.Item::getProductName));
  160 + MapUtils.findAndThen(customerMap, saleOrder.getCustomerId(), supplier -> saleOrder.setCustomerName(supplier.getName()));
  161 + MapUtils.findAndThen(userMap, Long.parseLong(saleOrder.getCreator()), user -> saleOrder.setCreatorName(user.getNickname()));
  162 + });
98 163 }
99 164  
100 165 }
101 166 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/sale/ErpSaleOutController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.sale;
  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.PageParam;
  6 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  7 +import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
  8 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
  9 +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
  10 +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
  11 +import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO;
  12 +import cn.iocoder.yudao.module.erp.controller.admin.sale.vo.out.ErpSaleOutPageReqVO;
  13 +import cn.iocoder.yudao.module.erp.controller.admin.sale.vo.out.ErpSaleOutRespVO;
  14 +import cn.iocoder.yudao.module.erp.controller.admin.sale.vo.out.ErpSaleOutSaveReqVO;
  15 +import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpCustomerDO;
  16 +import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpSaleOutDO;
  17 +import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpSaleOutItemDO;
  18 +import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockDO;
  19 +import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
  20 +import cn.iocoder.yudao.module.erp.service.sale.ErpCustomerService;
  21 +import cn.iocoder.yudao.module.erp.service.sale.ErpSaleOutService;
  22 +import cn.iocoder.yudao.module.erp.service.stock.ErpStockService;
  23 +import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
  24 +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
  25 +import io.swagger.v3.oas.annotations.Operation;
  26 +import io.swagger.v3.oas.annotations.Parameter;
  27 +import io.swagger.v3.oas.annotations.tags.Tag;
  28 +import jakarta.annotation.Resource;
  29 +import jakarta.servlet.http.HttpServletResponse;
  30 +import jakarta.validation.Valid;
  31 +import org.springframework.security.access.prepost.PreAuthorize;
  32 +import org.springframework.validation.annotation.Validated;
  33 +import org.springframework.web.bind.annotation.*;
  34 +
  35 +import java.io.IOException;
  36 +import java.math.BigDecimal;
  37 +import java.util.List;
  38 +import java.util.Map;
  39 +
  40 +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  41 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap;
  42 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
  43 +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
  44 +
  45 +@Tag(name = "管理后台 - ERP 销售出库")
  46 +@RestController
  47 +@RequestMapping("/erp/sale-out")
  48 +@Validated
  49 +public class ErpSaleOutController {
  50 +
  51 + @Resource
  52 + private ErpSaleOutService saleOutService;
  53 + @Resource
  54 + private ErpStockService stockService;
  55 + @Resource
  56 + private ErpProductService productService;
  57 + @Resource
  58 + private ErpCustomerService customerService;
  59 +
  60 + @Resource
  61 + private AdminUserApi adminUserApi;
  62 +
  63 + @PostMapping("/create")
  64 + @Operation(summary = "创建销售出库")
  65 + @PreAuthorize("@ss.hasPermission('erp:sale-out:create')")
  66 + public CommonResult<Long> createSaleOut(@Valid @RequestBody ErpSaleOutSaveReqVO createReqVO) {
  67 + return success(saleOutService.createSaleOut(createReqVO));
  68 + }
  69 +
  70 + @PutMapping("/update")
  71 + @Operation(summary = "更新销售出库")
  72 + @PreAuthorize("@ss.hasPermission('erp:sale-out:update')")
  73 + public CommonResult<Boolean> updateSaleOut(@Valid @RequestBody ErpSaleOutSaveReqVO updateReqVO) {
  74 + saleOutService.updateSaleOut(updateReqVO);
  75 + return success(true);
  76 + }
  77 +
  78 + @PutMapping("/update-status")
  79 + @Operation(summary = "更新销售出库的状态")
  80 + @PreAuthorize("@ss.hasPermission('erp:sale-out:update-status')")
  81 + public CommonResult<Boolean> updateSaleOutStatus(@RequestParam("id") Long id,
  82 + @RequestParam("status") Integer status) {
  83 + saleOutService.updateSaleOutStatus(id, status);
  84 + return success(true);
  85 + }
  86 +
  87 + @DeleteMapping("/delete")
  88 + @Operation(summary = "删除销售出库")
  89 + @Parameter(name = "ids", description = "编号数组", required = true)
  90 + @PreAuthorize("@ss.hasPermission('erp:sale-out:delete')")
  91 + public CommonResult<Boolean> deleteSaleOut(@RequestParam("ids") List<Long> ids) {
  92 + saleOutService.deleteSaleOut(ids);
  93 + return success(true);
  94 + }
  95 +
  96 + @GetMapping("/get")
  97 + @Operation(summary = "获得销售出库")
  98 + @Parameter(name = "id", description = "编号", required = true, example = "1024")
  99 + @PreAuthorize("@ss.hasPermission('erp:sale-out:query')")
  100 + public CommonResult<ErpSaleOutRespVO> getSaleOut(@RequestParam("id") Long id) {
  101 + ErpSaleOutDO saleOut = saleOutService.getSaleOut(id);
  102 + if (saleOut == null) {
  103 + return success(null);
  104 + }
  105 + List<ErpSaleOutItemDO> saleOutItemList = saleOutService.getSaleOutItemListByOutId(id);
  106 + Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
  107 + convertSet(saleOutItemList, ErpSaleOutItemDO::getProductId));
  108 + return success(BeanUtils.toBean(saleOut, ErpSaleOutRespVO.class, saleOutVO ->
  109 + saleOutVO.setItems(BeanUtils.toBean(saleOutItemList, ErpSaleOutRespVO.Item.class, item -> {
  110 + ErpStockDO stock = stockService.getStock(item.getProductId(), item.getWarehouseId());
  111 + item.setStockCount(stock != null ? stock.getCount() : BigDecimal.ZERO);
  112 + MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
  113 + .setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()));
  114 + }))));
  115 + }
  116 +
  117 + @GetMapping("/page")
  118 + @Operation(summary = "获得销售出库分页")
  119 + @PreAuthorize("@ss.hasPermission('erp:sale-out:query')")
  120 + public CommonResult<PageResult<ErpSaleOutRespVO>> getSaleOutPage(@Valid ErpSaleOutPageReqVO pageReqVO) {
  121 + PageResult<ErpSaleOutDO> pageResult = saleOutService.getSaleOutPage(pageReqVO);
  122 + return success(buildSaleOutVOPageResult(pageResult));
  123 + }
  124 +
  125 + @GetMapping("/export-excel")
  126 + @Operation(summary = "导出销售出库 Excel")
  127 + @PreAuthorize("@ss.hasPermission('erp:sale-out:export')")
  128 + @OperateLog(type = EXPORT)
  129 + public void exportSaleOutExcel(@Valid ErpSaleOutPageReqVO pageReqVO,
  130 + HttpServletResponse response) throws IOException {
  131 + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
  132 + List<ErpSaleOutRespVO> list = buildSaleOutVOPageResult(saleOutService.getSaleOutPage(pageReqVO)).getList();
  133 + // 导出 Excel
  134 + ExcelUtils.write(response, "销售出库.xls", "数据", ErpSaleOutRespVO.class, list);
  135 + }
  136 +
  137 + private PageResult<ErpSaleOutRespVO> buildSaleOutVOPageResult(PageResult<ErpSaleOutDO> pageResult) {
  138 + if (CollUtil.isEmpty(pageResult.getList())) {
  139 + return PageResult.empty(pageResult.getTotal());
  140 + }
  141 + // 1.1 出库项
  142 + List<ErpSaleOutItemDO> saleOutItemList = saleOutService.getSaleOutItemListByOutIds(
  143 + convertSet(pageResult.getList(), ErpSaleOutDO::getId));
  144 + Map<Long, List<ErpSaleOutItemDO>> saleOutItemMap = convertMultiMap(saleOutItemList, ErpSaleOutItemDO::getOutId);
  145 + // 1.2 产品信息
  146 + Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
  147 + convertSet(saleOutItemList, ErpSaleOutItemDO::getProductId));
  148 + // 1.3 客户信息
  149 + Map<Long, ErpCustomerDO> customerMap = customerService.getCustomerMap(
  150 + convertSet(pageResult.getList(), ErpSaleOutDO::getCustomerId));
  151 + // 1.4 管理员信息
  152 + Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
  153 + convertSet(pageResult.getList(), stockOut -> Long.parseLong(stockOut.getCreator())));
  154 + // 2. 开始拼接
  155 + return BeanUtils.toBean(pageResult, ErpSaleOutRespVO.class, saleOut -> {
  156 + saleOut.setItems(BeanUtils.toBean(saleOutItemMap.get(saleOut.getId()), ErpSaleOutRespVO.Item.class,
  157 + item -> MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
  158 + .setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()))));
  159 + saleOut.setProductNames(CollUtil.join(saleOut.getItems(), ",", ErpSaleOutRespVO.Item::getProductName));
  160 + MapUtils.findAndThen(customerMap, saleOut.getCustomerId(), supplier -> saleOut.setCustomerName(supplier.getName()));
  161 + MapUtils.findAndThen(userMap, Long.parseLong(saleOut.getCreator()), user -> saleOut.setCreatorName(user.getNickname()));
  162 + });
  163 + }
  164 +
  165 +}
0 166 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/sale/ErpSaleReturnController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.sale;
  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.PageParam;
  6 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  7 +import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
  8 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
  9 +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
  10 +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
  11 +import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO;
  12 +import cn.iocoder.yudao.module.erp.controller.admin.sale.vo.returns.ErpSaleReturnPageReqVO;
  13 +import cn.iocoder.yudao.module.erp.controller.admin.sale.vo.returns.ErpSaleReturnRespVO;
  14 +import cn.iocoder.yudao.module.erp.controller.admin.sale.vo.returns.ErpSaleReturnSaveReqVO;
  15 +import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpCustomerDO;
  16 +import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpSaleReturnDO;
  17 +import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpSaleReturnItemDO;
  18 +import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockDO;
  19 +import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
  20 +import cn.iocoder.yudao.module.erp.service.sale.ErpCustomerService;
  21 +import cn.iocoder.yudao.module.erp.service.sale.ErpSaleReturnService;
  22 +import cn.iocoder.yudao.module.erp.service.stock.ErpStockService;
  23 +import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
  24 +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
  25 +import io.swagger.v3.oas.annotations.Operation;
  26 +import io.swagger.v3.oas.annotations.Parameter;
  27 +import io.swagger.v3.oas.annotations.tags.Tag;
  28 +import jakarta.annotation.Resource;
  29 +import jakarta.servlet.http.HttpServletResponse;
  30 +import jakarta.validation.Valid;
  31 +import org.springframework.security.access.prepost.PreAuthorize;
  32 +import org.springframework.validation.annotation.Validated;
  33 +import org.springframework.web.bind.annotation.*;
  34 +
  35 +import java.io.IOException;
  36 +import java.math.BigDecimal;
  37 +import java.util.List;
  38 +import java.util.Map;
  39 +
  40 +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  41 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap;
  42 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
  43 +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
  44 +
  45 +@Tag(name = "管理后台 - ERP 销售退货")
  46 +@RestController
  47 +@RequestMapping("/erp/sale-return")
  48 +@Validated
  49 +public class ErpSaleReturnController {
  50 +
  51 + @Resource
  52 + private ErpSaleReturnService saleReturnService;
  53 + @Resource
  54 + private ErpStockService stockService;
  55 + @Resource
  56 + private ErpProductService productService;
  57 + @Resource
  58 + private ErpCustomerService customerService;
  59 +
  60 + @Resource
  61 + private AdminUserApi adminUserApi;
  62 +
  63 + @PostMapping("/create")
  64 + @Operation(summary = "创建销售退货")
  65 + @PreAuthorize("@ss.hasPermission('erp:sale-return:create')")
  66 + public CommonResult<Long> createSaleReturn(@Valid @RequestBody ErpSaleReturnSaveReqVO createReqVO) {
  67 + return success(saleReturnService.createSaleReturn(createReqVO));
  68 + }
  69 +
  70 + @PutMapping("/update")
  71 + @Operation(summary = "更新销售退货")
  72 + @PreAuthorize("@ss.hasPermission('erp:sale-return:update')")
  73 + public CommonResult<Boolean> updateSaleReturn(@Valid @RequestBody ErpSaleReturnSaveReqVO updateReqVO) {
  74 + saleReturnService.updateSaleReturn(updateReqVO);
  75 + return success(true);
  76 + }
  77 +
  78 + @PutMapping("/update-status")
  79 + @Operation(summary = "更新销售退货的状态")
  80 + @PreAuthorize("@ss.hasPermission('erp:sale-return:update-status')")
  81 + public CommonResult<Boolean> updateSaleReturnStatus(@RequestParam("id") Long id,
  82 + @RequestParam("status") Integer status) {
  83 + saleReturnService.updateSaleReturnStatus(id, status);
  84 + return success(true);
  85 + }
  86 +
  87 + @DeleteMapping("/delete")
  88 + @Operation(summary = "删除销售退货")
  89 + @Parameter(name = "ids", description = "编号数组", required = true)
  90 + @PreAuthorize("@ss.hasPermission('erp:sale-return:delete')")
  91 + public CommonResult<Boolean> deleteSaleReturn(@RequestParam("ids") List<Long> ids) {
  92 + saleReturnService.deleteSaleReturn(ids);
  93 + return success(true);
  94 + }
  95 +
  96 + @GetMapping("/get")
  97 + @Operation(summary = "获得销售退货")
  98 + @Parameter(name = "id", description = "编号", required = true, example = "1024")
  99 + @PreAuthorize("@ss.hasPermission('erp:sale-return:query')")
  100 + public CommonResult<ErpSaleReturnRespVO> getSaleReturn(@RequestParam("id") Long id) {
  101 + ErpSaleReturnDO saleReturn = saleReturnService.getSaleReturn(id);
  102 + if (saleReturn == null) {
  103 + return success(null);
  104 + }
  105 + List<ErpSaleReturnItemDO> saleReturnItemList = saleReturnService.getSaleReturnItemListByReturnId(id);
  106 + Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
  107 + convertSet(saleReturnItemList, ErpSaleReturnItemDO::getProductId));
  108 + return success(BeanUtils.toBean(saleReturn, ErpSaleReturnRespVO.class, saleReturnVO ->
  109 + saleReturnVO.setItems(BeanUtils.toBean(saleReturnItemList, ErpSaleReturnRespVO.Item.class, item -> {
  110 + ErpStockDO stock = stockService.getStock(item.getProductId(), item.getWarehouseId());
  111 + item.setStockCount(stock != null ? stock.getCount() : BigDecimal.ZERO);
  112 + MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
  113 + .setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()));
  114 + }))));
  115 + }
  116 +
  117 + @GetMapping("/page")
  118 + @Operation(summary = "获得销售退货分页")
  119 + @PreAuthorize("@ss.hasPermission('erp:sale-return:query')")
  120 + public CommonResult<PageResult<ErpSaleReturnRespVO>> getSaleReturnPage(@Valid ErpSaleReturnPageReqVO pageReqVO) {
  121 + PageResult<ErpSaleReturnDO> pageResult = saleReturnService.getSaleReturnPage(pageReqVO);
  122 + return success(buildSaleReturnVOPageResult(pageResult));
  123 + }
  124 +
  125 + @GetMapping("/export-excel")
  126 + @Operation(summary = "导出销售退货 Excel")
  127 + @PreAuthorize("@ss.hasPermission('erp:sale-return:export')")
  128 + @OperateLog(type = EXPORT)
  129 + public void exportSaleReturnExcel(@Valid ErpSaleReturnPageReqVO pageReqVO,
  130 + HttpServletResponse response) throws IOException {
  131 + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
  132 + List<ErpSaleReturnRespVO> list = buildSaleReturnVOPageResult(saleReturnService.getSaleReturnPage(pageReqVO)).getList();
  133 + // 导出 Excel
  134 + ExcelUtils.write(response, "销售退货.xls", "数据", ErpSaleReturnRespVO.class, list);
  135 + }
  136 +
  137 + private PageResult<ErpSaleReturnRespVO> buildSaleReturnVOPageResult(PageResult<ErpSaleReturnDO> pageResult) {
  138 + if (CollUtil.isEmpty(pageResult.getList())) {
  139 + return PageResult.empty(pageResult.getTotal());
  140 + }
  141 + // 1.1 退货项
  142 + List<ErpSaleReturnItemDO> saleReturnItemList = saleReturnService.getSaleReturnItemListByReturnIds(
  143 + convertSet(pageResult.getList(), ErpSaleReturnDO::getId));
  144 + Map<Long, List<ErpSaleReturnItemDO>> saleReturnItemMap = convertMultiMap(saleReturnItemList, ErpSaleReturnItemDO::getReturnId);
  145 + // 1.2 产品信息
  146 + Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
  147 + convertSet(saleReturnItemList, ErpSaleReturnItemDO::getProductId));
  148 + // 1.3 客户信息
  149 + Map<Long, ErpCustomerDO> customerMap = customerService.getCustomerMap(
  150 + convertSet(pageResult.getList(), ErpSaleReturnDO::getCustomerId));
  151 + // 1.4 管理员信息
  152 + Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
  153 + convertSet(pageResult.getList(), saleReturn -> Long.parseLong(saleReturn.getCreator())));
  154 + // 2. 开始拼接
  155 + return BeanUtils.toBean(pageResult, ErpSaleReturnRespVO.class, saleReturn -> {
  156 + saleReturn.setItems(BeanUtils.toBean(saleReturnItemMap.get(saleReturn.getId()), ErpSaleReturnRespVO.Item.class,
  157 + item -> MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
  158 + .setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()))));
  159 + saleReturn.setProductNames(CollUtil.join(saleReturn.getItems(), ",", ErpSaleReturnRespVO.Item::getProductName));
  160 + MapUtils.findAndThen(customerMap, saleReturn.getCustomerId(), supplier -> saleReturn.setCustomerName(supplier.getName()));
  161 + MapUtils.findAndThen(userMap, Long.parseLong(saleReturn.getCreator()), user -> saleReturn.setCreatorName(user.getNickname()));
  162 + });
  163 + }
  164 +
  165 +}
0 166 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/sale/vo/customer/ErpCustomerPageReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.sale.vo.customer;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import io.swagger.v3.oas.annotations.media.Schema;
  6 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
  7 +import java.math.BigDecimal;
  8 +import org.springframework.format.annotation.DateTimeFormat;
  9 +import java.time.LocalDateTime;
  10 +
  11 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
  12 +
  13 +@Schema(description = "管理后台 - ERP 客户分页 Request VO")
  14 +@Data
  15 +@EqualsAndHashCode(callSuper = true)
  16 +@ToString(callSuper = true)
  17 +public class ErpCustomerPageReqVO extends PageParam {
  18 +
  19 + @Schema(description = "客户名称", example = "张三")
  20 + private String name;
  21 +
  22 + @Schema(description = "手机号码", example = "15601691300")
  23 + private String mobile;
  24 +
  25 + @Schema(description = "联系电话", example = "15601691300")
  26 + private String telephone;
  27 +
  28 +}
0 29 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/sale/vo/customer/ErpCustomerRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.sale.vo.customer;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import lombok.*;
  5 +import java.util.*;
  6 +import java.util.*;
  7 +import java.math.BigDecimal;
  8 +import org.springframework.format.annotation.DateTimeFormat;
  9 +import java.time.LocalDateTime;
  10 +import com.alibaba.excel.annotation.*;
  11 +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
  12 +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
  13 +
  14 +@Schema(description = "管理后台 - ERP 客户 Response VO")
  15 +@Data
  16 +@ExcelIgnoreUnannotated
  17 +public class ErpCustomerRespVO {
  18 +
  19 + @Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "27520")
  20 + @ExcelProperty("客户编号")
  21 + private Long id;
  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 contact;
  30 +
  31 + @Schema(description = "手机号码", example = "15601691300")
  32 + @ExcelProperty("手机号码")
  33 + private String mobile;
  34 +
  35 + @Schema(description = "联系电话", example = "15601691300")
  36 + @ExcelProperty("联系电话")
  37 + private String telephone;
  38 +
  39 + @Schema(description = "电子邮箱", example = "7685323@qq.com")
  40 + @ExcelProperty("电子邮箱")
  41 + private String email;
  42 +
  43 + @Schema(description = "传真", example = "20 7123 4567")
  44 + @ExcelProperty("传真")
  45 + private String fax;
  46 +
  47 + @Schema(description = "备注", example = "你猜")
  48 + @ExcelProperty("备注")
  49 + private String remark;
  50 +
  51 + @Schema(description = "开启状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
  52 + @ExcelProperty(value = "开启状态", converter = DictConvert.class)
  53 + @DictFormat("common_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
  54 + private Integer status;
  55 +
  56 + @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
  57 + @ExcelProperty("排序")
  58 + private Integer sort;
  59 +
  60 + @Schema(description = "纳税人识别号", example = "91130803MA098BY05W")
  61 + @ExcelProperty("纳税人识别号")
  62 + private String taxNo;
  63 +
  64 + @Schema(description = "税率", example = "10")
  65 + @ExcelProperty("税率")
  66 + private BigDecimal taxPercent;
  67 +
  68 + @Schema(description = "开户行", example = "芋艿")
  69 + @ExcelProperty("开户行")
  70 + private String bankName;
  71 +
  72 + @Schema(description = "开户账号", example = "622908212277228617")
  73 + @ExcelProperty("开户账号")
  74 + private String bankAccount;
  75 +
  76 + @Schema(description = "开户地址", example = "兴业银行浦东支行")
  77 + @ExcelProperty("开户地址")
  78 + private String bankAddress;
  79 +
  80 + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
  81 + @ExcelProperty("创建时间")
  82 + private LocalDateTime createTime;
  83 +
  84 +}
0 85 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/sale/vo/customer/ErpCustomerSaveReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.sale.vo.customer;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import lombok.*;
  5 +import java.util.*;
  6 +import jakarta.validation.constraints.*;
  7 +import java.math.BigDecimal;
  8 +
  9 +@Schema(description = "管理后台 - ERP 客户新增/修改 Request VO")
  10 +@Data
  11 +public class ErpCustomerSaveReqVO {
  12 +
  13 + @Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "27520")
  14 + private Long id;
  15 +
  16 + @Schema(description = "客户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
  17 + @NotEmpty(message = "客户名称不能为空")
  18 + private String name;
  19 +
  20 + @Schema(description = "联系人", example = "老王")
  21 + private String contact;
  22 +
  23 + @Schema(description = "手机号码", example = "15601691300")
  24 + private String mobile;
  25 +
  26 + @Schema(description = "联系电话", example = "15601691300")
  27 + private String telephone;
  28 +
  29 + @Schema(description = "电子邮箱", example = "7685323@qq.com")
  30 + private String email;
  31 +
  32 + @Schema(description = "传真", example = "20 7123 4567")
  33 + private String fax;
  34 +
  35 + @Schema(description = "备注", example = "你猜")
  36 + private String remark;
  37 +
  38 + @Schema(description = "开启状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
  39 + @NotNull(message = "开启状态不能为空")
  40 + private Integer status;
  41 +
  42 + @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
  43 + @NotNull(message = "排序不能为空")
  44 + private Integer sort;
  45 +
  46 + @Schema(description = "纳税人识别号", example = "91130803MA098BY05W")
  47 + private String taxNo;
  48 +
  49 + @Schema(description = "税率", example = "10")
  50 + private BigDecimal taxPercent;
  51 +
  52 + @Schema(description = "开户行", example = "芋艿")
  53 + private String bankName;
  54 +
  55 + @Schema(description = "开户账号", example = "622908212277228617")
  56 + private String bankAccount;
  57 +
  58 + @Schema(description = "开户地址", example = "兴业银行浦东支行")
  59 + private String bankAddress;
  60 +
  61 +}
0 62 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/sale/vo/order/ErpSaleOrderPageReqVO.java
... ... @@ -17,6 +17,32 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
17 17 @ToString(callSuper = true)
18 18 public class ErpSaleOrderPageReqVO extends PageParam {
19 19  
  20 + /**
  21 + * 出库状态 - 无
  22 + */
  23 + public static final Integer OUT_STATUS_NONE = 0;
  24 + /**
  25 + * 出库状态 - 部分
  26 + */
  27 + public static final Integer OUT_STATUS_PART = 1;
  28 + /**
  29 + * 出库状态 - 全部
  30 + */
  31 + public static final Integer OUT_STATUS_ALL = 2;
  32 +
  33 + /**
  34 + * 退货状态 - 无
  35 + */
  36 + public static final Integer RETURN_STATUS_NONE = 0;
  37 + /**
  38 + * 退货状态 - 部分
  39 + */
  40 + public static final Integer RETURN_STATUS_PART = 1;
  41 + /**
  42 + * 退货状态 - 全部
  43 + */
  44 + public static final Integer RETURN_STATUS_ALL = 2;
  45 +
20 46 @Schema(description = "销售单编号", example = "XS001")
21 47 private String no;
22 48  
... ... @@ -28,7 +54,7 @@ public class ErpSaleOrderPageReqVO extends PageParam {
28 54 private LocalDateTime[] orderTime;
29 55  
30 56 @Schema(description = "备注", example = "你猜")
31   - private String description;
  57 + private String remark;
32 58  
33 59 @Schema(description = "销售状态", example = "2")
34 60 private Integer status;
... ... @@ -36,4 +62,19 @@ public class ErpSaleOrderPageReqVO extends PageParam {
36 62 @Schema(description = "创建者")
37 63 private String creator;
38 64  
  65 + @Schema(description = "产品编号", example = "1")
  66 + private Long productId;
  67 +
  68 + @Schema(description = "出库状态", example = "2")
  69 + private Integer outStatus;
  70 +
  71 + @Schema(description = "退货状态", example = "2")
  72 + private Integer returnStatus;
  73 +
  74 + @Schema(description = "是否可出库", example = "true")
  75 + private Boolean outEnable;
  76 +
  77 + @Schema(description = "是否可退货", example = "true")
  78 + private Boolean returnEnable;
  79 +
39 80 }
40 81 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/sale/vo/order/ErpSaleOrderRespVO.java
... ... @@ -3,12 +3,13 @@ package cn.iocoder.yudao.module.erp.controller.admin.sale.vo.order;
3 3 import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
4 4 import com.alibaba.excel.annotation.ExcelProperty;
5 5 import io.swagger.v3.oas.annotations.media.Schema;
  6 +import jakarta.validation.constraints.NotNull;
6 7 import lombok.Data;
7 8  
8 9 import java.math.BigDecimal;
9 10 import java.time.LocalDateTime;
  11 +import java.util.List;
10 12  
11   -// TODO 芋艿:导出最后搞
12 13 @Schema(description = "管理后台 - ERP 销售订单 Response VO")
13 14 @Data
14 15 @ExcelIgnoreUnannotated
... ... @@ -22,57 +23,133 @@ public class ErpSaleOrderRespVO {
22 23 @ExcelProperty("销售单编号")
23 24 private String no;
24 25  
  26 + @Schema(description = "销售状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
  27 + @ExcelProperty("销售状态")
  28 + private Integer status;
  29 +
25 30 @Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1724")
26   - @ExcelProperty("客户编号")
27 31 private Long customerId;
  32 + @Schema(description = "客户名称", example = "芋道")
  33 + @ExcelProperty("客户名称")
  34 + private String customerName;
  35 +
  36 + @Schema(description = "结算账户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "311.89")
  37 + @ExcelProperty("结算账户编号")
  38 + private Long accountId;
  39 +
  40 + @Schema(description = "销售员编号", example = "1888")
  41 + private Long saleUserId;
28 42  
29 43 @Schema(description = "下单时间", requiredMode = Schema.RequiredMode.REQUIRED)
30 44 @ExcelProperty("下单时间")
31 45 private LocalDateTime orderTime;
32 46  
33   - // TODO 芋艿:example 后面
34   - @Schema(description = "销售员编号数组")
35   - @ExcelProperty("销售员编号数组")
36   - private String salePersonIds;
37   -
38   - @Schema(description = "合计价格,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "26094")
39   - @ExcelProperty("合计价格,单位:元")
  47 + @Schema(description = "合计数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "15663")
  48 + @ExcelProperty("合计数量")
  49 + private BigDecimal totalCount;
  50 + @Schema(description = "最终合计价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
  51 + @ExcelProperty("最终合计价格")
40 52 private BigDecimal totalPrice;
41 53  
  54 + @Schema(description = "合计产品价格,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
  55 + private BigDecimal totalProductPrice;
  56 +
  57 + @Schema(description = "合计税额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
  58 + private BigDecimal totalTaxPrice;
  59 +
42 60 @Schema(description = "优惠率,百分比", requiredMode = Schema.RequiredMode.REQUIRED, example = "99.88")
43   - @ExcelProperty("优惠率,百分比")
44 61 private BigDecimal discountPercent;
45 62  
46   - @Schema(description = "优惠金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "44.52")
47   - @ExcelProperty("优惠金额,单位:元")
  63 + @Schema(description = "优惠金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
48 64 private BigDecimal discountPrice;
49 65  
50   - @Schema(description = "支付金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "322.40")
51   - @ExcelProperty("支付金额,单位:元")
52   - private BigDecimal payPrice;
53   -
54   - @Schema(description = "定金金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "71.27")
55   - @ExcelProperty("定金金额,单位:元")
  66 + @Schema(description = "定金金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
56 67 private BigDecimal depositPrice;
57 68  
58 69 @Schema(description = "附件地址", example = "https://www.iocoder.cn")
59 70 @ExcelProperty("附件地址")
60 71 private String fileUrl;
61 72  
62   - @Schema(description = "结算账户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "311.89")
63   - @ExcelProperty("结算账户编号")
64   - private Long accountId;
65   -
66 73 @Schema(description = "备注", example = "你猜")
67 74 @ExcelProperty("备注")
68   - private String description;
  75 + private String remark;
69 76  
70   - @Schema(description = "销售状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
71   - @ExcelProperty("销售状态")
72   - private Integer status;
  77 + @Schema(description = "创建人", example = "芋道")
  78 + private String creator;
  79 + @Schema(description = "创建人名称", example = "芋道")
  80 + private String creatorName;
73 81  
74 82 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
75 83 @ExcelProperty("创建时间")
76 84 private LocalDateTime createTime;
77 85  
  86 + @Schema(description = "订单项列表", requiredMode = Schema.RequiredMode.REQUIRED)
  87 + private List<Item> items;
  88 +
  89 + @Schema(description = "产品信息", requiredMode = Schema.RequiredMode.REQUIRED)
  90 + @ExcelProperty("产品信息")
  91 + private String productNames;
  92 +
  93 + // ========== 销售出库 ==========
  94 +
  95 + @Schema(description = "销售出库数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  96 + private BigDecimal outCount;
  97 +
  98 + // ========== 销售退货(出库)) ==========
  99 +
  100 + @Schema(description = "销售退货数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  101 + private BigDecimal returnCount;
  102 +
  103 + @Data
  104 + public static class Item {
  105 +
  106 + @Schema(description = "订单项编号", example = "11756")
  107 + private Long id;
  108 +
  109 + @Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  110 + private Long productId;
  111 +
  112 + @Schema(description = "产品单位单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  113 + private Long productUnitId;
  114 +
  115 + @Schema(description = "产品单价", example = "100.00")
  116 + private BigDecimal productPrice;
  117 +
  118 + @Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  119 + @NotNull(message = "产品数量不能为空")
  120 + private BigDecimal count;
  121 +
  122 + @Schema(description = "税率,百分比", example = "99.88")
  123 + private BigDecimal taxPercent;
  124 +
  125 + @Schema(description = "税额,单位:元", example = "100.00")
  126 + private BigDecimal taxPrice;
  127 +
  128 + @Schema(description = "备注", example = "随便")
  129 + private String remark;
  130 +
  131 + // ========== 销售出库 ==========
  132 +
  133 + @Schema(description = "销售出库数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  134 + private BigDecimal outCount;
  135 +
  136 + // ========== 销售退货(入库)) ==========
  137 +
  138 + @Schema(description = "销售退货数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  139 + private BigDecimal returnCount;
  140 +
  141 + // ========== 关联字段 ==========
  142 +
  143 + @Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "巧克力")
  144 + private String productName;
  145 + @Schema(description = "产品条码", requiredMode = Schema.RequiredMode.REQUIRED, example = "A9985")
  146 + private String productBarCode;
  147 + @Schema(description = "产品单位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "盒")
  148 + private String productUnitName;
  149 +
  150 + @Schema(description = "库存数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  151 + private BigDecimal stockCount; // 该字段仅仅在“详情”和“编辑”时使用
  152 +
  153 + }
  154 +
78 155 }
79 156 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/sale/vo/order/ErpSaleOrderSaveReqVO.java
1 1 package cn.iocoder.yudao.module.erp.controller.admin.sale.vo.order;
2 2  
3 3 import io.swagger.v3.oas.annotations.media.Schema;
4   -import jakarta.validation.constraints.NotEmpty;
5 4 import jakarta.validation.constraints.NotNull;
6 5 import lombok.Data;
7 6  
... ... @@ -16,10 +15,6 @@ public class ErpSaleOrderSaveReqVO {
16 15 @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17386")
17 16 private Long id;
18 17  
19   - @Schema(description = "销售单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "XS001")
20   - @NotEmpty(message = "销售单编号不能为空")
21   - private String no;
22   -
23 18 @Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1724")
24 19 @NotNull(message = "客户编号不能为空")
25 20 private Long customerId;
... ... @@ -28,100 +23,53 @@ public class ErpSaleOrderSaveReqVO {
28 23 @NotNull(message = "下单时间不能为空")
29 24 private LocalDateTime orderTime;
30 25  
31   - @Schema(description = "销售员编号数组")
32   - private List<Long> salePersonIds;
  26 + @Schema(description = "销售员编号", example = "1888")
  27 + private Long saleUserId;
33 28  
34   - @Schema(description = "合计价格,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "26094")
35   - @NotNull(message = "合计价格,单位:元不能为空")
36   - private BigDecimal totalPrice;
  29 + @Schema(description = "结算账户编号", example = "31189")
  30 + private Long accountId;
37 31  
38 32 @Schema(description = "优惠率,百分比", requiredMode = Schema.RequiredMode.REQUIRED, example = "99.88")
39   - @NotNull(message = "优惠率,百分比不能为空")
40 33 private BigDecimal discountPercent;
41 34  
42   - @Schema(description = "优惠金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "4452")
43   - @NotNull(message = "优惠金额,单位:元不能为空")
44   - private BigDecimal discountPrice;
45   -
46   - // TODO 芋艿:后面删除
47   -// @Schema(description = "支付金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "32240")
48   -// @NotNull(message = "支付金额,单位:元不能为空")
49   -// private BigDecimal payPrice;
50   -
51   - @Schema(description = "定金金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
52   - @NotNull(message = "定金金额,单位:元不能为空")
  35 + @Schema(description = "定金金额,单位:元", example = "7127")
53 36 private BigDecimal depositPrice;
54 37  
55 38 @Schema(description = "附件地址", example = "https://www.iocoder.cn")
56 39 private String fileUrl;
57 40  
58   - @Schema(description = "结算账户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "31189")
59   - @NotNull(message = "结算账户编号不能为空")
60   - private Long accountId;
61   -
62 41 @Schema(description = "备注", example = "你猜")
63   - private String description;
  42 + private String remark;
64 43  
65   - // TODO 芋艿:后面删除
66   -// @Schema(description = "销售状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
67   -// @NotNull(message = "销售状态不能为空")
68   -// private Integer status;
  44 + @Schema(description = "订单清单列表")
  45 + private List<Item> items;
69 46  
70   - @Schema(description = "ERP 销售订单明细列表")
71   - private List<Item> salesOrderItems;
72   -
73   - @Schema(description = "管理后台 - ERP 销售订单明细新增/修改 Request VO")
74 47 @Data
75   - public class Item {
  48 + public static class Item {
76 49  
77   - @Schema(description = "编号", example = "20704")
  50 + @Schema(description = "订单项编号", example = "11756")
78 51 private Long id;
79 52  
80   - // TODO 芋艿:后面删除
81   -// @Schema(description = "销售订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "30765")
82   -// @NotNull(message = "销售订单编号不能为空")
83   -// private Long orderId;
84   -
85   -// @Schema(description = "商品 SPU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "5574")
86   -// @NotNull(message = "商品 SPU 编号不能为空")
87   -// private Long productSpuId;
88   -
89   - @Schema(description = "商品 SKU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "21273")
90   - @NotNull(message = "商品 SKU 编号不能为空")
91   - private Long productSkuId;
  53 + @Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  54 + @NotNull(message = "产品编号不能为空")
  55 + private Long productId;
92 56  
93   - @Schema(description = "商品单位", requiredMode = Schema.RequiredMode.REQUIRED)
94   - @NotEmpty(message = "商品单位不能为空")
95   - private String productUnit;
  57 + @Schema(description = "产品单位单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  58 + @NotNull(message = "产品单位单位不能为空")
  59 + private Long productUnitId;
96 60  
97   - @Schema(description = "商品单价", requiredMode = Schema.RequiredMode.REQUIRED, example = "6897")
98   - @NotNull(message = "商品单价不能为空")
  61 + @Schema(description = "产品单价", example = "100.00")
99 62 private BigDecimal productPrice;
100 63  
101   - @Schema(description = "数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "22100")
102   - @NotNull(message = "数量不能为空")
103   - private Integer count;
  64 + @Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  65 + @NotNull(message = "产品数量不能为空")
  66 + private BigDecimal count;
104 67  
105   - // TODO 芋艿:后面删除
106   -// @Schema(description = "总价", requiredMode = Schema.RequiredMode.REQUIRED, example = "26868")
107   -// @NotNull(message = "总价不能为空")
108   -// private BigDecimal totalPrice;
109   -
110   - @Schema(description = "备注", example = "你说的对")
111   - private String description;
112   -
113   - @Schema(description = "税率,百分比", requiredMode = Schema.RequiredMode.REQUIRED)
114   - @NotNull(message = "税率,百分比不能为空")
  68 + @Schema(description = "税率,百分比", example = "99.88")
115 69 private BigDecimal taxPercent;
116 70  
117   - @Schema(description = "税额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "15791")
118   - @NotNull(message = "税额,单位:元不能为空")
119   - private BigDecimal taxPrice;
120   -
121   - // TODO 芋艿:后面删除
122   -// @Schema(description = "支付金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "21930")
123   -// @NotNull(message = "支付金额,单位:元不能为空")
124   -// private BigDecimal payPrice;
  71 + @Schema(description = "备注", example = "随便")
  72 + private String remark;
125 73  
126 74 }
127 75  
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/sale/vo/out/ErpSaleOutPageReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.sale.vo.out;
  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 = "管理后台 - ERP 销售出库分页 Request VO")
  15 +@Data
  16 +@EqualsAndHashCode(callSuper = true)
  17 +@ToString(callSuper = true)
  18 +public class ErpSaleOutPageReqVO extends PageParam {
  19 +
  20 + @Schema(description = "销售单编号", example = "XS001")
  21 + private String no;
  22 +
  23 + @Schema(description = "客户编号", example = "1724")
  24 + private Long customerId;
  25 +
  26 + @Schema(description = "出库时间")
  27 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  28 + private LocalDateTime[] outTime;
  29 +
  30 + @Schema(description = "备注", example = "你猜")
  31 + private String remark;
  32 +
  33 + @Schema(description = "出库状态", example = "2")
  34 + private Integer status;
  35 +
  36 + @Schema(description = "创建者")
  37 + private String creator;
  38 +
  39 + @Schema(description = "产品编号", example = "1")
  40 + private Long productId;
  41 +
  42 + @Schema(description = "仓库编号", example = "1")
  43 + private Long warehouseId;
  44 +
  45 + @Schema(description = "结算账号编号", example = "1")
  46 + private Long accountId;
  47 +
  48 + @Schema(description = "是否欠款", example = "true")
  49 + private Boolean debtStatus;
  50 +
  51 + @Schema(description = "销售单号", example = "1")
  52 + private String orderNo;
  53 +
  54 +}
0 55 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/sale/vo/out/ErpSaleOutRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.sale.vo.out;
  2 +
  3 +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
  4 +import com.alibaba.excel.annotation.ExcelProperty;
  5 +import io.swagger.v3.oas.annotations.media.Schema;
  6 +import jakarta.validation.constraints.NotNull;
  7 +import lombok.Data;
  8 +
  9 +import java.math.BigDecimal;
  10 +import java.time.LocalDateTime;
  11 +import java.util.List;
  12 +
  13 +@Schema(description = "管理后台 - ERP 销售出库 Response VO")
  14 +@Data
  15 +@ExcelIgnoreUnannotated
  16 +public class ErpSaleOutRespVO {
  17 +
  18 + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17386")
  19 + @ExcelProperty("编号")
  20 + private Long id;
  21 +
  22 + @Schema(description = "出库单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "XS001")
  23 + @ExcelProperty("出库单编号")
  24 + private String no;
  25 +
  26 + @Schema(description = "出库状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
  27 + @ExcelProperty("出库状态")
  28 + private Integer status;
  29 +
  30 + @Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1724")
  31 + private Long customerId;
  32 + @Schema(description = "客户名称", example = "芋道")
  33 + @ExcelProperty("客户名称")
  34 + private String customerName;
  35 +
  36 + @Schema(description = "结算账户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "311.89")
  37 + @ExcelProperty("结算账户编号")
  38 + private Long accountId;
  39 +
  40 + @Schema(description = "出库员编号", example = "1888")
  41 + private Long saleUserId;
  42 +
  43 + @Schema(description = "出库时间", requiredMode = Schema.RequiredMode.REQUIRED)
  44 + @ExcelProperty("出库时间")
  45 + private LocalDateTime outTime;
  46 +
  47 + @Schema(description = "销售订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17386")
  48 + private Long orderId;
  49 + @Schema(description = "销售订单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "XS001")
  50 + private String orderNo;
  51 +
  52 + @Schema(description = "合计数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "15663")
  53 + @ExcelProperty("合计数量")
  54 + private BigDecimal totalCount;
  55 + @Schema(description = "最终合计价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
  56 + @ExcelProperty("最终合计价格")
  57 + private BigDecimal totalPrice;
  58 +
  59 + @Schema(description = "合计产品价格,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
  60 + private BigDecimal totalProductPrice;
  61 +
  62 + @Schema(description = "合计税额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
  63 + private BigDecimal totalTaxPrice;
  64 +
  65 + @Schema(description = "优惠率,百分比", requiredMode = Schema.RequiredMode.REQUIRED, example = "99.88")
  66 + private BigDecimal discountPercent;
  67 +
  68 + @Schema(description = "优惠金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
  69 + private BigDecimal discountPrice;
  70 +
  71 + @Schema(description = "定金金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
  72 + private BigDecimal otherPrice;
  73 +
  74 + @Schema(description = "本次收款,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
  75 + private BigDecimal payPrice;
  76 + @Schema(description = "本次欠款,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "666")
  77 + private BigDecimal debtPrice;
  78 +
  79 +
  80 + @Schema(description = "附件地址", example = "https://www.iocoder.cn")
  81 + @ExcelProperty("附件地址")
  82 + private String fileUrl;
  83 +
  84 + @Schema(description = "备注", example = "你猜")
  85 + @ExcelProperty("备注")
  86 + private String remark;
  87 +
  88 + @Schema(description = "创建人", example = "芋道")
  89 + private String creator;
  90 + @Schema(description = "创建人名称", example = "芋道")
  91 + private String creatorName;
  92 +
  93 + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
  94 + @ExcelProperty("创建时间")
  95 + private LocalDateTime createTime;
  96 +
  97 + @Schema(description = "出库项列表", requiredMode = Schema.RequiredMode.REQUIRED)
  98 + private List<Item> items;
  99 +
  100 + @Schema(description = "产品信息", requiredMode = Schema.RequiredMode.REQUIRED)
  101 + @ExcelProperty("产品信息")
  102 + private String productNames;
  103 +
  104 + @Data
  105 + public static class Item {
  106 +
  107 + @Schema(description = "出库项编号", example = "11756")
  108 + private Long id;
  109 +
  110 + @Schema(description = "销售订单项编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
  111 + private Long orderItemId;
  112 +
  113 + @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  114 + private Long warehouseId;
  115 +
  116 + @Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  117 + private Long productId;
  118 +
  119 + @Schema(description = "产品单位单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  120 + private Long productUnitId;
  121 +
  122 + @Schema(description = "产品单价", example = "100.00")
  123 + private BigDecimal productPrice;
  124 +
  125 + @Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  126 + @NotNull(message = "产品数量不能为空")
  127 + private BigDecimal count;
  128 +
  129 + @Schema(description = "税率,百分比", example = "99.88")
  130 + private BigDecimal taxPercent;
  131 +
  132 + @Schema(description = "税额,单位:元", example = "100.00")
  133 + private BigDecimal taxPrice;
  134 +
  135 + @Schema(description = "备注", example = "随便")
  136 + private String remark;
  137 +
  138 + // ========== 关联字段 ==========
  139 +
  140 + @Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "巧克力")
  141 + private String productName;
  142 + @Schema(description = "产品条码", requiredMode = Schema.RequiredMode.REQUIRED, example = "A9985")
  143 + private String productBarCode;
  144 + @Schema(description = "产品单位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "盒")
  145 + private String productUnitName;
  146 +
  147 + @Schema(description = "库存数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  148 + private BigDecimal stockCount; // 该字段仅仅在“详情”和“编辑”时使用
  149 +
  150 + }
  151 +
  152 +}
0 153 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/sale/vo/out/ErpSaleOutSaveReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.sale.vo.out;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import jakarta.validation.constraints.NotNull;
  5 +import lombok.Data;
  6 +
  7 +import java.math.BigDecimal;
  8 +import java.time.LocalDateTime;
  9 +import java.util.List;
  10 +
  11 +@Schema(description = "管理后台 - ERP 销售出库新增/修改 Request VO")
  12 +@Data
  13 +public class ErpSaleOutSaveReqVO {
  14 +
  15 + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17386")
  16 + private Long id;
  17 +
  18 + @Schema(description = "结算账户编号", example = "31189")
  19 + private Long accountId;
  20 +
  21 + @Schema(description = "销售员编号", example = "1888")
  22 + private Long saleUserId;
  23 +
  24 + @Schema(description = "出库时间", requiredMode = Schema.RequiredMode.REQUIRED)
  25 + @NotNull(message = "出库时间不能为空")
  26 + private LocalDateTime outTime;
  27 +
  28 + @Schema(description = "销售订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17386")
  29 + @NotNull(message = "销售订单编号不能为空")
  30 + private Long orderId;
  31 +
  32 + @Schema(description = "优惠率,百分比", requiredMode = Schema.RequiredMode.REQUIRED, example = "99.88")
  33 + private BigDecimal discountPercent;
  34 +
  35 + @Schema(description = "其它金额,单位:元", example = "7127")
  36 + private BigDecimal otherPrice;
  37 +
  38 + @Schema(description = "本次收款,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
  39 + @NotNull(message = "本次收款不能为空")
  40 + private BigDecimal payPrice;
  41 +
  42 + @Schema(description = "附件地址", example = "https://www.iocoder.cn")
  43 + private String fileUrl;
  44 +
  45 + @Schema(description = "备注", example = "你猜")
  46 + private String remark;
  47 +
  48 + @Schema(description = "出库清单列表")
  49 + private List<Item> items;
  50 +
  51 + @Data
  52 + public static class Item {
  53 +
  54 + @Schema(description = "出库项编号", example = "11756")
  55 + private Long id;
  56 +
  57 + @Schema(description = "销售订单项编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
  58 + @NotNull(message = "销售订单项编号不能为空")
  59 + private Long orderItemId;
  60 +
  61 + @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  62 + @NotNull(message = "仓库编号不能为空")
  63 + private Long warehouseId;
  64 +
  65 + @Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  66 + @NotNull(message = "产品编号不能为空")
  67 + private Long productId;
  68 +
  69 + @Schema(description = "产品单位单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  70 + @NotNull(message = "产品单位单位不能为空")
  71 + private Long productUnitId;
  72 +
  73 + @Schema(description = "产品单价", example = "100.00")
  74 + private BigDecimal productPrice;
  75 +
  76 + @Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  77 + @NotNull(message = "产品数量不能为空")
  78 + private BigDecimal count;
  79 +
  80 + @Schema(description = "税率,百分比", example = "99.88")
  81 + private BigDecimal taxPercent;
  82 +
  83 + @Schema(description = "备注", example = "随便")
  84 + private String remark;
  85 +
  86 + }
  87 +
  88 +}
0 89 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/sale/vo/returns/ErpSaleReturnPageReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.sale.vo.returns;
  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 = "管理后台 - ERP 销售退货分页 Request VO")
  15 +@Data
  16 +@EqualsAndHashCode(callSuper = true)
  17 +@ToString(callSuper = true)
  18 +public class ErpSaleReturnPageReqVO extends PageParam {
  19 +
  20 + @Schema(description = "销售单编号", example = "XS001")
  21 + private String no;
  22 +
  23 + @Schema(description = "客户编号", example = "1724")
  24 + private Long customerId;
  25 +
  26 + @Schema(description = "退货时间")
  27 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  28 + private LocalDateTime[] returnTime;
  29 +
  30 + @Schema(description = "备注", example = "你猜")
  31 + private String remark;
  32 +
  33 + @Schema(description = "退货状态", example = "2")
  34 + private Integer status;
  35 +
  36 + @Schema(description = "创建者")
  37 + private String creator;
  38 +
  39 + @Schema(description = "产品编号", example = "1")
  40 + private Long productId;
  41 +
  42 + @Schema(description = "仓库编号", example = "1")
  43 + private Long warehouseId;
  44 +
  45 + @Schema(description = "结算账号编号", example = "1")
  46 + private Long accountId;
  47 +
  48 + @Schema(description = "销售单号", example = "1")
  49 + private String orderNo;
  50 +
  51 +}
0 52 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/sale/vo/returns/ErpSaleReturnRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.sale.vo.returns;
  2 +
  3 +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
  4 +import com.alibaba.excel.annotation.ExcelProperty;
  5 +import io.swagger.v3.oas.annotations.media.Schema;
  6 +import jakarta.validation.constraints.NotNull;
  7 +import lombok.Data;
  8 +
  9 +import java.math.BigDecimal;
  10 +import java.time.LocalDateTime;
  11 +import java.util.List;
  12 +
  13 +@Schema(description = "管理后台 - ERP 销售退货 Response VO")
  14 +@Data
  15 +@ExcelIgnoreUnannotated
  16 +public class ErpSaleReturnRespVO {
  17 +
  18 + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17386")
  19 + @ExcelProperty("编号")
  20 + private Long id;
  21 +
  22 + @Schema(description = "退货单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "XS001")
  23 + @ExcelProperty("退货单编号")
  24 + private String no;
  25 +
  26 + @Schema(description = "退货状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
  27 + @ExcelProperty("退货状态")
  28 + private Integer status;
  29 +
  30 + @Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1724")
  31 + private Long customerId;
  32 + @Schema(description = "客户名称", example = "芋道")
  33 + @ExcelProperty("客户名称")
  34 + private String customerName;
  35 +
  36 + @Schema(description = "结算账户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "311.89")
  37 + @ExcelProperty("结算账户编号")
  38 + private Long accountId;
  39 +
  40 + @Schema(description = "退货员编号", example = "1888")
  41 + private Long saleUserId;
  42 +
  43 + @Schema(description = "退货时间", requiredMode = Schema.RequiredMode.REQUIRED)
  44 + @ExcelProperty("退货时间")
  45 + private LocalDateTime returnTime;
  46 +
  47 + @Schema(description = "销售订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17386")
  48 + private Long orderId;
  49 + @Schema(description = "销售订单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "XS001")
  50 + private String orderNo;
  51 +
  52 + @Schema(description = "合计数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "15663")
  53 + @ExcelProperty("合计数量")
  54 + private BigDecimal totalCount;
  55 + @Schema(description = "最终合计价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
  56 + @ExcelProperty("最终合计价格")
  57 + private BigDecimal totalPrice;
  58 +
  59 + @Schema(description = "合计产品价格,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
  60 + private BigDecimal totalProductPrice;
  61 +
  62 + @Schema(description = "合计税额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
  63 + private BigDecimal totalTaxPrice;
  64 +
  65 + @Schema(description = "优惠率,百分比", requiredMode = Schema.RequiredMode.REQUIRED, example = "99.88")
  66 + private BigDecimal discountPercent;
  67 +
  68 + @Schema(description = "优惠金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
  69 + private BigDecimal discountPrice;
  70 +
  71 + @Schema(description = "定金金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
  72 + private BigDecimal otherPrice;
  73 +
  74 + @Schema(description = "本次退款,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
  75 + private BigDecimal refundPrice;
  76 + @Schema(description = "本次欠款,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "666")
  77 + private BigDecimal debtPrice;
  78 +
  79 +
  80 + @Schema(description = "附件地址", example = "https://www.iocoder.cn")
  81 + @ExcelProperty("附件地址")
  82 + private String fileUrl;
  83 +
  84 + @Schema(description = "备注", example = "你猜")
  85 + @ExcelProperty("备注")
  86 + private String remark;
  87 +
  88 + @Schema(description = "创建人", example = "芋道")
  89 + private String creator;
  90 + @Schema(description = "创建人名称", example = "芋道")
  91 + private String creatorName;
  92 +
  93 + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
  94 + @ExcelProperty("创建时间")
  95 + private LocalDateTime createTime;
  96 +
  97 + @Schema(description = "退货项列表", requiredMode = Schema.RequiredMode.REQUIRED)
  98 + private List<Item> items;
  99 +
  100 + @Schema(description = "产品信息", requiredMode = Schema.RequiredMode.REQUIRED)
  101 + @ExcelProperty("产品信息")
  102 + private String productNames;
  103 +
  104 + @Data
  105 + public static class Item {
  106 +
  107 + @Schema(description = "退货项编号", example = "11756")
  108 + private Long id;
  109 +
  110 + @Schema(description = "销售订单项编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
  111 + private Long orderItemId;
  112 +
  113 + @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  114 + private Long warehouseId;
  115 +
  116 + @Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  117 + private Long productId;
  118 +
  119 + @Schema(description = "产品单位单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  120 + private Long productUnitId;
  121 +
  122 + @Schema(description = "产品单价", example = "100.00")
  123 + private BigDecimal productPrice;
  124 +
  125 + @Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  126 + @NotNull(message = "产品数量不能为空")
  127 + private BigDecimal count;
  128 +
  129 + @Schema(description = "税率,百分比", example = "99.88")
  130 + private BigDecimal taxPercent;
  131 +
  132 + @Schema(description = "税额,单位:元", example = "100.00")
  133 + private BigDecimal taxPrice;
  134 +
  135 + @Schema(description = "备注", example = "随便")
  136 + private String remark;
  137 +
  138 + // ========== 关联字段 ==========
  139 +
  140 + @Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "巧克力")
  141 + private String productName;
  142 + @Schema(description = "产品条码", requiredMode = Schema.RequiredMode.REQUIRED, example = "A9985")
  143 + private String productBarCode;
  144 + @Schema(description = "产品单位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "盒")
  145 + private String productUnitName;
  146 +
  147 + @Schema(description = "库存数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  148 + private BigDecimal stockCount; // 该字段仅仅在“详情”和“编辑”时使用
  149 +
  150 + }
  151 +
  152 +}
0 153 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/sale/vo/returns/ErpSaleReturnSaveReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.sale.vo.returns;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import jakarta.validation.constraints.NotNull;
  5 +import lombok.Data;
  6 +
  7 +import java.math.BigDecimal;
  8 +import java.time.LocalDateTime;
  9 +import java.util.List;
  10 +
  11 +@Schema(description = "管理后台 - ERP 销售退货新增/修改 Request VO")
  12 +@Data
  13 +public class ErpSaleReturnSaveReqVO {
  14 +
  15 + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17386")
  16 + private Long id;
  17 +
  18 + @Schema(description = "结算账户编号", example = "31189")
  19 + private Long accountId;
  20 +
  21 + @Schema(description = "销售员编号", example = "1888")
  22 + private Long saleUserId;
  23 +
  24 + @Schema(description = "退货时间", requiredMode = Schema.RequiredMode.REQUIRED)
  25 + @NotNull(message = "退货时间不能为空")
  26 + private LocalDateTime returnTime;
  27 +
  28 + @Schema(description = "销售订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17386")
  29 + @NotNull(message = "销售订单编号不能为空")
  30 + private Long orderId;
  31 +
  32 + @Schema(description = "优惠率,百分比", requiredMode = Schema.RequiredMode.REQUIRED, example = "99.88")
  33 + private BigDecimal discountPercent;
  34 +
  35 + @Schema(description = "其它金额,单位:元", example = "7127")
  36 + private BigDecimal otherPrice;
  37 +
  38 + @Schema(description = "本次退款,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
  39 + @NotNull(message = "本次退款不能为空")
  40 + private BigDecimal refundPrice;
  41 +
  42 + @Schema(description = "附件地址", example = "https://www.iocoder.cn")
  43 + private String fileUrl;
  44 +
  45 + @Schema(description = "备注", example = "你猜")
  46 + private String remark;
  47 +
  48 + @Schema(description = "退货清单列表")
  49 + private List<Item> items;
  50 +
  51 + @Data
  52 + public static class Item {
  53 +
  54 + @Schema(description = "退货项编号", example = "11756")
  55 + private Long id;
  56 +
  57 + @Schema(description = "销售订单项编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
  58 + @NotNull(message = "销售订单项编号不能为空")
  59 + private Long orderItemId;
  60 +
  61 + @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  62 + @NotNull(message = "仓库编号不能为空")
  63 + private Long warehouseId;
  64 +
  65 + @Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  66 + @NotNull(message = "产品编号不能为空")
  67 + private Long productId;
  68 +
  69 + @Schema(description = "产品单位单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  70 + @NotNull(message = "产品单位单位不能为空")
  71 + private Long productUnitId;
  72 +
  73 + @Schema(description = "产品单价", example = "100.00")
  74 + private BigDecimal productPrice;
  75 +
  76 + @Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  77 + @NotNull(message = "产品数量不能为空")
  78 + private BigDecimal count;
  79 +
  80 + @Schema(description = "税率,百分比", example = "99.88")
  81 + private BigDecimal taxPercent;
  82 +
  83 + @Schema(description = "备注", example = "随便")
  84 + private String remark;
  85 +
  86 + }
  87 +
  88 +}
0 89 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/stock/ErpStockCheckController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.stock;
  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.PageParam;
  6 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  7 +import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
  8 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
  9 +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
  10 +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
  11 +import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO;
  12 +import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check.ErpStockCheckPageReqVO;
  13 +import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check.ErpStockCheckRespVO;
  14 +import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check.ErpStockCheckSaveReqVO;
  15 +import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockCheckDO;
  16 +import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockCheckItemDO;
  17 +import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
  18 +import cn.iocoder.yudao.module.erp.service.stock.ErpStockCheckService;
  19 +import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
  20 +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
  21 +import io.swagger.v3.oas.annotations.Operation;
  22 +import io.swagger.v3.oas.annotations.Parameter;
  23 +import io.swagger.v3.oas.annotations.tags.Tag;
  24 +import jakarta.annotation.Resource;
  25 +import jakarta.servlet.http.HttpServletResponse;
  26 +import jakarta.validation.Valid;
  27 +import org.springframework.security.access.prepost.PreAuthorize;
  28 +import org.springframework.validation.annotation.Validated;
  29 +import org.springframework.web.bind.annotation.*;
  30 +
  31 +import java.io.IOException;
  32 +import java.util.List;
  33 +import java.util.Map;
  34 +
  35 +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  36 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap;
  37 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
  38 +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
  39 +
  40 +@Tag(name = "管理后台 - ERP 库存调拨单")
  41 +@RestController
  42 +@RequestMapping("/erp/stock-check")
  43 +@Validated
  44 +public class ErpStockCheckController {
  45 +
  46 + @Resource
  47 + private ErpStockCheckService stockCheckService;
  48 + @Resource
  49 + private ErpProductService productService;
  50 +
  51 + @Resource
  52 + private AdminUserApi adminUserApi;
  53 +
  54 + @PostMapping("/create")
  55 + @Operation(summary = "创建库存调拨单")
  56 + @PreAuthorize("@ss.hasPermission('erp:stock-check:create')")
  57 + public CommonResult<Long> createStockCheck(@Valid @RequestBody ErpStockCheckSaveReqVO createReqVO) {
  58 + return success(stockCheckService.createStockCheck(createReqVO));
  59 + }
  60 +
  61 + @PutMapping("/update")
  62 + @Operation(summary = "更新库存调拨单")
  63 + @PreAuthorize("@ss.hasPermission('erp:stock-check:update')")
  64 + public CommonResult<Boolean> updateStockCheck(@Valid @RequestBody ErpStockCheckSaveReqVO updateReqVO) {
  65 + stockCheckService.updateStockCheck(updateReqVO);
  66 + return success(true);
  67 + }
  68 +
  69 + @PutMapping("/update-status")
  70 + @Operation(summary = "更新库存调拨单的状态")
  71 + @PreAuthorize("@ss.hasPermission('erp:stock-check:update-status')")
  72 + public CommonResult<Boolean> updateStockCheckStatus(@RequestParam("id") Long id,
  73 + @RequestParam("status") Integer status) {
  74 + stockCheckService.updateStockCheckStatus(id, status);
  75 + return success(true);
  76 + }
  77 +
  78 + @DeleteMapping("/delete")
  79 + @Operation(summary = "删除库存调拨单")
  80 + @Parameter(name = "ids", description = "编号数组", required = true)
  81 + @PreAuthorize("@ss.hasPermission('erp:stock-check:delete')")
  82 + public CommonResult<Boolean> deleteStockCheck(@RequestParam("ids") List<Long> ids) {
  83 + stockCheckService.deleteStockCheck(ids);
  84 + return success(true);
  85 + }
  86 +
  87 + @GetMapping("/get")
  88 + @Operation(summary = "获得库存调拨单")
  89 + @Parameter(name = "id", description = "编号", required = true, example = "1024")
  90 + @PreAuthorize("@ss.hasPermission('erp:stock-check:query')")
  91 + public CommonResult<ErpStockCheckRespVO> getStockCheck(@RequestParam("id") Long id) {
  92 + ErpStockCheckDO stockCheck = stockCheckService.getStockCheck(id);
  93 + if (stockCheck == null) {
  94 + return success(null);
  95 + }
  96 + List<ErpStockCheckItemDO> stockCheckItemList = stockCheckService.getStockCheckItemListByCheckId(id);
  97 + Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
  98 + convertSet(stockCheckItemList, ErpStockCheckItemDO::getProductId));
  99 + return success(BeanUtils.toBean(stockCheck, ErpStockCheckRespVO.class, stockCheckVO ->
  100 + stockCheckVO.setItems(BeanUtils.toBean(stockCheckItemList, ErpStockCheckRespVO.Item.class, item ->
  101 + MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
  102 + .setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()))))));
  103 + }
  104 +
  105 + @GetMapping("/page")
  106 + @Operation(summary = "获得库存调拨单分页")
  107 + @PreAuthorize("@ss.hasPermission('erp:stock-check:query')")
  108 + public CommonResult<PageResult<ErpStockCheckRespVO>> getStockCheckPage(@Valid ErpStockCheckPageReqVO pageReqVO) {
  109 + PageResult<ErpStockCheckDO> pageResult = stockCheckService.getStockCheckPage(pageReqVO);
  110 + return success(buildStockCheckVOPageResult(pageResult));
  111 + }
  112 +
  113 + @GetMapping("/export-excel")
  114 + @Operation(summary = "导出库存调拨单 Excel")
  115 + @PreAuthorize("@ss.hasPermission('erp:stock-check:export')")
  116 + @OperateLog(type = EXPORT)
  117 + public void exportStockCheckExcel(@Valid ErpStockCheckPageReqVO pageReqVO,
  118 + HttpServletResponse response) throws IOException {
  119 + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
  120 + List<ErpStockCheckRespVO> list = buildStockCheckVOPageResult(stockCheckService.getStockCheckPage(pageReqVO)).getList();
  121 + // 导出 Excel
  122 + ExcelUtils.write(response, "库存调拨单.xls", "数据", ErpStockCheckRespVO.class, list);
  123 + }
  124 +
  125 + private PageResult<ErpStockCheckRespVO> buildStockCheckVOPageResult(PageResult<ErpStockCheckDO> pageResult) {
  126 + if (CollUtil.isEmpty(pageResult.getList())) {
  127 + return PageResult.empty(pageResult.getTotal());
  128 + }
  129 + // 1.1 盘点项
  130 + List<ErpStockCheckItemDO> stockCheckItemList = stockCheckService.getStockCheckItemListByCheckIds(
  131 + convertSet(pageResult.getList(), ErpStockCheckDO::getId));
  132 + Map<Long, List<ErpStockCheckItemDO>> stockCheckItemMap = convertMultiMap(stockCheckItemList, ErpStockCheckItemDO::getCheckId);
  133 + // 1.2 产品信息
  134 + Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
  135 + convertSet(stockCheckItemList, ErpStockCheckItemDO::getProductId));
  136 + // 1.3 管理员信息
  137 + Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
  138 + convertSet(pageResult.getList(), stockCheck -> Long.parseLong(stockCheck.getCreator())));
  139 + // 2. 开始拼接
  140 + return BeanUtils.toBean(pageResult, ErpStockCheckRespVO.class, stockCheck -> {
  141 + stockCheck.setItems(BeanUtils.toBean(stockCheckItemMap.get(stockCheck.getId()), ErpStockCheckRespVO.Item.class,
  142 + item -> MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
  143 + .setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()))));
  144 + stockCheck.setProductNames(CollUtil.join(stockCheck.getItems(), ",", ErpStockCheckRespVO.Item::getProductName));
  145 + MapUtils.findAndThen(userMap, Long.parseLong(stockCheck.getCreator()), user -> stockCheck.setCreatorName(user.getNickname()));
  146 + });
  147 + }
  148 +
  149 +}
0 150 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/stock/ErpStockController.java
... ... @@ -31,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestParam;
31 31 import org.springframework.web.bind.annotation.RestController;
32 32  
33 33 import java.io.IOException;
  34 +import java.math.BigDecimal;
34 35 import java.util.List;
35 36 import java.util.Map;
36 37  
... ... @@ -66,6 +67,13 @@ public class ErpStockController {
66 67 return success(BeanUtils.toBean(stock, ErpStockRespVO.class));
67 68 }
68 69  
  70 + @GetMapping("/get-count")
  71 + @Operation(summary = "获得产品库存数量")
  72 + @Parameter(name = "productId", description = "产品编号", example = "10")
  73 + public CommonResult<BigDecimal> getStockCount(@RequestParam("productId") Long productId) {
  74 + return success(stockService.getStockCount(productId));
  75 + }
  76 +
69 77 @GetMapping("/page")
70 78 @Operation(summary = "获得产品库存分页")
71 79 @PreAuthorize("@ss.hasPermission('erp:stock:query')")
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/stock/ErpStockInController.java
... ... @@ -15,7 +15,7 @@ import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in.ErpStockInSaveRe
15 15 import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockDO;
16 16 import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockInDO;
17 17 import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockInItemDO;
18   -import cn.iocoder.yudao.module.erp.dal.dataobject.supplier.ErpSupplierDO;
  18 +import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpSupplierDO;
19 19 import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
20 20 import cn.iocoder.yudao.module.erp.service.purchase.ErpSupplierService;
21 21 import cn.iocoder.yudao.module.erp.service.stock.ErpStockInService;
... ... @@ -75,12 +75,21 @@ public class ErpStockInController {
75 75 return success(true);
76 76 }
77 77  
  78 + @PutMapping("/update-status")
  79 + @Operation(summary = "更新其它入库单的状态")
  80 + @PreAuthorize("@ss.hasPermission('erp:stock-in:update-status')")
  81 + public CommonResult<Boolean> updateStockInStatus(@RequestParam("id") Long id,
  82 + @RequestParam("status") Integer status) {
  83 + stockInService.updateStockInStatus(id, status);
  84 + return success(true);
  85 + }
  86 +
78 87 @DeleteMapping("/delete")
79 88 @Operation(summary = "删除其它入库单")
80   - @Parameter(name = "id", description = "编号", required = true)
  89 + @Parameter(name = "ids", description = "编号数组", required = true)
81 90 @PreAuthorize("@ss.hasPermission('erp:stock-in:delete')")
82   - public CommonResult<Boolean> deleteStockIn(@RequestParam("id") Long id) {
83   - stockInService.deleteStockIn(id);
  91 + public CommonResult<Boolean> deleteStockIn(@RequestParam("ids") List<Long> ids) {
  92 + stockInService.deleteStockIn(ids);
84 93 return success(true);
85 94 }
86 95  
... ... @@ -93,12 +102,15 @@ public class ErpStockInController {
93 102 if (stockIn == null) {
94 103 return success(null);
95 104 }
96   - List<ErpStockInItemDO> stockInItems = stockInService.getStockInItemListByInId(id);
97   - // TODO 芋艿:有个锤子;
  105 + List<ErpStockInItemDO> stockInItemList = stockInService.getStockInItemListByInId(id);
  106 + Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
  107 + convertSet(stockInItemList, ErpStockInItemDO::getProductId));
98 108 return success(BeanUtils.toBean(stockIn, ErpStockInRespVO.class, stockInVO ->
99   - stockInVO.setItems(BeanUtils.toBean(stockInItems, ErpStockInRespVO.Item.class, item -> {
  109 + stockInVO.setItems(BeanUtils.toBean(stockInItemList, ErpStockInRespVO.Item.class, item -> {
100 110 ErpStockDO stock = stockService.getStock(item.getProductId(), item.getWarehouseId());
101 111 item.setStockCount(stock != null ? stock.getCount() : BigDecimal.ZERO);
  112 + MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
  113 + .setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()));
102 114 }))));
103 115 }
104 116  
... ... @@ -130,7 +142,7 @@ public class ErpStockInController {
130 142 List<ErpStockInItemDO> stockInItemList = stockInService.getStockInItemListByInIds(
131 143 convertSet(pageResult.getList(), ErpStockInDO::getId));
132 144 Map<Long, List<ErpStockInItemDO>> stockInItemMap = convertMultiMap(stockInItemList, ErpStockInItemDO::getInId);
133   - // 1.2 商品信息
  145 + // 1.2 产品信息
134 146 Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
135 147 convertSet(stockInItemList, ErpStockInItemDO::getProductId));
136 148 // 1.3 供应商信息
... ... @@ -138,12 +150,12 @@ public class ErpStockInController {
138 150 convertSet(pageResult.getList(), ErpStockInDO::getSupplierId));
139 151 // 1.4 管理员信息
140 152 Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
141   - convertSet(pageResult.getList(), erpStockRecordDO -> Long.parseLong(erpStockRecordDO.getCreator())));
  153 + convertSet(pageResult.getList(), stockIn -> Long.parseLong(stockIn.getCreator())));
142 154 // 2. 开始拼接
143 155 return BeanUtils.toBean(pageResult, ErpStockInRespVO.class, stockIn -> {
144 156 stockIn.setItems(BeanUtils.toBean(stockInItemMap.get(stockIn.getId()), ErpStockInRespVO.Item.class,
145   - item -> MapUtils.findAndThen(productMap, item.getProductId(),
146   - product -> item.setProductName(product.getName()).setProductUnitName(product.getUnitName()))));
  157 + item -> MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
  158 + .setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()))));
147 159 stockIn.setProductNames(CollUtil.join(stockIn.getItems(), ",", ErpStockInRespVO.Item::getProductName));
148 160 MapUtils.findAndThen(supplierMap, stockIn.getSupplierId(), supplier -> stockIn.setSupplierName(supplier.getName()));
149 161 MapUtils.findAndThen(userMap, Long.parseLong(stockIn.getCreator()), user -> stockIn.setCreatorName(user.getNickname()));
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/stock/ErpStockMoveController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.stock;
  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.PageParam;
  6 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  7 +import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
  8 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
  9 +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
  10 +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
  11 +import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO;
  12 +import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.move.ErpStockMovePageReqVO;
  13 +import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.move.ErpStockMoveRespVO;
  14 +import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.move.ErpStockMoveSaveReqVO;
  15 +import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockDO;
  16 +import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockMoveDO;
  17 +import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockMoveItemDO;
  18 +import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
  19 +import cn.iocoder.yudao.module.erp.service.stock.ErpStockMoveService;
  20 +import cn.iocoder.yudao.module.erp.service.stock.ErpStockService;
  21 +import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
  22 +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
  23 +import io.swagger.v3.oas.annotations.Operation;
  24 +import io.swagger.v3.oas.annotations.Parameter;
  25 +import io.swagger.v3.oas.annotations.tags.Tag;
  26 +import jakarta.annotation.Resource;
  27 +import jakarta.servlet.http.HttpServletResponse;
  28 +import jakarta.validation.Valid;
  29 +import org.springframework.security.access.prepost.PreAuthorize;
  30 +import org.springframework.validation.annotation.Validated;
  31 +import org.springframework.web.bind.annotation.*;
  32 +
  33 +import java.io.IOException;
  34 +import java.math.BigDecimal;
  35 +import java.util.List;
  36 +import java.util.Map;
  37 +
  38 +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  39 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap;
  40 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
  41 +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
  42 +
  43 +@Tag(name = "管理后台 - ERP 库存调拨单")
  44 +@RestController
  45 +@RequestMapping("/erp/stock-move")
  46 +@Validated
  47 +public class ErpStockMoveController {
  48 +
  49 + @Resource
  50 + private ErpStockMoveService stockMoveService;
  51 + @Resource
  52 + private ErpStockService stockService;
  53 + @Resource
  54 + private ErpProductService productService;
  55 +
  56 + @Resource
  57 + private AdminUserApi adminUserApi;
  58 +
  59 + @PostMapping("/create")
  60 + @Operation(summary = "创建库存调拨单")
  61 + @PreAuthorize("@ss.hasPermission('erp:stock-move:create')")
  62 + public CommonResult<Long> createStockMove(@Valid @RequestBody ErpStockMoveSaveReqVO createReqVO) {
  63 + return success(stockMoveService.createStockMove(createReqVO));
  64 + }
  65 +
  66 + @PutMapping("/update")
  67 + @Operation(summary = "更新库存调拨单")
  68 + @PreAuthorize("@ss.hasPermission('erp:stock-move:update')")
  69 + public CommonResult<Boolean> updateStockMove(@Valid @RequestBody ErpStockMoveSaveReqVO updateReqVO) {
  70 + stockMoveService.updateStockMove(updateReqVO);
  71 + return success(true);
  72 + }
  73 +
  74 + @PutMapping("/update-status")
  75 + @Operation(summary = "更新库存调拨单的状态")
  76 + @PreAuthorize("@ss.hasPermission('erp:stock-move:update-status')")
  77 + public CommonResult<Boolean> updateStockMoveStatus(@RequestParam("id") Long id,
  78 + @RequestParam("status") Integer status) {
  79 + stockMoveService.updateStockMoveStatus(id, status);
  80 + return success(true);
  81 + }
  82 +
  83 + @DeleteMapping("/delete")
  84 + @Operation(summary = "删除库存调拨单")
  85 + @Parameter(name = "ids", description = "编号数组", required = true)
  86 + @PreAuthorize("@ss.hasPermission('erp:stock-move:delete')")
  87 + public CommonResult<Boolean> deleteStockMove(@RequestParam("ids") List<Long> ids) {
  88 + stockMoveService.deleteStockMove(ids);
  89 + return success(true);
  90 + }
  91 +
  92 + @GetMapping("/get")
  93 + @Operation(summary = "获得库存调拨单")
  94 + @Parameter(name = "id", description = "编号", required = true, example = "1024")
  95 + @PreAuthorize("@ss.hasPermission('erp:stock-move:query')")
  96 + public CommonResult<ErpStockMoveRespVO> getStockMove(@RequestParam("id") Long id) {
  97 + ErpStockMoveDO stockMove = stockMoveService.getStockMove(id);
  98 + if (stockMove == null) {
  99 + return success(null);
  100 + }
  101 + List<ErpStockMoveItemDO> stockMoveItemList = stockMoveService.getStockMoveItemListByMoveId(id);
  102 + Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
  103 + convertSet(stockMoveItemList, ErpStockMoveItemDO::getProductId));
  104 + return success(BeanUtils.toBean(stockMove, ErpStockMoveRespVO.class, stockMoveVO ->
  105 + stockMoveVO.setItems(BeanUtils.toBean(stockMoveItemList, ErpStockMoveRespVO.Item.class, item -> {
  106 + ErpStockDO stock = stockService.getStock(item.getProductId(), item.getFromWarehouseId());
  107 + item.setStockCount(stock != null ? stock.getCount() : BigDecimal.ZERO);
  108 + MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
  109 + .setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()));
  110 + }))));
  111 + }
  112 +
  113 + @GetMapping("/page")
  114 + @Operation(summary = "获得库存调拨单分页")
  115 + @PreAuthorize("@ss.hasPermission('erp:stock-move:query')")
  116 + public CommonResult<PageResult<ErpStockMoveRespVO>> getStockMovePage(@Valid ErpStockMovePageReqVO pageReqVO) {
  117 + PageResult<ErpStockMoveDO> pageResult = stockMoveService.getStockMovePage(pageReqVO);
  118 + return success(buildStockMoveVOPageResult(pageResult));
  119 + }
  120 +
  121 + @GetMapping("/export-excel")
  122 + @Operation(summary = "导出库存调拨单 Excel")
  123 + @PreAuthorize("@ss.hasPermission('erp:stock-move:export')")
  124 + @OperateLog(type = EXPORT)
  125 + public void exportStockMoveExcel(@Valid ErpStockMovePageReqVO pageReqVO,
  126 + HttpServletResponse response) throws IOException {
  127 + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
  128 + List<ErpStockMoveRespVO> list = buildStockMoveVOPageResult(stockMoveService.getStockMovePage(pageReqVO)).getList();
  129 + // 导出 Excel
  130 + ExcelUtils.write(response, "库存调拨单.xls", "数据", ErpStockMoveRespVO.class, list);
  131 + }
  132 +
  133 + private PageResult<ErpStockMoveRespVO> buildStockMoveVOPageResult(PageResult<ErpStockMoveDO> pageResult) {
  134 + if (CollUtil.isEmpty(pageResult.getList())) {
  135 + return PageResult.empty(pageResult.getTotal());
  136 + }
  137 + // 1.1 调拨项
  138 + List<ErpStockMoveItemDO> stockMoveItemList = stockMoveService.getStockMoveItemListByMoveIds(
  139 + convertSet(pageResult.getList(), ErpStockMoveDO::getId));
  140 + Map<Long, List<ErpStockMoveItemDO>> stockMoveItemMap = convertMultiMap(stockMoveItemList, ErpStockMoveItemDO::getMoveId);
  141 + // 1.2 产品信息
  142 + Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
  143 + convertSet(stockMoveItemList, ErpStockMoveItemDO::getProductId));
  144 + // 1.3 TODO 芋艿:搞仓库信息
  145 + // 1.4 管理员信息
  146 + Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
  147 + convertSet(pageResult.getList(), stockMove -> Long.parseLong(stockMove.getCreator())));
  148 + // 2. 开始拼接
  149 + return BeanUtils.toBean(pageResult, ErpStockMoveRespVO.class, stockMove -> {
  150 + stockMove.setItems(BeanUtils.toBean(stockMoveItemMap.get(stockMove.getId()), ErpStockMoveRespVO.Item.class,
  151 + item -> MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
  152 + .setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()))));
  153 + stockMove.setProductNames(CollUtil.join(stockMove.getItems(), ",", ErpStockMoveRespVO.Item::getProductName));
  154 + // TODO 芋艿:
  155 +// MapUtils.findAndThen(customerMap, stockMove.getCustomerId(), supplier -> stockMove.setCustomerName(supplier.getName()));
  156 + MapUtils.findAndThen(userMap, Long.parseLong(stockMove.getCreator()), user -> stockMove.setCreatorName(user.getNickname()));
  157 + });
  158 + }
  159 +
  160 +}
0 161 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/stock/ErpStockOutController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.stock;
  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.PageParam;
  6 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  7 +import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
  8 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
  9 +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
  10 +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
  11 +import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO;
  12 +import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out.ErpStockOutPageReqVO;
  13 +import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out.ErpStockOutRespVO;
  14 +import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out.ErpStockOutSaveReqVO;
  15 +import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpCustomerDO;
  16 +import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockDO;
  17 +import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockOutDO;
  18 +import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockOutItemDO;
  19 +import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
  20 +import cn.iocoder.yudao.module.erp.service.sale.ErpCustomerService;
  21 +import cn.iocoder.yudao.module.erp.service.stock.ErpStockOutService;
  22 +import cn.iocoder.yudao.module.erp.service.stock.ErpStockService;
  23 +import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
  24 +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
  25 +import io.swagger.v3.oas.annotations.Operation;
  26 +import io.swagger.v3.oas.annotations.Parameter;
  27 +import io.swagger.v3.oas.annotations.tags.Tag;
  28 +import jakarta.annotation.Resource;
  29 +import jakarta.servlet.http.HttpServletResponse;
  30 +import jakarta.validation.Valid;
  31 +import org.springframework.security.access.prepost.PreAuthorize;
  32 +import org.springframework.validation.annotation.Validated;
  33 +import org.springframework.web.bind.annotation.*;
  34 +
  35 +import java.io.IOException;
  36 +import java.math.BigDecimal;
  37 +import java.util.List;
  38 +import java.util.Map;
  39 +
  40 +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  41 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap;
  42 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
  43 +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
  44 +
  45 +@Tag(name = "管理后台 - ERP 其它出库单")
  46 +@RestController
  47 +@RequestMapping("/erp/stock-out")
  48 +@Validated
  49 +public class ErpStockOutController {
  50 +
  51 + @Resource
  52 + private ErpStockOutService stockOutService;
  53 + @Resource
  54 + private ErpStockService stockService;
  55 + @Resource
  56 + private ErpProductService productService;
  57 + @Resource
  58 + private ErpCustomerService customerService;
  59 +
  60 + @Resource
  61 + private AdminUserApi adminUserApi;
  62 +
  63 + @PostMapping("/create")
  64 + @Operation(summary = "创建其它出库单")
  65 + @PreAuthorize("@ss.hasPermission('erp:stock-out:create')")
  66 + public CommonResult<Long> createStockOut(@Valid @RequestBody ErpStockOutSaveReqVO createReqVO) {
  67 + return success(stockOutService.createStockOut(createReqVO));
  68 + }
  69 +
  70 + @PutMapping("/update")
  71 + @Operation(summary = "更新其它出库单")
  72 + @PreAuthorize("@ss.hasPermission('erp:stock-out:update')")
  73 + public CommonResult<Boolean> updateStockOut(@Valid @RequestBody ErpStockOutSaveReqVO updateReqVO) {
  74 + stockOutService.updateStockOut(updateReqVO);
  75 + return success(true);
  76 + }
  77 +
  78 + @PutMapping("/update-status")
  79 + @Operation(summary = "更新其它出库单的状态")
  80 + @PreAuthorize("@ss.hasPermission('erp:stock-out:update-status')")
  81 + public CommonResult<Boolean> updateStockOutStatus(@RequestParam("id") Long id,
  82 + @RequestParam("status") Integer status) {
  83 + stockOutService.updateStockOutStatus(id, status);
  84 + return success(true);
  85 + }
  86 +
  87 + @DeleteMapping("/delete")
  88 + @Operation(summary = "删除其它出库单")
  89 + @Parameter(name = "ids", description = "编号数组", required = true)
  90 + @PreAuthorize("@ss.hasPermission('erp:stock-out:delete')")
  91 + public CommonResult<Boolean> deleteStockOut(@RequestParam("ids") List<Long> ids) {
  92 + stockOutService.deleteStockOut(ids);
  93 + return success(true);
  94 + }
  95 +
  96 + @GetMapping("/get")
  97 + @Operation(summary = "获得其它出库单")
  98 + @Parameter(name = "id", description = "编号", required = true, example = "1024")
  99 + @PreAuthorize("@ss.hasPermission('erp:stock-out:query')")
  100 + public CommonResult<ErpStockOutRespVO> getStockOut(@RequestParam("id") Long id) {
  101 + ErpStockOutDO stockOut = stockOutService.getStockOut(id);
  102 + if (stockOut == null) {
  103 + return success(null);
  104 + }
  105 + List<ErpStockOutItemDO> stockOutItemList = stockOutService.getStockOutItemListByOutId(id);
  106 + Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
  107 + convertSet(stockOutItemList, ErpStockOutItemDO::getProductId));
  108 + return success(BeanUtils.toBean(stockOut, ErpStockOutRespVO.class, stockOutVO ->
  109 + stockOutVO.setItems(BeanUtils.toBean(stockOutItemList, ErpStockOutRespVO.Item.class, item -> {
  110 + ErpStockDO stock = stockService.getStock(item.getProductId(), item.getWarehouseId());
  111 + item.setStockCount(stock != null ? stock.getCount() : BigDecimal.ZERO);
  112 + MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
  113 + .setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()));
  114 + }))));
  115 + }
  116 +
  117 + @GetMapping("/page")
  118 + @Operation(summary = "获得其它出库单分页")
  119 + @PreAuthorize("@ss.hasPermission('erp:stock-out:query')")
  120 + public CommonResult<PageResult<ErpStockOutRespVO>> getStockOutPage(@Valid ErpStockOutPageReqVO pageReqVO) {
  121 + PageResult<ErpStockOutDO> pageResult = stockOutService.getStockOutPage(pageReqVO);
  122 + return success(buildStockOutVOPageResult(pageResult));
  123 + }
  124 +
  125 + @GetMapping("/export-excel")
  126 + @Operation(summary = "导出其它出库单 Excel")
  127 + @PreAuthorize("@ss.hasPermission('erp:stock-out:export')")
  128 + @OperateLog(type = EXPORT)
  129 + public void exportStockOutExcel(@Valid ErpStockOutPageReqVO pageReqVO,
  130 + HttpServletResponse response) throws IOException {
  131 + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
  132 + List<ErpStockOutRespVO> list = buildStockOutVOPageResult(stockOutService.getStockOutPage(pageReqVO)).getList();
  133 + // 导出 Excel
  134 + ExcelUtils.write(response, "其它出库单.xls", "数据", ErpStockOutRespVO.class, list);
  135 + }
  136 +
  137 + private PageResult<ErpStockOutRespVO> buildStockOutVOPageResult(PageResult<ErpStockOutDO> pageResult) {
  138 + if (CollUtil.isEmpty(pageResult.getList())) {
  139 + return PageResult.empty(pageResult.getTotal());
  140 + }
  141 + // 1.1 出库项
  142 + List<ErpStockOutItemDO> stockOutItemList = stockOutService.getStockOutItemListByOutIds(
  143 + convertSet(pageResult.getList(), ErpStockOutDO::getId));
  144 + Map<Long, List<ErpStockOutItemDO>> stockOutItemMap = convertMultiMap(stockOutItemList, ErpStockOutItemDO::getOutId);
  145 + // 1.2 产品信息
  146 + Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
  147 + convertSet(stockOutItemList, ErpStockOutItemDO::getProductId));
  148 + // 1.3 客户信息
  149 + Map<Long, ErpCustomerDO> customerMap = customerService.getCustomerMap(
  150 + convertSet(pageResult.getList(), ErpStockOutDO::getCustomerId));
  151 + // 1.4 管理员信息
  152 + Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
  153 + convertSet(pageResult.getList(), stockOut -> Long.parseLong(stockOut.getCreator())));
  154 + // 2. 开始拼接
  155 + return BeanUtils.toBean(pageResult, ErpStockOutRespVO.class, stockOut -> {
  156 + stockOut.setItems(BeanUtils.toBean(stockOutItemMap.get(stockOut.getId()), ErpStockOutRespVO.Item.class,
  157 + item -> MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
  158 + .setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()))));
  159 + stockOut.setProductNames(CollUtil.join(stockOut.getItems(), ",", ErpStockOutRespVO.Item::getProductName));
  160 + MapUtils.findAndThen(customerMap, stockOut.getCustomerId(), supplier -> stockOut.setCustomerName(supplier.getName()));
  161 + MapUtils.findAndThen(userMap, Long.parseLong(stockOut.getCreator()), user -> stockOut.setCreatorName(user.getNickname()));
  162 + });
  163 + }
  164 +
  165 +}
0 166 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/stock/ErpStockRecordController.java
... ... @@ -93,7 +93,7 @@ public class ErpStockRecordController {
93 93 Map<Long, ErpWarehouseDO> warehouseMap = warehouseService.getWarehouseMap(
94 94 convertSet(pageResult.getList(), ErpStockRecordDO::getWarehouseId));
95 95 Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
96   - convertSet(pageResult.getList(), erpStockRecordDO -> Long.parseLong(erpStockRecordDO.getCreator())));
  96 + convertSet(pageResult.getList(), record -> Long.parseLong(record.getCreator())));
97 97 return BeanUtils.toBean(pageResult, ErpStockRecordRespVO.class, stock -> {
98 98 MapUtils.findAndThen(productMap, stock.getProductId(), product -> stock.setProductName(product.getName())
99 99 .setCategoryName(product.getCategoryName()).setUnitName(product.getUnitName()));
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/stock/ErpWarehouseController.java
... ... @@ -27,6 +27,7 @@ import java.io.IOException;
27 27 import java.util.List;
28 28  
29 29 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  30 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
30 31 import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
31 32  
32 33 @Tag(name = "管理后台 - ERP 仓库")
... ... @@ -95,7 +96,8 @@ public class ErpWarehouseController {
95 96 @Operation(summary = "获得仓库精简列表", description = "只包含被开启的仓库,主要用于前端的下拉选项")
96 97 public CommonResult<List<ErpWarehouseRespVO>> getWarehouseSimpleList() {
97 98 List<ErpWarehouseDO> list = warehouseService.getWarehouseListByStatus(CommonStatusEnum.ENABLE.getStatus());
98   - return success(BeanUtils.toBean(list, ErpWarehouseRespVO.class));
  99 + return success(convertList(list, warehouse -> new ErpWarehouseRespVO().setId(warehouse.getId())
  100 + .setName(warehouse.getName()).setDefaultStatus(warehouse.getDefaultStatus())));
99 101 }
100 102  
101 103 @GetMapping("/export-excel")
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/stock/vo/check/ErpStockCheckPageReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check;
  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.erp.enums.ErpAuditStatus;
  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.time.LocalDateTime;
  13 +
  14 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
  15 +
  16 +@Schema(description = "管理后台 - ERP 库存盘点单分页 Request VO")
  17 +@Data
  18 +@EqualsAndHashCode(callSuper = true)
  19 +@ToString(callSuper = true)
  20 +public class ErpStockCheckPageReqVO extends PageParam {
  21 +
  22 + @Schema(description = "盘点单号", example = "S123")
  23 + private String no;
  24 +
  25 + @Schema(description = "仓库编号", example = "3113")
  26 + private Long warehouseId;
  27 +
  28 + @Schema(description = "盘点时间")
  29 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  30 + private LocalDateTime[] checkTime;
  31 +
  32 + @Schema(description = "状态", example = "10")
  33 + @InEnum(ErpAuditStatus.class)
  34 + private Integer status;
  35 +
  36 + @Schema(description = "备注", example = "随便")
  37 + private String remark;
  38 +
  39 + @Schema(description = "创建者")
  40 + private String creator;
  41 +
  42 + @Schema(description = "产品编号", example = "1")
  43 + private Long productId;
  44 +
  45 +}
0 46 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/stock/vo/check/ErpStockCheckRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check;
  2 +
  3 +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
  4 +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
  5 +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
  6 +import com.alibaba.excel.annotation.ExcelProperty;
  7 +import io.swagger.v3.oas.annotations.media.Schema;
  8 +import jakarta.validation.constraints.NotNull;
  9 +import lombok.Data;
  10 +
  11 +import java.math.BigDecimal;
  12 +import java.time.LocalDateTime;
  13 +import java.util.List;
  14 +
  15 +import static cn.iocoder.yudao.module.erp.enums.DictTypeConstants.AUDIT_STATUS;
  16 +
  17 +@Schema(description = "管理后台 - ERP 库存盘点单 Response VO")
  18 +@Data
  19 +@ExcelIgnoreUnannotated
  20 +public class ErpStockCheckRespVO {
  21 +
  22 + @Schema(description = "盘点编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
  23 + @ExcelProperty("盘点编号")
  24 + private Long id;
  25 +
  26 + @Schema(description = "盘点单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "S123")
  27 + @ExcelProperty("盘点单号")
  28 + private String no;
  29 +
  30 + @Schema(description = "盘点时间", requiredMode = Schema.RequiredMode.REQUIRED)
  31 + @ExcelProperty("盘点时间")
  32 + private LocalDateTime checkTime;
  33 +
  34 + @Schema(description = "合计数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "15663")
  35 + @ExcelProperty("合计数量")
  36 + private BigDecimal totalCount;
  37 +
  38 + @Schema(description = "合计金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
  39 + @ExcelProperty("合计金额")
  40 + private BigDecimal totalPrice;
  41 +
  42 + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
  43 + @ExcelProperty(value = "状态", converter = DictConvert.class)
  44 + @DictFormat(AUDIT_STATUS)
  45 + private Integer status;
  46 +
  47 + @Schema(description = "备注", example = "随便")
  48 + @ExcelProperty("备注")
  49 + private String remark;
  50 +
  51 + @Schema(description = "附件 URL", example = "https://www.iocoder.cn/1.doc")
  52 + private String fileUrl;
  53 +
  54 + @Schema(description = "创建人", example = "芋道")
  55 + private String creator;
  56 + @Schema(description = "创建人名称", example = "芋道")
  57 + private String creatorName;
  58 +
  59 + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
  60 + @ExcelProperty("创建时间")
  61 + private LocalDateTime createTime;
  62 +
  63 + @Schema(description = "盘点项列表", requiredMode = Schema.RequiredMode.REQUIRED)
  64 + private List<Item> items;
  65 +
  66 + @Schema(description = "产品信息", requiredMode = Schema.RequiredMode.REQUIRED)
  67 + @ExcelProperty("产品信息")
  68 + private String productNames;
  69 +
  70 + @Data
  71 + public static class Item {
  72 +
  73 + @Schema(description = "盘点项编号", example = "11756")
  74 + private Long id;
  75 +
  76 + @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  77 + private Long warehouseId;
  78 +
  79 + @Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  80 + private Long productId;
  81 +
  82 + @Schema(description = "产品单价", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  83 + private BigDecimal productPrice;
  84 +
  85 + @Schema(description = "账面数量(当前库存)", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  86 + @NotNull(message = "账面数量不能为空")
  87 + private BigDecimal stockCount;
  88 +
  89 + @Schema(description = "实际数量(实际库存)", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  90 + @NotNull(message = "实际数量不能为空")
  91 + private BigDecimal actualCount;
  92 +
  93 + @Schema(description = "盈亏数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  94 + @NotNull(message = "盈亏数量不能为空")
  95 + private BigDecimal count;
  96 +
  97 + @Schema(description = "备注", example = "随便")
  98 + private String remark;
  99 +
  100 + // ========== 关联字段 ==========
  101 +
  102 + @Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "巧克力")
  103 + private String productName;
  104 + @Schema(description = "产品条码", requiredMode = Schema.RequiredMode.REQUIRED, example = "A9985")
  105 + private String productBarCode;
  106 + @Schema(description = "产品单位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "盒")
  107 + private String productUnitName;
  108 +
  109 + }
  110 +
  111 +}
0 112 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/stock/vo/check/ErpStockCheckSaveReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import jakarta.validation.Valid;
  5 +import jakarta.validation.constraints.NotEmpty;
  6 +import jakarta.validation.constraints.NotNull;
  7 +import lombok.Data;
  8 +
  9 +import java.math.BigDecimal;
  10 +import java.time.LocalDateTime;
  11 +import java.util.List;
  12 +
  13 +@Schema(description = "管理后台 - ERP 其它出库单新增/修改 Request VO")
  14 +@Data
  15 +public class ErpStockCheckSaveReqVO {
  16 +
  17 + @Schema(description = "出库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
  18 + private Long id;
  19 +
  20 + @Schema(description = "出库时间", requiredMode = Schema.RequiredMode.REQUIRED)
  21 + @NotNull(message = "出库时间不能为空")
  22 + private LocalDateTime checkTime;
  23 +
  24 + @Schema(description = "备注", example = "随便")
  25 + private String remark;
  26 +
  27 + @Schema(description = "附件 URL", example = "https://www.iocoder.cn/1.doc")
  28 + private String fileUrl;
  29 +
  30 + @Schema(description = "出库项列表", requiredMode = Schema.RequiredMode.REQUIRED)
  31 + @NotEmpty(message = "出库项列表不能为空")
  32 + @Valid
  33 + private List<Item> items;
  34 +
  35 + @Data
  36 + public static class Item {
  37 +
  38 + @Schema(description = "出库项编号", example = "11756")
  39 + private Long id;
  40 +
  41 + @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  42 + @NotNull(message = "仓库编号不能为空")
  43 + private Long warehouseId;
  44 +
  45 + @Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  46 + @NotNull(message = "产品编号不能为空")
  47 + private Long productId;
  48 +
  49 + @Schema(description = "产品单价", example = "100.00")
  50 + private BigDecimal productPrice;
  51 +
  52 + @Schema(description = "账面数量(当前库存)", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  53 + @NotNull(message = "账面数量不能为空")
  54 + private BigDecimal stockCount;
  55 +
  56 + @Schema(description = "实际数量(实际库存)", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  57 + @NotNull(message = "实际数量不能为空")
  58 + private BigDecimal actualCount;
  59 +
  60 + @Schema(description = "盈亏数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  61 + @NotNull(message = "盈亏数量不能为空")
  62 + private BigDecimal count;
  63 +
  64 + @Schema(description = "备注", example = "随便")
  65 + private String remark;
  66 +
  67 + }
  68 +
  69 +}
0 70 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/stock/vo/in/ErpStockInRespVO.java
... ... @@ -56,9 +56,9 @@ public class ErpStockInRespVO {
56 56 @Schema(description = "附件 URL", example = "https://www.iocoder.cn/1.doc")
57 57 private String fileUrl;
58 58  
59   - @Schema(description = "审核人", example = "芋道")
  59 + @Schema(description = "创建人", example = "芋道")
60 60 private String creator;
61   - @Schema(description = "审核人名称", example = "芋道")
  61 + @Schema(description = "创建人名称", example = "芋道")
62 62 private String creatorName;
63 63  
64 64 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
... ... @@ -97,6 +97,8 @@ public class ErpStockInRespVO {
97 97  
98 98 @Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "巧克力")
99 99 private String productName;
  100 + @Schema(description = "产品条码", requiredMode = Schema.RequiredMode.REQUIRED, example = "A9985")
  101 + private String productBarCode;
100 102 @Schema(description = "产品单位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "盒")
101 103 private String productUnitName;
102 104  
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/stock/vo/in/ErpStockInSaveReqVO.java
... ... @@ -17,10 +17,6 @@ public class ErpStockInSaveReqVO {
17 17 @Schema(description = "入库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
18 18 private Long id;
19 19  
20   - @Schema(description = "入库单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "S123")
21   - @NotEmpty(message = "入库单号不能为空")
22   - private String no;
23   -
24 20 @Schema(description = "供应商编号", example = "3113")
25 21 private Long supplierId;
26 22  
... ... @@ -53,8 +49,7 @@ public class ErpStockInSaveReqVO {
53 49 @NotNull(message = "产品编号不能为空")
54 50 private Long productId;
55 51  
56   - @Schema(description = "产品单价", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
57   - @NotNull(message = "产品单价不能为空")
  52 + @Schema(description = "产品单价", example = "100.00")
58 53 private BigDecimal productPrice;
59 54  
60 55 @Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/stock/vo/move/ErpStockMovePageReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.move;
  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.erp.enums.ErpAuditStatus;
  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.time.LocalDateTime;
  13 +
  14 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
  15 +
  16 +@Schema(description = "管理后台 - ERP 库存调拨单分页 Request VO")
  17 +@Data
  18 +@EqualsAndHashCode(callSuper = true)
  19 +@ToString(callSuper = true)
  20 +public class ErpStockMovePageReqVO extends PageParam {
  21 +
  22 + @Schema(description = "调拨单号", example = "S123")
  23 + private String no;
  24 +
  25 + @Schema(description = "调拨时间")
  26 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  27 + private LocalDateTime[] moveTime;
  28 +
  29 + @Schema(description = "状态", example = "10")
  30 + @InEnum(ErpAuditStatus.class)
  31 + private Integer status;
  32 +
  33 + @Schema(description = "备注", example = "随便")
  34 + private String remark;
  35 +
  36 + @Schema(description = "创建者")
  37 + private String creator;
  38 +
  39 + @Schema(description = "产品编号", example = "1")
  40 + private Long productId;
  41 +
  42 + @Schema(description = "调出仓库编号", example = "1")
  43 + private Long fromWarehouseId;
  44 +
  45 +}
0 46 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/stock/vo/move/ErpStockMoveRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.move;
  2 +
  3 +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
  4 +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
  5 +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
  6 +import com.alibaba.excel.annotation.ExcelProperty;
  7 +import io.swagger.v3.oas.annotations.media.Schema;
  8 +import lombok.Data;
  9 +
  10 +import java.math.BigDecimal;
  11 +import java.time.LocalDateTime;
  12 +import java.util.List;
  13 +
  14 +import static cn.iocoder.yudao.module.erp.enums.DictTypeConstants.AUDIT_STATUS;
  15 +
  16 +@Schema(description = "管理后台 - ERP 库存调拨单 Response VO")
  17 +@Data
  18 +@ExcelIgnoreUnannotated
  19 +public class ErpStockMoveRespVO {
  20 +
  21 + @Schema(description = "调拨编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
  22 + @ExcelProperty("调拨编号")
  23 + private Long id;
  24 +
  25 + @Schema(description = "调拨单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "S123")
  26 + @ExcelProperty("调拨单号")
  27 + private String no;
  28 +
  29 + @Schema(description = "调拨时间", requiredMode = Schema.RequiredMode.REQUIRED)
  30 + @ExcelProperty("调拨时间")
  31 + private LocalDateTime moveTime;
  32 +
  33 + @Schema(description = "合计数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "15663")
  34 + @ExcelProperty("合计数量")
  35 + private BigDecimal totalCount;
  36 +
  37 + @Schema(description = "合计金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
  38 + @ExcelProperty("合计金额")
  39 + private BigDecimal totalPrice;
  40 +
  41 + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
  42 + @ExcelProperty(value = "状态", converter = DictConvert.class)
  43 + @DictFormat(AUDIT_STATUS)
  44 + private Integer status;
  45 +
  46 + @Schema(description = "备注", example = "随便")
  47 + @ExcelProperty("备注")
  48 + private String remark;
  49 +
  50 + @Schema(description = "附件 URL", example = "https://www.iocoder.cn/1.doc")
  51 + private String fileUrl;
  52 +
  53 + @Schema(description = "创建人", example = "芋道")
  54 + private String creator;
  55 + @Schema(description = "创建人名称", example = "芋道")
  56 + private String creatorName;
  57 +
  58 + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
  59 + @ExcelProperty("创建时间")
  60 + private LocalDateTime createTime;
  61 +
  62 + @Schema(description = "调拨项列表", requiredMode = Schema.RequiredMode.REQUIRED)
  63 + private List<Item> items;
  64 +
  65 + @Schema(description = "产品信息", requiredMode = Schema.RequiredMode.REQUIRED)
  66 + @ExcelProperty("产品信息")
  67 + private String productNames;
  68 +
  69 + @Data
  70 + public static class Item {
  71 +
  72 + @Schema(description = "调拨项编号", example = "11756")
  73 + private Long id;
  74 +
  75 + @Schema(description = "调出仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  76 + private Long fromWarehouseId;
  77 +
  78 + @Schema(description = "调入仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "888")
  79 + private Long toWarehouseId;
  80 +
  81 + @Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  82 + private Long productId;
  83 +
  84 + @Schema(description = "产品单价", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  85 + private BigDecimal productPrice;
  86 +
  87 + @Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  88 + private BigDecimal count;
  89 +
  90 + @Schema(description = "备注", example = "随便")
  91 + private String remark;
  92 +
  93 + // ========== 关联字段 ==========
  94 +
  95 + @Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "巧克力")
  96 + private String productName;
  97 + @Schema(description = "产品条码", requiredMode = Schema.RequiredMode.REQUIRED, example = "A9985")
  98 + private String productBarCode;
  99 + @Schema(description = "产品单位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "盒")
  100 + private String productUnitName;
  101 +
  102 + @Schema(description = "库存数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  103 + private BigDecimal stockCount; // 该字段仅仅在“详情”和“编辑”时使用
  104 +
  105 + }
  106 +
  107 +}
0 108 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/stock/vo/move/ErpStockMoveSaveReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.move;
  2 +
  3 +import cn.hutool.core.util.ObjectUtil;
  4 +import com.fasterxml.jackson.annotation.JsonIgnore;
  5 +import io.swagger.v3.oas.annotations.media.Schema;
  6 +import jakarta.validation.Valid;
  7 +import jakarta.validation.constraints.AssertTrue;
  8 +import jakarta.validation.constraints.NotEmpty;
  9 +import jakarta.validation.constraints.NotNull;
  10 +import lombok.Data;
  11 +
  12 +import java.math.BigDecimal;
  13 +import java.time.LocalDateTime;
  14 +import java.util.List;
  15 +
  16 +@Schema(description = "管理后台 - ERP 库存调拨单新增/修改 Request VO")
  17 +@Data
  18 +public class ErpStockMoveSaveReqVO {
  19 +
  20 + @Schema(description = "调拨编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
  21 + private Long id;
  22 +
  23 + @Schema(description = "客户编号", example = "3113")
  24 + private Long customerId;
  25 +
  26 + @Schema(description = "调拨时间", requiredMode = Schema.RequiredMode.REQUIRED)
  27 + @NotNull(message = "调拨时间不能为空")
  28 + private LocalDateTime moveTime;
  29 +
  30 + @Schema(description = "备注", example = "随便")
  31 + private String remark;
  32 +
  33 + @Schema(description = "附件 URL", example = "https://www.iocoder.cn/1.doc")
  34 + private String fileUrl;
  35 +
  36 + @Schema(description = "调拨项列表", requiredMode = Schema.RequiredMode.REQUIRED)
  37 + @NotEmpty(message = "调拨项列表不能为空")
  38 + @Valid
  39 + private List<Item> items;
  40 +
  41 + @Data
  42 + public static class Item {
  43 +
  44 + @Schema(description = "调拨项编号", example = "11756")
  45 + private Long id;
  46 +
  47 + @Schema(description = "调出仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  48 + @NotNull(message = "调出仓库编号不能为空")
  49 + private Long fromWarehouseId;
  50 +
  51 + @Schema(description = "调入仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "888")
  52 + @NotNull(message = "调入仓库编号不能为空")
  53 + private Long toWarehouseId;
  54 +
  55 + @Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  56 + @NotNull(message = "产品编号不能为空")
  57 + private Long productId;
  58 +
  59 + @Schema(description = "产品单价", example = "100.00")
  60 + private BigDecimal productPrice;
  61 +
  62 + @Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  63 + @NotNull(message = "产品数量不能为空")
  64 + private BigDecimal count;
  65 +
  66 + @Schema(description = "备注", example = "随便")
  67 + private String remark;
  68 +
  69 + @AssertTrue(message = "调出、调仓仓库不能相同")
  70 + @JsonIgnore
  71 + public boolean isWarehouseValid() {
  72 + return ObjectUtil.notEqual(fromWarehouseId, toWarehouseId);
  73 + }
  74 +
  75 + }
  76 +
  77 +}
0 78 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/stock/vo/out/ErpStockOutPageReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out;
  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.erp.enums.ErpAuditStatus;
  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.time.LocalDateTime;
  13 +
  14 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
  15 +
  16 +@Schema(description = "管理后台 - ERP 其它出库单分页 Request VO")
  17 +@Data
  18 +@EqualsAndHashCode(callSuper = true)
  19 +@ToString(callSuper = true)
  20 +public class ErpStockOutPageReqVO extends PageParam {
  21 +
  22 + @Schema(description = "出库单号", example = "S123")
  23 + private String no;
  24 +
  25 + @Schema(description = "客户编号", example = "3113")
  26 + private Long customerId;
  27 +
  28 + @Schema(description = "出库时间")
  29 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  30 + private LocalDateTime[] outTime;
  31 +
  32 + @Schema(description = "状态", example = "10")
  33 + @InEnum(ErpAuditStatus.class)
  34 + private Integer status;
  35 +
  36 + @Schema(description = "备注", example = "随便")
  37 + private String remark;
  38 +
  39 + @Schema(description = "创建者")
  40 + private String creator;
  41 +
  42 + @Schema(description = "产品编号", example = "1")
  43 + private Long productId;
  44 +
  45 + @Schema(description = "仓库编号", example = "1")
  46 + private Long warehouseId;
  47 +
  48 +}
0 49 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/stock/vo/out/ErpStockOutRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out;
  2 +
  3 +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
  4 +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
  5 +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
  6 +import com.alibaba.excel.annotation.ExcelProperty;
  7 +import io.swagger.v3.oas.annotations.media.Schema;
  8 +import lombok.Data;
  9 +
  10 +import java.math.BigDecimal;
  11 +import java.time.LocalDateTime;
  12 +import java.util.List;
  13 +
  14 +import static cn.iocoder.yudao.module.erp.enums.DictTypeConstants.AUDIT_STATUS;
  15 +
  16 +@Schema(description = "管理后台 - ERP 其它出库单 Response VO")
  17 +@Data
  18 +@ExcelIgnoreUnannotated
  19 +public class ErpStockOutRespVO {
  20 +
  21 + @Schema(description = "出库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
  22 + @ExcelProperty("出库编号")
  23 + private Long id;
  24 +
  25 + @Schema(description = "出库单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "S123")
  26 + @ExcelProperty("出库单号")
  27 + private String no;
  28 +
  29 + @Schema(description = "客户编号", example = "3113")
  30 + private Long customerId;
  31 + @Schema(description = "客户名称", example = "芋道")
  32 + @ExcelProperty("客户名称")
  33 + private String customerName;
  34 +
  35 + @Schema(description = "出库时间", requiredMode = Schema.RequiredMode.REQUIRED)
  36 + @ExcelProperty("出库时间")
  37 + private LocalDateTime outTime;
  38 +
  39 + @Schema(description = "合计数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "15663")
  40 + @ExcelProperty("合计数量")
  41 + private BigDecimal totalCount;
  42 +
  43 + @Schema(description = "合计金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
  44 + @ExcelProperty("合计金额")
  45 + private BigDecimal totalPrice;
  46 +
  47 + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
  48 + @ExcelProperty(value = "状态", converter = DictConvert.class)
  49 + @DictFormat(AUDIT_STATUS)
  50 + private Integer status;
  51 +
  52 + @Schema(description = "备注", example = "随便")
  53 + @ExcelProperty("备注")
  54 + private String remark;
  55 +
  56 + @Schema(description = "附件 URL", example = "https://www.iocoder.cn/1.doc")
  57 + private String fileUrl;
  58 +
  59 + @Schema(description = "创建人", example = "芋道")
  60 + private String creator;
  61 + @Schema(description = "创建人名称", example = "芋道")
  62 + private String creatorName;
  63 +
  64 + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
  65 + @ExcelProperty("创建时间")
  66 + private LocalDateTime createTime;
  67 +
  68 + @Schema(description = "出库项列表", requiredMode = Schema.RequiredMode.REQUIRED)
  69 + private List<Item> items;
  70 +
  71 + @Schema(description = "产品信息", requiredMode = Schema.RequiredMode.REQUIRED)
  72 + @ExcelProperty("产品信息")
  73 + private String productNames;
  74 +
  75 + @Data
  76 + public static class Item {
  77 +
  78 + @Schema(description = "出库项编号", example = "11756")
  79 + private Long id;
  80 +
  81 + @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  82 + private Long warehouseId;
  83 +
  84 + @Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  85 + private Long productId;
  86 +
  87 + @Schema(description = "产品单价", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  88 + private BigDecimal productPrice;
  89 +
  90 + @Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  91 + private BigDecimal count;
  92 +
  93 + @Schema(description = "备注", example = "随便")
  94 + private String remark;
  95 +
  96 + // ========== 关联字段 ==========
  97 +
  98 + @Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "巧克力")
  99 + private String productName;
  100 + @Schema(description = "产品条码", requiredMode = Schema.RequiredMode.REQUIRED, example = "A9985")
  101 + private String productBarCode;
  102 + @Schema(description = "产品单位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "盒")
  103 + private String productUnitName;
  104 +
  105 + @Schema(description = "库存数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  106 + private BigDecimal stockCount; // 该字段仅仅在“详情”和“编辑”时使用
  107 +
  108 + }
  109 +
  110 +}
0 111 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/stock/vo/out/ErpStockOutSaveReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import jakarta.validation.Valid;
  5 +import jakarta.validation.constraints.NotEmpty;
  6 +import jakarta.validation.constraints.NotNull;
  7 +import lombok.Data;
  8 +
  9 +import java.math.BigDecimal;
  10 +import java.time.LocalDateTime;
  11 +import java.util.List;
  12 +
  13 +@Schema(description = "管理后台 - ERP 其它出库单新增/修改 Request VO")
  14 +@Data
  15 +public class ErpStockOutSaveReqVO {
  16 +
  17 + @Schema(description = "出库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
  18 + private Long id;
  19 +
  20 + @Schema(description = "客户编号", example = "3113")
  21 + private Long customerId;
  22 +
  23 + @Schema(description = "出库时间", requiredMode = Schema.RequiredMode.REQUIRED)
  24 + @NotNull(message = "出库时间不能为空")
  25 + private LocalDateTime outTime;
  26 +
  27 + @Schema(description = "备注", example = "随便")
  28 + private String remark;
  29 +
  30 + @Schema(description = "附件 URL", example = "https://www.iocoder.cn/1.doc")
  31 + private String fileUrl;
  32 +
  33 + @Schema(description = "出库项列表", requiredMode = Schema.RequiredMode.REQUIRED)
  34 + @NotEmpty(message = "出库项列表不能为空")
  35 + @Valid
  36 + private List<Item> items;
  37 +
  38 + @Data
  39 + public static class Item {
  40 +
  41 + @Schema(description = "出库项编号", example = "11756")
  42 + private Long id;
  43 +
  44 + @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  45 + @NotNull(message = "仓库编号不能为空")
  46 + private Long warehouseId;
  47 +
  48 + @Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
  49 + @NotNull(message = "产品编号不能为空")
  50 + private Long productId;
  51 +
  52 + @Schema(description = "产品单价", example = "100.00")
  53 + private BigDecimal productPrice;
  54 +
  55 + @Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
  56 + @NotNull(message = "产品数量不能为空")
  57 + private BigDecimal count;
  58 +
  59 + @Schema(description = "备注", example = "随便")
  60 + private String remark;
  61 +
  62 + }
  63 +
  64 +}
0 65 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/finance/ErpAccountDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.dataobject.finance;
  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 + * ERP 结算账户 DO
  11 + *
  12 + * @author 芋道源码
  13 + */
  14 +@TableName("erp_account")
  15 +@KeySequence("erp_account_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  16 +@Data
  17 +@EqualsAndHashCode(callSuper = true)
  18 +@ToString(callSuper = true)
  19 +@Builder
  20 +@NoArgsConstructor
  21 +@AllArgsConstructor
  22 +public class ErpAccountDO extends BaseDO {
  23 +
  24 + /**
  25 + * 结算账户编号
  26 + */
  27 + @TableId
  28 + private Long id;
  29 + /**
  30 + * 账户名称
  31 + */
  32 + private String name;
  33 + /**
  34 + * 账户编码
  35 + */
  36 + private String no;
  37 + /**
  38 + * 备注
  39 + */
  40 + private String remark;
  41 + /**
  42 + * 开启状态
  43 + *
  44 + * 枚举 {@link cn.iocoder.yudao.framework.common.enums.CommonStatusEnum}
  45 + */
  46 + private Integer status;
  47 + /**
  48 + * 排序
  49 + */
  50 + private Integer sort;
  51 + /**
  52 + * 是否默认
  53 + */
  54 + private Boolean defaultStatus;
  55 +
  56 +}
0 57 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/finance/ErpFinancePaymentDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.dataobject.finance;
  2 +
  3 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  4 +import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpSupplierDO;
  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 +import java.math.BigDecimal;
  11 +import java.time.LocalDateTime;
  12 +
  13 +/**
  14 + * ERP 付款单 DO
  15 + *
  16 + * @author 芋道源码
  17 + */
  18 +@TableName("erp_finance_payment")
  19 +@KeySequence("erp_finance_payment_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  20 +@Data
  21 +@EqualsAndHashCode(callSuper = true)
  22 +@ToString(callSuper = true)
  23 +@Builder
  24 +@NoArgsConstructor
  25 +@AllArgsConstructor
  26 +public class ErpFinancePaymentDO extends BaseDO {
  27 +
  28 + /**
  29 + * 编号
  30 + */
  31 + @TableId
  32 + private Long id;
  33 + /**
  34 + * 付款单号
  35 + */
  36 + private String no;
  37 + /**
  38 + * 付款状态
  39 + *
  40 + * 枚举 {@link cn.iocoder.yudao.module.erp.enums.ErpAuditStatus}
  41 + */
  42 + private Integer status;
  43 + /**
  44 + * 付款时间
  45 + */
  46 + private LocalDateTime paymentTime;
  47 + /**
  48 + * 财务人员编号
  49 + *
  50 + * 关联 AdminUserDO 的 id 字段
  51 + */
  52 + private Long financeUserId;
  53 + /**
  54 + * 供应商编号
  55 + *
  56 + * 关联 {@link ErpSupplierDO#getId()}
  57 + */
  58 + private Long supplierId;
  59 + /**
  60 + * 付款账户编号
  61 + *
  62 + * 关联 {@link ErpAccountDO#getId()}
  63 + */
  64 + private Long accountId;
  65 +
  66 + /**
  67 + * 合计价格,单位:元
  68 + */
  69 + private BigDecimal totalPrice;
  70 + /**
  71 + * 优惠金额,单位:元
  72 + */
  73 + private BigDecimal discountPrice;
  74 + /**
  75 + * 实付金额,单位:分
  76 + *
  77 + * paymentPrice = totalPrice - discountPrice
  78 + */
  79 + private BigDecimal paymentPrice;
  80 +
  81 + /**
  82 + * 备注
  83 + */
  84 + private String remark;
  85 +
  86 +}
0 87 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/finance/ErpFinancePaymentItemDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.dataobject.finance;
  2 +
  3 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  4 +import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchaseInDO;
  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 +import java.math.BigDecimal;
  11 +
  12 +/**
  13 + * ERP 付款项 DO
  14 + *
  15 + * @author 芋道源码
  16 + */
  17 +@TableName("erp_finance_payment_item")
  18 +@KeySequence("erp_finance_payment_item_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  19 +@Data
  20 +@EqualsAndHashCode(callSuper = true)
  21 +@ToString(callSuper = true)
  22 +@Builder
  23 +@NoArgsConstructor
  24 +@AllArgsConstructor
  25 +public class ErpFinancePaymentItemDO extends BaseDO {
  26 +
  27 + /**
  28 + * 入库项编号
  29 + */
  30 + @TableId
  31 + private Long id;
  32 + /**
  33 + * 付款单编号
  34 + *
  35 + * 关联 {@link ErpFinancePaymentDO#getId()}
  36 + */
  37 + private Long paymentId;
  38 +
  39 + /**
  40 + * 业务类型
  41 + *
  42 + * 枚举 {@link cn.iocoder.yudao.module.erp.enums.common.ErpBizTypeEnum} 的采购入库、退货
  43 + */
  44 + private Integer bizType;
  45 + /**
  46 + * 业务编号
  47 + *
  48 + * 例如说:{@link ErpPurchaseInDO#getId()}
  49 + */
  50 + private Long bizId;
  51 + /**
  52 + * 业务单号
  53 + *
  54 + * 例如说:{@link ErpPurchaseInDO#getNo()}
  55 + */
  56 + private String bizNo;
  57 +
  58 + /**
  59 + * 应付欠款,单位:分
  60 + */
  61 + private BigDecimal totalPrice;
  62 + /**
  63 + * 已付欠款,单位:分
  64 + */
  65 + private BigDecimal paidPrice;
  66 + /**
  67 + * 本次付款,单位:分
  68 + */
  69 + private BigDecimal paymentPrice;
  70 + /**
  71 + * 备注
  72 + */
  73 + private String remark;
  74 +
  75 +}
0 76 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/purchase/ErpPurchaseInDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.dataobject.purchase;
  2 +
  3 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  4 +import cn.iocoder.yudao.module.erp.dal.dataobject.finance.ErpAccountDO;
  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 +import java.math.BigDecimal;
  11 +import java.time.LocalDateTime;
  12 +
  13 +/**
  14 + * ERP 采购入库 DO
  15 + *
  16 + * @author 芋道源码
  17 + */
  18 +@TableName(value = "erp_purchase_in")
  19 +@KeySequence("erp_purchase_in_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  20 +@Data
  21 +@EqualsAndHashCode(callSuper = true)
  22 +@ToString(callSuper = true)
  23 +@Builder
  24 +@NoArgsConstructor
  25 +@AllArgsConstructor
  26 +public class ErpPurchaseInDO extends BaseDO {
  27 +
  28 + /**
  29 + * 编号
  30 + */
  31 + @TableId
  32 + private Long id;
  33 + /**
  34 + * 采购入库单号
  35 + */
  36 + private String no;
  37 + /**
  38 + * 入库状态
  39 + *
  40 + * 枚举 {@link cn.iocoder.yudao.module.erp.enums.ErpAuditStatus}
  41 + */
  42 + private Integer status;
  43 + /**
  44 + * 供应商编号
  45 + *
  46 + * 关联 {@link ErpSupplierDO#getId()}
  47 + */
  48 + private Long supplierId;
  49 + /**
  50 + * 结算账户编号
  51 + *
  52 + * 关联 {@link ErpAccountDO#getId()}
  53 + */
  54 + private Long accountId;
  55 + /**
  56 + * 入库时间
  57 + */
  58 + private LocalDateTime inTime;
  59 +
  60 + /**
  61 + * 采购订单编号
  62 + *
  63 + * 关联 {@link ErpPurchaseOrderDO#getId()}
  64 + */
  65 + private Long orderId;
  66 + /**
  67 + * 采购订单号
  68 + *
  69 + * 冗余 {@link ErpPurchaseOrderDO#getNo()}
  70 + */
  71 + private String orderNo;
  72 +
  73 + /**
  74 + * 合计数量
  75 + */
  76 + private BigDecimal totalCount;
  77 + /**
  78 + * 最终合计价格,单位:元
  79 + *
  80 + * totalPrice = totalProductPrice + totalTaxPrice - discountPrice + otherPrice
  81 + */
  82 + private BigDecimal totalPrice;
  83 + /**
  84 + * 已支付金额,单位:元
  85 + *
  86 + * 目的:和 TODO erp_finance_payment 结合,记录已支付金额
  87 + */
  88 + private BigDecimal paymentPrice;
  89 +
  90 + /**
  91 + * 合计产品价格,单位:元
  92 + */
  93 + private BigDecimal totalProductPrice;
  94 + /**
  95 + * 合计税额,单位:元
  96 + */
  97 + private BigDecimal totalTaxPrice;
  98 + /**
  99 + * 优惠率,百分比
  100 + */
  101 + private BigDecimal discountPercent;
  102 + /**
  103 + * 优惠金额,单位:元
  104 + *
  105 + * discountPrice = (totalProductPrice + totalTaxPrice) * discountPercent
  106 + */
  107 + private BigDecimal discountPrice;
  108 + /**
  109 + * 其它金额,单位:元
  110 + */
  111 + private BigDecimal otherPrice;
  112 +
  113 + /**
  114 + * 附件地址
  115 + */
  116 + private String fileUrl;
  117 + /**
  118 + * 备注
  119 + */
  120 + private String remark;
  121 +
  122 +}
0 123 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/purchase/ErpPurchaseInItemDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.dataobject.purchase;
  2 +
  3 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  4 +import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
  5 +import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpWarehouseDO;
  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 + * ERP 采购入库项 DO
  15 + *
  16 + * @author 芋道源码
  17 + */
  18 +@TableName("erp_purchase_in_items")
  19 +@KeySequence("erp_purchase_in_items_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  20 +@Data
  21 +@EqualsAndHashCode(callSuper = true)
  22 +@ToString(callSuper = true)
  23 +@Builder
  24 +@NoArgsConstructor
  25 +@AllArgsConstructor
  26 +public class ErpPurchaseInItemDO extends BaseDO {
  27 +
  28 + /**
  29 + * 编号
  30 + */
  31 + @TableId
  32 + private Long id;
  33 + /**
  34 + * 采购入库编号
  35 + *
  36 + * 关联 {@link ErpPurchaseInDO##getId()}
  37 + */
  38 + private Long inId;
  39 + /**
  40 + * 采购订单项编号
  41 + *
  42 + * 关联 {@link ErpPurchaseOrderItemDO#getId()}
  43 + * 目的:方便更新关联的采购订单项的入库数量
  44 + */
  45 + private Long orderItemId;
  46 + /**
  47 + * 仓库编号
  48 + *
  49 + * 关联 {@link ErpWarehouseDO#getId()}
  50 + */
  51 + private Long warehouseId;
  52 + /**
  53 + * 产品编号
  54 + *
  55 + * 关联 {@link ErpProductDO#getId()}
  56 + */
  57 + private Long productId;
  58 + /**
  59 + * 产品单位单位
  60 + *
  61 + * 冗余 {@link ErpProductDO#getUnitId()}
  62 + */
  63 + private Long productUnitId;
  64 +
  65 + /**
  66 + * 产品单位单价,单位:元
  67 + */
  68 + private BigDecimal productPrice;
  69 + /**
  70 + * 数量
  71 + */
  72 + private BigDecimal count;
  73 + /**
  74 + * 总价,单位:元
  75 + *
  76 + * totalPrice = productPrice * count
  77 + */
  78 + private BigDecimal totalPrice;
  79 + /**
  80 + * 税率,百分比
  81 + */
  82 + private BigDecimal taxPercent;
  83 + /**
  84 + * 税额,单位:元
  85 + *
  86 + * taxPrice = totalPrice * taxPercent
  87 + */
  88 + private BigDecimal taxPrice;
  89 +
  90 + /**
  91 + * 备注
  92 + */
  93 + private String remark;
  94 +
  95 +}
0 96 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/purchase/ErpPurchaseOrderDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.dataobject.purchase;
  2 +
  3 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  4 +import cn.iocoder.yudao.module.erp.dal.dataobject.finance.ErpAccountDO;
  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 +import java.math.BigDecimal;
  11 +import java.time.LocalDateTime;
  12 +
  13 +/**
  14 + * ERP 采购订单 DO
  15 + *
  16 + * @author 芋道源码
  17 + */
  18 +@TableName(value = "erp_purchase_order")
  19 +@KeySequence("erp_purchase_order_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  20 +@Data
  21 +@EqualsAndHashCode(callSuper = true)
  22 +@ToString(callSuper = true)
  23 +@Builder
  24 +@NoArgsConstructor
  25 +@AllArgsConstructor
  26 +public class ErpPurchaseOrderDO extends BaseDO {
  27 +
  28 + /**
  29 + * 编号
  30 + */
  31 + @TableId
  32 + private Long id;
  33 + /**
  34 + * 采购订单号
  35 + */
  36 + private String no;
  37 + /**
  38 + * 采购状态
  39 + *
  40 + * 枚举 {@link cn.iocoder.yudao.module.erp.enums.ErpAuditStatus}
  41 + */
  42 + private Integer status;
  43 + /**
  44 + * 供应商编号
  45 + *
  46 + * 关联 {@link ErpSupplierDO#getId()}
  47 + */
  48 + private Long supplierId;
  49 + /**
  50 + * 结算账户编号
  51 + *
  52 + * 关联 {@link ErpAccountDO#getId()}
  53 + */
  54 + private Long accountId;
  55 + /**
  56 + * 下单时间
  57 + */
  58 + private LocalDateTime orderTime;
  59 +
  60 + /**
  61 + * 合计数量
  62 + */
  63 + private BigDecimal totalCount;
  64 + /**
  65 + * 最终合计价格,单位:元
  66 + *
  67 + * totalPrice = totalProductPrice + totalTaxPrice - discountPrice
  68 + */
  69 + private BigDecimal totalPrice;
  70 +
  71 + /**
  72 + * 合计产品价格,单位:元
  73 + */
  74 + private BigDecimal totalProductPrice;
  75 + /**
  76 + * 合计税额,单位:元
  77 + */
  78 + private BigDecimal totalTaxPrice;
  79 + /**
  80 + * 优惠率,百分比
  81 + */
  82 + private BigDecimal discountPercent;
  83 + /**
  84 + * 优惠金额,单位:元
  85 + *
  86 + * discountPrice = (totalProductPrice + totalTaxPrice) * discountPercent
  87 + */
  88 + private BigDecimal discountPrice;
  89 + /**
  90 + * 定金金额,单位:元
  91 + */
  92 + private BigDecimal depositPrice;
  93 +
  94 + /**
  95 + * 附件地址
  96 + */
  97 + private String fileUrl;
  98 + /**
  99 + * 备注
  100 + */
  101 + private String remark;
  102 +
  103 + // ========== 采购入库 ==========
  104 + /**
  105 + * 采购入库数量
  106 + */
  107 + private BigDecimal inCount;
  108 +
  109 + // ========== 采购退货(出库)) ==========
  110 + /**
  111 + * 采购退货数量
  112 + */
  113 + private BigDecimal returnCount;
  114 +
  115 +}
0 116 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/purchase/ErpPurchaseOrderItemDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.dataobject.purchase;
  2 +
  3 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  4 +import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
  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 +import java.math.BigDecimal;
  11 +
  12 +/**
  13 + * ERP 采购订单项 DO
  14 + *
  15 + * @author 芋道源码
  16 + */
  17 +@TableName("erp_purchase_order_items")
  18 +@KeySequence("erp_purchase_order_items_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  19 +@Data
  20 +@EqualsAndHashCode(callSuper = true)
  21 +@ToString(callSuper = true)
  22 +@Builder
  23 +@NoArgsConstructor
  24 +@AllArgsConstructor
  25 +public class ErpPurchaseOrderItemDO extends BaseDO {
  26 +
  27 + /**
  28 + * 编号
  29 + */
  30 + @TableId
  31 + private Long id;
  32 + /**
  33 + * 采购订单编号
  34 + *
  35 + * 关联 {@link ErpPurchaseOrderDO#getId()}
  36 + */
  37 + private Long orderId;
  38 + /**
  39 + * 产品编号
  40 + *
  41 + * 关联 {@link ErpProductDO#getId()}
  42 + */
  43 + private Long productId;
  44 + /**
  45 + * 产品单位单位
  46 + *
  47 + * 冗余 {@link ErpProductDO#getUnitId()}
  48 + */
  49 + private Long productUnitId;
  50 +
  51 + /**
  52 + * 产品单位单价,单位:元
  53 + */
  54 + private BigDecimal productPrice;
  55 + /**
  56 + * 数量
  57 + */
  58 + private BigDecimal count;
  59 + /**
  60 + * 总价,单位:元
  61 + *
  62 + * totalPrice = productPrice * count
  63 + */
  64 + private BigDecimal totalPrice;
  65 + /**
  66 + * 税率,百分比
  67 + */
  68 + private BigDecimal taxPercent;
  69 + /**
  70 + * 税额,单位:元
  71 + *
  72 + * taxPrice = totalPrice * taxPercent
  73 + */
  74 + private BigDecimal taxPrice;
  75 +
  76 + /**
  77 + * 备注
  78 + */
  79 + private String remark;
  80 +
  81 + // ========== 采购入库 ==========
  82 + /**
  83 + * 采购入库数量
  84 + */
  85 + private BigDecimal inCount;
  86 +
  87 + // ========== 采购退货(出库)) ==========
  88 + /**
  89 + * 采购退货数量
  90 + */
  91 + private BigDecimal returnCount;
  92 +
  93 +}
0 94 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/purchase/ErpPurchaseReturnDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.dataobject.purchase;
  2 +
  3 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  4 +import cn.iocoder.yudao.module.erp.dal.dataobject.finance.ErpAccountDO;
  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 +import java.math.BigDecimal;
  11 +import java.time.LocalDateTime;
  12 +
  13 +/**
  14 + * ERP 采购退货 DO
  15 + *
  16 + * @author 芋道源码
  17 + */
  18 +@TableName(value = "erp_purchase_return")
  19 +@KeySequence("erp_purchase_return_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  20 +@Data
  21 +@EqualsAndHashCode(callSuper = true)
  22 +@ToString(callSuper = true)
  23 +@Builder
  24 +@NoArgsConstructor
  25 +@AllArgsConstructor
  26 +public class ErpPurchaseReturnDO extends BaseDO {
  27 +
  28 + /**
  29 + * 编号
  30 + */
  31 + @TableId
  32 + private Long id;
  33 + /**
  34 + * 采购退货单号
  35 + */
  36 + private String no;
  37 + /**
  38 + * 退货状态
  39 + *
  40 + * 枚举 {@link cn.iocoder.yudao.module.erp.enums.ErpAuditStatus}
  41 + */
  42 + private Integer status;
  43 + /**
  44 + * 供应商编号
  45 + *
  46 + * 关联 {@link ErpSupplierDO#getId()}
  47 + */
  48 + private Long supplierId;
  49 + /**
  50 + * 结算账户编号
  51 + *
  52 + * 关联 {@link ErpAccountDO#getId()}
  53 + */
  54 + private Long accountId;
  55 + /**
  56 + * 退货时间
  57 + */
  58 + private LocalDateTime returnTime;
  59 +
  60 + /**
  61 + * 采购订单编号
  62 + *
  63 + * 关联 {@link ErpPurchaseOrderDO#getId()}
  64 + */
  65 + private Long orderId;
  66 + /**
  67 + * 采购订单号
  68 + *
  69 + * 冗余 {@link ErpPurchaseOrderDO#getNo()}
  70 + */
  71 + private String orderNo;
  72 +
  73 + /**
  74 + * 合计数量
  75 + */
  76 + private BigDecimal totalCount;
  77 + /**
  78 + * 最终合计价格,单位:元
  79 + *
  80 + * totalPrice = totalProductPrice + totalTaxPrice - discountPrice + otherPrice
  81 + */
  82 + private BigDecimal totalPrice;
  83 + /**
  84 + * 已退款金额,单位:元
  85 + *
  86 + * 目的:和 TODO erp_finance_payment 结合,记录已退款金额
  87 + */
  88 + private BigDecimal refundPrice;
  89 +
  90 + /**
  91 + * 合计产品价格,单位:元
  92 + */
  93 + private BigDecimal totalProductPrice;
  94 + /**
  95 + * 合计税额,单位:元
  96 + */
  97 + private BigDecimal totalTaxPrice;
  98 + /**
  99 + * 优惠率,百分比
  100 + */
  101 + private BigDecimal discountPercent;
  102 + /**
  103 + * 优惠金额,单位:元
  104 + *
  105 + * discountPrice = (totalProductPrice + totalTaxPrice) * discountPercent
  106 + */
  107 + private BigDecimal discountPrice;
  108 + /**
  109 + * 其它金额,单位:元
  110 + */
  111 + private BigDecimal otherPrice;
  112 +
  113 + /**
  114 + * 附件地址
  115 + */
  116 + private String fileUrl;
  117 + /**
  118 + * 备注
  119 + */
  120 + private String remark;
  121 +
  122 +}
0 123 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/purchase/ErpPurchaseReturnItemDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.dataobject.purchase;
  2 +
  3 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  4 +import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
  5 +import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpWarehouseDO;
  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 + * ERP 采购退货项 DO
  15 + *
  16 + * @author 芋道源码
  17 + */
  18 +@TableName("erp_purchase_return_items")
  19 +@KeySequence("erp_purchase_return_items_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  20 +@Data
  21 +@EqualsAndHashCode(callSuper = true)
  22 +@ToString(callSuper = true)
  23 +@Builder
  24 +@NoArgsConstructor
  25 +@AllArgsConstructor
  26 +public class ErpPurchaseReturnItemDO extends BaseDO {
  27 +
  28 + /**
  29 + * 编号
  30 + */
  31 + @TableId
  32 + private Long id;
  33 + /**
  34 + * 采购退货编号
  35 + *
  36 + * 关联 {@link ErpPurchaseReturnDO##getId()}
  37 + */
  38 + private Long returnId;
  39 + /**
  40 + * 采购订单项编号
  41 + *
  42 + * 关联 {@link ErpPurchaseOrderItemDO#getId()}
  43 + * 目的:方便更新关联的采购订单项的退货数量
  44 + */
  45 + private Long orderItemId;
  46 + /**
  47 + * 仓库编号
  48 + *
  49 + * 关联 {@link ErpWarehouseDO#getId()}
  50 + */
  51 + private Long warehouseId;
  52 + /**
  53 + * 产品编号
  54 + *
  55 + * 关联 {@link ErpProductDO#getId()}
  56 + */
  57 + private Long productId;
  58 + /**
  59 + * 产品单位单位
  60 + *
  61 + * 冗余 {@link ErpProductDO#getUnitId()}
  62 + */
  63 + private Long productUnitId;
  64 +
  65 + /**
  66 + * 产品单位单价,单位:元
  67 + */
  68 + private BigDecimal productPrice;
  69 + /**
  70 + * 数量
  71 + */
  72 + private BigDecimal count;
  73 + /**
  74 + * 总价,单位:元
  75 + *
  76 + * totalPrice = productPrice * count
  77 + */
  78 + private BigDecimal totalPrice;
  79 + /**
  80 + * 税率,百分比
  81 + */
  82 + private BigDecimal taxPercent;
  83 + /**
  84 + * 税额,单位:元
  85 + *
  86 + * taxPrice = totalPrice * taxPercent
  87 + */
  88 + private BigDecimal taxPrice;
  89 +
  90 + /**
  91 + * 备注
  92 + */
  93 + private String remark;
  94 +
  95 +}
0 96 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/supplier/ErpSupplierDO.java renamed to yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/purchase/ErpSupplierDO.java
1   -package cn.iocoder.yudao.module.erp.dal.dataobject.supplier;
  1 +package cn.iocoder.yudao.module.erp.dal.dataobject.purchase;
2 2  
3 3 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
4 4 import com.baomidou.mybatisplus.annotation.KeySequence;
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/sale/ErpCustomerDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.dataobject.sale;
  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 + * ERP 客户 DO
  13 + *
  14 + * @author 芋道源码
  15 + */
  16 +@TableName("erp_customer")
  17 +@KeySequence("erp_customer_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  18 +@Data
  19 +@EqualsAndHashCode(callSuper = true)
  20 +@ToString(callSuper = true)
  21 +@Builder
  22 +@NoArgsConstructor
  23 +@AllArgsConstructor
  24 +public class ErpCustomerDO extends BaseDO {
  25 +
  26 + /**
  27 + * 客户编号
  28 + */
  29 + @TableId
  30 + private Long id;
  31 + /**
  32 + * 客户名称
  33 + */
  34 + private String name;
  35 + /**
  36 + * 联系人
  37 + */
  38 + private String contact;
  39 + /**
  40 + * 手机号码
  41 + */
  42 + private String mobile;
  43 + /**
  44 + * 联系电话
  45 + */
  46 + private String telephone;
  47 + /**
  48 + * 电子邮箱
  49 + */
  50 + private String email;
  51 + /**
  52 + * 传真
  53 + */
  54 + private String fax;
  55 + /**
  56 + * 备注
  57 + */
  58 + private String remark;
  59 + /**
  60 + * 开启状态
  61 + *
  62 + * 枚举 {@link cn.iocoder.yudao.framework.common.enums.CommonStatusEnum}
  63 + */
  64 + private Integer status;
  65 + /**
  66 + * 排序
  67 + */
  68 + private Integer sort;
  69 + /**
  70 + * 纳税人识别号
  71 + */
  72 + private String taxNo;
  73 + /**
  74 + * 税率
  75 + */
  76 + private BigDecimal taxPercent;
  77 + /**
  78 + * 开户行
  79 + */
  80 + private String bankName;
  81 + /**
  82 + * 开户账号
  83 + */
  84 + private String bankAccount;
  85 + /**
  86 + * 开户地址
  87 + */
  88 + private String bankAddress;
  89 +
  90 +}
0 91 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/sale/ErpSaleOrderDO.java
1 1 package cn.iocoder.yudao.module.erp.dal.dataobject.sale;
2 2  
3 3 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
4   -import cn.iocoder.yudao.framework.mybatis.core.type.LongListTypeHandler;
5   -import cn.iocoder.yudao.module.erp.enums.sale.ErpSaleOrderStatusEnum;
  4 +import cn.iocoder.yudao.module.erp.dal.dataobject.finance.ErpAccountDO;
6 5 import com.baomidou.mybatisplus.annotation.KeySequence;
7   -import com.baomidou.mybatisplus.annotation.TableField;
8 6 import com.baomidou.mybatisplus.annotation.TableId;
9 7 import com.baomidou.mybatisplus.annotation.TableName;
10 8 import lombok.*;
11 9  
12 10 import java.math.BigDecimal;
13 11 import java.time.LocalDateTime;
14   -import java.util.List;
15 12  
16 13 /**
17 14 * ERP 销售订单 DO
18 15 *
19 16 * @author 芋道源码
20 17 */
21   -@TableName(value = "erp_sale_order", autoResultMap = true)
  18 +@TableName(value = "erp_sale_order")
22 19 @KeySequence("erp_sale_order_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
23 20 @Data
24 21 @EqualsAndHashCode(callSuper = true)
... ... @@ -34,56 +31,68 @@ public class ErpSaleOrderDO extends BaseDO {
34 31 @TableId
35 32 private Long id;
36 33 /**
37   - * 销售单编号
  34 + * 销售订单号
38 35 */
39 36 private String no;
40 37 /**
41 38 * 销售状态
42 39 *
43   - * 枚举 {@link ErpSaleOrderStatusEnum}
  40 + * 枚举 {@link cn.iocoder.yudao.module.erp.enums.ErpAuditStatus}
44 41 */
45 42 private Integer status;
46 43 /**
47 44 * 客户编号
48 45 *
49   - * TODO 芋艿:关联
  46 + * 关联 {@link ErpCustomerDO#getId()}
50 47 */
51 48 private Long customerId;
52 49 /**
53 50 * 结算账户编号
54 51 *
55   - * TODO 芋艿:关联
  52 + * 关联 {@link ErpAccountDO#getId()}
56 53 */
57 54 private Long accountId;
58 55 /**
59   - * 销售员编号数组
  56 + * 销售员编号
60 57 *
61   - * TODO 芋艿:关联
  58 + * 关联 AdminUserDO 的 id 字段
62 59 */
63   - @TableField(typeHandler = LongListTypeHandler.class)
64   - private List<Long> salePersonIds;
  60 + private Long saleUserId;
65 61 /**
66 62 * 下单时间
67 63 */
68 64 private LocalDateTime orderTime;
69 65  
70 66 /**
71   - * 合计价格,单位:元
  67 + * 合计数量
  68 + */
  69 + private BigDecimal totalCount;
  70 + /**
  71 + * 最终合计价格,单位:元
  72 + *
  73 + * totalPrice = totalProductPrice + totalTaxPrice - discountPrice
72 74 */
73 75 private BigDecimal totalPrice;
  76 +
  77 + /**
  78 + * 合计产品价格,单位:元
  79 + */
  80 + private BigDecimal totalProductPrice;
  81 + /**
  82 + * 合计税额,单位:元
  83 + */
  84 + private BigDecimal totalTaxPrice;
74 85 /**
75 86 * 优惠率,百分比
76 87 */
77 88 private BigDecimal discountPercent;
78 89 /**
79 90 * 优惠金额,单位:元
  91 + *
  92 + * discountPrice = (totalProductPrice + totalTaxPrice) * discountPercent
80 93 */
81 94 private BigDecimal discountPrice;
82 95 /**
83   - * 支付金额,单位:元
84   - */
85   - private BigDecimal payPrice;
86   - /**
87 96 * 定金金额,单位:元
88 97 */
89 98 private BigDecimal depositPrice;
... ... @@ -95,6 +104,18 @@ public class ErpSaleOrderDO extends BaseDO {
95 104 /**
96 105 * 备注
97 106 */
98   - private String description;
  107 + private String remark;
  108 +
  109 + // ========== 销售出库 ==========
  110 + /**
  111 + * 销售出库数量
  112 + */
  113 + private BigDecimal outCount;
  114 +
  115 + // ========== 销售退货(入库)) ==========
  116 + /**
  117 + * 销售退货数量
  118 + */
  119 + private BigDecimal returnCount;
99 120  
100 121 }
101 122 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/sale/ErpSalesOrderItemDO.java renamed to yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/sale/ErpSaleOrderItemDO.java
1 1 package cn.iocoder.yudao.module.erp.dal.dataobject.sale;
2 2  
3 3 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  4 +import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
4 5 import com.baomidou.mybatisplus.annotation.KeySequence;
5 6 import com.baomidou.mybatisplus.annotation.TableId;
6 7 import com.baomidou.mybatisplus.annotation.TableName;
... ... @@ -9,19 +10,19 @@ import lombok.*;
9 10 import java.math.BigDecimal;
10 11  
11 12 /**
12   - * ERP 销售订单明细 DO
  13 + * ERP 销售订单项 DO
13 14 *
14 15 * @author 芋道源码
15 16 */
16   -@TableName("erp_sales_order_items")
17   -@KeySequence("erp_sales_order_items_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  17 +@TableName("erp_sale_order_items")
  18 +@KeySequence("erp_sale_order_items_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
18 19 @Data
19 20 @EqualsAndHashCode(callSuper = true)
20 21 @ToString(callSuper = true)
21 22 @Builder
22 23 @NoArgsConstructor
23 24 @AllArgsConstructor
24   -public class ErpSalesOrderItemDO extends BaseDO {
  25 +public class ErpSaleOrderItemDO extends BaseDO {
25 26  
26 27 /**
27 28 * 编号
... ... @@ -34,55 +35,59 @@ public class ErpSalesOrderItemDO extends BaseDO {
34 35 * 关联 {@link ErpSaleOrderDO#getId()}
35 36 */
36 37 private Long orderId;
37   -
38 38 /**
39   - * 商品 SPU 编号
  39 + * 产品编号
40 40 *
41   - * TODO 芋艿 关联
  41 + * 关联 {@link ErpProductDO#getId()}
42 42 */
43   - private Long productSpuId;
  43 + private Long productId;
44 44 /**
45   - * 商品 SKU 编号
  45 + * 产品单位单位
46 46 *
47   - * TODO 芋艿 关联
  47 + * 冗余 {@link ErpProductDO#getUnitId()}
48 48 */
49   - private Long productSkuId;
50   - /**
51   - * 商品单位
52   - *
53   - * TODO 芋艿 冗余
54   - */
55   - private String productUnit;
  49 + private Long productUnitId;
  50 +
56 51 /**
57   - * 商品单价
58   - *
59   - * TODO 芋艿 冗余
  52 + * 产品单位单价,单位:元
60 53 */
61 54 private BigDecimal productPrice;
62   -
63 55 /**
64 56 * 数量
65 57 */
66   - private Integer count;
  58 + private BigDecimal count;
67 59 /**
68   - * 总价
  60 + * 总价,单位:元
  61 + *
  62 + * totalPrice = productPrice * count
69 63 */
70 64 private BigDecimal totalPrice;
71 65 /**
72   - * 备注
73   - */
74   - private String description;
75   - /**
76 66 * 税率,百分比
77 67 */
78 68 private BigDecimal taxPercent;
79 69 /**
80 70 * 税额,单位:元
  71 + *
  72 + * taxPrice = totalPrice * taxPercent
81 73 */
82 74 private BigDecimal taxPrice;
  75 +
  76 + /**
  77 + * 备注
  78 + */
  79 + private String remark;
  80 +
  81 + // ========== 销售出库 ==========
  82 + /**
  83 + * 销售出库数量
  84 + */
  85 + private BigDecimal outCount;
  86 +
  87 + // ========== 销售退货(入库)) ==========
83 88 /**
84   - * 支付金额,单位:元
  89 + * 销售退货数量
85 90 */
86   - private BigDecimal payPrice;
  91 + private BigDecimal returnCount;
87 92  
88 93 }
89 94 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/sale/ErpSaleOutDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.dataobject.sale;
  2 +
  3 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  4 +import cn.iocoder.yudao.module.erp.dal.dataobject.finance.ErpAccountDO;
  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 +import java.math.BigDecimal;
  11 +import java.time.LocalDateTime;
  12 +
  13 +/**
  14 + * ERP 销售出库 DO
  15 + *
  16 + * @author 芋道源码
  17 + */
  18 +@TableName(value = "erp_sale_out")
  19 +@KeySequence("erp_sale_out_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  20 +@Data
  21 +@EqualsAndHashCode(callSuper = true)
  22 +@ToString(callSuper = true)
  23 +@Builder
  24 +@NoArgsConstructor
  25 +@AllArgsConstructor
  26 +public class ErpSaleOutDO extends BaseDO {
  27 +
  28 + /**
  29 + * 编号
  30 + */
  31 + @TableId
  32 + private Long id;
  33 + /**
  34 + * 销售出库单号
  35 + */
  36 + private String no;
  37 + /**
  38 + * 出库状态
  39 + *
  40 + * 枚举 {@link cn.iocoder.yudao.module.erp.enums.ErpAuditStatus}
  41 + */
  42 + private Integer status;
  43 + /**
  44 + * 客户编号
  45 + *
  46 + * 关联 {@link ErpCustomerDO#getId()}
  47 + */
  48 + private Long customerId;
  49 + /**
  50 + * 结算账户编号
  51 + *
  52 + * 关联 {@link ErpAccountDO#getId()}
  53 + */
  54 + private Long accountId;
  55 + /**
  56 + * 销售员编号
  57 + *
  58 + * 关联 AdminUserDO 的 id 字段
  59 + */
  60 + private Long saleUserId;
  61 + /**
  62 + * 出库时间
  63 + */
  64 + private LocalDateTime outTime;
  65 +
  66 + /**
  67 + * 销售订单编号
  68 + *
  69 + * 关联 {@link ErpSaleOrderDO#getId()}
  70 + */
  71 + private Long orderId;
  72 + /**
  73 + * 销售订单号
  74 + *
  75 + * 冗余 {@link ErpSaleOrderDO#getNo()}
  76 + */
  77 + private String orderNo;
  78 +
  79 + /**
  80 + * 合计数量
  81 + */
  82 + private BigDecimal totalCount;
  83 + /**
  84 + * 最终合计价格,单位:元
  85 + *
  86 + * totalPrice = totalProductPrice + totalTaxPrice - discountPrice
  87 + */
  88 + private BigDecimal totalPrice;
  89 +
  90 + /**
  91 + * 合计产品价格,单位:元
  92 + */
  93 + private BigDecimal totalProductPrice;
  94 + /**
  95 + * 合计税额,单位:元
  96 + */
  97 + private BigDecimal totalTaxPrice;
  98 + /**
  99 + * 优惠率,百分比
  100 + */
  101 + private BigDecimal discountPercent;
  102 + /**
  103 + * 优惠金额,单位:元
  104 + *
  105 + * discountPrice = (totalProductPrice + totalTaxPrice) * discountPercent
  106 + */
  107 + private BigDecimal discountPrice;
  108 + /**
  109 + * 其它金额,单位:元
  110 + */
  111 + private BigDecimal otherPrice;
  112 +
  113 + // TODO 芋艿:receiptPrice
  114 + /**
  115 + * 本次收款,单位:元
  116 + *
  117 + * payPrice = totalPrice + otherPrice - debtPrice
  118 + */
  119 + private BigDecimal payPrice;
  120 + /**
  121 + * 本次欠款,单位:元
  122 + */
  123 + private BigDecimal debtPrice;
  124 +
  125 + /**
  126 + * 附件地址
  127 + */
  128 + private String fileUrl;
  129 + /**
  130 + * 备注
  131 + */
  132 + private String remark;
  133 +
  134 +}
0 135 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/sale/ErpSaleOutItemDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.dataobject.sale;
  2 +
  3 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  4 +import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
  5 +import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockOutDO;
  6 +import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpWarehouseDO;
  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 + * ERP 销售出库项 DO
  16 + *
  17 + * @author 芋道源码
  18 + */
  19 +@TableName("erp_sale_out_items")
  20 +@KeySequence("erp_sale_out_items_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  21 +@Data
  22 +@EqualsAndHashCode(callSuper = true)
  23 +@ToString(callSuper = true)
  24 +@Builder
  25 +@NoArgsConstructor
  26 +@AllArgsConstructor
  27 +public class ErpSaleOutItemDO extends BaseDO {
  28 +
  29 + /**
  30 + * 编号
  31 + */
  32 + @TableId
  33 + private Long id;
  34 + /**
  35 + * 销售出库编号
  36 + *
  37 + * 关联 {@link ErpStockOutDO##getId()}
  38 + */
  39 + private Long outId;
  40 + /**
  41 + * 销售订单项编号
  42 + *
  43 + * 关联 {@link ErpSaleOrderItemDO#getId()}
  44 + * 目的:方便更新关联的销售订单项的出库数量
  45 + */
  46 + private Long orderItemId;
  47 + /**
  48 + * 仓库编号
  49 + *
  50 + * 关联 {@link ErpWarehouseDO#getId()}
  51 + */
  52 + private Long warehouseId;
  53 + /**
  54 + * 产品编号
  55 + *
  56 + * 关联 {@link ErpProductDO#getId()}
  57 + */
  58 + private Long productId;
  59 + /**
  60 + * 产品单位单位
  61 + *
  62 + * 冗余 {@link ErpProductDO#getUnitId()}
  63 + */
  64 + private Long productUnitId;
  65 +
  66 + /**
  67 + * 产品单位单价,单位:元
  68 + */
  69 + private BigDecimal productPrice;
  70 + /**
  71 + * 数量
  72 + */
  73 + private BigDecimal count;
  74 + /**
  75 + * 总价,单位:元
  76 + *
  77 + * totalPrice = productPrice * count
  78 + */
  79 + private BigDecimal totalPrice;
  80 + /**
  81 + * 税率,百分比
  82 + */
  83 + private BigDecimal taxPercent;
  84 + /**
  85 + * 税额,单位:元
  86 + *
  87 + * taxPrice = totalPrice * taxPercent
  88 + */
  89 + private BigDecimal taxPrice;
  90 +
  91 + /**
  92 + * 备注
  93 + */
  94 + private String remark;
  95 +
  96 +}
0 97 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/sale/ErpSaleReturnDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.dataobject.sale;
  2 +
  3 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  4 +import cn.iocoder.yudao.module.erp.dal.dataobject.finance.ErpAccountDO;
  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 +import java.math.BigDecimal;
  11 +import java.time.LocalDateTime;
  12 +
  13 +/**
  14 + * ERP 销售退货 DO
  15 + *
  16 + * @author 芋道源码
  17 + */
  18 +@TableName(value = "erp_sale_return")
  19 +@KeySequence("erp_sale_return_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  20 +@Data
  21 +@EqualsAndHashCode(callSuper = true)
  22 +@ToString(callSuper = true)
  23 +@Builder
  24 +@NoArgsConstructor
  25 +@AllArgsConstructor
  26 +public class ErpSaleReturnDO extends BaseDO {
  27 +
  28 + /**
  29 + * 编号
  30 + */
  31 + @TableId
  32 + private Long id;
  33 + /**
  34 + * 销售退货单号
  35 + */
  36 + private String no;
  37 + /**
  38 + * 退货状态
  39 + *
  40 + * 枚举 {@link cn.iocoder.yudao.module.erp.enums.ErpAuditStatus}
  41 + */
  42 + private Integer status;
  43 + /**
  44 + * 客户编号
  45 + *
  46 + * 关联 {@link ErpCustomerDO#getId()}
  47 + */
  48 + private Long customerId;
  49 + /**
  50 + * 结算账户编号
  51 + *
  52 + * 关联 {@link ErpAccountDO#getId()}
  53 + */
  54 + private Long accountId;
  55 + /**
  56 + * 销售员编号
  57 + *
  58 + * 关联 AdminUserDO 的 id 字段
  59 + */
  60 + private Long saleUserId;
  61 + /**
  62 + * 退货时间
  63 + */
  64 + private LocalDateTime returnTime;
  65 +
  66 + /**
  67 + * 销售订单编号
  68 + *
  69 + * 关联 {@link ErpSaleOrderDO#getId()}
  70 + */
  71 + private Long orderId;
  72 + /**
  73 + * 销售订单号
  74 + *
  75 + * 冗余 {@link ErpSaleOrderDO#getNo()}
  76 + */
  77 + private String orderNo;
  78 +
  79 + /**
  80 + * 合计数量
  81 + */
  82 + private BigDecimal totalCount;
  83 + /**
  84 + * 最终合计价格,单位:元
  85 + *
  86 + * totalPrice = totalProductPrice + totalTaxPrice - discountPrice
  87 + */
  88 + private BigDecimal totalPrice;
  89 +
  90 + /**
  91 + * 合计产品价格,单位:元
  92 + */
  93 + private BigDecimal totalProductPrice;
  94 + /**
  95 + * 合计税额,单位:元
  96 + */
  97 + private BigDecimal totalTaxPrice;
  98 + /**
  99 + * 优惠率,百分比
  100 + */
  101 + private BigDecimal discountPercent;
  102 + /**
  103 + * 优惠金额,单位:元
  104 + *
  105 + * discountPrice = (totalProductPrice + totalTaxPrice) * discountPercent
  106 + */
  107 + private BigDecimal discountPrice;
  108 + /**
  109 + * 其它金额,单位:元
  110 + */
  111 + private BigDecimal otherPrice;
  112 +
  113 + /**
  114 + * 本次收款,单位:元
  115 + *
  116 + * refundPrice = totalPrice + otherPrice - debtPrice
  117 + */
  118 + private BigDecimal refundPrice;
  119 + /**
  120 + * 本次欠款,单位:元
  121 + */
  122 + private BigDecimal debtPrice;
  123 +
  124 + /**
  125 + * 附件地址
  126 + */
  127 + private String fileUrl;
  128 + /**
  129 + * 备注
  130 + */
  131 + private String remark;
  132 +
  133 +}
0 134 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/sale/ErpSaleReturnItemDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.dataobject.sale;
  2 +
  3 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  4 +import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
  5 +import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpWarehouseDO;
  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 + * ERP 销售退货项 DO
  15 + *
  16 + * @author 芋道源码
  17 + */
  18 +@TableName("erp_sale_return_items")
  19 +@KeySequence("erp_sale_return_items_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  20 +@Data
  21 +@EqualsAndHashCode(callSuper = true)
  22 +@ToString(callSuper = true)
  23 +@Builder
  24 +@NoArgsConstructor
  25 +@AllArgsConstructor
  26 +public class ErpSaleReturnItemDO extends BaseDO {
  27 +
  28 + /**
  29 + * 编号
  30 + */
  31 + @TableId
  32 + private Long id;
  33 + /**
  34 + * 销售退货编号
  35 + *
  36 + * 关联 {@link ErpSaleReturnDO##getId()}
  37 + */
  38 + private Long returnId;
  39 + /**
  40 + * 销售订单项编号
  41 + *
  42 + * 关联 {@link ErpSaleOrderItemDO#getId()}
  43 + * 目的:方便更新关联的销售订单项的退货数量
  44 + */
  45 + private Long orderItemId;
  46 + /**
  47 + * 仓库编号
  48 + *
  49 + * 关联 {@link ErpWarehouseDO#getId()}
  50 + */
  51 + private Long warehouseId;
  52 + /**
  53 + * 产品编号
  54 + *
  55 + * 关联 {@link ErpProductDO#getId()}
  56 + */
  57 + private Long productId;
  58 + /**
  59 + * 产品单位单位
  60 + *
  61 + * 冗余 {@link ErpProductDO#getUnitId()}
  62 + */
  63 + private Long productUnitId;
  64 +
  65 + /**
  66 + * 产品单位单价,单位:元
  67 + */
  68 + private BigDecimal productPrice;
  69 + /**
  70 + * 数量
  71 + */
  72 + private BigDecimal count;
  73 + /**
  74 + * 总价,单位:元
  75 + *
  76 + * totalPrice = productPrice * count
  77 + */
  78 + private BigDecimal totalPrice;
  79 + /**
  80 + * 税率,百分比
  81 + */
  82 + private BigDecimal taxPercent;
  83 + /**
  84 + * 税额,单位:元
  85 + *
  86 + * taxPrice = totalPrice * taxPercent
  87 + */
  88 + private BigDecimal taxPrice;
  89 +
  90 + /**
  91 + * 备注
  92 + */
  93 + private String remark;
  94 +
  95 +}
0 96 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/stock/ErpStockCheckDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.dataobject.stock;
  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 +import java.time.LocalDateTime;
  11 +
  12 +/**
  13 + * ERP 库存盘点单 DO
  14 + *
  15 + * @author 芋道源码
  16 + */
  17 +@TableName("erp_stock_check")
  18 +@KeySequence("erp_stock_check_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  19 +@Data
  20 +@EqualsAndHashCode(callSuper = true)
  21 +@ToString(callSuper = true)
  22 +@Builder
  23 +@NoArgsConstructor
  24 +@AllArgsConstructor
  25 +public class ErpStockCheckDO extends BaseDO {
  26 +
  27 + /**
  28 + * 盘点编号
  29 + */
  30 + @TableId
  31 + private Long id;
  32 + /**
  33 + * 盘点单号
  34 + */
  35 + private String no;
  36 + /**
  37 + * 盘点时间
  38 + */
  39 + private LocalDateTime checkTime;
  40 + /**
  41 + * 合计数量
  42 + */
  43 + private BigDecimal totalCount;
  44 + /**
  45 + * 合计金额,单位:元
  46 + */
  47 + private BigDecimal totalPrice;
  48 + /**
  49 + * 状态
  50 + *
  51 + * 枚举 {@link cn.iocoder.yudao.module.erp.enums.ErpAuditStatus}
  52 + */
  53 + private Integer status;
  54 + /**
  55 + * 备注
  56 + */
  57 + private String remark;
  58 + /**
  59 + * 附件 URL
  60 + */
  61 + private String fileUrl;
  62 +
  63 +}
0 64 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/stock/ErpStockCheckItemDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.dataobject.stock;
  2 +
  3 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  4 +import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
  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 +import java.math.BigDecimal;
  11 +
  12 +/**
  13 + * ERP 库存盘点单项 DO
  14 + *
  15 + * @author 芋道源码
  16 + */
  17 +@TableName("erp_stock_check_item")
  18 +@KeySequence("erp_stock_check_item_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  19 +@Data
  20 +@EqualsAndHashCode(callSuper = true)
  21 +@ToString(callSuper = true)
  22 +@Builder
  23 +@NoArgsConstructor
  24 +@AllArgsConstructor
  25 +public class ErpStockCheckItemDO extends BaseDO {
  26 +
  27 + /**
  28 + * 盘点项编号
  29 + */
  30 + @TableId
  31 + private Long id;
  32 + /**
  33 + * 盘点编号
  34 + *
  35 + * 关联 {@link ErpStockCheckDO#getId()}
  36 + */
  37 + private Long checkId;
  38 + /**
  39 + * 仓库编号
  40 + *
  41 + * 关联 {@link ErpWarehouseDO#getId()}
  42 + */
  43 + private Long warehouseId;
  44 + /**
  45 + * 产品编号
  46 + *
  47 + * 关联 {@link ErpProductDO#getId()}
  48 + */
  49 + private Long productId;
  50 + /**
  51 + * 产品单位编号
  52 + *
  53 + * 冗余 {@link ErpProductDO#getUnitId()}
  54 + */
  55 + private Long productUnitId;
  56 + /**
  57 + * 产品单价
  58 + */
  59 + private BigDecimal productPrice;
  60 + /**
  61 + * 账面数量(当前库存)
  62 + */
  63 + private BigDecimal stockCount;
  64 + /**
  65 + * 实际数量(实际库存)
  66 + */
  67 + private BigDecimal actualCount;
  68 + /**
  69 + * 盈亏数量
  70 + *
  71 + * count = stockCount - actualCount
  72 + */
  73 + private BigDecimal count;
  74 + /**
  75 + * 合计金额,单位:元
  76 + */
  77 + private BigDecimal totalPrice;
  78 + /**
  79 + * 备注
  80 + */
  81 + private String remark;
  82 +
  83 +}
0 84 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/stock/ErpStockInDO.java
1 1 package cn.iocoder.yudao.module.erp.dal.dataobject.stock;
2 2  
3 3 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  4 +import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpSupplierDO;
4 5 import com.baomidou.mybatisplus.annotation.KeySequence;
5 6 import com.baomidou.mybatisplus.annotation.TableId;
6 7 import com.baomidou.mybatisplus.annotation.TableName;
... ... @@ -36,7 +37,7 @@ public class ErpStockInDO extends BaseDO {
36 37 /**
37 38 * 供应商编号
38 39 *
39   - * TODO 芋艿:待关联
  40 + * 关联 {@link ErpSupplierDO#getId()}
40 41 */
41 42 private Long supplierId;
42 43 /**
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/stock/ErpStockMoveDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.dataobject.stock;
  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 +import java.time.LocalDateTime;
  11 +
  12 +/**
  13 + * ERP 库存调拨单 DO
  14 + *
  15 + * @author 芋道源码
  16 + */
  17 +@TableName("erp_stock_move")
  18 +@KeySequence("erp_stock_move_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  19 +@Data
  20 +@EqualsAndHashCode(callSuper = true)
  21 +@ToString(callSuper = true)
  22 +@Builder
  23 +@NoArgsConstructor
  24 +@AllArgsConstructor
  25 +public class ErpStockMoveDO extends BaseDO {
  26 +
  27 + /**
  28 + * 调拨编号
  29 + */
  30 + @TableId
  31 + private Long id;
  32 + /**
  33 + * 调拨单号
  34 + */
  35 + private String no;
  36 + /**
  37 + * 调拨时间
  38 + */
  39 + private LocalDateTime moveTime;
  40 + /**
  41 + * 合计数量
  42 + */
  43 + private BigDecimal totalCount;
  44 + /**
  45 + * 合计金额,单位:元
  46 + */
  47 + private BigDecimal totalPrice;
  48 + /**
  49 + * 状态
  50 + *
  51 + * 枚举 {@link cn.iocoder.yudao.module.erp.enums.ErpAuditStatus}
  52 + */
  53 + private Integer status;
  54 + /**
  55 + * 备注
  56 + */
  57 + private String remark;
  58 + /**
  59 + * 附件 URL
  60 + */
  61 + private String fileUrl;
  62 +
  63 +}
0 64 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/stock/ErpStockMoveItemDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.dataobject.stock;
  2 +
  3 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  4 +import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
  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 +import java.math.BigDecimal;
  11 +
  12 +/**
  13 + * ERP 库存调拨单项 DO
  14 + *
  15 + * @author 芋道源码
  16 + */
  17 +@TableName("erp_stock_move_item")
  18 +@KeySequence("erp_stock_move_item_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  19 +@Data
  20 +@EqualsAndHashCode(callSuper = true)
  21 +@ToString(callSuper = true)
  22 +@Builder
  23 +@NoArgsConstructor
  24 +@AllArgsConstructor
  25 +public class ErpStockMoveItemDO extends BaseDO {
  26 +
  27 + /**
  28 + * 调拨项编号
  29 + */
  30 + @TableId
  31 + private Long id;
  32 + /**
  33 + * 调拨编号
  34 + *
  35 + * 关联 {@link ErpStockMoveDO#getId()}
  36 + */
  37 + private Long moveId;
  38 + /**
  39 + * 调出仓库编号
  40 + *
  41 + * 关联 {@link ErpWarehouseDO#getId()}
  42 + */
  43 + private Long fromWarehouseId;
  44 + /**
  45 + * 调入仓库编号
  46 + *
  47 + * 关联 {@link ErpWarehouseDO#getId()}
  48 + */
  49 + private Long toWarehouseId;
  50 + /**
  51 + * 产品编号
  52 + *
  53 + * 关联 {@link ErpProductDO#getId()}
  54 + */
  55 + private Long productId;
  56 + /**
  57 + * 产品单位编号
  58 + *
  59 + * 冗余 {@link ErpProductDO#getUnitId()}
  60 + */
  61 + private Long productUnitId;
  62 + /**
  63 + * 产品单价
  64 + */
  65 + private BigDecimal productPrice;
  66 + /**
  67 + * 产品数量
  68 + */
  69 + private BigDecimal count;
  70 + /**
  71 + * 合计金额,单位:元
  72 + */
  73 + private BigDecimal totalPrice;
  74 + /**
  75 + * 备注
  76 + */
  77 + private String remark;
  78 +
  79 +}
0 80 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/stock/ErpStockOutDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.dataobject.stock;
  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 +import java.time.LocalDateTime;
  11 +
  12 +/**
  13 + * ERP 其它出库单 DO
  14 + *
  15 + * @author 芋道源码
  16 + */
  17 +@TableName("erp_stock_out")
  18 +@KeySequence("erp_stock_out_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  19 +@Data
  20 +@EqualsAndHashCode(callSuper = true)
  21 +@ToString(callSuper = true)
  22 +@Builder
  23 +@NoArgsConstructor
  24 +@AllArgsConstructor
  25 +public class ErpStockOutDO extends BaseDO {
  26 +
  27 + /**
  28 + * 出库编号
  29 + */
  30 + @TableId
  31 + private Long id;
  32 + /**
  33 + * 出库单号
  34 + */
  35 + private String no;
  36 + /**
  37 + * 客户编号
  38 + *
  39 + * TODO 芋艿:待关联
  40 + */
  41 + private Long customerId;
  42 + /**
  43 + * 出库时间
  44 + */
  45 + private LocalDateTime outTime;
  46 + /**
  47 + * 合计数量
  48 + */
  49 + private BigDecimal totalCount;
  50 + /**
  51 + * 合计金额,单位:元
  52 + */
  53 + private BigDecimal totalPrice;
  54 + /**
  55 + * 状态
  56 + *
  57 + * 枚举 {@link cn.iocoder.yudao.module.erp.enums.ErpAuditStatus}
  58 + */
  59 + private Integer status;
  60 + /**
  61 + * 备注
  62 + */
  63 + private String remark;
  64 + /**
  65 + * 附件 URL
  66 + */
  67 + private String fileUrl;
  68 +
  69 +}
0 70 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/stock/ErpStockOutItemDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.dataobject.stock;
  2 +
  3 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  4 +import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
  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 +import java.math.BigDecimal;
  11 +
  12 +/**
  13 + * ERP 其它出库单项 DO
  14 + *
  15 + * @author 芋道源码
  16 + */
  17 +@TableName("erp_stock_out_item")
  18 +@KeySequence("erp_stock_out_item_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  19 +@Data
  20 +@EqualsAndHashCode(callSuper = true)
  21 +@ToString(callSuper = true)
  22 +@Builder
  23 +@NoArgsConstructor
  24 +@AllArgsConstructor
  25 +public class ErpStockOutItemDO extends BaseDO {
  26 +
  27 + /**
  28 + * 出库项编号
  29 + */
  30 + @TableId
  31 + private Long id;
  32 + /**
  33 + * 出库编号
  34 + *
  35 + * 关联 {@link ErpStockOutDO#getId()}
  36 + */
  37 + private Long outId;
  38 + /**
  39 + * 仓库编号
  40 + *
  41 + * 关联 {@link ErpWarehouseDO#getId()}
  42 + */
  43 + private Long warehouseId;
  44 + /**
  45 + * 产品编号
  46 + *
  47 + * 关联 {@link ErpProductDO#getId()}
  48 + */
  49 + private Long productId;
  50 + /**
  51 + * 产品单位编号
  52 + *
  53 + * 冗余 {@link ErpProductDO#getUnitId()}
  54 + */
  55 + private Long productUnitId;
  56 + /**
  57 + * 产品单价
  58 + */
  59 + private BigDecimal productPrice;
  60 + /**
  61 + * 产品数量
  62 + */
  63 + private BigDecimal count;
  64 + /**
  65 + * 合计金额,单位:元
  66 + */
  67 + private BigDecimal totalPrice;
  68 + /**
  69 + * 备注
  70 + */
  71 + private String remark;
  72 +
  73 +}
0 74 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/stock/ErpStockRecordDO.java
... ... @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.erp.dal.dataobject.stock;
2 2  
3 3 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
4 4 import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
  5 +import cn.iocoder.yudao.module.erp.enums.stock.ErpStockRecordBizTypeEnum;
5 6 import com.baomidou.mybatisplus.annotation.KeySequence;
6 7 import com.baomidou.mybatisplus.annotation.TableId;
7 8 import com.baomidou.mybatisplus.annotation.TableName;
... ... @@ -56,25 +57,25 @@ public class ErpStockRecordDO extends BaseDO {
56 57 /**
57 58 * 业务类型
58 59 *
59   - * 枚举 {@link cn.iocoder.yudao.module.erp.enums.stock.ErpStockRecordBizTypeEnum}
  60 + * 枚举 {@link ErpStockRecordBizTypeEnum}
60 61 */
61 62 private Integer bizType;
62 63 /**
63 64 * 业务编号
64 65 *
65   - * 例如说:TODO
  66 + * 例如说:{@link ErpStockInDO#getId()}
66 67 */
67 68 private Long bizId;
68 69 /**
69 70 * 业务项编号
70 71 *
71   - * 例如说:TODO
  72 + * 例如说:{@link ErpStockInItemDO#getId()}
72 73 */
73 74 private Long bizItemId;
74 75 /**
75 76 * 业务单号
76 77 *
77   - * 例如说:TODO
  78 + * 例如说:{@link ErpStockInDO#getNo()}
78 79 */
79 80 private String bizNo;
80 81  
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/mysql/finance/ErpAccountMapper.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.mysql.finance;
  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.erp.controller.admin.finance.vo.account.ErpAccountPageReqVO;
  7 +import cn.iocoder.yudao.module.erp.dal.dataobject.finance.ErpAccountDO;
  8 +import org.apache.ibatis.annotations.Mapper;
  9 +
  10 +import java.util.List;
  11 +
  12 +/**
  13 + * ERP 结算账户 Mapper
  14 + *
  15 + * @author 芋道源码
  16 + */
  17 +@Mapper
  18 +public interface ErpAccountMapper extends BaseMapperX<ErpAccountDO> {
  19 +
  20 + default PageResult<ErpAccountDO> selectPage(ErpAccountPageReqVO reqVO) {
  21 + return selectPage(reqVO, new LambdaQueryWrapperX<ErpAccountDO>()
  22 + .likeIfPresent(ErpAccountDO::getName, reqVO.getName())
  23 + .likeIfPresent(ErpAccountDO::getNo, reqVO.getNo())
  24 + .eqIfPresent(ErpAccountDO::getRemark, reqVO.getRemark())
  25 + .orderByDesc(ErpAccountDO::getId));
  26 + }
  27 +
  28 + default ErpAccountDO selectByDefaultStatus() {
  29 + return selectOne(ErpAccountDO::getDefaultStatus, true);
  30 + }
  31 +
  32 + default List<ErpAccountDO> selectListByStatus(Integer status) {
  33 + return selectList(ErpAccountDO::getStatus, status);
  34 + }
  35 +
  36 +}
0 37 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/mysql/finance/ErpFinancePaymentItemMapper.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.mysql.finance;
  2 +
  3 +import cn.hutool.core.collection.CollUtil;
  4 +import cn.hutool.core.map.MapUtil;
  5 +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
  6 +import cn.iocoder.yudao.module.erp.dal.dataobject.finance.ErpFinancePaymentItemDO;
  7 +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  8 +import org.apache.ibatis.annotations.Mapper;
  9 +
  10 +import java.math.BigDecimal;
  11 +import java.util.Collection;
  12 +import java.util.List;
  13 +import java.util.Map;
  14 +
  15 +/**
  16 + * ERP 付款单项 Mapper
  17 + *
  18 + * @author 芋道源码
  19 + */
  20 +@Mapper
  21 +public interface ErpFinancePaymentItemMapper extends BaseMapperX<ErpFinancePaymentItemDO> {
  22 +
  23 + default List<ErpFinancePaymentItemDO> selectListByPaymentId(Long paymentId) {
  24 + return selectList(ErpFinancePaymentItemDO::getPaymentId, paymentId);
  25 + }
  26 +
  27 + default List<ErpFinancePaymentItemDO> selectListByPaymentIds(Collection<Long> paymentIds) {
  28 + return selectList(ErpFinancePaymentItemDO::getPaymentId, paymentIds);
  29 + }
  30 +
  31 + default BigDecimal selectPaymentPriceSumByBizIdAndBizType(Long bizId, Integer bizType) {
  32 + // SQL sum 查询
  33 + List<Map<String, Object>> result = selectMaps(new QueryWrapper<ErpFinancePaymentItemDO>()
  34 + .select("SUM(payment_price) AS paymentPriceSum")
  35 + .eq("biz_id", bizId)
  36 + .eq("biz_type", bizType));
  37 + // 获得数量
  38 + if (CollUtil.isEmpty(result)) {
  39 + return BigDecimal.ZERO;
  40 + }
  41 + return BigDecimal.valueOf(MapUtil.getDouble(result.get(0), "paymentPriceSum", 0D));
  42 + }
  43 +
  44 +}
0 45 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/mysql/finance/ErpFinancePaymentMapper.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.mysql.finance;
  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.erp.controller.admin.finance.vo.payment.ErpFinancePaymentPageReqVO;
  7 +import cn.iocoder.yudao.module.erp.dal.dataobject.finance.ErpFinancePaymentDO;
  8 +import cn.iocoder.yudao.module.erp.dal.dataobject.finance.ErpFinancePaymentItemDO;
  9 +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
  10 +import org.apache.ibatis.annotations.Mapper;
  11 +
  12 +/**
  13 + * ERP 付款单 Mapper
  14 + *
  15 + * @author 芋道源码
  16 + */
  17 +@Mapper
  18 +public interface ErpFinancePaymentMapper extends BaseMapperX<ErpFinancePaymentDO> {
  19 +
  20 + default PageResult<ErpFinancePaymentDO> selectPage(ErpFinancePaymentPageReqVO reqVO) {
  21 + MPJLambdaWrapperX<ErpFinancePaymentDO> query = new MPJLambdaWrapperX<ErpFinancePaymentDO>()
  22 + .likeIfPresent(ErpFinancePaymentDO::getNo, reqVO.getNo())
  23 + .betweenIfPresent(ErpFinancePaymentDO::getPaymentTime, reqVO.getPaymentTime())
  24 + .eqIfPresent(ErpFinancePaymentDO::getSupplierId, reqVO.getSupplierId())
  25 + .eqIfPresent(ErpFinancePaymentDO::getCreator, reqVO.getCreator())
  26 + .eqIfPresent(ErpFinancePaymentDO::getFinanceUserId, reqVO.getFinanceUserId())
  27 + .eqIfPresent(ErpFinancePaymentDO::getAccountId, reqVO.getAccountId())
  28 + .eqIfPresent(ErpFinancePaymentDO::getStatus, reqVO.getStatus())
  29 + .likeIfPresent(ErpFinancePaymentDO::getRemark, reqVO.getRemark())
  30 + .orderByDesc(ErpFinancePaymentDO::getId);
  31 + if (reqVO.getBizNo() != null) {
  32 + query.leftJoin(ErpFinancePaymentItemDO.class, ErpFinancePaymentItemDO::getPaymentId, ErpFinancePaymentDO::getId)
  33 + .eq(reqVO.getBizNo() != null, ErpFinancePaymentItemDO::getBizNo, reqVO.getBizNo())
  34 + .groupBy(ErpFinancePaymentDO::getId); // 避免 1 对多查询,产生相同的 1
  35 + }
  36 + return selectJoinPage(reqVO, ErpFinancePaymentDO.class, query);
  37 + }
  38 +
  39 + default int updateByIdAndStatus(Long id, Integer status, ErpFinancePaymentDO updateObj) {
  40 + return update(updateObj, new LambdaUpdateWrapper<ErpFinancePaymentDO>()
  41 + .eq(ErpFinancePaymentDO::getId, id).eq(ErpFinancePaymentDO::getStatus, status));
  42 + }
  43 +
  44 + default ErpFinancePaymentDO selectByNo(String no) {
  45 + return selectOne(ErpFinancePaymentDO::getNo, no);
  46 + }
  47 +
  48 +}
0 49 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/mysql/purchase/ErpPurchaseInItemMapper.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.mysql.purchase;
  2 +
  3 +import cn.hutool.core.collection.CollUtil;
  4 +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
  5 +import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchaseInItemDO;
  6 +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  7 +import org.apache.ibatis.annotations.Mapper;
  8 +
  9 +import java.math.BigDecimal;
  10 +import java.util.Collection;
  11 +import java.util.Collections;
  12 +import java.util.List;
  13 +import java.util.Map;
  14 +
  15 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
  16 +
  17 +/**
  18 + * ERP 采购入库项 Mapper
  19 + *
  20 + * @author 芋道源码
  21 + */
  22 +@Mapper
  23 +public interface ErpPurchaseInItemMapper extends BaseMapperX<ErpPurchaseInItemDO> {
  24 +
  25 + default List<ErpPurchaseInItemDO> selectListByInId(Long inId) {
  26 + return selectList(ErpPurchaseInItemDO::getInId, inId);
  27 + }
  28 +
  29 + default List<ErpPurchaseInItemDO> selectListByInIds(Collection<Long> inIds) {
  30 + return selectList(ErpPurchaseInItemDO::getInId, inIds);
  31 + }
  32 +
  33 + default int deleteByInId(Long inId) {
  34 + return delete(ErpPurchaseInItemDO::getInId, inId);
  35 + }
  36 +
  37 + /**
  38 + * 基于采购订单编号,查询每个采购订单项的入库数量之和
  39 + *
  40 + * @param inIds 入库订单项编号数组
  41 + * @return key:采购订单项编号;value:入库数量之和
  42 + */
  43 + default Map<Long, BigDecimal> selectOrderItemCountSumMapByInIds(Collection<Long> inIds) {
  44 + if (CollUtil.isEmpty(inIds)) {
  45 + return Collections.emptyMap();
  46 + }
  47 + // SQL sum 查询
  48 + List<Map<String, Object>> result = selectMaps(new QueryWrapper<ErpPurchaseInItemDO>()
  49 + .select("order_item_id, SUM(count) AS sumCount")
  50 + .groupBy("order_item_id")
  51 + .in("in_id", inIds));
  52 + // 获得数量
  53 + return convertMap(result, obj -> (Long) obj.get("order_item_id"), obj -> (BigDecimal) obj.get("sumCount"));
  54 + }
  55 +
  56 +}
0 57 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/mysql/purchase/ErpPurchaseInMapper.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.mysql.purchase;
  2 +
  3 +
  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.MPJLambdaWrapperX;
  7 +import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.in.ErpPurchaseInPageReqVO;
  8 +import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchaseInDO;
  9 +import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchaseInItemDO;
  10 +import cn.iocoder.yudao.module.erp.enums.ErpAuditStatus;
  11 +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
  12 +import org.apache.ibatis.annotations.Mapper;
  13 +
  14 +import java.util.List;
  15 +import java.util.Objects;
  16 +
  17 +/**
  18 + * ERP 采购入库 Mapper
  19 + *
  20 + * @author 芋道源码
  21 + */
  22 +@Mapper
  23 +public interface ErpPurchaseInMapper extends BaseMapperX<ErpPurchaseInDO> {
  24 +
  25 + default PageResult<ErpPurchaseInDO> selectPage(ErpPurchaseInPageReqVO reqVO) {
  26 + MPJLambdaWrapperX<ErpPurchaseInDO> query = new MPJLambdaWrapperX<ErpPurchaseInDO>()
  27 + .likeIfPresent(ErpPurchaseInDO::getNo, reqVO.getNo())
  28 + .eqIfPresent(ErpPurchaseInDO::getSupplierId, reqVO.getSupplierId())
  29 + .betweenIfPresent(ErpPurchaseInDO::getInTime, reqVO.getInTime())
  30 + .eqIfPresent(ErpPurchaseInDO::getStatus, reqVO.getStatus())
  31 + .likeIfPresent(ErpPurchaseInDO::getRemark, reqVO.getRemark())
  32 + .eqIfPresent(ErpPurchaseInDO::getCreator, reqVO.getCreator())
  33 + .eqIfPresent(ErpPurchaseInDO::getAccountId, reqVO.getAccountId())
  34 + .likeIfPresent(ErpPurchaseInDO::getOrderNo, reqVO.getOrderNo())
  35 + .orderByDesc(ErpPurchaseInDO::getId);
  36 + // 付款状态。为什么需要 t. 的原因,是因为联表查询时,需要指定表名,不然会报字段不存在的错误
  37 + if (Objects.equals(reqVO.getPaymentStatus(), ErpPurchaseInPageReqVO.PAYMENT_STATUS_NONE)) {
  38 + query.eq(ErpPurchaseInDO::getPaymentPrice, 0);
  39 + } else if (Objects.equals(reqVO.getPaymentStatus(), ErpPurchaseInPageReqVO.PAYMENT_STATUS_PART)) {
  40 + query.gt(ErpPurchaseInDO::getPaymentPrice, 0).apply("t.payment_price < t.total_price");
  41 + } else if (Objects.equals(reqVO.getPaymentStatus(), ErpPurchaseInPageReqVO.PAYMENT_STATUS_ALL)) {
  42 + query.apply("t.payment_price = t.total_price");
  43 + }
  44 + if (Boolean.TRUE.equals(reqVO.getPaymentEnable())) {
  45 + query.eq(ErpPurchaseInDO::getStatus, ErpAuditStatus.APPROVE.getStatus())
  46 + .apply("t.payment_price < t.total_price");
  47 + }
  48 + if (reqVO.getWarehouseId() != null || reqVO.getProductId() != null) {
  49 + query.leftJoin(ErpPurchaseInItemDO.class, ErpPurchaseInItemDO::getInId, ErpPurchaseInDO::getId)
  50 + .eq(reqVO.getWarehouseId() != null, ErpPurchaseInItemDO::getWarehouseId, reqVO.getWarehouseId())
  51 + .eq(reqVO.getProductId() != null, ErpPurchaseInItemDO::getProductId, reqVO.getProductId())
  52 + .groupBy(ErpPurchaseInDO::getId); // 避免 1 对多查询,产生相同的 1
  53 + }
  54 + return selectJoinPage(reqVO, ErpPurchaseInDO.class, query);
  55 + }
  56 +
  57 + default int updateByIdAndStatus(Long id, Integer status, ErpPurchaseInDO updateObj) {
  58 + return update(updateObj, new LambdaUpdateWrapper<ErpPurchaseInDO>()
  59 + .eq(ErpPurchaseInDO::getId, id).eq(ErpPurchaseInDO::getStatus, status));
  60 + }
  61 +
  62 + default ErpPurchaseInDO selectByNo(String no) {
  63 + return selectOne(ErpPurchaseInDO::getNo, no);
  64 + }
  65 +
  66 + default List<ErpPurchaseInDO> selectListByOrderId(Long orderId) {
  67 + return selectList(ErpPurchaseInDO::getOrderId, orderId);
  68 + }
  69 +
  70 +}
0 71 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/mysql/purchase/ErpPurchaseOrderItemMapper.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.mysql.purchase;
  2 +
  3 +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
  4 +import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchaseOrderItemDO;
  5 +import org.apache.ibatis.annotations.Mapper;
  6 +
  7 +import java.util.Collection;
  8 +import java.util.List;
  9 +
  10 +/**
  11 + * ERP 采购订单明项目 Mapper
  12 + *
  13 + * @author 芋道源码
  14 + */
  15 +@Mapper
  16 +public interface ErpPurchaseOrderItemMapper extends BaseMapperX<ErpPurchaseOrderItemDO> {
  17 +
  18 + default List<ErpPurchaseOrderItemDO> selectListByOrderId(Long orderId) {
  19 + return selectList(ErpPurchaseOrderItemDO::getOrderId, orderId);
  20 + }
  21 +
  22 + default List<ErpPurchaseOrderItemDO> selectListByOrderIds(Collection<Long> orderIds) {
  23 + return selectList(ErpPurchaseOrderItemDO::getOrderId, orderIds);
  24 + }
  25 +
  26 + default int deleteByOrderId(Long orderId) {
  27 + return delete(ErpPurchaseOrderItemDO::getOrderId, orderId);
  28 + }
  29 +
  30 +}
0 31 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/mysql/purchase/ErpPurchaseOrderMapper.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.mysql.purchase;
  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.erp.controller.admin.purchase.vo.order.ErpPurchaseOrderPageReqVO;
  7 +import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchaseOrderDO;
  8 +import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchaseOrderItemDO;
  9 +import cn.iocoder.yudao.module.erp.enums.ErpAuditStatus;
  10 +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
  11 +import org.apache.ibatis.annotations.Mapper;
  12 +
  13 +import java.util.Objects;
  14 +
  15 +/**
  16 + * ERP 采购订单 Mapper
  17 + *
  18 + * @author 芋道源码
  19 + */
  20 +@Mapper
  21 +public interface ErpPurchaseOrderMapper extends BaseMapperX<ErpPurchaseOrderDO> {
  22 +
  23 + default PageResult<ErpPurchaseOrderDO> selectPage(ErpPurchaseOrderPageReqVO reqVO) {
  24 + MPJLambdaWrapperX<ErpPurchaseOrderDO> query = new MPJLambdaWrapperX<ErpPurchaseOrderDO>()
  25 + .likeIfPresent(ErpPurchaseOrderDO::getNo, reqVO.getNo())
  26 + .eqIfPresent(ErpPurchaseOrderDO::getSupplierId, reqVO.getSupplierId())
  27 + .betweenIfPresent(ErpPurchaseOrderDO::getOrderTime, reqVO.getOrderTime())
  28 + .eqIfPresent(ErpPurchaseOrderDO::getStatus, reqVO.getStatus())
  29 + .likeIfPresent(ErpPurchaseOrderDO::getRemark, reqVO.getRemark())
  30 + .eqIfPresent(ErpPurchaseOrderDO::getCreator, reqVO.getCreator())
  31 + .orderByDesc(ErpPurchaseOrderDO::getId);
  32 + // 入库状态。为什么需要 t. 的原因,是因为联表查询时,需要指定表名,不然会报 in_count 错误
  33 + if (Objects.equals(reqVO.getInStatus(), ErpPurchaseOrderPageReqVO.IN_STATUS_NONE)) {
  34 + query.eq(ErpPurchaseOrderDO::getInCount, 0);
  35 + } else if (Objects.equals(reqVO.getInStatus(), ErpPurchaseOrderPageReqVO.IN_STATUS_PART)) {
  36 + query.gt(ErpPurchaseOrderDO::getInCount, 0).apply("t.in_count < t.total_count");
  37 + } else if (Objects.equals(reqVO.getInStatus(), ErpPurchaseOrderPageReqVO.IN_STATUS_ALL)) {
  38 + query.apply("t.in_count = t.total_count");
  39 + }
  40 + // 退货状态
  41 + if (Objects.equals(reqVO.getReturnStatus(), ErpPurchaseOrderPageReqVO.RETURN_STATUS_NONE)) {
  42 + query.eq(ErpPurchaseOrderDO::getReturnCount, 0);
  43 + } else if (Objects.equals(reqVO.getReturnStatus(), ErpPurchaseOrderPageReqVO.RETURN_STATUS_PART)) {
  44 + query.gt(ErpPurchaseOrderDO::getReturnCount, 0).apply("t.return_count < t.total_count");
  45 + } else if (Objects.equals(reqVO.getReturnStatus(), ErpPurchaseOrderPageReqVO.RETURN_STATUS_ALL)) {
  46 + query.apply("t.return_count = t.total_count");
  47 + }
  48 + // 可采购入库
  49 + if (Boolean.TRUE.equals(reqVO.getInEnable())) {
  50 + query.eq(ErpPurchaseOrderDO::getStatus, ErpAuditStatus.APPROVE.getStatus())
  51 + .apply("t.in_count < t.total_count");
  52 + }
  53 + // 可采购退货
  54 + if (Boolean.TRUE.equals(reqVO.getReturnEnable())) {
  55 + query.eq(ErpPurchaseOrderDO::getStatus, ErpAuditStatus.APPROVE.getStatus())
  56 + .apply("t.return_count < t.in_count");
  57 + }
  58 + if (reqVO.getProductId() != null) {
  59 + query.leftJoin(ErpPurchaseOrderItemDO.class, ErpPurchaseOrderItemDO::getOrderId, ErpPurchaseOrderDO::getId)
  60 + .eq(reqVO.getProductId() != null, ErpPurchaseOrderItemDO::getProductId, reqVO.getProductId())
  61 + .groupBy(ErpPurchaseOrderDO::getId); // 避免 1 对多查询,产生相同的 1
  62 + }
  63 + return selectJoinPage(reqVO, ErpPurchaseOrderDO.class, query);
  64 + }
  65 +
  66 + default int updateByIdAndStatus(Long id, Integer status, ErpPurchaseOrderDO updateObj) {
  67 + return update(updateObj, new LambdaUpdateWrapper<ErpPurchaseOrderDO>()
  68 + .eq(ErpPurchaseOrderDO::getId, id).eq(ErpPurchaseOrderDO::getStatus, status));
  69 + }
  70 +
  71 + default ErpPurchaseOrderDO selectByNo(String no) {
  72 + return selectOne(ErpPurchaseOrderDO::getNo, no);
  73 + }
  74 +
  75 +}
0 76 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/mysql/purchase/ErpPurchaseReturnItemMapper.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.mysql.purchase;
  2 +
  3 +import cn.hutool.core.collection.CollUtil;
  4 +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
  5 +import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchaseReturnItemDO;
  6 +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  7 +import org.apache.ibatis.annotations.Mapper;
  8 +
  9 +import java.math.BigDecimal;
  10 +import java.util.Collection;
  11 +import java.util.Collections;
  12 +import java.util.List;
  13 +import java.util.Map;
  14 +
  15 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
  16 +
  17 +/**
  18 + * ERP 采购退货项 Mapper
  19 + *
  20 + * @author 芋道源码
  21 + */
  22 +@Mapper
  23 +public interface ErpPurchaseReturnItemMapper extends BaseMapperX<ErpPurchaseReturnItemDO> {
  24 +
  25 + default List<ErpPurchaseReturnItemDO> selectListByReturnId(Long returnId) {
  26 + return selectList(ErpPurchaseReturnItemDO::getReturnId, returnId);
  27 + }
  28 +
  29 + default List<ErpPurchaseReturnItemDO> selectListByReturnIds(Collection<Long> returnIds) {
  30 + return selectList(ErpPurchaseReturnItemDO::getReturnId, returnIds);
  31 + }
  32 +
  33 + default int deleteByReturnId(Long returnId) {
  34 + return delete(ErpPurchaseReturnItemDO::getReturnId, returnId);
  35 + }
  36 +
  37 + /**
  38 + * 基于采购订单编号,查询每个采购订单项的退货数量之和
  39 + *
  40 + * @param returnIds 入库订单项编号数组
  41 + * @return key:采购订单项编号;value:退货数量之和
  42 + */
  43 + default Map<Long, BigDecimal> selectOrderItemCountSumMapByReturnIds(Collection<Long> returnIds) {
  44 + if (CollUtil.isEmpty(returnIds)) {
  45 + return Collections.emptyMap();
  46 + }
  47 + // SQL sum 查询
  48 + List<Map<String, Object>> result = selectMaps(new QueryWrapper<ErpPurchaseReturnItemDO>()
  49 + .select("order_item_id, SUM(count) AS sumCount")
  50 + .groupBy("order_item_id")
  51 + .in("return_id", returnIds));
  52 + // 获得数量
  53 + return convertMap(result, obj -> (Long) obj.get("order_item_id"), obj -> (BigDecimal) obj.get("sumCount"));
  54 + }
  55 +
  56 +}
0 57 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/mysql/purchase/ErpPurchaseReturnMapper.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.mysql.purchase;
  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.erp.controller.admin.purchase.vo.returns.ErpPurchaseReturnPageReqVO;
  7 +import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchaseInDO;
  8 +import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchaseReturnDO;
  9 +import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchaseReturnItemDO;
  10 +import cn.iocoder.yudao.module.erp.enums.ErpAuditStatus;
  11 +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
  12 +import org.apache.ibatis.annotations.Mapper;
  13 +
  14 +import java.util.List;
  15 +import java.util.Objects;
  16 +
  17 +/**
  18 + * ERP 采购退货 Mapper
  19 + *
  20 + * @author 芋道源码
  21 + */
  22 +@Mapper
  23 +public interface ErpPurchaseReturnMapper extends BaseMapperX<ErpPurchaseReturnDO> {
  24 +
  25 + default PageResult<ErpPurchaseReturnDO> selectPage(ErpPurchaseReturnPageReqVO reqVO) {
  26 + MPJLambdaWrapperX<ErpPurchaseReturnDO> query = new MPJLambdaWrapperX<ErpPurchaseReturnDO>()
  27 + .likeIfPresent(ErpPurchaseReturnDO::getNo, reqVO.getNo())
  28 + .eqIfPresent(ErpPurchaseReturnDO::getSupplierId, reqVO.getSupplierId())
  29 + .betweenIfPresent(ErpPurchaseReturnDO::getReturnTime, reqVO.getReturnTime())
  30 + .eqIfPresent(ErpPurchaseReturnDO::getStatus, reqVO.getStatus())
  31 + .likeIfPresent(ErpPurchaseReturnDO::getRemark, reqVO.getRemark())
  32 + .eqIfPresent(ErpPurchaseReturnDO::getCreator, reqVO.getCreator())
  33 + .eqIfPresent(ErpPurchaseReturnDO::getAccountId, reqVO.getAccountId())
  34 + .likeIfPresent(ErpPurchaseReturnDO::getOrderNo, reqVO.getOrderNo())
  35 + .orderByDesc(ErpPurchaseReturnDO::getId);
  36 + // 退款状态。为什么需要 t. 的原因,是因为联表查询时,需要指定表名,不然会报字段不存在的错误
  37 + if (Objects.equals(reqVO.getRefundStatus(), ErpPurchaseReturnPageReqVO.REFUND_STATUS_NONE)) {
  38 + query.eq(ErpPurchaseReturnDO::getRefundPrice, 0);
  39 + } else if (Objects.equals(reqVO.getRefundStatus(), ErpPurchaseReturnPageReqVO.REFUND_STATUS_PART)) {
  40 + query.gt(ErpPurchaseReturnDO::getRefundPrice, 0).apply("t.refund_price < t.total_price");
  41 + } else if (Objects.equals(reqVO.getRefundStatus(), ErpPurchaseReturnPageReqVO.REFUND_STATUS_ALL)) {
  42 + query.apply("t.refund_price = t.total_price");
  43 + }
  44 + if (Boolean.TRUE.equals(reqVO.getRefundEnable())) {
  45 + query.eq(ErpPurchaseInDO::getStatus, ErpAuditStatus.APPROVE.getStatus())
  46 + .apply("t.refund_price < t.total_price");
  47 + }
  48 + if (reqVO.getWarehouseId() != null || reqVO.getProductId() != null) {
  49 + query.leftJoin(ErpPurchaseReturnItemDO.class, ErpPurchaseReturnItemDO::getReturnId, ErpPurchaseReturnDO::getId)
  50 + .eq(reqVO.getWarehouseId() != null, ErpPurchaseReturnItemDO::getWarehouseId, reqVO.getWarehouseId())
  51 + .eq(reqVO.getProductId() != null, ErpPurchaseReturnItemDO::getProductId, reqVO.getProductId())
  52 + .groupBy(ErpPurchaseReturnDO::getId); // 避免 1 对多查询,产生相同的 1
  53 + }
  54 + return selectJoinPage(reqVO, ErpPurchaseReturnDO.class, query);
  55 + }
  56 +
  57 + default int updateByIdAndStatus(Long id, Integer status, ErpPurchaseReturnDO updateObj) {
  58 + return update(updateObj, new LambdaUpdateWrapper<ErpPurchaseReturnDO>()
  59 + .eq(ErpPurchaseReturnDO::getId, id).eq(ErpPurchaseReturnDO::getStatus, status));
  60 + }
  61 +
  62 + default ErpPurchaseReturnDO selectByNo(String no) {
  63 + return selectOne(ErpPurchaseReturnDO::getNo, no);
  64 + }
  65 +
  66 + default List<ErpPurchaseReturnDO> selectListByOrderId(Long orderId) {
  67 + return selectList(ErpPurchaseReturnDO::getOrderId, orderId);
  68 + }
  69 +
  70 +}
0 71 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/mysql/purchase/ErpSupplierMapper.java
... ... @@ -4,7 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 4 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
5 5 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
6 6 import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.supplier.ErpSupplierPageReqVO;
7   -import cn.iocoder.yudao.module.erp.dal.dataobject.supplier.ErpSupplierDO;
  7 +import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpSupplierDO;
8 8 import org.apache.ibatis.annotations.Mapper;
9 9  
10 10 import java.util.List;
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/mysql/sale/ErpCustomerMapper.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.mysql.sale;
  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.erp.controller.admin.sale.vo.customer.ErpCustomerPageReqVO;
  7 +import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpCustomerDO;
  8 +import org.apache.ibatis.annotations.Mapper;
  9 +
  10 +import java.util.List;
  11 +
  12 +/**
  13 + * ERP 客户 Mapper
  14 + *
  15 + * @author 芋道源码
  16 + */
  17 +@Mapper
  18 +public interface ErpCustomerMapper extends BaseMapperX<ErpCustomerDO> {
  19 +
  20 + default PageResult<ErpCustomerDO> selectPage(ErpCustomerPageReqVO reqVO) {
  21 + return selectPage(reqVO, new LambdaQueryWrapperX<ErpCustomerDO>()
  22 + .likeIfPresent(ErpCustomerDO::getName, reqVO.getName())
  23 + .eqIfPresent(ErpCustomerDO::getMobile, reqVO.getMobile())
  24 + .eqIfPresent(ErpCustomerDO::getTelephone, reqVO.getTelephone())
  25 + .orderByDesc(ErpCustomerDO::getId));
  26 + }
  27 +
  28 + default List<ErpCustomerDO> selectListByStatus(Integer status) {
  29 + return selectList(ErpCustomerDO::getStatus, status);
  30 + }
  31 +
  32 +}
0 33 \ No newline at end of file
... ...
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/mysql/sale/ErpSalesOrderItemMapper.java renamed to yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/mysql/sale/ErpSaleOrderItemMapper.java
1 1 package cn.iocoder.yudao.module.erp.dal.mysql.sale;
2 2  
3 3 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
4   -import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpSalesOrderItemDO;
  4 +import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpSaleOrderItemDO;
5 5 import org.apache.ibatis.annotations.Mapper;
6 6  
  7 +import java.util.Collection;
7 8 import java.util.List;
8 9  
9 10 /**
10   - * ERP 销售订单明细 Mapper
  11 + * ERP 销售订单明项目 Mapper
11 12 *
12 13 * @author 芋道源码
13 14 */
14 15 @Mapper
15   -public interface ErpSalesOrderItemMapper extends BaseMapperX<ErpSalesOrderItemDO> {
  16 +public interface ErpSaleOrderItemMapper extends BaseMapperX<ErpSaleOrderItemDO> {
16 17  
17   - default List<ErpSalesOrderItemDO> selectListById(Long id) {
18   - return selectList(ErpSalesOrderItemDO::getId, id);
  18 + default List<ErpSaleOrderItemDO> selectListByOrderId(Long orderId) {
  19 + return selectList(ErpSaleOrderItemDO::getOrderId, orderId);
19 20 }
20 21  
21   - default int deleteById(Long id) {
22   - return delete(ErpSalesOrderItemDO::getId, id);
  22 + default List<ErpSaleOrderItemDO> selectListByOrderIds(Collection<Long> orderIds) {
  23 + return selectList(ErpSaleOrderItemDO::getOrderId, orderIds);
  24 + }
  25 +
  26 + default int deleteByOrderId(Long orderId) {
  27 + return delete(ErpSaleOrderItemDO::getOrderId, orderId);
23 28 }
24 29  
25 30 }
26 31 \ No newline at end of file
... ...