houjie
2023-08-31 53112cfae1aa41fc0e2294cd9de5edeba1afd690
备件信息  备件库存 导入 导出 优化
已修改4个文件
234 ■■■■■ 文件已修改
lxzn-module-eam/src/main/java/org/jeecg/modules/spare/controller/SparePartController.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/spare/controller/SparesPartInventoryController.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/spare/entity/SparePart.java 184 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/spare/entity/SparesPartInventory.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/spare/controller/SparePartController.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -222,6 +223,18 @@
            try {
                List<SparePart> list = ExcelImportUtil.importExcel(file.getInputStream(), SparePart.class, params);
                long start = System.currentTimeMillis();
                for (int i = 0; i < list.size(); i++) {
                    SparePart sparePart = list.get(i);
                    if (!StringUtils.isNotEmpty(sparePart.getName()))
                        return Result.error("文件导入失败: 第" + (i + 1) + "行备件名称不能为空");
                    if (!StringUtils.isNotEmpty(sparePart.getNum()))
                        return Result.error("文件导入失败: 第" + (i + 1) + "行备件编码不能为空");
                    if (!StringUtils.isNotEmpty(sparePart.getSpecification()))
                        return Result.error("文件导入失败: 第" + (i + 1) + "行备件规格不能为空");
                    if (!StringUtils.isNotEmpty(sparePart.getModel()))
                        return Result.error("文件导入失败: 第" + (i + 1) + "行备件型号不能为空");
                }
                sparePartService.saveBatch(list);
                log.info("消耗时间" + (System.currentTimeMillis() - start) + "毫秒");
                return Result.OK("文件导入成功!数据行数:" + list.size());
lxzn-module-eam/src/main/java/org/jeecg/modules/spare/controller/SparesPartInventoryController.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -187,9 +188,30 @@
            params.setNeedSave(true);
            try {
                List<SparesPartInventory> list = ExcelImportUtil.importExcel(file.getInputStream(), SparesPartInventory.class, params);
                for (SparesPartInventory temp : list) {
             /*   for (SparesPartInventory temp : list) {
                    temp.setSparePartId(mainId);
                    if (!StringUtils.isNotEmpty(sparePart.getName()))
                        return Result.error("文件导入失败: 第" + (i + 1) + "行备件名称不能为空");
                    if (!StringUtils.isNotEmpty(sparePart.getNum()))
                        return Result.error("文件导入失败: 第" + (i + 1) + "行备件编码不能为空");
                    if (!StringUtils.isNotEmpty(sparePart.getSpecification()))
                        return Result.error("文件导入失败: 第" + (i + 1) + "行备件规格不能为空");
                    if (!StringUtils.isNotEmpty(sparePart.getModel()))
                        return Result.error("文件导入失败: 第" + (i + 1) + "行备件型号不能为空");
                }*/
                for (int i = 0; i < list.size(); i++) {
                    SparesPartInventory sparesPartInventory = list.get(i);
                    sparesPartInventory.setSparePartId(mainId);
                    if (!StringUtils.isNotEmpty(sparesPartInventory.getBatchNum()))
                        return Result.error("文件导入失败: 第" + (i + 1) + "行批次号不能为空");
                    if (sparesPartInventory.getMainQuantity() <= 0)
                        return Result.error("文件导入失败: 第" + (i + 1) + "行数量不能为小于等于0");
                }
                long start = System.currentTimeMillis();
                sparesPartInventoryService.saveBatch(list);
                log.info("消耗时间" + (System.currentTimeMillis() - start) + "毫秒");
@@ -207,7 +229,6 @@
        }
        return Result.error("文件导入失败!");
    }
    /**
lxzn-module-eam/src/main/java/org/jeecg/modules/spare/entity/SparePart.java
@@ -1,151 +1,205 @@
package org.jeecg.modules.spare.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import java.util.List;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.base.entity.JeecgEntity;
import org.jeecg.modules.spare.vo.AuxiliaryUnitVo;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
 * @Description: mom_eam_spare_part
 * @Author: jeecg-boot
 * @Date:   2023-06-20
 * @Date: 2023-06-20
 * @Version: V1.0
 */
@Data
@TableName("mom_eam_spare_part")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="mom_eam_spare_part对象", description="mom_eam_spare_part")
@ApiModel(value = "mom_eam_spare_part对象", description = "mom_eam_spare_part")
public class SparePart extends JeecgEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    /**备件分类id*/
    /**
     * 备件分类id
     */
    @ApiModelProperty(value = "备件分类id")
    private java.lang.String sparePartCategoryId;
    /**备件编码*/
    @Excel(name = "备件编码", width = 15)
    /**
     * 备件编码
     */
    @Excel(name = "备件编码", width = 15)
    @ApiModelProperty(value = "备件编码")
    private java.lang.String num;
    /**备件名称*/
    @Excel(name = "备件名称", width = 15)
    /**
     * 备件名称
     */
    @Excel(name = "备件名称", width = 15)
    @ApiModelProperty(value = "备件名称")
    private java.lang.String name;
    /**状态 0 禁用 1 启用*/
    @Excel(name = "状态 0 禁用 1 启用", width = 15)
    /**
     * 状态 0 禁用 1 启用
     */
    @Excel(name = "状态 0 禁用 1 启用", width = 15)
    @ApiModelProperty(value = "状态 0 禁用 1 启用")
    private java.lang.String status = CommonConstant.STATUS_1;
    /**型号*/
    @Excel(name = "型号", width = 15)
    /**
     * 型号
     */
    @Excel(name = "型号", width = 15)
    @ApiModelProperty(value = "型号")
    private java.lang.String model;
    /**规则*/
    @Excel(name = "规则", width = 15)
    /**
     * 规则
     */
    @Excel(name = "规则", width = 15)
    @ApiModelProperty(value = "规则")
    private java.lang.String specification;
    /**制造商*/
    @Excel(name = "制造商", width = 15,dictTable="mom_base_constructor",dicText="name")
    /**
     * 制造商
     */
    @Excel(name = "制造商", width = 25, dictTable = "mom_base_constructor", dicText = "name", dicCode = "id")
    @ApiModelProperty(value = "制造商")
    @Dict(dicCode = "id",dictTable="mom_base_constructor",dicText="name")
    @Dict(dicCode = "id", dictTable = "mom_base_constructor", dicText = "name")
    private java.lang.String constructorId;
    /**主单位id*/
    @Excel(name = "主单位", width = 15,dicCode = "id",dictTable="mom_base_unit",dicText="name")
    /**
     * 主单位id
     */
    @Excel(name = "主单位", width = 15, dicCode = "id", dictTable = "mom_base_unit", dicText = "name")
    @ApiModelProperty(value = "主单位id")
    @Dict(dicCode = "id",dictTable="mom_base_unit",dicText="name")
    @Dict(dicCode = "id", dictTable = "mom_base_unit", dicText = "name")
    private java.lang.String mainUnitId;
    /**辅单位id*/
    /**
     * 辅单位id
     */
    @ApiModelProperty(value = "辅单位id")
    @Dict(dicCode = "id",dictTable="mom_base_unit",dicText="name")
    @Dict(dicCode = "id", dictTable = "mom_base_unit", dicText = "name")
    private java.lang.String auxiliaryUnitId;
    /**换算比例*/
    /**
     * 换算比例
     */
    @ApiModelProperty(value = "换算比例")
    private java.lang.String conversionRatio;
    /**批次管理标识*/
    @Excel(name = "批次管理标识", width = 15)
    /**
     * 批次管理标识
     */
    @Excel(name = "批次管理标识", width = 15)
    @ApiModelProperty(value = "批次管理标识")
    private java.lang.Integer batchManagedFlag;
    /**有效期管理标识*/
    @Excel(name = "有效期管理标识", width = 15)
    /**
     * 有效期管理标识
     */
    @Excel(name = "有效期管理标识", width = 15)
    @ApiModelProperty(value = "有效期管理标识")
    private java.lang.Integer validityManagedFlag;
    /**有效期*/
    @Excel(name = "有效期", width = 15)
    /**
     * 有效期
     */
    @Excel(name = "有效期", width = 15)
    @ApiModelProperty(value = "有效期")
    private java.lang.Integer validityPeriod;
    /**有效期单位*/
    @Excel(name = "有效期单位", width = 15,dictTable="mom_base_unit",dicText="name")
    /**
     * 有效期单位
     */
    @Excel(name = "有效期单位", width = 15, dictTable = "mom_base_unit", dicText = "name", dicCode = "id")
    @ApiModelProperty(value = "有效期单位")
    @Dict(dicCode = "id",dictTable="mom_base_unit",dicText="name")
    @Dict(dicCode = "id", dictTable = "mom_base_unit", dicText = "name")
    private java.lang.String validityPeriodUnitId;
    /**库存上限制*/
    @Excel(name = "库存上限制", width = 15)
    /**
     * 库存上限制
     */
    @Excel(name = "库存上限制", width = 15)
    @ApiModelProperty(value = "库存上限制")
    private java.lang.Integer inventoryUpperLimit;
    /**库存下限制*/
    @Excel(name = "库存下限制", width = 15)
    /**
     * 库存下限制
     */
    @Excel(name = "库存下限制", width = 15)
    @ApiModelProperty(value = "库存下限制")
    private java.lang.Integer inventoryLowerLimit;
    /**库存预警下限*/
    @Excel(name = "库存预警下限", width = 15)
    /**
     * 库存预警下限
     */
    @Excel(name = "库存预警下限", width = 15)
    @ApiModelProperty(value = "库存预警下限")
    private java.lang.Integer inventoryWarnLimit;
    /**经济订货量*/
    @Excel(name = "经济订货量", width = 15)
    /**
     * 经济订货量
     */
    @Excel(name = "经济订货量", width = 15)
    @ApiModelProperty(value = "经济订货量")
    private java.lang.Integer economicOrderQuantity;
    /**采购提前期*/
    @Excel(name = "采购提前期", width = 15)
    /**
     * 采购提前期
     */
    @Excel(name = "采购提前期", width = 15)
    @ApiModelProperty(value = "采购提前期")
    private java.lang.Integer purchaseLeadTime;
    /**租户id*/
    @Excel(name = "租户id", width = 15)
    /**
     * 租户id
     */
    @ApiModelProperty(value = "租户id")
    private java.lang.String tenantId;
    /**删除状态(0-正常,1-已删除)*/
    /**
     * 删除状态(0-正常,1-已删除)
     */
    @ApiModelProperty(value = "删除状态(0-正常,1-已删除)")
    @TableLogic
    private Integer delFlag = CommonConstant.DEL_FLAG_0;
    /**备注*/
    /**
     * 备注
     */
    @ApiModelProperty(value = "备注")
    private java.lang.String remark;
    /**备用字段1*/
    /**
     * 备用字段1
     */
    @ApiModelProperty(value = "备用字段1")
    private java.lang.String uda1;
    /**备用字段2*/
    /**
     * 备用字段2
     */
    @ApiModelProperty(value = "备用字段2")
    private java.lang.String uda2;
    /**备用字段3*/
    /**
     * 备用字段3
     */
    @ApiModelProperty(value = "备用字段3")
    private java.lang.String uda3;
    /**备用字段4*/
    /**
     * 备用字段4
     */
    @ApiModelProperty(value = "备用字段4")
    private java.lang.String uda4;
    /**备用字段5*/
    /**
     * 备用字段5
     */
    @ApiModelProperty(value = "备用字段5")
    private java.lang.String uda5;
@@ -158,4 +212,6 @@
    @TableField(exist = false)
    private BigDecimal totalAuxiliaryQuantity;
}
lxzn-module-eam/src/main/java/org/jeecg/modules/spare/entity/SparesPartInventory.java
@@ -54,36 +54,36 @@
    /**
     * 制造商
     */
    @Excel(name = "制造商", width = 15)
    @Excel(name = "制造商", width = 15, dictTable = "mom_base_constructor", dicCode = "id", dicText = "name")
    @ApiModelProperty(value = "制造商")
    @Dict(dictTable = "mom_base_constructor", dicCode = "id", dicText = "name")
    private java.lang.String constructorId;
    /**
     * 主单位id
     */
    @Excel(name = "主单位id", width = 15)
    @Excel(name = "主单位id", width = 15, dictTable = "mom_base_unit", dicCode = "id", dicText = "name")
    @ApiModelProperty(value = "主单位id")
    @Dict(dictTable = "mom_base_unit", dicCode = "id", dicText = "name")
    private java.lang.String mainUnitId;
    /**
     * 辅单位id
     */
    @Excel(name = "辅单位id", width = 15)
    @Excel(name = "辅单位id", width = 15, dictTable = "mom_base_unit", dicCode = "id", dicText = "name")
    @ApiModelProperty(value = "辅单位id")
    @Dict(dictTable = "mom_base_unit", dicCode = "id", dicText = "name")
    private java.lang.String auxiliaryUnitId;
    @Excel(name = "仓库id", width = 15)
    @Excel(name = "仓库id", width = 15, dictTable = "mom_base_warehouse", dicCode = "id", dicText = "name")
    @ApiModelProperty(value = "仓库id")
    @Dict(dictTable = "mom_base_warehouse", dicCode = "id", dicText = "name")
    private java.lang.String warehouseId;
    @Excel(name = "库区id", width = 15)
    @Excel(name = "库区id", width = 15, dictTable = "mom_base_warehouse_area", dicCode = "id", dicText = "name")
    @ApiModelProperty(value = "库区id")
    @Dict(dictTable = "mom_base_warehouse_area", dicCode = "id", dicText = "name")
    private java.lang.String warehouseAreaId;
    @Excel(name = "库位id", width = 15)
    @Excel(name = "库位id", width = 15, dictTable = "mom_base_warehouse_location", dicCode = "id", dicText = "name")
    @ApiModelProperty(value = "库位id")
    @Dict(dictTable = "mom_base_warehouse_location", dicCode = "id", dicText = "name")
    private java.lang.String warehouseLocationId;