Subversion Repositories SmartDukaan

Rev

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

Rev 5945 Rev 7410
Line 38... Line 38...
38
    private String contactPhone;
38
    private String contactPhone;
39
    private String contactFax;
39
    private String contactFax;
40
    private String contactEmail;
40
    private String contactEmail;
41
    private String registeredAddress;
41
    private String registeredAddress;
42
    private String communicationAddress;
42
    private String communicationAddress;
-
 
43
    private List<Long> billingWarehouseIds;
43
    
44
    
44
    private String id;
45
    private String id;
45
    private List<Supplier> suppliers;
46
    private List<Supplier> suppliers;
46
    private String errorMessage = "";
47
    private String errorMessage = "";
47
    private Supplier supplier;
48
    private Supplier supplier;
Line 97... Line 98...
97
                    ConfigClientKeys.inventory_service_server_port.toString()).getClient();
98
                    ConfigClientKeys.inventory_service_server_port.toString()).getClient();
98
            Vendor vendor = new Vendor();
99
            Vendor vendor = new Vendor();
99
            vendor.setId(supplier.getId());
100
            vendor.setId(supplier.getId());
100
            vendor.setName(name);
101
            vendor.setName(name);
101
            inventoryClient.addVendor(vendor);
102
            inventoryClient.addVendor(vendor);
-
 
103
            for(Long billingWarehouseId : billingWarehouseIds) {
102
            Warehouse billingWarehouse = inventoryClient.getWarehouse(PurchaseOrderController.WAREHOUSE_ID);
104
	            Warehouse billingWarehouse = inventoryClient.getWarehouse(billingWarehouseId);
103
            Warehouse warehouse = new Warehouse();
105
	            Warehouse warehouse = new Warehouse();
104
            warehouse.setVendor(vendor);
106
	            warehouse.setVendor(vendor);
-
 
107
	            warehouse.setStateId(billingWarehouse.getStateId());
105
            warehouse.setBillingType(BillingType.OURS);
108
	            warehouse.setBillingType(BillingType.OURS);
106
            warehouse.setBillingWarehouseId(billingWarehouse.getId());
109
	            warehouse.setBillingWarehouseId(billingWarehouse.getId());
107
            warehouse.setDisplayName(StringUtils.join(new String[]{billingWarehouse.getDisplayName(), name, "G"}, '/'));
110
	            warehouse.setDisplayName(StringUtils.join(new String[]{billingWarehouse.getDisplayName(), name, "G"}, '/'));
108
            warehouse.setInventoryType(InventoryType.GOOD);
111
	            warehouse.setInventoryType(InventoryType.GOOD);
109
            warehouse.setIsAvailabilityMonitored(false);
112
	            warehouse.setIsAvailabilityMonitored(false);
110
            warehouse.setLocation(billingWarehouse.getLocation());
113
	            warehouse.setLocation(billingWarehouse.getLocation());
111
            warehouse.setPincode(billingWarehouse.getPincode());
114
	            warehouse.setPincode(billingWarehouse.getPincode());
112
            warehouse.setLogisticsLocation(billingWarehouse.getLogisticsLocation());
115
	            warehouse.setLogisticsLocation(billingWarehouse.getLogisticsLocation());
113
            warehouse.setShippingWarehouseId(billingWarehouse.getId());
116
	            warehouse.setShippingWarehouseId(billingWarehouse.getId());
114
            warehouse.setTinNumber(tin);
117
	            warehouse.setTinNumber(tin);
115
            warehouse.setTransferDelayInHours(0);
118
	            warehouse.setTransferDelayInHours(0);
116
            warehouse.setWarehouseType(WarehouseType.OURS);
119
	            warehouse.setWarehouseType(WarehouseType.OURS);
117
            inventoryClient.addWarehouse(warehouse);
120
	            inventoryClient.addWarehouse(warehouse);
118
            
121
	            
119
            warehouse.setDisplayName(StringUtils.join(new String[]{billingWarehouse.getDisplayName(), name, "B"}, '/'));
122
	            warehouse.setDisplayName(StringUtils.join(new String[]{billingWarehouse.getDisplayName(), name, "B"}, '/'));
120
            warehouse.setInventoryType(InventoryType.BAD);
123
	            warehouse.setInventoryType(InventoryType.BAD);
121
            inventoryClient.addWarehouse(warehouse);
124
	            inventoryClient.addWarehouse(warehouse);
122
            
125
	            
123
            warehouse.setWarehouseType(WarehouseType.THIRD_PARTY);
126
	            warehouse.setWarehouseType(WarehouseType.THIRD_PARTY);
124
            warehouse.setDisplayName(StringUtils.join(new String[]{name, "G"}, '/'));
127
	            warehouse.setDisplayName(StringUtils.join(new String[]{name, "G"}, '/'));
125
            warehouse.setInventoryType(InventoryType.GOOD);
128
	            warehouse.setInventoryType(InventoryType.GOOD);
126
            warehouse.setTransferDelayInHours(24);
129
	            warehouse.setTransferDelayInHours(24);
127
            warehouse.setBillingType(null);
130
	            warehouse.setBillingType(null);
128
            warehouse.setBillingWarehouseId(0);
131
	            warehouse.setBillingWarehouseId(0);
129
            warehouse.setShippingWarehouseId(0);
132
	            warehouse.setShippingWarehouseId(0);
130
            inventoryClient.addWarehouse(warehouse);
133
	            inventoryClient.addWarehouse(warehouse);
-
 
134
            }
131
        } catch (Exception e) {
135
        } catch (Exception e) {
132
            errorMessage = "Error creating supplier: " + e.getMessage();
136
            errorMessage = "Error creating supplier: " + e.getMessage();
133
            logger.error("Error creating supplier", e);
137
            logger.error("Error creating supplier", e);
134
        }
138
        }
135
 
139
 
Line 279... Line 283...
279
    }
283
    }
280
 
284
 
281
    public void setSupplier(Supplier supplier) {
285
    public void setSupplier(Supplier supplier) {
282
        this.supplier = supplier;
286
        this.supplier = supplier;
283
    }
287
    }
-
 
288
 
-
 
289
	public List<Long> getBillingWarehouseIds() {
-
 
290
		return billingWarehouseIds;
-
 
291
	}
-
 
292
 
-
 
293
	public void setBillingWarehouseIds(List<Long> billingWarehouseIds) {
-
 
294
		this.billingWarehouseIds = billingWarehouseIds;
-
 
295
	}
-
 
296
    
284
}
297
}