| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.*; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.aps.common.core.utils.uuid.IdUtils; |
| | | import com.aps.common.security.utils.SecurityUtils; |
| | | import com.aps.core.domain.ApsPlate.ApsPlateStandardRequireBomOrderDetail; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.aps.core.mapper.ApsPlateProcessStatMapper; |
| | |
| | | /** |
| | | * 保存钣金统计数据 |
| | | */ |
| | | @Transactional |
| | | @Override |
| | | public void savePlateProcessStat() { |
| | | public List<ApsPlateProcessStat> computePlateProcessStat() { |
| | | String batchNum = IdUtils.fastSimpleUUID(); |
| | | List<ApsPlateProcessStat> tempList = apsPlateProcessStatMapper.queryTempStat(); |
| | | Map<String, List<ApsPlateProcessStat>> groupByOrderNo = tempList.stream().collect(groupingBy(ApsPlateProcessStat::getWorkOrderNo)); |
| | | Boolean hasBefore = false; |
| | | |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | for (Map.Entry<String, List<ApsPlateProcessStat>> entry : groupByOrderNo.entrySet()) { |
| | | List<ApsPlateProcessStat> statPerOrder = entry.getValue(); |
| | | List<ApsPlateProcessStat> totalList=new ArrayList<>(); |
| | | ArrayList<Map.Entry<String, List<ApsPlateProcessStat>>> orderProcessRoutes = new ArrayList<>(groupByOrderNo.entrySet()); |
| | | orderProcessRoutes.stream().parallel().forEach(x->{ |
| | | boolean hasBefore = false; |
| | | List<ApsPlateProcessStat> statPerOrder = x.getValue(); |
| | | /*num 为根据完工时间排序出的序号,按此排序,可保证是按完工时间倒叙排列*/ |
| | | statPerOrder.sort((a, b)->a.getNum().compareTo(b.getNum())); |
| | | ApsPlateProcessStat last=null; |
| | |
| | | } |
| | | } |
| | | last = stat; |
| | | apsPlateProcessStatMapper.insertApsPlateProcessStat(stat); |
| | | totalList.add(stat); |
| | | } |
| | | hasBefore=false; |
| | | |
| | | } |
| | | apsPlateProcessStatMapper.removeOtherStat(batchNum); |
| | | |
| | | }); |
| | | return totalList; |
| | | } |
| | | |
| | | |