| | |
| | | import cn.smallbun.screw.core.util.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.github.yulichang.base.MPJBaseServiceImpl; |
| | | import com.mes.md.entity.BPjingpianKC; |
| | | import com.mes.md.entity.KBBTJPDrawingBP; |
| | | import com.mes.md.entity.KBBTProgramsOperationLogBP; |
| | | import com.mes.md.entity.TaskingLog; |
| | | import com.mes.md.mapper.BPjingpianKCMapper; |
| | | import com.mes.md.mapper.KBBTJPDrawingBPMapper; |
| | | import com.mes.md.mapper.KBBTProgramsOperationLogBPMapper; |
| | | import com.mes.md.mapper.TaskingLogMapper; |
| | |
| | | KBBTProgramsOperationLogBPMapper kBBTProgramsOperationLogBPMapper; |
| | | @Autowired |
| | | KBBTJPDrawingBPMapper kBBTJPDrawingBPMapper; |
| | | @Autowired |
| | | BPjingpianKCMapper bPjingpianKCMapper; |
| | | |
| | | @Override |
| | | public List<Map> selectMechanicalReport(int dayCount, Date startDate, Date endDate, String taskType, String operationRecord, String lineType) { |
| | |
| | | /** |
| | | * 查询库位数据 |
| | | * 按库位统计: |
| | | * - 标准工艺:统计上片1和上片2的记录 |
| | | * - 定制工艺:统计旋转1和旋转2的记录 |
| | | * 查询 BPjingpianKC 表的库位数据 |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> selectWareHouse(int dayCount) { |
| | |
| | | cal.set(Calendar.MILLISECOND, 0); |
| | | cal.add(Calendar.DATE, -dayCount + 1); |
| | | Date startDate = cal.getTime(); |
| | | |
| | | // 使用QueryWrapper构建查询 |
| | | QueryWrapper<TaskingLog> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.select( |
| | | "DATE_FORMAT(operation_record_time, '%Y-%m-%d') as date", |
| | | "warehouse", |
| | | "COUNT(*) as count" |
| | | ) |
| | | .and(wrapper -> wrapper |
| | | .and(w -> w |
| | | .eq("task_type", "标准") |
| | | .in("operation_record", "上片1", "上片2") |
| | | ) |
| | | .or(w -> w |
| | | .eq("task_type", "定制") |
| | | .in("operation_record", "旋转1", "旋转2") |
| | | ) |
| | | ) |
| | | .eq("operation_mode", "结束") |
| | | .ge("operation_record_time", startDate) |
| | | .groupBy("DATE_FORMAT(operation_record_time, '%Y-%m-%d')", "warehouse") |
| | | .orderByAsc("date", "warehouse"); |
| | | |
| | | return baseMapper.selectMaps(queryWrapper); |
| | | QueryWrapper<BPjingpianKC> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.select( |
| | | "RecordDate as date", |
| | | "LGORTOT as warehouse", |
| | | "TotalLensStock as count" |
| | | ) |
| | | .ge("RecordDate", startDate) |
| | | .orderByAsc("RecordDate", "LGORTOT"); |
| | | |
| | | return bPjingpianKCMapper.selectMaps(queryWrapper); |
| | | |
| | | } catch (Exception e) { |
| | | log.error("查询库位数据失败", e); |