Merge remote-tracking branch 'origin/feature/DM/nflg-bom' into feature/DM/nflg-bom
This commit is contained in:
commit
0e473399ad
|
|
@ -187,9 +187,8 @@ public class EbomApi extends BaseApi {
|
||||||
return ResultVO.error(STATE.ParamErr, "请选择要复核的数据");
|
return ResultVO.error(STATE.ParamErr, "请选择要复核的数据");
|
||||||
}
|
}
|
||||||
dto.setRevertUserName(SessionUtil.getUserName());
|
dto.setRevertUserName(SessionUtil.getUserName());
|
||||||
bomNewEbomParentService.designReview(dto);
|
return bomNewEbomParentService.designReview(dto);
|
||||||
|
|
||||||
return ResultVO.success(true);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,4 +17,30 @@ public enum MaterialGetEnum implements ValueEnum<Integer> {
|
||||||
|
|
||||||
private final Integer value;
|
private final Integer value;
|
||||||
private final String description;
|
private final String description;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Getter
|
||||||
|
public enum MaterialStateEnum implements ValueEnum<Integer> {
|
||||||
|
//物料状态 1:正常 2:禁止采购 3:售后专用 4:冻结 5:完全弃用
|
||||||
|
OK(1, "正常"),
|
||||||
|
STATE_NO_2(2, "禁止采购"),
|
||||||
|
STATE_NO_3(3, "售后专用"),
|
||||||
|
STATE_NO_4(4, "冻结"),
|
||||||
|
STATE_NO_5(5, "完全弃用")
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
private final Integer value;
|
||||||
|
private final String description;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -363,12 +363,12 @@ public class ExportDeviceHelper {
|
||||||
if(StrUtil.isEmpty(item3.getDrawingNo())) {
|
if(StrUtil.isEmpty(item3.getDrawingNo())) {
|
||||||
excelField.setCellSecond(StrUtil.format("{}", item3.getMaterialName()));
|
excelField.setCellSecond(StrUtil.format("{}", item3.getMaterialName()));
|
||||||
}else {
|
}else {
|
||||||
excelField.setCellSecond(StrUtil.format ("{}:{}", item3.getDrawingNo(), item3.getMaterialName()));
|
excelField.setCellSecond(StrUtil.format ("{} {}", item3.getDrawingNo(), item3.getMaterialName()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
excelField.setCellThird(StrUtil.format("{}",item3.getChooseStatus() == 1 ? "标配" : "可选")) ;
|
excelField.setCellThird(StrUtil.format("{}",item3.getChooseStatus() == 1 ? "标配" : "可选")) ;
|
||||||
excelField.setCellFourth(item3.getRemak()); ;
|
excelField.setCellFourth(item3.getRemak());
|
||||||
items.add(excelField);
|
items.add(excelField);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,9 @@ package com.nflg.product.bomnew.service;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
|
@ -118,6 +121,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
}
|
}
|
||||||
return returnResult;
|
return returnResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Page<BomNewEbomParentVO> handSeachToTree(List<BomNewEbomParentVO> parents, List<BomNewEbomParentVO> childs) {
|
private Page<BomNewEbomParentVO> handSeachToTree(List<BomNewEbomParentVO> parents, List<BomNewEbomParentVO> childs) {
|
||||||
Page<BomNewEbomParentVO> resutlData = new Page<>();
|
Page<BomNewEbomParentVO> resutlData = new Page<>();
|
||||||
Set<String> parentSet = parents.stream().map(u -> u.getMaterialNo()).collect(Collectors.toSet());
|
Set<String> parentSet = parents.stream().map(u -> u.getMaterialNo()).collect(Collectors.toSet());
|
||||||
|
|
@ -153,6 +157,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取物料所有父节点
|
* 获取物料所有父节点
|
||||||
|
*
|
||||||
* @param materialNo
|
* @param materialNo
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -191,6 +196,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 正式工作表
|
* 正式工作表
|
||||||
|
*
|
||||||
* @param query
|
* @param query
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -202,8 +208,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取子级
|
* 获取子级
|
||||||
*
|
*
|
||||||
|
|
@ -287,7 +291,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化-项目类别
|
* 初始化-项目类别
|
||||||
*/
|
*/
|
||||||
|
|
@ -521,7 +524,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!this.updateBatchById(updateList)) {
|
if (!this.updateBatchById(updateList)) {
|
||||||
throw new NflgBusinessException(STATE.Error, "退回设计失败");
|
throw new NflgBusinessException(STATE.Error, "退回设计失败");
|
||||||
}
|
}
|
||||||
|
|
@ -555,30 +557,131 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
|
|
||||||
for (BomNewEbomParentEntity item :
|
for (BomNewEbomParentEntity item :
|
||||||
bomNewEbomParentEntityList) {
|
bomNewEbomParentEntityList) {
|
||||||
|
|
||||||
|
|
||||||
if (item.getStatus().equals(EBomStatusEnum.CHECKED.getValue())) {
|
if (item.getStatus().equals(EBomStatusEnum.CHECKED.getValue())) {
|
||||||
continue;
|
return ResultVO.error(StrUtil.format("{} 已复核过,不需重复复核", item.getMaterialNo()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.getNum().equals(EBomExceptionStatusEnum.INIT.getValue())) {
|
if (item.getNum().equals(EBomExceptionStatusEnum.INIT.getValue())) {
|
||||||
return ResultVO.error("请调整数据后进行复核");
|
return ResultVO.error("请调整数据后进行复核");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.getNum().equals(EbomEditStatusEnum.HANDLER_CREATED.getValue())) {
|
||||||
|
return ResultVO.error("请先提交确认后进行复核");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (StrUtil.isEmpty(item.getMaterialNo()) || (item.getNum() == null || item.getNum().floatValue() == 0)) {
|
if (StrUtil.isEmpty(item.getMaterialNo()) || (item.getNum() == null || item.getNum().floatValue() == 0)) {
|
||||||
return ResultVO.error(EBomExceptionStatusEnum.EXCEPT_NO_4.getDescription());
|
return ResultVO.error(EBomExceptionStatusEnum.EXCEPT_NO_4.getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MaterialMainEntity entity = materialMainService.lambdaQuery().eq(MaterialMainEntity::getMaterialNo, item.getMaterialNo()).one();
|
||||||
|
|
||||||
|
if (entity == null) {
|
||||||
|
return ResultVO.error("物料编码[" + item.getMaterialNo() + "]物料不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Objects.equals(entity.getMaterialState(), MaterialGetEnum.MaterialStateEnum.STATE_NO_4)
|
||||||
|
|| Objects.equals(entity.getMaterialState(), MaterialGetEnum.MaterialStateEnum.STATE_NO_5)) {
|
||||||
|
return ResultVO.error("物料编码[" + item.getMaterialNo() + "]冻结/完全弃用异常");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
List<Long> updateReviewIdList=new ArrayList<>();
|
||||||
|
//子bom检查
|
||||||
|
for (BomNewEbomParentEntity item :
|
||||||
|
bomNewEbomParentEntityList) {
|
||||||
|
|
||||||
|
List<BomNewEbomParentVO> childBomList;
|
||||||
|
try {
|
||||||
|
childBomList = buildBomTree(item.getRowId());
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ResultVO.error("获取Bom数据失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (CollUtil.isNotEmpty(childBomList)) {
|
||||||
|
|
||||||
|
for (BomNewEbomParentVO childBomItem :
|
||||||
|
childBomList) {
|
||||||
|
|
||||||
|
|
||||||
|
if (childBomItem.getNum().equals(EBomExceptionStatusEnum.INIT.getValue())) {
|
||||||
|
return ResultVO.error("请调整数据后进行复核");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (childBomItem.getExceptionStatus().equals(EBomExceptionStatusEnum.EXCEPT_NO_2.getValue())) {
|
||||||
|
return ResultVO.error(StrUtil.format("物料{} {}", childBomItem.getMaterialNo(), EBomExceptionStatusEnum.EXCEPT_NO_2.getDescription()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (childBomItem.getExceptionStatus().equals(EBomExceptionStatusEnum.EXCEPT_NO_3.getValue())) {
|
||||||
|
return ResultVO.error(StrUtil.format("物料{} {}", childBomItem.getMaterialNo(), EBomExceptionStatusEnum.EXCEPT_NO_3.getDescription()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (childBomItem.getExceptionStatus().equals(EBomExceptionStatusEnum.EXCEPT_NO_4.getValue())) {
|
||||||
|
return ResultVO.error(StrUtil.format("物料{} {}", childBomItem.getMaterialNo(), EBomExceptionStatusEnum.EXCEPT_NO_4.getDescription()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (childBomItem.getExceptionStatus().equals(EBomExceptionStatusEnum.EXCEPT_NO_6.getValue())) {
|
||||||
|
return ResultVO.error(StrUtil.format("物料{} {}", childBomItem.getMaterialNo(), EBomExceptionStatusEnum.EXCEPT_NO_6.getDescription()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (childBomItem.getExceptionStatus().equals(EBomExceptionStatusEnum.EXCEPT_NO_7.getValue())) {
|
||||||
|
return ResultVO.error(StrUtil.format("物料{} {}", childBomItem.getMaterialNo(), EBomExceptionStatusEnum.EXCEPT_NO_7.getDescription()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (childBomItem.getExceptionStatus().equals(EBomExceptionStatusEnum.EXCEPT_NO_7.getValue())) {
|
||||||
|
return ResultVO.error(StrUtil.format("物料{} {}", childBomItem.getMaterialNo(), EBomExceptionStatusEnum.EXCEPT_NO_7.getDescription()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (childBomItem.getExceptionStatus().equals(EBomExceptionStatusEnum.EXCEPT_NO_8.getValue())) {
|
||||||
|
return ResultVO.error(StrUtil.format("物料{} {}", childBomItem.getMaterialNo(), EBomExceptionStatusEnum.EXCEPT_NO_8.getDescription()));
|
||||||
|
}
|
||||||
|
if (childBomItem.getExceptionStatus().equals(EBomExceptionStatusEnum.EXCEPT_NO_9.getValue())) {
|
||||||
|
return ResultVO.error(StrUtil.format("物料{} {}", childBomItem.getMaterialNo(), EBomExceptionStatusEnum.EXCEPT_NO_9.getDescription()));
|
||||||
|
|
||||||
|
}
|
||||||
|
if (childBomItem.getExceptionStatus().equals(EBomExceptionStatusEnum.EXCEPT_NO_10.getValue())) {
|
||||||
|
return ResultVO.error(StrUtil.format("物料{} {}", childBomItem.getMaterialNo(), EBomExceptionStatusEnum.EXCEPT_NO_10.getDescription()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
updateReviewIdList.addAll( childBomList.stream().map(BomNewEbomParentVO::getRowId).collect(Collectors.toList()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//改变复核状态
|
||||||
|
|
||||||
|
List<BomNewEbomParentEntity> updateReviewList=new ArrayList<>();
|
||||||
|
for(Long id:updateReviewIdList){
|
||||||
|
BomNewEbomParentEntity entity=new BomNewEbomParentEntity();
|
||||||
|
entity.setRowId(id);
|
||||||
|
entity.setAuditTime(LocalDateTime.now());
|
||||||
|
entity.setAuditUserName(dto.getRevertUserName());
|
||||||
|
updateReviewList.add(entity);
|
||||||
|
}
|
||||||
|
if (!this.updateBatchById(updateReviewList)) {
|
||||||
|
throw new NflgBusinessException(STATE.Error, "复核失败");
|
||||||
|
}
|
||||||
|
|
||||||
return ResultVO.success(true);
|
return ResultVO.success(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ package com.nflg.product.bomnew.service;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.core.lang.TypeReference;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
@ -50,6 +52,9 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化物料基本信息
|
* 初始化物料基本信息
|
||||||
*
|
*
|
||||||
|
|
@ -170,4 +175,23 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<BaseMaterialVO> getExceptStatList(List<String> materialNos,List<Integer> states) {
|
||||||
|
if (CollUtil.isNotEmpty(materialNos)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
List<MaterialMainEntity> list= this.lambdaQuery().in(MaterialMainEntity::getMaterialState, states)
|
||||||
|
.in(MaterialMainEntity::getMaterialNo, materialNos).list();
|
||||||
|
return Convert.convert(new TypeReference<List<BaseMaterialVO> >(){
|
||||||
|
|
||||||
|
},list);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@ spring.profiles.active=sit
|
||||||
|
|
||||||
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
|
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
|
||||||
|
|
||||||
spring.cloud.nacos.config.namespace=nflg_dev
|
spring.cloud.nacos.config.namespace=nflg
|
||||||
spring.cloud.nacos.discovery.namespace=nflg_dev
|
spring.cloud.nacos.discovery.namespace=nflg
|
||||||
spring.cloud.nacos.config.file-extension=properties
|
spring.cloud.nacos.config.file-extension=properties
|
||||||
nacos.plugin.namespace=nflg_dev
|
nacos.plugin.namespace=nflg
|
||||||
|
|
||||||
#configuration
|
#configuration
|
||||||
spring.cloud.nacos.config.server-addr=${nacos.server-addr}
|
spring.cloud.nacos.config.server-addr=${nacos.server-addr}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue