| 1146 |
chandransh |
1 |
package in.shop2020.hotspot.dashbaord.client.inbox;
|
|
|
2 |
|
|
|
3 |
import in.shop2020.hotspot.dashbaord.client.event.AddJacketNumberEvent;
|
| 2843 |
chandransh |
4 |
import in.shop2020.hotspot.dashbaord.shared.actions.BillingType;
|
| 1146 |
chandransh |
5 |
import in.shop2020.hotspot.dashbaord.shared.actions.Order;
|
|
|
6 |
|
| 5411 |
rajveer |
7 |
import java.util.ArrayList;
|
| 13146 |
manish.sha |
8 |
import java.util.HashMap;
|
| 5411 |
rajveer |
9 |
import java.util.List;
|
| 5110 |
mandeep.dh |
10 |
import java.util.Map;
|
|
|
11 |
|
| 1146 |
chandransh |
12 |
import org.enunes.gwt.mvp.client.EventBus;
|
|
|
13 |
|
|
|
14 |
import com.google.gwt.event.dom.client.ClickEvent;
|
|
|
15 |
import com.google.gwt.event.dom.client.ClickHandler;
|
| 13146 |
manish.sha |
16 |
import com.google.gwt.event.dom.client.KeyPressEvent;
|
|
|
17 |
import com.google.gwt.event.dom.client.KeyPressHandler;
|
| 1146 |
chandransh |
18 |
import com.google.gwt.user.client.ui.Button;
|
| 13227 |
manish.sha |
19 |
import com.google.gwt.user.client.ui.CheckBox;
|
| 1146 |
chandransh |
20 |
import com.google.gwt.user.client.ui.DialogBox;
|
| 13146 |
manish.sha |
21 |
import com.google.gwt.user.client.ui.HTML;
|
|
|
22 |
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
|
| 1146 |
chandransh |
23 |
import com.google.gwt.user.client.ui.HorizontalPanel;
|
|
|
24 |
import com.google.gwt.user.client.ui.Label;
|
| 20730 |
kshitij.so |
25 |
import com.google.gwt.user.client.ui.ListBox;
|
| 13146 |
manish.sha |
26 |
import com.google.gwt.user.client.ui.ScrollPanel;
|
| 1146 |
chandransh |
27 |
import com.google.gwt.user.client.ui.TextBox;
|
|
|
28 |
import com.google.gwt.user.client.ui.VerticalPanel;
|
| 2781 |
chandransh |
29 |
import com.google.gwt.user.client.ui.Widget;
|
| 1146 |
chandransh |
30 |
|
|
|
31 |
public class JacketInfoBox extends DialogBox {
|
|
|
32 |
private Label errorLabel = new Label("");
|
| 2781 |
chandransh |
33 |
|
| 20730 |
kshitij.so |
34 |
//private Label jacketNumberLabel = new Label("Jacket Number");
|
| 6746 |
rajveer |
35 |
|
| 5110 |
mandeep.dh |
36 |
private Label warehousePickSuggestion = new Label("");
|
| 13146 |
manish.sha |
37 |
|
| 20730 |
kshitij.so |
38 |
//private TextBox jacketNumberBox = new TextBox();
|
| 2781 |
chandransh |
39 |
|
| 20730 |
kshitij.so |
40 |
private Label packageDimensionsLabel = new Label("Package Dimensions");
|
|
|
41 |
|
|
|
42 |
private ListBox packageDimensions = new ListBox();
|
|
|
43 |
|
| 13146 |
manish.sha |
44 |
private Label billedByLabel = new Label("Billed By");
|
| 2781 |
chandransh |
45 |
|
| 13146 |
manish.sha |
46 |
private Label billNumberLabel = new Label("Bill Number");
|
|
|
47 |
private TextBox billNumber = new TextBox();
|
| 2781 |
chandransh |
48 |
|
| 20730 |
kshitij.so |
49 |
// private CheckBox changeInvoiceType = new CheckBox("Bulk Invoice");
|
| 13227 |
manish.sha |
50 |
|
| 13146 |
manish.sha |
51 |
private VerticalPanel vpanel = new VerticalPanel();
|
| 7190 |
amar.kumar |
52 |
|
| 13146 |
manish.sha |
53 |
private ScrollPanel spanel = new ScrollPanel();
|
| 7190 |
amar.kumar |
54 |
|
| 13146 |
manish.sha |
55 |
private Button submitbutton = new Button("Submit");
|
| 2781 |
chandransh |
56 |
|
| 13710 |
manish.sha |
57 |
private Button cancelButton = new Button("Cancel");
|
|
|
58 |
|
| 13146 |
manish.sha |
59 |
private Map<Long, List<String>> itemNumbersMap = new HashMap<Long, List<String>>();
|
|
|
60 |
|
|
|
61 |
private Map<Long, List<String>> serialNumbersMap = new HashMap<Long, List<String>>();
|
|
|
62 |
|
|
|
63 |
private Map<Long, List<Long>> freebieWarehouseIdMap = new HashMap<Long, List<Long>>();
|
|
|
64 |
|
|
|
65 |
|
|
|
66 |
private Map<Long, List<TextBox>> itemNumbersBoxMap= new HashMap<Long, List<TextBox>>();
|
|
|
67 |
|
|
|
68 |
private Map<Long, List<TextBox>> serialNumbersBoxMap = new HashMap<Long, List<TextBox>>();
|
|
|
69 |
|
|
|
70 |
private Map<Long, List<TextBox>> freebieWarehouseIdBoxMap = new HashMap<Long, List<TextBox>>();
|
|
|
71 |
|
|
|
72 |
|
|
|
73 |
private HorizontalPanel hpanel;
|
|
|
74 |
|
| 13231 |
manish.sha |
75 |
private Widget tmpLabel;
|
|
|
76 |
|
| 5110 |
mandeep.dh |
77 |
public JacketInfoBox(final EventBus eventBus, final Order order, final String user,
|
| 13146 |
manish.sha |
78 |
final BillingType billingType, Map<Long, String> warehouses, final Map<Long, Map<String, String>> billTogetherOrdersMap){
|
| 1146 |
chandransh |
79 |
vpanel.add(errorLabel);
|
| 13146 |
manish.sha |
80 |
|
| 20730 |
kshitij.so |
81 |
// jacketNumberBox.addKeyPressHandler(new KeyPressHandler() {
|
|
|
82 |
// @Override
|
|
|
83 |
// public void onKeyPress(KeyPressEvent event) {
|
|
|
84 |
// // TODO Auto-generated method stub
|
|
|
85 |
// if (!Character.isDigit(event.getCharCode())) {
|
|
|
86 |
// ((TextBox) event.getSource()).cancelKey();
|
|
|
87 |
// }
|
|
|
88 |
// }
|
|
|
89 |
// });
|
| 13146 |
manish.sha |
90 |
|
| 20730 |
kshitij.so |
91 |
// vpanel.add(getHorizontalPanel(jacketNumberLabel, jacketNumberBox));
|
| 20767 |
kshitij.so |
92 |
packageDimensions.addItem("","");
|
| 20773 |
kshitij.so |
93 |
packageDimensions.addItem("Box-1 (25 X 16 X 7)","25 X 16 X 7");
|
|
|
94 |
packageDimensions.addItem("Box-3 (30 X 25 X 11)","30 X 25 X 11");
|
|
|
95 |
packageDimensions.addItem("Box-A1 (18 X 12.5 X 10)","18 X 12.5 X 10");
|
|
|
96 |
packageDimensions.addItem("Box-A2 (20 X 17.5 X 12)","20 X 17.5 X 12");
|
|
|
97 |
packageDimensions.addItem("Box-A3 (22 X 18 X 12)","22 X 18 X 12");
|
| 20730 |
kshitij.so |
98 |
vpanel.add(getHorizontalPanel(packageDimensionsLabel, packageDimensions));
|
| 13146 |
manish.sha |
99 |
|
|
|
100 |
vpanel.add(getHorizontalPanel(billedByLabel, new Label(user)));
|
|
|
101 |
|
| 13315 |
manish.sha |
102 |
if (order.getPickFromWarehouse() != null && billTogetherOrdersMap.size()==1) {
|
| 5110 |
mandeep.dh |
103 |
warehousePickSuggestion.setText("Pick from WH: " + order.getPickFromWarehouse());
|
| 13315 |
manish.sha |
104 |
vpanel.add(warehousePickSuggestion);
|
| 5110 |
mandeep.dh |
105 |
}
|
| 13315 |
manish.sha |
106 |
|
| 20730 |
kshitij.so |
107 |
// changeInvoiceType = new CheckBox("BulkInvoice");
|
|
|
108 |
// changeInvoiceType.setValue(false);
|
|
|
109 |
// if(!order.getSource().equals("WEBSITE")) {
|
|
|
110 |
// changeInvoiceType.setEnabled(false);
|
|
|
111 |
// }
|
|
|
112 |
//
|
|
|
113 |
//
|
|
|
114 |
// vpanel.add(changeInvoiceType);
|
| 13227 |
manish.sha |
115 |
|
| 6746 |
rajveer |
116 |
if(billingType == BillingType.OURS_EXTERNAL || billingType == BillingType.EXTERNAL){
|
|
|
117 |
vpanel.add(getHorizontalPanel(billNumberLabel, billNumber));
|
|
|
118 |
if(order.getInvoiceNumber() != null && !order.getInvoiceNumber().trim().equals("")){
|
|
|
119 |
billNumber.setText(order.getInvoiceNumber().trim());
|
|
|
120 |
}
|
|
|
121 |
}
|
|
|
122 |
|
| 13228 |
manish.sha |
123 |
vpanel.add(new HTML("<br>"));
|
|
|
124 |
|
| 13146 |
manish.sha |
125 |
hpanel = new HorizontalPanel();
|
|
|
126 |
hpanel.setSpacing(5);
|
| 13231 |
manish.sha |
127 |
tmpLabel = new Label("Order Id");
|
|
|
128 |
hpanel.add(tmpLabel);
|
| 13232 |
manish.sha |
129 |
hpanel.setCellWidth(tmpLabel, "50");
|
| 13231 |
manish.sha |
130 |
tmpLabel = new Label("Product Name");
|
|
|
131 |
hpanel.add(tmpLabel);
|
| 13234 |
manish.sha |
132 |
hpanel.setCellWidth(tmpLabel, "250");
|
| 13231 |
manish.sha |
133 |
tmpLabel = new Label("Quantity");
|
|
|
134 |
hpanel.add(tmpLabel);
|
| 20731 |
kshitij.so |
135 |
// hpanel.setCellWidth(tmpLabel, "50");
|
|
|
136 |
// tmpLabel = new Label("Item Number");
|
|
|
137 |
// hpanel.add(tmpLabel);
|
| 20774 |
kshitij.so |
138 |
hpanel.setCellWidth(tmpLabel, "50");
|
| 13231 |
manish.sha |
139 |
tmpLabel = new Label("Serial Number");
|
|
|
140 |
hpanel.add(tmpLabel);
|
| 13234 |
manish.sha |
141 |
hpanel.setCellWidth(tmpLabel, "200");
|
| 13231 |
manish.sha |
142 |
tmpLabel = new Label("Freebie Warehouse Id");
|
|
|
143 |
hpanel.add(tmpLabel);
|
| 13234 |
manish.sha |
144 |
hpanel.setCellWidth(tmpLabel, "200");
|
| 13231 |
manish.sha |
145 |
|
| 13146 |
manish.sha |
146 |
vpanel.add(hpanel);
|
| 6746 |
rajveer |
147 |
|
| 13146 |
manish.sha |
148 |
for(Long orderId : billTogetherOrdersMap.keySet()){
|
|
|
149 |
List<TextBox> itemNumbersBoxList = new ArrayList<TextBox>();
|
|
|
150 |
List<TextBox> serialNumbersBoxList = new ArrayList<TextBox>();
|
|
|
151 |
List<TextBox> freebieWarehouseIdBoxList = new ArrayList<TextBox>();
|
|
|
152 |
|
|
|
153 |
long quantity = (long)Double.parseDouble(billTogetherOrdersMap.get(orderId).get("Quantity"));
|
|
|
154 |
boolean hasSerialized = Boolean.parseBoolean(billTogetherOrdersMap.get(orderId).get("IsSerialized"));
|
|
|
155 |
boolean hasFreebie = Boolean.parseBoolean(billTogetherOrdersMap.get(orderId).get("IsFreebie"));
|
|
|
156 |
TextBox itemNumber;
|
|
|
157 |
TextBox serialNumber;
|
|
|
158 |
TextBox freebieWarehouseId;
|
|
|
159 |
|
|
|
160 |
if(quantity>1){
|
|
|
161 |
if(hasSerialized){
|
|
|
162 |
for(long i=0; i<quantity; i++){
|
|
|
163 |
hpanel = new HorizontalPanel();
|
|
|
164 |
hpanel.setSpacing(5);
|
| 13231 |
manish.sha |
165 |
tmpLabel = new Label(orderId+"");
|
|
|
166 |
hpanel.add(tmpLabel);
|
| 13233 |
manish.sha |
167 |
hpanel.setCellWidth(tmpLabel, "50");
|
| 13231 |
manish.sha |
168 |
tmpLabel = new Label(billTogetherOrdersMap.get(orderId).get("ProductName"));
|
|
|
169 |
hpanel.add(tmpLabel);
|
| 13234 |
manish.sha |
170 |
hpanel.setCellWidth(tmpLabel, "250");
|
| 13231 |
manish.sha |
171 |
tmpLabel = new Label("1");
|
|
|
172 |
hpanel.add(tmpLabel);
|
|
|
173 |
hpanel.setCellWidth(tmpLabel, "50");
|
|
|
174 |
|
| 20730 |
kshitij.so |
175 |
//hpanel.add(new Label(orderId+""));
|
|
|
176 |
//hpanel.add(new Label(billTogetherOrdersMap.get(orderId).get("ProductName")));
|
|
|
177 |
//hpanel.add(new Label("1"));
|
| 13146 |
manish.sha |
178 |
itemNumber = new TextBox();
|
| 20731 |
kshitij.so |
179 |
itemNumber.setText("1");
|
| 13146 |
manish.sha |
180 |
serialNumber = new TextBox();
|
|
|
181 |
freebieWarehouseId = new TextBox();
|
|
|
182 |
if(!hasFreebie){
|
|
|
183 |
freebieWarehouseId.setEnabled(false);
|
|
|
184 |
}
|
|
|
185 |
freebieWarehouseId.addKeyPressHandler(new KeyPressHandler() {
|
|
|
186 |
@Override
|
|
|
187 |
public void onKeyPress(KeyPressEvent event) {
|
|
|
188 |
// TODO Auto-generated method stub
|
|
|
189 |
if (!Character.isDigit(event.getCharCode())) {
|
|
|
190 |
((TextBox) event.getSource()).cancelKey();
|
|
|
191 |
}
|
|
|
192 |
}
|
|
|
193 |
});
|
| 13231 |
manish.sha |
194 |
|
| 20731 |
kshitij.so |
195 |
// hpanel.add(itemNumber);
|
|
|
196 |
// hpanel.setCellWidth(itemNumber, "200");
|
| 13146 |
manish.sha |
197 |
hpanel.add(serialNumber);
|
| 13234 |
manish.sha |
198 |
hpanel.setCellWidth(serialNumber, "200");
|
| 13146 |
manish.sha |
199 |
hpanel.add(freebieWarehouseId);
|
| 13234 |
manish.sha |
200 |
hpanel.setCellWidth(freebieWarehouseId, "200");
|
| 13146 |
manish.sha |
201 |
vpanel.add(hpanel);
|
|
|
202 |
itemNumbersBoxList.add(itemNumber);
|
|
|
203 |
serialNumbersBoxList.add(serialNumber);
|
|
|
204 |
freebieWarehouseIdBoxList.add(freebieWarehouseId);
|
|
|
205 |
}
|
|
|
206 |
}
|
|
|
207 |
else{
|
|
|
208 |
hpanel = new HorizontalPanel();
|
|
|
209 |
hpanel.setSpacing(5);
|
| 13231 |
manish.sha |
210 |
tmpLabel = new Label(orderId+"");
|
|
|
211 |
hpanel.add(tmpLabel);
|
| 13233 |
manish.sha |
212 |
hpanel.setCellWidth(tmpLabel, "50");
|
| 13231 |
manish.sha |
213 |
tmpLabel = new Label(billTogetherOrdersMap.get(orderId).get("ProductName"));
|
|
|
214 |
hpanel.add(tmpLabel);
|
| 13234 |
manish.sha |
215 |
hpanel.setCellWidth(tmpLabel, "250");
|
| 13231 |
manish.sha |
216 |
tmpLabel = new Label(quantity+"");
|
|
|
217 |
hpanel.add(tmpLabel);
|
|
|
218 |
hpanel.setCellWidth(tmpLabel, "50");
|
| 13146 |
manish.sha |
219 |
itemNumber = new TextBox();
|
|
|
220 |
serialNumber = new TextBox();
|
|
|
221 |
freebieWarehouseId = new TextBox();
|
|
|
222 |
serialNumber.setEnabled(false);
|
|
|
223 |
if(!hasFreebie){
|
|
|
224 |
freebieWarehouseId.setEnabled(false);
|
|
|
225 |
}
|
|
|
226 |
freebieWarehouseId.addKeyPressHandler(new KeyPressHandler() {
|
|
|
227 |
@Override
|
|
|
228 |
public void onKeyPress(KeyPressEvent event) {
|
|
|
229 |
// TODO Auto-generated method stub
|
|
|
230 |
if (!Character.isDigit(event.getCharCode())) {
|
|
|
231 |
((TextBox) event.getSource()).cancelKey();
|
|
|
232 |
}
|
|
|
233 |
}
|
|
|
234 |
});
|
| 20731 |
kshitij.so |
235 |
// hpanel.add(itemNumber);
|
|
|
236 |
// hpanel.setCellWidth(itemNumber, "200");
|
|
|
237 |
itemNumber.setText("1");
|
| 13146 |
manish.sha |
238 |
hpanel.add(serialNumber);
|
| 13234 |
manish.sha |
239 |
hpanel.setCellWidth(serialNumber, "200");
|
| 13146 |
manish.sha |
240 |
hpanel.add(freebieWarehouseId);
|
| 13234 |
manish.sha |
241 |
hpanel.setCellWidth(freebieWarehouseId, "200");
|
| 13146 |
manish.sha |
242 |
vpanel.add(hpanel);
|
|
|
243 |
itemNumbersBoxList.add(itemNumber);
|
|
|
244 |
serialNumbersBoxList.add(serialNumber);
|
|
|
245 |
freebieWarehouseIdBoxList.add(freebieWarehouseId);
|
|
|
246 |
}
|
|
|
247 |
}
|
|
|
248 |
else {
|
|
|
249 |
|
|
|
250 |
hpanel = new HorizontalPanel();
|
|
|
251 |
hpanel.setSpacing(5);
|
| 13231 |
manish.sha |
252 |
tmpLabel = new Label(orderId+"");
|
|
|
253 |
hpanel.add(tmpLabel);
|
| 13233 |
manish.sha |
254 |
hpanel.setCellWidth(tmpLabel, "50");
|
| 13231 |
manish.sha |
255 |
tmpLabel = new Label(billTogetherOrdersMap.get(orderId).get("ProductName"));
|
|
|
256 |
hpanel.add(tmpLabel);
|
| 13234 |
manish.sha |
257 |
hpanel.setCellWidth(tmpLabel, "250");
|
| 13231 |
manish.sha |
258 |
tmpLabel = new Label(quantity+"");
|
|
|
259 |
hpanel.add(tmpLabel);
|
|
|
260 |
hpanel.setCellWidth(tmpLabel, "50");
|
| 13146 |
manish.sha |
261 |
itemNumber = new TextBox();
|
|
|
262 |
serialNumber = new TextBox();
|
|
|
263 |
freebieWarehouseId = new TextBox();
|
|
|
264 |
if(!hasSerialized){
|
|
|
265 |
serialNumber.setEnabled(false);
|
|
|
266 |
}
|
|
|
267 |
if(!hasFreebie){
|
|
|
268 |
freebieWarehouseId.setEnabled(false);
|
|
|
269 |
}
|
|
|
270 |
freebieWarehouseId.addKeyPressHandler(new KeyPressHandler() {
|
|
|
271 |
@Override
|
|
|
272 |
public void onKeyPress(KeyPressEvent event) {
|
|
|
273 |
// TODO Auto-generated method stub
|
|
|
274 |
if (!Character.isDigit(event.getCharCode())) {
|
|
|
275 |
((TextBox) event.getSource()).cancelKey();
|
|
|
276 |
}
|
|
|
277 |
}
|
|
|
278 |
});
|
| 20731 |
kshitij.so |
279 |
// hpanel.add(itemNumber);
|
|
|
280 |
// hpanel.setCellWidth(itemNumber, "200");
|
|
|
281 |
itemNumber.setText("1");
|
| 13146 |
manish.sha |
282 |
hpanel.add(serialNumber);
|
| 13234 |
manish.sha |
283 |
hpanel.setCellWidth(serialNumber, "200");
|
| 13146 |
manish.sha |
284 |
hpanel.add(freebieWarehouseId);
|
| 13234 |
manish.sha |
285 |
hpanel.setCellWidth(freebieWarehouseId, "200");
|
| 13146 |
manish.sha |
286 |
vpanel.add(hpanel);
|
|
|
287 |
itemNumbersBoxList.add(itemNumber);
|
|
|
288 |
serialNumbersBoxList.add(serialNumber);
|
|
|
289 |
freebieWarehouseIdBoxList.add(freebieWarehouseId);
|
|
|
290 |
}
|
|
|
291 |
|
|
|
292 |
//itemNumbersBoxMap, serialNumbersBoxMap, freebieWarehouseIdBoxMap
|
|
|
293 |
itemNumbersBoxMap.put(orderId, itemNumbersBoxList);
|
|
|
294 |
serialNumbersBoxMap.put(orderId, serialNumbersBoxList);
|
|
|
295 |
freebieWarehouseIdBoxMap.put(orderId, freebieWarehouseIdBoxList);
|
|
|
296 |
}
|
| 13710 |
manish.sha |
297 |
hpanel = new HorizontalPanel();
|
|
|
298 |
hpanel.setSpacing(5);
|
|
|
299 |
hpanel.add(submitbutton);
|
|
|
300 |
hpanel.add(cancelButton);
|
|
|
301 |
vpanel.add(hpanel);
|
|
|
302 |
vpanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
|
| 13146 |
manish.sha |
303 |
|
| 1146 |
chandransh |
304 |
setWidget(vpanel);
|
| 13710 |
manish.sha |
305 |
setAutoHideEnabled(false);
|
| 1146 |
chandransh |
306 |
setGlassEnabled(true);
|
| 13146 |
manish.sha |
307 |
setText("Enter all the details below:");
|
| 1146 |
chandransh |
308 |
setModal(true);
|
| 13146 |
manish.sha |
309 |
setWidth("1000px");
|
|
|
310 |
|
|
|
311 |
|
| 1146 |
chandransh |
312 |
submitbutton.addClickHandler(new ClickHandler() {
|
|
|
313 |
@Override
|
|
|
314 |
public void onClick(ClickEvent event) {
|
| 20730 |
kshitij.so |
315 |
long jacketNumber = 1;
|
| 13146 |
manish.sha |
316 |
String itemNumber = "";
|
| 5442 |
rajveer |
317 |
String serialNumber = "";
|
| 13146 |
manish.sha |
318 |
long freebieWhId = -1;
|
| 20767 |
kshitij.so |
319 |
String packageDimension = "";
|
| 20730 |
kshitij.so |
320 |
// try {
|
|
|
321 |
// jacketNumber = Long.parseLong(jacketNumberBox.getText());
|
|
|
322 |
// } catch(NumberFormatException nfe){
|
|
|
323 |
// nfe.printStackTrace();
|
|
|
324 |
// }
|
| 2352 |
chandransh |
325 |
|
|
|
326 |
if(jacketNumber <= 0){
|
|
|
327 |
errorLabel.setText("Invalid Jacket number.");
|
|
|
328 |
return;
|
|
|
329 |
}
|
| 13146 |
manish.sha |
330 |
|
| 20731 |
kshitij.so |
331 |
try{
|
| 20767 |
kshitij.so |
332 |
packageDimension = (packageDimensions.getValue(packageDimensions.getSelectedIndex()));
|
|
|
333 |
System.out.println("Package Dimensions "+packageDimension);
|
| 20731 |
kshitij.so |
334 |
}
|
|
|
335 |
catch(Exception e){
|
|
|
336 |
e.printStackTrace();
|
|
|
337 |
}
|
|
|
338 |
|
| 20767 |
kshitij.so |
339 |
if (packageDimension.isEmpty()){
|
| 20731 |
kshitij.so |
340 |
errorLabel.setText("Invalid Package Dimensions");
|
|
|
341 |
return;
|
|
|
342 |
}
|
|
|
343 |
|
| 13146 |
manish.sha |
344 |
for(Long orderId : billTogetherOrdersMap.keySet()){
|
|
|
345 |
boolean isSerialized = Boolean.parseBoolean(billTogetherOrdersMap.get(orderId).get("IsSerialized"));
|
|
|
346 |
boolean isFreebie = Boolean.parseBoolean(billTogetherOrdersMap.get(orderId).get("IsFreebie"));
|
|
|
347 |
for(TextBox tb : itemNumbersBoxMap.get(orderId)){
|
|
|
348 |
itemNumber = tb.getText();
|
|
|
349 |
if(itemNumber==null || itemNumber.trim().isEmpty()){
|
|
|
350 |
errorLabel.setText("Item Number can't be left empty for Order Id:- "+ orderId);
|
| 5530 |
mandeep.dh |
351 |
return;
|
|
|
352 |
}
|
| 7190 |
amar.kumar |
353 |
}
|
| 13146 |
manish.sha |
354 |
|
|
|
355 |
if(isSerialized){
|
|
|
356 |
for(TextBox tb : serialNumbersBoxMap.get(orderId)){
|
|
|
357 |
serialNumber = tb.getText();
|
|
|
358 |
if(serialNumber==null || serialNumber.trim().isEmpty()){
|
|
|
359 |
errorLabel.setText("Serial Number can't be left empty for Order Id:- "+ orderId);
|
|
|
360 |
return;
|
|
|
361 |
}
|
|
|
362 |
}
|
| 5411 |
rajveer |
363 |
}
|
| 13146 |
manish.sha |
364 |
|
|
|
365 |
if(isFreebie){
|
|
|
366 |
for(TextBox tb : freebieWarehouseIdBoxMap.get(orderId)){
|
|
|
367 |
try {
|
|
|
368 |
freebieWhId = Long.parseLong(tb.getText());
|
|
|
369 |
} catch(NumberFormatException nfe){
|
|
|
370 |
nfe.printStackTrace();
|
|
|
371 |
}
|
|
|
372 |
|
|
|
373 |
if(freebieWhId <= 0){
|
|
|
374 |
errorLabel.setText("Freebie Warehouse Id can't be left empty for Order Id:- "+ orderId);
|
|
|
375 |
return;
|
|
|
376 |
}
|
|
|
377 |
}
|
|
|
378 |
}
|
| 5411 |
rajveer |
379 |
}
|
| 13227 |
manish.sha |
380 |
|
| 20730 |
kshitij.so |
381 |
// String invoiceType = !changeInvoiceType.isEnabled() ? "Individual" : changeInvoiceType.getValue() ? "BulkInvoice" : "Individual";
|
|
|
382 |
String invoiceType = "Individual";
|
| 13146 |
manish.sha |
383 |
setValuesInDesiredMaps(billTogetherOrdersMap);
|
| 20767 |
kshitij.so |
384 |
eventBus.fireEvent(new AddJacketNumberEvent(order, billNumber.getText(), jacketNumber, itemNumbersMap, serialNumbersMap, freebieWarehouseIdMap, user, billingType, invoiceType, packageDimension));
|
| 2352 |
chandransh |
385 |
hide();
|
|
|
386 |
clean();
|
| 1146 |
chandransh |
387 |
}
|
|
|
388 |
});
|
| 13710 |
manish.sha |
389 |
|
|
|
390 |
cancelButton.addClickHandler(new ClickHandler() {
|
|
|
391 |
|
|
|
392 |
@Override
|
|
|
393 |
public void onClick(ClickEvent event) {
|
|
|
394 |
hide();
|
|
|
395 |
clean();
|
|
|
396 |
}
|
|
|
397 |
});
|
| 1146 |
chandransh |
398 |
}
|
|
|
399 |
|
| 5110 |
mandeep.dh |
400 |
public void clean() {
|
| 20730 |
kshitij.so |
401 |
// jacketNumberBox.setText("");
|
| 1146 |
chandransh |
402 |
errorLabel.setText("");
|
| 5110 |
mandeep.dh |
403 |
warehousePickSuggestion.setText("");
|
| 1146 |
chandransh |
404 |
}
|
| 2352 |
chandransh |
405 |
|
| 13146 |
manish.sha |
406 |
public void setValuesInDesiredMaps(Map<Long, Map<String, String>> billOrdersMap){
|
|
|
407 |
for(Long orderId : billOrdersMap.keySet()){
|
|
|
408 |
List<TextBox> itemNumbersBoxList = itemNumbersBoxMap.get(orderId);
|
|
|
409 |
|
|
|
410 |
Map<String, String> orderValuesMap = billOrdersMap.get(orderId);
|
|
|
411 |
boolean hasSerialized = Boolean.parseBoolean(orderValuesMap.get("IsSerialized"));
|
|
|
412 |
boolean hasFreebie = Boolean.parseBoolean(orderValuesMap.get("IsFreebie"));
|
|
|
413 |
|
|
|
414 |
List<String> itemNumbers = new ArrayList<String>();
|
|
|
415 |
|
|
|
416 |
for(TextBox tb : itemNumbersBoxList){
|
|
|
417 |
itemNumbers.add(tb.getText().trim());
|
|
|
418 |
}
|
|
|
419 |
|
|
|
420 |
itemNumbersMap.put(orderId, itemNumbers);
|
|
|
421 |
|
|
|
422 |
if(hasSerialized){
|
|
|
423 |
List<TextBox> serialNumbersBoxList = serialNumbersBoxMap.get(orderId);
|
|
|
424 |
List<String> serialNumbers = new ArrayList<String>();
|
|
|
425 |
for(TextBox tb : serialNumbersBoxList){
|
|
|
426 |
serialNumbers.add(tb.getText().trim());
|
|
|
427 |
}
|
|
|
428 |
serialNumbersMap.put(orderId, serialNumbers);
|
|
|
429 |
} else{
|
|
|
430 |
//itemNumbersMap, serialNumbersMap, freebieWarehouseIdMap
|
|
|
431 |
serialNumbersMap.put(orderId, new ArrayList<String>());
|
|
|
432 |
}
|
|
|
433 |
|
|
|
434 |
if(hasFreebie){
|
|
|
435 |
List<TextBox> freebieWarehouseIdBoxList = freebieWarehouseIdBoxMap.get(orderId);
|
|
|
436 |
List<Long> freebieWhIds = new ArrayList<Long>();
|
|
|
437 |
for(TextBox tb : freebieWarehouseIdBoxList){
|
|
|
438 |
freebieWhIds.add(Long.parseLong(tb.getText().trim()));
|
|
|
439 |
}
|
|
|
440 |
freebieWarehouseIdMap.put(orderId, freebieWhIds);
|
|
|
441 |
} else {
|
|
|
442 |
freebieWarehouseIdMap.put(orderId, new ArrayList<Long>());
|
|
|
443 |
}
|
|
|
444 |
}
|
|
|
445 |
}
|
|
|
446 |
|
| 4658 |
mandeep.dh |
447 |
private HorizontalPanel getHorizontalPanel(Label label, Widget textBox) {
|
| 2352 |
chandransh |
448 |
HorizontalPanel hpanel = new HorizontalPanel();
|
|
|
449 |
hpanel.setSpacing(5);
|
|
|
450 |
hpanel.add(label);
|
|
|
451 |
hpanel.add(textBox);
|
|
|
452 |
hpanel.setCellWidth(label, "120px");
|
|
|
453 |
return hpanel;
|
|
|
454 |
}
|
| 1146 |
chandransh |
455 |
}
|