houjie
2023-09-01 87cdb6ee2a471bc7b5c608f0af71918a22aa6f80
备件库存 导入  优化
已修改2个文件
33 ■■■■ 文件已修改
lxzn-module-eam/src/main/java/org/jeecg/modules/spare/controller/SparesPartInventoryController.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/spare/entity/SparesPartInventory.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/spare/controller/SparesPartInventoryController.java
@@ -188,31 +188,16 @@
            params.setNeedSave(true);
            try {
                List<SparesPartInventory> list = ExcelImportUtil.importExcel(file.getInputStream(), SparesPartInventory.class, params);
             /*   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) + "行备件型号不能为空");
                }*/
                long start = System.currentTimeMillis();
                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) + "毫秒");
                return Result.OK("文件导入成功!数据行数:" + list.size());
lxzn-module-eam/src/main/java/org/jeecg/modules/spare/entity/SparesPartInventory.java
@@ -54,43 +54,43 @@
    /**
     * 制造商
     */
    @Excel(name = "制造商", width = 15, dictTable = "mom_base_constructor", dicCode = "id", dicText = "name")
    @Excel(name = "制造商", width = 15)
    @ApiModelProperty(value = "制造商")
    @Dict(dictTable = "mom_base_constructor", dicCode = "id", dicText = "name")
    private java.lang.String constructorId;
    /**
     * 主单位id
     */
    @Excel(name = "主单位id", width = 15, dictTable = "mom_base_unit", dicCode = "id", dicText = "name")
    @Excel(name = "单位", width = 15)
    @ApiModelProperty(value = "主单位id")
    @Dict(dictTable = "mom_base_unit", dicCode = "id", dicText = "name")
    private java.lang.String mainUnitId;
    /**
     * 辅单位id
     */
    @Excel(name = "辅单位id", width = 15, dictTable = "mom_base_unit", dicCode = "id", dicText = "name")
    @Excel(name = "辅单位id", width = 15)
    @ApiModelProperty(value = "辅单位id")
    @Dict(dictTable = "mom_base_unit", dicCode = "id", dicText = "name")
    private java.lang.String auxiliaryUnitId;
    @Excel(name = "仓库id", width = 15, dictTable = "mom_base_warehouse", dicCode = "id", dicText = "name")
    @Excel(name = "仓库", width = 15)
    @ApiModelProperty(value = "仓库id")
    @Dict(dictTable = "mom_base_warehouse", dicCode = "id", dicText = "name")
    private java.lang.String warehouseId;
    @Excel(name = "库区id", width = 15, dictTable = "mom_base_warehouse_area", dicCode = "id", dicText = "name")
    @Excel(name = "库区", width = 15)
    @ApiModelProperty(value = "库区id")
    @Dict(dictTable = "mom_base_warehouse_area", dicCode = "id", dicText = "name")
    private java.lang.String warehouseAreaId;
    @Excel(name = "库位id", width = 15, dictTable = "mom_base_warehouse_location", dicCode = "id", dicText = "name")
    @Excel(name = "库位", width = 15)
    @ApiModelProperty(value = "库位id")
    @Dict(dictTable = "mom_base_warehouse_location", dicCode = "id", dicText = "name")
    private java.lang.String warehouseLocationId;
    /**
     * 主数量
     */
    @Excel(name = "主数量", width = 15)
    @Excel(name = "数量", width = 15)
    @ApiModelProperty(value = "主数量")
    private java.lang.Double mainQuantity;
    /**
@@ -112,7 +112,7 @@
    /**
     * 供应商id
     */
    @Excel(name = "供应商id", width = 15)
    @Excel(name = "供应商", width = 15)
    @ApiModelProperty(value = "供应商id")
    private String supplierId;