| 4687 |
mandeep.dh |
1 |
package in.shop2020.inventory.controllers;
|
|
|
2 |
|
| 4846 |
mandeep.dh |
3 |
import in.shop2020.model.v1.catalog.Item;
|
| 7410 |
amar.kumar |
4 |
import in.shop2020.model.v1.inventory.InventoryService;
|
| 5945 |
mandeep.dh |
5 |
import in.shop2020.model.v1.inventory.InventoryType;
|
|
|
6 |
import in.shop2020.model.v1.inventory.Warehouse;
|
|
|
7 |
import in.shop2020.model.v1.inventory.WarehouseType;
|
| 5110 |
mandeep.dh |
8 |
import in.shop2020.model.v1.order.LineItem;
|
| 5496 |
mandeep.dh |
9 |
import in.shop2020.purchase.Invoice;
|
| 5110 |
mandeep.dh |
10 |
import in.shop2020.purchase.PurchaseOrder;
|
| 4687 |
mandeep.dh |
11 |
import in.shop2020.purchase.PurchaseServiceException;
|
|
|
12 |
import in.shop2020.thrift.clients.CatalogClient;
|
| 7410 |
amar.kumar |
13 |
import in.shop2020.thrift.clients.HelperClient;
|
| 5945 |
mandeep.dh |
14 |
import in.shop2020.thrift.clients.InventoryClient;
|
| 4687 |
mandeep.dh |
15 |
import in.shop2020.thrift.clients.PurchaseClient;
|
|
|
16 |
import in.shop2020.thrift.clients.WarehouseClient;
|
| 7410 |
amar.kumar |
17 |
import in.shop2020.utils.HelperService;
|
| 4846 |
mandeep.dh |
18 |
import in.shop2020.utils.ModelUtils;
|
| 4687 |
mandeep.dh |
19 |
import in.shop2020.warehouse.InventoryItem;
|
|
|
20 |
import in.shop2020.warehouse.ScanType;
|
| 7410 |
amar.kumar |
21 |
import in.shop2020.warehouse.WarehouseService;
|
| 4687 |
mandeep.dh |
22 |
import in.shop2020.warehouse.WarehouseService.Client;
|
|
|
23 |
import in.shop2020.warehouse.WarehouseServiceException;
|
|
|
24 |
|
| 4846 |
mandeep.dh |
25 |
import java.util.ArrayList;
|
| 5496 |
mandeep.dh |
26 |
import java.util.Calendar;
|
|
|
27 |
import java.util.Date;
|
| 5110 |
mandeep.dh |
28 |
import java.util.HashMap;
|
| 4846 |
mandeep.dh |
29 |
import java.util.List;
|
| 5110 |
mandeep.dh |
30 |
import java.util.Map;
|
| 4846 |
mandeep.dh |
31 |
|
| 4687 |
mandeep.dh |
32 |
import javax.servlet.ServletContext;
|
|
|
33 |
|
| 5496 |
mandeep.dh |
34 |
import org.apache.commons.lang.StringUtils;
|
| 4687 |
mandeep.dh |
35 |
import org.apache.struts2.convention.annotation.Result;
|
|
|
36 |
import org.apache.struts2.convention.annotation.Results;
|
|
|
37 |
import org.apache.thrift.TException;
|
|
|
38 |
import org.apache.thrift.transport.TTransportException;
|
|
|
39 |
import org.slf4j.Logger;
|
|
|
40 |
import org.slf4j.LoggerFactory;
|
|
|
41 |
|
|
|
42 |
@SuppressWarnings("serial")
|
|
|
43 |
@Results({ @Result(name = "redirect", type = "redirectAction", params = {
|
|
|
44 |
"actionName", "warehouse" }) })
|
|
|
45 |
public class PurchaseController extends BaseController {
|
| 5110 |
mandeep.dh |
46 |
/**
|
|
|
47 |
*
|
|
|
48 |
*/
|
|
|
49 |
private static final int NUM_BULK__SCAN_ITEMS = 10;
|
|
|
50 |
private static Logger logger = LoggerFactory.getLogger(PurchaseController.class);
|
| 7410 |
amar.kumar |
51 |
public static enum ScanRecordType { VALID, BLANK };
|
| 4687 |
mandeep.dh |
52 |
|
|
|
53 |
private ServletContext context;
|
|
|
54 |
private String id;
|
| 7410 |
amar.kumar |
55 |
private Long transferLotId;
|
| 4687 |
mandeep.dh |
56 |
private String itemId;
|
|
|
57 |
private String itemNo;
|
|
|
58 |
private String errorMsg = "";
|
| 4846 |
mandeep.dh |
59 |
private List<Item> items;
|
| 5110 |
mandeep.dh |
60 |
private List<LineItem> lineItems;
|
| 5496 |
mandeep.dh |
61 |
private List<Invoice> invoices;
|
| 6630 |
amar.kumar |
62 |
|
|
|
63 |
private String invoiceNumber;
|
|
|
64 |
private Double freightCharges ;
|
|
|
65 |
private Long poId;
|
| 4687 |
mandeep.dh |
66 |
|
|
|
67 |
private String purchaseOrderId;
|
| 7410 |
amar.kumar |
68 |
private Long warehouseId;
|
|
|
69 |
private Long transferWarehouseId;
|
| 5110 |
mandeep.dh |
70 |
private Warehouse warehouse;
|
| 4687 |
mandeep.dh |
71 |
|
|
|
72 |
public String editNew() {
|
|
|
73 |
purchaseOrderId = request.getParameter("poId");
|
| 5496 |
mandeep.dh |
74 |
|
|
|
75 |
try {
|
|
|
76 |
in.shop2020.purchase.PurchaseService.Client purchaseClient = new PurchaseClient().getClient();
|
| 7410 |
amar.kumar |
77 |
//invoices = purchaseClient.getInvoices(getPreviousDay(getPreviousDay(new Date())).getTime());
|
|
|
78 |
PurchaseOrder po = purchaseClient.getPurchaseOrder(Long.parseLong(purchaseOrderId));
|
|
|
79 |
invoices = purchaseClient.getInvoicesForWarehouse(po.getWarehouseId(), po.getSupplierId(), getPreviousDay(getPreviousDay(new Date())).getTime());
|
| 5496 |
mandeep.dh |
80 |
} catch (Exception e) {
|
|
|
81 |
logger.error("Error loading invoices", e);
|
|
|
82 |
}
|
|
|
83 |
|
| 4687 |
mandeep.dh |
84 |
return "new";
|
|
|
85 |
}
|
|
|
86 |
|
| 5496 |
mandeep.dh |
87 |
private Date getPreviousDay(Date date) {
|
|
|
88 |
Calendar calendar = Calendar.getInstance();
|
|
|
89 |
calendar.setTime(date);
|
|
|
90 |
calendar.add(Calendar.DAY_OF_MONTH, -1);
|
|
|
91 |
return calendar.getTime();
|
|
|
92 |
}
|
|
|
93 |
|
| 4687 |
mandeep.dh |
94 |
public String create() {
|
| 6630 |
amar.kumar |
95 |
this.purchaseOrderId = request.getParameter("poId");
|
|
|
96 |
poId = Long.parseLong(purchaseOrderId);
|
|
|
97 |
invoiceNumber = request.getParameter("invoiceNo");
|
| 4687 |
mandeep.dh |
98 |
String fc = request.getParameter("freightCharges").trim();
|
| 6630 |
amar.kumar |
99 |
freightCharges = 0D;
|
|
|
100 |
id = "0";
|
| 4687 |
mandeep.dh |
101 |
if (fc != null && !fc.isEmpty())
|
|
|
102 |
freightCharges = Double.parseDouble(fc);
|
| 6630 |
amar.kumar |
103 |
return show();
|
|
|
104 |
//return "create";
|
| 4687 |
mandeep.dh |
105 |
|
|
|
106 |
}
|
|
|
107 |
|
|
|
108 |
public String show() {
|
| 5110 |
mandeep.dh |
109 |
resetLineItems();
|
| 6630 |
amar.kumar |
110 |
setItemsFromPO();
|
| 5110 |
mandeep.dh |
111 |
return SHOW;
|
| 4687 |
mandeep.dh |
112 |
}
|
|
|
113 |
|
| 5110 |
mandeep.dh |
114 |
private void resetLineItems() {
|
|
|
115 |
lineItems = new ArrayList<LineItem>();
|
|
|
116 |
|
|
|
117 |
for (int i = 0; i < NUM_BULK__SCAN_ITEMS; i++) {
|
|
|
118 |
LineItem lineItem = new LineItem();
|
|
|
119 |
lineItem.setId(i);
|
|
|
120 |
lineItem.setExtra_info("");
|
|
|
121 |
lineItem.setSerial_number("");
|
|
|
122 |
lineItem.setItem_number("");
|
| 5361 |
mandeep.dh |
123 |
lineItem.setQuantity(1);
|
| 5110 |
mandeep.dh |
124 |
lineItem.setItem_id(-1);
|
|
|
125 |
lineItems.add(lineItem);
|
|
|
126 |
}
|
|
|
127 |
}
|
|
|
128 |
|
| 6630 |
amar.kumar |
129 |
public boolean createPurchase(){
|
|
|
130 |
try {
|
|
|
131 |
logger.info("poId="+poId+" invoiceNumber="+invoiceNumber+" freightCharges="+freightCharges);
|
|
|
132 |
PurchaseClient purchaseClient = new PurchaseClient();
|
|
|
133 |
in.shop2020.purchase.PurchaseService.Client client = purchaseClient
|
|
|
134 |
.getClient();
|
|
|
135 |
id = "" + client.startPurchase(poId, invoiceNumber, freightCharges);
|
|
|
136 |
logger.info("id = "+id);
|
|
|
137 |
} catch (TTransportException e) {
|
|
|
138 |
errorMsg = "Error while establishing connection to the warehouse server";
|
|
|
139 |
logger.error(errorMsg, e);
|
|
|
140 |
} catch (TException e) {
|
|
|
141 |
errorMsg = "Error while scanning in the item";
|
|
|
142 |
logger.error(errorMsg, e);
|
|
|
143 |
} catch (PurchaseServiceException e) {
|
|
|
144 |
errorMsg = e.getMessage();
|
|
|
145 |
logger.error(errorMsg, e);
|
|
|
146 |
}
|
|
|
147 |
|
|
|
148 |
if (errorMsg.isEmpty())
|
|
|
149 |
return true;
|
|
|
150 |
else {
|
|
|
151 |
addActionError(errorMsg);
|
|
|
152 |
return false;
|
|
|
153 |
}
|
|
|
154 |
}
|
|
|
155 |
|
| 4687 |
mandeep.dh |
156 |
public String update() {
|
| 6630 |
amar.kumar |
157 |
setItemsFromPO();
|
| 4687 |
mandeep.dh |
158 |
|
|
|
159 |
try {
|
| 5110 |
mandeep.dh |
160 |
if (!areValidScans()) {
|
|
|
161 |
return SHOW;
|
|
|
162 |
}
|
| 6641 |
amar.kumar |
163 |
if(id == null || Long.parseLong(id)==0) {
|
|
|
164 |
if(!createPurchase()) {
|
|
|
165 |
return "new";
|
|
|
166 |
}
|
|
|
167 |
}
|
| 5110 |
mandeep.dh |
168 |
|
| 4687 |
mandeep.dh |
169 |
WarehouseClient warehouseClient = new WarehouseClient();
|
|
|
170 |
Client client = warehouseClient.getClient();
|
| 7410 |
amar.kumar |
171 |
in.shop2020.purchase.PurchaseService.Client purchaseClient = new PurchaseClient().getClient();
|
|
|
172 |
PurchaseOrder po = purchaseClient.getPurchaseOrder(poId);
|
|
|
173 |
if(transferLotId==null || transferLotId==0) {
|
|
|
174 |
if(transferWarehouseId!=null && transferWarehouseId!=0) {
|
|
|
175 |
InventoryService.Client inventoryClient = new InventoryClient().getClient();
|
|
|
176 |
Warehouse fulfilmentWarehouse = inventoryClient.getWarehouses(WarehouseType.OURS, InventoryType.GOOD, po.getSupplierId(), po.getWarehouseId(), 0L).get(0);
|
|
|
177 |
transferLotId = client.createTransferLot(po.getWarehouseId(), transferWarehouseId);
|
|
|
178 |
}
|
|
|
179 |
}
|
| 5110 |
mandeep.dh |
180 |
for (LineItem lineItem : lineItems) {
|
|
|
181 |
if (ScanRecordType.BLANK.name().equals(lineItem.getExtra_info())) {
|
|
|
182 |
continue;
|
|
|
183 |
}
|
|
|
184 |
|
| 5437 |
mandeep.dh |
185 |
InventoryItem inventoryItem = new InventoryItem();
|
|
|
186 |
inventoryItem.setItemId(lineItem.getItem_id());
|
| 6641 |
amar.kumar |
187 |
inventoryItem.setPurchaseId(Long.parseLong(id));
|
| 7410 |
amar.kumar |
188 |
inventoryItem.setCurrentQuantity(new Double(lineItem.getQuantity()).longValue());
|
| 5437 |
mandeep.dh |
189 |
inventoryItem.setItemNumber(lineItem.getItem_number());
|
|
|
190 |
inventoryItem.setSerialNumber(lineItem.getSerial_number());
|
| 5530 |
mandeep.dh |
191 |
inventoryItem.setInitialQuantity(new Double(lineItem.getQuantity()).longValue());
|
| 7410 |
amar.kumar |
192 |
inventoryItem.setPhysicalWarehouseId(po.getWarehouseId());
|
|
|
193 |
client.scan(inventoryItem, ScanType.PURCHASE, new Double(lineItem.getQuantity()).longValue(), warehouseId, (transferLotId!=null)?transferLotId:0L);
|
| 5361 |
mandeep.dh |
194 |
}
|
| 5110 |
mandeep.dh |
195 |
|
|
|
196 |
resetLineItems();
|
| 4687 |
mandeep.dh |
197 |
} catch (TTransportException e) {
|
|
|
198 |
errorMsg = "Error while establishing connection to the warehouse server";
|
|
|
199 |
logger.error(errorMsg, e);
|
|
|
200 |
} catch (WarehouseServiceException e) {
|
|
|
201 |
errorMsg = e.getMessage();
|
|
|
202 |
logger.error(errorMsg, e);
|
|
|
203 |
} catch (TException e) {
|
|
|
204 |
errorMsg = "Error while scanning in the item";
|
|
|
205 |
logger.error(errorMsg, e);
|
| 6630 |
amar.kumar |
206 |
} catch (PurchaseServiceException e) {
|
|
|
207 |
errorMsg = "Error while creating the purchase";
|
|
|
208 |
logger.error(errorMsg, e);
|
| 4687 |
mandeep.dh |
209 |
}
|
| 5110 |
mandeep.dh |
210 |
|
| 4687 |
mandeep.dh |
211 |
if (!errorMsg.isEmpty()) {
|
|
|
212 |
addActionError(errorMsg);
|
|
|
213 |
}
|
| 4846 |
mandeep.dh |
214 |
|
| 5110 |
mandeep.dh |
215 |
return SHOW;
|
| 4687 |
mandeep.dh |
216 |
}
|
|
|
217 |
|
| 5110 |
mandeep.dh |
218 |
/**
|
|
|
219 |
* @return
|
|
|
220 |
* @throws TException
|
|
|
221 |
* @throws NumberFormatException
|
| 6630 |
amar.kumar |
222 |
* @throws PurchaseServiceException
|
| 5110 |
mandeep.dh |
223 |
*/
|
| 6630 |
amar.kumar |
224 |
private boolean areValidScans() throws NumberFormatException, TException, PurchaseServiceException {
|
| 5110 |
mandeep.dh |
225 |
boolean areValidScans = true;
|
|
|
226 |
in.shop2020.purchase.PurchaseService.Client purchaseClient = new PurchaseClient().getClient();
|
| 6630 |
amar.kumar |
227 |
//PurchaseOrder purchaseOrder = purchaseClient.getPurchaseOrderForPurchase(Long.parseLong(id));
|
|
|
228 |
PurchaseOrder purchaseOrder = purchaseClient.getPurchaseOrder(poId);
|
| 5110 |
mandeep.dh |
229 |
Map<Long, Long> itemsQuantityMapFromPO = new HashMap<Long, Long>();
|
|
|
230 |
for (in.shop2020.purchase.LineItem lineItem : purchaseOrder.getLineitems()) {
|
|
|
231 |
itemsQuantityMapFromPO.put(lineItem.getItemId(), (long) lineItem.getUnfulfilledQuantity());
|
|
|
232 |
}
|
|
|
233 |
|
|
|
234 |
Client warehouseClient = new WarehouseClient().getClient();
|
|
|
235 |
for (LineItem lineItem : lineItems) {
|
|
|
236 |
if (lineItem.getItem_id() == -1 && lineItem.getItem_number().isEmpty() && lineItem.getSerial_number().isEmpty()) {
|
|
|
237 |
lineItem.setExtra_info(ScanRecordType.BLANK.name());
|
|
|
238 |
}
|
|
|
239 |
else {
|
|
|
240 |
lineItem.setExtra_info(ScanRecordType.VALID.name());
|
| 5496 |
mandeep.dh |
241 |
if (StringUtils.isNotBlank(lineItem.getSerial_number())) {
|
| 5361 |
mandeep.dh |
242 |
try {
|
| 7321 |
amit.gupta |
243 |
InventoryItem inventoryItem = warehouseClient.getInventoryItem(lineItem.getSerial_number());
|
|
|
244 |
if(inventoryItem.getLastScanType()!=ScanType.PURCHASE_RETURN) {
|
|
|
245 |
lineItem.setExtra_info("Item scanned already.");
|
|
|
246 |
areValidScans = false;
|
|
|
247 |
continue;
|
|
|
248 |
}
|
| 5496 |
mandeep.dh |
249 |
} catch (Exception e) {
|
| 5361 |
mandeep.dh |
250 |
}
|
| 5110 |
mandeep.dh |
251 |
}
|
|
|
252 |
|
| 5496 |
mandeep.dh |
253 |
if (lineItem.getItem_id() == -1 &&
|
|
|
254 |
(StringUtils.isBlank(lineItem.getItem_number()) ||
|
|
|
255 |
StringUtils.isBlank(lineItem.getSerial_number())))
|
|
|
256 |
{
|
|
|
257 |
lineItem.setExtra_info("Item not selected/Item or serial number not present");
|
| 5110 |
mandeep.dh |
258 |
areValidScans = false;
|
|
|
259 |
continue;
|
|
|
260 |
}
|
|
|
261 |
|
| 6630 |
amar.kumar |
262 |
if (StringUtils.isBlank(lineItem.getItem_number())) {
|
|
|
263 |
lineItem.setExtra_info("Item number not entered");
|
|
|
264 |
areValidScans = false;
|
|
|
265 |
continue;
|
|
|
266 |
}
|
|
|
267 |
|
| 5110 |
mandeep.dh |
268 |
if (lineItem.getItem_id() == -1) {
|
|
|
269 |
List<Long> itemIds = warehouseClient.getItemIds(lineItem.getItem_number());
|
|
|
270 |
if (itemIds.isEmpty()) {
|
|
|
271 |
lineItem.setExtra_info("Unknown item number");
|
|
|
272 |
areValidScans = false;
|
|
|
273 |
continue;
|
|
|
274 |
}
|
|
|
275 |
|
|
|
276 |
if (itemIds.size() > 0) {
|
|
|
277 |
int numItemsInPO = 0;
|
|
|
278 |
for (long itemId : itemIds) {
|
|
|
279 |
if (itemsQuantityMapFromPO.containsKey(itemId)) {
|
|
|
280 |
numItemsInPO++;
|
|
|
281 |
lineItem.setItem_id(itemId);
|
|
|
282 |
}
|
|
|
283 |
}
|
|
|
284 |
|
|
|
285 |
if (numItemsInPO > 1) {
|
|
|
286 |
lineItem.setExtra_info("Multiple items found for given item Number. Choose item explicitly.");
|
|
|
287 |
areValidScans = false;
|
| 5361 |
mandeep.dh |
288 |
continue;
|
| 5110 |
mandeep.dh |
289 |
}
|
|
|
290 |
}
|
|
|
291 |
}
|
|
|
292 |
|
|
|
293 |
if (!itemsQuantityMapFromPO.containsKey(lineItem.getItem_id())) {
|
|
|
294 |
lineItem.setExtra_info("Item not present in PO.");
|
|
|
295 |
areValidScans = false;
|
|
|
296 |
continue;
|
|
|
297 |
}
|
|
|
298 |
|
| 5361 |
mandeep.dh |
299 |
itemsQuantityMapFromPO.put(lineItem.getItem_id(),
|
|
|
300 |
itemsQuantityMapFromPO.get(lineItem.getItem_id()) - new Double(lineItem.getQuantity()).longValue());
|
| 5110 |
mandeep.dh |
301 |
|
|
|
302 |
if (itemsQuantityMapFromPO.get(lineItem.getItem_id()) < 0) {
|
|
|
303 |
lineItem.setExtra_info("Item already fulfilled in PO.");
|
|
|
304 |
areValidScans = false;
|
|
|
305 |
continue;
|
|
|
306 |
}
|
|
|
307 |
}
|
|
|
308 |
}
|
|
|
309 |
|
|
|
310 |
return areValidScans;
|
|
|
311 |
}
|
|
|
312 |
|
| 6630 |
amar.kumar |
313 |
private void setItemsFromPO() {
|
| 5110 |
mandeep.dh |
314 |
try {
|
|
|
315 |
items = new ArrayList<Item>();
|
|
|
316 |
in.shop2020.purchase.PurchaseService.Client purchaseClient = new PurchaseClient().getClient();
|
| 6630 |
amar.kumar |
317 |
//PurchaseOrder purchaseOrder = purchaseClient.getPurchaseOrderForPurchase(id);
|
|
|
318 |
PurchaseOrder purchaseOrder = purchaseClient.getPurchaseOrder(poId);
|
| 7410 |
amar.kumar |
319 |
warehouseId = purchaseOrder.getWarehouseId();
|
| 5945 |
mandeep.dh |
320 |
in.shop2020.model.v1.catalog.CatalogService.Client catalogClient = new CatalogClient().getClient();
|
| 5361 |
mandeep.dh |
321 |
|
| 5110 |
mandeep.dh |
322 |
for (in.shop2020.purchase.LineItem lineItem : purchaseOrder.getLineitems()) {
|
| 5496 |
mandeep.dh |
323 |
items.add(catalogClient.getItem(lineItem.getItemId()));
|
| 5110 |
mandeep.dh |
324 |
}
|
| 5496 |
mandeep.dh |
325 |
|
| 5945 |
mandeep.dh |
326 |
in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = new InventoryClient().getClient();
|
| 7410 |
amar.kumar |
327 |
warehouse = inventoryClient.getWarehouses(WarehouseType.OURS, InventoryType.GOOD, purchaseOrder.getSupplierId(), warehouseId, warehouseId).get(0);
|
| 5110 |
mandeep.dh |
328 |
} catch (Exception e) {
|
|
|
329 |
logger.error("Could not find items in PO with purchase: " + id, e);
|
|
|
330 |
}
|
|
|
331 |
}
|
|
|
332 |
|
| 4687 |
mandeep.dh |
333 |
public String destroy() {
|
|
|
334 |
long id = Long.parseLong(this.id);
|
|
|
335 |
|
|
|
336 |
try {
|
|
|
337 |
PurchaseClient warehouseClient = new PurchaseClient();
|
|
|
338 |
in.shop2020.purchase.PurchaseService.Client client = warehouseClient
|
|
|
339 |
.getClient();
|
|
|
340 |
client.closePurchase(id);
|
|
|
341 |
} catch (TTransportException e) {
|
|
|
342 |
errorMsg = "Error while establishing connection to the warehouse server";
|
|
|
343 |
logger.error(errorMsg, e);
|
|
|
344 |
} catch (TException e) {
|
|
|
345 |
errorMsg = "Error while scanning in the item";
|
|
|
346 |
logger.error(errorMsg, e);
|
|
|
347 |
} catch (PurchaseServiceException e) {
|
|
|
348 |
errorMsg = e.getMessage();
|
|
|
349 |
logger.error(errorMsg, e);
|
|
|
350 |
}
|
|
|
351 |
return "redirect";
|
|
|
352 |
}
|
|
|
353 |
|
|
|
354 |
public String createItemNumberMapping() {
|
|
|
355 |
long itemIdLong = Long.parseLong(itemId);
|
|
|
356 |
|
|
|
357 |
try {
|
|
|
358 |
Client warehouseClient = new WarehouseClient().getClient();
|
|
|
359 |
warehouseClient.createItemNumberMapping(itemNo, itemIdLong);
|
|
|
360 |
} catch (TTransportException e) {
|
|
|
361 |
logger.error("Could not create thrift client", e);
|
|
|
362 |
} catch (TException e) {
|
|
|
363 |
logger.error("Could not create item number mapping", e);
|
|
|
364 |
}
|
|
|
365 |
|
|
|
366 |
return show();
|
|
|
367 |
}
|
| 7410 |
amar.kumar |
368 |
|
|
|
369 |
/*public String setTransferItemsOption() {
|
|
|
370 |
boolean isTransferAllowed = false;
|
|
|
371 |
try {
|
|
|
372 |
Client warehouseClient = new WarehouseClient().getClient();
|
|
|
373 |
isTransferAllowed = warehouseClient.isItemTransferAllowed(warehouseId, transferWarehouseId);
|
|
|
374 |
} catch (TTransportException e) {
|
|
|
375 |
logger.error("Could not create thrift client", e);
|
|
|
376 |
} catch (TException e) {
|
|
|
377 |
logger.error("Could not check if item transfer allowed between warehouses", e);
|
|
|
378 |
}//TODO
|
|
|
379 |
return "";
|
|
|
380 |
}*/
|
|
|
381 |
|
|
|
382 |
public List<Warehouse> getAllowedDestinationWarehousesForTransfer(long originWarehouseId){
|
|
|
383 |
try {
|
|
|
384 |
WarehouseService.Client warehouseClient = new WarehouseClient().getClient();
|
|
|
385 |
List<Long> allowedWarehouseIds = warehouseClient.getAllowedDestinationWarehousesForTransfer(originWarehouseId);
|
|
|
386 |
List<Warehouse> allowedWarehouses = new ArrayList<Warehouse>();
|
|
|
387 |
InventoryService.Client inventoryClient = new InventoryClient().getClient();
|
|
|
388 |
for(Long allowedWarehouseId : allowedWarehouseIds) {
|
|
|
389 |
allowedWarehouses.add(inventoryClient.getWarehouse(allowedWarehouseId));
|
|
|
390 |
}
|
|
|
391 |
return allowedWarehouses;
|
|
|
392 |
} catch(Exception e) {
|
|
|
393 |
logger.error("Error while getting all destination warehouses for warehouseId " + warehouseId, e);
|
|
|
394 |
return new ArrayList<Warehouse>();
|
|
|
395 |
}
|
|
|
396 |
}
|
| 4687 |
mandeep.dh |
397 |
|
| 5110 |
mandeep.dh |
398 |
public String itemNumberMappingEditNew() {
|
|
|
399 |
return "item-number-mapping";
|
|
|
400 |
}
|
|
|
401 |
|
| 4846 |
mandeep.dh |
402 |
public String getName(Item item){
|
|
|
403 |
return ModelUtils.extractProductNameFromItem(item);
|
|
|
404 |
}
|
|
|
405 |
|
| 4687 |
mandeep.dh |
406 |
public void setId(String id) {
|
|
|
407 |
this.id = id;
|
|
|
408 |
}
|
|
|
409 |
|
|
|
410 |
public String getId() {
|
|
|
411 |
return id;
|
|
|
412 |
}
|
|
|
413 |
|
|
|
414 |
public String getErrorMessage() {
|
|
|
415 |
return errorMsg;
|
|
|
416 |
}
|
|
|
417 |
|
|
|
418 |
public String getPurchaseOrderId() {
|
|
|
419 |
return purchaseOrderId;
|
|
|
420 |
}
|
|
|
421 |
|
|
|
422 |
public String getServletContextPath() {
|
|
|
423 |
return context.getContextPath();
|
|
|
424 |
}
|
|
|
425 |
|
|
|
426 |
public String getItemId() {
|
|
|
427 |
return itemId;
|
|
|
428 |
}
|
|
|
429 |
|
|
|
430 |
public void setItemId(String itemId) {
|
|
|
431 |
this.itemId = itemId;
|
|
|
432 |
}
|
|
|
433 |
|
|
|
434 |
public String getItemNo() {
|
|
|
435 |
return itemNo;
|
|
|
436 |
}
|
|
|
437 |
|
|
|
438 |
public void setItemNo(String itemNo) {
|
|
|
439 |
this.itemNo = itemNo;
|
|
|
440 |
}
|
|
|
441 |
|
| 4846 |
mandeep.dh |
442 |
public List<Item> getItems() {
|
|
|
443 |
return items;
|
|
|
444 |
}
|
|
|
445 |
|
|
|
446 |
public void setItems(List<Item> items) {
|
|
|
447 |
this.items = items;
|
|
|
448 |
}
|
|
|
449 |
|
| 5110 |
mandeep.dh |
450 |
public List<LineItem> getLineItems() {
|
|
|
451 |
return lineItems;
|
|
|
452 |
}
|
|
|
453 |
|
|
|
454 |
public void setLineItems(List<LineItem> lineItems) {
|
|
|
455 |
this.lineItems = lineItems;
|
|
|
456 |
}
|
|
|
457 |
|
|
|
458 |
public Warehouse getWarehouse() {
|
|
|
459 |
return warehouse;
|
|
|
460 |
}
|
| 5496 |
mandeep.dh |
461 |
|
|
|
462 |
public List<Invoice> getInvoices() {
|
|
|
463 |
return invoices;
|
|
|
464 |
}
|
|
|
465 |
|
|
|
466 |
public void setInvoices(List<Invoice> invoices) {
|
|
|
467 |
this.invoices = invoices;
|
|
|
468 |
}
|
| 6630 |
amar.kumar |
469 |
|
|
|
470 |
public String getInvoiceNumber() {
|
|
|
471 |
return invoiceNumber;
|
|
|
472 |
}
|
|
|
473 |
|
|
|
474 |
public void setInvoiceNumber(String invoiceNumber) {
|
|
|
475 |
this.invoiceNumber = invoiceNumber;
|
|
|
476 |
}
|
|
|
477 |
|
|
|
478 |
public Double getFreightCharges() {
|
|
|
479 |
return freightCharges;
|
|
|
480 |
}
|
|
|
481 |
|
|
|
482 |
public void setFreightCharges(Double freightCharges) {
|
|
|
483 |
this.freightCharges = freightCharges;
|
|
|
484 |
}
|
|
|
485 |
|
|
|
486 |
public Long getPoId() {
|
|
|
487 |
return poId;
|
|
|
488 |
}
|
|
|
489 |
|
|
|
490 |
public void setPoId(Long poId) {
|
|
|
491 |
this.poId = poId;
|
|
|
492 |
}
|
| 7410 |
amar.kumar |
493 |
|
|
|
494 |
public Long getWarehouseId() {
|
|
|
495 |
return warehouseId;
|
|
|
496 |
}
|
|
|
497 |
|
|
|
498 |
public void setWarehouseId(Long warehouseId) {
|
|
|
499 |
this.warehouseId = warehouseId;
|
|
|
500 |
}
|
|
|
501 |
|
|
|
502 |
public Long getTransferWarehouseId() {
|
|
|
503 |
return transferWarehouseId;
|
|
|
504 |
}
|
|
|
505 |
|
|
|
506 |
public void setTransferWarehouseId(Long transferWarehouseId) {
|
|
|
507 |
this.transferWarehouseId = transferWarehouseId;
|
|
|
508 |
}
|
| 4687 |
mandeep.dh |
509 |
}
|