Merge branch 'test' into dev
# Conflicts: # nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java
This commit is contained in:
commit
a8b5c0aba7
|
|
@ -403,6 +403,18 @@ public class MaterialMainApi extends BaseApi {
|
|||
return materialMainService.updateProjectType(paramDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
* 申请人才允许更新
|
||||
* @param paramDto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("updateGeneralLevel")
|
||||
@ApiOperation("更新通用程度")
|
||||
public ResultVO<String> updateGeneralLevel(@RequestBody MaterialMainDTO paramDto) {
|
||||
return materialMainService.updateGeneralLevel(paramDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 手动执行计算推荐度
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.nflg.product.base.core.exception.NflgBusinessException;
|
|||
import com.nflg.product.material.pojo.dto.MaterialStateUpExcelDTO;
|
||||
import com.nflg.product.material.pojo.dto.MaterialUpdateBillDTO;
|
||||
import com.nflg.product.material.pojo.dto.TwentyMaterialTemplateExcelDTO;
|
||||
import com.nflg.product.material.pojo.entity.MaterialAttrValueI18nEntity;
|
||||
import com.nflg.product.material.pojo.entity.MaterialUpdateBillEntity;
|
||||
import com.nflg.product.material.pojo.entity.MaterialUpdateImportTaskEntity;
|
||||
import com.nflg.product.material.pojo.query.MaterialUpdateBillQuery;
|
||||
|
|
@ -198,4 +199,14 @@ public class MaterialUpdateBillApi extends BaseApi {
|
|||
public ResultVO<List<MaterialUpdateImportTaskEntity>> getMaterialUpdateImportTaskList() {
|
||||
return ResultVO.success(materialUpdateBillService.getMaterialUpdateImportTaskList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取制作物料名称国际化表
|
||||
* @param
|
||||
*/
|
||||
@GetMapping("getI18nForUpdate")
|
||||
@ApiOperation("获取制作物料名称国际化表")
|
||||
public ResultVO<MaterialAttrValueI18nEntity> materialUpdateBillService(@RequestParam("attrValueCn") String attrValueCn, @RequestParam("type") String type) {
|
||||
return materialUpdateBillService.materialUpdateBillService(attrValueCn, type);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -190,5 +190,11 @@ public class MaterialMainDTO implements Serializable {
|
|||
@ApiModelProperty(value = "申请部门")
|
||||
private String applyDeptName;
|
||||
|
||||
/**
|
||||
* 通用程度
|
||||
*/
|
||||
@ApiModelProperty("通用程度")
|
||||
private String generalLevel;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -369,6 +369,13 @@ public class MaterialMainEntity implements Serializable {
|
|||
@ApiModelProperty(value = "近两年使用量(新)")
|
||||
private BigDecimal twoYearsUsage;
|
||||
|
||||
/**
|
||||
* 通用程度
|
||||
*/
|
||||
@TableField(value = "general_level")
|
||||
@ApiModelProperty("通用程度")
|
||||
private String generalLevel;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.nflg.product.material.pojo.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.nflg.product.material.pojo.dto.MaterialMainAttrDTO;
|
||||
import com.nflg.product.material.pojo.entity.MaterialFilesEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
|
@ -12,6 +13,7 @@ import org.ttzero.excel.annotation.ExcelColumn;
|
|||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -438,4 +440,38 @@ public class MaterialMainVO implements Serializable {
|
|||
*/
|
||||
@ApiModelProperty(value = "项目类别")
|
||||
private String projectType;
|
||||
|
||||
/**
|
||||
* 通用程度
|
||||
*/
|
||||
@ApiModelProperty("通用程度")
|
||||
private String generalLevel;
|
||||
|
||||
// 变更弹窗字段 start
|
||||
/**
|
||||
* 变更人
|
||||
*/
|
||||
@ApiModelProperty(value = "变更人")
|
||||
private String updateCreatedByName;
|
||||
|
||||
/**
|
||||
* 变更部门
|
||||
*/
|
||||
@ApiModelProperty(value = "变更部门")
|
||||
private String updateApplyDeptName;
|
||||
|
||||
/**
|
||||
* 申请变更时间
|
||||
*/
|
||||
@ApiModelProperty(value = "申请变更时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateCreatedTime;
|
||||
|
||||
/**
|
||||
* 变更生效时间
|
||||
*/
|
||||
@ApiModelProperty(value = "变更生效时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateEffectTime;
|
||||
// 变更弹窗字段 end
|
||||
}
|
||||
|
|
|
|||
|
|
@ -238,8 +238,8 @@ public class MaterialExcelService {
|
|||
throw new NflgBusinessException(STATE.ParamErr, StrUtil.join(",", diff).concat("分类代码在系统中不存在"));
|
||||
}
|
||||
|
||||
// 校验项目类别
|
||||
checkProjectType(datas);
|
||||
// // 校验项目类别
|
||||
// checkProjectType(datas);
|
||||
|
||||
//验证21 物料
|
||||
check21Droring(datas);
|
||||
|
|
|
|||
|
|
@ -1325,10 +1325,10 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
|
|||
}
|
||||
}
|
||||
|
||||
ResultVO<String> projectTypeResult = checkProjectType(materialCategoryEntity.getRelCategoryCode(), paramDto);
|
||||
if (Objects.nonNull(projectTypeResult)) {
|
||||
return projectTypeResult;
|
||||
}
|
||||
// ResultVO<String> projectTypeResult = checkProjectType(materialCategoryEntity.getRelCategoryCode(), paramDto);
|
||||
// if (Objects.nonNull(projectTypeResult)) {
|
||||
// return projectTypeResult;
|
||||
// }
|
||||
|
||||
// 工具工装,只验证图号是否重名,不验证前缀
|
||||
if (materialCategoryEntity.getRelCategoryCode().equals(MaterialRelCategoryCodeEnum.relCategoryCode_71.getRelCategoryCode())) {
|
||||
|
|
@ -1602,7 +1602,7 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
|
|||
}
|
||||
|
||||
MaterialCategoryEntity materialCategoryEntity = materialCategoryService.lambdaQuery().eq(MaterialCategoryEntity::getCategoryCode, paramDto.getMaterialCategoryCode()).one();
|
||||
checkProjectType(materialCategoryEntity.getRelCategoryCode(), paramDto);
|
||||
// checkProjectType(materialCategoryEntity.getRelCategoryCode(), paramDto);
|
||||
|
||||
//效验21物料图片
|
||||
check21And31DrawingNo(paramDto, paramDto.getRowId());
|
||||
|
|
@ -2335,6 +2335,24 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
|
|||
return ResultVO.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新通用程度
|
||||
* 申请人才允许更新
|
||||
* @param paramDto
|
||||
* @return
|
||||
*/
|
||||
public ResultVO<String> updateGeneralLevel(MaterialMainDTO paramDto) {
|
||||
// 暂且和更新项目类别权限一致
|
||||
if (!checkUpdateProjectTypeByDept(paramDto)) {
|
||||
return ResultVO.error("无法更新本部门外申请物料的通用程度");
|
||||
}
|
||||
MaterialMainEntity entity = new MaterialMainEntity();
|
||||
entity.setRowId(paramDto.getRowId());
|
||||
entity.setGeneralLevel(paramDto.getGeneralLevel());
|
||||
this.updateById(entity);
|
||||
return ResultVO.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过部门判断是否有修改项目类别的权限,以下满足一个即可:
|
||||
* 1、自己申请的物料
|
||||
|
|
|
|||
|
|
@ -20,8 +20,7 @@ import com.nflg.product.base.core.conmon.util.SessionUtil;
|
|||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||
import com.nflg.product.base.core.vo.PageVO;
|
||||
import com.nflg.product.material.constant.*;
|
||||
import com.nflg.product.material.mapper.master.MaterialUpdateBillMapper;
|
||||
import com.nflg.product.material.mapper.master.MaterialUpdateImportTaskMapper;
|
||||
import com.nflg.product.material.mapper.master.*;
|
||||
import com.nflg.product.material.pojo.dto.ExcelDTO.MaterialStateUpExcelDTO;
|
||||
import com.nflg.product.material.pojo.dto.ExcelDTO.TwentyMaterialTemplateExcelDTO;
|
||||
import com.nflg.product.material.pojo.dto.MaterialMainAddAttrParamDTO;
|
||||
|
|
@ -96,6 +95,13 @@ public class MaterialUpdateBillService extends ServiceImpl<MaterialUpdateBillMap
|
|||
@Resource
|
||||
private MaterialUpdateImportTaskMapper materialUpdateImportTaskMapper;
|
||||
|
||||
@Resource
|
||||
private MaterialAttrValueMapper materialAttrValueMapper;
|
||||
@Resource
|
||||
private MaterialAttrValueI18nMapper materialAttrValueI18nMapper;
|
||||
@Resource
|
||||
private MaterialAttrValueI18n21Mapper materialAttrValueI18n21Mapper;
|
||||
|
||||
private static final String PREFIX = "frontend:material";
|
||||
|
||||
/**
|
||||
|
|
@ -1058,6 +1064,11 @@ public class MaterialUpdateBillService extends ServiceImpl<MaterialUpdateBillMap
|
|||
}
|
||||
materialMainVO.setReplaceMaterialNo(materialUpdateBillEntity.getReplaceMaterialNo());
|
||||
materialMainVO.setRemark(ent.getRemark());
|
||||
materialMainVO.setMaterialDescEn(materialUpdateBillEntity.getMaterialDescEn());
|
||||
materialMainVO.setUpdateCreatedByName(materialUpdateBillEntity.getCreatedByName());
|
||||
materialMainVO.setUpdateApplyDeptName(materialUpdateBillEntity.getApplyDeptName());
|
||||
materialMainVO.setUpdateCreatedTime(materialUpdateBillEntity.getCreatedTime());
|
||||
materialMainVO.setUpdateEffectTime(materialUpdateBillEntity.getEffectTime());
|
||||
}
|
||||
return materialMainVO;
|
||||
}
|
||||
|
|
@ -1202,4 +1213,25 @@ public class MaterialUpdateBillService extends ServiceImpl<MaterialUpdateBillMap
|
|||
public List<MaterialUpdateImportTaskEntity> getMaterialUpdateImportTaskList() {
|
||||
return materialUpdateImportTaskMapper.getMaterialUpdateImportTaskList(SessionUtil.getUserCode());
|
||||
}
|
||||
|
||||
public ResultVO<MaterialAttrValueI18nEntity> materialUpdateBillService(String attrValueCn, String type) {
|
||||
// 查询制作物料英文
|
||||
if ("20".equals(type)) {
|
||||
LambdaQueryWrapper<MaterialAttrValueI18n21Entity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(MaterialAttrValueI18n21Entity::getAttrValueCn, attrValueCn).eq(MaterialAttrValueI18n21Entity::getEnableState, 1);
|
||||
MaterialAttrValueI18n21Entity i18n21Entity = materialAttrValueI18n21Mapper.selectOne(queryWrapper);
|
||||
return ResultVO.success(Convert.convert(MaterialAttrValueI18nEntity.class, i18n21Entity));
|
||||
} else {
|
||||
// 查询采购物料英文
|
||||
LambdaQueryWrapper<MaterialAttrValueEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(MaterialAttrValueEntity::getAttrRowId, 1).eq(MaterialAttrValueEntity::getAttrValueName, attrValueCn);
|
||||
MaterialAttrValueEntity materialAttrValueEntity = materialAttrValueMapper.selectOne(queryWrapper);
|
||||
if (ObjectUtil.isNotEmpty(materialAttrValueEntity)) {
|
||||
LambdaQueryWrapper<MaterialAttrValueI18nEntity> i18nQueryWrapper = new LambdaQueryWrapper<>();
|
||||
i18nQueryWrapper.eq(MaterialAttrValueI18nEntity::getAttrValueRowId, materialAttrValueEntity.getRowId());
|
||||
return ResultVO.success(materialAttrValueI18nMapper.selectOne(i18nQueryWrapper));
|
||||
}
|
||||
}
|
||||
return ResultVO.success();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,35 +6,40 @@ import cn.hutool.core.convert.Convert;
|
|||
import cn.hutool.core.lang.TypeReference;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.nflg.product.base.core.api.BaseApi;
|
||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||
import com.nflg.product.bomnew.constant.ReportConstant;
|
||||
import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity;
|
||||
import com.nflg.product.bomnew.pojo.query.ChildBomReportQuery;
|
||||
import com.nflg.product.bomnew.pojo.query.CompareReportQuery;
|
||||
import com.nflg.product.bomnew.pojo.query.ReverseReportQuery;
|
||||
import com.nflg.product.bomnew.pojo.vo.*;
|
||||
import com.nflg.product.bomnew.service.CompareReportService;
|
||||
import com.nflg.product.bomnew.service.ForwardReportService;
|
||||
import com.nflg.product.bomnew.service.MaterialMainService;
|
||||
import com.nflg.product.bomnew.service.ReverseReportService;
|
||||
import com.nflg.product.bomnew.util.EecExcelUtil;
|
||||
import com.nflg.product.bomnew.util.VUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import nflg.product.common.constant.STATE;
|
||||
import nflg.product.common.vo.ResultVO;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.ttzero.excel.entity.ListSheet;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.xml.transform.Result;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Api(tags = "BOM-报表接口")
|
||||
@RestController
|
||||
|
|
@ -50,6 +55,8 @@ public class BomReportApi extends BaseApi {
|
|||
@Resource
|
||||
CompareReportService compareReportService;
|
||||
|
||||
@Resource
|
||||
MaterialMainService materialMainService;
|
||||
|
||||
@PostMapping("reverseReport")
|
||||
@ApiOperation("bom-反查")
|
||||
|
|
@ -123,8 +130,24 @@ public class BomReportApi extends BaseApi {
|
|||
if (resultVO != null) {
|
||||
return resultVO;
|
||||
}
|
||||
//物料描述从 物料主数据获取 by 10002327 240926
|
||||
ReportBomVO r = forwardReportService.factoryBomType(query);
|
||||
if(r == null){
|
||||
return ResultVO.error("查无数据~");
|
||||
}
|
||||
if(CollUtil.isNotEmpty(r.getChildNodes())){
|
||||
Set<String> materialNoSet = r.getChildNodes().stream().map(BaseMaterialVO::getMaterialNo).collect(Collectors.toSet());
|
||||
List<MaterialMainEntity> materialMainList = materialMainService.list(Wrappers.<MaterialMainEntity>lambdaQuery().in(MaterialMainEntity::getMaterialNo,materialNoSet));
|
||||
Map<String,String> materialMainMap = materialMainList.stream().collect(Collectors.toMap(MaterialMainEntity::getMaterialNo,MaterialMainEntity::getMaterialDesc,(k1, k2)->k1));
|
||||
r.getChildNodes().forEach(c -> c.setMaterialDesc(materialMainMap.getOrDefault(c.getMaterialNo(),c.getMaterialDesc())));
|
||||
}
|
||||
return ResultVO.success(r);
|
||||
}
|
||||
|
||||
return ResultVO.success(forwardReportService.factoryBomType(query));
|
||||
@PostMapping("getUpdateLog")
|
||||
@ApiOperation("bom-变更记录(和上一版本对比)")
|
||||
public ResultVO<List<UpdateLogVO>> getUpdateLog(@ApiParam("bom版本RowId") @RequestParam("bomRowId") Long bomRowId , @ApiParam("BOM 类型 1-EBom 2-PBom") @RequestParam("bomType") Integer bomType) {
|
||||
return ResultVO.success(forwardReportService.getUpdateLog(bomRowId,bomType));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -99,12 +99,12 @@ public class DQBomApi extends BaseApi {
|
|||
@ApiOperation("分页查询数据")
|
||||
public ResultVO<Page<BomNewDQbomVO>> getPageList(@Valid @RequestBody @NotNull BomNewDQbomPageQuery query) {
|
||||
// 电气BOM正式表查询无须添加时间条件 by 10002327 240918
|
||||
// if (query.getStatus() == 2) {
|
||||
// if (StrUtil.isBlank(query.getStartDate()) && StrUtil.isBlank(query.getEndDate())) {
|
||||
// query.setStartDate(LocalDateTimeUtil.format(LocalDateTime.now().plusDays(-2), "yyyy-MM-dd"));
|
||||
// query.setEndDate(LocalDateTimeUtil.format(LocalDateTime.now().plusDays(1), "yyyy-MM-dd"));
|
||||
// }
|
||||
// }
|
||||
if (query.getStatus() == 2) {
|
||||
if (StrUtil.isAllBlank(query.getDrawingNo(),query.getMaterialNo(),query.getMaterialName(),query.getStartDate(),query.getEndDate())) {
|
||||
query.setStartDate(LocalDateTimeUtil.format(LocalDateTime.now().plusDays(-2), "yyyy-MM-dd"));
|
||||
query.setEndDate(LocalDateTimeUtil.format(LocalDateTime.now().plusDays(1), "yyyy-MM-dd"));
|
||||
}
|
||||
}
|
||||
return ResultVO.success(dQBomService.getPageList(query));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import com.nflg.product.bomnew.pojo.entity.BomNewTechnologyPackageTypeEntity;
|
|||
import com.nflg.product.bomnew.pojo.query.BomExceptionQuery;
|
||||
import com.nflg.product.bomnew.pojo.query.BomNewPbomParentQuery;
|
||||
import com.nflg.product.bomnew.pojo.query.PBomExceptionQuery;
|
||||
import com.nflg.product.bomnew.pojo.query.PBomExceptionQuery;
|
||||
import com.nflg.product.bomnew.pojo.query.PbomImportToSAPQuery;
|
||||
import com.nflg.product.bomnew.pojo.vo.*;
|
||||
import com.nflg.product.bomnew.service.*;
|
||||
|
|
@ -27,6 +28,7 @@ import com.nflg.product.bomnew.util.EecExcelUtil;
|
|||
import com.nflg.product.bomnew.util.VUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import nflg.product.common.vo.ResultVO;
|
||||
import org.apache.commons.compress.utils.Lists;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
|
@ -35,6 +37,7 @@ import javax.annotation.Resource;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -439,6 +442,14 @@ public class PBomApi extends BaseApi {
|
|||
return ResultVO.success(bomNewPbomParentService.checkBomExist(bomRowId,type));
|
||||
}
|
||||
|
||||
@PostMapping("checkException")
|
||||
@ApiOperation("PBOM-数据异常检查")
|
||||
public ResultVO<Boolean> checkException(@RequestBody PBomCheckExceptionDTO checkExceptionDTO) {
|
||||
|
||||
bomNewPbomParentService.checkException(checkExceptionDTO.getBomRowId(),checkExceptionDTO.getPBomType());
|
||||
return ResultVO.success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取节点异常状态
|
||||
* @param query query
|
||||
|
|
|
|||
|
|
@ -19,4 +19,8 @@ public class BomConstant {
|
|||
|
||||
//工艺包物料类别编码
|
||||
public static final String ART_PACKAGE_MATERIAL_CATEGORY_CODE="201201";
|
||||
|
||||
public static final String ADD="新增";
|
||||
public static final String UP="修改";
|
||||
public static final String DEL="删除";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
package com.nflg.product.bomnew.pojo.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PBomCheckExceptionDTO {
|
||||
|
||||
@ApiModelProperty("BOM版本ID")
|
||||
private Long bomRowId;
|
||||
|
||||
|
||||
|
||||
@ApiModelProperty("pbom类型: 0- pBom工作表 1-pBOM正式表")
|
||||
private Integer pBomType;
|
||||
}
|
||||
|
|
@ -256,6 +256,10 @@ public class BomNewPbomChildEntity implements Serializable {
|
|||
@ApiModelProperty(value = "原始项目类别-来自ebom(不会变)")
|
||||
private String originalProjectType;
|
||||
|
||||
@TableField(value = "exception_status")
|
||||
@ApiModelProperty(value = "异常状态:1=正常、2=冻结/完全弃用异常、3=递归异常、4=数据不完整异常、5=超级物料异常、6=重复异常")
|
||||
private Integer exceptionStatus;
|
||||
|
||||
private static final long serialVersionUID = -76633783850936076L;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -378,6 +378,10 @@ public class BomNewPbomParentEntity implements Serializable {
|
|||
@ApiModelProperty(value = "ebom-发布后的版本")
|
||||
private String ebomVersion;
|
||||
|
||||
@TableField(value = "exception_status")
|
||||
@ApiModelProperty(value = "异常状态:1=正常、2=冻结/完全弃用异常、3=递归异常、4=数据不完整异常、5=超级物料异常、6=重复异常")
|
||||
private Integer exceptionStatus;
|
||||
|
||||
private static final long serialVersionUID = -31999878274445137L;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -348,6 +348,10 @@ public class BomNewPbomParentVO extends BaseMaterialVO implements Serializable {
|
|||
@ApiModelProperty(value = "ebom-发布后的版本")
|
||||
private String ebomVersion;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "异常状态:1=正常、2=冻结/完全弃用异常、3=递归异常、4=数据不完整异常、5=超级物料异常、6=重复异常 7=物料主数据不存在 8=项目类别为空 9=项目赋值异常(父级物料的项目类型为Q时,子级中不能存在项目类别为Q的物料) 10=项目赋值异常(当父级物料的项目类型为F时,子级中不能存在项目类型为F的物料) 11=未填写变更原因和技术通知单 12=数量需要用户确认 13=项目类型需要用户确认")
|
||||
private Integer exceptionStatus=1;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
package com.nflg.product.bomnew.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 版本变更-记录VO
|
||||
*/
|
||||
@Data
|
||||
public class UpdateLogVO {
|
||||
|
||||
@ApiModelProperty(value = "序号")
|
||||
private String orderNumber;
|
||||
|
||||
@ApiModelProperty(value = "版本号")
|
||||
private String currentVersion;
|
||||
|
||||
|
||||
@ApiModelProperty("项目类别")
|
||||
private String projectType;
|
||||
|
||||
@ApiModelProperty("物料编码")
|
||||
private String materialNo;
|
||||
|
||||
@ApiModelProperty("物料名称")
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty("物料描述")
|
||||
private String materialDesc;
|
||||
|
||||
@ApiModelProperty(value = "数量")
|
||||
private BigDecimal num;
|
||||
|
||||
@ApiModelProperty("单位")
|
||||
private String materialUnit;
|
||||
|
||||
@ApiModelProperty("排序字符串")
|
||||
private String orderStr;
|
||||
|
||||
@ApiModelProperty("操作类型")
|
||||
private String opType;
|
||||
|
||||
@ApiModelProperty("旧版或新版 0-旧版 1-新版")
|
||||
private Integer oldOrNewVersion=0;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package com.nflg.product.bomnew.service;
|
|||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
|
|
@ -79,6 +80,7 @@ public class BomNewEbomExportToSAP {
|
|||
sapDto.setI_EMPNO(root.getCreatedBy());
|
||||
sapDto.setT1(Convert.toList(T1DTO.class, this.children.stream().filter(c -> !c.isIgnore()).collect(Collectors.toList())));
|
||||
liErrMsg = SpringUtil.getBean(SapOpUtilService.class).importToSapV2(sapDto, null);
|
||||
this.tempHandleSapErrMsg(liErrMsg);
|
||||
if (CollUtil.isEmpty(liErrMsg)) {
|
||||
state = SapStatusEnum.PUB_SUCCESS;
|
||||
} else if (sapDto.getT1().size() != liErrMsg.size()) {
|
||||
|
|
@ -102,6 +104,18 @@ public class BomNewEbomExportToSAP {
|
|||
return liErrMsg;
|
||||
}
|
||||
|
||||
// 乔生要求,临时处理EBOM导入SAP报错情况:SAP信息含有“在工厂1010中未被维护”,不算报错
|
||||
// 后面可能取消掉
|
||||
private void tempHandleSapErrMsg(List<OperationErrorMsgVO> liErrMsg) {
|
||||
if (CollUtil.isEmpty(liErrMsg)) {
|
||||
return;
|
||||
}
|
||||
List<OperationErrorMsgVO> filterList = liErrMsg.stream().filter(item -> ObjectUtil.isNotEmpty(item.msg) && item.msg.contains("在工厂1010中未被维护")).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(filterList)) {
|
||||
liErrMsg.removeAll(filterList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建child数据发包编号
|
||||
* @param p 上级节点的parent
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ import nflg.product.common.constant.STATE;
|
|||
import nflg.product.common.vo.ResultVO;
|
||||
import org.apache.commons.compress.utils.Lists;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.checkerframework.checker.nullness.Opt;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
@ -1021,11 +1022,31 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
// //4、删掉ebom 子级的数据
|
||||
// ebomChildService.remove(Wrappers.<BomNewEbomChildEntity>lambdaQuery().in(BomNewEbomChildEntity::getParentRowId,ebomParentIdList));
|
||||
// }
|
||||
//3、判断parent下是否有子级,如果没有的话,把parent给删除了 物料****因下级全部是F项,仅保存EBOM,未生成PBOM数据
|
||||
//3、判断parent下是否有子级,排除电控系统和仙桃的,如果没有的话,把parent给删除了 物料****因下级全部是F项,仅保存EBOM,未生成PBOM数据 仙桃)
|
||||
List<BomNewPbomParentEntity> emptyChildParentList = eBomToPBom.getPBomParentResult().stream()
|
||||
.filter(p -> !p.getMaterialDesc().contains("电控系统") && !eBomToPBom.getPBomChildResult().stream().map(BomNewPbomChildEntity::getParentRowId).collect(Collectors.toList()).contains(p.getRowId()) )
|
||||
.filter(p -> !p.getMaterialDesc().contains("电控系统") && !p.getMaterialDesc().contains("仙桃)")
|
||||
&& !eBomToPBom.getPBomChildResult().stream().map(BomNewPbomChildEntity::getParentRowId).collect(Collectors.toList()).contains(p.getRowId()) )
|
||||
.collect(Collectors.toList());
|
||||
if(!emptyChildParentList.isEmpty()){
|
||||
//仅选择的第一层需要提示
|
||||
List<BomNewPbomParentEntity> fList = emptyChildParentList.stream().filter(p -> p.getSourceRowId().equals(bomRowId)).filter(p -> {
|
||||
Optional<BomNewEbomParentVO> opt = bomTree.stream().filter(t -> p.getMaterialNo().equals(t.getMaterialNo())).findFirst();
|
||||
if(opt.isPresent()){
|
||||
List<BomNewEbomParentVO> cList = bomTree.stream().filter(t -> t.getParentRowId().equals(opt.get().getRowId())).collect(Collectors.toList());
|
||||
if(cList.size() > 0){
|
||||
Map<String,List<BomNewEbomParentVO>> ptMap = cList.stream().collect(Collectors.groupingBy(BaseMaterialVO::getProjectType));
|
||||
return ptMap.getOrDefault("F",Lists.newArrayList()).size() == cList.size();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}).collect(Collectors.toList());
|
||||
if(!fList.isEmpty()){
|
||||
String m = fList.stream().map(BomNewPbomParentEntity::getMaterialNo).distinct().collect(Collectors.joining(","));
|
||||
OperationErrorMsgVO oem = new OperationErrorMsgVO();
|
||||
oem.setPrimaryKey(m);
|
||||
oem.msg = String.format("物料%s因下级全部是F项,仅保存EBOM,未生成PBOM数据",m);
|
||||
rList.add(oem);
|
||||
}
|
||||
// rList = emptyChildParentList.stream().map(BomNewPbomParentEntity::getMaterialNo).distinct()
|
||||
// .map(m -> {
|
||||
// OperationErrorMsgVO oem = new OperationErrorMsgVO();
|
||||
|
|
@ -1197,9 +1218,30 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
eBomToPBom.getPBomChildResult().removeAll(pbomChild);
|
||||
//3、判断parent下是否有子级,如果没有的话,把parent给删除了 物料****因下级全部是F项,仅保存EBOM,未生成PBOM数据
|
||||
List<BomNewPbomParentEntity> emptyChildParentList = eBomToPBom.getPBomParentResult().stream()
|
||||
.filter(p -> !p.getMaterialDesc().contains("电控系统") && !eBomToPBom.getPBomChildResult().stream().map(BomNewPbomChildEntity::getParentRowId).collect(Collectors.toList()).contains(p.getRowId()) )
|
||||
.filter(p -> !p.getMaterialDesc().contains("电控系统") && !p.getMaterialDesc().contains("仙桃)")
|
||||
&& !eBomToPBom.getPBomChildResult().stream().map(BomNewPbomChildEntity::getParentRowId).collect(Collectors.toList()).contains(p.getRowId()) )
|
||||
.collect(Collectors.toList());
|
||||
if(!emptyChildParentList.isEmpty()){
|
||||
//仅选择的第一层需要提示
|
||||
List<BomNewPbomParentEntity> fList = emptyChildParentList.stream().filter(p -> p.getSourceRowId().equals(bomRowId)).filter(p -> {
|
||||
Optional<BomNewEbomParentVO> opt = bomTree.stream().filter(t -> p.getMaterialNo().equals(t.getMaterialNo())).findFirst();
|
||||
if(opt.isPresent()){
|
||||
List<BomNewEbomParentVO> cList = bomTree.stream().filter(t -> t.getParentRowId().equals(opt.get().getRowId())).collect(Collectors.toList());
|
||||
if(cList.size() > 0){
|
||||
Map<String,List<BomNewEbomParentVO>> ptMap = cList.stream().collect(Collectors.groupingBy(BaseMaterialVO::getProjectType));
|
||||
return ptMap.getOrDefault("F",Lists.newArrayList()).size() == cList.size();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}).collect(Collectors.toList());
|
||||
if(!fList.isEmpty()){
|
||||
String m = fList.stream().map(BomNewPbomParentEntity::getMaterialNo).distinct().collect(Collectors.joining(","));
|
||||
OperationErrorMsgVO oem = new OperationErrorMsgVO();
|
||||
oem.setPrimaryKey(m);
|
||||
oem.msg = String.format("物料%s因下级全部是F项,仅保存EBOM,未生成PBOM数据",m);
|
||||
rList.add(oem);
|
||||
}
|
||||
|
||||
// rList = emptyChildParentList.stream().map(BomNewPbomParentEntity::getMaterialNo).distinct()
|
||||
// .map(m -> {
|
||||
// OperationErrorMsgVO oem = new OperationErrorMsgVO();
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import com.nflg.product.bomnew.pojo.dto.sap.impart2.T1DTO;
|
|||
import com.nflg.product.bomnew.pojo.entity.*;
|
||||
import com.nflg.product.bomnew.pojo.query.*;
|
||||
import com.nflg.product.bomnew.pojo.vo.*;
|
||||
import com.nflg.product.bomnew.service.domain.EBom.CheckPBomException;
|
||||
import com.nflg.product.bomnew.service.domain.PBom.*;
|
||||
import com.nflg.product.bomnew.service.domain.Sap;
|
||||
import com.nflg.product.bomnew.util.*;
|
||||
|
|
@ -774,6 +775,24 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取正式版-bom
|
||||
* @param rowId
|
||||
* @param countLevelNum
|
||||
* @return
|
||||
*/
|
||||
public List<BomNewPbomParentVO> getFormalAllBom(Long rowId, Integer countLevelNum) {
|
||||
List<BomNewPbomParentVO> bomDetail = this.getBaseMapper().getParentChild(rowId);
|
||||
AtomicInteger levelNum = new AtomicInteger(1);
|
||||
BomNewPbomParentEntity parent = this.getBaseMapper().selectById(rowId);
|
||||
PBomFormalTreeTask detailTask = new PBomFormalTreeTask(bomDetail, countLevelNum, levelNum,parent.getFacCode());
|
||||
ForkJoinTask<List<BomNewPbomParentVO>> submit = bomDetailPool.submit(detailTask);
|
||||
|
||||
List<BomNewPbomParentVO> result = submit.join();
|
||||
return result.stream().distinct().collect(Collectors.toList());
|
||||
|
||||
}
|
||||
|
||||
public List<BomNewPbomParentVO> getAllBom(Long rowId, Integer countLevelNum, Boolean generateDrawingNumberFalg) throws ExecutionException, InterruptedException {
|
||||
List<BomNewPbomParentVO> bomDetail = this.getBaseMapper().getParentChild(rowId);
|
||||
AtomicInteger levelNum = new AtomicInteger(1);
|
||||
|
|
@ -2044,6 +2063,59 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* PBOM-数据异常检查
|
||||
* @param rowId
|
||||
*/
|
||||
public void checkException(Long rowId,Integer bomType){
|
||||
BomNewPbomParentEntity parent = this.getById(rowId);
|
||||
VUtils.isTure(parent==null).throwMessage("PBom不存在");
|
||||
List<BomNewPbomParentVO> allBom =new ArrayList<>();
|
||||
if(bomType==0){
|
||||
allBom= this.getAllBom(rowId, 0);
|
||||
}else {
|
||||
this.getFormalAllBom(rowId,0);
|
||||
}
|
||||
BomNewPbomParentVO convert = Convert.convert(BomNewPbomParentVO.class, parent);
|
||||
convert.setBomRowId(convert.getRowId());
|
||||
convert.setParentRowId(0L);
|
||||
allBom.add(convert);
|
||||
CheckPBomException checkException=new CheckPBomException(allBom);
|
||||
checkException.initException();
|
||||
savePBomException(allBom);
|
||||
}
|
||||
|
||||
public void savePBomException(List<BomNewPbomParentVO> allBom){
|
||||
//父级
|
||||
List<BomNewPbomParentVO> parents = allBom.stream().filter(u -> u.getBomRowId() != null && u.getBomRowId() > 0 && u.getExceptionStatus()>1).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(parents)) {
|
||||
List<BomNewPbomParentEntity> pentList = new ArrayList<>();
|
||||
parents.forEach(k -> {
|
||||
BomNewPbomParentEntity pEnt = new BomNewPbomParentEntity();
|
||||
pEnt.setRowId(k.getBomRowId());
|
||||
pEnt.setExceptionStatus(k.getExceptionStatus());
|
||||
pentList.add(pEnt);
|
||||
});
|
||||
if (CollUtil.isNotEmpty(pentList)) {
|
||||
this.updateBatchById(pentList);
|
||||
}
|
||||
}
|
||||
//子级
|
||||
List<BomNewPbomParentVO> child = allBom.stream().filter(u -> u.getRowId() != null && u.getRowId() > 0 && u.getExceptionStatus()>1).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(parents)) {
|
||||
List<BomNewPbomChildEntity> childList = new ArrayList<>();
|
||||
child.forEach(k -> {
|
||||
BomNewPbomChildEntity pEnt = new BomNewPbomChildEntity();
|
||||
pEnt.setRowId(k.getRowId());
|
||||
pEnt.setExceptionStatus(k.getExceptionStatus());
|
||||
childList.add(pEnt);
|
||||
});
|
||||
if (CollUtil.isNotEmpty(childList)) {
|
||||
pbomChildService.updateBatchById(childList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public List<BomExceptionVO> getBomException(@Valid @NotEmpty List<BomExceptionQuery> query) {
|
||||
List<BomExceptionVO> datas = new ArrayList<>();
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
package com.nflg.product.bomnew.service;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
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.extra.spring.SpringUtil;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||
import com.nflg.product.bomnew.constant.*;
|
||||
import com.nflg.product.bomnew.mapper.master.BomNewPbomParentMapper;
|
||||
import com.nflg.product.bomnew.pojo.entity.*;
|
||||
|
|
@ -19,9 +22,12 @@ import com.nflg.product.bomnew.util.EecExcelUtil;
|
|||
import com.nflg.product.bomnew.util.ListCommonUtil;
|
||||
import com.nflg.product.bomnew.util.MaterialshouldBomExistUtil;
|
||||
import com.nflg.product.bomnew.util.VUtils;
|
||||
import nflg.product.common.constant.STATE;
|
||||
import org.apache.ibatis.builder.ParameterExpression;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.ttzero.excel.entity.ListSheet;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.*;
|
||||
|
|
@ -32,6 +38,19 @@ import java.util.stream.Collectors;
|
|||
@Service
|
||||
public class ForwardReportService {
|
||||
|
||||
@Resource
|
||||
private BomNewEbomParentFormalService ebomParentFormalService;
|
||||
|
||||
@Resource
|
||||
private BomNewEbomChildFormalService ebomChildFormalService;
|
||||
|
||||
|
||||
@Resource
|
||||
private BomNewPbomParentFormalService pbomParentFormalService;
|
||||
|
||||
@Resource
|
||||
private BomNewPbomChildFormalService pbomChildFormalService;
|
||||
|
||||
|
||||
public ReportBomVersionVO factoryVersion(ReverseReportQuery query) {
|
||||
//原始BOM
|
||||
|
|
@ -401,5 +420,100 @@ public class ForwardReportService {
|
|||
return mBomForwardReport.genReport();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取BOM变更记录
|
||||
* @param bomRowId bom版本rowId
|
||||
* @param bomType BOM 类型 0-原始BOM 1-EBom 2-PBom
|
||||
* @return
|
||||
*/
|
||||
public List<UpdateLogVO> getUpdateLog(Long bomRowId ,Integer bomType){
|
||||
//结果
|
||||
List<UpdateLogVO> result=new ArrayList<>();
|
||||
//eBom
|
||||
if(bomType==1){
|
||||
BomNewEbomParentFormalEntity ebomVersion = ebomParentFormalService.getById(bomRowId);
|
||||
if(Objects.nonNull(ebomVersion)){
|
||||
//上一个BOM版本
|
||||
BomNewEbomParentFormalEntity preBomVersion = ebomParentFormalService.lambdaQuery().eq(BomNewEbomParentFormalEntity::getMaterialNo, ebomVersion.getMaterialNo())
|
||||
.lt(BomNewEbomParentFormalEntity::getCurrentVersion, ebomVersion.getCurrentVersion()).orderByDesc(BomNewEbomParentFormalEntity::getCurrentVersion).last(" limit 1").one();
|
||||
if(Objects.nonNull(preBomVersion)) {
|
||||
List<BomNewEbomChildFormalEntity> newBomDetail = ebomChildFormalService.lambdaQuery().eq(BomNewEbomChildFormalEntity::getParentRowId, bomRowId).list();
|
||||
|
||||
List<BomNewEbomChildFormalEntity> oldBomDetail = ebomChildFormalService.lambdaQuery().eq(BomNewEbomChildFormalEntity::getParentRowId, preBomVersion.getRowId()).list();
|
||||
List<UpdateLogVO> newBomChild = Convert.toList(UpdateLogVO.class, newBomDetail);
|
||||
List<UpdateLogVO> oldBomChild = Convert.toList(UpdateLogVO.class, oldBomDetail);
|
||||
newBomChild.forEach(item->{item.setCurrentVersion(ebomVersion.getCurrentVersion()); item.setOldOrNewVersion(1);});
|
||||
oldBomChild.forEach(item->item.setCurrentVersion(preBomVersion.getCurrentVersion()));
|
||||
result=compare(oldBomChild,newBomChild);
|
||||
}
|
||||
}
|
||||
}//pBom
|
||||
else if(bomType==2){
|
||||
BomNewPbomParentFormalEntity pbomVersion = pbomParentFormalService.getById(bomRowId);
|
||||
if(Objects.nonNull(pbomVersion)){
|
||||
//上一个BOM版本
|
||||
BomNewPbomParentFormalEntity preBomVersion = pbomParentFormalService.lambdaQuery().eq(BomNewPbomParentFormalEntity::getMaterialNo, pbomVersion.getMaterialNo())
|
||||
.lt(BomNewPbomParentFormalEntity::getCurrentVersion, pbomVersion.getCurrentVersion()).orderByDesc(BomNewPbomParentFormalEntity::getCurrentVersion).last(" limit 1").one();
|
||||
if(Objects.nonNull(preBomVersion)) {
|
||||
List<BomNewPbomChildFormalEntity> newBomDetail = pbomChildFormalService.lambdaQuery().eq(BomNewPbomChildFormalEntity::getParentRowId, bomRowId).list();
|
||||
|
||||
List<BomNewPbomChildFormalEntity> oldBomDetail = pbomChildFormalService.lambdaQuery().eq(BomNewPbomChildFormalEntity::getParentRowId, preBomVersion.getRowId()).list();
|
||||
List<UpdateLogVO> newBomChild = Convert.toList(UpdateLogVO.class, newBomDetail);
|
||||
List<UpdateLogVO> oldBomChild = Convert.toList(UpdateLogVO.class, oldBomDetail);
|
||||
newBomChild.forEach(item->{item.setCurrentVersion(pbomVersion.getCurrentVersion()); item.setOldOrNewVersion(1);});
|
||||
oldBomChild.forEach(item->item.setCurrentVersion(preBomVersion.getCurrentVersion()));
|
||||
result=compare(oldBomChild,newBomChild);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new NflgBusinessException(STATE.ParamErr ,"bomType参数错误:暂不支持该类型BOM");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* bom-对比(变更记录)
|
||||
* @param oldBom
|
||||
* @param newBom
|
||||
* @return
|
||||
*/
|
||||
private List<UpdateLogVO> compare(List<UpdateLogVO> oldBom, List<UpdateLogVO> newBom){
|
||||
List<UpdateLogVO> result =new ArrayList<>();
|
||||
|
||||
Set<String> oldSet = oldBom.stream().map(u -> u.getOrderNumber()).collect(Collectors.toSet());
|
||||
Set<String> newSet =newBom.stream().map(u->u.getOrderNumber()).collect(Collectors.toSet());
|
||||
//删除的
|
||||
Set<String> del = Sets.difference(oldSet, newSet);
|
||||
for (String item: del) {
|
||||
UpdateLogVO oldEnd=oldBom.stream().filter(u->u.getOrderNumber().equals(item)).findFirst().get();
|
||||
result.add(oldEnd);
|
||||
UpdateLogVO newEnt =new UpdateLogVO();
|
||||
BeanUtil.copyProperties(oldEnd,newEnt);
|
||||
newEnt.setOpType(BomConstant.DEL);
|
||||
|
||||
}
|
||||
//新增
|
||||
Set<String> add= Sets.difference(newSet,oldSet);
|
||||
for (String item: add) {
|
||||
UpdateLogVO updateLogVO=newBom.stream().filter(u->u.getOrderNumber().equals(item)).findFirst().get();
|
||||
updateLogVO.setOpType(BomConstant.ADD);
|
||||
result.add(updateLogVO);
|
||||
}
|
||||
//都有比较编辑字段
|
||||
Set<String> intersection = Sets.intersection(oldSet,newSet);
|
||||
for (String item: intersection) {
|
||||
UpdateLogVO oldEnt = oldBom.stream().filter(u -> u.getOrderNumber().equals(item)).findFirst().get();
|
||||
UpdateLogVO newEnt = newBom.stream().filter(u -> u.getOrderNumber().equals(item)).findFirst().get();
|
||||
if(!oldEnt.getMaterialNo().equals(newEnt.getMaterialNo()) || ! oldEnt.getNum().equals(newEnt.getNum()) || oldEnt.getProjectType().equals(newEnt.getProjectType())){
|
||||
result.add(oldEnt);
|
||||
newEnt.setOpType(BomConstant.UP);
|
||||
result.add(newEnt);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,109 @@
|
|||
package com.nflg.product.bomnew.service.domain.EBom;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||
import com.nflg.product.bomnew.constant.*;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
||||
import com.nflg.product.bomnew.service.BomNewEbomChildService;
|
||||
import com.nflg.product.bomnew.service.BomNewEbomParentService;
|
||||
import com.nflg.product.bomnew.service.MaterialMainService;
|
||||
import com.nflg.product.bomnew.util.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import nflg.product.common.constant.STATE;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 检查BOM 异常
|
||||
*/
|
||||
public class CheckPBomException {
|
||||
|
||||
@Getter
|
||||
List<BomNewPbomParentVO> allBomDetail;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param allBom 整颗BOM树(包含跟节点)
|
||||
*/
|
||||
public CheckPBomException(List<BomNewPbomParentVO> allBom) {
|
||||
allBomDetail = allBom;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化异常
|
||||
*/
|
||||
public void initException() {
|
||||
//初始化物料信息
|
||||
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(allBomDetail, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
||||
|
||||
checkException();
|
||||
}
|
||||
public void checkException() {
|
||||
for (BomNewPbomParentVO vo : allBomDetail) {
|
||||
vo.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
|
||||
|
||||
if (StrUtil.isNotBlank(vo.getMaterialNo())
|
||||
&& (MaterialGetEnum.MaterialStateEnum.STATE_NO_4.equalsValue(vo.getMaterialState())
|
||||
|| MaterialGetEnum.MaterialStateEnum.STATE_NO_5.equalsValue(vo.getMaterialState()))) {
|
||||
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_2.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 黄色警号异常
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public void initExceptionYellowWarn() {
|
||||
Set<BomNewPbomParentVO> exceptionItems = allBomDetail.stream().filter(u -> EBomExceptionStatusEnum.EXCEPT_NO_2.equals(u.getExceptionStatus())).collect(Collectors.toSet());
|
||||
for (BomNewPbomParentVO vo : exceptionItems) {
|
||||
initExceptionParent(vo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 初始化上级警告
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
protected void initExceptionParent(BomNewPbomParentVO vo) {
|
||||
|
||||
List<BomNewPbomParentVO> parentEnts = initExceptionParentDo(ImmutableList.of(vo));
|
||||
|
||||
while (CollUtil.isNotEmpty(parentEnts) ) {
|
||||
parentEnts = initExceptionParentDo(parentEnts);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private List<BomNewPbomParentVO> initExceptionParentDo(List<BomNewPbomParentVO> vos) {
|
||||
Set<Long> parentRowIds = vos.stream().filter(u->u.getParentRowId()>0).map(u -> u.getParentRowId()).collect(Collectors.toSet());
|
||||
List<BomNewPbomParentVO> parents = allBomDetail.stream().filter(u ->parentRowIds.contains(u.getBomRowId())).collect(Collectors.toList());
|
||||
parents.forEach(u->u.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_14.getValue()));
|
||||
return parents;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -400,7 +400,7 @@ public abstract class EBomToPbomBase {
|
|||
//虚拟包
|
||||
if (firstLevelBom.getVirtualPartType() > 0) {
|
||||
result.add(firstLevelBom);
|
||||
if(VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.equalsValue(firstLevelBom.getVirtualPartType()) && firstLevelBom.getBomRowId()<=0){
|
||||
if((VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.equalsValue(firstLevelBom.getVirtualPartType()) ||VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.equalsValue(firstLevelBom.getVirtualPartType()) ) && firstLevelBom.getBomRowId()<=0){
|
||||
firstLevelBom.setBomRowId(IdWorker.getId());
|
||||
firstLevelBom.setStatus(EBomStatusEnum.CHECKED.getValue());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,7 +125,9 @@ public class EBomToPBomForFormalNew extends FormalEBomToPbomBase {
|
|||
continue;
|
||||
}
|
||||
//处理子级
|
||||
mergeChild=handlerArtPackage(parentEnt,mergeChild,facCode,parentList,vo.getVirtualPartType());
|
||||
if(!VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.equalsValue(vo.getVirtualPartType()) && !VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.equalsValue(vo.getVirtualPartType())) {
|
||||
mergeChild = handlerArtPackage(parentEnt, mergeChild, facCode, parentList, vo.getVirtualPartType());
|
||||
}
|
||||
//检查是否用户跟用户节点()
|
||||
if(parentEnt.getMaterialNo().equals(parent.getMaterialNo())) {
|
||||
List<String> childMaterialNos = SpringUtil.getBean(BomNewPbomParentMapper.class).getPBomExistMaterialInChildForWorkList(parent.getMaterialNo());
|
||||
|
|
|
|||
|
|
@ -380,7 +380,7 @@ public abstract class FormalEBomToPbomBase {
|
|||
//虚拟包
|
||||
if (firstLevelBom.getVirtualPartType() > 0) {
|
||||
result.add(firstLevelBom);
|
||||
if(VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.equalsValue(firstLevelBom.getVirtualPartType()) && firstLevelBom.getBomRowId()<=0){
|
||||
if((VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.equalsValue(firstLevelBom.getVirtualPartType())|| VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.equalsValue(firstLevelBom.getVirtualPartType())) && firstLevelBom.getBomRowId()<=0){
|
||||
firstLevelBom.setBomRowId(IdWorker.getId());
|
||||
firstLevelBom.setStatus(EBomStatusEnum.CHECKED.getValue());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package com.nflg.product.bomnew.service.domain.PBom;
|
|||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
|
|
@ -19,12 +21,14 @@ import com.nflg.product.bomnew.service.MaterialMainService;
|
|||
import com.nflg.product.bomnew.util.VUtils;
|
||||
import com.nflg.product.bomnew.util.VersionUtil;
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.compress.utils.Lists;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 工艺包构建
|
||||
|
|
@ -219,7 +223,11 @@ public class TechnologyPackageParamBuilder {
|
|||
child.setRowId(IdWorker.getId());
|
||||
child.setParentRowId(parent.getRowId());
|
||||
child.setFacCode(parent.getFacCode());
|
||||
child.setOrderNumber(StrUtil.padPre (String.valueOf(parentChildren.size()+1),3,"0"));
|
||||
//虚拟包作为下级时,序号按照已有的子级取出最大的序号值+1 by 10002327 0925
|
||||
int orderNumber = parentChildren.stream().max((p1,p2) -> p1.getOrderNumber().compareTo(p2.getOrderNumber()))
|
||||
.map(m -> Convert.toInt(m.getOrderNumber())).orElse(0);
|
||||
|
||||
child.setOrderNumber(StrUtil.padPre (String.valueOf(orderNumber+1),3,"0"));
|
||||
child.setDrawingNo(packageMaterial.getDrawingNo());
|
||||
child.setMaterialNo(packageMaterial.getMaterialNo());
|
||||
child.setMaterialName(packageMaterial.getMaterialName());
|
||||
|
|
|
|||
|
|
@ -35,6 +35,28 @@
|
|||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- error日志 -->
|
||||
<appender name="ErrorFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>error</level>
|
||||
</filter>
|
||||
<file>${logDir}/error/nflg-bom-new-error.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!-- 按日期滚动,每天生成一个文件 -->
|
||||
<fileNamePattern>${logDir}/error/%d{yyyy-MM-dd}.%i.error.log</fileNamePattern>
|
||||
<!-- 保留15天的日志 -->
|
||||
<maxHistory>30</maxHistory>
|
||||
<!-- 启动时,是否删除旧的日志文件 -->
|
||||
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||
<!-- 单天单个日志最大size -->
|
||||
<maxFileSize>${splitSize}</maxFileSize>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder" charset="UTF-8">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度,%logger:显示类名 %msg:日志消息,%n是换行符-->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %X{traceId} [%thread] %-5level %logger{50} %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 忽略Nacos服务器的INFO日志 -->
|
||||
<logger name="com.alibaba.nacos" level="WARN" />
|
||||
|
||||
|
|
@ -43,4 +65,7 @@
|
|||
<appender-ref ref="Console" />
|
||||
<appender-ref ref="RollingFileAll" />
|
||||
</root>
|
||||
<root level="ERROR">
|
||||
<appender-ref ref="ErrorFile" />
|
||||
</root>
|
||||
</configuration>
|
||||
|
|
@ -35,6 +35,28 @@
|
|||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- error日志 -->
|
||||
<appender name="ErrorFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>error</level>
|
||||
</filter>
|
||||
<file>${logDir}/error/nflg-bom-new-error.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!-- 按日期滚动,每天生成一个文件 -->
|
||||
<fileNamePattern>${logDir}/error/%d{yyyy-MM-dd}.%i.error.log</fileNamePattern>
|
||||
<!-- 保留15天的日志 -->
|
||||
<maxHistory>30</maxHistory>
|
||||
<!-- 启动时,是否删除旧的日志文件 -->
|
||||
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||
<!-- 单天单个日志最大size -->
|
||||
<maxFileSize>${splitSize}</maxFileSize>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder" charset="UTF-8">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度,%logger:显示类名 %msg:日志消息,%n是换行符-->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %X{traceId} [%thread] %-5level %logger{50} %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<logger name="com.alibaba.nacos" level="WARN" />
|
||||
<logger name="org.mybatis.spring" level="WARN"/>
|
||||
<logger name="org.springframework.web" level="WARN"/>
|
||||
|
|
@ -46,4 +68,7 @@
|
|||
<appender-ref ref="Console" />
|
||||
<appender-ref ref="RollingFileAll" />
|
||||
</root>
|
||||
<root level="ERROR">
|
||||
<appender-ref ref="ErrorFile" />
|
||||
</root>
|
||||
</configuration>
|
||||
|
|
@ -38,11 +38,12 @@
|
|||
<result column="original_material_no" property="originalMaterialNo" jdbcType="VARCHAR"/>
|
||||
<result column="original_num" property="orderNumber" jdbcType="DECIMAL" />
|
||||
<result column="original_project_type" property="originalProjectType" jdbcType="VARCHAR"/>
|
||||
<result column="exception_status" property="exceptionStatus" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
row_id, parent_row_id, identity_no, fac_code, order_number, drawing_no, material_no, material_name, material_desc, material_texture, material_unit, material_category_code, unit_weight, num, total_weight, project_type, production_factory_code,production_factory_code_input_type, set_production_factory_time, super_material_status, virtual_part_is, created_by, created_time, modify_time, source_row_id, remark, source_parent_material_no ,virtual_part_type ,virtual_part_root_material_no ,bom_version_row_id ,original_material_no , original_num, original_project_type </sql>
|
||||
row_id, parent_row_id, identity_no, fac_code, order_number, drawing_no, material_no, material_name, material_desc, material_texture, material_unit, material_category_code, unit_weight, num, total_weight, project_type, production_factory_code,production_factory_code_input_type, set_production_factory_time, super_material_status, virtual_part_is, created_by, created_time, modify_time, source_row_id, remark, source_parent_material_no ,virtual_part_type ,virtual_part_root_material_no ,bom_version_row_id ,original_material_no , original_num, original_project_type ,exception_status</sql>
|
||||
|
||||
|
||||
<delete id="delByRowId">
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@
|
|||
<result column="order_no" property="orderNo" jdbcType="VARCHAR"/>
|
||||
<result column="modify_time" property="modifyTime" jdbcType="TIMESTAMP"/>
|
||||
<result column="ebom_version" property="ebomVersion" jdbcType="VARCHAR"/>
|
||||
<result column="exception_status" property="exceptionStatus" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
|
|
@ -58,7 +59,7 @@
|
|||
should_bom_exist, super_material_status, bom_exist, last_version_is, edit_status, status, user_root_is,
|
||||
virtual_package_is, source_row_id, devise_user_code, devise_name,technology_user_code,technology_user_name, created_by, created_time, created_job,
|
||||
release_time, release_user_name,last_convert_mbom_user_name,last_convert_mbom_time, expire_end_time, remark, dept_name, level_num, change_desc, notice_nums,
|
||||
order_no, modify_time,ebom_version
|
||||
order_no, modify_time,ebom_version,exception_status
|
||||
</sql>
|
||||
|
||||
<sql id="whr">
|
||||
|
|
|
|||
Loading…
Reference in New Issue