Subversion Repositories SmartDukaan

Rev

Rev 11801 | Rev 24332 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 11801 Rev 16264
Line 174... Line 174...
174
 
174
 
175
            WarehouseClient warehouseClient = new WarehouseClient();
175
            WarehouseClient warehouseClient = new WarehouseClient();
176
            Client client = warehouseClient.getClient();
176
            Client client = warehouseClient.getClient();
177
            in.shop2020.purchase.PurchaseService.Client purchaseClient = new PurchaseClient().getClient();
177
            in.shop2020.purchase.PurchaseService.Client purchaseClient = new PurchaseClient().getClient();
178
            PurchaseOrder po = purchaseClient.getPurchaseOrder(poId);
178
            PurchaseOrder po = purchaseClient.getPurchaseOrder(poId);
-
 
179
            InventoryService.Client inventoryClient = new InventoryClient().getClient();
179
            if(transferLotId==null || transferLotId==0) {
180
            if(transferLotId==null || transferLotId==0) {
180
	            if(transferWarehouseId!=null && transferWarehouseId!=0) {
181
	            if(transferWarehouseId!=null && transferWarehouseId!=0) {
181
	            	InventoryService.Client inventoryClient = new InventoryClient().getClient();
-
 
182
	                Warehouse fulfilmentWarehouse = inventoryClient.getWarehouses(WarehouseType.OURS, InventoryType.GOOD, po.getSupplierId(), po.getWarehouseId(), 0L).get(0);
182
	                Warehouse fulfilmentWarehouse = inventoryClient.getWarehouses(WarehouseType.OURS, InventoryType.GOOD, po.getSupplierId(), po.getWarehouseId(), 0L).get(0);
183
	            	transferLotId = client.createTransferLot(po.getWarehouseId(), transferWarehouseId);
183
	            	transferLotId = client.createTransferLot(po.getWarehouseId(), transferWarehouseId);
184
	            }
184
	            }
185
            }
185
            }
186
            boolean checkDirectScanWarehouse = false;
186
            boolean checkDirectScanWarehouse = false;
187
            
187
            
188
            if(thirdPartyWarehouse.getVendor().getId()==DUMMY_VENDOR_ID && thirdPartyWarehouse.getInventoryType()==InventoryType.GOOD && thirdPartyWarehouse.getWarehouseType()==WarehouseType.OURS_THIRDPARTY){
188
            if(thirdPartyWarehouse.getVendor().getId()==DUMMY_VENDOR_ID && thirdPartyWarehouse.getInventoryType()==InventoryType.GOOD && thirdPartyWarehouse.getWarehouseType()==WarehouseType.OURS_THIRDPARTY){
189
            	checkDirectScanWarehouse = true;
189
            	checkDirectScanWarehouse = true;
190
            }
190
            }
191
            
191
            
-
 
192
            long currentWarehouseId = 0;
-
 
193
            if(!checkDirectScanWarehouse){
-
 
194
            	Warehouse fulfilmentWarehouse = inventoryClient.getWarehouses(WarehouseType.OURS, InventoryType.GOOD, po.getSupplierId(), po.getWarehouseId(), 0).get(0);
-
 
195
            	currentWarehouseId = fulfilmentWarehouse.getId();
-
 
196
            }
-
 
197
            
192
            for (LineItem lineItem : lineItems) {
198
            for (LineItem lineItem : lineItems) {
193
                if (ScanRecordType.BLANK.name().equals(lineItem.getExtra_info())) {
199
                if (ScanRecordType.BLANK.name().equals(lineItem.getExtra_info())) {
194
                    continue;
200
                    continue;
195
                }
201
                }
196
 
202
 
Line 208... Line 214...
208
                	inventoryItem.setPhysicalWarehouseId(po.getWarehouseId());
214
                	inventoryItem.setPhysicalWarehouseId(po.getWarehouseId());
209
                	inventoryItem.setCurrentWarehouseId(po.getWarehouseId());
215
                	inventoryItem.setCurrentWarehouseId(po.getWarehouseId());
210
                }else{
216
                }else{
211
                	logger.info("Come into this loop.... where direct scan Warehouse Id Not Exist");
217
                	logger.info("Come into this loop.... where direct scan Warehouse Id Not Exist");
212
                	inventoryItem.setPhysicalWarehouseId(po.getWarehouseId());
218
                	inventoryItem.setPhysicalWarehouseId(po.getWarehouseId());
-
 
219
                	inventoryItem.setCurrentWarehouseId(currentWarehouseId);
213
                }
220
                }
214
                
221
                
215
                if(!client.isAlive()){
222
                if(!client.isAlive()){
216
					client = warehouseClient.getClient();
223
					client = warehouseClient.getClient();
217
				}
224
				}
218
            	client.scan(inventoryItem, ScanType.PURCHASE, new Double(lineItem.getQuantity()).longValue(), warehouseId, (transferLotId!=null)?transferLotId:0L);
225
            	client.scan(inventoryItem, ScanType.PURCHASE, new Double(lineItem.getQuantity()).longValue(), warehouseId, (transferLotId!=null)?transferLotId:0L);
219
            }
226
            }
220
 
227
 
221
            resetLineItems();
228
            resetLineItems();
222
        } catch (TTransportException e) {
229
        } catch (TTransportException e) {
223
            errorMsg = "Error while establishing connection to the warehouse server";
230
            errorMsg = "Issue while scanning:- "+e.getMessage();
224
            logger.error(errorMsg, e);
231
            logger.error(errorMsg, e);
225
        } catch (WarehouseServiceException e) {
232
        } catch (WarehouseServiceException e) {
226
            errorMsg = e.getMessage();
233
            errorMsg = e.getMessage();
227
            logger.error(errorMsg, e);
234
            logger.error(errorMsg, e);
228
        } catch (TException e) {
235
        } catch (TException e) {