yys
1.需要加上库位,库位暂时分为外购、自制、委外三种类型
2.生产订单加上库存数量,方便实时查看
3.发货订单增加撤销功能
| | |
| | | |
| | | |
| | | /** |
| | | * 产品类型(1-物料,2-产品) |
| | | * 产品类型(1=自制,2=外购,3=委外) |
| | | */ |
| | | @ApiModelProperty(value = "1=自制,2=外购,3=委外") |
| | | private Integer productType; |
| | |
| | | @ApiModelProperty("结算人") |
| | | private String settler; |
| | | |
| | | @ApiModelProperty("状态") |
| | | @ApiModelProperty("状态 0-待处理 1-已处理 2-已撤销") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("创建时间") |
| | |
| | | @ApiModelProperty("退货产品金额") |
| | | private BigDecimal amount; |
| | | |
| | | @ApiModelProperty("退货状态 0 未退回 1已退货") |
| | | @ApiModelProperty("退货状态 0 未退回 1已退货 2-已撤销") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("备注") |
| | |
| | | import com.ruoyi.procurementrecord.pojo.ReturnManagement; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/9/17 10:33 |
| | |
| | | package com.ruoyi.procurementrecord.service.impl; |
| | | |
| | | 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | import com.ruoyi.procurementrecord.service.ReturnSaleProductService; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | | import com.ruoyi.sales.dto.SalesLedgerProductDto; |
| | | import com.ruoyi.sales.mapper.SalesLedgerMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedger; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import com.ruoyi.sales.pojo.ShippingInfoDetail; |
| | | import com.ruoyi.sales.service.ShippingInfoDetailService; |
| | | import com.ruoyi.sales.service.ShippingInfoService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | |
| | | @Autowired |
| | | private ReturnSaleProductService returnSaleProductService; |
| | | @Autowired |
| | | private ShippingInfoDetailService shippingInfoDetailService; |
| | | @Autowired |
| | | private ShippingInfoService shippingInfoService; |
| | | @Autowired |
| | |
| | | |
| | | @Override |
| | | public SalesLedgerDto getReturnManagementDtoByShippingIdId(Long shippingId) { |
| | | ShippingInfo byId = shippingInfoService.getById(shippingId); |
| | | ShippingInfoDetail byId = shippingInfoDetailService.getById(shippingId); |
| | | SalesLedger salesLedger = salesLedgerMapper.selectById(byId.getSalesLedgerId()); |
| | | SalesLedgerDto salesLedgerDto = new SalesLedgerDto(); |
| | | BeanUtils.copyProperties(salesLedger, salesLedgerDto); |
| | | |
| | | // List<SalesLedgerProductDto> salesLedgerProductDtos = shippingInfoService.getReturnManagementDtoById(byId.getId()); |
| | | // salesLedgerDto.setProductDtoData(salesLedgerProductDtos); |
| | | List<SalesLedgerProductDto> salesLedgerProductDtos = shippingInfoService.getReturnManagementDtoById(byId.getId()); |
| | | salesLedgerDto.setProductDtoData(salesLedgerProductDtos); |
| | | return salesLedgerDto; |
| | | } |
| | | |
| | |
| | | // 无质量问题,入合格库 |
| | | stockUtils.addStock(returnSaleProduct.getProductModelId(),returnSaleProduct.getNum(), StockInQualifiedRecordTypeEnum.RETURN_HE_IN.getCode(),returnSaleProduct.getId()); |
| | | } |
| | | returnSaleProduct.setStatus(1); |
| | | returnSaleProductService.updateById(returnSaleProduct); |
| | | } |
| | | // salesRefundAmountOrder.setRefundAmount(bigDecimal); |
| | | // salesRefundAmountOrder.setNotRefundedAmount(salesRefundAmountOrder.getRefundedAmount()); |
| | |
| | | return returnManagementDtoById; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @RequestMapping("productOrder") |
| | | @RequestMapping("/productOrder") |
| | | @RestController |
| | | @Api(tags = "生产订单") |
| | | public class ProductOrderController { |
| | |
| | | |
| | | |
| | | @ApiOperation("新增生产订单") |
| | | @PostMapping("addProductOrder") |
| | | @PostMapping("/addProductOrder") |
| | | public R addProductOrder(@RequestBody ProductOrder productOrder) { |
| | | return R.ok(productOrderService.addProductOrder(productOrder)); |
| | | } |
| | |
| | | |
| | | //是否发货(台账页面颜色控制) |
| | | private Boolean isFh; |
| | | |
| | | @ApiModelProperty(value = "库存数量") |
| | | @Excel(name = "库存数量") |
| | | private BigDecimal inventoryQuantity; |
| | | } |
| | |
| | | import com.ruoyi.production.service.ProductOrderService; |
| | | import com.ruoyi.quality.mapper.QualityInspectMapper; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.stock.dto.StockInventoryDto; |
| | | import com.ruoyi.stock.service.impl.StockInventoryServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | @Autowired |
| | | private StockUtils stockUtils; |
| | | |
| | | @Autowired |
| | | private StockInventoryServiceImpl stockInventoryService; |
| | | |
| | | @Override |
| | | public IPage<ProductOrderDto> pageProductOrder(Page page, ProductOrderDto productOrder) { |
| | | return productOrderMapper.pageProductOrder(page, productOrder); |
| | | IPage<ProductOrderDto> productOrderDtoIPage = productOrderMapper.pageProductOrder(page, productOrder); |
| | | productOrderDtoIPage.getRecords().forEach(productOrderDto -> { |
| | | // 获取产品合格库存 |
| | | StockInventoryDto stockInventoryDto = new StockInventoryDto(); |
| | | stockInventoryDto.setProductModelId(productOrderDto.getProductModelId()); |
| | | Page page1 = new Page<>(1,1); |
| | | IPage<StockInventoryDto> stockInventoryDtoIPage = stockInventoryService.pagestockInventory(page1,stockInventoryDto); |
| | | if(stockInventoryDtoIPage.getTotal() > 0){ |
| | | productOrderDto.setInventoryQuantity(stockInventoryDtoIPage.getRecords().get(0).getQualitity()); |
| | | } |
| | | }); |
| | | return productOrderDtoIPage; |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | 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.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.procurementrecord.dto.ProcurementPageDto; |
| | | import com.ruoyi.procurementrecord.dto.ProcurementPageDtoCopy; |
| | | import com.ruoyi.procurementrecord.mapper.ReturnManagementMapper; |
| | | import com.ruoyi.procurementrecord.mapper.ReturnSaleProductMapper; |
| | | import com.ruoyi.procurementrecord.service.ProcurementRecordService; |
| | | import com.ruoyi.procurementrecord.service.ReturnManagementService; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.sales.dto.SalesLedgerProductDto; |
| | | import com.ruoyi.sales.mapper.ShippingInfoDetailMapper; |
| | | import com.ruoyi.sales.mapper.ShippingInfoMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.pojo.ShippingInfoDetail; |
| | | import com.ruoyi.sales.service.ISalesLedgerProductService; |
| | | import com.ruoyi.sales.service.ShippingInfoService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 产品信息Controller |
| | |
| | | private ProcurementRecordService procurementRecordService; |
| | | @Autowired |
| | | private StockUtils stockUtils; |
| | | |
| | | @Autowired |
| | | private ShippingInfoService shippingInfoService; |
| | | |
| | | @Autowired |
| | | private ReturnManagementService returnManagementService; |
| | | |
| | | |
| | | /** |
| | |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | @ApiOperation("发货退货撤销") |
| | | @PostMapping("/cancelDelivery") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult cancelDelivery(@RequestBody SalesLedgerProduct salesLedgerProduct) { |
| | | return AjaxResult.success(salesLedgerProductService.cancelDelivery(salesLedgerProduct)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询产品信息列表 |
| | |
| | | { |
| | | List<SalesLedgerProduct> list = salesLedgerProductService.selectSalesLedgerProductList(salesLedgerProduct); |
| | | list.forEach(item -> { |
| | | if (item.getFutureTickets().compareTo(BigDecimal.ZERO) == 0) { |
| | | item.setFutureTickets(item.getQuantity()); |
| | | } |
| | | // 获取发货数量,退货数量 |
| | | Map<String, BigDecimal> map = shippingInfoService.getNumberOfSalesLedgerProduct(item.getId()); |
| | | item.setShippingNum(map.get("shippingNum")); |
| | | item.setReturnNum(map.get("returnNum")); |
| | | 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"); |
| | | |
| | | // ProcurementPageDtoCopy procurementDtoCopy = result.getRecords().get(0); |
| | | if (item.getApproveStatus() != 2) { |
| | | if (item.getHasSufficientStock() == 0) { |
| | | item.setApproveStatus(0); |
| | | }else { |
| | | item.setApproveStatus(1); |
| | | } |
| | | if (item.getApproveStatus() != 2) { |
| | | if (item.getHasSufficientStock() == 0) { |
| | | item.setApproveStatus(0); |
| | | }else { |
| | | item.setApproveStatus(1); |
| | | } |
| | | } |
| | | }); |
| | | return AjaxResult.success(list); |
| | | } |
| | |
| | | @Autowired |
| | | private StockUtils stockUtils; |
| | | |
| | | @GetMapping("/getByCustomerName") |
| | | @ApiOperation("通过客户名称查询") |
| | | public AjaxResult getByCustomerName(String customerName) { |
| | | return AjaxResult.success(shippingInfoService.getShippingInfoByCustomerName(customerName)); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/listPage") |
| | | @ApiOperation("发货信息列表") |
| | |
| | | |
| | | private Boolean hasChildren = false; |
| | | private List<SalesLedgerProduct> productData; |
| | | private List<SalesLedgerProductDto> productDtoData; |
| | | private List<String> tempFileIds; |
| | | private List<CommonFile> SalesLedgerFiles; |
| | | |
| | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | |
| | |
| | | |
| | | @Data |
| | | public class SalesLedgerProductDto extends SalesLedgerProduct { |
| | | |
| | | /** |
| | | * 业务员 |
| | | */ |
| | | private String salesman; |
| | | /** |
| | | * 发货数量 |
| | | */ |
| | | private BigDecimal shippingNum; |
| | | |
| | | /** |
| | | * 采购合同号 |
| | |
| | | |
| | | private Integer approvalStatus; |
| | | |
| | | @ApiModelProperty(value = "未退货数") |
| | | private BigDecimal unQuantity; |
| | | |
| | | @ApiModelProperty(value = "退货总数") |
| | | private BigDecimal totalReturnNum; |
| | | |
| | | } |
| | |
| | | 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.sales.dto.SalesLedgerProductDto; |
| | | import com.ruoyi.sales.dto.ShippingInfoDto; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | IPage<ShippingInfoDto> listPage(Page page, @Param("req") ShippingInfo req); |
| | | |
| | | List<ShippingInfo> listAll(); |
| | | |
| | | List<ShippingInfo> getShippingInfoByCustomerName(String customerName); |
| | | |
| | | List<SalesLedgerProductDto> getReturnManagementDtoById(@Param("shippingId")Long shippingId); |
| | | } |
| | |
| | | |
| | | @TableField(exist = false) |
| | | private Integer hasSufficientStock; |
| | | |
| | | @ApiModelProperty(value = "发货数量") |
| | | @TableField(exist = false) |
| | | private BigDecimal shippingNum; |
| | | |
| | | @ApiModelProperty(value = "退货数量") |
| | | @TableField(exist = false) |
| | | private BigDecimal returnNum; |
| | | } |
| | |
| | | @ApiModelProperty(value = "销售报价产品表id") |
| | | private Long salesLedgerProductId; |
| | | |
| | | @ApiModelProperty(value = "状态 待审核 审核中 ,审核拒绝 审核通过 已发货") |
| | | @ApiModelProperty(value = "状态 待审核 审核中 ,审核拒绝 审核通过 发货中 已发货 已撤销") |
| | | @Excel(name = "状态") |
| | | private String status; |
| | | |
| | |
| | | |
| | | R judgmentInventory(SalesLedgerProduct salesLedgerProduct); |
| | | |
| | | String cancelDelivery(SalesLedgerProduct salesLedgerProduct); |
| | | } |
| | |
| | | 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.sales.dto.SalesLedgerProductDto; |
| | | import com.ruoyi.sales.dto.ShippingInfoDto; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author :yys |
| | |
| | | boolean deductStock(ShippingInfoDto req) throws IOException; |
| | | |
| | | boolean delete(List<Long> ids); |
| | | |
| | | List<ShippingInfo> getShippingInfoByCustomerName(String customerName); |
| | | |
| | | List<SalesLedgerProductDto> getReturnManagementDtoById(Long id); |
| | | |
| | | Map<String ,BigDecimal> getNumberOfSalesLedgerProduct(Long id); |
| | | } |
| | |
| | | import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockInUnQualifiedRecordTypeEnum; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.procurementrecord.mapper.ReturnManagementMapper; |
| | | import com.ruoyi.procurementrecord.mapper.ReturnSaleProductMapper; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnManagement; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.production.dto.ProductStructureDto; |
| | | import com.ruoyi.production.mapper.*; |
| | |
| | | private QualityInspectMapper qualityInspectMapper; |
| | | private ShippingInfoMapper shippingInfoMapper; |
| | | private ShippingInfoServiceImpl shippingInfoService; |
| | | private ReturnSaleProductMapper returnSaleProductMapper; |
| | | private ReturnManagementMapper returnManagementMapper; |
| | | |
| | | |
| | | private StockUtils stockUtils; |
| | | |
| | |
| | | |
| | | @Override |
| | | public List<SalesLedgerProduct> selectSalesLedgerProductList(SalesLedgerProduct salesLedgerProduct) { |
| | | // LambdaQueryWrapper<SalesLedgerProduct> queryWrapper = new LambdaQueryWrapper<>(); |
| | | // queryWrapper.eq(SalesLedgerProduct::getSalesLedgerId, salesLedgerProduct.getSalesLedgerId()) |
| | | // .eq(SalesLedgerProduct::getType, salesLedgerProduct.getType()); |
| | | List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectSalesLedgerProductList(salesLedgerProduct); |
| | | if(!CollectionUtils.isEmpty(salesLedgerProducts)){ |
| | | salesLedgerProducts.forEach(item -> { |
| | |
| | | return R.ok(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String cancelDelivery(SalesLedgerProduct salesLedgerProduct) { |
| | | List<ShippingInfo> shippingInfos = shippingInfoMapper.selectList(new QueryWrapper<ShippingInfo>() |
| | | .lambda() |
| | | .eq(ShippingInfo::getSalesLedgerProductId, salesLedgerProduct.getId()) |
| | | .in(ShippingInfo::getStatus, "已发货", "发货中")); |
| | | if(CollectionUtils.isEmpty(shippingInfos)){ |
| | | throw new RuntimeException("没有可取消的发货信息"); |
| | | } |
| | | shippingInfos.forEach(item -> { |
| | | item.setStatus("已撤销"); |
| | | shippingInfoMapper.updateById(item); |
| | | }); |
| | | List<ReturnSaleProduct> returnSaleProducts = returnSaleProductMapper.selectList(new LambdaQueryWrapper<ReturnSaleProduct>() |
| | | .eq(ReturnSaleProduct::getReturnSaleLedgerProductId, salesLedgerProduct.getId()) |
| | | .eq(ReturnSaleProduct::getStatus, 1)); |
| | | if(CollectionUtils.isEmpty(returnSaleProducts)){ |
| | | throw new RuntimeException("没有可取消的退货信息"); |
| | | } |
| | | returnSaleProducts.forEach(item -> { |
| | | item.setStatus(2); |
| | | returnSaleProductMapper.updateById(item); |
| | | }); |
| | | List<ReturnManagement> returnManagements = returnManagementMapper.selectList(new QueryWrapper<ReturnManagement>() |
| | | .lambda() |
| | | .in(ReturnManagement::getId, returnSaleProducts.stream().map(ReturnSaleProduct::getReturnManagementId).collect(Collectors.toSet()))); |
| | | if(CollectionUtils.isEmpty(returnManagements)){ |
| | | throw new RuntimeException("没有可取消的退货信息"); |
| | | } |
| | | returnManagements.forEach(item -> { |
| | | item.setStatus(2); |
| | | returnManagementMapper.updateById(item); |
| | | }); |
| | | return "撤销成功"; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; |
| | | import com.ruoyi.other.service.impl.TempFileServiceImpl; |
| | | import com.ruoyi.procurementrecord.mapper.ReturnManagementMapper; |
| | | import com.ruoyi.procurementrecord.mapper.ReturnSaleProductMapper; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnManagement; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.sales.dto.SalesLedgerProductDto; |
| | | import com.ruoyi.sales.dto.ShippingInfoDto; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.sales.mapper.ShippingInfoDetailMapper; |
| | |
| | | |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private ShippingInfoDetailService shippingInfoDetailService; |
| | | |
| | | @Autowired |
| | | private ReturnManagementMapper returnManagementMapper; |
| | | |
| | | @Autowired |
| | | private ReturnSaleProductMapper returnSaleProductMapper; |
| | | |
| | | @Override |
| | | public List<SalesLedgerProductDto> getReturnManagementDtoById(Long shippingId) { |
| | | return shippingInfoMapper.getReturnManagementDtoById(shippingId ); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 获取销售产品单的已发货数量 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Map<String, BigDecimal> getNumberOfSalesLedgerProduct(Long salesLedgerProductId) { |
| | | Map<String, BigDecimal> map = new HashMap<>(); |
| | | map.put("shippingNum",BigDecimal.ZERO); // 发货数量 |
| | | map.put("returnNum",BigDecimal.ZERO); // 退货数量 |
| | | List<ShippingInfo> shippingInfos = shippingInfoMapper.selectList(new LambdaQueryWrapper<ShippingInfo>() |
| | | .eq(ShippingInfo::getSalesLedgerProductId, salesLedgerProductId) |
| | | // 只筛选“发货中”和“已发货”两种状态 |
| | | .in(ShippingInfo::getStatus, "发货中", "已发货")); |
| | | if(CollectionUtils.isEmpty(shippingInfos)){ |
| | | return map; |
| | | } |
| | | List<ShippingInfoDetail> shippingInfoDetails = shippingInfoDetailMapper.selectList(new LambdaQueryWrapper<ShippingInfoDetail>() |
| | | .in(ShippingInfoDetail::getShippingInfoId, shippingInfos.stream().map(ShippingInfo::getId).collect(Collectors.toList()))); |
| | | if(CollectionUtils.isEmpty(shippingInfoDetails)){ |
| | | return map; |
| | | } |
| | | // 获取发货数量 |
| | | map.put("shippingNum",shippingInfoDetails.stream().map(ShippingInfoDetail::getShippingNum).reduce(BigDecimal.ZERO, BigDecimal::add)); |
| | | // 获取退货数量 |
| | | List<ReturnSaleProduct> returnSaleProducts = returnSaleProductMapper.selectList(new LambdaQueryWrapper<ReturnSaleProduct>() |
| | | .eq(ReturnSaleProduct::getReturnSaleLedgerProductId, salesLedgerProductId) |
| | | .eq(ReturnSaleProduct::getStatus,1)); |
| | | if(CollectionUtils.isEmpty(returnSaleProducts)){ |
| | | return map; |
| | | } |
| | | map.put("returnNum",returnSaleProducts.stream().map(ReturnSaleProduct::getNum).reduce(BigDecimal.ZERO, BigDecimal::add)); |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public List<ShippingInfo> getShippingInfoByCustomerName(String customerName) { |
| | | return shippingInfoMapper.getShippingInfoByCustomerName(customerName); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<ShippingInfoDto> listPage(Page page, ShippingInfo req) { |
| | | IPage<ShippingInfoDto> listPage = shippingInfoMapper.listPage(page, req); |
| | |
| | | @Data |
| | | public class StockInRecordDto extends StockInRecord { |
| | | /** |
| | | * 产品属性 1=自制,2=外购,3=委外 |
| | | */ |
| | | private Integer productType; |
| | | |
| | | /** |
| | | * 产品名称 |
| | | */ |
| | | private String productName; |
| | |
| | | @Data |
| | | public class StockInventoryDto extends StockInventory { |
| | | |
| | | /** |
| | | * 产品属性 1=自制,2=外购,3=委外 |
| | | */ |
| | | private Integer productType; |
| | | |
| | | private String productName; |
| | | private String model; |
| | | private String unit; |
| | |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class StockOutRecordDto extends StockOutRecord { |
| | | |
| | | /** |
| | | * 产品属性 1=自制,2=外购,3=委外 |
| | | */ |
| | | private Integer productType; |
| | | |
| | | /** |
| | | * 产品名称 |
| | | */ |
| | |
| | | |
| | | @Data |
| | | public class StockUninventoryDto extends StockUninventory { |
| | | /** |
| | | * 产品属性 1=自制,2=外购,3=委外 |
| | | */ |
| | | private Integer productType; |
| | | private String productName; |
| | | private String model; |
| | | private String unit; |
| | |
| | | druid: |
| | | # 主库数据源 |
| | | master: |
| | | url: jdbc:mysql://localhost:3306/product-inventory-management-new?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | url: jdbc:mysql://localhost:3306/product-inventory-management-jtwy?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | username: root |
| | | password: 123456 |
| | | # 从库数据源 |
| | |
| | | sl.sales_contract_no, |
| | | sl.salesman |
| | | from return_management rm |
| | | left join shipping_info si on rm.shipping_id = si.id |
| | | left join shipping_info_detail sii on rm.shipping_id = sii.id |
| | | left join shipping_info si on sii.shipping_info_id = si.id |
| | | left join customer c on rm.customer_id = c.id |
| | | left join sales_ledger sl on si.sales_ledger_id = sl.id |
| | | <where> |
| | |
| | | sl.sales_contract_no, |
| | | sl.salesman |
| | | from return_management rm |
| | | left join shipping_info si on rm.shipping_id = si.id |
| | | left join shipping_info_detail sii on rm.shipping_id = sii.id |
| | | left join shipping_info si on sii.shipping_info_id = si.id |
| | | left join customer c on rm.customer_id = c.id |
| | | left join sales_ledger sl on si.sales_ledger_id = sl.id |
| | | where rm.id = #{id} |
| | |
| | | s.tenant_id, |
| | | sl.sales_contract_no, |
| | | sl.customer_name, |
| | | s.shipping_total AS shipping_total |
| | | s.shipping_total AS shipping_total, |
| | | slp.id as salesLedgerProductId |
| | | FROM shipping_info s |
| | | LEFT JOIN sales_ledger sl ON s.sales_ledger_id = sl.id |
| | | LEFT JOIN sales_ledger_product slp ON s.sales_ledger_product_id = slp.id and slp.type = 1 |
| | | WHERE 1=1 |
| | | <if test="req.salesContractNo != null and req.salesContractNo != ''"> |
| | | AND sl.sales_contract_no LIKE CONCAT('%',#{req.salesContractNo},'%') |
| | |
| | | FROM shipping_info s |
| | | LEFT JOIN sales_ledger sl ON s.sales_ledger_id = sl.id |
| | | </select> |
| | | <select id="getShippingInfoByCustomerName" resultType="com.ruoyi.sales.pojo.ShippingInfo"> |
| | | select *,sid.id as id from shipping_info_detail sid |
| | | left join shipping_info si on si.id = sid.shipping_info_id |
| | | left join sales_ledger sl on si.sales_ledger_id = sl.id |
| | | where (si.status = '已发货' or si.status = '发货中') and sl.customer_name = #{customerName} |
| | | </select> |
| | | <select id="getReturnManagementDtoById" resultType="com.ruoyi.sales.dto.SalesLedgerProductDto"> |
| | | SELECT |
| | | slp.*, |
| | | si.shipping_num, |
| | | GREATEST(si.shipping_num - COALESCE(rs.total_return_num, 0), 0) AS un_quantity, |
| | | COALESCE(rs.total_return_num, 0) AS total_return_num |
| | | FROM shipping_info_detail si |
| | | LEFT JOIN sales_ledger_product slp ON si.sales_ledger_product_id = slp.id and slp.type = 1 |
| | | LEFT JOIN ( |
| | | SELECT |
| | | return_sale_ledger_product_id, |
| | | SUM(num) AS total_return_num |
| | | FROM return_sale_product rsp |
| | | left join return_management rm on rm.id = rsp.return_management_id |
| | | left join shipping_info_detail si on si.id = rm.shipping_id |
| | | WHERE 1=1 |
| | | GROUP BY return_sale_ledger_product_id |
| | | ) rs ON rs.return_sale_ledger_product_id = slp.id |
| | | <where> |
| | | <if test="shippingId != null"> |
| | | si.id = #{shippingId} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | LEFT JOIN product as p on pm.product_id = p.id |
| | | LEFT JOIN sys_user as u on sir.create_user = u.user_id |
| | | <where> |
| | | pm.product_type = #{params.productType} |
| | | <if test="params.timeStr != null and params.timeStr != ''"> |
| | | and sir.create_time like concat('%',#{params.timeStr},'%') |
| | | </if> |
| | |
| | | from stock_inventory si |
| | | left join product_model pm on si.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | where 1 = 1 |
| | | where pm.product_type = #{ew.productType} |
| | | <if test="ew.productName != null and ew.productName !=''"> |
| | | and p.product_name like concat('%',#{ew.productName},'%') |
| | | </if> |
| | | <if test="ew.productModelId != null and ew.productModelId !=''"> |
| | | and pm.id = #{ew.productModelId} |
| | | </if> |
| | | </select> |
| | | <select id="listStockInventoryExportData" resultType="com.ruoyi.stock.execl.StockInventoryExportData"> |
| | | select si.qualitity, |
| | |
| | | LEFT JOIN product as p on pm.product_id = p.id |
| | | LEFT JOIN sys_user as u on sor.create_user = u.user_id |
| | | <where> |
| | | pm.product_type = #{params.productType} |
| | | <if test="params.timeStr != null and params.timeStr != ''"> |
| | | and sor.create_time like concat('%',#{params.timeStr},'%') |
| | | </if> |
| | |
| | | from stock_uninventory su |
| | | left join product_model pm on su.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | where 1 = 1 |
| | | where pm.product_type = #{ew.productType} |
| | | <if test="ew.productName != null and ew.productName !=''"> |
| | | and p.product_name like concat('%',#{ew.productName},'%') |
| | | </if> |