This commit is contained in:
parent
76028e0c64
commit
be8b809c6f
|
|
@ -2,8 +2,10 @@ package com.nflg.product.bomnew.service;
|
|||
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
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;
|
||||
|
|
@ -14,11 +16,13 @@ import com.nflg.product.bomnew.pojo.dto.BomNewMbomApplyBackMaterialDTO;
|
|||
import com.nflg.product.bomnew.pojo.dto.BomNewMbomBackMaterialDTO;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewMbomBackMaterialEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewMbomDetailEntity;
|
||||
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 nflg.product.common.constant.STATE;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -136,6 +140,7 @@ public class BomNewMbomBackMaterialService extends ServiceImpl<BomNewMbomBackMat
|
|||
* 确认退回
|
||||
* @param rowIds
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void confirmBack(List<Long> rowIds ){
|
||||
|
||||
QueryWrapper<BomNewMbomBackMaterialEntity> queryWrapper=new QueryWrapper<>();
|
||||
|
|
@ -151,20 +156,45 @@ public class BomNewMbomBackMaterialService extends ServiceImpl<BomNewMbomBackMat
|
|||
throw new NflgBusinessException(STATE.BusinessError,"选择数据存在已驳回");
|
||||
}
|
||||
|
||||
List<BomNewMbomBackMaterialEntity> updateList=new ArrayList<>();
|
||||
rowIds.forEach(id->{
|
||||
BomNewMbomBackMaterialEntity bean=new BomNewMbomBackMaterialEntity();
|
||||
bean.setRowId(id);
|
||||
bean.setBackStatus(MBomConstantEnum.MBomBackStatusEnum.DEAL_1.getValue());
|
||||
bean.setConfirmTime(LocalDateTime.now());
|
||||
bean.setConfirmUserCode(SessionUtil.getUserCode());
|
||||
bean.setConfirmUserName(SessionUtil.getUserName());
|
||||
updateList.add(bean);
|
||||
});
|
||||
if(CollectionUtil.isNotEmpty(updateList)){
|
||||
this.updateBatchById(updateList);
|
||||
//退回逻辑
|
||||
|
||||
//同一个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);
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
|
|||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.lang.TypeReference;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
|
@ -518,6 +519,20 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
|
||||
}
|
||||
|
||||
|
||||
public void reConvertToMBom(Long bomRowId,List<Long> backRowId){
|
||||
|
||||
|
||||
UpdateWrapper<BomNewPbomChildEntity > updateWrapper=new UpdateWrapper<>();
|
||||
updateWrapper.lambda().set(BomNewPbomChildEntity::getProductionFactoryCode,backRowId);
|
||||
updateWrapper.lambda().in(BomNewPbomChildEntity::getRowId,backRowId);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 发布MBOM
|
||||
*/
|
||||
|
|
@ -558,6 +573,8 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 发布Pbom
|
||||
* @param bomRowId
|
||||
|
|
|
|||
|
|
@ -6,21 +6,20 @@ import cn.hutool.core.date.DateUtil;
|
|||
import cn.hutool.core.lang.TypeReference;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.digest.MD5;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||
import com.nflg.product.bomnew.constant.OptionalBomConstant;
|
||||
import com.nflg.product.bomnew.pojo.dto.OptionalEbomPublishAddDTO;
|
||||
import com.nflg.product.bomnew.pojo.entity.*;
|
||||
import com.nflg.product.bomnew.pojo.vo.OptionalEbomImportChildVO;
|
||||
import com.nflg.product.bomnew.service.MaterialService;
|
||||
import com.nflg.product.bomnew.service.OptionalEbomConfigService;
|
||||
import com.nflg.product.bomnew.service.OptionalMbomCompareService;
|
||||
import com.nflg.product.bomnew.service.OptionalMbomMaterialService;
|
||||
import com.nflg.product.bomnew.service.*;
|
||||
import nflg.product.common.constant.STATE;
|
||||
import nflg.product.common.vo.ResultVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -150,6 +149,7 @@ public class PublishMaterialService {
|
|||
// throw new NflgBusinessException(STATE.Error, resultVO.getMsg());
|
||||
// }
|
||||
sendPack.setMaterialNo(data);
|
||||
sendPack.setDrawingNo(sendMaterialName);
|
||||
} catch (Exception e) {
|
||||
throw new NflgBusinessException(STATE.Error, "机型发货," + e.getMessage());
|
||||
}
|
||||
|
|
@ -182,6 +182,7 @@ public class PublishMaterialService {
|
|||
// throw new NflgBusinessException(STATE.Error, resultVO.getMsg());
|
||||
// }
|
||||
makePack.setMaterialNo(data);
|
||||
makePack.setDrawingNo(makeMaterialName);
|
||||
} catch (Exception e) {
|
||||
throw new NflgBusinessException(STATE.Error, "机型制作," + e.getMessage());
|
||||
}
|
||||
|
|
@ -341,6 +342,7 @@ public class PublishMaterialService {
|
|||
// throw new NflgBusinessException(STATE.Error, resultVO.getMsg());
|
||||
// }
|
||||
makePack.setMaterialNo(data);
|
||||
makePack.setDrawingNo(makeMaterialName);
|
||||
} catch (Exception e) {
|
||||
throw new NflgBusinessException(STATE.Error, "电控制作," + e.getMessage());
|
||||
}
|
||||
|
|
@ -371,6 +373,7 @@ public class PublishMaterialService {
|
|||
// throw new NflgBusinessException(STATE.Error, resultVO.getMsg());
|
||||
// }
|
||||
sendPack.setMaterialNo(data);
|
||||
sendPack.setDrawingNo(sendMaterialName);
|
||||
} catch (Exception e) {
|
||||
throw new NflgBusinessException(STATE.Error, "电控发货,"+e.getMessage());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue