Merge branch 'jtwy' into dev_New
# Conflicts:
# src/main/java/com/ruoyi/CodeGenerator.java
# src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java
# src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java
# src/main/java/com/ruoyi/sales/controller/SalesLedgerProductController.java
# src/main/java/com/ruoyi/sales/pojo/SalesLedgerProduct.java
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @TableName("product_model") |
| | | public class ProductModel { |
| | |
| | | @Excel(name = "产ååç§°") |
| | | private String productName; |
| | | |
| | | @Excel(name = "产åç¼ç ") |
| | | private String productCode; |
| | | |
| | | /** |
| | | * è§æ ¼åå· |
| | | */ |
| | |
| | | @ApiModelProperty(value = "ç§æ·ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | @TableField(exist = false) |
| | | @Excel(name = "å
¥åºæ°é") |
| | | private BigDecimal inboundNum; |
| | | @TableField(exist = false) |
| | | @Excel(name = "åºåºæ°é") |
| | | private BigDecimal outboundNum; |
| | | @TableField(exist = false) |
| | | @Excel(name = "å©ä½åºå") |
| | | private BigDecimal stockQuantity; |
| | | } |
| | |
| | | if (productModelDto.getId() == null) { |
| | | ProductModel productModel = new ProductModel(); |
| | | BeanUtils.copyProperties(productModelDto,productModel); |
| | | productModelMapper.insert(productModel); |
| | | |
| | | String dateStr = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")); |
| | | String idStr = String.format("%06d", productModel.getId()); // å
ä½è¡¥0 |
| | | String newProductCode = "BM" + dateStr + idStr; |
| | | // æ´æ°æ°æ®åºä¸çproductCode |
| | | productModel.setProductCode(newProductCode); |
| | | return productModelMapper.updateById(productModel); |
| | | return productModelMapper.insert(productModel); |
| | | } else { |
| | | return productModelMapper.updateById(productModelDto); |
| | | } |
| | |
| | | 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); |
| | |
| | | this.strictUpdateFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now()); // èµ·å§çæ¬ 3.3.0(æ¨è) |
| | | this.strictUpdateFill(metaObject, "updateUser", 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); |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | |
| | | 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 = "å
¥åºæ¥è¯¢") |
| | |
| | | util.exportExcel(response, customStorages, "å
¥åºå°è´¦"); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/listPageProductionStock") |
| | | @Log(title = "åºå管ç-æååºå", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPageProductionStock(Page page) { |
| | | IPage<ProductModel> result = procurementRecordService.listPageProductionStock(page); |
| | | return AjaxResult.success(result); |
| | | } |
| | | } |
| | |
| | | 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) { |
| | |
| | | |
| | | private Integer userId; |
| | | |
| | | private Integer salesLedgerProductId; |
| | | private Long salesLedgerProductId; |
| | | |
| | | /** |
| | | * åºåºç±»å 1-éè´åºåº 2-éå®åºåº 3-èªå®ä¹ |
| | |
| | | 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); |
| | | } |
| | |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 产åä¿¡æ¯è¡¨idï¼èªå®ä¹å
¥åºæ¶ä¸º0ï¼ |
| | | * 产åä¿¡æ¯è¡¨idï¼ç产æ£åºåçæ¶å使ç¨ï¼ |
| | | */ |
| | | private Integer salesLedgerProductId; |
| | | private Long salesLedgerProductId; |
| | | |
| | | /** |
| | | * å
¥åºid |
| | |
| | | IPage<ProcurementRecordOutPageDto> listPageByProduct(Page page, ProcurementRecordOutPageDto procurementDto); |
| | | |
| | | IPage<ProcurementRecordOutPageDto> listPageByCustom(Page page, ProcurementRecordOutPageDto procurementDto); |
| | | |
| | | IPage<ProcurementRecordOutPageDto> listPageBySemiProduct(Page page, ProcurementRecordOutPageDto procurementDto); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.procurementrecord.dto.*; |
| | | import com.ruoyi.procurementrecord.pojo.CustomStorage; |
| | |
| | | |
| | | BigDecimal getProcurementAmount(Long salesProductId); |
| | | 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); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.mapper.ProductModelMapper; |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementRecordOut; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementRecordStorage; |
| | | import com.ruoyi.procurementrecord.service.ProcurementRecordService; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | |
| | | private final ProcurementRecordOutMapper procurementRecordOutMapper; |
| | | |
| | | private final SalesLedgerProductMapper salesLedgerProductMapper; |
| | | private final StockUtils stockUtils; |
| | | private final ProductModelMapper productModelMapper; |
| | | |
| | | @Override |
| | | public List<ProcurementDto> listProcurementBySalesLedgerId(ProcurementDto procurementDto) { |
| | |
| | | List<ProcurementRecordStorage> collect1 = procurementRecordStorages.stream() |
| | | .filter(procurementRecordStorage -> procurementRecordStorage.getSalesLedgerProductId().equals(dto.getId())) |
| | | .collect(Collectors.toList()); |
| | | |
| | | |
| | | // å¦ææ²¡æç¸å
³çå
¥åºè®°å½ï¼è·³è¿è¯¥æ¡æ°æ® |
| | | if(CollectionUtils.isEmpty(collect1)){ |
| | | dto.setQuantity0(dto.getQuantity()); |
| | | continue; |
| | | } |
| | | |
| | | |
| | | // 计ç®å·²å
¥åºæ°éæ»åï¼å¹¶è®¾ç½®å¾
å
¥åºæ°é |
| | | BigDecimal totalInboundNum = collect1.stream() |
| | | .map(ProcurementRecordStorage::getInboundNum) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | |
| | | // å¾
å
¥åºæ°é = æ»æ°é - å·²å
¥åºæ°é |
| | | dto.setQuantity0(dto.getQuantity().subtract(totalInboundNum)); |
| | | } |
| | |
| | | List<ProcurementRecordOut> recordOutList = procurementRecordOutMapper.selectList(queryWrapper); |
| | | |
| | | // 2. æSalesLedgerProductIdåç»ï¼ç»è®¡æ¯ä¸ªid对åºçå·²åºåºæ°éæ»å-å·²åºåºæ°é |
| | | Map<Integer, BigDecimal> storageIdToTotalOutNumMap = recordOutList.stream() |
| | | Map<Long, BigDecimal> storageIdToTotalOutNumMap = recordOutList.stream() |
| | | .collect(Collectors.groupingBy( |
| | | ProcurementRecordOut::getSalesLedgerProductId, |
| | | Collectors.reducing( |
| | |
| | | procurementRecordLambdaQueryWrapper.eq(ProcurementRecordStorage::getSalesLedgerProductId, detail.getId()) |
| | | .eq(ProcurementRecordStorage::getType, procurementDto.getType()); |
| | | Long aLong = procurementRecordMapper.selectCount(procurementRecordLambdaQueryWrapper); |
| | | |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(detail.getId()); |
| | | if (ObjectUtils.isNull(detail.getProductModelId())){ |
| | | detail.setProductModelId(salesLedgerProduct.getProductModelId()); |
| | | } |
| | | ProcurementRecordStorage.ProcurementRecordStorageBuilder procurementRecordBuilder = ProcurementRecordStorage.builder() |
| | | .salesLedgerProductId(detail.getId()) |
| | | .inboundBatches(aLong.equals(0L) ? "第1æ¹æ¬¡("+ procurementDto.getTypeName() +")" : "第"+ (aLong + 1) + "æ¹æ¬¡(" + procurementDto.getTypeName() + ")" ) |
| | |
| | | } |
| | | return procurementPageDtoCopyIPage; |
| | | } |
| | | @Override |
| | | public IPage<ProductModel> listPageProductionStock(Page page) { |
| | | ProductModel productModel = new ProductModel(); |
| | | IPage<ProductModel> iPage = productModelMapper.listPageProductModel(page, productModel); |
| | | iPage.getRecords().forEach(item -> { |
| | | item.setInboundNum(stockUtils.getStockQuantity(item.getId()).get("inboundNum")); |
| | | item.setOutboundNum(stockUtils.getStockQuantity(item.getId()).get("outboundNum")); |
| | | item.setStockQuantity(stockUtils.getStockQuantity(item.getId()).get("stockQuantity")); |
| | | }); |
| | | return iPage; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<ProcurementPageDto> listPageByProductProduction(Page page, ProcurementPageDto procurementDto) { |
| | | IPage<ProcurementPageDto> procurementPageDtoIPage = procurementRecordMapper.listPageByProductProduction(page, procurementDto); |
| | | return procurementPageDtoIPage; |
| | | } |
| | | |
| | | } |
| | |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | @Component |
| | | @RequiredArgsConstructor |
| | |
| | | private final ProcurementRecordOutMapper procurementRecordOutMapper; |
| | | private final ProcurementRecordMapper procurementRecordMapper; |
| | | |
| | | // è·åååå©ä½åºå |
| | | public BigDecimal getStockQuantity(Long productModelId) { |
| | | // è·åååå
¥åºæ°é,åºåºæ°é,å©ä½åºå |
| | | public Map<String, BigDecimal> getStockQuantity(Long productModelId) { |
| | | // å
¥åºæ°é |
| | | BigDecimal sumQuantity = procurementRecordMapper.getSumQuantity(productModelId); |
| | | // åºåºæ°é |
| | | BigDecimal outQuantity = procurementRecordOutMapper.getSumQuantity(productModelId); |
| | | return outQuantity.compareTo(sumQuantity) > 0 ? BigDecimal.ZERO : sumQuantity.subtract(outQuantity); |
| | | // å©ä½åºå |
| | | BigDecimal stockQuantity = outQuantity.compareTo(sumQuantity) > 0 ? BigDecimal.ZERO : sumQuantity.subtract(outQuantity); |
| | | Map<String, BigDecimal> stockMap = new HashMap<>(); |
| | | stockMap.put("inboundNum", sumQuantity); |
| | | stockMap.put("outboundNum", outQuantity); |
| | | stockMap.put("stockQuantity", stockQuantity); |
| | | return stockMap; |
| | | } |
| | | } |
| | |
| | | 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.core.metadata.IPage; |
| | | 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.production.dto.ProductBomDto; |
| | | import com.ruoyi.production.dto.ProductProcessDto; |
| | | import com.ruoyi.production.pojo.ProcessRoute; |
| | | import com.ruoyi.production.pojo.ProductBom; |
| | | import com.ruoyi.production.pojo.ProductProcess; |
| | | import com.ruoyi.production.service.ProcessRouteService; |
| | | import com.ruoyi.production.service.ProductBomService; |
| | | import com.ruoyi.production.service.ProductProcessService; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | 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.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * BOM主表 å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-15 09:59:27 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/productBom") |
| | | public class ProductBomController { |
| | | |
| | | @Autowired |
| | | private ProductBomService productBomService; |
| | | |
| | | @Autowired |
| | | private ProcessRouteService processRouteService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "BOM-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | @ApiOperation("BOM-å页æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, ProductBomDto productBomDto) { |
| | | IPage<ProductBomDto> listPage = productBomService.listPage(page, productBomDto); |
| | | return AjaxResult.success(listPage); |
| | | } |
| | | |
| | | @ApiModelProperty("æ°å¢BOM") |
| | | @PostMapping("/add") |
| | | @Log(title = "æ°å¢", businessType = BusinessType.INSERT) |
| | | public AjaxResult add( @RequestBody ProductBom productBom) { |
| | | return productBomService.add(productBom); |
| | | } |
| | | |
| | | @ApiOperation("æ´æ°BOM") |
| | | @Log(title = "ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/update") |
| | | public AjaxResult update(@RequestBody ProductBom productBom) { |
| | | return AjaxResult.success(productBomService.updateById(productBom)); |
| | | } |
| | | |
| | | @ApiOperation("å é¤BOM") |
| | | @DeleteMapping("/batchDelete") |
| | | @Log(title = "å é¤", businessType = BusinessType.DELETE) |
| | | public AjaxResult batchDelete(@RequestBody List<Integer> ids) { |
| | | List<ProcessRoute> list = processRouteService.list(Wrappers.<ProcessRoute>lambdaQuery().in(ProcessRoute::getBomId, ids)); |
| | | if (list.size()>0){ |
| | | return AjaxResult.error("该BOMå·²ç»åå¨å¯¹åºçå·¥èºè·¯çº¿,æ æ³è¿è¡å é¤"); |
| | | } |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | return AjaxResult.success(productBomService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | @GetMapping("/getByModel") |
| | | @Log(title = "BOM-æ ¹æ®éæ©çè§æ ¼åå·idæ¥è¯¢åå¨çbom", businessType = BusinessType.OTHER) |
| | | @ApiOperation("BOM-æ ¹æ®éæ©çè§æ ¼åå·idæ¥è¯¢åå¨çbom") |
| | | public AjaxResult getByModel(Long productModelId) { |
| | | List<ProductBom> productBoms = productBomService.list(Wrappers.<ProductBom>lambdaQuery().eq(ProductBom::getProductModelId, productModelId)); |
| | | return AjaxResult.success(productBoms); |
| | | } |
| | | |
| | | } |
| | |
| | | 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, "çäº§è®¢åæ°æ®"); |
| | | } |
| | | |
| | | @ApiOperation("æ¥è¯¢ç产订å对åºçBOM") |
| | | @GetMapping("/listProcessBom") |
| | | public R listProcessBom(Long orderId) { |
| | | return R.ok(productOrderService.listProcessBom(orderId)); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.device.pojo.DeviceRepair; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | |
| | | @GetMapping("/list") |
| | | public AjaxResult list() { |
| | | return AjaxResult.success(productProcessService.list()); |
| | | } |
| | | |
| | | /** |
| | | * 导å
¥å·¥åº |
| | | */ |
| | | @Log(title = "å·¥åº", businessType = BusinessType.IMPORT) |
| | | @PostMapping("/importData") |
| | | public AjaxResult importData(MultipartFile file) throws Exception { |
| | | return productProcessService.importData(file); |
| | | } |
| | | |
| | | @PostMapping("/downloadTemplate") |
| | | @Log(title = "å·¥åº-ä¸è½½æ¨¡æ¿", businessType = BusinessType.EXPORT) |
| | | public void downloadTemplate(HttpServletResponse response) { |
| | | ExcelUtil<ProductProcess> util = new ExcelUtil<ProductProcess>(ProductProcess.class); |
| | | util.importTemplateExcel(response, "å·¥åºæ¨¡æ¿"); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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)); |
| | | } |
| | | |
| | | @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() + "]çå°è´¦äº§å"); |
| | | } |
| | | |
| | | 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); |
| | | @GetMapping("listMain") |
| | | @ApiOperation("æ ¹æ®Idæ¥è¯¢å·¥èºè·¯çº¿ä¸»è¡¨") |
| | | public R listMain(Long orderId) { |
| | | return R.ok(productProcessRouteService.listMain(orderId)); |
| | | } |
| | | |
| | | @DeleteMapping("/deleteRouteItem") |
| | | @PostMapping("/addRouteItem") |
| | | @ApiOperation("æ°å¢ç产订åçå·¥èºè·¯çº¿è¯¦æ
") |
| | | public R addRouteItem(@RequestBody ProductProcessRouteItem productProcessRouteItem) { |
| | | return productProcessRouteItemService.addRouteItem(productProcessRouteItem); |
| | | } |
| | | |
| | | @PostMapping("/updateRouteItem") |
| | | @ApiOperation("ä¿®æ¹ç产订åçå·¥èºè·¯çº¿è¯¦æ
") |
| | | public R updateRouteItem(@RequestBody ProductProcessRouteItem productProcessRouteItem) { |
| | | return R.ok(productProcessRouteItemService.updateById(productProcessRouteItem)); |
| | | } |
| | | |
| | | @DeleteMapping("/deleteRouteItem/{id}") |
| | | @ApiOperation("å é¤ç产工èºè·¯çº¿") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R deleteRouteItem(@RequestBody ProductProcessRouteItemDto processRouteItemDto) { |
| | | public R deleteRouteItem(@PathVariable("id") Long id) { |
| | | return productProcessRouteItemService.deleteRouteItem(id); |
| | | } |
| | | |
| | | 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)); |
| | | } |
| | | } |
| | | |
| | | // å 餿¥å·¥ï¼çäº§ä¸»è¡¨ï¼ |
| | | 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)); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.production.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | 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.ProductProcessDto; |
| | | import com.ruoyi.production.dto.ProductStructureDto; |
| | | import com.ruoyi.production.pojo.ProductStructure; |
| | | import com.ruoyi.production.service.ProductStructureService; |
| | |
| | | |
| | | @RequestMapping("productStructure") |
| | | @RestController |
| | | @Api(tags = "产åç»æ") |
| | | @Api(tags = "BOM") |
| | | public class ProductStructureController { |
| | | @Autowired |
| | | private ProductStructureService productStructureService; |
| | | |
| | | |
| | | @ApiOperation("æ ¹æ®productIdæ¥è¯¢") |
| | | @GetMapping("/listByproductModelId/{productModelId}") |
| | | public R listByproductModelId( @PathVariable("productModelId") Long productModelId){ |
| | | return R.ok(productStructureService.listByproductModelId( productModelId)); |
| | | } |
| | | |
| | | @ApiOperation("æ°å¢äº§åç»æ") |
| | | @ApiOperation("æ°å¢BOM") |
| | | @PostMapping() |
| | | public R addOrUpdate(@RequestBody ProductStructureDto productStructureDto){ |
| | | return R.ok(productStructureService.addProductStructureDto(productStructureDto)); |
| | | } |
| | | |
| | | @ApiOperation("BOMæ¥ç详æ
") |
| | | @GetMapping("/listBybomId/{bomId}") |
| | | public R listBybomId( @PathVariable("bomId") Long bomId){ |
| | | return R.ok(productStructureService.listBybomId(bomId)); |
| | | } |
| | | } |
| | |
| | | |
| | | @ApiModelProperty("è§æ ¼") |
| | | private String model; |
| | | |
| | | private String bomNo; |
| | | } |
| | |
| | | private Long productId; |
| | | |
| | | |
| | | private List<ProcessRouteItem> processRouteItem; |
| | | private String model; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.dto; |
| | | |
| | | import com.ruoyi.production.pojo.ProductBom; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | //å页æ¥è¯¢åæ¾æ°æ® |
| | | @Data |
| | | public class ProductBomDto extends ProductBom { |
| | | |
| | | //产ååç§° |
| | | private String productName; |
| | | |
| | | //产åè§æ ¼åå· |
| | | private String productModelName; |
| | | |
| | | } |
| | |
| | | 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 = "订åå®æåº¦") |
| | | |
| | | @ApiModelProperty(value = "å·¥èºè·¯çº¿ç¼å·") |
| | | @Excel(name = "å·¥èºè·¯çº¿ç¼å·") |
| | | private String processRouteCode; |
| | | |
| | | @ApiModelProperty(value = "å®æç¶æ") |
| | | @Excel(name = "å®æç¶æ") |
| | | private BigDecimal completionStatus; |
| | | |
| | | @ApiModelProperty(value = "BOMç¼å·") |
| | | @Excel(name = "BOMç¼å·") |
| | | private String bomNo; |
| | | } |
| | |
| | | |
| | | private String productName; |
| | | |
| | | |
| | | private List<ProductProcessRouteItem> processRouteItem; |
| | | private String model; |
| | | } |
| | |
| | | package com.ruoyi.production.dto; |
| | | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import com.ruoyi.production.pojo.ProductWorkOrder; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | |
| | | //ç产订åå· |
| | | @ApiModelProperty(value = "ç产订åå·") |
| | | private String productOrderNpsNo; |
| | | |
| | | @ApiModelProperty(value = "宿è¿åº¦") |
| | | private BigDecimal completionStatus; |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "产ååå·") |
| | | private String model; |
| | | |
| | | @ApiModelProperty(value = "产ååç§°") |
| | | private String productName; |
| | | |
| | | @ApiModelProperty(value = "åä½") |
| | | private String unit; |
| | | } |
| | |
| | | @ApiModelProperty(value = "æ¥å·¥æ°é") |
| | | private BigDecimal quantity; |
| | | |
| | | @ApiModelProperty(value = "æ¯å¦æ¥å·¥") |
| | | private boolean reportWork; |
| | | //产ååç§° |
| | | private String productName; |
| | | |
| | | @ApiModelProperty(value = "æ¥å·¥id") |
| | | private Long productMainId; |
| | | //产åè§æ ¼åå· |
| | | private String productModelName; |
| | | |
| | | //åä½ |
| | | private String unit; |
| | | |
| | | //éå®ååå· |
| | | private String salesContractNo; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.production.dto.ProductBomDto; |
| | | import com.ruoyi.production.dto.ProductProcessDto; |
| | | import com.ruoyi.production.pojo.ProductBom; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * <p> |
| | | * BOM主表 Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-15 09:59:27 |
| | | */ |
| | | @Mapper |
| | | public interface ProductBomMapper extends BaseMapper<ProductBom> { |
| | | |
| | | IPage<ProductBomDto> listPage(Page page, @Param("c") ProductBomDto productBomDto); |
| | | |
| | | ProductBomDto getById(@Param("bomId") Long bomId); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.production.dto.ProductBomDto; |
| | | import com.ruoyi.production.dto.ProductOrderDto; |
| | | import com.ruoyi.production.dto.ProductStructureDto; |
| | | 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); |
| | | |
| | | List<ProductStructureDto> listProcessBom(@Param("orderId") Long orderId); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.production.dto.ProductProcessDto; |
| | | import com.ruoyi.production.pojo.ProductProcess; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | @Mapper |
| | | public interface ProductProcessMapper extends BaseMapper<ProductProcess> { |
| | | IPage<ProductProcessDto> listPage(Page page,@Param("productProcessDto") ProductProcessDto productProcessDto); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
| | |
| | | |
| | | @Mapper |
| | | public interface ProductStructureMapper extends BaseMapper<ProductStructure> { |
| | | List<ProductStructureDto> listByproductModelId(@Param("productModelId") Long productModelId); |
| | | |
| | | List<ProductStructureDto> listBybomId(@Param("bomId") Long bomId); |
| | | |
| | | List<ProductStructureDto> listBybomAndProcess(@Param("bomId") Long bomId, @Param("processId") Long processId); |
| | | } |
| | |
| | | |
| | | IPage<ProductWorkOrderDto> pageProductWorkOrder(Page<ProductWorkOrderDto> page, @Param("c") ProductWorkOrderDto productWorkOrder); |
| | | |
| | | int updatePlanQuantity(Map<String, Object> params); |
| | | |
| | | /** |
| | | * 忻工åè®¡åæ°éï¼ä»production_product_outputåquantityå åplan_quantity |
| | | * @param productMainId |
| | | * @return |
| | | */ |
| | | int rollbackPlanQuantity(@Param("productMainId") Long productMainId); |
| | | |
| | | List<ProductWorkOrderDto> selectProductWorkOrderDtoList(); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | |
| | | @TableName("process_route") |
| | | @Data |
| | | @ApiModel(value = "processRoute", description = "å·¥èºè·¯çº¿ä¸»è¡¨") |
| | | public class ProcessRoute { |
| | | |
| | | @ApiModelProperty(value = "åºå·") |
| | | 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 = "å·¥èºè·¯çº¿ç¼ç ") |
| | | private String processRouteCode; |
| | | |
| | | @ApiModelProperty(value = "BOMçID") |
| | | private Long bomId; |
| | | } |
| | |
| | | package com.ruoyi.production.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | |
| | | @Data |
| | | @TableName("process_route_item") |
| | | @ApiModel(value = "processRouteItem", description = "å·¥èºè·¯çº¿å表") |
| | | public class ProcessRouteItem { |
| | | |
| | | @TableId(type = IdType.AUTO) |
| | |
| | | @TableField(fill = FieldFill.UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty(value ="æå¨æåº") |
| | | private Integer dragSort; |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | /** |
| | | * <p> |
| | | * BOM主表 |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-15 09:59:27 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @TableName("product_bom") |
| | | @ApiModel(value = "ProductBom对象", description = "BOM主表") |
| | | public class ProductBom implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty("bomç¼å·") |
| | | private String bomNo; |
| | | |
| | | @ApiModelProperty("产åè§æ ¼id") |
| | | private Long productModelId; |
| | | |
| | | @ApiModelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty("çæ¬å·") |
| | | private String version; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("æ´æ°æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("å建è
") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long createUser; |
| | | |
| | | @ApiModelProperty("æ´æ°è
") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Long updateUser; |
| | | |
| | | @ApiModelProperty("ç§æ·ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | } |
| | |
| | | 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.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | |
| | | |
| | | @TableName("product_process") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | @ApiModel(value = "productProcess", description = "å·¥åºè¡¨") |
| | | public class ProductProcess implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | |
| | | /** |
| | | * å·¥åºåç§° |
| | | */ |
| | | @Excel(name = "å·¥åºåç§°") |
| | | private String name; |
| | | |
| | | /** |
| | | * å·¥åºç¼å· |
| | | */ |
| | | @Excel(name = "å·¥åºç¼å·") |
| | | private String no; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | @Excel(name = "夿³¨") |
| | | private String remark; |
| | | |
| | | |
| | | /** |
| | | * å·¥èµå®é¢ |
| | | */ |
| | | @Excel(name = "å·¥èµå®é¢") |
| | | private BigDecimal salaryQuota; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¶é´ |
| | | */ |
| | | @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; |
| | | |
| | | /** |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @TableName("product_structure") |
| | | @Data |
| | | @ApiModel(value = "ProductStructure", description = "BOMå表") |
| | | public class ProductStructure { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | |
| | | private String unit; |
| | | |
| | | /** |
| | | * ç¶çº§id |
| | | */ |
| | | private Long parentId; |
| | | |
| | | /** |
| | | * çæ°é |
| | | */ |
| | | private BigDecimal diskQuantity; |
| | | |
| | | /** |
| | | * ç§æ·ID |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | /** |
| | | * å
³èBOMid |
| | | */ |
| | | private Long bomId; |
| | | |
| | | |
| | | } |
| | |
| | | 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.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; |
| | | |
| | | /** |
| | |
| | | private String workOrderNo; |
| | | |
| | | /** |
| | | * ç¶æ 1 å¾
确认 2 å¾
ç产 3çäº§ä¸ 4å·²ç产 |
| | | * ç¶æ 1 å¾
确认 2 å¾
ç产 3çäº§ä¸ 4已宿 |
| | | */ |
| | | @ApiModelProperty(value = "ç¶æ 1 å¾
确认 2 å¾
ç产 3çäº§ä¸ 4å·²ç产") |
| | | @ApiModelProperty(value = "ç¶æ 1 å¾
确认 2 å¾
ç产 3çäº§ä¸ 4已宿") |
| | | private Integer status; |
| | | |
| | | /** |
| | |
| | | * 计åå¼å§æ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "计åå¼å§æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate planStartTime; |
| | | |
| | | /** |
| | | * 计åç»ææ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "计åç»ææ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate planEndTime; |
| | | |
| | | /** |
| | | * å®é
å¼å§æ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "å®é
å¼å§æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate actualStartTime; |
| | | |
| | | /** |
| | | * å®é
ç»ææ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "å®é
ç»ææ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate actualEndTime; |
| | | |
| | | /** |
| | | * æ¯å¦æ¥å·¥ |
| | | * éæ±é |
| | | */ |
| | | @ApiModelProperty(value = "æ¯å¦æ¥å·¥") |
| | | private boolean reportWork; |
| | | |
| | | |
| | | /** |
| | | * è®¡åæ°é |
| | | */ |
| | | @ApiModelProperty(value = "è®¡åæ°é") |
| | | @ApiModelProperty(value = "éæ±æ°é") |
| | | private BigDecimal planQuantity; |
| | | |
| | | /** |
| | | * å®é
æ°é |
| | | * 宿æ°é |
| | | */ |
| | | @ApiModelProperty(value = "æ°é") |
| | | private BigDecimal quantity; |
| | | @ApiModelProperty(value = "宿æ°é") |
| | | private BigDecimal completeQuantity; |
| | | |
| | | /** |
| | | * æ¥å·¥id |
| | | */ |
| | | @ApiModelProperty(value = "æ¥å·¥id") |
| | | private Long productMainId; |
| | | } |
| | | |
| | | } |
| | |
| | | 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.time.LocalDateTime; |
| | | |
| | |
| | | |
| | | @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 = "ç§æ·ID") |
| | |
| | | |
| | | public interface ProcessRouteItemService extends IService<ProcessRouteItem> { |
| | | List<ProcessRouteItemDto> listProcessRouteItemDto( ProcessRouteItemDto processRouteItemDto); |
| | | |
| | | int sort(ProcessRouteItem processRouteItem); |
| | | |
| | | String batchDelete(Long id); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.production.dto.ProductBomDto; |
| | | import com.ruoyi.production.dto.ProductProcessDto; |
| | | import com.ruoyi.production.pojo.ProductBom; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * BOM主表 æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-15 09:59:27 |
| | | */ |
| | | public interface ProductBomService extends IService<ProductBom> { |
| | | |
| | | IPage<ProductBomDto> listPage(Page page, ProductBomDto productBomDto); |
| | | |
| | | AjaxResult add(ProductBom productBom); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.production.dto.ProductBomDto; |
| | | import com.ruoyi.production.dto.ProductOrderDto; |
| | | import com.ruoyi.production.dto.ProductStructureDto; |
| | | 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); |
| | | |
| | | List<ProductStructureDto> listProcessBom(Long orderId); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | import com.ruoyi.production.dto.*; |
| | | import com.ruoyi.production.pojo.ProductProcess; |
| | | import com.ruoyi.production.pojo.SalesLedgerScheduling; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | |
| | | IPage<ProductProcessDto> listPage(Page page, ProductProcessDto productProcessDto); |
| | | |
| | | AjaxResult add(ProductProcessDto productProcessDto); |
| | | |
| | | AjaxResult importData(MultipartFile file); |
| | | } |
| | |
| | | public interface ProductStructureService extends IService<ProductStructure> { |
| | | |
| | | |
| | | ProductModelDto listByproductModelId(Long productId); |
| | | |
| | | Boolean addProductStructureDto(ProductStructureDto productStructureDto); |
| | | |
| | | List<ProductStructureDto> listBybomId(Long bomId); |
| | | |
| | | } |
| | |
| | | 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 "å 餿å"; |
| | | } |
| | | } |
| | |
| | | this.save(processRoute); |
| | | String dateStr = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")); |
| | | String idStr = String.format("%06d", processRoute.getId()); |
| | | String newProductCode = "GY" + dateStr + idStr; |
| | | String newProductCode = "GYLX" + dateStr + idStr; |
| | | // æ´æ°æ°æ®åºä¸çproductCode |
| | | processRoute.setProcessRouteCode(newProductCode); |
| | | return processRouteMapper.updateById(processRoute); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.production.dto.ProductBomDto; |
| | | import com.ruoyi.production.dto.ProductProcessDto; |
| | | import com.ruoyi.production.pojo.ProductBom; |
| | | import com.ruoyi.production.mapper.ProductBomMapper; |
| | | import com.ruoyi.production.pojo.ProductProcess; |
| | | import com.ruoyi.production.service.ProductBomService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * BOM主表 æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-15 09:59:27 |
| | | */ |
| | | @Service |
| | | public class ProductBomServiceImpl extends ServiceImpl<ProductBomMapper, ProductBom> implements ProductBomService { |
| | | |
| | | @Autowired |
| | | private ProductBomMapper productBomMapper; |
| | | |
| | | @Override |
| | | public IPage<ProductBomDto> listPage(Page page, ProductBomDto productBomDto) { |
| | | return productBomMapper.listPage(page,productBomDto); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult add(ProductBom productBom) { |
| | | boolean save = productBomMapper.insert(productBom) > 0; |
| | | if (save) { |
| | | // æ ¹æ®idçænoåæ®µï¼GX + 8使°åï¼ä¸è¶³8ä½åé¢è¡¥0ï¼ |
| | | String no = "BM." + String.format("%05d", productBom.getId()); |
| | | productBom.setBomNo(no); |
| | | productBomMapper.updateById(productBom); |
| | | return AjaxResult.success(); |
| | | } |
| | | return AjaxResult.error(); |
| | | } |
| | | } |
| | |
| | | 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.ProductBomDto; |
| | | import com.ruoyi.production.dto.ProductOrderDto; |
| | | import com.ruoyi.production.mapper.ProductOrderMapper; |
| | | import com.ruoyi.production.pojo.ProductOrder; |
| | | import com.ruoyi.production.dto.ProductStructureDto; |
| | | 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); |
| | | } |
| | | |
| | | @Override |
| | | public List<ProductStructureDto> listProcessBom(Long orderId) { |
| | | return productOrderMapper.listProcessBom(orderId); |
| | | } |
| | | } |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.production.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.production.dto.ProductProcessDto; |
| | | import com.ruoyi.production.mapper.ProductProcessMapper; |
| | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class ProductProcessServiceImpl extends ServiceImpl<ProductProcessMapper, ProductProcess> implements ProductProcessService { |
| | |
| | | ProductProcess productProcess = new ProductProcess(); |
| | | BeanUtils.copyProperties(productProcessDto,productProcess); |
| | | boolean save = productProcessMapper.insert(productProcess) > 0; |
| | | if (save) { |
| | | if (save && ObjectUtils.isNotNull(productProcessDto.getNo())) { |
| | | // æ ¹æ®idçænoåæ®µï¼GX + 8使°åï¼ä¸è¶³8ä½åé¢è¡¥0ï¼ |
| | | String no = "GX" + String.format("%08d", productProcess.getId()); |
| | | productProcess.setNo(no); |
| | |
| | | } |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult importData(MultipartFile file) { |
| | | try { |
| | | ExcelUtil<ProductProcess> util = new ExcelUtil<ProductProcess>(ProductProcess.class); |
| | | List<ProductProcess> productProcessList = util.importExcel(file.getInputStream()); |
| | | if(CollectionUtils.isEmpty(productProcessList)){ |
| | | return AjaxResult.warn("模æ¿é误æå¯¼å
¥æ°æ®ä¸ºç©º"); |
| | | } |
| | | this.saveOrUpdateBatch(productProcessList); |
| | | return AjaxResult.success(true); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return AjaxResult.error("导å
¥å¤±è´¥"); |
| | | } |
| | | } |
| | | } |
| | |
| | | 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.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.dto.ProductModelDto; |
| | | import com.ruoyi.basic.dto.ProductTreeDto; |
| | | import com.ruoyi.basic.mapper.ProductMapper; |
| | | import com.ruoyi.basic.mapper.ProductModelMapper; |
| | | import com.ruoyi.basic.pojo.Product; |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.production.dto.ProductStructureDto; |
| | | import com.ruoyi.production.mapper.ProductBomMapper; |
| | | import com.ruoyi.production.mapper.ProductStructureMapper; |
| | | import com.ruoyi.production.pojo.ProductStructure; |
| | | import com.ruoyi.production.service.ProductStructureService; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | |
| | | @Autowired |
| | | private ProductStructureMapper productStructureMapper; |
| | | @Autowired |
| | | private ProductModelMapper productModelMapper; |
| | | @Autowired |
| | | private ProductMapper productMapper; |
| | | |
| | | @Override |
| | | public ProductModelDto listByproductModelId(Long productModelId) { |
| | | ProductModel productModel = productModelMapper.selectById(productModelId); |
| | | Product product = productMapper.selectById(productModel.getProductId()); |
| | | ProductModelDto productModelDto = new ProductModelDto(); |
| | | BeanUtils.copyProperties(productModel,productModelDto); |
| | | productModelDto.setProductName(product.getProductName()); |
| | | List<ProductStructureDto> productStructureDtos = productStructureMapper.listByproductModelId(productModelId); |
| | | productModelDto.setProductStructureList(productStructureDtos); |
| | | return productModelDto; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public Boolean addProductStructureDto(ProductStructureDto productStructureDto) { |
| | | this.remove(new QueryWrapper<ProductStructure>().lambda().eq(ProductStructure::getParentId, productStructureDto.getParentId())); |
| | | this.remove(new QueryWrapper<ProductStructure>().lambda().eq(ProductStructure::getBomId, productStructureDto.getBomId())); |
| | | productStructureDto.getProductStructureList().forEach(productStructure -> { |
| | | productStructure.setParentId(productStructureDto.getParentId()); |
| | | productStructure.setBomId(productStructureDto.getBomId()); |
| | | }); |
| | | return this.saveBatch(productStructureDto.getProductStructureList()); |
| | | } |
| | | |
| | | @Override |
| | | public List<ProductStructureDto> listBybomId(Long bomId) { |
| | | List<ProductStructureDto> tree = productStructureMapper.listBybomId(bomId); |
| | | return tree; |
| | | |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | 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.basic.mapper.ProductMapper; |
| | |
| | | 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.production.pojo.*; |
| | | import com.ruoyi.production.service.ProductionProductMainService; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.quality.mapper.QualityInspectMapper; |
| | | import com.ruoyi.quality.mapper.QualityInspectParamMapper; |
| | | import com.ruoyi.quality.mapper.QualityTestStandardMapper; |
| | | import com.ruoyi.quality.mapper.QualityTestStandardParamMapper; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.quality.pojo.QualityInspectParam; |
| | | import com.ruoyi.quality.pojo.QualityTestStandard; |
| | | import com.ruoyi.quality.pojo.QualityTestStandardParam; |
| | | import io.swagger.models.auth.In; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import com.ruoyi.production.mapper.ProductionProductMainMapper; |
| | | import oshi.driver.mac.net.NetStat; |
| | | |
| | | 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; |
| | |
| | | |
| | | @Service |
| | | @AllArgsConstructor |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public class ProductionProductMainServiceImpl extends ServiceImpl<ProductionProductMainMapper, ProductionProductMain> implements ProductionProductMainService { |
| | | |
| | | private final ProcurementRecordOutMapper procurementRecordOutMapper; |
| | | private ProductionProductMainMapper productionProductMainMapper; |
| | | |
| | | private ProductWorkOrderController productWorkOrderController; |
| | |
| | | private ProductWorkOrderMapper productWorkOrderMapper; |
| | | |
| | | private ProductProcessRouteItemMapper productProcessRouteItemMapper; |
| | | private SysUserMapper userMapper; |
| | | |
| | | private ProductionProductOutputMapper productionProductOutputMapper; |
| | | |
| | |
| | | private QualityInspectMapper qualityInspectMapper; |
| | | |
| | | private ProductProcessMapper productProcessMapper; |
| | | private ProductProcessRouteMapper productProcessRouteMapper; |
| | | |
| | | private ProductMapper productMapper; |
| | | |
| | | |
| | | private QualityTestStandardMapper qualityTestStandardMapper; |
| | | private QualityTestStandardParamMapper qualityTestStandardParamMapper; |
| | | |
| | | private QualityInspectParamMapper qualityInspectParamMapper; |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean addProductMain(ProductionProductMainDto dto) { |
| | | if (dto == null) { |
| | | throw new RuntimeException("åæ°ä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | | |
| | | |
| | | |
| | | // æ°å¢é»è¾ |
| | | SysUser user = userMapper.selectUserById(dto.getUserId()); |
| | | ProductionProductMain productionProductMain = new ProductionProductMain(); |
| | | //å½åå·¥èºè·¯çº¿å¯¹åºçå·¥åºè¯¦æ
|
| | | ProductProcessRouteItem productProcessRouteItem = productProcessRouteItemMapper.selectById(dto.getProductProcessRouteItemId()); |
| | | if (productProcessRouteItem == null) { |
| | | throw new RuntimeException("å·¥èºè·¯çº¿é¡¹ä¸åå¨"); |
| | | } |
| | | |
| | | String datePrefix = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")); |
| | | |
| | | //å½åå
·ä½å·¥åº |
| | | ProductProcess productProcess = productProcessMapper.selectById(productProcessRouteItem.getProcessId()); |
| | | //å·¥èºè·¯çº¿ä¸å½åå·¥åºå¯¹åºç产åºè§æ ¼åå· |
| | | ProductModel productModel = productModelMapper.selectById(productProcessRouteItem.getProductModelId()); |
| | | //æ¥è¯¢è¯¥ç产订å对åºçbom |
| | | ProductProcessRoute productProcessRoute = productProcessRouteMapper.selectById(productProcessRouteItem.getProductRouteId()); |
| | | /*æ°å¢æ¥å·¥ä¸»è¡¨*/ |
| | | //æ¥è¯¢æå¤§æ¥å·¥ç¼å· |
| | | String datePrefix = "BG" + LocalDate.now().format(DateTimeFormatter.ofPattern("yyMMdd")); |
| | | QueryWrapper<ProductionProductMain> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.select("MAX(product_no) as maxNo") |
| | | .likeRight("product_no", datePrefix); |
| | | |
| | | List<Map<String, Object>> resultList = productionProductMainMapper.selectMaps(queryWrapper); |
| | | |
| | | int sequenceNumber = 1; |
| | | if (resultList != null && !resultList.isEmpty()) { |
| | | Map<String, Object> result = resultList.get(0); |
| | | |
| | | if (result != null) { |
| | | Object maxNoObj = result.get("maxNo"); |
| | | if (maxNoObj != null) { |
| | | String lastNo = maxNoObj.toString(); |
| | | System.out.println("lastNo: " + lastNo); |
| | | |
| | | if (lastNo.startsWith(datePrefix)) { |
| | | try { |
| | | String seqStr = lastNo.substring(datePrefix.length()); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | String productNo = String.format("%s%03d", datePrefix, sequenceNumber); |
| | | productionProductMain.setProductNo(productNo); |
| | | productionProductMain.setUserId(user.getUserId()); |
| | | productionProductMain.setUserId(dto.getUserId()); |
| | | productionProductMain.setUserName(dto.getUserName()); |
| | | productionProductMain.setProductProcessRouteItemId(dto.getProductProcessRouteItemId()); |
| | | productionProductMain.setWorkOrderId(dto.getWorkOrderId()); |
| | | productionProductMain.setStatus(0); |
| | | |
| | | // æ·»å æ¥å·¥ä¸»è¡¨ |
| | | int insert = productionProductMainMapper.insert(productionProductMain); |
| | | |
| | | //æ´æ°å·¥å |
| | | if (insert > 0) { |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("quantity", dto.getQuantity()); |
| | | params.put("productMainId", productionProductMain.getId()); |
| | | params.put("workOrderId", dto.getWorkOrderId()); |
| | | params.put("deductQuantity", dto.getQuantity()); |
| | | |
| | | productWorkOrderMapper.updatePlanQuantity(params); |
| | | productionProductMainMapper.insert(productionProductMain); |
| | | /*æ°å¢æ¥å·¥æå
¥è¡¨*/ |
| | | List<ProductStructureDto> productStructureDtos = productStructureMapper.listBybomAndProcess(productProcessRoute.getBomId(), productProcess.getId()); |
| | | if (productStructureDtos.size() == 0) { |
| | | //å¦æè¯¥å·¥åºæ²¡æäº§åç»æçæå
¥å,é£è¿ä¸ªæå
¥åå产åºåæ¯åä¸ä¸ª |
| | | ProductStructureDto productStructureDto = new ProductStructureDto(); |
| | | productStructureDto.setProductModelId(productProcessRouteItem.getProductModelId()); |
| | | productStructureDto.setUnitQuantity(BigDecimal.ONE); |
| | | productStructureDtos.add(productStructureDto); |
| | | } |
| | | ProductProcess productProcess = productProcessMapper.selectById(productProcessRouteItem.getProcessId()); |
| | | ProductModel productModel = productProcessRouteItem.getProductModelId() != null ? |
| | | productModelMapper.selectById(productProcessRouteItem.getProductModelId()) : null; |
| | | |
| | | if (productModel != null) { |
| | | Product product = productMapper.selectById(productModel.getProductId()); |
| | | int inspectType = "ç»è£
".equals(productProcess.getName()) ? 2 : 1; |
| | | |
| | | QualityInspect qualityInspect = new QualityInspect(); |
| | | qualityInspect.setProductId(product.getId()); |
| | | qualityInspect.setProductName(product.getProductName()); |
| | | qualityInspect.setModel(productModel.getModel()); |
| | | qualityInspect.setUnit(productModel.getUnit()); |
| | | qualityInspect.setQuantity(dto.getQuantity()); |
| | | qualityInspect.setProcess(productProcess.getName()); |
| | | qualityInspect.setInspectState(0); |
| | | qualityInspect.setInspectType(inspectType); |
| | | qualityInspect.setProductMainId(productionProductMain.getId()); |
| | | qualityInspect.setProductModelId(productModel.getId()); |
| | | qualityInspectMapper.insert(qualityInspect); |
| | | |
| | | List<QualityTestStandardParam> qualityTestStandardParams = qualityTestStandardParamMapper.selectListByProductId(product.getId()); |
| | | if (qualityTestStandardParams.size()>0) { |
| | | qualityTestStandardParams.forEach(standard -> { |
| | | QualityInspectParam param = new QualityInspectParam(); |
| | | BeanUtils.copyProperties(standard, param); |
| | | param.setId(null); |
| | | param.setInspectId(qualityInspect.getId()); |
| | | qualityInspectParamMapper.insert(param); |
| | | }); |
| | | 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(product.getProductName() + "åºå为0"); |
| | | } |
| | | } |
| | | // æ·»å æå
¥ |
| | | if (productModel != null) { |
| | | List<ProductStructureDto> productStructureDtos = productStructureMapper.listByproductModelId(productModel.getId()); |
| | | for (ProductStructureDto productStructureDto : productStructureDtos) { |
| | | ProductModel productModel1 = productModelMapper.selectById(productStructureDto.getProductModelId()); |
| | | |
| | | BigDecimal stockQuantity = stockUtils.getStockQuantity(productModel1.getId()); |
| | | if (!(stockQuantity.compareTo(BigDecimal.ZERO) > 0)) { |
| | | throw new RuntimeException("åºåä¸è¶³"); |
| | | } |
| | | ProductionProductInput productionProductInput = new ProductionProductInput(); |
| | | productionProductInput.setProductModelId(productStructureDto.getProductModelId()); |
| | | productionProductInput.setQuantity(productStructureDto.getUnitQuantity().multiply(dto.getQuantity())); |
| | | productionProductInput.setProductMainId(productionProductMain.getId()); |
| | | productionProductInputMapper.insert(productionProductInput); |
| | | 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(productionProductMain.getId())//å
³èæ¥å·¥äº§åº |
| | | .inboundBatches(aLong.equals(0L) ? "第1æ¹æ¬¡" : "第" + (aLong + 1) + "æ¹æ¬¡") |
| | | .inboundNum(productionProductInput.getQuantity()) |
| | | .type(4) |
| | | .createBy(user.getNickName()) |
| | | .productModelId(productModel1.getId()); |
| | | procurementRecordOutMapper.insert(procurementRecordOut.build()); |
| | | } |
| | | |
| | | // æ·»å äº§åº |
| | | /*æ°å¢æ¥å·¥äº§åºè¡¨*/ |
| | | ProductionProductOutput productionProductOutput = new ProductionProductOutput(); |
| | | productionProductOutput.setProductMainId(productionProductMain.getId()); |
| | | productionProductOutput.setProductModelId(productProcessRouteItem.getProductModelId()); |
| | | 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("ç产订åä¸åå¨"); |
| | | //对åºçè¿ç¨æ£æè
åºåæ£ |
| | | List<ProductProcessRouteItem> productProcessRouteItems = productProcessRouteItemMapper.selectList(Wrappers.<ProductProcessRouteItem>lambdaQuery().eq(ProductProcessRouteItem::getProductRouteId, productProcessRouteItem.getProductRouteId())); |
| | | int inspectType = 1; |
| | | if (productProcessRouteItem.getDragSort()==productProcessRouteItems.size()){ |
| | | //æåä¸éå·¥åºçæåºåæ£ |
| | | inspectType = 2; |
| | | } |
| | | // æ·»å çäº§æ ¸ç® |
| | | Product product = productMapper.selectById(productModel.getProductId()); |
| | | QualityInspect qualityInspect = new QualityInspect(); |
| | | qualityInspect.setProductId(product.getId()); |
| | | qualityInspect.setProductName(product.getProductName()); |
| | | qualityInspect.setModel(productModel.getModel()); |
| | | qualityInspect.setUnit(productModel.getUnit()); |
| | | qualityInspect.setQuantity(dto.getQuantity()); |
| | | qualityInspect.setProcess(productProcess.getName()); |
| | | qualityInspect.setInspectState(0); |
| | | qualityInspect.setInspectType(inspectType); |
| | | qualityInspect.setProductMainId(productionProductMain.getId()); |
| | | qualityInspect.setProductModelId(productModel.getId()); |
| | | qualityInspectMapper.insert(qualityInspect); |
| | | qualityTestStandardMapper.selectList( |
| | | new LambdaQueryWrapper<QualityTestStandard>() |
| | | .eq(QualityTestStandard::getProductId, product.getId()) |
| | | ).forEach(standard -> { |
| | | QualityInspectParam param = new QualityInspectParam(); |
| | | BeanUtils.copyProperties(standard, param); |
| | | param.setId(null); |
| | | param.setInspectId(qualityInspect.getId()); |
| | | qualityInspectParamMapper.insert(param); |
| | | }); |
| | | /*æ´æ°å·¥ååç产订å*/ |
| | | ProductWorkOrder productWorkOrder = productWorkOrderMapper.selectById(dto.getWorkOrderId()); |
| | | productWorkOrder.setCompleteQuantity(productWorkOrder.getCompleteQuantity().add(dto.getQuantity())); |
| | | if (ObjectUtils.isNull(productWorkOrder.getActualStartTime())){ |
| | | productWorkOrder.setActualStartTime(LocalDate.now());//å®é
å¼å§æ¶é´ |
| | | } |
| | | if (productWorkOrder.getCompleteQuantity().compareTo(productWorkOrder.getPlanQuantity()) == 0){ |
| | | productWorkOrder.setActualEndTime(LocalDate.now());//å®é
ç»ææ¶é´ |
| | | } |
| | | productWorkOrderMapper.updateById(productWorkOrder); |
| | | //ç产订å |
| | | ProductOrder productOrder = productOrderMapper.selectById(productWorkOrder.getProductOrderId()); |
| | | if (ObjectUtils.isNull(productOrder.getStartTime())){ |
| | | productOrder.setStartTime(LocalDateTime.now());//å¼å§æ¶é´ |
| | | } |
| | | if (productProcessRouteItem.getDragSort()==productProcessRouteItems.size()){ |
| | | //å¦ææ¯æåä¸éå·¥åºæ¥å·¥ä¹åç产订å宿æ°é+ |
| | | productOrder.setCompleteQuantity(productOrder.getCompleteQuantity().add(dto.getQuantity())); |
| | | if (productOrder.getCompleteQuantity().compareTo(productOrder.getQuantity()) == 0){ |
| | | productOrder.setEndTime(LocalDateTime.now());//ç»ææ¶é´ |
| | | } |
| | | } |
| | | productOrderMapper.updateById(productOrder); |
| | | /*æ·»å çäº§æ ¸ç®*/ |
| | | SalesLedgerProductionAccounting salesLedgerProductionAccounting = SalesLedgerProductionAccounting.builder() |
| | | .salesLedgerWorkId(productionProductMain.getId()) |
| | | .salesLedgerSchedulingId(0L) |
| | |
| | | .tenantId(dto.getTenantId()) |
| | | .build(); |
| | | salesLedgerProductionAccountingMapper.insert(salesLedgerProductionAccounting); |
| | | |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public Boolean removeProductMain(ProductionProductMainDto dto) { |
| | | Long id = dto.getId(); |
| | | |
| | | // æ´æ°å·¥å |
| | | productWorkOrderMapper.rollbackPlanQuantity(id); |
| | | // å é¤è´¨æ£åæ°åè´¨æ£è®°å½ |
| | | ProductionProductMain productionProductMain = productionProductMainMapper.selectById(dto.getId()); |
| | | //该æ¥å·¥å¯¹åºçå·¥èºè·¯çº¿è¯¦æ
|
| | | ProductProcessRouteItem productProcessRouteItem = productProcessRouteItemMapper.selectById(productionProductMain.getProductProcessRouteItemId()); |
| | | ProductionProductOutput productionProductOutput = productionProductOutputMapper.selectList(Wrappers.<ProductionProductOutput>lambdaQuery().eq(ProductionProductOutput::getProductMainId, productionProductMain.getId())).get(0); |
| | | /*å 餿 ¸ç®*/ |
| | | salesLedgerProductionAccountingMapper.delete( |
| | | new LambdaQueryWrapper<SalesLedgerProductionAccounting>() |
| | | .eq(SalesLedgerProductionAccounting::getSalesLedgerWorkId, productionProductMain.getId()) |
| | | ); |
| | | /*æ´æ°å·¥ååç产订å*/ |
| | | ProductWorkOrder productWorkOrder = productWorkOrderMapper.selectById(productionProductMain.getWorkOrderId()); |
| | | productWorkOrder.setCompleteQuantity(productWorkOrder.getCompleteQuantity().subtract(productionProductOutput.getQuantity())); |
| | | productWorkOrder.setActualEndTime(null); |
| | | productWorkOrderMapper.updateById(productWorkOrder); |
| | | //夿æ¯å¦æ¯æåä¸éå·¥åº |
| | | List<ProductProcessRouteItem> productProcessRouteItems = productProcessRouteItemMapper.selectList(Wrappers.<ProductProcessRouteItem>lambdaQuery().eq(ProductProcessRouteItem::getProductRouteId, productProcessRouteItem.getProductRouteId())); |
| | | if (productProcessRouteItem.getDragSort() == productProcessRouteItems.size()){ |
| | | ProductOrder productOrder = productOrderMapper.selectById(productWorkOrder.getProductOrderId()); |
| | | productOrder.setCompleteQuantity(productOrder.getCompleteQuantity().subtract(productionProductOutput.getQuantity())); |
| | | productOrder.setEndTime(null); |
| | | productOrderMapper.updateById(productOrder); |
| | | } |
| | | /*å é¤äº§åº*/ |
| | | //å é¤è´¨æ£ |
| | | qualityInspectMapper.selectList( |
| | | new LambdaQueryWrapper<QualityInspect>() |
| | | .eq(QualityInspect::getProductMainId, id) |
| | | .eq(QualityInspect::getProductMainId, productionProductMain.getId()) |
| | | ).forEach(q -> { |
| | | qualityInspectParamMapper.delete( |
| | | new LambdaQueryWrapper<QualityInspectParam>() |
| | | .eq(QualityInspectParam::getInspectId, q.getId())); |
| | | qualityInspectMapper.deleteById(q.getId()); |
| | | }); |
| | | |
| | | // å é¤äº§åºè®°å½ |
| | | productionProductOutputMapper.delete(new LambdaQueryWrapper<ProductionProductOutput>() |
| | | .eq(ProductionProductOutput::getProductMainId, id) |
| | | ); |
| | | |
| | | // å é¤å
³èçæ ¸ç®æ°æ® |
| | | salesLedgerProductionAccountingMapper.delete( |
| | | new LambdaQueryWrapper<SalesLedgerProductionAccounting>() |
| | | .eq(SalesLedgerProductionAccounting::getSalesLedgerWorkId, id) |
| | | ); |
| | | |
| | | .eq(ProductionProductOutput::getProductMainId, productionProductMain.getId())); |
| | | /*å 餿å
¥*/ |
| | | procurementRecordOutMapper.delete(new LambdaQueryWrapper<ProcurementRecordOut>() |
| | | .eq(ProcurementRecordOut::getSalesLedgerProductId, productionProductMain.getId())); |
| | | productionProductInputMapper.delete(new LambdaQueryWrapper<ProductionProductInput>() |
| | | .eq(ProductionProductInput::getProductMainId, productionProductMain.getId())); |
| | | // å é¤ä¸»è¡¨ |
| | | return productionProductMainMapper.deleteById(id) > 0; |
| | | productionProductMainMapper.deleteById(productionProductMain.getId()); |
| | | return true; |
| | | } |
| | | } |
| | |
| | | |
| | | 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); |
| | | } |
| | |
| | | return AjaxResult.success("ä¿®æ¹æå"); |
| | | } |
| | | |
| | | @Override |
| | | public ProductRecordDto getProductRecordById(Long id) { |
| | | ProductRecordDto productRecordDto = productRecordMapper.getProductRecordById(id); |
| | | return productRecordDto; |
| | | @Override |
| | | 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; |
| | | } |
| | | } |
| | |
| | | } |
| | | //æ°å¢åæææ£éª |
| | | for (SalesLedgerProduct saleProduct : productList) { |
| | | QualityInspect qualityInspect = new QualityInspect(); |
| | | qualityInspect.setInspectType(0); |
| | | qualityInspect.setSupplier(purchaseLedger.getSupplierName()); |
| | | qualityInspect.setPurchaseLedgerId(purchaseLedger.getId()); |
| | | qualityInspect.setProductId(saleProduct.getId()); |
| | | qualityInspect.setProductName(saleProduct.getProductCategory()); |
| | | qualityInspect.setModel(saleProduct.getSpecificationModel()); |
| | | qualityInspect.setProductModelId(saleProduct.getProductModelId()); |
| | | qualityInspect.setUnit(saleProduct.getUnit()); |
| | | qualityInspect.setQuantity(saleProduct.getQuantity()); |
| | | qualityInspectMapper.insert(qualityInspect); |
| | | |
| | | List<QualityTestStandardParam> qualityTestStandardParams = qualityTestStandardParamMapper.selectListByProductId(saleProduct.getProductId()); |
| | | if (qualityTestStandardParams.size()>0) { |
| | | qualityTestStandardParams.forEach(standard -> { |
| | | QualityInspectParam param = new QualityInspectParam(); |
| | | com.ruoyi.common.utils.bean.BeanUtils.copyProperties(standard, param); |
| | | param.setId(null); |
| | | param.setInspectId(qualityInspect.getId()); |
| | | qualityInspectParamMapper.insert(param); |
| | | }); |
| | | //æ¯å¦æ¨éè´¨æ£ï¼å¦ætrue就添å |
| | | if (saleProduct.getIsChecked()) { |
| | | addQualityInspect(purchaseLedger, saleProduct); |
| | | } |
| | | } |
| | | // 5. è¿ç§»ä¸´æ¶æä»¶å°æ£å¼ç®å½ |
| | | if (purchaseLedgerDto.getTempFileIds() != null && !purchaseLedgerDto.getTempFileIds().isEmpty()) { |
| | | migrateTempFilesToFormal(purchaseLedger.getId(), purchaseLedgerDto.getTempFileIds()); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | private void addQualityInspect(PurchaseLedger purchaseLedger, SalesLedgerProduct saleProduct) { |
| | | QualityInspect qualityInspect = new QualityInspect(); |
| | | qualityInspect.setInspectType(0); |
| | | qualityInspect.setSupplier(purchaseLedger.getSupplierName()); |
| | | qualityInspect.setPurchaseLedgerId(purchaseLedger.getId()); |
| | | qualityInspect.setProductId(saleProduct.getId()); |
| | | qualityInspect.setProductName(saleProduct.getProductCategory()); |
| | | qualityInspect.setModel(saleProduct.getSpecificationModel()); |
| | | qualityInspect.setProductModelId(saleProduct.getProductModelId()); |
| | | qualityInspect.setUnit(saleProduct.getUnit()); |
| | | qualityInspect.setQuantity(saleProduct.getQuantity()); |
| | | qualityInspectMapper.insert(qualityInspect); |
| | | QualityTestStandard qualityTestStandard = new QualityTestStandard(); |
| | | qualityTestStandard.setProductId(saleProduct.getProductId()); |
| | | List<QualityTestStandard> qualityTestStandards = qualityTestStandardMapper.qualityTestStandardList(qualityTestStandard); |
| | | for (QualityTestStandard qualityTestStandardDB : qualityTestStandards) { |
| | | QualityInspectParam qualityInspectParam = new QualityInspectParam(); |
| | | qualityInspectParam.setInspectId(qualityInspect.getId()); |
| | | qualityInspectParam.setParameterItem(qualityTestStandardDB.getParameterItem()); |
| | | qualityInspectParam.setUnit(qualityTestStandardDB.getUnit()); |
| | | qualityInspectParam.setStandardValue(qualityTestStandardDB.getStandardValue()); |
| | | qualityInspectParam.setControlValue(qualityTestStandardDB.getControlValue()); |
| | | qualityInspectParamMapper.insert(qualityInspectParam); |
| | | } |
| | | } |
| | | |
| | | // 5. è¿ç§»ä¸´æ¶æä»¶å°æ£å¼ç®å½ |
| | | if (purchaseLedgerDto.getTempFileIds() != null && !purchaseLedgerDto.getTempFileIds().isEmpty()) { |
| | |
| | | |
| | | LocalDateTime localDateTime = entryDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); |
| | | salesLedgerProduct.setRegisterDate(localDateTime); |
| | | salesLedgerProduct.setFutureTickets(salesLedgerProduct.getQuantity()); |
| | | salesLedgerProduct.setFutureTicketsAmount(salesLedgerProduct.getTaxInclusiveTotalPrice()); |
| | | salesLedgerProduct.setPendingTicketsTotal(salesLedgerProduct.getTaxInclusiveTotalPrice()); |
| | | salesLedgerProductMapper.insert(salesLedgerProduct); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int deletePurchaseLedgerByIds(Long[] ids) { |
| | | if (ids == null || ids.length == 0) { |
| | | throw new BaseException("请éä¸è³å°ä¸æ¡æ°æ®"); |
| | |
| | | salesLedgerProductMapper.delete(queryWrapper); |
| | | // æ¹éå é¤å
³èçéè´å°è´¦çæ¥ç¥¨ç»è®° |
| | | LambdaQueryWrapper<TicketRegistration> ticketRegistrationLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | ticketRegistrationLambdaQueryWrapper.in(TicketRegistration::getSalesLedgerId,ids); |
| | | ticketRegistrationLambdaQueryWrapper.in(TicketRegistration::getPurchaseLedgerId,ids); |
| | | ticketRegistrationMapper.delete(ticketRegistrationLambdaQueryWrapper); |
| | | // æ¹éå é¤å
³èçéè´å°è´¦çæ¥ç¥¨ç»è®°è®°å½ |
| | | LambdaQueryWrapper<ProductRecord> productRecordLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | |
| | | LambdaQueryWrapper<QualityInspect> materialInspectLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | materialInspectLambdaQueryWrapper.in(QualityInspect::getPurchaseLedgerId, ids); |
| | | List<QualityInspect> qualityInspects = qualityInspectMapper.selectList(materialInspectLambdaQueryWrapper); |
| | | qualityInspects.stream().forEach(qualityInspect -> { |
| | | if (ObjectUtils.isNotEmpty(qualityInspect.getInspectState())&&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.procurementrecord.dto.ProcurementPageDto; |
| | | import com.ruoyi.procurementrecord.dto.ProcurementPageDtoCopy; |
| | | import com.ruoyi.procurementrecord.service.ProcurementRecordService; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.sales.dto.SalesLedgerProductDto; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.service.ISalesLedgerProductService; |
| | |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 产åä¿¡æ¯Controller |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | * @date 2025-05-08 |
| | | */ |
| | |
| | | private ISalesLedgerProductService salesLedgerProductService; |
| | | @Autowired |
| | | private ProcurementRecordService procurementRecordService; |
| | | @Autowired |
| | | private StockUtils stockUtils; |
| | | |
| | | |
| | | /** |
| | |
| | | { |
| | | List<SalesLedgerProduct> list = salesLedgerProductService.selectSalesLedgerProductList(salesLedgerProduct); |
| | | list.forEach(item -> { |
| | | ProcurementPageDto procurementDto = new ProcurementPageDto(); |
| | | procurementDto.setSalesLedgerProductId(item.getId()); |
| | | procurementDto.setProductCategory(item.getProductCategory()); |
| | | IPage<ProcurementPageDtoCopy> result = procurementRecordService.listPageCopyByProduction(new Page<>(1,-1), procurementDto); |
| | | if(result.getRecords().size()>0) { |
| | | ProcurementPageDtoCopy procurementDtoCopy = result.getRecords().get(0); |
| | | if (item.getQuantity().compareTo(procurementDtoCopy.getInboundNum0()) >= 0 && item.getApproveStatus() == 0) { |
| | | 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()); |
| | | // IPage<ProcurementPageDtoCopy> result = procurementRecordService.listPageCopyByProduction(new Page<>(1,-1), procurementDto); |
| | | BigDecimal stockQuantity = stockUtils.getStockQuantity(item.getProductModelId()).get("stockQuantity"); |
| | | if(stockQuantity != null) { |
| | | // ProcurementPageDtoCopy procurementDtoCopy = result.getRecords().get(0); |
| | | if (item.getQuantity().compareTo(stockQuantity) >= 0 && item.getApproveStatus() == 0) { |
| | | item.setApproveStatus(1); |
| | | salesLedgerProductService.addOrUpdateSalesLedgerProduct(item); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.google.common.math.LongMath; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | |
| | | @ApiOperation("å货审æ¹,æ´æ°å货审æ¹ç¶æ") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody ShipmentApproval req) { |
| | | |
| | | // æ¥è¯¢åè´§å®¡æ¹ |
| | | ShipmentApproval shipmentApproval = shipmentApprovalMapper.selectById(req.getId()); |
| | | if (shipmentApproval == null) { |
| | | return AjaxResult.error("å货审æ¹ä¸åå¨"); |
| | | } |
| | | |
| | | // æ´æ°å货审æ¹ç¶æ |
| | | shipmentApproval.setApproveStatus(req.getApproveStatus()); |
| | | boolean update = shipmentApprovalService.updateById(shipmentApproval); |
| | | if(update){ |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductService.getById(shipmentApproval.getSalesLedgerProductId()); |
| | | salesLedgerProduct.setApproveStatus(req.getApproveStatus()); |
| | | salesLedgerProductService.updateById(salesLedgerProduct); |
| | | |
| | | if(req.getApproveStatus()==3){ |
| | | ProcurementRecordStorage procurementRecordStorage = procurementRecordStorageService.getOne(new LambdaQueryWrapper<ProcurementRecordStorage>() |
| | | .eq(ProcurementRecordStorage::getSalesLedgerProductId, req.getSalesLedgerProductId())); |
| | | if(procurementRecordStorage==null){ |
| | | return AjaxResult.error("éè´è®°å½ä¸åå¨"); |
| | | } |
| | | //å货审æ¹éè¿ï¼ç产该订ååºåºè®°å½ |
| | | ProcurementRecordOutAdd procurementRecordOutAdd = new ProcurementRecordOutAdd(); |
| | | procurementRecordOutAdd.setId(procurementRecordStorage.getId()); |
| | | procurementRecordOutAdd.setSalesLedgerProductId(Math.toIntExact(salesLedgerProduct.getId())); |
| | | procurementRecordOutAdd.setType(2); |
| | | procurementRecordOutAdd.setUserId(Math.toIntExact(getUserId())); |
| | | procurementRecordOutAdd.setQuantity(String.valueOf(salesLedgerProduct.getQuantity())); |
| | | //è·åå½åæ¶é´ |
| | | LocalDate now = LocalDate.now(); |
| | | procurementRecordOutAdd.setTime(now.toString()); |
| | | procurementRecordOutService.stockout(procurementRecordOutAdd); |
| | | } |
| | | if (!update) { |
| | | // äºå¡åæ» |
| | | throw new ServiceException("åè´§å®¡æ¹æ´æ°å¤±è´¥"); |
| | | } |
| | | return update ? AjaxResult.success() : AjaxResult.error(); |
| | | // æ¥è¯¢å
³èçéå®å°è´¦äº§å |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductService.getById(shipmentApproval.getSalesLedgerProductId()); |
| | | if (salesLedgerProduct == null) { |
| | | // æå¼å¸¸äºå¡åæ» |
| | | throw new ServiceException("éå®å°è´¦ä¸åå¨ï¼å®¡æ¹åæ»"); |
| | | } |
| | | |
| | | // åæ¥æ´æ°éå®å°è´¦äº§åç审æ¹ç¶æ |
| | | salesLedgerProduct.setApproveStatus(req.getApproveStatus()); |
| | | salesLedgerProductService.updateById(salesLedgerProduct); |
| | | |
| | | // 审æ¹éè¿ |
| | | if (req.getApproveStatus() == 3) { |
| | | // æ¥è¯¢éè´å
¥åºè®°å½ |
| | | LambdaQueryWrapper<ProcurementRecordStorage> lambdaQueryWrapper = new LambdaQueryWrapper<ProcurementRecordStorage>() |
| | | .eq(ProcurementRecordStorage::getSalesLedgerProductId, req.getSalesLedgerProductId()); |
| | | ProcurementRecordStorage procurementRecordStorage = procurementRecordStorageService.getOne(lambdaQueryWrapper); |
| | | |
| | | if (procurementRecordStorage == null) { |
| | | // ä¿è¯åé¢çä¿®æ¹å
¨é¨åæ» |
| | | throw new ServiceException("éè´è®°å½ä¸åå¨ï¼å®¡æ¹åæ»"); |
| | | } |
| | | |
| | | // çæåºåºè®°å½ |
| | | ProcurementRecordOutAdd procurementRecordOutAdd = new ProcurementRecordOutAdd(); |
| | | procurementRecordOutAdd.setId(procurementRecordStorage.getId()); |
| | | procurementRecordOutAdd.setSalesLedgerProductId((long) Math.toIntExact(salesLedgerProduct.getId())); |
| | | procurementRecordOutAdd.setType(2); |
| | | procurementRecordOutAdd.setUserId(Math.toIntExact(getUserId())); |
| | | procurementRecordOutAdd.setQuantity(salesLedgerProduct.getQuantity().toPlainString()); |
| | | procurementRecordOutAdd.setTime(LocalDate.now().toString()); |
| | | |
| | | procurementRecordOutService.stockout(procurementRecordOutAdd); |
| | | } |
| | | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 导åºåè´§ä¿¡æ¯ç®¡ç |
| | | */ |
| | |
| | | /** |
| | | * æ¬æ¬¡æ¥ç¥¨æ° |
| | | */ |
| | | 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; |
| | |
| | | |
| | | @ApiModelProperty(value = "仿¬¾æ»éé¢") |
| | | private BigDecimal ticketsTotal = BigDecimal.ZERO; |
| | | |
| | | @ApiModelProperty(value = "æ¯å¦è´¨æ£") |
| | | private Boolean isChecked; |
| | | } |
| | |
| | | |
| | | /** |
| | | * å¤ç彿å¼ç¥¨å°è´¦å é¤ |
| | | * |
| | | * @param invoiceRegistrationProductId |
| | | * @param invoiceRegistrationProduct |
| | | */ |
| | | private void dealCurrentMonthDel(Integer invoiceRegistrationProductId,InvoiceRegistrationProduct invoiceRegistrationProduct){ |
| | | |
| | | private void dealCurrentMonthDel(Integer invoiceRegistrationProductId, InvoiceRegistrationProduct invoiceRegistrationProduct) { |
| | | |
| | | // å é¤å¼ç¥¨å°è´¦ |
| | | QueryWrapper<InvoiceLedger> delMapper = new QueryWrapper<>(); |
| | | delMapper.eq("invoice_registration_product_id", invoiceRegistrationProductId); |
| | | invoiceLedgerMapper.delete(delMapper); |
| | | // å é¤å¼ç¥¨ç»è®°å¹¶åæ» |
| | | QueryWrapper<InvoiceLedger> delLedgerWrapper = new QueryWrapper<>(); |
| | | delLedgerWrapper.eq("invoice_registration_product_id", invoiceRegistrationProductId); |
| | | invoiceLedgerMapper.delete(delLedgerWrapper); |
| | | |
| | | // æ¥è¯¢å½å产åä¸çææå¼ç¥¨ç»è®° |
| | | QueryWrapper<InvoiceRegistrationProduct> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("sales_ledger_id", invoiceRegistrationProduct.getSalesLedgerId()); |
| | | queryWrapper.eq("sales_ledger_product_id", invoiceRegistrationProduct.getSalesLedgerProductId()); |
| | | queryWrapper.orderByAsc("create_time"); |
| | | List<InvoiceRegistrationProduct> invoiceRegistrationProductList = invoiceRegistrationProductMapper.selectList(queryWrapper); |
| | | // InvoiceRegistrationProduct invoiceRegistrationProduct = invoiceRegistrationProductMapper.selectById(invoiceRegistrationProductId); |
| | | int index = -1; |
| | | for (int i = 0; i < invoiceRegistrationProductList.size(); i++) { |
| | | InvoiceRegistrationProduct currentInvoiceRegProduct = invoiceRegistrationProductList.get(i); |
| | | if(invoiceRegistrationProduct.getId().equals(currentInvoiceRegProduct.getId())){ |
| | | List<InvoiceRegistrationProduct> allList = invoiceRegistrationProductMapper.selectList(queryWrapper); |
| | | |
| | | int index = -1; |
| | | for (int i = 0; i < allList.size(); i++) { |
| | | if (invoiceRegistrationProductId.equals(allList.get(i).getId())) { |
| | | index = i; |
| | | break; |
| | | } |
| | | } |
| | | if(index == -1){ |
| | | if (index == -1) { |
| | | return; |
| | | } |
| | | for (int i = index + 1; i < invoiceRegistrationProductList.size(); i++) { |
| | | InvoiceRegistrationProduct currentInvoiceRegProduct = invoiceRegistrationProductList.get(i); |
| | | // åæ»æªå¼ç¥¨æ°/æªå¼ç¥¨éé¢ |
| | | BigDecimal noInvoiceAmount = currentInvoiceRegProduct.getNoInvoiceAmount().add(invoiceRegistrationProduct.getInvoiceAmount()); |
| | | BigDecimal noInvoiceNum = currentInvoiceRegProduct.getNoInvoiceNum().add(invoiceRegistrationProduct.getInvoiceNum()); |
| | | currentInvoiceRegProduct.setNoInvoiceAmount(noInvoiceAmount); |
| | | currentInvoiceRegProduct.setNoInvoiceNum(noInvoiceNum); |
| | | invoiceRegistrationProductMapper.updateById(currentInvoiceRegProduct); |
| | | |
| | | for (int i = index + 1; i < allList.size(); i++) { |
| | | InvoiceRegistrationProduct current = allList.get(i); |
| | | |
| | | current.setNoInvoiceNum(current.getNoInvoiceNum().add(invoiceRegistrationProduct.getInvoiceNum())); |
| | | current.setNoInvoiceAmount(current.getNoInvoiceAmount().add(invoiceRegistrationProduct.getInvoiceAmount())); |
| | | |
| | | invoiceRegistrationProductMapper.updateById(current); |
| | | } |
| | | |
| | | // å é¤å½åå¼ç¥¨ç»è®° |
| | | invoiceRegistrationProductMapper.deleteById(invoiceRegistrationProductId); |
| | | // ä¿®æ¹sale_productæ°æ® |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(invoiceRegistrationProduct.getSalesLedgerProductId()); |
| | | |
| | | // æ¥è¯¢å é¤åçå©ä½å¼ç¥¨ç»è®° |
| | | QueryWrapper<InvoiceRegistrationProduct> newQueryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("sales_ledger_id", invoiceRegistrationProduct.getSalesLedgerId()); |
| | | queryWrapper.eq("sales_ledger_product_id", invoiceRegistrationProduct.getSalesLedgerProductId()); |
| | | queryWrapper.orderByAsc("create_time"); |
| | | List<InvoiceRegistrationProduct> newInvoiceRegistrationProductList = invoiceRegistrationProductMapper.selectList(newQueryWrapper); |
| | | if(CollectionUtils.isEmpty(newInvoiceRegistrationProductList)){ |
| | | newQueryWrapper.eq("sales_ledger_id", invoiceRegistrationProduct.getSalesLedgerId()); |
| | | newQueryWrapper.eq("sales_ledger_product_id", invoiceRegistrationProduct.getSalesLedgerProductId()); |
| | | newQueryWrapper.orderByAsc("create_time"); |
| | | List<InvoiceRegistrationProduct> remainList = invoiceRegistrationProductMapper.selectList(newQueryWrapper); |
| | | |
| | | // æ¥è¯¢éå®å°è´¦äº§å |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(invoiceRegistrationProduct.getSalesLedgerProductId()); |
| | | |
| | | if (CollectionUtils.isEmpty(remainList)) { |
| | | // 没æä»»ä½å¼ç¥¨è®°å½ï¼æ¢å¤åå§ç¶æ |
| | | salesLedgerProduct.setInvoiceNum(BigDecimal.ZERO); |
| | | salesLedgerProduct.setInvoiceAmount(BigDecimal.ZERO); |
| | | salesLedgerProduct.setNoInvoiceNum(salesLedgerProduct.getQuantity()); |
| | | salesLedgerProduct.setNoInvoiceAmount(salesLedgerProduct.getTaxInclusiveTotalPrice()); |
| | | }else { |
| | | } else { |
| | | salesLedgerProduct.setInvoiceNum(salesLedgerProduct.getInvoiceNum().subtract(invoiceRegistrationProduct.getInvoiceNum())); |
| | | salesLedgerProduct.setInvoiceAmount(salesLedgerProduct.getInvoiceAmount().subtract(invoiceRegistrationProduct.getInvoiceAmount())); |
| | | salesLedgerProduct.setNoInvoiceNum(salesLedgerProduct.getNoInvoiceNum().add(invoiceRegistrationProduct.getInvoiceNum())); |
| | | salesLedgerProduct.setNoInvoiceAmount(salesLedgerProduct.getNoInvoiceAmount().add(invoiceRegistrationProduct.getInvoiceAmount())); |
| | | } |
| | | |
| | | salesLedgerProductMapper.updateById(salesLedgerProduct); |
| | | } |
| | | |
| | |
| | | * @param invoiceRegistrationProduct |
| | | * @param invoiceLedger |
| | | */ |
| | | private void dealOtherMonthDel(InvoiceRegistrationProduct invoiceRegistrationProduct,InvoiceLedger invoiceLedger ){ |
| | | InvoiceRegistrationProduct copyRegProduct = new InvoiceRegistrationProduct(); |
| | | BeanUtils.copyProperties(invoiceRegistrationProduct, copyRegProduct); |
| | | BigDecimal invoiceNum = copyRegProduct.getInvoiceNum().negate(); |
| | | BigDecimal invoiceAmount = copyRegProduct.getInvoiceAmount().negate(); |
| | | // invoice_registration_product |
| | | // å é¤å¼ç¥¨ç»è®°å¹¶åæ» |
| | | private void dealOtherMonthDel(InvoiceRegistrationProduct invoiceRegistrationProduct, InvoiceLedger invoiceLedger) { |
| | | //æ¥è¯¢åå²å¼ç¥¨ç»è®° |
| | | QueryWrapper<InvoiceRegistrationProduct> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("sales_ledger_id", invoiceRegistrationProduct.getSalesLedgerId()); |
| | | queryWrapper.eq("sales_ledger_product_id", invoiceRegistrationProduct.getSalesLedgerProductId()); |
| | | queryWrapper.orderByAsc("create_time"); |
| | | List<InvoiceRegistrationProduct> invoiceRegistrationProductList = invoiceRegistrationProductMapper.selectList(queryWrapper); |
| | | InvoiceRegistrationProduct lastInvoiceRegistrationProduct = invoiceRegistrationProductList.get(invoiceRegistrationProductList.size() - 1); |
| | | BigDecimal noInvoiceNum = lastInvoiceRegistrationProduct.getNoInvoiceNum().subtract(invoiceNum); |
| | | BigDecimal noInvoiceAmount = lastInvoiceRegistrationProduct.getNoInvoiceAmount().subtract(invoiceAmount); |
| | | copyRegProduct.setInvoiceNum(invoiceNum); |
| | | copyRegProduct.setInvoiceAmount(invoiceAmount); |
| | | copyRegProduct.setNoInvoiceNum(noInvoiceNum); |
| | | copyRegProduct.setNoInvoiceAmount(noInvoiceAmount); |
| | | copyRegProduct.setId(null); |
| | | invoiceRegistrationProductMapper.insert(copyRegProduct); |
| | | List<InvoiceRegistrationProduct> list = invoiceRegistrationProductMapper.selectList(queryWrapper); |
| | | |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return; |
| | | } |
| | | |
| | | InvoiceRegistrationProduct last = list.get(list.size() - 1); |
| | | |
| | | BigDecimal negateInvoiceNum = invoiceRegistrationProduct.getInvoiceNum().negate(); |
| | | BigDecimal negateInvoiceAmount = invoiceRegistrationProduct.getInvoiceAmount().negate(); |
| | | |
| | | InvoiceRegistrationProduct copy = new InvoiceRegistrationProduct(); |
| | | BeanUtils.copyProperties(invoiceRegistrationProduct, copy); |
| | | |
| | | copy.setId(null); |
| | | copy.setInvoiceNum(negateInvoiceNum); |
| | | copy.setInvoiceAmount(negateInvoiceAmount); |
| | | |
| | | // æªå¼ç¥¨ = ä¸ä¸æ¡ + æ¬æ¬¡å²åçæ°é |
| | | copy.setNoInvoiceNum(last.getNoInvoiceNum().add(invoiceRegistrationProduct.getInvoiceNum())); |
| | | copy.setNoInvoiceAmount(last.getNoInvoiceAmount().add(invoiceRegistrationProduct.getInvoiceAmount())); |
| | | |
| | | invoiceRegistrationProductMapper.insert(copy); |
| | | |
| | | // å¤å¶å¼ç¥¨å°è´¦ |
| | | InvoiceLedger invoiceLedgerCopy = new InvoiceLedger(); |
| | | BeanUtils.copyProperties(invoiceLedger, invoiceLedgerCopy); |
| | | invoiceLedgerCopy.setInvoiceRegistrationProductId(copyRegProduct.getId()); |
| | | BigDecimal invoiceTotal = invoiceLedgerCopy.getInvoiceTotal().negate(); |
| | | invoiceLedgerCopy.setInvoiceTotal(invoiceTotal); |
| | | invoiceLedgerCopy.setId(null); |
| | | invoiceLedgerCopy.setInvoiceDate(LocalDate.now()); |
| | | invoiceLedgerMapper.insert(invoiceLedgerCopy); |
| | | // æ´æ°sales_leger_product |
| | | QueryWrapper<SalesLedgerProduct> salesLedgerProductQueryWrapper = new QueryWrapper<>(); |
| | | salesLedgerProductQueryWrapper.eq("id", invoiceRegistrationProduct.getSalesLedgerProductId()); |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectOne(salesLedgerProductQueryWrapper); |
| | | salesLedgerProduct.setNoInvoiceNum(noInvoiceNum); |
| | | salesLedgerProduct.setNoInvoiceAmount(noInvoiceAmount); |
| | | BigDecimal newInvoiceNum = salesLedgerProduct.getInvoiceNum().add(invoiceNum); |
| | | BigDecimal newInvocieAmount = salesLedgerProduct.getInvoiceAmount().add(invoiceAmount); |
| | | salesLedgerProduct.setInvoiceNum(newInvoiceNum); |
| | | salesLedgerProduct.setInvoiceAmount(newInvocieAmount); |
| | | InvoiceLedger ledgerCopy = new InvoiceLedger(); |
| | | BeanUtils.copyProperties(invoiceLedger, ledgerCopy); |
| | | |
| | | ledgerCopy.setId(null); |
| | | ledgerCopy.setInvoiceRegistrationProductId(copy.getId()); |
| | | ledgerCopy.setInvoiceTotal(invoiceLedger.getInvoiceTotal().negate()); |
| | | ledgerCopy.setInvoiceDate(LocalDate.now()); |
| | | |
| | | invoiceLedgerMapper.insert(ledgerCopy); |
| | | |
| | | // åæ» sales_ledger_product |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(invoiceRegistrationProduct.getSalesLedgerProductId()); |
| | | |
| | | // å·²å¼ç¥¨ |
| | | salesLedgerProduct.setInvoiceNum(salesLedgerProduct.getInvoiceNum().add(negateInvoiceNum)); |
| | | salesLedgerProduct.setInvoiceAmount(salesLedgerProduct.getInvoiceAmount().add(negateInvoiceAmount)); |
| | | |
| | | // æªå¼ç¥¨ |
| | | salesLedgerProduct.setNoInvoiceNum(salesLedgerProduct.getNoInvoiceNum().add(invoiceRegistrationProduct.getInvoiceNum())); |
| | | salesLedgerProduct.setNoInvoiceAmount(salesLedgerProduct.getNoInvoiceAmount().add(invoiceRegistrationProduct.getInvoiceAmount())); |
| | | |
| | | salesLedgerProductMapper.updateById(salesLedgerProduct); |
| | | } |
| | | |
| | | } |
| | |
| | | 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.listBybomId(processRoute.getBomId()); |
| | | 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> |
| | |
| | | t1.create_by, |
| | | t2.warn_num, |
| | | t4.unit_price, |
| | | t4.unit_price * t1.inbound_num as totalPrice |
| | | from procurement_record_out t1 |
| | | t4.unit_price * t1.inbound_num as totalPrice |
| | | from procurement_record_out t1 |
| | | left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id and t2.type = 2 |
| | | left join purchase_ledger t3 on t3.id = t2.sales_ledger_id |
| | | left join procurement_record_storage t4 on t4.id = t1.procurement_record_storage_id |
| | | <where> |
| | | and t1.type = 1 |
| | | <if test="req.supplierName != null and req.supplierName != ''"> |
| | | and t3.supplier_name like concat('%',#{req.supplierName},'%') |
| | | and t3.supplier_name like concat('%',#{req.supplierName},'%') |
| | | </if> |
| | | <if test="req.productCategory != null and req.productCategory != ''"> |
| | | and t2.product_category like concat('%',#{req.productCategory},'%') |
| | | and t2.product_category like concat('%',#{req.productCategory},'%') |
| | | </if> |
| | | <if test="req.timeStr != null and req.timeStr != ''"> |
| | | and t1.create_time like concat('%',#{req.timeStr},'%') |
| | | and t1.create_time like concat('%',#{req.timeStr},'%') |
| | | </if> |
| | | </where> |
| | | order by t1.create_time desc |
| | | </select> |
| | | <select id="list" resultType="com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto"> |
| | | select |
| | | t3.supplier_name, |
| | | t2.product_category, |
| | | t1.id, |
| | | t2.specification_model, |
| | | t2.unit, |
| | | t2.tax_rate, |
| | | t2.tax_inclusive_unit_price, |
| | | t2.tax_inclusive_total_price, |
| | | t2.tax_exclusive_total_price, |
| | | t1.inbound_num, |
| | | t1.create_time, |
| | | t1.create_time as time, |
| | | t1.create_by |
| | | from procurement_record_out t1 |
| | | left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id |
| | | left join purchase_ledger t3 on t3.id = t2.sales_ledger_id |
| | | where t1.type = 1 |
| | | select t3.supplier_name, |
| | | t2.product_category, |
| | | t1.id, |
| | | t2.specification_model, |
| | | t2.unit, |
| | | t2.tax_rate, |
| | | t2.tax_inclusive_unit_price, |
| | | t2.tax_inclusive_total_price, |
| | | t2.tax_exclusive_total_price, |
| | | t1.inbound_num, |
| | | t1.create_time, |
| | | t1.create_time as time, |
| | | t1.create_by |
| | | from procurement_record_out t1 |
| | | left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id |
| | | left join purchase_ledger t3 on t3.id = t2.sales_ledger_id |
| | | where t1.type = 1 |
| | | </select> |
| | | |
| | | <select id="listOne" resultType="com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto"> |
| | | select |
| | | t3.customer_contract_no, |
| | | t3.sales_contract_no, |
| | | t3.customer_name, |
| | | t2.product_category, |
| | | t1.id, |
| | | t2.specification_model, |
| | | t2.unit, |
| | | t2.tax_rate, |
| | | t2.tax_inclusive_unit_price, |
| | | t2.tax_inclusive_total_price, |
| | | t2.tax_exclusive_total_price, |
| | | t1.inbound_num, |
| | | t1.create_time, |
| | | t1.create_time as time, |
| | | t1.create_by |
| | | from procurement_record_out t1 |
| | | left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id |
| | | left join sales_ledger t3 on t3.id = t2.sales_ledger_id |
| | | select t3.customer_contract_no, |
| | | t3.sales_contract_no, |
| | | t3.customer_name, |
| | | t2.product_category, |
| | | t1.id, |
| | | t2.specification_model, |
| | | t2.unit, |
| | | t2.tax_rate, |
| | | t2.tax_inclusive_unit_price, |
| | | t2.tax_inclusive_total_price, |
| | | t2.tax_exclusive_total_price, |
| | | t1.inbound_num, |
| | | t1.create_time, |
| | | t1.create_time as time, |
| | | t1.create_by |
| | | from procurement_record_out t1 |
| | | left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id |
| | | left join sales_ledger t3 on t3.id = t2.sales_ledger_id |
| | | where t1.type = 2 |
| | | </select> |
| | | |
| | | <select id="listTwo" resultType="com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto"> |
| | | select |
| | | t1.supplier_name, |
| | | t1.product_category, |
| | | t1.id, |
| | | t1.specification_model, |
| | | t1.unit, |
| | | t1.tax_rate, |
| | | t1.tax_inclusive_unit_price, |
| | | t1.tax_inclusive_total_price, |
| | | t1.tax_exclusive_total_price, |
| | | t1.inbound_num, |
| | | t1.create_time, |
| | | t1.create_time as time, |
| | | t1.create_by |
| | | from procurement_record_out t1 |
| | | select t1.supplier_name, |
| | | t1.product_category, |
| | | t1.id, |
| | | t1.specification_model, |
| | | t1.unit, |
| | | t1.tax_rate, |
| | | t1.tax_inclusive_unit_price, |
| | | t1.tax_inclusive_total_price, |
| | | t1.tax_exclusive_total_price, |
| | | t1.inbound_num, |
| | | t1.create_time, |
| | | t1.create_time as time, |
| | | t1.create_by |
| | | from procurement_record_out t1 |
| | | where t1.type = 3 |
| | | </select> |
| | | <select id="listPageByProduct" resultType="com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto"> |
| | |
| | | t1.create_time, |
| | | t1.create_by, |
| | | t4.unit_price, |
| | | t4.unit_price * t1.inbound_num as totalPrice |
| | | from procurement_record_out t1 |
| | | t4.unit_price * t1.inbound_num as totalPrice |
| | | from procurement_record_out t1 |
| | | 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 |
| | | left join procurement_record_storage t4 on t4.id = t1.procurement_record_storage_id |
| | | <where> |
| | | and t1.type = 2 |
| | | <if test="req.customerName != null and req.customerName != ''"> |
| | | and t3.customer_name like concat('%',#{req.customerName},'%') |
| | | and t3.customer_name like concat('%',#{req.customerName},'%') |
| | | </if> |
| | | <if test="req.productCategory != null and req.productCategory != ''"> |
| | | and t2.product_category like concat('%',#{req.productCategory},'%') |
| | | and t2.product_category like concat('%',#{req.productCategory},'%') |
| | | </if> |
| | | <if test="req.timeStr != null and req.timeStr != ''"> |
| | | and t1.create_time like concat('%',#{req.timeStr},'%') |
| | | and t1.create_time like concat('%',#{req.timeStr},'%') |
| | | </if> |
| | | </where> |
| | | order by t1.create_time desc |
| | |
| | | t1.create_by, |
| | | t2.item_type, |
| | | t2.code |
| | | from procurement_record_out t1 |
| | | from procurement_record_out t1 |
| | | left join custom_storage t2 on t2.id = t1.procurement_record_storage_id |
| | | <where> |
| | | t1.type = 3 |
| | | <if test="req.supplierName != null and req.supplierName != ''"> |
| | | and t2.supplier_name like concat('%',#{req.supplierName},'%') |
| | | and t2.supplier_name like concat('%',#{req.supplierName},'%') |
| | | </if> |
| | | <if test="req.productCategory != null and req.productCategory != ''"> |
| | | and t2.product_category like concat('%',#{req.productCategory},'%') |
| | | and t2.product_category like concat('%',#{req.productCategory},'%') |
| | | </if> |
| | | <if test="req.timeStr != null and req.timeStr != ''"> |
| | | and t1.create_time like concat('%',#{req.timeStr},'%') |
| | | and t1.create_time like concat('%',#{req.timeStr},'%') |
| | | </if> |
| | | </where> |
| | | order by t1.create_time desc |
| | |
| | | <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> |
| | |
| | | </resultMap> |
| | | |
| | | <select id="pageProcessRouteDto" resultType="com.ruoyi.production.dto.ProcessRouteDto"> |
| | | select ps.*, p.product_name,pm.product_id,pm.model |
| | | select ps.*, p.product_name,pm.product_id,pm.model,pb.bom_no |
| | | from process_route ps |
| | | left join product_bom pb on ps.bom_id = pb.id |
| | | left join product_model pm on ps.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | <where> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.ProductBomMapper"> |
| | | |
| | | <!-- éç¨æ¥è¯¢æ å°ç»æ --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.production.pojo.ProductBom"> |
| | | <id column="id" property="id"/> |
| | | <result column="product_model_id" property="productModelId"/> |
| | | <result column="bom_no" property="bomNo"/> |
| | | <result column="remark" property="remark"/> |
| | | <result column="version" property="version"/> |
| | | <result column="create_time" property="createTime"/> |
| | | <result column="update_time" property="updateTime"/> |
| | | <result column="create_user" property="createUser"/> |
| | | <result column="update_user" property="updateUser"/> |
| | | <result column="tenant_id" property="tenantId"/> |
| | | </resultMap> |
| | | <select id="listPage" resultType="com.ruoyi.production.dto.ProductBomDto"> |
| | | select * from (select pb.*, |
| | | pm.model productModelName, |
| | | p.product_name productName |
| | | from product_bom pb |
| | | left join product_model pm on pb.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id)A |
| | | where 1=1 |
| | | <if test="c.productModelName != null"> |
| | | and productModelName = #{c.productModelName} |
| | | </if> |
| | | <if test="c.productName != null"> |
| | | and productName = #{c.productName} |
| | | </if> |
| | | <if test="c.bomNo != null"> |
| | | and bom_no = #{c.bomNo} |
| | | </if> |
| | | <if test="c.version != null"> |
| | | and version = #{c.version} |
| | | </if> |
| | | </select> |
| | | <select id="getById" resultType="com.ruoyi.production.dto.ProductBomDto"> |
| | | select pb.*, |
| | | pm.model productModelName, |
| | | p.product_name productName |
| | | from product_bom pb |
| | | left join product_model pm on pb.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | </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, |
| | | pb.bom_no, |
| | | 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 |
| | | left join product_bom pb on pb.id = ppr.bom_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.*, |
| | | pwo.work_order_no, |
| | | pwo.report_work, |
| | | pwo.status, |
| | | pwo.quantity, |
| | | pwo.plan_quantity |
| | | select po.*, |
| | | pwo.work_order_no, |
| | | pwo.report_work, |
| | | pwo.status, |
| | | pwo.quantity, |
| | | pwo.plan_quantity |
| | | from product_order po |
| | | left join product_work_order pwo on po.id = pwo.product_order_id |
| | | 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> |
| | | <select id="listProcessBom" resultType="com.ruoyi.production.dto.ProductStructureDto"> |
| | | select ps.id, |
| | | ps.product_model_id, |
| | | ps.process_id, |
| | | ps.unit_quantity, |
| | | ps.unit_quantity * po.quantity as demandedQuantity, |
| | | ps.unit, |
| | | p.product_name, |
| | | pp.name as process_name, |
| | | pm.product_id, |
| | | pm.model |
| | | from |
| | | product_structure ps |
| | | left join product_model pm on ps.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | left join product_process pp on ps.process_id = pp.id |
| | | left join product_process_route ppr on ps.bom_id = ppr.bom_id |
| | | left join product_order po on po.id = ppr.product_order_id |
| | | where ppr.product_order_id = #{orderId} |
| | | order by ps.id |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | |
| | | <select id="listPage" resultType="com.ruoyi.production.dto.ProductProcessDto"> |
| | | SELECT |
| | | p.id, |
| | | p.name, |
| | | p.no, |
| | | p.remark, |
| | | p.salary_quota |
| | | * |
| | | FROM |
| | | product_process p |
| | | <where> |
| | |
| | | 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> |
| | |
| | | <result property="unitQuantity" column="unit_quantity"/> |
| | | <result property="demandedQuantity" column="demanded_quantity"/> |
| | | <result property="unit" column="unit"/> |
| | | <result property="diskQuantity" column="disk_quantity"/> |
| | | <result property="tenantId" column="tenant_id"/> |
| | | </resultMap> |
| | | |
| | | <select id="listByproductModelId" resultType="com.ruoyi.production.dto.ProductStructureDto"> |
| | | <select id="listBybomId" resultType="com.ruoyi.production.dto.ProductStructureDto"> |
| | | select ps.*, |
| | | p.product_name, |
| | | pp.name as process_name, |
| | |
| | | left join product_model pm on ps.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | left join product_process pp on ps.process_id = pp.id |
| | | where ps.parent_id = #{productModelId} |
| | | where ps.bom_id = #{bomId} |
| | | order by ps.id |
| | | </select> |
| | | <select id="listBybomAndProcess" resultType="com.ruoyi.production.dto.ProductStructureDto"> |
| | | select ps.*, |
| | | p.product_name, |
| | | pp.name as process_name, |
| | | pm.product_id, |
| | | pm.model |
| | | from |
| | | product_structure ps |
| | | left join product_model pm on ps.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | left join product_process pp on ps.process_id = pp.id |
| | | where ps.bom_id = #{bomId} |
| | | and ps.process_id=#{processId} |
| | | order by ps.id |
| | | </select> |
| | | </mapper> |
| | |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name AS productName, |
| | | po.nps_no AS productOrderNpsNo |
| | | po.nps_no AS productOrderNpsNo, |
| | | ROUND(pwo.complete_quantity / pwo.plan_quantity * 100, 2) AS completionStatus |
| | | FROM |
| | | `product_work_order` pwo |
| | | product_work_order pwo |
| | | LEFT JOIN product_process_route_item ppri ON ppri.id = pwo.product_process_route_item_id |
| | | LEFT JOIN product_order po ON po.id = pwo.product_order_id |
| | | LEFT JOIN product_process pp ON pp.id = ppri.process_id |
| | |
| | | from product_work_order pwo |
| | | left join product_order po on po.id = pwo.product_order_id |
| | | </select> |
| | | |
| | | <update id="updatePlanQuantity" parameterType="java.util.Map"> |
| | | UPDATE product_work_order |
| | | SET |
| | | report_work = #{reportWork}, |
| | | quantity = #{quantity}, |
| | | plan_quantity = plan_quantity - #{deductQuantity}, |
| | | product_main_id = #{productMainId} |
| | | WHERE id = #{workOrderId} |
| | | </update> |
| | | |
| | | <update id="rollbackPlanQuantity" parameterType="java.lang.Long"> |
| | | UPDATE product_work_order pwo |
| | | INNER JOIN production_product_main ppm |
| | | ON pwo.id = ppm.work_order_id |
| | | AND ppm.id = #{productMainId} |
| | | INNER JOIN production_product_output ppo |
| | | ON ppo.product_main_id = ppm.id |
| | | SET |
| | | pwo.plan_quantity = pwo.plan_quantity + ppo.quantity, |
| | | pwo.report_work = 0, |
| | | pwo.quantity = 0 |
| | | WHERE pwo.id = ppm.work_order_id |
| | | </update> |
| | | </mapper> |
| | |
| | | <select id="listPageProductionProductInputDto" resultType="com.ruoyi.production.dto.ProductionProductInputDto"> |
| | | select ppi.*, |
| | | pm.model as model, |
| | | ppm.product_no as productNo |
| | | ppm.product_no as productNo, |
| | | p.product_name, |
| | | pm.unit |
| | | from |
| | | production_product_input ppi |
| | | left join production_product_main ppm on ppm.id = ppi.product_main_id |
| | | left join product_model pm on pm.id = ppi.product_model_id |
| | | left join product p on p.id = pm.product_id |
| | | <where> |
| | | <if test="c.productMainId != null and c.productMainId > 0"> |
| | | and ppm.id = #{c.productMainId} |
| | |
| | | select ppm.*, |
| | | pwo.work_order_no as workOrderNo, |
| | | pwo.status as workOrderStatus, |
| | | u.nick_name as nickName |
| | | u.nick_name as nickName, |
| | | p.product_name as productName, |
| | | pm.model as productModelName, |
| | | ppo.quantity, |
| | | pm.unit, |
| | | sl.sales_contract_no salesContractNo |
| | | from |
| | | production_product_main ppm |
| | | left join product_work_order pwo on pwo.id = ppm.work_order_id |
| | | left join product_order po on po.id = pwo.product_order_id |
| | | left join production_product_output ppo on ppm.id = ppo.product_main_id |
| | | left join product_model pm on pm.id = ppo.product_model_id |
| | | left join product p on p.id = pm.product_id |
| | | left join sales_ledger sl on sl.id = po.sales_ledger_id |
| | | left join sys_user u on u.user_id = ppm.user_id |
| | | <where> |
| | | <if test="c.nickName != null and c.nickName != ''"> |
| | |
| | | </if> |
| | | </where> |
| | | order by ppm.id |
| | | |
| | | </select> |
| | | |
| | | <delete id="deleteByWorkOrderIds" parameterType="java.util.List"> |
| | |
| | | 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') |