优化
This commit is contained in:
@@ -20,10 +20,12 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Repository
|
@Repository
|
||||||
public interface MaterialInfoMapper extends BaseMapper<MaterialInfoDO> {
|
public interface MaterialInfoMapper extends BaseMapper<MaterialInfoDO> {
|
||||||
public int updateByName(List<MaterialInfoDO> list);
|
int updateByName(@Param("list") List<MaterialInfoDO> list);
|
||||||
|
|
||||||
public int updateByCode(List<MaterialInfoDO> list);
|
int updateByCode(@Param("list") List<MaterialInfoDO> list);
|
||||||
|
|
||||||
IPage<MaterialInfoResp> selectMaterialInfoPage(@Param("page") Page<Object> objectPage,
|
IPage<MaterialInfoResp> selectMaterialInfoPage(@Param("page") Page<Object> objectPage,
|
||||||
@Param(Constants.WRAPPER) QueryWrapper<MaterialInfoDO> queryWrapper);
|
@Param(Constants.WRAPPER) QueryWrapper<MaterialInfoDO> queryWrapper);
|
||||||
|
|
||||||
|
List<MaterialInfoResp> selectMaterialInfoExport(@Param(Constants.WRAPPER) QueryWrapper<MaterialInfoDO> queryWrapper);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package top.wms.admin.material.model.req;
|
package top.wms.admin.material.model.req;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.hibernate.validator.constraints.Length;
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
@@ -35,6 +37,7 @@ public class MaterialImportRowReq implements Serializable {
|
|||||||
* 物料单位重量(g)
|
* 物料单位重量(g)
|
||||||
*/
|
*/
|
||||||
@Schema(description = "物料单位重量(g)")
|
@Schema(description = "物料单位重量(g)")
|
||||||
|
@NotNull(message = "物料单位重量不能为空")
|
||||||
private BigDecimal unitWeight;
|
private BigDecimal unitWeight;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -42,4 +45,17 @@ public class MaterialImportRowReq implements Serializable {
|
|||||||
* */
|
* */
|
||||||
@Schema(description = "物料规格")
|
@Schema(description = "物料规格")
|
||||||
private String materialSpec;
|
private String materialSpec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料类型名称
|
||||||
|
*/
|
||||||
|
@Schema(description = "物料类型名称")
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流程名称
|
||||||
|
*/
|
||||||
|
@Schema(description = "流程名称")
|
||||||
|
private String processName;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ public class MaterialInfoReq implements Serializable {
|
|||||||
* 物料单位重量(g)
|
* 物料单位重量(g)
|
||||||
*/
|
*/
|
||||||
@Schema(description = "物料单位重量(g)")
|
@Schema(description = "物料单位重量(g)")
|
||||||
|
@NotNull(message = "物料单位重量不能为空")
|
||||||
private Double unitWeight;
|
private Double unitWeight;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||||||
import top.wms.admin.common.model.resp.BaseDetailResp;
|
import top.wms.admin.common.model.resp.BaseDetailResp;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 物料信息信息
|
* 物料信息信息
|
||||||
@@ -62,13 +63,43 @@ public class MaterialInfoResp extends BaseDetailResp {
|
|||||||
* 物料类型名称
|
* 物料类型名称
|
||||||
*/
|
*/
|
||||||
@Schema(description = "物料类型名称")
|
@Schema(description = "物料类型名称")
|
||||||
@ExcelIgnore
|
@ExcelProperty(value = "物料类型")
|
||||||
private String typeName;
|
private String typeName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程名称
|
* 流程名称
|
||||||
*/
|
*/
|
||||||
@Schema(description = "流程名称")
|
@Schema(description = "流程名称")
|
||||||
@ExcelIgnore
|
@ExcelProperty(value = "物料流程")
|
||||||
private String processName;
|
private String processName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料类型ID
|
||||||
|
*/
|
||||||
|
@Schema(description = "物料类型ID")
|
||||||
|
@ExcelIgnore
|
||||||
|
private Long materialTypeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流程ID
|
||||||
|
*/
|
||||||
|
@Schema(description = "流程ID")
|
||||||
|
@ExcelIgnore
|
||||||
|
private Long materialProcessId;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 品类下行浮动范围(%)
|
||||||
|
*/
|
||||||
|
@Schema(description = "品类下行浮动范围(%)")
|
||||||
|
@ExcelIgnore
|
||||||
|
private BigDecimal downFloatRatio;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 品类上行浮动范围(%)
|
||||||
|
*/
|
||||||
|
@Schema(description = "品类上行浮动范围(%)")
|
||||||
|
@ExcelIgnore
|
||||||
|
private BigDecimal upFloatRatio;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,11 +21,13 @@ import java.io.IOException;
|
|||||||
*/
|
*/
|
||||||
public interface MaterialInfoService extends BaseService<MaterialInfoResp, MaterialInfoResp, MaterialInfoQuery, MaterialInfoReq> {
|
public interface MaterialInfoService extends BaseService<MaterialInfoResp, MaterialInfoResp, MaterialInfoQuery, MaterialInfoReq> {
|
||||||
|
|
||||||
/*
|
/**
|
||||||
*
|
* 根据编码查询物料信息
|
||||||
* 根据编码查询物料信息
|
*
|
||||||
* */
|
* @param code 物料编码
|
||||||
public MaterialInfoDO getMaterialInfoByCode(String code);
|
* @return 物料信息
|
||||||
|
*/
|
||||||
|
MaterialInfoResp getMaterialInfoByCode(String code);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下载导入模板
|
* 下载导入模板
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import cn.hutool.extra.validation.ValidationUtil;
|
|||||||
import cn.hutool.http.ContentType;
|
import cn.hutool.http.ContentType;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.alibaba.excel.EasyExcel;
|
import com.alibaba.excel.EasyExcel;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
@@ -31,8 +32,10 @@ import top.continew.starter.cache.redisson.util.RedisUtils;
|
|||||||
import top.continew.starter.core.exception.BusinessException;
|
import top.continew.starter.core.exception.BusinessException;
|
||||||
import top.continew.starter.core.validation.CheckUtils;
|
import top.continew.starter.core.validation.CheckUtils;
|
||||||
import top.continew.starter.extension.crud.model.query.PageQuery;
|
import top.continew.starter.extension.crud.model.query.PageQuery;
|
||||||
|
import top.continew.starter.extension.crud.model.query.SortQuery;
|
||||||
import top.continew.starter.extension.crud.model.resp.PageResp;
|
import top.continew.starter.extension.crud.model.resp.PageResp;
|
||||||
import top.continew.starter.extension.crud.service.BaseServiceImpl;
|
import top.continew.starter.extension.crud.service.BaseServiceImpl;
|
||||||
|
import top.continew.starter.file.excel.util.ExcelUtils;
|
||||||
import top.continew.starter.web.util.FileUploadUtils;
|
import top.continew.starter.web.util.FileUploadUtils;
|
||||||
import top.wms.admin.common.constant.CacheConstants;
|
import top.wms.admin.common.constant.CacheConstants;
|
||||||
import top.wms.admin.common.context.UserContextHolder;
|
import top.wms.admin.common.context.UserContextHolder;
|
||||||
@@ -47,6 +50,10 @@ import top.wms.admin.material.model.resp.MaterialImportParseResp;
|
|||||||
import top.wms.admin.material.model.resp.MaterialInfoImportResp;
|
import top.wms.admin.material.model.resp.MaterialInfoImportResp;
|
||||||
import top.wms.admin.material.model.resp.MaterialInfoResp;
|
import top.wms.admin.material.model.resp.MaterialInfoResp;
|
||||||
import top.wms.admin.material.service.MaterialInfoService;
|
import top.wms.admin.material.service.MaterialInfoService;
|
||||||
|
import top.wms.admin.materialProcess.mapper.MaterialProcessMapper;
|
||||||
|
import top.wms.admin.materialProcess.model.entity.MaterialProcessDO;
|
||||||
|
import top.wms.admin.materialType.mapper.MaterialTypeMapper;
|
||||||
|
import top.wms.admin.materialType.model.entity.MaterialTypeDO;
|
||||||
import top.wms.admin.system.service.FileService;
|
import top.wms.admin.system.service.FileService;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
@@ -55,6 +62,7 @@ import java.io.ByteArrayOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -79,6 +87,10 @@ public class MaterialInfoServiceImpl extends BaseServiceImpl<MaterialInfoMapper,
|
|||||||
|
|
||||||
private final FileService fileService;
|
private final FileService fileService;
|
||||||
|
|
||||||
|
private final MaterialTypeMapper materialTypeMapper;
|
||||||
|
|
||||||
|
private final MaterialProcessMapper materialProcessMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResp<MaterialInfoResp> page(MaterialInfoQuery query, PageQuery pageQuery) {
|
public PageResp<MaterialInfoResp> page(MaterialInfoQuery query, PageQuery pageQuery) {
|
||||||
QueryWrapper<MaterialInfoDO> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<MaterialInfoDO> queryWrapper = new QueryWrapper<>();
|
||||||
@@ -93,12 +105,28 @@ public class MaterialInfoServiceImpl extends BaseServiceImpl<MaterialInfoMapper,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MaterialInfoDO getMaterialInfoByCode(String code) {
|
public void export(MaterialInfoQuery query, SortQuery sortQuery, HttpServletResponse response) {
|
||||||
if (StrUtil.isNotBlank(code)) {
|
|
||||||
return baseMapper.lambdaQuery().eq(MaterialInfoDO::getEncoding, code).one();
|
QueryWrapper<MaterialInfoDO> queryWrapper = new QueryWrapper<>();
|
||||||
} else {
|
queryWrapper.like(StrUtil.isNotBlank(query.getMaterialName()), "mi.material_name", query.getMaterialName());
|
||||||
return null;
|
queryWrapper.likeLeft(StrUtil.isNotBlank(query.getEncoding()), "mi.encoding", query.getEncoding());
|
||||||
}
|
this.sort(queryWrapper, sortQuery);
|
||||||
|
|
||||||
|
List<MaterialInfoResp> list = baseMapper.selectMaterialInfoExport(queryWrapper);
|
||||||
|
ExcelUtils.export(list, "物料信息导出", MaterialInfoResp.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MaterialInfoResp getMaterialInfoByCode(String code) {
|
||||||
|
MaterialInfoResp materialInfoResp = new MaterialInfoResp();
|
||||||
|
MaterialInfoDO materialInfoDO = baseMapper.lambdaQuery().eq(MaterialInfoDO::getEncoding, code).one();
|
||||||
|
CheckUtils.throwIf(materialInfoDO == null, "物料信息不存在");
|
||||||
|
MaterialTypeDO materialTypeDO = materialTypeMapper.selectById(materialInfoDO.getMaterialTypeId());
|
||||||
|
CheckUtils.throwIf(materialTypeDO == null, "该物料对应类型不存在");
|
||||||
|
BeanUtil.copyProperties(materialInfoDO, materialInfoResp);
|
||||||
|
materialInfoResp.setUpFloatRatio(materialTypeDO.getUpFloatRatio());
|
||||||
|
materialInfoResp.setDownFloatRatio(materialTypeDO.getDownFloatRatio());
|
||||||
|
return materialInfoResp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -107,7 +135,7 @@ public class MaterialInfoServiceImpl extends BaseServiceImpl<MaterialInfoMapper,
|
|||||||
FileUploadUtils.download(response, ResourceUtil
|
FileUploadUtils.download(response, ResourceUtil
|
||||||
.getStream("templates/import/materialInfo.xlsx"), "物料信息导入模板.xlsx");
|
.getStream("templates/import/materialInfo.xlsx"), "物料信息导入模板.xlsx");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("下载用户导入模板失败:{}", e);
|
log.error("下载用户导入模板失败:", e);
|
||||||
response.setCharacterEncoding(CharsetUtil.UTF_8);
|
response.setCharacterEncoding(CharsetUtil.UTF_8);
|
||||||
response.setContentType(ContentType.JSON.toString());
|
response.setContentType(ContentType.JSON.toString());
|
||||||
response.getWriter().write(JSONUtil.toJsonStr(R.fail("下载用户导入模板失败")));
|
response.getWriter().write(JSONUtil.toJsonStr(R.fail("下载用户导入模板失败")));
|
||||||
@@ -126,7 +154,7 @@ public class MaterialInfoServiceImpl extends BaseServiceImpl<MaterialInfoMapper,
|
|||||||
.headRowNumber(1)
|
.headRowNumber(1)
|
||||||
.doReadSync();
|
.doReadSync();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("物料信息导入数据文件解析异常:{}", e);
|
log.error("物料信息导入数据文件解析异常:", e);
|
||||||
throw new BusinessException("数据文件解析异常");
|
throw new BusinessException("数据文件解析异常");
|
||||||
}
|
}
|
||||||
// 总计行数
|
// 总计行数
|
||||||
@@ -144,10 +172,10 @@ public class MaterialInfoServiceImpl extends BaseServiceImpl<MaterialInfoMapper,
|
|||||||
.anyMatch(encoding -> encoding != null && !seenCode.add(encoding));
|
.anyMatch(encoding -> encoding != null && !seenCode.add(encoding));
|
||||||
CheckUtils.throwIf(hasDuplicateEncoding, "存在重复物料编码,请检测数据");
|
CheckUtils.throwIf(hasDuplicateEncoding, "存在重复物料编码,请检测数据");
|
||||||
|
|
||||||
// 查询重复用户
|
// 查询重复物料名
|
||||||
materialImportResp
|
materialImportResp
|
||||||
.setDuplicateNameRows(countExistByField(validRowList, MaterialImportRowReq::getMaterialName, MaterialInfoDO::getMaterialName, false));
|
.setDuplicateNameRows(countExistByField(validRowList, MaterialImportRowReq::getMaterialName, MaterialInfoDO::getMaterialName, false));
|
||||||
// 查询重复邮箱
|
// 查询重复物料编码
|
||||||
materialImportResp
|
materialImportResp
|
||||||
.setDuplicateCodeRows(countExistByField(validRowList, MaterialImportRowReq::getEncoding, MaterialInfoDO::getEncoding, false));
|
.setDuplicateCodeRows(countExistByField(validRowList, MaterialImportRowReq::getEncoding, MaterialInfoDO::getEncoding, false));
|
||||||
// 设置导入会话并缓存数据,有效期10分钟
|
// 设置导入会话并缓存数据,有效期10分钟
|
||||||
@@ -175,33 +203,46 @@ public class MaterialInfoServiceImpl extends BaseServiceImpl<MaterialInfoMapper,
|
|||||||
List<String> existName = listExistByField(importMaterialList, MaterialImportRowReq::getMaterialName, MaterialInfoDO::getMaterialName);
|
List<String> existName = listExistByField(importMaterialList, MaterialImportRowReq::getMaterialName, MaterialInfoDO::getMaterialName);
|
||||||
List<String> existCode = listExistByField(importMaterialList, MaterialImportRowReq::getEncoding, MaterialInfoDO::getEncoding);
|
List<String> existCode = listExistByField(importMaterialList, MaterialImportRowReq::getEncoding, MaterialInfoDO::getEncoding);
|
||||||
CheckUtils.throwIf(isExitImportMaterial(req, importMaterialList, existName, existCode), "数据不符合导入策略,已退出导入");
|
CheckUtils.throwIf(isExitImportMaterial(req, importMaterialList, existName, existCode), "数据不符合导入策略,已退出导入");
|
||||||
|
|
||||||
|
//查询物料类型
|
||||||
|
List<String> collect = importMaterialList.stream().map(MaterialImportRowReq::getTypeName).distinct().toList();
|
||||||
|
Map<String, Long> materialTypeMap = new HashMap<>();
|
||||||
|
if(CollUtil.isNotEmpty(collect)){
|
||||||
|
List<MaterialTypeDO> materialTypeList = materialTypeMapper.selectList(new LambdaQueryWrapper<MaterialTypeDO>().in(MaterialTypeDO::getTypeName, collect));
|
||||||
|
materialTypeMap = materialTypeList.stream().collect(Collectors.toMap(MaterialTypeDO::getTypeName, MaterialTypeDO::getId, (k1, v1) -> v1));
|
||||||
|
}
|
||||||
|
//查询物料流程
|
||||||
|
List<String> collect1 = importMaterialList.stream().map(MaterialImportRowReq::getProcessName).distinct().toList();
|
||||||
|
List<MaterialProcessDO> materialProcessList = materialProcessMapper.selectList(new LambdaQueryWrapper<MaterialProcessDO>().in(MaterialProcessDO::getProcessName, collect1));
|
||||||
|
Map<String, Long> materialProcessMap = new HashMap<>();
|
||||||
|
if(CollUtil.isNotEmpty(materialProcessList)) {
|
||||||
|
materialProcessMap = materialProcessList.stream().collect(Collectors.toMap(MaterialProcessDO::getProcessName, MaterialProcessDO::getId, (k1, v1) -> v1));
|
||||||
|
}
|
||||||
|
|
||||||
// 批量操作数据库集合
|
// 批量操作数据库集合
|
||||||
List<MaterialInfoDO> insertList = new ArrayList<>();
|
List<MaterialInfoDO> insertList = new ArrayList<>();
|
||||||
List<MaterialInfoDO> updateByNameList = new ArrayList<>();
|
List<MaterialInfoDO> updateByNameList = new ArrayList<>();
|
||||||
List<MaterialInfoDO> updateByCodeList = new ArrayList<>();
|
List<MaterialInfoDO> updateByCodeList = new ArrayList<>();
|
||||||
// ID生成器
|
// ID生成器
|
||||||
// IdGenerator idGenerator = DefaultIdGeneratorProvider.INSTANCE.getShare();
|
|
||||||
for (MaterialImportRowReq row : importMaterialList) {
|
for (MaterialImportRowReq row : importMaterialList) {
|
||||||
if (isSkipMaterialImport(req, row, existName, existCode)) {
|
if (isSkipMaterialImport(req, row, existName, existCode)) {
|
||||||
// 按规则跳过该行
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
MaterialInfoDO materialDO = BeanUtil.toBeanIgnoreError(row, MaterialInfoDO.class);
|
MaterialInfoDO materialDO = BeanUtil.toBeanIgnoreError(row, MaterialInfoDO.class);
|
||||||
materialDO.setUnitWeight(NumberUtil.isValidNumber(row.getUnitWeight()) ? row.getUnitWeight() : null);
|
materialDO.setUnitWeight(NumberUtil.isValidNumber(row.getUnitWeight()) ? row.getUnitWeight() : null);
|
||||||
materialDO.setMaterialSpec(StrUtil.isNotBlank(row.getMaterialSpec()) ? row.getMaterialSpec() : null);
|
materialDO.setMaterialSpec(StrUtil.isNotBlank(row.getMaterialSpec()) ? row.getMaterialSpec() : null);
|
||||||
|
materialDO.setMaterialProcessId(materialProcessMap.get(row.getProcessName()));
|
||||||
|
materialDO.setMaterialTypeId(materialTypeMap.get(row.getTypeName()));
|
||||||
// 修改 or 新增
|
// 修改 or 新增
|
||||||
if (UPDATE.validate(req.getDuplicateName(), row.getMaterialName(), existName)) {
|
if (UPDATE.validate(req.getDuplicateName(), row.getMaterialName(), existName)) {
|
||||||
materialDO.setMaterialName(row.getMaterialName());
|
materialDO.setMaterialName(row.getMaterialName());
|
||||||
materialDO.setUpdateTime(LocalDateTime.now());
|
|
||||||
materialDO.setUpdateUser(UserContextHolder.getUserId());
|
materialDO.setUpdateUser(UserContextHolder.getUserId());
|
||||||
updateByNameList.add(materialDO);
|
updateByNameList.add(materialDO);
|
||||||
} else if (UPDATE.validate(req.getDuplicateCode(), row.getEncoding(), existCode)) {
|
} else if (UPDATE.validate(req.getDuplicateCode(), row.getEncoding(), existCode)) {
|
||||||
materialDO.setEncoding(row.getEncoding());
|
materialDO.setEncoding(row.getEncoding());
|
||||||
materialDO.setUpdateTime(LocalDateTime.now());
|
|
||||||
materialDO.setUpdateUser(UserContextHolder.getUserId());
|
materialDO.setUpdateUser(UserContextHolder.getUserId());
|
||||||
updateByCodeList.add(materialDO);
|
updateByCodeList.add(materialDO);
|
||||||
} else {
|
} else {
|
||||||
// materialDO.setId(idGenerator.generate());
|
|
||||||
insertList.add(materialDO);
|
insertList.add(materialDO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -245,16 +286,9 @@ public class MaterialInfoServiceImpl extends BaseServiceImpl<MaterialInfoMapper,
|
|||||||
*/
|
*/
|
||||||
private List<MaterialImportRowReq> filterImportData(List<MaterialImportRowReq> importRowList) {
|
private List<MaterialImportRowReq> filterImportData(List<MaterialImportRowReq> importRowList) {
|
||||||
// 校验过滤
|
// 校验过滤
|
||||||
List<MaterialImportRowReq> list = importRowList.stream()
|
return importRowList.stream()
|
||||||
.filter(row -> ValidationUtil.validate(row).isEmpty())
|
.filter(row -> ValidationUtil.validate(row).isEmpty())
|
||||||
.toList();
|
.toList();
|
||||||
// 物料名去重
|
|
||||||
return list.stream()
|
|
||||||
.collect(Collectors.toMap(MaterialImportRowReq::getMaterialName, row -> row, (existing,
|
|
||||||
replacement) -> existing))
|
|
||||||
.values()
|
|
||||||
.stream()
|
|
||||||
.toList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -339,7 +373,7 @@ public class MaterialInfoServiceImpl extends BaseServiceImpl<MaterialInfoMapper,
|
|||||||
// 1. 初始化物料编码-照片地址Map
|
// 1. 初始化物料编码-照片地址Map
|
||||||
Map<String, String> codeUrlMap = new HashMap<>();
|
Map<String, String> codeUrlMap = new HashMap<>();
|
||||||
// 物料照片存储路径(自定义,比如按日期分目录)
|
// 物料照片存储路径(自定义,比如按日期分目录)
|
||||||
String photoStoragePath = "/" + DateUtil.today() + "/";
|
String photoStoragePath = "material/";
|
||||||
|
|
||||||
try (ZipInputStream zipInputStream = new ZipInputStream(zipFile.getInputStream())) {
|
try (ZipInputStream zipInputStream = new ZipInputStream(zipFile.getInputStream())) {
|
||||||
ZipEntry zipEntry;
|
ZipEntry zipEntry;
|
||||||
@@ -351,7 +385,7 @@ public class MaterialInfoServiceImpl extends BaseServiceImpl<MaterialInfoMapper,
|
|||||||
}
|
}
|
||||||
// 2. 提取物料编码(照片名 = 物料编码,去掉后缀)
|
// 2. 提取物料编码(照片名 = 物料编码,去掉后缀)
|
||||||
String fileName = zipEntry.getName();
|
String fileName = zipEntry.getName();
|
||||||
log.info("正在处理的照片:" + fileName);
|
log.info("正在处理的照片:{}", fileName);
|
||||||
//去除windows或linux环境下 可能存在的多层级目录
|
//去除windows或linux环境下 可能存在的多层级目录
|
||||||
if (fileName.contains("/")) {
|
if (fileName.contains("/")) {
|
||||||
fileName = fileName.substring(fileName.lastIndexOf("/") + 1);
|
fileName = fileName.substring(fileName.lastIndexOf("/") + 1);
|
||||||
@@ -378,7 +412,7 @@ public class MaterialInfoServiceImpl extends BaseServiceImpl<MaterialInfoMapper,
|
|||||||
.equals("jpg") ? "jpeg" : imageExt), imageBytes);
|
.equals("jpg") ? "jpeg" : imageExt), imageBytes);
|
||||||
|
|
||||||
// 6. 调用upload方法上传图片
|
// 6. 调用upload方法上传图片
|
||||||
FileInfo fileInfo = fileService.upload(singleImageFile, photoStoragePath, null, true, true);
|
FileInfo fileInfo = fileService.upload(singleImageFile, photoStoragePath, null, false, false);
|
||||||
|
|
||||||
// 7. 将物料编码和图片URL存入Map
|
// 7. 将物料编码和图片URL存入Map
|
||||||
codeUrlMap.put(materialCode, fileInfo.getUrl());
|
codeUrlMap.put(materialCode, fileInfo.getUrl());
|
||||||
|
|||||||
@@ -28,7 +28,12 @@ public class MaterialTypeDO extends BaseDO {
|
|||||||
private String typeName;
|
private String typeName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 品类浮动比
|
* 品类下行浮动范围(%)
|
||||||
*/
|
*/
|
||||||
private BigDecimal floatRatio;
|
private BigDecimal downFloatRatio;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 品类上行浮动范围(%)
|
||||||
|
*/
|
||||||
|
private BigDecimal upFloatRatio;
|
||||||
}
|
}
|
||||||
@@ -32,10 +32,4 @@ public class MaterialTypeQuery implements Serializable {
|
|||||||
@Query(type = QueryType.EQ)
|
@Query(type = QueryType.EQ)
|
||||||
private String typeName;
|
private String typeName;
|
||||||
|
|
||||||
/**
|
|
||||||
* 品类浮动比
|
|
||||||
*/
|
|
||||||
@Schema(description = "品类浮动比")
|
|
||||||
@Query(type = QueryType.EQ)
|
|
||||||
private BigDecimal floatRatio;
|
|
||||||
}
|
}
|
||||||
@@ -38,6 +38,13 @@ public class MaterialTypeReq implements Serializable {
|
|||||||
* 品类浮动比
|
* 品类浮动比
|
||||||
*/
|
*/
|
||||||
@Schema(description = "品类浮动比")
|
@Schema(description = "品类浮动比")
|
||||||
@NotNull(message = "品类浮动比不能为空")
|
@NotNull(message = "品类下行浮动范围不能为空")
|
||||||
private BigDecimal floatRatio;
|
private BigDecimal downFloatRatio;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 品类上行浮动范围(%)
|
||||||
|
*/
|
||||||
|
@Schema(description = "品类上行浮动范围(%)")
|
||||||
|
@NotNull(message = "品类上行浮动范围不能为空")
|
||||||
|
private BigDecimal upFloatRatio;
|
||||||
}
|
}
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
package top.wms.admin.materialType.model.resp;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
|
||||||
|
|
||||||
import top.wms.admin.common.model.resp.BaseDetailResp;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.time.*;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 物料品类详情信息
|
|
||||||
*
|
|
||||||
* @author zc
|
|
||||||
* @since 2026/03/16 11:18
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@ExcelIgnoreUnannotated
|
|
||||||
@Schema(description = "物料品类详情信息")
|
|
||||||
public class MaterialTypeDetailResp extends BaseDetailResp {
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 品类名称
|
|
||||||
*/
|
|
||||||
@Schema(description = "品类名称")
|
|
||||||
@ExcelProperty(value = "品类名称")
|
|
||||||
private String typeName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 品类浮动比
|
|
||||||
*/
|
|
||||||
@Schema(description = "品类浮动比")
|
|
||||||
@ExcelProperty(value = "品类浮动比")
|
|
||||||
private BigDecimal floatRatio;
|
|
||||||
}
|
|
||||||
@@ -30,8 +30,14 @@ public class MaterialTypeResp extends BaseDetailResp {
|
|||||||
private String typeName;
|
private String typeName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 品类浮动比
|
* 品类下行浮动范围(%)
|
||||||
*/
|
*/
|
||||||
@Schema(description = "品类浮动比")
|
@Schema(description = "品类下行浮动范围(%)")
|
||||||
private BigDecimal floatRatio;
|
private BigDecimal downFloatRatio;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 品类上行浮动范围(%)
|
||||||
|
*/
|
||||||
|
@Schema(description = "品类上行浮动范围(%)")
|
||||||
|
private BigDecimal upFloatRatio;
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,7 @@ import top.wms.admin.weighManage.model.resp.WorkOrderInfoResp;
|
|||||||
import top.wms.admin.weighManage.model.resp.WorkOrderResp;
|
import top.wms.admin.weighManage.model.resp.WorkOrderResp;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 任务工单信息业务接口
|
* 任务工单信息业务接口
|
||||||
@@ -46,5 +47,5 @@ public interface WorkOrderService extends BaseService<WorkOrderResp, WorkOrderRe
|
|||||||
* @param req
|
* @param req
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int validateWeighing(WorkOrderReq req);
|
Map<String, String> validateWeighing(WorkOrderReq req);
|
||||||
}
|
}
|
||||||
@@ -11,12 +11,15 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import top.continew.starter.core.validation.CheckUtils;
|
||||||
import top.continew.starter.extension.crud.model.query.PageQuery;
|
import top.continew.starter.extension.crud.model.query.PageQuery;
|
||||||
import top.continew.starter.extension.crud.model.resp.PageResp;
|
import top.continew.starter.extension.crud.model.resp.PageResp;
|
||||||
import top.continew.starter.extension.crud.service.BaseServiceImpl;
|
import top.continew.starter.extension.crud.service.BaseServiceImpl;
|
||||||
import top.wms.admin.common.context.UserContextHolder;
|
import top.wms.admin.common.context.UserContextHolder;
|
||||||
import top.wms.admin.material.mapper.MaterialInfoMapper;
|
import top.wms.admin.material.mapper.MaterialInfoMapper;
|
||||||
import top.wms.admin.material.model.entity.MaterialInfoDO;
|
import top.wms.admin.material.model.entity.MaterialInfoDO;
|
||||||
|
import top.wms.admin.materialType.mapper.MaterialTypeMapper;
|
||||||
|
import top.wms.admin.materialType.model.entity.MaterialTypeDO;
|
||||||
import top.wms.admin.system.service.ConfigService;
|
import top.wms.admin.system.service.ConfigService;
|
||||||
import top.wms.admin.weighManage.mapper.WorkOrderInfoMapper;
|
import top.wms.admin.weighManage.mapper.WorkOrderInfoMapper;
|
||||||
import top.wms.admin.weighManage.mapper.WorkOrderMapper;
|
import top.wms.admin.weighManage.mapper.WorkOrderMapper;
|
||||||
@@ -31,7 +34,9 @@ import top.wms.admin.weighManage.service.WorkOrderService;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 任务工单信息业务实现
|
* 任务工单信息业务实现
|
||||||
@@ -48,6 +53,8 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
|
|||||||
|
|
||||||
private final MaterialInfoMapper materialInfoMapper;
|
private final MaterialInfoMapper materialInfoMapper;
|
||||||
|
|
||||||
|
private final MaterialTypeMapper materialTypeMapper;
|
||||||
|
|
||||||
private final ConfigService configService;
|
private final ConfigService configService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -124,35 +131,47 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int validateWeighing(WorkOrderReq req) {
|
public Map<String, String> validateWeighing(WorkOrderReq req) {
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
map.put("code", "200");
|
||||||
log.info("validateWeighing req:{}", req);
|
log.info("validateWeighing req:{}", req);
|
||||||
String configValue = configService.getConfigValue("weight_float_ratio");
|
|
||||||
BigDecimal weightFloat = new BigDecimal("0.06");
|
|
||||||
if (StrUtil.isNotBlank(configValue)) {
|
|
||||||
weightFloat = new BigDecimal(configValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
MaterialInfoDO materialInfoDO = materialInfoMapper.selectById(req.getMaterialId());
|
||||||
|
CheckUtils.throwIf((materialInfoDO == null || null == materialInfoDO.getMaterialTypeId()), "该物料信息不全,请先维护!");
|
||||||
|
MaterialTypeDO materialTypeDO = materialTypeMapper.selectById(materialInfoDO.getMaterialTypeId());
|
||||||
|
CheckUtils.throwIf((materialTypeDO == null || null == materialTypeDO.getDownFloatRatio() || null == materialTypeDO.getUpFloatRatio()), "该物料品类信息不全,请先维护!");
|
||||||
|
|
||||||
|
//下行浮动范围
|
||||||
|
BigDecimal downFloatRatio = materialTypeDO.getDownFloatRatio();
|
||||||
|
//上行浮动范围
|
||||||
|
BigDecimal upFloatRatio = materialTypeDO.getUpFloatRatio();
|
||||||
//计算标准重量
|
//计算标准重量
|
||||||
BigDecimal standardWeight = new BigDecimal(req.getCalculatedWeight());
|
BigDecimal standardWeight = new BigDecimal(req.getCalculatedWeight());
|
||||||
|
//电子秤重量
|
||||||
BigDecimal electronicWeight = new BigDecimal(req.getAhDeviceWeight());
|
BigDecimal electronicWeight = new BigDecimal(req.getAhDeviceWeight());
|
||||||
|
|
||||||
// 检查 electronicWeight 是否大于 standardWeight
|
// 计算比值:(实重 - 标重) / 标重
|
||||||
if (electronicWeight.compareTo(standardWeight) <= 0) {
|
|
||||||
log.error("电子秤重量必须大于标准重量");
|
|
||||||
return 500; // 电子秤重量必须大于标准重量
|
|
||||||
}
|
|
||||||
|
|
||||||
// 计算比值:(electronicWeight - standardWeight) / standardWeight
|
|
||||||
BigDecimal weightDifference = electronicWeight.subtract(standardWeight);
|
BigDecimal weightDifference = electronicWeight.subtract(standardWeight);
|
||||||
BigDecimal ratio = weightDifference.divide(standardWeight, 4, BigDecimal.ROUND_HALF_UP);
|
BigDecimal ratio = weightDifference.divide(standardWeight, 4, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100));
|
||||||
|
log.info("ratio当前比值:{}%", ratio);
|
||||||
|
|
||||||
// 检查比值是否超过 6%
|
// 检查比值是否超过上行浮动范围
|
||||||
if (ratio.compareTo(weightFloat) > 0) {
|
if (ratio.compareTo(upFloatRatio) > 0) {
|
||||||
log.error("比值超过 6%,当前比值: {}", ratio);
|
log.info("比值超过 {}%", upFloatRatio);
|
||||||
return 500; // 比值超过 6%
|
map.put("code", "502");
|
||||||
|
map.put("msg", "数量不足");
|
||||||
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 200; // 验证通过
|
// 检查比值是否超过下行浮动范围
|
||||||
|
if (ratio.compareTo(downFloatRatio) < 0) {
|
||||||
|
log.info("比值超过下限 {}%", downFloatRatio);
|
||||||
|
map.put("code", "501");
|
||||||
|
map.put("msg", "数量过多");
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -6,22 +6,21 @@
|
|||||||
<update id="updateByName">
|
<update id="updateByName">
|
||||||
<foreach collection="list" item="item" separator=";">
|
<foreach collection="list" item="item" separator=";">
|
||||||
UPDATE sys_material_info
|
UPDATE sys_material_info
|
||||||
SET
|
<set>
|
||||||
<if test="item.encoding != null and item.encoding != ''" >
|
<if test="item.encoding != null and item.encoding != ''" >
|
||||||
encoding = #{item.encoding},
|
encoding = #{item.encoding},
|
||||||
</if>
|
</if>
|
||||||
<if test="item.unitWeight != null">
|
<if test="item.unitWeight != null">
|
||||||
unit_weight = #{item.unitWeight},
|
unit_weight = #{item.unitWeight},
|
||||||
</if>
|
</if>
|
||||||
<if test="item.materialSpec != null and item.materialSpec != ''">
|
<if test="item.materialSpec != null and item.materialSpec != ''">
|
||||||
material_spec = #{item.materialSpec},
|
material_spec = #{item.materialSpec},
|
||||||
</if>
|
</if>
|
||||||
<if test="item.updateTime != null">
|
<if test="item.updateUser != null">
|
||||||
update_time = NOW(),
|
update_user = #{item.updateUser},
|
||||||
</if>
|
</if>
|
||||||
<if test="item.updateUser != null and item.updateUser != ''">
|
update_time = NOW()
|
||||||
update_user = #{item.updateUser}
|
</set>
|
||||||
</if>
|
|
||||||
WHERE material_name = #{item.materialName}
|
WHERE material_name = #{item.materialName}
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
@@ -29,22 +28,21 @@
|
|||||||
<update id="updateByCode">
|
<update id="updateByCode">
|
||||||
<foreach collection="list" item="item" separator=";">
|
<foreach collection="list" item="item" separator=";">
|
||||||
UPDATE sys_material_info
|
UPDATE sys_material_info
|
||||||
SET
|
<set>
|
||||||
<if test="item.materialName != null and item.materialName != ''">
|
<if test="item.materialName != null and item.materialName != ''">
|
||||||
material_name = #{item.materialName},
|
material_name = #{item.materialName},
|
||||||
</if>
|
</if>
|
||||||
<if test="item.unitWeight != null">
|
<if test="item.unitWeight != null">
|
||||||
unit_weight = #{item.unitWeight},
|
unit_weight = #{item.unitWeight},
|
||||||
</if>
|
</if>
|
||||||
<if test="item.materialSpec != null and item.materialSpec != ''">
|
<if test="item.materialSpec != null and item.materialSpec != ''">
|
||||||
material_spec = #{item.materialSpec},
|
material_spec = #{item.materialSpec},
|
||||||
</if>
|
</if>
|
||||||
<if test="item.updateTime != null">
|
<if test="item.updateUser != null ">
|
||||||
update_time = NOW(),
|
update_user = #{item.updateUser},
|
||||||
</if>
|
</if>
|
||||||
<if test="item.updateUser != null and item.updateUser != ''">
|
update_time = NOW()
|
||||||
update_user = #{item.updateUser}
|
</set>
|
||||||
</if>
|
|
||||||
WHERE encoding = #{item.encoding}
|
WHERE encoding = #{item.encoding}
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
@@ -60,5 +58,16 @@
|
|||||||
left join sys_material_process mp on mi.material_process_id = mp.id
|
left join sys_material_process mp on mi.material_process_id = mp.id
|
||||||
${ew.customSqlSegment}
|
${ew.customSqlSegment}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectMaterialInfoExport" resultType="top.wms.admin.material.model.resp.MaterialInfoResp">
|
||||||
|
SELECT
|
||||||
|
mi.*,
|
||||||
|
mt.type_name typeName,
|
||||||
|
mp.process_name processName
|
||||||
|
FROM
|
||||||
|
sys_material_info mi
|
||||||
|
left join sys_material_type mt on mi.material_type_id = mt.id
|
||||||
|
left join sys_material_process mp on mi.material_process_id = mp.id
|
||||||
|
${ew.customSqlSegment}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package top.wms.admin.controller.meterial;
|
package top.wms.admin.controller.meterial;
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
@@ -29,6 +31,8 @@ import top.wms.admin.material.model.resp.MaterialInfoResp;
|
|||||||
import top.wms.admin.material.service.MaterialInfoService;
|
import top.wms.admin.material.service.MaterialInfoService;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 物料信息管理 API
|
* 物料信息管理 API
|
||||||
@@ -44,10 +48,15 @@ import java.io.IOException;
|
|||||||
public class MaterialInfoController extends BaseController<MaterialInfoService, MaterialInfoResp, MaterialInfoResp, MaterialInfoQuery, MaterialInfoReq> {
|
public class MaterialInfoController extends BaseController<MaterialInfoService, MaterialInfoResp, MaterialInfoResp, MaterialInfoQuery, MaterialInfoReq> {
|
||||||
|
|
||||||
@GetMapping("/code/{code}")
|
@GetMapping("/code/{code}")
|
||||||
public MaterialInfoDO getMaterialInfoByCode(@PathVariable String code) {
|
public MaterialInfoResp getMaterialInfoByCode(@PathVariable String code) {
|
||||||
MaterialInfoDO materialInfoDO = baseService.getMaterialInfoByCode(code);
|
List<String> list = Arrays.asList(code.split(","));
|
||||||
CheckUtils.throwIfEmpty(materialInfoDO, "未查询到相关物料信息");
|
if (CollUtil.isNotEmpty(list) && list.size() > 1) {
|
||||||
return materialInfoDO;
|
code = list.get(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialInfoResp materialInfoResp = baseService.getMaterialInfoByCode(code);
|
||||||
|
CheckUtils.throwIfEmpty(materialInfoResp, "未查询到相关物料信息");
|
||||||
|
return materialInfoResp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "下载导入模板", description = "下载导入模板")
|
@Operation(summary = "下载导入模板", description = "下载导入模板")
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import top.wms.admin.weighManage.model.resp.WorkOrderResp;
|
|||||||
import top.wms.admin.weighManage.service.WorkOrderService;
|
import top.wms.admin.weighManage.service.WorkOrderService;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 任务工单信息管理 API
|
* 任务工单信息管理 API
|
||||||
@@ -71,12 +72,12 @@ public class WorkOrderController extends BaseController<WorkOrderService, WorkOr
|
|||||||
if (StrUtil.isBlank(req.getAhDeviceWeight())) {
|
if (StrUtil.isBlank(req.getAhDeviceWeight())) {
|
||||||
return R.fail("400", "电子称重量不能为空");
|
return R.fail("400", "电子称重量不能为空");
|
||||||
}
|
}
|
||||||
|
if (req.getMaterialId() == null) {
|
||||||
int validateResult = baseService.validateWeighing(req);
|
return R.fail("400", "物料主键id不能为空");
|
||||||
if (validateResult != 200) {
|
|
||||||
return R.fail("500", "重量不匹配!");
|
|
||||||
}
|
}
|
||||||
return R.ok();
|
|
||||||
|
Map<String, String> validateResult = baseService.validateWeighing(req);
|
||||||
|
return R.ok(validateResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -18,7 +18,7 @@ spring:
|
|||||||
spring.datasource:
|
spring.datasource:
|
||||||
type: com.zaxxer.hikari.HikariDataSource
|
type: com.zaxxer.hikari.HikariDataSource
|
||||||
# 请务必提前创建好名为 wms_admin 的数据库,如果使用其他数据库名请注意同步修改 DB_NAME 配置
|
# 请务必提前创建好名为 wms_admin 的数据库,如果使用其他数据库名请注意同步修改 DB_NAME 配置
|
||||||
url: jdbc:p6spy:mysql://127.0.0.1:3306/wms?serverTimezone=Asia/Shanghai&useSSL=false&useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&autoReconnect=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
url: jdbc:p6spy:mysql://127.0.0.1:3306/wms?serverTimezone=Asia/Shanghai&useSSL=false&useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&autoReconnect=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&allowMultiQueries=true
|
||||||
username: root
|
username: root
|
||||||
password: root
|
password: root
|
||||||
# PostgreSQL 配置
|
# PostgreSQL 配置
|
||||||
@@ -54,12 +54,12 @@ spring.data:
|
|||||||
## Redis 配置(单机模式)
|
## Redis 配置(单机模式)
|
||||||
redis:
|
redis:
|
||||||
# 地址
|
# 地址
|
||||||
# host: ${REDIS_HOST:192.168.2.30}
|
host: ${REDIS_HOST:192.168.2.30}
|
||||||
host: ${REDIS_HOST:127.0.0.1}
|
# host: ${REDIS_HOST:127.0.0.1}
|
||||||
# 端口(默认 6379)
|
# 端口(默认 6379)
|
||||||
port: ${REDIS_PORT:6379}
|
port: ${REDIS_PORT:6379}
|
||||||
# 密码(未设置密码时请注释掉)
|
# 密码(未设置密码时请注释掉)
|
||||||
# password: ${REDIS_PWD:redis2025}
|
password: ${REDIS_PWD:redis2025}
|
||||||
# 数据库索引
|
# 数据库索引
|
||||||
database: ${REDIS_DB:0}
|
database: ${REDIS_DB:0}
|
||||||
# 连接超时时间
|
# 连接超时时间
|
||||||
@@ -138,11 +138,13 @@ captcha:
|
|||||||
continew-starter.log:
|
continew-starter.log:
|
||||||
# 是否打印日志,开启后可打印访问日志(类似于 Nginx access log)
|
# 是否打印日志,开启后可打印访问日志(类似于 Nginx access log)
|
||||||
is-print: true
|
is-print: true
|
||||||
|
# 忽略的路径,多个路径用逗号分隔
|
||||||
|
exclude-patterns: ["/file/**", "/sdk/**"]
|
||||||
## 项目日志配置(配置重叠部分,优先级高于 logback-spring.xml 中的配置)
|
## 项目日志配置(配置重叠部分,优先级高于 logback-spring.xml 中的配置)
|
||||||
logging:
|
logging:
|
||||||
level:
|
level:
|
||||||
top.continew.admin: DEBUG
|
top.continew.admin: WARN
|
||||||
top.continew.starter: DEBUG
|
top.continew.starter: WARN
|
||||||
file:
|
file:
|
||||||
path: ./logs
|
path: ./logs
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ server:
|
|||||||
spring.datasource:
|
spring.datasource:
|
||||||
type: com.zaxxer.hikari.HikariDataSource
|
type: com.zaxxer.hikari.HikariDataSource
|
||||||
# 请务必提前创建好名为 wms_admin 的数据库,如果使用其他数据库名请注意同步修改 DB_NAME 配置
|
# 请务必提前创建好名为 wms_admin 的数据库,如果使用其他数据库名请注意同步修改 DB_NAME 配置
|
||||||
url: jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:wms_admin}?serverTimezone=Asia/Shanghai&useSSL=true&useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&autoReconnect=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
url: jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:wms_admin}?serverTimezone=Asia/Shanghai&useSSL=true&useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&autoReconnect=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&allowMultiQueries=true
|
||||||
username: ${DB_USER:root}
|
username: ${DB_USER:root}
|
||||||
password: ${DB_PWD:123456}
|
password: ${DB_PWD:123456}
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user