diff --git a/docs/superpowers/plans/2026-08-25-wms-box-type-migration.md b/docs/superpowers/plans/2026-08-25-wms-box-type-migration.md new file mode 100644 index 00000000..fe902787 --- /dev/null +++ b/docs/superpowers/plans/2026-08-25-wms-box-type-migration.md @@ -0,0 +1,327 @@ +# WMS 木箱类型归属迁移实现计划 + +> **面向 AI 代理的工作者:** 必需子技能:使用 superpowers:subagent-driven-development(推荐)或 superpowers:executing-plans 逐任务实现此计划。步骤使用复选框(`- [ ]`)语法来跟踪进度。 + +**目标:** 将木箱类型表和全部管理能力收敛到 WMS,LMS 仅通过 WMS Feign API 使用木箱类型,管理前端和手持端直接访问 WMS Controller。 + +**架构:** WMS 以 `wms_box_type` 为唯一数据源,管理 Controller 与内部 Feign API共用同一个 `BoxTypeService`。LMS 删除本地木箱类型 CRUD 和 Mapper,子卷装箱关系通过一次批量 Feign 查询完成容量校验;前端保留现有页面交互,只迁移 API 归属、请求路径和权限编码。 + +**技术栈:** Java 17、Spring Boot、Spring Cloud OpenFeign、MyBatis-Plus/MyBatis XML、MySQL、Vue 3、TypeScript、Vben Admin。 + +**基线限制:** 隔离分支中的 LMS 基线因 `CuttingProcessServiceImpl` 引用不存在的 `rawfoilcasheposition` 包而无法完整编译。用户已同意继续;最终验证必须单独证明 WMS 编译通过,并确认 LMS 没有新增木箱类型相关编译错误。 + +--- + +## 文件结构 + +### 新建 + +- `nl-module-wms/nl-module-wms-api/src/main/java/cn/code/nl/module/wms/api/boxtype/BoxTypeApi.java`:LMS 调用的 Feign 契约。 +- `nl-module-wms/nl-module-wms-api/src/main/java/cn/code/nl/module/wms/api/boxtype/dto/BoxTypeResp.java`:跨模块木箱类型数据。 +- `nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/api/boxtype/BoxTypeApiImpl.java`:Feign 契约实现。 +- `nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/controller/admin/boxtype/BoxTypeController.java`:WMS 管理接口。 +- `nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/controller/admin/boxtype/vo/BoxTypeCreateReqVO.java`:新增请求。 +- `nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/controller/admin/boxtype/vo/BoxTypeUpdateReqVO.java`:修改请求。 +- `nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/controller/admin/boxtype/vo/BoxTypePageReqVO.java`:分页请求。 +- `nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/controller/admin/boxtype/vo/BoxTypeRespVO.java`:管理响应和导出模型。 +- `nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/service/boxtype/BoxTypeService.java`:木箱类型领域服务。 +- `nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/service/boxtype/BoxTypeServiceImpl.java`:CRUD、唯一性和批量查询实现。 +- `nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/api/wms/boxtype/index.ts`:WMS 木箱类型前端 API。 +- `sql/mysql/wms_box_type_menu.sql`:将既有菜单权限幂等迁移为 `wms:box-type:*`。 + +### 修改 + +- `sql/mysql/wms_empty_box.sql`:使用给定字段创建 `wms_box_type`,不迁移旧数据。 +- `nl-module-wms/.../dal/dataobject/boxtype/BoxTypeDO.java`:完整映射新表字段。 +- `nl-module-wms/.../dal/mysql/boxtype/BoxTypeMapper.java`:改为 `BaseMapperX` 并声明 XML 查询。 +- `nl-module-wms/.../resources/mapper/boxtype/BoxTypeMapper.xml`:分页、编码查询、批量查询 SQL。 +- `nl-module-wms/.../service/emptybox/EmptyBoxServiceImpl.java`:按 `boxType` 校验并使用新字段创建木箱实例。 +- `nl-module-wms/.../enums/ErrorCodeConstants.java`:增加木箱类型不存在和已存在错误码。 +- `nl-module-lms/.../service/subpackagerelation/SubPackageRelationServiceImpl.java`:由本地 Mapper 改为批量 Feign。 +- `nl-ui/.../views/lms/boxtype/index.vue`、`data.ts`、`modules/form.vue`、`components/BoxTypeSelectModal.vue`:改用 WMS API 和权限。 +- `nl-ui/.../views/lms/subpackagerelation/modules/batch-form.vue`:选择器类型引用改用 WMS API。 + +### 删除 + +- `nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/controller/admin/boxtype/**` +- `nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/service/boxtype/**` +- `nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/dal/dataobject/boxtype/**` +- `nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/dal/mysql/boxtype/**` +- `nl-module-lms/nl-module-lms-server/src/main/resources/mapper/boxtype/**` +- `nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/api/lms/boxtype/index.ts` + +--- + +### 任务 1:建立 WMS 唯一表模型和数据访问 + +**文件:** +- 修改:`sql/mysql/wms_empty_box.sql` +- 修改:`nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/dal/dataobject/boxtype/BoxTypeDO.java` +- 修改:`nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/dal/mysql/boxtype/BoxTypeMapper.java` +- 修改:`nl-module-wms/nl-module-wms-server/src/main/resources/mapper/boxtype/BoxTypeMapper.xml` + +- [ ] **步骤 1:替换建表 SQL** + +将 `wms_boxtype` 建表段替换为规格中的 `CREATE TABLE IF NOT EXISTS wms_box_type`,字段、类型、默认值、主键和 `index_unq_box_type` 唯一索引逐字对齐确认后的结构。不增加审计、租户或逻辑删除字段,不写历史数据迁移和删表语句。 + +- [ ] **步骤 2:重写 WMS 数据对象** + +`BoxTypeDO` 使用 `@TableName("wms_box_type")`,保留 `@TableId private Long id`,增加 `boxType`、`boxName`、`lashNum`、`lashNumOne`、`lashNumTwo`、`needLashOne`、`needLashTwo`、`expendWidth`、`boxStructure`、`desiccantNum`、`boxLength`、`boxWidth`、`boxHigh`、`maxNum`。其中 `expendWidth` 使用 `BigDecimal`,不继承 `BaseDO`。 + +- [ ] **步骤 3:重写 Mapper 契约和 XML** + +Mapper 继承 `BaseMapperX`,声明: + +```java +BoxTypeDO selectByBoxType(String boxType); +List selectByBoxTypes(Collection boxTypes); +PageResult selectPage(BoxTypePageReqVO reqVO); +``` + +全部查询写入 XML。分页条件为 `box_type` 精确、`box_name` 模糊、两项捆扎 Boolean 精确,默认 `ORDER BY id DESC`;批量集合为空时由 Service 拦截,不生成空 `IN`。 + +- [ ] **步骤 4:运行静态检查并提交** + +运行: + +```bash +git diff --check +rg -n "wms_boxtype|material_code|material_name|box_height" \ + nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/dal \ + nl-module-wms/nl-module-wms-server/src/main/resources/mapper/boxtype \ + sql/mysql/wms_empty_box.sql +``` + +预期:`git diff --check` 无输出;目标木箱类型文件不再引用旧表和旧字段。 + +提交: + +```bash +git add sql/mysql/wms_empty_box.sql nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/dal nl-module-wms/nl-module-wms-server/src/main/resources/mapper/boxtype +git commit -m "refactor: 统一WMS木箱类型数据模型" +``` + +### 任务 2:迁移木箱类型 CRUD 到 WMS + +**文件:** +- 创建:`nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/controller/admin/boxtype/**` +- 创建:`nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/service/boxtype/**` +- 修改:`nl-module-wms/nl-module-wms-api/src/main/java/cn/code/nl/module/wms/enums/ErrorCodeConstants.java` + +- [ ] **步骤 1:定义管理 VO** + +将 LMS 现有字段迁入 WMS。新增请求 `BoxTypeCreateReqVO` 要求 `boxType` 非空且最长 20,`maxNum >= 1`,`desiccantNum >= 0`;更新请求继承新增请求并增加 `@NotNull Long id`。分页请求继承 `PageParam`。响应 VO 覆盖完整字段并保留 Excel 注解。 + +- [ ] **步骤 2:实现 WMS Service** + +Service 暴露 create、update、delete、deleteList、get、page、getByBoxType、getByBoxTypes。实现使用 `@Resource` 注入 Mapper,新增 ID 使用 `IdUtil.getSnowflakeNextId()`,请求到 DO 逐字段映射;新增和更新校验唯一索引语义,更新时允许当前记录保持原编码。远程批量查询的空集合直接返回空列表。 + +- [ ] **步骤 3:实现 WMS 管理 Controller** + +基础路径为 `/wms/box-type`,保留 create、update、delete、delete-list、get、page、export-excel,权限逐项替换为 `wms:box-type:*`。返回项目现有 `CommonResult`/`PageResult`,导出复用 `ExcelUtils`。 + +- [ ] **步骤 4:增加 WMS 错误码并编译** + +在 WMS 错误码未占用区间定义“木箱类型不存在”“木箱类型已存在”。运行: + +```bash +mvn -pl nl-module-wms/nl-module-wms-server -am -DskipTests compile +``` + +预期:`BUILD SUCCESS`。 + +- [ ] **步骤 5:提交** + +```bash +git add nl-module-wms/nl-module-wms-api/src/main/java/cn/code/nl/module/wms/enums/ErrorCodeConstants.java nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/controller/admin/boxtype nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/service/boxtype +git commit -m "feat: 增加WMS木箱类型管理" +``` + +### 任务 3:增加 WMS 木箱类型 Feign API + +**文件:** +- 创建:`nl-module-wms/nl-module-wms-api/src/main/java/cn/code/nl/module/wms/api/boxtype/BoxTypeApi.java` +- 创建:`nl-module-wms/nl-module-wms-api/src/main/java/cn/code/nl/module/wms/api/boxtype/dto/BoxTypeResp.java` +- 创建:`nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/api/boxtype/BoxTypeApiImpl.java` + +- [ ] **步骤 1:定义共享 DTO 和 FeignClient** + +`BoxTypeResp` 包含新表全部业务字段。`BoxTypeApi` 使用 `@FeignClient(name = ApiConstants.NAME)`,前缀为 `ApiConstants.PREFIX + "/box-type"`,提供: + +```java +@GetMapping(PREFIX + "/getByBoxType") +CommonResult getByBoxType(@RequestParam("boxType") String boxType); + +@PostMapping(PREFIX + "/getByBoxTypes") +CommonResult> getByBoxTypes(@RequestBody Collection boxTypes); +``` + +- [ ] **步骤 2:实现 Server API** + +`BoxTypeApiImpl` 实现接口并注入 `BoxTypeService`;逐字段转换 DO 为 Resp。单项不存在返回成功空值,交由业务调用方决定提示;批量返回命中集合。 + +- [ ] **步骤 3:编译并提交** + +运行: + +```bash +mvn -pl nl-module-wms/nl-module-wms-server -am -DskipTests compile +``` + +预期:`BUILD SUCCESS`。 + +提交: + +```bash +git add nl-module-wms/nl-module-wms-api/src/main/java/cn/code/nl/module/wms/api/boxtype nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/api/boxtype +git commit -m "feat: 增加WMS木箱类型内部接口" +``` + +### 任务 4:让 WMS 空木箱业务使用新模型 + +**文件:** +- 修改:`nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/service/emptybox/EmptyBoxServiceImpl.java` + +- [ ] **步骤 1:替换类型查询和字段映射** + +将 `selectByMaterialCode(req.getMaterialCode())` 改为 Service/Mapper 的按 `boxType` 查询。创建 `BoxInfoDO` 时改为: + +```java +box.setMaterialCode(boxType.getBoxType()); +box.setMaterialName(boxType.getBoxName()); +box.setBoxLength(String.valueOf(boxType.getBoxLength())); +box.setBoxWidth(String.valueOf(boxType.getBoxWidth())); +box.setBoxHigh(String.valueOf(boxType.getBoxHigh())); +box.setLashNum(boxType.getLashNum()); +``` + +只在 `wmw_boxinfo` 对应字段确为字符串时转换;允许新表可空字段按现有实例表约束处理,不添加虚构默认值。 + +- [ ] **步骤 2:验证所有空木箱入口** + +扫描 `createInbound`、`createOutbound`、ACS 空木箱申请和桁架入口,确认它们最终都使用 `wms_box_type.box_type` 校验。 + +- [ ] **步骤 3:编译并提交** + +运行 WMS Maven compile,预期 `BUILD SUCCESS`;提交: + +```bash +git add nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/service/emptybox/EmptyBoxServiceImpl.java +git commit -m "refactor: 空木箱业务改用WMS木箱类型" +``` + +### 任务 5:LMS 改用 Feign 并删除本地木箱类型实现 + +**文件:** +- 修改:`nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/service/subpackagerelation/SubPackageRelationServiceImpl.java` +- 删除:`nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/controller/admin/boxtype/**` +- 删除:`nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/service/boxtype/**` +- 删除:`nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/dal/dataobject/boxtype/**` +- 删除:`nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/dal/mysql/boxtype/**` +- 删除:`nl-module-lms/nl-module-lms-server/src/main/resources/mapper/boxtype/**` +- 修改:`nl-module-lms/nl-module-lms-api/src/main/java/cn/code/nl/module/lms/enums/ErrorCodeConstants.java` + +- [ ] **步骤 1:替换子卷装箱关系依赖** + +注入 `BoxTypeApi`,一次调用 `getByBoxTypes(boxTypes)`。先检查 `CommonResult.isSuccess()`;失败时记录中文错误日志(包含请求编码集合和返回结果)并抛 `ServiceException`,成功后将 `List` 按 `BoxTypeResp::getBoxType` 建 Map。容量校验改用 `BoxTypeResp.getMaxNum()`,其余分组逻辑不变。 + +- [ ] **步骤 2:删除 LMS 木箱类型完整实现** + +删除 Controller、VO、Service、DO、Mapper 接口和 XML;从 LMS 错误码删除仅由已迁移 CRUD 使用的 `BOX_TYPE_NOT_EXISTS`、`BOX_TYPE_EXISTS`,保留子卷装箱关系自己的业务错误码。 + +- [ ] **步骤 3:全量扫描 LMS 残留** + +运行: + +```bash +rg -n "lms_box_type|dal\.mysql\.boxtype|dal\.dataobject\.boxtype|service\.boxtype|controller\.admin\.boxtype" nl-module-lms +``` + +预期:源代码无输出,允许 `target` 目录旧编译产物不参与判断。 + +- [ ] **步骤 4:验证编译边界并提交** + +运行 LMS compile。已知基线仍可能仅在 `CuttingProcessServiceImpl` 的 `rawfoilcasheposition` 导入失败;输出不得包含 boxtype、BoxTypeApi、BoxTypeResp 或 SubPackageRelationServiceImpl 新错误。 + +提交: + +```bash +git add -A nl-module-lms nl-module-wms/nl-module-wms-api +git commit -m "refactor: LMS木箱类型改用WMS服务" +``` + +### 任务 6:迁移前端 API、权限和菜单 + +**文件:** +- 创建:`nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/api/wms/boxtype/index.ts` +- 删除:`nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/api/lms/boxtype/index.ts` +- 修改:`nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/lms/boxtype/**` +- 修改:`nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/lms/subpackagerelation/modules/batch-form.vue` +- 创建:`sql/mysql/wms_box_type_menu.sql` + +- [ ] **步骤 1:迁移 TypeScript API** + +将命名空间改为 `WmsBoxTypeApi`,所有请求改为 `/wms/box-type/*`。ID 保持现有 `number | string` 契约,CRUD、分页和导出方法签名不改变页面行为。 + +- [ ] **步骤 2:替换页面引用和权限** + +管理页、表单、选择弹窗、子卷批量表单统一从 `#/api/wms/boxtype` 导入;按钮权限从 `lms:box-type:*` 改为 `wms:box-type:*`。页面组件路径暂时保留 `views/lms/boxtype`,不做无业务价值的目录移动。 + +- [ ] **步骤 3:编写幂等权限迁移 SQL** + +对现有 `system_menu.permission` 中 `lms:box-type:create/update/delete/query/export` 逐项更新为对应 `wms:box-type:*`。以旧权限或新权限定位,保证重复执行不新增菜单、不改变父菜单和角色关联。 + +- [ ] **步骤 4:运行前端静态检查并提交** + +运行目标文件 ESLint 和 TypeScript 检查;若全量检查存在仓库既有错误,过滤输出确认本次 `boxtype` 文件没有新增错误。运行: + +```bash +rg -n "/lms/box-type|LmsBoxTypeApi|lms:box-type" \ + nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src +git diff --check +``` + +预期:扫描无输出,diff check 无输出。 + +提交: + +```bash +git add -A nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/api nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/lms/boxtype nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/lms/subpackagerelation/modules/batch-form.vue sql/mysql/wms_box_type_menu.sql +git commit -m "refactor: 木箱类型前端切换WMS接口" +``` + +### 任务 7:数据库和整体回归验证 + +**文件:** +- 验证:`sql/mysql/wms_empty_box.sql` +- 验证:`sql/mysql/wms_box_type_menu.sql` +- 验证:WMS、LMS 和前端全部目标文件 + +- [ ] **步骤 1:验证建表 SQL** + +在本地开发库执行 `wms_empty_box.sql` 的 `wms_box_type` 建表段并执行两次,使用 `SHOW CREATE TABLE wms_box_type` 核对字段和唯一索引。不插入或迁移旧数据,不删除 `wms_boxtype`、`lms_box_type`。 + +- [ ] **步骤 2:验证菜单 SQL** + +连续执行两次 `wms_box_type_menu.sql`,查询五项权限各一条且原角色关联仍指向同一菜单 ID。 + +- [ ] **步骤 3:编译和静态扫描** + +运行: + +```bash +mvn -pl nl-module-wms/nl-module-wms-server -am -DskipTests compile +mvn -pl nl-module-lms/nl-module-lms-server -am -DskipTests compile +rg -n "wms_boxtype|lms_box_type|/lms/box-type|LmsBoxTypeApi|lms:box-type" \ + nl-module-wms nl-module-lms \ + nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src \ + sql/mysql/wms_empty_box.sql sql/mysql/wms_box_type_menu.sql +git diff --check +``` + +预期:WMS `BUILD SUCCESS`;LMS 除已确认的 `CuttingProcessServiceImpl` 基线错误外没有新增错误;残留扫描无业务源文件结果;diff check 无输出。 + +- [ ] **步骤 4:最终提交检查** + +运行 `git status --short` 和 `git log --oneline`,确认仅包含本计划文件和预期迁移提交,不包含主工作区的未提交配置或其他业务修改。 + diff --git a/docs/superpowers/specs/2026-08-25-wms-box-type-migration-design.md b/docs/superpowers/specs/2026-08-25-wms-box-type-migration-design.md new file mode 100644 index 00000000..a9017361 --- /dev/null +++ b/docs/superpowers/specs/2026-08-25-wms-box-type-migration-design.md @@ -0,0 +1,136 @@ +# WMS 木箱类型归属迁移设计 + +## 1. 目标 + +将木箱类型的唯一数据归属从 LMS 迁移到 WMS,消除 WMS、LMS 各自维护 `BoxTypeMapper` 和木箱类型表的重复实现。 + +迁移完成后: + +- WMS 独占木箱类型表、数据访问、管理服务和管理接口。 +- LMS 不再直接访问木箱类型表,业务代码统一通过 WMS FeignClient 查询。 +- 管理前端和手持端直接调用 WMS Controller,不经过 LMS Controller 转发。 +- 不迁移或兼容 `wms_boxtype`、`lms_box_type` 的历史数据。 + +## 2. 数据模型 + +WMS 使用唯一表 `wms_box_type`,表结构如下: + +```sql +CREATE TABLE `wms_box_type` ( + `id` bigint NOT NULL COMMENT '木箱类型id', + `box_type` varchar(20) NOT NULL COMMENT '木箱类型', + `box_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '木箱描述', + `lash_num` char(1) DEFAULT NULL COMMENT '捆扎模版', + `lash_num_one` int DEFAULT NULL COMMENT '一次捆扎次数', + `lash_num_two` int DEFAULT NULL COMMENT '二次捆扎次数', + `need_lash_one` tinyint(1) DEFAULT NULL COMMENT '是否一次捆扎', + `need_lash_two` tinyint(1) DEFAULT NULL COMMENT '是否二次捆扎', + `expend_width` decimal(20,0) DEFAULT NULL COMMENT '叉车取货宽度', + `box_structure` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '木箱结构', + `desiccant_num` int NOT NULL DEFAULT '6' COMMENT '干燥剂数量', + `box_length` int DEFAULT NULL COMMENT '木箱长度', + `box_width` int DEFAULT NULL COMMENT '木箱宽度', + `box_high` int DEFAULT NULL COMMENT '木箱高度', + `max_num` int NOT NULL DEFAULT '1' COMMENT '最大子卷数', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `index_unq_box_type` (`box_type`) USING BTREE COMMENT '木箱编码唯一索引' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='木箱类型表'; +``` + +初始化 SQL 删除原 `wms_boxtype` 建表定义,改为创建 `wms_box_type`。不编写旧表数据迁移逻辑,也不主动删除现有旧表,避免部署脚本破坏历史数据;旧表退出业务读写即可。 + +## 3. WMS 模块 + +### 3.1 数据访问 + +- WMS `BoxTypeDO` 映射 `wms_box_type`,字段与表结构逐一对应。 +- WMS `BoxTypeMapper` 采用 MyBatis-Plus,提供分页、主键查询、按 `box_type` 查询和批量按 `box_type` 查询。 +- 删除基于 `material_code`、`material_name`、`box_height` 的旧 XML 查询。 + +### 3.2 管理能力 + +将 LMS 原有木箱类型管理能力迁入 WMS: + +- 请求和响应 VO。 +- 新增、修改、删除、批量删除、详情、分页和导出 Service。 +- 管理 Controller,基础路径为 `/wms/box-type`。 +- 权限编码统一为 `wms:box-type:create`、`update`、`delete`、`query`、`export`。 +- 唯一性和不存在校验由 WMS 负责,并使用 WMS 错误码。 + +### 3.3 空木箱业务 + +空木箱入库、出库和 ACS 申请仍由现有 WMS 服务处理,但木箱类型校验统一改为按 `box_type` 查询 `wms_box_type`。 + +创建木箱实例时字段映射调整为: + +- `box_type` 作为业务请求中的 `materialCode` 和木箱实例的物料编码。 +- `box_name` 作为木箱实例的物料名称。 +- `box_high` 映射木箱实例高度。 +- 长度、宽度、捆扎模板使用新表对应字段。 + +## 4. WMS Feign API + +在 `nl-module-wms-api` 增加木箱类型内部 API 和跨模块 DTO,至少提供: + +- 按 `boxType` 查询单个木箱类型。 +- 按 `boxTypes` 批量查询木箱类型。 + +WMS Server 实现该 API。批量接口一次返回全部命中记录,LMS 不逐条发起远程请求。 + +## 5. LMS 模块 + +从 LMS Server 删除: + +- 木箱类型 Controller 及其 VO。 +- 木箱类型 Service 和实现。 +- `BoxTypeDO`。 +- `BoxTypeMapper` 和 XML。 + +LMS 中仍需木箱类型信息的业务 Service 改为注入 WMS `BoxTypeApi`: + +- 子卷装箱关系保存前,批量远程查询木箱类型。 +- 使用 Feign DTO 中的 `boxType`、尺寸、最大子卷数等字段完成原有分组和校验。 +- WMS 不可用或返回失败时直接中止当前 LMS 业务,不允许绕过木箱类型校验继续写入。 + +## 6. 前端与手持调用 + +- 管理前端木箱类型 API 从 `/lms/box-type/*` 改为 `/wms/box-type/*`。 +- 前端 API 类型命名从 LMS 归属调整为 WMS 归属;管理页面和选择弹窗复用现有交互。 +- 菜单权限同步迁移为 `wms:box-type:*`。 +- 手持端直接请求 WMS Controller 获取木箱类型,不新增 LMS 代理 Controller。 +- 不保留 `/lms/box-type/*` 兼容接口。 + +## 7. 调用链 + +```text +管理前端/手持端 + -> WMS BoxTypeController + -> WMS BoxTypeService + -> WMS BoxTypeMapper + -> wms_box_type + +LMS 业务 Service + -> WMS BoxTypeApi (Feign) + -> WMS API 实现 + -> WMS BoxTypeService/Mapper + -> wms_box_type +``` + +## 8. 错误处理与一致性 + +- `box_type` 由数据库唯一索引和 Service 前置校验双重保证唯一。 +- 修改、删除前校验主键存在。 +- LMS 仅消费 WMS 返回的 DTO,不持有木箱类型实体或本地缓存,避免双写和数据过期。 +- 木箱类型远程查询失败时,LMS 当前事务回滚。 +- 因新表不包含逻辑删除和审计字段,DO 不继承带审计字段的基类,删除使用物理删除,与给定表结构保持一致。 + +## 9. 验证范围 + +- WMS 与 LMS Maven 编译。 +- WMS 木箱类型 CRUD、分页和唯一性校验静态检查。 +- 空木箱入库、出库按新字段读取木箱类型。 +- LMS 子卷装箱关系不再引用 LMS Mapper,并使用一次批量 Feign 查询。 +- 前端木箱类型管理页和选择弹窗不再请求 `/lms/box-type/*`。 +- 全仓扫描不存在 LMS 木箱类型 DO、Mapper、Service、Controller,以及业务代码中的 `wms_boxtype` 引用。 +- 建表 SQL 语法及重复执行验证。 + diff --git a/nl-module-lms/nl-module-lms-api/src/main/java/cn/code/nl/module/lms/enums/ErrorCodeConstants.java b/nl-module-lms/nl-module-lms-api/src/main/java/cn/code/nl/module/lms/enums/ErrorCodeConstants.java index ab70e8a1..abd8badf 100644 --- a/nl-module-lms/nl-module-lms-api/src/main/java/cn/code/nl/module/lms/enums/ErrorCodeConstants.java +++ b/nl-module-lms/nl-module-lms-api/src/main/java/cn/code/nl/module/lms/enums/ErrorCodeConstants.java @@ -110,10 +110,6 @@ public interface ErrorCodeConstants { // ========== 子卷包装关系 ========== ErrorCode SUB_PACKAGE_RELATION_NOT_EXISTS = new ErrorCode(300001, "子卷包装关系不存在"); - // ========== 木箱类型 ========== - ErrorCode BOX_TYPE_NOT_EXISTS = new ErrorCode(400001, "木箱类型不存在"); - ErrorCode BOX_TYPE_EXISTS = new ErrorCode(400002, "木箱类型已存在"); - // ========== LMS系统包装码校验日志 ========== ErrorCode PACKAGE_CHECK_LOG_NOT_EXISTS = new ErrorCode(500001, "LMS系统包装码校验日志不存在"); diff --git a/nl-module-lms/nl-module-lms-server/pom.xml b/nl-module-lms/nl-module-lms-server/pom.xml index 83cc6386..9f2962d9 100644 --- a/nl-module-lms/nl-module-lms-server/pom.xml +++ b/nl-module-lms/nl-module-lms-server/pom.xml @@ -48,6 +48,11 @@ nl-module-task-api ${revision} + + cn.nl.cloud + nl-module-wms-api + ${revision} + cn.nl.cloud nl-module-system-api diff --git a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/controller/admin/boxtype/BoxTypeController.java b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/controller/admin/boxtype/BoxTypeController.java deleted file mode 100644 index f6bd4651..00000000 --- a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/controller/admin/boxtype/BoxTypeController.java +++ /dev/null @@ -1,104 +0,0 @@ -package cn.code.nl.module.lms.controller.admin.boxtype; - -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.lms.controller.admin.boxtype.vo.*; -import cn.code.nl.module.lms.dal.dataobject.boxtype.BoxTypeDO; -import cn.code.nl.module.lms.service.boxtype.BoxTypeService; - -@Tag(name = "管理后台 - 木箱类型") -@RestController -@RequestMapping("/lms/box-type") -@Validated -public class BoxTypeController { - - @Resource - private BoxTypeService boxTypeService; - - @PostMapping("/create") - @Operation(summary = "创建木箱类型") - @PreAuthorize("@ss.hasPermission('lms:box-type:create')") - public CommonResult createBoxType(@Valid @RequestBody BoxTypeSaveReqVO createReqVO) { - return success(boxTypeService.createBoxType(createReqVO)); - } - - @PutMapping("/update") - @Operation(summary = "更新木箱类型") - @PreAuthorize("@ss.hasPermission('lms:box-type:update')") - public CommonResult updateBoxType(@Valid @RequestBody BoxTypeSaveReqVO updateReqVO) { - boxTypeService.updateBoxType(updateReqVO); - return success(true); - } - - @DeleteMapping("/delete") - @Operation(summary = "删除木箱类型") - @Parameter(name = "id", description = "编号", required = true) - @PreAuthorize("@ss.hasPermission('lms:box-type:delete')") - public CommonResult deleteBoxType(@RequestParam("id") String id) { - boxTypeService.deleteBoxType(id); - return success(true); - } - - @DeleteMapping("/delete-list") - @Parameter(name = "ids", description = "编号", required = true) - @Operation(summary = "批量删除木箱类型") - @PreAuthorize("@ss.hasPermission('lms:box-type:delete')") - public CommonResult deleteBoxTypeList(@RequestParam("ids") List ids) { - boxTypeService.deleteBoxTypeListByIds(ids); - return success(true); - } - - @GetMapping("/get") - @Operation(summary = "获得木箱类型") - @Parameter(name = "id", description = "编号", required = true, example = "1024") - @PreAuthorize("@ss.hasPermission('lms:box-type:query')") - public CommonResult getBoxType(@RequestParam("id") String id) { - BoxTypeDO boxType = boxTypeService.getBoxType(id); - return success(BeanUtils.toBean(boxType, BoxTypeRespVO.class)); - } - - @GetMapping("/page") - @Operation(summary = "获得木箱类型分页") - @PreAuthorize("@ss.hasPermission('lms:box-type:query')") - public CommonResult> getBoxTypePage(@Valid BoxTypePageReqVO pageReqVO) { - PageResult pageResult = boxTypeService.getBoxTypePage(pageReqVO); - return success(BeanUtils.toBean(pageResult, BoxTypeRespVO.class)); - } - - @GetMapping("/export-excel") - @Operation(summary = "导出木箱类型 Excel") - @PreAuthorize("@ss.hasPermission('lms:box-type:export')") - @ApiAccessLog(operateType = EXPORT) - public void exportBoxTypeExcel(@Valid BoxTypePageReqVO pageReqVO, - HttpServletResponse response) throws IOException { - pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); - List list = boxTypeService.getBoxTypePage(pageReqVO).getList(); - // 导出 Excel - ExcelUtils.write(response, "木箱类型.xls", "数据", BoxTypeRespVO.class, - BeanUtils.toBean(list, BoxTypeRespVO.class)); - } - -} diff --git a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/controller/admin/boxtype/vo/BoxTypePageReqVO.java b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/controller/admin/boxtype/vo/BoxTypePageReqVO.java deleted file mode 100644 index c66e0a0f..00000000 --- a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/controller/admin/boxtype/vo/BoxTypePageReqVO.java +++ /dev/null @@ -1,25 +0,0 @@ -package cn.code.nl.module.lms.controller.admin.boxtype.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; - -@Schema(description = "管理后台 - 木箱类型分页 Request VO") -@Data -public class BoxTypePageReqVO extends PageParam { - - @Schema(description = "木箱类型", example = "2") - private String boxType; - - @Schema(description = "木箱描述", example = "张三") - private String boxName; - - @Schema(description = "是否一次捆扎") - private Boolean needLashOne; - - @Schema(description = "是否二次捆扎") - private Boolean needLashTwo; - -} \ No newline at end of file diff --git a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/controller/admin/boxtype/vo/BoxTypeRespVO.java b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/controller/admin/boxtype/vo/BoxTypeRespVO.java deleted file mode 100644 index bfb25427..00000000 --- a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/controller/admin/boxtype/vo/BoxTypeRespVO.java +++ /dev/null @@ -1,76 +0,0 @@ -package cn.code.nl.module.lms.controller.admin.boxtype.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; -import java.math.BigDecimal; -import cn.idev.excel.annotation.*; -import cn.code.nl.framework.excel.core.annotations.DictFormat; -import cn.code.nl.framework.excel.core.convert.DictConvert; - -@Schema(description = "管理后台 - 木箱类型 Response VO") -@Data -@ExcelIgnoreUnannotated -public class BoxTypeRespVO { - - private Long id; - - @Schema(description = "木箱类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") - @ExcelProperty("木箱类型") - private String boxType; - - @Schema(description = "木箱描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") - @ExcelProperty("木箱描述") - private String boxName; - - @Schema(description = "木箱长度") - @ExcelProperty("木箱长度") - private Integer boxLength; - - @Schema(description = "木箱宽度") - @ExcelProperty("木箱宽度") - private Integer boxWidth; - - @Schema(description = "木箱高度") - @ExcelProperty("木箱高度") - private Integer boxHigh; - - @Schema(description = "最大子卷数", requiredMode = Schema.RequiredMode.REQUIRED) - @ExcelProperty("最大子卷数") - private Integer maxNum; - - @Schema(description = "捆扎模版") - @ExcelProperty("捆扎模版") - private String lashNum; - - @Schema(description = "一次捆扎次数") - @ExcelProperty("一次捆扎次数") - private Integer lashNumOne; - - @Schema(description = "二次捆扎次数") - @ExcelProperty("二次捆扎次数") - private Integer lashNumTwo; - - @Schema(description = "是否一次捆扎") - @ExcelProperty(value = "是否一次捆扎", converter = DictConvert.class) - @DictFormat("infra_boolean_string") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 - private Boolean needLashOne; - - @Schema(description = "是否二次捆扎") - @ExcelProperty(value = "是否二次捆扎", converter = DictConvert.class) - @DictFormat("infra_boolean_string") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 - private Boolean needLashTwo; - - @Schema(description = "叉车取货宽度") - @ExcelProperty("叉车取货宽度") - private BigDecimal expendWidth; - - @Schema(description = "木箱结构") - @ExcelProperty("木箱结构") - private String boxStructure; - - @Schema(description = "干燥剂数量", requiredMode = Schema.RequiredMode.REQUIRED) - @ExcelProperty("干燥剂数量") - private Integer desiccantNum; - -} diff --git a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/controller/admin/boxtype/vo/BoxTypeSaveReqVO.java b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/controller/admin/boxtype/vo/BoxTypeSaveReqVO.java deleted file mode 100644 index 36c68b84..00000000 --- a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/controller/admin/boxtype/vo/BoxTypeSaveReqVO.java +++ /dev/null @@ -1,87 +0,0 @@ -package cn.code.nl.module.lms.controller.admin.boxtype.vo; - -import java.io.IOException; -import java.math.BigDecimal; -import java.util.*; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.core.exc.InputCoercionException; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonDeserializer; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.exc.InvalidFormatException; -import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.validation.constraints.*; -import lombok.*; - -@Schema(description = "管理后台 - 木箱类型新增/修改 Request VO") -@Data -public class BoxTypeSaveReqVO { - - private Long id; - - @Schema(description = "木箱类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") - private String boxType; - @Schema(description = "木箱描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") - private String boxName; - - @Schema(description = "木箱长度") - private Integer boxLength; - - @Schema(description = "木箱宽度") - private Integer boxWidth; - - @Schema(description = "木箱高度") - private Integer boxHigh; - - @Schema(description = "最大子卷数", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "最大子卷数不能为空") - @Min(value = 1, message = "最大子卷数不能小于1") - @JsonDeserialize(using = StrictIntegerDeserializer.class) - private Integer maxNum; - - @Schema(description = "捆扎模版") - private String lashNum; - - @Schema(description = "一次捆扎次数") - private Integer lashNumOne; - - @Schema(description = "二次捆扎次数") - private Integer lashNumTwo; - - @Schema(description = "是否一次捆扎") - private Boolean needLashOne; - - @Schema(description = "是否二次捆扎") - private Boolean needLashTwo; - - @Schema(description = "叉车取货宽度") - private BigDecimal expendWidth; - - @Schema(description = "木箱结构") - private String boxStructure; - - @Schema(description = "干燥剂数量", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "干燥剂数量不能为空") - private Integer desiccantNum; - - /** - * 严格限制 JSON 数字必须为整数,避免小数被 Jackson 截断。 - */ - private static class StrictIntegerDeserializer extends JsonDeserializer { - - @Override - public Integer deserialize(JsonParser parser, DeserializationContext context) throws IOException { - if (!parser.hasToken(JsonToken.VALUE_NUMBER_INT)) { - throw InvalidFormatException.from(parser, "最大子卷数必须为整数", parser.getText(), Integer.class); - } - try { - return parser.getIntValue(); - } catch (InputCoercionException exception) { - throw InvalidFormatException.from(parser, "最大子卷数超出整数范围", parser.getText(), Integer.class); - } - } - } - -} diff --git a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/dal/dataobject/boxtype/BoxTypeDO.java b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/dal/dataobject/boxtype/BoxTypeDO.java deleted file mode 100644 index b6d5edf9..00000000 --- a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/dal/dataobject/boxtype/BoxTypeDO.java +++ /dev/null @@ -1,92 +0,0 @@ -package cn.code.nl.module.lms.dal.dataobject.boxtype; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.KeySequence; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.*; - -import java.math.BigDecimal; - -/** - * 木箱类型 DO - * - * @author 诺力管理员 - */ -@TableName("lms_box_type") -@KeySequence("lms_box_type_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 -@Data -@ToString(callSuper = true) -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class BoxTypeDO { - - /** - * 木箱类型id - */ - @TableId - private Long id; - /** - * 木箱类型 - */ - private String boxType; - /** - * 木箱描述 - */ - private String boxName; - /** - * 木箱长度 - */ - private Integer boxLength; - /** - * 木箱宽度 - */ - private Integer boxWidth; - /** - * 木箱高度 - */ - private Integer boxHigh; - /** - * 最大子卷数 - */ - private Integer maxNum; - /** - * 捆扎模版 - */ - private String lashNum; - /** - * 一次捆扎次数 - */ - private Integer lashNumOne; - /** - * 二次捆扎次数 - */ - private Integer lashNumTwo; - /** - * 是否一次捆扎 - * - * 枚举 {@link TODO infra_boolean_string 对应的类} - */ - private Boolean needLashOne; - /** - * 是否二次捆扎 - * - * 枚举 {@link TODO infra_boolean_string 对应的类} - */ - private Boolean needLashTwo; - /** - * 叉车取货宽度 - */ - private BigDecimal expendWidth; - /** - * 木箱结构 - */ - private String boxStructure; - /** - * 干燥剂数量 - */ - private Integer desiccantNum; - - -} diff --git a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/dal/mysql/boxtype/BoxTypeMapper.java b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/dal/mysql/boxtype/BoxTypeMapper.java deleted file mode 100644 index a8ba0cce..00000000 --- a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/dal/mysql/boxtype/BoxTypeMapper.java +++ /dev/null @@ -1,40 +0,0 @@ -package cn.code.nl.module.lms.dal.mysql.boxtype; - -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.lms.dal.dataobject.boxtype.BoxTypeDO; -import org.apache.ibatis.annotations.Mapper; -import cn.code.nl.module.lms.controller.admin.boxtype.vo.*; - -/** - * 木箱类型 Mapper - * - * @author 诺力管理员 - */ -@Mapper -public interface BoxTypeMapper extends BaseMapperX { - - default PageResult selectPage(BoxTypePageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .eqIfPresent(BoxTypeDO::getBoxType, reqVO.getBoxType()) - .likeIfPresent(BoxTypeDO::getBoxName, reqVO.getBoxName()) - .eqIfPresent(BoxTypeDO::getNeedLashOne, reqVO.getNeedLashOne()) - .eqIfPresent(BoxTypeDO::getNeedLashTwo, reqVO.getNeedLashTwo()) - .orderByDesc(BoxTypeDO::getId)); - } - - default BoxTypeDO selectByBoxType(String boxType) { - return selectOne(BoxTypeDO::getBoxType, boxType); - } - - /** - * 根据木箱料号集合查询木箱类型 - */ - default List selectListByBoxTypes(Collection boxTypes) { - return selectList(BoxTypeDO::getBoxType, boxTypes); - } - -} diff --git a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/framwork/rpc/config/RpcConfiguration.java b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/framwork/rpc/config/RpcConfiguration.java index 68788d33..43a191a8 100644 --- a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/framwork/rpc/config/RpcConfiguration.java +++ b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/framwork/rpc/config/RpcConfiguration.java @@ -3,6 +3,7 @@ package cn.code.nl.module.lms.framwork.rpc.config; import cn.code.nl.module.base.api.codegen.CodeGenApi; import cn.code.nl.module.base.api.materialbase.MaterialBaseApi; import cn.code.nl.module.task.api.TransportTaskApi; +import cn.code.nl.module.wms.api.boxtype.BoxTypeApi; import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.context.annotation.Configuration; @@ -11,6 +12,6 @@ import org.springframework.context.annotation.Configuration; * 业务 API 的 Feign Client 在此处声明注册,后续新增的业务 Feign 接口需追加到 clients 列表 */ @Configuration(value = "lmsRpcConfiguration", proxyBeanMethods = false) -@EnableFeignClients(clients = {MaterialBaseApi.class, TransportTaskApi.class, CodeGenApi.class}) +@EnableFeignClients(clients = {MaterialBaseApi.class, TransportTaskApi.class, CodeGenApi.class, BoxTypeApi.class}) public class RpcConfiguration { } diff --git a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/service/boxtype/BoxTypeService.java b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/service/boxtype/BoxTypeService.java deleted file mode 100644 index 82caeee6..00000000 --- a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/service/boxtype/BoxTypeService.java +++ /dev/null @@ -1,62 +0,0 @@ -package cn.code.nl.module.lms.service.boxtype; - -import java.util.*; -import jakarta.validation.*; -import cn.code.nl.module.lms.controller.admin.boxtype.vo.*; -import cn.code.nl.module.lms.dal.dataobject.boxtype.BoxTypeDO; -import cn.code.nl.framework.common.pojo.PageResult; -import cn.code.nl.framework.common.pojo.PageParam; - -/** - * 木箱类型 Service 接口 - * - * @author 诺力管理员 - */ -public interface BoxTypeService { - - /** - * 创建木箱类型 - * - * @param createReqVO 创建信息 - * @return 编号 - */ - Long createBoxType(@Valid BoxTypeSaveReqVO createReqVO); - - /** - * 更新木箱类型 - * - * @param updateReqVO 更新信息 - */ - void updateBoxType(@Valid BoxTypeSaveReqVO updateReqVO); - - /** - * 删除木箱类型 - * - * @param id 编号 - */ - void deleteBoxType(String id); - - /** - * 批量删除木箱类型 - * - * @param ids 编号 - */ - void deleteBoxTypeListByIds(List ids); - - /** - * 获得木箱类型 - * - * @param id 编号 - * @return 木箱类型 - */ - BoxTypeDO getBoxType(String id); - - /** - * 获得木箱类型分页 - * - * @param pageReqVO 分页查询 - * @return 木箱类型分页 - */ - PageResult getBoxTypePage(BoxTypePageReqVO pageReqVO); - -} diff --git a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/service/boxtype/BoxTypeServiceImpl.java b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/service/boxtype/BoxTypeServiceImpl.java deleted file mode 100644 index 8425cd07..00000000 --- a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/service/boxtype/BoxTypeServiceImpl.java +++ /dev/null @@ -1,93 +0,0 @@ -package cn.code.nl.module.lms.service.boxtype; - -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.lms.controller.admin.boxtype.vo.*; -import cn.code.nl.module.lms.dal.dataobject.boxtype.BoxTypeDO; -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.lms.dal.mysql.boxtype.BoxTypeMapper; - -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.lms.enums.ErrorCodeConstants.*; - -/** - * 木箱类型 Service 实现类 - * - * @author 诺力管理员 - */ -@Service -@Validated -public class BoxTypeServiceImpl implements BoxTypeService { - - @Resource - private BoxTypeMapper boxTypeMapper; - - @Override - public Long createBoxType(BoxTypeSaveReqVO createReqVO) { - // 校验唯一性 - validateBoxTypeUnique(createReqVO.getBoxType()); - // 插入 - BoxTypeDO boxType = BeanUtils.toBean(createReqVO, BoxTypeDO.class); - boxTypeMapper.insert(boxType); - - // 返回 - return boxType.getId(); - } - - private void validateBoxTypeUnique(String boxType) { - if (boxTypeMapper.selectByBoxType(boxType) != null) { - throw exception(BOX_TYPE_EXISTS); - } - } - - @Override - public void updateBoxType(BoxTypeSaveReqVO updateReqVO) { - // 校验存在 - validateBoxTypeExists(String.valueOf(updateReqVO.getId())); - // 更新 - BoxTypeDO updateObj = BeanUtils.toBean(updateReqVO, BoxTypeDO.class); - boxTypeMapper.updateById(updateObj); - } - - @Override - public void deleteBoxType(String id) { - // 校验存在 - validateBoxTypeExists(id); - // 删除 - boxTypeMapper.deleteById(id); - } - - @Override - public void deleteBoxTypeListByIds(List ids) { - // 删除 - boxTypeMapper.deleteByIds(ids); - } - - - private void validateBoxTypeExists(String id) { - if (boxTypeMapper.selectById(id) == null) { - throw exception(BOX_TYPE_NOT_EXISTS); - } - } - - @Override - public BoxTypeDO getBoxType(String id) { - return boxTypeMapper.selectById(id); - } - - @Override - public PageResult getBoxTypePage(BoxTypePageReqVO pageReqVO) { - return boxTypeMapper.selectPage(pageReqVO); - } - -} diff --git a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/service/subpackagerelation/SubPackageRelationServiceImpl.java b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/service/subpackagerelation/SubPackageRelationServiceImpl.java index a9265299..14c3fa7c 100644 --- a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/service/subpackagerelation/SubPackageRelationServiceImpl.java +++ b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/service/subpackagerelation/SubPackageRelationServiceImpl.java @@ -1,8 +1,11 @@ package cn.code.nl.module.lms.service.subpackagerelation; import cn.hutool.core.collection.CollUtil; -import cn.code.nl.module.lms.dal.dataobject.boxtype.BoxTypeDO; -import cn.code.nl.module.lms.dal.mysql.boxtype.BoxTypeMapper; +import cn.hutool.json.JSONUtil; +import cn.code.nl.framework.common.exception.ServiceException; +import cn.code.nl.framework.common.pojo.CommonResult; +import cn.code.nl.module.wms.api.boxtype.BoxTypeApi; +import cn.code.nl.module.wms.api.boxtype.dto.BoxTypeResp; import cn.code.nl.module.lms.dal.mysql.slittingproductionplan.SlittingproductionplanMapper; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -54,9 +57,9 @@ public class SubPackageRelationServiceImpl implements SubPackageRelationService @Resource private SubPackageRelationMapper subPackageRelationMapper; - /** 木箱类型数据访问对象 */ + /** WMS 木箱类型内部接口 */ @Resource - private BoxTypeMapper boxTypeMapper; + private BoxTypeApi boxTypeApi; /** 分切生产计划数据访问对象 */ @Resource @@ -199,8 +202,14 @@ public class SubPackageRelationServiceImpl implements SubPackageRelationService Set boxTypes = validItems.stream() .map(context -> context.item().getBoxType()) .collect(Collectors.toCollection(LinkedHashSet::new)); - Map boxTypeMap = boxTypeMapper.selectListByBoxTypes(boxTypes).stream() - .collect(Collectors.toMap(BoxTypeDO::getBoxType, Function.identity())); + CommonResult> boxTypeResult = boxTypeApi.getByBoxTypes(boxTypes); + if (!boxTypeResult.isSuccess()) { + log.error("查询WMS木箱类型失败,boxTypes={},WMS返回信息={}", + JSONUtil.toJsonStr(boxTypes), JSONUtil.toJsonStr(boxTypeResult)); + throw new ServiceException(boxTypeResult.getCode(), boxTypeResult.getMsg()); + } + Map boxTypeMap = boxTypeResult.getData().stream() + .collect(Collectors.toMap(BoxTypeResp::getBoxType, Function.identity())); Map> groups = validItems.stream() .collect(Collectors.groupingBy(context -> new GroupKey(context.item().getPackageBoxSn(), context.item().getBoxType()), LinkedHashMap::new, Collectors.toList())); @@ -229,7 +238,7 @@ public class SubPackageRelationServiceImpl implements SubPackageRelationService } continue; } - BoxTypeDO boxType = boxTypeMap.get(key.boxType()); + BoxTypeResp boxType = boxTypeMap.get(key.boxType()); if (boxType == null) { for (BatchItemContext context : group) { failures.add(buildFailure(context.item().getClientKey(), context.rowIndex(), BOX_TYPE_NOT_FOUND, diff --git a/nl-module-lms/nl-module-lms-server/src/main/resources/mapper/boxtype/BoxTypeMapper.xml b/nl-module-lms/nl-module-lms-server/src/main/resources/mapper/boxtype/BoxTypeMapper.xml deleted file mode 100644 index 2ef45a15..00000000 --- a/nl-module-lms/nl-module-lms-server/src/main/resources/mapper/boxtype/BoxTypeMapper.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/nl-module-wms/nl-module-wms-api/src/main/java/cn/code/nl/module/wms/api/boxtype/BoxTypeApi.java b/nl-module-wms/nl-module-wms-api/src/main/java/cn/code/nl/module/wms/api/boxtype/BoxTypeApi.java new file mode 100644 index 00000000..857424cd --- /dev/null +++ b/nl-module-wms/nl-module-wms-api/src/main/java/cn/code/nl/module/wms/api/boxtype/BoxTypeApi.java @@ -0,0 +1,30 @@ +package cn.code.nl.module.wms.api.boxtype; + +import cn.code.nl.framework.common.pojo.CommonResult; +import cn.code.nl.module.wms.api.boxtype.dto.BoxTypeResp; +import cn.code.nl.module.wms.enums.ApiConstants; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.Collection; +import java.util.List; + +/** + * 木箱类型内部接口。 + */ +@FeignClient(name = ApiConstants.NAME) +public interface BoxTypeApi { + + String PREFIX = ApiConstants.PREFIX + "/box-type"; + + /** 按木箱类型查询。 */ + @GetMapping(PREFIX + "/getByBoxType") + CommonResult getByBoxType(@RequestParam("boxType") String boxType); + + /** 按木箱类型集合批量查询。 */ + @PostMapping(PREFIX + "/getByBoxTypes") + CommonResult> getByBoxTypes(@RequestBody Collection boxTypes); +} diff --git a/nl-module-wms/nl-module-wms-api/src/main/java/cn/code/nl/module/wms/api/boxtype/dto/BoxTypeResp.java b/nl-module-wms/nl-module-wms-api/src/main/java/cn/code/nl/module/wms/api/boxtype/dto/BoxTypeResp.java new file mode 100644 index 00000000..b115867d --- /dev/null +++ b/nl-module-wms/nl-module-wms-api/src/main/java/cn/code/nl/module/wms/api/boxtype/dto/BoxTypeResp.java @@ -0,0 +1,43 @@ +package cn.code.nl.module.wms.api.boxtype.dto; + +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 木箱类型内部接口响应。 + */ +@Data +public class BoxTypeResp { + + /** 木箱类型 ID。 */ + private Long id; + /** 木箱类型。 */ + private String boxType; + /** 木箱描述。 */ + private String boxName; + /** 捆扎模板。 */ + private String lashNum; + /** 一次捆扎次数。 */ + private Integer lashNumOne; + /** 二次捆扎次数。 */ + private Integer lashNumTwo; + /** 是否一次捆扎。 */ + private Boolean needLashOne; + /** 是否二次捆扎。 */ + private Boolean needLashTwo; + /** 叉车取货宽度。 */ + private BigDecimal expendWidth; + /** 木箱结构。 */ + private String boxStructure; + /** 干燥剂数量。 */ + private Integer desiccantNum; + /** 木箱长度。 */ + private Integer boxLength; + /** 木箱宽度。 */ + private Integer boxWidth; + /** 木箱高度。 */ + private Integer boxHigh; + /** 最大子卷数。 */ + private Integer maxNum; +} diff --git a/nl-module-wms/nl-module-wms-api/src/main/java/cn/code/nl/module/wms/enums/ErrorCodeConstants.java b/nl-module-wms/nl-module-wms-api/src/main/java/cn/code/nl/module/wms/enums/ErrorCodeConstants.java index 5e0aae5f..989f07ea 100644 --- a/nl-module-wms/nl-module-wms-api/src/main/java/cn/code/nl/module/wms/enums/ErrorCodeConstants.java +++ b/nl-module-wms/nl-module-wms-api/src/main/java/cn/code/nl/module/wms/enums/ErrorCodeConstants.java @@ -57,4 +57,8 @@ public interface ErrorCodeConstants { // ========== 载具扩展属性信息 ========== ErrorCode STORAGE_VEHICLE_EXT_NOT_EXISTS = new ErrorCode(12, "载具扩展属性信息不存在"); + + // ========== 木箱类型相关错误码 ========== + ErrorCode BOX_TYPE_NOT_EXISTS = new ErrorCode(6_003_0, "木箱类型不存在"); + ErrorCode BOX_TYPE_EXISTS = new ErrorCode(6_003_1, "木箱类型已存在"); } diff --git a/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/api/boxtype/BoxTypeApiImpl.java b/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/api/boxtype/BoxTypeApiImpl.java new file mode 100644 index 00000000..ef8c2cef --- /dev/null +++ b/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/api/boxtype/BoxTypeApiImpl.java @@ -0,0 +1,62 @@ +package cn.code.nl.module.wms.api.boxtype; + +import cn.code.nl.framework.common.pojo.CommonResult; +import cn.code.nl.module.wms.api.boxtype.dto.BoxTypeResp; +import cn.code.nl.module.wms.dal.dataobject.boxtype.BoxTypeDO; +import cn.code.nl.module.wms.service.boxtype.BoxTypeService; +import jakarta.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Collection; +import java.util.List; + +import static cn.code.nl.framework.common.pojo.CommonResult.success; + +/** + * 木箱类型内部接口实现。 + */ +@RestController +@Validated +public class BoxTypeApiImpl implements BoxTypeApi { + + /** 木箱类型服务。 */ + @Resource + private BoxTypeService boxTypeService; + + /** 按木箱类型查询。 */ + @Override + public CommonResult getByBoxType(String boxType) { + return success(convert(boxTypeService.getByBoxType(boxType))); + } + + /** 按木箱类型集合批量查询。 */ + @Override + public CommonResult> getByBoxTypes(Collection boxTypes) { + return success(boxTypeService.getByBoxTypes(boxTypes).stream().map(this::convert).toList()); + } + + /** 将木箱类型数据对象转换为内部响应。 */ + private BoxTypeResp convert(BoxTypeDO source) { + if (source == null) { + return null; + } + BoxTypeResp target = new BoxTypeResp(); + target.setId(source.getId()); + target.setBoxType(source.getBoxType()); + target.setBoxName(source.getBoxName()); + target.setLashNum(source.getLashNum()); + target.setLashNumOne(source.getLashNumOne()); + target.setLashNumTwo(source.getLashNumTwo()); + target.setNeedLashOne(source.getNeedLashOne()); + target.setNeedLashTwo(source.getNeedLashTwo()); + target.setExpendWidth(source.getExpendWidth()); + target.setBoxStructure(source.getBoxStructure()); + target.setDesiccantNum(source.getDesiccantNum()); + target.setBoxLength(source.getBoxLength()); + target.setBoxWidth(source.getBoxWidth()); + target.setBoxHigh(source.getBoxHigh()); + target.setMaxNum(source.getMaxNum()); + return target; + } +} diff --git a/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/controller/admin/boxtype/BoxTypeController.java b/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/controller/admin/boxtype/BoxTypeController.java new file mode 100644 index 00000000..89a9d87c --- /dev/null +++ b/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/controller/admin/boxtype/BoxTypeController.java @@ -0,0 +1,139 @@ +package cn.code.nl.module.wms.controller.admin.boxtype; + +import cn.code.nl.framework.apilog.core.annotation.ApiAccessLog; +import cn.code.nl.framework.common.pojo.CommonResult; +import cn.code.nl.framework.common.pojo.PageParam; +import cn.code.nl.framework.common.pojo.PageResult; +import cn.code.nl.framework.excel.core.util.ExcelUtils; +import cn.code.nl.module.wms.controller.admin.boxtype.vo.BoxTypeCreateReqVO; +import cn.code.nl.module.wms.controller.admin.boxtype.vo.BoxTypePageReqVO; +import cn.code.nl.module.wms.controller.admin.boxtype.vo.BoxTypeRespVO; +import cn.code.nl.module.wms.controller.admin.boxtype.vo.BoxTypeUpdateReqVO; +import cn.code.nl.module.wms.dal.dataobject.boxtype.BoxTypeDO; +import cn.code.nl.module.wms.service.boxtype.BoxTypeService; +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.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +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 static cn.code.nl.framework.apilog.core.enums.OperateTypeEnum.EXPORT; +import static cn.code.nl.framework.common.pojo.CommonResult.success; + +/** + * 木箱类型管理接口。 + */ +@Tag(name = "管理后台 - 木箱类型") +@RestController +@RequestMapping("/wms/box-type") +@Validated +public class BoxTypeController { + + /** 木箱类型服务。 */ + @Resource + private BoxTypeService boxTypeService; + + /** 创建木箱类型。 */ + @PostMapping("/create") + @Operation(summary = "创建木箱类型") + @PreAuthorize("@ss.hasPermission('wms:box-type:create')") + public CommonResult createBoxType(@Valid @RequestBody BoxTypeCreateReqVO reqVO) { + return success(boxTypeService.createBoxType(reqVO)); + } + + /** 修改木箱类型。 */ + @PutMapping("/update") + @Operation(summary = "修改木箱类型") + @PreAuthorize("@ss.hasPermission('wms:box-type:update')") + public CommonResult updateBoxType(@Valid @RequestBody BoxTypeUpdateReqVO reqVO) { + boxTypeService.updateBoxType(reqVO); + return success(true); + } + + /** 删除木箱类型。 */ + @DeleteMapping("/delete") + @Operation(summary = "删除木箱类型") + @Parameter(name = "id", description = "木箱类型ID", required = true) + @PreAuthorize("@ss.hasPermission('wms:box-type:delete')") + public CommonResult deleteBoxType(@RequestParam("id") Long id) { + boxTypeService.deleteBoxType(id); + return success(true); + } + + /** 批量删除木箱类型。 */ + @DeleteMapping("/delete-list") + @Operation(summary = "批量删除木箱类型") + @PreAuthorize("@ss.hasPermission('wms:box-type:delete')") + public CommonResult deleteBoxTypes(@RequestParam("ids") List ids) { + boxTypeService.deleteBoxTypes(ids); + return success(true); + } + + /** 查询木箱类型详情。 */ + @GetMapping("/get") + @Operation(summary = "查询木箱类型详情") + @PreAuthorize("@ss.hasPermission('wms:box-type:query')") + public CommonResult getBoxType(@RequestParam("id") Long id) { + return success(convert(boxTypeService.getBoxType(id))); + } + + /** 分页查询木箱类型。 */ + @GetMapping("/page") + @Operation(summary = "分页查询木箱类型") + @PreAuthorize("@ss.hasPermission('wms:box-type:query')") + public CommonResult> getBoxTypePage(@Valid BoxTypePageReqVO reqVO) { + PageResult page = boxTypeService.getBoxTypePage(reqVO); + return success(new PageResult<>(page.getList().stream().map(this::convert).toList(), page.getTotal())); + } + + /** 导出木箱类型。 */ + @GetMapping("/export-excel") + @Operation(summary = "导出木箱类型") + @PreAuthorize("@ss.hasPermission('wms:box-type:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportBoxTypeExcel(@Valid BoxTypePageReqVO reqVO, + HttpServletResponse response) throws IOException { + reqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = boxTypeService.getBoxTypePage(reqVO).getList() + .stream().map(this::convert).toList(); + ExcelUtils.write(response, "木箱类型.xls", "数据", BoxTypeRespVO.class, list); + } + + /** 将数据对象转换为响应对象。 */ + private BoxTypeRespVO convert(BoxTypeDO source) { + if (source == null) { + return null; + } + BoxTypeRespVO target = new BoxTypeRespVO(); + target.setId(source.getId()); + target.setBoxType(source.getBoxType()); + target.setBoxName(source.getBoxName()); + target.setLashNum(source.getLashNum()); + target.setLashNumOne(source.getLashNumOne()); + target.setLashNumTwo(source.getLashNumTwo()); + target.setNeedLashOne(source.getNeedLashOne()); + target.setNeedLashTwo(source.getNeedLashTwo()); + target.setExpendWidth(source.getExpendWidth()); + target.setBoxStructure(source.getBoxStructure()); + target.setDesiccantNum(source.getDesiccantNum()); + target.setBoxLength(source.getBoxLength()); + target.setBoxWidth(source.getBoxWidth()); + target.setBoxHigh(source.getBoxHigh()); + target.setMaxNum(source.getMaxNum()); + return target; + } +} diff --git a/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/controller/admin/boxtype/vo/BoxTypeCreateReqVO.java b/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/controller/admin/boxtype/vo/BoxTypeCreateReqVO.java new file mode 100644 index 00000000..a3de7f75 --- /dev/null +++ b/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/controller/admin/boxtype/vo/BoxTypeCreateReqVO.java @@ -0,0 +1,67 @@ +package cn.code.nl.module.wms.controller.admin.boxtype.vo; + +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 木箱类型新增请求。 + */ +@Data +public class BoxTypeCreateReqVO { + + /** 木箱类型。 */ + @NotBlank(message = "木箱类型不能为空") + @Size(max = 20, message = "木箱类型长度不能超过20个字符") + private String boxType; + + /** 木箱描述。 */ + @Size(max = 255, message = "木箱描述长度不能超过255个字符") + private String boxName; + + /** 捆扎模板。 */ + @Size(max = 1, message = "捆扎模板长度不能超过1个字符") + private String lashNum; + + /** 一次捆扎次数。 */ + private Integer lashNumOne; + + /** 二次捆扎次数。 */ + private Integer lashNumTwo; + + /** 是否一次捆扎。 */ + private Boolean needLashOne; + + /** 是否二次捆扎。 */ + private Boolean needLashTwo; + + /** 叉车取货宽度。 */ + private BigDecimal expendWidth; + + /** 木箱结构。 */ + @Size(max = 10, message = "木箱结构长度不能超过10个字符") + private String boxStructure; + + /** 干燥剂数量。 */ + @NotNull(message = "干燥剂数量不能为空") + @Min(value = 0, message = "干燥剂数量不能小于0") + private Integer desiccantNum; + + /** 木箱长度。 */ + private Integer boxLength; + + /** 木箱宽度。 */ + private Integer boxWidth; + + /** 木箱高度。 */ + private Integer boxHigh; + + /** 最大子卷数。 */ + @NotNull(message = "最大子卷数不能为空") + @Min(value = 1, message = "最大子卷数不能小于1") + private Integer maxNum; +} diff --git a/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/controller/admin/boxtype/vo/BoxTypePageReqVO.java b/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/controller/admin/boxtype/vo/BoxTypePageReqVO.java new file mode 100644 index 00000000..0842c815 --- /dev/null +++ b/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/controller/admin/boxtype/vo/BoxTypePageReqVO.java @@ -0,0 +1,25 @@ +package cn.code.nl.module.wms.controller.admin.boxtype.vo; + +import cn.code.nl.framework.common.pojo.PageParam; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 木箱类型分页请求。 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class BoxTypePageReqVO extends PageParam { + + /** 木箱类型。 */ + private String boxType; + + /** 木箱描述。 */ + private String boxName; + + /** 是否一次捆扎。 */ + private Boolean needLashOne; + + /** 是否二次捆扎。 */ + private Boolean needLashTwo; +} diff --git a/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/controller/admin/boxtype/vo/BoxTypeRespVO.java b/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/controller/admin/boxtype/vo/BoxTypeRespVO.java new file mode 100644 index 00000000..89389b32 --- /dev/null +++ b/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/controller/admin/boxtype/vo/BoxTypeRespVO.java @@ -0,0 +1,78 @@ +package cn.code.nl.module.wms.controller.admin.boxtype.vo; + +import cn.code.nl.framework.excel.core.annotations.DictFormat; +import cn.code.nl.framework.excel.core.convert.DictConvert; +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; +import cn.idev.excel.annotation.ExcelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 木箱类型响应。 + */ +@Data +@ExcelIgnoreUnannotated +public class BoxTypeRespVO { + + /** 木箱类型 ID。 */ + private Long id; + + /** 木箱类型。 */ + @ExcelProperty("木箱类型") + private String boxType; + + /** 木箱描述。 */ + @ExcelProperty("木箱描述") + private String boxName; + + /** 捆扎模板。 */ + @ExcelProperty("捆扎模板") + private String lashNum; + + /** 一次捆扎次数。 */ + @ExcelProperty("一次捆扎次数") + private Integer lashNumOne; + + /** 二次捆扎次数。 */ + @ExcelProperty("二次捆扎次数") + private Integer lashNumTwo; + + /** 是否一次捆扎。 */ + @ExcelProperty(value = "是否一次捆扎", converter = DictConvert.class) + @DictFormat("infra_boolean_string") + private Boolean needLashOne; + + /** 是否二次捆扎。 */ + @ExcelProperty(value = "是否二次捆扎", converter = DictConvert.class) + @DictFormat("infra_boolean_string") + private Boolean needLashTwo; + + /** 叉车取货宽度。 */ + @ExcelProperty("叉车取货宽度") + private BigDecimal expendWidth; + + /** 木箱结构。 */ + @ExcelProperty("木箱结构") + private String boxStructure; + + /** 干燥剂数量。 */ + @ExcelProperty("干燥剂数量") + private Integer desiccantNum; + + /** 木箱长度。 */ + @ExcelProperty("木箱长度") + private Integer boxLength; + + /** 木箱宽度。 */ + @ExcelProperty("木箱宽度") + private Integer boxWidth; + + /** 木箱高度。 */ + @ExcelProperty("木箱高度") + private Integer boxHigh; + + /** 最大子卷数。 */ + @ExcelProperty("最大子卷数") + private Integer maxNum; +} diff --git a/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/controller/admin/boxtype/vo/BoxTypeUpdateReqVO.java b/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/controller/admin/boxtype/vo/BoxTypeUpdateReqVO.java new file mode 100644 index 00000000..c7e66dfe --- /dev/null +++ b/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/controller/admin/boxtype/vo/BoxTypeUpdateReqVO.java @@ -0,0 +1,17 @@ +package cn.code.nl.module.wms.controller.admin.boxtype.vo; + +import jakarta.validation.constraints.NotNull; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 木箱类型修改请求。 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class BoxTypeUpdateReqVO extends BoxTypeCreateReqVO { + + /** 木箱类型 ID。 */ + @NotNull(message = "木箱类型ID不能为空") + private Long id; +} diff --git a/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/dal/dataobject/boxtype/BoxTypeDO.java b/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/dal/dataobject/boxtype/BoxTypeDO.java index bdcf134d..446d1f8d 100644 --- a/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/dal/dataobject/boxtype/BoxTypeDO.java +++ b/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/dal/dataobject/boxtype/BoxTypeDO.java @@ -1,22 +1,34 @@ package cn.code.nl.module.wms.dal.dataobject.boxtype; +import cn.code.nl.framework.tenant.core.aop.TenantIgnore; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; +import java.math.BigDecimal; + /** - * 木箱规格数据对象。 + * 木箱类型数据对象。 */ @Data -@TableName("wms_boxtype") +@TableName("wms_box_type") +@TenantIgnore public class BoxTypeDO { @TableId private Long id; - private String materialCode; - private String materialName; + private String boxType; + private String boxName; private String lashNum; - private String boxLength; - private String boxWidth; - private String boxHeight; + private Integer lashNumOne; + private Integer lashNumTwo; + private Boolean needLashOne; + private Boolean needLashTwo; + private BigDecimal expendWidth; + private String boxStructure; + private Integer desiccantNum; + private Integer boxLength; + private Integer boxWidth; + private Integer boxHigh; + private Integer maxNum; } diff --git a/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/dal/mysql/boxtype/BoxTypeMapper.java b/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/dal/mysql/boxtype/BoxTypeMapper.java index 60a017d9..545cf8ac 100644 --- a/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/dal/mysql/boxtype/BoxTypeMapper.java +++ b/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/dal/mysql/boxtype/BoxTypeMapper.java @@ -1,17 +1,48 @@ package cn.code.nl.module.wms.dal.mysql.boxtype; +import cn.code.nl.framework.mybatis.core.mapper.BaseMapperX; +import cn.code.nl.framework.common.pojo.PageResult; +import cn.code.nl.framework.mybatis.core.util.MyBatisUtils; +import cn.code.nl.module.wms.controller.admin.boxtype.vo.BoxTypePageReqVO; import cn.code.nl.module.wms.dal.dataobject.boxtype.BoxTypeDO; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.Collection; +import java.util.List; + /** * 木箱规格 Mapper。 */ @Mapper -public interface BoxTypeMapper { +public interface BoxTypeMapper extends BaseMapperX { /** - * 根据规格编码查询木箱规格。 + * 分页查询木箱类型。 */ - BoxTypeDO selectByMaterialCode(@Param("materialCode") String materialCode); + default PageResult selectPage(BoxTypePageReqVO reqVO) { + Page page = selectPage(MyBatisUtils.buildPage(reqVO), reqVO); + return new PageResult<>(page.getRecords(), page.getTotal()); + } + + /** + * 执行木箱类型分页查询。 + */ + Page selectPage(Page page, @Param("reqVO") BoxTypePageReqVO reqVO); + + /** + * 根据木箱类型查询木箱类型信息。 + */ + BoxTypeDO selectByBoxType(@Param("boxType") String boxType); + + /** + * 根据木箱类型集合批量查询。 + */ + List selectByBoxTypes(@Param("boxTypes") Collection boxTypes); + + /** + * 查询指定主键中实际存在的记录数。 + */ + Long selectExistingCount(@Param("ids") Collection ids); } diff --git a/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/service/boxtype/BoxTypeService.java b/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/service/boxtype/BoxTypeService.java new file mode 100644 index 00000000..15bd9cc2 --- /dev/null +++ b/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/service/boxtype/BoxTypeService.java @@ -0,0 +1,41 @@ +package cn.code.nl.module.wms.service.boxtype; + +import cn.code.nl.framework.common.pojo.PageResult; +import cn.code.nl.module.wms.controller.admin.boxtype.vo.BoxTypeCreateReqVO; +import cn.code.nl.module.wms.controller.admin.boxtype.vo.BoxTypePageReqVO; +import cn.code.nl.module.wms.controller.admin.boxtype.vo.BoxTypeUpdateReqVO; +import cn.code.nl.module.wms.dal.dataobject.boxtype.BoxTypeDO; +import jakarta.validation.Valid; + +import java.util.Collection; +import java.util.List; + +/** + * 木箱类型服务。 + */ +public interface BoxTypeService { + + /** 创建木箱类型。 */ + Long createBoxType(@Valid BoxTypeCreateReqVO reqVO); + + /** 修改木箱类型。 */ + void updateBoxType(@Valid BoxTypeUpdateReqVO reqVO); + + /** 删除木箱类型。 */ + void deleteBoxType(Long id); + + /** 批量删除木箱类型。 */ + void deleteBoxTypes(Collection ids); + + /** 查询木箱类型详情。 */ + BoxTypeDO getBoxType(Long id); + + /** 分页查询木箱类型。 */ + PageResult getBoxTypePage(BoxTypePageReqVO reqVO); + + /** 按类型编码查询。 */ + BoxTypeDO getByBoxType(String boxType); + + /** 按类型编码批量查询。 */ + List getByBoxTypes(Collection boxTypes); +} diff --git a/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/service/boxtype/BoxTypeServiceImpl.java b/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/service/boxtype/BoxTypeServiceImpl.java new file mode 100644 index 00000000..6a134ffe --- /dev/null +++ b/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/service/boxtype/BoxTypeServiceImpl.java @@ -0,0 +1,136 @@ +package cn.code.nl.module.wms.service.boxtype; + +import cn.code.nl.framework.common.pojo.PageResult; +import cn.code.nl.module.wms.controller.admin.boxtype.vo.BoxTypeCreateReqVO; +import cn.code.nl.module.wms.controller.admin.boxtype.vo.BoxTypePageReqVO; +import cn.code.nl.module.wms.controller.admin.boxtype.vo.BoxTypeUpdateReqVO; +import cn.code.nl.module.wms.dal.dataobject.boxtype.BoxTypeDO; +import cn.code.nl.module.wms.dal.mysql.boxtype.BoxTypeMapper; +import cn.hutool.core.util.IdUtil; +import jakarta.annotation.Resource; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; +import org.springframework.validation.annotation.Validated; + +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; + +import static cn.code.nl.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.code.nl.module.wms.enums.ErrorCodeConstants.BOX_TYPE_EXISTS; +import static cn.code.nl.module.wms.enums.ErrorCodeConstants.BOX_TYPE_NOT_EXISTS; + +/** + * 木箱类型服务实现。 + */ +@Service +@Validated +public class BoxTypeServiceImpl implements BoxTypeService { + + /** 木箱类型 Mapper。 */ + @Resource + private BoxTypeMapper boxTypeMapper; + + /** 创建木箱类型。 */ + @Override + public Long createBoxType(BoxTypeCreateReqVO reqVO) { + if (boxTypeMapper.selectByBoxType(reqVO.getBoxType()) != null) { + throw exception(BOX_TYPE_EXISTS); + } + BoxTypeDO boxType = buildBoxType(reqVO); + boxType.setId(IdUtil.getSnowflakeNextId()); + boxTypeMapper.insert(boxType); + return boxType.getId(); + } + + /** 修改木箱类型。 */ + @Override + public void updateBoxType(BoxTypeUpdateReqVO reqVO) { + if (boxTypeMapper.selectById(reqVO.getId()) == null) { + throw exception(BOX_TYPE_NOT_EXISTS); + } + BoxTypeDO sameType = boxTypeMapper.selectByBoxType(reqVO.getBoxType()); + if (sameType != null && !sameType.getId().equals(reqVO.getId())) { + throw exception(BOX_TYPE_EXISTS); + } + BoxTypeDO update = buildBoxType(reqVO); + update.setId(reqVO.getId()); + boxTypeMapper.updateById(update); + } + + /** 删除木箱类型。 */ + @Override + public void deleteBoxType(Long id) { + if (boxTypeMapper.selectById(id) == null) { + throw exception(BOX_TYPE_NOT_EXISTS); + } + boxTypeMapper.deleteById(id); + } + + /** 批量删除木箱类型。 */ + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteBoxTypes(Collection ids) { + if (CollectionUtils.isEmpty(ids)) { + throw exception(BOX_TYPE_NOT_EXISTS); + } + int distinctIdCount = new HashSet<>(ids).size(); + if (boxTypeMapper.selectExistingCount(ids) != distinctIdCount) { + throw exception(BOX_TYPE_NOT_EXISTS); + } + boxTypeMapper.deleteByIds(ids); + } + + /** 查询木箱类型详情。 */ + @Override + public BoxTypeDO getBoxType(Long id) { + BoxTypeDO boxType = boxTypeMapper.selectById(id); + if (boxType == null) { + throw exception(BOX_TYPE_NOT_EXISTS); + } + return boxType; + } + + /** 分页查询木箱类型。 */ + @Override + public PageResult getBoxTypePage(BoxTypePageReqVO reqVO) { + return boxTypeMapper.selectPage(reqVO); + } + + /** 按类型编码查询。 */ + @Override + public BoxTypeDO getByBoxType(String boxType) { + return boxTypeMapper.selectByBoxType(boxType); + } + + /** 按类型编码批量查询。 */ + @Override + public List getByBoxTypes(Collection boxTypes) { + if (CollectionUtils.isEmpty(boxTypes)) { + return Collections.emptyList(); + } + return boxTypeMapper.selectByBoxTypes(boxTypes); + } + + /** 将新增或修改请求转换为数据对象。 */ + private BoxTypeDO buildBoxType(BoxTypeCreateReqVO reqVO) { + BoxTypeDO boxType = new BoxTypeDO(); + boxType.setBoxType(reqVO.getBoxType()); + boxType.setBoxName(reqVO.getBoxName()); + boxType.setLashNum(reqVO.getLashNum()); + boxType.setLashNumOne(reqVO.getLashNumOne()); + boxType.setLashNumTwo(reqVO.getLashNumTwo()); + boxType.setNeedLashOne(reqVO.getNeedLashOne()); + boxType.setNeedLashTwo(reqVO.getNeedLashTwo()); + boxType.setExpendWidth(reqVO.getExpendWidth()); + boxType.setBoxStructure(reqVO.getBoxStructure()); + boxType.setDesiccantNum(reqVO.getDesiccantNum()); + boxType.setBoxLength(reqVO.getBoxLength()); + boxType.setBoxWidth(reqVO.getBoxWidth()); + boxType.setBoxHigh(reqVO.getBoxHigh()); + boxType.setMaxNum(reqVO.getMaxNum()); + return boxType; + } +} diff --git a/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/service/emptybox/EmptyBoxServiceImpl.java b/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/service/emptybox/EmptyBoxServiceImpl.java index 312fa9c4..709506b1 100644 --- a/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/service/emptybox/EmptyBoxServiceImpl.java +++ b/nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/service/emptybox/EmptyBoxServiceImpl.java @@ -60,7 +60,7 @@ public class EmptyBoxServiceImpl implements EmptyBoxService { @Override @Transactional(rollbackFor = Exception.class) public EmptyBoxInboundCreateResp createInbound(EmptyBoxInboundCreateReq req) { - BoxTypeDO boxType = boxTypeMapper.selectByMaterialCode(req.getMaterialCode()); + BoxTypeDO boxType = boxTypeMapper.selectByBoxType(req.getMaterialCode()); if (boxType == null) { throw new ServiceException(500, "木箱规格不存在"); } @@ -120,7 +120,7 @@ public class EmptyBoxServiceImpl implements EmptyBoxService { @Override @Transactional(rollbackFor = Exception.class) public EmptyBoxOutboundCreateResp createOutbound(EmptyBoxOutboundCreateReq req) { - if (boxTypeMapper.selectByMaterialCode(req.getMaterialCode()) == null) { + if (boxTypeMapper.selectByBoxType(req.getMaterialCode()) == null) { throw new ServiceException(500, "木箱规格不存在"); } String reservationCode = generateReservationCode(); @@ -232,12 +232,12 @@ public class EmptyBoxServiceImpl implements EmptyBoxService { BoxInfoDO box = new BoxInfoDO(); box.setBoxId(IdUtil.getSnowflakeNextId()); box.setBoxNo(boxNo); - box.setMaterialCode(boxType.getMaterialCode()); - box.setMaterialName(boxType.getMaterialName()); + box.setMaterialCode(boxType.getBoxType()); + box.setMaterialName(boxType.getBoxName()); box.setNum("1"); - box.setBoxLength(boxType.getBoxLength()); - box.setBoxWidth(boxType.getBoxWidth()); - box.setBoxHigh(boxType.getBoxHeight()); + box.setBoxLength(boxType.getBoxLength() != null ? String.valueOf(boxType.getBoxLength()) : null); + box.setBoxWidth(boxType.getBoxWidth() != null ? String.valueOf(boxType.getBoxWidth()) : null); + box.setBoxHigh(boxType.getBoxHigh() != null ? String.valueOf(boxType.getBoxHigh()) : null); box.setInsertTime(LocalDateTime.now().format(TIME_FORMATTER)); box.setLashNum(boxType.getLashNum()); box.setIsPacking("0"); diff --git a/nl-module-wms/nl-module-wms-server/src/main/resources/mapper/boxtype/BoxTypeMapper.xml b/nl-module-wms/nl-module-wms-server/src/main/resources/mapper/boxtype/BoxTypeMapper.xml index b9e6571d..638efcaf 100644 --- a/nl-module-wms/nl-module-wms-server/src/main/resources/mapper/boxtype/BoxTypeMapper.xml +++ b/nl-module-wms/nl-module-wms-server/src/main/resources/mapper/boxtype/BoxTypeMapper.xml @@ -3,12 +3,58 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - SELECT id, material_code, material_name, lash_num, - box_length, box_width, box_height - FROM wms_boxtype - WHERE material_code = #{materialCode} + SELECT + FROM wms_box_type + WHERE box_type = #{boxType} + + + + + + + diff --git a/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/api/lms/boxtype/index.ts b/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/api/lms/boxtype/index.ts deleted file mode 100644 index 627e6f2c..00000000 --- a/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/api/lms/boxtype/index.ts +++ /dev/null @@ -1,68 +0,0 @@ -import type { PageParam, PageResult } from '@vben/request'; - -import { requestClient } from '#/api/request'; - -export namespace LmsBoxTypeApi { - /** 木箱类型信息 */ - export interface BoxType { - id?: number; // id - boxType: string; // 木箱类型 - boxName?: string; // 木箱描述 - boxLength?: number; // 木箱长度 - boxWidth?: number; // 木箱宽度 - boxHigh?: number; // 木箱高度 - maxNum: number; // 最大子卷数 - lashNum: string; // 捆扎模版 - lashNumOne: number; // 一次捆扎次数 - lashNumTwo: number; // 二次捆扎次数 - needLashOne: boolean; // 是否一次捆扎 - needLashTwo: boolean; // 是否二次捆扎 - expendWidth: number; // 叉车取货宽度 - boxStructure: string; // 木箱结构 - desiccantNum?: number; // 干燥剂数量 - } -} - -/** 查询木箱类型分页 */ -export function getBoxTypePage(params: PageParam) { - return requestClient.get>( - '/lms/box-type/page', - { params }, - ); -} - -/** 查询木箱类型详情 */ -export function getBoxType(id: number) { - return requestClient.get( - `/lms/box-type/get?id=${id}`, - ); -} - -/** 新增木箱类型 */ -export function createBoxType(data: LmsBoxTypeApi.BoxType) { - return requestClient.post('/lms/box-type/create', data); -} - -/** 修改木箱类型 */ -export function updateBoxType(data: LmsBoxTypeApi.BoxType) { - return requestClient.put('/lms/box-type/update', data); -} - -/** 删除木箱类型 */ -export function deleteBoxType(id: number) { - return requestClient.delete(`/lms/box-type/delete?id=${id}`); -} - -/** 批量删除木箱类型 */ -export function deleteBoxTypeList(ids: number[]) { - return requestClient.delete( - `/lms/box-type/delete-list?ids=${ids.join(',')}`, - ); -} - -/** 导出木箱类型 */ -export function exportBoxType(params: any) { - return requestClient.download('/lms/box-type/export-excel', { params }); -} - - diff --git a/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/api/wms/boxtype/index.ts b/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/api/wms/boxtype/index.ts new file mode 100644 index 00000000..59341645 --- /dev/null +++ b/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/api/wms/boxtype/index.ts @@ -0,0 +1,68 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace WmsBoxTypeApi { + export type ApiId = number | string; + + /** 木箱类型信息 */ + export interface BoxType { + id?: ApiId; + boxType: string; + boxName?: string; + lashNum?: string; + lashNumOne?: number; + lashNumTwo?: number; + needLashOne?: boolean; + needLashTwo?: boolean; + expendWidth?: number; + boxStructure?: string; + desiccantNum: number; + boxLength?: number; + boxWidth?: number; + boxHigh?: number; + maxNum: number; + } +} + +/** 查询木箱类型分页 */ +export function getBoxTypePage(params: PageParam) { + return requestClient.get>( + '/wms/box-type/page', + { params }, + ); +} + +/** 查询木箱类型详情 */ +export function getBoxType(id: WmsBoxTypeApi.ApiId) { + return requestClient.get( + `/wms/box-type/get?id=${id}`, + ); +} + +/** 新增木箱类型 */ +export function createBoxType(data: WmsBoxTypeApi.BoxType) { + return requestClient.post('/wms/box-type/create', data); +} + +/** 修改木箱类型 */ +export function updateBoxType(data: WmsBoxTypeApi.BoxType) { + return requestClient.put('/wms/box-type/update', data); +} + +/** 删除木箱类型 */ +export function deleteBoxType(id: WmsBoxTypeApi.ApiId) { + return requestClient.delete(`/wms/box-type/delete?id=${id}`); +} + +/** 批量删除木箱类型 */ +export function deleteBoxTypeList(ids: WmsBoxTypeApi.ApiId[]) { + return requestClient.delete( + `/wms/box-type/delete-list?ids=${ids.join(',')}`, + ); +} + +/** 导出木箱类型 */ +export function exportBoxType(params: PageParam) { + return requestClient.download('/wms/box-type/export-excel', { params }); +} diff --git a/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/lms/boxtype/components/BoxTypeSelectModal.vue b/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/lms/boxtype/components/BoxTypeSelectModal.vue index 98993c30..9a4586c2 100644 --- a/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/lms/boxtype/components/BoxTypeSelectModal.vue +++ b/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/lms/boxtype/components/BoxTypeSelectModal.vue @@ -1,6 +1,6 @@ - - \ No newline at end of file + + + diff --git a/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/lms/boxtype/modules/form.vue b/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/lms/boxtype/modules/form.vue index 4373e9ad..feec9b1b 100644 --- a/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/lms/boxtype/modules/form.vue +++ b/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/lms/boxtype/modules/form.vue @@ -1,134 +1,134 @@ - - - \ No newline at end of file + + + \ No newline at end of file diff --git a/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/lms/subpackagerelation/modules/batch-form.vue b/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/lms/subpackagerelation/modules/batch-form.vue index 4d757605..f829e087 100644 --- a/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/lms/subpackagerelation/modules/batch-form.vue +++ b/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/lms/subpackagerelation/modules/batch-form.vue @@ -1,7 +1,7 @@