Merge remote-tracking branch 'origin/feature/DM/nflg-bom' into feature/DM/nflg-bom

This commit is contained in:
大米 2024-01-20 11:49:33 +08:00
commit 9bcea20836
18 changed files with 679 additions and 191 deletions

View File

@ -162,7 +162,7 @@ public class MBomApi extends BaseApi {
@PostMapping("applyBack")
@ApiOperation("申请退回")
public ResultVO<Boolean> applyBack(@RequestBody BomNewMbomApplyBackMaterialDTO dto){
VUtils.isTure(CollectionUtil.isEmpty(dto.getRowIds())).throwMessage("选择申请退回数据");
VUtils.isTure(CollectionUtil.isEmpty(dto.getRowIds())).throwMessage("选择行数据操作");
bomNewMbomBackMaterialService.applyBack(dto);
return ResultVO.success(true);
}
@ -171,22 +171,39 @@ public class MBomApi extends BaseApi {
@ApiOperation("申请驳回")
public ResultVO<Boolean> rejectBack(@RequestBody List<Long> rowIds){
VUtils.isTure(CollectionUtil.isEmpty(rowIds)).throwMessage("选择驳回的数据");
VUtils.isTure(CollectionUtil.isEmpty(rowIds)).throwMessage("选择行数据操作");
bomNewMbomBackMaterialService.rejectBack(rowIds);
return ResultVO.success(true);
}
@PostMapping("deleteBack")
@ApiOperation("删除申请")
public ResultVO<Boolean> deleteBack(@RequestBody List<Long> rowIds){
VUtils.isTure(CollectionUtil.isEmpty(rowIds)).throwMessage("选择行数据操作");
bomNewMbomBackMaterialService.rejectBack(rowIds);
return ResultVO.success(true);
}
@PostMapping("confirmBack")
@ApiOperation("确认退回")
public ResultVO<Boolean> confirmBack(@RequestBody List<Long> rowIds){
VUtils.isTure(CollectionUtil.isEmpty(rowIds)).throwMessage("选择确认的数据");
bomNewMbomBackMaterialService.confirmBack(rowIds);
return ResultVO.success(true);
VUtils.isTure(CollectionUtil.isEmpty(rowIds)).throwMessage("选择行数据操作");
try {
bomNewMbomBackMaterialService.confirmBack(rowIds);
return ResultVO.success(true);
}catch (Exception e){
throw new NflgBusinessException(STATE.Error,"联系管理员,"+e.getMessage());
}
}
}

View File

@ -45,4 +45,22 @@ public class MBomConstantEnum {
}
@AllArgsConstructor
@Getter
public enum MaterialBackStatusEnum implements ValueEnum<Integer> {
//状态 0-待处理 1-待退回 2-已退
APPLY_0(0, "待处理"),
DEAL_1 (1, "待退回"),
REJECT_2 (2, "已退"),
;
private final Integer value;
private final String description;
}
}

View File

@ -8,6 +8,8 @@ import lombok.Getter;
@Getter
public enum VirtualPackageTypeEnum implements ValueEnum<Integer>{
//1-发货包 2-制作包 4-直发包 8-发货前装配包
UN_VIRTUAL_PACKAGE(0,"非虚拟包","" ,"", ""),
DELIVERY_PACKAGE(1,"发货包","发货" ,"201101", ""),
MAKING_PACKAGE(2,"制作包","制作","201101",""),
DIRECT_DELIVERY_PACKAGE(4,"直发包","直发","201101","F"),

View File

@ -24,4 +24,7 @@ public interface BomNewMbomBackMaterialMapper extends BaseMapper<BomNewMbomBackM
Page<BomNewMbomBackMaterialVO> getListPage(Page<BomNewMbomBackMaterialVO> page, @Param("query") BomNewMbomBackMaterialQuery query );
}

View File

@ -16,4 +16,11 @@ import org.apache.ibatis.annotations.Param;
public interface BomNewMbomDetailMapper extends BaseMapper<BomNewMbomDetailEntity> {
BomNewMbomMiddleVO getDetailById(@Param("rowId") Long rowId );
String getGroupRowId(@Param("rowId") Long rowId);
void updateBackStatus(@Param("rowIds") String rowIds,@Param("materialBackStatus") Integer materialBackStatus);
}

View File

@ -1,5 +1,6 @@
package com.nflg.product.bomnew.pojo.entity;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
@ -99,10 +100,100 @@ public class BomNewMbomBackMaterialEntity implements Serializable {
@ApiModelProperty(value = "创建时间")
private LocalDateTime createdTime;
@TableField(value = "created_time")
@ApiModelProperty(value = "创建时间")
private LocalDateTime modifyTime;
@TableField(value = "reason_msg")
@ApiModelProperty(value = "退回原因")
private String reasonMsg;
/**
* 图号
*/
@TableField(value = "drawing_no")
@ApiModelProperty(value = "图号")
private String drawingNo;
/**
* 物料编码
*/
@TableField(value = "material_no")
@ApiModelProperty(value = "物料编码")
private String materialNo;
/**
* 物料名称
*/
@TableField(value = "material_name")
@ApiModelProperty(value = "物料名称")
private String materialName;
/**
* 物料描述
*/
@TableField(value = "material_desc")
@ApiModelProperty(value = "物料描述")
private String materialDesc;
/**
* 材质材料
*/
@TableField(value = "material_texture")
@ApiModelProperty(value = "材质,材料")
private String materialTexture;
/**
* 单位
*/
@TableField(value = "material_unit")
@ApiModelProperty(value = "单位")
private String materialUnit;
/**
* 单重
*/
@TableField(value = "unit_weight")
@ApiModelProperty(value = "单重")
private BigDecimal unitWeight;
/**
* 总重
*/
@TableField(value = "total_weight")
@ApiModelProperty(value = "总重")
private BigDecimal totalWeight;
/**
* 数量
*/
@TableField(value = "num")
@ApiModelProperty(value = "数量")
private BigDecimal num;
/**
* 项目类别
*/
@TableField(value = "project_type")
@ApiModelProperty(value = "项目类别")
private String projectType;
/**
* 订单号
*/
@TableField(value = "order_no")
@ApiModelProperty(value = "订单号")
private String orderNo;
@TableField(value = "group_row_id")
@ApiModelProperty(value = "子级包含自己rowid")
private String groupRowId;
private static final long serialVersionUID = -35414988190486329L;

View File

@ -219,7 +219,20 @@ public class BomNewMbomDetailEntity implements Serializable {
@TableField(value = "modify_time")
@ApiModelProperty(value = "修改时间")
private LocalDateTime modifyTime;
/**
*退回状态
*/
@TableField(value = "material_back_status")
@ApiModelProperty(value = "状态 0-待处理 1-待退回 2-已退")
private Integer materialBackStatus;
/**
* 0-非虚拟包 1-发货包 2-制作包 4-直发包 8-发货前装配包
*/
@TableField(value = "virtual_part_type")
@ApiModelProperty(value = "0-非虚拟包 1-发货包 2-制作包 4-直发包 8-发货前装配包")
private Integer virtualPartType;
private static final long serialVersionUID = -78419386224657732L;
}

View File

@ -30,6 +30,15 @@ public class BomNewEbomMaterialQuery implements Serializable {
*/
@ApiModelProperty(value = "物料编码")
private String materialNo;
@ApiModelProperty(value = "上级rowId")
private Long bomRowId;
@ApiModelProperty(value = "当前行rowId")
private Long rowId;

View File

@ -19,10 +19,24 @@ import java.time.LocalDate;
@Data
@Accessors(chain = true)
@ApiModel(value="com-nflg-product-bomnew-pojo-new-vo-BomNewMbomBackMaterialEntityVO")
public class BomNewMbomBackMaterialVO extends BomNewMbomMiddleVO {
public class BomNewMbomBackMaterialVO extends BaseMaterialVO {
/**
* 主键行ID-雪花
*/
@ApiModelProperty(value = "主键行ID-雪花")
private Long rowId;
/**
* bom版本行ID,和mbom_parent表row_id关联
*/
@ApiModelProperty(value = "bom版本行ID,和mbom_parent表row_id关联")
private Long bomRowId;
@ApiModelProperty(value = "bom版本行ID,和mbom_parent表row_id关联")
private Long detailRowId;
/**
@ -30,7 +44,9 @@ public class BomNewMbomBackMaterialVO extends BomNewMbomMiddleVO {
*/
@ApiModelProperty(value = "退回人名称")
private String backUserName;
@ApiModelProperty(value = "来源行ID(PBOM中parent的行ID)")
private Long sourceRowId;
/**
* 退回人工号
*/
@ -66,6 +82,26 @@ public class BomNewMbomBackMaterialVO extends BomNewMbomMiddleVO {
private String reasonMsg;
@ApiModelProperty(value = "状态 0-待处理 1-已处理 2- 驳回")
private Integer backStatus=0;
/**
* 修改时间
*/
@ApiModelProperty(value = "修改时间")
private LocalDateTime modifyTime;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private LocalDateTime createdTime;
/**
* 订单号
*/
@ApiModelProperty(value = "订单号")
private String orderNo;
private static final long serialVersionUID = 1L;
}

View File

@ -1,6 +1,7 @@
package com.nflg.product.bomnew.pojo.vo;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import com.nflg.product.bomnew.constant.FactoryCodeEnum;
import com.nflg.product.bomnew.util.EnumUtils;
import io.swagger.annotations.ApiModel;
@ -237,8 +238,24 @@ public class BomNewMbomMiddleVO extends BaseMaterialVO implements Serializable {
return 0;
}
@ApiModelProperty(value = "状态 0-待处理 1-已处理 2- 驳回")
private Integer backStatus=0;
// @ApiModelProperty(value = "状态 0-待处理 1-已处理 2- 驳回")
// private Integer backStatus=0;
/**
*退回状态
*/
@ApiModelProperty(value = "状态 0-待处理 1-待退回 2-已退")
private Integer materialBackStatus;
/**
* 0-非虚拟包 1-发货包 2-制作包 4-直发包 8-发货前装配包
*/
@ApiModelProperty(value = "0-非虚拟包 1-发货包 2-制作包 4-直发包 8-发货前装配包")
private Integer virtualPartType;
private List<BomNewMbomMiddleVO> childNodes = Collections.emptyList();

View File

@ -1212,18 +1212,53 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
BomNewEbomParentEntity bomParent=null;
if(query.getBomRowId()!=null){
bomParent= getById(query.getBomRowId());
}
if (CollUtil.isNotEmpty(materialMainList)) {
MaterialMainEntity materialMainEntity = materialMainList.get(0);
BomNewEbomParentVO baseMaterialVO = new BomNewEbomParentVO();
BeanUtil.copyProperties(materialMainEntity, baseMaterialVO);
// baseMaterialVO.setCreatedBy(SessionUtil.getUserCode());
baseMaterialVO.setRowId(null);
baseMaterialVO.setExceptionStatus(materialMainEntity.getMaterialState());
baseMaterialVO.setRowId(query.getRowId());
materialMainEntity.setProjectType(null);
baseMaterialVO.setDeviseUserCode(SessionUtil.getUserCode());
baseMaterialVO.setDeviseName(SessionUtil.getRealName());
baseMaterialVO.setCreatedBy(SessionUtil.getUserCode());
baseMaterialVO.setCreatedTime(LocalDateTime.now());
baseMaterialVO.setModifyTime(LocalDateTime.now());
if(StrUtil.isNotBlank(materialMainEntity.getMaterialWeight())) {
baseMaterialVO.setUnitWeight(new BigDecimal(materialMainEntity.getMaterialWeight()));
}
if(bomParent!=null){
baseMaterialVO.setEditStatus(bomParent.getEditStatus());
baseMaterialVO.setStatus(bomParent.getStatus());
}
if (StrUtil.isNotBlank(baseMaterialVO.getMaterialNo())
&& (MaterialGetEnum.MaterialStateEnum.STATE_NO_4.equalsValue(baseMaterialVO.getMaterialState())
|| MaterialGetEnum.MaterialStateEnum.STATE_NO_5.equalsValue(baseMaterialVO.getMaterialState()))) {
baseMaterialVO.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_2.getValue());
}
// else if (StrUtil.isBlank(baseMaterialVO.getMaterialNo()) || Objects.isNull(baseMaterialVO.getNum()) || BigDecimal.ZERO.compareTo(baseMaterialVO.getNum()) >= 0) {
// baseMaterialVO.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_4.getValue());
// }
else if (StrUtil.isNotBlank(baseMaterialVO.getMaterialNo()) && Objects.isNull(baseMaterialVO.getMaterialState())) {
baseMaterialVO.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_7.getValue());
}
baseMaterialVO.setTotalWeight(NumberUtil.mul(baseMaterialVO.getUnitWeight(), baseMaterialVO.getNum()));
return baseMaterialVO;
}
throw new NflgBusinessException(STATE.Error, "未查询到相关物料信息");
}
/**

View File

@ -2,6 +2,8 @@ package com.nflg.product.bomnew.service;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.lang.TypeReference;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -10,8 +12,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nflg.product.base.core.conmon.util.SessionUtil;
import com.nflg.product.base.core.exception.NflgBusinessException;
import com.nflg.product.bomnew.constant.FactoryCodeEnum;
import com.nflg.product.bomnew.constant.MBomConstantEnum;
import com.nflg.product.bomnew.constant.ProjectTypeInputTypeEnum;
import com.nflg.product.bomnew.constant.VirtualPackageTypeEnum;
import com.nflg.product.bomnew.mapper.master.BomNewMbomBackMaterialMapper;
import com.nflg.product.bomnew.pojo.dto.BomNewMBomChildDTO;
import com.nflg.product.bomnew.pojo.dto.BomNewMbomApplyBackMaterialDTO;
import com.nflg.product.bomnew.pojo.dto.BomNewMbomBackMaterialDTO;
import com.nflg.product.bomnew.pojo.entity.BomNewMbomBackMaterialEntity;
@ -20,6 +26,9 @@ import com.nflg.product.bomnew.pojo.entity.BomNewMbomParentEntity;
import com.nflg.product.bomnew.pojo.query.BomNewMbomBackMaterialQuery;
import com.nflg.product.bomnew.pojo.query.BomNewMbomParentQuery;
import com.nflg.product.bomnew.pojo.vo.BomNewMbomBackMaterialVO;
import com.nflg.product.bomnew.pojo.vo.BomNewMbomMiddleVO;
import com.nflg.product.bomnew.pojo.vo.BomNewMbomParentVO;
import com.nflg.product.bomnew.pojo.vo.OptionalMbomMaterialListVO;
import nflg.product.common.constant.STATE;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -29,8 +38,11 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
import static com.nflg.product.bomnew.constant.EBomConstant.MAIN_FACTORY_CODE_1010;
/**
* t_bom_new_mbom_back_material 表服务实现类
@ -52,147 +64,313 @@ public class BomNewMbomBackMaterialService extends ServiceImpl<BomNewMbomBackMat
}
private void checkBackStatus( List<BomNewMbomBackMaterialEntity> backList){
if(CollectionUtil.isEmpty(backList)){
throw new NflgBusinessException(STATE.BusinessError,"未查询到数据");
}
for (BomNewMbomBackMaterialEntity entity:
backList) {
if(Objects.equals(entity.getBackStatus(), MBomConstantEnum.MBomBackStatusEnum.REJECT_2.getValue())){
throw new NflgBusinessException(STATE.BusinessError,StrUtil.format("{}物料已驳回禁止操作",entity.getMaterialNo()));
}
if(Objects.equals(entity.getBackStatus(), MBomConstantEnum.MBomBackStatusEnum.DEAL_1.getValue())){
throw new NflgBusinessException(STATE.BusinessError,StrUtil.format("{}物料已处理退回禁止操作",entity.getMaterialNo()));
}
}
}
@Transactional(rollbackFor = Exception.class)
public void deleteBack(List<Long> rowIds ){
QueryWrapper<BomNewMbomBackMaterialEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().in(BomNewMbomBackMaterialEntity::getRowId,rowIds);
List<BomNewMbomBackMaterialEntity> backList=getBaseMapper().selectList(queryWrapper);
checkBackStatus(backList);
for (BomNewMbomBackMaterialEntity entity:
backList) {
if(!entity.getBackUserCode().equals(SessionUtil.getUserCode())){
throw new NflgBusinessException(STATE.BusinessError,StrUtil.format("{}物料由申请人才能删除",entity.getMaterialNo()));
}
}
for (BomNewMbomBackMaterialEntity entity:
backList) {
this.removeById(entity.getRowId());
SpringUtil.getBean(BomNewMbomDetailService.class).getBaseMapper().updateBackStatus(entity.getGroupRowId(),
MBomConstantEnum.MaterialBackStatusEnum.APPLY_0.getValue());
}
}
/**
* 驳回
* 1010工厂处理
* @param rowIds
*/
@Transactional(rollbackFor = Exception.class)
public void rejectBack(List<Long> rowIds ){
QueryWrapper<BomNewMbomBackMaterialEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().in(BomNewMbomBackMaterialEntity::getRowId,rowIds);
queryWrapper.lambda().eq(BomNewMbomBackMaterialEntity::getBackStatus, MBomConstantEnum.MBomBackStatusEnum.REJECT_2.getValue());
// queryWrapper.lambda().eq(BomNewMbomBackMaterialEntity::getBackStatus, MBomConstantEnum.MBomBackStatusEnum.REJECT_2.getValue());
List<BomNewMbomBackMaterialEntity> backList=getBaseMapper().selectList(queryWrapper);
if(CollectionUtil.isNotEmpty(backList)){
throw new NflgBusinessException(STATE.BusinessError,"选择数据存在已驳回不能重复驳回");
}
List<BomNewMbomBackMaterialEntity> updateList=new ArrayList<>();
rowIds.forEach(id->{
checkBackStatus(backList);
List<String> facList=SpringUtil.getBean(UserRoleService.class).getUserOfFactory();
if(!facList.contains(MAIN_FACTORY_CODE_1010)){
throw new NflgBusinessException(STATE.BusinessError,StrUtil.format("你不是{}工厂用户不能操作",MAIN_FACTORY_CODE_1010));
}
//修改物料退回
for ( BomNewMbomBackMaterialEntity entity:
backList) {
BomNewMbomBackMaterialEntity bean=new BomNewMbomBackMaterialEntity();
bean.setRowId(id);
bean.setRowId(entity.getRowId());
bean.setBackStatus(MBomConstantEnum.MBomBackStatusEnum.REJECT_2.getValue());
bean.setConfirmTime(LocalDateTime.now());
bean.setModifyTime(LocalDateTime.now());
bean.setConfirmUserCode(SessionUtil.getUserCode());
bean.setConfirmUserName(SessionUtil.getUserName());
updateList.add(bean);
});
if(CollectionUtil.isNotEmpty(updateList)){
this.updateBatchById(updateList);
}
this.updateById(entity);
SpringUtil.getBean(BomNewMbomDetailService.class).getBaseMapper().updateBackStatus(entity.getGroupRowId(),
MBomConstantEnum.MaterialBackStatusEnum.APPLY_0.getValue());
}
}
/**
* 退回
*
* 申请退回
*只能退回1020工厂的
*/
@Transactional(rollbackFor = Exception.class)
public void applyBack(BomNewMbomApplyBackMaterialDTO dto ){
List<BomNewMbomBackMaterialDTO> rowIds=dto.getRowIds();
//是否存在退回
List<Long> backRowId=rowIds.stream().map(BomNewMbomBackMaterialDTO::getRowId).collect(Collectors.toList());
QueryWrapper<BomNewMbomBackMaterialEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().in(BomNewMbomBackMaterialEntity::getDetailRowId,backRowId);
List<BomNewMbomBackMaterialEntity> backList=getBaseMapper().selectList(queryWrapper);
if(CollectionUtil.isNotEmpty(backList)){
throw new NflgBusinessException(STATE.BusinessError,"选择数据已申请退回");
}
dto.getRowIds().forEach(item->{
if(Objects.equals(item.getRowId(),item.getBomRowId())){
throw new NflgBusinessException(STATE.BusinessError,"不能选择顶层数据退回");
}
});
//是否存在退回
List<Long> backRowId=rowIds.stream().map(BomNewMbomBackMaterialDTO::getRowId).collect(Collectors.toList());
QueryWrapper<BomNewMbomBackMaterialEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().in(BomNewMbomBackMaterialEntity::getDetailRowId,backRowId);
queryWrapper.lambda().eq(BomNewMbomBackMaterialEntity::getBackStatus,MBomConstantEnum.MBomBackStatusEnum.REJECT_2.getValue());
List<BomNewMbomBackMaterialEntity> backList=getBaseMapper().selectList(queryWrapper);
QueryWrapper<BomNewMbomDetailEntity> queryWrapper2=new QueryWrapper<>();
queryWrapper2.lambda().in(BomNewMbomDetailEntity::getRowId,backRowId);
List<BomNewMbomDetailEntity> list= SpringUtil.getBean(BomNewMbomDetailService.class).list(queryWrapper2);
if(CollectionUtil.isNotEmpty(list)){
List<BomNewMbomBackMaterialEntity> saveBackList=new ArrayList<>();
list.forEach(item->{
BomNewMbomBackMaterialEntity beanBack=new BomNewMbomBackMaterialEntity();
beanBack.setBomRowId(item.getBomRowId());
beanBack.setDetailRowId(item.getRowId());
beanBack.setSourceRowId(item.getSourceRowId());
beanBack.setBackStatus(MBomConstantEnum.MBomBackStatusEnum.APPLY_0.getValue());
beanBack.setBackUserName(SessionUtil.getRealName());
beanBack.setBackUserCode(SessionUtil.getUserCode());
beanBack.setCreatedTime(LocalDateTime.now());
beanBack.setReasonMsg(dto.getReasonMsg());
saveBackList.add(beanBack);
});
this.saveBatch(saveBackList);
if(CollectionUtil.isNotEmpty(backList)){
throw new NflgBusinessException(STATE.BusinessError,"选择数据申请退回中或已处理退回");
}
//虚拟包不能退
QueryWrapper<BomNewMbomDetailEntity> queryWrapper2=new QueryWrapper<>();
queryWrapper2.lambda().in(BomNewMbomDetailEntity::getRowId,backRowId);
List<BomNewMbomDetailEntity> detailEntityList = SpringUtil.getBean(BomNewMbomDetailService.class).list(queryWrapper2);
List<BomNewMbomDetailEntity> checkVirtualPartList= detailEntityList.stream().filter(item->Objects.nonNull(item.getVirtualPartType())&&item.getVirtualPartType().intValue()>0).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(checkVirtualPartList)){
throw new NflgBusinessException(STATE.BusinessError,"虚拟包数据不能进行退回");
}
if(detailEntityList.get(0).getFacCode().equals(FactoryCodeEnum.FACTORY_1010.getValue())){
throw new NflgBusinessException(STATE.BusinessError,StrUtil.format("{}({}) 工厂数据不能退回",FactoryCodeEnum.FACTORY_1010.getDescription(),FactoryCodeEnum.FACTORY_1010.getValue()));
}
//订单号
String orderNo;
if(CollectionUtil.isNotEmpty(detailEntityList)){
BomNewMbomParentEntity bomNewMbomParentEntity=
SpringUtil.getBean(BomNewMbomParentService .class).getById(detailEntityList.get(0).getBomRowId());
orderNo=bomNewMbomParentEntity.getOrderNo();
} else {
orderNo = null;
}
List<BomNewMbomBackMaterialEntity> backMaterialEntityList=Convert.convert(new TypeReference<List<BomNewMbomBackMaterialEntity>>() {
},detailEntityList);
//1.物料的项目类型是Q时此时这个物料的下级递归处理要全部进行退回
//2. 不为Q时 首先向上递归所有父级物料到虚拟包为止,然后向下递归所有子级物料
if(CollectionUtil.isNotEmpty(backMaterialEntityList)){
List<BomNewMbomBackMaterialEntity> saveBackList=new ArrayList<>();
for (BomNewMbomBackMaterialEntity item:
backMaterialEntityList) {
item.setBackUserName(SessionUtil.getRealName());
item.setBackUserCode(SessionUtil.getUserCode());
item.setCreatedTime(LocalDateTime.now());
item.setModifyTime(LocalDateTime.now());
item.setReasonMsg(dto.getReasonMsg());
item.setOrderNo(orderNo);
item.setBackStatus(MBomConstantEnum.MBomBackStatusEnum.APPLY_0.getValue());
if (item.getProjectType().equals(ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.getValue())) {
item.setGroupRowId(SpringUtil.getBean(BomNewMbomDetailService.class).getGroupRowId(item.getDetailRowId()));
} else {
item.setGroupRowId(SpringUtil.getBean(BomNewMbomDetailService.class).getGroupRowId(findRootRowId(item.getDetailRowId())));
}
this.save(item);
SpringUtil.getBean(BomNewMbomDetailService.class).getBaseMapper().updateBackStatus(item.getGroupRowId(),
MBomConstantEnum.MaterialBackStatusEnum.DEAL_1.getValue());
}
}
}
/**
* 向上递归到根
* 从根向下查找最近一个非虚拟包作为起始节点返回然后起始节点向下递归
* @param rowId
* @return
*/
private Long findRootRowId(Long rowId){
//向上到根
List<BomNewMbomMiddleVO> childList = SpringUtil.getBean(BomNewMbomParentService.class).getBaseMapper()
.searchList(rowId);
BomNewMbomMiddleVO root=listToTree(childList);
for (;root!=null;) {
//查找根非虚拟包
if(root.getVirtualPartType()!=null&&
root.getVirtualPartType().intValue()== VirtualPackageTypeEnum.UN_VIRTUAL_PACKAGE.getValue().intValue()){
return root.getRowId();
}
if(CollectionUtil.isNotEmpty(root.getChildNodes())){
root= root.getChildNodes().get(0);
}else{
break;
}
}
throw new NflgBusinessException(STATE.BusinessError,"非Q向上递归未查询到节点");
}
private BomNewMbomMiddleVO listToTree(List<BomNewMbomMiddleVO> childs) {
if(CollectionUtil.isEmpty(childs)){
return null;
}
Map<Long, List<BomNewMbomMiddleVO>> groupMap = childs.stream().collect(Collectors.groupingBy(BomNewMbomMiddleVO::getParentRowId));
childs.forEach(child -> {
child.setChildNodes(groupMap.get(child.getRowId()));
});
//筛选出根
List<BomNewMbomMiddleVO> collect = childs.stream().filter(item -> Objects.isNull(item.getParentRowId()) || item.getParentRowId().longValue()==0).collect(Collectors.toList());
return collect.get(0);
}
/**
* 确认退回
* @param rowIds
*/
@Transactional(rollbackFor = Exception.class)
public void confirmBack(List<Long> rowIds ){
public void confirmBack(List<Long> rowIds ) throws ExecutionException, InterruptedException {
QueryWrapper<BomNewMbomBackMaterialEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().in(BomNewMbomBackMaterialEntity::getRowId,rowIds);
List<BomNewMbomBackMaterialEntity> backList=getBaseMapper().selectList(queryWrapper);
Map<Integer,List<BomNewMbomBackMaterialEntity>> groupBackMap=backList.stream().collect(Collectors.groupingBy(BomNewMbomBackMaterialEntity::getBackStatus));
if(CollectionUtil.isNotEmpty(groupBackMap.get(MBomConstantEnum.MBomBackStatusEnum.DEAL_1.getValue()))){
throw new NflgBusinessException(STATE.BusinessError,"选择数据存在已确认退回");
checkBackStatus(backList);
List<String> facList=SpringUtil.getBean(UserRoleService.class).getUserOfFactory();
if(!facList.contains(MAIN_FACTORY_CODE_1010)){
throw new NflgBusinessException(STATE.BusinessError,StrUtil.format("你不是{}工厂用户不能操作",MAIN_FACTORY_CODE_1010));
}
if(CollectionUtil.isNotEmpty(groupBackMap.get(MBomConstantEnum.MBomBackStatusEnum.REJECT_2.getValue()))){
throw new NflgBusinessException(STATE.BusinessError,"选择数据存在已驳回");
// Map<Integer,List<BomNewMbomBackMaterialEntity>> groupBackMap=backList.stream().collect(Collectors.groupingBy(BomNewMbomBackMaterialEntity::getBackStatus));
for (BomNewMbomBackMaterialEntity item:
backList) {
BomNewMbomParentEntity parentEntity= SpringUtil.getBean(BomNewMbomParentService.class).getById(item.getBomRowId());
QueryWrapper<BomNewMbomDetailEntity > queryWrapper1=new QueryWrapper<>();
queryWrapper1.lambda().in(BomNewMbomDetailEntity::getRowId,item.getGroupRowId());
List<BomNewMbomDetailEntity> detailEntityList= SpringUtil.getBean(BomNewMbomDetailService.class).list(queryWrapper1);
SpringUtil.getBean(BomNewMbomDetailService.class).getBaseMapper().updateBackStatus(item.getGroupRowId(),
MBomConstantEnum.MaterialBackStatusEnum.REJECT_2.getValue());
List<Long> sourceIds= detailEntityList.stream().map(BomNewMbomDetailEntity::getSourceRowId).collect(Collectors.toList());
//重新发布
SpringUtil.getBean(BomNewPbomParentService.class).reConvertToMBom(parentEntity.getSourceRowId(),sourceIds);
BomNewMbomBackMaterialEntity bean=new BomNewMbomBackMaterialEntity();
bean.setRowId(item.getRowId());
bean.setBackStatus(MBomConstantEnum.MBomBackStatusEnum.DEAL_1.getValue());
bean.setConfirmTime(LocalDateTime.now());
bean.setModifyTime(LocalDateTime.now());
bean.setConfirmUserName(SessionUtil.getUserName());
bean.setConfirmUserName(SessionUtil.getUserName());
updateById(bean);
}
//退回逻辑
//同一个bom下退回的物料
Map<Long,List<BomNewMbomBackMaterialEntity>> groupBackMap2=backList.stream().collect(Collectors.groupingBy(BomNewMbomBackMaterialEntity::getBomRowId));
groupBackMap2.forEach((bomRowId,val)->{
BomNewMbomParentEntity parentEntity=SpringUtil.getBean(BomNewMbomParentService.class).getById(bomRowId);
if(parentEntity==null){
throw new NflgBusinessException(STATE.BusinessError , StrUtil.format("{} 数据不存在 退回生成异常",bomRowId));
}
List<Long> updateSourceIdList=val.stream().map(BomNewMbomBackMaterialEntity::getSourceRowId).collect(Collectors.toList());
//重新发布
//SpringUtil.getBean(BomNewPbomParentService.class).reConvertToMBom(parentEntity.getSourceRowId(),updateSourceIdList);
//更新状态
List<Long> updateIdList=val.stream().map(BomNewMbomBackMaterialEntity::getRowId).collect(Collectors.toList());
UpdateWrapper<BomNewMbomBackMaterialEntity> updateWrapper=new UpdateWrapper();
updateWrapper.lambda().in(BomNewMbomBackMaterialEntity::getRowId,updateIdList);
updateWrapper.lambda().set(BomNewMbomBackMaterialEntity::getBackStatus, MBomConstantEnum.MBomBackStatusEnum.DEAL_1.getValue());
updateWrapper.lambda(). set(BomNewMbomBackMaterialEntity::getConfirmTime,LocalDateTime.now());
updateWrapper.lambda(). set(BomNewMbomBackMaterialEntity::getConfirmUserName,SessionUtil.getUserName());
updateWrapper.lambda(). set(BomNewMbomBackMaterialEntity::getConfirmUserCode,SessionUtil.getUserCode());
update(updateWrapper);
});

View File

@ -45,7 +45,9 @@ public class BomNewMbomDetailService extends ServiceImpl<BomNewMbomDetailMapper,
}
public String getGroupRowId(Long rowId){
return this.getBaseMapper().getGroupRowId(rowId);
}
public List<BomNewMbomMiddleVO> superSaterialList(Long rowId) {

View File

@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.alibaba.excel.enums.BooleanEnum;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -694,14 +695,20 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
}
public void reConvertToMBom(Long bomRowId, List<Long> backRowId) {
/**
* 修改生产工厂
* 重新发布
*
*/
public void reConvertToMBom(Long bomRowId, List<Long> sourceRowId) throws ExecutionException, InterruptedException {
UpdateWrapper<BomNewPbomChildEntity> updateWrapper = new UpdateWrapper<>();
updateWrapper.lambda().set(BomNewPbomChildEntity::getProductionFactoryCode, backRowId);
updateWrapper.lambda().in(BomNewPbomChildEntity::getRowId, backRowId);
updateWrapper.lambda().set(BomNewPbomChildEntity::getProductionFactoryCode, FactoryCodeEnum.FACTORY_1010.getValue());
updateWrapper.lambda().in(BomNewPbomChildEntity::getRowId, sourceRowId);
SpringUtil.getBean(BomNewPbomChildService.class).update(updateWrapper);
convertToMBomFor1020(bomRowId);
}

View File

@ -249,6 +249,8 @@ public class OptionalMbomMaterialService extends ServiceImpl<OptionalMbomMateria
item.setRootRowId(parentRow.getRootRowId());
if(Objects.isNull(item.getRowId()) || item.getRowId().longValue() == 0){
item.setCreatedTime(DateUtil.now());
}else{
item.setCreatedTime(null);
}
item.setCreatedBy(SessionUtil.getUserCode());

View File

@ -3,64 +3,66 @@
<mapper namespace="com.nflg.product.bomnew.mapper.master.BomNewMbomBackMaterialMapper">
<resultMap id="BaseResultMap" type="com.nflg.product.bomnew.pojo.entity.BomNewMbomBackMaterialEntity">
<!--@mbg.generated-->
<!--@Table t_bom_new_mbom_back_material -->
<id column="row_id" property="rowId" jdbcType="BIGINT"/>
<result column="detail_row_id" property="sourceRowId" jdbcType="BIGINT"/>
<!--@mbg.generated-->
<!--@Table t_bom_new_mbom_back_material -->
<id column="row_id" property="rowId" jdbcType="BIGINT"/>
<result column="detail_row_id" property="sourceRowId" jdbcType="BIGINT"/>
<result column="bom_row_id" property="bomRowId" jdbcType="BIGINT"/>
<result column="bom_row_id" property="bomRowId" jdbcType="BIGINT"/>
<result column="detail_row_id" property="detailRowId" jdbcType="BIGINT"/>
<result column="back_user_name" property="backUserName" jdbcType="VARCHAR"/>
<result column="back_user_code" property="backUserCode" jdbcType="VARCHAR"/>
<result column="back_status" property="backStatus" jdbcType="INTEGER"/>
<result column="confirm_user_code" property="confirmUserCode" jdbcType="VARCHAR"/>
<result column="confirm_user_name" property="confirmUserName" jdbcType="VARCHAR"/>
<result column="confirm_time" property="confirmTime" jdbcType="TIMESTAMP"/>
<result column="created_time" property="createdTime" jdbcType="TIMESTAMP"/>
<result column="reason_msg" property="reasonMsg" jdbcType="VARCHAR"/>
<result column="detail_row_id" property="detailRowId" jdbcType="BIGINT"/>
<result column="back_user_name" property="backUserName" jdbcType="VARCHAR"/>
<result column="back_user_code" property="backUserCode" jdbcType="VARCHAR"/>
<result column="back_status" property="backStatus" jdbcType="INTEGER"/>
<result column="confirm_user_code" property="confirmUserCode" jdbcType="VARCHAR"/>
<result column="confirm_user_name" property="confirmUserName" jdbcType="VARCHAR"/>
<result column="confirm_time" property="confirmTime" jdbcType="TIMESTAMP"/>
<result column="created_time" property="createdTime" jdbcType="TIMESTAMP"/>
</resultMap>
<result column="modify_time" property="modifTime" jdbcType="TIMESTAMP"/>
<result column="reason_msg" property="reasonMsg" jdbcType="VARCHAR"/>
<result column="material_no" property="materialNo" jdbcType="VARCHAR"/>
<result column="drawing_no" property="drawingNo" jdbcType="VARCHAR"/>
<result column="project_type" property="projectType" jdbcType="VARCHAR"/>
<result column="material_name" property="materialName" jdbcType="VARCHAR"/>
<result column="material_desc" property="materialDesc" jdbcType="VARCHAR"/>
<result column="material_texture" property="materialTexture" jdbcType="VARCHAR"/>
<result column="material_unit" property="materialUnit" jdbcType="VARCHAR"/>
<result column="unit_weight" property="unitWeight" jdbcType="DECIMAL"/>
<result column="total_weight" property="totalWeight" jdbcType="DECIMAL"/>
<result column="num" property="num" jdbcType="DECIMAL"/>
<result column="order_no" property="orderNo" jdbcType="VARCHAR"/>
<result column="group_row_id" property="groupRowId" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
row_id, source_id, back_user_name, back_user_code, status, confirm_user_code, confirm_user_name, confirm_time, created_time </sql>
row_id, source_id, back_user_name, back_user_code, status, confirm_user_code, confirm_user_name, confirm_time,
created_time
</sql>
<select id="getListPage" resultType="com.nflg.product.bomnew.pojo.vo.BomNewMbomBackMaterialVO">
select t1.*, t2.drawing_no,
t2.fac_code,
t2.material_no,
t2.material_name,
t2.material_desc,
t2.material_texture,
t2.material_unit,
t2.unit_weight,
t2.total_weight,
t2.num,
t2.project_type,
t2.super_material_status,
t2.virtual_part_is,
t2.remark,
t3.order_no
select t1.*
from t_bom_new_mbom_back_material as t1
left join t_bom_new_mbom_detail t2
on t1.detail_row_id=t2.row_id
left join t_bom_new_mbom_parent t3
on t1.bom_row_id=t3.row_id
<where>
<if test="query.drawingNo!=null and query.drawingNo!=''">
and t2.drawing_no=#{query.drawingNo}
and t1.drawing_no=#{query.drawingNo}
</if>
<if test="query.materialNo!=null and query.materialNo!=''">
and t2.material_no=#{query.materialNo}
and t1.material_no=#{query.materialNo}
</if>
<if test="query.orderNo!=null and query.orderNo!=''">
and t3.order_no=#{query.orderNo}
and t1.order_no=#{query.orderNo}
</if>
<if test="query.startDate!=null and query.startDate!='' and query.endDate!=null and query.endDate!=''">
<![CDATA[ and t1.created_time >= #{query.startDate} and t1.created_time <=#{query.endDate}]]>
@ -78,4 +80,6 @@
</mapper>

View File

@ -3,45 +3,91 @@
<mapper namespace="com.nflg.product.bomnew.mapper.master.BomNewMbomDetailMapper">
<resultMap id="BaseResultMap" type="com.nflg.product.bomnew.pojo.entity.BomNewMbomDetailEntity">
<!--@mbg.generated-->
<!--@Table t_bom_new_mbom_detail -->
<id column="row_id" property="rowId" jdbcType="BIGINT"/>
<result column="bom_row_id" property="bomRowId" jdbcType="BIGINT"/>
<result column="parent_row_id" property="parentRowId" jdbcType="BIGINT"/>
<result column="drawing_no" property="drawingNo" jdbcType="VARCHAR"/>
<result column="fac_code" property="facCode" jdbcType="VARCHAR"/>
<result column="material_no" property="materialNo" jdbcType="VARCHAR"/>
<result column="order_number" property="orderNumber" jdbcType="VARCHAR"/>
<result column="material_name" property="materialName" jdbcType="VARCHAR"/>
<result column="material_desc" property="materialDesc" jdbcType="VARCHAR"/>
<result column="material_texture" property="materialTexture" jdbcType="VARCHAR"/>
<result column="material_unit" property="materialUnit" jdbcType="VARCHAR"/>
<result column="unit_weight" property="unitWeight" jdbcType="DECIMAL"/>
<result column="total_weight" property="totalWeight" jdbcType="DECIMAL"/>
<result column="num" property="num" jdbcType="DECIMAL"/>
<result column="project_type" property="projectType" jdbcType="VARCHAR"/>
<result column="super_material_status" property="superMaterialStatus" jdbcType="INTEGER"/>
<result column="virtual_part_is" property="virtualPartIs" jdbcType="INTEGER"/>
<result column="source_row_id" property="sourceRowId" jdbcType="BIGINT"/>
<result column="devise_user_code" property="deviseUserCode" jdbcType="VARCHAR"/>
<result column="devise_name" property="deviseName" jdbcType="VARCHAR"/>
<result column="created_by" property="createdBy" jdbcType="VARCHAR"/>
<result column="created_time" property="createdTime" jdbcType="TIMESTAMP"/>
<result column="remark" property="remark" jdbcType="VARCHAR"/>
<result column="dept_name" property="deptName" jdbcType="VARCHAR"/>
<result column="level_num" property="levelNum" jdbcType="INTEGER"/>
<result column="change_desc" property="changeDesc" jdbcType="VARCHAR"/>
<result column="notice_nums" property="noticeNums" jdbcType="VARCHAR"/>
<result column="modify_time" property="modifyTime" jdbcType="TIMESTAMP"/>
</resultMap>
<!--@mbg.generated-->
<!--@Table t_bom_new_mbom_detail -->
<id column="row_id" property="rowId" jdbcType="BIGINT"/>
<result column="bom_row_id" property="bomRowId" jdbcType="BIGINT"/>
<result column="parent_row_id" property="parentRowId" jdbcType="BIGINT"/>
<result column="drawing_no" property="drawingNo" jdbcType="VARCHAR"/>
<result column="fac_code" property="facCode" jdbcType="VARCHAR"/>
<result column="material_no" property="materialNo" jdbcType="VARCHAR"/>
<result column="order_number" property="orderNumber" jdbcType="VARCHAR"/>
<result column="material_name" property="materialName" jdbcType="VARCHAR"/>
<result column="material_desc" property="materialDesc" jdbcType="VARCHAR"/>
<result column="material_texture" property="materialTexture" jdbcType="VARCHAR"/>
<result column="material_unit" property="materialUnit" jdbcType="VARCHAR"/>
<result column="unit_weight" property="unitWeight" jdbcType="DECIMAL"/>
<result column="total_weight" property="totalWeight" jdbcType="DECIMAL"/>
<result column="num" property="num" jdbcType="DECIMAL"/>
<result column="project_type" property="projectType" jdbcType="VARCHAR"/>
<result column="super_material_status" property="superMaterialStatus" jdbcType="INTEGER"/>
<result column="virtual_part_is" property="virtualPartIs" jdbcType="INTEGER"/>
<result column="source_row_id" property="sourceRowId" jdbcType="BIGINT"/>
<result column="devise_user_code" property="deviseUserCode" jdbcType="VARCHAR"/>
<result column="devise_name" property="deviseName" jdbcType="VARCHAR"/>
<result column="created_by" property="createdBy" jdbcType="VARCHAR"/>
<result column="created_time" property="createdTime" jdbcType="TIMESTAMP"/>
<result column="remark" property="remark" jdbcType="VARCHAR"/>
<result column="dept_name" property="deptName" jdbcType="VARCHAR"/>
<result column="level_num" property="levelNum" jdbcType="INTEGER"/>
<result column="change_desc" property="changeDesc" jdbcType="VARCHAR"/>
<result column="notice_nums" property="noticeNums" jdbcType="VARCHAR"/>
<result column="modify_time" property="modifyTime" jdbcType="TIMESTAMP"/>
<result column="material_back_status" property="materialBackStatus" jdbcType="INTEGER"/>
<result column="virtual_part_type" property="virtualPartType" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
row_id, bom_row_id, parent_row_id, drawing_no, fac_code, material_no, order_number, material_name, material_desc, material_texture, material_unit, unit_weight, total_weight, num, project_type, super_material_status, virtual_part_is, source_row_id, devise_user_code, devise_name, created_by, created_time, remark, dept_name, level_num, change_desc, notice_nums, modify_time </sql>
row_id, bom_row_id, parent_row_id, drawing_no, fac_code, material_no, order_number, material_name,
material_desc, material_texture, material_unit, unit_weight, total_weight, num, project_type,
super_material_status, virtual_part_is, source_row_id, devise_user_code, devise_name, created_by, created_time,
remark, dept_name, level_num, change_desc, notice_nums, modify_time
</sql>
<select id="getDetailById" resultType="com.nflg.product.bomnew.pojo.vo.BomNewMbomMiddleVO">
select t1.*
from t_bom_new_mbom_detail as t1
select t1.*
from t_bom_new_mbom_detail as t1
where t1.row_id = #{rowId}
</select>
<select id="getSourceRowId" resultType="java.lang.String">
SELECT GROUP_CONCAT( source_row_id) ids
from t_bom_new_mbom_detail
WHERE
row_id in (${rowIds})
</select>
<!--向下递归查找-->
<select id="getGroupRowId" resultType="java.lang.String">
SELECT GROUP_CONCAT(d.row_id) ids
FROM (SELECT @ids AS _ids,
(SELECT @ids := GROUP_CONCAT( row_id )
FROM t_bom_new_mbom_detail
WHERE FIND_IN_SET( parent_row_id, @ids )) AS cids FROM
t_bom_new_mbom_detail,
( SELECT @ids := ( SELECT pu.row_id FROM t_bom_new_mbom_detail pu WHERE pu.row_id = ${rowId}) ) b
WHERE
@ids IS NOT NULL
) dd
, t_bom_new_mbom_detail d
WHERE
FIND_IN_SET( d.row_id
, dd._ids )
</select>
<update id="updateBackStatus" >
UPDATE t_bom_new_mbom_detail SET material_back_status=#{materialBackStatus},modify_time=now()
WHERE row_id in ${rowIds}
</update>
</mapper>

View File

@ -106,12 +106,12 @@
<!-- </select>-->
<select id="getParentChild" resultType="com.nflg.product.bomnew.pojo.vo.BomNewMbomMiddleVO">
select t1.*,IFNULL(t2.back_status,0) as back_status,
(SELECT count(1) from t_bom_new_mbom_detail where parent_row_id=t1.row_id) as bom_exist
select t1.*,t2.status,
(SELECT count(1) from t_bom_new_mbom_detail where parent_row_id=t1.row_id) as bom_exist
from t_bom_new_mbom_detail as t1
left join t_bom_new_mbom_back_material as t2
on t1.row_id=t2.detail_row_id
left join t_bom_new_mbom_parent as t2
on
t1.bom_row_id=t2.row_id
where t1.parent_row_id = #{rowId}
<if test="bomRowId!=null and bomRowId!=0">
and t1.bom_row_id=#{bomRowId}
@ -161,7 +161,7 @@
<!--向上递归查找-->
<select id="searchList" resultType="com.nflg.product.bomnew.pojo.vo.BomNewMbomMiddleVO">
<![CDATA[
select T1.*, IFNULL(T2.back_status, 0) as back_status
select T1.*,T2.status
from (SELECT t2.*, (SELECT count(1) from t_bom_new_mbom_detail where parent_row_id = t2.row_id) as bom_exist
FROM (SELECT @r AS _row_id,
(SELECT @r := parent_row_id
@ -174,8 +174,9 @@
JOIN t_bom_new_mbom_detail t2
ON t1._row_id = t2.row_id
)as T1
left join t_bom_new_mbom_back_material as T2
on T1.row_id=T2.detail_row_id
left join t_bom_new_mbom_parent as T2
on T1.bom_row_id=T2.row_id
]]>
</select>