Merge remote-tracking branch 'origin/feature/DM/nflg-bom' into feature/DM/nflg-bom
This commit is contained in:
commit
c17a135723
|
|
@ -13,6 +13,9 @@ public class EBomConstant {
|
||||||
|
|
||||||
//EBOM 获取时,初始化物料主数据信息是,忽略的字段
|
//EBOM 获取时,初始化物料主数据信息是,忽略的字段
|
||||||
public static final String[] EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT = {"material", "materialTexture", "projectType", "materialUnit"};
|
public static final String[] EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT = {"material", "materialTexture", "projectType", "materialUnit"};
|
||||||
|
public static final String[] EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT2 = {"material", "materialTexture", "projectType", "materialUnit","materialNo",
|
||||||
|
"materialName","materialDesc","drawingNo"
|
||||||
|
};
|
||||||
|
|
||||||
//集团总部代码
|
//集团总部代码
|
||||||
public static final String MAIN_FACTORY_CODE_1010="1010";
|
public static final String MAIN_FACTORY_CODE_1010="1010";
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ public interface BomNewMbomParentMapper extends BaseMapper<BomNewMbomParentEntit
|
||||||
* @param rowId
|
* @param rowId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<BomNewMbomMiddleVO> getParentChild(@Param("rowId") Long rowId );
|
List<BomNewMbomMiddleVO> getParentChild(@Param("rowId") Long rowId ,@Param("bomRowId") Long bomRowId);
|
||||||
|
|
||||||
BomNewMbomMiddleVO getParentById(@Param("rowId") Long rowId );
|
BomNewMbomMiddleVO getParentById(@Param("rowId") Long rowId );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||||
|
import com.nflg.product.bomnew.constant.EBomConstant;
|
||||||
import com.nflg.product.bomnew.constant.MBomConstantEnum;
|
import com.nflg.product.bomnew.constant.MBomConstantEnum;
|
||||||
import com.nflg.product.bomnew.mapper.master.BomNewMbomDetailMapper;
|
import com.nflg.product.bomnew.mapper.master.BomNewMbomDetailMapper;
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewMbomDetailEntity;
|
import com.nflg.product.bomnew.pojo.entity.BomNewMbomDetailEntity;
|
||||||
|
|
@ -19,6 +20,7 @@ import com.nflg.product.bomnew.pojo.vo.BomNewMbomMiddleVO;
|
||||||
import nflg.product.common.constant.STATE;
|
import nflg.product.common.constant.STATE;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -61,6 +63,8 @@ public class BomNewMbomDetailService extends ServiceImpl<BomNewMbomDetailMapper,
|
||||||
List<BomNewMbomMiddleVO> voList = Convert.convert(new TypeReference<List<BomNewMbomMiddleVO>>() {
|
List<BomNewMbomMiddleVO> voList = Convert.convert(new TypeReference<List<BomNewMbomMiddleVO>>() {
|
||||||
}, list);
|
}, list);
|
||||||
|
|
||||||
|
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(voList, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT2);
|
||||||
|
|
||||||
return voList;
|
return voList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -74,6 +78,7 @@ public class BomNewMbomDetailService extends ServiceImpl<BomNewMbomDetailMapper,
|
||||||
*
|
*
|
||||||
* @param rowId
|
* @param rowId
|
||||||
*/
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void superSaterialStatusTag(Long rowId, Integer status) {
|
public void superSaterialStatusTag(Long rowId, Integer status) {
|
||||||
|
|
||||||
BomNewMbomDetailEntity entity = getById(rowId);
|
BomNewMbomDetailEntity entity = getById(rowId);
|
||||||
|
|
@ -90,52 +95,61 @@ public class BomNewMbomDetailService extends ServiceImpl<BomNewMbomDetailMapper,
|
||||||
}
|
}
|
||||||
|
|
||||||
//取消超级物料标签
|
//取消超级物料标签
|
||||||
if (Objects.equals(status, MBomConstantEnum.MBomSuperMaterialStatusEnum.UN_SUPER.getValue())) {
|
// if (Objects.equals(status, MBomConstantEnum.MBomSuperMaterialStatusEnum.UN_SUPER.getValue())) {
|
||||||
BomNewMbomDetailEntity uppdateBomNewMbomDetailEntity = new BomNewMbomDetailEntity();
|
// BomNewMbomDetailEntity uppdateBomNewMbomDetailEntity = new BomNewMbomDetailEntity();
|
||||||
uppdateBomNewMbomDetailEntity.setSuperMaterialStatus(MBomConstantEnum.MBomSuperMaterialStatusEnum.UN_SUPER.getValue());
|
// uppdateBomNewMbomDetailEntity.setSuperMaterialStatus(MBomConstantEnum.MBomSuperMaterialStatusEnum.UN_SUPER.getValue());
|
||||||
uppdateBomNewMbomDetailEntity.setModifyTime(LocalDateTime.now());
|
// uppdateBomNewMbomDetailEntity.setModifyTime(LocalDateTime.now());
|
||||||
uppdateBomNewMbomDetailEntity.setRowId(rowId);
|
// uppdateBomNewMbomDetailEntity.setRowId(rowId);
|
||||||
updateById(uppdateBomNewMbomDetailEntity);
|
// updateById(uppdateBomNewMbomDetailEntity);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//当前数据已是超级物料
|
// //当前数据已是超级物料
|
||||||
if (Objects.equals(MBomConstantEnum.MBomSuperMaterialStatusEnum.SUPER.getValue(), entity.getSuperMaterialStatus())) {
|
// if (Objects.equals(MBomConstantEnum.MBomSuperMaterialStatusEnum.SUPER.getValue(), entity.getSuperMaterialStatus())) {
|
||||||
throw new NflgBusinessException(STATE.Error, StrUtil.format("选择行物料{}已为超级物料", entity.getMaterialNo()));
|
// throw new NflgBusinessException(STATE.Error, StrUtil.format("选择行物料{}已为超级物料", entity.getMaterialNo()));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
// //parentRowId 空情况
|
||||||
|
// if (Objects.isNull(entity.getParentRowId()) || entity.getParentRowId().longValue() == 0) {
|
||||||
|
// QueryWrapper<BomNewMbomDetailEntity> queryWrapper = new QueryWrapper<>();
|
||||||
|
// queryWrapper.lambda().eq(BomNewMbomDetailEntity::getParentRowId, 0l)
|
||||||
|
// .eq(BomNewMbomDetailEntity::getSuperMaterialStatus, MBomConstantEnum.MBomSuperMaterialStatusEnum.SUPER.getValue());
|
||||||
|
// List<BomNewMbomDetailEntity> list = this.list(queryWrapper);
|
||||||
|
// if (CollectionUtil.isNotEmpty(list)) {
|
||||||
|
// throw new NflgBusinessException(STATE.Error, "同级已有物料设置为超级物料");
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// //check 父级为超级物料 子级才能为超级物料
|
||||||
|
// QueryWrapper<BomNewMbomDetailEntity> queryParentWrapper = new QueryWrapper<>();
|
||||||
|
// queryParentWrapper.lambda().eq(BomNewMbomDetailEntity::getRowId, entity.getParentRowId());
|
||||||
|
// BomNewMbomDetailEntity parentDetail = this.getOne(queryParentWrapper);
|
||||||
|
// if (parentDetail == null) {
|
||||||
|
// throw new NflgBusinessException(STATE.Error, "数据异常联系管理员");
|
||||||
|
// }
|
||||||
|
// if (!Objects.equals(MBomConstantEnum.MBomSuperMaterialStatusEnum.SUPER.getValue(), parentDetail.getSuperMaterialStatus())) {
|
||||||
|
// throw new NflgBusinessException(STATE.Error, "父级不为超级物料,子级不能设置为超级物料");
|
||||||
|
// }
|
||||||
|
// //check 同级不能多个超级物料
|
||||||
|
// QueryWrapper<BomNewMbomDetailEntity> queryWrapper = new QueryWrapper<>();
|
||||||
|
// queryWrapper.lambda().eq(BomNewMbomDetailEntity::getParentRowId, entity.getParentRowId())
|
||||||
|
// .eq(BomNewMbomDetailEntity::getSuperMaterialStatus, MBomConstantEnum.MBomSuperMaterialStatusEnum.SUPER.getValue());
|
||||||
|
// List<BomNewMbomDetailEntity> list = this.list(queryWrapper);
|
||||||
|
// if (CollectionUtil.isNotEmpty(list)) {
|
||||||
|
// throw new NflgBusinessException(STATE.Error, "同级已有物料设置为超级物料");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
//parentRowId 空情况
|
//取消
|
||||||
if (Objects.isNull(entity.getParentRowId()) || entity.getParentRowId().longValue() == 0) {
|
|
||||||
QueryWrapper<BomNewMbomDetailEntity> queryWrapper = new QueryWrapper<>();
|
|
||||||
queryWrapper.lambda().eq(BomNewMbomDetailEntity::getParentRowId, 0l)
|
|
||||||
.eq(BomNewMbomDetailEntity::getSuperMaterialStatus, MBomConstantEnum.MBomSuperMaterialStatusEnum.SUPER.getValue());
|
|
||||||
List<BomNewMbomDetailEntity> list = this.list(queryWrapper);
|
|
||||||
if (CollectionUtil.isNotEmpty(list)) {
|
|
||||||
throw new NflgBusinessException(STATE.Error, "同级已有物料设置为超级物料");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//check 父级为超级物料 子级才能为超级物料
|
|
||||||
QueryWrapper<BomNewMbomDetailEntity> queryParentWrapper = new QueryWrapper<>();
|
|
||||||
queryParentWrapper.lambda().eq(BomNewMbomDetailEntity::getRowId, entity.getParentRowId());
|
|
||||||
BomNewMbomDetailEntity parentDetail = this.getOne(queryParentWrapper);
|
|
||||||
if (parentDetail == null) {
|
|
||||||
throw new NflgBusinessException(STATE.Error, "数据异常联系管理员");
|
|
||||||
}
|
|
||||||
if (!Objects.equals(MBomConstantEnum.MBomSuperMaterialStatusEnum.SUPER.getValue(), parentDetail.getSuperMaterialStatus())) {
|
|
||||||
throw new NflgBusinessException(STATE.Error, "父级不为超级物料,子级不能设置为超级物料");
|
|
||||||
}
|
|
||||||
//check 同级不能多个超级物料
|
|
||||||
QueryWrapper<BomNewMbomDetailEntity> queryWrapper = new QueryWrapper<>();
|
|
||||||
queryWrapper.lambda().eq(BomNewMbomDetailEntity::getParentRowId, entity.getParentRowId())
|
|
||||||
.eq(BomNewMbomDetailEntity::getSuperMaterialStatus, MBomConstantEnum.MBomSuperMaterialStatusEnum.SUPER.getValue());
|
|
||||||
List<BomNewMbomDetailEntity> list = this.list(queryWrapper);
|
|
||||||
if (CollectionUtil.isNotEmpty(list)) {
|
|
||||||
throw new NflgBusinessException(STATE.Error, "同级已有物料设置为超级物料");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
UpdateWrapper<BomNewMbomDetailEntity> updateWrapper=new UpdateWrapper<>();
|
||||||
|
updateWrapper.lambda().set(BomNewMbomDetailEntity::getModifyTime,LocalDateTime.now());
|
||||||
|
updateWrapper.lambda().set(BomNewMbomDetailEntity::getSuperMaterialStatus,MBomConstantEnum.MBomSuperMaterialStatusEnum.UN_SUPER.getValue());
|
||||||
|
updateWrapper.lambda().eq(BomNewMbomDetailEntity::getParentRowId ,entity.getParentRowId());
|
||||||
|
update(updateWrapper);
|
||||||
|
|
||||||
BomNewMbomDetailEntity uppdateBomNewMbomDetailEntity = new BomNewMbomDetailEntity();
|
BomNewMbomDetailEntity uppdateBomNewMbomDetailEntity = new BomNewMbomDetailEntity();
|
||||||
uppdateBomNewMbomDetailEntity.setSuperMaterialStatus(MBomConstantEnum.MBomSuperMaterialStatusEnum.SUPER.getValue());
|
uppdateBomNewMbomDetailEntity.setSuperMaterialStatus(MBomConstantEnum.MBomSuperMaterialStatusEnum.SUPER.getValue());
|
||||||
uppdateBomNewMbomDetailEntity.setModifyTime(LocalDateTime.now());
|
uppdateBomNewMbomDetailEntity.setModifyTime(LocalDateTime.now());
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ public class BomNewMbomParentService extends ServiceImpl<BomNewMbomParentMapper,
|
||||||
if (Objects.equals(dto.getRowId(), dto.getBomRowId())) {
|
if (Objects.equals(dto.getRowId(), dto.getBomRowId())) {
|
||||||
_rowId = 0l;
|
_rowId = 0l;
|
||||||
}
|
}
|
||||||
List<BomNewMbomMiddleVO> listChild = this.getBaseMapper().getParentChild(_rowId);
|
List<BomNewMbomMiddleVO> listChild = this.getBaseMapper().getParentChild(_rowId,dto.getBomRowId());
|
||||||
if (CollectionUtil.isNotEmpty(listChild)) {
|
if (CollectionUtil.isNotEmpty(listChild)) {
|
||||||
listChild.forEach(child -> {
|
listChild.forEach(child -> {
|
||||||
IndexListTree.sysnParentParam(parent, child);
|
IndexListTree.sysnParentParam(parent, child);
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@
|
||||||
and fac_code=#{query.facCode}
|
and fac_code=#{query.facCode}
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
|
|
||||||
<if test="query.status!=null and query.status==1">
|
<if test="query.status!=null and query.status==1">
|
||||||
<if test="query.startDate!=null and query.startDate!='' and query.endDate!=null and query.endDate!=''">
|
<if test="query.startDate!=null and query.startDate!='' and query.endDate!=null and query.endDate!=''">
|
||||||
<![CDATA[ and created_time >= #{query.startDate} and created_time <=#{query.endDate}]]>
|
<![CDATA[ and created_time >= #{query.startDate} and created_time <=#{query.endDate}]]>
|
||||||
|
|
@ -112,6 +113,9 @@
|
||||||
left join t_bom_new_mbom_back_material as t2
|
left join t_bom_new_mbom_back_material as t2
|
||||||
on t1.row_id=t2.detail_row_id
|
on t1.row_id=t2.detail_row_id
|
||||||
where t1.parent_row_id = #{rowId}
|
where t1.parent_row_id = #{rowId}
|
||||||
|
<if test="bomRowId!=null and bomRowId!=0">
|
||||||
|
and t1.bom_row_id=#{bomRowId}
|
||||||
|
</if>
|
||||||
order by t1.order_number
|
order by t1.order_number
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
@ -138,7 +142,9 @@
|
||||||
on t1.bom_row_id=t2.row_id
|
on t1.bom_row_id=t2.row_id
|
||||||
where t1.bom_row_id=t2.row_id and t2.last_version_is=1
|
where t1.bom_row_id=t2.row_id and t2.last_version_is=1
|
||||||
|
|
||||||
|
<if test="query.status!=null and query.status!=0">
|
||||||
|
and t2.status=#{query.status}
|
||||||
|
</if>
|
||||||
<if test="query.facCode!=null and query.facCode!=''">
|
<if test="query.facCode!=null and query.facCode!=''">
|
||||||
and t1.fac_code=#{query.facCode}
|
and t1.fac_code=#{query.facCode}
|
||||||
</if>
|
</if>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue