|
|
|
|
@ -7,6 +7,7 @@ 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.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
|
|
|
|
import com.sun.xml.internal.ws.resources.UtilMessages; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
@ -574,38 +575,51 @@ public class GoodsController extends BladeController { |
|
|
|
|
* 出入库记录查询 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/inAndOutRecord") |
|
|
|
|
public R<IPage> inAndOutRecord(String id, Query query) { |
|
|
|
|
public R<IPage> inAndOutRecord(String id, Query query, String type, Date startTime, Date endTime) { |
|
|
|
|
List<InAndOutRecord> inAndOutRecordList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
// 物品出库信息
|
|
|
|
|
LambdaQueryWrapper<ApplyDetail> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
wrapper.eq(ApplyDetail::getProductId, id); |
|
|
|
|
wrapper.eq(ApplyDetail::getIsCk, 1); |
|
|
|
|
List<ApplyDetail> applyDetailList = applyDetailService.list(wrapper); |
|
|
|
|
if (CollectionUtils.isNotEmpty(applyDetailList)) { |
|
|
|
|
for (ApplyDetail applyDetail : applyDetailList) { |
|
|
|
|
InAndOutRecord inAndOutRecord = new InAndOutRecord(); |
|
|
|
|
inAndOutRecord.setGoodsName(applyDetail.getProductName()); |
|
|
|
|
inAndOutRecord.setType("出库"); |
|
|
|
|
inAndOutRecord.setNum(applyDetail.getOutNum()); |
|
|
|
|
inAndOutRecord.setTime(applyDetail.getCkTime()); |
|
|
|
|
inAndOutRecordList.add(inAndOutRecord); |
|
|
|
|
if (!"2".equals(type)) { |
|
|
|
|
LambdaQueryWrapper<ApplyDetail> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
wrapper.eq(ApplyDetail::getProductId, id); |
|
|
|
|
wrapper.eq(ApplyDetail::getIsCk, 1); |
|
|
|
|
if (startTime != null && endTime != null) { |
|
|
|
|
wrapper.between(ApplyDetail::getCkTime, startTime, endTime); |
|
|
|
|
} |
|
|
|
|
List<ApplyDetail> applyDetailList = applyDetailService.list(wrapper); |
|
|
|
|
if (CollectionUtils.isNotEmpty(applyDetailList)) { |
|
|
|
|
for (ApplyDetail applyDetail : applyDetailList) { |
|
|
|
|
InAndOutRecord inAndOutRecord = new InAndOutRecord(); |
|
|
|
|
inAndOutRecord.setGoodsName(applyDetail.getProductName()); |
|
|
|
|
inAndOutRecord.setType("出库"); |
|
|
|
|
inAndOutRecord.setNum(applyDetail.getOutNum()); |
|
|
|
|
inAndOutRecord.setTime(applyDetail.getCkTime()); |
|
|
|
|
inAndOutRecordList.add(inAndOutRecord); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 物品入库信息
|
|
|
|
|
LambdaQueryWrapper<ProductStoreDetial> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
queryWrapper.eq(ProductStoreDetial::getGoodsId, id); |
|
|
|
|
List<ProductStoreDetial> detialList = productStoreDetialService.list(queryWrapper); |
|
|
|
|
if (CollectionUtils.isNotEmpty(detialList)) { |
|
|
|
|
for (ProductStoreDetial productStoreDetial : detialList) { |
|
|
|
|
InAndOutRecord inAndOutRecord = new InAndOutRecord(); |
|
|
|
|
inAndOutRecord.setGoodsName(productStoreDetial.getGoodsName()); |
|
|
|
|
inAndOutRecord.setType("入库"); |
|
|
|
|
inAndOutRecord.setNum(productStoreDetial.getNum()); |
|
|
|
|
inAndOutRecord.setTime(productStoreDetial.getCreateTime()); |
|
|
|
|
inAndOutRecordList.add(inAndOutRecord); |
|
|
|
|
if (!"1".equals(type)) { |
|
|
|
|
LambdaQueryWrapper<ProductStoreDetial> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
queryWrapper.eq(ProductStoreDetial::getGoodsId, id); |
|
|
|
|
if (startTime != null && endTime != null) { |
|
|
|
|
queryWrapper.between(ProductStoreDetial::getCreateTime, startTime, endTime); |
|
|
|
|
} |
|
|
|
|
List<ProductStoreDetial> detialList = productStoreDetialService.list(queryWrapper); |
|
|
|
|
if (CollectionUtils.isNotEmpty(detialList)) { |
|
|
|
|
for (ProductStoreDetial productStoreDetial : detialList) { |
|
|
|
|
InAndOutRecord inAndOutRecord = new InAndOutRecord(); |
|
|
|
|
inAndOutRecord.setGoodsName(productStoreDetial.getGoodsName()); |
|
|
|
|
inAndOutRecord.setType("入库"); |
|
|
|
|
inAndOutRecord.setNum(productStoreDetial.getNum()); |
|
|
|
|
inAndOutRecord.setTime(productStoreDetial.getCreateTime()); |
|
|
|
|
inAndOutRecordList.add(inAndOutRecord); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 组装过滤生成page对象
|
|
|
|
|
List<InAndOutRecord> inAndOutRecords = inAndOutRecordList.stream().sorted(Comparator.comparing(InAndOutRecord::getTime, Comparator.reverseOrder())).collect(toList()); |
|
|
|
|
IPage<InAndOutRecord> page = new Page<>(); |
|
|
|
|
List<InAndOutRecord> collect = inAndOutRecords.stream().skip((query.getCurrent() - 1) * query.getSize()).limit(query.getSize()).collect(toList()); |
|
|
|
|
|