From 66b2a6bc81c0e0f9d999777fe42e8f74f10c3134 Mon Sep 17 00:00:00 2001 From: chenhc <2369838784@qq.com> Date: Tue, 12 Nov 2024 15:03:30 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=8D=AF=E5=93=81=E5=85=B3=E8=81=94?= =?UTF-8?q?=E5=85=B3=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/entity/collect/RelCodeBatch.java | 22 ++++++++++ .../service/collect/RelCodeBatchService.java | 39 +++++++++++++++++ src/main/resources/schemas/schema_v2.1.sql | 43 ++++++++++++++++++- 3 files changed, 103 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/glxp/udidl/admin/entity/collect/RelCodeBatch.java b/src/main/java/com/glxp/udidl/admin/entity/collect/RelCodeBatch.java index 9384446..ac7612e 100644 --- a/src/main/java/com/glxp/udidl/admin/entity/collect/RelCodeBatch.java +++ b/src/main/java/com/glxp/udidl/admin/entity/collect/RelCodeBatch.java @@ -139,4 +139,26 @@ public class RelCodeBatch implements Serializable { private String erpId; + /** + * curCode + */ + + @TableField(value = "curCode") + @ApiModelProperty(value = "") + private String curCode; + + + @TableField(value = "oneLevelCount") + @ApiModelProperty(value = "") + private Integer oneLevelCount; + + + @TableField(value = "twoLevelCount") + @ApiModelProperty(value = "") + private Integer twoLevelCount; + + + @TableField(value = "threeLevelCount") + @ApiModelProperty(value = "") + private Integer threeLevelCount; } diff --git a/src/main/java/com/glxp/udidl/admin/service/collect/RelCodeBatchService.java b/src/main/java/com/glxp/udidl/admin/service/collect/RelCodeBatchService.java index 7374da4..b176b16 100644 --- a/src/main/java/com/glxp/udidl/admin/service/collect/RelCodeBatchService.java +++ b/src/main/java/com/glxp/udidl/admin/service/collect/RelCodeBatchService.java @@ -168,6 +168,7 @@ public class RelCodeBatchService extends ServiceImpl relCodeDetails = new ArrayList<>(); for(RelCodeDetailRequest request : detailList){ @@ -180,6 +181,7 @@ public class RelCodeBatchService extends ServiceImpl filterList(RelCodeBatchRequest relCodeBatchRequest) { @@ -259,4 +261,41 @@ public class RelCodeBatchService extends ServiceImpl list = relCodeDetailService.list(new LambdaQueryWrapper().eq(RelCodeDetail::getParentCode, curCode)); + if (CollUtil.isNotEmpty(list)){ + RelCodeDetail relCodeDetail = list.get(0); + Integer packLayer = relCodeDetail.getPackLayer(); + if (packLayer == 2){ + item.setThreeLevelCount(1); + item.setTwoLevelCount(list.size()); + + //需要计算出一级数量 + List twoCurCodes = list.stream().map(RelCodeDetail::getCurCode).collect(Collectors.toList()); + List list2 = relCodeDetailService.list(new LambdaQueryWrapper().in(RelCodeDetail::getParentCode, twoCurCodes)); + item.setOneLevelCount(list2.size()); + + //更新下 二级单 + List twoRelCodeBatchs = this.list(new LambdaQueryWrapper().in(RelCodeBatch::getCurCode, twoCurCodes)); + if (CollUtil.isNotEmpty(twoRelCodeBatchs)){ + twoRelCodeBatchs.forEach( t -> { + this.updateDrugLevelCount(t); + }); + } + }else if (packLayer == 1){ + item.setThreeLevelCount(0); + item.setTwoLevelCount(1); + item.setOneLevelCount(list.size()); + } + this.updateById(item); + } + return; + } } diff --git a/src/main/resources/schemas/schema_v2.1.sql b/src/main/resources/schemas/schema_v2.1.sql index 969ea32..70411d7 100644 --- a/src/main/resources/schemas/schema_v2.1.sql +++ b/src/main/resources/schemas/schema_v2.1.sql @@ -205,4 +205,45 @@ CREATE TABLE IF NOT EXISTS `io_collect_code` ( `relId` bigint DEFAULT NULL COMMENT '耗材字典ID外键', `webTitle` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '来源', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; \ No newline at end of file +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; + + + +CREATE TABLE IF NOT EXISTS `rel_code_batch` ( + `id` int NOT NULL AUTO_INCREMENT, + `productCode` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '产品编码', + `subTypeNo` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '类型编码', + `cascadeRatio` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '包装比例', + `packageSpec` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '包装规格', + `comment` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '备注', + `batchNo` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '批次号', + `madeDate` datetime DEFAULT NULL COMMENT '生产日期', + `validateDate` datetime DEFAULT NULL COMMENT '失效日期', + `workShop` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '生产车间', + `lineName` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '生产线', + `lineManager` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '负责人', + `createTime` datetime DEFAULT NULL COMMENT '创建时间', + `createUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '创建人', + `updateTime` datetime DEFAULT NULL COMMENT '更新时间', + `updateUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '更新人', + `parentCode` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '父级码', + `uploadFlagUp` tinyint(1) DEFAULT '0' COMMENT '0 未上传 1已上传 2上传失败', + `uploadFlagDown` tinyint(1) DEFAULT '0' COMMENT '0 未上传 1已上传 2上传失败', + `erpId` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '供应商ID', + `curCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '当前码', + `oneLevelCount` int DEFAULT NULL COMMENT '一级数量', + `twoLevelCount` int DEFAULT NULL COMMENT '二级数量', + `threeLevelCount` int DEFAULT NULL COMMENT '三级数量', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=131 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; + + +CREATE TABLE IF NOT EXISTS `rel_code_detail` ( + `id` int NOT NULL AUTO_INCREMENT, + `curCode` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '当前条码', + `packLayer` tinyint DEFAULT NULL COMMENT '包装级别', + `parentCode` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '父级码', + `flag` tinyint DEFAULT NULL COMMENT '状态', + `batchIdFk` int DEFAULT NULL COMMENT '产品批次ID外键', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=708 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; \ No newline at end of file