feat: 入库操作插入库存批次表

dev_2.5_optimize
chenhc 5 months ago
parent 9f8de20e54
commit e7ad820fb9

@ -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<InvProductBatchDao, InvProductBatchEntity, InvProductBatchEntity> {
}

@ -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;
}

@ -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<InvProductBatchEntity> 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());

@ -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<InvProductBatchDao, InvProductBatchEntity> {
}

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.glxp.api.dao.inv.InvProductBatchDao">
</mapper>

@ -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;
Loading…
Cancel
Save