| | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.*; |
| | |
| | | import com.aps.core.domain.ApsPartPlan; |
| | | import com.aps.core.domain.ApsResourceDateStat; |
| | | import com.aps.core.domain.ApsResourceGroup; |
| | | import com.aps.core.mapper.ApsAbnormalProcessAnalysisMapper; |
| | | import com.aps.core.mapper.ApsResourceGroupMapper; |
| | | import com.aps.core.service.IApsAbnormalProcessAnalysisService; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.poi.ss.usermodel.*; |
| | | import org.apache.poi.ss.util.CellRangeAddress; |
| | | import org.apache.poi.util.IOUtils; |
| | | import org.apache.poi.util.Removal; |
| | | import org.apache.poi.xssf.streaming.SXSSFCell; |
| | | import org.apache.poi.xssf.streaming.SXSSFRow; |
| | | import org.apache.poi.xssf.streaming.SXSSFSheet; |
| | |
| | | private ApsResourceGroupMapper resourceGroupMapper; |
| | | @Autowired |
| | | private ApsResourceGroupMapper apsResourceGroupMapper; |
| | | |
| | | @Resource |
| | | private IApsAbnormalProcessAnalysisService analysisService; |
| | | |
| | | /** |
| | | * 查询零件统计表 |
| | |
| | | /*判断当前工序 当前工序只有一条*/ |
| | | if (stat.getCurrentProcessNumber().equals(stat.getRoadProcessNumber())) { |
| | | /* 对 stat.getProcessPlanStartDay() 和当前日期 进行对比,只对比到日,不用管十分秒*/ |
| | | if (stat.getProcessPlanStartDay().toLocalDate().isBefore(LocalDateTime.now().toLocalDate())) { |
| | | stat.setProcessPlanStartDay(LocalDateTime.now()); |
| | | LocalDate startLocalDate = LocalDate.ofInstant(stat.getProcessPlanStartDay().toInstant(), ZoneId.systemDefault()); |
| | | LocalDate nowLocalDate = LocalDate.now(); |
| | | if (startLocalDate.isBefore(nowLocalDate)) { |
| | | stat.setProcessPlanStartDay(new Date()); |
| | | } |
| | | } |
| | | /*未开工工序的计划开工日=上一道工序的计划开工日+上一道工序的工序总工时。*/ |
| | | if (stat.getCurrentProcessNumber().compareTo(stat.getRoadProcessNumber()) < 0) { |
| | | if (last != null) { |
| | | stat.setProcessPlanStartDay(last.getProcessPlanStartDay().plusHours(last.getProcessTotalTime())); |
| | | LocalDateTime lastStartDate = LocalDateTime.ofInstant(last.getProcessPlanStartDay().toInstant(), ZoneId.systemDefault()); |
| | | lastStartDate.plusHours(last.getProcessTotalTime().longValue()); |
| | | stat.setProcessPlanStartDay(Date.from(lastStartDate.atZone(ZoneId.systemDefault()).toInstant())); |
| | | } |
| | | } |
| | | /*保存上一步计算的 开工日*/ |
| | |
| | | } |
| | | } |
| | | apsPartRouteStatMapper.deleteLastBatch(batchNum); |
| | | /*计算并保存 工序异常信息*/ |
| | | analysisService.batchSaveAbnormalInfo(); |
| | | } |
| | | /** 查询资源日历表 |
| | | */ |