Merge remote-tracking branch 'origin/feature/DM/nflg-bom-transition' into feature/DM/nflg-bom-transition

This commit is contained in:
luoliming 2024-08-08 22:34:40 +08:00
commit 6d77ac079f
11 changed files with 66 additions and 34 deletions

View File

@ -16,6 +16,8 @@ import com.nflg.product.material.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import nflg.product.common.vo.ResultVO;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -39,6 +41,7 @@ import java.util.stream.Collectors;
@Api(tags = "主数据平台首页")
@RestController
@RequestMapping("home")
@RefreshScope
public class MaterialHomeApi extends BaseApi {
@Resource
@ -62,6 +65,9 @@ public class MaterialHomeApi extends BaseApi {
@Resource
private StandardCategoryService standardCategoryService;
@Value("${material.home.day:30}")
private Integer homeDay;
@GetMapping("materialManagement")
@ApiOperation("物料管理")
public ResultVO<Map<String,List<MaterialHomeMainVO>>> materialManagement(){
@ -88,7 +94,7 @@ public class MaterialHomeApi extends BaseApi {
@ApiOperation("标准部件")
public ResultVO<Map<String, List<StandardPartPickRuleHomeVO>>> standardPartList(){
//仅取90天内的数据
Date date90 = DateUtil.offsetDay(new Date(),-90);
Date date90 = DateUtil.offsetDay(new Date(),-homeDay);
Map<String, List<StandardPartPickRuleHomeVO>> mp = Maps.newHashMap();
AuthorityDepartmentEntity auDept = authorityDepartmentService.getById(SessionUtil.getPartRowId());

View File

@ -25,11 +25,17 @@ public class MaterialHomeMainVO implements Serializable {
@ApiModelProperty(value = "物料名称")
private String materialName;
@ApiModelProperty(value = "物料分类编码")
private String materialCategoryCode;
@ApiModelProperty(value = "对应的物料大类")
private String relCategoryCode;
@ApiModelProperty(value = "流程状态")
private Integer processState;
@ApiModelProperty(value = "流程状态名称")
private String processStateName;
}

View File

@ -161,6 +161,9 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
@Resource
private ConnectPooled connectPooled;
@Value("${material.home.day:30}")
private Integer homeDay;
/**
* 分页查询所有数据
*
@ -2886,8 +2889,8 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
*/
public List<MaterialHomeMainVO> listByHome(Integer processState,Integer limitNums){
List<MaterialHomeMainVO> rlist = Lists.newArrayList();
//仅取90天内的数据
Date date90 = DateUtil.offsetDay(new Date(),-90);
//仅取30天内的数据
Date date90 = DateUtil.offsetDay(new Date(),-homeDay);
LambdaQueryWrapper<MaterialMainEntity> lw = Wrappers.<MaterialMainEntity>lambdaQuery()
.eq(MaterialMainEntity::getCreatedBy, SessionUtil.getUserCode());
//消息提醒仅获取已驳回的记录
@ -2895,18 +2898,27 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
lw.eq(MaterialMainEntity::getProcessState,processState);
lw.ge(MaterialMainEntity::getRejectTime,date90).orderByDesc(MaterialMainEntity::getRejectTime);
}else{
lw.ge(MaterialMainEntity::getCreatedTime,date90).orderByDesc(MaterialMainEntity::getCreatedTime);
lw.ge(MaterialMainEntity::getCreatedTime,date90)
.orderByAsc(MaterialMainEntity::getProcessState).orderByDesc(MaterialMainEntity::getCreatedTime);
}
lw.last(String.format("limit %d",limitNums));
List<MaterialMainEntity> mainList = this.list(lw);
if(!mainList.isEmpty()){
List<String> categoryCodeList = mainList.stream().map(MaterialMainEntity::getMaterialCategoryCode)
.distinct().collect(Collectors.toList());
List<MaterialCategoryEntity> categoryList = materialCategoryService.list(Wrappers.<MaterialCategoryEntity>lambdaQuery()
.in(MaterialCategoryEntity::getCategoryCode,categoryCodeList));
Map<String,String> categoryMap = categoryList.stream().collect(Collectors
.toMap(MaterialCategoryEntity::getCategoryCode,MaterialCategoryEntity::getRelCategoryCode,(k1,k2)->k1));
rlist = Convert.toList(MaterialHomeMainVO.class,mainList);
rlist.forEach(r -> r.setProcessStateName(Optional.ofNullable(MaterialProcessStateEnum.findDescriptionByValue(r.getProcessState()))
.map(MaterialProcessStateEnum::getDescription).orElse("") ));
rlist.forEach(r -> {
r.setProcessStateName(Optional.ofNullable(MaterialProcessStateEnum.findDescriptionByValue(r.getProcessState()))
.map(MaterialProcessStateEnum::getDescription).orElse("") );
r.setRelCategoryCode(categoryMap.getOrDefault(r.getMaterialCategoryCode(),""));
});
}
return rlist;
}
}

View File

@ -39,6 +39,7 @@ import nflg.product.common.vo.ResultVO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
@ -84,6 +85,9 @@ public class MaterialUpdateBillService extends ServiceImpl<MaterialUpdateBillMap
@Resource
AuthorityDepartmentService departmentService;
@Value("${material.home.day:30}")
private Integer homeDay;
/**
* 分页查询所有数据
*
@ -975,7 +979,7 @@ public class MaterialUpdateBillService extends ServiceImpl<MaterialUpdateBillMap
public List<MaterialHomeMainVO> listByHome(Integer billState,Integer limitNums){
List<MaterialHomeMainVO> rlist = Lists.newArrayList();
//仅取90天内的数据
Date date90 = DateUtil.offsetDay(new Date(),-90);
Date date90 = DateUtil.offsetDay(new Date(),-homeDay);
LambdaQueryWrapper<MaterialUpdateBillEntity> lw = Wrappers.<MaterialUpdateBillEntity>lambdaQuery()
.eq(MaterialUpdateBillEntity::getCreatedBy,SessionUtil.getUserCode());
@ -987,16 +991,12 @@ public class MaterialUpdateBillService extends ServiceImpl<MaterialUpdateBillMap
.orderByDesc(MaterialUpdateBillEntity::getRejectTime);
}else{
lw.ge(MaterialUpdateBillEntity::getCreatedTime,date90)
.orderByAsc(MaterialUpdateBillEntity::getBillState)
.orderByDesc(MaterialUpdateBillEntity::getCreatedTime);
}
lw.last(String.format("limit %d",limitNums));
List<MaterialUpdateBillEntity> entityList = this.list(Wrappers.<MaterialUpdateBillEntity>lambdaQuery()
.eq(MaterialUpdateBillEntity::getCreatedBy,SessionUtil.getUserCode())
.eq(null != billState,MaterialUpdateBillEntity::getBillState,billState)
.ge(MaterialUpdateBillEntity::getCreatedTime,date90)
.orderByDesc(MaterialUpdateBillEntity::getCreatedTime)
.last(String.format("limit %d",limitNums)));
List<MaterialUpdateBillEntity> entityList = this.list(lw);
if(!entityList.isEmpty()){
entityList.forEach(e -> {
MaterialHomeMainVO r = Convert.convert(MaterialHomeMainVO.class,e);
@ -1006,6 +1006,7 @@ public class MaterialUpdateBillService extends ServiceImpl<MaterialUpdateBillMap
r.setProcessState(e.getBillState());
r.setProcessStateName(Optional.ofNullable(MaterialUpdateBillStateEnum.findDescriptionByValue(e.getBillState()))
.map(MaterialUpdateBillStateEnum::getDescription).orElse(""));
r.setMaterialCategoryCode(Optional.ofNullable(e.getNewCategoryCode()).orElse(e.getOldCategoryCode()));
rlist.add(r);
});
}

View File

@ -31,6 +31,7 @@ import io.swagger.annotations.ApiOperation;
import nflg.product.common.constant.STATE;
import nflg.product.common.vo.ResultVO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.ttzero.excel.entity.ListSheet;
@ -81,6 +82,9 @@ public class EbomApi extends BaseApi {
@Resource
private BomNewNoticeNumService bomNewNoticeNumService;
@Value("${material.home.day:30}")
private Integer homeDay;
@PostMapping("workDetailsListByPage")
@ApiOperation("Ebom-工作明细列表")
@ -567,11 +571,12 @@ public class EbomApi extends BaseApi {
public ResultVO<Map<String,List<BomNewHomeBomVO>>> byHome(){
Map<String,List<BomNewHomeBomVO>> mp = Maps.newHashMap();
//仅取90天内的数据
Date date90 = DateUtil.offsetDay(new Date(),-90);
Date date90 = DateUtil.offsetDay(new Date(),-homeDay);
int limitNums = 5;
List<BomNewEbomParentEntity> eList = bomNewEbomParentService.list(Wrappers.<BomNewEbomParentEntity>lambdaQuery()
.eq(BomNewEbomParentEntity::getCreatedBy,SessionUtil.getUserCode())
.ge(BomNewEbomParentEntity::getCreatedTime,date90)
.orderByAsc(BomNewEbomParentEntity::getEditStatus)
.orderByDesc(BomNewEbomParentEntity::getCreatedTime)
.last(String.format("limit %d",limitNums)));
List<BomNewHomeBomVO> ebomList = Convert.toList(BomNewHomeBomVO.class,eList);
@ -581,6 +586,7 @@ public class EbomApi extends BaseApi {
List<BomNewPbomParentEntity> pList = bomNewPbomParentService.list(Wrappers.<BomNewPbomParentEntity>lambdaQuery()
.eq(BomNewPbomParentEntity::getCreatedBy,SessionUtil.getUserCode())
.ge(BomNewPbomParentEntity::getCreatedTime,date90)
.orderByAsc(BomNewPbomParentEntity::getEditStatus)
.orderByDesc(BomNewPbomParentEntity::getCreatedTime)
.last(String.format("limit %d",limitNums)));

View File

@ -48,7 +48,7 @@ public class BomNewEbomExportToSAP {
BomNewEbomParentEntity root = bomNewEbomParentService.getById(rootBomRowId);
// VUtils.isTure(Objects.isNull(root)).throwMessage("数据不存在");
if (Objects.isNull(root)) return Collections.emptyList();
VUtils.isTure(root.getUserRootIs() != 1).throwMessage("请选择根节点");
// VUtils.isTure(root.getUserRootIs() != 1).throwMessage("请选择根节点");
VUtils.isTure(Objects.equals(root.getSapState(), SapStatusEnum.PUB_RUNNING.getValue()))
.throwMessage("正在导入中,请等待操作完成");

View File

@ -442,6 +442,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
}
child.setChildBomRowId(child.getRowId());
child.setSapState(null);
}
}
}
@ -2181,6 +2182,14 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
EBomExceptionStatusEnum.EXCEPT_NO_10.getValue()
});
if (CollectionUtil.isNotEmpty(eBomEdit.childEntities)) {
List<BomNewEbomParentVO> allBom = Convert.convert(new TypeReference<List<BomNewEbomParentVO>>() {
}, eBomEdit.childEntities);
CheckEBomException checkEBomException = new CheckEBomException(allBom);
checkEBomException.checkContainExcept(checkStatus);
}
if (eBomEdit.getParentEntity() != null) {
@ -2191,13 +2200,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
if (CollectionUtil.isNotEmpty(eBomEdit.childEntities)) {
List<BomNewEbomParentVO> allBom = Convert.convert(new TypeReference<List<BomNewEbomParentVO>>() {
}, eBomEdit.childEntities);
CheckEBomException checkEBomException = new CheckEBomException(allBom);
checkEBomException.checkContainExcept(checkStatus);
}
if (CollectionUtil.isNotEmpty(eBomEdit.childEntities)) {

View File

@ -277,6 +277,7 @@ public class BomNewPbomExportToSAPImpl implements IBomNewPbomExportToSAP {
.eq(BomNewPbomParentEntity::getMaterialNo, child.getMaterialNo())
.ge(BomNewPbomParentEntity::getStatus, PBomStatusEnum.PUBLISH.getValue())
.eq(BomNewPbomParentEntity::getFacCode, child.getFacCode())
.ne(BomNewPbomParentEntity::getSource, PbomSourceEnum.FROM_SAP.getValue())
.orderByDesc(BomNewPbomParentEntity::getCurrentVersion)
.last(" limit 1")
.one();

View File

@ -37,7 +37,6 @@ import com.nflg.product.bomnew.util.*;
import lombok.extern.slf4j.Slf4j;
import nflg.product.common.constant.STATE;
import nflg.product.common.vo.ResultVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
@ -356,6 +355,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
}
child.setSapOrderNum(BomUtil.generateSapOrderNum(child.getProjectType(), child.getMaterialCategoryCode()
, child.getFacCode(), child.getMaterialNo(), child.getBomExist()));
child.setSapState(null);
}
}
}

View File

@ -130,7 +130,7 @@ public class CheckEBomException {
&& (MaterialGetEnum.MaterialStateEnum.STATE_NO_4.equalsValue(vo.getMaterialState())
|| MaterialGetEnum.MaterialStateEnum.STATE_NO_5.equalsValue(vo.getMaterialState()))) {
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_2.getValue());
} else if (StrUtil.isBlank(vo.getMaterialNo()) || Objects.isNull(vo.getNum()) || BigDecimal.ZERO.compareTo(vo.getNum()) >= 0) {
} else if (StrUtil.isBlank(vo.getMaterialNo()) || Objects.isNull(vo.getNum())) {
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_4.getValue());
} else if (StrUtil.isNotBlank(vo.getMaterialNo()) && Objects.isNull(vo.getMaterialState())) {
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_7.getValue());

View File

@ -203,11 +203,12 @@ public class EBomEdit {
if(StrUtil.isEmpty(child.getOrderNumber())){
child.setOrderNumber("001");
}
if (dto.getOpType() == 2) {
if (dto.getOpType() == EbomEditStatusEnum.HANDLER_FINISHED.getValue()) {
child.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
// parent.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
checkExcept(dto.getParent(), child);
}
if (StrUtil.isNotBlank(child.getProjectType())) {
child.setProjectType(child.getProjectType().toUpperCase());
}
@ -241,8 +242,7 @@ public class EBomEdit {
child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_4.getValue());
}
} else {
if (StrUtil.isBlank(child.getMaterialNo()) || Objects.isNull(child.getNum())
|| BigDecimal.ZERO.compareTo(child.getNum()) >= 0) {
if (StrUtil.isBlank(child.getMaterialNo()) || Objects.isNull(child.getNum())) {
child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_4.getValue());
} else if (StrUtil.isEmpty(child.getProjectType())) {
child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_8.getValue());
@ -251,9 +251,7 @@ public class EBomEdit {
if (StrUtil.equals(ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.getValue(), child.getProjectType())) {
child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_9.getValue());
}
// if (StrUtil.equals(ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_F.getValue(), child.getProjectType())) {
// child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_10.getValue());
// }
}
}