Merge branch 'refs/heads/feature/DM/nflg-bom-dq' into sit
This commit is contained in:
commit
d59958cf5e
|
|
@ -239,4 +239,16 @@ public class DQBomApi extends BaseApi {
|
||||||
public ResultVO<List<BomExceptionVO>> getBomException(@Valid @RequestBody @NotEmpty List<BomExceptionQuery> query) {
|
public ResultVO<List<BomExceptionVO>> getBomException(@Valid @RequestBody @NotEmpty List<BomExceptionQuery> query) {
|
||||||
return ResultVO.success(dQBomService.getBomException(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, "错误信息");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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.api.BaseApi;
|
||||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||||
import com.nflg.product.bomnew.pojo.dto.*;
|
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.BomNewEbomMaterialQuery;
|
||||||
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
|
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
|
||||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomEditDetailVO;
|
import com.nflg.product.bomnew.pojo.vo.*;
|
||||||
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.service.*;
|
import com.nflg.product.bomnew.service.*;
|
||||||
import com.nflg.product.bomnew.util.EecExcelUtil;
|
import com.nflg.product.bomnew.util.EecExcelUtil;
|
||||||
import com.nflg.product.bomnew.util.VUtils;
|
import com.nflg.product.bomnew.util.VUtils;
|
||||||
|
|
@ -29,11 +27,13 @@ import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import org.ttzero.excel.entity.ListSheet;
|
import org.ttzero.excel.entity.ListSheet;
|
||||||
import org.ttzero.excel.entity.Workbook;
|
import org.ttzero.excel.entity.Workbook;
|
||||||
|
import springfox.bean.validators.plugins.schema.NotNullAnnotationPlugin;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.validation.Valid;
|
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.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
@ -70,6 +70,7 @@ public class EbomApi extends BaseApi {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private BomNewPbomParentService bomNewPbomParentService;
|
private BomNewPbomParentService bomNewPbomParentService;
|
||||||
|
private NotNullAnnotationPlugin notNullPlugin;
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("workDetailsListByPage")
|
@PostMapping("workDetailsListByPage")
|
||||||
|
|
@ -411,7 +412,7 @@ public class EbomApi extends BaseApi {
|
||||||
@PostMapping("intiException")
|
@PostMapping("intiException")
|
||||||
@ApiOperation("初始化错误类型")
|
@ApiOperation("初始化错误类型")
|
||||||
@LogRecord(success = "Ebom-初始化错误类型,操作结果:{{#_ret}}", bizNo = "{{#bomRowIds.toString()}}", type = "Ebom-初始化错误类型")
|
@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);
|
bomNewEbomParentService.batchCheckAndSaveEBomException(bomRowIds);
|
||||||
return ResultVO.success(true);
|
return ResultVO.success(true);
|
||||||
|
|
@ -464,4 +465,26 @@ public class EbomApi extends BaseApi {
|
||||||
VUtils.isTure(rootBomRowIds.size() > 1).throwMessage("每次只能导入1条");
|
VUtils.isTure(rootBomRowIds.size() > 1).throwMessage("每次只能导入1条");
|
||||||
return bomNewEbomParentService.importToSAP(rootBomRowIds.get(0));
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取对应的原始bom
|
||||||
|
* @param rowId rowId
|
||||||
|
* @return 原始bom
|
||||||
|
*/
|
||||||
|
@GetMapping("getSource")
|
||||||
|
@ApiOperation("获取对应的原始bom")
|
||||||
|
public ResultVO<BomOriginalListVO> getSource(@Valid @RequestParam("rowId") @NotNull Long rowId) {
|
||||||
|
return ResultVO.success(bomNewEbomParentService.getSource(rowId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,12 @@ import io.swagger.annotations.ApiOperation;
|
||||||
import nflg.product.common.vo.ResultVO;
|
import nflg.product.common.vo.ResultVO;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -30,6 +33,10 @@ public class TestApi {
|
||||||
@Resource
|
@Resource
|
||||||
SapOpUtilService sapOpUtilService;
|
SapOpUtilService sapOpUtilService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sap接口测试
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@GetMapping("sap")
|
@GetMapping("sap")
|
||||||
@ApiOperation("sap接口测试")
|
@ApiOperation("sap接口测试")
|
||||||
public ResultVO<List<OperationErrorMsgVO>> workDetailsListByPage() {
|
public ResultVO<List<OperationErrorMsgVO>> workDetailsListByPage() {
|
||||||
|
|
@ -52,4 +59,19 @@ public class TestApi {
|
||||||
sapDto.setT1(t1s);
|
sapDto.setT1(t1s);
|
||||||
return ResultVO.success(sapOpUtilService.importToSapV2(sapDto, null));
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,4 +24,6 @@ public interface BomNewEbomChildMapper extends BaseMapper<BomNewEbomChildEntity>
|
||||||
void updateEBomMaterialUse();
|
void updateEBomMaterialUse();
|
||||||
|
|
||||||
List<ChildMaxExceptionStateVO> getChildMaxExceptionState(@Param("bomRowIds") List<Long> bomRowIds);
|
List<ChildMaxExceptionStateVO> getChildMaxExceptionState(@Param("bomRowIds") List<Long> bomRowIds);
|
||||||
|
|
||||||
|
Integer shouldSetRootIs(String materialNo);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ public interface BomNewEbomParentMapper extends BaseMapper<BomNewEbomParentEntit
|
||||||
* @param query
|
* @param query
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Page<BomNewEbomParentVO> formalWorksheet(Page<BomNewEbomParentVO> page, @Param("query") BomNewEbomParentQuery query);
|
Page<BomNewEbomParentVO> formalWorksheet(Page<BomNewEbomParentVO> page, @Param("query") BomNewEbomParentQuery query, String userCode);
|
||||||
|
|
||||||
Page<BomNewEbomUpgradeChangeVO> getUpgradeChangeList(Page<BomNewEbomUpgradeChangeVO> page, @Param("query") BomNewEbomParentQuery query);
|
Page<BomNewEbomUpgradeChangeVO> getUpgradeChangeList(Page<BomNewEbomUpgradeChangeVO> page, @Param("query") BomNewEbomParentQuery query);
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
package com.nflg.product.bomnew.pojo.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.ttzero.excel.annotation.ExcelColumn;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 曹鹏飞
|
||||||
|
* @date 2024/5/8 09:07:23
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class EbomExcelDTO extends BaseImportExcelDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父级物料编号
|
||||||
|
*/
|
||||||
|
@ExcelColumn("抬头物料")
|
||||||
|
private String parentMaterialNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父级物料描述
|
||||||
|
*/
|
||||||
|
@ExcelColumn("物料描述")
|
||||||
|
private String parentMaterialDesc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目类别
|
||||||
|
*/
|
||||||
|
@ExcelColumn("项目类别")
|
||||||
|
private String projectType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料编号
|
||||||
|
*/
|
||||||
|
@ExcelColumn("项目物料")
|
||||||
|
private String materialNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料描述
|
||||||
|
*/
|
||||||
|
@ExcelColumn("项目物料描述")
|
||||||
|
private String materialDesc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数量
|
||||||
|
*/
|
||||||
|
@ExcelColumn("数量")
|
||||||
|
private BigDecimal num;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料单位
|
||||||
|
*/
|
||||||
|
@ExcelColumn("单位")
|
||||||
|
private String unit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序顺序
|
||||||
|
*/
|
||||||
|
@ExcelColumn("排序顺序")
|
||||||
|
private String orderNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@ExcelColumn("备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图号
|
||||||
|
*/
|
||||||
|
private String drawingNo;
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.nflg.product.bomnew.pojo.vo;
|
package com.nflg.product.bomnew.pojo.vo;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import org.ttzero.excel.annotation.ExcelColumn;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
@ -11,6 +12,7 @@ import java.io.Serializable;
|
||||||
public class OperationErrorMsgBaseVO implements Serializable {
|
public class OperationErrorMsgBaseVO implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty("错误描述")
|
@ApiModelProperty("错误描述")
|
||||||
|
@ExcelColumn("异常信息")
|
||||||
public String msg;
|
public String msg;
|
||||||
|
|
||||||
public OperationErrorMsgBaseVO() {
|
public OperationErrorMsgBaseVO() {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.nflg.product.bomnew.pojo.vo;
|
package com.nflg.product.bomnew.pojo.vo;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.ttzero.excel.annotation.ExcelColumn;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
@ -8,9 +10,11 @@ import java.io.Serializable;
|
||||||
* @author 曹鹏飞
|
* @author 曹鹏飞
|
||||||
* @date 2024-03-21 14:49:05
|
* @date 2024-03-21 14:49:05
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class OperationErrorMsgVO extends OperationErrorMsgBaseVO implements Serializable {
|
public class OperationErrorMsgVO extends OperationErrorMsgBaseVO implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty("主键数据")
|
@ApiModelProperty("主键数据")
|
||||||
|
@ExcelColumn("所在行")
|
||||||
public String primaryKey;
|
public String primaryKey;
|
||||||
|
|
||||||
public OperationErrorMsgVO() {
|
public OperationErrorMsgVO() {
|
||||||
|
|
|
||||||
|
|
@ -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.ImportSapParamDTO;
|
||||||
import com.nflg.product.bomnew.pojo.dto.sap.impart2.T1DTO;
|
import com.nflg.product.bomnew.pojo.dto.sap.impart2.T1DTO;
|
||||||
import com.nflg.product.bomnew.pojo.entity.*;
|
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.BomNewEbomMaterialQuery;
|
||||||
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
|
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
|
||||||
import com.nflg.product.bomnew.pojo.vo.*;
|
import com.nflg.product.bomnew.pojo.vo.*;
|
||||||
|
|
@ -97,6 +98,12 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
@Resource
|
@Resource
|
||||||
private BomNewEbomUpdateDetailService updateDetailService;
|
private BomNewEbomUpdateDetailService updateDetailService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BomNewOriginalParentService originalParentService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BomNewOriginalChildService originalChildService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取列表
|
* 获取列表
|
||||||
*
|
*
|
||||||
|
|
@ -295,7 +302,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Page<BomNewEbomParentVO> formalWorksheet(BomNewEbomParentQuery query) {
|
public Page<BomNewEbomParentVO> formalWorksheet(BomNewEbomParentQuery query) {
|
||||||
Page<BomNewEbomParentVO> result = this.getBaseMapper().formalWorksheet(new Page<>(query.getPage(), query.getPageSize()), query);
|
Page<BomNewEbomParentVO> result = this.getBaseMapper().formalWorksheet(new Page<>(query.getPage(), query.getPageSize()), query, SessionUtil.getUserCode());
|
||||||
|
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(result.getRecords())) {
|
if (CollUtil.isNotEmpty(result.getRecords())) {
|
||||||
|
|
@ -398,6 +405,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
child.setCurrentVersion(OriginalConstant.DEFAULT_BOM_VERSION);
|
child.setCurrentVersion(OriginalConstant.DEFAULT_BOM_VERSION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
child.setChildBomRowId(child.getRowId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -527,10 +535,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
*
|
*
|
||||||
* @param rowId
|
* @param rowId
|
||||||
* @return
|
* @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);
|
List<BomNewEbomParentVO> bomDetail = this.getBaseMapper().getParentChild(rowId);
|
||||||
// EBomDetailTask detailTask = new EBomDetailTask(bomDetail);
|
// EBomDetailTask detailTask = new EBomDetailTask(bomDetail);
|
||||||
|
|
||||||
|
|
@ -719,7 +725,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) {
|
for (Long bomRowId : bomRowIds) {
|
||||||
CheckEBomException checkEBomException = new CheckEBomException(bomRowId);
|
CheckEBomException checkEBomException = new CheckEBomException(bomRowId);
|
||||||
checkEBomException.initException();
|
checkEBomException.initException();
|
||||||
|
|
@ -960,7 +966,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
private void updateSapState(Long rootBomRowId, SapStatusEnum sapState) {
|
private void updateSapState(Long rootBomRowId, SapStatusEnum sapState) {
|
||||||
lambdaUpdate().eq(BomNewEbomParentEntity::getRowId, rootBomRowId)
|
lambdaUpdate().eq(BomNewEbomParentEntity::getRowId, rootBomRowId)
|
||||||
.set(BomNewEbomParentEntity::getSapTime, LocalDateTime.now())
|
.set(BomNewEbomParentEntity::getSapTime, LocalDateTime.now())
|
||||||
.set(BomNewEbomParentEntity::getSapState, sapState)
|
.set(BomNewEbomParentEntity::getSapState, sapState.getValue())
|
||||||
.update();
|
.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1561,7 +1567,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
|
|
||||||
parentVO.setBomRowId(parentVO.getRowId());
|
parentVO.setBomRowId(parentVO.getRowId());
|
||||||
parentVO.setProjectType(projectType);
|
parentVO.setProjectType(projectType);
|
||||||
parentVO.setParentRowId(0l);
|
parentVO.setParentRowId(0L);
|
||||||
|
parentVO.setChildBomRowId(rowId);
|
||||||
materialMainService.intiMaterialInfo(ImmutableList.of(parentVO), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT2);
|
materialMainService.intiMaterialInfo(ImmutableList.of(parentVO), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT2);
|
||||||
vo.setDatas(getChild(bomRowId));
|
vo.setDatas(getChild(bomRowId));
|
||||||
}
|
}
|
||||||
|
|
@ -2258,4 +2265,58 @@ 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BomOriginalListVO getSource(Long rowId) {
|
||||||
|
VUtils.isTure(Objects.isNull(rowId) || rowId == 0).throwMessage("无效的数据");
|
||||||
|
|
||||||
|
BomNewEbomParentEntity parent = getById(rowId);
|
||||||
|
|
||||||
|
if (!Objects.isNull(parent)) {
|
||||||
|
if (parent.getSourceRowId() != 0) {
|
||||||
|
BomNewOriginalParentEntity op = originalParentService.getById(parent.getSourceRowId());
|
||||||
|
if (!Objects.isNull(op)) {
|
||||||
|
return Convert.convert(BomOriginalListVO.class, op);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
BomNewEbomChildEntity child = ebomChildService.getById(rowId);
|
||||||
|
if (!Objects.isNull(child)) {
|
||||||
|
if (child.getSourceRowId() != 0) {
|
||||||
|
BomNewOriginalChildEntity oc = originalChildService.getById(child.getSourceRowId());
|
||||||
|
if (!Objects.isNull(oc)) {
|
||||||
|
return Convert.convert(BomOriginalListVO.class, oc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -319,7 +319,7 @@ public class BomNewMbomParentService extends ServiceImpl<BomNewMbomParentMapper,
|
||||||
private void updateSapState(Long rootBomRowId, SapStatusEnum sapState) {
|
private void updateSapState(Long rootBomRowId, SapStatusEnum sapState) {
|
||||||
lambdaUpdate().eq(BomNewMbomParentEntity::getRowId, rootBomRowId)
|
lambdaUpdate().eq(BomNewMbomParentEntity::getRowId, rootBomRowId)
|
||||||
.set(BomNewMbomParentEntity::getSysnSapTime, LocalDateTime.now())
|
.set(BomNewMbomParentEntity::getSysnSapTime, LocalDateTime.now())
|
||||||
.set(BomNewMbomParentEntity::getStatus, sapState)
|
.set(BomNewMbomParentEntity::getStatus, sapState.getValue())
|
||||||
.update();
|
.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -379,6 +379,9 @@ public class DQBomImportService {
|
||||||
dQbomExcelVO.setProjectType(BomConstant.PROJECT_TYPE_TEMPORARY);
|
dQbomExcelVO.setProjectType(BomConstant.PROJECT_TYPE_TEMPORARY);
|
||||||
}
|
}
|
||||||
dQbomExcelVO.setCurrentVersion("");
|
dQbomExcelVO.setCurrentVersion("");
|
||||||
|
if (StrUtil.isBlank(dQbomExcelVO.getProjectType())) {
|
||||||
|
dQbomExcelVO.setProjectType("L");
|
||||||
|
}
|
||||||
|
|
||||||
excelContextTL.get().add(dQbomExcelVO);
|
excelContextTL.get().add(dQbomExcelVO);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,286 @@
|
||||||
|
package com.nflg.product.bomnew.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
|
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||||
|
import com.nflg.product.bomnew.constant.*;
|
||||||
|
import com.nflg.product.bomnew.pojo.dto.BaseImportExcelDTO;
|
||||||
|
import com.nflg.product.bomnew.pojo.dto.EbomExcelDTO;
|
||||||
|
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.OperationErrorMsgVO;
|
||||||
|
import com.nflg.product.bomnew.util.BomUtil;
|
||||||
|
import com.nflg.product.bomnew.util.EecExcelUtil;
|
||||||
|
import com.nflg.product.bomnew.util.StringUtil;
|
||||||
|
import com.nflg.product.bomnew.util.VUtils;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 曹鹏飞
|
||||||
|
* @date 2024/5/8 09:02:12
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class EBomImportService {
|
||||||
|
|
||||||
|
public static final ThreadLocal<Integer> rowNum = new ThreadLocal<>();
|
||||||
|
|
||||||
|
public static final ThreadLocal<List<EbomExcelDTO>> excelContextTL = new ThreadLocal<>();
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MaterialMainService materialMainService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserRoleService userRoleService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BomNewEbomParentService bomNewEbomParentService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BomNewEbomChildService bomNewEbomChildService;
|
||||||
|
|
||||||
|
public List<OperationErrorMsgVO> importBom(MultipartFile file) throws IOException {
|
||||||
|
try {
|
||||||
|
rowNum.set(1);
|
||||||
|
excelContextTL.set(new ArrayList<>());
|
||||||
|
EecExcelUtil.handlerExcel(file.getInputStream(), EbomExcelDTO.class, this::handlerExcelRow);
|
||||||
|
|
||||||
|
List<EbomExcelDTO> datas = excelContextTL.get();
|
||||||
|
|
||||||
|
List<OperationErrorMsgVO> errorMsg = checkExcel(datas);
|
||||||
|
if (!errorMsg.isEmpty()) {
|
||||||
|
return errorMsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
Pair<List<BomNewEbomParentEntity>, List<BomNewEbomChildEntity>> pcs = convertToBom(datas);
|
||||||
|
VUtils.isTure(pcs.getLeft().stream().filter(p -> p.getRootIs() == 1).count() > 1)
|
||||||
|
.throwMessage("文件中存在多个根节点");
|
||||||
|
//VUtils.isTure(checkInconsistentData(pcs.getLeft().get(0), pcs.getLeft(), pcs.getRight()))
|
||||||
|
// .throwMessage("导入的数据已存在,请勿重复导入");
|
||||||
|
|
||||||
|
//save(pcs.getLeft(), pcs.getRight());
|
||||||
|
|
||||||
|
return Collections.emptyList();
|
||||||
|
} finally {
|
||||||
|
excelContextTL.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handlerExcelRow(EbomExcelDTO dQbomExcelVO) {
|
||||||
|
rowNum.set(rowNum.get() + 1);
|
||||||
|
log.debug("ebom导入excel,第{}行,处理前:{}", rowNum.get(), JSON.toJSONString(dQbomExcelVO));
|
||||||
|
|
||||||
|
dQbomExcelVO.setRowNum(rowNum.get());
|
||||||
|
|
||||||
|
excelContextTL.get().add(dQbomExcelVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<OperationErrorMsgVO> checkExcel(List<EbomExcelDTO> datas) {
|
||||||
|
List<OperationErrorMsgVO> errorMsg = new ArrayList<>();
|
||||||
|
|
||||||
|
List<Integer> numError = datas.stream().filter(u -> StrUtil.isBlank(u.getParentMaterialNo()))
|
||||||
|
.map(BaseImportExcelDTO::getRowNum)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (!numError.isEmpty()) {
|
||||||
|
errorMsg.addAll(numError.stream().map(n -> OperationErrorMsgVO.create("第" + n + "行", "抬头物料为空"))
|
||||||
|
.collect(Collectors.toList())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
numError = datas.stream().filter(u -> StrUtil.isBlank(u.getMaterialNo()))
|
||||||
|
.map(BaseImportExcelDTO::getRowNum)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (!numError.isEmpty()) {
|
||||||
|
errorMsg.addAll(numError.stream().map(n -> OperationErrorMsgVO.create("第" + n + "行", "项目物料为空"))
|
||||||
|
.collect(Collectors.toList())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
numError = datas.stream().filter(u -> Objects.isNull(u.getNum()) || BigDecimal.ZERO.compareTo(u.getNum()) >= 0)
|
||||||
|
.map(BaseImportExcelDTO::getRowNum)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (!numError.isEmpty()) {
|
||||||
|
errorMsg.addAll(numError.stream().map(n -> OperationErrorMsgVO.create("第" + n + "行", "数量不正确"))
|
||||||
|
.collect(Collectors.toList())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
numError = datas.stream().filter(u -> StringUtil.CountForMysql(u.getRemark()) > 200)
|
||||||
|
.map(BaseImportExcelDTO::getRowNum)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (!numError.isEmpty()) {
|
||||||
|
errorMsg.addAll(numError.stream().map(n -> OperationErrorMsgVO.create("第" + n + "行", "备注超出200字"))
|
||||||
|
.collect(Collectors.toList())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return errorMsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Pair<List<BomNewEbomParentEntity>, List<BomNewEbomChildEntity>> convertToBom(List<EbomExcelDTO> datas) {
|
||||||
|
List<BomNewEbomParentEntity> parents = new ArrayList<>();
|
||||||
|
List<BomNewEbomChildEntity> children = new ArrayList<>();
|
||||||
|
|
||||||
|
List<String> materialNos = datas.stream().map(EbomExcelDTO::getMaterialNo).collect(Collectors.toList());
|
||||||
|
materialNos.addAll(datas.stream().map(EbomExcelDTO::getParentMaterialNo).collect(Collectors.toList()));
|
||||||
|
materialNos = materialNos.stream().distinct().collect(Collectors.toList());
|
||||||
|
List<BaseMaterialVO> materialBaseInfos = materialMainService.getMaterialBaseInfo(materialNos);
|
||||||
|
|
||||||
|
BomNewEbomParentEntity parent;
|
||||||
|
for (EbomExcelDTO data : datas) {
|
||||||
|
parent = parents.stream().filter(p -> p.getMaterialNo().equals(data.getParentMaterialNo()))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
if (Objects.isNull(parent)) {
|
||||||
|
parents.add(buildRoot(materialBaseInfos, data.getParentMaterialNo(), data.getParentMaterialDesc()));
|
||||||
|
}
|
||||||
|
|
||||||
|
parent = parents.stream().filter(p -> p.getMaterialNo().equals(data.getMaterialNo()))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
if (Objects.isNull(parent)) {
|
||||||
|
parent = buildParent(materialBaseInfos, data);
|
||||||
|
children.add(buildChild(materialBaseInfos, parent, data.getProjectType()));
|
||||||
|
parents.add(parent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Pair.of(parents, children);
|
||||||
|
}
|
||||||
|
|
||||||
|
private BomNewEbomChildEntity buildChild(List<BaseMaterialVO> materialBaseInfos, BomNewEbomParentEntity parent, String projectType) {
|
||||||
|
BomNewEbomChildEntity child = Convert.convert(BomNewEbomChildEntity.class, parent);
|
||||||
|
parent.setOrderNumber("");
|
||||||
|
child.setRowId(IdWorker.getId());
|
||||||
|
child.setParentRowId(parent.getRowId());
|
||||||
|
child.setProjectType(projectType);
|
||||||
|
child.setProjectTypeInputType(ProjectTypeInputTypeEnum.MANUAL_INPUT.getValue());
|
||||||
|
child.setIdentityNo(child.getParentRowId() + "_" + child.getRowId());
|
||||||
|
BaseMaterialVO vo = materialBaseInfos.stream()
|
||||||
|
.filter(m -> m.getMaterialNo().equals(child.getMaterialNo()))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
if (!Objects.isNull(vo)) {
|
||||||
|
child.setMaterialCategoryCode(vo.getMaterialCategoryCode());
|
||||||
|
}
|
||||||
|
return child;
|
||||||
|
}
|
||||||
|
|
||||||
|
private BomNewEbomParentEntity buildParent(List<BaseMaterialVO> materialBaseInfos, EbomExcelDTO data) {
|
||||||
|
BomNewEbomParentEntity parent = new BomNewEbomParentEntity();
|
||||||
|
parent.setRowId(IdWorker.getId());
|
||||||
|
|
||||||
|
BaseMaterialVO vo = materialBaseInfos.stream()
|
||||||
|
.filter(m -> m.getMaterialNo().equals(data.getMaterialNo()))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
if (!Objects.isNull(vo)) {
|
||||||
|
parent.setDrawingNo(vo.getDrawingNo());
|
||||||
|
parent.setUnitWeight(vo.getMaterialWeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
parent.setMaterialNo(data.getMaterialNo());
|
||||||
|
parent.setMaterialDesc(data.getMaterialDesc());
|
||||||
|
parent.setMaterialTexture("");
|
||||||
|
parent.setMaterialUnit(data.getUnit());
|
||||||
|
parent.setNum(data.getNum());
|
||||||
|
parent.setTotalWeight(BomUtil.calculateTotalWeight(parent.getNum(), parent.getUnitWeight()));
|
||||||
|
//parent.setCurrentVersion(OriginalConstant.DEFAULT_BOM_VERSION);
|
||||||
|
parent.setUserRootIs(0);
|
||||||
|
parent.setRootIs(0);
|
||||||
|
if (userRoleService.technician()) {
|
||||||
|
//工艺人员
|
||||||
|
parent.setStatus(EBomStatusEnum.CHECKED.getValue());
|
||||||
|
parent.setCreatedJob(UserJobEnum.ENGINEER.getValue());
|
||||||
|
parent.setAuditUserName(SessionUtil.getUserCode());
|
||||||
|
parent.setAuditTime(LocalDateTime.now());
|
||||||
|
} else {
|
||||||
|
//设计人员
|
||||||
|
parent.setStatus(EBomStatusEnum.WAIT_CHECK.getValue());
|
||||||
|
parent.setCreatedJob(UserJobEnum.DESIGNER.getValue());
|
||||||
|
parent.setRootIsForWaitReview(1);
|
||||||
|
}
|
||||||
|
parent.setDeviseName(SessionUtil.getRealName());
|
||||||
|
parent.setDeviseUserCode(SessionUtil.getUserCode());
|
||||||
|
parent.setLastVersionIs(1);
|
||||||
|
parent.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.getValue());
|
||||||
|
parent.setExceptionStatus(EBomExceptionStatusEnum.INIT.getValue());
|
||||||
|
parent.setCreatedBy(SessionUtil.getUserCode());
|
||||||
|
parent.setRemark(data.getRemark());
|
||||||
|
parent.setOrderNumber(data.getOrderNum());
|
||||||
|
parent.setDeptName(SessionUtil.getDepartName());
|
||||||
|
parent.setSource(EBomSourceEnum.FROM_EXCE.getValue());
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建顶级
|
||||||
|
* @param materialBaseInfos 主物料数据
|
||||||
|
* @param materialNo 物料编号
|
||||||
|
* @param materialDesc 物料描述
|
||||||
|
* @return 父级
|
||||||
|
*/
|
||||||
|
private BomNewEbomParentEntity buildRoot(List<BaseMaterialVO> materialBaseInfos, String materialNo, String materialDesc) {
|
||||||
|
BomNewEbomParentEntity parent = new BomNewEbomParentEntity();
|
||||||
|
parent.setRowId(IdWorker.getId());
|
||||||
|
|
||||||
|
BaseMaterialVO vo = materialBaseInfos.stream()
|
||||||
|
.filter(m -> m.getMaterialNo().equals(materialNo))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
if (!Objects.isNull(vo)) {
|
||||||
|
parent.setDrawingNo(vo.getDrawingNo());
|
||||||
|
parent.setUnitWeight(vo.getMaterialWeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
parent.setMaterialNo(materialNo);
|
||||||
|
parent.setMaterialDesc(materialDesc);
|
||||||
|
parent.setMaterialTexture("");
|
||||||
|
parent.setMaterialUnit("PC");
|
||||||
|
//parent.setUnitWeight(BigDecimal.ZERO);
|
||||||
|
parent.setNum(BigDecimal.ONE);
|
||||||
|
//parent.setTotalWeight(BomUtil.calculateTotalWeight(data.getNum(), data.getUnitWeight()));
|
||||||
|
//parent.setCurrentVersion(OriginalConstant.DEFAULT_BOM_VERSION);
|
||||||
|
parent.setUserRootIs(1);
|
||||||
|
if (userRoleService.technician()) {
|
||||||
|
//工艺人员
|
||||||
|
parent.setStatus(EBomStatusEnum.CHECKED.getValue());
|
||||||
|
parent.setCreatedJob(UserJobEnum.ENGINEER.getValue());
|
||||||
|
parent.setAuditUserName(SessionUtil.getUserCode());
|
||||||
|
parent.setAuditTime(LocalDateTime.now());
|
||||||
|
parent.setRootIs(bomNewEbomChildService.getBaseMapper().shouldSetRootIs(materialNo));
|
||||||
|
} else {
|
||||||
|
//设计人员
|
||||||
|
parent.setRootIs(1);
|
||||||
|
parent.setStatus(EBomStatusEnum.WAIT_CHECK.getValue());
|
||||||
|
parent.setCreatedJob(UserJobEnum.DESIGNER.getValue());
|
||||||
|
parent.setRootIsForWaitReview(1);
|
||||||
|
}
|
||||||
|
parent.setDeviseName(SessionUtil.getRealName());
|
||||||
|
parent.setDeviseUserCode(SessionUtil.getUserCode());
|
||||||
|
parent.setLastVersionIs(1);
|
||||||
|
parent.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.getValue());
|
||||||
|
parent.setExceptionStatus(EBomExceptionStatusEnum.INIT.getValue());
|
||||||
|
parent.setCreatedBy(SessionUtil.getUserCode());
|
||||||
|
parent.setRemark("");
|
||||||
|
parent.setDeptName(SessionUtil.getDepartName());
|
||||||
|
parent.setSource(EBomSourceEnum.FROM_EXCE.getValue());
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -21,7 +21,6 @@ import nflg.product.common.constant.STATE;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
import java.util.stream.Collectors;
|
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);
|
allBomDetail = SpringUtil.getBean(BomNewEbomParentService.class).getBomTree(bomRowId, true);
|
||||||
//只检查待复核和自己的
|
//只检查待复核和自己的
|
||||||
|
|
@ -114,10 +113,10 @@ public class CheckEBomException {
|
||||||
&& unCheckExcept.contains(vo.getExceptionStatus())) {
|
&& unCheckExcept.contains(vo.getExceptionStatus())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
BaseMaterialVO mainVO = materialBaseInfo.stream()
|
// BaseMaterialVO mainVO = materialBaseInfo.stream()
|
||||||
.filter(u -> StrUtil.equals(u.getMaterialNo(), vo.getMaterialNo()))
|
// .filter(u -> StrUtil.equals(u.getMaterialNo(), vo.getMaterialNo()))
|
||||||
.findFirst()
|
// .findFirst()
|
||||||
.orElse(null);
|
// .orElse(null);
|
||||||
vo.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
|
vo.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
|
||||||
// }
|
// }
|
||||||
if (StrUtil.isNotBlank(vo.getMaterialNo())
|
if (StrUtil.isNotBlank(vo.getMaterialNo())
|
||||||
|
|
@ -131,8 +130,9 @@ public class CheckEBomException {
|
||||||
} else if (StrUtil.isBlank(vo.getProjectType()) && !Objects.equals(vo.getRootIs(), 1)
|
} else if (StrUtil.isBlank(vo.getProjectType()) && !Objects.equals(vo.getRootIs(), 1)
|
||||||
&& !Objects.equals(vo.getUserRootIs(), 1) && !Objects.equals(vo.getRootIsForWaitReview(), 1)) {
|
&& !Objects.equals(vo.getUserRootIs(), 1) && !Objects.equals(vo.getRootIsForWaitReview(), 1)) {
|
||||||
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_8.getValue());
|
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_8.getValue());
|
||||||
} else if ((StrUtil.equals("KG", StringUtil.toUpperCase(vo.getMaterialUnit())) && !StrUtil.equals(StringUtil.toUpperCase(vo.getMaterialUnit()), "PC"))
|
} 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()))) {
|
//|| (!Objects.isNull(mainVO) && !StrUtil.equals(vo.getMaterialUnit(), mainVO.getMaterialUnit()))) {
|
||||||
|
&& (StrUtil.isBlank(vo.getExceptionTag()) || (!vo.getExceptionTag().contains("16")) && !vo.getExceptionTag().contains("12"))) {
|
||||||
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_12.getValue());
|
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_12.getValue());
|
||||||
} else if (StrUtil.isNotBlank(vo.getNoticeNums()) && EBomExceptionStatusEnum.EXCEPT_NO_11.equalsValue(vo.getExceptionStatus())) {
|
} else if (StrUtil.isNotBlank(vo.getNoticeNums()) && EBomExceptionStatusEnum.EXCEPT_NO_11.equalsValue(vo.getExceptionStatus())) {
|
||||||
vo.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
|
vo.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
|
||||||
|
|
|
||||||
|
|
@ -73,4 +73,16 @@
|
||||||
</foreach>
|
</foreach>
|
||||||
group by parent_row_id
|
group by parent_row_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="shouldSetRootIs" resultType="java.lang.Integer">
|
||||||
|
SELECT CASE
|
||||||
|
WHEN EXISTS
|
||||||
|
(SELECT *
|
||||||
|
FROM t_bom_new_ebom_parent p
|
||||||
|
INNER JOIN t_bom_new_ebom_child c ON p.row_id = c.parent_row_id
|
||||||
|
AND p.STATUS < 4
|
||||||
|
WHERE c.material_no = #{materialNo}) THEN 1
|
||||||
|
ELSE 0
|
||||||
|
END AS result;
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -393,24 +393,26 @@
|
||||||
SELECT *,row_id as bomRowId
|
SELECT *,row_id as bomRowId
|
||||||
FROM t_bom_new_ebom_parent
|
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="query.showMySelfOnly == 1">
|
<where>
|
||||||
AND created_by = #{userCode}
|
<if test="query.showMySelfOnly == 1">
|
||||||
</if>
|
AND created_by = #{userCode}
|
||||||
<if test="userJob==0">
|
</if>
|
||||||
WHERE status IN (1,3) AND (user_root_is=1 OR root_is_for_wait_review=1) AND created_by=#{userCode}
|
<if test="userJob==0">
|
||||||
</if>
|
AND status IN (1,3) AND (user_root_is=1 OR root_is_for_wait_review=1) AND created_by=#{userCode}
|
||||||
<if test="userJob==1 and query.dataType==0">
|
</if>
|
||||||
WHERE root_is=1 AND status=2
|
<if test="userJob==1 and query.dataType==0">
|
||||||
</if>
|
AND root_is=1 AND status=2
|
||||||
<if test="userJob==1 and query.dataType==1">
|
</if>
|
||||||
WHERE root_is=1 AND status=4
|
<if test="userJob==1 and query.dataType==1">
|
||||||
</if>
|
AND root_is=1 AND status=4
|
||||||
<if test="query.deviseName!=null and query.deviseName!=''">
|
</if>
|
||||||
AND devise_name=#{query.deviseName}
|
<if test="query.deviseName!=null and query.deviseName!=''">
|
||||||
</if>
|
AND devise_name=#{query.deviseName}
|
||||||
<if test="query.startDate!=null and query.startDate!=''">
|
</if>
|
||||||
AND created_time BETWEEN #{query.startDate} AND DATE_ADD(#{query.endDate}, INTERVAL 1 DAY)
|
<if test="query.startDate!=null and query.startDate!=''">
|
||||||
</if>
|
AND created_time BETWEEN #{query.startDate} AND DATE_ADD(#{query.endDate}, INTERVAL 1 DAY)
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
order by row_id desc
|
order by row_id desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue