| | |
| | | <groupId>org.apache.poi</groupId> |
| | | <artifactId>poi</artifactId> |
| | | <version>4.1.0</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.apache.poi</groupId> |
| | | <artifactId>poi</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>cn.afterturn</groupId> |
| | | <artifactId>easypoi-spring-boot-starter</artifactId> |
| | | <version>4.1.2</version> |
| | | <version>4.1.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.aspectj</groupId> |
| | |
| | | <artifactId>druid-spring-boot-starter</artifactId> |
| | | <version>1.2.6</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>cn.afterturn</groupId> |
| | | <artifactId>easypoi-annotation</artifactId> |
| | | <version>4.2.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>easyexcel</artifactId> |
| | | <version>2.2.6</version> |
| | | </dependency> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>cn.afterturn</groupId>--> |
| | | <!-- <artifactId>easypoi-base</artifactId>--> |
| | | <!-- <version>4.2.0</version>--> |
| | | <!-- </dependency>--> |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | // generator.username="sa"; |
| | | // generator.password="Zoneyung@zy56$"; |
| | | |
| | | generator.table="man_qly_ispt_item"; |
| | | generator.table="man_loc"; |
| | | generator.tableDesc="质检信息"; |
| | | generator.packagePath="com.vincent.rsf.server.manager"; |
| | | generator.packagePath="com.vincent.rsf.server.test"; |
| | | |
| | | generator.build(); |
| | | } |
| | |
| | | |
| | | import cn.afterturn.easypoi.excel.annotation.Excel; |
| | | import cn.afterturn.easypoi.excel.entity.ImportParams; |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.SpringUtils; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.manager.entity.Matnr; |
| | | import com.vincent.rsf.server.manager.entity.excel.MatnrsTemplate; |
| | | import com.vincent.rsf.server.manager.entity.excel.annotation.ExcelComment; |
| | | import com.vincent.rsf.server.system.entity.Fields; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.apache.poi.ss.usermodel.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | public static ImportParams getDefaultImportParams() { |
| | | ImportParams importParams = new ImportParams(); |
| | | importParams.setTitleRows(0); |
| | | // importParams.setNeedVerify(true); |
| | | importParams.setHeadRows(1); |
| | | importParams.setSheetNum(1); |
| | | return importParams; |
| | | } |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @description Excel导出Map格式表格 |
| | | * @param |
| | | * @return |
| | | * @time 2025/3/18 09:30 |
| | | */ |
| | | public static void exportForMap(HttpServletResponse response, Class cls, String fileName, List<List<Object>> data) { |
| | | try { |
| | | response.setContentType("application/octet-stream; charset=utf-8"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | String name = URLEncoder.encode(fileName, "UTF-8"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + name + ".xlsx"); |
| | | EasyExcel.write(response.getOutputStream()).head(getHeader(cls)).sheet().doWrite(null); |
| | | } catch (IOException exception) { |
| | | exception.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @description excel导出map模式 |
| | | * @param Class<T> 模板类型 |
| | | * @return List<List<String>> 表头信息 |
| | | * @time 2025/3/18 09:26 |
| | | */ |
| | | public static List<List<String>> getHeader(Class<T> t) { |
| | | List<List<String>> headList = new ArrayList<List<String>>(); |
| | | if (t.getSuperclass().isInstance(MatnrsTemplate.class)) { |
| | | Field[] allFields = Cools.getAllFields(t); |
| | | if (Objects.isNull(allFields) || allFields.length < 1) { |
| | | throw new CoolException("模板列不能为空!!"); |
| | | } |
| | | for (Field field : allFields) { |
| | | List<String> list = new ArrayList<String>(); |
| | | String fieldName = ""; |
| | | if (field.isAnnotationPresent(Excel.class)){ |
| | | fieldName = field.getAnnotation(Excel.class).name(); |
| | | } |
| | | |
| | | list.add(field.getName()); |
| | | headList.add(list); |
| | | } |
| | | |
| | | FieldsService itemService = SpringUtils.getBean(FieldsService.class); |
| | | List<Fields> sysFields = itemService.list(new LambdaQueryWrapper<Fields>() |
| | | .eq(Fields::getStatus, 1) |
| | | .eq(Fields::getFlagEnable, 1)); |
| | | //添加扩展字段别名 |
| | | if (!sysFields.isEmpty()) { |
| | | sysFields.forEach(fields1 -> { |
| | | List<String> list = new ArrayList<String>(); |
| | | list.add(fields1.getFieldsAlise()); |
| | | headList.add(list); |
| | | }); |
| | | } |
| | | } |
| | | return headList; |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.vincent.rsf.framework.common.SpringUtils; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.system.entity.Fields; |
| | | import com.vincent.rsf.server.system.entity.FieldsItem; |
| | | import com.vincent.rsf.server.system.service.FieldsItemService; |
| | | import com.vincent.rsf.server.system.service.FieldsService; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author Ryan |
| | |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @description 通过字段唯一标识获取动态字段Map |
| | | * @description 通过字段唯一标识获取动态字段对象key-value |
| | | * @param |
| | | * @return |
| | | * @time 2025/3/12 12:50 |
| | |
| | | |
| | | return fieldsMap; |
| | | } |
| | | |
| | | /** |
| | | * @param template |
| | | * @return |
| | | * @author Ryan |
| | | * @description 动态字段value保存 |
| | | * @time 2025/3/18 15:00 |
| | | */ |
| | | public static void saveFields(Map<String, String> template, String uuid) { |
| | | List<Fields> fields = getFieldsSta(); |
| | | FieldsItemService fieldsItemService = SpringUtils.getBean(FieldsItemService.class); |
| | | if (fields.isEmpty()) { |
| | | throw new CoolException("扩展字段不存在!!"); |
| | | } |
| | | List<FieldsItem> fieldsItems = new ArrayList<>(); |
| | | fields.forEach(fields1 -> { |
| | | if (!Objects.isNull(template.get(fields1.getFields()))) { |
| | | FieldsItem item = new FieldsItem(); |
| | | item.setFieldsId(fields1.getId()) |
| | | .setUuid(uuid) |
| | | .setValue(template.get(fields1.getFields())); |
| | | fieldsItems.add(item); |
| | | } |
| | | }); |
| | | if (!fieldsItemService.saveBatch(fieldsItems)) { |
| | | throw new CoolException("动态字段值保存失败!!"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取所有开启动态扩展字段 |
| | | * @return |
| | | */ |
| | | public static List<Fields> getFieldsSta() { |
| | | FieldsService fieldsService = SpringUtils.getBean(FieldsService.class); |
| | | return fieldsService.list(new LambdaQueryWrapper<Fields>().eq(Fields::getStatus, 1).eq(Fields::getFlagEnable, 1)); |
| | | } |
| | | } |
| | |
| | | package com.vincent.rsf.server.manager.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import com.vincent.rsf.server.manager.service.WarehouseAreasService; |
| | | import com.vincent.rsf.server.manager.service.WarehouseService; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.SpringUtils; |
| | | import com.vincent.rsf.server.system.service.UserService; |
| | | import com.vincent.rsf.server.system.entity.User; |
| | | import com.vincent.rsf.server.system.service.UserService; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("man_loc") |
| | | @Accessors(chain = true) |
| | | @TableName("man_loc") |
| | | public class Loc implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | |
| | | private Long id; |
| | | |
| | | /** |
| | | * 仓库标识 |
| | | */ |
| | | @ApiModelProperty(value = "仓库标识") |
| | | private Long warehouseId; |
| | | /** |
| | | * 库区标识 |
| | | */ |
| | | @ApiModelProperty(value= "库区标识") |
| | | private Long areaId; |
| | | |
| | | /** |
| | | * 编号 |
| | | * 库位号 |
| | | */ |
| | | @ApiModelProperty(value= "编号") |
| | | @ApiModelProperty(value= "库位号") |
| | | private String code; |
| | | |
| | | /** |
| | | * 库位类型 |
| | | * 仓库标识 |
| | | */ |
| | | @ApiModelProperty(value= "库位类型") |
| | | private String type; |
| | | @ApiModelProperty(value= "仓库标识") |
| | | private Long warehouseId; |
| | | |
| | | /** |
| | | * 库位类型(*) H: 高库位 M: 中库位 L: 低库位 |
| | | */ |
| | | @ApiModelProperty(value= "库位类型(*) H: 高库位 M: 中库位 L: 低库位 ") |
| | | @TableField("`type`") |
| | | private String type; |
| | | |
| | | /** |
| | | * 虚拟库位 |
| | |
| | | private String unit; |
| | | |
| | | /** |
| | | * 长/宽/高 |
| | | * 长 |
| | | */ |
| | | @ApiModelProperty(value= "长/宽/高") |
| | | @ApiModelProperty(value= "长") |
| | | @TableField("`length`") |
| | | private Double length; |
| | | |
| | | /** |
| | | * 宽 |
| | | */ |
| | | @ApiModelProperty("宽") |
| | | @TableField("`width`") |
| | | private Double width; |
| | | |
| | | /** |
| | | * 高 |
| | | */ |
| | | @ApiModelProperty("高") |
| | | @ApiModelProperty(value= "高") |
| | | private Double height; |
| | | |
| | | /** |
| | | * 宽 |
| | | */ |
| | | @ApiModelProperty(value= "宽") |
| | | private Double width; |
| | | |
| | | /** |
| | | * 排 |
| | |
| | | private Integer lev; |
| | | |
| | | /** |
| | | * 通道 |
| | | * 巷道 |
| | | */ |
| | | @ApiModelProperty(value= "巷道") |
| | | @TableField("`channel`") |
| | | private Integer channel; |
| | | |
| | | /** |
| | | * 库位使用状态 |
| | | */ |
| | | private String useStatus; |
| | | |
| | | /** |
| | | * 最大零件数 |
| | |
| | | */ |
| | | @ApiModelProperty(value= "最大包装数") |
| | | private Integer maxPack; |
| | | |
| | | /** |
| | | * 库位使用状态 O: 空库 D: 空板 R: 预约出库 S: 预约入库 X: 禁用 F: 在库 |
| | | */ |
| | | @ApiModelProperty(value= "库位使用状态 O: 空库 D: 空板 R: 预约出库 S: 预约入库 X: 禁用 F: 在库 ") |
| | | private String useStatus; |
| | | |
| | | /** |
| | | * 是否标签管理 |
| | |
| | | * 状态 1: 正常 0: 冻结 |
| | | */ |
| | | @ApiModelProperty(value= "状态 1: 正常 0: 冻结 ") |
| | | @TableField("`status`") |
| | | private Integer status; |
| | | |
| | | /** |
| | |
| | | |
| | | public Loc() {} |
| | | |
| | | public Loc(Long areaId, Long warehouseId, String code,String type,Short flagLogic,String fucAtrrs,String barcode,String unit,Double size, Double width, Double height,Integer lrow,Integer col,Integer lev,Integer channel,Integer maxParts,Integer maxPack,Short flagLabelMange,String locAttrs,Integer status,Integer deleted,Integer tenantId,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo) { |
| | | this.warehouseId = warehouseId; |
| | | public Loc(Long areaId, String code, Long warehouseId, String type, Short flagLogic, String fucAtrrs, String barcode, String unit, Double length, Double height, Double width, Integer row, Integer col, Integer lev, Integer channel, Integer maxParts, Integer maxPack, String useStatus, Short flagLabelMange, String locAttrs, Integer status, Integer deleted, Integer tenantId, Long createBy, Date createTime, Long updateBy, Date updateTime, String memo) { |
| | | this.areaId = areaId; |
| | | this.code = code; |
| | | this.warehouseId = warehouseId; |
| | | this.type = type; |
| | | this.width = width; |
| | | this.height = height; |
| | | this.flagLogic = flagLogic; |
| | | this.fucAtrrs = fucAtrrs; |
| | | this.barcode = barcode; |
| | | this.unit = unit; |
| | | this.length = size; |
| | | this.row = lrow; |
| | | this.length = length; |
| | | this.height = height; |
| | | this.width = width; |
| | | this.row = row; |
| | | this.col = col; |
| | | this.lev = lev; |
| | | this.channel = channel; |
| | | this.maxParts = maxParts; |
| | | this.maxPack = maxPack; |
| | | this.useStatus = useStatus; |
| | | this.flagLabelMange = flagLabelMange; |
| | | this.locAttrs = locAttrs; |
| | | this.status = status; |
| | |
| | | |
| | | // Loc loc = new Loc( |
| | | // null, // 库区标识[非空] |
| | | // null, // 编号[非空] |
| | | // null, // 库位类型[非空] |
| | | // null, // 名称 |
| | | // null, // 库位号 |
| | | // null, // 仓库标识[非空] |
| | | // null, // 库位类型(*)[非空] |
| | | // null, // 虚拟库位 |
| | | // null, // 功能属性 |
| | | // null, // 容器编码 |
| | | // null, // 存放单位 |
| | | // null, // 长/宽/高 |
| | | // null, // 长 |
| | | // null, // 高 |
| | | // null, // 宽 |
| | | // null, // 排[非空] |
| | | // null, // 列[非空] |
| | | // null, // 层[非空] |
| | | // null, // 通道[非空] |
| | | // null, // 巷道 |
| | | // null, // 最大零件数 |
| | | // null, // 最大包装数 |
| | | // null, // 库位使用状态[非空] |
| | | // null, // 是否标签管理 |
| | | // null, // 属性[非空] |
| | | // null, // 属性 |
| | | // null, // 状态[非空] |
| | | // null, // 是否删除[非空] |
| | | // null, // 租户 |
| | |
| | | // null // 备注 |
| | | // ); |
| | | |
| | | public String getWarehouseId$() { |
| | | WarehouseService service = SpringUtils.getBean(WarehouseService.class); |
| | | Warehouse warehouse = service.getById(this.warehouseId); |
| | | if (!Cools.isEmpty(warehouse)) { |
| | | return String.valueOf(warehouse.getName()); |
| | | public String getType$(){ |
| | | if (null == this.type){ return null; } |
| | | switch (this.type){ |
| | | case "H": |
| | | return " 高库位"; |
| | | case "M": |
| | | return " 中库位"; |
| | | case "L": |
| | | return " 低库位"; |
| | | default: |
| | | return String.valueOf(this.type); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String gerAreaId$() { |
| | | WarehouseAreasService service = SpringUtils.getBean(WarehouseAreasService.class); |
| | | WarehouseAreas areas = service.getById(this.areaId); |
| | | if (!Cools.isEmpty(areas)) { |
| | | return String.valueOf(areas.getName()); |
| | | public String getUseStatus$(){ |
| | | if (null == this.useStatus){ return null; } |
| | | switch (this.useStatus){ |
| | | case "O": |
| | | return " 空库"; |
| | | case "D": |
| | | return " 空板"; |
| | | case "R": |
| | | return " 预约出库"; |
| | | case "S": |
| | | return " 预约入库"; |
| | | case "X": |
| | | return " 禁用"; |
| | | case "F": |
| | | return " 在库"; |
| | | default: |
| | | return String.valueOf(this.useStatus); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getStatus$(){ |
| | |
| | | private Long groupId; |
| | | |
| | | /** |
| | | * 字段标识 |
| | | */ |
| | | @ApiModelProperty(value = "字段标识") |
| | | private String fieldsIndex; |
| | | |
| | | /** |
| | | * 分组助记码 |
| | | */ |
| | | @ApiModelProperty(value = "分组助记码") |
| | |
| | | import com.vincent.rsf.server.manager.entity.excel.annotation.ExcelAutoColumnSize; |
| | | import com.vincent.rsf.server.manager.entity.excel.annotation.ExcelComment; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | |
| | | @Accessors(chain = true) |
| | | //@ToString(callSuper = true) |
| | | //@EqualsAndHashCode(callSuper = false) |
| | | public class AsnOrderTemplate implements IExcelModel, IExcelDataModel, Serializable { |
| | | public class AsnOrderTemplate implements Serializable { |
| | | |
| | | @Excel(name = "行号") |
| | | @ExcelComment(value = "platItemId", example = "1357564255478") |
| | |
| | | @ExcelComment(value = "memo",example = "注:易碎品,轻拿放") |
| | | private String memo; |
| | | |
| | | private Integer rowNum; |
| | | |
| | | private String errorMsg; |
| | | |
| | | @Override |
| | | public Integer getRowNum() { |
| | | return this.rowNum; |
| | | } |
| | | |
| | | @Override |
| | | public void setRowNum(Integer rowNum) { |
| | | this.rowNum = rowNum; |
| | | } |
| | | |
| | | @Override |
| | | public String getErrorMsg() { |
| | | return this.errorMsg; |
| | | } |
| | | |
| | | @Override |
| | | public void setErrorMsg(String errorMsg) { |
| | | this.errorMsg = errorMsg; |
| | | } |
| | | } |
| | |
| | | import lombok.ToString; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | |
| | | * @create 2025/3/3 08:40 |
| | | */ |
| | | @Data |
| | | @ExcelAutoColumnSize |
| | | @Accessors(chain = true) |
| | | @ToString(callSuper = true) |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class MatnrsTemplate implements Serializable { |
| | | public class MatnrsTemplate { |
| | | |
| | | @NotNull |
| | | @Excel(name = "物料名称") |
| | | @ExcelComment(example = "华为手机") |
| | | private String name; |
| | | |
| | | @NotNull |
| | | @Excel(name = "分类助记码") |
| | | @ExcelComment(example = "256874556") |
| | | private String groupCode; |
| | | |
| | | @NotNull |
| | | @Excel(name = "分类名称") |
| | | @ExcelComment(example = "移动设备") |
| | | private String groupName; |
| | | |
| | | @NotNull |
| | | @Excel(name = "物料助记码") |
| | | @ExcelComment(example = "P3528461569") |
| | | private String erpCode; |
| | | |
| | | @NotNull |
| | | @Excel(name = "规格") |
| | | @ExcelComment(example = "HW-148*68*10") |
| | | private String spec; |
| | | |
| | | @NotNull |
| | | @Excel(name = "型号") |
| | | @ExcelComment(example = "华为三折叠") |
| | | private String model; |
| | |
| | | @ExcelComment(notNull = false, example = "新上市三折叠") |
| | | private String nromNum; |
| | | |
| | | @NotNull |
| | | @Excel(name = "主单位") |
| | | @ExcelComment(example = "部") |
| | | private String unit; |
| | |
| | | @ExcelComment(notNull = false, example = "10") |
| | | private String minQty; |
| | | |
| | | @NotNull |
| | | @Excel(name = "最大库存量") |
| | | @ExcelComment(notNull = false, example = "150") |
| | | private String maxQty; |
| | |
| | | import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.common.SpringUtils; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.common.utils.CommonUtil; |
| | | import com.vincent.rsf.server.common.utils.ExcelUtil; |
| | | import com.vincent.rsf.server.common.utils.FieldsUtils; |
| | | import com.vincent.rsf.server.manager.entity.MatnrGroup; |
| | | import com.vincent.rsf.server.manager.entity.excel.MatnrsTemplate; |
| | | import com.vincent.rsf.server.manager.mapper.MatnrMapper; |
| | |
| | | import com.vincent.rsf.server.manager.service.MatnrGroupService; |
| | | import com.vincent.rsf.server.manager.service.MatnrService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.vincent.rsf.server.system.entity.Fields; |
| | | import com.vincent.rsf.server.system.service.FieldsService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | @Service("matnrService") |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R importExcels(MultipartFile file) throws Exception { |
| | | //读取上传文件内容 |
| | | ExcelImportResult<MatnrsTemplate> result = ExcelImportUtil.importExcelMore(file.getInputStream(), MatnrsTemplate.class, ExcelUtil.getDefaultImportParams()); |
| | | ExcelImportResult result = ExcelImportUtil.importExcelMore(file.getInputStream(), MatnrsTemplate.class, ExcelUtil.getDefaultImportParams()); |
| | | if (result.getList().isEmpty()) { |
| | | throw new CoolException("物料导入失败!!"); |
| | | } |
| | | List<Matnr> matnrs = new ArrayList<>(); |
| | | result.getList().forEach(template -> { |
| | | List<Map<String, String>> list = result.getList(); |
| | | list.forEach(template -> { |
| | | Matnr matnr = new Matnr(); |
| | | matnr.setBarcode(template.getBarcode()) |
| | | .setCode(template.getErpCode()) |
| | | .setDescrible(template.getDescrible()) |
| | | .setColor(template.getColor()) |
| | | .setFlagCheck(Short.parseShort(template.getFlagCheck())) |
| | | .setWeight(Double.parseDouble(template.getWeight())) |
| | | .setValidWarn(Integer.parseInt(template.getValidWarn())) |
| | | .setValid(Integer.parseInt(template.getValid())) |
| | | .setUnit(template.getUnit()) |
| | | .setStockUnit(template.getPurUnit()) |
| | | .setSpec(template.getSpec()) |
| | | .setStagn(Integer.parseInt(template.getStagn())) |
| | | .setModel(template.getModel()) |
| | | .setGroupCode(template.getGroupCode()) |
| | | .setPurUnit(template.getPurUnit()) |
| | | .setStockLevel(Short.parseShort(template.getStockLevel())) |
| | | .setSafeQty(Double.parseDouble(template.getSafeQty())) |
| | | .setMinQty(Double.parseDouble(template.getMinQty())); |
| | | if (Objects.isNull(template.getGroupCode()) && Objects.isNull(template.getGroupName())) { |
| | | matnr.setBarcode(template.get("barcode")) |
| | | .setCode(template.get("code")) |
| | | .setDescrible(template.get("describle")) |
| | | .setColor(template.get("color")) |
| | | .setFlagCheck(!Objects.isNull(template.get("flagCheck")) ? Short.parseShort(template.get("flagCheck")) : 0) |
| | | .setWeight(!Objects.isNull(template.get("weight")) ? Double.parseDouble(template.get("weight")) : 0.0) |
| | | .setValidWarn(!Objects.isNull(template.get("validWarn")) ? Integer.parseInt(template.get("validWarn")): 0) |
| | | .setValid(!Objects.isNull(template.get("valid")) ? Integer.parseInt( template.get("valid")) : 0) |
| | | .setUnit(template.get("unit")) |
| | | .setStockUnit(template.get("purUnit")) |
| | | .setSpec(template.get("spec")) |
| | | .setStagn(!Objects.isNull(template.get("stagn")) ? Integer.parseInt(template.get("stagn")) : 0) |
| | | .setModel(template.get("model")) |
| | | .setGroupCode(template.get("groupCode")) |
| | | .setPurUnit(template.get("purUnit")) |
| | | .setStockLevel(!Objects.isNull(template.get("stockLevel")) ? Short.parseShort(template.get("stockLevel")) : 0) |
| | | .setSafeQty(!Objects.isNull(template.get("safeQty")) ? Double.parseDouble(template.get("safeQty")) : 0) |
| | | .setMinQty(!Objects.isNull(template.get("safeQty")) ? Double.parseDouble(template.get("minQty")) : 0); |
| | | if (Objects.isNull(template.get("groupCode")) && Objects.isNull(template.get("groupName"))) { |
| | | MatnrGroup matnrGroups = matnrGroupService.getOne(new LambdaQueryWrapper<MatnrGroup>() |
| | | .eq(!Objects.isNull(template.getGroupCode()), MatnrGroup::getCode, template.getGroupCode()) |
| | | .eq(!Objects.isNull(template.getGroupName()),MatnrGroup::getName, template.getName())); |
| | | .eq(!Objects.isNull(template.get("groupCode")), MatnrGroup::getCode, template.get("groupCode")) |
| | | .eq(!Objects.isNull(template.get("groupName")),MatnrGroup::getName, template.get("groupName"))); |
| | | matnr.setGroupId(matnrGroups.getId()); |
| | | } |
| | | |
| | | //获取动态字段,并保存明细内容 |
| | | if (!FieldsUtils.getFieldsSta().isEmpty()) { |
| | | String uuid = CommonUtil.randomUUID16(); |
| | | matnr.setFieldsIndex(uuid); |
| | | //保存物料扩展属性值 |
| | | FieldsUtils.saveFields(template, uuid); |
| | | } |
| | | matnrs.add(matnr); |
| | | }); |
| | | |
| | |
| | | # global-config:
|
| | | # field-strategy: 0
|
| | | configuration:
|
| | | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
| | | # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
| | | map-underscore-to-camel-case: true
|
| | | cache-enabled: true
|
| | | global-config:
|
New file |
| | |
| | | <?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.vincent.rsf.server.test.mapper.LocMapper"> |
| | | |
| | | </mapper> |