| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.web.controller;
|
1 |
package com.spice.profitmandi.web.controller;
|
| 2 |
|
2 |
|
| - |
|
3 |
import java.util.ArrayList;
|
| 3 |
import java.util.HashMap;
|
4 |
import java.util.HashMap;
|
| 4 |
import java.util.HashSet;
|
5 |
import java.util.HashSet;
|
| 5 |
import java.util.List;
|
6 |
import java.util.List;
|
| 6 |
import java.util.Map;
|
7 |
import java.util.Map;
|
| 7 |
import java.util.Set;
|
8 |
import java.util.Set;
|
| Line 10... |
Line 11... |
| 10 |
|
11 |
|
| 11 |
import org.apache.logging.log4j.LogManager;
|
12 |
import org.apache.logging.log4j.LogManager;
|
| 12 |
import org.apache.logging.log4j.Logger;
|
13 |
import org.apache.logging.log4j.Logger;
|
| 13 |
import org.springframework.beans.factory.annotation.Autowired;
|
14 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 14 |
import org.springframework.beans.factory.annotation.Qualifier;
|
15 |
import org.springframework.beans.factory.annotation.Qualifier;
|
| 15 |
import org.springframework.http.ResponseEntity;
|
- |
|
| 16 |
import org.springframework.stereotype.Controller;
|
16 |
import org.springframework.stereotype.Controller;
|
| 17 |
import org.springframework.transaction.annotation.Transactional;
|
17 |
import org.springframework.transaction.annotation.Transactional;
|
| 18 |
import org.springframework.ui.Model;
|
18 |
import org.springframework.ui.Model;
|
| 19 |
import org.springframework.web.bind.annotation.RequestBody;
|
19 |
import org.springframework.web.bind.annotation.RequestBody;
|
| 20 |
import org.springframework.web.bind.annotation.RequestMapping;
|
20 |
import org.springframework.web.bind.annotation.RequestMapping;
|
| Line 23... |
Line 23... |
| 23 |
|
23 |
|
| 24 |
import com.spice.profitmandi.common.enumuration.ItemType;
|
24 |
import com.spice.profitmandi.common.enumuration.ItemType;
|
| 25 |
import com.spice.profitmandi.common.enumuration.ScanType;
|
25 |
import com.spice.profitmandi.common.enumuration.ScanType;
|
| 26 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
26 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 27 |
import com.spice.profitmandi.common.model.CreateItemRequest;
|
27 |
import com.spice.profitmandi.common.model.CreateItemRequest;
|
| - |
|
28 |
import com.spice.profitmandi.common.model.InstructionItemRequest;
|
| 28 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
29 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 29 |
import com.spice.profitmandi.common.model.ScanInItemRequest;
|
30 |
import com.spice.profitmandi.common.model.ScanInItemRequest;
|
| - |
|
31 |
import com.spice.profitmandi.common.model.ScanInPartnerItemRequest;
|
| 30 |
import com.spice.profitmandi.common.model.ScanOutItemRequest;
|
32 |
import com.spice.profitmandi.common.model.ScanOutItemRequest;
|
| 31 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
33 |
import com.spice.profitmandi.common.model.ScanOutPartnerItemRequest;
|
| 32 |
import com.spice.profitmandi.dao.entity.nonbillable.AdminCurrentInventorySnapshot;
|
34 |
import com.spice.profitmandi.dao.entity.nonbillable.AdminCurrentInventorySnapshot;
|
| 33 |
import com.spice.profitmandi.dao.entity.nonbillable.AdminDeliveryNote;
|
35 |
import com.spice.profitmandi.dao.entity.nonbillable.AdminDeliveryNote;
|
| - |
|
36 |
import com.spice.profitmandi.dao.entity.nonbillable.InstructionItem;
|
| - |
|
37 |
import com.spice.profitmandi.dao.entity.nonbillable.InstructionItemDetail;
|
| 34 |
import com.spice.profitmandi.dao.entity.nonbillable.Item;
|
38 |
import com.spice.profitmandi.dao.entity.nonbillable.Item;
|
| 35 |
import com.spice.profitmandi.dao.entity.nonbillable.PartnerCurrentInventorySnapshot;
|
39 |
import com.spice.profitmandi.dao.entity.nonbillable.PartnerCurrentInventorySnapshot;
|
| - |
|
40 |
import com.spice.profitmandi.dao.entity.nonbillable.ScanOutPartnerItem;
|
| 36 |
import com.spice.profitmandi.dao.entity.nonbillable.Vendor;
|
41 |
import com.spice.profitmandi.dao.entity.nonbillable.Vendor;
|
| 37 |
import com.spice.profitmandi.dao.entity.nonbillable.Warehouse;
|
42 |
import com.spice.profitmandi.dao.entity.nonbillable.Warehouse;
|
| - |
|
43 |
import com.spice.profitmandi.dao.entity.user.Address;
|
| - |
|
44 |
import com.spice.profitmandi.dao.enumuration.nonbillable.InstructionItemStatus;
|
| - |
|
45 |
import com.spice.profitmandi.dao.repository.dtr.RetailerRegisteredAddressRepository;
|
| 38 |
import com.spice.profitmandi.dao.repository.dtr.UserRepository;
|
46 |
import com.spice.profitmandi.dao.repository.dtr.UserRepository;
|
| 39 |
import com.spice.profitmandi.dao.repository.nonbillable.AdminCurrentInventorySnapshotRepository;
|
47 |
import com.spice.profitmandi.dao.repository.nonbillable.AdminCurrentInventorySnapshotRepository;
|
| - |
|
48 |
import com.spice.profitmandi.dao.repository.nonbillable.AdminDeliveryNoteDetailRepository;
|
| 40 |
import com.spice.profitmandi.dao.repository.nonbillable.AdminDeliveryNoteRepository;
|
49 |
import com.spice.profitmandi.dao.repository.nonbillable.AdminDeliveryNoteRepository;
|
| 41 |
import com.spice.profitmandi.dao.repository.nonbillable.AdminInventoryItemRepository;
|
50 |
import com.spice.profitmandi.dao.repository.nonbillable.AdminInventoryItemRepository;
|
| - |
|
51 |
import com.spice.profitmandi.dao.repository.nonbillable.InstructionItemDetailRepository;
|
| - |
|
52 |
import com.spice.profitmandi.dao.repository.nonbillable.InstructionItemRepository;
|
| 42 |
import com.spice.profitmandi.dao.repository.nonbillable.ItemRepository;
|
53 |
import com.spice.profitmandi.dao.repository.nonbillable.ItemRepository;
|
| 43 |
import com.spice.profitmandi.dao.repository.nonbillable.PartnerCurrentInventorySnapshotRepository;
|
54 |
import com.spice.profitmandi.dao.repository.nonbillable.PartnerCurrentInventorySnapshotRepository;
|
| - |
|
55 |
import com.spice.profitmandi.dao.repository.nonbillable.PartnerInventoryItemRepository;
|
| - |
|
56 |
import com.spice.profitmandi.dao.repository.nonbillable.ScanOutPartnerItemRepository;
|
| 44 |
import com.spice.profitmandi.dao.repository.nonbillable.UserWarehouseRepository;
|
57 |
import com.spice.profitmandi.dao.repository.nonbillable.UserWarehouseRepository;
|
| 45 |
import com.spice.profitmandi.dao.repository.nonbillable.VendorRepository;
|
58 |
import com.spice.profitmandi.dao.repository.nonbillable.VendorRepository;
|
| 46 |
import com.spice.profitmandi.dao.repository.nonbillable.WarehouseRepository;
|
59 |
import com.spice.profitmandi.dao.repository.nonbillable.WarehouseRepository;
|
| - |
|
60 |
import com.spice.profitmandi.dao.repository.user.AddressRepository;
|
| 47 |
import com.spice.profitmandi.service.nonbillable.InventoryService;
|
61 |
import com.spice.profitmandi.service.nonbillable.InventoryService;
|
| 48 |
import com.spice.profitmandi.service.user.RetailerService;
|
62 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 49 |
import com.spice.profitmandi.web.model.LoginDetails;
|
63 |
import com.spice.profitmandi.web.model.LoginDetails;
|
| 50 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
64 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
| 51 |
|
65 |
|
| Line 88... |
Line 102... |
| 88 |
@Autowired
|
102 |
@Autowired
|
| 89 |
private UserWarehouseRepository userWarehouseRepository;
|
103 |
private UserWarehouseRepository userWarehouseRepository;
|
| 90 |
|
104 |
|
| 91 |
@Autowired
|
105 |
@Autowired
|
| 92 |
private AdminDeliveryNoteRepository adminDeliveryNoteRepository;
|
106 |
private AdminDeliveryNoteRepository adminDeliveryNoteRepository;
|
| - |
|
107 |
|
| - |
|
108 |
@Autowired
|
| - |
|
109 |
private RetailerRegisteredAddressRepository retailerRegisteredAddressRepository;
|
| - |
|
110 |
|
| - |
|
111 |
@Autowired
|
| - |
|
112 |
private AddressRepository addressRepository;
|
| - |
|
113 |
|
| - |
|
114 |
@Autowired
|
| - |
|
115 |
private PartnerInventoryItemRepository partnerInventoryItemRepository;
|
| - |
|
116 |
|
| - |
|
117 |
@Autowired
|
| - |
|
118 |
private ScanOutPartnerItemRepository scanOutPartnerItemRepository;
|
| - |
|
119 |
|
| - |
|
120 |
@Autowired
|
| - |
|
121 |
private InstructionItemRepository instructionItemRepository;
|
| 93 |
|
122 |
|
| 94 |
@Autowired
|
123 |
@Autowired
|
| 95 |
private ResponseSender<?> responseSender;
|
124 |
private InstructionItemDetailRepository instructionItemDetailRepository;
|
| - |
|
125 |
|
| - |
|
126 |
@Autowired
|
| - |
|
127 |
private AdminDeliveryNoteDetailRepository adminDeliveryNoteDetailRepository;
|
| 96 |
|
128 |
|
| 97 |
@Autowired
|
129 |
@Autowired
|
| 98 |
private CookiesProcessor cookiesProcessor;
|
130 |
private CookiesProcessor cookiesProcessor;
|
| 99 |
|
131 |
|
| 100 |
private Map<Integer, String> itemsToVendorIdNameMap(List<Item> items){
|
132 |
private Map<Integer, String> itemsToVendorIdNameMap(List<Item> items){
|
| Line 145... |
Line 177... |
| 145 |
itemIds.add(partnerCurrentInventorySnapshot.getItemId());
|
177 |
itemIds.add(partnerCurrentInventorySnapshot.getItemId());
|
| 146 |
}
|
178 |
}
|
| 147 |
return itemIdDescriptionMap(itemIds);
|
179 |
return itemIdDescriptionMap(itemIds);
|
| 148 |
}
|
180 |
}
|
| 149 |
|
181 |
|
| 150 |
private Map<Integer, String> adminDeliveryNotesToItemIdDescriptionMap(List<AdminDeliveryNote> adminDeliveryNotes){
|
182 |
/*private Map<Integer, String> adminDeliveryNotesToItemIdDescriptionMap(List<AdminDeliveryNote> adminDeliveryNotes){
|
| 151 |
if(adminDeliveryNotes.isEmpty()) {
|
183 |
if(adminDeliveryNotes.isEmpty()) {
|
| 152 |
return new HashMap<>();
|
184 |
return new HashMap<>();
|
| 153 |
}
|
185 |
}
|
| 154 |
Set<Integer> itemIds = new HashSet<>();
|
186 |
Set<Integer> itemIds = new HashSet<>();
|
| 155 |
for(AdminDeliveryNote adminDeliveryNote : adminDeliveryNotes) {
|
187 |
for(AdminDeliveryNote adminDeliveryNote : adminDeliveryNotes) {
|
| 156 |
itemIds.add(adminDeliveryNote.getItemId());
|
188 |
itemIds.add(adminDeliveryNote.getItemId());
|
| 157 |
}
|
189 |
}
|
| 158 |
return itemIdDescriptionMap(itemIds);
|
190 |
return itemIdDescriptionMap(itemIds);
|
| 159 |
}
|
191 |
}*/
|
| - |
|
192 |
|
| - |
|
193 |
private Map<Integer, String> scanOutPartnerItemsToItemIdDescriptionMap(List<ScanOutPartnerItem> scanOutPartnerItems){
|
| - |
|
194 |
if(scanOutPartnerItems.isEmpty()) {
|
| - |
|
195 |
return new HashMap<>();
|
| - |
|
196 |
}
|
| - |
|
197 |
Set<Integer> itemIds = new HashSet<>();
|
| - |
|
198 |
for(ScanOutPartnerItem scanOutPartnerItem : scanOutPartnerItems) {
|
| - |
|
199 |
itemIds.add(scanOutPartnerItem.getItemId());
|
| - |
|
200 |
}
|
| - |
|
201 |
return itemIdDescriptionMap(itemIds);
|
| - |
|
202 |
}
|
| 160 |
|
203 |
|
| 161 |
private Map<Integer, String> itemIdDescriptionMap(Set<Integer> itemIds){
|
204 |
private Map<Integer, String> itemIdDescriptionMap(Set<Integer> itemIds){
|
| 162 |
Map<Integer, String> itemIdDescriptionMap = new HashMap<>();
|
205 |
Map<Integer, String> itemIdDescriptionMap = new HashMap<>();
|
| 163 |
List<Item> items = itemRepository.selectByIds(itemIds);
|
206 |
List<Item> items = itemRepository.selectByIds(itemIds);
|
| 164 |
for(Item item : items) {
|
207 |
for(Item item : items) {
|
| Line 182... |
Line 225... |
| 182 |
warehouseIdNameMap.put(warehouse.getId(), warehouse.getName());
|
225 |
warehouseIdNameMap.put(warehouse.getId(), warehouse.getName());
|
| 183 |
}
|
226 |
}
|
| 184 |
return warehouseIdNameMap;
|
227 |
return warehouseIdNameMap;
|
| 185 |
}
|
228 |
}
|
| 186 |
|
229 |
|
| - |
|
230 |
private Set<Integer> instructionItemsToWarehouseIds(List<InstructionItem> instructionItems){
|
| - |
|
231 |
Set<Integer> warehouseIds = new HashSet<>();
|
| - |
|
232 |
for(InstructionItem instructionItem : instructionItems) {
|
| - |
|
233 |
warehouseIds.add(instructionItem.getWarehouseId());
|
| - |
|
234 |
}
|
| - |
|
235 |
return warehouseIds;
|
| - |
|
236 |
}
|
| - |
|
237 |
|
| - |
|
238 |
private Set<Integer> instructionItemsToFofoIds(List<InstructionItem> instructionItems){
|
| - |
|
239 |
Set<Integer> fofoIds = new HashSet<>();
|
| - |
|
240 |
for(InstructionItem instructionItem : instructionItems) {
|
| - |
|
241 |
fofoIds.add(instructionItem.getFofoId());
|
| - |
|
242 |
}
|
| - |
|
243 |
return fofoIds;
|
| - |
|
244 |
}
|
| - |
|
245 |
|
| - |
|
246 |
private Set<Integer> instructionItemsToInstructionItemIds(List<InstructionItem> instructionItems){
|
| - |
|
247 |
Set<Integer> instructionItemIds = new HashSet<>();
|
| - |
|
248 |
for(InstructionItem instructionItem : instructionItems) {
|
| - |
|
249 |
instructionItemIds.add(instructionItem.getId());
|
| - |
|
250 |
}
|
| - |
|
251 |
return instructionItemIds;
|
| - |
|
252 |
}
|
| - |
|
253 |
|
| - |
|
254 |
|
| - |
|
255 |
private Map<Integer, Integer> instructionItemDetailsToItemIdQuantityMap(List<InstructionItemDetail> instructionItemDetails) {
|
| - |
|
256 |
Map<Integer, Integer> itemIdQuantityMap = new HashMap<>();
|
| - |
|
257 |
for(InstructionItemDetail instructionItemDetail : instructionItemDetails) {
|
| - |
|
258 |
if(!itemIdQuantityMap.containsKey(instructionItemDetail.getItemId())) {
|
| - |
|
259 |
itemIdQuantityMap.put(instructionItemDetail.getItemId(), instructionItemDetail.getQuantity());
|
| - |
|
260 |
}else {
|
| - |
|
261 |
itemIdQuantityMap.put(instructionItemDetail.getItemId(), itemIdQuantityMap.get(instructionItemDetail.getItemId()) + instructionItemDetail.getQuantity());
|
| - |
|
262 |
}
|
| - |
|
263 |
}
|
| - |
|
264 |
return itemIdQuantityMap;
|
| - |
|
265 |
}
|
| - |
|
266 |
|
| - |
|
267 |
private Map<Integer, List<InstructionItemDetail>> instructionItemsToInstructionItemIdInstructionItemDetailsMap(List<InstructionItemDetail> instructionItemDetails){
|
| - |
|
268 |
//Set<Integer> instructionItemIds = this.instructionItemsToInstructionItemIds(instructionItems);
|
| - |
|
269 |
//List<InstructionItemDetail> instructionItemDetails = instructionItemDetailRepository.selectByInstructionItemIds(instructionItemIds);
|
| - |
|
270 |
Map<Integer, List<InstructionItemDetail>> instructionIdInstructionItemDetailMap = new HashMap<>();
|
| - |
|
271 |
for(InstructionItemDetail instructionItemDetail : instructionItemDetails) {
|
| - |
|
272 |
if(!instructionIdInstructionItemDetailMap.containsKey(instructionItemDetail.getInstructionItemId())) {
|
| - |
|
273 |
List<InstructionItemDetail> instructionItemDetailsList = new ArrayList<>();
|
| - |
|
274 |
instructionItemDetailsList.add(instructionItemDetail);
|
| - |
|
275 |
instructionIdInstructionItemDetailMap.put(instructionItemDetail.getInstructionItemId(), instructionItemDetailsList);
|
| - |
|
276 |
}else {
|
| - |
|
277 |
instructionIdInstructionItemDetailMap.get(instructionItemDetail.getInstructionItemId()).add(instructionItemDetail);
|
| - |
|
278 |
}
|
| - |
|
279 |
}
|
| - |
|
280 |
return instructionIdInstructionItemDetailMap;
|
| - |
|
281 |
}
|
| - |
|
282 |
|
| - |
|
283 |
private Set<Integer> instructionItemDetailsToItemIds(List<InstructionItemDetail> instructionItemDetails){
|
| - |
|
284 |
Set<Integer> itemIds = new HashSet<>();
|
| - |
|
285 |
for(InstructionItemDetail instructionItemDetail : instructionItemDetails) {
|
| - |
|
286 |
itemIds.add(instructionItemDetail.getItemId());
|
| - |
|
287 |
}
|
| - |
|
288 |
return itemIds;
|
| - |
|
289 |
}
|
| - |
|
290 |
|
| - |
|
291 |
private Set<Integer> adminDeliveryNotesToWarehouseIds(List<AdminDeliveryNote> adminDeliveryNotes){
|
| - |
|
292 |
Set<Integer> warehouseIds = new HashSet<>();
|
| - |
|
293 |
for(AdminDeliveryNote adminDeliveryNote : adminDeliveryNotes) {
|
| - |
|
294 |
warehouseIds.add(adminDeliveryNote.getWarehouseId());
|
| - |
|
295 |
}
|
| - |
|
296 |
return warehouseIds;
|
| - |
|
297 |
}
|
| - |
|
298 |
|
| - |
|
299 |
private Set<Integer> adminDeliveryNotesToFofoIds(List<AdminDeliveryNote> adminDeliveryNotes){
|
| - |
|
300 |
Set<Integer> fofoIds = new HashSet<>();
|
| - |
|
301 |
for(AdminDeliveryNote adminDeliveryNote : adminDeliveryNotes) {
|
| - |
|
302 |
fofoIds.add(adminDeliveryNote.getFofoId());
|
| - |
|
303 |
}
|
| - |
|
304 |
return fofoIds;
|
| - |
|
305 |
}
|
| - |
|
306 |
|
| - |
|
307 |
|
| 187 |
@RequestMapping(value = "/createItem", method = RequestMethod.GET)
|
308 |
@RequestMapping(value = "/createItem", method = RequestMethod.GET)
|
| 188 |
public String createItem(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException{
|
309 |
public String createItem(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException{
|
| 189 |
LOGGER.info("Request Received at url {}", request.getRequestURI());
|
310 |
LOGGER.info("Request Received at url {}", request.getRequestURI());
|
| 190 |
List<Item> items = itemRepository.selectAll(offset, limit);
|
311 |
List<Item> items = itemRepository.selectAll(offset, limit);
|
| 191 |
long size = itemRepository.selectAllCount();
|
312 |
long size = itemRepository.selectAllCount();
|
| Line 240... |
Line 361... |
| 240 |
|
361 |
|
| 241 |
@RequestMapping(value = "/scanInItems", method = RequestMethod.POST)
|
362 |
@RequestMapping(value = "/scanInItems", method = RequestMethod.POST)
|
| 242 |
public String scanInItems(HttpServletRequest request, @RequestBody ScanInItemRequest scanInItemRequest, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException{
|
363 |
public String scanInItems(HttpServletRequest request, @RequestBody ScanInItemRequest scanInItemRequest, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException{
|
| 243 |
LOGGER.info("Request Received at url {} with body {}", request.getRequestURI(), scanInItemRequest);
|
364 |
LOGGER.info("Request Received at url {} with body {}", request.getRequestURI(), scanInItemRequest);
|
| 244 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
365 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
366 |
List<Integer> warehouseIds = userWarehouseRepository.selectWarehouseIdsByUserId(loginDetails.getFofoId());
|
| 245 |
List<Item> items = itemRepository.selectAll();
|
367 |
List<Item> items = itemRepository.selectAll();
|
| 246 |
inventoryService.scanInItem(scanInItemRequest, loginDetails.getFofoId());
|
368 |
inventoryService.scanInItem(scanInItemRequest, loginDetails.getFofoId());
|
| 247 |
List<AdminCurrentInventorySnapshot> adminCurrentInventorySnapshots = adminCurrentInventorySnapshotRepository.selectAllByAdminId(loginDetails.getFofoId(), offset, limit);
|
369 |
List<AdminCurrentInventorySnapshot> adminCurrentInventorySnapshots = adminCurrentInventorySnapshotRepository.selectAllByAdminId(loginDetails.getFofoId(), offset, limit);
|
| 248 |
Map<Integer, String> itemIdDescriptionMap = this.adminCurrentInventorySnapshotsToItemIdDescriptionMap(adminCurrentInventorySnapshots);
|
370 |
Map<Integer, String> itemIdDescriptionMap = this.adminCurrentInventorySnapshotsToItemIdDescriptionMap(adminCurrentInventorySnapshots);
|
| 249 |
long size = adminCurrentInventorySnapshotRepository.selectAllCountByAdminId(loginDetails.getFofoId());
|
371 |
long size = adminCurrentInventorySnapshotRepository.selectAllCountByAdminId(loginDetails.getFofoId());
|
| - |
|
372 |
if(!warehouseIds.isEmpty()) {
|
| - |
|
373 |
model.addAttribute("warehouses", warehouseRepository.selectByIds(new HashSet<>(warehouseIds)));
|
| - |
|
374 |
}
|
| 250 |
model.addAttribute("items", items);
|
375 |
model.addAttribute("items", items);
|
| 251 |
model.addAttribute("adminCurrentInventorySnapshots", adminCurrentInventorySnapshots);
|
376 |
model.addAttribute("adminCurrentInventorySnapshots", adminCurrentInventorySnapshots);
|
| 252 |
model.addAttribute("itemIdDescriptionMap", itemIdDescriptionMap);
|
377 |
model.addAttribute("itemIdDescriptionMap", itemIdDescriptionMap);
|
| 253 |
model.addAttribute("start", offset + 1);
|
378 |
model.addAttribute("start", offset + 1);
|
| 254 |
model.addAttribute("size", size);
|
379 |
model.addAttribute("size", size);
|
| Line 262... |
Line 387... |
| 262 |
|
387 |
|
| 263 |
@RequestMapping(value = "/getScanInItems", method = RequestMethod.GET)
|
388 |
@RequestMapping(value = "/getScanInItems", method = RequestMethod.GET)
|
| 264 |
public String getScanInItems(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException{
|
389 |
public String getScanInItems(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException{
|
| 265 |
LOGGER.info("Request Received at url {}", request.getRequestURI());
|
390 |
LOGGER.info("Request Received at url {}", request.getRequestURI());
|
| 266 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
391 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
392 |
List<Integer> warehouseIds = userWarehouseRepository.selectWarehouseIdsByUserId(loginDetails.getFofoId());
|
| 267 |
List<Item> items = itemRepository.selectAll();
|
393 |
List<Item> items = itemRepository.selectAll();
|
| 268 |
List<AdminCurrentInventorySnapshot> adminCurrentInventorySnapshots = adminCurrentInventorySnapshotRepository.selectAllByAdminId(loginDetails.getFofoId(), offset, limit);
|
394 |
List<AdminCurrentInventorySnapshot> adminCurrentInventorySnapshots = adminCurrentInventorySnapshotRepository.selectAllByAdminId(loginDetails.getFofoId(), offset, limit);
|
| 269 |
Map<Integer, String> itemIdDescriptionMap = this.adminCurrentInventorySnapshotsToItemIdDescriptionMap(adminCurrentInventorySnapshots);
|
395 |
Map<Integer, String> itemIdDescriptionMap = this.adminCurrentInventorySnapshotsToItemIdDescriptionMap(adminCurrentInventorySnapshots);
|
| 270 |
long size = adminCurrentInventorySnapshotRepository.selectAllCountByAdminId(loginDetails.getFofoId());
|
396 |
long size = adminCurrentInventorySnapshotRepository.selectAllCountByAdminId(loginDetails.getFofoId());
|
| - |
|
397 |
if(!warehouseIds.isEmpty()) {
|
| - |
|
398 |
model.addAttribute("warehouses", warehouseRepository.selectByIds(new HashSet<>(warehouseIds)));
|
| - |
|
399 |
}
|
| 271 |
model.addAttribute("items", items);
|
400 |
model.addAttribute("items", items);
|
| 272 |
model.addAttribute("adminCurrentInventorySnapshots", adminCurrentInventorySnapshots);
|
401 |
model.addAttribute("adminCurrentInventorySnapshots", adminCurrentInventorySnapshots);
|
| 273 |
model.addAttribute("itemIdDescriptionMap", itemIdDescriptionMap);
|
402 |
model.addAttribute("itemIdDescriptionMap", itemIdDescriptionMap);
|
| 274 |
model.addAttribute("start", offset + 1);
|
403 |
model.addAttribute("start", offset + 1);
|
| 275 |
model.addAttribute("size", size);
|
404 |
model.addAttribute("size", size);
|
| Line 311... |
Line 440... |
| 311 |
model.addAttribute("end", offset + limit);
|
440 |
model.addAttribute("end", offset + limit);
|
| 312 |
}
|
441 |
}
|
| 313 |
return "scan-in-partner-items";
|
442 |
return "scan-in-partner-items";
|
| 314 |
}
|
443 |
}
|
| 315 |
|
444 |
|
| 316 |
@RequestMapping(value = "/scanInPartnerItems", method = RequestMethod.GET)
|
445 |
@RequestMapping(value = "/scanInPartnerItems", method = RequestMethod.POST)
|
| 317 |
public String getScanInPartnerItems(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.DELIVERY_NOTE_ID) String deliveryNoteId, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException{
|
446 |
public String getScanInPartnerItems(HttpServletRequest request, @RequestBody ScanInPartnerItemRequest scanInPartnerItemRequest, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException{
|
| 318 |
LOGGER.info("Request Received at url {}", request.getRequestURI());
|
447 |
LOGGER.info("Request Received at url {}", request.getRequestURI());
|
| 319 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
448 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 320 |
inventoryService.scanInPartnerItem(deliveryNoteId, loginDetails.getFofoId());
|
449 |
inventoryService.scanInPartnerItem(scanInPartnerItemRequest, loginDetails.getFofoId());
|
| 321 |
List<PartnerCurrentInventorySnapshot> partnerCurrentInventorySnapshots = partnerCurrentInventorySnapshotRepository.selectAllByFofoId(loginDetails.getFofoId(), offset, limit);
|
450 |
List<PartnerCurrentInventorySnapshot> partnerCurrentInventorySnapshots = partnerCurrentInventorySnapshotRepository.selectAllByFofoId(loginDetails.getFofoId(), offset, limit);
|
| 322 |
Map<Integer, String> itemIdDescriptionMap = this.partnerCurrentInventorySnapshotsToItemIdDescriptionMap(partnerCurrentInventorySnapshots);
|
451 |
Map<Integer, String> itemIdDescriptionMap = this.partnerCurrentInventorySnapshotsToItemIdDescriptionMap(partnerCurrentInventorySnapshots);
|
| 323 |
long size = partnerCurrentInventorySnapshotRepository.selectAllCountByFofoId(loginDetails.getFofoId());
|
452 |
long size = partnerCurrentInventorySnapshotRepository.selectAllCountByFofoId(loginDetails.getFofoId());
|
| 324 |
model.addAttribute("partnerCurrentInventorySnapshots", partnerCurrentInventorySnapshots);
|
453 |
model.addAttribute("partnerCurrentInventorySnapshots", partnerCurrentInventorySnapshots);
|
| 325 |
model.addAttribute("itemIdDescriptionMap", itemIdDescriptionMap);
|
454 |
model.addAttribute("itemIdDescriptionMap", itemIdDescriptionMap);
|
| Line 341... |
Line 470... |
| 341 |
model.addAttribute("partnerCurrentInventorySnapshots", partnerCurrentInventorySnapshots);
|
470 |
model.addAttribute("partnerCurrentInventorySnapshots", partnerCurrentInventorySnapshots);
|
| 342 |
model.addAttribute("itemIdDescriptionMap", itemIdDescriptionMap);
|
471 |
model.addAttribute("itemIdDescriptionMap", itemIdDescriptionMap);
|
| 343 |
return "scan-in-partner-items-paginated";
|
472 |
return "scan-in-partner-items-paginated";
|
| 344 |
}
|
473 |
}
|
| 345 |
|
474 |
|
| - |
|
475 |
private Map<Integer, Integer> partnerCurrentInventorySnapshotsItemIdQuantityMap(List<PartnerCurrentInventorySnapshot> partnerCurrentInventorySnapshots){
|
| - |
|
476 |
Map<Integer, Integer> itemIdQuantityMap = new HashMap<>();
|
| - |
|
477 |
for(PartnerCurrentInventorySnapshot partnerCurrentInventorySnapshot : partnerCurrentInventorySnapshots) {
|
| - |
|
478 |
itemIdQuantityMap.put(partnerCurrentInventorySnapshot.getItemId(), partnerCurrentInventorySnapshot.getAvailability());
|
| - |
|
479 |
}
|
| - |
|
480 |
return itemIdQuantityMap;
|
| - |
|
481 |
}
|
| - |
|
482 |
|
| - |
|
483 |
@RequestMapping(value = "/getScanOutPartnerItems", method = RequestMethod.GET)
|
| - |
|
484 |
public String getScanOutPartnerItems(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException{
|
| - |
|
485 |
LOGGER.info("Request Received at url {}", request.getRequestURI());
|
| - |
|
486 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
487 |
|
| - |
|
488 |
int addressId = retailerRegisteredAddressRepository.selectAddressIdByRetailerId(loginDetails.getFofoId());
|
| - |
|
489 |
Address address = addressRepository.selectById(addressId);
|
| - |
|
490 |
|
| - |
|
491 |
List<PartnerCurrentInventorySnapshot> partnerCurrentInventorySnapshots = partnerCurrentInventorySnapshotRepository.selectByFofoId(loginDetails.getFofoId());
|
| - |
|
492 |
Map<Integer, Integer> itemIdQuantityMap = this.partnerCurrentInventorySnapshotsItemIdQuantityMap(partnerCurrentInventorySnapshots);
|
| - |
|
493 |
List<Item> items = itemRepository.selectByIds(itemIdQuantityMap.keySet());
|
| - |
|
494 |
|
| - |
|
495 |
List<ScanOutPartnerItem> scanOutPartnerItems = scanOutPartnerItemRepository.selectAllByFofoId(loginDetails.getFofoId(), offset, limit);
|
| - |
|
496 |
Map<Integer, String> itemIdDescriptionMap = this.scanOutPartnerItemsToItemIdDescriptionMap(scanOutPartnerItems);
|
| - |
|
497 |
long size = scanOutPartnerItemRepository.selectCountByFofoId(loginDetails.getFofoId());
|
| - |
|
498 |
model.addAttribute("items", items);
|
| - |
|
499 |
//model.addAttribute("stateNames", Utils.getAllStateNames());
|
| - |
|
500 |
model.addAttribute("retailerStateName", address.getState());
|
| - |
|
501 |
model.addAttribute("scanOutPartnerItems", scanOutPartnerItems);
|
| - |
|
502 |
model.addAttribute("itemIdDescriptionMap", itemIdDescriptionMap);
|
| - |
|
503 |
model.addAttribute("itemIdQuantityMap", itemIdQuantityMap);
|
| - |
|
504 |
model.addAttribute("start", offset + 1);
|
| - |
|
505 |
model.addAttribute("size", size);
|
| - |
|
506 |
if (scanOutPartnerItems.size() < limit){
|
| - |
|
507 |
model.addAttribute("end", offset + scanOutPartnerItems.size());
|
| - |
|
508 |
}else{
|
| - |
|
509 |
model.addAttribute("end", offset + limit);
|
| - |
|
510 |
}
|
| - |
|
511 |
return "scan-out-partner-items";
|
| - |
|
512 |
}
|
| - |
|
513 |
|
| - |
|
514 |
@RequestMapping(value = "/instructionItem", method = RequestMethod.POST)
|
| - |
|
515 |
public String instructionItems(HttpServletRequest request, @RequestBody InstructionItemRequest instructionItemRequest, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException{
|
| - |
|
516 |
LOGGER.info("Request Received at url {} with body {}", request.getRequestURI(), instructionItemRequest);
|
| - |
|
517 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
518 |
inventoryService.instructionItem(instructionItemRequest, loginDetails.getFofoId());
|
| - |
|
519 |
return this.getInstructionItems(request, offset, limit, model);
|
| - |
|
520 |
}
|
| - |
|
521 |
|
| - |
|
522 |
@RequestMapping(value = "/getInstructionItems", method = RequestMethod.GET)
|
| - |
|
523 |
public String getInstructionItems(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException{
|
| - |
|
524 |
LOGGER.info("Request Received at url {}", request.getRequestURI());
|
| - |
|
525 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
526 |
|
| - |
|
527 |
List<InstructionItem> instructionItems = instructionItemRepository.selectAllByAdminId(loginDetails.getFofoId(), offset, limit);
|
| - |
|
528 |
|
| - |
|
529 |
Set<Integer> instructionItemWarehouseIds = this.instructionItemsToWarehouseIds(instructionItems);
|
| - |
|
530 |
|
| - |
|
531 |
List<Warehouse> warehouses = new ArrayList<>();
|
| - |
|
532 |
if(!instructionItemWarehouseIds.isEmpty()) {
|
| - |
|
533 |
warehouses = warehouseRepository.selectByIds(instructionItemWarehouseIds);
|
| - |
|
534 |
}
|
| - |
|
535 |
Map<Integer, String> warehouseIdNameMap = this.warehouseIdNameMap(warehouses);
|
| - |
|
536 |
|
| - |
|
537 |
List<Integer> warehouseIds = userWarehouseRepository.selectWarehouseIdsByUserId(loginDetails.getFofoId());
|
| - |
|
538 |
if(!warehouseIds.isEmpty()) {
|
| - |
|
539 |
model.addAttribute("warehouses", warehouseRepository.selectByIds(new HashSet<>(warehouseIds)));
|
| - |
|
540 |
}
|
| - |
|
541 |
Map<Integer, String> fofoIdEmailIdMap = retailerService.getAllFofoRetailerIdEmailIdMap();
|
| - |
|
542 |
model.addAttribute("fofoIdEmailIdMap", fofoIdEmailIdMap);
|
| - |
|
543 |
|
| - |
|
544 |
long size = instructionItemRepository.selectCountByAdminId(loginDetails.getFofoId());
|
| - |
|
545 |
model.addAttribute("warehouseIdNameMap", warehouseIdNameMap);
|
| - |
|
546 |
model.addAttribute("instructionItems", instructionItems);
|
| - |
|
547 |
model.addAttribute("start", offset + 1);
|
| - |
|
548 |
model.addAttribute("size", size);
|
| - |
|
549 |
if (instructionItems.size() < limit){
|
| - |
|
550 |
model.addAttribute("end", offset + instructionItems.size());
|
| - |
|
551 |
}else{
|
| - |
|
552 |
model.addAttribute("end", offset + limit);
|
| - |
|
553 |
}
|
| - |
|
554 |
|
| - |
|
555 |
return "instruction-items";
|
| - |
|
556 |
}
|
| - |
|
557 |
|
| - |
|
558 |
@RequestMapping(value = "/getPaginatedInstructionItems", method = RequestMethod.GET)
|
| - |
|
559 |
public String getPaginatedInstructionItems(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException{
|
| - |
|
560 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
561 |
List<InstructionItem> instructionItems = instructionItemRepository.selectAllByAdminId(loginDetails.getFofoId(), offset, limit);
|
| - |
|
562 |
|
| - |
|
563 |
Set<Integer> warehouseIds = this.instructionItemsToWarehouseIds(instructionItems);
|
| - |
|
564 |
List<Warehouse> warehouses = warehouseRepository.selectByIds(warehouseIds);
|
| - |
|
565 |
Map<Integer, String> warehouseIdNameMap = this.warehouseIdNameMap(warehouses);
|
| - |
|
566 |
|
| - |
|
567 |
model.addAttribute("warehouseIdNameMap", warehouseIdNameMap);
|
| - |
|
568 |
model.addAttribute("instructionItems", instructionItems);
|
| - |
|
569 |
return "scan-out-partner-items-paginated";
|
| - |
|
570 |
}
|
| - |
|
571 |
|
| - |
|
572 |
@RequestMapping(value = "/scanOutPartnerItem", method = RequestMethod.POST)
|
| - |
|
573 |
public String scanOutPartnerItems(HttpServletRequest request, @RequestBody ScanOutPartnerItemRequest scanOutPartnerItemRequest, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException{
|
| - |
|
574 |
LOGGER.info("Request Received at url {}", request.getRequestURI());
|
| - |
|
575 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
576 |
inventoryService.scanOutPartnerItem(scanOutPartnerItemRequest, loginDetails.getFofoId());
|
| - |
|
577 |
return this.scanOutPartnerItems(request, scanOutPartnerItemRequest, offset, limit, model);
|
| - |
|
578 |
}
|
| - |
|
579 |
|
| - |
|
580 |
@RequestMapping(value = "/getPaginatedScanOutPartnerItems", method = RequestMethod.GET)
|
| - |
|
581 |
public String getPaginatedScanOutPartnerItems(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException{
|
| - |
|
582 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
583 |
List<ScanOutPartnerItem> scanOutPartnerItems = scanOutPartnerItemRepository.selectAllByFofoId(loginDetails.getFofoId(), offset, limit);
|
| - |
|
584 |
Map<Integer, String> itemIdDescriptionMap = this.scanOutPartnerItemsToItemIdDescriptionMap(scanOutPartnerItems);
|
| - |
|
585 |
model.addAttribute("scanOutPartnerItems", scanOutPartnerItems);
|
| - |
|
586 |
model.addAttribute("itemIdDescriptionMap", itemIdDescriptionMap);
|
| - |
|
587 |
return "scan-out-partner-items-paginated";
|
| - |
|
588 |
}
|
| - |
|
589 |
|
| 346 |
@RequestMapping(value = "/deliveryNoteDetails", method = RequestMethod.GET)
|
590 |
@RequestMapping(value = "/deliveryNoteDetails", method = RequestMethod.GET)
|
| 347 |
public ResponseEntity<?> deliveryNoteDetails(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.DELIVERY_NOTE_ID) String deliveryNoteId) throws ProfitMandiBusinessException{
|
591 |
public String deliveryNoteDetails(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.DELIVERY_NOTE_ID) String deliveryNoteId, Model model) throws ProfitMandiBusinessException{
|
| 348 |
LOGGER.info("Request Received at url {}", request.getRequestURI());
|
592 |
LOGGER.info("Request Received at url {}", request.getRequestURI());
|
| 349 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
593 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 350 |
return responseSender.ok(inventoryService.getDeliveryNoteDetailsMap(deliveryNoteId, loginDetails.getFofoId()));
|
594 |
AdminDeliveryNote adminDeliveryNote = adminDeliveryNoteRepository.selectByDeliveryNoteIdAndFofoid(deliveryNoteId, loginDetails.getFofoId());
|
| - |
|
595 |
if(adminDeliveryNote.getCompleteTimestamp() != null) {
|
| - |
|
596 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.DELIVERY_NOTE_ID + ", " + ProfitMandiConstants.FOFO_ID, deliveryNoteId + ", " + loginDetails.getFofoId(), "NNBLBL_ITM_1002");
|
| - |
|
597 |
}
|
| - |
|
598 |
Warehouse warehouse = warehouseRepository.selectId(adminDeliveryNote.getWarehouseId());
|
| - |
|
599 |
List<Integer> instructionItemIds = adminDeliveryNoteDetailRepository.selectInstructionItemIdsByDeliveryNoteId(deliveryNoteId);
|
| - |
|
600 |
List<InstructionItemDetail> instructionItemDetails = instructionItemDetailRepository.selectByInstructionItemIds(new HashSet<>(instructionItemIds));
|
| - |
|
601 |
Map<Integer, Integer> itemIdQuantityMap = this.instructionItemDetailsToItemIdQuantityMap(instructionItemDetails);
|
| - |
|
602 |
Map<Integer, String> itemIdDescriptionMap = this.itemIdDescriptionMap(itemIdQuantityMap.keySet());
|
| - |
|
603 |
Map<Integer, String> itemIdTypeMap = this.itemIdTypeMap(itemIdQuantityMap.keySet());
|
| - |
|
604 |
model.addAttribute("deliveryNoteId", deliveryNoteId);
|
| - |
|
605 |
model.addAttribute("warehouseName", warehouse.getName());
|
| - |
|
606 |
model.addAttribute("itemIdQuantityMap", itemIdQuantityMap);
|
| - |
|
607 |
model.addAttribute("itemIdDescriptionMap", itemIdDescriptionMap);
|
| - |
|
608 |
model.addAttribute("itemIdTypeMap", itemIdTypeMap);
|
| - |
|
609 |
return "delivery-note-details";
|
| 351 |
}
|
610 |
}
|
| 352 |
|
611 |
|
| 353 |
@RequestMapping(value = "/getItemsByWarehouseId", method = RequestMethod.GET)
|
612 |
@RequestMapping(value = "/getItemsByWarehouseId", method = RequestMethod.GET)
|
| 354 |
public String getItemsByWarehouseId(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.WAREHOUSE_ID) int warehouseId, Model model) throws ProfitMandiBusinessException{
|
613 |
public String getItemsByWarehouseId(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.WAREHOUSE_ID) int warehouseId, Model model) throws ProfitMandiBusinessException{
|
| 355 |
LOGGER.info("Request Received at url {}", request.getRequestURI());
|
614 |
LOGGER.info("Request Received at url {}", request.getRequestURI());
|
| Line 359... |
Line 618... |
| 359 |
model.addAttribute("itemIdDescriptionMap", itemIdDescriptionMap);
|
618 |
model.addAttribute("itemIdDescriptionMap", itemIdDescriptionMap);
|
| 360 |
model.addAttribute("itemIdTypeMap", itemIdTypeMap);
|
619 |
model.addAttribute("itemIdTypeMap", itemIdTypeMap);
|
| 361 |
return "warehouse-items";
|
620 |
return "warehouse-items";
|
| 362 |
}
|
621 |
}
|
| 363 |
|
622 |
|
| - |
|
623 |
@RequestMapping(value = "/getInstructionItemsByWarehouseId", method = RequestMethod.GET)
|
| - |
|
624 |
public String getInstructionItemsByWarehouseId(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.WAREHOUSE_ID) int warehouseId, Model model) throws ProfitMandiBusinessException{
|
| - |
|
625 |
LOGGER.info("Request Received at url {}", request.getRequestURI());
|
| - |
|
626 |
List<AdminCurrentInventorySnapshot> adminCurrentInventorySnapshots = adminCurrentInventorySnapshotRepository.selectAllAvailableByWarehouseId(warehouseId);
|
| - |
|
627 |
Map<Integer, String> itemIdDescriptionMap = this.adminCurrentInventorySnapshotsToItemIdDescriptionMap(adminCurrentInventorySnapshots);
|
| - |
|
628 |
Map<Integer, String> itemIdTypeMap = this.adminCurrentInventorySnapshotsToItemIdTypeMap(adminCurrentInventorySnapshots);
|
| - |
|
629 |
model.addAttribute("itemIdDescriptionMap", itemIdDescriptionMap);
|
| - |
|
630 |
model.addAttribute("itemIdTypeMap", itemIdTypeMap);
|
| - |
|
631 |
return "warehouse-instruction-items";
|
| - |
|
632 |
}
|
| - |
|
633 |
|
| - |
|
634 |
@RequestMapping(value = "/getPendingInstructionItems", method = RequestMethod.GET)
|
| - |
|
635 |
public String getPendingInstructionItems(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.WAREHOUSE_ID) int warehouseId, @RequestParam(name = ProfitMandiConstants.USER_ID) int userId, Model model) throws ProfitMandiBusinessException{
|
| - |
|
636 |
LOGGER.info("Request Received at url {}", request.getRequestURI());
|
| - |
|
637 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
638 |
List<InstructionItem> instructionItems = instructionItemRepository.selectByAdminIdWarehouseIdUserIdStatus(loginDetails.getFofoId(), warehouseId, userId, InstructionItemStatus.PENDING);
|
| - |
|
639 |
Set<Integer> instructionItemIds = this.instructionItemsToInstructionItemIds(instructionItems);
|
| - |
|
640 |
List<InstructionItemDetail> instructionItemDetails = instructionItemDetailRepository.selectByInstructionItemIds(instructionItemIds);
|
| - |
|
641 |
Set<Integer> itemIds = this.instructionItemDetailsToItemIds(instructionItemDetails);
|
| - |
|
642 |
Map<Integer, List<InstructionItemDetail>> instructionItemIdInstructionItemDetailsMap = this.instructionItemsToInstructionItemIdInstructionItemDetailsMap(instructionItemDetails);
|
| - |
|
643 |
Map<Integer, String> itemIdDescriptionMap = this.itemIdDescriptionMap(itemIds);
|
| - |
|
644 |
Map<Integer, String> itemIdTypeMap = this.itemIdTypeMap(itemIds);
|
| - |
|
645 |
model.addAttribute("instructionItems", instructionItems);
|
| - |
|
646 |
model.addAttribute("instructionItemIdInstructionItemDetailsMap", instructionItemIdInstructionItemDetailsMap);
|
| - |
|
647 |
model.addAttribute("itemIdDescriptionMap", itemIdDescriptionMap);
|
| - |
|
648 |
model.addAttribute("itemIdTypeMap", itemIdTypeMap);
|
| - |
|
649 |
return "pending-instruction-items";
|
| - |
|
650 |
}
|
| 364 |
|
651 |
|
| 365 |
@RequestMapping(value = "/getScanOutItems", method = RequestMethod.GET)
|
652 |
@RequestMapping(value = "/getScanOutItems", method = RequestMethod.GET)
|
| 366 |
public String getScanOutItems(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException{
|
653 |
public String getScanOutItems(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException{
|
| 367 |
LOGGER.info("Request Received at url {}", request.getRequestURI());
|
654 |
LOGGER.info("Request Received at url {}", request.getRequestURI());
|
| - |
|
655 |
//List<AdminCurrentInventorySnapshot> adminCurrentInventorySnapshots = adminCurrentInventorySnapshotRepository.selectAll();
|
| - |
|
656 |
//Set<Integer> adminIds = this.getAdminIds(adminCurrentInventorySnapshots);
|
| - |
|
657 |
//Map<Integer, String> adminIdEmailIdMap = retailerService.getAllFofoRetailerIdEmailIdMap(adminIds);
|
| - |
|
658 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
659 |
List<InstructionItem> instructionItems = instructionItemRepository.selectByAdminIdStatus(loginDetails.getFofoId(), InstructionItemStatus.PENDING);
|
| - |
|
660 |
|
| 368 |
List<Warehouse> warehouses = warehouseRepository.selectAll();
|
661 |
List<Warehouse> warehouses = new ArrayList<>();
|
| - |
|
662 |
Map<Integer, String> fofoIdEmailIdMap = new HashMap<>();
|
| - |
|
663 |
if(!instructionItems.isEmpty()) {
|
| - |
|
664 |
Set<Integer> warehouseIds = this.instructionItemsToWarehouseIds(instructionItems);
|
| - |
|
665 |
warehouses = warehouseRepository.selectByIds(warehouseIds);
|
| - |
|
666 |
Set<Integer> fofoIds = this.instructionItemsToFofoIds(instructionItems);
|
| - |
|
667 |
fofoIdEmailIdMap = retailerService.getAllFofoRetailerIdEmailIdMap(fofoIds);
|
| - |
|
668 |
}
|
| - |
|
669 |
|
| 369 |
List<AdminDeliveryNote> adminDeliveryNotes = adminDeliveryNoteRepository.selectAll(offset, limit);
|
670 |
List<AdminDeliveryNote> adminDeliveryNotes = adminDeliveryNoteRepository.selectAll(offset, limit);
|
| - |
|
671 |
Map<Integer, String> warehouseIdNameMap = new HashMap<>();
|
| - |
|
672 |
if(!adminDeliveryNotes.isEmpty()) {
|
| 370 |
Map<Integer, String> itemIdDescriptionMap = this.adminDeliveryNotesToItemIdDescriptionMap(adminDeliveryNotes);
|
673 |
List<Warehouse> adminDeliveryNoteWarehouses = warehouseRepository.selectByIds(this.adminDeliveryNotesToWarehouseIds(adminDeliveryNotes));
|
| 371 |
Map<Integer, String> warehouseIdNameMap = this.warehouseIdNameMap(warehouses);
|
674 |
warehouseIdNameMap = this.warehouseIdNameMap(adminDeliveryNoteWarehouses);
|
| 372 |
Map<Integer, String> fofoIdEmailIdMap = retailerService.getAllFofoRetailerIdEmailIdMap();
|
675 |
fofoIdEmailIdMap = retailerService.getAllFofoRetailerIdEmailIdMap(this.adminDeliveryNotesToFofoIds(adminDeliveryNotes));
|
| - |
|
676 |
}
|
| 373 |
long size = adminDeliveryNoteRepository.selectAllCount();
|
677 |
long size = adminDeliveryNoteRepository.selectAllCount();
|
| - |
|
678 |
//model.addAttribute("adminIdEmailIdMap", adminIdEmailIdMap);
|
| 374 |
model.addAttribute("adminDeliveryNotes", adminDeliveryNotes);
|
679 |
model.addAttribute("adminDeliveryNotes", adminDeliveryNotes);
|
| - |
|
680 |
model.addAttribute("warehouses", warehouses);
|
| 375 |
model.addAttribute("warehouseIdNameMap", warehouseIdNameMap);
|
681 |
model.addAttribute("warehouseIdNameMap", warehouseIdNameMap);
|
| 376 |
model.addAttribute("fofoIdEmailIdMap", fofoIdEmailIdMap);
|
682 |
model.addAttribute("fofoIdEmailIdMap", fofoIdEmailIdMap);
|
| 377 |
model.addAttribute("itemIdDescriptionMap", itemIdDescriptionMap);
|
- |
|
| 378 |
model.addAttribute("start", offset + 1);
|
683 |
model.addAttribute("start", offset + 1);
|
| 379 |
model.addAttribute("size", size);
|
684 |
model.addAttribute("size", size);
|
| 380 |
if (adminDeliveryNotes.size() < limit){
|
685 |
if (adminDeliveryNotes.size() < limit){
|
| 381 |
model.addAttribute("end", offset + adminDeliveryNotes.size());
|
686 |
model.addAttribute("end", offset + adminDeliveryNotes.size());
|
| 382 |
}else{
|
687 |
}else{
|
| 383 |
model.addAttribute("end", offset + limit);
|
688 |
model.addAttribute("end", offset + limit);
|
| 384 |
}
|
689 |
}
|
| 385 |
return "scan-out-items";
|
690 |
return "scan-out-items";
|
| 386 |
}
|
691 |
}
|
| 387 |
|
692 |
|
| - |
|
693 |
|
| - |
|
694 |
|
| 388 |
@RequestMapping(value = "/scanOutItems", method = RequestMethod.POST)
|
695 |
@RequestMapping(value = "/scanOutItems", method = RequestMethod.POST)
|
| 389 |
public String scanOutItems(HttpServletRequest request, @RequestBody ScanOutItemRequest scanOutItemRequest, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException{
|
696 |
public String scanOutItems(HttpServletRequest request, @RequestBody ScanOutItemRequest scanOutItemRequest, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException{
|
| 390 |
LOGGER.info("Request Received at url {} with body {}", request.getRequestURI(), scanOutItemRequest);
|
697 |
LOGGER.info("Request Received at url {} with body {}", request.getRequestURI(), scanOutItemRequest);
|
| 391 |
inventoryService.scanOutItem(scanOutItemRequest);
|
- |
|
| 392 |
List<Warehouse> warehouses = warehouseRepository.selectAll();
|
- |
|
| 393 |
List<AdminDeliveryNote> adminDeliveryNotes = adminDeliveryNoteRepository.selectAll(offset, limit);
|
- |
|
| 394 |
Map<Integer, String> itemIdDescriptionMap = this.adminDeliveryNotesToItemIdDescriptionMap(adminDeliveryNotes);
|
- |
|
| 395 |
Map<Integer, String> warehouseIdNameMap = this.warehouseIdNameMap(warehouses);
|
- |
|
| 396 |
Map<Integer, String> fofoIdEmailIdMap = retailerService.getAllFofoRetailerIdEmailIdMap();
|
- |
|
| 397 |
long size = adminDeliveryNoteRepository.selectAllCount();
|
698 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 398 |
model.addAttribute("adminDeliveryNotes", adminDeliveryNotes);
|
699 |
inventoryService.scanOutItem(scanOutItemRequest, loginDetails.getFofoId());
|
| 399 |
model.addAttribute("warehouseIdNameMap", warehouseIdNameMap);
|
- |
|
| 400 |
model.addAttribute("fofoIdEmailIdMap", fofoIdEmailIdMap);
|
- |
|
| 401 |
model.addAttribute("itemIdDescriptionMap", itemIdDescriptionMap);
|
- |
|
| 402 |
model.addAttribute("start", offset + 1);
|
- |
|
| 403 |
model.addAttribute("size", size);
|
- |
|
| 404 |
if (adminDeliveryNotes.size() < limit){
|
- |
|
| 405 |
model.addAttribute("end", offset + adminDeliveryNotes.size());
|
- |
|
| 406 |
}else{
|
- |
|
| 407 |
model.addAttribute("end", offset + limit);
|
700 |
return this.getScanOutItems(request, offset, limit, model);
|
| 408 |
}
|
- |
|
| 409 |
return "scan-out-items";
|
- |
|
| 410 |
}
|
701 |
}
|
| 411 |
|
702 |
|
| 412 |
@RequestMapping(value = "/getPaginatedScanOutItems", method = RequestMethod.GET)
|
703 |
@RequestMapping(value = "/getPaginatedScanOutItems", method = RequestMethod.GET)
|
| 413 |
public String getPaginatedScanOutItems(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException{
|
704 |
public String getPaginatedScanOutItems(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException{
|
| 414 |
LOGGER.info("Request Received at url {}", request.getRequestURI());
|
705 |
LOGGER.info("Request Received at url {}", request.getRequestURI());
|
| 415 |
List<Warehouse> warehouses = warehouseRepository.selectAll();
|
706 |
/*List<Warehouse> warehouses = warehouseRepository.selectAll();
|
| 416 |
List<AdminDeliveryNote> adminDeliveryNotes = adminDeliveryNoteRepository.selectAll(offset, limit);
|
707 |
List<AdminDeliveryNote> adminDeliveryNotes = adminDeliveryNoteRepository.selectAll(offset, limit);
|
| 417 |
Map<Integer, String> itemIdDescriptionMap = this.adminDeliveryNotesToItemIdDescriptionMap(adminDeliveryNotes);
|
708 |
Map<Integer, String> itemIdDescriptionMap = this.adminDeliveryNotesToItemIdDescriptionMap(adminDeliveryNotes);
|
| 418 |
Map<Integer, String> warehouseIdNameMap = this.warehouseIdNameMap(warehouses);
|
709 |
Map<Integer, String> warehouseIdNameMap = this.warehouseIdNameMap(warehouses);
|
| 419 |
Map<Integer, String> fofoIdEmailIdMap = retailerService.getAllFofoRetailerIdEmailIdMap();
|
710 |
Map<Integer, String> fofoIdEmailIdMap = retailerService.getAllFofoRetailerIdEmailIdMap();
|
| 420 |
model.addAttribute("adminDeliveryNotes", adminDeliveryNotes);
|
711 |
model.addAttribute("adminDeliveryNotes", adminDeliveryNotes);
|
| 421 |
model.addAttribute("warehouseIdNameMap", warehouseIdNameMap);
|
712 |
model.addAttribute("warehouseIdNameMap", warehouseIdNameMap);
|
| 422 |
model.addAttribute("fofoIdEmailIdMap", fofoIdEmailIdMap);
|
713 |
model.addAttribute("fofoIdEmailIdMap", fofoIdEmailIdMap);
|
| 423 |
model.addAttribute("itemIdDescriptionMap", itemIdDescriptionMap);
|
714 |
model.addAttribute("itemIdDescriptionMap", itemIdDescriptionMap);*/
|
| 424 |
return "scan-out-items-paginated";
|
715 |
return "scan-out-items-paginated";
|
| 425 |
}
|
716 |
}
|
| 426 |
|
717 |
|
| 427 |
@RequestMapping(value = "/getSerialNumbersByItemId", method = RequestMethod.GET)
|
718 |
@RequestMapping(value = "/getSerialNumbersByItemIdWarehouseId", method = RequestMethod.GET)
|
| 428 |
public String getSerialNumbersByItemId(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.ITEM_ID) int itemId,
|
719 |
public String getSerialNumbersByItemIdWarehouseId(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.ITEM_ID) int itemId,
|
| 429 |
@RequestParam(name = ProfitMandiConstants.WAREHOUSE_ID) int warehouseId, Model model) throws ProfitMandiBusinessException{
|
720 |
@RequestParam(name = ProfitMandiConstants.WAREHOUSE_ID) int warehouseId, Model model) throws ProfitMandiBusinessException{
|
| 430 |
int adminId = userWarehouseRepository.selectUserIdByWarehouseId(warehouseId);
|
- |
|
| 431 |
List<String> itemSerialNumbers = adminInventoryItemRepository.selectSerialNumbersByAdminIdWarehouseIdItemIdScanType(adminId, warehouseId, itemId, ScanType.IN);
|
721 |
List<String> itemSerialNumbers = adminInventoryItemRepository.selectSerialNumbersByWarehouseIdItemIdScanType(warehouseId, itemId, ScanType.IN);
|
| 432 |
model.addAttribute("itemSerialNumbers", itemSerialNumbers);
|
722 |
model.addAttribute("itemSerialNumbers", itemSerialNumbers);
|
| 433 |
return "item-serial-numbers";
|
723 |
return "item-serial-numbers";
|
| 434 |
}
|
724 |
}
|
| - |
|
725 |
|
| - |
|
726 |
@RequestMapping(value = "/getSerialNumbersByItemId", method = RequestMethod.GET)
|
| - |
|
727 |
public String getSerialNumbersByItemId(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.ITEM_ID) int itemId, Model model) throws ProfitMandiBusinessException{
|
| - |
|
728 |
List<String> itemSerialNumbers = partnerInventoryItemRepository.selectSerialNumbersByItemIdScanType(itemId, ScanType.IN);
|
| - |
|
729 |
model.addAttribute("itemSerialNumbers", itemSerialNumbers);
|
| - |
|
730 |
return "item-serial-numbers-single";
|
| - |
|
731 |
}
|
| - |
|
732 |
|
| 435 |
|
733 |
|
| 436 |
}
|
734 |
}
|