| | |
| | | import com.ruoyi.basic.mapper.ProductModelMapper; |
| | | import com.ruoyi.basic.pojo.Product; |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.production.controller.ProductWorkOrderController; |
| | | import com.ruoyi.production.dto.ProductStructureDto; |
| | |
| | | import com.ruoyi.production.mapper.*; |
| | | import com.ruoyi.production.pojo.*; |
| | | import com.ruoyi.production.service.ProductionProductMainService; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.quality.mapper.QualityInspectMapper; |
| | | import com.ruoyi.quality.mapper.QualityInspectParamMapper; |
| | | import com.ruoyi.quality.mapper.QualityTestStandardMapper; |
| | |
| | | |
| | | private ProductionProductInputMapper productionProductInputMapper; |
| | | |
| | | private ProductOrderMapper productOrderMapper; |
| | | |
| | | private SalesLedgerProductionAccountingMapper salesLedgerProductionAccountingMapper; |
| | | |
| | | |
| | | @Override |
| | | public IPage<ProductionProductMainDto> listPageProductionProductMainDto(Page page, ProductionProductMainDto productionProductMainDto) { |
| | |
| | | throw new RuntimeException("åæ°ä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | | |
| | | if (dto.isReportWork()) { |
| | | // æ´æ°é»è¾ - åªæ´æ°æ°é |
| | | QueryWrapper<ProductionProductOutput> outputWrapper = new QueryWrapper<>(); |
| | |
| | | throw new RuntimeException("产åºè®°å½ä¸åå¨"); |
| | | } |
| | | |
| | | // æ¥è¯¢çäº§æ ¸ç®è®°å½ |
| | | QueryWrapper<SalesLedgerProductionAccounting> accountingWrapper = new QueryWrapper<>(); |
| | | accountingWrapper.eq("sales_ledger_work_id", dto.getProductMainId()); |
| | | SalesLedgerProductionAccounting accounting = salesLedgerProductionAccountingMapper.selectOne(accountingWrapper); |
| | | if (accounting == null) { |
| | | throw new RuntimeException("çäº§æ ¸ç®è®°å½ä¸åå¨"); |
| | | } |
| | | |
| | | // åªæ´æ°æ°é |
| | | if (dto.getQuantity() != null) { |
| | | output.setQuantity(dto.getQuantity()); |
| | | productionProductOutputMapper.updateById(output); |
| | | // æ´æ°çäº§æ ¸ç®è®°å½ |
| | | accounting.setFinishedNum(dto.getQuantity()); |
| | | salesLedgerProductionAccountingMapper.updateById(accounting); |
| | | } |
| | | return true; |
| | | } |
| | |
| | | |
| | | String productNo = String.format("%s%03d", datePrefix, sequenceNumber); |
| | | productionProductMain.setProductNo(productNo); |
| | | productionProductMain.setUserId(dto.getUserId()); |
| | | productionProductMain.setUserId(user.getUserId()); |
| | | productionProductMain.setProductProcessRouteItemId(dto.getProductProcessRouteItemId()); |
| | | productionProductMain.setWorkOrderId(dto.getWorkOrderId()); |
| | | productionProductMain.setStatus(0); |
| | |
| | | productionProductOutput.setQuantity(dto.getQuantity() != null ? dto.getQuantity() : BigDecimal.ZERO); |
| | | productionProductOutputMapper.insert(productionProductOutput); |
| | | |
| | | // è·åç产订å |
| | | ProductWorkOrder productWorkOrder = productWorkOrderMapper.selectById(dto.getWorkOrderId()); |
| | | ProductOrder productOrder = productOrderMapper.selectById(productWorkOrder.getProductOrderId()); |
| | | if (productOrder == null) { |
| | | throw new RuntimeException("ç产订åä¸åå¨"); |
| | | } |
| | | // æ·»å çäº§æ ¸ç® |
| | | SalesLedgerProductionAccounting salesLedgerProductionAccounting = SalesLedgerProductionAccounting.builder() |
| | | .salesLedgerWorkId(productionProductMain.getId()) |
| | | .salesLedgerSchedulingId(0L) |
| | | .salesLedgerId(productOrder.getSalesLedgerId()) |
| | | .salesLedgerProductId(productOrder.getProductModelId()) |
| | | .schedulingUserId(user.getUserId()) |
| | | .schedulingUserName(user.getNickName()) |
| | | .finishedNum(dto.getQuantity() != null ? dto.getQuantity() : BigDecimal.ZERO) |
| | | .workHours(productProcess.getSalaryQuota()) |
| | | .process(productProcess.getName()) |
| | | .schedulingDate(LocalDate.now()) |
| | | .tenantId(dto.getTenantId()) |
| | | .build(); |
| | | salesLedgerProductionAccountingMapper.insert(salesLedgerProductionAccounting); |
| | | |
| | | return true; |
| | | } |
| | | |
| | |
| | | .eq(ProductionProductOutput::getProductMainId, id) |
| | | ); |
| | | |
| | | // å é¤å
³èçæ ¸ç®æ°æ® |
| | | salesLedgerProductionAccountingMapper.delete( |
| | | new LambdaQueryWrapper<SalesLedgerProductionAccounting>() |
| | | .eq(SalesLedgerProductionAccounting::getSalesLedgerWorkId, id) |
| | | ); |
| | | |
| | | // å é¤ä¸»è¡¨ |
| | | return productionProductMainMapper.deleteById(id) > 0; |
| | | } |