Merge remote-tracking branch 'origin/jtwy' into jtwy
| | |
| | | tenantId = SecurityUtils.getLoginUser().getTenantId(); |
| | | } catch (Exception ignored) { |
| | | } |
| | | System.out.println("æ§è¡æå
¥å¡«å
..."); |
| | | this.strictInsertFill(metaObject, "createTime", LocalDateTime.class, LocalDateTime.now()); |
| | | this.strictInsertFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now()); |
| | | this.strictInsertFill(metaObject, "createUser", Integer.class, userId); |
| | |
| | | List<ProductOrderDto> productOrderDtoList = new ArrayList<>(); |
| | | productOrderList.forEach(productOrder -> { |
| | | ProductOrderDto productOrderDto = productOrderMapper.productMainByOrderId(productOrder); |
| | | if (productOrderDto != null && productOrderDto.getPlanQuantity() != null && productOrderDto.getQuantity() != null) { |
| | | productOrderDto.setCompletionStatus(BigDecimal.valueOf(productOrderDto.getPlanQuantity()-productOrderDto.getQuantity()).divide(BigDecimal.valueOf(productOrderDto.getPlanQuantity()), 2, RoundingMode.HALF_UP)); |
| | | } |
| | | // if (productOrderDto != null && productOrderDto.getPlanQuantity() != null && productOrderDto.getQuantity() != null) { |
| | | // productOrderDto.setCompletionStatus((productOrderDto.getPlanQuantity().subtract(productOrderDto.getQuantity())).divide(productOrderDto.getPlanQuantity(), 2, RoundingMode.HALF_UP)); |
| | | // } |
| | | productOrderDtoList.add(productOrderDto); |
| | | }); |
| | | productionProgressDto.setCompletedOrderDetails(productOrderDtoList); |
| | |
| | | |
| | | // 2. åå§åæ±æ»æ°æ® |
| | | int totalCount = productOrderDtoIPage.getRecords().size(); |
| | | int completedCount = (int) productOrderDtoIPage.getRecords().stream().map(productOrderDto -> productOrderMapper.productMainByOrderId(productOrderDto)).filter(productOrderDto1 -> productOrderDto1.getQuantity() != null && productOrderDto1.getQuantity() == 0).count(); |
| | | int completedCount = (int) productOrderDtoIPage.getRecords().stream().map(productOrderDto -> productOrderMapper.productMainByOrderId(productOrderDto)).filter(productOrderDto1 -> productOrderDto1.getQuantity() != null && productOrderDto1.getQuantity().compareTo(BigDecimal.ZERO) == 0).count(); |
| | | |
| | | // 6. èµå¼æ±æ»æ°æ® |
| | | productionProgressDto.setTotalOrderCount(totalCount); |
| | |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | @GetMapping("/listPageByProductProduction") |
| | | @Log(title = "ç产å
¥åº-å
¥åºç®¡ç-ç产å
¥åºæ¥è¯¢", businessType = BusinessType.OTHER) |
| | | @ApiOperation(value = "å
¥åºæ¥è¯¢") |
| | | public AjaxResult listPageByProductProduction(Page page, ProcurementPageDto procurementDto) { |
| | | IPage<ProcurementPageDto> result = procurementRecordService.listPageByProductProduction(page, procurementDto); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | @GetMapping("/listPageByCustom") |
| | | @Log(title = "èªå®ä¹å
¥åº-å
¥åºç®¡ç-å
¥åºæ¥è¯¢", businessType = BusinessType.OTHER) |
| | | @ApiOperation(value = "å
¥åºæ¥è¯¢") |
| | |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | @GetMapping("/listPageBySemiProduct") |
| | | @Log(title = "ç产åºåº-åºåºå°è´¦-åºåºæ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPageBySemiProduct(Page page, ProcurementRecordOutPageDto procurementDto) { |
| | | IPage<ProcurementRecordOutPageDto> result = procurementRecordOutService.listPageBySemiProduct(page, procurementDto); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | @GetMapping("/listPageByCustom") |
| | | @Log(title = "èªå®ä¹åºåº-åºåºå°è´¦-åºåºæ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPageByCustom(Page page, ProcurementRecordOutPageDto procurementDto) { |
| | |
| | | IPage<ProcurementPageDtoCopy> listPagePRS(Page page, @Param("req") ProcurementPageDto procurementDto); |
| | | |
| | | BigDecimal getSumQuantity(@Param("productModelId") Long productModelId); |
| | | |
| | | IPage<ProcurementPageDto> listPageByProductProduction(Page page, @Param("req") ProcurementPageDto procurementDto); |
| | | } |
| | |
| | | IPage<ProcurementRecordOutPageDto> listPageByCustom(Page page,@Param("req") ProcurementRecordOutPageDto procurementDto); |
| | | |
| | | BigDecimal getSumQuantity(@Param("productModelId") Long productModelId); |
| | | |
| | | ProcurementRecordOut selectCode(@Param("format") String format); |
| | | |
| | | IPage<ProcurementRecordOutPageDto> listPageBySemiProduct(Page page,@Param("req") ProcurementRecordOutPageDto procurementDto); |
| | | } |
| | |
| | | IPage<ProcurementRecordOutPageDto> listPageByProduct(Page page, ProcurementRecordOutPageDto procurementDto); |
| | | |
| | | IPage<ProcurementRecordOutPageDto> listPageByCustom(Page page, ProcurementRecordOutPageDto procurementDto); |
| | | |
| | | IPage<ProcurementRecordOutPageDto> listPageBySemiProduct(Page page, ProcurementRecordOutPageDto procurementDto); |
| | | } |
| | |
| | | InventoryInformationDto getReportList(); |
| | | |
| | | IPage<ProductModel> listPageProductionStock(Page page); |
| | | |
| | | IPage<ProcurementPageDto> listPageByProductProduction(Page page, ProcurementPageDto procurementDto); |
| | | } |
| | |
| | | Long aLong = procurementRecordOutMapper.selectCount(procurementRecordLambdaQueryWrapper); |
| | | ProcurementRecordOut.ProcurementRecordOutBuilder procurementRecordOut = ProcurementRecordOut.builder() |
| | | .procurementRecordStorageId(procurementRecordOutAdd.getId()) |
| | | .code("LS" + dateFormat.format(now) + String.format("%03d", aLong1 + 1)) |
| | | .code("SC" + dateFormat.format(now) + String.format("%03d", aLong1 + 1)) |
| | | .salesLedgerProductId(procurementRecordOutAdd.getSalesLedgerProductId()) |
| | | .inboundBatches(aLong.equals(0L) ? "第1æ¹æ¬¡" : "第"+ (aLong + 1) + "æ¹æ¬¡") |
| | | .inboundNum(new BigDecimal(procurementRecordOutAdd.getQuantity())) |
| | |
| | | public IPage<ProcurementRecordOutPageDto> listPageByCustom(Page page, ProcurementRecordOutPageDto procurementDto) { |
| | | return procurementRecordOutMapper.listPageByCustom(page, procurementDto); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<ProcurementRecordOutPageDto> listPageBySemiProduct(Page page, ProcurementRecordOutPageDto procurementDto) { |
| | | return procurementRecordOutMapper.listPageBySemiProduct(page, procurementDto); |
| | | } |
| | | } |
| | |
| | | return iPage; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<ProcurementPageDto> listPageByProductProduction(Page page, ProcurementPageDto procurementDto) { |
| | | IPage<ProcurementPageDto> procurementPageDtoIPage = procurementRecordMapper.listPageByProductProduction(page, procurementDto); |
| | | return procurementPageDtoIPage; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.production.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.production.dto.ProcessRouteDto; |
| | | import com.ruoyi.production.pojo.ProcessRoute; |
| | | import com.ruoyi.production.pojo.ProcessRouteItem; |
| | | import com.ruoyi.production.service.ProcessRouteItemService; |
| | | import com.ruoyi.production.service.ProcessRouteService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | |
| | | @Autowired |
| | | private ProcessRouteService processRouteService; |
| | | |
| | | @Autowired |
| | | private ProcessRouteItemService processRouteItemService; |
| | | |
| | | @GetMapping("page") |
| | | @ApiOperation("å页æ¥è¯¢") |
| | |
| | | @ApiOperation("å é¤å·¥èºè·¯çº¿") |
| | | @DeleteMapping("/{ids}") |
| | | public R delete(@PathVariable("ids") Long[] ids) { |
| | | //å é¤å·¥èºè·¯çº¿è¯¦æ
|
| | | processRouteItemService.remove(Wrappers.<ProcessRouteItem>lambdaQuery().in(ProcessRouteItem::getRouteId,Arrays.asList(ids))); |
| | | return R.ok(processRouteService.removeBatchByIds(Arrays.asList(ids))); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.production.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.production.dto.ProcessRouteItemDto; |
| | | import com.ruoyi.production.pojo.ProcessRoute; |
| | | import com.ruoyi.production.pojo.ProcessRouteItem; |
| | | import com.ruoyi.production.service.ProcessRouteItemService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | |
| | | return R.ok(processRouteItemService.listProcessRouteItemDto(processRouteItemDto)); |
| | | } |
| | | |
| | | |
| | | @PostMapping () |
| | | @ApiOperation("æ°å¢ä¿®æ¹") |
| | | public R addOrUpdate(@RequestBody ProcessRouteItemDto processRouteItemDto) { |
| | | processRouteItemService.remove(new QueryWrapper<ProcessRouteItem>().lambda().eq(ProcessRouteItem::getRouteId, processRouteItemDto.getRouteId())); |
| | | return R.ok(processRouteItemService.saveBatch(processRouteItemDto.getProcessRouteItem())); |
| | | public R addOrUpdate(@RequestBody ProcessRouteItem processRouteItem) { |
| | | return R.ok(processRouteItemService.saveOrUpdate(processRouteItem)); |
| | | } |
| | | |
| | | @PostMapping ("/sort") |
| | | @ApiOperation("æåº") |
| | | public R sort(@RequestBody ProcessRouteItem processRouteItem) { |
| | | return R.ok(processRouteItemService.sort(processRouteItem)); |
| | | } |
| | | |
| | | @ApiOperation("å é¤å·¥èºè·¯çº¿æç»") |
| | | @DeleteMapping("/batchDelete/{id}") |
| | | @Log(title = "å é¤", businessType = BusinessType.DELETE) |
| | | public AjaxResult batchDelete(@PathVariable("id") Long id) { |
| | | return AjaxResult.success(processRouteItemService.batchDelete(id)); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.production.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.production.dto.ProductOrderDto; |
| | | import com.ruoyi.production.pojo.ProcessRoute; |
| | | import com.ruoyi.production.pojo.ProductOrder; |
| | | import com.ruoyi.production.service.ProductOrderService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | @RequestMapping("productOrder") |
| | | @RestController |
| | | @Api(tags = "ç产订å") |
| | | public class ProductOrderController { |
| | | |
| | | @Autowired |
| | |
| | | return R.ok(productOrderService.pageProductOrder(page, productOrder)); |
| | | } |
| | | |
| | | @ApiOperation("ç»å®å·¥èºè·¯çº¿") |
| | | @PostMapping("/bindingRoute") |
| | | public R bindingRoute(@RequestBody ProductOrder productOrder) { |
| | | return R.ok(productOrderService.bindingRoute(productOrder)); |
| | | } |
| | | |
| | | @ApiOperation("æ¥è¯¢è§æ ¼åå·å¯¹åºçå·¥èºè·¯çº¿") |
| | | @GetMapping("/listProcessRoute") |
| | | public R listProcessRoute(Long productModelId) { |
| | | return R.ok(productOrderService.listProcessRoute(productModelId)); |
| | | } |
| | | |
| | | /** |
| | | * 导åºç产订å |
| | | */ |
| | | @Log(title = "ç产订å", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, ProductOrderDto productOrderDto) { |
| | | List<ProductOrderDto> list; |
| | | list = productOrderService.pageProductOrder(new Page<>(1, -1), productOrderDto).getRecords(); |
| | | ExcelUtil<ProductOrderDto> util = new ExcelUtil<ProductOrderDto>(ProductOrderDto.class); |
| | | util.exportExcel(response, list, "çäº§è®¢åæ°æ®"); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.controller; |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-15 02:51:09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/productProcessRoute") |
| | | public class ProductProcessRouteController { |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.production.dto.ProductProcessRouteItemDto; |
| | | import com.ruoyi.production.mapper.*; |
| | | import com.ruoyi.production.pojo.*; |
| | | import com.ruoyi.production.service.ProductProcessRouteItemService; |
| | | import com.ruoyi.production.service.ProductProcessRouteService; |
| | | import com.ruoyi.production.service.ProductWorkOrderService; |
| | | import com.ruoyi.quality.mapper.QualityInspectMapper; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | |
| | | @Api(tags = "ç产工èºè·¯çº¿") |
| | | public class ProductProcessRouteItemController { |
| | | |
| | | private final ProductOrderMapper productOrderMapper; |
| | | |
| | | private ProductProcessRouteItemService productProcessRouteItemService; |
| | | |
| | | private ProductWorkOrderService productWorkOrderService; |
| | | |
| | | private ProductWorkOrderMapper productWorkOrderMapper; |
| | | |
| | | private SalesLedgerProductMapper salesLedgerProductMapper; |
| | | |
| | | private ProductionProductMainMapper productionProductMainMapper; |
| | | |
| | | private ProductionProductInputMapper productionProductInputMapper; |
| | | |
| | | private ProductionProductOutputMapper productionProductOutputMapper; |
| | | |
| | | private QualityInspectMapper qualityInspectMapper; |
| | | |
| | | private SalesLedgerProductionAccountingMapper salesLedgerProductionAccountingMapper; |
| | | private ProductProcessRouteService productProcessRouteService; |
| | | |
| | | @GetMapping("list") |
| | | @ApiOperation("æ ¹æ®Idæ¥è¯¢å·¥èºé¡¹ç®") |
| | | @ApiOperation("æ ¹æ®Idæ¥è¯¢å·¥èºè·¯çº¿å表") |
| | | public R list(Long orderId) { |
| | | return R.ok(productProcessRouteItemService.listItem(orderId)); |
| | | } |
| | | |
| | | @GetMapping("listMain") |
| | | @ApiOperation("æ ¹æ®Idæ¥è¯¢å·¥èºè·¯çº¿ä¸»è¡¨") |
| | | public R listMain(Long orderId) { |
| | | return R.ok(productProcessRouteService.listMain(orderId)); |
| | | } |
| | | |
| | | @PostMapping("/addRouteItem") |
| | | @ApiOperation("æ°å¢ç产订åçå·¥èºè·¯çº¿è¯¦æ
") |
| | | public R addRouteItem(@RequestBody ProductProcessRouteItem productProcessRouteItem) { |
| | | return productProcessRouteItemService.addRouteItem(productProcessRouteItem); |
| | | } |
| | | |
| | | @PostMapping("/updateRouteItem") |
| | | @ApiOperation("æ¹éæ°å¢ä¿®æ¹") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R addOrUpdate(@RequestBody ProductProcessRouteItemDto processRouteItemDto) { |
| | | |
| | | ProductOrder productOrder = productOrderMapper.selectById(processRouteItemDto.getRouteId()); |
| | | if (productOrder == null) { |
| | | return R.fail("æªæ¾å°ID为[" + processRouteItemDto.getRouteId() + "]ç产å订å"); |
| | | } |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectOne(new LambdaQueryWrapper<SalesLedgerProduct>() |
| | | .eq(SalesLedgerProduct::getSalesLedgerId, productOrder.getSalesLedgerId())); |
| | | |
| | | if (salesLedgerProduct == null) { |
| | | return R.fail("æªæ¾å°éå®å°è´¦ID为[" + productOrder.getSalesLedgerId() + "]çå°è´¦äº§å"); |
| | | @ApiOperation("ä¿®æ¹ç产订åçå·¥èºè·¯çº¿è¯¦æ
") |
| | | public R updateRouteItem(@RequestBody ProductProcessRouteItem productProcessRouteItem) { |
| | | return R.ok(productProcessRouteItemService.updateById(productProcessRouteItem)); |
| | | } |
| | | |
| | | List<ProductProcessRouteItem> items = processRouteItemDto.getProcessRouteItem(); |
| | | if (CollectionUtils.isEmpty(items)) { |
| | | return R.ok(); |
| | | } |
| | | |
| | | Map<Boolean, List<ProductProcessRouteItem>> partitioned = items.stream() |
| | | .collect(Collectors.partitioningBy( |
| | | item -> item.getId() != null && item.getId() > 0 |
| | | )); |
| | | |
| | | List<ProductProcessRouteItem> toUpdate = partitioned.get(true); |
| | | List<ProductProcessRouteItem> toInsert = partitioned.get(false); |
| | | // æ¹éå¤ç |
| | | boolean result = true; |
| | | if (!toInsert.isEmpty()) { |
| | | result = productProcessRouteItemService.saveBatch(toInsert); |
| | | if (result) { |
| | | // çæå·¥åå· |
| | | String datePrefix = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")); |
| | | // æ¥è¯¢ä»æ¥æå¤§å·¥åå· |
| | | QueryWrapper<ProductWorkOrder> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.likeRight("work_order_no", datePrefix) |
| | | .select("MAX(work_order_no) as maxNo"); |
| | | |
| | | List<Map<String, Object>> maxNoList = productWorkOrderMapper.selectMaps(queryWrapper); |
| | | String maxWorkOrderNo = null; |
| | | if (!maxNoList.isEmpty() && maxNoList.get(0) != null && maxNoList.get(0).get("maxNo") != null) { |
| | | maxWorkOrderNo = maxNoList.get(0).get("maxNo").toString(); |
| | | } |
| | | int startSequence = 1; |
| | | if (maxWorkOrderNo != null && maxWorkOrderNo.startsWith(datePrefix)) { |
| | | try { |
| | | String seqStr = maxWorkOrderNo.substring(datePrefix.length()); |
| | | startSequence = Integer.parseInt(seqStr) + 1; |
| | | } catch (NumberFormatException e) { |
| | | startSequence = 1; |
| | | } |
| | | } |
| | | // æ¹éçæå·¥å |
| | | List<ProductWorkOrder> workOrders = new ArrayList<>(); |
| | | for (int i = 0; i < toInsert.size(); i++) { |
| | | ProductProcessRouteItem item = toInsert.get(i); |
| | | String workOrderNoStr = String.format("%s%03d", datePrefix, startSequence + i); |
| | | ProductWorkOrder workOrder = new ProductWorkOrder(); |
| | | workOrder.setProductProcessRouteItemId(item.getId()); |
| | | workOrder.setProductOrderId(item.getRouteId()); |
| | | workOrder.setWorkOrderNo(workOrderNoStr); |
| | | workOrder.setPlanQuantity(salesLedgerProduct.getQuantity()); |
| | | workOrder.setStatus(1); |
| | | workOrders.add(workOrder); |
| | | } |
| | | result = productWorkOrderService.saveBatch(workOrders); |
| | | } |
| | | } |
| | | if (!toUpdate.isEmpty()) { |
| | | result = productProcessRouteItemService.updateBatchById(toUpdate) && result; |
| | | } |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @DeleteMapping("/deleteRouteItem") |
| | | @DeleteMapping("/deleteRouteItem/{id}") |
| | | @ApiOperation("å é¤ç产工èºè·¯çº¿") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R deleteRouteItem(@RequestBody ProductProcessRouteItemDto processRouteItemDto) { |
| | | |
| | | if (processRouteItemDto == null || processRouteItemDto.getId() == null) { |
| | | return R.fail("å é¤å¤±è´¥ï¼å·¥èºè·¯çº¿é¡¹IDä¸è½ä¸ºç©º"); |
| | | } |
| | | Long routeItemId = processRouteItemDto.getId(); |
| | | |
| | | try { |
| | | // æ¥è¯¢å·¥å |
| | | ProductWorkOrder productWorkOrder = productWorkOrderMapper.selectOne( |
| | | new LambdaQueryWrapper<ProductWorkOrder>() |
| | | .eq(ProductWorkOrder::getProductProcessRouteItemId, routeItemId) |
| | | .last("LIMIT 1") |
| | | ); |
| | | if (productWorkOrder == null) { |
| | | return R.fail("å é¤å¤±è´¥ï¼æªæ¾å°å
³èçç产工å"); |
| | | } |
| | | Long workOrderId = productWorkOrder.getId(); |
| | | Long productOrderId = productWorkOrder.getProductOrderId(); |
| | | |
| | | // æ¥è¯¢ç产主表 |
| | | List<ProductionProductMain> productionProductMains = productionProductMainMapper.selectList( |
| | | new LambdaQueryWrapper<ProductionProductMain>() |
| | | .eq(ProductionProductMain::getWorkOrderId, workOrderId) |
| | | ); |
| | | if (!productionProductMains.isEmpty()) { |
| | | // æ¹éå é¤å表 |
| | | for (ProductionProductMain main : productionProductMains) { |
| | | Long mainId = main.getId(); |
| | | // å 餿å
¥ |
| | | productionProductInputMapper.delete(new LambdaQueryWrapper<ProductionProductInput>() |
| | | .eq(ProductionProductInput::getProductMainId, mainId)); |
| | | // å é¤äº§åº |
| | | productionProductOutputMapper.delete(new LambdaQueryWrapper<ProductionProductOutput>() |
| | | .eq(ProductionProductOutput::getProductMainId, mainId)); |
| | | // å é¤è´¨æ£ |
| | | qualityInspectMapper.delete(new LambdaQueryWrapper<QualityInspect>() |
| | | .eq(QualityInspect::getProductMainId, mainId)); |
| | | } |
| | | public R deleteRouteItem(@PathVariable("id") Long id) { |
| | | return productProcessRouteItemService.deleteRouteItem(id); |
| | | } |
| | | |
| | | // å 餿¥å·¥ï¼çäº§ä¸»è¡¨ï¼ |
| | | productionProductMainMapper.delete(new LambdaQueryWrapper<ProductionProductMain>() |
| | | .eq(ProductionProductMain::getWorkOrderId, workOrderId)); |
| | | |
| | | // æ¥è¯¢è®¢å + å 餿 ¸ç® |
| | | ProductOrder productOrder = productOrderMapper.selectById(productOrderId); |
| | | if (productOrder != null && productOrder.getSalesLedgerId() != null) { |
| | | salesLedgerProductionAccountingMapper.delete(new LambdaQueryWrapper<SalesLedgerProductionAccounting>() |
| | | .eq(SalesLedgerProductionAccounting::getSalesLedgerId, productOrder.getSalesLedgerId())); |
| | | } |
| | | |
| | | // å é¤å
³èå·¥å |
| | | productWorkOrderMapper.delete(new LambdaQueryWrapper<ProductWorkOrder>() |
| | | .eq(ProductWorkOrder::getProductProcessRouteItemId, routeItemId)); |
| | | |
| | | // å é¤ä¸»è¡¨æ°æ® |
| | | boolean removeFlag = productProcessRouteItemService.removeById(routeItemId); |
| | | if (!removeFlag) { |
| | | return R.fail("å é¤å¤±è´¥ï¼å·¥èºè·¯çº¿é¡¹ä¸»è¡¨æ°æ®ä¸åå¨"); |
| | | } |
| | | |
| | | return R.ok(); |
| | | } catch (Exception e) { |
| | | return R.fail("å é¤ç产工èºè·¯çº¿å¤±è´¥ï¼" + e.getMessage()); |
| | | } |
| | | @PostMapping ("/sortRouteItem") |
| | | @ApiOperation("æåº") |
| | | public R sortRouteItem(@RequestBody ProductProcessRouteItem productProcessRouteItem) { |
| | | return R.ok(productProcessRouteItemService.sortRouteItem(productProcessRouteItem)); |
| | | } |
| | | } |
| | |
| | | private Long productId; |
| | | |
| | | |
| | | private List<ProcessRouteItem> processRouteItem; |
| | | private String model; |
| | | } |
| | |
| | | package com.ruoyi.production.dto; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import com.ruoyi.production.pojo.ProductOrder; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class ProductOrderDto extends ProductOrder { |
| | | |
| | | @ApiModelProperty(value = "éå®ååå·") |
| | | @Excel(name = "éå®ååå·") |
| | | private String salesContractNo; |
| | | |
| | | @ApiModelProperty(value = "项ç®å") |
| | | @Excel(name = "项ç®å") |
| | | private String projectName; |
| | | |
| | | @ApiModelProperty(value = "客æ·å") |
| | | @ApiModelProperty(value = "客æ·åç§°") |
| | | @Excel(name = "客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | @ApiModelProperty(value = "产ååç§°") |
| | | @Excel(name = "产ååç§°") |
| | | private String productCategory; |
| | | |
| | | @ApiModelProperty(value = "è§æ ¼") |
| | | @Excel(name = "è§æ ¼") |
| | | private String specificationModel; |
| | | @ApiModelProperty(value = "è®¡åæ°é") |
| | | private Integer planQuantity; |
| | | @ApiModelProperty(value = "æ°é") |
| | | private Integer Quantity; |
| | | @ApiModelProperty(value = "å·¥åå·") |
| | | private String workOrderNo; |
| | | @ApiModelProperty(value = "æ¯å¦æ¥å·¥") |
| | | private Integer reportWork; |
| | | @ApiModelProperty(value = "å·¥åç¶æ") |
| | | private Integer status; |
| | | @ApiModelProperty(value = "订åå®æåº¦") |
| | | private BigDecimal completionStatus; |
| | | |
| | | @ApiModelProperty(value = "å·¥èºè·¯çº¿ç¼å·") |
| | | @Excel(name = "å·¥èºè·¯çº¿ç¼å·") |
| | | private String processRouteCode; |
| | | } |
| | |
| | | |
| | | private String productName; |
| | | |
| | | |
| | | private List<ProductProcessRouteItem> processRouteItem; |
| | | private String model; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.production.dto.ProductOrderDto; |
| | | import com.ruoyi.production.pojo.ProcessRoute; |
| | | import com.ruoyi.production.pojo.ProductOrder; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface ProductOrderMapper extends BaseMapper<ProductOrder> { |
| | |
| | | * æ ¹æ®è®¢åIDæ¥è¯¢å·¥åæ¥å·¥ |
| | | */ |
| | | ProductOrderDto productMainByOrderId(@Param("c") ProductOrder productOrder); |
| | | |
| | | List<ProcessRoute> listProcessRoute(@Param("productModelId") Long productModelId); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.mapper; |
| | | |
| | | import com.ruoyi.production.dto.ProcessRouteDto; |
| | | import com.ruoyi.production.pojo.ProductProcessRoute; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-15 02:51:09 |
| | | */ |
| | | @Mapper |
| | | public interface ProductProcessRouteMapper extends BaseMapper<ProductProcessRoute> { |
| | | |
| | | ProcessRouteDto listMain(@Param("orderId") Long orderId); |
| | | } |
| | |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "产åID") |
| | | //product_model |
| | | private Long productModelId; |
| | | |
| | | @ApiModelProperty(value = "æè¿°") |
| | |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "æ´æ°æ¶é´") |
| | | @TableField(fill = FieldFill.UPDATE) |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty(value = "å·¥èºè·¯çº¿ç¼ç ") |
| | |
| | | @TableField(fill = FieldFill.UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty(value ="æå¨æåº") |
| | | private Integer dragSort; |
| | | |
| | | |
| | | } |
| | |
| | | package com.ruoyi.production.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | |
| | | private Long salesLedgerId; |
| | | |
| | | /** |
| | | * éå®å°è´¦äº§åid |
| | | * éå®å°è´¦äº§åid(sales_ledger_product) |
| | | */ |
| | | @ApiModelProperty(value = "éå®å°è´¦äº§åid") |
| | | private Long productModelId; |
| | |
| | | * ç产订åå· |
| | | */ |
| | | @ApiModelProperty(value = "ç产订åå·") |
| | | @Excel(name = "ç产订åå·") |
| | | private String npsNo; |
| | | |
| | | /** |
| | |
| | | //å建æ¶é´ |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @Excel(name = "å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | //ä¿®æ¹æ¶é´ |
| | | @ApiModelProperty(value = "ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.UPDATE) |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime updateTime; |
| | | |
| | | |
| | | /** |
| | | * éæ±æ°é |
| | | */ |
| | | @ApiModelProperty(value = "éæ±æ°é") |
| | | @Excel(name = "éæ±æ°é") |
| | | private BigDecimal quantity; |
| | | |
| | | /** |
| | | * 宿æ°é |
| | | */ |
| | | @ApiModelProperty(value = "宿æ°é") |
| | | @Excel(name = "宿æ°é") |
| | | private BigDecimal completeQuantity; |
| | | |
| | | @Excel(name = "å¼å§æ¶é´") |
| | | @ApiModelProperty(value = "å¼å§æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime startTime; |
| | | |
| | | @ApiModelProperty(value = "ç»ææ¶é´") |
| | | @Excel(name = "ç»ææ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime endTime; |
| | | |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-15 02:51:09 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @TableName("product_process_route") |
| | | @ApiModel(value = "ProductProcessRoute对象", description = "") |
| | | public class ProductProcessRoute implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("产åid") |
| | | //product_model |
| | | private Long productModelId; |
| | | |
| | | @ApiModelProperty("æè¿°") |
| | | private String description; |
| | | |
| | | @ApiModelProperty("ç§æ·id") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @ApiModelProperty("å½å
¥æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("æ´æ°æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("å
³èbomçid") |
| | | private Long bomId; |
| | | |
| | | @ApiModelProperty("å·¥èºè·¯çº¿ç¼ç ") |
| | | private String processRouteCode; |
| | | |
| | | @ApiModelProperty("ç产订åçid") |
| | | private Long productOrderId; |
| | | } |
| | |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "ç产订åid(product_order_id)") |
| | | private Long routeId; |
| | | private Long productOrderId; |
| | | |
| | | @ApiModelProperty(value = "ç产订åçå·¥èºè·¯çº¿id(product_process_route)") |
| | | private Long productRouteId; |
| | | |
| | | @ApiModelProperty(value = "å·¥åºid") |
| | | private Long processId; |
| | |
| | | package com.ruoyi.production.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | |
| | | */ |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.UPDATE) |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime updateTime; |
| | | |
| | | /** |
| | |
| | | |
| | | |
| | | /** |
| | | * è®¡åæ°é |
| | | */ |
| | | @ApiModelProperty(value = "è®¡åæ°é") |
| | | private BigDecimal planQuantity; |
| | | |
| | | /** |
| | | * å®é
æ°é |
| | | */ |
| | | @ApiModelProperty(value = "æ°é") |
| | | private BigDecimal quantity; |
| | | private BigDecimal planQuantity; |
| | | |
| | | /** |
| | | * æ¥å·¥id |
| | | */ |
| | | @ApiModelProperty(value = "æ¥å·¥id") |
| | | private Long productMainId; |
| | | |
| | | } |
| | |
| | | |
| | | public interface ProcessRouteItemService extends IService<ProcessRouteItem> { |
| | | List<ProcessRouteItemDto> listProcessRouteItemDto( ProcessRouteItemDto processRouteItemDto); |
| | | |
| | | int sort(ProcessRouteItem processRouteItem); |
| | | |
| | | String batchDelete(Long id); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.production.dto.ProductOrderDto; |
| | | import com.ruoyi.production.pojo.ProcessRoute; |
| | | import com.ruoyi.production.pojo.ProductOrder; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | public interface ProductOrderService extends IService<ProductOrder> { |
| | | |
| | | IPage<ProductOrderDto> pageProductOrder(Page page, ProductOrderDto productOrder); |
| | | |
| | | int bindingRoute(ProductOrder productOrder); |
| | | |
| | | List<ProcessRoute> listProcessRoute(Long productModelId); |
| | | |
| | | } |
| | |
| | | package com.ruoyi.production.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.production.dto.ProductProcessRouteItemDto; |
| | | import com.ruoyi.production.pojo.ProductProcessRouteItem; |
| | | |
| | |
| | | |
| | | public interface ProductProcessRouteItemService extends IService<ProductProcessRouteItem> { |
| | | List<ProductProcessRouteItemDto> listItem(Long orderId); |
| | | |
| | | R deleteRouteItem(Long id); |
| | | |
| | | R addRouteItem(ProductProcessRouteItem productProcessRouteItem); |
| | | |
| | | int sortRouteItem(ProductProcessRouteItem productProcessRouteItem); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.service; |
| | | |
| | | import com.ruoyi.production.dto.ProcessRouteDto; |
| | | import com.ruoyi.production.pojo.ProductProcessRoute; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-15 02:51:09 |
| | | */ |
| | | public interface ProductProcessRouteService extends IService<ProductProcessRoute> { |
| | | |
| | | ProcessRouteDto listMain(Long orderId); |
| | | } |
| | |
| | | package com.ruoyi.production.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.production.dto.ProcessRouteItemDto; |
| | |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | @AllArgsConstructor |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public class ProcessRouteItemServiceImpl extends ServiceImpl<ProcessRouteItemMapper, ProcessRouteItem> implements ProcessRouteItemService { |
| | | |
| | | @Autowired |
| | |
| | | public List<ProcessRouteItemDto> listProcessRouteItemDto(ProcessRouteItemDto processRouteItemDto) { |
| | | return processRouteItemMapper.listProcessRouteItemDto( processRouteItemDto); |
| | | } |
| | | |
| | | //æåº |
| | | @Override |
| | | public int sort(ProcessRouteItem processRouteItem) { |
| | | //æ¥è¯¢è¢«æ¹å¨çè¿æ¡æ°æ® |
| | | ProcessRouteItem oldProcessRouteItem = processRouteItemMapper.selectById(processRouteItem.getId()); |
| | | //æ¥è¯¢è¯¥å·¥èºè·¯çº¿çææå·¥åºå¹¶æç
§é¡ºåºæåº |
| | | List<ProcessRouteItem> processRouteItems = processRouteItemMapper.selectList(Wrappers.<ProcessRouteItem>lambdaQuery() |
| | | .eq(ProcessRouteItem::getRouteId, oldProcessRouteItem.getRouteId()) |
| | | .orderByAsc(ProcessRouteItem::getDragSort)); |
| | | // è·åç®æ ä½ç½®ï¼ç§»å¨å°ç¬¬å 个ä¹åï¼ |
| | | Integer targetPosition = processRouteItem.getDragSort(); |
| | | if (targetPosition != null && targetPosition >= 0) { |
| | | // ç§»å¨å
ç´ å°æ°çä½ç½® |
| | | processRouteItems.remove(oldProcessRouteItem); |
| | | processRouteItems.add(targetPosition-1, oldProcessRouteItem); |
| | | // æ´æ°ææåå½±åçæåºå段 |
| | | for (int i = 0; i < processRouteItems.size(); i++) { |
| | | ProcessRouteItem item = processRouteItems.get(i); |
| | | if (!item.getId().equals(oldProcessRouteItem.getId())) { |
| | | // æ£æ¥æ¯å¦éè¦æ´æ°æåºå¼ |
| | | if (item.getDragSort() != i+1) { |
| | | item.setDragSort(i+1); |
| | | processRouteItemMapper.updateById(item); |
| | | } |
| | | } else { |
| | | // æ´æ°åè®°å½çæ°æåºä½ç½® |
| | | oldProcessRouteItem.setDragSort(targetPosition); |
| | | processRouteItemMapper.updateById(oldProcessRouteItem); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public String batchDelete(Long id) { |
| | | // æ¥è¯¢è¦å é¤çæ°æ® |
| | | ProcessRouteItem deleteProcessRouteItem = processRouteItemMapper.selectById(id); |
| | | if (deleteProcessRouteItem == null) { |
| | | return "å é¤å¤±è´¥ï¼æªæ¾å°å¯¹åºæ°æ®"; |
| | | } |
| | | Long routeId = deleteProcessRouteItem.getRouteId(); |
| | | // å 餿宿°æ® |
| | | processRouteItemMapper.deleteById(id); |
| | | // æ¥è¯¢è¯¥å·¥èºè·¯çº¿çææå·¥åºå¹¶æç
§é¡ºåºæåº |
| | | List<ProcessRouteItem> processRouteItems = processRouteItemMapper.selectList(Wrappers.<ProcessRouteItem>lambdaQuery() |
| | | .eq(ProcessRouteItem::getRouteId, routeId) |
| | | .orderByAsc(ProcessRouteItem::getDragSort)); |
| | | // éæ°è®¾ç½®æåºå¼ï¼ä½¿åºå·è¿ç» |
| | | for (int i = 0; i < processRouteItems.size(); i++) { |
| | | ProcessRouteItem item = processRouteItems.get(i); |
| | | if (!item.getDragSort().equals(i+1)) { |
| | | item.setDragSort(i+1); |
| | | processRouteItemMapper.updateById(item); |
| | | } |
| | | } |
| | | return "å 餿å"; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.production.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.production.dto.ProductOrderDto; |
| | | import com.ruoyi.production.mapper.ProductOrderMapper; |
| | | import com.ruoyi.production.pojo.ProductOrder; |
| | | import com.ruoyi.production.mapper.*; |
| | | import com.ruoyi.production.pojo.*; |
| | | import com.ruoyi.production.service.ProcessRouteService; |
| | | import com.ruoyi.production.service.ProductOrderService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class ProductOrderServiceImpl extends ServiceImpl<ProductOrderMapper, ProductOrder> implements ProductOrderService { |
| | | |
| | | @Autowired |
| | | private ProductOrderMapper productOrderMapper; |
| | | |
| | | @Autowired |
| | | private ProcessRouteMapper processRouteMapper; |
| | | |
| | | @Autowired |
| | | private ProductProcessRouteMapper productProcessRouteMapper; |
| | | |
| | | @Autowired |
| | | private ProcessRouteItemMapper processRouteItemMapper; |
| | | |
| | | @Autowired |
| | | private ProductProcessRouteItemMapper productProcessRouteItemMapper; |
| | | |
| | | @Autowired |
| | | private ProductWorkOrderMapper productWorkOrderMapper; |
| | | |
| | | |
| | | @Override |
| | | public IPage<ProductOrderDto> pageProductOrder(Page page, ProductOrderDto productOrder) { |
| | | return productOrderMapper.pageProductOrder(page, productOrder); |
| | | } |
| | | |
| | | @Override |
| | | public int bindingRoute(ProductOrder productOrder) { |
| | | //æ°å¢ç产订åä¸çå·¥èºè·¯çº¿ä¸»è¡¨ |
| | | ProcessRoute processRoute = processRouteMapper.selectById(productOrder.getRouteId()); |
| | | ProductProcessRoute productProcessRoute = new ProductProcessRoute(); |
| | | productProcessRoute.setProductModelId(processRoute.getProductModelId()); |
| | | productProcessRoute.setProcessRouteCode(processRoute.getProcessRouteCode()); |
| | | productProcessRoute.setProductOrderId(productOrder.getId()); |
| | | productProcessRoute.setBomId(processRoute.getBomId()); |
| | | productProcessRouteMapper.insert(productProcessRoute); |
| | | //æ°å¢ç产订åä¸çå·¥èºè·¯çº¿å表 |
| | | List<ProcessRouteItem> processRouteItems = processRouteItemMapper.selectList(new QueryWrapper<ProcessRouteItem>().lambda().eq(ProcessRouteItem::getRouteId, processRoute.getId())); |
| | | // çæå½åæ¥æçåç¼ï¼å¹´ææ¥ |
| | | String datePrefix = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")); |
| | | for (ProcessRouteItem processRouteItem : processRouteItems) { |
| | | ProductProcessRouteItem productProcessRouteItem = new ProductProcessRouteItem(); |
| | | productProcessRouteItem.setProductModelId(processRouteItem.getProductModelId()); |
| | | productProcessRouteItem.setProcessId(processRouteItem.getProcessId()); |
| | | productProcessRouteItem.setProductOrderId(productOrder.getId()); |
| | | productProcessRouteItem.setProductRouteId(productProcessRoute.getId()); |
| | | int insert = productProcessRouteItemMapper.insert(productProcessRouteItem); |
| | | if (insert > 0) { |
| | | // æ¥è¯¢ä»æ¥å·²åå¨çæå¤§å·¥åå· |
| | | QueryWrapper<ProductWorkOrder> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.likeRight("work_order_no", datePrefix) |
| | | .orderByDesc("work_order_no") |
| | | .last("LIMIT 1"); |
| | | ProductWorkOrder lastWorkOrder = productWorkOrderMapper.selectOne(queryWrapper); |
| | | int sequenceNumber = 1; // é»è®¤åºå· |
| | | if (lastWorkOrder != null && lastWorkOrder.getWorkOrderNo() != null) { |
| | | String lastNo = lastWorkOrder.getWorkOrderNo().toString(); |
| | | if (lastNo.startsWith(datePrefix)) { |
| | | String seqStr = lastNo.substring(datePrefix.length()); |
| | | try { |
| | | sequenceNumber = Integer.parseInt(seqStr) + 1; |
| | | } catch (NumberFormatException e) { |
| | | sequenceNumber = 1; |
| | | } |
| | | } |
| | | } |
| | | // çæå®æ´çå·¥åå· |
| | | String workOrderNoStr = String.format("%s%03d", datePrefix, sequenceNumber); |
| | | ProductWorkOrder productWorkOrder = new ProductWorkOrder(); |
| | | productWorkOrder.setProductProcessRouteItemId(productProcessRouteItem.getId()); |
| | | productWorkOrder.setProductOrderId(productOrder.getId()); |
| | | productWorkOrder.setPlanQuantity(productOrder.getQuantity()); |
| | | productWorkOrder.setWorkOrderNo(workOrderNoStr); |
| | | productWorkOrder.setStatus(1); |
| | | productWorkOrderMapper.insert(productWorkOrder); |
| | | } |
| | | } |
| | | return productOrderMapper.updateById(productOrder); |
| | | } |
| | | |
| | | @Override |
| | | public List<ProcessRoute> listProcessRoute(Long productModelId) { |
| | | return productOrderMapper.listProcessRoute(productModelId); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.production.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.production.dto.ProductProcessRouteItemDto; |
| | | import com.ruoyi.production.mapper.ProductProcessRouteItemMapper; |
| | | import com.ruoyi.production.pojo.ProductProcessRouteItem; |
| | | import com.ruoyi.production.mapper.*; |
| | | import com.ruoyi.production.pojo.*; |
| | | import com.ruoyi.production.service.ProductProcessRouteItemService; |
| | | import com.ruoyi.quality.mapper.QualityInspectMapper; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @AllArgsConstructor |
| | | public class ProductProcessRouteItemServiceImpl extends ServiceImpl<ProductProcessRouteItemMapper, ProductProcessRouteItem> implements ProductProcessRouteItemService { |
| | | |
| | | @Autowired |
| | | |
| | | private ProductProcessRouteItemMapper productProcessRouteItemMapper; |
| | | |
| | | private ProductionProductMainMapper productionProductMainMapper; |
| | | |
| | | private ProductionProductInputMapper productionProductInputMapper; |
| | | |
| | | private ProductionProductOutputMapper productionProductOutputMapper; |
| | | |
| | | private QualityInspectMapper qualityInspectMapper; |
| | | |
| | | private SalesLedgerProductionAccountingMapper salesLedgerProductionAccountingMapper; |
| | | |
| | | private ProductWorkOrderMapper productWorkOrderMapper; |
| | | |
| | | private ProductOrderMapper productOrderMapper; |
| | | |
| | | private ProductProcessRouteMapper productProcessRouteMapper; |
| | | |
| | | private SalesLedgerProductMapper salesLedgerProductMapper; |
| | | |
| | | |
| | | @Override |
| | | public List<ProductProcessRouteItemDto> listItem(Long orderId) { |
| | | return productProcessRouteItemMapper.listItem(orderId); |
| | | } |
| | | |
| | | @Override |
| | | public R deleteRouteItem(Long id) { |
| | | Long routeItemId = id; |
| | | try { |
| | | // æ¥è¯¢å·¥å |
| | | ProductWorkOrder productWorkOrder = productWorkOrderMapper.selectOne( |
| | | new LambdaQueryWrapper<ProductWorkOrder>() |
| | | .eq(ProductWorkOrder::getProductProcessRouteItemId, routeItemId) |
| | | .last("LIMIT 1") |
| | | ); |
| | | if (productWorkOrder == null) { |
| | | throw new RuntimeException("å é¤å¤±è´¥ï¼æªæ¾å°å
³èçç产工å"); |
| | | } |
| | | Long workOrderId = productWorkOrder.getId(); |
| | | Long productOrderId = productWorkOrder.getProductOrderId(); |
| | | // æ¥è¯¢ç产主表 |
| | | List<ProductionProductMain> productionProductMains = productionProductMainMapper.selectList( |
| | | new LambdaQueryWrapper<ProductionProductMain>() |
| | | .eq(ProductionProductMain::getWorkOrderId, workOrderId) |
| | | ); |
| | | if (!productionProductMains.isEmpty()) { |
| | | // æ¹éå é¤å表 |
| | | for (ProductionProductMain main : productionProductMains) { |
| | | Long mainId = main.getId(); |
| | | // å 餿å
¥ |
| | | productionProductInputMapper.delete(new LambdaQueryWrapper<ProductionProductInput>() |
| | | .eq(ProductionProductInput::getProductMainId, mainId)); |
| | | // å é¤äº§åº |
| | | productionProductOutputMapper.delete(new LambdaQueryWrapper<ProductionProductOutput>() |
| | | .eq(ProductionProductOutput::getProductMainId, mainId)); |
| | | // å é¤è´¨æ£ |
| | | qualityInspectMapper.delete(new LambdaQueryWrapper<QualityInspect>() |
| | | .eq(QualityInspect::getProductMainId, mainId)); |
| | | } |
| | | } |
| | | // å 餿¥å·¥ï¼çäº§ä¸»è¡¨ï¼ |
| | | productionProductMainMapper.delete(new LambdaQueryWrapper<ProductionProductMain>() |
| | | .eq(ProductionProductMain::getWorkOrderId, workOrderId)); |
| | | // æ¥è¯¢è®¢å + å 餿 ¸ç® |
| | | ProductOrder productOrder = productOrderMapper.selectById(productOrderId); |
| | | if (productOrder != null && productOrder.getSalesLedgerId() != null) { |
| | | salesLedgerProductionAccountingMapper.delete(new LambdaQueryWrapper<SalesLedgerProductionAccounting>() |
| | | .eq(SalesLedgerProductionAccounting::getSalesLedgerId, productOrder.getSalesLedgerId())); |
| | | } |
| | | // å é¤å
³èå·¥å |
| | | productWorkOrderMapper.delete(new LambdaQueryWrapper<ProductWorkOrder>() |
| | | .eq(ProductWorkOrder::getProductProcessRouteItemId, routeItemId)); |
| | | |
| | | // å é¤ä¸»è¡¨æ°æ® |
| | | ProductProcessRouteItem deleteProductProcessRouteItem = productProcessRouteItemMapper.selectById(routeItemId); |
| | | Long productRouteId = deleteProductProcessRouteItem.getProductRouteId(); |
| | | // å 餿宿°æ® |
| | | productProcessRouteItemMapper.deleteById(id); |
| | | // æ¥è¯¢è¯¥å·¥èºè·¯çº¿çææå·¥åºå¹¶æç
§é¡ºåºæåº |
| | | List<ProductProcessRouteItem> productProcessRouteItems = productProcessRouteItemMapper.selectList(Wrappers.<ProductProcessRouteItem>lambdaQuery() |
| | | .eq(ProductProcessRouteItem::getProductRouteId, productRouteId) |
| | | .orderByAsc(ProductProcessRouteItem::getDragSort)); |
| | | // éæ°è®¾ç½®æåºå¼ï¼ä½¿åºå·è¿ç» |
| | | for (int i = 0; i < productProcessRouteItems.size(); i++) { |
| | | ProductProcessRouteItem item = productProcessRouteItems.get(i); |
| | | if (!item.getDragSort().equals(i + 1)) { |
| | | item.setDragSort(i + 1); |
| | | productProcessRouteItemMapper.updateById(item); |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException("å é¤ç产工èºè·¯çº¿å¤±è´¥ï¼" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public R addRouteItem(ProductProcessRouteItem productProcessRouteItem) { |
| | | ProductOrder productOrder = productOrderMapper.selectById(productProcessRouteItem.getProductOrderId()); |
| | | int insert = productProcessRouteItemMapper.insert(productProcessRouteItem); |
| | | // çæå½åæ¥æçåç¼ï¼å¹´ææ¥ |
| | | String datePrefix = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")); |
| | | if (insert > 0) { |
| | | // æ¥è¯¢ä»æ¥å·²åå¨çæå¤§å·¥åå· |
| | | QueryWrapper<ProductWorkOrder> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.likeRight("work_order_no", datePrefix) |
| | | .orderByDesc("work_order_no") |
| | | .last("LIMIT 1"); |
| | | ProductWorkOrder lastWorkOrder = productWorkOrderMapper.selectOne(queryWrapper); |
| | | int sequenceNumber = 1; // é»è®¤åºå· |
| | | if (lastWorkOrder != null && lastWorkOrder.getWorkOrderNo() != null) { |
| | | String lastNo = lastWorkOrder.getWorkOrderNo().toString(); |
| | | if (lastNo.startsWith(datePrefix)) { |
| | | String seqStr = lastNo.substring(datePrefix.length()); |
| | | try { |
| | | sequenceNumber = Integer.parseInt(seqStr) + 1; |
| | | } catch (NumberFormatException e) { |
| | | sequenceNumber = 1; |
| | | } |
| | | } |
| | | } |
| | | // çæå®æ´çå·¥åå· |
| | | String workOrderNoStr = String.format("%s%03d", datePrefix, sequenceNumber); |
| | | ProductWorkOrder productWorkOrder = new ProductWorkOrder(); |
| | | productWorkOrder.setProductProcessRouteItemId(productProcessRouteItem.getId()); |
| | | productWorkOrder.setProductOrderId(productProcessRouteItem.getProductOrderId()); |
| | | productWorkOrder.setPlanQuantity(productOrder.getQuantity()); |
| | | productWorkOrder.setWorkOrderNo(workOrderNoStr); |
| | | productWorkOrder.setStatus(1); |
| | | productWorkOrderMapper.insert(productWorkOrder); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Override |
| | | public int sortRouteItem(ProductProcessRouteItem productProcessRouteItem) { |
| | | //æ¥è¯¢è¢«æ¹å¨çè¿æ¡æ°æ® |
| | | ProductProcessRouteItem oldProductProcessRouteItem = productProcessRouteItemMapper.selectById(productProcessRouteItem.getId()); |
| | | //æ¥è¯¢è¯¥å·¥èºè·¯çº¿çææå·¥åºå¹¶æç
§é¡ºåºæåº |
| | | List<ProductProcessRouteItem> productProcessRouteItems = productProcessRouteItemMapper.selectList(Wrappers.<ProductProcessRouteItem>lambdaQuery() |
| | | .eq(ProductProcessRouteItem::getProductRouteId, oldProductProcessRouteItem.getProductRouteId()) |
| | | .orderByAsc(ProductProcessRouteItem::getDragSort)); |
| | | // è·åç®æ ä½ç½®ï¼ç§»å¨å°ç¬¬å 个ä¹åï¼ |
| | | Integer targetPosition = productProcessRouteItem.getDragSort(); |
| | | if (targetPosition != null && targetPosition >= 0) { |
| | | // ç§»å¨å
ç´ å°æ°çä½ç½® |
| | | productProcessRouteItems.remove(oldProductProcessRouteItem); |
| | | productProcessRouteItems.add(targetPosition-1, oldProductProcessRouteItem); |
| | | // æ´æ°ææåå½±åçæåºå段 |
| | | for (int i = 0; i < productProcessRouteItems.size(); i++) { |
| | | ProductProcessRouteItem item = productProcessRouteItems.get(i); |
| | | if (!item.getId().equals(oldProductProcessRouteItem.getId())) { |
| | | // æ£æ¥æ¯å¦éè¦æ´æ°æåºå¼ |
| | | if (item.getDragSort() != i+1) { |
| | | item.setDragSort(i+1); |
| | | productProcessRouteItemMapper.updateById(item); |
| | | } |
| | | } else { |
| | | // æ´æ°åè®°å½çæ°æåºä½ç½® |
| | | oldProductProcessRouteItem.setDragSort(targetPosition); |
| | | productProcessRouteItemMapper.updateById(oldProductProcessRouteItem); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.service.impl; |
| | | |
| | | import com.ruoyi.production.dto.ProcessRouteDto; |
| | | import com.ruoyi.production.pojo.ProductProcessRoute; |
| | | import com.ruoyi.production.mapper.ProductProcessRouteMapper; |
| | | import com.ruoyi.production.service.ProductProcessRouteService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-15 02:51:09 |
| | | */ |
| | | @Service |
| | | public class ProductProcessRouteServiceImpl extends ServiceImpl<ProductProcessRouteMapper, ProductProcessRoute> implements ProductProcessRouteService { |
| | | |
| | | @Autowired |
| | | private ProductProcessRouteMapper productProcessRouteMapper; |
| | | |
| | | @Override |
| | | public ProcessRouteDto listMain(Long orderId) { |
| | | return productProcessRouteMapper.listMain(orderId); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordOutMapper; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementRecordOut; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.production.controller.ProductWorkOrderController; |
| | | import com.ruoyi.production.dto.ProductStructureDto; |
| | |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.quality.pojo.QualityInspectParam; |
| | | import com.ruoyi.quality.pojo.QualityTestStandard; |
| | | import io.swagger.models.auth.In; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | @AllArgsConstructor |
| | | public class ProductionProductMainServiceImpl extends ServiceImpl<ProductionProductMainMapper, ProductionProductMain> implements ProductionProductMainService { |
| | | |
| | | private final ProcurementRecordOutMapper procurementRecordOutMapper; |
| | | private ProductionProductMainMapper productionProductMainMapper; |
| | | |
| | | private ProductWorkOrderController productWorkOrderController; |
| | |
| | | SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | | |
| | | |
| | | |
| | | // æ°å¢é»è¾ |
| | | ProductionProductMain productionProductMain = new ProductionProductMain(); |
| | | ProductProcessRouteItem productProcessRouteItem = productProcessRouteItemMapper.selectById(dto.getProductProcessRouteItemId()); |
| | |
| | | productionProductMain.setProductProcessRouteItemId(dto.getProductProcessRouteItemId()); |
| | | productionProductMain.setWorkOrderId(dto.getWorkOrderId()); |
| | | productionProductMain.setStatus(0); |
| | | |
| | | // æ·»å æ¥å·¥ä¸»è¡¨ |
| | | int insert = productionProductMainMapper.insert(productionProductMain); |
| | | |
| | |
| | | List<ProductStructureDto> productStructureDtos = productStructureMapper.listByproductModelId(productModel.getId()); |
| | | for (ProductStructureDto productStructureDto : productStructureDtos) { |
| | | ProductModel productModel1 = productModelMapper.selectById(productStructureDto.getProductModelId()); |
| | | |
| | | Product product = productMapper.selectById(productModel1.getProductId()); |
| | | BigDecimal stockQuantity = stockUtils.getStockQuantity(productModel1.getId()).get("stockQuantity"); |
| | | if (!(stockQuantity.compareTo(BigDecimal.ZERO) > 0)) { |
| | | throw new RuntimeException("åºåä¸è¶³"); |
| | | throw new RuntimeException(product.getProductName() + "åºå为0"); |
| | | } |
| | | if (stockQuantity.compareTo(productStructureDto.getUnitQuantity().multiply(dto.getQuantity())) < 0) { |
| | | throw new RuntimeException(product.getProductName() + "åºåä¸è¶³"); |
| | | } |
| | | ProductionProductInput productionProductInput = new ProductionProductInput(); |
| | | productionProductInput.setProductModelId(productStructureDto.getProductModelId()); |
| | | productionProductInput.setQuantity(productStructureDto.getUnitQuantity().multiply(dto.getQuantity())); |
| | | productionProductInput.setProductMainId(productionProductMain.getId()); |
| | | productionProductInputMapper.insert(productionProductInput); |
| | | |
| | | |
| | | DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyyMMdd"); |
| | | LocalDate now = LocalDate.now(); |
| | | ProcurementRecordOut procurementRecordOut1 = procurementRecordOutMapper.selectCode(dateFormat.format(now)); |
| | | Long aLong = procurementRecordOut1 == null ? 1L : Long.valueOf(procurementRecordOut1.getCode().split("LS"+dateFormat.format(now))[1]); |
| | | //æ·»å åºåºå¤ç |
| | | ProcurementRecordOut.ProcurementRecordOutBuilder procurementRecordOut = ProcurementRecordOut.builder() |
| | | .procurementRecordStorageId(0) |
| | | .code("LS" + dateFormat.format(now) + String.format("%03d", aLong + 1)) |
| | | .salesLedgerProductId(0) |
| | | .inboundBatches(aLong.equals(0L) ? "第1æ¹æ¬¡" : "第"+ (aLong + 1) + "æ¹æ¬¡") |
| | | .inboundNum(productionProductInput.getQuantity()) |
| | | .type(4) |
| | | .createTime(LocalDateTime.now()) |
| | | .createUser(user.getUserId()) |
| | | .createBy(user.getNickName()) |
| | | .updateUser(user.getUserId()) |
| | | .updateTime(LocalDateTime.now()) |
| | | .productModelId(productModel1.getId()); |
| | | procurementRecordOutMapper.insert(procurementRecordOut.build()); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | // è·åç产订å |
| | | ProductWorkOrder productWorkOrder = productWorkOrderMapper.selectById(dto.getWorkOrderId()); |
| | | List<ProductionProductMain> productionProductMains = productionProductMainMapper.selectList(new QueryWrapper<ProductionProductMain>().lambda().eq(ProductionProductMain::getWorkOrderId, dto.getWorkOrderId())); |
| | | |
| | | if (productionProductMains.isEmpty()) { |
| | | productWorkOrder.setActualStartTime(LocalDate.now()); |
| | | } |
| | | ProductOrder productOrder = productOrderMapper.selectById(productWorkOrder.getProductOrderId()); |
| | | if (productOrder == null) { |
| | | throw new RuntimeException("ç产订åä¸åå¨"); |
| | |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | IPage<PurchaseLedgerDto> purchaseLedgerDtoIPage = purchaseLedgerService.selectPurchaseLedgerListPage(page ,purchaseLedger); |
| | | //è¿æ»¤æapprovalStatus=3çè®°å½ |
| | | purchaseLedgerDtoIPage.getRecords().removeIf(purchaseLedgerDto -> purchaseLedgerDto.getApprovalStatus() == 3); |
| | | purchaseLedgerDtoIPage.getRecords().forEach(purchaseLedgerDto -> { |
| | | if (purchaseLedgerDto.getUnReceiptPaymentAmount().compareTo(BigDecimal.ZERO) == 0) { |
| | | purchaseLedgerDto.setUnReceiptPaymentAmount(purchaseLedgerDto.getContractAmount()); |
| | | } |
| | | }); |
| | | return AjaxResult.success(purchaseLedgerDtoIPage); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | @GetMapping("/getProductRecordById") |
| | | public AjaxResult getProductRecordById(Long id) { |
| | | if (id == null) { |
| | | @PostMapping("/getProductRecordById") |
| | | public AjaxResult getProductRecordById(@RequestBody ProductRecordDto productRecordDto) { |
| | | if (productRecordDto.getId() == null) { |
| | | return AjaxResult.error("åæ°é误"); |
| | | } |
| | | return AjaxResult.success(productRecordService.getProductRecordById(id)); |
| | | return AjaxResult.success(productRecordService.getProductRecordById(productRecordDto)); |
| | | } |
| | | |
| | | @ApiModelProperty("ä¿®æ¹æ¥ç¥¨ç»è®°") |
| | |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | |
| | | private String projectName; |
| | | private Long issUerId; |
| | | private String issUer; |
| | | /** |
| | | * ååéé¢ï¼äº§åå«ç¨æ»ä»·ï¼ |
| | | */ |
| | | private BigDecimal contractAmount = BigDecimal.ZERO; |
| | | //å¢å¼ç¨ |
| | | private String invoiceAmount = "0"; |
| | | |
| | | /** |
| | | * å·²æ¥ç¥¨éé¢ï¼å票éé¢ï¼ |
| | | */ |
| | | private BigDecimal invoiceTotal = BigDecimal.ZERO; |
| | | private BigDecimal invoiceAmount = BigDecimal.ZERO; |
| | | /** |
| | | * åç¥¨å· |
| | | */ |
| | | private String invoiceNumber; |
| | | |
| | | private String unTicketsPrice = "0"; |
| | | private BigDecimal unTicketsPrice = BigDecimal.ZERO; |
| | | |
| | | private List<CommonFile> commonFiles; |
| | | |
| | |
| | | import com.ruoyi.purchase.pojo.ProductRecord; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * éè´å°è´¦äº§åå¼ç¥¨è®°å½Mapperæ¥å£ |
| | | * |
| | |
| | | |
| | | IPage<ProductRecordDto> productRecordPage(Page page, @Param("c") TicketRegistrationDto ticketRegistrationDto); |
| | | |
| | | ProductRecordDto getProductRecordById(Long id); |
| | | List<ProductRecordDto> getProductRecordById(@Param("c") ProductRecordDto productRecordDto); |
| | | } |
| | |
| | | |
| | | AjaxResult updateRecord(ProductRecordDto productRecordDto); |
| | | |
| | | ProductRecordDto getProductRecordById(Long id); |
| | | ProductRecordDto getProductRecordById(ProductRecordDto productRecordDto); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public ProductRecordDto getProductRecordById(Long id) { |
| | | ProductRecordDto productRecordDto = productRecordMapper.getProductRecordById(id); |
| | | return productRecordDto; |
| | | public ProductRecordDto getProductRecordById(ProductRecordDto productRecordDto) { |
| | | List<ProductRecordDto> productRecordDtoList = productRecordMapper.getProductRecordById(productRecordDto); |
| | | if(productRecordDtoList != null && productRecordDtoList.size() > 0){ |
| | | ProductRecordDto productRecordDto1 = productRecordDtoList.get(productRecordDtoList.size() - 1); |
| | | // è¿æ»¤åºä¸ä¼ å
¥ç productRecordDto 主é®ç¸åçè®°å½ |
| | | ProductRecordDto productRecordDto2 = productRecordDtoList.stream().filter(item -> |
| | | item.getId().equals(productRecordDto.getId())) |
| | | .findFirst().orElse(null); |
| | | productRecordDto2.setFutureTickets(productRecordDto1.getFutureTickets()); |
| | | productRecordDto2.setFutureTicketsAmount(productRecordDto1.getFutureTicketsAmount()); |
| | | return productRecordDto2; |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | |
| | | LocalDateTime localDateTime = entryDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); |
| | | salesLedgerProduct.setRegisterDate(localDateTime); |
| | | salesLedgerProduct.setFutureTickets(salesLedgerProduct.getQuantity()); |
| | | salesLedgerProduct.setFutureTicketsAmount(salesLedgerProduct.getTaxInclusiveTotalPrice()); |
| | | salesLedgerProductMapper.insert(salesLedgerProduct); |
| | | } |
| | | } |
| | |
| | | LambdaQueryWrapper<QualityInspect> materialInspectLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | materialInspectLambdaQueryWrapper.in(QualityInspect::getPurchaseLedgerId, ids); |
| | | List<QualityInspect> qualityInspects = qualityInspectMapper.selectList(materialInspectLambdaQueryWrapper); |
| | | qualityInspects.stream().forEach(qualityInspect -> { |
| | | if (qualityInspect.getInspectState().equals(1)) { |
| | | throw new BaseException("å·²æäº¤çæ£éªåä¸è½å é¤"); |
| | | } |
| | | }); |
| | | List<Long> inspectIds = qualityInspects.stream() |
| | | .map(QualityInspect::getId) |
| | | .collect(Collectors.toList()); |
| | |
| | | procurementRecordOutAdd.setDetails(details); |
| | | |
| | | ProcurementRecordStorage.ProcurementRecordStorageBuilder procurementRecordBuilder = ProcurementRecordStorage.builder() |
| | | .salesLedgerProductId(details1.getId()) |
| | | .salesLedgerProductId(0) |
| | | .inboundBatches( "ç产åæåå
¥åº") |
| | | .inboundNum(details1.getInboundQuantity()) |
| | | .type(2) |
| | |
| | | List<Details> details = new ArrayList<>(); |
| | | Details details1 = new Details(); |
| | | details1.setInboundQuantity(qualityInspect.getQuantity()); |
| | | details1.setId(Math.toIntExact(salesLedgerProduct.getProductId())); |
| | | details1.setId(Math.toIntExact(salesLedgerProduct.getId())); |
| | | details1.setUnitPrice(salesLedgerProduct.getTaxInclusiveUnitPrice()); |
| | | details1.setTotalPrice(salesLedgerProduct.getTaxInclusiveTotalPrice()); |
| | | details1.setProductModelId(salesLedgerProduct.getProductModelId()); |
| | |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | { |
| | | List<SalesLedgerProduct> list = salesLedgerProductService.selectSalesLedgerProductList(salesLedgerProduct); |
| | | list.forEach(item -> { |
| | | if (item.getFutureTickets().compareTo(BigDecimal.ZERO) == 0) { |
| | | item.setFutureTickets(item.getQuantity()); |
| | | } |
| | | if (item.getFutureTicketsAmount().compareTo(BigDecimal.ZERO) == 0) { |
| | | item.setFutureTicketsAmount(item.getTaxInclusiveTotalPrice()); |
| | | } |
| | | ProcurementPageDto procurementDto = new ProcurementPageDto(); |
| | | procurementDto.setSalesLedgerProductId(item.getId()); |
| | | procurementDto.setProductCategory(item.getProductCategory()); |
| | |
| | | /** |
| | | * æ¬æ¬¡æ¥ç¥¨æ° |
| | | */ |
| | | private BigDecimal ticketsNum; |
| | | private BigDecimal ticketsNum=BigDecimal.ZERO; |
| | | |
| | | /** |
| | | * æ¬æ¬¡æ¥ç¥¨éé¢(å
) |
| | | */ |
| | | private BigDecimal ticketsAmount; |
| | | private BigDecimal ticketsAmount=BigDecimal.ZERO; |
| | | |
| | | /** |
| | | * æªæ¥ç¥¨æ° |
| | | */ |
| | | private BigDecimal futureTickets; |
| | | private BigDecimal futureTickets=BigDecimal.ZERO; |
| | | |
| | | /** |
| | | * æªæ¥ç¥¨éé¢(å
) |
| | | */ |
| | | private BigDecimal futureTicketsAmount; |
| | | private BigDecimal futureTicketsAmount=BigDecimal.ZERO; |
| | | |
| | | @ApiModelProperty(value = "å¼ç¥¨æ°") |
| | | private BigDecimal invoiceNum; |
| | |
| | | private InvoiceRegistrationProductMapper invoiceRegistrationProductMapper; |
| | | |
| | | private ProcessRouteMapper processRouteMapper; |
| | | private ProductProcessRouteMapper productProcessRouteMapper; |
| | | |
| | | private ProductWorkOrderMapper productWorkOrderMapper; |
| | | |
| | |
| | | // æ¹éæ¥è¯¢processRouteItems |
| | | List<ProductProcessRouteItem> allRouteItems = productProcessRouteItemMapper.selectList( |
| | | new LambdaQueryWrapper<ProductProcessRouteItem>() |
| | | .in(ProductProcessRouteItem::getRouteId, orderIds) |
| | | .in(ProductProcessRouteItem::getProductOrderId, orderIds) |
| | | ); |
| | | |
| | | if (!CollectionUtils.isEmpty(allRouteItems)) { |
| | |
| | | .in(ProductWorkOrder::getProductProcessRouteItemId, routeItemIds)); |
| | | } |
| | | |
| | | // æ¹éå é¤processRouteItem |
| | | // æ¹éå é¤productProcessRouteItem |
| | | productProcessRouteItemMapper.delete(new LambdaQueryWrapper<ProductProcessRouteItem>() |
| | | .in(ProductProcessRouteItem::getRouteId, orderIds)); |
| | | .in(ProductProcessRouteItem::getProductOrderId, orderIds)); |
| | | |
| | | // æ¹éå é¤productProcessRoute |
| | | productProcessRouteMapper.delete(new LambdaQueryWrapper<ProductProcessRoute>() |
| | | .in(ProductProcessRoute::getProductOrderId, orderIds)); |
| | | |
| | | // æ¹éå é¤productOrder |
| | | productOrderMapper.delete(new LambdaQueryWrapper<ProductOrder>() |
| | |
| | | productOrder.setSalesLedgerId(salesLedgerProduct.getSalesLedgerId()); |
| | | productOrder.setProductModelId(salesLedgerProduct.getId()); |
| | | productOrder.setNpsNo("SC" + String.format("%08d", salesLedgerProduct.getId())); |
| | | productOrder.setQuantity(salesLedgerProduct.getQuantity());//éæ±æ°é |
| | | productOrder.setCompleteQuantity(BigDecimal.ZERO);//宿æ°é |
| | | productOrderMapper.insert(productOrder); |
| | | |
| | | ProcessRoute processRoute = processRouteMapper.selectOne(new QueryWrapper<ProcessRoute>().lambda().eq(ProcessRoute::getProductModelId, salesLedgerProduct.getProductModelId())); |
| | | if (processRoute != null) { |
| | | //æ°å¢ç产订åå·¥èºè·¯çº¿ä¸»è¡¨ |
| | | ProductProcessRoute productProcessRoute = new ProductProcessRoute(); |
| | | productProcessRoute.setProductModelId(processRoute.getProductModelId()); |
| | | productProcessRoute.setProcessRouteCode(processRoute.getProcessRouteCode()); |
| | | productProcessRoute.setProductOrderId(productOrder.getId()); |
| | | productProcessRoute.setBomId(processRoute.getBomId()); |
| | | productProcessRouteMapper.insert(productProcessRoute); |
| | | //æ°å¢ç产订åå·¥èºè·¯çº¿å表 |
| | | List<ProcessRouteItem> processRouteItems = processRouteItemMapper.selectList(new QueryWrapper<ProcessRouteItem>().lambda().eq(ProcessRouteItem::getRouteId, processRoute.getId())); |
| | | // çæå½åæ¥æçåç¼ï¼å¹´ææ¥ |
| | | String datePrefix = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")); |
| | |
| | | ProductProcessRouteItem productProcessRouteItem = new ProductProcessRouteItem(); |
| | | productProcessRouteItem.setProductModelId(processRouteItem.getProductModelId()); |
| | | productProcessRouteItem.setProcessId(processRouteItem.getProcessId()); |
| | | productProcessRouteItem.setRouteId(productOrder.getId()); |
| | | productProcessRouteItem.setProductOrderId(productOrder.getId()); |
| | | productProcessRouteItem.setProductRouteId(productProcessRoute.getId()); |
| | | int insert = productProcessRouteItemMapper.insert(productProcessRouteItem); |
| | | if (insert > 0) { |
| | | // æ¥è¯¢ä»æ¥å·²åå¨çæå¤§å·¥åå· |
| | |
| | | import com.ruoyi.account.pojo.AccountIncome; |
| | | import com.ruoyi.account.service.AccountIncomeService; |
| | | import com.ruoyi.basic.mapper.CustomerMapper; |
| | | import com.ruoyi.basic.mapper.ProductModelMapper; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.other.mapper.TempFileMapper; |
| | | import com.ruoyi.other.pojo.TempFile; |
| | | import com.ruoyi.production.dto.ProductStructureDto; |
| | | import com.ruoyi.production.mapper.*; |
| | | import com.ruoyi.production.pojo.*; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | |
| | | private final ProductOrderMapper productOrderMapper; |
| | | |
| | | private final ProcessRouteMapper processRouteMapper; |
| | | private final ProductProcessRouteMapper productProcessRouteMapper; |
| | | |
| | | private final ProcessRouteItemMapper processRouteItemMapper; |
| | | |
| | |
| | | private static final long LOCK_EXPIRE_TIME = 30; // éèªå¨è¿ææ¶é´ï¼ç§ï¼ |
| | | |
| | | private final RedisTemplate<String, String> redisTemplate; |
| | | @Autowired |
| | | private ProductModelMapper productModelMapper; |
| | | @Autowired |
| | | private ProductStructureMapper productStructureMapper; |
| | | |
| | | @Override |
| | | public List<SalesLedger> selectSalesLedgerList(SalesLedgerDto salesLedgerDto) { |
| | |
| | | // æ¹éæ¥è¯¢processRouteItems |
| | | List<ProductProcessRouteItem> allRouteItems = productProcessRouteItemMapper.selectList( |
| | | new LambdaQueryWrapper<ProductProcessRouteItem>() |
| | | .in(ProductProcessRouteItem::getRouteId, orderIds) |
| | | .in(ProductProcessRouteItem::getProductOrderId, orderIds) |
| | | ); |
| | | |
| | | if (!CollectionUtils.isEmpty(allRouteItems)) { |
| | |
| | | } |
| | | // æ¹éå é¤processRouteItem |
| | | productProcessRouteItemMapper.delete(new LambdaQueryWrapper<ProductProcessRouteItem>() |
| | | .in(ProductProcessRouteItem::getRouteId, orderIds)); |
| | | .in(ProductProcessRouteItem::getProductOrderId, orderIds)); |
| | | |
| | | // æ¹éå é¤productProcessRoute |
| | | productProcessRouteMapper.delete(new LambdaQueryWrapper<ProductProcessRoute>() |
| | | .in(ProductProcessRoute::getProductOrderId, orderIds)); |
| | | |
| | | // æ¹éå é¤productOrder |
| | | productOrderMapper.delete(new LambdaQueryWrapper<ProductOrder>() |
| | |
| | | productOrder.setSalesLedgerId(salesLedgerProduct.getSalesLedgerId()); |
| | | productOrder.setProductModelId(salesLedgerProduct.getId()); |
| | | productOrder.setNpsNo("SC" + String.format("%08d", salesLedgerProduct.getId())); |
| | | productOrder.setQuantity(salesLedgerProduct.getQuantity());//éæ±æ°é |
| | | productOrder.setCompleteQuantity(BigDecimal.ZERO);//宿æ°é |
| | | productOrderMapper.insert(productOrder); |
| | | |
| | | ProcessRoute processRoute = processRouteMapper.selectOne(new QueryWrapper<ProcessRoute>().lambda().eq(ProcessRoute::getProductModelId, salesLedgerProduct.getProductModelId())); |
| | | List<ProductStructureDto> productStructureDtos = productStructureMapper.listByproductModelId(salesLedgerProduct.getProductModelId()); |
| | | if (processRoute != null) { |
| | | //æ°å¢ç产订åå·¥èºè·¯çº¿ä¸»è¡¨ |
| | | ProductProcessRoute productProcessRoute = new ProductProcessRoute(); |
| | | productProcessRoute.setProductModelId(processRoute.getProductModelId()); |
| | | productProcessRoute.setProcessRouteCode(processRoute.getProcessRouteCode()); |
| | | productProcessRoute.setProductOrderId(productOrder.getId()); |
| | | productProcessRoute.setBomId(processRoute.getBomId()); |
| | | productProcessRouteMapper.insert(productProcessRoute); |
| | | //æ°å¢ç产订åå·¥èºè·¯çº¿å表 |
| | | List<ProcessRouteItem> processRouteItems = processRouteItemMapper.selectList(new QueryWrapper<ProcessRouteItem>().lambda().eq(ProcessRouteItem::getRouteId, processRoute.getId())); |
| | | // çæå½åæ¥æçåç¼ï¼å¹´ææ¥ |
| | | String datePrefix = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")); |
| | | int dragSort = 1; |
| | | for (ProcessRouteItem processRouteItem : processRouteItems) { |
| | | ProductProcessRouteItem productProcessRouteItem = new ProductProcessRouteItem(); |
| | | productProcessRouteItem.setProductModelId(processRouteItem.getProductModelId()); |
| | | productProcessRouteItem.setProcessId(processRouteItem.getProcessId()); |
| | | productProcessRouteItem.setRouteId(productOrder.getId()); |
| | | productProcessRouteItem.setDragSort(dragSort); |
| | | productProcessRouteItem.setProductOrderId(productOrder.getId()); |
| | | productProcessRouteItem.setProductRouteId(productProcessRoute.getId()); |
| | | productProcessRouteItem.setDragSort(processRouteItem.getDragSort()); |
| | | int insert = productProcessRouteItemMapper.insert(productProcessRouteItem); |
| | | if (insert > 0) { |
| | | // æ¥è¯¢ä»æ¥å·²åå¨çæå¤§å·¥åå· |
| | |
| | | // çæå®æ´çå·¥åå· |
| | | String workOrderNoStr = String.format("%s%03d", datePrefix, sequenceNumber); |
| | | ProductWorkOrder productWorkOrder = new ProductWorkOrder(); |
| | | productStructureDtos.stream().forEach(productStructureDto -> { |
| | | if (productStructureDto.getProductModelId().equals(productProcessRouteItem.getProductModelId())){ |
| | | productWorkOrder.setPlanQuantity(productWorkOrder.getPlanQuantity()); |
| | | } |
| | | }); |
| | | if (Objects.equals(productProcessRouteItem.getProductModelId(), salesLedgerProduct.getProductModelId())) { |
| | | productWorkOrder.setPlanQuantity(salesLedgerProduct.getQuantity()); |
| | | } |
| | | productWorkOrder.setProductProcessRouteItemId(productProcessRouteItem.getId()); |
| | | productWorkOrder.setProductOrderId(productOrder.getId()); |
| | | productWorkOrder.setPlanQuantity(salesLedgerProduct.getQuantity()); |
| | | productWorkOrder.setWorkOrderNo(workOrderNoStr); |
| | | productWorkOrder.setStatus(1); |
| | | productWorkOrderMapper.insert(productWorkOrder); |
| | | } |
| | | dragSort++; |
| | | } |
| | | productOrder.setRouteId(processRoute.getId()); |
| | | productOrderMapper.updateById(productOrder); |
| | |
| | | left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id and t2.type = 1 |
| | | left join sales_ledger t3 on t3.id = t2.sales_ledger_id |
| | | <where> |
| | | t1.type = 2 |
| | | t1.type = 2 and t1.sales_ledger_product_id != 0 |
| | | <if test="req.customerName != null and req.customerName != ''"> |
| | | and t3.customer_name like concat('%',#{req.customerName},'%') |
| | | </if> |
| | |
| | | from procurement_record_storage |
| | | where product_model_id = #{productModelId} |
| | | </select> |
| | | <select id="listPageByProductProduction" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDto"> |
| | | select |
| | | t1.*, |
| | | t2.model as specification_model , |
| | | t2.unit, |
| | | t3.product_name as product_category |
| | | from procurement_record_storage t1 |
| | | left join product_model t2 on t1.product_model_id = t2.id |
| | | left join product t3 on t2.product_id = t3.id |
| | | <where> |
| | | t1.type = 2 and t1.sales_ledger_product_id = 0 |
| | | <if test="req.productCategory != null and req.productCategory != ''"> |
| | | and t3.product_name like concat('%',#{req.productCategory},'%') |
| | | </if> |
| | | |
| | | <if test="req.timeStr != null and req.timeStr != ''"> |
| | | and t1.create_time like concat('%',#{req.timeStr},'%') |
| | | </if> |
| | | </where> |
| | | order by t1.create_time desc |
| | | </select> |
| | | </mapper> |
| | |
| | | order by t1.create_time desc |
| | | </select> |
| | | <select id="list" resultType="com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto"> |
| | | select |
| | | t3.supplier_name, |
| | | select t3.supplier_name, |
| | | t2.product_category, |
| | | t1.id, |
| | | t2.specification_model, |
| | |
| | | </select> |
| | | |
| | | <select id="listOne" resultType="com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto"> |
| | | select |
| | | t3.customer_contract_no, |
| | | select t3.customer_contract_no, |
| | | t3.sales_contract_no, |
| | | t3.customer_name, |
| | | t2.product_category, |
| | |
| | | </select> |
| | | |
| | | <select id="listTwo" resultType="com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto"> |
| | | select |
| | | t1.supplier_name, |
| | | select t1.supplier_name, |
| | | t1.product_category, |
| | | t1.id, |
| | | t1.specification_model, |
| | |
| | | <select id="getSumQuantity" resultType="BigDecimal"> |
| | | select COALESCE(sum(inbound_num), 0) |
| | | from procurement_record_out |
| | | where type = 1 |
| | | and product_model_id = #{productModelId} |
| | | where |
| | | product_model_id = #{productModelId} |
| | | </select> |
| | | <select id="selectCode" resultType="com.ruoyi.procurementrecord.pojo.ProcurementRecordOut"> |
| | | select * |
| | | from procurement_record_out |
| | | where code like concat('%', #{format}) |
| | | order by id desc |
| | | limit 1 |
| | | </select> |
| | | <select id="listPageBySemiProduct" resultType="com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto"> |
| | | select |
| | | t1.id, |
| | | t1.code, |
| | | t2.unit, |
| | | t1.inbound_num, |
| | | t1.create_time, |
| | | t1.create_by, |
| | | t2.model as specification_model, |
| | | t2.product_code, |
| | | t3.product_name as product_category |
| | | from procurement_record_out t1 |
| | | left join product_model t2 on t2.id = t1.product_model_id |
| | | left join product t3 on t3.id = t2.product_id |
| | | <where> |
| | | and t1.type = 4 |
| | | <if test="req.productCategory !=null and req.productCategory !=''"> |
| | | t3.product_name like concat('%',#{req.productCategory},'%') |
| | | </if> |
| | | <if test="req.timeStr != null and req.timeStr != ''"> |
| | | and t1.create_time like concat('%',#{req.timeStr},'%') |
| | | </if> |
| | | </where> |
| | | order by t1.create_time desc |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <result property="tenantId" column="tenant_id"/> |
| | | <result property="createTime" column="create_time"/> |
| | | <result property="updateTime" column="update_time"/> |
| | | <result property="dragSort" column="drag_sort"/> |
| | | </resultMap> |
| | | |
| | | <select id="listProcessRouteItemDto" resultType="com.ruoyi.production.dto.ProcessRouteItemDto"> |
| | |
| | | left join process_route pr on pr.id = pri.route_id |
| | | where |
| | | pri.route_id = #{c.routeId} |
| | | order by pri.id |
| | | order by pri.drag_sort |
| | | </select> |
| | | </mapper> |
| | |
| | | <result property="updateTime" column="update_time"/> |
| | | </resultMap> |
| | | <select id="pageProductOrder" resultType="com.ruoyi.production.dto.ProductOrderDto"> |
| | | select po.*,sl.sales_contract_no,sl.customer_name,slp.product_category,slp.specification_model |
| | | select po.*, |
| | | sl.sales_contract_no, |
| | | sl.customer_name, |
| | | slp.product_category, |
| | | slp.specification_model, |
| | | ppr.process_route_code, |
| | | ROUND(po.complete_quantity / po.quantity * 100, 2) AS completionStatus |
| | | from product_order po |
| | | left join sales_ledger sl on po.sales_ledger_id = sl.id |
| | | left join sales_ledger_product slp on po.product_model_id = slp.id |
| | | left join process_route pr on po.route_id = pr.id |
| | | left join product_process_route ppr on po.id = ppr.product_order_id |
| | | <where> |
| | | <if test="c.npsNo != null and c.npsNo != ''"> |
| | | and po.nps_no like concat('%',#{c.npsNo},'%') |
| | |
| | | </where> |
| | | </select> |
| | | <select id="productMainByOrderId" resultType="com.ruoyi.production.dto.ProductOrderDto"> |
| | | select |
| | | po.*, |
| | | select po.*, |
| | | pwo.work_order_no, |
| | | pwo.report_work, |
| | | pwo.status, |
| | |
| | | left join product_work_order pwo on po.id = pwo.product_order_id |
| | | where po.id = #{c.id} |
| | | </select> |
| | | <select id="listProcessRoute" resultType="com.ruoyi.production.pojo.ProcessRoute"> |
| | | select pr.* |
| | | from process_route pr |
| | | left join product_model pm on pr.product_model_id = pm.id |
| | | left join sales_ledger_product slp on pm.id = slp.product_model_id |
| | | where slp.id = #{productModelId} |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | left join product_model pm on ppri.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | left join product_process pp on pp.id = ppri.process_id |
| | | where ppri.route_id = #{orderId} |
| | | where ppri.product_order_id = #{orderId} |
| | | order by ppri.drag_sort |
| | | </select> |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.production.mapper.ProductProcessRouteMapper"> |
| | | |
| | | <!-- éç¨æ¥è¯¢æ å°ç»æ --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.production.pojo.ProductProcessRoute"> |
| | | <id column="id" property="id"/> |
| | | <result column="product_model_id" property="productModelId"/> |
| | | <result column="description" property="description"/> |
| | | <result column="tenant_id" property="tenantId"/> |
| | | <result column="create_time" property="createTime"/> |
| | | <result column="update_time" property="updateTime"/> |
| | | <result column="bom_id" property="bomId"/> |
| | | <result column="process_route_code" property="processRouteCode"/> |
| | | <result column="product_order_id" property="productOrderId"/> |
| | | </resultMap> |
| | | <select id="listMain" resultType="com.ruoyi.production.dto.ProcessRouteDto"> |
| | | select ppr.*, p.product_name, pm.product_id, pm.model, pb.bom_no |
| | | from product_process_route ppr |
| | | left join product_bom pb on ppr.bom_id = pb.id |
| | | left join product_model pm on ppr.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | where ppr.product_order_id = #{orderId} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | and pl.supplier_name like concat('%',#{c.supplierName},'%') |
| | | </if> |
| | | <if test="c.createdAtStart != null and c.createdAtStart != ''"> |
| | | and pr.created_at >= date_format(#{c.createdAtStart},'%Y-%m-%d hh:mm:ss') |
| | | and pr.created_at >= str_to_date(#{c.createdAtStart}, '%Y-%m-%d') |
| | | </if> |
| | | <if test="c.createdAtEnd != null and c.createdAtEnd != ''"> |
| | | and pr.created_at <= date_format(#{c.createdAtEnd},'%Y-%m-%d hh:mm:ss') |
| | | and pr.created_at < date_add(str_to_date(#{c.createdAtEnd}, '%Y-%m-%d'), interval 1 day) |
| | | </if> |
| | | <if test="c.purchaseContractNumber != null and c.purchaseContractNumber != ''"> |
| | | and tr.purchase_contract_number like concat('%',#{c.purchaseContractNumber},'%') |
| | |
| | | left join sales_ledger sl on sl.id = pl.sales_ledger_id |
| | | left join ticket_registration tr on tr.id = pr.ticket_registration_id |
| | | left join product_model pm on pm.id = pr.product_model_id |
| | | |
| | | WHERE type = 2 and pr.id = #{id} |
| | | WHERE type = 2 |
| | | <if test="c.purchaseLedgerId != null and c.purchaseLedgerId != ''"> |
| | | and pr.purchase_ledger_id = #{c.purchaseLedgerId} |
| | | </if> |
| | | <if test="c.productModelId != null and c.productModelId != ''"> |
| | | and pm.id = #{c.productModelId} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | pl.supplier_name, |
| | | pl.project_name, |
| | | pl.contract_amount, |
| | | sum(pr.tickets_amount)as receipt_payment_amount, |
| | | pl.contract_amount-sum(pr.tickets_amount) AS unReceipt_payment_amount, |
| | | sum(tr.invoice_amount)as receipt_payment_amount, |
| | | pl.contract_amount-sum(tr.invoice_amount) AS unReceipt_payment_amount, |
| | | pl.entry_date, |
| | | pl.recorder_id, |
| | | pl.recorder_name, |
| | |
| | | pl.approval_status, |
| | | pl.payment_method |
| | | from purchase_ledger pl |
| | | left join sales_ledger_product slp on slp.sales_ledger_id = pl.id and slp.type=2 |
| | | left join product_record pr on pl.id = pr.purchase_ledger_id |
| | | left join ticket_registration tr on tr.id = pr.ticket_registration_id |
| | | left join supplier_manage sm on pl.supplier_id = sm.id |
| | | <where> |
| | | 1 = 1 |
| | |
| | | ) |
| | | </if> |
| | | <if test="invoiceRegistrationProductDto.invoiceDateStart != null and invoiceRegistrationProductDto.invoiceDateStart != ''"> |
| | | AND T3.invoice_date >= date_format(#{invoiceRegistrationProductDto.invoiceDateStart}, '%Y-%m-%d') |
| | | AND T3.invoice_date >= str_to_date(#{invoiceRegistrationProductDto.invoiceDateStart}, '%Y-%m-%d') |
| | | </if> |
| | | <if test="invoiceRegistrationProductDto.invoiceDateEnd != null and invoiceRegistrationProductDto.invoiceDateEnd != ''"> |
| | | AND T3.invoice_date <= date_format(#{invoiceRegistrationProductDto.invoiceDateEnd}, '%Y-%m-%d') |
| | | AND T3.invoice_date < date_add(str_to_date(#{invoiceRegistrationProductDto.invoiceDateEnd}, '%Y-%m-%d'), interval 1 day) |
| | | </if> |
| | | <if test="invoiceRegistrationProductDto.createTimeStart != null "> |
| | | AND T1.create_time >= date_format(#{invoiceRegistrationProductDto.createTimeStart}, '%Y-%m-%d %H:%i:%s') |