| | |
| | | |
| | | 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.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.procurementrecord.dto.*; |
| | | import com.ruoyi.procurementrecord.mapper.CustomStorageMapper; |
| | | import com.ruoyi.procurementrecord.pojo.CustomStorage; |
| | | import com.ruoyi.procurementrecord.service.ProcurementRecordService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.ibatis.annotations.Delete; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @Transactional |
| | | public AjaxResult addCustom(@RequestBody List<CustomStorage> customStorage) { |
| | | return procurementRecordService.addCustom(customStorage); |
| | | } |
| | | |
| | | @PostMapping("/updateCustom") |
| | | @Log(title = "自定义入库-入库管理-修改入库", businessType = BusinessType.UPDATE) |
| | | @Transactional |
| | | public AjaxResult updateCustom(@RequestBody CustomStorage customStorage) { |
| | | return procurementRecordService.updateCustom(customStorage); |
| | | } |
| | | |
| | | @Delete("/delteCustom") |
| | | @Log(title = "自定义入库-入库管理-删除入库", businessType = BusinessType.DELETE) |
| | | @Transactional |
| | | public AjaxResult deleteCustom(@RequestBody List<Long> ids) { |
| | | return procurementRecordService.deleteCustom(ids); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | |
| | | } |
| | | |
| | | /** |
| | | * 导出 |
| | | * 库存管理采购导出 |
| | | * @param response |
| | | */ |
| | | @PostMapping("/exportCopy") |
| | | public void exportCopy(HttpServletResponse response) { |
| | | procurementRecordService.exportCopy(response); |
| | | procurementRecordService.exportCopy(response,1); |
| | | } |
| | | |
| | | /** |
| | | * 导出 |
| | | * 库存管理生产导出 |
| | | * @param response |
| | | */ |
| | | @PostMapping("/exportCopyOne") |
| | | public void exportCopyOne(HttpServletResponse response) { |
| | | procurementRecordService.exportCopy(response,2); |
| | | } |
| | | |
| | | /** |
| | | * 库存管理自定义导出 |
| | | * @param response |
| | | */ |
| | | @PostMapping("/exportCopyTwo") |
| | | public void exportCopyTwo(HttpServletResponse response) { |
| | | procurementRecordService.exportCopyTwo(response,3); |
| | | } |
| | | |
| | | /** |
| | | * 入库,出库管理采购导出 |
| | | * @param response |
| | | */ |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response) { |
| | | procurementRecordService.export(response); |
| | | procurementRecordService.export(response,1); |
| | | } |
| | | |
| | | /** |
| | | * 入库,出库管理生产导出 |
| | | * @param response |
| | | */ |
| | | @PostMapping("/exportOne") |
| | | public void exportOne(HttpServletResponse response) { |
| | | procurementRecordService.export(response,2); |
| | | } |
| | | |
| | | @Autowired |
| | | private CustomStorageMapper customStorageMapper; |
| | | |
| | | /** |
| | | * 入库,出库管理自定义导出 |
| | | * @param response |
| | | */ |
| | | @PostMapping("/exportTwo") |
| | | public void exportTwo(HttpServletResponse response) { |
| | | List<CustomStorage> customStorages = customStorageMapper.selectList(null); |
| | | ExcelUtil<CustomStorage> util = new ExcelUtil<CustomStorage>(CustomStorage.class); |
| | | util.exportExcel(response, customStorages, "入库台账"); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | 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.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | |
| | | import com.ruoyi.procurementrecord.dto.ProcurementRecordOutAdd; |
| | | import com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto; |
| | | import com.ruoyi.procurementrecord.dto.ProcurementUpdateDto; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordOutMapper; |
| | | import com.ruoyi.procurementrecord.service.ProcurementRecordOutService; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author :yys |
| | |
| | | private ProcurementRecordOutService procurementRecordOutService; |
| | | |
| | | @PostMapping("/stockout") |
| | | @Log(title = "采购入库-出库管理-出库", businessType = BusinessType.INSERT) |
| | | @Log(title = "采购出库-出库管理-出库", businessType = BusinessType.INSERT) |
| | | public AjaxResult stockout(@RequestBody ProcurementRecordOutAdd procurementRecordOutAdd) { |
| | | return AjaxResult.success(procurementRecordOutService.stockout(procurementRecordOutAdd)); |
| | | } |
| | | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "采购入库-出库管理-出库查询", businessType = BusinessType.OTHER) |
| | | @Log(title = "采购出库-出库台账-出库查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page page, ProcurementRecordOutPageDto procurementDto) { |
| | | IPage<ProcurementRecordOutPageDto> result = procurementRecordOutService.listPage(page, procurementDto); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | @GetMapping("/listPageByProduct") |
| | | @Log(title = "生产出库-出库台账-出库查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPageByProduct(Page page, ProcurementRecordOutPageDto procurementDto) { |
| | | IPage<ProcurementRecordOutPageDto> result = procurementRecordOutService.listPageByProduct(page, procurementDto); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | @GetMapping("/listPageByCustom") |
| | | @Log(title = "自定义出库-出库台账-出库查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPageByCustom(Page page, ProcurementRecordOutPageDto procurementDto) { |
| | | IPage<ProcurementRecordOutPageDto> result = procurementRecordOutService.listPageByCustom(page, procurementDto); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | @PostMapping("/del") |
| | | @Log(title = "采购入库-出库管理-删除出库", businessType = BusinessType.DELETE) |
| | | @Log(title = "采购出库-出库台账-删除出库", businessType = BusinessType.DELETE) |
| | | public AjaxResult deletePro(@RequestBody ProcurementUpdateDto procurementDto) { |
| | | return AjaxResult.success(procurementRecordOutService.deletePro(procurementDto)); |
| | | } |
| | | |
| | | /** |
| | | * 导出 |
| | | * 采购出库导出 |
| | | * @param response |
| | | */ |
| | | @PostMapping("/export") |
| | |
| | | procurementRecordOutService.export(response); |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | public ProcurementRecordOutMapper procurementRecordOutMapper; |
| | | /** |
| | | * 生产出库导出 |
| | | * @param response |
| | | */ |
| | | @PostMapping("/exportOne") |
| | | public void exportOne(HttpServletResponse response) { |
| | | List<ProcurementRecordOutPageDto> list = procurementRecordOutMapper.listOne(); |
| | | ExcelUtil<ProcurementRecordOutPageDto> util = new ExcelUtil<>(ProcurementRecordOutPageDto.class); |
| | | util.exportExcel(response, list, "生产出库台账"); |
| | | } |
| | | |
| | | /** |
| | | * 自定义出库导出 |
| | | * @param response |
| | | */ |
| | | @PostMapping("/exportTwo") |
| | | public void exportTwo(HttpServletResponse response) { |
| | | List<ProcurementRecordOutPageDto> list = procurementRecordOutMapper.listTwo(); |
| | | ExcelUtil<ProcurementRecordOutPageDto> util = new ExcelUtil<>(ProcurementRecordOutPageDto.class); |
| | | util.exportExcel(response, list, "生产出库台账"); |
| | | } |
| | | |
| | | } |
| | |
| | | /** |
| | | * 客户名称 |
| | | */ |
| | | @Excel(name = "客户名称") |
| | | private String customerName; |
| | | |
| | | private String salesLedgerProductId; |
| | |
| | | |
| | | private Integer salesLedgerProductId; |
| | | |
| | | /** |
| | | * 出库类型 1-采购出库 2-销售出库 3-自定义 |
| | | */ |
| | | private Integer type; |
| | | |
| | | } |
| | |
| | | private Integer id; |
| | | |
| | | private BigDecimal warnNum; |
| | | /** |
| | | * 销售合同号 |
| | | */ |
| | | private String salesContractNo; |
| | | |
| | | /** |
| | | * 客户合同号 |
| | | */ |
| | | private String customerContractNo; |
| | | |
| | | /** |
| | | * 客户名称 |
| | | */ |
| | | @Excel(name = "客户名称") |
| | | private String customerName; |
| | | |
| | | |
| | | /** |
| | | * 出入库数量 |
| | |
| | | private String supplierName; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 产品大类 |
| | | */ |
| | |
| | | |
| | | List<ProcurementPageDtoCopy> listCopy(); |
| | | |
| | | List<ProcurementPageDtoCopy> listCopyOne(); |
| | | |
| | | List<ProcurementPageDto> list(); |
| | | |
| | | List<ProcurementPageDto> listOne(); |
| | | |
| | | IPage<ProcurementPageDto> listPageByProduction(Page page, @Param("req") ProcurementPageDto procurementDto); |
| | | |
| | | IPage<ProcurementPageDtoCopy> listPageCopyByProduction(Page page, @Param("req") ProcurementPageDto procurementDto); |
| | |
| | | IPage<ProcurementRecordOutPageDto> listPage(Page page,@Param("req") ProcurementRecordOutPageDto procurementDto); |
| | | |
| | | List<ProcurementRecordOutPageDto> list(); |
| | | |
| | | List<ProcurementRecordOutPageDto> listOne(); |
| | | |
| | | List<ProcurementRecordOutPageDto> listTwo(); |
| | | |
| | | IPage<ProcurementRecordOutPageDto> listPageByProduct(Page page,@Param("req") ProcurementRecordOutPageDto procurementDto); |
| | | |
| | | IPage<ProcurementRecordOutPageDto> listPageByCustom(Page page,@Param("req") ProcurementRecordOutPageDto procurementDto); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | |
| | | // 入库时间 |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "入库时间") |
| | | private Date inboundDate; |
| | | |
| | | /** |
| | | * 待出库数量 |
| | | */ |
| | | @Excel(name = "待出库数量") |
| | | @TableField(exist = false) |
| | | private BigDecimal inboundNum0; |
| | | /** |
| | | * 出库数量 |
| | | */ |
| | | @Excel(name = "出库数量") |
| | | @TableField(exist = false) |
| | | private BigDecimal totalInboundNum; |
| | | // 物品类型 |
| | | @Excel(name = "物品类型") |
| | | private String itemType; |
| | | // 入库批次 |
| | | @Excel(name = "入库批次") |
| | | private String inboundBatches; |
| | | // 入库数量 |
| | | @Excel(name = "入库数量") |
| | | private BigDecimal inboundNum; |
| | | // 供应商名称 |
| | | @Excel(name = "供应商名称") |
| | | private String supplierName; |
| | | // 产品大类 |
| | | @Excel(name = "产品大类") |
| | | private String productCategory; |
| | | // 规格型号 |
| | | @Excel(name = "规格型号") |
| | | private String specificationModel; |
| | | // 单位 |
| | | @Excel(name = "单位") |
| | | private String unit; |
| | | // 含税单价 |
| | | @Excel(name = "含税单价") |
| | | private BigDecimal taxInclusiveUnitPrice; |
| | | // 含税总价 |
| | | @Excel(name = "含税总价") |
| | | private BigDecimal taxInclusiveTotalPrice; |
| | | // 税率(%) |
| | | @Excel(name = "税率(%)") |
| | | private BigDecimal taxRate; |
| | | // 不含税总价 |
| | | @Excel(name = "不含税总价") |
| | | private BigDecimal taxExclusiveTotalPrice; |
| | | /** |
| | | * 出出库用户 |
| | | * 入库用户 |
| | | */ |
| | | @Excel(name = "入库用户") |
| | | private String createBy; |
| | | /** |
| | | * 入库用户id |
| | |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 产品信息表id |
| | | * 产品信息表id(自定义入库时为0) |
| | | */ |
| | | private Integer salesLedgerProductId; |
| | | |
| | |
| | | private String inboundBatches; |
| | | |
| | | /** |
| | | * 出出库数量 |
| | | * 出库数量 |
| | | */ |
| | | private BigDecimal inboundNum; |
| | | |
| | | /** |
| | | * 出出库用户 |
| | | * 出库类型 1-采购 2-销售 3-自定义 |
| | | */ |
| | | private Integer type; |
| | | |
| | | /** |
| | | * 出库用户 |
| | | */ |
| | | private String createBy; |
| | | /** |
| | |
| | | int deletePro(ProcurementUpdateDto procurementDto); |
| | | |
| | | void export(HttpServletResponse response); |
| | | |
| | | IPage<ProcurementRecordOutPageDto> listPageByProduct(Page page, ProcurementRecordOutPageDto procurementDto); |
| | | |
| | | IPage<ProcurementRecordOutPageDto> listPageByCustom(Page page, ProcurementRecordOutPageDto procurementDto); |
| | | } |
| | |
| | | |
| | | int deletePro(ProcurementUpdateDto procurementDto); |
| | | |
| | | void export(HttpServletResponse response); |
| | | void export(HttpServletResponse response,Integer type); |
| | | |
| | | int updateManagement(ProcurementManagementUpdateDto procurementDto); |
| | | |
| | | void exportCopy(HttpServletResponse response); |
| | | void exportCopy(HttpServletResponse response,Integer type); |
| | | |
| | | void exportCopyTwo(HttpServletResponse response,Integer type); |
| | | |
| | | Map<String, Object> getReportList(Page page, ProcurementPageDto procurementDto); |
| | | |
| | |
| | | IPage<ProcurementPageDtoCopy> listPageCopyByProduction(Page page, ProcurementPageDto procurementDto); |
| | | |
| | | IPage<CustomStorage> listPageCopyByCustom(Page page, CustomStorage customStorage); |
| | | |
| | | AjaxResult updateCustom(CustomStorage customStorage); |
| | | |
| | | AjaxResult deleteCustom(List<Long> ids); |
| | | } |
| | |
| | | .salesLedgerProductId(procurementRecordOutAdd.getSalesLedgerProductId()) |
| | | .inboundBatches(aLong.equals(0L) ? "第1批次" : "第"+ (aLong + 1) + "批次") |
| | | .inboundNum(new BigDecimal(procurementRecordOutAdd.getQuantity())) |
| | | .type(procurementRecordOutAdd.getType()) |
| | | .createTime(LocalDateTime.now()) |
| | | .createUser(Long.valueOf(procurementRecordOutAdd.getUserId())) |
| | | .createBy(sysUser.getNickName()) |
| | |
| | | |
| | | @Override |
| | | public void export(HttpServletResponse response) { |
| | | List<ProcurementRecordOutPageDto> list =procurementRecordOutMapper.list(); |
| | | List<ProcurementRecordOutPageDto> list = procurementRecordOutMapper.list(); |
| | | ExcelUtil<ProcurementRecordOutPageDto> util = new ExcelUtil<>(ProcurementRecordOutPageDto.class); |
| | | util.exportExcel(response, list, "出库台账"); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<ProcurementRecordOutPageDto> listPageByProduct(Page page, ProcurementRecordOutPageDto procurementDto) { |
| | | return procurementRecordOutMapper.listPageByProduct(page, procurementDto); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<ProcurementRecordOutPageDto> listPageByCustom(Page page, ProcurementRecordOutPageDto procurementDto) { |
| | | return procurementRecordOutMapper.listPageByCustom(page, procurementDto); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void export(HttpServletResponse response) { |
| | | List<ProcurementPageDto> list =procurementRecordMapper.list(); |
| | | public void export(HttpServletResponse response,Integer type) { |
| | | List<ProcurementPageDto> list = new ArrayList<>(); |
| | | if(type == 1){ |
| | | list = procurementRecordMapper.list(); |
| | | }else{ |
| | | list = procurementRecordMapper.listOne(); |
| | | } |
| | | // 计算待入库数量 |
| | | // 查询采购记录已入库数量 |
| | | List<Integer> collect = list.stream().map(ProcurementPageDto::getId).collect(Collectors.toList()); |
| | |
| | | } |
| | | LambdaQueryWrapper<ProcurementRecordOut> procurementRecordLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | procurementRecordLambdaQueryWrapper.in(ProcurementRecordOut::getProcurementRecordStorageId, collect); |
| | | procurementRecordLambdaQueryWrapper.eq(ProcurementRecordOut::getType, type); |
| | | List<ProcurementRecordOut> procurementRecords = procurementRecordOutMapper.selectList(procurementRecordLambdaQueryWrapper); |
| | | if(CollectionUtils.isEmpty( procurementRecords)){ |
| | | ExcelUtil<ProcurementPageDto> util = new ExcelUtil<ProcurementPageDto>(ProcurementPageDto.class); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void exportCopy(HttpServletResponse response) { |
| | | List<ProcurementPageDtoCopy> list =procurementRecordMapper.listCopy(); |
| | | public void exportCopy(HttpServletResponse response,Integer type) { |
| | | List<ProcurementPageDtoCopy> list = new ArrayList<>(); |
| | | if(type == 1){ |
| | | list = procurementRecordMapper.listCopy(); |
| | | }else{ |
| | | list = procurementRecordMapper.listCopyOne(); |
| | | } |
| | | // 计算待入库数量 |
| | | // 查询采购记录已入库数量 |
| | | List<Integer> collect = list.stream().map(ProcurementPageDtoCopy::getId).collect(Collectors.toList()); |
| | |
| | | } |
| | | LambdaQueryWrapper<ProcurementRecordOut> procurementRecordLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | procurementRecordLambdaQueryWrapper.in(ProcurementRecordOut::getProcurementRecordStorageId, collect); |
| | | procurementRecordLambdaQueryWrapper.eq(ProcurementRecordOut::getType, type); |
| | | List<ProcurementRecordOut> procurementRecords = procurementRecordOutMapper.selectList(procurementRecordLambdaQueryWrapper); |
| | | if(CollectionUtils.isEmpty( procurementRecords)){ |
| | | ExcelUtil<ProcurementPageDtoCopy> util = new ExcelUtil<ProcurementPageDtoCopy>(ProcurementPageDtoCopy.class); |
| | |
| | | dto.setInboundNum0(dto.getInboundNum().subtract(totalInboundNum)); |
| | | } |
| | | ExcelUtil<ProcurementPageDtoCopy> util = new ExcelUtil<ProcurementPageDtoCopy>(ProcurementPageDtoCopy.class); |
| | | util.exportExcel(response, list, "库存管理"); |
| | | } |
| | | |
| | | @Override |
| | | public void exportCopyTwo(HttpServletResponse response,Integer type) { |
| | | List<CustomStorage> list = customStorageMapper.selectList(null); |
| | | // 计算待入库数量 |
| | | // 查询采购记录已入库数量 |
| | | List<Integer> collect = list.stream().map(CustomStorage::getId).collect(Collectors.toList()); |
| | | if(CollectionUtils.isEmpty( collect)){ |
| | | ExcelUtil<CustomStorage> util = new ExcelUtil<CustomStorage>(CustomStorage.class); |
| | | util.exportExcel(response, list, "库存管理"); |
| | | return; |
| | | } |
| | | LambdaQueryWrapper<ProcurementRecordOut> procurementRecordLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | procurementRecordLambdaQueryWrapper.in(ProcurementRecordOut::getProcurementRecordStorageId, collect); |
| | | procurementRecordLambdaQueryWrapper.eq(ProcurementRecordOut::getType, type); |
| | | procurementRecordLambdaQueryWrapper.eq(ProcurementRecordOut::getType, type); |
| | | List<ProcurementRecordOut> procurementRecords = procurementRecordOutMapper.selectList(procurementRecordLambdaQueryWrapper); |
| | | if(CollectionUtils.isEmpty( procurementRecords)){ |
| | | ExcelUtil<CustomStorage> util = new ExcelUtil<CustomStorage>(CustomStorage.class); |
| | | util.exportExcel(response, list, "库存管理"); |
| | | return; |
| | | } |
| | | for (CustomStorage dto : list) { |
| | | // 根据采购台账ID筛选对应的出库记录 |
| | | List<ProcurementRecordOut> collect1 = procurementRecords.stream() |
| | | .filter(ProcurementRecordOut -> ProcurementRecordOut.getProcurementRecordStorageId().equals(dto.getId())) |
| | | .collect(Collectors.toList()); |
| | | |
| | | // 如果没有相关的出库记录,跳过该条数据 |
| | | if(CollectionUtils.isEmpty(collect1)){ |
| | | dto.setInboundNum0(dto.getInboundNum()); |
| | | continue; |
| | | } |
| | | |
| | | // 计算已出库数量总和,并设置待出库数量 |
| | | BigDecimal totalInboundNum = collect1.stream() |
| | | .map(ProcurementRecordOut::getInboundNum) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | // 待出库数量 = 总数量 - 已出库数量 |
| | | dto.setInboundNum0(dto.getInboundNum().subtract(totalInboundNum)); |
| | | } |
| | | ExcelUtil<CustomStorage> util = new ExcelUtil<CustomStorage>(CustomStorage.class); |
| | | util.exportExcel(response, list, "库存管理"); |
| | | } |
| | | |
| | |
| | | } |
| | | LambdaQueryWrapper<ProcurementRecordOut> procurementRecordLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | procurementRecordLambdaQueryWrapper.in(ProcurementRecordOut::getProcurementRecordStorageId, collect); |
| | | procurementRecordLambdaQueryWrapper.eq(ProcurementRecordOut::getType, 2); |
| | | List<ProcurementRecordOut> procurementRecords = procurementRecordOutMapper.selectList(procurementRecordLambdaQueryWrapper); |
| | | if(CollectionUtils.isEmpty( procurementRecords)){ |
| | | return procurementPageDtoCopyIPage; |
| | |
| | | customStorageLambdaQueryWrapper.eq(CustomStorage::getInboundDate, customStorage.getInboundDate()); |
| | | } |
| | | } |
| | | return customStorageMapper.selectPage(page, customStorageLambdaQueryWrapper); |
| | | IPage<CustomStorage> pageList = customStorageMapper.selectPage(page, customStorageLambdaQueryWrapper); |
| | | List<CustomStorage> procurementPageDtoCopyList = pageList.getRecords(); |
| | | // 计算待入库数量 |
| | | // 查询采购记录已入库数量 |
| | | List<Integer> collect = procurementPageDtoCopyList.stream().map(CustomStorage::getId).collect(Collectors.toList()); |
| | | if(CollectionUtils.isEmpty( collect)){ |
| | | return pageList; |
| | | } |
| | | LambdaQueryWrapper<ProcurementRecordOut> procurementRecordLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | procurementRecordLambdaQueryWrapper.in(ProcurementRecordOut::getProcurementRecordStorageId, collect); |
| | | procurementRecordLambdaQueryWrapper.eq(ProcurementRecordOut::getType, 3); |
| | | List<ProcurementRecordOut> procurementRecords = procurementRecordOutMapper.selectList(procurementRecordLambdaQueryWrapper); |
| | | if(CollectionUtils.isEmpty( procurementRecords)){ |
| | | return pageList; |
| | | } |
| | | for (CustomStorage dto : procurementPageDtoCopyList) { |
| | | // 根据采购台账ID筛选对应的出库记录 |
| | | List<ProcurementRecordOut> collect1 = procurementRecords.stream() |
| | | .filter(ProcurementRecordOut -> ProcurementRecordOut.getProcurementRecordStorageId().equals(dto.getId())) |
| | | .collect(Collectors.toList()); |
| | | |
| | | // 如果没有相关的出库记录,跳过该条数据 |
| | | if(CollectionUtils.isEmpty(collect1)){ |
| | | dto.setInboundNum0(dto.getInboundNum()); |
| | | continue; |
| | | } |
| | | |
| | | // 计算已出库数量总和,并设置待出库数量 |
| | | BigDecimal totalInboundNum = collect1.stream() |
| | | .map(ProcurementRecordOut::getInboundNum) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | // 出库数量 = 总数量 - 待出库数量 |
| | | dto.setTotalInboundNum(totalInboundNum); |
| | | // 待出库数量 = 总数量 - 已出库数量 |
| | | dto.setInboundNum0(dto.getInboundNum().subtract(totalInboundNum)); |
| | | } |
| | | pageList.setRecords(procurementPageDtoCopyList); |
| | | return pageList; |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult updateCustom(CustomStorage customStorage) { |
| | | return AjaxResult.success(customStorageMapper.updateById(customStorage)); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult deleteCustom(List<Long> ids) { |
| | | return AjaxResult.success(customStorageMapper.deleteBatchIds(ids)); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | LambdaQueryWrapper<ProcurementRecordOut> procurementRecordLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | procurementRecordLambdaQueryWrapper.in(ProcurementRecordOut::getProcurementRecordStorageId, collect); |
| | | procurementRecordLambdaQueryWrapper.eq(ProcurementRecordOut::getType,1); |
| | | List<ProcurementRecordOut> procurementRecords = procurementRecordOutMapper.selectList(procurementRecordLambdaQueryWrapper); |
| | | if(CollectionUtils.isEmpty( procurementRecords)){ |
| | | return procurementPageDtoCopyIPage; |
| | |
| | | from procurement_record_storage 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.ProcurementPageDto"> |
| | | select |
| | | t3.customer_contract_no, |
| | | t3.sales_contract_no, |
| | | t3.customer_name, |
| | | t2.product_category, |
| | | t1.id, |
| | | t2.specification_model, |
| | | t2.unit, |
| | | t2.quantity, |
| | | t2.quantity as quantity0, |
| | | t2.tax_rate, |
| | | t2.tax_inclusive_unit_price, |
| | | t2.tax_inclusive_total_price, |
| | | t2.tax_exclusive_total_price, |
| | | t1.inbound_batches, |
| | | t1.inbound_num, |
| | | t1.create_time, |
| | | t1.create_time as time, |
| | | t1.create_by |
| | | from procurement_record_storage 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="listPageCopy" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDtoCopy"> |
| | | select |
| | |
| | | from procurement_record_storage 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="listCopyOne" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDtoCopy"> |
| | | select |
| | | t3.customer_contract_no, |
| | | t3.sales_contract_no, |
| | | t3.customer_name, |
| | | t2.product_category, |
| | | t1.id, |
| | | t1.sales_ledger_product_id, |
| | | t1.create_user, |
| | | 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_batches, |
| | | t1.inbound_num, |
| | | t1.inbound_num as inboundNum0, |
| | | t1.create_time, |
| | | t1.update_time, |
| | | t1.create_time as cTime, |
| | | t1.update_time as uTime, |
| | | t1.create_by |
| | | from procurement_record_storage 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="listPageByProduction" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDto"> |
| | | select |
| | |
| | | t1.create_by, |
| | | t2.warn_num |
| | | from procurement_record_out t1 |
| | | left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id |
| | | 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 |
| | | <where> |
| | | 1 = 1 |
| | | and t1.type = 1 |
| | | <if test="req.supplierName != null and req.supplierName != ''"> |
| | | and t3.supplier_name like concat('%',#{req.supplierName},'%') |
| | | </if> |
| | |
| | | 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 |
| | | 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 |
| | | where t1.type = 3 |
| | | </select> |
| | | <select id="listPageByProduct" resultType="com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto"> |
| | | select |
| | | t3.customer_contract_no, |
| | | t3.sales_contract_no, |
| | | t3.customer_name, |
| | | t2.product_category, |
| | | t1.id, |
| | | t1.code, |
| | | 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_by |
| | | 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 |
| | | <where> |
| | | and t1.type = 2 |
| | | <if test="req.customerName != null and req.customerName != ''"> |
| | | and t3.customer_name like concat('%',#{req.customerName},'%') |
| | | </if> |
| | | <if test="req.timeStr != null and req.timeStr != ''"> |
| | | and t1.create_time like concat('%',#{req.timeStr},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="listPageByCustom" resultType="com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto"> |
| | | select |
| | | t2.supplier_name, |
| | | t2.product_category, |
| | | t1.id, |
| | | t1.code, |
| | | 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_by |
| | | 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},'%') |
| | | </if> |
| | | <if test="req.timeStr != null and req.timeStr != ''"> |
| | | and t1.create_time like concat('%',#{req.timeStr},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |