feat: 载具扩展表

This commit is contained in:
2026-07-23 09:28:18 +08:00
parent 7360ac1c0f
commit efe6e3b0d5
14 changed files with 1220 additions and 0 deletions

View File

@@ -28,4 +28,7 @@ public interface ErrorCodeConstants {
// ========== 载具信息相关错误码 ==========
ErrorCode STORAGE_VEHICLE_INFO_NOT_EXISTS = new ErrorCode(11, "载具信息不存在");
// ========== 载具扩展属性信息 ==========
ErrorCode STORAGE_VEHICLE_EXT_NOT_EXISTS = new ErrorCode(12, "载具扩展属性信息不存在");
}

View File

@@ -0,0 +1,104 @@
package cn.code.nl.module.wms.controller.admin.storagevehicleext;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.code.nl.framework.common.pojo.PageParam;
import cn.code.nl.framework.common.pojo.PageResult;
import cn.code.nl.framework.common.pojo.CommonResult;
import cn.code.nl.framework.common.util.object.BeanUtils;
import static cn.code.nl.framework.common.pojo.CommonResult.success;
import cn.code.nl.framework.excel.core.util.ExcelUtils;
import cn.code.nl.framework.apilog.core.annotation.ApiAccessLog;
import static cn.code.nl.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.code.nl.module.wms.controller.admin.storagevehicleext.vo.*;
import cn.code.nl.module.wms.dal.dataobject.storagevehicleext.StorageVehicleExtDO;
import cn.code.nl.module.wms.service.storagevehicleext.StorageVehicleExtService;
@Tag(name = "管理后台 - 载具扩展属性信息")
@RestController
@RequestMapping("/wms/storage-vehicle-ext")
@Validated
public class StorageVehicleExtController {
@Resource
private StorageVehicleExtService storageVehicleExtService;
@PostMapping("/create")
@Operation(summary = "创建载具扩展属性信息")
@PreAuthorize("@ss.hasPermission('wms:storage-vehicle-ext:create')")
public CommonResult<Long> createStorageVehicleExt(@Valid @RequestBody StorageVehicleExtSaveReqVO createReqVO) {
return success(storageVehicleExtService.createStorageVehicleExt(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新载具扩展属性信息")
@PreAuthorize("@ss.hasPermission('wms:storage-vehicle-ext:update')")
public CommonResult<Boolean> updateStorageVehicleExt(@Valid @RequestBody StorageVehicleExtSaveReqVO updateReqVO) {
storageVehicleExtService.updateStorageVehicleExt(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除载具扩展属性信息")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('wms:storage-vehicle-ext:delete')")
public CommonResult<Boolean> deleteStorageVehicleExt(@RequestParam("id") Long id) {
storageVehicleExtService.deleteStorageVehicleExt(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除载具扩展属性信息")
@PreAuthorize("@ss.hasPermission('wms:storage-vehicle-ext:delete')")
public CommonResult<Boolean> deleteStorageVehicleExtList(@RequestParam("ids") List<Long> ids) {
storageVehicleExtService.deleteStorageVehicleExtListByIds(ids);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得载具扩展属性信息")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('wms:storage-vehicle-ext:query')")
public CommonResult<StorageVehicleExtRespVO> getStorageVehicleExt(@RequestParam("id") Long id) {
StorageVehicleExtDO storageVehicleExt = storageVehicleExtService.getStorageVehicleExt(id);
return success(BeanUtils.toBean(storageVehicleExt, StorageVehicleExtRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得载具扩展属性信息分页")
@PreAuthorize("@ss.hasPermission('wms:storage-vehicle-ext:query')")
public CommonResult<PageResult<StorageVehicleExtRespVO>> getStorageVehicleExtPage(@Valid StorageVehicleExtPageReqVO pageReqVO) {
PageResult<StorageVehicleExtDO> pageResult = storageVehicleExtService.getStorageVehicleExtPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, StorageVehicleExtRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出载具扩展属性信息 Excel")
@PreAuthorize("@ss.hasPermission('wms:storage-vehicle-ext:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportStorageVehicleExtExcel(@Valid StorageVehicleExtPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<StorageVehicleExtDO> list = storageVehicleExtService.getStorageVehicleExtPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "载具扩展属性信息.xls", "数据", StorageVehicleExtRespVO.class,
BeanUtils.toBean(list, StorageVehicleExtRespVO.class));
}
}

View File

@@ -0,0 +1,36 @@
package cn.code.nl.module.wms.controller.admin.storagevehicleext.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.code.nl.framework.common.pojo.PageParam;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.code.nl.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 载具扩展属性信息分页 Request VO")
@Data
public class StorageVehicleExtPageReqVO extends PageParam {
@Schema(description = "载具编码")
private String storageVehicleCode;
@Schema(description = "载具类型", example = "1")
private String storageVehicleType;
@Schema(description = "物料标识", example = "9871")
private Long materialId;
@Schema(description = "批次")
private String pcsn;
@Schema(description = "木箱号")
private String boxNo;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@@ -0,0 +1,72 @@
package cn.code.nl.module.wms.controller.admin.storagevehicleext.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import cn.idev.excel.annotation.*;
@Schema(description = "管理后台 - 载具扩展属性信息 Response VO")
@Data
@ExcelIgnoreUnannotated
public class StorageVehicleExtRespVO {
@Schema(description = "载具编码", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("载具编码")
private String storageVehicleCode;
@Schema(description = "载具类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty("载具类型")
private String storageVehicleType;
@Schema(description = "物料标识", example = "9871")
@ExcelProperty("物料标识")
private Long materialId;
@Schema(description = "批次")
@ExcelProperty("批次")
private String pcsn;
@Schema(description = "木箱号")
@ExcelProperty("木箱号")
private String boxNo;
@Schema(description = "数量计量单位标识", example = "5443")
@ExcelProperty("数量计量单位标识")
private Long qtyUnitId;
@Schema(description = "数量计量单位名称", example = "赵六")
@ExcelProperty("数量计量单位名称")
private String qtyUnitName;
@Schema(description = "物料数量")
@ExcelProperty("物料数量")
private BigDecimal qty;
@Schema(description = "托盘重量", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("托盘重量")
private BigDecimal vehicleWeight;
@Schema(description = "重量计量单位标识", example = "4653")
@ExcelProperty("重量计量单位标识")
private Long weightUnitId;
@Schema(description = "重量计量单位名称", example = "王五")
@ExcelProperty("重量计量单位名称")
private String weightUnitName;
@Schema(description = "备注", example = "随便")
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("更新时间")
private LocalDateTime updateTime;
}

View File

@@ -0,0 +1,58 @@
package cn.code.nl.module.wms.controller.admin.storagevehicleext.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
import java.math.BigDecimal;
@Schema(description = "管理后台 - 载具扩展属性信息新增/修改 Request VO")
@Data
public class StorageVehicleExtSaveReqVO {
private Long storageVehicleExtId;
@Schema(description = "载具标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "7198")
@NotNull(message = "载具标识不能为空")
private Long storageVehicleId;
@Schema(description = "载具编码", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "载具编码不能为空")
private String storageVehicleCode;
@Schema(description = "载具类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotEmpty(message = "载具类型不能为空")
private String storageVehicleType;
@Schema(description = "物料标识", example = "9871")
private Long materialId;
@Schema(description = "批次")
private String pcsn;
@Schema(description = "木箱号")
private String boxNo;
@Schema(description = "数量计量单位标识", example = "5443")
private Long qtyUnitId;
@Schema(description = "数量计量单位名称", example = "赵六")
private String qtyUnitName;
@Schema(description = "物料数量")
private BigDecimal qty;
@Schema(description = "托盘重量", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "托盘重量不能为空")
private BigDecimal vehicleWeight;
@Schema(description = "重量计量单位标识", example = "4653")
private Long weightUnitId;
@Schema(description = "重量计量单位名称", example = "王五")
private String weightUnitName;
@Schema(description = "备注", example = "随便")
private String remark;
}

View File

@@ -0,0 +1,90 @@
package cn.code.nl.module.wms.dal.dataobject.storagevehicleext;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.code.nl.framework.mybatis.core.dataobject.BaseDO;
/**
* 载具扩展属性信息 DO
*
* @author 诺力管理员
*/
@TableName("wms_storage_vehicle_ext")
@KeySequence("wms_storage_vehicle_ext_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class StorageVehicleExtDO extends BaseDO {
/**
* 载具扩展标识
*/
@TableId
private Long storageVehicleExtId;
/**
* 载具标识
*/
private Long storageVehicleId;
/**
* 载具编码
*/
private String storageVehicleCode;
/**
* 载具类型
*/
private String storageVehicleType;
/**
* 物料标识
*/
private Long materialId;
/**
* 批次
*/
private String pcsn;
/**
* 木箱号
*/
private String boxNo;
/**
* 数量计量单位标识
*/
private Long qtyUnitId;
/**
* 数量计量单位名称
*/
private String qtyUnitName;
/**
* 物料数量
*/
private BigDecimal qty;
/**
* 设备标识
*/
private Long deviceUuid;
/**
* 托盘重量
*/
private BigDecimal vehicleWeight;
/**
* 重量计量单位标识
*/
private Long weightUnitId;
/**
* 重量计量单位名称
*/
private String weightUnitName;
/**
* 备注
*/
private String remark;
}

View File

@@ -0,0 +1,31 @@
package cn.code.nl.module.wms.dal.mysql.storagevehicleext;
import java.util.*;
import cn.code.nl.framework.common.pojo.PageResult;
import cn.code.nl.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.code.nl.framework.mybatis.core.mapper.BaseMapperX;
import cn.code.nl.module.wms.dal.dataobject.storagevehicleext.StorageVehicleExtDO;
import org.apache.ibatis.annotations.Mapper;
import cn.code.nl.module.wms.controller.admin.storagevehicleext.vo.*;
/**
* 载具扩展属性信息 Mapper
*
* @author 诺力管理员
*/
@Mapper
public interface StorageVehicleExtMapper extends BaseMapperX<StorageVehicleExtDO> {
default PageResult<StorageVehicleExtDO> selectPage(StorageVehicleExtPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<StorageVehicleExtDO>()
.eqIfPresent(StorageVehicleExtDO::getStorageVehicleCode, reqVO.getStorageVehicleCode())
.eqIfPresent(StorageVehicleExtDO::getStorageVehicleType, reqVO.getStorageVehicleType())
.eqIfPresent(StorageVehicleExtDO::getMaterialId, reqVO.getMaterialId())
.eqIfPresent(StorageVehicleExtDO::getPcsn, reqVO.getPcsn())
.eqIfPresent(StorageVehicleExtDO::getBoxNo, reqVO.getBoxNo())
.betweenIfPresent(StorageVehicleExtDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(StorageVehicleExtDO::getStorageVehicleExtId));
}
}

View File

@@ -0,0 +1,62 @@
package cn.code.nl.module.wms.service.storagevehicleext;
import java.util.*;
import jakarta.validation.*;
import cn.code.nl.module.wms.controller.admin.storagevehicleext.vo.*;
import cn.code.nl.module.wms.dal.dataobject.storagevehicleext.StorageVehicleExtDO;
import cn.code.nl.framework.common.pojo.PageResult;
import cn.code.nl.framework.common.pojo.PageParam;
/**
* 载具扩展属性信息 Service 接口
*
* @author 诺力管理员
*/
public interface StorageVehicleExtService {
/**
* 创建载具扩展属性信息
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createStorageVehicleExt(@Valid StorageVehicleExtSaveReqVO createReqVO);
/**
* 更新载具扩展属性信息
*
* @param updateReqVO 更新信息
*/
void updateStorageVehicleExt(@Valid StorageVehicleExtSaveReqVO updateReqVO);
/**
* 删除载具扩展属性信息
*
* @param id 编号
*/
void deleteStorageVehicleExt(Long id);
/**
* 批量删除载具扩展属性信息
*
* @param ids 编号
*/
void deleteStorageVehicleExtListByIds(List<Long> ids);
/**
* 获得载具扩展属性信息
*
* @param id 编号
* @return 载具扩展属性信息
*/
StorageVehicleExtDO getStorageVehicleExt(Long id);
/**
* 获得载具扩展属性信息分页
*
* @param pageReqVO 分页查询
* @return 载具扩展属性信息分页
*/
PageResult<StorageVehicleExtDO> getStorageVehicleExtPage(StorageVehicleExtPageReqVO pageReqVO);
}

View File

@@ -0,0 +1,85 @@
package cn.code.nl.module.wms.service.storagevehicleext;
import cn.hutool.core.collection.CollUtil;
import org.springframework.stereotype.Service;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import cn.code.nl.module.wms.controller.admin.storagevehicleext.vo.*;
import cn.code.nl.module.wms.dal.dataobject.storagevehicleext.StorageVehicleExtDO;
import cn.code.nl.framework.common.pojo.PageResult;
import cn.code.nl.framework.common.pojo.PageParam;
import cn.code.nl.framework.common.util.object.BeanUtils;
import cn.code.nl.module.wms.dal.mysql.storagevehicleext.StorageVehicleExtMapper;
import static cn.code.nl.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.code.nl.framework.common.util.collection.CollectionUtils.convertList;
import static cn.code.nl.framework.common.util.collection.CollectionUtils.diffList;
import static cn.code.nl.module.wms.enums.ErrorCodeConstants.*;
/**
* 载具扩展属性信息 Service 实现类
*
* @author 诺力管理员
*/
@Service
@Validated
public class StorageVehicleExtServiceImpl implements StorageVehicleExtService {
@Resource
private StorageVehicleExtMapper storageVehicleExtMapper;
@Override
public Long createStorageVehicleExt(StorageVehicleExtSaveReqVO createReqVO) {
// 插入
StorageVehicleExtDO storageVehicleExt = BeanUtils.toBean(createReqVO, StorageVehicleExtDO.class);
storageVehicleExtMapper.insert(storageVehicleExt);
// 返回
return storageVehicleExt.getStorageVehicleExtId();
}
@Override
public void updateStorageVehicleExt(StorageVehicleExtSaveReqVO updateReqVO) {
// 校验存在
validateStorageVehicleExtExists(updateReqVO.getStorageVehicleExtId());
// 更新
StorageVehicleExtDO updateObj = BeanUtils.toBean(updateReqVO, StorageVehicleExtDO.class);
storageVehicleExtMapper.updateById(updateObj);
}
@Override
public void deleteStorageVehicleExt(Long id) {
// 校验存在
validateStorageVehicleExtExists(id);
// 删除
storageVehicleExtMapper.deleteById(id);
}
@Override
public void deleteStorageVehicleExtListByIds(List<Long> ids) {
// 删除
storageVehicleExtMapper.deleteByIds(ids);
}
private void validateStorageVehicleExtExists(Long id) {
if (storageVehicleExtMapper.selectById(id) == null) {
throw exception(STORAGE_VEHICLE_EXT_NOT_EXISTS);
}
}
@Override
public StorageVehicleExtDO getStorageVehicleExt(Long id) {
return storageVehicleExtMapper.selectById(id);
}
@Override
public PageResult<StorageVehicleExtDO> getStorageVehicleExtPage(StorageVehicleExtPageReqVO pageReqVO) {
return storageVehicleExtMapper.selectPage(pageReqVO);
}
}

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.code.nl.module.wms.dal.mysql.storagevehicleext.StorageVehicleExtMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>