From 53112cfae1aa41fc0e2294cd9de5edeba1afd690 Mon Sep 17 00:00:00 2001 From: houjie <714924425@qq.com> Date: 星期四, 31 八月 2023 18:23:17 +0800 Subject: [PATCH] 备件信息 备件库存 导入 导出 优化 --- lxzn-module-eam/src/main/java/org/jeecg/modules/spare/entity/SparePart.java | 184 ++++++++++++++++++++++++++++++---------------- lxzn-module-eam/src/main/java/org/jeecg/modules/spare/controller/SparesPartInventoryController.java | 25 +++++ lxzn-module-eam/src/main/java/org/jeecg/modules/spare/entity/SparesPartInventory.java | 12 +- lxzn-module-eam/src/main/java/org/jeecg/modules/spare/controller/SparePartController.java | 13 +++ 4 files changed, 162 insertions(+), 72 deletions(-) diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/spare/controller/SparePartController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/spare/controller/SparePartController.java index b569717..1a28779 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/spare/controller/SparePartController.java +++ b/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()); diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/spare/controller/SparesPartInventoryController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/spare/controller/SparesPartInventoryController.java index 56fa79a..0b9419d 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/spare/controller/SparesPartInventoryController.java +++ b/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("鏂囦欢瀵煎叆澶辫触锛�"); } - /** diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/spare/entity/SparePart.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/spare/entity/SparePart.java index 0986f12..b5f4655 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/spare/entity/SparePart.java +++ b/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; - /**涓诲崟浣峣d*/ - @Excel(name = "涓诲崟浣�", width = 15,dicCode = "id",dictTable="mom_base_unit",dicText="name") + + /** + * 涓诲崟浣峣d + */ + @Excel(name = "涓诲崟浣�", width = 15, dicCode = "id", dictTable = "mom_base_unit", dicText = "name") @ApiModelProperty(value = "涓诲崟浣峣d") - @Dict(dicCode = "id",dictTable="mom_base_unit",dicText="name") + @Dict(dicCode = "id", dictTable = "mom_base_unit", dicText = "name") private java.lang.String mainUnitId; - /**杈呭崟浣峣d*/ + /** + * 杈呭崟浣峣d + */ @ApiModelProperty(value = "杈呭崟浣峣d") - @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-姝e父,1-宸插垹闄�)*/ + /** + * 鍒犻櫎鐘舵��(0-姝e父,1-宸插垹闄�) + */ @ApiModelProperty(value = "鍒犻櫎鐘舵��(0-姝e父,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; + + } diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/spare/entity/SparesPartInventory.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/spare/entity/SparesPartInventory.java index 7b5386f..ddeeebd 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/spare/entity/SparesPartInventory.java +++ b/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; /** * 涓诲崟浣峣d */ - @Excel(name = "涓诲崟浣峣d", width = 15) + @Excel(name = "涓诲崟浣峣d", width = 15, dictTable = "mom_base_unit", dicCode = "id", dicText = "name") @ApiModelProperty(value = "涓诲崟浣峣d") @Dict(dictTable = "mom_base_unit", dicCode = "id", dicText = "name") private java.lang.String mainUnitId; /** * 杈呭崟浣峣d */ - @Excel(name = "杈呭崟浣峣d", width = 15) + @Excel(name = "杈呭崟浣峣d", width = 15, dictTable = "mom_base_unit", dicCode = "id", dicText = "name") @ApiModelProperty(value = "杈呭崟浣峣d") @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; -- Gitblit v1.9.3