问题调整

This commit is contained in:
jing's 2024-01-03 22:36:25 +08:00
parent be9db5d36f
commit 5ef293e69c
8 changed files with 72 additions and 39 deletions

View File

@ -326,7 +326,7 @@ public class EbomApi extends BaseApi {
@PostMapping("temporary")
@ApiOperation("暂存")
public ResultVO<Boolean> temporary(@RequestBody BomNewEBomParentEditDTO dto) {
public ResultVO<Boolean> temporary(@RequestBody BomNewEBomParentEditDTO dto) throws ExecutionException, InterruptedException {
return ResultVO.success(bomNewEbomParentService.temporary(dto));
}

View File

@ -30,7 +30,6 @@ import java.util.Objects;
/**
* t_bom_new_mbom_parent 表控制层
*
*
* @author makejava
* @since 2024-01-01 10:53:24
*/
@ -46,7 +45,7 @@ public class MBomApi extends BaseApi {
private BomNewMbomParentService bomNewMbomParentService;
@Resource
private BomNewMbomDetailService bomNewMbomDetailService ;
private BomNewMbomDetailService bomNewMbomDetailService;
/**
@ -70,64 +69,53 @@ public class MBomApi extends BaseApi {
@PostMapping("getChild")
@ApiOperation("获取下级")
public ResultVO<List<BomNewMbomMiddleVO>> getChild(@RequestBody BomNewMBomChildDTO dto) {
if(Objects.isNull(dto.getBomRowId())){
throw new NflgBusinessException(STATE.ParamErr,"bomRowId 不能为空");
if (Objects.isNull(dto.getBomRowId())) {
throw new NflgBusinessException(STATE.ParamErr, "bomRowId 不能为空");
}
if(Objects.isNull(dto.getRowId())){
throw new NflgBusinessException(STATE.ParamErr,"rowId 不能为空");
if (Objects.isNull(dto.getRowId())) {
throw new NflgBusinessException(STATE.ParamErr, "rowId 不能为空");
}
return ResultVO.success(bomNewMbomParentService.getChild(dto));
}
@GetMapping("factoryList")
@ApiOperation("工厂列表")
public ResultVO<List> factoryList() {
List list= EnumUtils.listEnum( FactoryCodeEnum.class);
List list = EnumUtils.listEnum(FactoryCodeEnum.class);
return ResultVO.success(list);
}
@PostMapping("superSaterialList")
@ApiOperation("设置超级物料列表")
public ResultVO<List<BomNewMbomDetailVO>> superSaterialList(@RequestParam(value = "rowId") Long rowId ) {
public ResultVO<List<BomNewMbomDetailVO>> superSaterialList(@RequestParam(value = "rowId") Long rowId) {
if (Objects.isNull(rowId)) {
throw new NflgBusinessException(STATE.ParamErr, "选择行后操作");
}
return ResultVO.success(bomNewMbomDetailService.superSaterialList(rowId));
return ResultVO.success(bomNewMbomDetailService.superSaterialList(rowId));
}
@PostMapping("superSaterialStatus")
@ApiOperation("设置超级物料")
public ResultVO<Boolean> superSaterialStatus(@ApiParam("超级物料 0-否 1-是") @RequestParam(value = "status") Integer status, @RequestParam(value = "rowId") Long rowId ) {
if(Objects.isNull(rowId)){
throw new NflgBusinessException(STATE.ParamErr,"选择行后操作");
public ResultVO<Boolean> superSaterialStatus(@ApiParam("超级物料 0-否 1-是") @RequestParam(value = "status") Integer status, @RequestParam(value = "rowId") Long rowId) {
if (Objects.isNull(rowId)) {
throw new NflgBusinessException(STATE.ParamErr, "选择行后操作");
}
if(Objects.isNull(status)){
throw new NflgBusinessException(STATE.ParamErr,"status 不能为空");
if (Objects.isNull(status)) {
throw new NflgBusinessException(STATE.ParamErr, "status 不能为空");
}
if(StrUtil.isEmpty(EnumUtils.getEnumDescription(MBomConstantEnum.MBomSuperMaterialStatusEnum.class,status))){
throw new NflgBusinessException(STATE.ParamErr,"status 不在范围内");
if (StrUtil.isEmpty(EnumUtils.getEnumDescription(MBomConstantEnum.MBomSuperMaterialStatusEnum.class, status))) {
throw new NflgBusinessException(STATE.ParamErr, "status 不在范围内");
}
bomNewMbomDetailService.superSaterialStatusTag(rowId,status);
bomNewMbomDetailService.superSaterialStatusTag(rowId, status);
return ResultVO.success(true);
}
}
}

View File

@ -39,6 +39,10 @@ public interface MaterialMainMapper extends BaseMapper<MaterialMainEntity> {
Integer getUserMultiplantFacRoleCount(@Param("userRowId") Long userRowId);
List<BaseMaterialVO> getMaterialLikeByDrawingNo(@Param("drawingNo") String drawingNo);
}

View File

@ -1191,7 +1191,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
* 用户临时处理数据数据的处理状态为待处理当用户单击暂存的时候所有的数据都不需要校验直接保存即可
*/
public Boolean temporary(BomNewEBomParentEditDTO dto) {
public Boolean temporary(BomNewEBomParentEditDTO dto) throws ExecutionException, InterruptedException {
EBomEdit eBomEdit = new EBomEdit(EBomSourceEnum.FROM_MDM.getValue());
dto.setOpType(EbomEditStatusEnum.HANDLER_CREATED.getValue());
@ -1210,6 +1210,10 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
deleteBomChild(dto.getDelDatas());
}
}
checkAndSaveEBomException(dto.getParent().getBomRowId());
ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
@ -1268,7 +1272,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
deleteBomChild(dto.getDelDatas());
}
}
checkAndSaveEBomException(dto.getParent().getBomRowId());
// ebomChildService.getBaseMapper().updateEBomMaterialUse();
ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
return true;

View File

@ -178,9 +178,19 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
}
}
}
public List<BaseMaterialVO> getMaterialLikeByDrawingNo( String drawingNo ) {
List<BaseMaterialVO> materialList = SpringUtil.getBean(MaterialMainMapper.class).getMaterialLikeByDrawingNo(drawingNo);
return materialList;
}
/**
* @param drawingNos 图号 物料号
* @return

View File

@ -21,10 +21,12 @@ import com.nflg.product.bomnew.pojo.dto.OptionalEbomMainDTO;
import com.nflg.product.bomnew.pojo.entity.OptionalEbomImportChildEntity;
import com.nflg.product.bomnew.pojo.entity.OptionalEbomImportEntity;
import com.nflg.product.bomnew.pojo.entity.OptionalEbomMainEntity;
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
import com.nflg.product.bomnew.service.MaterialMainService;
import com.nflg.product.bomnew.service.OptionalEbomImportChildService;
import com.nflg.product.bomnew.service.OptionalEbomImportService;
import com.nflg.product.bomnew.service.OptionalEbomMainService;
import lombok.extern.slf4j.Slf4j;
import nflg.product.common.constant.STATE;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
@ -40,6 +42,7 @@ import java.util.stream.Collectors;
* 导入移动破
*/
@Service
@Slf4j
public class OptionalExcelService {
@Resource
@ -294,11 +297,27 @@ public class OptionalExcelService {
for (OptionalEbomImportDTO item1 :
listParent) {
List<OptionalEbomImportChildDTO> listChild = item1.getChild();
//
SpringUtil.getBean(MaterialMainService.class).initMaterialForDrawdingNoImmul(listChild, OptionalEbomImportChildDTO::getDrawingNo, OptionalEbomImportChildDTO::setMaterialNo, OptionalEbomImportChildDTO::setMaterialDesc);
//构建测试数据 无物料号 用图号代替
for (OptionalEbomImportChildDTO childDTO : listChild) {
if (!childDTO.getTag() && StringUtils.isEmpty(childDTO.getMaterialNo())) {
//in 批量没匹配到 再模糊匹配一次
List<BaseMaterialVO> likeList= SpringUtil.getBean(MaterialMainService.class)
.getMaterialLikeByDrawingNo(StrUtil.format("{} {}",childDTO.getDrawingNo(),childDTO.getMaterialName()));
if(CollectionUtil.isNotEmpty(likeList) ) {
if (likeList.size() == 1) {
BaseMaterialVO materialVO = likeList.get(0);
childDTO.setMaterialNo(materialVO.getMaterialNo());
childDTO.setMaterialDesc(materialVO.getMaterialDesc());
continue;
} else if (likeList.size() > 1) {
throw new NflgBusinessException(STATE.BusinessError, StrUtil.format("第{}行,{} 图号匹配到多条物料数据", childDTO.getLineNo(), childDTO.getDrawingNo()));
}
}
// childDTO.setMaterialNo(childDTO.getDrawingNo());
childDTO.setError(childDTO.getError() | OptionalBomConstant.ExcelErrorTagEnum.MATERIA_NO_UNKOWN.getValue());
item1.setError(true);
@ -308,7 +327,7 @@ public class OptionalExcelService {
}
});
System.out.println(JSON.toJSON(optionalEbomInportExcelDTO));
}
@ -318,9 +337,10 @@ public class OptionalExcelService {
throw new NflgBusinessException(STATE.Error, hintMsg);
}
// return true;
System.out.println(JSON.toJSONString(optionalEbomInportExcelDTO));
// return true;
//保存db
return batchExcelToRepertory(optionalEbomInportExcelDTO);
return batchExcelToRepertory(optionalEbomInportExcelDTO);
}

View File

@ -23,9 +23,7 @@ public class IndexListTree {
Map<Long, List<BomNewMbomMiddleVO>> groupMap = childs.stream().collect(Collectors.groupingBy(BomNewMbomMiddleVO::getParentRowId));
childs.forEach(child -> {
child.setChildNodes(groupMap.get(child.getRowId()));
sysnParentParam(parent,child);
});

View File

@ -108,6 +108,15 @@
</select>
<select id="getMaterialLikeByDrawingNo" resultType="com.nflg.product.bomnew.pojo.vo.BaseMaterialVO">
select material_no, material_name, material_desc, procure_type, project_type, material_state,drawing_no,material_category_code ,material_get_type
from t_material_main
where drawing_no like concat('', #{drawingNo},'%')
</select>