Commit 9c925c8bbb7db5e7c474126b332e1f7c88356f10
Merge branch 'develop4' of http://172.16.29.40:8010/wms/wms4.git into develop4
Showing
1 changed file
with
49 additions
and
14 deletions
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/home/service/impl/HomePageViewServiceImpl.java
... | ... | @@ -26,6 +26,8 @@ import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; |
26 | 26 | import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryHeader; |
27 | 27 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.impl.InventoryDetailServiceImpl; |
28 | 28 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.impl.InventoryHeaderServiceImpl; |
29 | +import org.jeecg.modules.wms.inventory.inventoryTransaction.entity.InventoryTransaction; | |
30 | +import org.jeecg.modules.wms.inventory.inventoryTransaction.service.impl.InventoryTransactionServiceImpl; | |
29 | 31 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; |
30 | 32 | import org.jeecg.modules.wms.receipt.receiptHeader.service.impl.ReceiptHeaderServiceImpl; |
31 | 33 | import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader; |
... | ... | @@ -72,38 +74,71 @@ public class HomePageViewServiceImpl implements HomePageViewService { |
72 | 74 | TaskHeaderServiceImpl taskHeaderService; |
73 | 75 | @Resource |
74 | 76 | HomePageViewService homePageViewService; |
77 | + @Resource | |
78 | + InventoryTransactionServiceImpl inventoryTransactionServiceImpl; | |
75 | 79 | |
76 | 80 | @Override |
77 | 81 | public Result<String> deliveringAmount() { |
82 | + //通过库存交易记录来查询 | |
83 | + LambdaQueryWrapper<InventoryTransaction> inventoryTransactionLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
84 | + inventoryTransactionLambdaQueryWrapper.select(InventoryTransaction::getCreateTime, InventoryTransaction::getQty,InventoryTransaction::getType); | |
85 | + List<InventoryTransaction> inventoryTransactions = inventoryTransactionServiceImpl.list(inventoryTransactionLambdaQueryWrapper); | |
86 | + | |
87 | + | |
78 | 88 | // 查询出库单的7天出库量 |
79 | - LambdaQueryWrapper<ShipmentHeader> shipmentHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
80 | - shipmentHeaderLambdaQueryWrapper.select(ShipmentHeader::getCreateTime, ShipmentHeader::getTotalQty); | |
81 | - List<ShipmentHeader> shipmentHeaders = shipmentHeaderServiceImpl.list(shipmentHeaderLambdaQueryWrapper); | |
89 | + List<InventoryTransaction> shipmentHeaders=new ArrayList<>(); | |
90 | + shipmentHeaders.addAll(inventoryTransactions); | |
91 | + shipmentHeaders.removeIf(Inventory->Inventory.getType()!=20); | |
82 | 92 | LinkedHashMap<String, String> list = new LinkedHashMap<>(); |
83 | 93 | |
84 | 94 | for (int i = 6; i >= 0; i--) { |
85 | - List<ShipmentHeader> shipmentHeadersCop = shipmentHeaders; | |
86 | 95 | String today = new SimpleDateFormat("yyyy-MM-dd").format(System.currentTimeMillis() - (1000 * 60 * 60 * 24) * i).toString(); |
87 | - List<ShipmentHeader> collect = shipmentHeadersCop.stream() | |
96 | + List<InventoryTransaction> collect = shipmentHeaders.stream() | |
88 | 97 | .filter(shipmentHeader -> new SimpleDateFormat("yyyy-MM-dd").format(shipmentHeader.getCreateTime()).toString().contains(today)) |
89 | 98 | .collect(Collectors.toList()); |
90 | - list.put(today, String.valueOf(collect.size())); | |
99 | + if (collect.size()!=0) | |
100 | + { | |
101 | + BigDecimal sum=new BigDecimal(0); | |
102 | + for (InventoryTransaction item : collect) | |
103 | + { | |
104 | + sum=sum.add(item.getQty()); | |
105 | + } | |
106 | + list.put(today,String.valueOf(sum)); | |
107 | + }else | |
108 | + { | |
109 | + list.put(today,"0"); | |
110 | + } | |
111 | + | |
91 | 112 | } |
92 | 113 | |
93 | 114 | // 查询入库单的7天入库量 |
94 | - LambdaQueryWrapper<ReceiptHeader> receiptHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
95 | - receiptHeaderLambdaQueryWrapper.select(ReceiptHeader::getCreateTime, ReceiptHeader::getTotalqty); | |
96 | - List<ReceiptHeader> receiptHeaders = receiptHeaderServiceImpl.list(receiptHeaderLambdaQueryWrapper); | |
115 | + | |
116 | + List<InventoryTransaction> receiptHeaders = new ArrayList<>(); | |
117 | + receiptHeaders.addAll(inventoryTransactions); | |
118 | + receiptHeaders.removeIf(Inventory->Inventory.getType()!=10); | |
97 | 119 | LinkedHashMap<String, String> list2 = new LinkedHashMap<>(); |
98 | 120 | for (int i = 6; i >= 0; i--) { |
99 | - List<ReceiptHeader> receiptHeadersCop = receiptHeaders; | |
121 | + List<InventoryTransaction> receiptHeadersCop = receiptHeaders; | |
100 | 122 | String today = new SimpleDateFormat("yyyy-MM-dd").format(System.currentTimeMillis() - (1000 * 60 * 60 * 24) * i).toString(); |
101 | - List<ReceiptHeader> collect = receiptHeadersCop.stream() | |
123 | + List<InventoryTransaction> collect = receiptHeadersCop.stream() | |
102 | 124 | .filter(ReceiptHeader -> new SimpleDateFormat("yyyy-MM-dd").format(ReceiptHeader.getCreateTime()).toString().contains(today)) |
103 | 125 | .collect(Collectors.toList()); |
104 | - list2.put(today, String.valueOf(collect.size())); | |
126 | + if (collect.size()!=0) | |
127 | + { | |
128 | + BigDecimal sum=new BigDecimal(0); | |
129 | + for (InventoryTransaction item : collect) | |
130 | + { | |
131 | + sum=sum.add(item.getQty()); | |
132 | + } | |
133 | + list2.put(today,String.valueOf(sum)); | |
134 | + }else | |
135 | + { | |
136 | + list2.put(today,"0"); | |
137 | + } | |
105 | 138 | } |
106 | 139 | |
140 | + | |
141 | + | |
107 | 142 | Option option = new Option(); |
108 | 143 | option.tooltip().trigger(Trigger.axis).axisPointer().type(PointerType.cross); |
109 | 144 | option.grid().setLeft("3%"); |
... | ... | @@ -148,12 +183,12 @@ public class HomePageViewServiceImpl implements HomePageViewService { |
148 | 183 | public Result<String> inventoryUtilization() { |
149 | 184 | // 先存储总数 |
150 | 185 | Integer allStock = locationServiceImpl.count(); |
151 | - | |
186 | + | |
152 | 187 | // 有货数量 = 总库位删除为空的数量长度 |
153 | 188 | LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); |
154 | 189 | locationLambdaQueryWrapper.isNotNull(Location::getContainerCode).ne(Location::getContainerCode, ""); |
155 | 190 | int locationStock = locationServiceImpl.count(locationLambdaQueryWrapper); |
156 | - | |
191 | + | |
157 | 192 | // 无货数量 = 总数 - 有货数量 |
158 | 193 | Integer inStock = allStock - locationStock; |
159 | 194 | Option option = new Option(); |
... | ... |