|
|
|
@ -10,10 +10,12 @@ import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspection;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspectionDetail;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.rework.MesReworkTask;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesPartInspectionDetailRepository;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesPartInspectionRepository;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesReworkTaskRepository;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
@ -40,6 +42,9 @@ public class MesQmsSuspiciousService extends BaseMesService<MesQmsSuspicious> im
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesReworkTaskRepository mesReworkTaskRepository;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesPartInspectionRepository partInspectionRepository;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void setPackQueryBean(MesQmsSuspicious bean, DdlPackBean packBean) {
|
|
|
|
|
DdlPreparedPack.getStringLikerPack(bean.getPartNo(), "partNo", packBean);
|
|
|
|
@ -58,13 +63,36 @@ public class MesQmsSuspiciousService extends BaseMesService<MesQmsSuspicious> im
|
|
|
|
|
//根据物料对可疑品分组
|
|
|
|
|
for (Map.Entry<String, List<MesPartInspection>> stringListEntry : workOrderPartMap.entrySet()) {
|
|
|
|
|
String key = stringListEntry.getKey();
|
|
|
|
|
List<MesPartInspection> mesPartInspections = stringListEntry.getValue();
|
|
|
|
|
List<MesPartInspection> mesPartInspectionsList = stringListEntry.getValue();
|
|
|
|
|
//修改时间的集合
|
|
|
|
|
List<MesPartInspection> mesPartInspectionsListTime = new ArrayList<>();
|
|
|
|
|
for (MesPartInspection partInspection : mesPartInspectionsList) {
|
|
|
|
|
MesPartInspection partInspectionNew = new MesPartInspection();
|
|
|
|
|
BeanUtils.copyProperties(partInspection, partInspectionNew);
|
|
|
|
|
//去创建日期换算整点2024-07-25 10:00:00
|
|
|
|
|
DdlPackBean packBeanNew = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(partInspection.getPartNo(), "partNo", packBeanNew);
|
|
|
|
|
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)) {
|
|
|
|
|
qmsTime = partInspectionDao.getCreateDatetime().substring(0, 13) + ":00:00";
|
|
|
|
|
}
|
|
|
|
|
partInspectionNew.setInspectionDate(qmsTime);
|
|
|
|
|
mesPartInspectionsListTime.add(partInspectionNew);
|
|
|
|
|
}
|
|
|
|
|
//根据时间分组发送
|
|
|
|
|
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();
|
|
|
|
|
MesPartInspection next = mesPartInspections.iterator().next();
|
|
|
|
|
|
|
|
|
|
//新增一条数据到报废表中
|
|
|
|
|
MesQmsSuspicious mesQmsSuspicious = new MesQmsSuspicious();
|
|
|
|
|
mesQmsSuspicious.setOrganizeCode(organizeCode);
|
|
|
|
|
mesQmsSuspicious.setInspectionDate(next.getInspectionDate());
|
|
|
|
|
|
|
|
|
|
//检验数量是全部数量汇总
|
|
|
|
|
double sumQty = mesPartInspections.stream().mapToDouble(MesPartInspection::getQty).sum();
|
|
|
|
|
mesQmsSuspicious.setInspectionQty((int) sumQty);
|
|
|
|
@ -131,5 +159,7 @@ public class MesQmsSuspiciousService extends BaseMesService<MesQmsSuspicious> im
|
|
|
|
|
|
|
|
|
|
baseRDao.insert(mesQmsSuspicious);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|