|
|
|
@ -53,6 +53,7 @@ import com.spring.modules.part.service.PartInformationService; |
|
|
|
import com.spring.modules.part.util.UtilsClass; |
|
|
|
import com.spring.modules.part.vo.*; |
|
|
|
import com.spring.modules.project.data.PlmProjectPartData; |
|
|
|
import com.spring.modules.project.dao.ProjectDao; |
|
|
|
import com.spring.modules.proofing.mapper.ProofingInformationMapper; |
|
|
|
import com.spring.modules.proofing.service.ProofingInformationService; |
|
|
|
import com.spring.modules.proofing.vo.ProofingInformationVo; |
|
|
|
@ -171,6 +172,9 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe |
|
|
|
@Autowired |
|
|
|
private TechnicalClassBean technicalClassBean; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ProjectDao projectDao; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private PartCatalogDao partCatalogDao; |
|
|
|
|
|
|
|
@ -741,6 +745,7 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe |
|
|
|
partInformationMapper.saveProjectPart(data); |
|
|
|
// 新增客户料号信息 |
|
|
|
partInformationMapper.saveCustomerPartInfo(data); |
|
|
|
resetCompletedProjectIfTemporaryPartAdded(data.getSite(), data.getProjectId(), data.getCreateBy(), isTemporaryPart(data.getSite(), data)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@ -2888,6 +2893,7 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public Map<String, Object> addProjectPart(PlmProjectPartData data) { |
|
|
|
List<PartInformationVo> partList = data.getPartList().stream().map(a -> { |
|
|
|
a.setProjectId(data.getProjectId()); |
|
|
|
@ -2895,6 +2901,8 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe |
|
|
|
return a; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
partInformationMapper.addProjectPart(partList); |
|
|
|
String site = resolveProjectPartSite(data, partList); |
|
|
|
resetCompletedProjectIfTemporaryPartAdded(site, data.getProjectId(), data.getCreateBy(), containsTemporaryPart(site, partList)); |
|
|
|
//List<PartInformationVo> row1 = partInformationMapper.getProjectPartList1(data); |
|
|
|
List<PartInformationVo> row2 = partInformationMapper.getProjectPartList2(data); |
|
|
|
HashMap<String, Object> map = new HashMap<>(); |
|
|
|
@ -2919,6 +2927,8 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe |
|
|
|
return a; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
partInformationMapper.addProjectPart(partList); |
|
|
|
String site = resolveProjectPartSite(data, partList); |
|
|
|
resetCompletedProjectIfTemporaryPartAdded(site, data.getProjectId(), data.getCreateBy(), containsTemporaryPart(site, partList)); |
|
|
|
// 校验是否已经有了客户物料 没有则新增 |
|
|
|
|
|
|
|
List<PartInformationVo> customerPartToAdd = partList.stream() |
|
|
|
@ -5657,6 +5667,52 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private String resolveProjectPartSite(PlmProjectPartData data, List<PartInformationVo> partList) { |
|
|
|
if (data != null && StringUtils.hasText(data.getSite())) { |
|
|
|
return data.getSite(); |
|
|
|
} |
|
|
|
if (partList != null) { |
|
|
|
for (PartInformationVo part : partList) { |
|
|
|
if (part != null && StringUtils.hasText(part.getSite())) { |
|
|
|
return part.getSite(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
private boolean containsTemporaryPart(String site, List<PartInformationVo> partList) { |
|
|
|
if (partList == null || partList.isEmpty()) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
for (PartInformationVo part : partList) { |
|
|
|
if (isTemporaryPart(site, part)) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
private boolean isTemporaryPart(String site, PartInformationVo part) { |
|
|
|
if (part == null) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
String status = part.getStatus(); |
|
|
|
if (!StringUtils.hasText(status) && StringUtils.hasText(site) && StringUtils.hasText(part.getPartNo())) { |
|
|
|
PartInformationEntity dbPart = partInformationMapper.selectOne( |
|
|
|
new QueryWrapper<PartInformationEntity>().eq("site", site).eq("part_no", part.getPartNo())); |
|
|
|
status = dbPart == null ? null : dbPart.getStatus(); |
|
|
|
} |
|
|
|
return "N".equals(status); |
|
|
|
} |
|
|
|
|
|
|
|
private void resetCompletedProjectIfTemporaryPartAdded(String site, String projectId, String updateBy, boolean hasTemporaryPart) { |
|
|
|
if (!hasTemporaryPart || !StringUtils.hasText(site) || !StringUtils.hasText(projectId)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
projectDao.resetCompletedProjectToDraft(site, projectId, updateBy); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|