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

# Conflicts:
#	yudao-module-erp/yudao-module-erp-biz/src/test/java/cn/iocoder/yudao/module/erp/service/product/ProductServiceImplTest.java
This commit is contained in:
puhui999 2024-02-08 11:54:04 +08:00
commit 51b53d6ed8
118 changed files with 7310 additions and 141 deletions

View File

@ -288,11 +288,16 @@ public class CollectionUtils {
public static <T, V extends Comparable<? super V>> V getSumValue(List<T> from, Function<T, V> valueFunc,
BinaryOperator<V> accumulator) {
return getSumValue(from, valueFunc, accumulator, null);
}
public static <T, V extends Comparable<? super V>> V getSumValue(List<T> from, Function<T, V> valueFunc,
BinaryOperator<V> accumulator, V defaultValue) {
if (CollUtil.isEmpty(from)) {
return null;
return defaultValue;
}
assert from.size() > 0; // 断言避免告警
return from.stream().map(valueFunc).reduce(accumulator).get();
assert !from.isEmpty(); // 断言避免告警
return from.stream().map(valueFunc).filter(Objects::nonNull).reduce(accumulator).orElse(defaultValue);
}
public static <T> void addIfNotNull(Collection<T> coll, T item) {
@ -302,8 +307,8 @@ public class CollectionUtils {
coll.add(item);
}
public static <T> Collection<T> singleton(T deptId) {
return deptId == null ? Collections.emptyList() : Collections.singleton(deptId);
public static <T> Collection<T> singleton(T obj) {
return obj == null ? Collections.emptyList() : Collections.singleton(obj);
}
}

View File

@ -13,6 +13,11 @@ import java.math.RoundingMode;
*/
public class MoneyUtils {
/**
* 金额的小数位数
*/
private static final int PRICE_SCALE = 2;
/**
* 计算百分比金额四舍五入
*
@ -86,4 +91,20 @@ public class MoneyUtils {
return new Money(0, fen).toString();
}
/**
* 金额相乘默认进行四舍五入
*
* 位数{@link #PRICE_SCALE}
*
* @param price 金额
* @param count 数量
* @return 金额相乘结果
*/
public static BigDecimal priceMultiply(BigDecimal price, BigDecimal count) {
if (price == null || count == null) {
return null;
}
return price.multiply(count).setScale(PRICE_SCALE, RoundingMode.HALF_UP);
}
}

View File

@ -1,7 +1,10 @@
package cn.iocoder.yudao.framework.common.util.number;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import java.math.BigDecimal;
/**
* 数字的工具类补全 {@link cn.hutool.core.util.NumberUtil} 的功能
*
@ -37,4 +40,21 @@ public class NumberUtils {
return distance;
}
/**
* 提供精确的乘法运算
*
* hutool {@link NumberUtil#mul(BigDecimal...)} 的差别是如果存在 null则返回 null
*
* @param values 多个被乘值
* @return
*/
public static BigDecimal mul(BigDecimal... values) {
for (BigDecimal value : values) {
if (value == null) {
return null;
}
}
return NumberUtil.mul(values);
}
}

View File

@ -1,26 +0,0 @@
package cn.iocoder.yudao.module.erp;
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
/**
* ERP 错误码枚举类
* <p>
* erp 系统使用 1-030-000-000
*/
public interface ErrorCodeConstants {
// ========== ERP 产品 1-030-500-000 ==========
ErrorCode PRODUCT_NOT_EXISTS = new ErrorCode(1_030_500_000, "产品不存在");
// ========== ERP 产品分类 1-030-501-000 ==========
ErrorCode PRODUCT_CATEGORY_NOT_EXISTS = new ErrorCode(1_030_501_000, "产品分类不存在");
ErrorCode PRODUCT_CATEGORY_EXITS_CHILDREN = new ErrorCode(1_030_501_001, "存在存在子产品分类,无法删除");
ErrorCode PRODUCT_CATEGORY_PARENT_NOT_EXITS = new ErrorCode(1_030_501_002,"父级产品分类不存在");
ErrorCode PRODUCT_CATEGORY_PARENT_ERROR = new ErrorCode(1_030_501_003, "不能设置自己为父产品分类");
ErrorCode PRODUCT_CATEGORY_NAME_DUPLICATE = new ErrorCode(1_030_501_004, "已经存在该分类名称的产品分类");
ErrorCode PRODUCT_CATEGORY_PARENT_IS_CHILD = new ErrorCode(1_030_501_005, "不能设置自己的子分类为父分类");
// ========== ERP 产品单位 1-030-502-000 ==========
ErrorCode PRODUCT_UNIT_NOT_EXISTS = new ErrorCode(1_030_502_000, "产品单位不存在");
}

View File

@ -7,4 +7,7 @@ package cn.iocoder.yudao.module.erp.enums;
*/
public interface DictTypeConstants {
String AUDIT_STATUS = "erp_audit_status"; // 审核状态
String STOCK_RECORD_BIZ_TYPE = "erp_stock_record_biz_type"; // 库存明细的业务类型
}

View File

@ -0,0 +1,39 @@
package cn.iocoder.yudao.module.erp.enums;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import java.util.Arrays;
/**
* ERP 审核状态枚举
*
* TODO 芋艿目前只有待审批已审批两个状态未来接入工作流后会丰富下待提交草稿=已提交待审核=审核通过审核不通过另外工作流需要支持反审核把工作流退回到原点
*
* @author 芋道源码
*/
@RequiredArgsConstructor
@Getter
public enum ErpAuditStatus implements IntArrayValuable {
PROCESS(10, "未审核"), // 审核中
APPROVE(20, "已审核"); // 审核通过
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ErpAuditStatus::getStatus).toArray();
/**
* 状态
*/
private final Integer status;
/**
* 状态名
*/
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@ -9,7 +9,73 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
*/
public interface ErrorCodeConstants {
// ========== 销售订单1-030-000-000 ==========
ErrorCode SALE_ORDER_NOT_EXISTS = new ErrorCode(1_030_000_000, "销售订单不存在");
// ========== ERP 供应商1-030-100-000 ==========
ErrorCode SUPPLIER_NOT_EXISTS = new ErrorCode(1_030_100_000, "供应商不存在");
ErrorCode SUPPLIER_NOT_ENABLE = new ErrorCode(1_030_100_000, "供应商({})未启用");
// ========== ERP 客户1-030-200-000==========
ErrorCode CUSTOMER_NOT_EXISTS = new ErrorCode(1_020_200_000, "客户不存在");
ErrorCode CUSTOMER_NOT_ENABLE = new ErrorCode(1_020_200_001, "客户({})未启用");
// ========== ERP 销售订单1-030-201-000 ==========
ErrorCode SALE_ORDER_NOT_EXISTS = new ErrorCode(1_020_201_000, "销售订单不存在");
// ========== ERP 仓库 1-030-400-000 ==========
ErrorCode WAREHOUSE_NOT_EXISTS = new ErrorCode(1_030_400_000, "仓库不存在");
ErrorCode WAREHOUSE_NOT_ENABLE = new ErrorCode(1_030_400_001, "仓库({})未启用");
// ========== ERP 其它入库单 1-030-401-000 ==========
ErrorCode STOCK_IN_NOT_EXISTS = new ErrorCode(1_030_401_000, "其它入库单不存在");
ErrorCode STOCK_IN_DELETE_FAIL_APPROVE = new ErrorCode(1_030_401_001, "其它入库单({})已审核,无法删除");
ErrorCode STOCK_IN_PROCESS_FAIL = new ErrorCode(1_030_401_002, "反审核失败,只有已审核的入库单才能反审核");
ErrorCode STOCK_IN_APPROVE_FAIL = new ErrorCode(1_030_401_003, "审核失败,只有未审核的入库单才能审核");
ErrorCode STOCK_IN_NO_EXISTS = new ErrorCode(1_030_401_004, "生成入库单失败,请重新提交");
ErrorCode STOCK_IN_UPDATE_FAIL_APPROVE = new ErrorCode(1_030_401_005, "其它入库单({})已审核,无法修改");
// ========== ERP 其它出库单 1-030-402-000 ==========
ErrorCode STOCK_OUT_NOT_EXISTS = new ErrorCode(1_030_402_000, "其它出库单不存在");
ErrorCode STOCK_OUT_DELETE_FAIL_APPROVE = new ErrorCode(1_030_402_001, "其它出库单({})已审核,无法删除");
ErrorCode STOCK_OUT_PROCESS_FAIL = new ErrorCode(1_030_402_002, "反审核失败,只有已审核的出库单才能反审核");
ErrorCode STOCK_OUT_APPROVE_FAIL = new ErrorCode(1_030_402_003, "审核失败,只有未审核的出库单才能审核");
ErrorCode STOCK_OUT_NO_EXISTS = new ErrorCode(1_030_402_004, "生成出库单失败,请重新提交");
ErrorCode STOCK_OUT_UPDATE_FAIL_APPROVE = new ErrorCode(1_030_402_005, "其它出库单({})已审核,无法修改");
// ========== ERP 库存调拨单 1-030-403-000 ==========
ErrorCode STOCK_MOVE_NOT_EXISTS = new ErrorCode(1_030_402_000, "库存调拨单不存在");
ErrorCode STOCK_MOVE_DELETE_FAIL_APPROVE = new ErrorCode(1_030_402_001, "库存调拨单({})已审核,无法删除");
ErrorCode STOCK_MOVE_PROCESS_FAIL = new ErrorCode(1_030_402_002, "反审核失败,只有已审核的调拨单才能反审核");
ErrorCode STOCK_MOVE_APPROVE_FAIL = new ErrorCode(1_030_402_003, "审核失败,只有未审核的调拨单才能审核");
ErrorCode STOCK_MOVE_NO_EXISTS = new ErrorCode(1_030_402_004, "生成调拨号失败,请重新提交");
ErrorCode STOCK_MOVE_UPDATE_FAIL_APPROVE = new ErrorCode(1_030_402_005, "库存调拨单({})已审核,无法修改");
// ========== ERP 库存盘点单 1-030-403-000 ==========
ErrorCode STOCK_CHECK_NOT_EXISTS = new ErrorCode(1_030_403_000, "库存盘点单不存在");
ErrorCode STOCK_CHECK_DELETE_FAIL_APPROVE = new ErrorCode(1_030_403_001, "库存盘点单({})已审核,无法删除");
ErrorCode STOCK_CHECK_PROCESS_FAIL = new ErrorCode(1_030_403_002, "反审核失败,只有已审核的盘点单才能反审核");
ErrorCode STOCK_CHECK_APPROVE_FAIL = new ErrorCode(1_030_403_003, "审核失败,只有未审核的盘点单才能审核");
ErrorCode STOCK_CHECK_NO_EXISTS = new ErrorCode(1_030_403_004, "生成盘点号失败,请重新提交");
ErrorCode STOCK_CHECK_UPDATE_FAIL_APPROVE = new ErrorCode(1_030_403_005, "库存盘点单({})已审核,无法修改");
// ========== ERP 产品库存 1-030-404-000 ==========
ErrorCode STOCK_COUNT_NEGATIVE = new ErrorCode(1_030_404_000, "操作失败,产品({})所在仓库({})的库存:{},小于变更数量:{}");
ErrorCode STOCK_COUNT_NEGATIVE2 = new ErrorCode(1_030_404_001, "操作失败,产品({})所在仓库({})的库存不足");
// ========== ERP 产品 1-030-500-000 ==========
ErrorCode PRODUCT_NOT_EXISTS = new ErrorCode(1_030_500_000, "产品不存在");
ErrorCode PRODUCT_NOT_ENABLE = new ErrorCode(1_030_500_001, "产品({})未启用");
// ========== ERP 产品分类 1-030-501-000 ==========
ErrorCode PRODUCT_CATEGORY_NOT_EXISTS = new ErrorCode(1_030_501_000, "产品分类不存在");
ErrorCode PRODUCT_CATEGORY_EXITS_CHILDREN = new ErrorCode(1_030_501_001, "存在存在子产品分类,无法删除");
ErrorCode PRODUCT_CATEGORY_PARENT_NOT_EXITS = new ErrorCode(1_030_501_002,"父级产品分类不存在");
ErrorCode PRODUCT_CATEGORY_PARENT_ERROR = new ErrorCode(1_030_501_003, "不能设置自己为父产品分类");
ErrorCode PRODUCT_CATEGORY_NAME_DUPLICATE = new ErrorCode(1_030_501_004, "已经存在该分类名称的产品分类");
ErrorCode PRODUCT_CATEGORY_PARENT_IS_CHILD = new ErrorCode(1_030_501_005, "不能设置自己的子分类为父分类");
ErrorCode PRODUCT_CATEGORY_EXITS_PRODUCT = new ErrorCode(1_030_502_002, "存在产品使用该分类,无法删除");
// ========== ERP 产品单位 1-030-502-000 ==========
ErrorCode PRODUCT_UNIT_NOT_EXISTS = new ErrorCode(1_030_502_000, "产品单位不存在");
ErrorCode PRODUCT_UNIT_NAME_DUPLICATE = new ErrorCode(1_030_502_001, "已存在该名字的产品单位");
ErrorCode PRODUCT_UNIT_EXITS_PRODUCT = new ErrorCode(1_030_502_002, "存在产品使用该单位,无法删除");
}

View File

@ -0,0 +1,51 @@
package cn.iocoder.yudao.module.erp.enums.stock;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import java.util.Arrays;
/**
* ERP 库存明细 - 业务类型枚举
*
* @author 芋道源码
*/
@RequiredArgsConstructor
@Getter
public enum ErpStockRecordBizTypeEnum implements IntArrayValuable {
OTHER_IN(10, "其它入库"),
OTHER_IN_CANCEL(11, "其它入库(作废)"),
OTHER_OUT(20, "其它出库"),
OTHER_OUT_CANCEL(21, "其它出库(作废)"),
MOVE_IN(30, "调拨入库"),
MOVE_IN_CANCEL(31, "调拨入库(作废)"),
MOVE_OUT(32, "调拨出库"),
MOVE_OUT_CANCEL(33, "调拨出库(作废)"),
CHECK_MORE_IN(40, "盘盈入库"),
CHECK_MORE_IN_CANCEL(41, "盘盈入库(作废)"),
CHECK_LESS_OUT(42, "盘亏出库"),
CHECK_LESS_OUT_CANCEL(43, "盘亏出库(作废)"),
;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ErpStockRecordBizTypeEnum::getType).toArray();
/**
* 类型
*/
private final Integer type;
/**
* 名字
*/
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@ -51,6 +51,11 @@
<artifactId>yudao-spring-boot-starter-mybatis</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-redis</artifactId>
</dependency>
<!-- 工具类相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.erp.controller.admin.product;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
@ -23,6 +24,7 @@ import java.io.IOException;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - ERP 产品分类")
@ -35,14 +37,14 @@ public class ErpProductCategoryController {
private ErpProductCategoryService productCategoryService;
@PostMapping("/create")
@Operation(summary = "创建ERP 产品分类")
@Operation(summary = "创建产品分类")
@PreAuthorize("@ss.hasPermission('erp:product-category:create')")
public CommonResult<Long> createProductCategory(@Valid @RequestBody ErpProductCategorySaveReqVO createReqVO) {
return success(productCategoryService.createProductCategory(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新ERP 产品分类")
@Operation(summary = "更新产品分类")
@PreAuthorize("@ss.hasPermission('erp:product-category:update')")
public CommonResult<Boolean> updateProductCategory(@Valid @RequestBody ErpProductCategorySaveReqVO updateReqVO) {
productCategoryService.updateProductCategory(updateReqVO);
@ -50,7 +52,7 @@ public class ErpProductCategoryController {
}
@DeleteMapping("/delete")
@Operation(summary = "删除ERP 产品分类")
@Operation(summary = "删除产品分类")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('erp:product-category:delete')")
public CommonResult<Boolean> deleteProductCategory(@RequestParam("id") Long id) {
@ -59,31 +61,40 @@ public class ErpProductCategoryController {
}
@GetMapping("/get")
@Operation(summary = "获得ERP 产品分类")
@Operation(summary = "获得产品分类")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('erp:product-category:query')")
public CommonResult<ErpProductCategoryRespVO> getProductCategory(@RequestParam("id") Long id) {
ErpProductCategoryDO productCategory = productCategoryService.getProductCategory(id);
return success(BeanUtils.toBean(productCategory, ErpProductCategoryRespVO.class));
ErpProductCategoryDO category = productCategoryService.getProductCategory(id);
return success(BeanUtils.toBean(category, ErpProductCategoryRespVO.class));
}
@GetMapping("/list")
@Operation(summary = "获得ERP 产品分类列表")
@Operation(summary = "获得产品分类列表")
@PreAuthorize("@ss.hasPermission('erp:product-category:query')")
public CommonResult<List<ErpProductCategoryRespVO>> getProductCategoryList(@Valid ErpProductCategoryListReqVO listReqVO) {
List<ErpProductCategoryDO> list = productCategoryService.getProductCategoryList(listReqVO);
return success(BeanUtils.toBean(list, ErpProductCategoryRespVO.class));
}
@GetMapping("/simple-list")
@Operation(summary = "获得产品分类精简列表", description = "只包含被开启的分类,主要用于前端的下拉选项")
public CommonResult<List<ErpProductCategoryRespVO>> getProductCategorySimpleList() {
List<ErpProductCategoryDO> list = productCategoryService.getProductCategoryList(
new ErpProductCategoryListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus()));
return success(convertList(list, category -> new ErpProductCategoryRespVO()
.setId(category.getId()).setName(category.getName()).setParentId(category.getParentId())));
}
@GetMapping("/export-excel")
@Operation(summary = "导出ERP 产品分类 Excel")
@Operation(summary = "导出产品分类 Excel")
@PreAuthorize("@ss.hasPermission('erp:product-category:export')")
@OperateLog(type = EXPORT)
public void exportProductCategoryExcel(@Valid ErpProductCategoryListReqVO listReqVO,
HttpServletResponse response) throws IOException {
List<ErpProductCategoryDO> list = productCategoryService.getProductCategoryList(listReqVO);
// 导出 Excel
ExcelUtils.write(response, "ERP 产品分类.xls", "数据", ErpProductCategoryRespVO.class,
ExcelUtils.write(response, "产品分类.xls", "数据", ErpProductCategoryRespVO.class,
BeanUtils.toBean(list, ErpProductCategoryRespVO.class));
}

View File

@ -1,13 +1,14 @@
package cn.iocoder.yudao.module.erp.controller.admin.product;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ProductPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ProductRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ProductSaveReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
@ -25,6 +26,7 @@ import java.io.IOException;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - ERP 产品")
@ -64,30 +66,40 @@ public class ErpProductController {
@Operation(summary = "获得产品")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('erp:product:query')")
public CommonResult<ProductRespVO> getProduct(@RequestParam("id") Long id) {
public CommonResult<ErpProductRespVO> getProduct(@RequestParam("id") Long id) {
ErpProductDO product = productService.getProduct(id);
return success(BeanUtils.toBean(product, ProductRespVO.class));
return success(BeanUtils.toBean(product, ErpProductRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得产品分页")
@PreAuthorize("@ss.hasPermission('erp:product:query')")
public CommonResult<PageResult<ProductRespVO>> getProductPage(@Valid ProductPageReqVO pageReqVO) {
PageResult<ErpProductDO> pageResult = productService.getProductPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, ProductRespVO.class));
public CommonResult<PageResult<ErpProductRespVO>> getProductPage(@Valid ErpProductPageReqVO pageReqVO) {
return success(productService.getProductVOPage(pageReqVO));
}
@GetMapping("/simple-list")
@Operation(summary = "获得产品精简列表", description = "只包含被开启的产品,主要用于前端的下拉选项")
public CommonResult<List<ErpProductRespVO>> getProductSimpleList() {
List<ErpProductRespVO> list = productService.getProductVOListByStatus(CommonStatusEnum.ENABLE.getStatus());
return success(convertList(list, product -> new ErpProductRespVO().setId(product.getId())
.setName(product.getName()).setBarCode(product.getBarCode())
.setCategoryId(product.getCategoryId()).setCategoryName(product.getCategoryName())
.setUnitId(product.getUnitId()).setUnitName(product.getUnitName())
.setPurchasePrice(product.getPurchasePrice()).setSalePrice(product.getSalePrice()).setMinPrice(product.getMinPrice())));
}
@GetMapping("/export-excel")
@Operation(summary = "导出产品 Excel")
@PreAuthorize("@ss.hasPermission('erp:product:export')")
@OperateLog(type = EXPORT)
public void exportProductExcel(@Valid ProductPageReqVO pageReqVO,
public void exportProductExcel(@Valid ErpProductPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ErpProductDO> list = productService.getProductPage(pageReqVO).getList();
PageResult<ErpProductRespVO> pageResult = productService.getProductVOPage(pageReqVO);
// 导出 Excel
ExcelUtils.write(response, "产品.xls", "数据", ProductRespVO.class,
BeanUtils.toBean(list, ProductRespVO.class));
ExcelUtils.write(response, "产品.xls", "数据", ErpProductRespVO.class,
pageResult.getList());
}
}

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.erp.controller.admin.product;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
@ -25,6 +26,7 @@ import java.io.IOException;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - ERP 产品单位")
@ -77,6 +79,13 @@ public class ErpProductUnitController {
return success(BeanUtils.toBean(pageResult, ErpProductUnitRespVO.class));
}
@GetMapping("/simple-list")
@Operation(summary = "获得产品单位精简列表", description = "只包含被开启的单位,主要用于前端的下拉选项")
public CommonResult<List<ErpProductUnitRespVO>> getProductUnitSimpleList() {
List<ErpProductUnitDO> list = productUnitService.getProductUnitListByStatus(CommonStatusEnum.ENABLE.getStatus());
return success(convertList(list, unit -> new ErpProductUnitRespVO().setId(unit.getId()).setName(unit.getName())));
}
@GetMapping("/export-excel")
@Operation(summary = "导出产品单位 Excel")
@PreAuthorize("@ss.hasPermission('erp:product-unit:export')")

View File

@ -1,10 +1,8 @@
package cn.iocoder.yudao.module.erp.controller.admin.product.vo.product;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
@ -14,7 +12,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ProductPageReqVO extends PageParam {
public class ErpProductPageReqVO extends PageParam {
@Schema(description = "产品名称", example = "李四")
private String name;

View File

@ -11,7 +11,7 @@ import java.time.LocalDateTime;
@Schema(description = "管理后台 - ERP 产品 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ProductRespVO {
public class ErpProductRespVO {
@Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "15672")
@ExcelProperty("产品编号")
@ -26,12 +26,16 @@ public class ProductRespVO {
private String barCode;
@Schema(description = "产品分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11161")
@ExcelProperty("产品分类编号")
private Long categoryId;
@Schema(description = "产品分类", requiredMode = Schema.RequiredMode.REQUIRED, example = "水果")
@ExcelProperty("产品分类")
private String categoryName;
@Schema(description = "单位编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8869")
@ExcelProperty("单位编号")
private Integer unitId;
private Long unitId;
@Schema(description = "单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "")
@ExcelProperty("单位")
private String unitName;
@Schema(description = "产品状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty("产品状态")

View File

@ -1,9 +1,10 @@
package cn.iocoder.yudao.module.erp.controller.admin.product.vo.product;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.math.BigDecimal;
@Schema(description = "管理后台 - ERP 产品新增/修改 Request VO")
@ -27,7 +28,7 @@ public class ProductSaveReqVO {
@Schema(description = "单位编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8869")
@NotNull(message = "单位编号不能为空")
private Integer unitId;
private Long unitId;
@Schema(description = "产品状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotNull(message = "产品状态不能为空")

View File

@ -5,11 +5,6 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - ERP 产品单位分页 Request VO")
@Data
@ -23,8 +18,4 @@ public class ErpProductUnitPageReqVO extends PageParam {
@Schema(description = "单位状态", example = "1")
private Integer status;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -1,9 +1,10 @@
package cn.iocoder.yudao.module.erp.controller.admin.product.vo.unit;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.module.system.enums.DictTypeConstants;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.time.LocalDateTime;
@ -23,7 +24,7 @@ public class ErpProductUnitRespVO {
@Schema(description = "单位状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty("单位状态")
@NotNull(message = "分类排序不能为空")
@DictFormat(DictTypeConstants.COMMON_STATUS)
private Integer status;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)

View File

@ -1,5 +1,7 @@
package cn.iocoder.yudao.module.erp.controller.admin.product.vo.unit;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
@ -18,6 +20,7 @@ public class ErpProductUnitSaveReqVO {
@Schema(description = "单位状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "单位状态不能为空")
@InEnum(CommonStatusEnum.class)
private Integer status;
}

View File

@ -0,0 +1,102 @@
package cn.iocoder.yudao.module.erp.controller.admin.purchase;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.supplier.ErpSupplierPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.supplier.ErpSupplierRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.supplier.ErpSupplierSaveReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpSupplierDO;
import cn.iocoder.yudao.module.erp.service.purchase.ErpSupplierService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - ERP 供应商")
@RestController
@RequestMapping("/erp/supplier")
@Validated
public class ErpSupplierController {
@Resource
private ErpSupplierService supplierService;
@PostMapping("/create")
@Operation(summary = "创建供应商")
@PreAuthorize("@ss.hasPermission('erp:supplier:create')")
public CommonResult<Long> createSupplier(@Valid @RequestBody ErpSupplierSaveReqVO createReqVO) {
return success(supplierService.createSupplier(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新供应商")
@PreAuthorize("@ss.hasPermission('erp:supplier:update')")
public CommonResult<Boolean> updateSupplier(@Valid @RequestBody ErpSupplierSaveReqVO updateReqVO) {
supplierService.updateSupplier(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除供应商")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('erp:supplier:delete')")
public CommonResult<Boolean> deleteSupplier(@RequestParam("id") Long id) {
supplierService.deleteSupplier(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得供应商")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('erp:supplier:query')")
public CommonResult<ErpSupplierRespVO> getSupplier(@RequestParam("id") Long id) {
ErpSupplierDO supplier = supplierService.getSupplier(id);
return success(BeanUtils.toBean(supplier, ErpSupplierRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得供应商分页")
@PreAuthorize("@ss.hasPermission('erp:supplier:query')")
public CommonResult<PageResult<ErpSupplierRespVO>> getSupplierPage(@Valid ErpSupplierPageReqVO pageReqVO) {
PageResult<ErpSupplierDO> pageResult = supplierService.getSupplierPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, ErpSupplierRespVO.class));
}
@GetMapping("/simple-list")
@Operation(summary = "获得供应商精简列表", description = "只包含被开启的供应商,主要用于前端的下拉选项")
public CommonResult<List<ErpSupplierRespVO>> getSupplierSimpleList() {
List<ErpSupplierDO> list = supplierService.getSupplierListByStatus(CommonStatusEnum.ENABLE.getStatus());
return success(convertList(list, supplier -> new ErpSupplierRespVO().setId(supplier.getId()).setName(supplier.getName())));
}
@GetMapping("/export-excel")
@Operation(summary = "导出供应商 Excel")
@PreAuthorize("@ss.hasPermission('erp:supplier:export')")
@OperateLog(type = EXPORT)
public void exportSupplierExcel(@Valid ErpSupplierPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ErpSupplierDO> list = supplierService.getSupplierPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "供应商.xls", "数据", ErpSupplierRespVO.class,
BeanUtils.toBean(list, ErpSupplierRespVO.class));
}
}

View File

@ -0,0 +1,24 @@
package cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.supplier;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Schema(description = "管理后台 - ERP 供应商分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ErpSupplierPageReqVO extends PageParam {
@Schema(description = "供应商名称", example = "芋道源码")
private String name;
@Schema(description = "手机号码", example = "15601691300")
private String mobile;
@Schema(description = "联系电话", example = "18818288888")
private String telephone;
}

View File

@ -0,0 +1,84 @@
package cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.supplier;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import cn.iocoder.yudao.module.system.enums.DictTypeConstants;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - ERP 供应商 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ErpSupplierRespVO {
@Schema(description = "供应商编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17791")
@ExcelProperty("供应商编号")
private Long id;
@Schema(description = "供应商名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道源码")
@ExcelProperty("供应商名称")
private String name;
@Schema(description = "联系人", example = "芋艿")
@ExcelProperty("联系人")
private String contact;
@Schema(description = "手机号码", example = "15601691300")
@ExcelProperty("手机号码")
private String mobile;
@Schema(description = "联系电话", example = "18818288888")
@ExcelProperty("联系电话")
private String telephone;
@Schema(description = "电子邮箱", example = "76853@qq.com")
@ExcelProperty("电子邮箱")
private String email;
@Schema(description = "传真", example = "20 7123 4567")
@ExcelProperty("传真")
private String fax;
@Schema(description = "备注", example = "你猜")
@ExcelProperty("备注")
private String remark;
@Schema(description = "开启状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty(value = "开启状态", converter = DictConvert.class)
@DictFormat(DictTypeConstants.COMMON_STATUS)
private Integer status;
@Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
@ExcelProperty("排序")
private Integer sort;
@Schema(description = "纳税人识别号", example = "91130803MA098BY05W")
@ExcelProperty("纳税人识别号")
private String taxNo;
@Schema(description = "税率", example = "10")
@ExcelProperty("税率")
private BigDecimal taxPercent;
@Schema(description = "开户行", example = "张三")
@ExcelProperty("开户行")
private String bankName;
@Schema(description = "开户账号", example = "622908212277228617")
@ExcelProperty("开户账号")
private String bankAccount;
@Schema(description = "开户地址", example = "兴业银行浦东支行")
@ExcelProperty("开户地址")
private String bankAddress;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,71 @@
package cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.supplier;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.framework.common.validation.Mobile;
import cn.iocoder.yudao.framework.common.validation.Telephone;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.math.BigDecimal;
@Schema(description = "管理后台 - ERP 供应商新增/修改 Request VO")
@Data
public class ErpSupplierSaveReqVO {
@Schema(description = "供应商编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17791")
private Long id;
@Schema(description = "供应商名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道源码")
@NotEmpty(message = "供应商名称不能为空")
private String name;
@Schema(description = "联系人", example = "芋艿")
private String contact;
@Schema(description = "手机号码", example = "15601691300")
@Mobile
private String mobile;
@Schema(description = "联系电话", example = "18818288888")
@Telephone
private String telephone;
@Schema(description = "电子邮箱", example = "76853@qq.com")
@Email
private String email;
@Schema(description = "传真", example = "20 7123 4567")
private String fax;
@Schema(description = "备注", example = "你猜")
private String remark;
@Schema(description = "开启状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "开启状态不能为空")
@InEnum(value = CommonStatusEnum.class)
private Integer status;
@Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
@NotNull(message = "排序不能为空")
private Integer sort;
@Schema(description = "纳税人识别号", example = "91130803MA098BY05W")
private String taxNo;
@Schema(description = "税率", example = "10")
private BigDecimal taxPercent;
@Schema(description = "开户行", example = "张三")
private String bankName;
@Schema(description = "开户账号", example = "622908212277228617")
private String bankAccount;
@Schema(description = "开户地址", example = "兴业银行浦东支行")
private String bankAddress;
}

View File

@ -0,0 +1,102 @@
package cn.iocoder.yudao.module.erp.controller.admin.sale;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.erp.controller.admin.sale.vo.customer.ErpCustomerPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.sale.vo.customer.ErpCustomerRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.sale.vo.customer.ErpCustomerSaveReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpCustomerDO;
import cn.iocoder.yudao.module.erp.service.sale.ErpCustomerService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - ERP 客户")
@RestController
@RequestMapping("/erp/customer")
@Validated
public class ErpCustomerController {
@Resource
private ErpCustomerService customerService;
@PostMapping("/create")
@Operation(summary = "创建客户")
@PreAuthorize("@ss.hasPermission('erp:customer:create')")
public CommonResult<Long> createCustomer(@Valid @RequestBody ErpCustomerSaveReqVO createReqVO) {
return success(customerService.createCustomer(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新客户")
@PreAuthorize("@ss.hasPermission('erp:customer:update')")
public CommonResult<Boolean> updateCustomer(@Valid @RequestBody ErpCustomerSaveReqVO updateReqVO) {
customerService.updateCustomer(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除客户")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('erp:customer:delete')")
public CommonResult<Boolean> deleteCustomer(@RequestParam("id") Long id) {
customerService.deleteCustomer(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得客户")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('erp:customer:query')")
public CommonResult<ErpCustomerRespVO> getCustomer(@RequestParam("id") Long id) {
ErpCustomerDO customer = customerService.getCustomer(id);
return success(BeanUtils.toBean(customer, ErpCustomerRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得客户分页")
@PreAuthorize("@ss.hasPermission('erp:customer:query')")
public CommonResult<PageResult<ErpCustomerRespVO>> getCustomerPage(@Valid ErpCustomerPageReqVO pageReqVO) {
PageResult<ErpCustomerDO> pageResult = customerService.getCustomerPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, ErpCustomerRespVO.class));
}
@GetMapping("/simple-list")
@Operation(summary = "获得客户精简列表", description = "只包含被开启的客户,主要用于前端的下拉选项")
public CommonResult<List<ErpCustomerRespVO>> getCustomerSimpleList() {
List<ErpCustomerDO> list = customerService.getCustomerListByStatus(CommonStatusEnum.ENABLE.getStatus());
return success(convertList(list, customer -> new ErpCustomerRespVO().setId(customer.getId()).setName(customer.getName())));
}
@GetMapping("/export-excel")
@Operation(summary = "导出客户 Excel")
@PreAuthorize("@ss.hasPermission('erp:customer:export')")
@OperateLog(type = EXPORT)
public void exportCustomerExcel(@Valid ErpCustomerPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ErpCustomerDO> list = customerService.getCustomerPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "客户.xls", "数据", ErpCustomerRespVO.class,
BeanUtils.toBean(list, ErpCustomerRespVO.class));
}
}

View File

@ -0,0 +1,28 @@
package cn.iocoder.yudao.module.erp.controller.admin.sale.vo.customer;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - ERP 客户分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ErpCustomerPageReqVO extends PageParam {
@Schema(description = "客户名称", example = "张三")
private String name;
@Schema(description = "手机号码", example = "15601691300")
private String mobile;
@Schema(description = "联系电话", example = "15601691300")
private String telephone;
}

View File

@ -0,0 +1,84 @@
package cn.iocoder.yudao.module.erp.controller.admin.sale.vo.customer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.util.*;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
@Schema(description = "管理后台 - ERP 客户 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ErpCustomerRespVO {
@Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "27520")
@ExcelProperty("客户编号")
private Long id;
@Schema(description = "客户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
@ExcelProperty("客户名称")
private String name;
@Schema(description = "联系人", example = "老王")
@ExcelProperty("联系人")
private String contact;
@Schema(description = "手机号码", example = "15601691300")
@ExcelProperty("手机号码")
private String mobile;
@Schema(description = "联系电话", example = "15601691300")
@ExcelProperty("联系电话")
private String telephone;
@Schema(description = "电子邮箱", example = "7685323@qq.com")
@ExcelProperty("电子邮箱")
private String email;
@Schema(description = "传真", example = "20 7123 4567")
@ExcelProperty("传真")
private String fax;
@Schema(description = "备注", example = "你猜")
@ExcelProperty("备注")
private String remark;
@Schema(description = "开启状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty(value = "开启状态", converter = DictConvert.class)
@DictFormat("common_status") // TODO 代码优化建议设置到对应的 DictTypeConstants 枚举类中
private Integer status;
@Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
@ExcelProperty("排序")
private Integer sort;
@Schema(description = "纳税人识别号", example = "91130803MA098BY05W")
@ExcelProperty("纳税人识别号")
private String taxNo;
@Schema(description = "税率", example = "10")
@ExcelProperty("税率")
private BigDecimal taxPercent;
@Schema(description = "开户行", example = "芋艿")
@ExcelProperty("开户行")
private String bankName;
@Schema(description = "开户账号", example = "622908212277228617")
@ExcelProperty("开户账号")
private String bankAccount;
@Schema(description = "开户地址", example = "兴业银行浦东支行")
@ExcelProperty("开户地址")
private String bankAddress;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,61 @@
package cn.iocoder.yudao.module.erp.controller.admin.sale.vo.customer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
import java.math.BigDecimal;
@Schema(description = "管理后台 - ERP 客户新增/修改 Request VO")
@Data
public class ErpCustomerSaveReqVO {
@Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "27520")
private Long id;
@Schema(description = "客户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
@NotEmpty(message = "客户名称不能为空")
private String name;
@Schema(description = "联系人", example = "老王")
private String contact;
@Schema(description = "手机号码", example = "15601691300")
private String mobile;
@Schema(description = "联系电话", example = "15601691300")
private String telephone;
@Schema(description = "电子邮箱", example = "7685323@qq.com")
private String email;
@Schema(description = "传真", example = "20 7123 4567")
private String fax;
@Schema(description = "备注", example = "你猜")
private String remark;
@Schema(description = "开启状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "开启状态不能为空")
private Integer status;
@Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
@NotNull(message = "排序不能为空")
private Integer sort;
@Schema(description = "纳税人识别号", example = "91130803MA098BY05W")
private String taxNo;
@Schema(description = "税率", example = "10")
private BigDecimal taxPercent;
@Schema(description = "开户行", example = "芋艿")
private String bankName;
@Schema(description = "开户账号", example = "622908212277228617")
private String bankAccount;
@Schema(description = "开户地址", example = "兴业银行浦东支行")
private String bankAddress;
}

View File

@ -0,0 +1,149 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check.ErpStockCheckPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check.ErpStockCheckRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check.ErpStockCheckSaveReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockCheckDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockCheckItemDO;
import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
import cn.iocoder.yudao.module.erp.service.stock.ErpStockCheckService;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - ERP 库存调拨单")
@RestController
@RequestMapping("/erp/stock-check")
@Validated
public class ErpStockCheckController {
@Resource
private ErpStockCheckService stockCheckService;
@Resource
private ErpProductService productService;
@Resource
private AdminUserApi adminUserApi;
@PostMapping("/create")
@Operation(summary = "创建库存调拨单")
@PreAuthorize("@ss.hasPermission('erp:stock-check:create')")
public CommonResult<Long> createStockCheck(@Valid @RequestBody ErpStockCheckSaveReqVO createReqVO) {
return success(stockCheckService.createStockCheck(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新库存调拨单")
@PreAuthorize("@ss.hasPermission('erp:stock-check:update')")
public CommonResult<Boolean> updateStockCheck(@Valid @RequestBody ErpStockCheckSaveReqVO updateReqVO) {
stockCheckService.updateStockCheck(updateReqVO);
return success(true);
}
@PutMapping("/update-status")
@Operation(summary = "更新库存调拨单的状态")
@PreAuthorize("@ss.hasPermission('erp:stock-check:update-status')")
public CommonResult<Boolean> updateStockCheckStatus(@RequestParam("id") Long id,
@RequestParam("status") Integer status) {
stockCheckService.updateStockCheckStatus(id, status);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除库存调拨单")
@Parameter(name = "ids", description = "编号数组", required = true)
@PreAuthorize("@ss.hasPermission('erp:stock-check:delete')")
public CommonResult<Boolean> deleteStockCheck(@RequestParam("ids") List<Long> ids) {
stockCheckService.deleteStockCheck(ids);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得库存调拨单")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('erp:stock-check:query')")
public CommonResult<ErpStockCheckRespVO> getStockCheck(@RequestParam("id") Long id) {
ErpStockCheckDO stockCheck = stockCheckService.getStockCheck(id);
if (stockCheck == null) {
return success(null);
}
List<ErpStockCheckItemDO> stockCheckItemList = stockCheckService.getStockCheckItemListByCheckId(id);
Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
convertSet(stockCheckItemList, ErpStockCheckItemDO::getProductId));
return success(BeanUtils.toBean(stockCheck, ErpStockCheckRespVO.class, stockCheckVO ->
stockCheckVO.setItems(BeanUtils.toBean(stockCheckItemList, ErpStockCheckRespVO.Item.class, item ->
MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
.setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()))))));
}
@GetMapping("/page")
@Operation(summary = "获得库存调拨单分页")
@PreAuthorize("@ss.hasPermission('erp:stock-check:query')")
public CommonResult<PageResult<ErpStockCheckRespVO>> getStockCheckPage(@Valid ErpStockCheckPageReqVO pageReqVO) {
PageResult<ErpStockCheckDO> pageResult = stockCheckService.getStockCheckPage(pageReqVO);
return success(buildStockCheckVOPageResult(pageResult));
}
@GetMapping("/export-excel")
@Operation(summary = "导出库存调拨单 Excel")
@PreAuthorize("@ss.hasPermission('erp:stock-check:export')")
@OperateLog(type = EXPORT)
public void exportStockCheckExcel(@Valid ErpStockCheckPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ErpStockCheckRespVO> list = buildStockCheckVOPageResult(stockCheckService.getStockCheckPage(pageReqVO)).getList();
// 导出 Excel
ExcelUtils.write(response, "库存调拨单.xls", "数据", ErpStockCheckRespVO.class, list);
}
private PageResult<ErpStockCheckRespVO> buildStockCheckVOPageResult(PageResult<ErpStockCheckDO> pageResult) {
if (CollUtil.isEmpty(pageResult.getList())) {
return PageResult.empty(pageResult.getTotal());
}
// 1.1 出库项
List<ErpStockCheckItemDO> stockCheckItemList = stockCheckService.getStockCheckItemListByCheckIds(
convertSet(pageResult.getList(), ErpStockCheckDO::getId));
Map<Long, List<ErpStockCheckItemDO>> stockCheckItemMap = convertMultiMap(stockCheckItemList, ErpStockCheckItemDO::getCheckId);
// 1.2 商品信息
Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
convertSet(stockCheckItemList, ErpStockCheckItemDO::getProductId));
// 1.3 管理员信息
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
convertSet(pageResult.getList(), erpStockRecordDO -> Long.parseLong(erpStockRecordDO.getCreator())));
// 2. 开始拼接
return BeanUtils.toBean(pageResult, ErpStockCheckRespVO.class, stockCheck -> {
stockCheck.setItems(BeanUtils.toBean(stockCheckItemMap.get(stockCheck.getId()), ErpStockCheckRespVO.Item.class,
item -> MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
.setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()))));
stockCheck.setProductNames(CollUtil.join(stockCheck.getItems(), "", ErpStockCheckRespVO.Item::getProductName));
MapUtils.findAndThen(userMap, Long.parseLong(stockCheck.getCreator()), user -> stockCheck.setCreatorName(user.getNickname()));
});
}
}

View File

@ -0,0 +1,104 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.stock.ErpStockPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.stock.ErpStockRespVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpWarehouseDO;
import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
import cn.iocoder.yudao.module.erp.service.stock.ErpStockService;
import cn.iocoder.yudao.module.erp.service.stock.ErpWarehouseService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - ERP 产品库存")
@RestController
@RequestMapping("/erp/stock")
@Validated
public class ErpStockController {
@Resource
private ErpStockService stockService;
@Resource
private ErpProductService productService;
@Resource
private ErpWarehouseService warehouseService;
@GetMapping("/get")
@Operation(summary = "获得产品库存")
@Parameters({
@Parameter(name = "id", description = "编号", example = "1"), // 方案一传递 id
@Parameter(name = "productId", description = "产品编号", example = "10"), // 方案二传递 productId + warehouseId
@Parameter(name = "warehouseId", description = "仓库编号", example = "2")
})
@PreAuthorize("@ss.hasPermission('erp:stock:query')")
public CommonResult<ErpStockRespVO> getStock(@RequestParam(value = "id", required = false) Long id,
@RequestParam(value = "productId", required = false) Long productId,
@RequestParam(value = "warehouseId", required = false) Long warehouseId) {
ErpStockDO stock = id != null ? stockService.getStock(id) : stockService.getStock(productId, warehouseId);
return success(BeanUtils.toBean(stock, ErpStockRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得产品库存分页")
@PreAuthorize("@ss.hasPermission('erp:stock:query')")
public CommonResult<PageResult<ErpStockRespVO>> getStockPage(@Valid ErpStockPageReqVO pageReqVO) {
PageResult<ErpStockDO> pageResult = stockService.getStockPage(pageReqVO);
return success(buildStockVOPageResult(pageResult));
}
@GetMapping("/export-excel")
@Operation(summary = "导出产品库存 Excel")
@PreAuthorize("@ss.hasPermission('erp:stock:export')")
@OperateLog(type = EXPORT)
public void exportStockExcel(@Valid ErpStockPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ErpStockRespVO> list = buildStockVOPageResult(stockService.getStockPage(pageReqVO)).getList();
// 导出 Excel
ExcelUtils.write(response, "产品库存.xls", "数据", ErpStockRespVO.class, list);
}
private PageResult<ErpStockRespVO> buildStockVOPageResult(PageResult<ErpStockDO> pageResult) {
if (CollUtil.isEmpty(pageResult.getList())) {
return PageResult.empty(pageResult.getTotal());
}
Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
convertSet(pageResult.getList(), ErpStockDO::getProductId));
Map<Long, ErpWarehouseDO> warehouseMap = warehouseService.getWarehouseMap(
convertSet(pageResult.getList(), ErpStockDO::getWarehouseId));
return BeanUtils.toBean(pageResult, ErpStockRespVO.class, stock -> {
MapUtils.findAndThen(productMap, stock.getProductId(), product -> stock.setProductName(product.getName())
.setCategoryName(product.getCategoryName()).setUnitName(product.getUnitName()));
MapUtils.findAndThen(warehouseMap, stock.getWarehouseId(), warehouse -> stock.setWarehouseName(warehouse.getName()));
});
}
}

View File

@ -0,0 +1,165 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in.ErpStockInPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in.ErpStockInRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in.ErpStockInSaveReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockInDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockInItemDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpSupplierDO;
import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
import cn.iocoder.yudao.module.erp.service.purchase.ErpSupplierService;
import cn.iocoder.yudao.module.erp.service.stock.ErpStockInService;
import cn.iocoder.yudao.module.erp.service.stock.ErpStockService;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - ERP 其它入库单")
@RestController
@RequestMapping("/erp/stock-in")
@Validated
public class ErpStockInController {
@Resource
private ErpStockInService stockInService;
@Resource
private ErpStockService stockService;
@Resource
private ErpProductService productService;
@Resource
private ErpSupplierService supplierService;
@Resource
private AdminUserApi adminUserApi;
@PostMapping("/create")
@Operation(summary = "创建其它入库单")
@PreAuthorize("@ss.hasPermission('erp:stock-in:create')")
public CommonResult<Long> createStockIn(@Valid @RequestBody ErpStockInSaveReqVO createReqVO) {
return success(stockInService.createStockIn(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新其它入库单")
@PreAuthorize("@ss.hasPermission('erp:stock-in:update')")
public CommonResult<Boolean> updateStockIn(@Valid @RequestBody ErpStockInSaveReqVO updateReqVO) {
stockInService.updateStockIn(updateReqVO);
return success(true);
}
@PutMapping("/update-status")
@Operation(summary = "更新其它入库单的状态")
@PreAuthorize("@ss.hasPermission('erp:stock-in:update-status')")
public CommonResult<Boolean> updateStockInStatus(@RequestParam("id") Long id,
@RequestParam("status") Integer status) {
stockInService.updateStockInStatus(id, status);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除其它入库单")
@Parameter(name = "ids", description = "编号数组", required = true)
@PreAuthorize("@ss.hasPermission('erp:stock-in:delete')")
public CommonResult<Boolean> deleteStockIn(@RequestParam("ids") List<Long> ids) {
stockInService.deleteStockIn(ids);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得其它入库单")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('erp:stock-in:query')")
public CommonResult<ErpStockInRespVO> getStockIn(@RequestParam("id") Long id) {
ErpStockInDO stockIn = stockInService.getStockIn(id);
if (stockIn == null) {
return success(null);
}
List<ErpStockInItemDO> stockInItemList = stockInService.getStockInItemListByInId(id);
Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
convertSet(stockInItemList, ErpStockInItemDO::getProductId));
return success(BeanUtils.toBean(stockIn, ErpStockInRespVO.class, stockInVO ->
stockInVO.setItems(BeanUtils.toBean(stockInItemList, ErpStockInRespVO.Item.class, item -> {
ErpStockDO stock = stockService.getStock(item.getProductId(), item.getWarehouseId());
item.setStockCount(stock != null ? stock.getCount() : BigDecimal.ZERO);
MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
.setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()));
}))));
}
@GetMapping("/page")
@Operation(summary = "获得其它入库单分页")
@PreAuthorize("@ss.hasPermission('erp:stock-in:query')")
public CommonResult<PageResult<ErpStockInRespVO>> getStockInPage(@Valid ErpStockInPageReqVO pageReqVO) {
PageResult<ErpStockInDO> pageResult = stockInService.getStockInPage(pageReqVO);
return success(buildStockInVOPageResult(pageResult));
}
@GetMapping("/export-excel")
@Operation(summary = "导出其它入库单 Excel")
@PreAuthorize("@ss.hasPermission('erp:stock-in:export')")
@OperateLog(type = EXPORT)
public void exportStockInExcel(@Valid ErpStockInPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ErpStockInRespVO> list = buildStockInVOPageResult(stockInService.getStockInPage(pageReqVO)).getList();
// 导出 Excel
ExcelUtils.write(response, "其它入库单.xls", "数据", ErpStockInRespVO.class, list);
}
private PageResult<ErpStockInRespVO> buildStockInVOPageResult(PageResult<ErpStockInDO> pageResult) {
if (CollUtil.isEmpty(pageResult.getList())) {
return PageResult.empty(pageResult.getTotal());
}
// 1.1 入库项
List<ErpStockInItemDO> stockInItemList = stockInService.getStockInItemListByInIds(
convertSet(pageResult.getList(), ErpStockInDO::getId));
Map<Long, List<ErpStockInItemDO>> stockInItemMap = convertMultiMap(stockInItemList, ErpStockInItemDO::getInId);
// 1.2 商品信息
Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
convertSet(stockInItemList, ErpStockInItemDO::getProductId));
// 1.3 供应商信息
Map<Long, ErpSupplierDO> supplierMap = supplierService.getSupplierMap(
convertSet(pageResult.getList(), ErpStockInDO::getSupplierId));
// 1.4 管理员信息
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
convertSet(pageResult.getList(), erpStockRecordDO -> Long.parseLong(erpStockRecordDO.getCreator())));
// 2. 开始拼接
return BeanUtils.toBean(pageResult, ErpStockInRespVO.class, stockIn -> {
stockIn.setItems(BeanUtils.toBean(stockInItemMap.get(stockIn.getId()), ErpStockInRespVO.Item.class,
item -> MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
.setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()))));
stockIn.setProductNames(CollUtil.join(stockIn.getItems(), "", ErpStockInRespVO.Item::getProductName));
MapUtils.findAndThen(supplierMap, stockIn.getSupplierId(), supplier -> stockIn.setSupplierName(supplier.getName()));
MapUtils.findAndThen(userMap, Long.parseLong(stockIn.getCreator()), user -> stockIn.setCreatorName(user.getNickname()));
});
}
}

View File

@ -0,0 +1,160 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.move.ErpStockMovePageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.move.ErpStockMoveRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.move.ErpStockMoveSaveReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockMoveDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockMoveItemDO;
import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
import cn.iocoder.yudao.module.erp.service.stock.ErpStockMoveService;
import cn.iocoder.yudao.module.erp.service.stock.ErpStockService;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - ERP 库存调拨单")
@RestController
@RequestMapping("/erp/stock-move")
@Validated
public class ErpStockMoveController {
@Resource
private ErpStockMoveService stockMoveService;
@Resource
private ErpStockService stockService;
@Resource
private ErpProductService productService;
@Resource
private AdminUserApi adminUserApi;
@PostMapping("/create")
@Operation(summary = "创建库存调拨单")
@PreAuthorize("@ss.hasPermission('erp:stock-move:create')")
public CommonResult<Long> createStockMove(@Valid @RequestBody ErpStockMoveSaveReqVO createReqVO) {
return success(stockMoveService.createStockMove(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新库存调拨单")
@PreAuthorize("@ss.hasPermission('erp:stock-move:update')")
public CommonResult<Boolean> updateStockMove(@Valid @RequestBody ErpStockMoveSaveReqVO updateReqVO) {
stockMoveService.updateStockMove(updateReqVO);
return success(true);
}
@PutMapping("/update-status")
@Operation(summary = "更新库存调拨单的状态")
@PreAuthorize("@ss.hasPermission('erp:stock-move:update-status')")
public CommonResult<Boolean> updateStockMoveStatus(@RequestParam("id") Long id,
@RequestParam("status") Integer status) {
stockMoveService.updateStockMoveStatus(id, status);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除库存调拨单")
@Parameter(name = "ids", description = "编号数组", required = true)
@PreAuthorize("@ss.hasPermission('erp:stock-move:delete')")
public CommonResult<Boolean> deleteStockMove(@RequestParam("ids") List<Long> ids) {
stockMoveService.deleteStockMove(ids);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得库存调拨单")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('erp:stock-move:query')")
public CommonResult<ErpStockMoveRespVO> getStockMove(@RequestParam("id") Long id) {
ErpStockMoveDO stockMove = stockMoveService.getStockMove(id);
if (stockMove == null) {
return success(null);
}
List<ErpStockMoveItemDO> stockMoveItemList = stockMoveService.getStockMoveItemListByMoveId(id);
Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
convertSet(stockMoveItemList, ErpStockMoveItemDO::getProductId));
return success(BeanUtils.toBean(stockMove, ErpStockMoveRespVO.class, stockMoveVO ->
stockMoveVO.setItems(BeanUtils.toBean(stockMoveItemList, ErpStockMoveRespVO.Item.class, item -> {
ErpStockDO stock = stockService.getStock(item.getProductId(), item.getFromWarehouseId());
item.setStockCount(stock != null ? stock.getCount() : BigDecimal.ZERO);
MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
.setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()));
}))));
}
@GetMapping("/page")
@Operation(summary = "获得库存调拨单分页")
@PreAuthorize("@ss.hasPermission('erp:stock-move:query')")
public CommonResult<PageResult<ErpStockMoveRespVO>> getStockMovePage(@Valid ErpStockMovePageReqVO pageReqVO) {
PageResult<ErpStockMoveDO> pageResult = stockMoveService.getStockMovePage(pageReqVO);
return success(buildStockMoveVOPageResult(pageResult));
}
@GetMapping("/export-excel")
@Operation(summary = "导出库存调拨单 Excel")
@PreAuthorize("@ss.hasPermission('erp:stock-move:export')")
@OperateLog(type = EXPORT)
public void exportStockMoveExcel(@Valid ErpStockMovePageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ErpStockMoveRespVO> list = buildStockMoveVOPageResult(stockMoveService.getStockMovePage(pageReqVO)).getList();
// 导出 Excel
ExcelUtils.write(response, "库存调拨单.xls", "数据", ErpStockMoveRespVO.class, list);
}
private PageResult<ErpStockMoveRespVO> buildStockMoveVOPageResult(PageResult<ErpStockMoveDO> pageResult) {
if (CollUtil.isEmpty(pageResult.getList())) {
return PageResult.empty(pageResult.getTotal());
}
// 1.1 出库项
List<ErpStockMoveItemDO> stockMoveItemList = stockMoveService.getStockMoveItemListByMoveIds(
convertSet(pageResult.getList(), ErpStockMoveDO::getId));
Map<Long, List<ErpStockMoveItemDO>> stockMoveItemMap = convertMultiMap(stockMoveItemList, ErpStockMoveItemDO::getMoveId);
// 1.2 商品信息
Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
convertSet(stockMoveItemList, ErpStockMoveItemDO::getProductId));
// 1.3 TODO 芋艿搞仓库信息
// 1.4 管理员信息
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
convertSet(pageResult.getList(), erpStockRecordDO -> Long.parseLong(erpStockRecordDO.getCreator())));
// 2. 开始拼接
return BeanUtils.toBean(pageResult, ErpStockMoveRespVO.class, stockMove -> {
stockMove.setItems(BeanUtils.toBean(stockMoveItemMap.get(stockMove.getId()), ErpStockMoveRespVO.Item.class,
item -> MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
.setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()))));
stockMove.setProductNames(CollUtil.join(stockMove.getItems(), "", ErpStockMoveRespVO.Item::getProductName));
// TODO 芋艿
// MapUtils.findAndThen(customerMap, stockMove.getCustomerId(), supplier -> stockMove.setCustomerName(supplier.getName()));
MapUtils.findAndThen(userMap, Long.parseLong(stockMove.getCreator()), user -> stockMove.setCreatorName(user.getNickname()));
});
}
}

View File

@ -0,0 +1,165 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out.ErpStockOutPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out.ErpStockOutRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out.ErpStockOutSaveReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpCustomerDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockOutDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockOutItemDO;
import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
import cn.iocoder.yudao.module.erp.service.sale.ErpCustomerService;
import cn.iocoder.yudao.module.erp.service.stock.ErpStockOutService;
import cn.iocoder.yudao.module.erp.service.stock.ErpStockService;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - ERP 其它出库单")
@RestController
@RequestMapping("/erp/stock-out")
@Validated
public class ErpStockOutController {
@Resource
private ErpStockOutService stockOutService;
@Resource
private ErpStockService stockService;
@Resource
private ErpProductService productService;
@Resource
private ErpCustomerService customerService;
@Resource
private AdminUserApi adminUserApi;
@PostMapping("/create")
@Operation(summary = "创建其它出库单")
@PreAuthorize("@ss.hasPermission('erp:stock-out:create')")
public CommonResult<Long> createStockOut(@Valid @RequestBody ErpStockOutSaveReqVO createReqVO) {
return success(stockOutService.createStockOut(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新其它出库单")
@PreAuthorize("@ss.hasPermission('erp:stock-out:update')")
public CommonResult<Boolean> updateStockOut(@Valid @RequestBody ErpStockOutSaveReqVO updateReqVO) {
stockOutService.updateStockOut(updateReqVO);
return success(true);
}
@PutMapping("/update-status")
@Operation(summary = "更新其它出库单的状态")
@PreAuthorize("@ss.hasPermission('erp:stock-out:update-status')")
public CommonResult<Boolean> updateStockOutStatus(@RequestParam("id") Long id,
@RequestParam("status") Integer status) {
stockOutService.updateStockOutStatus(id, status);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除其它出库单")
@Parameter(name = "ids", description = "编号数组", required = true)
@PreAuthorize("@ss.hasPermission('erp:stock-out:delete')")
public CommonResult<Boolean> deleteStockOut(@RequestParam("ids") List<Long> ids) {
stockOutService.deleteStockOut(ids);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得其它出库单")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('erp:stock-out:query')")
public CommonResult<ErpStockOutRespVO> getStockOut(@RequestParam("id") Long id) {
ErpStockOutDO stockOut = stockOutService.getStockOut(id);
if (stockOut == null) {
return success(null);
}
List<ErpStockOutItemDO> stockOutItemList = stockOutService.getStockOutItemListByOutId(id);
Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
convertSet(stockOutItemList, ErpStockOutItemDO::getProductId));
return success(BeanUtils.toBean(stockOut, ErpStockOutRespVO.class, stockOutVO ->
stockOutVO.setItems(BeanUtils.toBean(stockOutItemList, ErpStockOutRespVO.Item.class, item -> {
ErpStockDO stock = stockService.getStock(item.getProductId(), item.getWarehouseId());
item.setStockCount(stock != null ? stock.getCount() : BigDecimal.ZERO);
MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
.setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()));
}))));
}
@GetMapping("/page")
@Operation(summary = "获得其它出库单分页")
@PreAuthorize("@ss.hasPermission('erp:stock-out:query')")
public CommonResult<PageResult<ErpStockOutRespVO>> getStockOutPage(@Valid ErpStockOutPageReqVO pageReqVO) {
PageResult<ErpStockOutDO> pageResult = stockOutService.getStockOutPage(pageReqVO);
return success(buildStockOutVOPageResult(pageResult));
}
@GetMapping("/export-excel")
@Operation(summary = "导出其它出库单 Excel")
@PreAuthorize("@ss.hasPermission('erp:stock-out:export')")
@OperateLog(type = EXPORT)
public void exportStockOutExcel(@Valid ErpStockOutPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ErpStockOutRespVO> list = buildStockOutVOPageResult(stockOutService.getStockOutPage(pageReqVO)).getList();
// 导出 Excel
ExcelUtils.write(response, "其它出库单.xls", "数据", ErpStockOutRespVO.class, list);
}
private PageResult<ErpStockOutRespVO> buildStockOutVOPageResult(PageResult<ErpStockOutDO> pageResult) {
if (CollUtil.isEmpty(pageResult.getList())) {
return PageResult.empty(pageResult.getTotal());
}
// 1.1 出库项
List<ErpStockOutItemDO> stockOutItemList = stockOutService.getStockOutItemListByOutIds(
convertSet(pageResult.getList(), ErpStockOutDO::getId));
Map<Long, List<ErpStockOutItemDO>> stockOutItemMap = convertMultiMap(stockOutItemList, ErpStockOutItemDO::getOutId);
// 1.2 商品信息
Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
convertSet(stockOutItemList, ErpStockOutItemDO::getProductId));
// 1.3 客户信息
Map<Long, ErpCustomerDO> customerMap = customerService.getCustomerMap(
convertSet(pageResult.getList(), ErpStockOutDO::getCustomerId));
// 1.4 管理员信息
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
convertSet(pageResult.getList(), erpStockRecordDO -> Long.parseLong(erpStockRecordDO.getCreator())));
// 2. 开始拼接
return BeanUtils.toBean(pageResult, ErpStockOutRespVO.class, stockOut -> {
stockOut.setItems(BeanUtils.toBean(stockOutItemMap.get(stockOut.getId()), ErpStockOutRespVO.Item.class,
item -> MapUtils.findAndThen(productMap, item.getProductId(), product -> item.setProductName(product.getName())
.setProductBarCode(product.getBarCode()).setProductUnitName(product.getUnitName()))));
stockOut.setProductNames(CollUtil.join(stockOut.getItems(), "", ErpStockOutRespVO.Item::getProductName));
MapUtils.findAndThen(customerMap, stockOut.getCustomerId(), supplier -> stockOut.setCustomerName(supplier.getName()));
MapUtils.findAndThen(userMap, Long.parseLong(stockOut.getCreator()), user -> stockOut.setCreatorName(user.getNickname()));
});
}
}

View File

@ -0,0 +1,105 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.record.ErpStockRecordPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.record.ErpStockRecordRespVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockRecordDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpWarehouseDO;
import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
import cn.iocoder.yudao.module.erp.service.stock.ErpStockRecordService;
import cn.iocoder.yudao.module.erp.service.stock.ErpWarehouseService;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - ERP 产品库存明细")
@RestController
@RequestMapping("/erp/stock-record")
@Validated
public class ErpStockRecordController {
@Resource
private ErpStockRecordService stockRecordService;
@Resource
private ErpProductService productService;
@Resource
private ErpWarehouseService warehouseService;
@Resource
private AdminUserApi adminUserApi;
@GetMapping("/get")
@Operation(summary = "获得产品库存明细")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('erp:stock-record:query')")
public CommonResult<ErpStockRecordRespVO> getStockRecord(@RequestParam("id") Long id) {
ErpStockRecordDO stockRecord = stockRecordService.getStockRecord(id);
return success(BeanUtils.toBean(stockRecord, ErpStockRecordRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得产品库存明细分页")
@PreAuthorize("@ss.hasPermission('erp:stock-record:query')")
public CommonResult<PageResult<ErpStockRecordRespVO>> getStockRecordPage(@Valid ErpStockRecordPageReqVO pageReqVO) {
PageResult<ErpStockRecordDO> pageResult = stockRecordService.getStockRecordPage(pageReqVO);
return success(buildStockRecrodVOPageResult(pageResult));
}
@GetMapping("/export-excel")
@Operation(summary = "导出产品库存明细 Excel")
@PreAuthorize("@ss.hasPermission('erp:stock-record:export')")
@OperateLog(type = EXPORT)
public void exportStockRecordExcel(@Valid ErpStockRecordPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ErpStockRecordRespVO> list = buildStockRecrodVOPageResult(stockRecordService.getStockRecordPage(pageReqVO)).getList();
// 导出 Excel
ExcelUtils.write(response, "产品库存明细.xls", "数据", ErpStockRecordRespVO.class, list);
}
private PageResult<ErpStockRecordRespVO> buildStockRecrodVOPageResult(PageResult<ErpStockRecordDO> pageResult) {
if (CollUtil.isEmpty(pageResult.getList())) {
return PageResult.empty(pageResult.getTotal());
}
Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
convertSet(pageResult.getList(), ErpStockRecordDO::getProductId));
Map<Long, ErpWarehouseDO> warehouseMap = warehouseService.getWarehouseMap(
convertSet(pageResult.getList(), ErpStockRecordDO::getWarehouseId));
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
convertSet(pageResult.getList(), erpStockRecordDO -> Long.parseLong(erpStockRecordDO.getCreator())));
return BeanUtils.toBean(pageResult, ErpStockRecordRespVO.class, stock -> {
MapUtils.findAndThen(productMap, stock.getProductId(), product -> stock.setProductName(product.getName())
.setCategoryName(product.getCategoryName()).setUnitName(product.getUnitName()));
MapUtils.findAndThen(warehouseMap, stock.getWarehouseId(), warehouse -> stock.setWarehouseName(warehouse.getName()));
MapUtils.findAndThen(userMap, Long.parseLong(stock.getCreator()), user -> stock.setCreatorName(user.getNickname()));
});
}
}

View File

@ -0,0 +1,114 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.ErpWarehouseSaveReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse.ErpWarehousePageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse.ErpWarehouseRespVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpWarehouseDO;
import cn.iocoder.yudao.module.erp.service.stock.ErpWarehouseService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - ERP 仓库")
@RestController
@RequestMapping("/erp/warehouse")
@Validated
public class ErpWarehouseController {
@Resource
private ErpWarehouseService warehouseService;
@PostMapping("/create")
@Operation(summary = "创建仓库")
@PreAuthorize("@ss.hasPermission('erp:warehouse:create')")
public CommonResult<Long> createWarehouse(@Valid @RequestBody ErpWarehouseSaveReqVO createReqVO) {
return success(warehouseService.createWarehouse(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新仓库")
@PreAuthorize("@ss.hasPermission('erp:warehouse:update')")
public CommonResult<Boolean> updateWarehouse(@Valid @RequestBody ErpWarehouseSaveReqVO updateReqVO) {
warehouseService.updateWarehouse(updateReqVO);
return success(true);
}
@PutMapping("/update-default-status")
@Operation(summary = "更新仓库默认状态")
@Parameters({
@Parameter(name = "id", description = "编号", required = true),
@Parameter(name = "status", description = "状态", required = true)
})
public CommonResult<Boolean> updateWarehouseDefaultStatus(@RequestParam("id") Long id,
@RequestParam("defaultStatus") Boolean defaultStatus) {
warehouseService.updateWarehouseDefaultStatus(id, defaultStatus);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除仓库")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('erp:warehouse:delete')")
public CommonResult<Boolean> deleteWarehouse(@RequestParam("id") Long id) {
warehouseService.deleteWarehouse(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得仓库")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('erp:warehouse:query')")
public CommonResult<ErpWarehouseRespVO> getWarehouse(@RequestParam("id") Long id) {
ErpWarehouseDO warehouse = warehouseService.getWarehouse(id);
return success(BeanUtils.toBean(warehouse, ErpWarehouseRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得仓库分页")
@PreAuthorize("@ss.hasPermission('erp:warehouse:query')")
public CommonResult<PageResult<ErpWarehouseRespVO>> getWarehousePage(@Valid ErpWarehousePageReqVO pageReqVO) {
PageResult<ErpWarehouseDO> pageResult = warehouseService.getWarehousePage(pageReqVO);
return success(BeanUtils.toBean(pageResult, ErpWarehouseRespVO.class));
}
@GetMapping("/simple-list")
@Operation(summary = "获得仓库精简列表", description = "只包含被开启的仓库,主要用于前端的下拉选项")
public CommonResult<List<ErpWarehouseRespVO>> getWarehouseSimpleList() {
List<ErpWarehouseDO> list = warehouseService.getWarehouseListByStatus(CommonStatusEnum.ENABLE.getStatus());
return success(BeanUtils.toBean(list, ErpWarehouseRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出仓库 Excel")
@PreAuthorize("@ss.hasPermission('erp:warehouse:export')")
@OperateLog(type = EXPORT)
public void exportWarehouseExcel(@Valid ErpWarehousePageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ErpWarehouseDO> list = warehouseService.getWarehousePage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "仓库.xls", "数据", ErpWarehouseRespVO.class,
BeanUtils.toBean(list, ErpWarehouseRespVO.class));
}
}

View File

@ -0,0 +1,45 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.erp.enums.ErpAuditStatus;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - ERP 库存盘点单分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ErpStockCheckPageReqVO extends PageParam {
@Schema(description = "盘点单号", example = "S123")
private String no;
@Schema(description = "仓库编号", example = "3113")
private Long warehouseId;
@Schema(description = "盘点时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] checkTime;
@Schema(description = "状态", example = "10")
@InEnum(ErpAuditStatus.class)
private Integer status;
@Schema(description = "备注", example = "随便")
private String remark;
@Schema(description = "创建者")
private String creator;
@Schema(description = "产品编号", example = "1")
private Long productId;
}

View File

@ -0,0 +1,111 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import static cn.iocoder.yudao.module.erp.enums.DictTypeConstants.AUDIT_STATUS;
@Schema(description = "管理后台 - ERP 库存盘点单 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ErpStockCheckRespVO {
@Schema(description = "盘点编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
@ExcelProperty("盘点编号")
private Long id;
@Schema(description = "盘点单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "S123")
@ExcelProperty("盘点单号")
private String no;
@Schema(description = "盘点时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("盘点时间")
private LocalDateTime checkTime;
@Schema(description = "合计数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "15663")
@ExcelProperty("合计数量")
private BigDecimal totalCount;
@Schema(description = "合计金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
@ExcelProperty("合计金额")
private BigDecimal totalPrice;
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
@ExcelProperty(value = "状态", converter = DictConvert.class)
@DictFormat(AUDIT_STATUS)
private Integer status;
@Schema(description = "备注", example = "随便")
@ExcelProperty("备注")
private String remark;
@Schema(description = "附件 URL", example = "https://www.iocoder.cn/1.doc")
private String fileUrl;
@Schema(description = "审核人", example = "芋道")
private String creator;
@Schema(description = "审核人名称", example = "芋道")
private String creatorName;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "盘点项列表", requiredMode = Schema.RequiredMode.REQUIRED)
private List<Item> items;
@Schema(description = "产品信息", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("产品信息")
private String productNames;
@Data
public static class Item {
@Schema(description = "盘点项编号", example = "11756")
private Long id;
@Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
private Long warehouseId;
@Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
private Long productId;
@Schema(description = "产品单价", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
private BigDecimal productPrice;
@Schema(description = "账面数量(当前库存)", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
@NotNull(message = "账面数量不能为空")
private BigDecimal stockCount;
@Schema(description = "实际数量(实际库存)", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
@NotNull(message = "实际数量不能为空")
private BigDecimal actualCount;
@Schema(description = "盈亏数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
@NotNull(message = "盈亏数量不能为空")
private BigDecimal count;
@Schema(description = "备注", example = "随便")
private String remark;
// ========== 关联字段 ==========
@Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "巧克力")
private String productName;
@Schema(description = "产品条码", requiredMode = Schema.RequiredMode.REQUIRED, example = "A9985")
private String productBarCode;
@Schema(description = "产品单位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "")
private String productUnitName;
}
}

View File

@ -0,0 +1,69 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@Schema(description = "管理后台 - ERP 其它出库单新增/修改 Request VO")
@Data
public class ErpStockCheckSaveReqVO {
@Schema(description = "出库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
private Long id;
@Schema(description = "出库时间", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "出库时间不能为空")
private LocalDateTime checkTime;
@Schema(description = "备注", example = "随便")
private String remark;
@Schema(description = "附件 URL", example = "https://www.iocoder.cn/1.doc")
private String fileUrl;
@Schema(description = "出库项列表", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "出库项列表不能为空")
@Valid
private List<Item> items;
@Data
public static class Item {
@Schema(description = "出库项编号", example = "11756")
private Long id;
@Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
@NotNull(message = "仓库编号不能为空")
private Long warehouseId;
@Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
@NotNull(message = "产品编号不能为空")
private Long productId;
@Schema(description = "产品单价", example = "100.00")
private BigDecimal productPrice;
@Schema(description = "账面数量(当前库存)", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
@NotNull(message = "账面数量不能为空")
private BigDecimal stockCount;
@Schema(description = "实际数量(实际库存)", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
@NotNull(message = "实际数量不能为空")
private BigDecimal actualCount;
@Schema(description = "盈亏数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
@NotNull(message = "盈亏数量不能为空")
private BigDecimal count;
@Schema(description = "备注", example = "随便")
private String remark;
}
}

View File

@ -0,0 +1,48 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.erp.enums.ErpAuditStatus;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - ERP 其它入库单分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ErpStockInPageReqVO extends PageParam {
@Schema(description = "入库单号", example = "S123")
private String no;
@Schema(description = "供应商编号", example = "3113")
private Long supplierId;
@Schema(description = "入库时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] inTime;
@Schema(description = "状态", example = "10")
@InEnum(ErpAuditStatus.class)
private Integer status;
@Schema(description = "备注", example = "随便")
private String remark;
@Schema(description = "创建者")
private String creator;
@Schema(description = "产品编号", example = "1")
private Long productId;
@Schema(description = "仓库编号", example = "1")
private Long warehouseId;
}

View File

@ -0,0 +1,110 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import static cn.iocoder.yudao.module.erp.enums.DictTypeConstants.AUDIT_STATUS;
@Schema(description = "管理后台 - ERP 其它入库单 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ErpStockInRespVO {
@Schema(description = "入库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
@ExcelProperty("入库编号")
private Long id;
@Schema(description = "入库单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "S123")
@ExcelProperty("入库单号")
private String no;
@Schema(description = "供应商编号", example = "3113")
private Long supplierId;
@Schema(description = "供应商名称", example = "芋道")
@ExcelProperty("供应商名称")
private String supplierName;
@Schema(description = "入库时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("入库时间")
private LocalDateTime inTime;
@Schema(description = "合计数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "15663")
@ExcelProperty("合计数量")
private BigDecimal totalCount;
@Schema(description = "合计金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
@ExcelProperty("合计金额")
private BigDecimal totalPrice;
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
@ExcelProperty(value = "状态", converter = DictConvert.class)
@DictFormat(AUDIT_STATUS)
private Integer status;
@Schema(description = "备注", example = "随便")
@ExcelProperty("备注")
private String remark;
@Schema(description = "附件 URL", example = "https://www.iocoder.cn/1.doc")
private String fileUrl;
@Schema(description = "审核人", example = "芋道")
private String creator;
@Schema(description = "审核人名称", example = "芋道")
private String creatorName;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "入库项列表", requiredMode = Schema.RequiredMode.REQUIRED)
private List<Item> items;
@Schema(description = "产品信息", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("产品信息")
private String productNames;
@Data
public static class Item {
@Schema(description = "入库项编号", example = "11756")
private Long id;
@Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
private Long warehouseId;
@Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
private Long productId;
@Schema(description = "产品单价", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
private BigDecimal productPrice;
@Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
private BigDecimal count;
@Schema(description = "备注", example = "随便")
private String remark;
// ========== 关联字段 ==========
@Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "巧克力")
private String productName;
@Schema(description = "产品条码", requiredMode = Schema.RequiredMode.REQUIRED, example = "A9985")
private String productBarCode;
@Schema(description = "产品单位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "")
private String productUnitName;
@Schema(description = "库存数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
private BigDecimal stockCount; // 该字段仅仅在详情编辑时使用
}
}

View File

@ -0,0 +1,64 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@Schema(description = "管理后台 - ERP 其它入库单新增/修改 Request VO")
@Data
public class ErpStockInSaveReqVO {
@Schema(description = "入库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
private Long id;
@Schema(description = "供应商编号", example = "3113")
private Long supplierId;
@Schema(description = "入库时间", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "入库时间不能为空")
private LocalDateTime inTime;
@Schema(description = "备注", example = "随便")
private String remark;
@Schema(description = "附件 URL", example = "https://www.iocoder.cn/1.doc")
private String fileUrl;
@Schema(description = "入库项列表", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "入库项列表不能为空")
@Valid
private List<Item> items;
@Data
public static class Item {
@Schema(description = "入库项编号", example = "11756")
private Long id;
@Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
@NotNull(message = "仓库编号不能为空")
private Long warehouseId;
@Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
@NotNull(message = "产品编号不能为空")
private Long productId;
@Schema(description = "产品单价", example = "100.00")
private BigDecimal productPrice;
@Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
@NotNull(message = "产品数量不能为空")
private BigDecimal count;
@Schema(description = "备注", example = "随便")
private String remark;
}
}

View File

@ -0,0 +1,45 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.move;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.erp.enums.ErpAuditStatus;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - ERP 库存调拨单分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ErpStockMovePageReqVO extends PageParam {
@Schema(description = "调拨单号", example = "S123")
private String no;
@Schema(description = "调拨时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] moveTime;
@Schema(description = "状态", example = "10")
@InEnum(ErpAuditStatus.class)
private Integer status;
@Schema(description = "备注", example = "随便")
private String remark;
@Schema(description = "创建者")
private String creator;
@Schema(description = "产品编号", example = "1")
private Long productId;
@Schema(description = "调出仓库编号", example = "1")
private Long fromWarehouseId;
}

View File

@ -0,0 +1,107 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.move;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import static cn.iocoder.yudao.module.erp.enums.DictTypeConstants.AUDIT_STATUS;
@Schema(description = "管理后台 - ERP 库存调拨单 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ErpStockMoveRespVO {
@Schema(description = "调拨编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
@ExcelProperty("调拨编号")
private Long id;
@Schema(description = "调拨单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "S123")
@ExcelProperty("调拨单号")
private String no;
@Schema(description = "调拨时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("调拨时间")
private LocalDateTime moveTime;
@Schema(description = "合计数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "15663")
@ExcelProperty("合计数量")
private BigDecimal totalCount;
@Schema(description = "合计金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
@ExcelProperty("合计金额")
private BigDecimal totalPrice;
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
@ExcelProperty(value = "状态", converter = DictConvert.class)
@DictFormat(AUDIT_STATUS)
private Integer status;
@Schema(description = "备注", example = "随便")
@ExcelProperty("备注")
private String remark;
@Schema(description = "附件 URL", example = "https://www.iocoder.cn/1.doc")
private String fileUrl;
@Schema(description = "审核人", example = "芋道")
private String creator;
@Schema(description = "审核人名称", example = "芋道")
private String creatorName;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "调拨项列表", requiredMode = Schema.RequiredMode.REQUIRED)
private List<Item> items;
@Schema(description = "产品信息", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("产品信息")
private String productNames;
@Data
public static class Item {
@Schema(description = "调拨项编号", example = "11756")
private Long id;
@Schema(description = "调出仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
private Long fromWarehouseId;
@Schema(description = "调入仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "888")
private Long toWarehouseId;
@Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
private Long productId;
@Schema(description = "产品单价", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
private BigDecimal productPrice;
@Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
private BigDecimal count;
@Schema(description = "备注", example = "随便")
private String remark;
// ========== 关联字段 ==========
@Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "巧克力")
private String productName;
@Schema(description = "产品条码", requiredMode = Schema.RequiredMode.REQUIRED, example = "A9985")
private String productBarCode;
@Schema(description = "产品单位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "")
private String productUnitName;
@Schema(description = "库存数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
private BigDecimal stockCount; // 该字段仅仅在详情编辑时使用
}
}

View File

@ -0,0 +1,77 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.move;
import cn.hutool.core.util.ObjectUtil;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.AssertTrue;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@Schema(description = "管理后台 - ERP 库存调拨单新增/修改 Request VO")
@Data
public class ErpStockMoveSaveReqVO {
@Schema(description = "调拨编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
private Long id;
@Schema(description = "客户编号", example = "3113")
private Long customerId;
@Schema(description = "调拨时间", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "调拨时间不能为空")
private LocalDateTime moveTime;
@Schema(description = "备注", example = "随便")
private String remark;
@Schema(description = "附件 URL", example = "https://www.iocoder.cn/1.doc")
private String fileUrl;
@Schema(description = "调拨项列表", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "调拨项列表不能为空")
@Valid
private List<Item> items;
@Data
public static class Item {
@Schema(description = "调拨项编号", example = "11756")
private Long id;
@Schema(description = "调出仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
@NotNull(message = "调出仓库编号不能为空")
private Long fromWarehouseId;
@Schema(description = "调入仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "888")
@NotNull(message = "调入仓库编号不能为空")
private Long toWarehouseId;
@Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
@NotNull(message = "产品编号不能为空")
private Long productId;
@Schema(description = "产品单价", example = "100.00")
private BigDecimal productPrice;
@Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
@NotNull(message = "产品数量不能为空")
private BigDecimal count;
@Schema(description = "备注", example = "随便")
private String remark;
@AssertTrue(message = "调出、调仓仓库不能相同")
@JsonIgnore
public boolean isWarehouseValid() {
return ObjectUtil.notEqual(fromWarehouseId, toWarehouseId);
}
}
}

View File

@ -0,0 +1,48 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.erp.enums.ErpAuditStatus;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - ERP 其它出库单分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ErpStockOutPageReqVO extends PageParam {
@Schema(description = "出库单号", example = "S123")
private String no;
@Schema(description = "客户编号", example = "3113")
private Long customerId;
@Schema(description = "出库时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] outTime;
@Schema(description = "状态", example = "10")
@InEnum(ErpAuditStatus.class)
private Integer status;
@Schema(description = "备注", example = "随便")
private String remark;
@Schema(description = "创建者")
private String creator;
@Schema(description = "产品编号", example = "1")
private Long productId;
@Schema(description = "仓库编号", example = "1")
private Long warehouseId;
}

View File

@ -0,0 +1,110 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import static cn.iocoder.yudao.module.erp.enums.DictTypeConstants.AUDIT_STATUS;
@Schema(description = "管理后台 - ERP 其它出库单 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ErpStockOutRespVO {
@Schema(description = "出库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
@ExcelProperty("出库编号")
private Long id;
@Schema(description = "出库单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "S123")
@ExcelProperty("出库单号")
private String no;
@Schema(description = "客户编号", example = "3113")
private Long customerId;
@Schema(description = "客户名称", example = "芋道")
@ExcelProperty("客户名称")
private String customerName;
@Schema(description = "出库时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("出库时间")
private LocalDateTime outTime;
@Schema(description = "合计数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "15663")
@ExcelProperty("合计数量")
private BigDecimal totalCount;
@Schema(description = "合计金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
@ExcelProperty("合计金额")
private BigDecimal totalPrice;
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
@ExcelProperty(value = "状态", converter = DictConvert.class)
@DictFormat(AUDIT_STATUS)
private Integer status;
@Schema(description = "备注", example = "随便")
@ExcelProperty("备注")
private String remark;
@Schema(description = "附件 URL", example = "https://www.iocoder.cn/1.doc")
private String fileUrl;
@Schema(description = "审核人", example = "芋道")
private String creator;
@Schema(description = "审核人名称", example = "芋道")
private String creatorName;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "出库项列表", requiredMode = Schema.RequiredMode.REQUIRED)
private List<Item> items;
@Schema(description = "产品信息", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("产品信息")
private String productNames;
@Data
public static class Item {
@Schema(description = "出库项编号", example = "11756")
private Long id;
@Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
private Long warehouseId;
@Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
private Long productId;
@Schema(description = "产品单价", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
private BigDecimal productPrice;
@Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
private BigDecimal count;
@Schema(description = "备注", example = "随便")
private String remark;
// ========== 关联字段 ==========
@Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "巧克力")
private String productName;
@Schema(description = "产品条码", requiredMode = Schema.RequiredMode.REQUIRED, example = "A9985")
private String productBarCode;
@Schema(description = "产品单位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "")
private String productUnitName;
@Schema(description = "库存数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
private BigDecimal stockCount; // 该字段仅仅在详情编辑时使用
}
}

View File

@ -0,0 +1,64 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@Schema(description = "管理后台 - ERP 其它出库单新增/修改 Request VO")
@Data
public class ErpStockOutSaveReqVO {
@Schema(description = "出库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
private Long id;
@Schema(description = "客户编号", example = "3113")
private Long customerId;
@Schema(description = "出库时间", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "出库时间不能为空")
private LocalDateTime outTime;
@Schema(description = "备注", example = "随便")
private String remark;
@Schema(description = "附件 URL", example = "https://www.iocoder.cn/1.doc")
private String fileUrl;
@Schema(description = "出库项列表", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "出库项列表不能为空")
@Valid
private List<Item> items;
@Data
public static class Item {
@Schema(description = "出库项编号", example = "11756")
private Long id;
@Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
@NotNull(message = "仓库编号不能为空")
private Long warehouseId;
@Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
@NotNull(message = "产品编号不能为空")
private Long productId;
@Schema(description = "产品单价", example = "100.00")
private BigDecimal productPrice;
@Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
@NotNull(message = "产品数量不能为空")
private BigDecimal count;
@Schema(description = "备注", example = "随便")
private String remark;
}
}

View File

@ -0,0 +1,36 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.record;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - ERP 产品库存明细分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ErpStockRecordPageReqVO extends PageParam {
@Schema(description = "产品编号", example = "10625")
private Long productId;
@Schema(description = "仓库编号", example = "32407")
private Long warehouseId;
@Schema(description = "业务类型", example = "10")
private Integer bizType;
@Schema(description = "业务单号", example = "Z110")
private String bizNo;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,87 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.record;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import cn.iocoder.yudao.module.erp.enums.DictTypeConstants;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - ERP 产品库存明细 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ErpStockRecordRespVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18909")
@ExcelProperty("编号")
private Long id;
@Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10625")
private Long productId;
@Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "32407")
private Long warehouseId;
@Schema(description = "出入库数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "11084")
@ExcelProperty("出入库数量")
private BigDecimal count;
@Schema(description = "总库存量", requiredMode = Schema.RequiredMode.REQUIRED, example = "4307")
@ExcelProperty("总库存量")
private BigDecimal totalCount;
@Schema(description = "业务类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
@ExcelProperty(value = "业务类型", converter = DictConvert.class)
@DictFormat(DictTypeConstants.STOCK_RECORD_BIZ_TYPE)
private Integer bizType;
@Schema(description = "业务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "27093")
@ExcelProperty("业务编号")
private Long bizId;
@Schema(description = "业务项编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "23516")
@ExcelProperty("业务项编号")
private Long bizItemId;
@Schema(description = "业务单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "Z110")
@ExcelProperty("业务单号")
private String bizNo;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "创建人", requiredMode = Schema.RequiredMode.REQUIRED, example = "25682")
private String creator;
// ========== 产品信息 ==========
@Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "苹果")
@ExcelProperty("产品名称")
private String productName;
@Schema(description = "产品分类", requiredMode = Schema.RequiredMode.REQUIRED, example = "水果")
@ExcelProperty("产品分类")
private String categoryName;
@Schema(description = "单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "")
@ExcelProperty("单位")
private String unitName;
// ========== 仓库信息 ==========
@Schema(description = "仓库名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
@ExcelProperty("仓库名称")
private String warehouseName;
// ========== 用户信息 ==========
@Schema(description = "创建人", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
@ExcelProperty("创建人")
private String creatorName;
}

View File

@ -0,0 +1,21 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.stock;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Schema(description = "管理后台 - ERP 库存分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ErpStockPageReqVO extends PageParam {
@Schema(description = "产品编号", example = "19614")
private Long productId;
@Schema(description = "仓库编号", example = "2802")
private Long warehouseId;
}

View File

@ -0,0 +1,49 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.stock;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Schema(description = "管理后台 - ERP 库存 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ErpStockRespVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17086")
@ExcelProperty("编号")
private Long id;
@Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "19614")
private Long productId;
@Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2802")
private Long warehouseId;
@Schema(description = "库存数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "21935")
@ExcelProperty("库存数量")
private BigDecimal count;
// ========== 产品信息 ==========
@Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "苹果")
@ExcelProperty("产品名称")
private String productName;
@Schema(description = "产品分类", requiredMode = Schema.RequiredMode.REQUIRED, example = "水果")
@ExcelProperty("产品分类")
private String categoryName;
@Schema(description = "单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "")
@ExcelProperty("单位")
private String unitName;
// ========== 仓库信息 ==========
@Schema(description = "仓库名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
@ExcelProperty("仓库名称")
private String warehouseName;
}

View File

@ -0,0 +1,24 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Schema(description = "管理后台 - ERP 仓库分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ErpWarehousePageReqVO extends PageParam {
@Schema(description = "仓库名称", example = "李四")
private String name;
@Schema(description = "开启状态", example = "1")
@InEnum(CommonStatusEnum.class)
private Integer status;
}

View File

@ -0,0 +1,64 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import cn.iocoder.yudao.module.system.enums.DictTypeConstants;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - ERP 仓库 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ErpWarehouseRespVO {
@Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11614")
@ExcelProperty("仓库编号")
private Long id;
@Schema(description = "仓库名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
@ExcelProperty("仓库名称")
private String name;
@Schema(description = "仓库地址", example = "上海陆家嘴")
@ExcelProperty("仓库地址")
private String address;
@Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
@ExcelProperty("排序")
private Long sort;
@Schema(description = "备注", example = "随便")
@ExcelProperty("备注")
private String remark;
@Schema(description = "负责人", example = "芋头")
@ExcelProperty("负责人")
private String principal;
@Schema(description = "仓储费,单位:元", example = "13973")
@ExcelProperty("仓储费,单位:元")
private BigDecimal warehousePrice;
@Schema(description = "搬运费,单位:元", example = "9903")
@ExcelProperty("搬运费,单位:元")
private BigDecimal truckagePrice;
@Schema(description = "开启状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty(value = "开启状态", converter = DictConvert.class)
@DictFormat(DictTypeConstants.COMMON_STATUS)
private Integer status;
@Schema(description = "是否默认", example = "1")
@ExcelProperty("是否默认")
private Boolean defaultStatus;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,47 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.math.BigDecimal;
@Schema(description = "管理后台 - ERP 仓库新增/修改 Request VO")
@Data
public class ErpWarehouseSaveReqVO {
@Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11614")
private Long id;
@Schema(description = "仓库名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
@NotEmpty(message = "仓库名称不能为空")
private String name;
@Schema(description = "仓库地址", example = "上海陆家嘴")
private String address;
@Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
@NotNull(message = "排序不能为空")
private Long sort;
@Schema(description = "备注", example = "随便")
private String remark;
@Schema(description = "负责人", example = "芋头")
private String principal;
@Schema(description = "仓储费,单位:元", example = "13973")
private BigDecimal warehousePrice;
@Schema(description = "搬运费,单位:元", example = "9903")
private BigDecimal truckagePrice;
@Schema(description = "开启状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotNull(message = "开启状态不能为空")
@InEnum(CommonStatusEnum.class)
private Integer status;
}

View File

@ -45,9 +45,9 @@ public class ErpProductDO extends BaseDO {
/**
* 单位编号
*
* TODO 芋艿关联
* 关联 {@link ErpProductUnitDO#getId()}
*/
private Integer unitId;
private Long unitId;
/**
* 产品状态
*

View File

@ -0,0 +1,90 @@
package cn.iocoder.yudao.module.erp.dal.dataobject.purchase;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.math.BigDecimal;
/**
* ERP 供应商 DO
*
* @author 芋道源码
*/
@TableName("erp_supplier")
@KeySequence("erp_supplier_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ErpSupplierDO extends BaseDO {
/**
* 供应商编号
*/
@TableId
private Long id;
/**
* 供应商名称
*/
private String name;
/**
* 联系人
*/
private String contact;
/**
* 手机号码
*/
private String mobile;
/**
* 联系电话
*/
private String telephone;
/**
* 电子邮箱
*/
private String email;
/**
* 传真
*/
private String fax;
/**
* 备注
*/
private String remark;
/**
* 开启状态
*
* 枚举 {@link cn.iocoder.yudao.framework.common.enums.CommonStatusEnum}
*/
private Integer status;
/**
* 排序
*/
private Integer sort;
/**
* 纳税人识别号
*/
private String taxNo;
/**
* 税率
*/
private BigDecimal taxPercent;
/**
* 开户行
*/
private String bankName;
/**
* 开户账号
*/
private String bankAccount;
/**
* 开户地址
*/
private String bankAddress;
}

View File

@ -0,0 +1,90 @@
package cn.iocoder.yudao.module.erp.dal.dataobject.sale;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.math.BigDecimal;
/**
* ERP 客户 DO
*
* @author 芋道源码
*/
@TableName("erp_customer")
@KeySequence("erp_customer_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ErpCustomerDO extends BaseDO {
/**
* 客户编号
*/
@TableId
private Long id;
/**
* 客户名称
*/
private String name;
/**
* 联系人
*/
private String contact;
/**
* 手机号码
*/
private String mobile;
/**
* 联系电话
*/
private String telephone;
/**
* 电子邮箱
*/
private String email;
/**
* 传真
*/
private String fax;
/**
* 备注
*/
private String remark;
/**
* 开启状态
*
* 枚举 {@link cn.iocoder.yudao.framework.common.enums.CommonStatusEnum}
*/
private Integer status;
/**
* 排序
*/
private Integer sort;
/**
* 纳税人识别号
*/
private String taxNo;
/**
* 税率
*/
private BigDecimal taxPercent;
/**
* 开户行
*/
private String bankName;
/**
* 开户账号
*/
private String bankAccount;
/**
* 开户地址
*/
private String bankAddress;
}

View File

@ -0,0 +1,63 @@
package cn.iocoder.yudao.module.erp.dal.dataobject.stock;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* ERP 库存盘点单 DO
*
* @author 芋道源码
*/
@TableName("erp_stock_check")
@KeySequence("erp_stock_check_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ErpStockCheckDO extends BaseDO {
/**
* 盘点编号
*/
@TableId
private Long id;
/**
* 盘点单号
*/
private String no;
/**
* 盘点时间
*/
private LocalDateTime checkTime;
/**
* 合计数量
*/
private BigDecimal totalCount;
/**
* 合计金额单位
*/
private BigDecimal totalPrice;
/**
* 状态
*
* 枚举 {@link cn.iocoder.yudao.module.erp.enums.ErpAuditStatus}
*/
private Integer status;
/**
* 备注
*/
private String remark;
/**
* 附件 URL
*/
private String fileUrl;
}

View File

@ -0,0 +1,83 @@
package cn.iocoder.yudao.module.erp.dal.dataobject.stock;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.math.BigDecimal;
/**
* ERP 库存盘点单项 DO
*
* @author 芋道源码
*/
@TableName("erp_stock_check_item")
@KeySequence("erp_stock_check_item_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ErpStockCheckItemDO extends BaseDO {
/**
* 盘点项编号
*/
@TableId
private Long id;
/**
* 盘点编号
*
* 关联 {@link ErpStockCheckDO#getId()}
*/
private Long checkId;
/**
* 仓库编号
*
* 关联 {@link ErpWarehouseDO#getId()}
*/
private Long warehouseId;
/**
* 产品编号
*
* 关联 {@link ErpProductDO#getId()}
*/
private Long productId;
/**
* 产品单位编号
*
* 冗余 {@link ErpProductDO#getUnitId()}
*/
private Long productUnitId;
/**
* 产品单价
*/
private BigDecimal productPrice;
/**
* 账面数量当前库存
*/
private BigDecimal stockCount;
/**
* 实际数量实际库存
*/
private BigDecimal actualCount;
/**
* 盈亏数量
*
* count = stockCount - actualCount
*/
private BigDecimal count;
/**
* 合计金额单位
*/
private BigDecimal totalPrice;
/**
* 备注
*/
private String remark;
}

View File

@ -0,0 +1,49 @@
package cn.iocoder.yudao.module.erp.dal.dataobject.stock;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.math.BigDecimal;
/**
* ERP 产品库存 DO
*
* @author 芋道源码
*/
@TableName("erp_stock")
@KeySequence("erp_stock_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ErpStockDO extends BaseDO {
/**
* 编号
*/
@TableId
private Long id;
/**
* 产品编号
*
* 关联 {@link ErpProductDO#getId()}
*/
private Long productId;
/**
* 仓库编号
*
* 关联 {@link ErpWarehouseDO#getId()}
*/
private Long warehouseId;
/**
* 库存数量
*/
private BigDecimal count;
}

View File

@ -0,0 +1,70 @@
package cn.iocoder.yudao.module.erp.dal.dataobject.stock;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpSupplierDO;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* ERP 其它入库单 DO
*
* @author 芋道源码
*/
@TableName("erp_stock_in")
@KeySequence("erp_stock_in_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ErpStockInDO extends BaseDO {
/**
* 入库编号
*/
@TableId
private Long id;
/**
* 入库单号
*/
private String no;
/**
* 供应商编号
*
* 关联 {@link ErpSupplierDO#getId()}
*/
private Long supplierId;
/**
* 入库时间
*/
private LocalDateTime inTime;
/**
* 合计数量
*/
private BigDecimal totalCount;
/**
* 合计金额单位
*/
private BigDecimal totalPrice;
/**
* 状态
*
* 枚举 {@link cn.iocoder.yudao.module.erp.enums.ErpAuditStatus}
*/
private Integer status;
/**
* 备注
*/
private String remark;
/**
* 附件 URL
*/
private String fileUrl;
}

View File

@ -0,0 +1,73 @@
package cn.iocoder.yudao.module.erp.dal.dataobject.stock;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.math.BigDecimal;
/**
* ERP 其它入库单项 DO
*
* @author 芋道源码
*/
@TableName("erp_stock_in_item")
@KeySequence("erp_stock_in_item_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ErpStockInItemDO extends BaseDO {
/**
* 入库项编号
*/
@TableId
private Long id;
/**
* 入库编号
*
* 关联 {@link ErpStockInDO#getId()}
*/
private Long inId;
/**
* 仓库编号
*
* 关联 {@link ErpWarehouseDO#getId()}
*/
private Long warehouseId;
/**
* 产品编号
*
* 关联 {@link ErpProductDO#getId()}
*/
private Long productId;
/**
* 产品单位编号
*
* 冗余 {@link ErpProductDO#getUnitId()}
*/
private Long productUnitId;
/**
* 产品单价
*/
private BigDecimal productPrice;
/**
* 产品数量
*/
private BigDecimal count;
/**
* 合计金额单位
*/
private BigDecimal totalPrice;
/**
* 备注
*/
private String remark;
}

View File

@ -0,0 +1,63 @@
package cn.iocoder.yudao.module.erp.dal.dataobject.stock;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* ERP 库存调拨单 DO
*
* @author 芋道源码
*/
@TableName("erp_stock_move")
@KeySequence("erp_stock_move_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ErpStockMoveDO extends BaseDO {
/**
* 调拨编号
*/
@TableId
private Long id;
/**
* 调拨单号
*/
private String no;
/**
* 调拨时间
*/
private LocalDateTime moveTime;
/**
* 合计数量
*/
private BigDecimal totalCount;
/**
* 合计金额单位
*/
private BigDecimal totalPrice;
/**
* 状态
*
* 枚举 {@link cn.iocoder.yudao.module.erp.enums.ErpAuditStatus}
*/
private Integer status;
/**
* 备注
*/
private String remark;
/**
* 附件 URL
*/
private String fileUrl;
}

View File

@ -0,0 +1,79 @@
package cn.iocoder.yudao.module.erp.dal.dataobject.stock;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.math.BigDecimal;
/**
* ERP 库存调拨单项 DO
*
* @author 芋道源码
*/
@TableName("erp_stock_move_item")
@KeySequence("erp_stock_move_item_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ErpStockMoveItemDO extends BaseDO {
/**
* 调拨项编号
*/
@TableId
private Long id;
/**
* 调拨编号
*
* 关联 {@link ErpStockMoveDO#getId()}
*/
private Long moveId;
/**
* 调出仓库编号
*
* 关联 {@link ErpWarehouseDO#getId()}
*/
private Long fromWarehouseId;
/**
* 调入仓库编号
*
* 关联 {@link ErpWarehouseDO#getId()}
*/
private Long toWarehouseId;
/**
* 产品编号
*
* 关联 {@link ErpProductDO#getId()}
*/
private Long productId;
/**
* 产品单位编号
*
* 冗余 {@link ErpProductDO#getUnitId()}
*/
private Long productUnitId;
/**
* 产品单价
*/
private BigDecimal productPrice;
/**
* 产品数量
*/
private BigDecimal count;
/**
* 合计金额单位
*/
private BigDecimal totalPrice;
/**
* 备注
*/
private String remark;
}

View File

@ -0,0 +1,69 @@
package cn.iocoder.yudao.module.erp.dal.dataobject.stock;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* ERP 其它出库单 DO
*
* @author 芋道源码
*/
@TableName("erp_stock_out")
@KeySequence("erp_stock_out_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ErpStockOutDO extends BaseDO {
/**
* 出库编号
*/
@TableId
private Long id;
/**
* 出库单号
*/
private String no;
/**
* 客户编号
*
* TODO 芋艿待关联
*/
private Long customerId;
/**
* 出库时间
*/
private LocalDateTime outTime;
/**
* 合计数量
*/
private BigDecimal totalCount;
/**
* 合计金额单位
*/
private BigDecimal totalPrice;
/**
* 状态
*
* 枚举 {@link cn.iocoder.yudao.module.erp.enums.ErpAuditStatus}
*/
private Integer status;
/**
* 备注
*/
private String remark;
/**
* 附件 URL
*/
private String fileUrl;
}

View File

@ -0,0 +1,73 @@
package cn.iocoder.yudao.module.erp.dal.dataobject.stock;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.math.BigDecimal;
/**
* ERP 其它出库单项 DO
*
* @author 芋道源码
*/
@TableName("erp_stock_out_item")
@KeySequence("erp_stock_out_item_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ErpStockOutItemDO extends BaseDO {
/**
* 出库项编号
*/
@TableId
private Long id;
/**
* 出库编号
*
* 关联 {@link ErpStockOutDO#getId()}
*/
private Long outId;
/**
* 仓库编号
*
* 关联 {@link ErpWarehouseDO#getId()}
*/
private Long warehouseId;
/**
* 产品编号
*
* 关联 {@link ErpProductDO#getId()}
*/
private Long productId;
/**
* 产品单位编号
*
* 冗余 {@link ErpProductDO#getUnitId()}
*/
private Long productUnitId;
/**
* 产品单价
*/
private BigDecimal productPrice;
/**
* 产品数量
*/
private BigDecimal count;
/**
* 合计金额单位
*/
private BigDecimal totalPrice;
/**
* 备注
*/
private String remark;
}

View File

@ -0,0 +1,82 @@
package cn.iocoder.yudao.module.erp.dal.dataobject.stock;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
import cn.iocoder.yudao.module.erp.enums.stock.ErpStockRecordBizTypeEnum;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.math.BigDecimal;
/**
* ERP 产品库存明细 DO
*
* @author 芋道源码
*/
@TableName("erp_stock_record")
@KeySequence("erp_stock_record_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ErpStockRecordDO extends BaseDO {
/**
* 编号
*/
@TableId
private Long id;
/**
* 产品编号
*
* 关联 {@link ErpProductDO#getId()}
*/
private Long productId;
/**
* 仓库编号
*
* 关联 {@link ErpWarehouseDO#getId()}
*/
private Long warehouseId;
/**
* 出入库数量
*
* 正数表示入库负数表示出库
*/
private BigDecimal count;
/**
* 总库存量
*
* 出入库之后目前的库存量
*/
private BigDecimal totalCount;
/**
* 业务类型
*
* 枚举 {@link ErpStockRecordBizTypeEnum}
*/
private Integer bizType;
/**
* 业务编号
*
* 例如说{@link ErpStockInDO#getId()}
*/
private Long bizId;
/**
* 业务项编号
*
* 例如说{@link ErpStockInItemDO#getId()}
*/
private Long bizItemId;
/**
* 业务单号
*
* 例如说{@link ErpStockInDO#getNo()}
*/
private String bizNo;
}

View File

@ -0,0 +1,70 @@
package cn.iocoder.yudao.module.erp.dal.dataobject.stock;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.math.BigDecimal;
/**
* ERP 仓库 DO
*
* @author 芋道源码
*/
@TableName("erp_warehouse")
@KeySequence("erp_warehouse_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ErpWarehouseDO extends BaseDO {
/**
* 仓库编号
*/
@TableId
private Long id;
/**
* 仓库名称
*/
private String name;
/**
* 仓库地址
*/
private String address;
/**
* 排序
*/
private Long sort;
/**
* 备注
*/
private String remark;
/**
* 负责人
*/
private String principal;
/**
* 仓储费单位
*/
private BigDecimal warehousePrice;
/**
* 搬运费单位
*/
private BigDecimal truckagePrice;
/**
* 开启状态
*
* 枚举 {@link cn.iocoder.yudao.framework.common.enums.CommonStatusEnum}
*/
private Integer status;
/**
* 是否默认
*/
private Boolean defaultStatus;
}

View File

@ -3,10 +3,12 @@ package cn.iocoder.yudao.module.erp.dal.mysql.product;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ProductPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductPageReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* ERP 产品 Mapper
*
@ -15,7 +17,7 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ErpProductMapper extends BaseMapperX<ErpProductDO> {
default PageResult<ErpProductDO> selectPage(ProductPageReqVO reqVO) {
default PageResult<ErpProductDO> selectPage(ErpProductPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ErpProductDO>()
.likeIfPresent(ErpProductDO::getName, reqVO.getName())
.eqIfPresent(ErpProductDO::getCategoryId, reqVO.getCategoryId())
@ -23,4 +25,16 @@ public interface ErpProductMapper extends BaseMapperX<ErpProductDO> {
.orderByDesc(ErpProductDO::getId));
}
default Long selectCountByCategoryId(Long categoryId) {
return selectCount(ErpProductDO::getCategoryId, categoryId);
}
default Long selectCountByUnitId(Long unitId) {
return selectCount(ErpProductDO::getUnitId, unitId);
}
default List<ErpProductDO> selectListByStatus(Integer status) {
return selectList(ErpProductDO::getStatus, status);
}
}

View File

@ -7,6 +7,8 @@ import cn.iocoder.yudao.module.erp.controller.admin.product.vo.unit.ErpProductUn
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductUnitDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* ERP 产品单位 Mapper
*
@ -19,8 +21,15 @@ public interface ErpProductUnitMapper extends BaseMapperX<ErpProductUnitDO> {
return selectPage(reqVO, new LambdaQueryWrapperX<ErpProductUnitDO>()
.likeIfPresent(ErpProductUnitDO::getName, reqVO.getName())
.eqIfPresent(ErpProductUnitDO::getStatus, reqVO.getStatus())
.betweenIfPresent(ErpProductUnitDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(ErpProductUnitDO::getId));
}
default ErpProductUnitDO selectByName(String name) {
return selectOne(ErpProductUnitDO::getName, name);
}
default List<ErpProductUnitDO> selectListByStatus(Integer status) {
return selectList(ErpProductUnitDO::getStatus, status);
}
}

View File

@ -0,0 +1,32 @@
package cn.iocoder.yudao.module.erp.dal.mysql.purchase;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.supplier.ErpSupplierPageReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpSupplierDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* ERP 供应商 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface ErpSupplierMapper extends BaseMapperX<ErpSupplierDO> {
default PageResult<ErpSupplierDO> selectPage(ErpSupplierPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ErpSupplierDO>()
.likeIfPresent(ErpSupplierDO::getName, reqVO.getName())
.likeIfPresent(ErpSupplierDO::getMobile, reqVO.getMobile())
.likeIfPresent(ErpSupplierDO::getTelephone, reqVO.getTelephone())
.orderByDesc(ErpSupplierDO::getId));
}
default List<ErpSupplierDO> selectListByStatus(Integer status) {
return selectList(ErpSupplierDO::getStatus, status);
}
}

View File

@ -0,0 +1,32 @@
package cn.iocoder.yudao.module.erp.dal.mysql.sale;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.erp.controller.admin.sale.vo.customer.ErpCustomerPageReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpCustomerDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* ERP 客户 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface ErpCustomerMapper extends BaseMapperX<ErpCustomerDO> {
default PageResult<ErpCustomerDO> selectPage(ErpCustomerPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ErpCustomerDO>()
.likeIfPresent(ErpCustomerDO::getName, reqVO.getName())
.eqIfPresent(ErpCustomerDO::getMobile, reqVO.getMobile())
.eqIfPresent(ErpCustomerDO::getTelephone, reqVO.getTelephone())
.orderByDesc(ErpCustomerDO::getId));
}
default List<ErpCustomerDO> selectListByStatus(Integer status) {
return selectList(ErpCustomerDO::getStatus, status);
}
}

View File

@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.erp.dal.mysql.stock;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockCheckItemDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.Collection;
import java.util.List;
/**
* ERP 库存盘点单项 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface ErpStockCheckItemMapper extends BaseMapperX<ErpStockCheckItemDO> {
default List<ErpStockCheckItemDO> selectListByCheckId(Long checkId) {
return selectList(ErpStockCheckItemDO::getCheckId, checkId);
}
default List<ErpStockCheckItemDO> selectListByCheckIds(Collection<Long> checkIds) {
return selectList(ErpStockCheckItemDO::getCheckId, checkIds);
}
default int deleteByCheckId(Long checkId) {
return delete(ErpStockCheckItemDO::getCheckId, checkId);
}
}

View File

@ -0,0 +1,46 @@
package cn.iocoder.yudao.module.erp.dal.mysql.stock;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.MPJLambdaWrapperX;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check.ErpStockCheckPageReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockCheckDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockCheckItemDO;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import org.apache.ibatis.annotations.Mapper;
/**
* ERP 库存调拨单 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface ErpStockCheckMapper extends BaseMapperX<ErpStockCheckDO> {
default PageResult<ErpStockCheckDO> selectPage(ErpStockCheckPageReqVO reqVO) {
MPJLambdaWrapperX<ErpStockCheckDO> query = new MPJLambdaWrapperX<ErpStockCheckDO>()
.eqIfPresent(ErpStockCheckDO::getNo, reqVO.getNo())
.betweenIfPresent(ErpStockCheckDO::getCheckTime, reqVO.getCheckTime())
.eqIfPresent(ErpStockCheckDO::getStatus, reqVO.getStatus())
.likeIfPresent(ErpStockCheckDO::getRemark, reqVO.getRemark())
.eqIfPresent(ErpStockCheckDO::getCreator, reqVO.getCreator())
.orderByDesc(ErpStockCheckDO::getId);
if (reqVO.getWarehouseId() != null || reqVO.getProductId() != null) {
query.leftJoin(ErpStockCheckItemDO.class, ErpStockCheckItemDO::getCheckId, ErpStockCheckDO::getId)
.eq(reqVO.getWarehouseId() != null, ErpStockCheckItemDO::getWarehouseId, reqVO.getWarehouseId())
.eq(reqVO.getProductId() != null, ErpStockCheckItemDO::getProductId, reqVO.getProductId())
.groupBy(ErpStockCheckDO::getId); // 避免 1 对多查询产生相同的 1
}
return selectJoinPage(reqVO, ErpStockCheckDO.class, query);
}
default int updateByIdAndStatus(Long id, Integer status, ErpStockCheckDO updateObj) {
return update(updateObj, new LambdaUpdateWrapper<ErpStockCheckDO>()
.eq(ErpStockCheckDO::getId, id).eq(ErpStockCheckDO::getStatus, status));
}
default ErpStockCheckDO selectByNo(String no) {
return selectOne(ErpStockCheckDO::getNo, no);
}
}

View File

@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.erp.dal.mysql.stock;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockInItemDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.Collection;
import java.util.List;
/**
* ERP 其它入库单项 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface ErpStockInItemMapper extends BaseMapperX<ErpStockInItemDO> {
default List<ErpStockInItemDO> selectListByInId(Long inId) {
return selectList(ErpStockInItemDO::getInId, inId);
}
default List<ErpStockInItemDO> selectListByInIds(Collection<Long> inIds) {
return selectList(ErpStockInItemDO::getInId, inIds);
}
default int deleteByInId(Long inId) {
return delete(ErpStockInItemDO::getInId, inId);
}
}

View File

@ -0,0 +1,47 @@
package cn.iocoder.yudao.module.erp.dal.mysql.stock;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.MPJLambdaWrapperX;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in.ErpStockInPageReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockInDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockInItemDO;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import org.apache.ibatis.annotations.Mapper;
/**
* ERP 其它入库单 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface ErpStockInMapper extends BaseMapperX<ErpStockInDO> {
default PageResult<ErpStockInDO> selectPage(ErpStockInPageReqVO reqVO) {
MPJLambdaWrapperX<ErpStockInDO> query = new MPJLambdaWrapperX<ErpStockInDO>()
.eqIfPresent(ErpStockInDO::getNo, reqVO.getNo())
.eqIfPresent(ErpStockInDO::getSupplierId, reqVO.getSupplierId())
.betweenIfPresent(ErpStockInDO::getInTime, reqVO.getInTime())
.eqIfPresent(ErpStockInDO::getStatus, reqVO.getStatus())
.likeIfPresent(ErpStockInDO::getRemark, reqVO.getRemark())
.eqIfPresent(ErpStockInDO::getCreator, reqVO.getCreator())
.orderByDesc(ErpStockInDO::getId);
if (reqVO.getWarehouseId() != null || reqVO.getProductId() != null) {
query.leftJoin(ErpStockInItemDO.class, ErpStockInItemDO::getInId, ErpStockInDO::getId)
.eq(reqVO.getWarehouseId() != null, ErpStockInItemDO::getWarehouseId, reqVO.getWarehouseId())
.eq(reqVO.getProductId() != null, ErpStockInItemDO::getProductId, reqVO.getProductId())
.groupBy(ErpStockInDO::getId); // 避免 1 对多查询产生相同的 1
}
return selectJoinPage(reqVO, ErpStockInDO.class, query);
}
default int updateByIdAndStatus(Long id, Integer status, ErpStockInDO updateObj) {
return update(updateObj, new LambdaUpdateWrapper<ErpStockInDO>()
.eq(ErpStockInDO::getId, id).eq(ErpStockInDO::getStatus, status));
}
default ErpStockInDO selectByNo(String no) {
return selectOne(ErpStockInDO::getNo, no);
}
}

View File

@ -0,0 +1,47 @@
package cn.iocoder.yudao.module.erp.dal.mysql.stock;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.stock.ErpStockPageReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockDO;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import org.apache.ibatis.annotations.Mapper;
import java.math.BigDecimal;
/**
* ERP 产品库存 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface ErpStockMapper extends BaseMapperX<ErpStockDO> {
default PageResult<ErpStockDO> selectPage(ErpStockPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ErpStockDO>()
.eqIfPresent(ErpStockDO::getProductId, reqVO.getProductId())
.eqIfPresent(ErpStockDO::getWarehouseId, reqVO.getWarehouseId())
.orderByDesc(ErpStockDO::getId));
}
default ErpStockDO selectByProductIdAndWarehouseId(Long productId, Long warehouseId) {
return selectOne(ErpStockDO::getProductId, productId,
ErpStockDO::getWarehouseId, warehouseId);
}
default int updateCountIncrement(Long id, BigDecimal count, boolean negativeEnable) {
LambdaUpdateWrapper<ErpStockDO> updateWrapper = new LambdaUpdateWrapper<ErpStockDO>()
.eq(ErpStockDO::getId, id);
if (count.compareTo(BigDecimal.ZERO) > 0) {
updateWrapper.setSql("count = count + " + count);
} else if (count.compareTo(BigDecimal.ZERO) < 0) {
if (!negativeEnable) {
updateWrapper.gt(ErpStockDO::getCount, count.abs());
}
updateWrapper.setSql("count = count - " + count.abs());
}
return update(null, updateWrapper);
}
}

View File

@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.erp.dal.mysql.stock;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockMoveItemDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.Collection;
import java.util.List;
/**
* ERP 库存调拨单项 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface ErpStockMoveItemMapper extends BaseMapperX<ErpStockMoveItemDO> {
default List<ErpStockMoveItemDO> selectListByMoveId(Long moveId) {
return selectList(ErpStockMoveItemDO::getMoveId, moveId);
}
default List<ErpStockMoveItemDO> selectListByMoveIds(Collection<Long> moveIds) {
return selectList(ErpStockMoveItemDO::getMoveId, moveIds);
}
default int deleteByMoveId(Long moveId) {
return delete(ErpStockMoveItemDO::getMoveId, moveId);
}
}

View File

@ -0,0 +1,46 @@
package cn.iocoder.yudao.module.erp.dal.mysql.stock;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.MPJLambdaWrapperX;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.move.ErpStockMovePageReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockMoveDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockMoveItemDO;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import org.apache.ibatis.annotations.Mapper;
/**
* ERP 库存调拨单 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface ErpStockMoveMapper extends BaseMapperX<ErpStockMoveDO> {
default PageResult<ErpStockMoveDO> selectPage(ErpStockMovePageReqVO reqVO) {
MPJLambdaWrapperX<ErpStockMoveDO> query = new MPJLambdaWrapperX<ErpStockMoveDO>()
.eqIfPresent(ErpStockMoveDO::getNo, reqVO.getNo())
.betweenIfPresent(ErpStockMoveDO::getMoveTime, reqVO.getMoveTime())
.eqIfPresent(ErpStockMoveDO::getStatus, reqVO.getStatus())
.likeIfPresent(ErpStockMoveDO::getRemark, reqVO.getRemark())
.eqIfPresent(ErpStockMoveDO::getCreator, reqVO.getCreator())
.orderByDesc(ErpStockMoveDO::getId);
if (reqVO.getFromWarehouseId() != null || reqVO.getProductId() != null) {
query.leftJoin(ErpStockMoveItemDO.class, ErpStockMoveItemDO::getMoveId, ErpStockMoveDO::getId)
.eq(reqVO.getFromWarehouseId() != null, ErpStockMoveItemDO::getFromWarehouseId, reqVO.getFromWarehouseId())
.eq(reqVO.getProductId() != null, ErpStockMoveItemDO::getProductId, reqVO.getProductId())
.groupBy(ErpStockMoveDO::getId); // 避免 1 对多查询产生相同的 1
}
return selectJoinPage(reqVO, ErpStockMoveDO.class, query);
}
default int updateByIdAndStatus(Long id, Integer status, ErpStockMoveDO updateObj) {
return update(updateObj, new LambdaUpdateWrapper<ErpStockMoveDO>()
.eq(ErpStockMoveDO::getId, id).eq(ErpStockMoveDO::getStatus, status));
}
default ErpStockMoveDO selectByNo(String no) {
return selectOne(ErpStockMoveDO::getNo, no);
}
}

View File

@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.erp.dal.mysql.stock;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockOutItemDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.Collection;
import java.util.List;
/**
* ERP 其它出库单项 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface ErpStockOutItemMapper extends BaseMapperX<ErpStockOutItemDO> {
default List<ErpStockOutItemDO> selectListByOutId(Long outId) {
return selectList(ErpStockOutItemDO::getOutId, outId);
}
default List<ErpStockOutItemDO> selectListByOutIds(Collection<Long> outIds) {
return selectList(ErpStockOutItemDO::getOutId, outIds);
}
default int deleteByOutId(Long outId) {
return delete(ErpStockOutItemDO::getOutId, outId);
}
}

View File

@ -0,0 +1,47 @@
package cn.iocoder.yudao.module.erp.dal.mysql.stock;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.MPJLambdaWrapperX;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out.ErpStockOutPageReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockOutDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockOutItemDO;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import org.apache.ibatis.annotations.Mapper;
/**
* ERP 其它出库单 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface ErpStockOutMapper extends BaseMapperX<ErpStockOutDO> {
default PageResult<ErpStockOutDO> selectPage(ErpStockOutPageReqVO reqVO) {
MPJLambdaWrapperX<ErpStockOutDO> query = new MPJLambdaWrapperX<ErpStockOutDO>()
.eqIfPresent(ErpStockOutDO::getNo, reqVO.getNo())
.eqIfPresent(ErpStockOutDO::getCustomerId, reqVO.getCustomerId())
.betweenIfPresent(ErpStockOutDO::getOutTime, reqVO.getOutTime())
.eqIfPresent(ErpStockOutDO::getStatus, reqVO.getStatus())
.likeIfPresent(ErpStockOutDO::getRemark, reqVO.getRemark())
.eqIfPresent(ErpStockOutDO::getCreator, reqVO.getCreator())
.orderByDesc(ErpStockOutDO::getId);
if (reqVO.getWarehouseId() != null || reqVO.getProductId() != null) {
query.leftJoin(ErpStockOutItemDO.class, ErpStockOutItemDO::getOutId, ErpStockOutDO::getId)
.eq(reqVO.getWarehouseId() != null, ErpStockOutItemDO::getWarehouseId, reqVO.getWarehouseId())
.eq(reqVO.getProductId() != null, ErpStockOutItemDO::getProductId, reqVO.getProductId())
.groupBy(ErpStockOutDO::getId); // 避免 1 对多查询产生相同的 1
}
return selectJoinPage(reqVO, ErpStockOutDO.class, query);
}
default int updateByIdAndStatus(Long id, Integer status, ErpStockOutDO updateObj) {
return update(updateObj, new LambdaUpdateWrapper<ErpStockOutDO>()
.eq(ErpStockOutDO::getId, id).eq(ErpStockOutDO::getStatus, status));
}
default ErpStockOutDO selectByNo(String no) {
return selectOne(ErpStockOutDO::getNo, no);
}
}

View File

@ -0,0 +1,28 @@
package cn.iocoder.yudao.module.erp.dal.mysql.stock;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.record.ErpStockRecordPageReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockRecordDO;
import org.apache.ibatis.annotations.Mapper;
/**
* ERP 产品库存明细 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface ErpStockRecordMapper extends BaseMapperX<ErpStockRecordDO> {
default PageResult<ErpStockRecordDO> selectPage(ErpStockRecordPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ErpStockRecordDO>()
.eqIfPresent(ErpStockRecordDO::getProductId, reqVO.getProductId())
.eqIfPresent(ErpStockRecordDO::getWarehouseId, reqVO.getWarehouseId())
.eqIfPresent(ErpStockRecordDO::getBizType, reqVO.getBizType())
.likeIfPresent(ErpStockRecordDO::getBizNo, reqVO.getBizNo())
.betweenIfPresent(ErpStockRecordDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(ErpStockRecordDO::getId));
}
}

View File

@ -0,0 +1,35 @@
package cn.iocoder.yudao.module.erp.dal.mysql.stock;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse.ErpWarehousePageReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpWarehouseDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* ERP 仓库 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface ErpWarehouseMapper extends BaseMapperX<ErpWarehouseDO> {
default PageResult<ErpWarehouseDO> selectPage(ErpWarehousePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ErpWarehouseDO>()
.likeIfPresent(ErpWarehouseDO::getName, reqVO.getName())
.eqIfPresent(ErpWarehouseDO::getStatus, reqVO.getStatus())
.orderByDesc(ErpWarehouseDO::getId));
}
default ErpWarehouseDO selectByDefaultStatus() {
return selectOne(ErpWarehouseDO::getDefaultStatus, true);
}
default List<ErpWarehouseDO> selectListByStatus(Integer status) {
return selectList(ErpWarehouseDO::getStatus, status);
}
}

View File

@ -0,0 +1,18 @@
package cn.iocoder.yudao.module.erp.dal.redis;
/**
* ERP Redis Key 枚举类
*
* @author 芋道源码
*/
public interface RedisKeyConstants {
/**
* 序号的缓存
*
* KEY 格式trade_no:{prefix}
* VALUE 数据格式编号自增
*/
String NO = "seq_no:";
}

View File

@ -0,0 +1,61 @@
package cn.iocoder.yudao.module.erp.dal.redis.no;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.iocoder.yudao.module.erp.dal.redis.RedisKeyConstants;
import jakarta.annotation.Resource;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Repository;
import java.time.Duration;
import java.time.LocalDateTime;
/**
* 订单序号的 Redis DAO
*
* @author HUIHUI
*/
@Repository
public class ErpNoRedisDAO {
/**
* 其它入库 {@link cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockInDO}
*/
public static final String STOCK_IN_NO_PREFIX = "QTRK";
/**
* 其它出库 {@link cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockOutDO}
*/
public static final String STOCK_OUT_NO_PREFIX = "QCKD";
/**
* 库存调拨 {@link cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockMoveDO}
*/
public static final String STOCK_MOVE_NO_PREFIX = "QCDB";
/**
* 库存盘点 {@link cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockCheckDO}
*/
public static final String STOCK_CHECK_NO_PREFIX = "QCPD";
@Resource
private StringRedisTemplate stringRedisTemplate;
/**
* 生成序号使用当前日期格式为 {PREFIX} + yyyyMMdd + 6 位自增
* 例如说QTRK 202109 000001 没有中间空格
*
* @param prefix 前缀
* @return 序号
*/
public String generate(String prefix) {
// 递增序号
String noPrefix = prefix + DateUtil.format(LocalDateTime.now(), DatePattern.PURE_DATE_PATTERN);
String key = RedisKeyConstants.NO + noPrefix;
Long no = stringRedisTemplate.opsForValue().increment(key);
// 设置过期时间
stringRedisTemplate.expire(key, Duration.ofMinutes(1L));
return noPrefix + String.format("%06d", no);
}
}

View File

@ -5,7 +5,11 @@ import cn.iocoder.yudao.module.erp.controller.admin.product.vo.category.ErpProdu
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductCategoryDO;
import jakarta.validation.Valid;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
/**
* ERP 产品分类 Service 接口
@ -40,7 +44,7 @@ public interface ErpProductCategoryService {
* 获得产品分类
*
* @param id 编号
* @return ERP 产品分类
* @return 产品分类
*/
ErpProductCategoryDO getProductCategory(Long id);
@ -48,8 +52,26 @@ public interface ErpProductCategoryService {
* 获得产品分类列表
*
* @param listReqVO 查询条件
* @return ERP 产品分类列表
* @return 产品分类列表
*/
List<ErpProductCategoryDO> getProductCategoryList(ErpProductCategoryListReqVO listReqVO);
/**
* 获得产品分类列表
*
* @param ids 编号数组
* @return 产品分类列表
*/
List<ErpProductCategoryDO> getProductCategoryList(Collection<Long> ids);
/**
* 获得产品分类 Map
*
* @param ids 编号数组
* @return 产品分类 Map
*/
default Map<Long, ErpProductCategoryDO> getProductCategoryMap(Collection<Long> ids) {
return convertMap(getProductCategoryList(ids), ErpProductCategoryDO::getId);
}
}

View File

@ -6,14 +6,16 @@ import cn.iocoder.yudao.module.erp.controller.admin.product.vo.category.ErpProdu
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductCategoryDO;
import cn.iocoder.yudao.module.erp.dal.mysql.product.ErpProductCategoryMapper;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.erp.ErrorCodeConstants.*;
import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.*;
/**
* ERP 产品分类 Service 实现类
@ -27,6 +29,10 @@ public class ErpProductCategoryServiceImpl implements ErpProductCategoryService
@Resource
private ErpProductCategoryMapper productCategoryMapper;
@Resource
@Lazy // 延迟加载避免循环依赖
private ErpProductService productService;
@Override
public Long createProductCategory(ErpProductCategorySaveReqVO createReqVO) {
// 校验父分类编号的有效性
@ -57,13 +63,17 @@ public class ErpProductCategoryServiceImpl implements ErpProductCategoryService
@Override
public void deleteProductCategory(Long id) {
// 校验存在
// 1.1 校验存在
validateProductCategoryExists(id);
// 校验是否有子产品分类
// 1.2 校验是否有子产品分类
if (productCategoryMapper.selectCountByParentId(id) > 0) {
throw exception(PRODUCT_CATEGORY_EXITS_CHILDREN);
}
// 删除
// 1.3 校验是否有产品
if (productService.getProductCountByCategoryId(id) > 0) {
throw exception(PRODUCT_CATEGORY_EXITS_PRODUCT);
}
// 2. 删除
productCategoryMapper.deleteById(id);
}
@ -131,4 +141,9 @@ public class ErpProductCategoryServiceImpl implements ErpProductCategoryService
return productCategoryMapper.selectList(listReqVO);
}
@Override
public List<ErpProductCategoryDO> getProductCategoryList(Collection<Long> ids) {
return productCategoryMapper.selectBatchIds(ids);
}
}

View File

@ -1,10 +1,17 @@
package cn.iocoder.yudao.module.erp.service.product;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ProductPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ProductSaveReqVO;
import jakarta.validation.*;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ProductSaveReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
import jakarta.validation.Valid;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
/**
* ERP 产品 Service 接口
@ -35,6 +42,14 @@ public interface ErpProductService {
*/
void deleteProduct(Long id);
/**
* 校验产品们的有效性
*
* @param ids 编号数组
* @return 产品列表
*/
List<ErpProductDO> validProductList(Collection<Long> ids);
/**
* 获得产品
*
@ -44,11 +59,53 @@ public interface ErpProductService {
ErpProductDO getProduct(Long id);
/**
* 获得产品分页
* 获得指定状态的产品 VO 列表
*
* @param status 状态
* @return 产品 VO 列表
*/
List<ErpProductRespVO> getProductVOListByStatus(Integer status);
/**
* 获得产品 VO 列表
*
* @param ids 编号数组
* @return 产品 VO 列表
*/
List<ErpProductRespVO> getProductVOList(Collection<Long> ids);
/**
* 获得产品 VO Map
*
* @param ids 编号数组
* @return 产品 VO Map
*/
default Map<Long, ErpProductRespVO> getProductVOMap(Collection<Long> ids) {
return convertMap(getProductVOList(ids), ErpProductRespVO::getId);
}
/**
* 获得产品 VO 分页
*
* @param pageReqVO 分页查询
* @return 产品分页
*/
PageResult<ErpProductDO> getProductPage(ProductPageReqVO pageReqVO);
PageResult<ErpProductRespVO> getProductVOPage(ErpProductPageReqVO pageReqVO);
/**
* 基于产品分类编号获得产品数量
*
* @param categoryId 产品分类编号
* @return 产品数量
*/
Long getProductCountByCategoryId(Long categoryId);
/**
* 基于产品单位编号获得产品数量
*
* @param unitId 产品单位编号
* @return 产品数量
*/
Long getProductCountByUnitId(Long unitId);
}

View File

@ -1,19 +1,26 @@
package cn.iocoder.yudao.module.erp.service.product;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ProductPageReqVO;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ProductSaveReqVO;
import org.springframework.stereotype.Service;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductCategoryDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductUnitDO;
import cn.iocoder.yudao.module.erp.dal.mysql.product.ErpProductMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.erp.dal.mysql.product.ErpProductMapper;
import java.util.*;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.erp.ErrorCodeConstants.PRODUCT_NOT_EXISTS;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.*;
/**
* ERP 产品 Service 实现类
@ -27,8 +34,14 @@ public class ErpProductServiceImpl implements ErpProductService {
@Resource
private ErpProductMapper productMapper;
@Resource
private ErpProductCategoryService productCategoryService;
@Resource
private ErpProductUnitService productUnitService;
@Override
public Long createProduct(ProductSaveReqVO createReqVO) {
// TODO 芋艿校验分类
// 插入
ErpProductDO product = BeanUtils.toBean(createReqVO, ErpProductDO.class);
productMapper.insert(product);
@ -38,6 +51,7 @@ public class ErpProductServiceImpl implements ErpProductService {
@Override
public void updateProduct(ProductSaveReqVO updateReqVO) {
// TODO 芋艿校验分类
// 校验存在
validateProductExists(updateReqVO.getId());
// 更新
@ -53,6 +67,25 @@ public class ErpProductServiceImpl implements ErpProductService {
productMapper.deleteById(id);
}
@Override
public List<ErpProductDO> validProductList(Collection<Long> ids) {
if (CollUtil.isEmpty(ids)) {
return Collections.emptyList();
}
List<ErpProductDO> list = productMapper.selectBatchIds(ids);
Map<Long, ErpProductDO> productMap = convertMap(list, ErpProductDO::getId);
for (Long id : ids) {
ErpProductDO product = productMap.get(id);
if (productMap.get(id) == null) {
throw exception(PRODUCT_NOT_EXISTS);
}
if (CommonStatusEnum.isDisable(product.getStatus())) {
throw exception(PRODUCT_NOT_ENABLE, product.getName());
}
}
return list;
}
private void validateProductExists(Long id) {
if (productMapper.selectById(id) == null) {
throw exception(PRODUCT_NOT_EXISTS);
@ -65,8 +98,47 @@ public class ErpProductServiceImpl implements ErpProductService {
}
@Override
public PageResult<ErpProductDO> getProductPage(ProductPageReqVO pageReqVO) {
return productMapper.selectPage(pageReqVO);
public List<ErpProductRespVO> getProductVOListByStatus(Integer status) {
List<ErpProductDO> list = productMapper.selectListByStatus(status);
return buildProductVOList(list);
}
@Override
public List<ErpProductRespVO> getProductVOList(Collection<Long> ids) {
List<ErpProductDO> list = productMapper.selectBatchIds(ids);
return buildProductVOList(list);
}
@Override
public PageResult<ErpProductRespVO> getProductVOPage(ErpProductPageReqVO pageReqVO) {
PageResult<ErpProductDO> pageResult = productMapper.selectPage(pageReqVO);
return new PageResult<>(buildProductVOList(pageResult.getList()), pageResult.getTotal());
}
private List<ErpProductRespVO> buildProductVOList(List<ErpProductDO> list) {
if (CollUtil.isEmpty(list)) {
return Collections.emptyList();
}
Map<Long, ErpProductCategoryDO> categoryMap = productCategoryService.getProductCategoryMap(
convertSet(list, ErpProductDO::getCategoryId));
Map<Long, ErpProductUnitDO> unitMap = productUnitService.getProductUnitMap(
convertSet(list, ErpProductDO::getUnitId));
return BeanUtils.toBean(list, ErpProductRespVO.class, product -> {
MapUtils.findAndThen(categoryMap, product.getCategoryId(),
category -> product.setCategoryName(category.getName()));
MapUtils.findAndThen(unitMap, product.getUnitId(),
unit -> product.setUnitName(unit.getName()));
});
}
@Override
public Long getProductCountByCategoryId(Long categoryId) {
return productMapper.selectCountByCategoryId(categoryId);
}
@Override
public Long getProductCountByUnitId(Long unitId) {
return productMapper.selectCountByUnitId(unitId);
}
}

View File

@ -1,10 +1,16 @@
package cn.iocoder.yudao.module.erp.service.product;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.unit.ErpProductUnitPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.unit.ErpProductUnitSaveReqVO;
import jakarta.validation.*;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductUnitDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import jakarta.validation.Valid;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
/**
* ERP 产品单位 Service 接口
@ -51,4 +57,30 @@ public interface ErpProductUnitService {
*/
PageResult<ErpProductUnitDO> getProductUnitPage(ErpProductUnitPageReqVO pageReqVO);
/**
* 获得指定状态的产品单位列表
*
* @param status 状态
* @return 产品单位列表
*/
List<ErpProductUnitDO> getProductUnitListByStatus(Integer status);
/**
* 获得产品单位列表
*
* @param ids 编号数组
* @return 产品单位列表
*/
List<ErpProductUnitDO> getProductUnitList(Collection<Long> ids);
/**
* 获得产品单位 Map
*
* @param ids 编号数组
* @return 产品单位 Map
*/
default Map<Long, ErpProductUnitDO> getProductUnitMap(Collection<Long> ids) {
return convertMap(getProductUnitList(ids), ErpProductUnitDO::getId);
}
}

View File

@ -1,19 +1,22 @@
package cn.iocoder.yudao.module.erp.service.product;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.unit.ErpProductUnitPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.unit.ErpProductUnitSaveReqVO;
import org.springframework.stereotype.Service;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductUnitDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.unit.ErpProductUnitPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.unit.ErpProductUnitSaveReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductUnitDO;
import cn.iocoder.yudao.module.erp.dal.mysql.product.ErpProductUnitMapper;
import com.google.common.annotations.VisibleForTesting;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.util.Collection;
import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.erp.ErrorCodeConstants.PRODUCT_UNIT_NOT_EXISTS;
import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.*;
/**
* ERP 产品单位 Service 实现类
@ -27,29 +30,55 @@ public class ErpProductUnitServiceImpl implements ErpProductUnitService {
@Resource
private ErpProductUnitMapper productUnitMapper;
@Resource
@Lazy // 延迟加载避免循环依赖
private ErpProductService productService;
@Override
public Long createProductUnit(ErpProductUnitSaveReqVO createReqVO) {
// 插入
// 1. 校验名字唯一
validateProductUnitNameUnique(null, createReqVO.getName());
// 2. 插入
ErpProductUnitDO unit = BeanUtils.toBean(createReqVO, ErpProductUnitDO.class);
productUnitMapper.insert(unit);
// 返回
return unit.getId();
}
@Override
public void updateProductUnit(ErpProductUnitSaveReqVO updateReqVO) {
// 校验存在
// 1.1 校验存在
validateProductUnitExists(updateReqVO.getId());
// 更新
// 1.2 校验名字唯一
validateProductUnitNameUnique(updateReqVO.getId(), updateReqVO.getName());
// 2. 更新
ErpProductUnitDO updateObj = BeanUtils.toBean(updateReqVO, ErpProductUnitDO.class);
productUnitMapper.updateById(updateObj);
}
@VisibleForTesting
void validateProductUnitNameUnique(Long id, String name) {
ErpProductUnitDO unit = productUnitMapper.selectByName(name);
if (unit == null) {
return;
}
// 如果 id 为空说明不用比较是否为相同 id 的字典类型
if (id == null) {
throw exception(PRODUCT_UNIT_NAME_DUPLICATE);
}
if (!unit.getId().equals(id)) {
throw exception(PRODUCT_UNIT_NAME_DUPLICATE);
}
}
@Override
public void deleteProductUnit(Long id) {
// 校验存在
// 1.1 校验存在
validateProductUnitExists(id);
// 删除
// 1.2 校验商品是否使用
if (productService.getProductCountByUnitId(id) > 0) {
throw exception(PRODUCT_UNIT_EXITS_PRODUCT);
}
// 2. 删除
productUnitMapper.deleteById(id);
}
@ -69,4 +98,14 @@ public class ErpProductUnitServiceImpl implements ErpProductUnitService {
return productUnitMapper.selectPage(pageReqVO);
}
@Override
public List<ErpProductUnitDO> getProductUnitListByStatus(Integer status) {
return productUnitMapper.selectListByStatus(status);
}
@Override
public List<ErpProductUnitDO> getProductUnitList(Collection<Long> ids) {
return productUnitMapper.selectBatchIds(ids);
}
}

View File

@ -0,0 +1,94 @@
package cn.iocoder.yudao.module.erp.service.purchase;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.supplier.ErpSupplierPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.supplier.ErpSupplierSaveReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpSupplierDO;
import jakarta.validation.Valid;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
/**
* ERP 供应商 Service 接口
*
* @author 芋道源码
*/
public interface ErpSupplierService {
/**
* 创建供应商
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createSupplier(@Valid ErpSupplierSaveReqVO createReqVO);
/**
* 更新供应商
*
* @param updateReqVO 更新信息
*/
void updateSupplier(@Valid ErpSupplierSaveReqVO updateReqVO);
/**
* 删除供应商
*
* @param id 编号
*/
void deleteSupplier(Long id);
/**
* 获得供应商
*
* @param id 编号
* @return 供应商
*/
ErpSupplierDO getSupplier(Long id);
/**
* 校验供应商
*
* @param id 编号
* @return 供应商
*/
ErpSupplierDO validateSupplier(Long id);
/**
* 获得供应商列表
*
* @param ids 编号列表
* @return 供应商列表
*/
List<ErpSupplierDO> getSupplierList(Collection<Long> ids);
/**
* 获得供应商 Map
*
* @param ids 编号列表
* @return 供应商 Map
*/
default Map<Long, ErpSupplierDO> getSupplierMap(Collection<Long> ids) {
return convertMap(getSupplierList(ids), ErpSupplierDO::getId);
}
/**
* 获得供应商分页
*
* @param pageReqVO 分页查询
* @return 供应商分页
*/
PageResult<ErpSupplierDO> getSupplierPage(ErpSupplierPageReqVO pageReqVO);
/**
* 获得指定状态的供应商列表
*
* @param status 状态
* @return 供应商列表
*/
List<ErpSupplierDO> getSupplierListByStatus(Integer status);
}

View File

@ -0,0 +1,94 @@
package cn.iocoder.yudao.module.erp.service.purchase;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.supplier.ErpSupplierPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.supplier.ErpSupplierSaveReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpSupplierDO;
import cn.iocoder.yudao.module.erp.dal.mysql.purchase.ErpSupplierMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.util.Collection;
import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.*;
/**
* ERP 供应商 Service 实现类
*
* @author 芋道源码
*/
@Service
@Validated
public class ErpSupplierServiceImpl implements ErpSupplierService {
@Resource
private ErpSupplierMapper supplierMapper;
@Override
public Long createSupplier(ErpSupplierSaveReqVO createReqVO) {
ErpSupplierDO supplier = BeanUtils.toBean(createReqVO, ErpSupplierDO.class);
supplierMapper.insert(supplier);
return supplier.getId();
}
@Override
public void updateSupplier(ErpSupplierSaveReqVO updateReqVO) {
// 校验存在
validateSupplierExists(updateReqVO.getId());
// 更新
ErpSupplierDO updateObj = BeanUtils.toBean(updateReqVO, ErpSupplierDO.class);
supplierMapper.updateById(updateObj);
}
@Override
public void deleteSupplier(Long id) {
// 校验存在
validateSupplierExists(id);
// 删除
supplierMapper.deleteById(id);
}
private void validateSupplierExists(Long id) {
if (supplierMapper.selectById(id) == null) {
throw exception(SUPPLIER_NOT_EXISTS);
}
}
@Override
public ErpSupplierDO getSupplier(Long id) {
return supplierMapper.selectById(id);
}
@Override
public ErpSupplierDO validateSupplier(Long id) {
ErpSupplierDO supplier = supplierMapper.selectById(id);
if (supplier == null) {
throw exception(WAREHOUSE_NOT_EXISTS);
}
if (CommonStatusEnum.isDisable(supplier.getStatus())) {
throw exception(WAREHOUSE_NOT_ENABLE, supplier.getName());
}
return supplier;
}
@Override
public List<ErpSupplierDO> getSupplierList(Collection<Long> ids) {
return supplierMapper.selectBatchIds(ids);
}
@Override
public PageResult<ErpSupplierDO> getSupplierPage(ErpSupplierPageReqVO pageReqVO) {
return supplierMapper.selectPage(pageReqVO);
}
@Override
public List<ErpSupplierDO> getSupplierListByStatus(Integer status) {
return supplierMapper.selectListByStatus(status);
}
}

View File

@ -0,0 +1,94 @@
package cn.iocoder.yudao.module.erp.service.sale;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.erp.controller.admin.sale.vo.customer.ErpCustomerPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.sale.vo.customer.ErpCustomerSaveReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpCustomerDO;
import jakarta.validation.Valid;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
/**
* ERP 客户 Service 接口
*
* @author 芋道源码
*/
public interface ErpCustomerService {
/**
* 创建客户
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createCustomer(@Valid ErpCustomerSaveReqVO createReqVO);
/**
* 更新客户
*
* @param updateReqVO 更新信息
*/
void updateCustomer(@Valid ErpCustomerSaveReqVO updateReqVO);
/**
* 删除客户
*
* @param id 编号
*/
void deleteCustomer(Long id);
/**
* 获得客户
*
* @param id 编号
* @return 客户
*/
ErpCustomerDO getCustomer(Long id);
/**
* 校验客户
*
* @param id 编号
* @return 客户
*/
ErpCustomerDO validateCustomer(Long id);
/**
* 获得客户列表
*
* @param ids 编号列表
* @return 客户列表
*/
List<ErpCustomerDO> getCustomerList(Collection<Long> ids);
/**
* 获得客户 Map
*
* @param ids 编号列表
* @return 客户 Map
*/
default Map<Long, ErpCustomerDO> getCustomerMap(Collection<Long> ids) {
return convertMap(getCustomerList(ids), ErpCustomerDO::getId);
}
/**
* 获得客户分页
*
* @param pageReqVO 分页查询
* @return 客户分页
*/
PageResult<ErpCustomerDO> getCustomerPage(ErpCustomerPageReqVO pageReqVO);
/**
* 获得指定状态的客户列表
*
* @param status 状态
* @return 客户列表
*/
List<ErpCustomerDO> getCustomerListByStatus(Integer status);
}

View File

@ -0,0 +1,97 @@
package cn.iocoder.yudao.module.erp.service.sale;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.erp.controller.admin.sale.vo.customer.ErpCustomerPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.sale.vo.customer.ErpCustomerSaveReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpCustomerDO;
import cn.iocoder.yudao.module.erp.dal.mysql.sale.ErpCustomerMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.util.Collection;
import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.CUSTOMER_NOT_ENABLE;
import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.CUSTOMER_NOT_EXISTS;
/**
* ERP 客户 Service 实现类
*
* @author 芋道源码
*/
@Service
@Validated
public class ErpCustomerServiceImpl implements ErpCustomerService {
@Resource
private ErpCustomerMapper customerMapper;
@Override
public Long createCustomer(ErpCustomerSaveReqVO createReqVO) {
// 插入
ErpCustomerDO customer = BeanUtils.toBean(createReqVO, ErpCustomerDO.class);
customerMapper.insert(customer);
// 返回
return customer.getId();
}
@Override
public void updateCustomer(ErpCustomerSaveReqVO updateReqVO) {
// 校验存在
validateCustomerExists(updateReqVO.getId());
// 更新
ErpCustomerDO updateObj = BeanUtils.toBean(updateReqVO, ErpCustomerDO.class);
customerMapper.updateById(updateObj);
}
@Override
public void deleteCustomer(Long id) {
// 校验存在
validateCustomerExists(id);
// 删除
customerMapper.deleteById(id);
}
private void validateCustomerExists(Long id) {
if (customerMapper.selectById(id) == null) {
throw exception(CUSTOMER_NOT_EXISTS);
}
}
@Override
public ErpCustomerDO getCustomer(Long id) {
return customerMapper.selectById(id);
}
@Override
public ErpCustomerDO validateCustomer(Long id) {
ErpCustomerDO customer = customerMapper.selectById(id);
if (customer == null) {
throw exception(CUSTOMER_NOT_EXISTS);
}
if (CommonStatusEnum.isDisable(customer.getStatus())) {
throw exception(CUSTOMER_NOT_ENABLE, customer.getName());
}
return customer;
}
@Override
public List<ErpCustomerDO> getCustomerList(Collection<Long> ids) {
return customerMapper.selectBatchIds(ids);
}
@Override
public PageResult<ErpCustomerDO> getCustomerPage(ErpCustomerPageReqVO pageReqVO) {
return customerMapper.selectPage(pageReqVO);
}
@Override
public List<ErpCustomerDO> getCustomerListByStatus(Integer status) {
return customerMapper.selectListByStatus(status);
}
}

View File

@ -0,0 +1,84 @@
package cn.iocoder.yudao.module.erp.service.stock;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check.ErpStockCheckPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check.ErpStockCheckSaveReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockCheckDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockCheckItemDO;
import jakarta.validation.Valid;
import java.util.Collection;
import java.util.List;
/**
* ERP 库存盘点单 Service 接口
*
* @author 芋道源码
*/
public interface ErpStockCheckService {
/**
* 创建库存盘点单
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createStockCheck(@Valid ErpStockCheckSaveReqVO createReqVO);
/**
* 更新库存盘点单
*
* @param updateReqVO 更新信息
*/
void updateStockCheck(@Valid ErpStockCheckSaveReqVO updateReqVO);
/**
* 更新库存盘点单的状态
*
* @param id 编号
* @param status 状态
*/
void updateStockCheckStatus(Long id, Integer status);
/**
* 删除库存盘点单
*
* @param ids 编号数组
*/
void deleteStockCheck(List<Long> ids);
/**
* 获得库存盘点单
*
* @param id 编号
* @return 库存盘点单
*/
ErpStockCheckDO getStockCheck(Long id);
/**
* 获得库存盘点单分页
*
* @param pageReqVO 分页查询
* @return 库存盘点单分页
*/
PageResult<ErpStockCheckDO> getStockCheckPage(ErpStockCheckPageReqVO pageReqVO);
// ==================== 盘点项 ====================
/**
* 获得库存盘点单项列表
*
* @param checkId 盘点编号
* @return 库存盘点单项列表
*/
List<ErpStockCheckItemDO> getStockCheckItemListByCheckId(Long checkId);
/**
* 获得库存盘点单项 List
*
* @param checkIds 盘点编号数组
* @return 库存盘点单项 List
*/
List<ErpStockCheckItemDO> getStockCheckItemListByCheckIds(Collection<Long> checkIds);
}

View File

@ -0,0 +1,232 @@
package cn.iocoder.yudao.module.erp.service.stock;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.number.MoneyUtils;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check.ErpStockCheckPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.check.ErpStockCheckSaveReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockCheckDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockCheckItemDO;
import cn.iocoder.yudao.module.erp.dal.mysql.stock.ErpStockCheckItemMapper;
import cn.iocoder.yudao.module.erp.dal.mysql.stock.ErpStockCheckMapper;
import cn.iocoder.yudao.module.erp.dal.redis.no.ErpNoRedisDAO;
import cn.iocoder.yudao.module.erp.enums.ErpAuditStatus;
import cn.iocoder.yudao.module.erp.enums.stock.ErpStockRecordBizTypeEnum;
import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
import cn.iocoder.yudao.module.erp.service.stock.bo.ErpStockRecordCreateReqBO;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.*;
// TODO 芋艿记录操作日志
/**
* ERP 库存盘点单 Service 实现类
*
* @author 芋道源码
*/
@Service
@Validated
public class ErpStockCheckServiceImpl implements ErpStockCheckService {
@Resource
private ErpStockCheckMapper stockCheckMapper;
@Resource
private ErpStockCheckItemMapper stockCheckItemMapper;
@Resource
private ErpNoRedisDAO noRedisDAO;
@Resource
private ErpProductService productService;
@Resource
private ErpWarehouseService warehouseService;
@Resource
private ErpStockRecordService stockRecordService;
@Override
@Transactional(rollbackFor = Exception.class)
public Long createStockCheck(ErpStockCheckSaveReqVO createReqVO) {
// 1.1 校验盘点项的有效性
List<ErpStockCheckItemDO> stockCheckItems = validateStockCheckItems(createReqVO.getItems());
// 1.2 生成盘点单号并校验唯一性
String no = noRedisDAO.generate(ErpNoRedisDAO.STOCK_CHECK_NO_PREFIX);
if (stockCheckMapper.selectByNo(no) != null) {
throw exception(STOCK_CHECK_NO_EXISTS);
}
// 2.1 插入盘点单
ErpStockCheckDO stockCheck = BeanUtils.toBean(createReqVO, ErpStockCheckDO.class, in -> in
.setNo(no).setStatus(ErpAuditStatus.PROCESS.getStatus())
.setTotalCount(getSumValue(stockCheckItems, ErpStockCheckItemDO::getCount, BigDecimal::add))
.setTotalPrice(getSumValue(stockCheckItems, ErpStockCheckItemDO::getTotalPrice, BigDecimal::add, BigDecimal.ZERO)));
stockCheckMapper.insert(stockCheck);
// 2.2 插入盘点单项
stockCheckItems.forEach(o -> o.setCheckId(stockCheck.getId()));
stockCheckItemMapper.insertBatch(stockCheckItems);
return stockCheck.getId();
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateStockCheck(ErpStockCheckSaveReqVO updateReqVO) {
// 1.1 校验存在
ErpStockCheckDO stockCheck = validateStockCheckExists(updateReqVO.getId());
if (ErpAuditStatus.APPROVE.getStatus().equals(stockCheck.getStatus())) {
throw exception(STOCK_CHECK_UPDATE_FAIL_APPROVE, stockCheck.getNo());
}
// 1.2 校验盘点项的有效性
List<ErpStockCheckItemDO> stockCheckItems = validateStockCheckItems(updateReqVO.getItems());
// 2.1 更新盘点单
ErpStockCheckDO updateObj = BeanUtils.toBean(updateReqVO, ErpStockCheckDO.class, in -> in
.setTotalCount(getSumValue(stockCheckItems, ErpStockCheckItemDO::getCount, BigDecimal::add))
.setTotalPrice(getSumValue(stockCheckItems, ErpStockCheckItemDO::getTotalPrice, BigDecimal::add)));
stockCheckMapper.updateById(updateObj);
// 2.2 更新盘点单项
updateStockCheckItemList(updateReqVO.getId(), stockCheckItems);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateStockCheckStatus(Long id, Integer status) {
boolean approve = ErpAuditStatus.APPROVE.getStatus().equals(status);
// 1.1 校验存在
ErpStockCheckDO stockCheck = validateStockCheckExists(id);
// 1.2 校验状态
if (stockCheck.getStatus().equals(status)) {
throw exception(approve ? STOCK_CHECK_APPROVE_FAIL : STOCK_CHECK_PROCESS_FAIL);
}
// 2. 更新状态
int updateCount = stockCheckMapper.updateByIdAndStatus(id, stockCheck.getStatus(),
new ErpStockCheckDO().setStatus(status));
if (updateCount == 0) {
throw exception(approve ? STOCK_CHECK_APPROVE_FAIL : STOCK_CHECK_PROCESS_FAIL);
}
// 3. 变更库存
List<ErpStockCheckItemDO> stockCheckItems = stockCheckItemMapper.selectListByCheckId(id);
stockCheckItems.forEach(stockCheckItem -> {
// 没有盈亏不用出入库
if (stockCheckItem.getCount().compareTo(BigDecimal.ZERO) == 0) {
return;
}
// 1012-2
BigDecimal count = approve ? stockCheckItem.getCount(): stockCheckItem.getCount().negate();
Integer bizType;
if (approve) {
bizType = count.compareTo(BigDecimal.ZERO) > 0 ? ErpStockRecordBizTypeEnum.CHECK_MORE_IN.getType()
: ErpStockRecordBizTypeEnum.CHECK_LESS_OUT.getType();
} else {
bizType = count.compareTo(BigDecimal.ZERO) > 0 ? ErpStockRecordBizTypeEnum.CHECK_MORE_IN_CANCEL.getType()
: ErpStockRecordBizTypeEnum.CHECK_LESS_OUT_CANCEL.getType();
}
stockRecordService.createStockRecord(new ErpStockRecordCreateReqBO(
stockCheckItem.getProductId(), stockCheckItem.getWarehouseId(), count,
bizType, stockCheckItem.getCheckId(), stockCheckItem.getId(), stockCheck.getNo()));
});
}
private List<ErpStockCheckItemDO> validateStockCheckItems(List<ErpStockCheckSaveReqVO.Item> list) {
// 1.1 校验产品存在
List<ErpProductDO> productList = productService.validProductList(
convertSet(list, ErpStockCheckSaveReqVO.Item::getProductId));
Map<Long, ErpProductDO> productMap = convertMap(productList, ErpProductDO::getId);
// 1.2 校验仓库存在
warehouseService.validWarehouseList(convertSet(list, ErpStockCheckSaveReqVO.Item::getWarehouseId));
// 2. 转化为 ErpStockCheckItemDO 列表
return convertList(list, o -> BeanUtils.toBean(o, ErpStockCheckItemDO.class, item -> item
.setProductUnitId(productMap.get(item.getProductId()).getUnitId())
.setTotalPrice(MoneyUtils.priceMultiply(item.getProductPrice(), item.getCount()))));
}
private void updateStockCheckItemList(Long id, List<ErpStockCheckItemDO> newList) {
// 第一步对比新老数据获得添加修改删除的列表
List<ErpStockCheckItemDO> oldList = stockCheckItemMapper.selectListByCheckId(id);
List<List<ErpStockCheckItemDO>> diffList = diffList(oldList, newList, // id 不同就认为是不同的记录
(oldVal, newVal) -> oldVal.getId().equals(newVal.getId()));
// 第二步批量添加修改删除
if (CollUtil.isNotEmpty(diffList.get(0))) {
diffList.get(0).forEach(o -> o.setCheckId(id));
stockCheckItemMapper.insertBatch(diffList.get(0));
}
if (CollUtil.isNotEmpty(diffList.get(1))) {
stockCheckItemMapper.updateBatch(diffList.get(1));
}
if (CollUtil.isNotEmpty(diffList.get(2))) {
stockCheckItemMapper.deleteBatchIds(convertList(diffList.get(2), ErpStockCheckItemDO::getId));
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteStockCheck(List<Long> ids) {
// 1. 校验不处于已审批
List<ErpStockCheckDO> stockChecks = stockCheckMapper.selectBatchIds(ids);
if (CollUtil.isEmpty(stockChecks)) {
return;
}
stockChecks.forEach(stockCheck -> {
if (ErpAuditStatus.APPROVE.getStatus().equals(stockCheck.getStatus())) {
throw exception(STOCK_CHECK_DELETE_FAIL_APPROVE, stockCheck.getNo());
}
});
// 2. 遍历删除并记录操作日志
stockChecks.forEach(stockCheck -> {
// 2.1 删除盘点单
stockCheckMapper.deleteById(stockCheck.getId());
// 2.2 删除盘点单项
stockCheckItemMapper.deleteByCheckId(stockCheck.getId());
});
}
private ErpStockCheckDO validateStockCheckExists(Long id) {
ErpStockCheckDO stockCheck = stockCheckMapper.selectById(id);
if (stockCheck == null) {
throw exception(STOCK_CHECK_NOT_EXISTS);
}
return stockCheck;
}
@Override
public ErpStockCheckDO getStockCheck(Long id) {
return stockCheckMapper.selectById(id);
}
@Override
public PageResult<ErpStockCheckDO> getStockCheckPage(ErpStockCheckPageReqVO pageReqVO) {
return stockCheckMapper.selectPage(pageReqVO);
}
// ==================== 盘点项 ====================
@Override
public List<ErpStockCheckItemDO> getStockCheckItemListByCheckId(Long checkId) {
return stockCheckItemMapper.selectListByCheckId(checkId);
}
@Override
public List<ErpStockCheckItemDO> getStockCheckItemListByCheckIds(Collection<Long> checkIds) {
if (CollUtil.isEmpty(checkIds)) {
return Collections.emptyList();
}
return stockCheckItemMapper.selectListByCheckIds(checkIds);
}
}

View File

@ -0,0 +1,84 @@
package cn.iocoder.yudao.module.erp.service.stock;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in.ErpStockInPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in.ErpStockInSaveReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockInDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockInItemDO;
import jakarta.validation.Valid;
import java.util.Collection;
import java.util.List;
/**
* ERP 其它入库单 Service 接口
*
* @author 芋道源码
*/
public interface ErpStockInService {
/**
* 创建其它入库单
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createStockIn(@Valid ErpStockInSaveReqVO createReqVO);
/**
* 更新其它入库单
*
* @param updateReqVO 更新信息
*/
void updateStockIn(@Valid ErpStockInSaveReqVO updateReqVO);
/**
* 更新其它入库单的状态
*
* @param id 编号
* @param status 状态
*/
void updateStockInStatus(Long id, Integer status);
/**
* 删除其它入库单
*
* @param ids 编号数组
*/
void deleteStockIn(List<Long> ids);
/**
* 获得其它入库单
*
* @param id 编号
* @return 其它入库单
*/
ErpStockInDO getStockIn(Long id);
/**
* 获得其它入库单分页
*
* @param pageReqVO 分页查询
* @return 其它入库单分页
*/
PageResult<ErpStockInDO> getStockInPage(ErpStockInPageReqVO pageReqVO);
// ==================== 入库项 ====================
/**
* 获得其它入库单项列表
*
* @param inId 入库编号
* @return 其它入库单项列表
*/
List<ErpStockInItemDO> getStockInItemListByInId(Long inId);
/**
* 获得其它入库单项 List
*
* @param inIds 入库编号数组
* @return 其它入库单项 List
*/
List<ErpStockInItemDO> getStockInItemListByInIds(Collection<Long> inIds);
}

View File

@ -0,0 +1,228 @@
package cn.iocoder.yudao.module.erp.service.stock;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.number.MoneyUtils;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in.ErpStockInPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in.ErpStockInSaveReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockInDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockInItemDO;
import cn.iocoder.yudao.module.erp.dal.mysql.stock.ErpStockInItemMapper;
import cn.iocoder.yudao.module.erp.dal.mysql.stock.ErpStockInMapper;
import cn.iocoder.yudao.module.erp.dal.redis.no.ErpNoRedisDAO;
import cn.iocoder.yudao.module.erp.enums.ErpAuditStatus;
import cn.iocoder.yudao.module.erp.enums.stock.ErpStockRecordBizTypeEnum;
import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
import cn.iocoder.yudao.module.erp.service.purchase.ErpSupplierService;
import cn.iocoder.yudao.module.erp.service.stock.bo.ErpStockRecordCreateReqBO;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.*;
// TODO 芋艿记录操作日志
/**
* ERP 其它入库单 Service 实现类
*
* @author 芋道源码
*/
@Service
@Validated
public class ErpStockInServiceImpl implements ErpStockInService {
@Resource
private ErpStockInMapper stockInMapper;
@Resource
private ErpStockInItemMapper stockInItemMapper;
@Resource
private ErpNoRedisDAO noRedisDAO;
@Resource
private ErpProductService productService;
@Resource
private ErpWarehouseService warehouseService;
@Resource
private ErpSupplierService supplierService;
@Resource
private ErpStockRecordService stockRecordService;
@Override
@Transactional(rollbackFor = Exception.class)
public Long createStockIn(ErpStockInSaveReqVO createReqVO) {
// 1.1 校验入库项的有效性
List<ErpStockInItemDO> stockInItems = validateStockInItems(createReqVO.getItems());
// 1.2 校验供应商
supplierService.validateSupplier(createReqVO.getSupplierId());
// 1.3 生成入库单号并校验唯一性
String no = noRedisDAO.generate(ErpNoRedisDAO.STOCK_IN_NO_PREFIX);
if (stockInMapper.selectByNo(no) != null) {
throw exception(STOCK_IN_NO_EXISTS);
}
// 2.1 插入入库单
ErpStockInDO stockIn = BeanUtils.toBean(createReqVO, ErpStockInDO.class, in -> in
.setNo(no).setStatus(ErpAuditStatus.PROCESS.getStatus())
.setTotalCount(getSumValue(stockInItems, ErpStockInItemDO::getCount, BigDecimal::add))
.setTotalPrice(getSumValue(stockInItems, ErpStockInItemDO::getTotalPrice, BigDecimal::add, BigDecimal.ZERO)));
stockInMapper.insert(stockIn);
// 2.2 插入入库单项
stockInItems.forEach(o -> o.setInId(stockIn.getId()));
stockInItemMapper.insertBatch(stockInItems);
return stockIn.getId();
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateStockIn(ErpStockInSaveReqVO updateReqVO) {
// 1.1 校验存在
ErpStockInDO stockIn = validateStockInExists(updateReqVO.getId());
if (ErpAuditStatus.APPROVE.getStatus().equals(stockIn.getStatus())) {
throw exception(STOCK_IN_UPDATE_FAIL_APPROVE, stockIn.getNo());
}
// 1.2 校验供应商
supplierService.validateSupplier(updateReqVO.getSupplierId());
// 1.3 校验入库项的有效性
List<ErpStockInItemDO> stockInItems = validateStockInItems(updateReqVO.getItems());
// 2.1 更新入库单
ErpStockInDO updateObj = BeanUtils.toBean(updateReqVO, ErpStockInDO.class, in -> in
.setTotalCount(getSumValue(stockInItems, ErpStockInItemDO::getCount, BigDecimal::add))
.setTotalPrice(getSumValue(stockInItems, ErpStockInItemDO::getTotalPrice, BigDecimal::add)));
stockInMapper.updateById(updateObj);
// 2.2 更新入库单项
updateStockInItemList(updateReqVO.getId(), stockInItems);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateStockInStatus(Long id, Integer status) {
boolean approve = ErpAuditStatus.APPROVE.getStatus().equals(status);
// 1.1 校验存在
ErpStockInDO stockIn = validateStockInExists(id);
// 1.2 校验状态
if (stockIn.getStatus().equals(status)) {
throw exception(approve ? STOCK_IN_APPROVE_FAIL : STOCK_IN_PROCESS_FAIL);
}
// 2. 更新状态
int updateCount = stockInMapper.updateByIdAndStatus(id, stockIn.getStatus(),
new ErpStockInDO().setStatus(status));
if (updateCount == 0) {
throw exception(approve ? STOCK_IN_APPROVE_FAIL : STOCK_IN_PROCESS_FAIL);
}
// 3. 变更库存
List<ErpStockInItemDO> stockInItems = stockInItemMapper.selectListByInId(id);
Integer bizType = approve ? ErpStockRecordBizTypeEnum.OTHER_IN.getType()
: ErpStockRecordBizTypeEnum.OTHER_IN_CANCEL.getType();
stockInItems.forEach(stockInItem -> {
BigDecimal count = approve ? stockInItem.getCount() : stockInItem.getCount().negate();
stockRecordService.createStockRecord(new ErpStockRecordCreateReqBO(
stockInItem.getProductId(), stockInItem.getWarehouseId(), count,
bizType, stockInItem.getInId(), stockInItem.getId(), stockIn.getNo()));
});
}
private List<ErpStockInItemDO> validateStockInItems(List<ErpStockInSaveReqVO.Item> list) {
// 1.1 校验产品存在
List<ErpProductDO> productList = productService.validProductList(
convertSet(list, ErpStockInSaveReqVO.Item::getProductId));
Map<Long, ErpProductDO> productMap = convertMap(productList, ErpProductDO::getId);
// 1.2 校验仓库存在
warehouseService.validWarehouseList(convertSet(
list, ErpStockInSaveReqVO.Item::getWarehouseId));
// 2. 转化为 ErpStockInItemDO 列表
return convertList(list, o -> BeanUtils.toBean(o, ErpStockInItemDO.class, item -> item
.setProductUnitId(productMap.get(item.getProductId()).getUnitId())
.setTotalPrice(MoneyUtils.priceMultiply(item.getProductPrice(), item.getCount()))));
}
private void updateStockInItemList(Long id, List<ErpStockInItemDO> newList) {
// 第一步对比新老数据获得添加修改删除的列表
List<ErpStockInItemDO> oldList = stockInItemMapper.selectListByInId(id);
List<List<ErpStockInItemDO>> diffList = diffList(oldList, newList, // id 不同就认为是不同的记录
(oldVal, newVal) -> oldVal.getId().equals(newVal.getId()));
// 第二步批量添加修改删除
if (CollUtil.isNotEmpty(diffList.get(0))) {
diffList.get(0).forEach(o -> o.setInId(id));
stockInItemMapper.insertBatch(diffList.get(0));
}
if (CollUtil.isNotEmpty(diffList.get(1))) {
stockInItemMapper.updateBatch(diffList.get(1));
}
if (CollUtil.isNotEmpty(diffList.get(2))) {
stockInItemMapper.deleteBatchIds(convertList(diffList.get(2), ErpStockInItemDO::getId));
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteStockIn(List<Long> ids) {
// 1. 校验不处于已审批
List<ErpStockInDO> stockIns = stockInMapper.selectBatchIds(ids);
if (CollUtil.isEmpty(stockIns)) {
return;
}
stockIns.forEach(stockIn -> {
if (ErpAuditStatus.APPROVE.getStatus().equals(stockIn.getStatus())) {
throw exception(STOCK_IN_DELETE_FAIL_APPROVE, stockIn.getNo());
}
});
// 2. 遍历删除并记录操作日志
stockIns.forEach(stockIn -> {
// 2.1 删除入库单
stockInMapper.deleteById(stockIn.getId());
// 2.2 删除入库单项
stockInItemMapper.deleteByInId(stockIn.getId());
});
}
private ErpStockInDO validateStockInExists(Long id) {
ErpStockInDO stockIn = stockInMapper.selectById(id);
if (stockIn == null) {
throw exception(STOCK_IN_NOT_EXISTS);
}
return stockIn;
}
@Override
public ErpStockInDO getStockIn(Long id) {
return stockInMapper.selectById(id);
}
@Override
public PageResult<ErpStockInDO> getStockInPage(ErpStockInPageReqVO pageReqVO) {
return stockInMapper.selectPage(pageReqVO);
}
// ==================== 入库项 ====================
@Override
public List<ErpStockInItemDO> getStockInItemListByInId(Long inId) {
return stockInItemMapper.selectListByInId(inId);
}
@Override
public List<ErpStockInItemDO> getStockInItemListByInIds(Collection<Long> inIds) {
if (CollUtil.isEmpty(inIds)) {
return Collections.emptyList();
}
return stockInItemMapper.selectListByInIds(inIds);
}
}

View File

@ -0,0 +1,84 @@
package cn.iocoder.yudao.module.erp.service.stock;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.move.ErpStockMovePageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.move.ErpStockMoveSaveReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockMoveDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockMoveItemDO;
import jakarta.validation.Valid;
import java.util.Collection;
import java.util.List;
/**
* ERP 库存调拨单 Service 接口
*
* @author 芋道源码
*/
public interface ErpStockMoveService {
/**
* 创建库存调拨单
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createStockMove(@Valid ErpStockMoveSaveReqVO createReqVO);
/**
* 更新库存调拨单
*
* @param updateReqVO 更新信息
*/
void updateStockMove(@Valid ErpStockMoveSaveReqVO updateReqVO);
/**
* 更新库存调拨单的状态
*
* @param id 编号
* @param status 状态
*/
void updateStockMoveStatus(Long id, Integer status);
/**
* 删除库存调拨单
*
* @param ids 编号数组
*/
void deleteStockMove(List<Long> ids);
/**
* 获得库存调拨单
*
* @param id 编号
* @return 库存调拨单
*/
ErpStockMoveDO getStockMove(Long id);
/**
* 获得库存调拨单分页
*
* @param pageReqVO 分页查询
* @return 库存调拨单分页
*/
PageResult<ErpStockMoveDO> getStockMovePage(ErpStockMovePageReqVO pageReqVO);
// ==================== 调拨项 ====================
/**
* 获得库存调拨单项列表
*
* @param moveId 调拨编号
* @return 库存调拨单项列表
*/
List<ErpStockMoveItemDO> getStockMoveItemListByMoveId(Long moveId);
/**
* 获得库存调拨单项 List
*
* @param moveIds 调拨编号数组
* @return 库存调拨单项 List
*/
List<ErpStockMoveItemDO> getStockMoveItemListByMoveIds(Collection<Long> moveIds);
}

View File

@ -0,0 +1,229 @@
package cn.iocoder.yudao.module.erp.service.stock;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.number.MoneyUtils;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.move.ErpStockMovePageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.move.ErpStockMoveSaveReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockMoveDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockMoveItemDO;
import cn.iocoder.yudao.module.erp.dal.mysql.stock.ErpStockMoveItemMapper;
import cn.iocoder.yudao.module.erp.dal.mysql.stock.ErpStockMoveMapper;
import cn.iocoder.yudao.module.erp.dal.redis.no.ErpNoRedisDAO;
import cn.iocoder.yudao.module.erp.enums.ErpAuditStatus;
import cn.iocoder.yudao.module.erp.enums.stock.ErpStockRecordBizTypeEnum;
import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
import cn.iocoder.yudao.module.erp.service.stock.bo.ErpStockRecordCreateReqBO;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Stream;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.*;
// TODO 芋艿记录操作日志
/**
* ERP 库存调拨单 Service 实现类
*
* @author 芋道源码
*/
@Service
@Validated
public class ErpStockMoveServiceImpl implements ErpStockMoveService {
@Resource
private ErpStockMoveMapper stockMoveMapper;
@Resource
private ErpStockMoveItemMapper stockMoveItemMapper;
@Resource
private ErpNoRedisDAO noRedisDAO;
@Resource
private ErpProductService productService;
@Resource
private ErpWarehouseService warehouseService;
@Resource
private ErpStockRecordService stockRecordService;
@Override
@Transactional(rollbackFor = Exception.class)
public Long createStockMove(ErpStockMoveSaveReqVO createReqVO) {
// 1.1 校验出库项的有效性
List<ErpStockMoveItemDO> stockMoveItems = validateStockMoveItems(createReqVO.getItems());
// 1.2 生成调拨单号并校验唯一性
String no = noRedisDAO.generate(ErpNoRedisDAO.STOCK_MOVE_NO_PREFIX);
if (stockMoveMapper.selectByNo(no) != null) {
throw exception(STOCK_MOVE_NO_EXISTS);
}
// 2.1 插入出库单
ErpStockMoveDO stockMove = BeanUtils.toBean(createReqVO, ErpStockMoveDO.class, in -> in
.setNo(no).setStatus(ErpAuditStatus.PROCESS.getStatus())
.setTotalCount(getSumValue(stockMoveItems, ErpStockMoveItemDO::getCount, BigDecimal::add))
.setTotalPrice(getSumValue(stockMoveItems, ErpStockMoveItemDO::getTotalPrice, BigDecimal::add, BigDecimal.ZERO)));
stockMoveMapper.insert(stockMove);
// 2.2 插入出库单项
stockMoveItems.forEach(o -> o.setMoveId(stockMove.getId()));
stockMoveItemMapper.insertBatch(stockMoveItems);
return stockMove.getId();
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateStockMove(ErpStockMoveSaveReqVO updateReqVO) {
// 1.1 校验存在
ErpStockMoveDO stockMove = validateStockMoveExists(updateReqVO.getId());
if (ErpAuditStatus.APPROVE.getStatus().equals(stockMove.getStatus())) {
throw exception(STOCK_MOVE_UPDATE_FAIL_APPROVE, stockMove.getNo());
}
// 1.2 校验出库项的有效性
List<ErpStockMoveItemDO> stockMoveItems = validateStockMoveItems(updateReqVO.getItems());
// 2.1 更新出库单
ErpStockMoveDO updateObj = BeanUtils.toBean(updateReqVO, ErpStockMoveDO.class, in -> in
.setTotalCount(getSumValue(stockMoveItems, ErpStockMoveItemDO::getCount, BigDecimal::add))
.setTotalPrice(getSumValue(stockMoveItems, ErpStockMoveItemDO::getTotalPrice, BigDecimal::add)));
stockMoveMapper.updateById(updateObj);
// 2.2 更新出库单项
updateStockMoveItemList(updateReqVO.getId(), stockMoveItems);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateStockMoveStatus(Long id, Integer status) {
boolean approve = ErpAuditStatus.APPROVE.getStatus().equals(status);
// 1.1 校验存在
ErpStockMoveDO stockMove = validateStockMoveExists(id);
// 1.2 校验状态
if (stockMove.getStatus().equals(status)) {
throw exception(approve ? STOCK_MOVE_APPROVE_FAIL : STOCK_MOVE_PROCESS_FAIL);
}
// 2. 更新状态
int updateCount = stockMoveMapper.updateByIdAndStatus(id, stockMove.getStatus(),
new ErpStockMoveDO().setStatus(status));
if (updateCount == 0) {
throw exception(approve ? STOCK_MOVE_APPROVE_FAIL : STOCK_MOVE_PROCESS_FAIL);
}
// 3. 变更库存
List<ErpStockMoveItemDO> stockMoveItems = stockMoveItemMapper.selectListByMoveId(id);
Integer fromBizType = approve ? ErpStockRecordBizTypeEnum.MOVE_OUT.getType()
: ErpStockRecordBizTypeEnum.MOVE_OUT_CANCEL.getType();
Integer toBizType = approve ? ErpStockRecordBizTypeEnum.MOVE_IN.getType()
: ErpStockRecordBizTypeEnum.MOVE_IN_CANCEL.getType();
stockMoveItems.forEach(stockMoveItem -> {
BigDecimal fromCount = approve ? stockMoveItem.getCount().negate() : stockMoveItem.getCount();
BigDecimal toCount = approve ? stockMoveItem.getCount() : stockMoveItem.getCount().negate();
stockRecordService.createStockRecord(new ErpStockRecordCreateReqBO(
stockMoveItem.getProductId(), stockMoveItem.getFromWarehouseId(), fromCount,
fromBizType, stockMoveItem.getMoveId(), stockMoveItem.getId(), stockMove.getNo()));
stockRecordService.createStockRecord(new ErpStockRecordCreateReqBO(
stockMoveItem.getProductId(), stockMoveItem.getToWarehouseId(), toCount,
toBizType, stockMoveItem.getMoveId(), stockMoveItem.getId(), stockMove.getNo()));
});
}
private List<ErpStockMoveItemDO> validateStockMoveItems(List<ErpStockMoveSaveReqVO.Item> list) {
// 1.1 校验产品存在
List<ErpProductDO> productList = productService.validProductList(
convertSet(list, ErpStockMoveSaveReqVO.Item::getProductId));
Map<Long, ErpProductDO> productMap = convertMap(productList, ErpProductDO::getId);
// 1.2 校验仓库存在
warehouseService.validWarehouseList(convertSetByFlatMap(list,
item -> Stream.of(item.getFromWarehouseId(), item.getToWarehouseId())));
// 2. 转化为 ErpStockMoveItemDO 列表
return convertList(list, o -> BeanUtils.toBean(o, ErpStockMoveItemDO.class, item -> item
.setProductUnitId(productMap.get(item.getProductId()).getUnitId())
.setTotalPrice(MoneyUtils.priceMultiply(item.getProductPrice(), item.getCount()))));
}
private void updateStockMoveItemList(Long id, List<ErpStockMoveItemDO> newList) {
// 第一步对比新老数据获得添加修改删除的列表
List<ErpStockMoveItemDO> oldList = stockMoveItemMapper.selectListByMoveId(id);
List<List<ErpStockMoveItemDO>> diffList = diffList(oldList, newList, // id 不同就认为是不同的记录
(oldVal, newVal) -> oldVal.getId().equals(newVal.getId()));
// 第二步批量添加修改删除
if (CollUtil.isNotEmpty(diffList.get(0))) {
diffList.get(0).forEach(o -> o.setMoveId(id));
stockMoveItemMapper.insertBatch(diffList.get(0));
}
if (CollUtil.isNotEmpty(diffList.get(1))) {
stockMoveItemMapper.updateBatch(diffList.get(1));
}
if (CollUtil.isNotEmpty(diffList.get(2))) {
stockMoveItemMapper.deleteBatchIds(convertList(diffList.get(2), ErpStockMoveItemDO::getId));
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteStockMove(List<Long> ids) {
// 1. 校验不处于已审批
List<ErpStockMoveDO> stockMoves = stockMoveMapper.selectBatchIds(ids);
if (CollUtil.isEmpty(stockMoves)) {
return;
}
stockMoves.forEach(stockMove -> {
if (ErpAuditStatus.APPROVE.getStatus().equals(stockMove.getStatus())) {
throw exception(STOCK_MOVE_DELETE_FAIL_APPROVE, stockMove.getNo());
}
});
// 2. 遍历删除并记录操作日志
stockMoves.forEach(stockMove -> {
// 2.1 删除出库单
stockMoveMapper.deleteById(stockMove.getId());
// 2.2 删除出库单项
stockMoveItemMapper.deleteByMoveId(stockMove.getId());
});
}
private ErpStockMoveDO validateStockMoveExists(Long id) {
ErpStockMoveDO stockMove = stockMoveMapper.selectById(id);
if (stockMove == null) {
throw exception(STOCK_MOVE_NOT_EXISTS);
}
return stockMove;
}
@Override
public ErpStockMoveDO getStockMove(Long id) {
return stockMoveMapper.selectById(id);
}
@Override
public PageResult<ErpStockMoveDO> getStockMovePage(ErpStockMovePageReqVO pageReqVO) {
return stockMoveMapper.selectPage(pageReqVO);
}
// ==================== 出库项 ====================
@Override
public List<ErpStockMoveItemDO> getStockMoveItemListByMoveId(Long moveId) {
return stockMoveItemMapper.selectListByMoveId(moveId);
}
@Override
public List<ErpStockMoveItemDO> getStockMoveItemListByMoveIds(Collection<Long> moveIds) {
if (CollUtil.isEmpty(moveIds)) {
return Collections.emptyList();
}
return stockMoveItemMapper.selectListByMoveIds(moveIds);
}
}

View File

@ -0,0 +1,84 @@
package cn.iocoder.yudao.module.erp.service.stock;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out.ErpStockOutPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.out.ErpStockOutSaveReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockOutDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockOutItemDO;
import jakarta.validation.Valid;
import java.util.Collection;
import java.util.List;
/**
* ERP 其它出库单 Service 接口
*
* @author 芋道源码
*/
public interface ErpStockOutService {
/**
* 创建其它出库单
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createStockOut(@Valid ErpStockOutSaveReqVO createReqVO);
/**
* 更新其它出库单
*
* @param updateReqVO 更新信息
*/
void updateStockOut(@Valid ErpStockOutSaveReqVO updateReqVO);
/**
* 更新其它出库单的状态
*
* @param id 编号
* @param status 状态
*/
void updateStockOutStatus(Long id, Integer status);
/**
* 删除其它出库单
*
* @param ids 编号数组
*/
void deleteStockOut(List<Long> ids);
/**
* 获得其它出库单
*
* @param id 编号
* @return 其它出库单
*/
ErpStockOutDO getStockOut(Long id);
/**
* 获得其它出库单分页
*
* @param pageReqVO 分页查询
* @return 其它出库单分页
*/
PageResult<ErpStockOutDO> getStockOutPage(ErpStockOutPageReqVO pageReqVO);
// ==================== 出库项 ====================
/**
* 获得其它出库单项列表
*
* @param outId 出库编号
* @return 其它出库单项列表
*/
List<ErpStockOutItemDO> getStockOutItemListByOutId(Long outId);
/**
* 获得其它出库单项 List
*
* @param outIds 出库编号数组
* @return 其它出库单项 List
*/
List<ErpStockOutItemDO> getStockOutItemListByOutIds(Collection<Long> outIds);
}

Some files were not shown because too many files have changed in this diff Show More