InventoryController.java
5.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
package com.huaheng.api.general.controller;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.huaheng.common.utils.Wrappers;
import com.huaheng.api.general.domain.CycCountDomain;
import com.huaheng.api.general.domain.InventoryDomain;
import com.huaheng.api.general.domain.InventoryQueryDomain;
import com.huaheng.common.utils.security.ShiroUtils;
import com.huaheng.framework.aspectj.lang.annotation.ApiLogger;
import com.huaheng.framework.aspectj.lang.annotation.Log;
import com.huaheng.framework.aspectj.lang.constant.BusinessType;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.pc.inventory.InventoryMaterialSummary.domain.InventoryMaterialSummary;
import com.huaheng.pc.inventory.InventoryMaterialSummary.service.InventoryMaterialSummaryService;
import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail;
import com.huaheng.pc.inventory.inventoryDetail.service.InventoryDetailService;
import com.huaheng.pc.inventory.inventoryHeader.service.InventoryHeaderService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.lang.ref.WeakReference;
import java.util.Collections;
import java.util.List;
@RestController
@RequestMapping("/api/inventory")
public class InventoryController {
@Resource
private InventoryDetailService inventoryHeaderService;
@Resource
private InventoryMaterialSummaryService inventoryMaterialSummaryService;
/**
* 查询库存
*/
@Log(title = "查询库存", action = BusinessType.INSERT)
@PostMapping("/searchInventory")
@ApiOperation("查询库存系统库存")
@ResponseBody
@ApiLogger(apiName = "查询库存", from="ERP")
public AjaxResult searchInventory(@RequestBody InventoryQueryDomain inventoryQueryDomain)
{
LambdaQueryWrapper<InventoryDetail> inventoryDetailLambdaQueryWrapper = Wrappers.lambdaQuery();
inventoryDetailLambdaQueryWrapper.eq(StringUtils.isNotEmpty(inventoryQueryDomain.getWarehouseCode()),
InventoryDetail::getWarehouseCode, inventoryQueryDomain.getWarehouseCode())
.eq(StringUtils.isNotEmpty(inventoryQueryDomain.getContainerCode()),
InventoryDetail::getContainerCode, inventoryQueryDomain.getContainerCode())
.eq(StringUtils.isNotEmpty(inventoryQueryDomain.getLocationCode()),
InventoryDetail::getLocationCode, inventoryQueryDomain.getLocationCode())
.eq(StringUtils.isNotEmpty(inventoryQueryDomain.getCompanyCode()),
InventoryDetail::getCompanyCode, inventoryQueryDomain.getCompanyCode())
.eq(StringUtils.isNotEmpty(inventoryQueryDomain.getMaterialCode()),
InventoryDetail::getMaterialCode, inventoryQueryDomain.getMaterialCode());
List<InventoryDetail> inventoryDetailList = inventoryHeaderService.list(inventoryDetailLambdaQueryWrapper);
return AjaxResult.success(inventoryDetailList);
}
/**
* 查询库存
*/
@Log(title = "查询库存", action = BusinessType.INSERT)
@PostMapping("/searchTotalInventory")
@ApiOperation("查询库存系统库存")
@ResponseBody
@ApiLogger(apiName = "查询库存", from="ERP")
public AjaxResult searchTotalInventory(@RequestBody InventoryMaterialSummary inventoryMaterialSummary)
{
LambdaQueryWrapper<InventoryMaterialSummary> lambdaQueryWrapper = Wrappers.lambdaQuery();
lambdaQueryWrapper
.eq(StringUtils.isNotEmpty(inventoryMaterialSummary.getWarehouseCode()),
InventoryMaterialSummary::getWarehouseCode, inventoryMaterialSummary.getWarehouseCode())
//物料编码
.eq(StringUtils.isNotEmpty(inventoryMaterialSummary.getMaterialCode()), InventoryMaterialSummary::getMaterialCode, inventoryMaterialSummary.getMaterialCode())
//物料名称
.eq(StringUtils.isNotEmpty(inventoryMaterialSummary.getMaterialName()), InventoryMaterialSummary::getMaterialName, inventoryMaterialSummary.getMaterialName())
.eq(StringUtils.isNotEmpty(inventoryMaterialSummary.getZoneCode()), InventoryMaterialSummary::getZoneCode, inventoryMaterialSummary.getZoneCode())
//货主
.eq(!StringUtils.isEmpty(inventoryMaterialSummary.getCompanyCode()),InventoryMaterialSummary::getCompanyCode, inventoryMaterialSummary.getCompanyCode());
//.orderByAsc(InventoryMaterialSummary::getMaterialCode);
List<InventoryMaterialSummary> list = inventoryMaterialSummaryService.list(lambdaQueryWrapper);
if (list == null) {
list = Collections.emptyList();
}
//筛选库存汇总数据的专用方法
List<InventoryMaterialSummary> details = inventoryMaterialSummaryService.duplicateRemoval(list);
return AjaxResult.success(details);
}
}