42221 单件条码返工后报废

tags/yfai-mes-ext-v1.0
gsz 10 months ago
parent b5a0c0d81a
commit 065b4241d9

@ -19,6 +19,9 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.CollectionUtils;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -68,14 +71,34 @@ public class MesQmsSuspiciousJob extends BaseMesScheduleJob {
//获取前一天的所有ncStatus=40报废状态下可疑品缺陷
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
//按天执行前一天的所有可疑记录
//按小时 条码+物料出现过一次 就排除当前时间段
// DdlPreparedPack.getNumEqualPack(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), "systemSyncStatus", packBean);
DdlPreparedPack.timeBuilder(
new SimpleDateFormat("yyyy-MM-dd").format(TimeTool.getDateBefore(new Date(), 1)) + " 00:00:00",
TimeTool.getToday() + " 00:00:00", "createDatetime", packBean, true);
// DdlPreparedPack.timeBuilder(
// new SimpleDateFormat("yyyy-MM-dd").format(TimeTool.getDateBefore(new Date(), 1)) + " 00:00:00",
// TimeTool.getToday() + " 00:00:00", "createDatetime", packBean, true);
// 获取当前时间前1小时的时间
LocalDateTime now = LocalDateTime.now();
LocalDateTime oneHourAgo = now.minusHours(1);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String formattedNow = now.format(formatter);
String formattedOneHourAgo = oneHourAgo.format(formatter);
DdlPreparedPack.timeBuilder(formattedOneHourAgo ,formattedNow, "createDatetime", packBean, true);
List<MesPartInspection> mesPartInspectionList = partInspectionRepository.findByHqlWhere(packBean);
if (!CollectionUtils.isEmpty(mesPartInspectionList)) {
qmsSuspiciousService.doQmsSuspiciousByPartInspection(mesPartInspectionList,organizeCode);
//过滤掉已经汇总的
List<MesPartInspection> partInspectionList = new ArrayList<>();
for (MesPartInspection mesPartInspection : mesPartInspectionList) {
DdlPackBean packBeanNew = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getStringLikerPack(mesPartInspection.getPartNo(), "partNo", packBeanNew);
DdlPreparedPack.getStringLikerPack(mesPartInspection.getSn(), "sn", packBeanNew);
boolean flg = partInspectionRepository.isExitByHql(packBeanNew);
if (!flg) {
partInspectionList.add(mesPartInspection);
}
}
qmsSuspiciousService.doQmsSuspiciousByPartInspection(partInspectionList,organizeCode);
for (MesPartInspection mesPartInspection : mesPartInspectionList) {
mesPartInspection.setSystemSyncStatus(1);

Loading…
Cancel
Save