Subversion Repositories SmartDukaan

Rev

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

Rev 21253 Rev 22588
Line 8... Line 8...
8
import in.shop2020.model.v1.order.TransactionServiceException;
8
import in.shop2020.model.v1.order.TransactionServiceException;
9
import in.shop2020.model.v1.order.TransactionService.Client;
9
import in.shop2020.model.v1.order.TransactionService.Client;
10
import in.shop2020.thrift.clients.LogisticsClient;
10
import in.shop2020.thrift.clients.LogisticsClient;
11
import in.shop2020.thrift.clients.TransactionClient;
11
import in.shop2020.thrift.clients.TransactionClient;
12
import in.shop2020.thrift.clients.WarehouseClient;
12
import in.shop2020.thrift.clients.WarehouseClient;
-
 
13
import in.shop2020.thrift.clients.config.ConfigClient;
13
import in.shop2020.warehouse.InventoryItem;
14
import in.shop2020.warehouse.InventoryItem;
14
 
15
 
15
import java.io.File;
16
import java.io.File;
16
import java.io.FileInputStream;
17
import java.io.FileInputStream;
17
import java.util.ArrayList;
18
import java.util.ArrayList;
-
 
19
import java.util.Date;
18
import java.util.HashMap;
20
import java.util.HashMap;
19
import java.util.List;
21
import java.util.List;
20
import java.util.Map;
22
import java.util.Map;
21
import java.util.Set;
23
import java.util.Set;
22
 
24
 
Line 48... Line 50...
48
	private Map<Long, List<String>> itemNumbersMap = new HashMap<Long, List<String>>();
50
	private Map<Long, List<String>> itemNumbersMap = new HashMap<Long, List<String>>();
49
	private Map<Long, List<String>> serialNumbersMap = new HashMap<Long, List<String>>();
51
	private Map<Long, List<String>> serialNumbersMap = new HashMap<Long, List<String>>();
50
	private Map<Long, List<Long>> freebieWarehouseIdMap = new HashMap<Long, List<Long>>();
52
	private Map<Long, List<Long>> freebieWarehouseIdMap = new HashMap<Long, List<Long>>();
51
	private static final long jacket_number = 1;
53
	private static final long jacket_number = 1;
52
	private static final String invoice_type = "Individual";
54
	private static final String invoice_type = "Individual";
-
 
55
	
-
 
56
	private static String live = "false";
-
 
57
	
-
 
58
	static {
-
 
59
		try {
-
 
60
			ConfigClient cc = ConfigClient.getClient();
-
 
61
			live = cc.get("env");
-
 
62
		} catch (Exception e) {
-
 
63
			e.printStackTrace();
-
 
64
		}
-
 
65
	}
53
 
66
 
54
 
67
 
55
	ProcessBulkBilling(String fileName, String logisticsTransactionId, String packageDimensions, BillingType billingType, String user) {
68
	ProcessBulkBilling(String fileName, String logisticsTransactionId, String packageDimensions, BillingType billingType, String user) {
56
		logger.info("FileName "+fileName+" logisticsTransactionId "+logisticsTransactionId+" packageDimension "+packageDimensions+" billingType "+billingType+" user "+user);
69
		logger.info("FileName "+fileName+" logisticsTransactionId "+logisticsTransactionId+" packageDimension "+packageDimensions+" billingType "+billingType+" user "+user);
57
		this.fileName = fileName;
70
		this.fileName = fileName;
Line 111... Line 124...
111
			}
124
			}
112
 
125
 
113
 
126
 
114
			if (t_order.getAirwaybill_no()==null){
127
			if (t_order.getAirwaybill_no()==null){
115
				String airway_billno = null;
128
				String airway_billno = null;
-
 
129
				if(live.equals("true")) {
116
				try{
130
					try{
-
 
131
						//If aramaex then
117
					if (t_order.getLogistics_provider_id()==2){
132
						if (t_order.getLogistics_provider_id()==2){
-
 
133
							List<in.shop2020.model.v1.order.Order> orders = client.getGroupOrdersByLogisticsTxnId(t_order.getLogisticsTransactionId());
118
						Provider logisticsProvider = ProviderFactory.getProvider((int)orders_list.get(0).getLogistics_provider_id());
134
							Provider logisticsProvider = ProviderFactory.getProvider((int)orders.get(0).getLogistics_provider_id());
119
						airway_billno = logisticsProvider.getAirwayBillNo(orders_list);
135
							airway_billno = logisticsProvider.getAirwayBillNo(orders);
-
 
136
						}
-
 
137
						else{
-
 
138
							LogisticsClient lc = new LogisticsClient();
-
 
139
							airway_billno = lc.getClient().getEmptyAWB(t_order.getLogistics_provider_id(), t_order.getLogisticsTransactionId());
-
 
140
						}
-
 
141
						if (airway_billno==null || airway_billno.isEmpty()){
-
 
142
							throw new Exception("Empty airway bill number");
-
 
143
						}
120
					}
144
					}
121
					else{
145
					catch(Exception airwayBillException){
122
						LogisticsClient lc = new LogisticsClient();
146
						airwayBillException.printStackTrace();
123
						airway_billno = lc.getClient().getEmptyAWB(t_order.getLogistics_provider_id(), t_order.getLogisticsTransactionId());
147
						return "Unable to assign airway bill number";
124
					}
148
					}
125
					if (airway_billno==null || airway_billno.isEmpty()){
-
 
126
						throw new Exception("Empty airway bill number");
-
 
127
					}
-
 
128
				}
149
				} else {
129
				catch(Exception airwayBillException){
-
 
130
					airwayBillException.printStackTrace();
150
					airway_billno = String.valueOf(new Date().getTime());
131
					return "Unable to assign airway bill number";
-
 
132
				}
151
				}
133
				client.updateMasterOrderAWB(t_order.getLogisticsTransactionId(), airway_billno);
-
 
134
			}
152
			}
135
 
153
 
136
 
154
 
137
			if((billingType == BillingType.OURS || billingType == BillingType.OURS_EXTERNAL) && t_order.getStatus().getValue() >= OrderStatus.BILLED.getValue()){
155
			if((billingType == BillingType.OURS || billingType == BillingType.OURS_EXTERNAL) && t_order.getStatus().getValue() >= OrderStatus.BILLED.getValue()){
138
				return "Already Billed";
156
				return "Already Billed";