| | |
| | | import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.device.mapper.DeviceLedgerMapper; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.production.bean.dto.ProductStructureDto; |
| | | import com.ruoyi.production.bean.dto.ProductionProductMainDto; |
| | | import com.ruoyi.production.bean.vo.DeviceOutputStatVo; |
| | | import com.ruoyi.production.bean.vo.PieceWageSummaryVo; |
| | | import com.ruoyi.production.enums.ProductOrderStatusEnum; |
| | | import com.ruoyi.production.mapper.*; |
| | | import com.ruoyi.production.pojo.*; |
| | | import com.ruoyi.production.service.PieceRateConfigService; |
| | | import com.ruoyi.production.service.ProductionProductMainService; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Collections; |
| | | import java.util.HashMap; |
| | | import java.util.LinkedHashMap; |
| | |
| | | private final StockUtils stockUtils; |
| | | private final StockInRecordService stockInRecordService; |
| | | private final StockInventoryService stockInventoryService; |
| | | private final DeviceLedgerMapper deviceLedgerMapper; |
| | | private final PieceRateConfigService pieceRateConfigService; |
| | | |
| | | @Override |
| | | public IPage<ProductionProductMainDto> listPageProductionProductMainDto(Page page, ProductionProductMainDto productionProductMainDto) { |
| | |
| | | productionProductMain.setProductNo(generateProductNo()); |
| | | productionProductMain.setUserId(user == null ? dto.getUserId() : user.getUserId()); |
| | | productionProductMain.setUserName(user == null ? dto.getUserName() : user.getNickName()); |
| | | if (dto.getDeviceId() != null) { |
| | | DeviceLedger device = deviceLedgerMapper.selectById(dto.getDeviceId()); |
| | | if (device == null) { |
| | | throw new ServiceException("设备不存在,ID=" + dto.getDeviceId()); |
| | | } |
| | | productionProductMain.setDeviceId(device.getId()); |
| | | productionProductMain.setDeviceName(device.getDeviceName()); |
| | | } |
| | | productionProductMain.setProductionOperationTaskId(taskId); |
| | | productionProductMain.setStatus(0); |
| | | productionProductMain.setWorkHour(dto.getWorkHour()); |
| | |
| | | // 查询主表ID集合 |
| | | return productionProductMainMapper.listMain(idList); |
| | | } |
| | | |
| | | @Override |
| | | public List<PieceWageSummaryVo> wageSummary(LocalDate startDate, LocalDate endDate, String userName) { |
| | | return productionProductMainMapper.wageSummary(startDate, endDate, userName); |
| | | } |
| | | |
| | | @Override |
| | | public List<DeviceOutputStatVo> outputStat(String dimension, LocalDate startDate, LocalDate endDate, Long deviceId) { |
| | | String dim = dimension == null || dimension.isEmpty() ? "device" : dimension; |
| | | if (!Arrays.asList("device", "operation", "product").contains(dim)) { |
| | | throw new ServiceException("统计维度不合法,仅支持 device/operation/product"); |
| | | } |
| | | return productionProductMainMapper.outputStat(dim, startDate, endDate, deviceId); |
| | | } |
| | | } |