| | |
| | | import com.ruoyi.quality.mapper.*; |
| | | import com.ruoyi.quality.pojo.*; |
| | | import com.ruoyi.quality.service.IQualityInspectService; |
| | | import com.ruoyi.sales.mapper.SalesLedgerMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.aop.framework.AopContext; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public class ProductionProductMainServiceImpl extends ServiceImpl<ProductionProductMainMapper, ProductionProductMain> implements ProductionProductMainService { |
| | | |
| | | private final SalesLedgerMapper salesLedgerMapper; |
| | | private IQualityInspectService qualityInspectService; |
| | | private ProductionProductMainMapper productionProductMainMapper; |
| | | |
| | |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | ProductWorkOrder productWorkOrder = productWorkOrderMapper.selectById(dto.getWorkOrderId()); |
| | | |
| | | SysUser user = userMapper.selectUserById(dto.getUserId()); |
| | | ProductionProductMain productionProductMain = new ProductionProductMain(); |
| | | //当前工艺路线对应的工序详情 |
| | | ProductProcessRouteItem productProcessRouteItem = productProcessRouteItemMapper.selectById(dto.getProductProcessRouteItemId()); |
| | |
| | | productionProductMain.setTeamIds(dto.getTeamList().stream().map(ProductionProductMainDto.Team::getUserId).map(String::valueOf).collect(Collectors.joining(","))); |
| | | productionProductMain.setTeamNames(dto.getTeamList().stream().map(ProductionProductMainDto.Team::getUserName).collect(Collectors.joining(","))); |
| | | |
| | | productionProductMain.setUserId(dto.getTeamList().get(0).getUserId()); |
| | | productionProductMain.setUserName(dto.getTeamList().get(0).getUserName()); |
| | | //报工人 是 谁报工就是是谁 |
| | | productionProductMain.setUserId(SecurityUtils.getUserId()); |
| | | productionProductMain.setUserName(SecurityUtils.getLoginUser().getNickName()); |
| | | |
| | | |
| | | |
| | |
| | | productionProductMain.setAuditUserId(dto.getAuditUserId()); |
| | | productionProductMain.setAuditUserName(dto.getAuditUserName()); |
| | | productionProductMain.setStatus(0); |
| | | productionProductMain.setStartTime(productWorkOrder.getStartProductTime()); |
| | | productionProductMain.setEndTime(now); |
| | | productionProductMain.setDeviceId(productProcess.getDeviceId()); |
| | | productionProductMain.setDeviceName(productProcess.getDeviceName()); |
| | | if (ObjectUtils.isNotEmpty(dto.getStartTime())&&ObjectUtils.isNotEmpty(dto.getEndTime())) { |
| | | productionProductMain.setStartTime(dto.getStartTime()); |
| | | productionProductMain.setEndTime(dto.getEndTime()); |
| | | }else { |
| | | productionProductMain.setStartTime(productWorkOrder.getStartProductTime()); |
| | | productionProductMain.setEndTime(now); |
| | | } |
| | | productionProductMain.setDeviceId(dto.getDeviceId()); |
| | | productionProductMain.setDeviceName(dto.getDeviceName()); |
| | | productionProductMainMapper.insert(productionProductMain); |
| | | /*新增报工投入表*/ |
| | | List<ProductStructureDto> productStructureDtos = productStructureMapper.listBybomAndProcess(productProcessRoute.getBomId(), productProcess.getId()); |
| | |
| | | |
| | | SalesLedgerProductionAccounting salesLedgerProductionAccounting = SalesLedgerProductionAccounting.builder() |
| | | .productMainId(productionProductMain.getId()) |
| | | .schedulingUserId(user.getUserId()) |
| | | .schedulingUserName(user.getNickName()) |
| | | .schedulingUserId(productionProductMain.getUserId()) |
| | | .schedulingUserName(userMapper.selectUserById(productionProductMain.getUserId()).getNickName()) |
| | | .finishedNum(productQty) |
| | | .workHours(workHours) |
| | | .process(productProcess.getName()) |