| Line 51... |
Line 51... |
| 51 |
"actionName", "warehouse" }) })
|
51 |
"actionName", "warehouse" }) })
|
| 52 |
public class BulkPurchaseController extends BaseController {
|
52 |
public class BulkPurchaseController extends BaseController {
|
| 53 |
private static Logger logger = LoggerFactory.getLogger(BulkPurchaseController.class);
|
53 |
private static Logger logger = LoggerFactory.getLogger(BulkPurchaseController.class);
|
| 54 |
private List<String> exceptionList = new ArrayList<String>();
|
54 |
private List<String> exceptionList = new ArrayList<String>();
|
| 55 |
private static final int NUM_BULK__SCAN_ITEMS = 10;
|
55 |
private static final int NUM_BULK__SCAN_ITEMS = 10;
|
| - |
|
56 |
private static final long DUMMY_VENDOR_ID = 40;
|
| 56 |
|
57 |
|
| 57 |
private ServletContext context;
|
58 |
private ServletContext context;
|
| 58 |
private String id="";
|
59 |
private String id="";
|
| 59 |
private Long transferLotId;
|
60 |
private Long transferLotId;
|
| 60 |
private String itemId;
|
61 |
private String itemId;
|
| Line 66... |
Line 67... |
| 66 |
private String bulkScanUploadItem;
|
67 |
private String bulkScanUploadItem;
|
| 67 |
private File scanDataFile;
|
68 |
private File scanDataFile;
|
| 68 |
|
69 |
|
| 69 |
private String invoiceNumber;
|
70 |
private String invoiceNumber;
|
| 70 |
private Double freightCharges ;
|
71 |
private Double freightCharges ;
|
| - |
|
72 |
private String purchaseComments;
|
| 71 |
private Long poId;
|
73 |
private Long poId;
|
| 72 |
private String fileNameVal;
|
74 |
private String fileNameVal;
|
| 73 |
|
75 |
|
| 74 |
private String purchaseId;
|
76 |
private String purchaseId;
|
| 75 |
private String purchaseOrderId;
|
77 |
private String purchaseOrderId;
|
| 76 |
private Long warehouseId;
|
78 |
private Long warehouseId;
|
| 77 |
private Long transferWarehouseId;
|
79 |
private Long transferWarehouseId;
|
| 78 |
private Warehouse warehouse;
|
80 |
private Warehouse warehouse;
|
| - |
|
81 |
private Warehouse thirdPartyWarehouse;
|
| 79 |
|
82 |
|
| 80 |
private Map<Long, Double> unfulfilledMap = new HashMap<Long, Double>();
|
83 |
private Map<Long, Double> unfulfilledMap = new HashMap<Long, Double>();
|
| 81 |
|
84 |
|
| 82 |
|
85 |
|
| 83 |
public String show() {
|
86 |
public String show() {
|
| Line 116... |
Line 119... |
| 116 |
|
119 |
|
| 117 |
}
|
120 |
}
|
| 118 |
|
121 |
|
| 119 |
public boolean createPurchase(){
|
122 |
public boolean createPurchase(){
|
| 120 |
try {
|
123 |
try {
|
| 121 |
logger.info("poId="+poId+" invoiceNumber="+invoiceNumber+" freightCharges="+freightCharges);
|
124 |
logger.info("poId="+poId+" invoiceNumber="+invoiceNumber+" freightCharges="+freightCharges+ " purchaseComments="+purchaseComments);
|
| 122 |
PurchaseClient purchaseClient = new PurchaseClient();
|
125 |
PurchaseClient purchaseClient = new PurchaseClient();
|
| 123 |
in.shop2020.purchase.PurchaseService.Client client = purchaseClient
|
126 |
in.shop2020.purchase.PurchaseService.Client client = purchaseClient
|
| 124 |
.getClient();
|
127 |
.getClient();
|
| 125 |
id = "" + client.startPurchase(poId, invoiceNumber, freightCharges);
|
128 |
id = "" + client.startPurchase(poId, invoiceNumber, freightCharges, purchaseComments);
|
| 126 |
logger.info("id = "+id);
|
129 |
logger.info("id = "+id);
|
| 127 |
} catch (TTransportException e) {
|
130 |
} catch (TTransportException e) {
|
| 128 |
errorMsg = errorMsg + "<br> Error while establishing connection to the warehouse server";
|
131 |
errorMsg = errorMsg + "<br> Error while establishing connection to the warehouse server";
|
| 129 |
exceptionList.add("Error while establishing connection to the warehouse server");
|
132 |
exceptionList.add("Error while establishing connection to the warehouse server");
|
| 130 |
logger.error(errorMsg, e);
|
133 |
logger.error(errorMsg, e);
|
| Line 298... |
Line 301... |
| 298 |
items.add(catalogClient.getItem(lineItem.getItemId()));
|
301 |
items.add(catalogClient.getItem(lineItem.getItemId()));
|
| 299 |
unfulfilledMap.put(lineItem.getItemId(), lineItem.getUnfulfilledQuantity());
|
302 |
unfulfilledMap.put(lineItem.getItemId(), lineItem.getUnfulfilledQuantity());
|
| 300 |
}
|
303 |
}
|
| 301 |
|
304 |
|
| 302 |
in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = new InventoryClient().getClient();
|
305 |
in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = new InventoryClient().getClient();
|
| - |
|
306 |
thirdPartyWarehouse = inventoryClient.getWarehouse(warehouseId);
|
| - |
|
307 |
if(thirdPartyWarehouse.getVendor().getId()==DUMMY_VENDOR_ID && thirdPartyWarehouse.getInventoryType()==InventoryType.GOOD && thirdPartyWarehouse.getWarehouseType()==WarehouseType.OURS_THIRDPARTY){
|
| - |
|
308 |
warehouse = thirdPartyWarehouse;
|
| - |
|
309 |
} else {
|
| 303 |
warehouse = inventoryClient.getWarehouses(WarehouseType.OURS, InventoryType.GOOD, purchaseOrder.getSupplierId(), warehouseId, warehouseId).get(0);
|
310 |
warehouse = inventoryClient.getWarehouses(WarehouseType.OURS, InventoryType.GOOD, purchaseOrder.getSupplierId(), warehouseId, warehouseId).get(0);
|
| - |
|
311 |
}
|
| 304 |
} catch (Exception e) {
|
312 |
} catch (Exception e) {
|
| 305 |
logger.error("Could not find items in PO with purchase: " + id, e);
|
313 |
logger.error("Could not find items in PO with purchase: " + id, e);
|
| 306 |
}
|
314 |
}
|
| 307 |
}
|
315 |
}
|
| 308 |
|
316 |
|
| Line 453... |
Line 461... |
| 453 |
}
|
461 |
}
|
| 454 |
}
|
462 |
}
|
| 455 |
|
463 |
|
| 456 |
WarehouseClient warehouseClient = new WarehouseClient();
|
464 |
WarehouseClient warehouseClient = new WarehouseClient();
|
| 457 |
Client client = warehouseClient.getClient();
|
465 |
Client client = warehouseClient.getClient();
|
| - |
|
466 |
boolean checkDirectScanWarehouse = false;
|
| - |
|
467 |
|
| - |
|
468 |
if(thirdPartyWarehouse.getVendor().getId()==DUMMY_VENDOR_ID && thirdPartyWarehouse.getInventoryType()==InventoryType.GOOD && thirdPartyWarehouse.getWarehouseType()==WarehouseType.OURS_THIRDPARTY){
|
| - |
|
469 |
checkDirectScanWarehouse = true;
|
| - |
|
470 |
}
|
| 458 |
|
471 |
|
| 459 |
for (LineItem lineItem : lineItems) {
|
472 |
for (LineItem lineItem : lineItems) {
|
| 460 |
|
473 |
|
| 461 |
InventoryItem inventoryItem = new InventoryItem();
|
474 |
InventoryItem inventoryItem = new InventoryItem();
|
| 462 |
inventoryItem.setItemId(lineItem.getItem_id());
|
475 |
inventoryItem.setItemId(lineItem.getItem_id());
|
| 463 |
inventoryItem.setPurchaseId(Long.parseLong(id));
|
476 |
inventoryItem.setPurchaseId(Long.parseLong(id));
|
| 464 |
inventoryItem.setCurrentQuantity(0);
|
477 |
inventoryItem.setCurrentQuantity(0);
|
| 465 |
inventoryItem.setItemNumber(lineItem.getItem_number());
|
478 |
inventoryItem.setItemNumber(lineItem.getItem_number());
|
| 466 |
inventoryItem.setSerialNumber(lineItem.getSerial_number());
|
479 |
inventoryItem.setSerialNumber(lineItem.getSerial_number());
|
| 467 |
inventoryItem.setInitialQuantity(new Double(lineItem.getQuantity()).longValue());
|
480 |
inventoryItem.setInitialQuantity(new Double(lineItem.getQuantity()).longValue());
|
| - |
|
481 |
if(checkDirectScanWarehouse){
|
| - |
|
482 |
inventoryItem.setPhysicalWarehouseId(po.getWarehouseId());
|
| - |
|
483 |
inventoryItem.setCurrentWarehouseId(po.getWarehouseId());
|
| - |
|
484 |
}else{
|
| 468 |
inventoryItem.setPhysicalWarehouseId(po.getWarehouseId());
|
485 |
inventoryItem.setPhysicalWarehouseId(po.getWarehouseId());
|
| - |
|
486 |
}
|
| 469 |
if(!client.isAlive()){
|
487 |
if(!client.isAlive()){
|
| 470 |
client = warehouseClient.getClient();
|
488 |
client = warehouseClient.getClient();
|
| 471 |
}
|
489 |
}
|
| 472 |
try{
|
490 |
try{
|
| 473 |
client.scan(inventoryItem, ScanType.PURCHASE, new Double(lineItem.getQuantity()).longValue(), warehouseId, (transferLotId!=null)?transferLotId:0L);
|
491 |
client.scan(inventoryItem, ScanType.PURCHASE, new Double(lineItem.getQuantity()).longValue(), warehouseId, (transferLotId!=null)?transferLotId:0L);
|
| Line 690... |
Line 708... |
| 690 |
|
708 |
|
| 691 |
public void setSuccessMsg(String successMsg) {
|
709 |
public void setSuccessMsg(String successMsg) {
|
| 692 |
this.successMsg = successMsg;
|
710 |
this.successMsg = successMsg;
|
| 693 |
}
|
711 |
}
|
| 694 |
|
712 |
|
| - |
|
713 |
public String getPurchaseComments() {
|
| - |
|
714 |
return purchaseComments;
|
| - |
|
715 |
}
|
| - |
|
716 |
|
| - |
|
717 |
public void setPurchaseComments(String purchaseComments) {
|
| - |
|
718 |
this.purchaseComments = purchaseComments;
|
| - |
|
719 |
}
|
| - |
|
720 |
|
| - |
|
721 |
public Warehouse getThirdPartyWarehouse() {
|
| - |
|
722 |
return thirdPartyWarehouse;
|
| - |
|
723 |
}
|
| - |
|
724 |
|
| - |
|
725 |
public void setThirdPartyWarehouse(Warehouse thirdPartyWarehouse) {
|
| - |
|
726 |
this.thirdPartyWarehouse = thirdPartyWarehouse;
|
| - |
|
727 |
}
|
| 695 |
}
|
728 |
}
|
| 696 |
|
729 |
|