|
|
|
|
@ -89,38 +89,38 @@ public class DsPartServiceImpl extends BaseServiceImpl<DsPartMapper, DsPartEntit |
|
|
|
|
public IPage<DsPartVO> selectDsPartPage(IPage<DsPartVO> page, DsPartVO dsPart) { |
|
|
|
|
|
|
|
|
|
List<Long> partIds = null; |
|
|
|
|
if(null != dsPart.getProjectCode()){ |
|
|
|
|
if (null != dsPart.getProjectCode()) { |
|
|
|
|
//查询工序项目
|
|
|
|
|
List<DsProcessProjectEntity> processProjectEntities = processProjectService.selectDsProcessProjectByProcessCode(dsPart.getProjectCode()); |
|
|
|
|
if(!CollectionUtils.isEmpty(processProjectEntities)){ |
|
|
|
|
if (!CollectionUtils.isEmpty(processProjectEntities)) { |
|
|
|
|
List<Long> processIds = processProjectEntities.stream().map(DsProcessProjectEntity::getProcessId).collect(Collectors.toList()); |
|
|
|
|
//查询零件工艺工序信息
|
|
|
|
|
List<DsProcessEntity> processList = processService.selectDsProcessByIds(processIds); |
|
|
|
|
if(!CollectionUtils.isEmpty(processList)){ |
|
|
|
|
if (!CollectionUtils.isEmpty(processList)) { |
|
|
|
|
List<Long> craftIds = processList.stream().map(DsProcessEntity::getCraftId).collect(Collectors.toList()); |
|
|
|
|
List<DsCraftEntity> craftList = craftService.selectDsCraftByIds(craftIds); |
|
|
|
|
if(!CollectionUtils.isEmpty(craftList)){ |
|
|
|
|
partIds = craftList.stream().map(DsCraftEntity::getPartId).collect(Collectors.toList()); |
|
|
|
|
if (!CollectionUtils.isEmpty(craftList)) { |
|
|
|
|
partIds = craftList.stream().map(DsCraftEntity::getPartId).collect(Collectors.toList()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if(null != partIds){ |
|
|
|
|
if (null != partIds) { |
|
|
|
|
dsPart.setPartIds(partIds); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<DsPartVO> dsPartVOS = baseMapper.selectDsPartPage(page, dsPart); |
|
|
|
|
if(!CollectionUtils.isEmpty(dsPartVOS)){ |
|
|
|
|
if (!CollectionUtils.isEmpty(dsPartVOS)) { |
|
|
|
|
for (DsPartVO dsPartVO : dsPartVOS) { |
|
|
|
|
dsPartVO.setUpdateUserStr(userClient.userInfo(Func.toLong(dsPartVO.getUpdateUser())).getData().getUser().getName()); |
|
|
|
|
String isSintering = dsPartVO.getIsSintering(); |
|
|
|
|
if(TaskingConstant.IS_SINTERING.equals(isSintering)){ |
|
|
|
|
if (TaskingConstant.IS_SINTERING.equals(isSintering)) { |
|
|
|
|
//查询子件信息
|
|
|
|
|
List<DsPartRelationEntity> partRelationEntityList = partRelationService.selectDsPartRelationByPartId(dsPartVO.getId()); |
|
|
|
|
//获取所有子件ID
|
|
|
|
|
List<Long> idList = partRelationEntityList.stream().map(DsPartRelationEntity::getChildPartId).collect(Collectors.toList()); |
|
|
|
|
if(!CollectionUtils.isEmpty(idList)){ |
|
|
|
|
if (!CollectionUtils.isEmpty(idList)) { |
|
|
|
|
List<DsPartVersionVO> dsPartEntityList = dsPartMapper.selectDsPartVersionByIds(idList); |
|
|
|
|
for (DsPartVersionVO dsPartVersionVO : dsPartEntityList) { |
|
|
|
|
dsPartVersionVO.setUpdateUserStr(userClient.userInfo(Func.toLong(dsPartVersionVO.getUpdateUser())).getData().getUser().getName()); |
|
|
|
|
@ -149,9 +149,9 @@ public class DsPartServiceImpl extends BaseServiceImpl<DsPartMapper, DsPartEntit |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public DsPartEntity selectDsPartByPatCodeAndVersion(String partCode,String version) { |
|
|
|
|
public DsPartEntity selectDsPartByPatCodeAndVersion(String partCode, String version) { |
|
|
|
|
//查询最新版本号 对应的零件
|
|
|
|
|
if(StringUtils.isEmpty(version)){ |
|
|
|
|
if (StringUtils.isEmpty(version)) { |
|
|
|
|
List<DsPartVersionEntity> partVersionEntityList = partVersionService.selectByPartCode(partCode); |
|
|
|
|
Optional<DsPartVersionEntity> maxEntity = partVersionEntityList.stream() |
|
|
|
|
.filter(entity -> entity.getPartVersion() != null) |
|
|
|
|
@ -164,15 +164,15 @@ public class DsPartServiceImpl extends BaseServiceImpl<DsPartMapper, DsPartEntit |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
DsPartEntity part = dsPartMapper.selectByPartCodeAndVersion(partCode,version); |
|
|
|
|
DsPartEntity part = dsPartMapper.selectByPartCodeAndVersion(partCode, version); |
|
|
|
|
|
|
|
|
|
return part; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<DsPartEntity> selectDsPartByPatCode(String partCode, Integer sinTerType) { |
|
|
|
|
LambdaQueryWrapper<DsPartEntity> queryWrapper = Wrappers.lambdaQuery(DsPartEntity.class) |
|
|
|
|
.eq(DsPartEntity::getPartCode, partCode); |
|
|
|
|
LambdaQueryWrapper<DsPartEntity> queryWrapper = Wrappers.lambdaQuery(DsPartEntity.class) |
|
|
|
|
.eq(DsPartEntity::getPartCode, partCode); |
|
|
|
|
|
|
|
|
|
if (Func.isNotEmpty(sinTerType)) { |
|
|
|
|
queryWrapper.eq(DsPartEntity::getSinTerType, sinTerType); |
|
|
|
|
@ -194,7 +194,7 @@ public class DsPartServiceImpl extends BaseServiceImpl<DsPartMapper, DsPartEntit |
|
|
|
|
// 查询零件信息
|
|
|
|
|
Date startDate = DateUtils.getPreviousDayStartDate(1); |
|
|
|
|
Date endDate = DateUtils.getPreviousDayEndDate(1); |
|
|
|
|
List<DsPartEntity> partList = dsPartMapper.selectPartByDate(startDate,endDate); |
|
|
|
|
List<DsPartEntity> partList = dsPartMapper.selectPartByDate(startDate, endDate); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
@ -208,7 +208,7 @@ public class DsPartServiceImpl extends BaseServiceImpl<DsPartMapper, DsPartEntit |
|
|
|
|
// 2. 加三天
|
|
|
|
|
LocalDate futureDate = currentDate.plusDays(TaskingConstant.PART_EARLY_WARNING); |
|
|
|
|
//查询即将过期的零件信息
|
|
|
|
|
List<DsPartEntity> dsPartEntityList = dsPartMapper.selectDsPartLoseEfficacy(currentDate,futureDate); |
|
|
|
|
List<DsPartEntity> dsPartEntityList = dsPartMapper.selectDsPartLoseEfficacy(currentDate, futureDate); |
|
|
|
|
for (DsPartEntity partEntity : dsPartEntityList) { |
|
|
|
|
//获取工艺员
|
|
|
|
|
String technician = partEntity.getTechnician(); |
|
|
|
|
@ -229,7 +229,7 @@ public class DsPartServiceImpl extends BaseServiceImpl<DsPartMapper, DsPartEntit |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean updateNextDueByIds(String nextDue, List<Long> Ids) { |
|
|
|
|
return dsPartMapper.updateNextDueByIds(nextDue,Ids); |
|
|
|
|
return dsPartMapper.updateNextDueByIds(nextDue, Ids); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -245,7 +245,7 @@ public class DsPartServiceImpl extends BaseServiceImpl<DsPartMapper, DsPartEntit |
|
|
|
|
// 格式化输出
|
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
|
|
|
|
|
|
|
|
|
List<DsCraftExpireVO> expireVOList = dsPartMapper.selectDsPartByNextDue(currentDate,futureDate); |
|
|
|
|
List<DsCraftExpireVO> expireVOList = dsPartMapper.selectDsPartByNextDue(currentDate, futureDate); |
|
|
|
|
|
|
|
|
|
return expireVOList; |
|
|
|
|
} |
|
|
|
|
@ -253,7 +253,7 @@ public class DsPartServiceImpl extends BaseServiceImpl<DsPartMapper, DsPartEntit |
|
|
|
|
@Override |
|
|
|
|
public boolean updateNextDueByIds(String nextDue, String ids) { |
|
|
|
|
List<DsPartEntity> partEntityList = dsPartMapper.selectDsPartByIds(Func.toLongList(ids)); |
|
|
|
|
if(CollectionUtils.isEmpty(partEntityList)){ |
|
|
|
|
if (CollectionUtils.isEmpty(partEntityList)) { |
|
|
|
|
throw new NullPointerException("零件信息为空"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -263,8 +263,8 @@ public class DsPartServiceImpl extends BaseServiceImpl<DsPartMapper, DsPartEntit |
|
|
|
|
Date date1 = formatter.parse(nextDue); |
|
|
|
|
Date date2 = partEntity.getNextDue(); |
|
|
|
|
int num = compareDateOnly(date1, date2); |
|
|
|
|
if(num<=0){ |
|
|
|
|
throw new ServiceException(partEntity.getPartCode()+"到期日期错误 :小于之前到期日期"); |
|
|
|
|
if (num <= 0) { |
|
|
|
|
throw new ServiceException(partEntity.getPartCode() + "到期日期错误 :小于之前到期日期"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} catch (ParseException e) { |
|
|
|
|
@ -283,12 +283,12 @@ public class DsPartServiceImpl extends BaseServiceImpl<DsPartMapper, DsPartEntit |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<DsPartBomVO> sinteringPart(String bPartCode, String zPartCode) { |
|
|
|
|
if(!StringUtils.isEmpty(bPartCode) && !StringUtils.isEmpty(zPartCode)){ |
|
|
|
|
return partRelationService.selectDsPartRelationByPartCodeAndChildPartCode(bPartCode,zPartCode); |
|
|
|
|
if (!StringUtils.isEmpty(bPartCode) && !StringUtils.isEmpty(zPartCode)) { |
|
|
|
|
return partRelationService.selectDsPartRelationByPartCodeAndChildPartCode(bPartCode, zPartCode); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(!StringUtils.isEmpty(zPartCode)){ |
|
|
|
|
return partRelationService.selectDsPartRelationByPartCodeAndChildPartCode(null,zPartCode); |
|
|
|
|
if (!StringUtils.isEmpty(zPartCode)) { |
|
|
|
|
return partRelationService.selectDsPartRelationByPartCodeAndChildPartCode(null, zPartCode); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
@ -310,12 +310,12 @@ public class DsPartServiceImpl extends BaseServiceImpl<DsPartMapper, DsPartEntit |
|
|
|
|
@Override |
|
|
|
|
public boolean updateDsPart(DsPartEntity dsPart, List<DsPartEntity> zPartList) { |
|
|
|
|
|
|
|
|
|
DsPartEntity partEntity = dsPartMapper.selectDsPartByPartIdAndPartCode(dsPart.getId(),dsPart.getPartCode()); |
|
|
|
|
if(null == partEntity){ |
|
|
|
|
DsPartEntity partEntity = dsPartMapper.selectDsPartByPartIdAndPartCode(dsPart.getId(), dsPart.getPartCode()); |
|
|
|
|
if (null == partEntity) { |
|
|
|
|
throw new ServiceException("零件ID与零件号有误"); |
|
|
|
|
} |
|
|
|
|
Long userId = AuthUtil.getUser().getUserId(); |
|
|
|
|
if(null != dsPart.getExpirationPeriod()){ |
|
|
|
|
if (null != dsPart.getExpirationPeriod()) { |
|
|
|
|
//到期时间
|
|
|
|
|
Date futureDate = addDaysToCurrentDate(dsPart.getExpirationPeriod().intValue()); |
|
|
|
|
dsPart.setNextDue(futureDate); |
|
|
|
|
@ -325,27 +325,26 @@ public class DsPartServiceImpl extends BaseServiceImpl<DsPartMapper, DsPartEntit |
|
|
|
|
dsPart.setPfStatus(TaskingConstant.STATUS_NEW); |
|
|
|
|
updateById(dsPart); |
|
|
|
|
if (!TaskingConstant.IS_SINTERING.equals(dsPart.getIsSintering())) { |
|
|
|
|
if((org.apache.commons.lang3.StringUtils.isNotBlank(dsPart.getCraftWay()) && dsPart.getCraftWay().contains("4"))) { |
|
|
|
|
if ((org.apache.commons.lang3.StringUtils.isNotBlank(dsPart.getCraftWay()) && dsPart.getCraftWay().contains("4"))) { |
|
|
|
|
getErpDataPartClient().sendingPartGiveErp(dsPart); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if(!CollectionUtils.isEmpty(zPartList)){ |
|
|
|
|
if (!CollectionUtils.isEmpty(zPartList)) { |
|
|
|
|
updateBatchById(zPartList); |
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public DsPartSynthesisVO detail(String partCode, String partVersion) { |
|
|
|
|
|
|
|
|
|
DsPartVersionEntity partVersionEntity = partVersionService.selectByPartCodeAndPartVersion(partCode,partVersion); |
|
|
|
|
DsPartVersionEntity partVersionEntity = partVersionService.selectByPartCodeAndPartVersion(partCode, partVersion); |
|
|
|
|
//零件信息
|
|
|
|
|
DsPartEntity partEntity = dsPartMapper.selectById(partVersionEntity.getPartId()); |
|
|
|
|
DsPartSynthesisVO dsPartSynthesisVO = new DsPartSynthesisVO(); |
|
|
|
|
//查询子件信息
|
|
|
|
|
if(TaskingConstant.IS_SINTERING.equals(partEntity.getIsSintering())){ |
|
|
|
|
if (TaskingConstant.IS_SINTERING.equals(partEntity.getIsSintering())) { |
|
|
|
|
List<DsPartRelationEntity> partRelationEntityList = partRelationService.selectDsPartRelationByPartId(partEntity.getId()); |
|
|
|
|
List<Long> idList = partRelationEntityList.stream() |
|
|
|
|
.map(DsPartRelationEntity::getChildPartId) |
|
|
|
|
@ -474,11 +473,11 @@ public class DsPartServiceImpl extends BaseServiceImpl<DsPartMapper, DsPartEntit |
|
|
|
|
|
|
|
|
|
public int compareDateOnly(Date date1, Date date2) { |
|
|
|
|
LocalDate localDate1 = date1.toInstant() |
|
|
|
|
.atZone(ZoneId.systemDefault()) |
|
|
|
|
.toLocalDate(); |
|
|
|
|
.atZone(ZoneId.systemDefault()) |
|
|
|
|
.toLocalDate(); |
|
|
|
|
LocalDate localDate2 = date2.toInstant() |
|
|
|
|
.atZone(ZoneId.systemDefault()) |
|
|
|
|
.toLocalDate(); |
|
|
|
|
.atZone(ZoneId.systemDefault()) |
|
|
|
|
.toLocalDate(); |
|
|
|
|
|
|
|
|
|
return localDate1.compareTo(localDate2); |
|
|
|
|
} |
|
|
|
|
@ -491,6 +490,7 @@ public class DsPartServiceImpl extends BaseServiceImpl<DsPartMapper, DsPartEntit |
|
|
|
|
// sb.append(" ) b where rownum=1 ");
|
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public String findNameByRoamNo(String partCode, String roamNo) { |
|
|
|
|
//TODO 到ERP数据中查询数据
|
|
|
|
|
@ -498,4 +498,15 @@ public class DsPartServiceImpl extends BaseServiceImpl<DsPartMapper, DsPartEntit |
|
|
|
|
// sb.append(" where a.prtno=:partCode and a.firseq=:roamNo ");
|
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 根据零件号查询零件 |
|
|
|
|
* |
|
|
|
|
* @param partCode |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public DsPartEntity selectDsPartByPatCode(String partCode) { |
|
|
|
|
return dsPartMapper.selectDsPartByPatCode(partCode); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|