Merge branch 'refs/heads/feature/DM/nflg-bom-dq' into sit

This commit is contained in:
曹鹏飞 2024-04-25 19:38:05 +08:00
commit 9ea60a175b
16 changed files with 400 additions and 143 deletions

View File

@ -7,16 +7,15 @@ import com.google.common.collect.ImmutableList;
import com.mzt.logapi.context.LogRecordContext;
import com.mzt.logapi.starter.annotation.LogRecord;
import com.nflg.product.base.core.api.BaseApi;
import com.nflg.product.bomnew.pojo.query.BomExceptionQuery;
import com.nflg.product.bomnew.pojo.query.BomNewDQbomPageQuery;
import com.nflg.product.bomnew.pojo.query.BomNewDQbomQuery;
import com.nflg.product.bomnew.pojo.query.BomNewDQbomSaveQuery;
import com.nflg.product.bomnew.pojo.vo.BomDQbomEditDetailVO;
import com.nflg.product.bomnew.pojo.vo.BomNewDQbomVO;
import com.nflg.product.bomnew.pojo.vo.DQbomExcelVO;
import com.nflg.product.bomnew.pojo.vo.OperationErrorMsgVO;
import com.nflg.product.bomnew.pojo.vo.*;
import com.nflg.product.bomnew.service.DQBomImportService;
import com.nflg.product.bomnew.service.DQBomService;
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 nflg.product.common.vo.ResultVO;
@ -141,7 +140,7 @@ public class DQBomApi extends BaseApi {
@PostMapping("checkException")
@ApiOperation("异常检查")
public ResultVO<String> checkException(@Valid @RequestBody @NotEmpty List<Long> bomRowIds) {
dQBomService.checkException(bomRowIds.get(0));
bomRowIds.forEach(dQBomService::checkException);
return ResultVO.success();
}
@ -153,7 +152,7 @@ public class DQBomApi extends BaseApi {
@PostMapping("deleteBom")
@ApiOperation("删除bom")
public ResultVO<String> deleteBom(@Valid @RequestBody @NotEmpty List<Long> rootBomRowIds) {
dQBomService.deleteBom(rootBomRowIds.get(0));
rootBomRowIds.forEach(dQBomService::deleteBom);
return ResultVO.success();
}
@ -165,6 +164,7 @@ public class DQBomApi extends BaseApi {
@PostMapping("exportBom")
@ApiOperation("导出bom")
public void exportBom(@Valid @RequestBody @NotEmpty List<Long> rootBomRowIds, HttpServletResponse response) throws IOException {
VUtils.isTure(rootBomRowIds.size() > 1).throwMessage("每次只能导出1条");
List<DQbomExcelVO> data = dQBomService.exportBom(rootBomRowIds.get(0));
EecExcelUtil.export(response, data, DQbomExcelVO.class, "电气专用bom");
}
@ -177,7 +177,7 @@ public class DQBomApi extends BaseApi {
@PostMapping("convertToPbom")
@ApiOperation("生成pbom")
public ResultVO convertToPbom(@Valid @RequestBody @NotEmpty List<Long> rootBomRowIds) {
dQBomService.convertToPbom(rootBomRowIds.get(0));
rootBomRowIds.forEach(dQBomService::convertToPbom);
return ResultVO.success();
}
@ -213,6 +213,7 @@ public class DQBomApi extends BaseApi {
@PostMapping("importToSAP")
@ApiOperation("导入到SAP")
public ResultVO<Boolean> importToSAP(@Valid @RequestBody @NotEmpty List<Long> rootBomRowIds) {
VUtils.isTure(rootBomRowIds.size() > 1).throwMessage("每次只能导入1条");
return dQBomService.importToSAP(rootBomRowIds.get(0));
}
@ -227,4 +228,15 @@ public class DQBomApi extends BaseApi {
public ResultVO<BomDQbomEditDetailVO> editDetail(@Valid @RequestParam("rowId") @NotNull Long rowId, @Valid @RequestParam("bomRowId") @NotNull Long bomRowId) {
return ResultVO.success(dQBomService.editDetail(rowId, bomRowId));
}
/**
* 获取节点异常状态
* @param query query
* @return 节点异常状态
*/
@PostMapping("getBomException")
@ApiOperation("获取节点异常状态")
public ResultVO<List<BomExceptionVO>> getBomException(@Valid @RequestBody @NotEmpty List<BomExceptionQuery> query) {
return ResultVO.success(dQBomService.getBomException(query));
}
}

View File

@ -31,6 +31,8 @@ import org.ttzero.excel.entity.Workbook;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.io.IOException;
import java.util.List;
import java.util.Objects;
@ -450,5 +452,15 @@ public class EbomApi extends BaseApi {
return ResultVO.success();
}
/**
* 导入到SAP
* @param rootBomRowIds 顶级bom的rowId
* @return
*/
@PostMapping("importToSAP")
@ApiOperation("导入到SAP")
public ResultVO<Boolean> importToSAP(@Valid @RequestBody @NotEmpty List<Long> rootBomRowIds) {
VUtils.isTure(rootBomRowIds.size() > 1).throwMessage("每次只能导入1条");
return bomNewEbomParentService.importToSAP(rootBomRowIds.get(0));
}
}

View File

@ -1,19 +1,17 @@
package com.nflg.product.bomnew.pojo.entity;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.LocalDate;
/**
* t_bom_new_ebom_parent
@ -365,5 +363,19 @@ public class BomNewEbomParentEntity implements Serializable {
@ApiModelProperty(value = "待复核根节点")
private Integer rootIsForWaitReview;
/**
* 导入SAP状态1-未导入3-已导入
*/
@TableField(value = "sap_state")
@ApiModelProperty(value = "导入SAP状态1-未导入3-已导入")
private Integer sapState;
/**
* 导入SAP时间
*/
@TableField(value = "sap_time")
@ApiModelProperty(value = "导入SAP时间")
private LocalDateTime sapTime;
private static final long serialVersionUID = 265246823929418418L;
}

View File

@ -0,0 +1,33 @@
package com.nflg.product.bomnew.pojo.query;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @author 曹鹏飞
* @date 2024/4/24 14:24:21
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "com-nflg-product-bomnew-pojo-new-query-BomExceptionQuery")
public class BomExceptionQuery implements Serializable {
/**
* bomRowId
*/
@ApiModelProperty(value = "bomRowId", required = true)
@NotNull
protected Long bomRowId;
/**
* rowId
*/
@ApiModelProperty(value = "rowId", required = true)
@NotNull
protected Long rowId;
}

View File

@ -0,0 +1,43 @@
package com.nflg.product.bomnew.pojo.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* @author 曹鹏飞
* @date 2024/4/24 13:32:57
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "com-nflg-product-bomnew-pojo-new-vo-BomExceptionVO")
public class BomExceptionVO implements Serializable {
/**
* bom行编号
*/
@ApiModelProperty(value = "bom行编号")
public Long bomRowId;
/**
* rowId
*/
@ApiModelProperty(value = "rowId")
public Long rowId;
/**
* 物料编码
*/
@ApiModelProperty(value = "物料编码")
public String materialNo;
/**
* 异常状态
* @see com.nflg.product.bomnew.constant.EBomExceptionStatusEnum
*/
@ApiModelProperty(value = "异常状态")
private Integer exceptionStatus = -1;
}

View File

@ -1,7 +1,6 @@
package com.nflg.product.bomnew.pojo.vo;
import cn.hutool.core.util.StrUtil;
import com.nflg.product.bomnew.constant.BomConstant;
import com.nflg.product.bomnew.pojo.entity.BomNewDQbomChildEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -116,7 +115,7 @@ public class BomNewDQbomVO extends BomNewDQbomChildEntity implements Serializabl
private String drawingNoDesc;
public String getDrawingNoDesc() {
if (StrUtil.isNotBlank(getDrawingNo()) && getDrawingNo().startsWith(BomConstant.NO_TEMPORARY_PREFIX)) {
if (StrUtil.equals(getProjectType(), "T")) {
return "";
}
return getDrawingNo();
@ -129,7 +128,7 @@ public class BomNewDQbomVO extends BomNewDQbomChildEntity implements Serializabl
private String materialNoDesc;
public String getMaterialNoDesc() {
if (StrUtil.isNotBlank(getMaterialNo()) && getMaterialNo().startsWith(BomConstant.NO_TEMPORARY_PREFIX)) {
if (StrUtil.equals(getProjectType(), "T")) {
return "";
}
return getMaterialNo();

View File

@ -3,7 +3,6 @@ package com.nflg.product.bomnew.service;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.nflg.product.bomnew.constant.BomConstant;
import com.nflg.product.bomnew.constant.EBomExceptionStatusEnum;
import com.nflg.product.bomnew.constant.MaterialGetEnum;
import com.nflg.product.bomnew.pojo.entity.BomNewDQbomChildEntity;
@ -125,18 +124,19 @@ public class BomNewDQbomExceptionCheckService {
EBomExceptionStatusEnum status = EBomExceptionStatusEnum.OK;
if (parent.getRootIs() == 1 || parent.getUserRootIs() == 1) {
if ("T".equals(parent.getProjectType())) {
parent.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
} else if (parent.getMaterialNo().startsWith(BomConstant.NO_TEMPORARY_PREFIX)) {
if (StrUtil.isBlank(parent.getMaterialName())) {
status = EBomExceptionStatusEnum.EXCEPT_NO_4;
}
} else {
BaseMaterialVO materialVO = materialVOS.stream().filter(v -> v.getMaterialNo().equals(parent.getMaterialNo()))
BaseMaterialVO materialVO = materialVOS.stream()
.filter(v -> v.getMaterialNo().equals(parent.getMaterialNo()))
.findFirst()
.orElse(null);
if (materialVO == null) {
status = EBomExceptionStatusEnum.EXCEPT_NO_7;
} else if (materialVO.getMaterialState().equals(MaterialGetEnum.MaterialStateEnum.STATE_NO_4.getValue())) {
status = EBomExceptionStatusEnum.EXCEPT_NO_2;
} else if (!materialVO.getMaterialName().equals(parent.getMaterialName())) {
} else if (!materialVO.getMaterialDesc().equals(parent.getMaterialName())) {
status = EBomExceptionStatusEnum.EXCEPT_NO_15;
} else if (Objects.isNull(parent.getNum()) || parent.getNum().equals(BigDecimal.ZERO)) {
status = EBomExceptionStatusEnum.EXCEPT_NO_4;
@ -163,9 +163,11 @@ public class BomNewDQbomExceptionCheckService {
private void checkChild(BomNewDQbomChildEntity child) {
EBomExceptionStatusEnum status = EBomExceptionStatusEnum.OK;
if ("T".equals(child.getProjectType())) {
child.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
} else if (child.getMaterialNo().startsWith(BomConstant.NO_TEMPORARY_PREFIX)) {
if (StrUtil.isBlank(child.getMaterialName())) {
status = EBomExceptionStatusEnum.EXCEPT_NO_4;
}
// } else if (child.getMaterialNo().startsWith(BomConstant.NO_TEMPORARY_PREFIX)) {
// status = EBomExceptionStatusEnum.EXCEPT_NO_4;
} else {
BaseMaterialVO materialVO = materialVOS.stream().filter(v -> v.getMaterialNo().equals(child.getMaterialNo()))
.findFirst()
@ -174,7 +176,7 @@ public class BomNewDQbomExceptionCheckService {
status = EBomExceptionStatusEnum.EXCEPT_NO_7;
} else if (materialVO.getMaterialState().equals(MaterialGetEnum.MaterialStateEnum.STATE_NO_4.getValue())) {
status = EBomExceptionStatusEnum.EXCEPT_NO_2;
} else if (!materialVO.getMaterialName().equals(child.getMaterialName())) {
} else if (!materialVO.getMaterialDesc().equals(child.getMaterialName())) {
status = EBomExceptionStatusEnum.EXCEPT_NO_15;
} else if (Objects.isNull(child.getNum()) || child.getNum().equals(BigDecimal.ZERO)) {
status = EBomExceptionStatusEnum.EXCEPT_NO_4;

View File

@ -4,11 +4,10 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.lang.TypeReference;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.*;
import cn.hutool.extra.spring.SpringUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@ -23,6 +22,8 @@ import com.nflg.product.base.core.exception.NflgBusinessException;
import com.nflg.product.bomnew.constant.*;
import com.nflg.product.bomnew.mapper.master.BomNewEbomParentMapper;
import com.nflg.product.bomnew.pojo.dto.*;
import com.nflg.product.bomnew.pojo.dto.sap.impart2.ImportSapParamDTO;
import com.nflg.product.bomnew.pojo.dto.sap.impart2.T1DTO;
import com.nflg.product.bomnew.pojo.entity.*;
import com.nflg.product.bomnew.pojo.query.BomNewEbomMaterialQuery;
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
@ -46,6 +47,7 @@ import java.io.OutputStream;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.ForkJoinTask;
@ -626,14 +628,14 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
public void checkBomException(List<BomNewEbomParentVO> list, List<Integer> unCheckList) {
CheckEBomException checkEBomException = new CheckEBomException(list);
checkEBomException.setUnCheckExcept(unCheckList);
checkEBomException.checkException();
//保存异常
saveException(checkEBomException);
}
// public void checkBomException(List<BomNewEbomParentVO> list, List<Integer> unCheckList) {
// CheckEBomException checkEBomException = new CheckEBomException(list);
// checkEBomException.setUnCheckExcept(unCheckList);
// checkEBomException.checkException();
//
// //保存异常
// saveException(checkEBomException);
// }
/**
@ -919,6 +921,69 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
SpringUtil.getBean(BomNewEbomParentFormalService.class).copyEbomFormal(bomRowId);
CompletableFuture.runAsync(() -> {
importToSAP(bomRowId);
});
}
}
public ResultVO<Boolean> importToSAP(Long bomRowId) {
BomNewEbomParentEntity root = this.getById(bomRowId);
VUtils.isTure(Objects.isNull(root)).throwMessage("数据不存在");
VUtils.isTure(root.getRootIs() != 1).throwMessage("请选择根节点");
ImportSapParamDTO sapDto = new ImportSapParamDTO();
sapDto.setZID(RandomUtil.randomNumbers(5));
sapDto.setI_WERKS(FactoryCodeEnum.FACTORY_1010.getValue());
sapDto.setI_STLAN("2");
String dateYMD = DateUtil.format(new Date(), "yyyyMMdd");
List<T1DTO> t1s = new ArrayList<>();
T1DTO troot = new T1DTO();
troot.setID(RandomUtil.randomNumbers(5));
troot.setMATNR("");
troot.setIDNRK(root.getMaterialNo());
troot.setMEINS(root.getMaterialUnit());
troot.setMENGE("1");
troot.setPOSTP("");
troot.setDATUM(dateYMD);
t1s.add(troot);
buildChildrenForSap(root, t1s);
sapDto.setT1(t1s);
ResultVO<Boolean> resultVO = SpringUtil.getBean(SapOpUtilService.class).importToSapV2(sapDto, null);
if (resultVO.getState().equals(STATE.Success.getState())) {
BomNewEbomParentEntity parentEntity = new BomNewEbomParentEntity();
parentEntity.setRowId(bomRowId);
parentEntity.setSapState(MBomConstantEnum.MBomStatusEnum.PUB_SAP.getValue());
parentEntity.setSapTime(LocalDateTimeUtil.now());
updateById(parentEntity);
}
return resultVO;
}
private void buildChildrenForSap(BomNewEbomParentEntity parent, List<T1DTO> t1s) {
List<BomNewEbomChildEntity> children = ebomChildService.lambdaQuery()
.eq(BomNewEbomChildEntity::getParentRowId, parent.getRowId())
.list();
if (CollUtil.isNotEmpty(children)) {
String dateYMD = DateUtil.format(new Date(), "yyyyMMdd");
children.forEach(c -> {
T1DTO t1 = new T1DTO();
t1.setID(RandomUtil.randomNumbers(5));
t1.setMATNR(parent.getMaterialNo());
t1.setIDNRK(c.getMaterialNo());
t1.setMEINS(c.getMaterialUnit());
t1.setMENGE(c.getNum().toString());
t1.setPOSTP(c.getProjectType());
t1.setDATUM(dateYMD);
t1s.add(t1);
BomNewEbomParentEntity cp = lambdaQuery()
.eq(BomNewEbomParentEntity::getMaterialNo, c.getMaterialNo())
.eq(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue())
.one();
if (!Objects.isNull(cp)) {
buildChildrenForSap(cp, t1s);
}
});
}
}
@ -1681,10 +1746,10 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
//恢复原始bom状态
if (CollectionUtil.isNotEmpty(eBomDel.getRevertOBom())) {
List<Long> rowIds = eBomDel.getRevertOBom().stream().map(BomNewEbomParentVO::getSourceRowId).collect(Collectors.toList());
SpringUtil.getBean(BomNewOriginalParentService.class).revertBom(rowIds);
}
// if (CollectionUtil.isNotEmpty(eBomDel.getRevertOBom())) {
// List<Long> rowIds = eBomDel.getRevertOBom().stream().map(BomNewEbomParentVO::getSourceRowId).collect(Collectors.toList());
// SpringUtil.getBean(BomNewOriginalParentService.class).revertBom(rowIds);
// }
if (CollectionUtil.isNotEmpty(eBomDel.getDelEBom())) {

View File

@ -2,6 +2,7 @@ package com.nflg.product.bomnew.service;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
@ -138,7 +139,7 @@ public class DQBomImportService {
//BomNewDQbomParentEntity oldParent = dQBomParentService.getLatestByMaterialNo(parent.getMaterialNo());
boolean isSame = true;
if (Objects.isNull(oldParent)) {
return isSame;
return false;
}
isSame = Objects.equals(parent.getMaterialUnit(), oldParent.getMaterialUnit())
&& NumberUtil.equals(parent.getNum(), oldParent.getNum())
@ -176,14 +177,14 @@ public class DQBomImportService {
log.debug("checkInconsistentDataentity" + JsonUtil.toJson(child));
List<BomNewDQbomVO> oldChildren = dQBomChildService.getBom(parentRowId, child.getMaterialNo());
boolean isSame = true;
if (CollUtil.isEmpty(oldChildren)) return isSame;
if (CollUtil.isEmpty(oldChildren)) return false;
BomNewDQbomVO oldChild;
if (oldChildren.size() == 1) {
oldChild = oldChildren.get(0);
} else {
oldChild = oldChildren.stream().filter(c -> Objects.equals(c.getOrderNumber(), child.getOrderNumber())).findFirst().orElse(null);
if (Objects.isNull(oldChild)) {
return isSame;
return false;
}
}
isSame = Objects.equals(child.getMaterialUnit(), oldChild.getMaterialUnit())
@ -364,7 +365,7 @@ public class DQBomImportService {
dQbomExcelVO.setRowNum(rowNum.get());
if (dQbomExcelVO.getProjectType().equals("T")) {
long id = System.currentTimeMillis();
String id = RandomUtil.randomNumbers(9);
dQbomExcelVO.setMaterialNo(BomConstant.NO_TEMPORARY_PREFIX + id);
dQbomExcelVO.setDrawingNo(BomConstant.NO_TEMPORARY_PREFIX + id);
if (StrUtil.isBlank(dQbomExcelVO.getMaterialUnit())) {
@ -374,6 +375,10 @@ public class DQBomImportService {
dQbomExcelVO.setNum(BigDecimal.ONE);
}
}
if (StrUtil.equals(dQbomExcelVO.getMaterialNo(), "9000000000")) {
dQbomExcelVO.setProjectType("T");
}
dQbomExcelVO.setCurrentVersion("");
excelContextTL.get().add(dQbomExcelVO);
}

View File

@ -1,6 +1,5 @@
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.date.DateUtil;
@ -12,7 +11,6 @@ import cn.hutool.extra.spring.SpringUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Sets;
import com.nflg.product.base.core.conmon.util.SessionUtil;
import com.nflg.product.bomnew.constant.*;
import com.nflg.product.bomnew.pojo.dto.sap.impart2.ImportSapParamDTO;
@ -21,13 +19,11 @@ import com.nflg.product.bomnew.pojo.entity.BomNewDQbomChildEntity;
import com.nflg.product.bomnew.pojo.entity.BomNewDQbomParentEntity;
import com.nflg.product.bomnew.pojo.entity.BomNewPbomChildEntity;
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
import com.nflg.product.bomnew.pojo.query.BomExceptionQuery;
import com.nflg.product.bomnew.pojo.query.BomNewDQbomPageQuery;
import com.nflg.product.bomnew.pojo.query.BomNewDQbomQuery;
import com.nflg.product.bomnew.pojo.query.BomNewDQbomSaveQuery;
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
import com.nflg.product.bomnew.pojo.vo.BomDQbomEditDetailVO;
import com.nflg.product.bomnew.pojo.vo.BomNewDQbomVO;
import com.nflg.product.bomnew.pojo.vo.DQbomExcelVO;
import com.nflg.product.bomnew.pojo.vo.*;
import com.nflg.product.bomnew.util.BomUtil;
import com.nflg.product.bomnew.util.VUtils;
import com.nflg.product.bomnew.util.VersionUtil;
@ -148,11 +144,7 @@ public class DQBomService {
parents.forEach(p -> {
if (Objects.isNull(vo.getStatus())) {
vo.setStatus(p.getStatus());
// vo.setCurrentVersion("A00");
}
// if (Objects.equals(vo.getBomExist(), 0) && Objects.equals(vo.getShouldBomExist(), 1)) {
// vo.setCurrentVersion("A-1");
// }
p.setChildNodes(CollUtil.toList(vo));
datas.addAll(buildParent(p));
});
@ -192,7 +184,7 @@ public class DQBomService {
BaseMaterialVO bm = materialBaseInfos.stream().filter(m -> m.getMaterialNo().equals(d.getMaterialNo())).findFirst().orElse(null);
if (bm != null) {
d.setMaterialState(bm.getMaterialState());
d.setSystemMaterialName(bm.getMaterialName());
d.setSystemMaterialName(bm.getMaterialDesc());
d.setSystemMaterialCategoryName(bm.getCategoryName());
d.setSystemMaterialUnit(bm.getMaterialUnit());
d.setMaterialRowId(bm.getMaterialRowId());
@ -224,13 +216,13 @@ public class DQBomService {
*/
@Transactional(rollbackFor = Exception.class)
public BomNewDQbomSaveQuery save(BomNewDQbomSaveQuery query) {
BomNewDQbomParentEntity parent = new BomNewDQbomParentEntity();
BeanUtil.copyProperties(query.getParent(), parent);
BomNewDQbomParentEntity parent = Convert.convert(BomNewDQbomParentEntity.class, query.getParent());
if (Objects.isNull(parent.getRowId()) || parent.getRowId() == 0) {
if (Objects.isNull(query.getParent()) || query.getParent().getBomRowId() == 0) {
//新增父级节点
BomNewDQbomParentEntity oldParent = dQBomParentService.lambdaQuery().eq(BomNewDQbomParentEntity::getMaterialNo, parent.getMaterialNo())
.eq(BomNewDQbomParentEntity::getLastVersionIs, 1)
BomNewDQbomParentEntity oldParent = dQBomParentService.lambdaQuery()
.eq(BomNewDQbomParentEntity::getMaterialNo, query.getParent().getMaterialNo())
.eq(BomNewDQbomParentEntity::getStatus, DQBomStatusEnum.WAIT_CONVERT.getValue())
.one();
VUtils.isTure(oldParent != null && !oldParent.getCreatedBy().equals(SessionUtil.getUserCode()))
.throwMessage("父级已被其他人创建");
@ -248,20 +240,20 @@ public class DQBomService {
parent.setCreatedJob(userRoleService.technician() ? UserJobEnum.ENGINEER.getValue() : UserJobEnum.DESIGNER.getValue());
parent.setSource(2);
dQBomParentService.save(parent);
query.getParent().setRowId(parent.getRowId());
query.getParent().setBomRowId(parent.getRowId());
} else {
//修改数据
// VUtils.isTure(!SessionUtil.getUserCode().equals(parent.getCreatedBy())).throwMessage("不能修改他人的数据");
//删除所有子级关系
dQBomChildService.deleteAllChildren(query.getParent().getBomRowId());
parent.setRowId(query.getParent().getBomRowId());
parent.setModifyTime(LocalDateTime.now());
if (CollUtil.isEmpty(query.getChildren())) {
dQBomChildService.deleteAllChildren(parent.getRowId());
parent.setBomExist(0);
dQBomParentService.saveOrUpdate(parent);
return query;
}
//删除
dQBomChildService.deleteAllChildren(parent.getRowId());
parent.setBomExist(1);
parent.setModifyTime(LocalDateTime.now());
dQBomParentService.updateById(parent);
dQBomParentService.saveOrUpdate(parent);
}
//处理child
List<BomNewDQbomChildEntity> children = Convert.toList(BomNewDQbomChildEntity.class, query.getChildren());
@ -271,14 +263,19 @@ public class DQBomService {
c.setRowId(IdWorker.getId());
c.setCreatedBy(SessionUtil.getUserCode());
c.setCreatedName(SessionUtil.getRealName());
} else {
c.setModifyTime(LocalDateTime.now());
if (StrUtil.equals(c.getProjectType(), "T")) {
String id = RandomUtil.randomNumbers(9);
c.setMaterialNo(BomConstant.NO_TEMPORARY_PREFIX + id);
c.setDrawingNo(BomConstant.NO_TEMPORARY_PREFIX + id);
if (Objects.isNull(c.getNum()) || NumberUtil.equals(c.getNum(), BigDecimal.ZERO)) {
c.setNum(BigDecimal.ONE);
}
if (StrUtil.isBlank(c.getMaterialUnit())) {
c.setMaterialUnit("PC");
}
if (Objects.isNull(c.getNum()) || NumberUtil.equals(c.getNum(), BigDecimal.ZERO)) {
c.setNum(BigDecimal.ONE);
}
} else {
c.setModifyTime(LocalDateTime.now());
}
c.setLevel(parent.getLevel() + 1);
c.setParentRowId(parent.getRowId());
@ -327,6 +324,11 @@ public class DQBomService {
.set(BomNewDQbomParentEntity::getEditStatus, EbomEditStatusEnum.HANDLER_FINISHED.getValue())
.set(BomNewDQbomParentEntity::getModifyTime, LocalDateTime.now())
.update();
dQBomChildService.lambdaUpdate()
.eq(BomNewDQbomChildEntity::getParentRowId, query.getParent().getRowId())
.set(BomNewDQbomChildEntity::getEditStatus, EbomEditStatusEnum.HANDLER_FINISHED.getValue())
.set(BomNewDQbomChildEntity::getModifyTime, LocalDateTime.now())
.update();
//checkException(CollUtil.toList(query.getParent().getRowId()));
}
@ -375,7 +377,7 @@ public class DQBomService {
t1.setMATNR(d.getParentMaterialNo());
t1.setIDNRK(d.getMaterialNo());
t1.setMEINS(d.getMaterialUnit());
t1.setMENGE("1");
t1.setMENGE(d.getNum().toString());
t1.setPOSTP(d.getProjectType());
t1.setDATUM(dateYMD);
t1s.add(t1);
@ -393,15 +395,29 @@ public class DQBomService {
}
public BomDQbomEditDetailVO editDetail(Long rowId, Long bomRowId) {
VUtils.isTure(Objects.isNull(rowId) && Objects.isNull(bomRowId)).throwMessage("无效的数据");
BomDQbomEditDetailVO vo = new BomDQbomEditDetailVO();
BomNewDQbomParentEntity parent = dQBomParentService.getById(bomRowId);
if (bomRowId == 0) {
BomNewDQbomChildEntity child = dQBomChildService.getById(rowId);
VUtils.isTure(Objects.isNull(parent) && Objects.isNull(child)).throwMessage("无效的数据");
if (!Objects.isNull(parent)) {
vo.setParent(Convert.convert(BomNewDQbomVO.class, parent));
BomNewDQbomVO p = Convert.convert(BomNewDQbomVO.class, child);
p.setRootIs(0);
p.setBomRowId(bomRowId);
p.setUserRootIs(0);
p.setRowId(IdWorker.getId());
p.setCreatedTime(LocalDateTime.now());
p.setCreatedBy(SessionUtil.getUserCode());
p.setModifyTime(null);
initMaterialInfo(Collections.singletonList(p));
vo.setParent(p);
} else {
BomNewDQbomParentEntity parent = dQBomParentService.getById(bomRowId);
BomNewDQbomVO p = Convert.convert(BomNewDQbomVO.class, parent);
p.setBomRowId(bomRowId);
p.setRowId(rowId);
initMaterialInfo(Collections.singletonList(p));
vo.setParent(p);
vo.setDatas(getChild(bomRowId));
} else if (!Objects.isNull(child)) {
vo.setParent(Convert.convert(BomNewDQbomVO.class, child));
}
return vo;
}
@ -438,13 +454,17 @@ public class DQBomService {
BomNewDQbomParentEntity root = dQBomParentService.getById(rootBomRowId);
VUtils.isTure(Objects.isNull(root)).throwMessage("未找到数据");
VUtils.isTure(root.getStatus() == 2).throwMessage("已转pbom不能再次转换");
if (Objects.equals(root.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue())) {
//如果没有异常则再进行一次异常检查避免手动添加数据后没做异常检查就转pbom
checkException(rootBomRowId);
}
VUtils.isTure(!Objects.equals(root.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue()))
.throwMessage("异常状态不能转pbom");
VUtils.isTure(root.getStatus() == 2).throwMessage("已转pbom不能再次转换");
List<BomNewDQbomParentEntity> parents = new ArrayList<>();
List<BomNewDQbomChildEntity> children = new ArrayList<>();
buildPbom(root, parents, children);
buildTree(root, parents, children);
dQBomParentService.updateBatchById(parents);
dQBomChildService.updateBatchById(children);
savePbomParents(parents);
@ -465,14 +485,21 @@ public class DQBomService {
pchildren.forEach(c -> {
c.setCreatedTime(LocalDateTime.now());
c.setModifyTime(null);
c.setFacCode(FactoryCodeEnum.FACTORY_1010.getValue());
c.setIdentityNo(c.getParentRowId() + "_" + c.getRowId());
if (CollUtil.isNotEmpty(materialBaseInfos)) {
BaseMaterialVO materialVO = materialBaseInfos.stream().filter(m -> m.getMaterialNo().equals(c.getMaterialNo())).findFirst().orElse(null);
BaseMaterialVO materialVO = materialBaseInfos.stream()
.filter(m -> m.getMaterialNo().equals(c.getMaterialNo()))
.findFirst()
.orElse(null);
if (!Objects.isNull(materialVO)) {
c.setMaterialCategoryCode(materialVO.getMaterialCategoryCode());
}
}
BomNewDQbomParentEntity parent = parents.stream().filter(p -> p.getMaterialNo().equals(c.getMaterialNo())).findFirst().orElse(null);
BomNewDQbomParentEntity parent = parents.stream()
.filter(p -> p.getMaterialNo().equals(c.getMaterialNo()))
.findFirst()
.orElse(null);
if (!Objects.isNull(parent)) {
c.setBomVersionRowId(parent.getRowId());
}
@ -496,10 +523,11 @@ public class DQBomService {
bomNewPbomParentService.saveBatch(pparents);
}
private void buildPbom(BomNewDQbomParentEntity parent, List<BomNewDQbomParentEntity> parents, List<BomNewDQbomChildEntity> children) {
private void buildTree(BomNewDQbomParentEntity parent, List<BomNewDQbomParentEntity> parents, List<BomNewDQbomChildEntity> children) {
parent.setStatus(2);
parent.setConvertToPbomTime(LocalDateTime.now());
parent.setModifyTime(LocalDateTime.now());
parent.setEditStatus(2);
parents.add(parent);
LambdaQueryWrapper<BomNewDQbomParentEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BomNewDQbomParentEntity::getMaterialNo, parent.getMaterialNo());
@ -508,6 +536,7 @@ public class DQBomService {
List<BomNewDQbomChildEntity> cc = dQBomChildService.getByParentRowId(parent.getRowId());
cc.forEach(c -> {
c.setStatus(2);
c.setEditStatus(2);
c.setModifyTime(LocalDateTime.now());
});
children.addAll(cc);
@ -521,34 +550,37 @@ public class DQBomService {
VUtils.isTure(true).throwMessage(StrUtil.format("{}的当前版本为{}比pbom中版本{}低", parent.getMaterialNo()
, parent.getCurrentVersion(), pp.getCurrentVersion()));
} else {
if (pp.getStatus() == 4) {
List<BomNewDQbomVO> dqChildren = getChild(parent.getRowId());
Set<String> pChildren = bomNewPbomChildService.lambdaQuery()
.select(BomNewPbomChildEntity::getMaterialNo)
.eq(BomNewPbomChildEntity::getParentRowId, pp.getRowId())
.list()
.stream()
.map(BomNewPbomChildEntity::getMaterialNo)
.collect(Collectors.toSet());
if (dqChildren.size() != pChildren.size()
|| !Sets.difference(dqChildren.stream().map(BomNewDQbomVO::getMaterialNo).collect(Collectors.toSet()), pChildren).isEmpty()) {
parent.setCurrentVersion(VersionUtil.getNextVersion(parent.getCurrentVersion()));
if (pp.getStatus() >= 4) {
// List<BomNewDQbomVO> dqChildren = getChild(parent.getRowId());
// Set<String> pChildren = bomNewPbomChildService.lambdaQuery()
// .select(BomNewPbomChildEntity::getMaterialNo)
// .eq(BomNewPbomChildEntity::getParentRowId, pp.getRowId())
// .list()
// .stream()
// .map(BomNewPbomChildEntity::getMaterialNo)
// .collect(Collectors.toSet());
// if (dqChildren.size() != pChildren.size()
// || !Sets.difference(dqChildren.stream().map(BomNewDQbomVO::getMaterialNo).collect(Collectors.toSet()), pChildren).isEmpty()) {
parent.setCurrentVersion(VersionUtil.getNextVersion(pp.getCurrentVersion()));
pp.setLastVersionIs(0);
bomNewPbomParentService.updateById(pp);
}
// }
} else {
parent.setCurrentVersion(pp.getCurrentVersion());
bomNewPbomParentService.getBaseMapper().deleteById(pp.getRowId());
bomNewPbomChildService.getBaseMapper().delete(new LambdaQueryWrapper<BomNewPbomChildEntity>()
bomNewPbomChildService.getBaseMapper().delete(bomNewPbomChildService.lambdaQuery()
.eq(BomNewPbomChildEntity::getParentRowId, pp.getRowId()));
}
}
} else {
parent.setCurrentVersion(VersionUtil.getNextVersion(""));
}
//处理子级
dQBomParentService.lambdaQuery()
.in(BomNewDQbomParentEntity::getMaterialNo, cc.stream().map(BomNewDQbomChildEntity::getMaterialNo).collect(Collectors.toList()))
.eq(BomNewDQbomParentEntity::getStatus, 1)
.list()
.forEach(p -> buildPbom(p, parents, children));
.forEach(p -> buildTree(p, parents, children));
}
private int versionCompare(String version1, String version2) {
@ -556,4 +588,33 @@ public class DQBomService {
if (StrUtil.isBlank(version2)) return -1;
return Integer.parseInt(version1.substring(1)) - Integer.parseInt(version2.substring(1));
}
public List<BomExceptionVO> getBomException(List<BomExceptionQuery> query) {
List<BomExceptionVO> datas = new ArrayList<>();
for (int index = 0, count = query.size(); index < count; index++) {
BomExceptionQuery bom = query.get(index);
BomExceptionVO vo = new BomExceptionVO();
if (index == 0) {
checkException(bom.getBomRowId());
BomNewDQbomParentEntity parent = dQBomParentService.getById(bom.getBomRowId());
vo.setMaterialNo(parent.getMaterialNo());
vo.setExceptionStatus(parent.getExceptionStatus());
} else {
BomNewDQbomChildEntity child = dQBomChildService.getById(bom.getRowId());
vo.setMaterialNo(child.getMaterialNo());
if (Objects.equals(child.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue())) {
BomNewDQbomParentEntity parent = dQBomParentService.getById(bom.getBomRowId());
vo.setExceptionStatus(parent.getExceptionStatus());
} else {
vo.setExceptionStatus(child.getExceptionStatus());
}
}
vo.setBomRowId(bom.getBomRowId());
vo.setRowId(bom.getRowId());
datas.add(vo);
}
return datas;
}
}

View File

@ -19,6 +19,7 @@ import com.nflg.product.bomnew.util.VUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.function.BiConsumer;
@ -108,12 +109,14 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
}
}
public <T extends BaseMaterialVO> void intiMaterialInfo(List<T> data , String ... ignorePropertyList) {
public <T extends BaseMaterialVO> List<BaseMaterialVO> intiMaterialInfo(List<T> data, String... ignorePropertyList) {
List<String> materialNos = data.stream().map(BaseMaterialVO::getMaterialNo).filter(StrUtil::isNotBlank).collect(Collectors.toList());
if (CollUtil.isNotEmpty(materialNos)) {
List<BaseMaterialVO> materialBaseInfos = SpringUtil.getBean(MaterialMainService.class).getMaterialBaseInfo(materialNos);
intiMaterialInfo(data, materialBaseInfos, ignorePropertyList);
return materialBaseInfos;
}
return Collections.emptyList();
}
public <T extends BaseMaterialVO> void intiMaterialInfo(List<T> data ,List<BaseMaterialVO> materialBaseInfos, String ... ignorePropertyList) {

View File

@ -14,10 +14,7 @@ import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
import com.nflg.product.bomnew.service.BomNewEbomParentService;
import com.nflg.product.bomnew.service.MaterialMainService;
import com.nflg.product.bomnew.util.BomLevelUtil;
import com.nflg.product.bomnew.util.ListCommonUtil;
import com.nflg.product.bomnew.util.TreeUtils;
import com.nflg.product.bomnew.util.VUtils;
import com.nflg.product.bomnew.util.*;
import lombok.Getter;
import lombok.Setter;
import nflg.product.common.constant.STATE;
@ -88,28 +85,27 @@ public class CheckEBomException {
*/
public void initException() {
//初始化物料信息
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(allBomDetail, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
List<BaseMaterialVO> materialBaseInfo = SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(allBomDetail, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
checkException();
checkException(materialBaseInfo);
}
public void initException(List<Integer> unCheckException) {
//初始化物料信息
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(allBomDetail, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
List<BaseMaterialVO> materialBaseInfo = SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(allBomDetail, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
this.unCheckExcept=unCheckException;
checkException();
checkException(materialBaseInfo);
}
public void initException(String... ignorePropertyList) {
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(allBomDetail, ignorePropertyList);
checkException();
List<BaseMaterialVO> materialBaseInfo = SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(allBomDetail, ignorePropertyList);
checkException(materialBaseInfo);
}
public void checkException() {
public void checkException(List<BaseMaterialVO> materialBaseInfo) {
for (BomNewEbomParentVO vo : allBomDetail) {
// if(Objects.isNull(vo.getExceptionStatus())) {
//忽略不检查的如14
@ -118,7 +114,10 @@ public class CheckEBomException {
&& unCheckExcept.contains(vo.getExceptionStatus())) {
continue;
}
BaseMaterialVO mainVO = materialBaseInfo.stream()
.filter(u -> StrUtil.equals(u.getMaterialNo(), vo.getMaterialNo()))
.findFirst()
.orElse(null);
vo.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
// }
if (StrUtil.isNotBlank(vo.getMaterialNo())
@ -132,6 +131,9 @@ public class CheckEBomException {
} else if (StrUtil.isBlank(vo.getProjectType()) && !Objects.equals(vo.getRootIs(), 1)
&& !Objects.equals(vo.getUserRootIs(), 1) && !Objects.equals(vo.getRootIsForWaitReview(), 1)) {
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_8.getValue());
} else if ((StrUtil.equals("KG", StringUtil.toUpperCase(vo.getMaterialUnit())) && !StrUtil.equals(StringUtil.toUpperCase(vo.getMaterialUnit()), "PC"))
|| (!Objects.isNull(mainVO) && !StrUtil.equals(vo.getMaterialUnit(), mainVO.getMaterialUnit()))) {
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_12.getValue());
} else if (StrUtil.isNotBlank(vo.getNoticeNums()) && EBomExceptionStatusEnum.EXCEPT_NO_11.equalsValue(vo.getExceptionStatus())) {
vo.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
}
@ -158,11 +160,15 @@ public class CheckEBomException {
for (String key : childMaterialMap.keySet()) {
List<BomNewEbomParentVO> materialGroupList = childMaterialMap.get(key);
if (materialGroupList.size() > 1) {
materialGroupList.forEach(u -> {
Map<String, List<BomNewEbomParentVO>> m2 = ListCommonUtil.listGroupMap(materialGroupList, BomNewEbomParentVO::getProjectType);
m2.forEach((mk, mv) -> {
if (mv.size() > 1) {
mv.forEach(u -> {
u.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_6.getValue());
});
}
});
}
}
if (ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.getValue().equals(parent.getProjectType())) {
List<BomNewEbomParentVO> qList = child.stream().filter(u -> ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.getValue().equals(u.getProjectType())).collect(Collectors.toList());

View File

@ -1,5 +1,6 @@
package com.nflg.product.bomnew.util;
import cn.hutool.core.util.StrUtil;
import org.apache.commons.lang3.StringUtils;
/**
@ -134,4 +135,9 @@ public class StringUtil {
}
return count;
}
public static String toUpperCase(String str) {
if (StrUtil.isBlank(str)) return str;
return str.toUpperCase();
}
}

View File

@ -67,9 +67,10 @@
ifnull(p.bom_exist, 0) bom_exist,
ifnull(p.sap_state, 1) sap_state,
c.*
FROM t_bom_new_dqbom_parent p
RIGHT JOIN t_bom_new_dqbom_child c ON p.material_no = c.material_no
WHERE c.parent_row_id = #{bomRowId}
FROM t_bom_new_dqbom_child c
INNER JOIN t_bom_new_dqbom_parent p2 ON p2.row_id = c.parent_row_id
LEFT JOIN t_bom_new_dqbom_parent p ON p.material_no = c.material_no AND p.status = p2.status
WHERE p2.row_id = #{bomRowId}
ORDER BY c.order_number
</select>
@ -128,16 +129,7 @@
</select>
<select id="getVOById" resultType="com.nflg.product.bomnew.pojo.vo.BomNewDQbomVO">
SELECT IFNULL(b.exception_status, a.exception_status) exception_status
, IFNULL(b.created_by, a.created_by) created_by
, IFNULL(b.edit_status, a.edit_status) edit_status
, IFNULL(b.created_time, a.created_time) created_time
, b.exception_tag
, b.project_type
, IFNULL(b.num, a.num) num
, IFNULL(b.modify_time, a.modify_time) modify_time
, IFNULL(b.parent_row_id, 0) parent_row_id
, a.row_id bomRowId
SELECT a.row_id bomRowId
, b.order_number
, a.*
FROM t_bom_new_dqbom_parent a

View File

@ -384,15 +384,15 @@
<select id="workDetailsListByPageNew" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
SELECT *,row_id as bomRowId
FROM t_bom_new_ebom_parent
WHERE (root_is=1 OR ((user_root_is=1 OR root_is_for_wait_review=1) AND created_by=#{userCode}))
<!-- WHERE (root_is=1 OR ((user_root_is=1 OR root_is_for_wait_review=1) AND created_by=#{userCode}))-->
<if test="userJob==0">
AND status IN (1,3)
WHERE status IN (1,3) AND (user_root_is=1 OR root_is_for_wait_review=1) AND created_by=#{userCode}
</if>
<if test="userJob==1 and query.dataType==0">
AND status=2
WHERE root_is=1 AND status=2
</if>
<if test="userJob==1 and query.dataType==1">
AND status=4
WHERE root_is=1 AND status=4
</if>
<if test="query.deviseName!=null and query.deviseName!=''">
AND devise_name=#{query.deviseName}

View File

@ -1,6 +1,7 @@
package com.nflg.product.bomnew.service.test;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
@ -142,4 +143,9 @@ public class OtherTest {
public void test16() {
System.out.println("下一个版本:" + VersionUtil.getNextVersionForSmallVersion("A00"));
}
@Test
public void test17() {
System.out.println("T" + RandomUtil.randomNumbers(9));
}
}