42692 MES:可疑品汇总逻辑更新

tags/yfai-mes-ext-v1.6
gsz 9 months ago
parent d4a3b131df
commit 3006fc0d13

@ -81,7 +81,7 @@ public class MesQmsScrapJob extends BaseMesScheduleJob {
List<MesPartInspection> mesPartInspectionList = partInspectionRepository.findByHqlWhere(packBean);
if (!CollectionUtils.isEmpty(mesPartInspectionList)) {
qmsScrapService.doQmsScrapByPartInspection(mesPartInspectionList,organizeCode);
qmsScrapService.doQmsScrapByPartInspection(mesPartInspectionList, organizeCode);
for (MesPartInspection mesPartInspection : mesPartInspectionList) {
mesPartInspection.setSystemSyncStatus(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());

@ -91,15 +91,24 @@ public class MesQmsSuspiciousJob extends BaseMesScheduleJob {
if (!CollectionUtils.isEmpty(mesPartInspectionList)) {
//过滤掉已经汇总的
List<MesPartInspection> partInspectionList = new ArrayList<>();
//排序取未同步的一条最早的
Map<String, List<MesPartInspection>> partMap = mesPartInspectionList.stream().collect(Collectors.groupingBy(p -> p.getSn() + "-" + p.getPartNo()));
for (Map.Entry<String, List<MesPartInspection>> stringListEntry : partMap.entrySet()) {
//排序取单件逻辑未同步的一条最新的
Map<String, List<MesPartInspection>> partSnMap = mesPartInspectionList.stream()
.filter(p -> p.getSourceType() == 10)
.collect(Collectors.groupingBy(p -> p.getSn() + "-" + p.getPartNo()));
for (Map.Entry<String, List<MesPartInspection>> stringListEntry : partSnMap.entrySet()) {
List<MesPartInspection> value = stringListEntry.getValue();
MesPartInspection next = value.stream().sorted(Comparator.comparing(MesPartInspection::getCreateDatetime).reversed()).iterator().next();
partInspectionList.add(next);
}
LOGGER.info("MES可疑品汇总 ----- partInspectionList{}",partInspectionList.size());
//批次逻辑的全部汇总数量 42692 MES:可疑品汇总逻辑更新
Map<String, List<MesPartInspection>> partMap = mesPartInspectionList.stream()
.filter(p -> p.getSourceType() == 20)
.collect(Collectors.groupingBy(MesPartInspection::getPartNo));
for (Map.Entry<String, List<MesPartInspection>> stringListEntry : partMap.entrySet()) {
partInspectionList.addAll(stringListEntry.getValue());
}
LOGGER.info("MES可疑品汇总 ----- partInspectionList{}", partInspectionList.size());
qmsSuspiciousService.doQmsSuspiciousByPartInspection(partInspectionList, organizeCode);
for (MesPartInspection mesPartInspection : mesPartInspectionList) {

@ -29,6 +29,7 @@ import java.util.stream.Collectors;
public class MesQmsScrapService extends BaseMesService<MesQmsScrap> implements IMesQmsScrapService {
@Autowired
private MesPartInspectionDetailRepository partInspectionDetailRDao;
@Override
protected void setPackQueryBean(MesQmsScrap bean, DdlPackBean packBean) {
DdlPreparedPack.getStringLikerPack(bean.getPartNo(), "partNo", packBean);
@ -49,7 +50,7 @@ public class MesQmsScrapService extends BaseMesService<MesQmsScrap> implements I
String key = stringListEntry.getKey();
List<MesPartInspection> mesPartInspections = stringListEntry.getValue();
MesPartInspection next = mesPartInspections.iterator().next();
List<MesPartInspectionDetail> mesPartInspectionDetails=new ArrayList<>();
List<MesPartInspectionDetail> mesPartInspectionDetails = new ArrayList<>();
for (MesPartInspection mesPartInspection : mesPartInspections) {
mesPartInspectionDetails.addAll(idDetailListMap.get(mesPartInspection.getId()));
}
@ -67,7 +68,7 @@ public class MesQmsScrapService extends BaseMesService<MesQmsScrap> implements I
mesQmsScrap.setDefectTypeName(defectTypeName);
mesQmsScrap.setReponsibilityId(next.getResponsibleParty());
mesQmsScrap.setNcJudger(next.getModifyUser());
ConvertBean.serviceModelInitialize(mesQmsScrap,"MesScrapJob");
ConvertBean.serviceModelInitialize(mesQmsScrap, "MesScrapJob");
baseRDao.insert(mesQmsScrap);
}

@ -75,14 +75,26 @@ public class MesQmsSuspiciousService extends BaseMesService<MesQmsSuspicious> im
DdlPreparedPack.getStringEqualPack(partInspection.getSn(), "sn", packBeanNew);
packBeanNew.setOrderByStr(" order by createDatetime ");
MesPartInspection partInspectionDao = partInspectionRepository.getByProperty(packBeanNew);
//检验日期年月日可以根据创建日期截取,批次的不用取最早出现的
String qmsTime = partInspection.getCreateDatetime().substring(0, 13) + ":00:00";
if (!StringUtil.isEmpty(partInspectionDao)) {
if (!StringUtil.isEmpty(partInspectionDao) && partInspection.getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()) {
qmsTime = partInspectionDao.getCreateDatetime().substring(0, 13) + ":00:00";
}
partInspectionNew.setInspectionDate(qmsTime);
mesPartInspectionsListTime.add(partInspectionNew);
}
//根据时间分组发送
// 批次的:
//A 2024-08-21 08:00 10
//A 2024-08-21 08:00 10
//B 2024-08-20 08:00 10 检验日期 2024-08-21 08:00
//B 2024-08-21 08:00 10 检验日期 2024-08-21 08:00
//单件的:
//A 2024-08-21 08:00 1 0 0 1
//
//qms汇总表=====
//A 2024-08-21 08:00 21 0 0 1
//B 2024-08-21 08:00 20
Map<String, List<MesPartInspection>> mesPartInspectionsMap = mesPartInspectionsListTime.stream().collect(Collectors.groupingBy(MesPartInspection::getInspectionDate));
for (Map.Entry<String, List<MesPartInspection>> partInspection : mesPartInspectionsMap.entrySet()) {
List<MesPartInspection> mesPartInspections = partInspection.getValue();
@ -143,7 +155,7 @@ public class MesQmsSuspiciousService extends BaseMesService<MesQmsSuspicious> im
mesQmsSuspicious.setReworkScrapped(0);
mesQmsSuspicious.setPartNo(key);
mesQmsSuspicious.setPartName(next.getPartName());
//缺陷分类缺陷数量JOSN格式:
//缺陷分类缺陷数量JOSN格式:【批次&单件数量汇总时需要根据检验时间段合并】
//[{"Defect_Name":"缺陷01","Defect_Qty":1},{"Defect_Name":"缺陷02","Defect_Qty":2}]
Map<String, List<MesPartInspectionDetail>> listDefectMap = mesPartInspectionDetails.stream().collect(Collectors.groupingBy(MesPartInspectionDetail::getDefectTypeName));
List<Map<String, Object>> defectsList = new ArrayList<>();

Loading…
Cancel
Save