From e7ad820fb9330e1079c8d31fe33bb42be0ef7695 Mon Sep 17 00:00:00 2001 From: chenhc <2369838784@qq.com> Date: Mon, 10 Feb 2025 10:54:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=85=A5=E5=BA=93=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E6=8F=92=E5=85=A5=E5=BA=93=E5=AD=98=E6=89=B9=E6=AC=A1=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../glxp/api/dao/inv/InvProductBatchDao.java | 17 ++ .../api/entity/inv/InvProductBatchEntity.java | 146 ++++++++++++++++++ .../api/service/inout/IoGenInvService.java | 14 ++ .../inv/impl/InvProductBatchService.java | 17 ++ .../mybatis/mapper/inv/invProductBatchDao.xml | 7 + src/main/resources/schemas/schema_v2.4.sql | 20 +++ 6 files changed, 221 insertions(+) create mode 100644 src/main/java/com/glxp/api/dao/inv/InvProductBatchDao.java create mode 100644 src/main/java/com/glxp/api/entity/inv/InvProductBatchEntity.java create mode 100644 src/main/java/com/glxp/api/service/inv/impl/InvProductBatchService.java create mode 100644 src/main/resources/mybatis/mapper/inv/invProductBatchDao.xml diff --git a/src/main/java/com/glxp/api/dao/inv/InvProductBatchDao.java b/src/main/java/com/glxp/api/dao/inv/InvProductBatchDao.java new file mode 100644 index 000000000..fc5b7cec5 --- /dev/null +++ b/src/main/java/com/glxp/api/dao/inv/InvProductBatchDao.java @@ -0,0 +1,17 @@ +package com.glxp.api.dao.inv; + +import com.glxp.api.dao.BaseMapperPlus; +import com.glxp.api.entity.inv.InvProductBatchEntity; +import com.glxp.api.entity.inv.InvProductEntity; +import com.glxp.api.req.inv.FilterInvProductRequest; +import com.glxp.api.res.inv.InvProductResponse; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface InvProductBatchDao extends BaseMapperPlus { + + +} diff --git a/src/main/java/com/glxp/api/entity/inv/InvProductBatchEntity.java b/src/main/java/com/glxp/api/entity/inv/InvProductBatchEntity.java new file mode 100644 index 000000000..34e32f6f9 --- /dev/null +++ b/src/main/java/com/glxp/api/entity/inv/InvProductBatchEntity.java @@ -0,0 +1,146 @@ +package com.glxp.api.entity.inv; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +@ApiModel(value = "com-glxp-api-entity-inv-InvProductBatchEntity") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@TableName(value = "inv_product_batch") +public class InvProductBatchEntity implements Serializable { + + @TableId(value = "id", type = IdType.INPUT) + @ApiModelProperty(value = "") + private Integer id; + + + /** + * 内部批号 + */ + @TableField(value = "inBatchNo") + @ApiModelProperty(value = "内部批号") + private String inBatchNo; + + /** + * 入库单号 + */ + @TableField(value = "orderId") + @ApiModelProperty(value = "入库单号") + private String orderId; + + + /** + * 产品ID + */ + @TableField(value = "relIdFk") + @ApiModelProperty(value = "产品ID") + private String relIdFk; + + + /** + * 最小销售标识 + */ + @TableField(value = "nameCode") + @ApiModelProperty(value = "最小销售标识") + private String nameCode; + + /** + * 批次号 + */ + @TableField(value = "batchNo") + @ApiModelProperty(value = "批次号") + private String batchNo; + + /** + * 价格 + */ + @TableField(value = "price") + @ApiModelProperty(value = "价格") + private BigDecimal price; + + + /** + * 生产日期 + */ + @TableField(value = "produceDate") + @ApiModelProperty(value = "生产日期") + private String produceDate; + + + /** + * 失效日期 + */ + @TableField(value = "expireDate") + @ApiModelProperty(value = "失效日期") + private String expireDate; + + + /** + * 入库数量 + */ + @TableField(value = "invCount") + @ApiModelProperty(value = "入库数量") + private Integer invCount; + + /** + * 剩余数量 + */ + @TableField(value = "reCount") + @ApiModelProperty(value = "剩余数量") + private Integer reCount; + + + + /** + * 供应商ID + */ + @TableField(value = "supId") + @ApiModelProperty(value = "供应商ID") + private String supId; + + /** + * 部门编码 + */ + @TableField(value = "deptCode") + @ApiModelProperty(value = "部门编码") + private String deptCode; + + /** + * 创建时间 + */ + @TableField(value = "createTime") + @ApiModelProperty(value = "创建时间") + private Date createTime; + + /** + * 更新时间 + */ + @TableField(value = "updateTime") + @ApiModelProperty(value = "更新时间") + private Date updateTime; + + /** + * 仓库编码 + */ + @TableField(value = "`invCode`") + @ApiModelProperty(value = "仓库编码") + private String invCode; + + + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/glxp/api/service/inout/IoGenInvService.java b/src/main/java/com/glxp/api/service/inout/IoGenInvService.java index 5d2eb0433..81e2264ad 100644 --- a/src/main/java/com/glxp/api/service/inout/IoGenInvService.java +++ b/src/main/java/com/glxp/api/service/inout/IoGenInvService.java @@ -1,7 +1,9 @@ package com.glxp.api.service.inout; +import cn.hutool.core.collection.CollUtil; import com.glxp.api.service.dev.DeviceChangeOrderService; import com.glxp.api.service.inout.impl.IoCodeService; +import com.glxp.api.service.inv.impl.InvProductBatchService; import com.glxp.api.service.inv.impl.InvProductService; import org.springframework.beans.BeanUtils; import cn.hutool.core.util.StrUtil; @@ -52,6 +54,8 @@ public class IoGenInvService { IoChangeInoutService ioChangeInoutService; @Resource DeviceChangeOrderService deviceChangeOrderService; + @Resource + InvProductBatchService invProductBatchService; //生成普通库存 @@ -67,6 +71,8 @@ public class IoGenInvService { orderService.update(orderEntity); } + List batchEntities = new ArrayList<>(); + //生成库存产品表 for (IoOrderDetailResultEntity orderDetailResultEntity : orderDetailResultEntities) { InvProductEntity invProductEntity = invProductService.selectByUnique(orderDetailResultEntity.getBindRlFk(), orderDetailResultEntity.getBatchNo(), orderDetailResultEntity.getSupId(), orderEntity.getDeptCode(), orderEntity.getInvCode(), orderDetailResultEntity.getPrice()); @@ -98,6 +104,14 @@ public class IoGenInvService { invProductEntity.setReCount(invProductEntity.getInCount() - invProductEntity.getOutCount()); invProductEntity.setUpdateTime(new Date()); invProductService.update(invProductEntity); + + InvProductBatchEntity batchEntity = new InvProductBatchEntity(); + BeanUtils.copyProperties(invProductEntity,batchEntity); + batchEntities.add(batchEntity); + } + + if (CollUtil.isNotEmpty(batchEntities)){ + invProductBatchService.saveBatch(batchEntities); } BasicBusTypePreEntity basicBusTypePreEntity = basicBusTypePreService.findByOriginAction(orderEntity.getAction()); diff --git a/src/main/java/com/glxp/api/service/inv/impl/InvProductBatchService.java b/src/main/java/com/glxp/api/service/inv/impl/InvProductBatchService.java new file mode 100644 index 000000000..3056b34da --- /dev/null +++ b/src/main/java/com/glxp/api/service/inv/impl/InvProductBatchService.java @@ -0,0 +1,17 @@ +package com.glxp.api.service.inv.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.glxp.api.dao.inv.InvProductBatchDao; +import com.glxp.api.entity.inv.InvProductBatchEntity; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + + +@Service +@Transactional(rollbackFor = Exception.class) +public class InvProductBatchService extends ServiceImpl { + + + + +} diff --git a/src/main/resources/mybatis/mapper/inv/invProductBatchDao.xml b/src/main/resources/mybatis/mapper/inv/invProductBatchDao.xml new file mode 100644 index 000000000..5577fb8c6 --- /dev/null +++ b/src/main/resources/mybatis/mapper/inv/invProductBatchDao.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/src/main/resources/schemas/schema_v2.4.sql b/src/main/resources/schemas/schema_v2.4.sql index 0f4382501..e14a20c46 100644 --- a/src/main/resources/schemas/schema_v2.4.sql +++ b/src/main/resources/schemas/schema_v2.4.sql @@ -5232,3 +5232,23 @@ CALL Pro_Temp_ColumnWork('io_collect_set', 'ipcMaxCount', 'int NULL DEFAULT NULL COMMENT ''PDA扫码数量''', 1); + +CREATE TABLE IF NOT EXISTS `inv_product_batch` ( + `id` int NOT NULL AUTO_INCREMENT, + `inBatchNo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '内部批号', + `orderId` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '入库单号', + `relIdFk` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '产品ID', + `nameCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '最小销售标识', + `batchNo` varchar(60) DEFAULT NULL COMMENT '批次号', + `price` decimal(10,3) DEFAULT NULL COMMENT '价格', + `produceDate` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '生产日期', + `expireDate` varchar(60) DEFAULT NULL COMMENT '失效日期', + `inCount` int DEFAULT NULL COMMENT '入库数量', + `reCount` int DEFAULT NULL COMMENT '剩余数量', + `supId` varchar(60) DEFAULT NULL COMMENT '供应商ID', + `deptCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '部门编码', + `createTime` datetime DEFAULT NULL COMMENT '创建时间', + `updateTime` datetime DEFAULT NULL COMMENT '更新时间', + `invCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '仓库编码', + PRIMARY KEY (`id`) USING BTREE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; \ No newline at end of file