InventoryTotalController.java
2.08 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
package com.huaheng.api.logistics.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.huaheng.api.general.domain.Receipt;
import com.huaheng.api.general.service.ReceiptService;
import com.huaheng.mobile.shipment.Shipment;
import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail;
import com.huaheng.pc.inventory.inventoryDetail.service.InventoryDetailService;
import com.huaheng.pc.receipt.receiptHeader.service.ReceiptHeaderService;
import com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader;
import com.huaheng.pc.shipment.shipmentHeader.service.ShipmentHeaderService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.management.Query;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
/**
* 出入库曲线接口
* @author mahua
*/
@RestController
@RequestMapping("/API/inventoryTotal")
public class InventoryTotalController {
@Resource
private InventoryDetailService inventoryDetailService;
@Resource
private ReceiptHeaderService receiptHeaderService;
@Resource
private ShipmentHeaderService shipmentHeaderService;
public Map<String, Object> inventoryTotal() {
Map<String, Object> resultMap = new HashMap<>();
QueryWrapper<InventoryDetail> queryWrapper = new QueryWrapper<>();
queryWrapper.select("count(DISTINCT materialCode) as materialType, sum(qty) as quantity");
Map<String, Object> materialMap = inventoryDetailService.getMap(queryWrapper);
resultMap.put("materialType", materialMap.get("materialType"));
resultMap.put("quantity", materialMap.get("quantity"));
int receiptCount = receiptHeaderService.count();
int shipmentCount = shipmentHeaderService.count();
resultMap.put("ordersNumber", receiptCount+shipmentCount);
return resultMap;
}
}