optimize: 大量修改
This commit is contained in:
parent
424095c5c5
commit
7e3cf23eb1
|
|
@ -1,10 +1,10 @@
|
|||
package com.nflg.product.bomnew.api.user;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.lang.TypeReference;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.nflg.product.base.core.api.BaseApi;
|
||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||
|
|
@ -26,6 +26,7 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.ttzero.excel.entity.ListSheet;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
|
@ -219,5 +220,28 @@ public class BomReportApi extends BaseApi {
|
|||
return ResultVO.success(forwardReportService.factoryVersion(query));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 反查导出
|
||||
*/
|
||||
@PostMapping("reverseExport")
|
||||
@ApiOperation("反查导出")
|
||||
public void reverseExport(@RequestBody ReverseReportQuery query, HttpServletResponse response) throws IOException {
|
||||
ResultVO resultVO = checkQueryParam(query);
|
||||
if (resultVO != null) {
|
||||
VUtils.isTure(true).throwMessage(resultVO.getMsg());
|
||||
}
|
||||
if (query.getBomType().equals(1)) {
|
||||
EecExcelUtil.setResponseExcelHeader(response, "eBom反查列表");
|
||||
List<ForwardReportExcelVO> exportList = Convert.convert(new TypeReference<List<ForwardReportExcelVO>>() {
|
||||
}, reverseReportService.queryEBom(query));
|
||||
ListSheet<ForwardReportExcelVO> listSheet = new ListSheet<>(exportList);
|
||||
EecExcelUtil.eecExcel("eBom反查列表", listSheet, response);
|
||||
} else if (query.getBomType().equals(2)) {
|
||||
EecExcelUtil.setResponseExcelHeader(response, "pBom反查列表");
|
||||
List<ForwardReportExcelVO> exportList = Convert.convert(new TypeReference<List<ForwardReportExcelVO>>() {
|
||||
}, reverseReportService.queryPBom(query));
|
||||
ListSheet<ForwardReportExcelVO> listSheet = new ListSheet<>(exportList);
|
||||
EecExcelUtil.eecExcel("pBom反查列表", listSheet, response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.nflg.product.bomnew.mapper.master;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildEntity;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.ChildMaxExceptionStateVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
|
@ -34,4 +35,6 @@ public interface BomNewEbomChildMapper extends BaseMapper<BomNewEbomChildEntity>
|
|||
void deleteAllChildren(Long rowId);
|
||||
|
||||
void delBomChild(@Param("bomRowIds") List<Long> bomRowIds);
|
||||
|
||||
List<BomNewPbomParentVO> getBomByMaterialNo(String materialNo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,10 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomUpgradeChangeVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.MaterialHistoryProjectTypeVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.ReverseReportVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
|
|
@ -110,4 +107,6 @@ public interface BomNewEbomParentMapper extends BaseMapper<BomNewEbomParentEntit
|
|||
List<BomNewEbomParentEntity> getLatestByMaterialNo(Collection<String> materialNos);
|
||||
|
||||
void updateLastVersionIs();
|
||||
|
||||
List<BomNewPbomParentVO> getReverseBoms(Long parentRowId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.nflg.product.bomnew.mapper.master;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewPbomChildEntity;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -27,4 +28,6 @@ public interface BomNewPbomChildMapper extends BaseMapper<BomNewPbomChildEntity>
|
|||
List<BomNewPbomChildEntity> getChildrenByChildRowId(Long rowId);
|
||||
|
||||
void setParentRowId(List<Long> rowIds, Long parentRowId);
|
||||
|
||||
List<BomNewPbomParentVO> getBomByMaterialNo(String materialNo, String facCode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,11 +2,9 @@ package com.nflg.product.bomnew.mapper.master;
|
|||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentFormalEntity;
|
||||
import com.nflg.product.bomnew.pojo.query.BomNewPbomParentQuery;
|
||||
import com.nflg.product.bomnew.pojo.vo.*;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentFormalVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.ReverseReportVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -25,6 +23,6 @@ public interface BomNewPbomParentFormalMapper extends BaseMapper<BomNewPbomParen
|
|||
* pbom单层反查
|
||||
* @return
|
||||
*/
|
||||
List<ReverseReportVO> pBomSingleReverseReport(@Param("bomVersionRowId")Long bomVersionRowId,@Param("startDate") String startDate, @Param("endDate")String endDate, @Param("materialNos")List<String> materialNos);
|
||||
List<ReverseReportVO> pBomSingleReverseReport(@Param("bomVersionRowId") Long bomVersionRowId, @Param("startDate") String startDate, @Param("endDate") String endDate, String materialNo, String faCode);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,4 +71,6 @@ public interface BomNewPbomParentMapper extends BaseMapper<BomNewPbomParentEntit
|
|||
Page<BomNewPbomParentVO> getSapErrorWorksheet(Page<BomNewPbomParentQuery> page, String userCode);
|
||||
|
||||
Integer getSapErrorNum(String userCode);
|
||||
|
||||
List<BomNewPbomParentVO> getReverseBoms(Long parentRowId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
package com.nflg.product.bomnew.pojo.vo;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.ttzero.excel.annotation.ExcelColumn;
|
||||
|
||||
|
|
@ -41,8 +39,11 @@ public class ForwardReportExcelVO {
|
|||
private String currentVersion; //设计人员
|
||||
|
||||
|
||||
// @ExcelColumn("物料名称")
|
||||
// private String materialName;
|
||||
|
||||
@ExcelColumn("物料名称")
|
||||
private String materialName;
|
||||
private String materialDesc;
|
||||
|
||||
@ExcelColumn("物料编码")
|
||||
private String materialNo;
|
||||
|
|
@ -52,8 +53,6 @@ public class ForwardReportExcelVO {
|
|||
|
||||
@ExcelColumn("图号")
|
||||
private String drawingNo;
|
||||
@ApiModelProperty("物料描述")
|
||||
private String materialDesc;
|
||||
|
||||
|
||||
@ExcelColumn(value = "项目类别")
|
||||
|
|
|
|||
|
|
@ -75,6 +75,12 @@ public class ReverseReportVO {
|
|||
@ApiModelProperty("物料行id")
|
||||
private Long materialRowId;
|
||||
|
||||
@ApiModelProperty("单重")
|
||||
private BigDecimal unitWeight;
|
||||
|
||||
@ApiModelProperty("设计人员")
|
||||
private String deviseName;
|
||||
|
||||
public LocalDateTime getExpireEndTime(){
|
||||
return Objects.isNull(expireEndTime)? LocalDateTime.parse("9999-12-31 23:59:59", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")):expireEndTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,11 +4,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import com.nflg.product.bomnew.mapper.master.BomNewEbomChildMapper;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildEntity;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -34,4 +35,8 @@ public class BomNewEbomChildService extends ServiceImpl<BomNewEbomChildMapper, B
|
|||
baseMapper.updateEBomMaterialUse(materialNos);
|
||||
});
|
||||
}
|
||||
|
||||
public List<BomNewPbomParentVO> getBomByMaterialNo(String materialNo) {
|
||||
return baseMapper.getBomByMaterialNo(materialNo);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ 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;
|
||||
|
|
@ -1398,6 +1397,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
parent.setCurrentVersion("A00");
|
||||
parent.setDeviseName(SessionUtil.getRealName());
|
||||
parent.setDeptName(SessionUtil.getDepartName());
|
||||
parent.setDeptRowId(SessionUtil.getPartRowId());
|
||||
parent.setSource(EBomSourceEnum.FROM_MDM.getValue());
|
||||
parent.setBomExist(1);
|
||||
parent.setLastVersionIs(1);
|
||||
|
|
@ -1768,6 +1768,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
baseMaterialVO.setParentRowId(query.getBomRowId());
|
||||
baseMaterialVO.setProjectType(null);
|
||||
baseMaterialVO.setDeptName(SessionUtil.getDepartName());
|
||||
baseMaterialVO.setDeptRowId(SessionUtil.getPartRowId());
|
||||
baseMaterialVO.setDeviseUserCode(SessionUtil.getUserCode());
|
||||
baseMaterialVO.setDeviseName(SessionUtil.getRealName());
|
||||
baseMaterialVO.setCreatedBy(SessionUtil.getUserCode());
|
||||
|
|
@ -2363,6 +2364,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
vo.setStatus(p.getStatus());
|
||||
vo.setCurrentVersion("A00");
|
||||
vo.setDeptName(p.getDeptName());
|
||||
vo.setDeptRowId(p.getDeptRowId());
|
||||
vo.setDeviseName(p.getDeviseName());
|
||||
}
|
||||
if (Objects.equals(vo.getBomExist(), 0) && Objects.equals(vo.getShouldBomExist(), 1)) {
|
||||
|
|
@ -2390,6 +2392,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
c.setStatus(vo.getStatus());
|
||||
c.setCurrentVersion("A00");
|
||||
c.setDeptName(vo.getDeptName());
|
||||
c.setDeptRowId(vo.getDeptRowId());
|
||||
c.setDeviseName(vo.getDeviseName());
|
||||
}
|
||||
if (Objects.equals(c.getBomExist(), 0) && Objects.equals(c.getShouldBomExist(), 1)) {
|
||||
|
|
@ -2704,19 +2707,21 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
|
||||
LogRecordContext.putVariable("bom", parent);
|
||||
|
||||
delete(parent);
|
||||
Set<String> materailNos = new HashSet<>();
|
||||
delete(parent, materailNos);
|
||||
|
||||
CompletableFuture.runAsync(this::updateLastVersionIs);
|
||||
updateLastVersionIs1(materailNos);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void delete(BomNewEbomParentEntity parent) {
|
||||
private void delete(BomNewEbomParentEntity parent, Set<String> materailNos) {
|
||||
VUtils.isTure(!(StrUtil.equals(parent.getCreatedBy(), SessionUtil.getUserCode())
|
||||
|| Objects.equals(parent.getVirtualPackageIs(), 1)))
|
||||
.throwMessage("只能删除虚拟包和自己创建的数据");
|
||||
|
||||
this.getBaseMapper().delete(Wrappers.lambdaQuery(BomNewEbomParentEntity.class)
|
||||
.eq(BomNewEbomParentEntity::getRowId, parent.getRowId()));
|
||||
materailNos.add(parent.getMaterialNo());
|
||||
|
||||
Set<String> materialNos = ebomChildService.lambdaQuery()
|
||||
.select(BomNewEbomChildEntity::getMaterialNo)
|
||||
|
|
@ -2742,11 +2747,14 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
List<BomNewEbomParentEntity> deleteParents = parents.stream()
|
||||
.filter(p -> StrUtil.equals(p.getCreatedBy(), SessionUtil.getUserCode()) || Objects.equals(p.getVirtualPackageIs(), 1))
|
||||
.collect(Collectors.toList());
|
||||
deleteParents.forEach(this::delete);
|
||||
deleteParents.forEach(it -> delete(it, materailNos));
|
||||
}
|
||||
|
||||
private void updateLastVersionIs() {
|
||||
this.getBaseMapper().updateLastVersionIs();
|
||||
private void updateLastVersionIs1(Collection<String> materialNos) {
|
||||
lambdaUpdate()
|
||||
.in(BomNewEbomParentEntity::getMaterialNo, materialNos)
|
||||
.set(BomNewEbomParentEntity::getLastVersionIs, 1)
|
||||
.update();
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
|
@ -2785,6 +2793,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
vo.setStatus(cp.getStatus());
|
||||
vo.setDeviseName(cp.getDeviseName());
|
||||
vo.setDeptName(cp.getDeptName());
|
||||
vo.setDeptRowId(cp.getDeptRowId());
|
||||
vo.setDeviseUserCode(cp.getDeviseUserCode());
|
||||
}
|
||||
|
||||
|
|
@ -2792,4 +2801,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
ebomChildService.save(c);
|
||||
return vo;
|
||||
}
|
||||
|
||||
public List<BomNewPbomParentVO> getReverseBoms(Long parentRowId) {
|
||||
return baseMapper.getReverseBoms(parentRowId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import com.nflg.product.bomnew.constant.EBomConstant;
|
||||
import com.nflg.product.bomnew.mapper.master.BomNewPbomChildMapper;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewPbomChildEntity;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -35,4 +36,8 @@ public class BomNewPbomChildService extends ServiceImpl<BomNewPbomChildMapper, B
|
|||
.set(BomNewPbomChildEntity::getProductionFactoryCodeInputType, 2)
|
||||
.update();
|
||||
}
|
||||
|
||||
public List<BomNewPbomParentVO> getBomByMaterialNo(String materialNo, String facCode) {
|
||||
return this.getBaseMapper().getBomByMaterialNo(materialNo, facCode);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1055,6 +1055,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
|
||||
// SpringUtil.getBean(BomNewPbomParentFormalService.class).copyPbomFormal(bomRowId);
|
||||
} catch (Exception ex) {
|
||||
log.error("realesePbom", ex);
|
||||
throw new NflgBusinessException(STATE.BusinessError, "发布Pbom失败:" + ex.getMessage());
|
||||
}
|
||||
return true;
|
||||
|
|
@ -1209,14 +1210,6 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
VUtils.isTure(Objects.isNull(root)).throwMessage("数据不存在");
|
||||
VUtils.isTure(root.getUserRootIs() != 1 && root.getRootIs() != 1).throwMessage("请选择根节点");
|
||||
|
||||
// IBomNewPbomExportToSAP service;
|
||||
// if (root.getMaterialNo().startsWith("31")) {
|
||||
// service = new BomNewPbomExportToSAP31();
|
||||
// } else if (root.getMaterialNo().startsWith("21")) {
|
||||
// service = new BomNewPbomExportToSAP21(query.getIsForSale());
|
||||
// } else {
|
||||
// throw new NflgBusinessException(STATE.BusinessError, "不复核要求的物料:" + root.getMaterialNo());
|
||||
// }
|
||||
IBomNewPbomExportToSAP service = new BomNewPbomExportToSAPImpl(query.getIsForSale());
|
||||
return service.export(root.getRowId());
|
||||
}
|
||||
|
|
@ -1479,4 +1472,8 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
if (Objects.isNull(sapErrorMsgEntity)) return Collections.emptyList();
|
||||
return JSON.parseArray(sapErrorMsgEntity.getData(), OperationErrorMsgVO.class);
|
||||
}
|
||||
|
||||
public List<BomNewPbomParentVO> getReverseBoms(Long parentRowId) {
|
||||
return this.getBaseMapper().getReverseBoms(parentRowId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,12 +4,8 @@ import cn.hutool.core.collection.CollUtil;
|
|||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewOriginalParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomOriginalListVO;
|
||||
import com.nflg.product.bomnew.service.BomNewEbomParentService;
|
||||
import com.nflg.product.bomnew.service.BomNewOriginalParentService;
|
||||
import com.nflg.product.bomnew.util.ListCommonUtil;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
|
|
@ -70,6 +66,7 @@ public class EBomDetailTask extends RecursiveTask<List<BomNewEbomParentVO>> {
|
|||
detailVO.setCurrentVersion(ebomParentEntity.getCurrentVersion());
|
||||
detailVO.setDeviseUserCode(ebomParentEntity.getDeviseUserCode());
|
||||
detailVO.setDeptName(ebomParentEntity.getDeptName());
|
||||
detailVO.setDeptRowId(ebomParentEntity.getDeptRowId());
|
||||
detailVO.setDeviseName(ebomParentEntity.getDeviseName());
|
||||
detailVO.setBomExist(ebomParentEntity.getBomExist());
|
||||
detailVO.setStatus(ebomParentEntity.getStatus());
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import com.nflg.product.bomnew.constant.EBomStatusEnum;
|
|||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
||||
import com.nflg.product.bomnew.service.BomNewEbomParentService;
|
||||
import com.nflg.product.bomnew.util.ListCommonUtil;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
|
|
@ -72,6 +71,7 @@ public class EBomFormalDetailTask extends RecursiveTask<List<BomNewEbomParentVO>
|
|||
detailVO.setCurrentVersion(ebomParentEntity.getCurrentVersion());
|
||||
detailVO.setDeviseUserCode(ebomParentEntity.getDeviseUserCode());
|
||||
detailVO.setDeptName(ebomParentEntity.getDeptName());
|
||||
detailVO.setDeptRowId(ebomParentEntity.getDeptRowId());
|
||||
detailVO.setDeviseName(ebomParentEntity.getDeviseName());
|
||||
detailVO.setBomExist(ebomParentEntity.getBomExist());
|
||||
detailVO.setStatus(ebomParentEntity.getStatus());
|
||||
|
|
|
|||
|
|
@ -238,6 +238,7 @@ public abstract class VirtualPackageBase {
|
|||
parent.setDeviseName(SessionUtil.getRealName());
|
||||
parent.setCreatedBy(SessionUtil.getUserCode());
|
||||
parent.setDeptName(SessionUtil.getDepartName());
|
||||
parent.setDeptRowId(SessionUtil.getDepartRowId());
|
||||
parent.setSource(EBomSourceEnum.FROM_MDM.getValue());
|
||||
//parent.setModifyTime(LocalDateTime.now());
|
||||
parent.setStatus(p.getStatus());
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ public class PBomDetailTask extends RecursiveTask<List<BomNewPbomParentVO>> {
|
|||
detailVO.setCreatedBy(ebomParentEntity.getCreatedBy());
|
||||
detailVO.setLevelNum(ebomParentEntity.getLevelNum());
|
||||
detailVO.setDeptName(ebomParentEntity.getDeptName());
|
||||
detailVO.setDeptRowId(ebomParentEntity.getDeptRowId());
|
||||
detailVO.setChangeDesc(ebomParentEntity.getChangeDesc());
|
||||
detailVO.setOrderNo(ebomParentEntity.getOrderNo());
|
||||
|
||||
|
|
@ -96,6 +97,7 @@ public class PBomDetailTask extends RecursiveTask<List<BomNewPbomParentVO>> {
|
|||
detailVO.setDeviseUserCode(parent.getDeviseUserCode());
|
||||
detailVO.setDeviseName(parent.getDeviseName());
|
||||
detailVO.setDeptName(parent.getDeptName());
|
||||
detailVO.setDeptRowId(parent.getDeptRowId());
|
||||
detailVO.setStatus(parent.getStatus());
|
||||
detailVO.setEditStatus(parent.getEditStatus());
|
||||
detailVO.setVirtualPackageIs(parent.getVirtualPackageIs());
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ public class PBomUpgrade {
|
|||
BeanUtil.copyProperties(parentVO, pbomParent);
|
||||
pbomParent.setRowId(IdWorker.getId());
|
||||
pbomParent.setCreatedTime(LocalDateTime.now());
|
||||
pbomParent.setCreatedBy(SessionUtil.getRealName());
|
||||
pbomParent.setCreatedBy(SessionUtil.getUserCode());
|
||||
pbomParent.setModifyTime(LocalDateTime.now());
|
||||
pbomParent.setStatus(PBomStatusEnum.WAIT_PUBLISH.getValue());
|
||||
pbomParent.setCurrentVersion(VersionUtil.getNextVersion(parentVO.getCurrentVersion()));
|
||||
|
|
|
|||
|
|
@ -80,7 +80,11 @@ public class TechnologyPackageParamBuilder {
|
|||
|
||||
//通过子级构建父级
|
||||
private BomNewPbomParentEntity buildParentByChild(BomNewPbomChildEntity child){
|
||||
BomNewPbomParentEntity oldBom =SpringUtil.getBean(BomNewPbomParentService.class).lambdaQuery().eq(BomNewPbomParentEntity::getMaterialNo, child.getMaterialNo()).eq(BomNewPbomParentEntity::getLastVersionIs, 1).one();
|
||||
BomNewPbomParentEntity oldBom = SpringUtil.getBean(BomNewPbomParentService.class)
|
||||
.lambdaQuery()
|
||||
.eq(BomNewPbomParentEntity::getMaterialNo, child.getMaterialNo())
|
||||
.eq(BomNewPbomParentEntity::getLastVersionIs, 1)
|
||||
.one();
|
||||
if(Objects.nonNull(oldBom)){
|
||||
return oldBom;
|
||||
}
|
||||
|
|
@ -101,21 +105,23 @@ public class TechnologyPackageParamBuilder {
|
|||
newBom.setDeviseUserCode(SessionUtil.getUserCode());
|
||||
newBom.setDeviseName(SessionUtil.getRealName());
|
||||
newBom.setDeptName(SessionUtil.getDepartName());
|
||||
newBom.setDeptRowId(SessionUtil.getDepartRowId());
|
||||
newBom.setCreatedBy(SessionUtil.getUserCode());
|
||||
newBom.setCreatedTime(LocalDateTime.now());
|
||||
return newBom;
|
||||
}
|
||||
|
||||
|
||||
private BomNewPbomParentEntity buildParentForTechnologyPackage() {
|
||||
|
||||
private BomNewPbomParentEntity buildParentForTechnologyPackage(){
|
||||
|
||||
BomNewPbomParentEntity oldBom =SpringUtil.getBean(BomNewPbomParentService.class).lambdaQuery().eq(BomNewPbomParentEntity::getMaterialNo, packageParam.getTechnologyPackageMaterialNo())
|
||||
.eq(BomNewPbomParentEntity::getLastVersionIs, 1)
|
||||
BomNewPbomParentEntity oldBom = SpringUtil.getBean(BomNewPbomParentService.class)
|
||||
.lambdaQuery().eq(BomNewPbomParentEntity::getMaterialNo, packageParam.getTechnologyPackageMaterialNo())
|
||||
.eq(BomNewPbomParentEntity::getFacCode,parent.getFacCode())
|
||||
.orderByDesc(BomNewPbomParentEntity::getCurrentVersion)
|
||||
.last(" limit 1")
|
||||
.one();
|
||||
VUtils.isTure(Objects.nonNull(oldBom) && oldBom.getStatus()< PBomStatusEnum.PUBLISH.getValue()).throwMessage("该工艺包存在未发布的BOM版本");
|
||||
|
||||
VUtils.isTure(Objects.nonNull(oldBom) && oldBom.getStatus() < PBomStatusEnum.PUBLISH.getValue())
|
||||
.throwMessage("该工艺包存在未发布的BOM版本");
|
||||
|
||||
BomNewPbomParentEntity newBom=new BomNewPbomParentEntity();
|
||||
newBom.setRowId(IdWorker.getId());
|
||||
|
|
@ -134,6 +140,7 @@ public class TechnologyPackageParamBuilder {
|
|||
newBom.setDeviseUserCode(SessionUtil.getUserCode());
|
||||
newBom.setDeviseName(SessionUtil.getRealName());
|
||||
newBom.setDeptName(SessionUtil.getDepartName());
|
||||
newBom.setDeptRowId(SessionUtil.getDepartRowId());
|
||||
newBom.setCreatedBy(SessionUtil.getUserCode());
|
||||
newBom.setCreatedTime(LocalDateTime.now());
|
||||
newBom.setTechnologyUserCode(SessionUtil.getUserCode());
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@ package com.nflg.product.bomnew.service.domain.ReverseReport;
|
|||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.nflg.product.bomnew.constant.EBomStatusEnum;
|
||||
import com.nflg.product.bomnew.constant.OriginalConstant;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentFormalEntity;
|
||||
import com.nflg.product.bomnew.pojo.query.ReverseReportQuery;
|
||||
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
|
||||
|
|
@ -11,7 +13,6 @@ import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
|||
import com.nflg.product.bomnew.pojo.vo.ReverseReportVO;
|
||||
import com.nflg.product.bomnew.service.*;
|
||||
import com.nflg.product.bomnew.util.MaterialshouldBomExistUtil;
|
||||
import com.nflg.product.bomnew.util.VUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -36,6 +37,9 @@ public class EBomQueryService {
|
|||
@Resource
|
||||
BomNewEbomParentService ebomParentService;
|
||||
|
||||
@Resource
|
||||
BomNewEbomChildService ebomChildService;
|
||||
|
||||
@Resource
|
||||
BomNewEbomParentFormalService ebomParentFormalService;
|
||||
|
||||
|
|
@ -45,18 +49,11 @@ public class EBomQueryService {
|
|||
@Resource
|
||||
MaterialMainService materialMainService;
|
||||
|
||||
private static final ThreadLocal<Boolean> ADD = new ThreadLocal<>();
|
||||
|
||||
public void report(ReverseReportQuery queryParam , List<ReverseReportVO> result) {
|
||||
if(queryParam.getQueryType().equals(0)) {
|
||||
result.addAll(singleLevelReport(queryParam));
|
||||
}else {
|
||||
try {
|
||||
ADD.set(true);
|
||||
result.addAll(multipleLevelReport(queryParam));
|
||||
} finally {
|
||||
ADD.remove();
|
||||
}
|
||||
result.addAll(multipleLevelReport(queryParam));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -79,8 +76,23 @@ public class EBomQueryService {
|
|||
bomVersionRowId=one.getRowId();
|
||||
}
|
||||
}
|
||||
return ebomParentService.getBaseMapper().eBomReverseReport(bomVersionRowId,queryParam.getStartDate(),queryParam.getEndDate(), queryParam.getMaterialNo());
|
||||
|
||||
List<ReverseReportVO> vos = ebomParentService.getBaseMapper().eBomReverseReport(bomVersionRowId, queryParam.getStartDate(), queryParam.getEndDate(), queryParam.getMaterialNo());
|
||||
if (CollUtil.isNotEmpty(vos)) {
|
||||
List<BaseMaterialVO> materialVOS = materialMainService.getMaterialBaseInfo(vos.stream().map(ReverseReportVO::getMaterialNo).collect(Collectors.toList()));
|
||||
vos.forEach(it -> {
|
||||
it.setLevelNum("1");
|
||||
BaseMaterialVO materialVO = materialVOS.stream()
|
||||
.filter(f -> StrUtil.equals(f.getMaterialNo(), it.getMaterialNo()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (Objects.nonNull(materialVO)) {
|
||||
it.setCategoryName(materialVO.getCategoryName());
|
||||
it.setRelCategoryCode(materialVO.getRelCategoryCode());
|
||||
it.setMaterialRowId(materialVO.getMaterialRowId());
|
||||
}
|
||||
});
|
||||
}
|
||||
return vos;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -91,53 +103,38 @@ public class EBomQueryService {
|
|||
*/
|
||||
public List<ReverseReportVO> multipleLevelReport(ReverseReportQuery queryParam) {
|
||||
List<ReverseReportVO> vos = new ArrayList<>();
|
||||
String version = "";
|
||||
if (queryParam.getVersionStrategy() == 0) {
|
||||
BomNewEbomParentFormalEntity parent = ebomParentFormalService.lambdaQuery()
|
||||
.select(BomNewEbomParentFormalEntity::getCurrentVersion)
|
||||
.eq(BomNewEbomParentFormalEntity::getMaterialNo, queryParam.getMaterialNo())
|
||||
.orderByDesc(BomNewEbomParentFormalEntity::getCurrentVersion)
|
||||
.last(" limit 1")
|
||||
.one();
|
||||
if (Objects.nonNull(parent)) {
|
||||
version = parent.getCurrentVersion();
|
||||
}
|
||||
} else if (queryParam.getVersionStrategy() == 1 || queryParam.getVersionStrategy() == 2) {
|
||||
VUtils.isTure(StrUtil.isBlank(queryParam.getBomVersion())).throwMessage("版本号不能为空");
|
||||
version = queryParam.getBomVersion();
|
||||
}
|
||||
if (StrUtil.isBlank(version)) {
|
||||
List<BomNewPbomParentVO> pVOs = ebomChildFormalService.getSuperiorByMaterialNo(queryParam.getMaterialNo());
|
||||
List<String> materialNos = pVOs.stream().map(BomNewPbomParentVO::getMaterialNo).collect(Collectors.toList());
|
||||
List<BaseMaterialVO> materialVOS = materialMainService.getMaterialBaseInfo(materialNos);
|
||||
|
||||
BomNewEbomParentEntity parent = ebomParentService.lambdaQuery()
|
||||
.select(BomNewEbomParentEntity::getRowId)
|
||||
.eq(BomNewEbomParentEntity::getMaterialNo, queryParam.getMaterialNo())
|
||||
.eq(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue())
|
||||
.one();
|
||||
if (Objects.nonNull(parent)) {
|
||||
List<BomNewPbomParentVO> pVOs = getReverseBoms(parent.getRowId());
|
||||
pVOs.forEach(p -> {
|
||||
if (!ADD.get()) return;
|
||||
BaseMaterialVO materialMainEntity = materialVOS.stream()
|
||||
.filter(m -> StrUtil.equals(m.getMaterialNo(), p.getMaterialNo()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (Objects.nonNull(materialMainEntity)) {
|
||||
if (MaterialshouldBomExistUtil.checkShouldBomExist(materialMainEntity.getMaterialCategoryCode()
|
||||
, materialMainEntity.getMaterialGetType())) {
|
||||
p.setCurrentVersion(OriginalConstant.NO_BOM_VERSION);
|
||||
}
|
||||
}
|
||||
vos.add(createVO(p, 1));
|
||||
bindData(p, 1, vos);
|
||||
});
|
||||
} else {
|
||||
BomNewEbomParentFormalEntity parent = ebomParentFormalService.lambdaQuery()
|
||||
.eq(BomNewEbomParentFormalEntity::getMaterialNo, queryParam.getMaterialNo())
|
||||
.eq(BomNewEbomParentFormalEntity::getCurrentVersion, version)
|
||||
.one();
|
||||
VUtils.isTure(Objects.isNull(parent)).throwMessage(StrUtil.format("版本{}不存在", version));
|
||||
|
||||
List<BomNewPbomParentVO> pVOs = getSuperiors(parent.getRowId());
|
||||
pVOs.forEach(p -> {
|
||||
if (!ADD.get()) return;
|
||||
vos.add(createVO(p, 1));
|
||||
bindData(p, 1, vos);
|
||||
});
|
||||
List<BomNewPbomParentVO> pVOs = ebomChildService.getBomByMaterialNo(queryParam.getMaterialNo());
|
||||
if (CollUtil.isNotEmpty(pVOs)) {
|
||||
List<String> materialNos = pVOs.stream().map(BomNewPbomParentVO::getMaterialNo).collect(Collectors.toList());
|
||||
List<BaseMaterialVO> materialVOS = materialMainService.getMaterialBaseInfo(materialNos);
|
||||
pVOs.forEach(p -> {
|
||||
BaseMaterialVO materialMainEntity = materialVOS.stream()
|
||||
.filter(m -> StrUtil.equals(m.getMaterialNo(), p.getMaterialNo()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (Objects.nonNull(materialMainEntity)) {
|
||||
if (MaterialshouldBomExistUtil.checkShouldBomExist(materialMainEntity.getMaterialCategoryCode()
|
||||
, materialMainEntity.getMaterialGetType())) {
|
||||
p.setCurrentVersion(OriginalConstant.NO_BOM_VERSION);
|
||||
}
|
||||
}
|
||||
vos.add(createVO(p, 1));
|
||||
bindData(p, 1, vos);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (CollUtil.isNotEmpty(vos)) {
|
||||
|
|
@ -158,25 +155,19 @@ public class EBomQueryService {
|
|||
}
|
||||
|
||||
private void bindData(BomNewPbomParentVO pVO, Integer level, List<ReverseReportVO> vos) {
|
||||
if (!ADD.get()) return;
|
||||
if (Objects.nonNull(pVO.getParentRowId())) {
|
||||
List<BomNewPbomParentVO> parents = getSuperiors(pVO.getParentRowId());
|
||||
List<BomNewPbomParentVO> parents = getReverseBoms(pVO.getParentRowId());
|
||||
level++;
|
||||
Integer finalLevel = level;
|
||||
for (BomNewPbomParentVO it : parents) {
|
||||
if (!ADD.get()) return;
|
||||
vos.add(createVO(it, finalLevel));
|
||||
if (vos.size() >= 1000) {
|
||||
ADD.set(false);
|
||||
return;
|
||||
}
|
||||
bindData(it, finalLevel, vos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<BomNewPbomParentVO> getSuperiors(Long parentRowId) {
|
||||
return ebomParentFormalService.getSuperiors(parentRowId);
|
||||
private List<BomNewPbomParentVO> getReverseBoms(Long parentRowId) {
|
||||
return ebomParentService.getReverseBoms(parentRowId);
|
||||
}
|
||||
|
||||
private ReverseReportVO createVO(BomNewPbomParentVO parentVO, Integer level) {
|
||||
|
|
|
|||
|
|
@ -1,19 +1,28 @@
|
|||
package com.nflg.product.bomnew.service.domain.ReverseReport;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.nflg.product.bomnew.mapper.master.BomNewPbomParentFormalMapper;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentFormalEntity;
|
||||
import com.nflg.product.bomnew.constant.OriginalConstant;
|
||||
import com.nflg.product.bomnew.constant.PBomStatusEnum;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentFormalEntity;
|
||||
import com.nflg.product.bomnew.pojo.query.ReverseReportQuery;
|
||||
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.ReverseReportVO;
|
||||
import com.nflg.product.bomnew.service.BomNewPbomChildService;
|
||||
import com.nflg.product.bomnew.service.BomNewPbomParentFormalService;
|
||||
import com.nflg.product.bomnew.service.BomNewPbomParentService;
|
||||
import com.nflg.product.bomnew.service.MaterialMainService;
|
||||
import com.nflg.product.bomnew.util.MaterialshouldBomExistUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* PBom-反查
|
||||
|
|
@ -24,11 +33,21 @@ public class PBomQueryService {
|
|||
|
||||
@Resource
|
||||
BomNewPbomParentFormalService pbomParentFormalService;
|
||||
|
||||
@Resource
|
||||
BomNewPbomParentService pbomParentService;
|
||||
|
||||
@Resource
|
||||
BomNewPbomChildService pbomChildService;
|
||||
|
||||
@Resource
|
||||
MaterialMainService materialMainService;
|
||||
|
||||
public void report(ReverseReportQuery queryParam , List<ReverseReportVO> result) {
|
||||
if(queryParam.getQueryType().equals(0)) {
|
||||
result.addAll(singleLevelReport(queryParam));
|
||||
}else {
|
||||
// multipleLevelReport(queryParam);
|
||||
result.addAll(multipleLevelReport(queryParam));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -44,7 +63,99 @@ public class PBomQueryService {
|
|||
bomVersionRowId= Objects.nonNull(one)? one.getRowId():0L;
|
||||
}
|
||||
|
||||
return pbomParentFormalService.getBaseMapper().pBomSingleReverseReport(bomVersionRowId,queryParam.getStartDate(),queryParam.getEndDate(), ImmutableList.of(queryParam.getMaterialNo()));
|
||||
List<ReverseReportVO> vos = pbomParentFormalService.getBaseMapper().pBomSingleReverseReport(bomVersionRowId, queryParam.getStartDate()
|
||||
, queryParam.getEndDate(), queryParam.getMaterialNo(), queryParam.getFacCode());
|
||||
if (CollUtil.isNotEmpty(vos)) {
|
||||
List<BaseMaterialVO> materialVOS = materialMainService.getMaterialBaseInfo(vos.stream().map(ReverseReportVO::getMaterialNo).collect(Collectors.toList()));
|
||||
vos.forEach(it -> {
|
||||
it.setLevelNum("1");
|
||||
BaseMaterialVO materialVO = materialVOS.stream()
|
||||
.filter(f -> StrUtil.equals(f.getMaterialNo(), it.getMaterialNo()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (Objects.nonNull(materialVO)) {
|
||||
it.setCategoryName(materialVO.getCategoryName());
|
||||
it.setRelCategoryCode(materialVO.getRelCategoryCode());
|
||||
it.setMaterialRowId(materialVO.getMaterialRowId());
|
||||
}
|
||||
});
|
||||
}
|
||||
return vos;
|
||||
}
|
||||
|
||||
public List<ReverseReportVO> multipleLevelReport(ReverseReportQuery queryParam) {
|
||||
List<ReverseReportVO> vos = new ArrayList<>();
|
||||
|
||||
BomNewPbomParentEntity parent = pbomParentService.lambdaQuery()
|
||||
.select(BomNewPbomParentEntity::getRowId)
|
||||
.eq(BomNewPbomParentEntity::getMaterialNo, queryParam.getMaterialNo())
|
||||
.eq(BomNewPbomParentEntity::getFacCode, queryParam.getFacCode())
|
||||
.ge(BomNewPbomParentEntity::getStatus, PBomStatusEnum.PUBLISH.getValue())
|
||||
.one();
|
||||
if (Objects.nonNull(parent)) {
|
||||
List<BomNewPbomParentVO> pVOs = getReverseBoms(parent.getRowId());
|
||||
pVOs.forEach(p -> {
|
||||
vos.add(createVO(p, 1));
|
||||
bindData(p, 1, vos);
|
||||
});
|
||||
} else {
|
||||
List<BomNewPbomParentVO> pVOs = pbomChildService.getBomByMaterialNo(queryParam.getMaterialNo(), queryParam.getFacCode());
|
||||
if (CollUtil.isNotEmpty(pVOs)) {
|
||||
List<String> materialNos = pVOs.stream().map(BomNewPbomParentVO::getMaterialNo).collect(Collectors.toList());
|
||||
List<BaseMaterialVO> materialVOS = materialMainService.getMaterialBaseInfo(materialNos);
|
||||
pVOs.forEach(p -> {
|
||||
BaseMaterialVO materialMainEntity = materialVOS.stream()
|
||||
.filter(m -> StrUtil.equals(m.getMaterialNo(), p.getMaterialNo()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (Objects.nonNull(materialMainEntity)) {
|
||||
if (MaterialshouldBomExistUtil.checkShouldBomExist(materialMainEntity.getMaterialCategoryCode()
|
||||
, materialMainEntity.getMaterialGetType())) {
|
||||
p.setCurrentVersion(OriginalConstant.NO_BOM_VERSION);
|
||||
}
|
||||
}
|
||||
vos.add(createVO(p, 1));
|
||||
bindData(p, 1, vos);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (CollUtil.isNotEmpty(vos)) {
|
||||
List<BaseMaterialVO> materialVOS = materialMainService.getMaterialBaseInfo(vos.stream().map(ReverseReportVO::getMaterialNo).collect(Collectors.toList()));
|
||||
vos.forEach(it -> {
|
||||
BaseMaterialVO materialVO = materialVOS.stream()
|
||||
.filter(f -> StrUtil.equals(f.getMaterialNo(), it.getMaterialNo()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (Objects.nonNull(materialVO)) {
|
||||
it.setCategoryName(materialVO.getCategoryName());
|
||||
it.setRelCategoryCode(materialVO.getRelCategoryCode());
|
||||
it.setMaterialRowId(materialVO.getMaterialRowId());
|
||||
}
|
||||
});
|
||||
}
|
||||
return vos;
|
||||
}
|
||||
|
||||
private void bindData(BomNewPbomParentVO pVO, Integer level, List<ReverseReportVO> vos) {
|
||||
if (Objects.nonNull(pVO.getParentRowId())) {
|
||||
List<BomNewPbomParentVO> parents = getReverseBoms(pVO.getParentRowId());
|
||||
level++;
|
||||
Integer finalLevel = level;
|
||||
for (BomNewPbomParentVO it : parents) {
|
||||
vos.add(createVO(it, finalLevel));
|
||||
bindData(it, finalLevel, vos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<BomNewPbomParentVO> getReverseBoms(Long parentRowId) {
|
||||
return pbomParentService.getReverseBoms(parentRowId);
|
||||
}
|
||||
|
||||
private ReverseReportVO createVO(BomNewPbomParentVO parentVO, Integer level) {
|
||||
ReverseReportVO vo = Convert.convert(ReverseReportVO.class, parentVO);
|
||||
vo.setLevelNum(String.valueOf(level));
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,6 +102,12 @@
|
|||
WHERE c.parent_row_id = #{parentRowId}
|
||||
AND c.material_no = #{materialNo}
|
||||
</select>
|
||||
<select id="getBomByMaterialNo" resultType="com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO">
|
||||
SELECT c.parent_row_id parentRowId, p.expire_end_time, p.current_version, c.*
|
||||
FROM t_bom_new_ebom_child c
|
||||
INNER JOIN t_bom_new_ebom_parent p ON c.parent_row_id = p.row_id AND p.status = 4
|
||||
WHERE c.material_no = #{materialNo}
|
||||
</select>
|
||||
|
||||
<delete id="deleteAllChildren">
|
||||
DELETE
|
||||
|
|
|
|||
|
|
@ -541,6 +541,13 @@
|
|||
#{materialNo}
|
||||
</foreach>;
|
||||
</select>
|
||||
<select id="getReverseBoms" resultType="com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO">
|
||||
SELECT c.num, c.project_type projectType, c.project_type, p1.row_id parentRowId, p.*
|
||||
FROM t_bom_new_ebom_child c
|
||||
RIGHT JOIN t_bom_new_ebom_parent p ON c.material_no = p.material_no
|
||||
LEFT JOIN t_bom_new_ebom_parent p1 ON c.parent_row_id = p1.row_id AND p1.status = 4
|
||||
WHERE p.row_id = #{parentRowId}
|
||||
</select>
|
||||
|
||||
<insert id="insertEBomFormalParent">
|
||||
INSERT INTO `t_bom_new_ebom_parent_formal` (`row_id`, `batch_no`, `drawing_no`, `material_no`, `order_number`,
|
||||
|
|
|
|||
|
|
@ -86,4 +86,12 @@
|
|||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="getBomByMaterialNo" resultType="com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO">
|
||||
SELECT c.parent_row_id parentRowId, p.expire_end_time, p.current_version, c.*
|
||||
FROM t_bom_new_pbom_child c
|
||||
INNER JOIN t_bom_new_pbom_parent p ON c.parent_row_id = p.row_id AND p.status >= 4
|
||||
WHERE c.material_no = #{materialNo}
|
||||
AND c.fac_code = #{facCode}
|
||||
AND p.fac_code = #{facCode}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -78,7 +78,8 @@
|
|||
|
||||
<!--pbom单层反查-->
|
||||
<select id="pBomSingleReverseReport" resultType="com.nflg.product.bomnew.pojo.vo.ReverseReportVO">
|
||||
select b.* , a.drawing_no as childDrawingNo from t_bom_new_pbom_child_formal a
|
||||
select IFNULL(a.num,1)*IFNULL(b.num,1) AS num,b.* , a.drawing_no as childDrawingNo from
|
||||
t_bom_new_pbom_child_formal a
|
||||
join t_bom_new_pbom_parent_formal b on a.parent_row_id=b.row_id
|
||||
|
||||
where true
|
||||
|
|
@ -88,9 +89,6 @@
|
|||
<if test="startDate!=null and startDate!='' and endDate!=null and endDate!=''">
|
||||
and b.last_convert_mbom_time >= #{startDate} and b.expire_end_time <=#{endDate}
|
||||
</if>
|
||||
and a.material_no in
|
||||
<foreach collection="materialNos" item="materialNo" open="(" separator="," close=")">
|
||||
#{materialNo}
|
||||
</foreach>
|
||||
and a.material_no = #{materialNo} and a.fac_code = #{faCode}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@
|
|||
<select id="getSapErrorWorksheet" resultType="com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO">
|
||||
SELECT *, row_id AS bomRowId
|
||||
FROM t_bom_new_pbom_parent
|
||||
WHERE status > 4
|
||||
WHERE status >= 4
|
||||
AND (root_is = 1 OR user_root_is = 1 OR root_state = 1)
|
||||
AND sap_state > 3
|
||||
AND created_by = #{userCode}
|
||||
|
|
@ -283,6 +283,14 @@
|
|||
INNER JOIN t_bom_new_sap_error_msg e ON p.row_id = e.target_row_id AND e.type = 1
|
||||
WHERE p.created_by = #{userCode}
|
||||
</select>
|
||||
<select id="getReverseBoms" resultType="com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO">
|
||||
SELECT c.num, c.project_type projectType, c.project_type, p1.row_id parentRowId, p.*
|
||||
FROM t_bom_new_pbom_child c
|
||||
RIGHT JOIN t_bom_new_pbom_parent p ON c.material_no = p.material_no AND c.fac_code = p.fac_code
|
||||
LEFT JOIN t_bom_new_pbom_parent p1
|
||||
ON c.parent_row_id = p1.row_id AND p1.status >= 4 AND c.fac_code = p1.fac_code
|
||||
WHERE p.row_id = #{parentRowId}
|
||||
</select>
|
||||
|
||||
<sql id="upRootStateWhr">
|
||||
<foreach collection="materialNoList" item="item" open="(" separator="," close=")">
|
||||
|
|
|
|||
Loading…
Reference in New Issue