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

This commit is contained in:
曹鹏飞 2024-05-07 11:14:26 +08:00
commit a70b91267c
7 changed files with 86 additions and 11 deletions

View File

@ -239,4 +239,16 @@ public class DQBomApi extends BaseApi {
public ResultVO<List<BomExceptionVO>> getBomException(@Valid @RequestBody @NotEmpty List<BomExceptionQuery> query) {
return ResultVO.success(dQBomService.getBomException(query));
}
/**
* 导出错误信息到excel
* @param messages 错误信息
* @return
*/
@PostMapping("exportErrorToExcel")
@ApiOperation("导出错误信息到excel")
public void exportErrorToExcel(@Valid @RequestBody @NotNull List<OperationErrorMsgVO> messages
, HttpServletResponse response) throws IOException {
EecExcelUtil.export(response, messages, OperationErrorMsgVO.class, "错误信息");
}
}

View File

@ -10,12 +10,10 @@ import com.mzt.logapi.starter.annotation.LogRecord;
import com.nflg.product.base.core.api.BaseApi;
import com.nflg.product.base.core.conmon.util.SessionUtil;
import com.nflg.product.bomnew.pojo.dto.*;
import com.nflg.product.bomnew.pojo.query.BomExceptionQuery;
import com.nflg.product.bomnew.pojo.query.BomNewEbomMaterialQuery;
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
import com.nflg.product.bomnew.pojo.vo.BomNewEbomEditDetailVO;
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
import com.nflg.product.bomnew.pojo.vo.BomNewEbomUpgradeChangeVO;
import com.nflg.product.bomnew.pojo.vo.OperationErrorMsgVO;
import com.nflg.product.bomnew.pojo.vo.*;
import com.nflg.product.bomnew.service.*;
import com.nflg.product.bomnew.util.EecExcelUtil;
import com.nflg.product.bomnew.util.VUtils;
@ -411,7 +409,7 @@ public class EbomApi extends BaseApi {
@PostMapping("intiException")
@ApiOperation("初始化错误类型")
@LogRecord(success = "Ebom-初始化错误类型,操作结果:{{#_ret}}", bizNo = "{{#bomRowIds.toString()}}", type = "Ebom-初始化错误类型")
public ResultVO<Boolean> intiException(@RequestBody List<Long> bomRowIds) throws ExecutionException, InterruptedException {
public ResultVO<Boolean> intiException(@RequestBody List<Long> bomRowIds) {
bomNewEbomParentService.batchCheckAndSaveEBomException(bomRowIds);
return ResultVO.success(true);
@ -464,4 +462,15 @@ public class EbomApi extends BaseApi {
VUtils.isTure(rootBomRowIds.size() > 1).throwMessage("每次只能导入1条");
return bomNewEbomParentService.importToSAP(rootBomRowIds.get(0));
}
/**
* 获取节点异常状态
* @param query query
* @return 节点异常状态
*/
@PostMapping("getBomException")
@ApiOperation("获取节点异常状态")
public ResultVO<List<BomExceptionVO>> getBomException(@Valid @RequestBody @NotEmpty List<BomExceptionQuery> query) {
return ResultVO.success(bomNewEbomParentService.getBomException(query));
}
}

View File

@ -11,9 +11,12 @@ import io.swagger.annotations.ApiOperation;
import nflg.product.common.vo.ResultVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -30,6 +33,10 @@ public class TestApi {
@Resource
SapOpUtilService sapOpUtilService;
/**
* sap接口测试
* @return
*/
@GetMapping("sap")
@ApiOperation("sap接口测试")
public ResultVO<List<OperationErrorMsgVO>> workDetailsListByPage() {
@ -52,4 +59,19 @@ public class TestApi {
sapDto.setT1(t1s);
return ResultVO.success(sapOpUtilService.importToSapV2(sapDto, null));
}
/**
* 获取异常信息
* @param num 数量
* @return
*/
@GetMapping("getErrors")
@ApiOperation("获取异常信息")
public ResultVO<List<OperationErrorMsgVO>> getErrors(@Valid @RequestParam("num") @NotNull Integer num) {
List<OperationErrorMsgVO> msgs = new ArrayList<>();
for (int i = 0; i < num; i++) {
msgs.add(OperationErrorMsgVO.create("主键数据:" + i, "错误描述:" + i));
}
return ResultVO.success(msgs);
}
}

View File

@ -1,6 +1,7 @@
package com.nflg.product.bomnew.pojo.vo;
import io.swagger.annotations.ApiModelProperty;
import org.ttzero.excel.annotation.ExcelColumn;
import java.io.Serializable;
@ -11,6 +12,7 @@ import java.io.Serializable;
public class OperationErrorMsgBaseVO implements Serializable {
@ApiModelProperty("错误描述")
@ExcelColumn("异常信息")
public String msg;
public OperationErrorMsgBaseVO() {

View File

@ -1,6 +1,8 @@
package com.nflg.product.bomnew.pojo.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.ttzero.excel.annotation.ExcelColumn;
import java.io.Serializable;
@ -8,9 +10,11 @@ import java.io.Serializable;
* @author 曹鹏飞
* @date 2024-03-21 14:49:05
*/
@Data
public class OperationErrorMsgVO extends OperationErrorMsgBaseVO implements Serializable {
@ApiModelProperty("主键数据")
@ExcelColumn("所在行")
public String primaryKey;
public OperationErrorMsgVO() {

View File

@ -24,6 +24,7 @@ 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.BomExceptionQuery;
import com.nflg.product.bomnew.pojo.query.BomNewEbomMaterialQuery;
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
import com.nflg.product.bomnew.pojo.vo.*;
@ -527,10 +528,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
*
* @param rowId
* @return
* @throws ExecutionException
* @throws InterruptedException
*/
public List<BomNewEbomParentVO> getBomTree(Long rowId, Boolean generateLevelNumberFlag) throws ExecutionException, InterruptedException {
public List<BomNewEbomParentVO> getBomTree(Long rowId, Boolean generateLevelNumberFlag) {
List<BomNewEbomParentVO> bomDetail = this.getBaseMapper().getParentChild(rowId);
// EBomDetailTask detailTask = new EBomDetailTask(bomDetail);
@ -719,7 +718,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
/**
* 检查 并保存异常信息
*/
public void batchCheckAndSaveEBomException(List<Long> bomRowIds) throws ExecutionException, InterruptedException {
public void batchCheckAndSaveEBomException(List<Long> bomRowIds) {
for (Long bomRowId : bomRowIds) {
CheckEBomException checkEBomException = new CheckEBomException(bomRowId);
checkEBomException.initException();
@ -2260,4 +2259,32 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
});
}
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) {
batchCheckAndSaveEBomException(Collections.singletonList(bom.getBomRowId()));
BomNewEbomParentEntity parent = getById(bom.getBomRowId());
vo.setMaterialNo(parent.getMaterialNo());
vo.setExceptionStatus(parent.getExceptionStatus());
} else {
BomNewEbomChildEntity child = ebomChildService.getById(bom.getRowId());
vo.setMaterialNo(child.getMaterialNo());
if (Objects.equals(child.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue())) {
BomNewEbomParentEntity parent = 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

@ -21,7 +21,6 @@ import nflg.product.common.constant.STATE;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
/**
@ -53,7 +52,7 @@ public class CheckEBomException {
}
public CheckEBomException(Long bomRowId) throws ExecutionException, InterruptedException {
public CheckEBomException(Long bomRowId) {
allBomDetail = SpringUtil.getBean(BomNewEbomParentService.class).getBomTree(bomRowId, true);
//只检查待复核和自己的