This commit is contained in:
parent
05cc8db7db
commit
ce9596a61f
|
|
@ -193,12 +193,17 @@ public class MBomApi extends BaseApi {
|
||||||
public ResultVO<Boolean> confirmBack(@RequestBody List<Long> rowIds){
|
public ResultVO<Boolean> confirmBack(@RequestBody List<Long> rowIds){
|
||||||
|
|
||||||
VUtils.isTure(CollectionUtil.isEmpty(rowIds)).throwMessage("选择行数据操作");
|
VUtils.isTure(CollectionUtil.isEmpty(rowIds)).throwMessage("选择行数据操作");
|
||||||
|
try {
|
||||||
bomNewMbomBackMaterialService.confirmBack(rowIds);
|
bomNewMbomBackMaterialService.confirmBack(rowIds);
|
||||||
|
|
||||||
return ResultVO.success(true);
|
return ResultVO.success(true);
|
||||||
|
|
||||||
|
}catch (Exception e){
|
||||||
|
|
||||||
|
throw new NflgBusinessException(STATE.Error,"联系管理员,"+e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import lombok.Getter;
|
||||||
public enum VirtualPackageTypeEnum implements ValueEnum<Integer>{
|
public enum VirtualPackageTypeEnum implements ValueEnum<Integer>{
|
||||||
//1-发货包 2-制作包 4-直发包 8-发货前装配包
|
//1-发货包 2-制作包 4-直发包 8-发货前装配包
|
||||||
|
|
||||||
UN_VIRTUAL_PACKAGE(1,"非虚拟包","" ,"", ""),
|
UN_VIRTUAL_PACKAGE(0,"非虚拟包","" ,"", ""),
|
||||||
DELIVERY_PACKAGE(1,"发货包","发货" ,"201101", ""),
|
DELIVERY_PACKAGE(1,"发货包","发货" ,"201101", ""),
|
||||||
MAKING_PACKAGE(2,"制作包","制作","201101",""),
|
MAKING_PACKAGE(2,"制作包","制作","201101",""),
|
||||||
DIRECT_DELIVERY_PACKAGE(4,"直发包","直发","201101","F"),
|
DIRECT_DELIVERY_PACKAGE(4,"直发包","直发","201101","F"),
|
||||||
|
|
|
||||||
|
|
@ -32,5 +32,14 @@ public class BomNewEbomMaterialQuery implements Serializable {
|
||||||
private String materialNo;
|
private String materialNo;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "上级rowId")
|
||||||
|
private Long bomRowId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "当前行rowId")
|
||||||
|
private Long rowId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1212,18 +1212,36 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BomNewEbomParentEntity bomParent=null;
|
||||||
|
|
||||||
|
if(query.getBomRowId()!=null){
|
||||||
|
bomParent= getById(query.getBomRowId());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(materialMainList)) {
|
if (CollUtil.isNotEmpty(materialMainList)) {
|
||||||
MaterialMainEntity materialMainEntity = materialMainList.get(0);
|
MaterialMainEntity materialMainEntity = materialMainList.get(0);
|
||||||
BomNewEbomParentVO baseMaterialVO = new BomNewEbomParentVO();
|
BomNewEbomParentVO baseMaterialVO = new BomNewEbomParentVO();
|
||||||
BeanUtil.copyProperties(materialMainEntity, baseMaterialVO);
|
BeanUtil.copyProperties(materialMainEntity, baseMaterialVO);
|
||||||
// baseMaterialVO.setCreatedBy(SessionUtil.getUserCode());
|
// baseMaterialVO.setCreatedBy(SessionUtil.getUserCode());
|
||||||
baseMaterialVO.setRowId(null);
|
baseMaterialVO.setRowId(query.getRowId());
|
||||||
baseMaterialVO.setExceptionStatus(materialMainEntity.getMaterialState());
|
materialMainEntity.setProjectType(null);
|
||||||
|
baseMaterialVO.setDeviseUserCode(SessionUtil.getUserCode());
|
||||||
|
baseMaterialVO.setDeviseName(SessionUtil.getRealName());
|
||||||
|
baseMaterialVO.setCreatedBy(SessionUtil.getUserCode());
|
||||||
|
baseMaterialVO.setCreatedTime(LocalDateTime.now());
|
||||||
|
baseMaterialVO.setModifyTime(LocalDateTime.now());
|
||||||
|
baseMaterialVO.setUnitWeight(new BigDecimal(materialMainEntity.getMaterialWeight()));
|
||||||
|
if(bomParent!=null){
|
||||||
|
baseMaterialVO.setEditStatus(bomParent.getEditStatus());
|
||||||
|
baseMaterialVO.setStatus(bomParent.getStatus());
|
||||||
|
}
|
||||||
|
baseMaterialVO.setTotalWeight(NumberUtil.mul(baseMaterialVO.getUnitWeight(), baseMaterialVO.getNum()));
|
||||||
return baseMaterialVO;
|
return baseMaterialVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new NflgBusinessException(STATE.Error, "未查询到相关物料信息");
|
throw new NflgBusinessException(STATE.Error, "未查询到相关物料信息");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
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.MBomConstantEnum;
|
||||||
import com.nflg.product.bomnew.constant.ProjectTypeInputTypeEnum;
|
import com.nflg.product.bomnew.constant.ProjectTypeInputTypeEnum;
|
||||||
import com.nflg.product.bomnew.constant.VirtualPackageTypeEnum;
|
import com.nflg.product.bomnew.constant.VirtualPackageTypeEnum;
|
||||||
import com.nflg.product.bomnew.mapper.master.BomNewMbomBackMaterialMapper;
|
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.BomNewMbomApplyBackMaterialDTO;
|
||||||
import com.nflg.product.bomnew.pojo.dto.BomNewMbomBackMaterialDTO;
|
import com.nflg.product.bomnew.pojo.dto.BomNewMbomBackMaterialDTO;
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewMbomBackMaterialEntity;
|
import com.nflg.product.bomnew.pojo.entity.BomNewMbomBackMaterialEntity;
|
||||||
|
|
@ -36,8 +38,11 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static com.nflg.product.bomnew.constant.EBomConstant.MAIN_FACTORY_CODE_1010;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* t_bom_new_mbom_back_material 表服务实现类
|
* t_bom_new_mbom_back_material 表服务实现类
|
||||||
|
|
@ -115,6 +120,7 @@ private void checkBackStatus( List<BomNewMbomBackMaterialEntity> backList){
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 驳回
|
* 驳回
|
||||||
|
* 1010工厂处理
|
||||||
* @param rowIds
|
* @param rowIds
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
|
@ -129,6 +135,11 @@ private void checkBackStatus( List<BomNewMbomBackMaterialEntity> backList){
|
||||||
|
|
||||||
checkBackStatus(backList);
|
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:
|
for ( BomNewMbomBackMaterialEntity entity:
|
||||||
|
|
@ -160,7 +171,7 @@ private void checkBackStatus( List<BomNewMbomBackMaterialEntity> backList){
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 申请退回
|
* 申请退回
|
||||||
*
|
*只能退回1020工厂的
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void applyBack(BomNewMbomApplyBackMaterialDTO dto ){
|
public void applyBack(BomNewMbomApplyBackMaterialDTO dto ){
|
||||||
|
|
@ -177,9 +188,16 @@ private void checkBackStatus( List<BomNewMbomBackMaterialEntity> backList){
|
||||||
List<Long> backRowId=rowIds.stream().map(BomNewMbomBackMaterialDTO::getRowId).collect(Collectors.toList());
|
List<Long> backRowId=rowIds.stream().map(BomNewMbomBackMaterialDTO::getRowId).collect(Collectors.toList());
|
||||||
QueryWrapper<BomNewMbomBackMaterialEntity> queryWrapper=new QueryWrapper<>();
|
QueryWrapper<BomNewMbomBackMaterialEntity> queryWrapper=new QueryWrapper<>();
|
||||||
queryWrapper.lambda().in(BomNewMbomBackMaterialEntity::getDetailRowId,backRowId);
|
queryWrapper.lambda().in(BomNewMbomBackMaterialEntity::getDetailRowId,backRowId);
|
||||||
|
queryWrapper.lambda().eq(BomNewMbomBackMaterialEntity::getBackStatus,MBomConstantEnum.MBomBackStatusEnum.REJECT_2.getValue());
|
||||||
List<BomNewMbomBackMaterialEntity> backList=getBaseMapper().selectList(queryWrapper);
|
List<BomNewMbomBackMaterialEntity> backList=getBaseMapper().selectList(queryWrapper);
|
||||||
checkBackStatus(backList);
|
|
||||||
|
if(CollectionUtil.isNotEmpty(backList)){
|
||||||
|
throw new NflgBusinessException(STATE.BusinessError,"选择数据申请退回中或已处理退回");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -192,6 +210,12 @@ private void checkBackStatus( List<BomNewMbomBackMaterialEntity> backList){
|
||||||
throw new NflgBusinessException(STATE.BusinessError,"虚拟包数据不能进行退回");
|
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;
|
String orderNo;
|
||||||
if(CollectionUtil.isNotEmpty(detailEntityList)){
|
if(CollectionUtil.isNotEmpty(detailEntityList)){
|
||||||
|
|
@ -217,8 +241,6 @@ private void checkBackStatus( List<BomNewMbomBackMaterialEntity> backList){
|
||||||
|
|
||||||
for (BomNewMbomBackMaterialEntity item:
|
for (BomNewMbomBackMaterialEntity item:
|
||||||
backMaterialEntityList) {
|
backMaterialEntityList) {
|
||||||
|
|
||||||
|
|
||||||
item.setBackUserName(SessionUtil.getRealName());
|
item.setBackUserName(SessionUtil.getRealName());
|
||||||
item.setBackUserCode(SessionUtil.getUserCode());
|
item.setBackUserCode(SessionUtil.getUserCode());
|
||||||
item.setCreatedTime(LocalDateTime.now());
|
item.setCreatedTime(LocalDateTime.now());
|
||||||
|
|
@ -226,16 +248,17 @@ private void checkBackStatus( List<BomNewMbomBackMaterialEntity> backList){
|
||||||
item.setReasonMsg(dto.getReasonMsg());
|
item.setReasonMsg(dto.getReasonMsg());
|
||||||
item.setOrderNo(orderNo);
|
item.setOrderNo(orderNo);
|
||||||
item.setBackStatus(MBomConstantEnum.MBomBackStatusEnum.APPLY_0.getValue());
|
item.setBackStatus(MBomConstantEnum.MBomBackStatusEnum.APPLY_0.getValue());
|
||||||
if(item.getProjectType().equals(ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.getValue())){
|
if (item.getProjectType().equals(ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.getValue())) {
|
||||||
item.setGroupRowId(SpringUtil.getBean(BomNewMbomDetailService.class).getGroupRowId(item.getDetailRowId()));
|
item.setGroupRowId(SpringUtil.getBean(BomNewMbomDetailService.class).getGroupRowId(item.getDetailRowId()));
|
||||||
}else{
|
} else {
|
||||||
item.setGroupRowId(SpringUtil.getBean(BomNewMbomDetailService.class).getGroupRowId(findRootRowId(item.getDetailRowId())));
|
item.setGroupRowId(SpringUtil.getBean(BomNewMbomDetailService.class).getGroupRowId(findRootRowId(item.getDetailRowId())));
|
||||||
}
|
}
|
||||||
saveBackList.add(beanBack);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
this.save(item);
|
||||||
|
SpringUtil.getBean(BomNewMbomDetailService.class).getBaseMapper().updateBackStatus(item.getGroupRowId(),
|
||||||
|
MBomConstantEnum.MaterialBackStatusEnum.DEAL_1.getValue());
|
||||||
|
|
||||||
this.saveBatch(saveBackList);
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -250,15 +273,16 @@ private void checkBackStatus( List<BomNewMbomBackMaterialEntity> backList){
|
||||||
*/
|
*/
|
||||||
private Long findRootRowId(Long rowId){
|
private Long findRootRowId(Long rowId){
|
||||||
|
|
||||||
|
//向上到根
|
||||||
List<BomNewMbomMiddleVO> childList = SpringUtil.getBean(BomNewMbomParentService.class).getBaseMapper()
|
List<BomNewMbomMiddleVO> childList = SpringUtil.getBean(BomNewMbomParentService.class).getBaseMapper()
|
||||||
.searchList(rowId);
|
.searchList(rowId);
|
||||||
|
|
||||||
|
|
||||||
BomNewMbomMiddleVO root=listToTree(childList);
|
BomNewMbomMiddleVO root=listToTree(childList);
|
||||||
for (;root!=null;) {
|
for (;root!=null;) {
|
||||||
|
//查找根。非虚拟包
|
||||||
if(root.getVirtualPartType()!=null&&
|
if(root.getVirtualPartType()!=null&&
|
||||||
root.getVirtualPartType().intValue()== VirtualPackageTypeEnum.UN_VIRTUAL_PACKAGE.getValue()){
|
root.getVirtualPartType().intValue()== VirtualPackageTypeEnum.UN_VIRTUAL_PACKAGE.getValue().intValue()){
|
||||||
return root.getRowId();
|
return root.getRowId();
|
||||||
}
|
}
|
||||||
if(CollectionUtil.isNotEmpty(root.getChildNodes())){
|
if(CollectionUtil.isNotEmpty(root.getChildNodes())){
|
||||||
|
|
@ -301,57 +325,51 @@ private void checkBackStatus( List<BomNewMbomBackMaterialEntity> backList){
|
||||||
* @param rowIds
|
* @param rowIds
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@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<BomNewMbomBackMaterialEntity> queryWrapper=new QueryWrapper<>();
|
||||||
queryWrapper.lambda().in(BomNewMbomBackMaterialEntity::getRowId,rowIds);
|
queryWrapper.lambda().in(BomNewMbomBackMaterialEntity::getRowId,rowIds);
|
||||||
List<BomNewMbomBackMaterialEntity> backList=getBaseMapper().selectList(queryWrapper);
|
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));
|
||||||
|
|
||||||
//同一个bom下退回的物料
|
|
||||||
Map<Long,List<BomNewMbomBackMaterialEntity>> groupBackMap2=backList.stream().collect(Collectors.groupingBy(BomNewMbomBackMaterialEntity::getBomRowId));
|
|
||||||
|
|
||||||
groupBackMap2.forEach((bomRowId,val)->{
|
for (BomNewMbomBackMaterialEntity item:
|
||||||
|
backList) {
|
||||||
|
|
||||||
BomNewMbomParentEntity parentEntity=SpringUtil.getBean(BomNewMbomParentService.class).getById(bomRowId);
|
BomNewMbomParentEntity parentEntity= SpringUtil.getBean(BomNewMbomParentService.class).getById(item.getBomRowId());
|
||||||
if(parentEntity==null){
|
|
||||||
throw new NflgBusinessException(STATE.BusinessError , StrUtil.format("{} 数据不存在 退回生成异常",bomRowId));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Long> updateSourceIdList=val.stream().map(BomNewMbomBackMaterialEntity::getSourceRowId).collect(Collectors.toList());
|
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(),updateSourceIdList);
|
SpringUtil.getBean(BomNewPbomParentService.class).reConvertToMBom(parentEntity.getSourceRowId(),sourceIds);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//更新状态
|
|
||||||
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);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import com.alibaba.excel.enums.BooleanEnum;
|
import com.alibaba.excel.enums.BooleanEnum;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
|
@ -679,14 +680,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<BomNewPbomChildEntity> updateWrapper = new UpdateWrapper<>();
|
||||||
updateWrapper.lambda().set(BomNewPbomChildEntity::getProductionFactoryCode, backRowId);
|
updateWrapper.lambda().set(BomNewPbomChildEntity::getProductionFactoryCode, FactoryCodeEnum.FACTORY_1010.getValue());
|
||||||
updateWrapper.lambda().in(BomNewPbomChildEntity::getRowId, backRowId);
|
updateWrapper.lambda().in(BomNewPbomChildEntity::getRowId, sourceRowId);
|
||||||
|
|
||||||
|
SpringUtil.getBean(BomNewPbomChildService.class).update(updateWrapper);
|
||||||
|
|
||||||
|
convertToMBomFor1020(bomRowId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,13 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<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 id="getGroupRowId" resultType="java.lang.String">
|
||||||
|
|
@ -74,7 +80,7 @@
|
||||||
, t_bom_new_mbom_detail d
|
, t_bom_new_mbom_detail d
|
||||||
WHERE
|
WHERE
|
||||||
FIND_IN_SET( d.row_id
|
FIND_IN_SET( d.row_id
|
||||||
, dd._ids );
|
, dd._ids )
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<update id="updateBackStatus" >
|
<update id="updateBackStatus" >
|
||||||
|
|
|
||||||
|
|
@ -106,12 +106,12 @@
|
||||||
<!-- </select>-->
|
<!-- </select>-->
|
||||||
|
|
||||||
<select id="getParentChild" resultType="com.nflg.product.bomnew.pojo.vo.BomNewMbomMiddleVO">
|
<select id="getParentChild" resultType="com.nflg.product.bomnew.pojo.vo.BomNewMbomMiddleVO">
|
||||||
select t1.*,IFNULL(t2.back_status,0) as back_status,
|
select t1.*,t2.status,
|
||||||
|
|
||||||
(SELECT count(1) from t_bom_new_mbom_detail where parent_row_id=t1.row_id) as bom_exist
|
(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
|
from t_bom_new_mbom_detail as t1
|
||||||
left join t_bom_new_mbom_back_material as t2
|
left join t_bom_new_mbom_parent as t2
|
||||||
on t1.row_id=t2.detail_row_id
|
on
|
||||||
|
t1.bom_row_id=t2.row_id
|
||||||
where t1.parent_row_id = #{rowId}
|
where t1.parent_row_id = #{rowId}
|
||||||
<if test="bomRowId!=null and bomRowId!=0">
|
<if test="bomRowId!=null and bomRowId!=0">
|
||||||
and t1.bom_row_id=#{bomRowId}
|
and t1.bom_row_id=#{bomRowId}
|
||||||
|
|
@ -161,7 +161,7 @@
|
||||||
<!--向上递归查找-->
|
<!--向上递归查找-->
|
||||||
<select id="searchList" resultType="com.nflg.product.bomnew.pojo.vo.BomNewMbomMiddleVO">
|
<select id="searchList" resultType="com.nflg.product.bomnew.pojo.vo.BomNewMbomMiddleVO">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
select T1.*
|
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 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,
|
FROM (SELECT @r AS _row_id,
|
||||||
(SELECT @r := parent_row_id
|
(SELECT @r := parent_row_id
|
||||||
|
|
@ -174,6 +174,8 @@
|
||||||
JOIN t_bom_new_mbom_detail t2
|
JOIN t_bom_new_mbom_detail t2
|
||||||
ON t1._row_id = t2.row_id
|
ON t1._row_id = t2.row_id
|
||||||
)as T1
|
)as T1
|
||||||
|
left join t_bom_new_mbom_parent as T2
|
||||||
|
on T1.bom_row_id=T2.row_id
|
||||||
|
|
||||||
]]>
|
]]>
|
||||||
</select>
|
</select>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue