| Line 45... |
Line 45... |
| 45 |
* It also contains vendor item pricings, vendor item keys, and item availability in tabular format.
|
45 |
* It also contains vendor item pricings, vendor item keys, and item availability in tabular format.
|
| 46 |
* Item availability is made invisible for time being
|
46 |
* Item availability is made invisible for time being
|
| 47 |
*/
|
47 |
*/
|
| 48 |
public class ItemDetails extends ResizeComposite implements ComingSoon {
|
48 |
public class ItemDetails extends ResizeComposite implements ComingSoon {
|
| 49 |
|
49 |
|
| 50 |
private final int TABLE_INDEX_MAPPING_VENDOR_DESC = 0,
|
50 |
private final int TABLE_INDEX_MAPPING_VENDOR_DESC = 0,
|
| 51 |
TABLE_INDEX_MAPPING_ITEM_KEY = 1,
|
51 |
TABLE_INDEX_MAPPING_ITEM_KEY = 1,
|
| 52 |
TABLE_INDEX_MAPPING_BUTTON = 2,
|
52 |
TABLE_INDEX_MAPPING_BUTTON = 2,
|
| 53 |
TABLE_INDEX_MAPPING_VENDORID = 3,
|
53 |
TABLE_INDEX_MAPPING_VENDORID = 3,
|
| 54 |
TABLE_INDEX_MAPPING_ITEM_KEY_OLD = 4;
|
54 |
TABLE_INDEX_MAPPING_ITEM_KEY_OLD = 4;
|
| 55 |
|
55 |
|
| 56 |
private final int TABLE_INDEX_PRICING_VENDOR_DESC = 0,
|
56 |
private final int TABLE_INDEX_PRICING_VENDOR_DESC = 0,
|
| 57 |
TABLE_INDEX_PRICING_MOP = 1,
|
57 |
TABLE_INDEX_PRICING_MOP = 1,
|
| 58 |
TABLE_INDEX_PRICING_DP = 2,
|
58 |
TABLE_INDEX_PRICING_DP = 2,
|
| 59 |
TABLE_INDEX_PRICING_TP = 3,
|
59 |
TABLE_INDEX_PRICING_TP = 3,
|
| 60 |
TABLE_INDEX_PRICING_NLC = 4,
|
60 |
TABLE_INDEX_PRICING_NLC = 4,
|
| 61 |
TABLE_INDEX_PRICING_BUTTON = 5,
|
61 |
TABLE_INDEX_PRICING_BUTTON = 5,
|
| 62 |
TABLE_INDEX_PRICING_VENDORID = 6;
|
62 |
TABLE_INDEX_PRICING_VENDORID = 6;
|
| 63 |
|
63 |
|
| 64 |
private final int TABLE_INDEX_SOURCE_PRICING_SOURCE_DESC = 0,
|
64 |
private final int TABLE_INDEX_SOURCE_PRICING_SOURCE_DESC = 0,
|
| 65 |
TABLE_INDEX_SOURCE_PRICING_MRP = 1,
|
65 |
TABLE_INDEX_SOURCE_PRICING_MRP = 1,
|
| 66 |
TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE = 2,
|
66 |
TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE = 2,
|
| 67 |
TABLE_INDEX_SOURCE_PRICING_BUTTON = 3,
|
67 |
TABLE_INDEX_SOURCE_PRICING_BUTTON = 3,
|
| 68 |
TABLE_INDEX_SOURCE_PRICING_SOURCE_ID = 4;
|
68 |
TABLE_INDEX_SOURCE_PRICING_SOURCE_ID = 4;
|
| 69 |
|
69 |
|
| 70 |
private final int TABLE_INDEX_WAREHOUSE_ID = 0,
|
70 |
private final int TABLE_INDEX_WAREHOUSE_ID = 0,
|
| 71 |
TABLE_INDEX_WAREHOUSE_DESC = 1,
|
71 |
TABLE_INDEX_WAREHOUSE_DESC = 1,
|
| 72 |
TABLE_INDEX_WAREHOUSE_INVA = 2,
|
72 |
TABLE_INDEX_WAREHOUSE_INVA = 2,
|
| 73 |
TABLE_INDEX_WAREHOUSE_INVR = 3,
|
73 |
TABLE_INDEX_WAREHOUSE_INVR = 3,
|
| 74 |
TABLE_INDEX_WAREHOUSE_HELD = 4,
|
74 |
TABLE_INDEX_WAREHOUSE_HELD = 4,
|
| 75 |
TABLE_INDEX_WAREHOUSE_EBAY_HELD = 5,
|
75 |
TABLE_INDEX_WAREHOUSE_EBAY_HELD = 5,
|
| 76 |
TABLE_INDEX_WAREHOUSE_SNAPDEAL_HELD = 6,
|
76 |
TABLE_INDEX_WAREHOUSE_SNAPDEAL_HELD = 6,
|
| 77 |
TABLE_INDEX_WAREHOUSE_FLIPKART_HELD = 7,
|
77 |
TABLE_INDEX_WAREHOUSE_FLIPKART_HELD = 7,
|
| 78 |
TABLE_INDEX_WAREHOUSE_GET_BUTTON = 8,
|
78 |
TABLE_INDEX_WAREHOUSE_GET_BUTTON = 8,
|
| 79 |
TABLE_INDEX_WAREHOUSE_UPDATE_BUTTON = 9;
|
79 |
TABLE_INDEX_WAREHOUSE_UPDATE_BUTTON = 9;
|
| 80 |
|
80 |
|
| 81 |
private final int TABLE_INDEX_WAREHOUSE_NAME = 0,
|
81 |
private final int TABLE_INDEX_WAREHOUSE_NAME = 0,
|
| 82 |
TABLE_INDEX_WAREHOUSE_ADD_DEL_BUTTON = 1;
|
82 |
TABLE_INDEX_WAREHOUSE_ADD_DEL_BUTTON = 1;
|
| 83 |
|
83 |
|
| 84 |
private final int TABLE_INDEX_SIMILAR_ITEMS_CATALOG_ITEM_ID = 0,
|
84 |
private final int TABLE_INDEX_STATE_NAME = 0,
|
| 85 |
TABLE_INDEX_SIMILAR_ITEMS_PRODUCT_GROUP = 1,
|
85 |
TABLE_INDEX_STATE_TAX_PERCENTAGE = 1;
|
| 86 |
TABLE_INDEX_SIMILAR_ITEMS_BRAND = 2,
|
86 |
|
| 87 |
TABLE_INDEX_SIMILAR_ITEMS_MODEL_NUMBER = 3,
|
87 |
|
| 88 |
TABLE_INDEX_SIMILAR_ITEMS_MODEL_NAME = 4,
|
88 |
private final int TABLE_INDEX_SIMILAR_ITEMS_CATALOG_ITEM_ID = 0,
|
| 89 |
TABLE_INDEX_SIMILAR_ITEMS_CATEGORY = 5,
|
89 |
TABLE_INDEX_SIMILAR_ITEMS_PRODUCT_GROUP = 1,
|
| 90 |
TABLE_INDEX_SIMILAR_ITEMS_BUTTON = 6;
|
90 |
TABLE_INDEX_SIMILAR_ITEMS_BRAND = 2,
|
| 91 |
|
91 |
TABLE_INDEX_SIMILAR_ITEMS_MODEL_NUMBER = 3,
|
| 92 |
private final int TABLE_INDEX_VOUCHERS_TYPE = 0,
|
92 |
TABLE_INDEX_SIMILAR_ITEMS_MODEL_NAME = 4,
|
| 93 |
TABLE_INDEX_VOUCHERS_AMOUNT = 1,
|
93 |
TABLE_INDEX_SIMILAR_ITEMS_CATEGORY = 5,
|
| 94 |
TABLE_INDEX_VOUCHERS_ADD_EDIT_BUTTON = 2,
|
94 |
TABLE_INDEX_SIMILAR_ITEMS_BUTTON = 6;
|
| 95 |
TABLE_INDEX_VOUCHERS_DEL_BUTTON = 3;
|
95 |
|
| 96 |
|
96 |
private final int TABLE_INDEX_VOUCHERS_TYPE = 0,
|
| 97 |
private final String MANDATORY_MRP = "MRP",
|
97 |
TABLE_INDEX_VOUCHERS_AMOUNT = 1,
|
| 98 |
MANDATORY_WEIGHT = "Weight",
|
98 |
TABLE_INDEX_VOUCHERS_ADD_EDIT_BUTTON = 2,
|
| 99 |
MANDATORY_BEST_DEAL_TEXT = "Best Deal Text",
|
99 |
TABLE_INDEX_VOUCHERS_DEL_BUTTON = 3;
|
| 100 |
MANDATORY_BEST_DEAL_DETAIL_TEXT = "Best Deal Detail Text",
|
100 |
|
| 101 |
MANDATORY_BEST_DEAL_DETAIL_LINK = "Best Deal Detail Link",
|
101 |
private final String MANDATORY_MRP = "MRP",
|
| 102 |
MANDATORY_BRAND = "Brand",
|
102 |
MANDATORY_WEIGHT = "Weight",
|
| 103 |
MANDATORY_MODEL_NO = "Model Number",
|
103 |
MANDATORY_BEST_DEAL_TEXT = "Best Deal Text",
|
| 104 |
MANDATORY_MODEL_NAME = "Model Name";
|
104 |
MANDATORY_BEST_DEAL_DETAIL_TEXT = "Best Deal Detail Text",
|
| 105 |
|
105 |
MANDATORY_BEST_DEAL_DETAIL_LINK = "Best Deal Detail Link",
|
| 106 |
|
106 |
MANDATORY_BRAND = "Brand",
|
| 107 |
private final String OPTIONAL_SELLING_PRICE = "Selling Price",
|
107 |
MANDATORY_MODEL_NO = "Model Number",
|
| 108 |
OPTIONAL_VENDOR_PRICING = "Vendor Pricing",
|
108 |
MANDATORY_MODEL_NAME = "Model Name";
|
| 109 |
OPTIONAL_PREFERRED_VENDOR = "Preferred Vendor",
|
109 |
|
| 110 |
OPTIONAL_PREFERRED_INSURER = "Preferred Insurer",
|
110 |
|
| 111 |
OPTIONAL_SOURCE_PRICING = "Source Pricing",
|
111 |
private final String OPTIONAL_SELLING_PRICE = "Selling Price",
|
| 112 |
OPTIONAL_FREEBIE_ITEM_ID = "Freebie Item Id";
|
112 |
OPTIONAL_VENDOR_PRICING = "Vendor Pricing",
|
| 113 |
|
113 |
OPTIONAL_PREFERRED_VENDOR = "Preferred Vendor",
|
| 114 |
private final String PRICE_WIDTH = "100px", VENDOR_DESC_WIDTH = "130px",
|
114 |
OPTIONAL_PREFERRED_INSURER = "Preferred Insurer",
|
| 115 |
VENDOR_ID_WIDTH = "100px", ITEM_KEY_WIDTH = "200px",
|
115 |
OPTIONAL_SOURCE_PRICING = "Source Pricing",
|
| 116 |
BUTTON_WIDTH = "50px";
|
116 |
OPTIONAL_FREEBIE_ITEM_ID = "Freebie Item Id";
|
| 117 |
|
117 |
|
| 118 |
private Map<String, String> ConfigMap;
|
118 |
private final String PRICE_WIDTH = "100px", VENDOR_DESC_WIDTH = "130px",
|
| 119 |
interface ItemDetailsUiBinder extends UiBinder<Widget, ItemDetails> {}
|
119 |
VENDOR_ID_WIDTH = "100px", ITEM_KEY_WIDTH = "200px",
|
| 120 |
private static ItemDetailsUiBinder uiBinder = GWT.create(ItemDetailsUiBinder.class);
|
120 |
BUTTON_WIDTH = "50px";
|
| 121 |
private final CatalogServiceAsync catalogService = GWT.create(CatalogService.class);
|
121 |
|
| 122 |
Map<String, Object> mandatoryChangedValMap;
|
122 |
private Map<String, String> ConfigMap;
|
| 123 |
Map<String, Object> optionalChangedValMap;
|
123 |
interface ItemDetailsUiBinder extends UiBinder<Widget, ItemDetails> {}
|
| 124 |
|
124 |
private static ItemDetailsUiBinder uiBinder = GWT.create(ItemDetailsUiBinder.class);
|
| 125 |
|
125 |
private final CatalogServiceAsync catalogService = GWT.create(CatalogService.class);
|
| 126 |
interface ItemDetailStyle extends CssResource{
|
126 |
Map<String, Object> mandatoryChangedValMap;
|
| 127 |
String greenLabel();
|
127 |
Map<String, Object> optionalChangedValMap;
|
| 128 |
String fieldChanged();
|
128 |
|
| 129 |
}
|
129 |
|
| 130 |
|
130 |
interface ItemDetailStyle extends CssResource{
|
| 131 |
private Item item, newItem;
|
131 |
String greenLabel();
|
| 132 |
private CatalogDashboard catalogDashboardPanel;
|
132 |
String fieldChanged();
|
| 133 |
|
133 |
}
|
| 134 |
@UiField ItemDetailStyle style;
|
- |
|
| 135 |
@UiField Label itemId;
|
- |
|
| 136 |
@UiField TextBox brand, modelNumber, modelName, color;
|
- |
|
| 137 |
@UiField Label contentCategory, catalogItemId, productGroup;
|
- |
|
| 138 |
@UiField TextBox statusDesc, comments;
|
- |
|
| 139 |
@UiField TextBox sellingPrice, mrp, weight;
|
- |
|
| 140 |
@UiField Label addedOn, retireDate, updatedOn;
|
- |
|
| 141 |
@UiField Label itemStatus;
|
- |
|
| 142 |
@UiField TextBox bestDealsText, bestDealsValue ,bestDealsDetailsText,bestDealsDetailsLink;
|
- |
|
| 143 |
@UiField FlexTable headerAvailability, availabilityTable;
|
- |
|
| 144 |
@UiField FlexTable headerVendorItemKey, tableVendorItemKey;
|
- |
|
| 145 |
@UiField FlexTable headerVendorPrices, tableVendorPrices;
|
- |
|
| 146 |
@UiField FlexTable headerSourcePrices, tableSourcePrices;
|
- |
|
| 147 |
@UiField TextBox bestSellingRank;
|
- |
|
| 148 |
@UiField TextBox expectedDelay;
|
- |
|
| 149 |
@UiField CheckBox defaultForEntity, risky, warehouseStickiness, itemType, hasItemNo, showSellingPrice, holdOverride;
|
- |
|
| 150 |
@UiField DateBox startDate, expectedArrivalDate, comingSoonStartDate;
|
- |
|
| 151 |
@UiField FlexTable headerSimilarItems, tableSimilarItems;
|
- |
|
| 152 |
@UiField ListBox preferredVendor,preferredInsurer;
|
- |
|
| 153 |
@UiField Button comingSoonButton;
|
- |
|
| 154 |
@UiField FlexTable headerVouchers, tableVouchers;
|
- |
|
| 155 |
@UiField FlexTable headerIgnoredWarehouse,tableIgnoredWarehouse;
|
- |
|
| 156 |
@UiField TextBox minStockLevel, numOfDaysStock;
|
- |
|
| 157 |
@UiField TextBox lastNdaySale, websiteLastNdaySale, amazonLastNdaySale, ebayLastNdaySale, snapdealLastNdaySale, flipkartLastNdaySale;
|
- |
|
| 158 |
@UiField TextBox freebieItemId;
|
- |
|
| 159 |
@UiField TextBox asin;
|
- |
|
| 160 |
@UiField TextBox holdInventory;
|
- |
|
| 161 |
@UiField TextBox defaultInventory;
|
- |
|
| 162 |
|
- |
|
| 163 |
public ItemDetails(Item item){
|
- |
|
| 164 |
this();
|
- |
|
| 165 |
setItemDetails(item);
|
- |
|
| 166 |
}
|
- |
|
| 167 |
|
- |
|
| 168 |
public ItemDetails() {
|
- |
|
| 169 |
initWidget(uiBinder.createAndBindUi(this));
|
- |
|
| 170 |
initAvailabilityHeader();
|
- |
|
| 171 |
initVendorKeysHeader();
|
- |
|
| 172 |
initVendorPricingHeader();
|
- |
|
| 173 |
initSourcePricingHeader();
|
- |
|
| 174 |
initSimilarItemList();
|
- |
|
| 175 |
initVoucherHeader();
|
- |
|
| 176 |
initIgnoredWarehouseHeader();
|
- |
|
| 177 |
preferredVendor.addItem("null");
|
- |
|
| 178 |
preferredInsurer.addItem("null");
|
- |
|
| 179 |
getConfigdataforPriceCompare();
|
- |
|
| 180 |
}
|
- |
|
| 181 |
|
134 |
|
| 182 |
public void getConfigdataforPriceCompare(){
|
- |
|
| 183 |
catalogService.getConfigdataforPriceCompare(new AsyncCallback<Map<String,String>>() {
|
- |
|
| 184 |
@Override
|
- |
|
| 185 |
public void onSuccess(Map<String, String> result) {
|
- |
|
| 186 |
ConfigMap = result;
|
135 |
private Item item, newItem;
|
| 187 |
}
|
- |
|
| 188 |
@Override
|
- |
|
| 189 |
public void onFailure(Throwable caught) {
|
136 |
private CatalogDashboard catalogDashboardPanel;
|
| 190 |
caught.printStackTrace();
|
- |
|
| 191 |
}
|
- |
|
| 192 |
});
|
- |
|
| 193 |
}
|
- |
|
| 194 |
|
137 |
|
| 195 |
/**
|
138 |
@UiField ItemDetailStyle style;
|
| 196 |
* Sets the UI fields with item object attributes
|
139 |
@UiField Label itemId;
|
| 197 |
* Also populates tables for vendor prices, keys and item availability
|
140 |
@UiField TextBox brand, modelNumber, modelName, color;
|
| 198 |
* @param item
|
141 |
@UiField Label contentCategory, catalogItemId, productGroup;
|
| 199 |
*/
|
142 |
@UiField TextBox statusDesc, comments;
|
| 200 |
public void setItemDetails(Item item){
|
143 |
@UiField TextBox sellingPrice, mrp, weight;
|
| 201 |
this.item = item;
|
144 |
@UiField Label addedOn, retireDate, updatedOn;
|
| 202 |
itemId.setText(item.getId()+"");
|
145 |
@UiField Label itemStatus;
|
| 203 |
productGroup.setText(item.getProductGroup());
|
146 |
@UiField TextBox bestDealsText, bestDealsValue ,bestDealsDetailsText,bestDealsDetailsLink;
|
| 204 |
brand.setText(item.getBrand());
|
147 |
@UiField FlexTable headerAvailability, availabilityTable;
|
| 205 |
modelNumber.setText(item.getModelNumber());
|
148 |
@UiField FlexTable headerVendorItemKey, tableVendorItemKey;
|
| 206 |
modelName.setText(item.getModelName());
|
149 |
@UiField FlexTable headerVendorPrices, tableVendorPrices;
|
| 207 |
color.setText(item.getColor());
|
150 |
@UiField FlexTable headerSourcePrices, tableSourcePrices;
|
| 208 |
|
151 |
@UiField TextBox bestSellingRank;
|
| 209 |
statusDesc.setText(item.getItemStatusDesc());
|
152 |
@UiField TextBox expectedDelay;
|
| 210 |
contentCategory.setText(item.getContentCategory()+"");
|
153 |
@UiField CheckBox defaultForEntity, risky, warehouseStickiness, itemType, hasItemNo, showSellingPrice, holdOverride;
|
| 211 |
comments.setText(item.getComments());
|
154 |
@UiField DateBox startDate, expectedArrivalDate, comingSoonStartDate;
|
| 212 |
catalogItemId.setText(item.getCatalogItemId() + "");
|
155 |
@UiField FlexTable headerSimilarItems, tableSimilarItems;
|
| 213 |
preferredInsurer.clear();
|
156 |
@UiField ListBox preferredVendor,preferredInsurer;
|
| 214 |
preferredVendor.clear();
|
157 |
@UiField Button comingSoonButton;
|
| 215 |
int index = -1;
|
158 |
@UiField FlexTable headerVouchers, tableVouchers;
|
| 216 |
if (item.getPreferredVendor() == null) {
|
159 |
@UiField FlexTable headerIgnoredWarehouse,tableIgnoredWarehouse;
|
| 217 |
index++;
|
160 |
@UiField FlexTable headerVatDetails,tableVatDetails;
|
| 218 |
preferredVendor.addItem("select");
|
161 |
@UiField TextBox minStockLevel, numOfDaysStock;
|
| 219 |
}
|
162 |
@UiField TextBox lastNdaySale, websiteLastNdaySale, amazonLastNdaySale, ebayLastNdaySale, snapdealLastNdaySale, flipkartLastNdaySale;
|
| 220 |
|
163 |
@UiField TextBox freebieItemId;
|
| 221 |
if((item.getVendorPricesMap() == null || item.getVendorPricesMap().isEmpty())) {
|
164 |
@UiField TextBox asin;
|
| 222 |
if(item.getPreferredVendor() != null) {
|
165 |
@UiField TextBox holdInventory;
|
| 223 |
index++;
|
166 |
@UiField TextBox defaultInventory;
|
| 224 |
preferredVendor.addItem(Utils.getVendorDesc(item.getPreferredVendor()));
|
167 |
|
| 225 |
}
|
168 |
public ItemDetails(Item item){
|
| 226 |
}
|
169 |
this();
|
| 227 |
else {
|
170 |
setItemDetails(item);
|
| 228 |
for(VendorPricings vendorDetail : item.getVendorPricesMap().values()){
|
171 |
}
|
| 229 |
index++;
|
172 |
|
| 230 |
preferredVendor.addItem(Utils.getVendorDesc(vendorDetail.getVendorId()));
|
173 |
public ItemDetails() {
|
| 231 |
if(item.getPreferredVendor() != null && item.getPreferredVendor() == vendorDetail.getVendorId()) {
|
174 |
initWidget(uiBinder.createAndBindUi(this));
|
| 232 |
preferredVendor.setSelectedIndex(index);
|
175 |
initAvailabilityHeader();
|
| 233 |
}
|
176 |
initVendorKeysHeader();
|
| 234 |
}
|
177 |
initVendorPricingHeader();
|
| 235 |
|
178 |
initSourcePricingHeader();
|
| 236 |
if(item.getPreferredVendor() != null && !item.getVendorPricesMap().containsKey(item.getPreferredVendor())){
|
179 |
initSimilarItemList();
|
| 237 |
index++;
|
180 |
initVoucherHeader();
|
| 238 |
preferredVendor.addItem(Utils.getVendorDesc(item.getPreferredVendor()));
|
181 |
initIgnoredWarehouseHeader();
|
| 239 |
preferredVendor.setSelectedIndex(index);
|
182 |
preferredVendor.addItem("null");
|
| 240 |
}
|
183 |
preferredInsurer.addItem("null");
|
| 241 |
}
|
184 |
getConfigdataforPriceCompare();
|
| 242 |
index=0;
|
185 |
}
|
| 243 |
preferredInsurer.addItem("select","0");
|
186 |
|
| 244 |
preferredInsurer.setSelectedIndex(0);
|
187 |
public void getConfigdataforPriceCompare(){
|
| 245 |
for (Map.Entry<Long, String> entry : Utils.getAllInsurers().entrySet()){
|
188 |
catalogService.getConfigdataforPriceCompare(new AsyncCallback<Map<String,String>>() {
|
| 246 |
index++;
|
189 |
@Override
|
| 247 |
preferredInsurer.addItem(entry.getValue(),entry.getKey().toString());
|
190 |
public void onSuccess(Map<String, String> result) {
|
| 248 |
if(item.getPreferredInsurer()==entry.getKey()){
|
191 |
ConfigMap = result;
|
| 249 |
preferredInsurer.setSelectedIndex(index);
|
192 |
}
|
| 250 |
}
|
193 |
@Override
|
| 251 |
}
|
194 |
public void onFailure(Throwable caught) {
|
| 252 |
mrp.setText(item.getMrp() != null ? item.getMrp()+"" : "");
|
195 |
caught.printStackTrace();
|
| 253 |
sellingPrice.setText(item.getSellingPrice() != null ? item.getSellingPrice()+"" : "");
|
196 |
}
|
| 254 |
weight.setText(item.getWeight() != null ? item.getWeight()+"" : "");
|
197 |
});
|
| 255 |
expectedDelay.setValue(item.getExpectedDelay()+"");
|
198 |
}
|
| 256 |
warehouseStickiness.setValue(item.isWarehouseStickiness());
|
199 |
|
| 257 |
|
200 |
/**
|
| 258 |
hasItemNo.setValue(item.isHasItemNo());
|
201 |
* Sets the UI fields with item object attributes
|
| 259 |
itemType.setValue(item.isItemType());
|
202 |
* Also populates tables for vendor prices, keys and item availability
|
| 260 |
showSellingPrice.setValue(item.isShowSellingPrice());
|
203 |
* @param item
|
| 261 |
holdOverride.setValue(item.isHoldOverride());
|
204 |
*/
|
| 262 |
|
205 |
public void setItemDetails(Item item){
|
| 263 |
startDate.setValue(new Date(item.getStartDate()));
|
206 |
this.item = item;
|
| 264 |
if(item.getComingSoonStartDate() != null){
|
207 |
itemId.setText(item.getId()+"");
|
| 265 |
comingSoonStartDate.setValue(new Date(item.getComingSoonStartDate()));
|
208 |
productGroup.setText(item.getProductGroup());
|
| 266 |
}else {
|
209 |
brand.setText(item.getBrand());
|
| 267 |
comingSoonStartDate.setValue(null);
|
210 |
modelNumber.setText(item.getModelNumber());
|
| 268 |
}
|
211 |
modelName.setText(item.getModelName());
|
| 269 |
|
212 |
color.setText(item.getColor());
|
| 270 |
if(item.getExpectedArrivalDate() != null){
|
213 |
|
| 271 |
expectedArrivalDate.setValue(new Date(item.getExpectedArrivalDate()));
|
214 |
statusDesc.setText(item.getItemStatusDesc());
|
| 272 |
}else {
|
215 |
contentCategory.setText(item.getContentCategory()+"");
|
| 273 |
expectedArrivalDate.setValue(null);
|
216 |
comments.setText(item.getComments());
|
| 274 |
}
|
217 |
catalogItemId.setText(item.getCatalogItemId() + "");
|
| 275 |
addedOn.setText(Utils.getDisplayableDate(item.getAddedOn()));
|
218 |
preferredInsurer.clear();
|
| 276 |
retireDate.setText(Utils.getDisplayableDate(item.getRetireDate()));
|
219 |
preferredVendor.clear();
|
| 277 |
updatedOn.setText(Utils.getDisplayableDate(item.getUpdatedOn()));
|
220 |
int index = -1;
|
| 278 |
|
221 |
if (item.getPreferredVendor() == null) {
|
| 279 |
bestDealsText.setText(item.getBestDealsText());
|
222 |
index++;
|
| 280 |
bestDealsDetailsText.setText(item.getBestDealsDetailsText());
|
223 |
preferredVendor.addItem("select");
|
| 281 |
bestDealsDetailsLink.setText(item.getBestDealsDetailsLink());
|
224 |
}
|
| 282 |
bestDealsValue.setText(item.getBestDealsValue() != null ? item.getBestDealsValue()+"" : "");
|
225 |
|
| 283 |
bestSellingRank.setText(item.getBestSellingRank() != null ? item.getBestSellingRank()+"" : "");
|
226 |
if((item.getVendorPricesMap() == null || item.getVendorPricesMap().isEmpty())) {
|
| 284 |
minStockLevel.setText(item.getMinStockLevel() != null ? item.getMinStockLevel()+"" : "");
|
227 |
if(item.getPreferredVendor() != null) {
|
| 285 |
lastNdaySale.setText(item.getSaleHistory().get(0L));
|
228 |
index++;
|
| 286 |
websiteLastNdaySale.setText(item.getSaleHistory().get(1L));
|
229 |
preferredVendor.addItem(Utils.getVendorDesc(item.getPreferredVendor()));
|
| 287 |
amazonLastNdaySale.setText(item.getSaleHistory().get(3L));
|
230 |
}
|
| 288 |
ebayLastNdaySale.setText(item.getSaleHistory().get(6L));
|
231 |
}
|
| 289 |
snapdealLastNdaySale.setText(item.getSaleHistory().get(7L));
|
232 |
else {
|
| 290 |
flipkartLastNdaySale.setText(item.getSaleHistory().get(8L));
|
233 |
for(VendorPricings vendorDetail : item.getVendorPricesMap().values()){
|
| 291 |
numOfDaysStock.setText(item.getNumOfDaysStock() != null ? item.getNumOfDaysStock()+"" : "");
|
234 |
index++;
|
| 292 |
defaultForEntity.setValue(item.isDefaultForEntity());
|
235 |
preferredVendor.addItem(Utils.getVendorDesc(vendorDetail.getVendorId()));
|
| 293 |
risky.setValue(item.isRisky());
|
236 |
if(item.getPreferredVendor() != null && item.getPreferredVendor() == vendorDetail.getVendorId()) {
|
| 294 |
|
237 |
preferredVendor.setSelectedIndex(index);
|
| 295 |
itemStatus.setText(item.getItemStatus());
|
238 |
}
|
| 296 |
freebieItemId.setText(item.getFreebieItemId().toString());
|
239 |
}
|
| 297 |
asin.setText(item.getAsin());
|
240 |
|
| 298 |
holdInventory.setText(Long.toString(item.getHoldInventory()));
|
241 |
if(item.getPreferredVendor() != null && !item.getVendorPricesMap().containsKey(item.getPreferredVendor())){
|
| 299 |
defaultInventory.setText(Long.toString(item.getDefaultInventory()));
|
242 |
index++;
|
| 300 |
updateAvailabilityTable(item.getItemInventory());
|
243 |
preferredVendor.addItem(Utils.getVendorDesc(item.getPreferredVendor()));
|
| 301 |
updateVendorKeysTable(item.getVendorKeysMap());
|
244 |
preferredVendor.setSelectedIndex(index);
|
| 302 |
updateVendorPricingTable(item.getVendorPricesMap());
|
245 |
}
|
| 303 |
updateSourcePricingTable(item.getSourcePricesMap());
|
246 |
}
|
| 304 |
updateSimilarItemsTable(item.getSimilarItems());
|
247 |
index=0;
|
| 305 |
updateVoucherTable(item.getVouchersMap());
|
248 |
preferredInsurer.addItem("select","0");
|
| 306 |
updateTableIgnoredWarehouse();
|
249 |
preferredInsurer.setSelectedIndex(0);
|
| 307 |
}
|
250 |
for (Map.Entry<Long, String> entry : Utils.getAllInsurers().entrySet()){
|
| 308 |
|
251 |
index++;
|
| 309 |
/**
|
252 |
preferredInsurer.addItem(entry.getValue(),entry.getKey().toString());
|
| 310 |
* initialise item availability table header.
|
253 |
if(item.getPreferredInsurer()==entry.getKey()){
|
| 311 |
*/
|
254 |
preferredInsurer.setSelectedIndex(index);
|
| 312 |
private void initAvailabilityHeader(){
|
255 |
}
|
| 313 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_ID, "100px");
|
256 |
}
|
| 314 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_DESC, "250px");
|
257 |
mrp.setText(item.getMrp() != null ? item.getMrp()+"" : "");
|
| 315 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_INVA, "100px");
|
258 |
sellingPrice.setText(item.getSellingPrice() != null ? item.getSellingPrice()+"" : "");
|
| 316 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_INVR, "100px");
|
259 |
weight.setText(item.getWeight() != null ? item.getWeight()+"" : "");
|
| 317 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_HELD, "100px");
|
260 |
expectedDelay.setValue(item.getExpectedDelay()+"");
|
| 318 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_EBAY_HELD, "80px");
|
261 |
warehouseStickiness.setValue(item.isWarehouseStickiness());
|
| 319 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_SNAPDEAL_HELD, "80px");
|
262 |
|
| 320 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_FLIPKART_HELD, "80px");
|
263 |
hasItemNo.setValue(item.isHasItemNo());
|
| 321 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_GET_BUTTON, "100px");
|
264 |
itemType.setValue(item.isItemType());
|
| 322 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_UPDATE_BUTTON, "100px");
|
265 |
showSellingPrice.setValue(item.isShowSellingPrice());
|
| 323 |
|
266 |
holdOverride.setValue(item.isHoldOverride());
|
| 324 |
headerAvailability.setText(0, TABLE_INDEX_WAREHOUSE_ID, "Warehouse Id");
|
267 |
|
| 325 |
headerAvailability.setText(0, TABLE_INDEX_WAREHOUSE_DESC, "Warehouse Desc");
|
268 |
startDate.setValue(new Date(item.getStartDate()));
|
| 326 |
headerAvailability.setText(0, TABLE_INDEX_WAREHOUSE_INVA, "Availability");
|
269 |
if(item.getComingSoonStartDate() != null){
|
| 327 |
headerAvailability.setText(0, TABLE_INDEX_WAREHOUSE_INVR, "Reserved");
|
270 |
comingSoonStartDate.setValue(new Date(item.getComingSoonStartDate()));
|
| 328 |
headerAvailability.setText(0, TABLE_INDEX_WAREHOUSE_HELD, "Held");
|
271 |
}else {
|
| 329 |
headerAvailability.setText(0, TABLE_INDEX_WAREHOUSE_EBAY_HELD, "Ebay Held");
|
272 |
comingSoonStartDate.setValue(null);
|
| 330 |
headerAvailability.setText(0, TABLE_INDEX_WAREHOUSE_SNAPDEAL_HELD, "Snapdeal Held");
|
273 |
}
|
| 331 |
headerAvailability.setText(0, TABLE_INDEX_WAREHOUSE_FLIPKART_HELD, "Flipkart Held");
|
274 |
|
| 332 |
|
275 |
if(item.getExpectedArrivalDate() != null){
|
| 333 |
Button getLiveDataButton = new Button("Get Live Data");
|
276 |
expectedArrivalDate.setValue(new Date(item.getExpectedArrivalDate()));
|
| 334 |
headerAvailability.setWidget(0, TABLE_INDEX_WAREHOUSE_GET_BUTTON, getLiveDataButton);
|
277 |
}else {
|
| 335 |
getLiveDataButton.addClickHandler(new ClickHandler() {
|
278 |
expectedArrivalDate.setValue(null);
|
| 336 |
@Override
|
279 |
}
|
| 337 |
public void onClick(ClickEvent event) {
|
280 |
addedOn.setText(Utils.getDisplayableDate(item.getAddedOn()));
|
| 338 |
catalogService.getProdItemInventory(item.getId(), new AsyncCallback<Map<Long, ItemInventory>>() {
|
281 |
retireDate.setText(Utils.getDisplayableDate(item.getRetireDate()));
|
| 339 |
@Override
|
282 |
updatedOn.setText(Utils.getDisplayableDate(item.getUpdatedOn()));
|
| 340 |
public void onSuccess(Map<Long, ItemInventory> itemInventoryMap) {
|
283 |
|
| 341 |
if(itemInventoryMap != null) {
|
284 |
bestDealsText.setText(item.getBestDealsText());
|
| 342 |
GWT.log("Inventory Data fetched");
|
285 |
bestDealsDetailsText.setText(item.getBestDealsDetailsText());
|
| 343 |
item.setItemInventory(itemInventoryMap);
|
286 |
bestDealsDetailsLink.setText(item.getBestDealsDetailsLink());
|
| 344 |
updateAvailabilityTable(item.getItemInventory());
|
287 |
bestDealsValue.setText(item.getBestDealsValue() != null ? item.getBestDealsValue()+"" : "");
|
| 345 |
}
|
288 |
bestSellingRank.setText(item.getBestSellingRank() != null ? item.getBestSellingRank()+"" : "");
|
| 346 |
else {
|
289 |
minStockLevel.setText(item.getMinStockLevel() != null ? item.getMinStockLevel()+"" : "");
|
| 347 |
GWT.log("Error fetching Inventory Data");
|
290 |
lastNdaySale.setText(item.getSaleHistory().get(0L));
|
| 348 |
Window.alert("Error fetching Inventory Data");
|
291 |
websiteLastNdaySale.setText(item.getSaleHistory().get(1L));
|
| 349 |
}
|
292 |
amazonLastNdaySale.setText(item.getSaleHistory().get(3L));
|
| 350 |
}
|
293 |
ebayLastNdaySale.setText(item.getSaleHistory().get(6L));
|
| 351 |
@Override
|
294 |
snapdealLastNdaySale.setText(item.getSaleHistory().get(7L));
|
| 352 |
public void onFailure(Throwable caught) {
|
295 |
flipkartLastNdaySale.setText(item.getSaleHistory().get(8L));
|
| 353 |
caught.printStackTrace();
|
296 |
numOfDaysStock.setText(item.getNumOfDaysStock() != null ? item.getNumOfDaysStock()+"" : "");
|
| 354 |
Window.alert("Error fetching Inventory Data");
|
297 |
defaultForEntity.setValue(item.isDefaultForEntity());
|
| 355 |
}
|
298 |
risky.setValue(item.isRisky());
|
| 356 |
});
|
299 |
|
| 357 |
}
|
300 |
itemStatus.setText(item.getItemStatus());
|
| 358 |
});
|
301 |
freebieItemId.setText(item.getFreebieItemId().toString());
|
| 359 |
|
302 |
asin.setText(item.getAsin());
|
| 360 |
Button updateLiveDataButton = new Button("Update Live Data");
|
303 |
holdInventory.setText(Long.toString(item.getHoldInventory()));
|
| 361 |
headerAvailability.setWidget(0, TABLE_INDEX_WAREHOUSE_UPDATE_BUTTON, updateLiveDataButton);
|
304 |
defaultInventory.setText(Long.toString(item.getDefaultInventory()));
|
| 362 |
/* code to be rewritten later
|
305 |
initVatDetailsHeader();
|
| - |
|
306 |
updateVatDetailsTable(item.getStateNameVatPercentageMap());
|
| - |
|
307 |
updateAvailabilityTable(item.getItemInventory());
|
| - |
|
308 |
updateVendorKeysTable(item.getVendorKeysMap());
|
| - |
|
309 |
updateVendorPricingTable(item.getVendorPricesMap());
|
| - |
|
310 |
updateSourcePricingTable(item.getSourcePricesMap());
|
| - |
|
311 |
updateSimilarItemsTable(item.getSimilarItems());
|
| - |
|
312 |
updateVoucherTable(item.getVouchersMap());
|
| - |
|
313 |
updateTableIgnoredWarehouse();
|
| - |
|
314 |
}
|
| - |
|
315 |
|
| - |
|
316 |
/**
|
| - |
|
317 |
* initialise item availability table header.
|
| - |
|
318 |
*/
|
| - |
|
319 |
private void initAvailabilityHeader(){
|
| - |
|
320 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_ID, "100px");
|
| - |
|
321 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_DESC, "250px");
|
| - |
|
322 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_INVA, "100px");
|
| - |
|
323 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_INVR, "100px");
|
| - |
|
324 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_HELD, "100px");
|
| - |
|
325 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_EBAY_HELD, "80px");
|
| - |
|
326 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_SNAPDEAL_HELD, "80px");
|
| - |
|
327 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_FLIPKART_HELD, "80px");
|
| - |
|
328 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_GET_BUTTON, "100px");
|
| - |
|
329 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_UPDATE_BUTTON, "100px");
|
| - |
|
330 |
|
| - |
|
331 |
headerAvailability.setText(0, TABLE_INDEX_WAREHOUSE_ID, "Warehouse Id");
|
| - |
|
332 |
headerAvailability.setText(0, TABLE_INDEX_WAREHOUSE_DESC, "Warehouse Desc");
|
| - |
|
333 |
headerAvailability.setText(0, TABLE_INDEX_WAREHOUSE_INVA, "Availability");
|
| - |
|
334 |
headerAvailability.setText(0, TABLE_INDEX_WAREHOUSE_INVR, "Reserved");
|
| - |
|
335 |
headerAvailability.setText(0, TABLE_INDEX_WAREHOUSE_HELD, "Held");
|
| - |
|
336 |
headerAvailability.setText(0, TABLE_INDEX_WAREHOUSE_EBAY_HELD, "Ebay Held");
|
| - |
|
337 |
headerAvailability.setText(0, TABLE_INDEX_WAREHOUSE_SNAPDEAL_HELD, "Snapdeal Held");
|
| - |
|
338 |
headerAvailability.setText(0, TABLE_INDEX_WAREHOUSE_FLIPKART_HELD, "Flipkart Held");
|
| - |
|
339 |
|
| - |
|
340 |
Button getLiveDataButton = new Button("Get Live Data");
|
| - |
|
341 |
headerAvailability.setWidget(0, TABLE_INDEX_WAREHOUSE_GET_BUTTON, getLiveDataButton);
|
| - |
|
342 |
getLiveDataButton.addClickHandler(new ClickHandler() {
|
| - |
|
343 |
@Override
|
| - |
|
344 |
public void onClick(ClickEvent event) {
|
| - |
|
345 |
catalogService.getProdItemInventory(item.getId(), new AsyncCallback<Map<Long, ItemInventory>>() {
|
| - |
|
346 |
@Override
|
| - |
|
347 |
public void onSuccess(Map<Long, ItemInventory> itemInventoryMap) {
|
| - |
|
348 |
if(itemInventoryMap != null) {
|
| - |
|
349 |
GWT.log("Inventory Data fetched");
|
| - |
|
350 |
item.setItemInventory(itemInventoryMap);
|
| - |
|
351 |
updateAvailabilityTable(item.getItemInventory());
|
| - |
|
352 |
}
|
| - |
|
353 |
else {
|
| - |
|
354 |
GWT.log("Error fetching Inventory Data");
|
| - |
|
355 |
Window.alert("Error fetching Inventory Data");
|
| - |
|
356 |
}
|
| - |
|
357 |
}
|
| - |
|
358 |
@Override
|
| - |
|
359 |
public void onFailure(Throwable caught) {
|
| - |
|
360 |
caught.printStackTrace();
|
| - |
|
361 |
Window.alert("Error fetching Inventory Data");
|
| - |
|
362 |
}
|
| - |
|
363 |
});
|
| - |
|
364 |
}
|
| - |
|
365 |
});
|
| - |
|
366 |
|
| - |
|
367 |
Button updateLiveDataButton = new Button("Update Live Data");
|
| - |
|
368 |
headerAvailability.setWidget(0, TABLE_INDEX_WAREHOUSE_UPDATE_BUTTON, updateLiveDataButton);
|
| - |
|
369 |
/* code to be rewritten later
|
| 363 |
updateLiveDataButton.addClickHandler(new ClickHandler() {
|
370 |
updateLiveDataButton.addClickHandler(new ClickHandler() {
|
| 364 |
@Override
|
371 |
@Override
|
| 365 |
public void onClick(ClickEvent event) {
|
372 |
public void onClick(ClickEvent event) {
|
| 366 |
catalogService.getProdItemInventory(item.getId(), new AsyncCallback<Map<Long, ItemInventory>>() {
|
373 |
catalogService.getProdItemInventory(item.getId(), new AsyncCallback<Map<Long, ItemInventory>>() {
|
| 367 |
@Override
|
374 |
@Override
|
| Line 382... |
Line 389... |
| 382 |
Window.alert("Error fetching Inventory Data");
|
389 |
Window.alert("Error fetching Inventory Data");
|
| 383 |
}
|
390 |
}
|
| 384 |
});
|
391 |
});
|
| 385 |
}
|
392 |
}
|
| 386 |
});
|
393 |
});
|
| 387 |
*/
|
394 |
*/
|
| 388 |
headerAvailability.getCellFormatter().setVisible(0, TABLE_INDEX_WAREHOUSE_UPDATE_BUTTON, false);
|
395 |
headerAvailability.getCellFormatter().setVisible(0, TABLE_INDEX_WAREHOUSE_UPDATE_BUTTON, false);
|
| 389 |
|
396 |
|
| 390 |
}
|
397 |
}
|
| 391 |
|
398 |
|
| 392 |
/**
|
399 |
/**
|
| 393 |
* initialises vendor item key table header. Creates an Add button and
|
400 |
* initialises vendor item key table header. Creates an Add button and
|
| 394 |
* adds click event listener to it to create and pop up a dialog for adding
|
401 |
* adds click event listener to it to create and pop up a dialog for adding
|
| 395 |
* a new vendor item key.
|
402 |
* a new vendor item key.
|
| 396 |
*/
|
403 |
*/
|
| 397 |
private void initVendorKeysHeader(){
|
404 |
private void initVendorKeysHeader(){
|
| 398 |
headerVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_VENDORID, VENDOR_ID_WIDTH);
|
405 |
headerVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_VENDORID, VENDOR_ID_WIDTH);
|
| 399 |
headerVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_VENDOR_DESC, VENDOR_DESC_WIDTH);
|
406 |
headerVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_VENDOR_DESC, VENDOR_DESC_WIDTH);
|
| 400 |
headerVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_ITEM_KEY, ITEM_KEY_WIDTH);
|
407 |
headerVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_ITEM_KEY, ITEM_KEY_WIDTH);
|
| 401 |
headerVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_ITEM_KEY_OLD, ITEM_KEY_WIDTH);
|
408 |
headerVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_ITEM_KEY_OLD, ITEM_KEY_WIDTH);
|
| 402 |
headerVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_BUTTON, BUTTON_WIDTH);
|
409 |
headerVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_BUTTON, BUTTON_WIDTH);
|
| 403 |
|
410 |
|
| 404 |
headerVendorItemKey.setText(0, TABLE_INDEX_MAPPING_VENDORID, "Vendor Id");
|
411 |
headerVendorItemKey.setText(0, TABLE_INDEX_MAPPING_VENDORID, "Vendor Id");
|
| 405 |
headerVendorItemKey.setText(0, TABLE_INDEX_MAPPING_VENDOR_DESC, "Vendor");
|
412 |
headerVendorItemKey.setText(0, TABLE_INDEX_MAPPING_VENDOR_DESC, "Vendor");
|
| 406 |
headerVendorItemKey.setText(0, TABLE_INDEX_MAPPING_ITEM_KEY, "Item Key");
|
413 |
headerVendorItemKey.setText(0, TABLE_INDEX_MAPPING_ITEM_KEY, "Item Key");
|
| 407 |
headerVendorItemKey.setText(0, TABLE_INDEX_MAPPING_ITEM_KEY_OLD, "Prev Item Key");
|
414 |
headerVendorItemKey.setText(0, TABLE_INDEX_MAPPING_ITEM_KEY_OLD, "Prev Item Key");
|
| 408 |
|
415 |
|
| 409 |
headerVendorItemKey.getCellFormatter().setVisible(0, TABLE_INDEX_MAPPING_VENDORID, false);
|
416 |
headerVendorItemKey.getCellFormatter().setVisible(0, TABLE_INDEX_MAPPING_VENDORID, false);
|
| 410 |
headerVendorItemKey.getCellFormatter().setVisible(0, TABLE_INDEX_MAPPING_ITEM_KEY_OLD, false);
|
417 |
headerVendorItemKey.getCellFormatter().setVisible(0, TABLE_INDEX_MAPPING_ITEM_KEY_OLD, false);
|
| 411 |
|
418 |
|
| 412 |
Button addButton = new Button("Add");
|
419 |
Button addButton = new Button("Add");
|
| 413 |
headerVendorItemKey.setWidget(0, TABLE_INDEX_MAPPING_BUTTON, addButton);
|
420 |
headerVendorItemKey.setWidget(0, TABLE_INDEX_MAPPING_BUTTON, addButton);
|
| 414 |
addButton.addClickHandler(new ClickHandler() {
|
421 |
addButton.addClickHandler(new ClickHandler() {
|
| 415 |
@Override
|
422 |
@Override
|
| 416 |
public void onClick(ClickEvent event) {
|
423 |
public void onClick(ClickEvent event) {
|
| 417 |
VendorMappingDialog vendorMappingDialog = new VendorMappingDialog(productGroup.getText().trim(), brand.getText().trim(),
|
424 |
VendorMappingDialog vendorMappingDialog = new VendorMappingDialog(productGroup.getText().trim(), brand.getText().trim(),
|
| 418 |
modelNumber.getText().trim(), color.getText().trim());
|
425 |
modelNumber.getText().trim(), color.getText().trim());
|
| 419 |
vendorMappingDialog.updateButton.setText("Add");
|
426 |
vendorMappingDialog.updateButton.setText("Add");
|
| 420 |
vendorMappingDialog.setVendorMappingUpdateListener(new VendorMappingDialog.VendorMappingUpdateListener() {
|
427 |
vendorMappingDialog.setVendorMappingUpdateListener(new VendorMappingDialog.VendorMappingUpdateListener() {
|
| 421 |
@Override
|
428 |
@Override
|
| 422 |
public boolean onUpdate(String key, long vendorId) {
|
429 |
public boolean onUpdate(String key, long vendorId) {
|
| 423 |
int row = tableVendorItemKey.getRowCount();
|
430 |
int row = tableVendorItemKey.getRowCount();
|
| 424 |
tableVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_VENDORID, VENDOR_ID_WIDTH);
|
431 |
tableVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_VENDORID, VENDOR_ID_WIDTH);
|
| 425 |
tableVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_VENDOR_DESC, VENDOR_DESC_WIDTH);
|
432 |
tableVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_VENDOR_DESC, VENDOR_DESC_WIDTH);
|
| 426 |
tableVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_ITEM_KEY, ITEM_KEY_WIDTH);
|
433 |
tableVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_ITEM_KEY, ITEM_KEY_WIDTH);
|
| 427 |
tableVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_ITEM_KEY_OLD, ITEM_KEY_WIDTH);
|
434 |
tableVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_ITEM_KEY_OLD, ITEM_KEY_WIDTH);
|
| 428 |
|
- |
|
| - |
|
435 |
|
| 429 |
tableVendorItemKey.setText(row, TABLE_INDEX_MAPPING_VENDORID, vendorId + "");
|
436 |
tableVendorItemKey.setText(row, TABLE_INDEX_MAPPING_VENDORID, vendorId + "");
|
| 430 |
tableVendorItemKey.setText(row, TABLE_INDEX_MAPPING_VENDOR_DESC, Utils.getVendorDesc(vendorId));
|
437 |
tableVendorItemKey.setText(row, TABLE_INDEX_MAPPING_VENDOR_DESC, Utils.getVendorDesc(vendorId));
|
| 431 |
tableVendorItemKey.setText(row, TABLE_INDEX_MAPPING_ITEM_KEY, key);
|
438 |
tableVendorItemKey.setText(row, TABLE_INDEX_MAPPING_ITEM_KEY, key);
|
| 432 |
tableVendorItemKey.setText(row, TABLE_INDEX_MAPPING_ITEM_KEY_OLD, key);
|
439 |
tableVendorItemKey.setText(row, TABLE_INDEX_MAPPING_ITEM_KEY_OLD, key);
|
| 433 |
|
- |
|
| - |
|
440 |
|
| 434 |
tableVendorItemKey.getCellFormatter().setVisible(row, TABLE_INDEX_MAPPING_VENDORID, false);
|
441 |
tableVendorItemKey.getCellFormatter().setVisible(row, TABLE_INDEX_MAPPING_VENDORID, false);
|
| 435 |
tableVendorItemKey.getCellFormatter().setVisible(row, TABLE_INDEX_MAPPING_ITEM_KEY_OLD, false);
|
442 |
tableVendorItemKey.getCellFormatter().setVisible(row, TABLE_INDEX_MAPPING_ITEM_KEY_OLD, false);
|
| 436 |
return true;
|
443 |
return true;
|
| 437 |
}
|
444 |
}
|
| 438 |
});
|
445 |
});
|
| 439 |
vendorMappingDialog.show();
|
446 |
vendorMappingDialog.show();
|
| 440 |
}
|
447 |
}
|
| 441 |
});
|
448 |
});
|
| 442 |
}
|
449 |
}
|
| 443 |
|
450 |
|
| 444 |
/**
|
451 |
/**
|
| 445 |
* initialises vendor prices table header. Creates an Add button and
|
452 |
* initialises vendor prices table header. Creates an Add button and
|
| 446 |
* adds click event listener to it to create and pop up a dialog for adding
|
453 |
* adds click event listener to it to create and pop up a dialog for adding
|
| 447 |
* a prices for a new vendor
|
454 |
* a prices for a new vendor
|
| 448 |
*/
|
455 |
*/
|
| 449 |
private void initVendorPricingHeader(){
|
456 |
private void initVendorPricingHeader(){
|
| 450 |
headerVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_VENDORID, VENDOR_ID_WIDTH);
|
457 |
headerVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_VENDORID, VENDOR_ID_WIDTH);
|
| 451 |
headerVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_VENDOR_DESC, VENDOR_DESC_WIDTH);
|
458 |
headerVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_VENDOR_DESC, VENDOR_DESC_WIDTH);
|
| 452 |
headerVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_MOP, PRICE_WIDTH);
|
459 |
headerVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_MOP, PRICE_WIDTH);
|
| 453 |
headerVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_DP, PRICE_WIDTH);
|
460 |
headerVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_DP, PRICE_WIDTH);
|
| 454 |
headerVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_TP, PRICE_WIDTH);
|
461 |
headerVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_TP, PRICE_WIDTH);
|
| 455 |
headerVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_NLC, PRICE_WIDTH);
|
462 |
headerVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_NLC, PRICE_WIDTH);
|
| 456 |
headerVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_BUTTON, BUTTON_WIDTH);
|
463 |
headerVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_BUTTON, BUTTON_WIDTH);
|
| 457 |
|
464 |
|
| 458 |
headerVendorPrices.setText(0, TABLE_INDEX_PRICING_VENDORID, "Vendor Id");
|
465 |
headerVendorPrices.setText(0, TABLE_INDEX_PRICING_VENDORID, "Vendor Id");
|
| 459 |
headerVendorPrices.setText(0, TABLE_INDEX_PRICING_VENDOR_DESC, "Vendor");
|
466 |
headerVendorPrices.setText(0, TABLE_INDEX_PRICING_VENDOR_DESC, "Vendor");
|
| 460 |
headerVendorPrices.setText(0, TABLE_INDEX_PRICING_MOP, "MOP");
|
467 |
headerVendorPrices.setText(0, TABLE_INDEX_PRICING_MOP, "MOP");
|
| 461 |
headerVendorPrices.setText(0, TABLE_INDEX_PRICING_DP, "Dealer Price");
|
468 |
headerVendorPrices.setText(0, TABLE_INDEX_PRICING_DP, "Dealer Price");
|
| 462 |
headerVendorPrices.setText(0, TABLE_INDEX_PRICING_TP, "Transfer Price");
|
469 |
headerVendorPrices.setText(0, TABLE_INDEX_PRICING_TP, "Transfer Price");
|
| 463 |
headerVendorPrices.setText(0, TABLE_INDEX_PRICING_NLC, "NLC");
|
470 |
headerVendorPrices.setText(0, TABLE_INDEX_PRICING_NLC, "NLC");
|
| 464 |
|
471 |
|
| 465 |
headerVendorPrices.getCellFormatter().setVisible(0, TABLE_INDEX_PRICING_VENDORID, false);
|
472 |
headerVendorPrices.getCellFormatter().setVisible(0, TABLE_INDEX_PRICING_VENDORID, false);
|
| 466 |
|
473 |
|
| 467 |
Button addButton = new Button("Add");
|
474 |
Button addButton = new Button("Add");
|
| 468 |
headerVendorPrices.setWidget(0, TABLE_INDEX_PRICING_BUTTON, addButton);
|
475 |
headerVendorPrices.setWidget(0, TABLE_INDEX_PRICING_BUTTON, addButton);
|
| 469 |
addButton.addClickHandler(new ClickHandler() {
|
476 |
addButton.addClickHandler(new ClickHandler() {
|
| 470 |
@Override
|
477 |
@Override
|
| 471 |
public void onClick(ClickEvent event) {
|
478 |
public void onClick(ClickEvent event) {
|
| 472 |
VendorPricesDialog vendorPricesDialog = new VendorPricesDialog();
|
479 |
VendorPricesDialog vendorPricesDialog = new VendorPricesDialog();
|
| 473 |
vendorPricesDialog.updateButton.setText("Add");
|
480 |
vendorPricesDialog.updateButton.setText("Add");
|
| 474 |
vendorPricesDialog.setVendorPriceUpdateListener(new VendorPricesDialog.VendorPriceUpdateListener() {
|
481 |
vendorPricesDialog.setVendorPriceUpdateListener(new VendorPricesDialog.VendorPriceUpdateListener() {
|
| 475 |
@Override
|
482 |
@Override
|
| 476 |
public boolean onUpdate(double mop, double dp, double tp, double nlc, long vendorId) {
|
483 |
public boolean onUpdate(double mop, double dp, double tp, double nlc, long vendorId) {
|
| 477 |
if(!vendorExists(vendorId)) {
|
484 |
if(!vendorExists(vendorId)) {
|
| 478 |
Window.alert("Vendor already exists");
|
485 |
Window.alert("Vendor already exists");
|
| 479 |
return false;
|
486 |
return false;
|
| 480 |
}
|
487 |
}
|
| 481 |
/*if(!validateVendorPrices(mop, dp, tp)) {
|
488 |
/*if(!validateVendorPrices(mop, dp, tp)) {
|
| 482 |
return false;
|
489 |
return false;
|
| 483 |
}*/
|
490 |
}*/
|
| 484 |
int row = tableVendorPrices.getRowCount();
|
491 |
int row = tableVendorPrices.getRowCount();
|
| 485 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_VENDORID, VENDOR_ID_WIDTH);
|
492 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_VENDORID, VENDOR_ID_WIDTH);
|
| 486 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_VENDOR_DESC, VENDOR_DESC_WIDTH);
|
493 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_VENDOR_DESC, VENDOR_DESC_WIDTH);
|
| 487 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_MOP, PRICE_WIDTH);
|
494 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_MOP, PRICE_WIDTH);
|
| 488 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_DP, PRICE_WIDTH);
|
495 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_DP, PRICE_WIDTH);
|
| 489 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_TP, PRICE_WIDTH);
|
496 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_TP, PRICE_WIDTH);
|
| 490 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_NLC, PRICE_WIDTH);
|
497 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_NLC, PRICE_WIDTH);
|
| 491 |
|
- |
|
| - |
|
498 |
|
| 492 |
tableVendorPrices.setText(row, TABLE_INDEX_PRICING_VENDORID, vendorId + "");
|
499 |
tableVendorPrices.setText(row, TABLE_INDEX_PRICING_VENDORID, vendorId + "");
|
| 493 |
tableVendorPrices.setText(row, TABLE_INDEX_PRICING_VENDOR_DESC, Utils.getVendorDesc(vendorId));
|
500 |
tableVendorPrices.setText(row, TABLE_INDEX_PRICING_VENDOR_DESC, Utils.getVendorDesc(vendorId));
|
| 494 |
tableVendorPrices.setText(row, TABLE_INDEX_PRICING_MOP, mop + "");
|
501 |
tableVendorPrices.setText(row, TABLE_INDEX_PRICING_MOP, mop + "");
|
| 495 |
tableVendorPrices.setText(row, TABLE_INDEX_PRICING_DP, dp + "");
|
502 |
tableVendorPrices.setText(row, TABLE_INDEX_PRICING_DP, dp + "");
|
| 496 |
tableVendorPrices.setText(row, TABLE_INDEX_PRICING_TP, tp + "");
|
503 |
tableVendorPrices.setText(row, TABLE_INDEX_PRICING_TP, tp + "");
|
| 497 |
tableVendorPrices.setText(row, TABLE_INDEX_PRICING_NLC, nlc + "");
|
504 |
tableVendorPrices.setText(row, TABLE_INDEX_PRICING_NLC, nlc + "");
|
| 498 |
|
- |
|
| 499 |
tableVendorPrices.getCellFormatter().setVisible(row, TABLE_INDEX_PRICING_VENDORID, false);
|
- |
|
| 500 |
return true;
|
- |
|
| 501 |
}
|
- |
|
| 502 |
});
|
- |
|
| 503 |
vendorPricesDialog.show();
|
- |
|
| 504 |
}
|
- |
|
| 505 |
});
|
- |
|
| 506 |
}
|
- |
|
| 507 |
|
- |
|
| 508 |
/**
|
- |
|
| 509 |
* initialises source prices table header. Creates an Add button and
|
- |
|
| 510 |
* adds click event listener to it to create and pop up a dialog for adding
|
- |
|
| 511 |
* a prices for a new source
|
- |
|
| 512 |
*/
|
- |
|
| 513 |
private void initSourcePricingHeader(){
|
- |
|
| 514 |
headerSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_SOURCE_ID, VENDOR_ID_WIDTH);
|
- |
|
| 515 |
headerSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_SOURCE_DESC, VENDOR_DESC_WIDTH);
|
- |
|
| 516 |
headerSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_MRP, PRICE_WIDTH);
|
- |
|
| 517 |
headerSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE, PRICE_WIDTH);
|
- |
|
| 518 |
headerSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_BUTTON, BUTTON_WIDTH);
|
- |
|
| 519 |
|
- |
|
| 520 |
headerSourcePrices.setText(0, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID, "Source Id");
|
- |
|
| 521 |
headerSourcePrices.setText(0, TABLE_INDEX_SOURCE_PRICING_SOURCE_DESC, "Source");
|
- |
|
| 522 |
headerSourcePrices.setText(0, TABLE_INDEX_SOURCE_PRICING_MRP, "MRP");
|
- |
|
| 523 |
headerSourcePrices.setText(0, TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE, "Selling Price");
|
- |
|
| 524 |
|
- |
|
| 525 |
headerSourcePrices.getCellFormatter().setVisible(0, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID, false);
|
- |
|
| 526 |
|
- |
|
| 527 |
Button addButton = new Button("Add");
|
- |
|
| 528 |
headerSourcePrices.setWidget(0, TABLE_INDEX_SOURCE_PRICING_BUTTON, addButton);
|
- |
|
| 529 |
addButton.addClickHandler(new ClickHandler() {
|
- |
|
| 530 |
@Override
|
- |
|
| 531 |
public void onClick(ClickEvent event) {
|
- |
|
| 532 |
SourcePricesDialog sourcePricesDialog = new SourcePricesDialog(mrp.getText().trim(), sellingPrice.getText().trim());
|
- |
|
| 533 |
//SourcePricesDialog sourcePricesDialog = new SourcePricesDialog();
|
- |
|
| 534 |
sourcePricesDialog.updateButton.setText("Add");
|
- |
|
| 535 |
sourcePricesDialog.setSourcePriceUpdateListener(new SourcePricesDialog.SourcePriceUpdateListener() {
|
- |
|
| 536 |
@Override
|
- |
|
| 537 |
public boolean onUpdate(double mrp, double sellingPrice, long sourceId) {
|
- |
|
| 538 |
if(!sourceExists(sourceId)) {
|
- |
|
| 539 |
Window.alert("Source already exists");
|
- |
|
| 540 |
return false;
|
- |
|
| 541 |
}
|
- |
|
| 542 |
|
505 |
|
| 543 |
int row = tableSourcePrices.getRowCount();
|
- |
|
| 544 |
tableSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_SOURCE_ID, VENDOR_ID_WIDTH);
|
- |
|
| 545 |
tableSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_SOURCE_DESC, VENDOR_DESC_WIDTH);
|
- |
|
| 546 |
tableSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_MRP, PRICE_WIDTH);
|
- |
|
| 547 |
tableSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE, PRICE_WIDTH);
|
- |
|
| 548 |
|
- |
|
| 549 |
tableSourcePrices.setText(row, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID, sourceId + "");
|
- |
|
| 550 |
tableSourcePrices.setText(row, TABLE_INDEX_SOURCE_PRICING_SOURCE_DESC, Utils.getSourceDesc(sourceId));
|
- |
|
| 551 |
tableSourcePrices.setText(row, TABLE_INDEX_SOURCE_PRICING_MRP, mrp + "");
|
- |
|
| 552 |
tableSourcePrices.setText(row, TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE, sellingPrice + "");
|
- |
|
| 553 |
|
- |
|
| 554 |
tableSourcePrices.getCellFormatter().setVisible(row, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID, false);
|
506 |
tableVendorPrices.getCellFormatter().setVisible(row, TABLE_INDEX_PRICING_VENDORID, false);
|
| 555 |
return true;
|
507 |
return true;
|
| 556 |
}
|
508 |
}
|
| 557 |
});
|
509 |
});
|
| 558 |
sourcePricesDialog.show();
|
510 |
vendorPricesDialog.show();
|
| 559 |
}
|
511 |
}
|
| 560 |
});
|
512 |
});
|
| 561 |
}
|
513 |
}
|
| 562 |
|
514 |
|
| - |
|
515 |
/**
|
| - |
|
516 |
* initialises source prices table header. Creates an Add button and
|
| - |
|
517 |
* adds click event listener to it to create and pop up a dialog for adding
|
| - |
|
518 |
* a prices for a new source
|
| - |
|
519 |
*/
|
| - |
|
520 |
private void initSourcePricingHeader(){
|
| - |
|
521 |
headerSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_SOURCE_ID, VENDOR_ID_WIDTH);
|
| - |
|
522 |
headerSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_SOURCE_DESC, VENDOR_DESC_WIDTH);
|
| - |
|
523 |
headerSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_MRP, PRICE_WIDTH);
|
| - |
|
524 |
headerSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE, PRICE_WIDTH);
|
| - |
|
525 |
headerSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_BUTTON, BUTTON_WIDTH);
|
| - |
|
526 |
|
| - |
|
527 |
headerSourcePrices.setText(0, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID, "Source Id");
|
| - |
|
528 |
headerSourcePrices.setText(0, TABLE_INDEX_SOURCE_PRICING_SOURCE_DESC, "Source");
|
| - |
|
529 |
headerSourcePrices.setText(0, TABLE_INDEX_SOURCE_PRICING_MRP, "MRP");
|
| - |
|
530 |
headerSourcePrices.setText(0, TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE, "Selling Price");
|
| - |
|
531 |
|
| - |
|
532 |
headerSourcePrices.getCellFormatter().setVisible(0, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID, false);
|
| - |
|
533 |
|
| - |
|
534 |
Button addButton = new Button("Add");
|
| - |
|
535 |
headerSourcePrices.setWidget(0, TABLE_INDEX_SOURCE_PRICING_BUTTON, addButton);
|
| - |
|
536 |
addButton.addClickHandler(new ClickHandler() {
|
| - |
|
537 |
@Override
|
| - |
|
538 |
public void onClick(ClickEvent event) {
|
| - |
|
539 |
SourcePricesDialog sourcePricesDialog = new SourcePricesDialog(mrp.getText().trim(), sellingPrice.getText().trim());
|
| - |
|
540 |
//SourcePricesDialog sourcePricesDialog = new SourcePricesDialog();
|
| - |
|
541 |
sourcePricesDialog.updateButton.setText("Add");
|
| - |
|
542 |
sourcePricesDialog.setSourcePriceUpdateListener(new SourcePricesDialog.SourcePriceUpdateListener() {
|
| - |
|
543 |
@Override
|
| - |
|
544 |
public boolean onUpdate(double mrp, double sellingPrice, long sourceId) {
|
| - |
|
545 |
if(!sourceExists(sourceId)) {
|
| - |
|
546 |
Window.alert("Source already exists");
|
| - |
|
547 |
return false;
|
| - |
|
548 |
}
|
| - |
|
549 |
|
| - |
|
550 |
int row = tableSourcePrices.getRowCount();
|
| - |
|
551 |
tableSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_SOURCE_ID, VENDOR_ID_WIDTH);
|
| - |
|
552 |
tableSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_SOURCE_DESC, VENDOR_DESC_WIDTH);
|
| - |
|
553 |
tableSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_MRP, PRICE_WIDTH);
|
| - |
|
554 |
tableSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE, PRICE_WIDTH);
|
| - |
|
555 |
|
| - |
|
556 |
tableSourcePrices.setText(row, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID, sourceId + "");
|
| - |
|
557 |
tableSourcePrices.setText(row, TABLE_INDEX_SOURCE_PRICING_SOURCE_DESC, Utils.getSourceDesc(sourceId));
|
| - |
|
558 |
tableSourcePrices.setText(row, TABLE_INDEX_SOURCE_PRICING_MRP, mrp + "");
|
| - |
|
559 |
tableSourcePrices.setText(row, TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE, sellingPrice + "");
|
| - |
|
560 |
|
| - |
|
561 |
tableSourcePrices.getCellFormatter().setVisible(row, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID, false);
|
| - |
|
562 |
return true;
|
| - |
|
563 |
}
|
| - |
|
564 |
});
|
| - |
|
565 |
sourcePricesDialog.show();
|
| - |
|
566 |
}
|
| - |
|
567 |
});
|
| - |
|
568 |
}
|
| - |
|
569 |
|
| 563 |
/**
|
570 |
/**
|
| 564 |
* initialises similar items table header. Creates an Add button and
|
571 |
* initialises similar items table header. Creates an Add button and
|
| 565 |
* adds click event listener to it to create and pop up a dialog for adding
|
572 |
* adds click event listener to it to create and pop up a dialog for adding
|
| 566 |
* a new similar item.
|
573 |
* a new similar item.
|
| 567 |
*/
|
574 |
*/
|
| 568 |
private void initSimilarItemList() {
|
575 |
private void initSimilarItemList() {
|
| 569 |
headerSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_CATALOG_ITEM_ID, PRICE_WIDTH);
|
576 |
headerSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_CATALOG_ITEM_ID, PRICE_WIDTH);
|
| 570 |
headerSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_PRODUCT_GROUP, PRICE_WIDTH);
|
577 |
headerSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_PRODUCT_GROUP, PRICE_WIDTH);
|
| 571 |
headerSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_BRAND, PRICE_WIDTH);
|
578 |
headerSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_BRAND, PRICE_WIDTH);
|
| 572 |
headerSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_MODEL_NUMBER, PRICE_WIDTH);
|
579 |
headerSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_MODEL_NUMBER, PRICE_WIDTH);
|
| 573 |
headerSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_MODEL_NAME, PRICE_WIDTH);
|
580 |
headerSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_MODEL_NAME, PRICE_WIDTH);
|
| 574 |
headerSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_CATEGORY, "150px");
|
581 |
headerSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_CATEGORY, "150px");
|
| 575 |
headerSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_BUTTON, BUTTON_WIDTH);
|
582 |
headerSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_BUTTON, BUTTON_WIDTH);
|
| 576 |
|
583 |
|
| 577 |
headerSimilarItems.setText(0, TABLE_INDEX_SIMILAR_ITEMS_CATALOG_ITEM_ID, "Catalog ItemId");
|
584 |
headerSimilarItems.setText(0, TABLE_INDEX_SIMILAR_ITEMS_CATALOG_ITEM_ID, "Catalog ItemId");
|
| 578 |
headerSimilarItems.setText(0, TABLE_INDEX_SIMILAR_ITEMS_PRODUCT_GROUP, "Product Group");
|
585 |
headerSimilarItems.setText(0, TABLE_INDEX_SIMILAR_ITEMS_PRODUCT_GROUP, "Product Group");
|
| 579 |
headerSimilarItems.setText(0, TABLE_INDEX_SIMILAR_ITEMS_BRAND, "Brand");
|
586 |
headerSimilarItems.setText(0, TABLE_INDEX_SIMILAR_ITEMS_BRAND, "Brand");
|
| 580 |
headerSimilarItems.setText(0, TABLE_INDEX_SIMILAR_ITEMS_MODEL_NUMBER, "Model Number");
|
587 |
headerSimilarItems.setText(0, TABLE_INDEX_SIMILAR_ITEMS_MODEL_NUMBER, "Model Number");
|
| 581 |
headerSimilarItems.setText(0, TABLE_INDEX_SIMILAR_ITEMS_MODEL_NAME, "Model Name");
|
588 |
headerSimilarItems.setText(0, TABLE_INDEX_SIMILAR_ITEMS_MODEL_NAME, "Model Name");
|
| 582 |
headerSimilarItems.setText(0, TABLE_INDEX_SIMILAR_ITEMS_CATEGORY, "Category");
|
589 |
headerSimilarItems.setText(0, TABLE_INDEX_SIMILAR_ITEMS_CATEGORY, "Category");
|
| 583 |
|
590 |
|
| 584 |
Button addButton = new Button("Add");
|
591 |
Button addButton = new Button("Add");
|
| 585 |
headerSimilarItems.setWidget(0, TABLE_INDEX_SIMILAR_ITEMS_BUTTON, addButton);
|
592 |
headerSimilarItems.setWidget(0, TABLE_INDEX_SIMILAR_ITEMS_BUTTON, addButton);
|
| 586 |
addButton.addClickHandler(new ClickHandler() {
|
593 |
addButton.addClickHandler(new ClickHandler() {
|
| 587 |
@Override
|
594 |
@Override
|
| 588 |
public void onClick(ClickEvent event) {
|
595 |
public void onClick(ClickEvent event) {
|
| 589 |
AddSimilarItemDialog addSimilarItemDialog = new AddSimilarItemDialog();
|
596 |
AddSimilarItemDialog addSimilarItemDialog = new AddSimilarItemDialog();
|
| 590 |
addSimilarItemDialog.setAddSimilarItemUpdateListener(new AddSimilarItemDialog.AddSimilarItemUpdateListener() {
|
597 |
addSimilarItemDialog.setAddSimilarItemUpdateListener(new AddSimilarItemDialog.AddSimilarItemUpdateListener() {
|
| 591 |
@Override
|
598 |
@Override
|
| 592 |
public boolean onUpdate(long catalogItemId) {
|
599 |
public boolean onUpdate(long catalogItemId) {
|
| 593 |
if (item.getSimilarItems().containsKey(catalogItemId)) {
|
600 |
if (item.getSimilarItems().containsKey(catalogItemId)) {
|
| 594 |
Window.alert("Similar Item exists.");
|
601 |
Window.alert("Similar Item exists.");
|
| 595 |
return false;
|
602 |
return false;
|
| 596 |
}
|
603 |
}
|
| 597 |
else {
|
604 |
else {
|
| 598 |
catalogService.addSimilarItem(item.getId(), catalogItemId, new AsyncCallback<Item>() {
|
605 |
catalogService.addSimilarItem(item.getId(), catalogItemId, new AsyncCallback<Item>() {
|
| 599 |
@Override
|
606 |
@Override
|
| 600 |
public void onSuccess(Item similarItem) {
|
607 |
public void onSuccess(Item similarItem) {
|
| 601 |
if(similarItem != null) {
|
608 |
if(similarItem != null) {
|
| 602 |
GWT.log("Similar Item Added");
|
609 |
GWT.log("Similar Item Added");
|
| 603 |
Map<Long, Item> newsimilarItems = item.getSimilarItems();
|
610 |
Map<Long, Item> newsimilarItems = item.getSimilarItems();
|
| 604 |
newsimilarItems.put(similarItem.getCatalogItemId(), similarItem);
|
611 |
newsimilarItems.put(similarItem.getCatalogItemId(), similarItem);
|
| 605 |
item.setSimilarItems(newsimilarItems);
|
612 |
item.setSimilarItems(newsimilarItems);
|
| 606 |
updateSimilarItemsTable(item.getSimilarItems());
|
613 |
updateSimilarItemsTable(item.getSimilarItems());
|
| 607 |
Window.alert("Similar Item Added successfully.");
|
614 |
Window.alert("Similar Item Added successfully.");
|
| 608 |
}
|
615 |
}
|
| 609 |
else {
|
616 |
else {
|
| 610 |
GWT.log("Error Adding Similar Item");
|
617 |
GWT.log("Error Adding Similar Item");
|
| 611 |
Window.alert("Error Adding Similar Item");
|
618 |
Window.alert("Error Adding Similar Item");
|
| 612 |
}
|
619 |
}
|
| 613 |
}
|
620 |
}
|
| 614 |
@Override
|
621 |
@Override
|
| 615 |
public void onFailure(Throwable caught) {
|
622 |
public void onFailure(Throwable caught) {
|
| 616 |
caught.printStackTrace();
|
623 |
caught.printStackTrace();
|
| 617 |
Window.alert("Error deleting Similar Item");
|
624 |
Window.alert("Error deleting Similar Item");
|
| 618 |
}
|
625 |
}
|
| 619 |
});
|
626 |
});
|
| 620 |
return true;
|
627 |
return true;
|
| 621 |
}
|
628 |
}
|
| 622 |
}
|
629 |
}
|
| 623 |
});
|
630 |
});
|
| 624 |
addSimilarItemDialog.show();
|
631 |
addSimilarItemDialog.show();
|
| - |
|
632 |
}
|
| - |
|
633 |
});
|
| - |
|
634 |
}
|
| - |
|
635 |
private void initVatDetailsHeader(){
|
| - |
|
636 |
headerVatDetails.getColumnFormatter().setWidth(TABLE_INDEX_STATE_NAME, "80px");
|
| - |
|
637 |
headerVatDetails.getColumnFormatter().setWidth(TABLE_INDEX_STATE_TAX_PERCENTAGE, "50px");
|
| - |
|
638 |
headerVatDetails.setText(0, TABLE_INDEX_STATE_NAME, "State Name");
|
| - |
|
639 |
headerVatDetails.setText(0, TABLE_INDEX_STATE_TAX_PERCENTAGE, "Tax Percentage");
|
| - |
|
640 |
|
| - |
|
641 |
}
|
| - |
|
642 |
private void updateVatDetailsTable(Map<String,String> stateVatPercentage){
|
| - |
|
643 |
tableVatDetails.removeAllRows();
|
| - |
|
644 |
if(stateVatPercentage == null || stateVatPercentage.isEmpty()) {
|
| 625 |
}
|
645 |
return;
|
| - |
|
646 |
}
|
| - |
|
647 |
tableVatDetails.getColumnFormatter().setWidth(TABLE_INDEX_STATE_NAME, "80px");
|
| - |
|
648 |
tableVatDetails.getColumnFormatter().setWidth(TABLE_INDEX_STATE_TAX_PERCENTAGE, "50px");
|
| 626 |
});
|
649 |
int i=0;
|
| - |
|
650 |
for(Entry<String,String> e : stateVatPercentage.entrySet()){
|
| - |
|
651 |
tableVatDetails.setText(i, TABLE_INDEX_STATE_NAME, e.getKey() +"");
|
| - |
|
652 |
if(e.getValue().equals("-1.0")){
|
| - |
|
653 |
tableVatDetails.setText(i, TABLE_INDEX_STATE_TAX_PERCENTAGE, "N.A" + "");
|
| 627 |
}
|
654 |
}
|
| - |
|
655 |
else{
|
| - |
|
656 |
tableVatDetails.setText(i, TABLE_INDEX_STATE_TAX_PERCENTAGE, e.getValue()+" %" + "");
|
| 628 |
|
657 |
}
|
| - |
|
658 |
i++;
|
| - |
|
659 |
}
|
| - |
|
660 |
}
|
| 629 |
private void initIgnoredWarehouseHeader(){
|
661 |
private void initIgnoredWarehouseHeader(){
|
| 630 |
headerIgnoredWarehouse.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_NAME, "100px");
|
662 |
headerIgnoredWarehouse.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_NAME, "100px");
|
| 631 |
headerIgnoredWarehouse.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_ADD_DEL_BUTTON, BUTTON_WIDTH);
|
663 |
headerIgnoredWarehouse.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_ADD_DEL_BUTTON, BUTTON_WIDTH);
|
| 632 |
headerIgnoredWarehouse.setText(0, TABLE_INDEX_WAREHOUSE_NAME, "Warehouse Desc");
|
664 |
headerIgnoredWarehouse.setText(0, TABLE_INDEX_WAREHOUSE_NAME, "Warehouse Desc");
|
| 633 |
Button addButton = new Button("Add");
|
665 |
Button addButton = new Button("Add");
|
| 634 |
headerIgnoredWarehouse.setWidget(0,TABLE_INDEX_WAREHOUSE_ADD_DEL_BUTTON,addButton);
|
666 |
headerIgnoredWarehouse.setWidget(0,TABLE_INDEX_WAREHOUSE_ADD_DEL_BUTTON,addButton);
|
| 635 |
addButton.addClickHandler(new ClickHandler() {
|
667 |
addButton.addClickHandler(new ClickHandler() {
|
| 636 |
@Override
|
668 |
@Override
|
| 637 |
public void onClick(ClickEvent event) {
|
669 |
public void onClick(ClickEvent event) {
|
| 638 |
DeactivateWarehouseDialog deactivateWarehouseDialog = new DeactivateWarehouseDialog(new ArrayList<Long>(item.getVendorPricesMap().keySet()));
|
670 |
DeactivateWarehouseDialog deactivateWarehouseDialog = new DeactivateWarehouseDialog(new ArrayList<Long>(item.getVendorPricesMap().keySet()));
|
| 639 |
deactivateWarehouseDialog.updateButton.setText("Add");
|
671 |
deactivateWarehouseDialog.updateButton.setText("Add");
|
| 640 |
deactivateWarehouseDialog.setDeactivateWarehouseListener(new DeactivateWarehouseDialog.DeactivateWarehouseListener(){
|
672 |
deactivateWarehouseDialog.setDeactivateWarehouseListener(new DeactivateWarehouseDialog.DeactivateWarehouseListener(){
|
| 641 |
@Override
|
673 |
@Override
|
| 642 |
public boolean onUpdate(final long warehouseId) {
|
674 |
public boolean onUpdate(final long warehouseId) {
|
| 643 |
if(Utils.getignoredInventoryUpdateItemsIdsWarehouseIds().contains(new ItemWarehouse(item.getId(),warehouseId))) {
|
675 |
if(Utils.getignoredInventoryUpdateItemsIdsWarehouseIds().contains(new ItemWarehouse(item.getId(),warehouseId))) {
|
| 644 |
Window.alert("Warehouse already deactivated");
|
676 |
Window.alert("Warehouse already deactivated");
|
| 645 |
return false;
|
677 |
return false;
|
| 646 |
}
|
678 |
}
|
| 647 |
catalogService.addtoIgnoredInventoryUpdateItemsIdsWarehouseIds(item.getId(),warehouseId,new AsyncCallback<Boolean>() {
|
679 |
catalogService.addtoIgnoredInventoryUpdateItemsIdsWarehouseIds(item.getId(),warehouseId,new AsyncCallback<Boolean>() {
|
| 648 |
@Override
|
680 |
@Override
|
| 649 |
public void onSuccess(Boolean result) {
|
681 |
public void onSuccess(Boolean result) {
|
| 650 |
if(result) {
|
682 |
if(result) {
|
| 651 |
Utils.getignoredInventoryUpdateItemsIdsWarehouseIds().add(new ItemWarehouse(item.getId(),warehouseId));
|
683 |
Utils.getignoredInventoryUpdateItemsIdsWarehouseIds().add(new ItemWarehouse(item.getId(),warehouseId));
|
| 652 |
int index1 = tableIgnoredWarehouse.insertRow(0);
|
684 |
int index1 = tableIgnoredWarehouse.insertRow(0);
|
| 653 |
addRowToIgnoredWarehouseTable(index1, warehouseId, Utils.getAllWarehouses().get(warehouseId));
|
685 |
addRowToIgnoredWarehouseTable(index1, warehouseId, Utils.getAllWarehouses().get(warehouseId));
|
| 654 |
|
- |
|
| - |
|
686 |
|
| 655 |
Window.alert("Warehouse deactivated successfully");
|
687 |
Window.alert("Warehouse deactivated successfully");
|
| - |
|
688 |
}
|
| 656 |
}
|
689 |
else {
|
| 657 |
else {
|
690 |
GWT.log("Error Deactivating warehouse");
|
| 658 |
GWT.log("Error Deactivating warehouse");
|
691 |
Window.alert("Error Deactivating warehouse");
|
| - |
|
692 |
}
|
| - |
|
693 |
}
|
| - |
|
694 |
@Override
|
| - |
|
695 |
public void onFailure(Throwable caught) {
|
| - |
|
696 |
caught.printStackTrace();
|
| 659 |
Window.alert("Error Deactivating warehouse");
|
697 |
Window.alert("Error Deactivating warehouse");
|
| - |
|
698 |
}
|
| - |
|
699 |
});
|
| - |
|
700 |
return true;
|
| - |
|
701 |
}
|
| - |
|
702 |
});
|
| - |
|
703 |
deactivateWarehouseDialog.show();
|
| - |
|
704 |
}
|
| - |
|
705 |
});
|
| - |
|
706 |
}
|
| - |
|
707 |
|
| - |
|
708 |
|
| - |
|
709 |
private void initVoucherHeader(){
|
| - |
|
710 |
headerVouchers.getColumnFormatter().setWidth(TABLE_INDEX_VOUCHERS_TYPE, ITEM_KEY_WIDTH);
|
| - |
|
711 |
headerVouchers.getColumnFormatter().setWidth(TABLE_INDEX_VOUCHERS_AMOUNT, VENDOR_DESC_WIDTH);
|
| - |
|
712 |
headerVouchers.getColumnFormatter().setWidth(TABLE_INDEX_VOUCHERS_ADD_EDIT_BUTTON, BUTTON_WIDTH);
|
| - |
|
713 |
headerVouchers.getColumnFormatter().setWidth(TABLE_INDEX_VOUCHERS_DEL_BUTTON, BUTTON_WIDTH);
|
| - |
|
714 |
|
| - |
|
715 |
headerVouchers.setText(0, TABLE_INDEX_VOUCHERS_TYPE, "Voucher Type");
|
| - |
|
716 |
headerVouchers.setText(0, TABLE_INDEX_VOUCHERS_AMOUNT, "Voucher Amount");
|
| - |
|
717 |
headerVouchers.getCellFormatter().setVisible(0, TABLE_INDEX_VOUCHERS_DEL_BUTTON, false);
|
| 660 |
}
|
718 |
Button addButton = new Button("Add");
|
| - |
|
719 |
headerVouchers.setWidget(0, TABLE_INDEX_VOUCHERS_ADD_EDIT_BUTTON, addButton);
|
| - |
|
720 |
addButton.addClickHandler(new ClickHandler() {
|
| - |
|
721 |
@Override
|
| - |
|
722 |
public void onClick(ClickEvent event) {
|
| - |
|
723 |
VoucherItemDialog voucherItemDialog = new VoucherItemDialog();
|
| - |
|
724 |
voucherItemDialog.updateButton.setText("Add");
|
| - |
|
725 |
voucherItemDialog.setVoucherUpdateListener(new VoucherItemDialog.VoucherUpdateListener() {
|
| - |
|
726 |
@Override
|
| - |
|
727 |
public boolean onUpdate(final String voucherType, final long voucherAmount) {
|
| - |
|
728 |
if(!voucherExists(voucherType)) {
|
| - |
|
729 |
Window.alert("Voucher already exists");
|
| 661 |
}
|
730 |
return false;
|
| - |
|
731 |
}
|
| - |
|
732 |
Long voucherTypeValue = Utils.getVoucherTypeId(voucherType);;
|
| - |
|
733 |
catalogService.addVoucher(item.getCatalogItemId(), voucherTypeValue, voucherAmount, new AsyncCallback<Boolean>() {
|
| - |
|
734 |
@Override
|
| - |
|
735 |
public void onSuccess(Boolean result) {
|
| - |
|
736 |
if(result) {
|
| 662 |
@Override
|
737 |
GWT.log("Voucher Added");
|
| - |
|
738 |
VoucherItemMapping newvoucher = new VoucherItemMapping(voucherAmount, voucherType);
|
| - |
|
739 |
Map<String, VoucherItemMapping> newvouchersMap = item.getVouchersMap();
|
| - |
|
740 |
newvouchersMap.put(voucherType, newvoucher);
|
| - |
|
741 |
item.setVouchersMap(newvouchersMap);
|
| - |
|
742 |
updateVoucherTable(item.getVouchersMap());
|
| - |
|
743 |
Window.alert("Voucher Added successfully.");
|
| - |
|
744 |
}
|
| - |
|
745 |
else {
|
| - |
|
746 |
GWT.log("Error Adding Voucher");
|
| - |
|
747 |
Window.alert("Error Adding Voucher");
|
| - |
|
748 |
}
|
| - |
|
749 |
}
|
| - |
|
750 |
@Override
|
| 663 |
public void onFailure(Throwable caught) {
|
751 |
public void onFailure(Throwable caught) {
|
| 664 |
caught.printStackTrace();
|
752 |
caught.printStackTrace();
|
| 665 |
Window.alert("Error Deactivating warehouse");
|
753 |
Window.alert("Error deleting voucher");
|
| - |
|
754 |
}
|
| - |
|
755 |
});
|
| - |
|
756 |
return true;
|
| - |
|
757 |
}
|
| - |
|
758 |
});
|
| - |
|
759 |
voucherItemDialog.show();
|
| - |
|
760 |
}
|
| - |
|
761 |
});
|
| - |
|
762 |
}
|
| - |
|
763 |
|
| - |
|
764 |
/**
|
| - |
|
765 |
* Clear and populate item availability table.
|
| 666 |
}
|
766 |
* @param availabilityMap
|
| - |
|
767 |
*/
|
| - |
|
768 |
|
| - |
|
769 |
private void updateAvailabilityTable(Map<Long, ItemInventory> itemInventoryMap){
|
| - |
|
770 |
availabilityTable.removeAllRows();
|
| - |
|
771 |
if(itemInventoryMap == null || itemInventoryMap.isEmpty()) {
|
| - |
|
772 |
return;
|
| - |
|
773 |
}
|
| - |
|
774 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_ID, "100px");
|
| - |
|
775 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_DESC, "300px");
|
| - |
|
776 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_INVA, "100px");
|
| - |
|
777 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_INVR, "100px");
|
| - |
|
778 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_HELD, "100px");
|
| - |
|
779 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_EBAY_HELD, "80px");
|
| - |
|
780 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_SNAPDEAL_HELD, "80px");
|
| - |
|
781 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_FLIPKART_HELD, "80px");
|
| - |
|
782 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_GET_BUTTON, "100px");
|
| - |
|
783 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_UPDATE_BUTTON, "100px");
|
| - |
|
784 |
|
| - |
|
785 |
int i=0;
|
| - |
|
786 |
for(ItemInventory warehousedata : itemInventoryMap.values()){
|
| - |
|
787 |
availabilityTable.setText(i, TABLE_INDEX_WAREHOUSE_ID, warehousedata.getWarehouseId() + "");
|
| - |
|
788 |
availabilityTable.setText(i, TABLE_INDEX_WAREHOUSE_DESC, Utils.getWarehouseDesc(warehousedata.getWarehouseId()) + "");
|
| - |
|
789 |
availabilityTable.setText(i, TABLE_INDEX_WAREHOUSE_INVA, warehousedata.getAvailability() + "");
|
| - |
|
790 |
availabilityTable.setText(i, TABLE_INDEX_WAREHOUSE_INVR, warehousedata.getReserved() + "");
|
| - |
|
791 |
availabilityTable.setText(i, TABLE_INDEX_WAREHOUSE_HELD, warehousedata.getHeld() + "");
|
| - |
|
792 |
availabilityTable.setText(i, TABLE_INDEX_WAREHOUSE_EBAY_HELD, warehousedata.getEbayHeld() + "");
|
| - |
|
793 |
availabilityTable.setText(i, TABLE_INDEX_WAREHOUSE_SNAPDEAL_HELD, warehousedata.getSnapdealHeld() + "");
|
| - |
|
794 |
availabilityTable.setText(i, TABLE_INDEX_WAREHOUSE_FLIPKART_HELD, warehousedata.getFlipkartHeld() + "");
|
| - |
|
795 |
|
| - |
|
796 |
i++;
|
| - |
|
797 |
}
|
| - |
|
798 |
}
|
| - |
|
799 |
|
| - |
|
800 |
/**
|
| - |
|
801 |
* Clear and populate vendor item key table with keys in the passed argument.
|
| - |
|
802 |
* With each row in the table, an edit button is created and click event listener
|
| - |
|
803 |
* is added to it to edit that vendor item key row.
|
| 667 |
});
|
804 |
* @param vendorKeysMap
|
| - |
|
805 |
*/
|
| - |
|
806 |
private void updateVendorKeysTable(Map<String, VendorItemMapping> vendorKeysMap){
|
| - |
|
807 |
tableVendorItemKey.removeAllRows();
|
| - |
|
808 |
|
| - |
|
809 |
if(vendorKeysMap == null || vendorKeysMap.isEmpty()) {
|
| - |
|
810 |
return;
|
| - |
|
811 |
}
|
| - |
|
812 |
tableVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_VENDORID, VENDOR_ID_WIDTH);
|
| - |
|
813 |
tableVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_VENDOR_DESC, VENDOR_DESC_WIDTH);
|
| - |
|
814 |
tableVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_ITEM_KEY, ITEM_KEY_WIDTH);
|
| - |
|
815 |
tableVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_ITEM_KEY_OLD, ITEM_KEY_WIDTH);
|
| - |
|
816 |
tableVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_BUTTON, BUTTON_WIDTH);
|
| - |
|
817 |
|
| - |
|
818 |
int i=0;
|
| - |
|
819 |
for(Entry<String, VendorItemMapping> e : vendorKeysMap.entrySet()){
|
| - |
|
820 |
VendorItemMapping vendorMapping = e.getValue();
|
| - |
|
821 |
tableVendorItemKey.setText(i, TABLE_INDEX_MAPPING_VENDORID, vendorMapping.getVendorId() + "");
|
| - |
|
822 |
tableVendorItemKey.setText(i, TABLE_INDEX_MAPPING_VENDOR_DESC, Utils.getVendorDesc(vendorMapping.getVendorId()));
|
| - |
|
823 |
tableVendorItemKey.setText(i, TABLE_INDEX_MAPPING_ITEM_KEY, vendorMapping.getItemKey());
|
| - |
|
824 |
tableVendorItemKey.setText(i, TABLE_INDEX_MAPPING_ITEM_KEY_OLD, e.getKey().substring(e.getKey().indexOf(Item.KEY_SEPARATOR)+1));
|
| - |
|
825 |
Button editButton = new Button("Edit");
|
| - |
|
826 |
tableVendorItemKey.setWidget(i, TABLE_INDEX_MAPPING_BUTTON, editButton);
|
| - |
|
827 |
editButton.addClickHandler(new ClickHandler() {
|
| - |
|
828 |
@Override
|
| - |
|
829 |
public void onClick(ClickEvent event) {
|
| - |
|
830 |
Cell cell = tableVendorItemKey.getCellForEvent(event);
|
| - |
|
831 |
int row = cell.getRowIndex();
|
| - |
|
832 |
long vendorId = Long.parseLong(tableVendorItemKey.getText(row, TABLE_INDEX_MAPPING_VENDORID));
|
| - |
|
833 |
editVendorKey(vendorId, row);
|
| - |
|
834 |
}
|
| - |
|
835 |
});
|
| - |
|
836 |
tableVendorItemKey.getCellFormatter().setVisible(i, TABLE_INDEX_MAPPING_VENDORID, false);
|
| - |
|
837 |
tableVendorItemKey.getCellFormatter().setVisible(i, TABLE_INDEX_MAPPING_ITEM_KEY_OLD, false);
|
| - |
|
838 |
i++;
|
| - |
|
839 |
}
|
| - |
|
840 |
}
|
| - |
|
841 |
|
| - |
|
842 |
/**
|
| - |
|
843 |
* Clear and populate vendor prices table with prices in the passed argument.
|
| - |
|
844 |
* With each row in the table, an edit button is created and click event listener
|
| - |
|
845 |
* is added to it to edit that vendor prices row.
|
| - |
|
846 |
* @param vendorPricingMap
|
| - |
|
847 |
*/
|
| - |
|
848 |
private void updateVendorPricingTable(Map<Long, VendorPricings> vendorPricingMap){
|
| - |
|
849 |
tableVendorPrices.removeAllRows();
|
| - |
|
850 |
|
| - |
|
851 |
if(vendorPricingMap == null || vendorPricingMap.isEmpty()) {
|
| - |
|
852 |
return;
|
| - |
|
853 |
}
|
| - |
|
854 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_VENDORID, VENDOR_ID_WIDTH);
|
| - |
|
855 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_VENDOR_DESC, VENDOR_DESC_WIDTH);
|
| - |
|
856 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_MOP, PRICE_WIDTH);
|
| - |
|
857 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_DP, PRICE_WIDTH);
|
| - |
|
858 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_TP, PRICE_WIDTH);
|
| - |
|
859 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_NLC, PRICE_WIDTH);
|
| - |
|
860 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_BUTTON, BUTTON_WIDTH);
|
| - |
|
861 |
|
| - |
|
862 |
|
| - |
|
863 |
int i=0;
|
| - |
|
864 |
for(VendorPricings vendorDetail : vendorPricingMap.values()){
|
| - |
|
865 |
tableVendorPrices.setText(i, TABLE_INDEX_PRICING_VENDORID, vendorDetail.getVendorId() + "");
|
| - |
|
866 |
tableVendorPrices.setText(i, TABLE_INDEX_PRICING_VENDOR_DESC, Utils.getVendorDesc(vendorDetail.getVendorId()));
|
| - |
|
867 |
tableVendorPrices.setText(i, TABLE_INDEX_PRICING_MOP, vendorDetail.getMop() + "");
|
| - |
|
868 |
tableVendorPrices.setText(i, TABLE_INDEX_PRICING_DP, vendorDetail.getDealerPrice() + "");
|
| - |
|
869 |
tableVendorPrices.setText(i, TABLE_INDEX_PRICING_TP, vendorDetail.getTransferPrice() + "");
|
| - |
|
870 |
tableVendorPrices.setText(i, TABLE_INDEX_PRICING_NLC, vendorDetail.getNlc() + "");
|
| - |
|
871 |
Button editButton = new Button("Edit");
|
| - |
|
872 |
tableVendorPrices.setWidget(i, TABLE_INDEX_PRICING_BUTTON, editButton);
|
| - |
|
873 |
editButton.addClickHandler(new ClickHandler() {
|
| - |
|
874 |
@Override
|
| - |
|
875 |
public void onClick(ClickEvent event) {
|
| - |
|
876 |
Cell cell = tableVendorPrices.getCellForEvent(event);
|
| - |
|
877 |
int row = cell.getRowIndex();
|
| - |
|
878 |
long vendorId = Long.parseLong(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_VENDORID));
|
| - |
|
879 |
editVendorPrices(vendorId, row);
|
| - |
|
880 |
}
|
| - |
|
881 |
});
|
| - |
|
882 |
tableVendorPrices.getCellFormatter().setVisible(i, TABLE_INDEX_PRICING_VENDORID, false);
|
| - |
|
883 |
i++;
|
| - |
|
884 |
}
|
| - |
|
885 |
}
|
| - |
|
886 |
|
| - |
|
887 |
/**
|
| - |
|
888 |
* Clear and populate vendor prices table with prices in the passed argument.
|
| - |
|
889 |
* With each row in the table, an edit button is created and click event listener
|
| 668 |
return true;
|
890 |
* is added to it to edit that vendor prices row.
|
| - |
|
891 |
* @param sourcePricingMap
|
| - |
|
892 |
*/
|
| - |
|
893 |
private void updateSourcePricingTable(Map<Long, SourcePricings> sourcePricingMap){
|
| - |
|
894 |
tableSourcePrices.removeAllRows();
|
| - |
|
895 |
|
| - |
|
896 |
if(sourcePricingMap == null || sourcePricingMap.isEmpty()) {
|
| - |
|
897 |
return;
|
| - |
|
898 |
}
|
| - |
|
899 |
tableSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_SOURCE_ID, VENDOR_ID_WIDTH);
|
| - |
|
900 |
tableSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_SOURCE_DESC, VENDOR_DESC_WIDTH);
|
| - |
|
901 |
tableSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_MRP, PRICE_WIDTH);
|
| - |
|
902 |
tableSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE, PRICE_WIDTH);
|
| - |
|
903 |
tableSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_BUTTON, BUTTON_WIDTH);
|
| - |
|
904 |
|
| - |
|
905 |
int i=0;
|
| - |
|
906 |
for(SourcePricings sourceDetail : sourcePricingMap.values()){
|
| - |
|
907 |
tableSourcePrices.setText(i, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID, sourceDetail.getSourceId() + "");
|
| - |
|
908 |
tableSourcePrices.setText(i, TABLE_INDEX_SOURCE_PRICING_SOURCE_DESC, Utils.getSourceDesc(sourceDetail.getSourceId()));
|
| - |
|
909 |
tableSourcePrices.setText(i, TABLE_INDEX_SOURCE_PRICING_MRP, sourceDetail.getMrp() + "");
|
| - |
|
910 |
tableSourcePrices.setText(i, TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE, sourceDetail.getSellingPrice() + "");
|
| - |
|
911 |
|
| - |
|
912 |
Button editButton = new Button("Edit");
|
| - |
|
913 |
tableSourcePrices.setWidget(i, TABLE_INDEX_SOURCE_PRICING_BUTTON, editButton);
|
| - |
|
914 |
editButton.addClickHandler(new ClickHandler() {
|
| - |
|
915 |
@Override
|
| - |
|
916 |
public void onClick(ClickEvent event) {
|
| - |
|
917 |
Cell cell = tableSourcePrices.getCellForEvent(event);
|
| - |
|
918 |
int row = cell.getRowIndex();
|
| - |
|
919 |
long sourceId = Long.parseLong(tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID));
|
| - |
|
920 |
editSourcePrices(sourceId, row);
|
| - |
|
921 |
}
|
| - |
|
922 |
});
|
| - |
|
923 |
tableSourcePrices.getCellFormatter().setVisible(i, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID, false);
|
| - |
|
924 |
i++;
|
| - |
|
925 |
}
|
| - |
|
926 |
}
|
| - |
|
927 |
|
| - |
|
928 |
/**
|
| - |
|
929 |
* Clear and populate similar items table with items in the passed argument.
|
| - |
|
930 |
* With each row in the table, an delete button is created and click event listener
|
| - |
|
931 |
* is added to it to delete that similar item row.
|
| 669 |
}
|
932 |
* @param similarItems
|
| - |
|
933 |
*/
|
| - |
|
934 |
private void updateSimilarItemsTable(Map<Long, Item> similarItems){
|
| - |
|
935 |
tableSimilarItems.removeAllRows();
|
| - |
|
936 |
|
| - |
|
937 |
if(similarItems == null || similarItems.isEmpty()) {
|
| - |
|
938 |
return;
|
| - |
|
939 |
}
|
| - |
|
940 |
tableSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_CATALOG_ITEM_ID, PRICE_WIDTH);
|
| - |
|
941 |
tableSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_PRODUCT_GROUP, PRICE_WIDTH);
|
| - |
|
942 |
tableSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_BRAND, PRICE_WIDTH);
|
| - |
|
943 |
tableSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_MODEL_NUMBER, PRICE_WIDTH);
|
| - |
|
944 |
tableSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_MODEL_NAME, PRICE_WIDTH);
|
| - |
|
945 |
tableSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_CATEGORY, "150px");
|
| - |
|
946 |
tableSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_BUTTON, BUTTON_WIDTH);
|
| - |
|
947 |
|
| - |
|
948 |
|
| - |
|
949 |
int i=0;
|
| - |
|
950 |
for(Item similarItemDetail : similarItems.values()){
|
| - |
|
951 |
tableSimilarItems.setText(i, TABLE_INDEX_SIMILAR_ITEMS_CATALOG_ITEM_ID, similarItemDetail.getCatalogItemId() + "");
|
| - |
|
952 |
tableSimilarItems.setText(i, TABLE_INDEX_SIMILAR_ITEMS_PRODUCT_GROUP, similarItemDetail.getProductGroup() + "");
|
| - |
|
953 |
tableSimilarItems.setText(i, TABLE_INDEX_SIMILAR_ITEMS_BRAND, similarItemDetail.getBrand() + "");
|
| - |
|
954 |
tableSimilarItems.setText(i, TABLE_INDEX_SIMILAR_ITEMS_MODEL_NUMBER, similarItemDetail.getModelNumber() + "");
|
| - |
|
955 |
tableSimilarItems.setText(i, TABLE_INDEX_SIMILAR_ITEMS_MODEL_NAME, similarItemDetail.getModelName() + "");
|
| - |
|
956 |
tableSimilarItems.setText(i, TABLE_INDEX_SIMILAR_ITEMS_CATEGORY, similarItemDetail.getContentCategory() + "");
|
| - |
|
957 |
|
| - |
|
958 |
Button deleteButton = new Button("Delete");
|
| - |
|
959 |
tableSimilarItems.setWidget(i, TABLE_INDEX_SIMILAR_ITEMS_BUTTON, deleteButton);
|
| - |
|
960 |
deleteButton.addClickHandler(new ClickHandler() {
|
| - |
|
961 |
@Override
|
| - |
|
962 |
public void onClick(ClickEvent event) {
|
| - |
|
963 |
Cell cell = tableSimilarItems.getCellForEvent(event);
|
| - |
|
964 |
final int row = cell.getRowIndex();
|
| - |
|
965 |
long catalogItemId = Long.parseLong(tableSimilarItems.getText(row, TABLE_INDEX_SIMILAR_ITEMS_CATALOG_ITEM_ID));
|
| - |
|
966 |
|
| - |
|
967 |
catalogService.deleteSimilarItem(item.getId(), catalogItemId, new AsyncCallback<Boolean>() {
|
| - |
|
968 |
@Override
|
| - |
|
969 |
public void onSuccess(Boolean result) {
|
| - |
|
970 |
if(result) {
|
| - |
|
971 |
GWT.log("Similar Item deleted");
|
| - |
|
972 |
long catalogItemId = Long.parseLong(tableSimilarItems.getText(row, TABLE_INDEX_SIMILAR_ITEMS_CATALOG_ITEM_ID));
|
| - |
|
973 |
tableSimilarItems.removeRow(row);
|
| - |
|
974 |
Map<Long, Item> newsimilarItems = item.getSimilarItems();
|
| - |
|
975 |
newsimilarItems.remove(catalogItemId);
|
| - |
|
976 |
item.setSimilarItems(newsimilarItems);
|
| - |
|
977 |
}
|
| - |
|
978 |
else {
|
| - |
|
979 |
GWT.log("Error deleting Similar Item");
|
| - |
|
980 |
Window.alert("Error deleting Similar Item");
|
| - |
|
981 |
}
|
| - |
|
982 |
}
|
| - |
|
983 |
@Override
|
| - |
|
984 |
public void onFailure(Throwable caught) {
|
| - |
|
985 |
caught.printStackTrace();
|
| - |
|
986 |
Window.alert("Error deleting Similar Item");
|
| - |
|
987 |
}
|
| 670 |
});
|
988 |
});
|
| 671 |
deactivateWarehouseDialog.show();
|
- |
|
| 672 |
}
|
989 |
}
|
| 673 |
});
|
990 |
});
|
| - |
|
991 |
i++;
|
| 674 |
}
|
992 |
}
|
| 675 |
|
993 |
}
|
| 676 |
|
994 |
|
| - |
|
995 |
private void updateVoucherTable(Map<String, VoucherItemMapping> vouchersMap){
|
| - |
|
996 |
tableVouchers.removeAllRows();
|
| - |
|
997 |
|
| 677 |
private void initVoucherHeader(){
|
998 |
if(vouchersMap == null || vouchersMap.isEmpty()) {
|
| - |
|
999 |
return;
|
| - |
|
1000 |
}
|
| 678 |
headerVouchers.getColumnFormatter().setWidth(TABLE_INDEX_VOUCHERS_TYPE, ITEM_KEY_WIDTH);
|
1001 |
tableVouchers.getColumnFormatter().setWidth(TABLE_INDEX_VOUCHERS_TYPE, ITEM_KEY_WIDTH);
|
| 679 |
headerVouchers.getColumnFormatter().setWidth(TABLE_INDEX_VOUCHERS_AMOUNT, VENDOR_DESC_WIDTH);
|
1002 |
tableVouchers.getColumnFormatter().setWidth(TABLE_INDEX_VOUCHERS_AMOUNT, VENDOR_DESC_WIDTH);
|
| 680 |
headerVouchers.getColumnFormatter().setWidth(TABLE_INDEX_VOUCHERS_ADD_EDIT_BUTTON, BUTTON_WIDTH);
|
1003 |
tableVouchers.getColumnFormatter().setWidth(TABLE_INDEX_VOUCHERS_ADD_EDIT_BUTTON, BUTTON_WIDTH);
|
| 681 |
headerVouchers.getColumnFormatter().setWidth(TABLE_INDEX_VOUCHERS_DEL_BUTTON, BUTTON_WIDTH);
|
1004 |
tableVouchers.getColumnFormatter().setWidth(TABLE_INDEX_VOUCHERS_DEL_BUTTON, BUTTON_WIDTH);
|
| - |
|
1005 |
|
| 682 |
|
1006 |
int i=0;
|
| 683 |
headerVouchers.setText(0, TABLE_INDEX_VOUCHERS_TYPE, "Voucher Type");
|
1007 |
for(VoucherItemMapping voucher : vouchersMap.values()){
|
| 684 |
headerVouchers.setText(0, TABLE_INDEX_VOUCHERS_AMOUNT, "Voucher Amount");
|
1008 |
tableVouchers.setText(i, TABLE_INDEX_VOUCHERS_TYPE, voucher.getVoucherType());
|
| 685 |
headerVouchers.getCellFormatter().setVisible(0, TABLE_INDEX_VOUCHERS_DEL_BUTTON, false);
|
1009 |
tableVouchers.setText(i, TABLE_INDEX_VOUCHERS_AMOUNT, voucher.getAmount() + "");
|
| - |
|
1010 |
|
| 686 |
Button addButton = new Button("Add");
|
1011 |
Button editButton = new Button("Edit");
|
| 687 |
headerVouchers.setWidget(0, TABLE_INDEX_VOUCHERS_ADD_EDIT_BUTTON, addButton);
|
1012 |
tableVouchers.setWidget(i, TABLE_INDEX_VOUCHERS_ADD_EDIT_BUTTON, editButton);
|
| 688 |
addButton.addClickHandler(new ClickHandler() {
|
1013 |
editButton.addClickHandler(new ClickHandler() {
|
| 689 |
@Override
|
1014 |
@Override
|
| 690 |
public void onClick(ClickEvent event) {
|
1015 |
public void onClick(ClickEvent event) {
|
| - |
|
1016 |
Cell cell = tableVouchers.getCellForEvent(event);
|
| - |
|
1017 |
final int row = cell.getRowIndex();
|
| - |
|
1018 |
String voucherAmount = tableVouchers.getText(row, TABLE_INDEX_VOUCHERS_AMOUNT);
|
| 691 |
VoucherItemDialog voucherItemDialog = new VoucherItemDialog();
|
1019 |
VoucherItemDialog voucherDialog = new VoucherItemDialog(voucherAmount);
|
| 692 |
voucherItemDialog.updateButton.setText("Add");
|
1020 |
voucherDialog.updateButton.setText("Update");
|
| 693 |
voucherItemDialog.setVoucherUpdateListener(new VoucherItemDialog.VoucherUpdateListener() {
|
1021 |
voucherDialog.setVoucherUpdateListener(new VoucherItemDialog.VoucherUpdateListener() {
|
| 694 |
@Override
|
1022 |
@Override
|
| 695 |
public boolean onUpdate(final String voucherType, final long voucherAmount) {
|
1023 |
public boolean onUpdate(final String voucherType, final long voucherAmount) {
|
| 696 |
if(!voucherExists(voucherType)) {
|
- |
|
| 697 |
Window.alert("Voucher already exists");
|
- |
|
| 698 |
return false;
|
- |
|
| 699 |
}
|
- |
|
| 700 |
Long voucherTypeValue = Utils.getVoucherTypeId(voucherType);;
|
1024 |
Long voucherTypeValue = Utils.getVoucherTypeId(voucherType);
|
| 701 |
catalogService.addVoucher(item.getCatalogItemId(), voucherTypeValue, voucherAmount, new AsyncCallback<Boolean>() {
|
1025 |
catalogService.addVoucher(item.getCatalogItemId(), voucherTypeValue, voucherAmount, new AsyncCallback<Boolean>() {
|
| 702 |
@Override
|
1026 |
@Override
|
| 703 |
public void onSuccess(Boolean result) {
|
1027 |
public void onSuccess(Boolean result) {
|
| 704 |
if(result) {
|
1028 |
if(result) {
|
| 705 |
GWT.log("Voucher Added");
|
1029 |
GWT.log("Voucher Updated");
|
| 706 |
VoucherItemMapping newvoucher = new VoucherItemMapping(voucherAmount, voucherType);
|
1030 |
VoucherItemMapping newvoucher = new VoucherItemMapping(voucherAmount, voucherType);
|
| 707 |
Map<String, VoucherItemMapping> newvouchersMap = item.getVouchersMap();
|
1031 |
Map<String, VoucherItemMapping> newvouchersMap = item.getVouchersMap();
|
| - |
|
1032 |
newvouchersMap.remove(voucherType);
|
| 708 |
newvouchersMap.put(voucherType, newvoucher);
|
1033 |
newvouchersMap.put(voucherType, newvoucher);
|
| 709 |
item.setVouchersMap(newvouchersMap);
|
1034 |
item.setVouchersMap(newvouchersMap);
|
| 710 |
updateVoucherTable(item.getVouchersMap());
|
1035 |
updateVoucherTable(item.getVouchersMap());
|
| 711 |
Window.alert("Voucher Added successfully.");
|
1036 |
Window.alert("Voucher Updated successfully.");
|
| - |
|
1037 |
}
|
| 712 |
}
|
1038 |
else {
|
| 713 |
else {
|
1039 |
GWT.log("Error Updating Voucher");
|
| 714 |
GWT.log("Error Adding Voucher");
|
1040 |
Window.alert("Error Updating Voucher");
|
| - |
|
1041 |
}
|
| - |
|
1042 |
}
|
| - |
|
1043 |
@Override
|
| - |
|
1044 |
public void onFailure(Throwable caught) {
|
| - |
|
1045 |
caught.printStackTrace();
|
| 715 |
Window.alert("Error Adding Voucher");
|
1046 |
Window.alert("Error Updating voucher");
|
| - |
|
1047 |
}
|
| - |
|
1048 |
});
|
| 716 |
}
|
1049 |
return true;
|
| - |
|
1050 |
}
|
| - |
|
1051 |
});
|
| 717 |
}
|
1052 |
voucherDialog.show();
|
| - |
|
1053 |
}
|
| - |
|
1054 |
});
|
| - |
|
1055 |
|
| - |
|
1056 |
Button deleteButton = new Button("Delete");
|
| - |
|
1057 |
tableVouchers.setWidget(i, TABLE_INDEX_VOUCHERS_DEL_BUTTON, deleteButton);
|
| - |
|
1058 |
deleteButton.addClickHandler(new ClickHandler() {
|
| - |
|
1059 |
@Override
|
| - |
|
1060 |
public void onClick(ClickEvent event) {
|
| - |
|
1061 |
Cell cell = tableVouchers.getCellForEvent(event);
|
| 718 |
@Override
|
1062 |
final int row = cell.getRowIndex();
|
| - |
|
1063 |
String voucherType = tableVouchers.getText(row, TABLE_INDEX_VOUCHERS_TYPE);
|
| - |
|
1064 |
Long voucherTypeValue = Utils.getVoucherTypeId(voucherType);
|
| - |
|
1065 |
catalogService.deleteVoucher(item.getCatalogItemId(), voucherTypeValue, new AsyncCallback<Boolean>() {
|
| - |
|
1066 |
@Override
|
| - |
|
1067 |
public void onSuccess(Boolean result) {
|
| - |
|
1068 |
if(result) {
|
| - |
|
1069 |
GWT.log("Voucher deleted");
|
| - |
|
1070 |
String voucherType = tableVouchers.getText(row, TABLE_INDEX_VOUCHERS_TYPE);
|
| - |
|
1071 |
tableVouchers.removeRow(row);
|
| - |
|
1072 |
Map<String, VoucherItemMapping> newvouchersMap = item.getVouchersMap();
|
| - |
|
1073 |
newvouchersMap.remove(voucherType);
|
| - |
|
1074 |
item.setVouchersMap(newvouchersMap);
|
| - |
|
1075 |
}
|
| - |
|
1076 |
else {
|
| - |
|
1077 |
GWT.log("Error deleting Voucher");
|
| - |
|
1078 |
Window.alert("Error deleting Voucher");
|
| - |
|
1079 |
}
|
| - |
|
1080 |
}
|
| - |
|
1081 |
@Override
|
| 719 |
public void onFailure(Throwable caught) {
|
1082 |
public void onFailure(Throwable caught) {
|
| 720 |
caught.printStackTrace();
|
1083 |
caught.printStackTrace();
|
| 721 |
Window.alert("Error deleting voucher");
|
1084 |
Window.alert("Error deleting Voucher");
|
| - |
|
1085 |
}
|
| - |
|
1086 |
});
|
| - |
|
1087 |
}
|
| - |
|
1088 |
});
|
| - |
|
1089 |
i++;
|
| - |
|
1090 |
}
|
| - |
|
1091 |
}
|
| - |
|
1092 |
private void updateTableIgnoredWarehouse(){
|
| - |
|
1093 |
tableIgnoredWarehouse.removeAllRows();
|
| - |
|
1094 |
List<ItemWarehouse> itemWarehouses = Utils.getignoredInventoryUpdateItemsIdsWarehouseIds();
|
| - |
|
1095 |
Map<Long,String> ignoredWarehouses = new HashMap<Long, String>();
|
| - |
|
1096 |
for(ItemWarehouse itemWarehouse:itemWarehouses){
|
| - |
|
1097 |
if(itemWarehouse.getItemId()==item.getId()){
|
| - |
|
1098 |
ignoredWarehouses.put(itemWarehouse.getWarehouseId(),Utils.getAllWarehouses().get(itemWarehouse.getWarehouseId()));
|
| - |
|
1099 |
}
|
| - |
|
1100 |
|
| - |
|
1101 |
}
|
| - |
|
1102 |
tableIgnoredWarehouse.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_NAME, "100px");
|
| - |
|
1103 |
tableIgnoredWarehouse.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_ADD_DEL_BUTTON, BUTTON_WIDTH);
|
| - |
|
1104 |
|
| - |
|
1105 |
int i=0;
|
| - |
|
1106 |
for(final Map.Entry<Long,String> entry : ignoredWarehouses.entrySet()){
|
| - |
|
1107 |
addRowToIgnoredWarehouseTable(i, entry.getKey(), entry.getValue());
|
| - |
|
1108 |
i++;
|
| - |
|
1109 |
}
|
| - |
|
1110 |
}
|
| - |
|
1111 |
|
| - |
|
1112 |
private void addRowToIgnoredWarehouseTable(int i, final Long whId, final String whName) {
|
| - |
|
1113 |
tableIgnoredWarehouse.setText(i,TABLE_INDEX_WAREHOUSE_NAME,whName);
|
| 722 |
}
|
1114 |
Button deleteButton = new Button("Delete");
|
| - |
|
1115 |
tableIgnoredWarehouse.setWidget(i, TABLE_INDEX_WAREHOUSE_ADD_DEL_BUTTON, deleteButton);
|
| - |
|
1116 |
deleteButton.addClickHandler(new ClickHandler() {
|
| - |
|
1117 |
@Override
|
| 723 |
});
|
1118 |
public void onClick(ClickEvent event) {
|
| - |
|
1119 |
Cell cell = tableIgnoredWarehouse.getCellForEvent(event);
|
| 724 |
return true;
|
1120 |
final int row = cell.getRowIndex();
|
| - |
|
1121 |
catalogService.deleteFromIgnoredInventoryUpdateItemsIdsWarehouseIds(item.getId(),whId, new AsyncCallback<Boolean>() {
|
| 725 |
}
|
1122 |
@Override
|
| - |
|
1123 |
public void onSuccess(Boolean result) {
|
| 726 |
});
|
1124 |
if(result) {
|
| - |
|
1125 |
GWT.log("Warehouse will now be in sync");
|
| 727 |
voucherItemDialog.show();
|
1126 |
tableIgnoredWarehouse.removeRow(row);
|
| - |
|
1127 |
Window.alert("Warehouse deleted from list ");
|
| - |
|
1128 |
Utils.getignoredInventoryUpdateItemsIdsWarehouseIds().remove(new ItemWarehouse(item.getId(),whId));
|
| - |
|
1129 |
}
|
| 728 |
}
|
1130 |
else {
|
| - |
|
1131 |
GWT.log("Error deleting Warehouse");
|
| - |
|
1132 |
Window.alert("Error deleting Warehouse");
|
| - |
|
1133 |
}
|
| - |
|
1134 |
}
|
| - |
|
1135 |
@Override
|
| - |
|
1136 |
public void onFailure(Throwable caught) {
|
| - |
|
1137 |
caught.printStackTrace();
|
| - |
|
1138 |
Window.alert("Error deleting Warehouse");
|
| - |
|
1139 |
}
|
| 729 |
});
|
1140 |
});
|
| 730 |
}
|
1141 |
}
|
| - |
|
1142 |
});
|
| 731 |
|
1143 |
|
| 732 |
/**
|
- |
|
| 733 |
* Clear and populate item availability table.
|
- |
|
| 734 |
* @param availabilityMap
|
- |
|
| 735 |
*/
|
- |
|
| 736 |
|
- |
|
| 737 |
private void updateAvailabilityTable(Map<Long, ItemInventory> itemInventoryMap){
|
- |
|
| 738 |
availabilityTable.removeAllRows();
|
- |
|
| 739 |
if(itemInventoryMap == null || itemInventoryMap.isEmpty()) {
|
- |
|
| 740 |
return;
|
- |
|
| 741 |
}
|
- |
|
| 742 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_ID, "100px");
|
- |
|
| 743 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_DESC, "300px");
|
- |
|
| 744 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_INVA, "100px");
|
- |
|
| 745 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_INVR, "100px");
|
- |
|
| 746 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_HELD, "100px");
|
- |
|
| 747 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_EBAY_HELD, "80px");
|
- |
|
| 748 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_SNAPDEAL_HELD, "80px");
|
- |
|
| 749 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_FLIPKART_HELD, "80px");
|
- |
|
| 750 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_GET_BUTTON, "100px");
|
- |
|
| 751 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_UPDATE_BUTTON, "100px");
|
- |
|
| 752 |
|
- |
|
| 753 |
int i=0;
|
- |
|
| 754 |
for(ItemInventory warehousedata : itemInventoryMap.values()){
|
- |
|
| 755 |
availabilityTable.setText(i, TABLE_INDEX_WAREHOUSE_ID, warehousedata.getWarehouseId() + "");
|
- |
|
| 756 |
availabilityTable.setText(i, TABLE_INDEX_WAREHOUSE_DESC, Utils.getWarehouseDesc(warehousedata.getWarehouseId()) + "");
|
- |
|
| 757 |
availabilityTable.setText(i, TABLE_INDEX_WAREHOUSE_INVA, warehousedata.getAvailability() + "");
|
- |
|
| 758 |
availabilityTable.setText(i, TABLE_INDEX_WAREHOUSE_INVR, warehousedata.getReserved() + "");
|
- |
|
| 759 |
availabilityTable.setText(i, TABLE_INDEX_WAREHOUSE_HELD, warehousedata.getHeld() + "");
|
- |
|
| 760 |
availabilityTable.setText(i, TABLE_INDEX_WAREHOUSE_EBAY_HELD, warehousedata.getEbayHeld() + "");
|
- |
|
| 761 |
availabilityTable.setText(i, TABLE_INDEX_WAREHOUSE_SNAPDEAL_HELD, warehousedata.getSnapdealHeld() + "");
|
- |
|
| 762 |
availabilityTable.setText(i, TABLE_INDEX_WAREHOUSE_FLIPKART_HELD, warehousedata.getFlipkartHeld() + "");
|
- |
|
| 763 |
|
- |
|
| 764 |
i++;
|
- |
|
| 765 |
}
|
- |
|
| 766 |
}
|
- |
|
| 767 |
|
- |
|
| 768 |
/**
|
- |
|
| 769 |
* Clear and populate vendor item key table with keys in the passed argument.
|
- |
|
| 770 |
* With each row in the table, an edit button is created and click event listener
|
- |
|
| 771 |
* is added to it to edit that vendor item key row.
|
- |
|
| 772 |
* @param vendorKeysMap
|
- |
|
| 773 |
*/
|
- |
|
| 774 |
private void updateVendorKeysTable(Map<String, VendorItemMapping> vendorKeysMap){
|
- |
|
| 775 |
tableVendorItemKey.removeAllRows();
|
- |
|
| 776 |
|
- |
|
| 777 |
if(vendorKeysMap == null || vendorKeysMap.isEmpty()) {
|
- |
|
| 778 |
return;
|
- |
|
| 779 |
}
|
- |
|
| 780 |
tableVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_VENDORID, VENDOR_ID_WIDTH);
|
- |
|
| 781 |
tableVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_VENDOR_DESC, VENDOR_DESC_WIDTH);
|
- |
|
| 782 |
tableVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_ITEM_KEY, ITEM_KEY_WIDTH);
|
- |
|
| 783 |
tableVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_ITEM_KEY_OLD, ITEM_KEY_WIDTH);
|
- |
|
| 784 |
tableVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_BUTTON, BUTTON_WIDTH);
|
- |
|
| 785 |
|
- |
|
| 786 |
int i=0;
|
- |
|
| 787 |
for(Entry<String, VendorItemMapping> e : vendorKeysMap.entrySet()){
|
- |
|
| 788 |
VendorItemMapping vendorMapping = e.getValue();
|
- |
|
| 789 |
tableVendorItemKey.setText(i, TABLE_INDEX_MAPPING_VENDORID, vendorMapping.getVendorId() + "");
|
- |
|
| 790 |
tableVendorItemKey.setText(i, TABLE_INDEX_MAPPING_VENDOR_DESC, Utils.getVendorDesc(vendorMapping.getVendorId()));
|
- |
|
| 791 |
tableVendorItemKey.setText(i, TABLE_INDEX_MAPPING_ITEM_KEY, vendorMapping.getItemKey());
|
- |
|
| 792 |
tableVendorItemKey.setText(i, TABLE_INDEX_MAPPING_ITEM_KEY_OLD, e.getKey().substring(e.getKey().indexOf(Item.KEY_SEPARATOR)+1));
|
- |
|
| 793 |
Button editButton = new Button("Edit");
|
- |
|
| 794 |
tableVendorItemKey.setWidget(i, TABLE_INDEX_MAPPING_BUTTON, editButton);
|
- |
|
| 795 |
editButton.addClickHandler(new ClickHandler() {
|
- |
|
| 796 |
@Override
|
- |
|
| 797 |
public void onClick(ClickEvent event) {
|
- |
|
| 798 |
Cell cell = tableVendorItemKey.getCellForEvent(event);
|
- |
|
| 799 |
int row = cell.getRowIndex();
|
- |
|
| 800 |
long vendorId = Long.parseLong(tableVendorItemKey.getText(row, TABLE_INDEX_MAPPING_VENDORID));
|
- |
|
| 801 |
editVendorKey(vendorId, row);
|
- |
|
| 802 |
}
|
- |
|
| 803 |
});
|
- |
|
| 804 |
tableVendorItemKey.getCellFormatter().setVisible(i, TABLE_INDEX_MAPPING_VENDORID, false);
|
- |
|
| 805 |
tableVendorItemKey.getCellFormatter().setVisible(i, TABLE_INDEX_MAPPING_ITEM_KEY_OLD, false);
|
- |
|
| 806 |
i++;
|
- |
|
| 807 |
}
|
- |
|
| 808 |
}
|
- |
|
| 809 |
|
- |
|
| 810 |
/**
|
- |
|
| 811 |
* Clear and populate vendor prices table with prices in the passed argument.
|
- |
|
| 812 |
* With each row in the table, an edit button is created and click event listener
|
- |
|
| 813 |
* is added to it to edit that vendor prices row.
|
- |
|
| 814 |
* @param vendorPricingMap
|
- |
|
| 815 |
*/
|
- |
|
| 816 |
private void updateVendorPricingTable(Map<Long, VendorPricings> vendorPricingMap){
|
- |
|
| 817 |
tableVendorPrices.removeAllRows();
|
- |
|
| 818 |
|
- |
|
| 819 |
if(vendorPricingMap == null || vendorPricingMap.isEmpty()) {
|
- |
|
| 820 |
return;
|
- |
|
| 821 |
}
|
- |
|
| 822 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_VENDORID, VENDOR_ID_WIDTH);
|
- |
|
| 823 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_VENDOR_DESC, VENDOR_DESC_WIDTH);
|
- |
|
| 824 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_MOP, PRICE_WIDTH);
|
- |
|
| 825 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_DP, PRICE_WIDTH);
|
- |
|
| 826 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_TP, PRICE_WIDTH);
|
- |
|
| 827 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_NLC, PRICE_WIDTH);
|
- |
|
| 828 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_BUTTON, BUTTON_WIDTH);
|
- |
|
| 829 |
|
- |
|
| 830 |
|
- |
|
| 831 |
int i=0;
|
- |
|
| 832 |
for(VendorPricings vendorDetail : vendorPricingMap.values()){
|
- |
|
| 833 |
tableVendorPrices.setText(i, TABLE_INDEX_PRICING_VENDORID, vendorDetail.getVendorId() + "");
|
- |
|
| 834 |
tableVendorPrices.setText(i, TABLE_INDEX_PRICING_VENDOR_DESC, Utils.getVendorDesc(vendorDetail.getVendorId()));
|
- |
|
| 835 |
tableVendorPrices.setText(i, TABLE_INDEX_PRICING_MOP, vendorDetail.getMop() + "");
|
- |
|
| 836 |
tableVendorPrices.setText(i, TABLE_INDEX_PRICING_DP, vendorDetail.getDealerPrice() + "");
|
- |
|
| 837 |
tableVendorPrices.setText(i, TABLE_INDEX_PRICING_TP, vendorDetail.getTransferPrice() + "");
|
- |
|
| 838 |
tableVendorPrices.setText(i, TABLE_INDEX_PRICING_NLC, vendorDetail.getNlc() + "");
|
- |
|
| 839 |
Button editButton = new Button("Edit");
|
- |
|
| 840 |
tableVendorPrices.setWidget(i, TABLE_INDEX_PRICING_BUTTON, editButton);
|
- |
|
| 841 |
editButton.addClickHandler(new ClickHandler() {
|
- |
|
| 842 |
@Override
|
- |
|
| 843 |
public void onClick(ClickEvent event) {
|
- |
|
| 844 |
Cell cell = tableVendorPrices.getCellForEvent(event);
|
- |
|
| 845 |
int row = cell.getRowIndex();
|
- |
|
| 846 |
long vendorId = Long.parseLong(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_VENDORID));
|
- |
|
| 847 |
editVendorPrices(vendorId, row);
|
- |
|
| 848 |
}
|
- |
|
| 849 |
});
|
- |
|
| 850 |
tableVendorPrices.getCellFormatter().setVisible(i, TABLE_INDEX_PRICING_VENDORID, false);
|
- |
|
| 851 |
i++;
|
- |
|
| 852 |
}
|
- |
|
| 853 |
}
|
- |
|
| 854 |
|
- |
|
| 855 |
/**
|
- |
|
| 856 |
* Clear and populate vendor prices table with prices in the passed argument.
|
- |
|
| 857 |
* With each row in the table, an edit button is created and click event listener
|
- |
|
| 858 |
* is added to it to edit that vendor prices row.
|
- |
|
| 859 |
* @param sourcePricingMap
|
- |
|
| 860 |
*/
|
- |
|
| 861 |
private void updateSourcePricingTable(Map<Long, SourcePricings> sourcePricingMap){
|
- |
|
| 862 |
tableSourcePrices.removeAllRows();
|
- |
|
| 863 |
|
- |
|
| 864 |
if(sourcePricingMap == null || sourcePricingMap.isEmpty()) {
|
- |
|
| 865 |
return;
|
- |
|
| 866 |
}
|
- |
|
| 867 |
tableSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_SOURCE_ID, VENDOR_ID_WIDTH);
|
- |
|
| 868 |
tableSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_SOURCE_DESC, VENDOR_DESC_WIDTH);
|
- |
|
| 869 |
tableSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_MRP, PRICE_WIDTH);
|
- |
|
| 870 |
tableSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE, PRICE_WIDTH);
|
- |
|
| 871 |
tableSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_BUTTON, BUTTON_WIDTH);
|
- |
|
| 872 |
|
- |
|
| 873 |
int i=0;
|
- |
|
| 874 |
for(SourcePricings sourceDetail : sourcePricingMap.values()){
|
- |
|
| 875 |
tableSourcePrices.setText(i, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID, sourceDetail.getSourceId() + "");
|
- |
|
| 876 |
tableSourcePrices.setText(i, TABLE_INDEX_SOURCE_PRICING_SOURCE_DESC, Utils.getSourceDesc(sourceDetail.getSourceId()));
|
- |
|
| 877 |
tableSourcePrices.setText(i, TABLE_INDEX_SOURCE_PRICING_MRP, sourceDetail.getMrp() + "");
|
- |
|
| 878 |
tableSourcePrices.setText(i, TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE, sourceDetail.getSellingPrice() + "");
|
- |
|
| 879 |
|
- |
|
| 880 |
Button editButton = new Button("Edit");
|
- |
|
| 881 |
tableSourcePrices.setWidget(i, TABLE_INDEX_SOURCE_PRICING_BUTTON, editButton);
|
- |
|
| 882 |
editButton.addClickHandler(new ClickHandler() {
|
- |
|
| 883 |
@Override
|
- |
|
| 884 |
public void onClick(ClickEvent event) {
|
- |
|
| 885 |
Cell cell = tableSourcePrices.getCellForEvent(event);
|
- |
|
| 886 |
int row = cell.getRowIndex();
|
- |
|
| 887 |
long sourceId = Long.parseLong(tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID));
|
- |
|
| 888 |
editSourcePrices(sourceId, row);
|
- |
|
| 889 |
}
|
- |
|
| 890 |
});
|
- |
|
| 891 |
tableSourcePrices.getCellFormatter().setVisible(i, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID, false);
|
- |
|
| 892 |
i++;
|
- |
|
| 893 |
}
|
- |
|
| 894 |
}
|
- |
|
| 895 |
|
- |
|
| 896 |
/**
|
- |
|
| 897 |
* Clear and populate similar items table with items in the passed argument.
|
- |
|
| 898 |
* With each row in the table, an delete button is created and click event listener
|
- |
|
| 899 |
* is added to it to delete that similar item row.
|
- |
|
| 900 |
* @param similarItems
|
- |
|
| 901 |
*/
|
- |
|
| 902 |
private void updateSimilarItemsTable(Map<Long, Item> similarItems){
|
- |
|
| 903 |
tableSimilarItems.removeAllRows();
|
- |
|
| 904 |
|
- |
|
| 905 |
if(similarItems == null || similarItems.isEmpty()) {
|
- |
|
| 906 |
return;
|
- |
|
| 907 |
}
|
- |
|
| 908 |
tableSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_CATALOG_ITEM_ID, PRICE_WIDTH);
|
- |
|
| 909 |
tableSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_PRODUCT_GROUP, PRICE_WIDTH);
|
- |
|
| 910 |
tableSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_BRAND, PRICE_WIDTH);
|
- |
|
| 911 |
tableSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_MODEL_NUMBER, PRICE_WIDTH);
|
- |
|
| 912 |
tableSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_MODEL_NAME, PRICE_WIDTH);
|
- |
|
| 913 |
tableSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_CATEGORY, "150px");
|
- |
|
| 914 |
tableSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_BUTTON, BUTTON_WIDTH);
|
- |
|
| 915 |
|
- |
|
| 916 |
|
- |
|
| 917 |
int i=0;
|
- |
|
| 918 |
for(Item similarItemDetail : similarItems.values()){
|
- |
|
| 919 |
tableSimilarItems.setText(i, TABLE_INDEX_SIMILAR_ITEMS_CATALOG_ITEM_ID, similarItemDetail.getCatalogItemId() + "");
|
- |
|
| 920 |
tableSimilarItems.setText(i, TABLE_INDEX_SIMILAR_ITEMS_PRODUCT_GROUP, similarItemDetail.getProductGroup() + "");
|
- |
|
| 921 |
tableSimilarItems.setText(i, TABLE_INDEX_SIMILAR_ITEMS_BRAND, similarItemDetail.getBrand() + "");
|
- |
|
| 922 |
tableSimilarItems.setText(i, TABLE_INDEX_SIMILAR_ITEMS_MODEL_NUMBER, similarItemDetail.getModelNumber() + "");
|
- |
|
| 923 |
tableSimilarItems.setText(i, TABLE_INDEX_SIMILAR_ITEMS_MODEL_NAME, similarItemDetail.getModelName() + "");
|
- |
|
| 924 |
tableSimilarItems.setText(i, TABLE_INDEX_SIMILAR_ITEMS_CATEGORY, similarItemDetail.getContentCategory() + "");
|
- |
|
| 925 |
|
- |
|
| 926 |
Button deleteButton = new Button("Delete");
|
- |
|
| 927 |
tableSimilarItems.setWidget(i, TABLE_INDEX_SIMILAR_ITEMS_BUTTON, deleteButton);
|
- |
|
| 928 |
deleteButton.addClickHandler(new ClickHandler() {
|
- |
|
| 929 |
@Override
|
- |
|
| 930 |
public void onClick(ClickEvent event) {
|
- |
|
| 931 |
Cell cell = tableSimilarItems.getCellForEvent(event);
|
- |
|
| 932 |
final int row = cell.getRowIndex();
|
- |
|
| 933 |
long catalogItemId = Long.parseLong(tableSimilarItems.getText(row, TABLE_INDEX_SIMILAR_ITEMS_CATALOG_ITEM_ID));
|
- |
|
| 934 |
|
- |
|
| 935 |
catalogService.deleteSimilarItem(item.getId(), catalogItemId, new AsyncCallback<Boolean>() {
|
- |
|
| 936 |
@Override
|
- |
|
| 937 |
public void onSuccess(Boolean result) {
|
- |
|
| 938 |
if(result) {
|
- |
|
| 939 |
GWT.log("Similar Item deleted");
|
- |
|
| 940 |
long catalogItemId = Long.parseLong(tableSimilarItems.getText(row, TABLE_INDEX_SIMILAR_ITEMS_CATALOG_ITEM_ID));
|
- |
|
| 941 |
tableSimilarItems.removeRow(row);
|
- |
|
| 942 |
Map<Long, Item> newsimilarItems = item.getSimilarItems();
|
- |
|
| 943 |
newsimilarItems.remove(catalogItemId);
|
- |
|
| 944 |
item.setSimilarItems(newsimilarItems);
|
- |
|
| 945 |
}
|
- |
|
| 946 |
else {
|
- |
|
| 947 |
GWT.log("Error deleting Similar Item");
|
- |
|
| 948 |
Window.alert("Error deleting Similar Item");
|
- |
|
| 949 |
}
|
- |
|
| 950 |
}
|
- |
|
| 951 |
@Override
|
- |
|
| 952 |
public void onFailure(Throwable caught) {
|
- |
|
| 953 |
caught.printStackTrace();
|
- |
|
| 954 |
Window.alert("Error deleting Similar Item");
|
- |
|
| 955 |
}
|
- |
|
| 956 |
});
|
- |
|
| 957 |
}
|
- |
|
| 958 |
});
|
- |
|
| 959 |
i++;
|
- |
|
| 960 |
}
|
- |
|
| 961 |
}
|
- |
|
| 962 |
|
- |
|
| 963 |
private void updateVoucherTable(Map<String, VoucherItemMapping> vouchersMap){
|
- |
|
| 964 |
tableVouchers.removeAllRows();
|
- |
|
| 965 |
|
- |
|
| 966 |
if(vouchersMap == null || vouchersMap.isEmpty()) {
|
- |
|
| 967 |
return;
|
- |
|
| 968 |
}
|
- |
|
| 969 |
tableVouchers.getColumnFormatter().setWidth(TABLE_INDEX_VOUCHERS_TYPE, ITEM_KEY_WIDTH);
|
- |
|
| 970 |
tableVouchers.getColumnFormatter().setWidth(TABLE_INDEX_VOUCHERS_AMOUNT, VENDOR_DESC_WIDTH);
|
- |
|
| 971 |
tableVouchers.getColumnFormatter().setWidth(TABLE_INDEX_VOUCHERS_ADD_EDIT_BUTTON, BUTTON_WIDTH);
|
- |
|
| 972 |
tableVouchers.getColumnFormatter().setWidth(TABLE_INDEX_VOUCHERS_DEL_BUTTON, BUTTON_WIDTH);
|
- |
|
| 973 |
|
- |
|
| 974 |
int i=0;
|
- |
|
| 975 |
for(VoucherItemMapping voucher : vouchersMap.values()){
|
- |
|
| 976 |
tableVouchers.setText(i, TABLE_INDEX_VOUCHERS_TYPE, voucher.getVoucherType());
|
- |
|
| 977 |
tableVouchers.setText(i, TABLE_INDEX_VOUCHERS_AMOUNT, voucher.getAmount() + "");
|
- |
|
| 978 |
|
- |
|
| 979 |
Button editButton = new Button("Edit");
|
- |
|
| 980 |
tableVouchers.setWidget(i, TABLE_INDEX_VOUCHERS_ADD_EDIT_BUTTON, editButton);
|
- |
|
| 981 |
editButton.addClickHandler(new ClickHandler() {
|
- |
|
| 982 |
@Override
|
- |
|
| 983 |
public void onClick(ClickEvent event) {
|
- |
|
| 984 |
Cell cell = tableVouchers.getCellForEvent(event);
|
- |
|
| 985 |
final int row = cell.getRowIndex();
|
- |
|
| 986 |
String voucherAmount = tableVouchers.getText(row, TABLE_INDEX_VOUCHERS_AMOUNT);
|
- |
|
| 987 |
VoucherItemDialog voucherDialog = new VoucherItemDialog(voucherAmount);
|
- |
|
| 988 |
voucherDialog.updateButton.setText("Update");
|
- |
|
| 989 |
voucherDialog.setVoucherUpdateListener(new VoucherItemDialog.VoucherUpdateListener() {
|
- |
|
| 990 |
@Override
|
- |
|
| 991 |
public boolean onUpdate(final String voucherType, final long voucherAmount) {
|
- |
|
| 992 |
Long voucherTypeValue = Utils.getVoucherTypeId(voucherType);
|
- |
|
| 993 |
catalogService.addVoucher(item.getCatalogItemId(), voucherTypeValue, voucherAmount, new AsyncCallback<Boolean>() {
|
- |
|
| 994 |
@Override
|
- |
|
| 995 |
public void onSuccess(Boolean result) {
|
- |
|
| 996 |
if(result) {
|
- |
|
| 997 |
GWT.log("Voucher Updated");
|
- |
|
| 998 |
VoucherItemMapping newvoucher = new VoucherItemMapping(voucherAmount, voucherType);
|
- |
|
| 999 |
Map<String, VoucherItemMapping> newvouchersMap = item.getVouchersMap();
|
- |
|
| 1000 |
newvouchersMap.remove(voucherType);
|
- |
|
| 1001 |
newvouchersMap.put(voucherType, newvoucher);
|
- |
|
| 1002 |
item.setVouchersMap(newvouchersMap);
|
- |
|
| 1003 |
updateVoucherTable(item.getVouchersMap());
|
- |
|
| 1004 |
Window.alert("Voucher Updated successfully.");
|
- |
|
| 1005 |
}
|
- |
|
| 1006 |
else {
|
- |
|
| 1007 |
GWT.log("Error Updating Voucher");
|
- |
|
| 1008 |
Window.alert("Error Updating Voucher");
|
- |
|
| 1009 |
}
|
- |
|
| 1010 |
}
|
- |
|
| 1011 |
@Override
|
- |
|
| 1012 |
public void onFailure(Throwable caught) {
|
- |
|
| 1013 |
caught.printStackTrace();
|
- |
|
| 1014 |
Window.alert("Error Updating voucher");
|
- |
|
| 1015 |
}
|
- |
|
| 1016 |
});
|
- |
|
| 1017 |
return true;
|
- |
|
| 1018 |
}
|
- |
|
| 1019 |
});
|
- |
|
| 1020 |
voucherDialog.show();
|
- |
|
| 1021 |
}
|
- |
|
| 1022 |
});
|
- |
|
| 1023 |
|
- |
|
| 1024 |
Button deleteButton = new Button("Delete");
|
- |
|
| 1025 |
tableVouchers.setWidget(i, TABLE_INDEX_VOUCHERS_DEL_BUTTON, deleteButton);
|
- |
|
| 1026 |
deleteButton.addClickHandler(new ClickHandler() {
|
- |
|
| 1027 |
@Override
|
- |
|
| 1028 |
public void onClick(ClickEvent event) {
|
- |
|
| 1029 |
Cell cell = tableVouchers.getCellForEvent(event);
|
- |
|
| 1030 |
final int row = cell.getRowIndex();
|
- |
|
| 1031 |
String voucherType = tableVouchers.getText(row, TABLE_INDEX_VOUCHERS_TYPE);
|
- |
|
| 1032 |
Long voucherTypeValue = Utils.getVoucherTypeId(voucherType);
|
- |
|
| 1033 |
catalogService.deleteVoucher(item.getCatalogItemId(), voucherTypeValue, new AsyncCallback<Boolean>() {
|
- |
|
| 1034 |
@Override
|
- |
|
| 1035 |
public void onSuccess(Boolean result) {
|
- |
|
| 1036 |
if(result) {
|
- |
|
| 1037 |
GWT.log("Voucher deleted");
|
- |
|
| 1038 |
String voucherType = tableVouchers.getText(row, TABLE_INDEX_VOUCHERS_TYPE);
|
- |
|
| 1039 |
tableVouchers.removeRow(row);
|
- |
|
| 1040 |
Map<String, VoucherItemMapping> newvouchersMap = item.getVouchersMap();
|
- |
|
| 1041 |
newvouchersMap.remove(voucherType);
|
- |
|
| 1042 |
item.setVouchersMap(newvouchersMap);
|
- |
|
| 1043 |
}
|
- |
|
| 1044 |
else {
|
- |
|
| 1045 |
GWT.log("Error deleting Voucher");
|
- |
|
| 1046 |
Window.alert("Error deleting Voucher");
|
- |
|
| 1047 |
}
|
- |
|
| 1048 |
}
|
- |
|
| 1049 |
@Override
|
- |
|
| 1050 |
public void onFailure(Throwable caught) {
|
- |
|
| 1051 |
caught.printStackTrace();
|
- |
|
| 1052 |
Window.alert("Error deleting Voucher");
|
- |
|
| 1053 |
}
|
- |
|
| 1054 |
});
|
- |
|
| 1055 |
}
|
- |
|
| 1056 |
});
|
- |
|
| 1057 |
i++;
|
- |
|
| 1058 |
}
|
- |
|
| 1059 |
}
|
- |
|
| 1060 |
private void updateTableIgnoredWarehouse(){
|
- |
|
| 1061 |
tableIgnoredWarehouse.removeAllRows();
|
- |
|
| 1062 |
List<ItemWarehouse> itemWarehouses = Utils.getignoredInventoryUpdateItemsIdsWarehouseIds();
|
- |
|
| 1063 |
Map<Long,String> ignoredWarehouses = new HashMap<Long, String>();
|
- |
|
| 1064 |
for(ItemWarehouse itemWarehouse:itemWarehouses){
|
- |
|
| 1065 |
if(itemWarehouse.getItemId()==item.getId()){
|
- |
|
| 1066 |
ignoredWarehouses.put(itemWarehouse.getWarehouseId(),Utils.getAllWarehouses().get(itemWarehouse.getWarehouseId()));
|
- |
|
| 1067 |
}
|
- |
|
| 1068 |
|
- |
|
| 1069 |
}
|
- |
|
| 1070 |
tableIgnoredWarehouse.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_NAME, "100px");
|
- |
|
| 1071 |
tableIgnoredWarehouse.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_ADD_DEL_BUTTON, BUTTON_WIDTH);
|
- |
|
| 1072 |
|
- |
|
| 1073 |
int i=0;
|
- |
|
| 1074 |
for(final Map.Entry<Long,String> entry : ignoredWarehouses.entrySet()){
|
- |
|
| 1075 |
addRowToIgnoredWarehouseTable(i, entry.getKey(), entry.getValue());
|
- |
|
| 1076 |
i++;
|
- |
|
| 1077 |
}
|
- |
|
| 1078 |
}
|
- |
|
| 1079 |
|
- |
|
| 1080 |
private void addRowToIgnoredWarehouseTable(int i, final Long whId, final String whName) {
|
- |
|
| 1081 |
tableIgnoredWarehouse.setText(i,TABLE_INDEX_WAREHOUSE_NAME,whName);
|
- |
|
| 1082 |
Button deleteButton = new Button("Delete");
|
- |
|
| 1083 |
tableIgnoredWarehouse.setWidget(i, TABLE_INDEX_WAREHOUSE_ADD_DEL_BUTTON, deleteButton);
|
- |
|
| 1084 |
deleteButton.addClickHandler(new ClickHandler() {
|
- |
|
| 1085 |
@Override
|
- |
|
| 1086 |
public void onClick(ClickEvent event) {
|
- |
|
| 1087 |
Cell cell = tableIgnoredWarehouse.getCellForEvent(event);
|
- |
|
| 1088 |
final int row = cell.getRowIndex();
|
- |
|
| 1089 |
catalogService.deleteFromIgnoredInventoryUpdateItemsIdsWarehouseIds(item.getId(),whId, new AsyncCallback<Boolean>() {
|
- |
|
| 1090 |
@Override
|
- |
|
| 1091 |
public void onSuccess(Boolean result) {
|
- |
|
| 1092 |
if(result) {
|
- |
|
| 1093 |
GWT.log("Warehouse will now be in sync");
|
- |
|
| 1094 |
tableIgnoredWarehouse.removeRow(row);
|
- |
|
| 1095 |
Window.alert("Warehouse deleted from list ");
|
- |
|
| 1096 |
Utils.getignoredInventoryUpdateItemsIdsWarehouseIds().remove(new ItemWarehouse(item.getId(),whId));
|
- |
|
| 1097 |
}
|
- |
|
| 1098 |
else {
|
- |
|
| 1099 |
GWT.log("Error deleting Warehouse");
|
- |
|
| 1100 |
Window.alert("Error deleting Warehouse");
|
- |
|
| 1101 |
}
|
- |
|
| 1102 |
}
|
- |
|
| 1103 |
@Override
|
- |
|
| 1104 |
public void onFailure(Throwable caught) {
|
- |
|
| 1105 |
caught.printStackTrace();
|
- |
|
| 1106 |
Window.alert("Error deleting Warehouse");
|
- |
|
| 1107 |
}
|
- |
|
| 1108 |
});
|
- |
|
| 1109 |
}
|
- |
|
| 1110 |
});
|
- |
|
| 1111 |
|
- |
|
| 1112 |
}
|
1144 |
}
|
| 1113 |
|
1145 |
|
| 1114 |
/**
|
1146 |
/**
|
| 1115 |
* called on the click event of update item button in ItemActions
|
1147 |
* called on the click event of update item button in ItemActions
|
| 1116 |
*/
|
1148 |
*/
|
| 1117 |
void updateItem() {
|
1149 |
void updateItem() {
|
| 1118 |
if(item == null) {
|
1150 |
if(item == null) {
|
| 1119 |
Window.alert("Please select an item to update.");
|
1151 |
Window.alert("Please select an item to update.");
|
| 1120 |
return;
|
1152 |
return;
|
| 1121 |
}
|
1153 |
}
|
| 1122 |
try {
|
1154 |
try {
|
| 1123 |
if(!createNewItem()) {
|
1155 |
if(!createNewItem()) {
|
| 1124 |
return;
|
1156 |
return;
|
| 1125 |
}
|
1157 |
}
|
| 1126 |
} catch(NumberFormatException ex) {
|
1158 |
} catch(NumberFormatException ex) {
|
| 1127 |
ex.printStackTrace();
|
1159 |
ex.printStackTrace();
|
| 1128 |
GWT.log("Number format exception");
|
1160 |
GWT.log("Number format exception");
|
| 1129 |
}
|
1161 |
}
|
| 1130 |
String paramsChanged = isItemChanged();
|
1162 |
String paramsChanged = isItemChanged();
|
| 1131 |
if(paramsChanged.equals("")) {
|
1163 |
if(paramsChanged.equals("")) {
|
| 1132 |
Window.alert("Nothing to update. Please change intended item parameters and try again.");
|
1164 |
Window.alert("Nothing to update. Please change intended item parameters and try again.");
|
| 1133 |
return;
|
1165 |
return;
|
| 1134 |
} else {
|
1166 |
} else {
|
| 1135 |
if(item.getSameItemsWithDifferentColors().size()>0 && optionalChangedValMap.size()>0 ){
|
1167 |
if(item.getSameItemsWithDifferentColors().size()>0 && optionalChangedValMap.size()>0 ){
|
| 1136 |
createDialog(paramsChanged);
|
1168 |
createDialog(paramsChanged);
|
| 1137 |
} else {
|
1169 |
} else {
|
| 1138 |
String paramsChanged1 = "";
|
1170 |
String paramsChanged1 = "";
|
| 1139 |
paramsChanged1 = "You have changed following items.\n" + paramsChanged;
|
1171 |
paramsChanged1 = "You have changed following items.\n" + paramsChanged;
|
| 1140 |
Window.alert(paramsChanged1);
|
1172 |
Window.alert(paramsChanged1);
|
| 1141 |
validateNUpdate();
|
1173 |
validateNUpdate();
|
| 1142 |
}
|
1174 |
}
|
| 1143 |
if("\n-Expected Delay".equals(paramsChanged) || "\n-Has Serial Number Flag".equals(paramsChanged)){
|
1175 |
if("\n-Expected Delay".equals(paramsChanged) || "\n-Has Serial Number Flag".equals(paramsChanged)){
|
| 1144 |
catalogService.updateExpectedDelayOnProd(newItem, new AsyncCallback<String>() {
|
1176 |
catalogService.updateExpectedDelayOnProd(newItem, new AsyncCallback<String>() {
|
| 1145 |
@Override
|
1177 |
@Override
|
| 1146 |
public void onSuccess(String result) {
|
1178 |
public void onSuccess(String result) {
|
| 1147 |
Window.alert(result);
|
1179 |
Window.alert(result);
|
| 1148 |
}
|
1180 |
}
|
| 1149 |
@Override
|
1181 |
@Override
|
| 1150 |
public void onFailure(Throwable caught) {
|
1182 |
public void onFailure(Throwable caught) {
|
| 1151 |
Window.alert("Error while updating item on production");
|
1183 |
Window.alert("Error while updating item on production");
|
| 1152 |
}
|
1184 |
}
|
| 1153 |
});
|
1185 |
});
|
| 1154 |
}
|
1186 |
}
|
| 1155 |
}
|
1187 |
}
|
| 1156 |
}
|
1188 |
}
|
| 1157 |
|
1189 |
|
| 1158 |
|
1190 |
|
| 1159 |
private void validateNUpdate() {
|
1191 |
private void validateNUpdate() {
|
| 1160 |
if(!Utils.validateItem(newItem)) {
|
1192 |
if(!Utils.validateItem(newItem)) {
|
| 1161 |
return;
|
1193 |
return;
|
| 1162 |
}
|
1194 |
}
|
| 1163 |
|
1195 |
|
| 1164 |
final String[] messageList = new String[2];
|
1196 |
final String[] messageList = new String[2];
|
| 1165 |
|
1197 |
|
| 1166 |
String sellingpricemessage = compareSellingPricewithBreakEven();
|
1198 |
String sellingpricemessage = compareSellingPricewithBreakEven();
|
| 1167 |
if(sellingpricemessage.equals("false")) {
|
1199 |
if(sellingpricemessage.equals("false")) {
|
| 1168 |
return;
|
1200 |
return;
|
| 1169 |
}
|
1201 |
}
|
| 1170 |
else if(!sellingpricemessage.equals("true")) {
|
1202 |
else if(!sellingpricemessage.equals("true")) {
|
| 1171 |
messageList[0] = sellingpricemessage;
|
1203 |
messageList[0] = sellingpricemessage;
|
| 1172 |
}
|
1204 |
}
|
| 1173 |
|
1205 |
|
| 1174 |
String preferredvendormessage = checkTransferPriceforPreferredVendor();
|
1206 |
String preferredvendormessage = checkTransferPriceforPreferredVendor();
|
| 1175 |
if(preferredvendormessage.equals("false")) {
|
1207 |
if(preferredvendormessage.equals("false")) {
|
| 1176 |
return;
|
1208 |
return;
|
| 1177 |
}
|
1209 |
}
|
| 1178 |
else if(!preferredvendormessage.equals("true")) {
|
1210 |
else if(!preferredvendormessage.equals("true")) {
|
| 1179 |
messageList[1] = preferredvendormessage;
|
1211 |
messageList[1] = preferredvendormessage;
|
| 1180 |
}
|
1212 |
}
|
| 1181 |
|
1213 |
|
| 1182 |
/*if(!validatePrices()) {
|
1214 |
/*if(!validatePrices()) {
|
| 1183 |
return;
|
1215 |
return;
|
| 1184 |
}*/
|
1216 |
}*/
|
| 1185 |
catalogService.updateItem(newItem, new AsyncCallback<Boolean>() {
|
1217 |
catalogService.updateItem(newItem, new AsyncCallback<Boolean>() {
|
| 1186 |
@Override
|
1218 |
@Override
|
| 1187 |
public void onSuccess(Boolean result) {
|
1219 |
public void onSuccess(Boolean result) {
|
| 1188 |
if(result) {
|
1220 |
if(result) {
|
| 1189 |
for(int i = 0; i < messageList.length; i++) {
|
1221 |
for(int i = 0; i < messageList.length; i++) {
|
| 1190 |
if(messageList[i] != null) {
|
1222 |
if(messageList[i] != null) {
|
| 1191 |
logAuthorization(messageList[i]);
|
1223 |
logAuthorization(messageList[i]);
|
| 1192 |
}
|
1224 |
}
|
| 1193 |
}
|
1225 |
}
|
| 1194 |
if(optionalChangedValMap.size()>0 || mandatoryChangedValMap.size()>0){
|
1226 |
if(optionalChangedValMap.size()>0 || mandatoryChangedValMap.size()>0){
|
| 1195 |
for(Long itemId : item.getSameItemsWithDifferentColors()){
|
1227 |
for(Long itemId : item.getSameItemsWithDifferentColors()){
|
| 1196 |
updateItem(itemId);
|
1228 |
updateItem(itemId);
|
| 1197 |
}
|
1229 |
}
|
| 1198 |
}
|
1230 |
}
|
| 1199 |
item = newItem;
|
1231 |
item = newItem;
|
| 1200 |
GWT.log("Item updated. Id = " + item.getId());
|
1232 |
GWT.log("Item updated. Id = " + item.getId());
|
| 1201 |
catalogDashboardPanel.getItemListWidget().updateItem(item);
|
1233 |
catalogDashboardPanel.getItemListWidget().updateItem(item);
|
| 1202 |
getFreshItemFromDB(item.getId());
|
1234 |
getFreshItemFromDB(item.getId());
|
| 1203 |
Window.alert("Item updated successfully.");
|
1235 |
Window.alert("Item updated successfully.");
|
| 1204 |
}
|
1236 |
}
|
| 1205 |
else {
|
1237 |
else {
|
| 1206 |
GWT.log("Error updating item");
|
1238 |
GWT.log("Error updating item");
|
| 1207 |
Window.alert("Error updating item");
|
1239 |
Window.alert("Error updating item");
|
| 1208 |
}
|
1240 |
}
|
| 1209 |
}
|
1241 |
}
|
| 1210 |
@Override
|
1242 |
@Override
|
| 1211 |
public void onFailure(Throwable caught) {
|
1243 |
public void onFailure(Throwable caught) {
|
| 1212 |
caught.printStackTrace();
|
1244 |
caught.printStackTrace();
|
| 1213 |
Window.alert("Error while updating item");
|
1245 |
Window.alert("Error while updating item");
|
| 1214 |
}
|
1246 |
}
|
| 1215 |
});
|
1247 |
});
|
| 1216 |
}
|
1248 |
}
|
| 1217 |
|
1249 |
|
| 1218 |
private void getFreshItemFromDB(long id) {
|
1250 |
private void getFreshItemFromDB(long id) {
|
| 1219 |
catalogService.getItem(id, new AsyncCallback<Item>() {
|
1251 |
catalogService.getItem(id, new AsyncCallback<Item>() {
|
| 1220 |
@Override
|
1252 |
@Override
|
| 1221 |
public void onSuccess(Item result) {
|
1253 |
public void onSuccess(Item result) {
|
| 1222 |
setItemDetails(result);
|
1254 |
setItemDetails(result);
|
| 1223 |
}
|
1255 |
}
|
| 1224 |
@Override
|
1256 |
@Override
|
| 1225 |
public void onFailure(Throwable caught) {
|
1257 |
public void onFailure(Throwable caught) {
|
| 1226 |
caught.printStackTrace();
|
1258 |
caught.printStackTrace();
|
| 1227 |
Window.alert("Unable to fetch item details.");
|
1259 |
Window.alert("Unable to fetch item details.");
|
| 1228 |
}
|
1260 |
}
|
| 1229 |
});
|
1261 |
});
|
| 1230 |
}
|
1262 |
}
|
| 1231 |
|
1263 |
|
| 1232 |
/**
|
1264 |
/**
|
| 1233 |
* This method is called while updating item.<br> It will create a new Item object and set
|
1265 |
* This method is called while updating item.<br> It will create a new Item object and set
|
| 1234 |
* its editable attributes with UI fields values and non-editable attributes with old Item
|
1266 |
* its editable attributes with UI fields values and non-editable attributes with old Item
|
| 1235 |
* object attributes. This new Item object is then passed to the service to update item in the database.
|
1267 |
* object attributes. This new Item object is then passed to the service to update item in the database.
|
| 1236 |
* <br>If update is successful, the old Item object is replaced with the new Item object.
|
1268 |
* <br>If update is successful, the old Item object is replaced with the new Item object.
|
| 1237 |
* @return true if new Item object is created successfully
|
1269 |
* @return true if new Item object is created successfully
|
| 1238 |
* <br>false if some error occurs due to NumberFormatException
|
1270 |
* <br>false if some error occurs due to NumberFormatException
|
| 1239 |
*/
|
1271 |
*/
|
| 1240 |
private boolean createNewItem() {
|
1272 |
private boolean createNewItem() {
|
| 1241 |
newItem = new Item();
|
1273 |
newItem = new Item();
|
| 1242 |
newItem.setId(item.getId());
|
1274 |
newItem.setId(item.getId());
|
| 1243 |
newItem.setProductGroup(productGroup.getText().trim());
|
1275 |
newItem.setProductGroup(productGroup.getText().trim());
|
| 1244 |
newItem.setBrand(brand.getText().trim());
|
1276 |
newItem.setBrand(brand.getText().trim());
|
| 1245 |
newItem.setModelNumber(modelNumber.getText().trim());
|
1277 |
newItem.setModelNumber(modelNumber.getText().trim());
|
| 1246 |
newItem.setModelName(modelName.getText().trim());
|
1278 |
newItem.setModelName(modelName.getText().trim());
|
| 1247 |
newItem.setColor(color.getText().trim());
|
1279 |
newItem.setColor(color.getText().trim());
|
| 1248 |
newItem.setContentCategory(contentCategory.getText());
|
1280 |
newItem.setContentCategory(contentCategory.getText());
|
| 1249 |
newItem.setComments(comments.getText().trim());
|
1281 |
newItem.setComments(comments.getText().trim());
|
| 1250 |
newItem.setCatalogItemId(Long.parseLong(catalogItemId.getText()));
|
1282 |
newItem.setCatalogItemId(Long.parseLong(catalogItemId.getText()));
|
| 1251 |
|
1283 |
|
| 1252 |
try {
|
1284 |
try {
|
| 1253 |
if(!mrp.getText().trim().isEmpty()) {
|
1285 |
if(!mrp.getText().trim().isEmpty()) {
|
| 1254 |
double mrpValue = Double.parseDouble(mrp.getText().trim());
|
1286 |
double mrpValue = Double.parseDouble(mrp.getText().trim());
|
| 1255 |
if(mrpValue <= 0) {
|
1287 |
if(mrpValue <= 0) {
|
| 1256 |
throw new NumberFormatException("Negative value of MRP");
|
1288 |
throw new NumberFormatException("Negative value of MRP");
|
| 1257 |
}
|
1289 |
}
|
| 1258 |
newItem.setMrp(mrpValue);
|
1290 |
newItem.setMrp(mrpValue);
|
| 1259 |
}
|
1291 |
}
|
| 1260 |
} catch(NumberFormatException ex) {
|
1292 |
} catch(NumberFormatException ex) {
|
| 1261 |
Window.alert("Invalid MRP format/value. Value shoule be greater than zero");
|
1293 |
Window.alert("Invalid MRP format/value. Value shoule be greater than zero");
|
| 1262 |
return false;
|
1294 |
return false;
|
| 1263 |
}
|
1295 |
}
|
| 1264 |
try {
|
1296 |
try {
|
| 1265 |
if(!sellingPrice.getText().trim().isEmpty()) {
|
1297 |
if(!sellingPrice.getText().trim().isEmpty()) {
|
| 1266 |
double spValue = Double.parseDouble(sellingPrice.getText().trim());
|
1298 |
double spValue = Double.parseDouble(sellingPrice.getText().trim());
|
| 1267 |
if(spValue <= 0) {
|
1299 |
if(spValue <= 0) {
|
| 1268 |
throw new NumberFormatException("Negative value of Selling price");
|
1300 |
throw new NumberFormatException("Negative value of Selling price");
|
| 1269 |
}
|
1301 |
}
|
| 1270 |
newItem.setSellingPrice(spValue);
|
1302 |
newItem.setSellingPrice(spValue);
|
| 1271 |
}
|
1303 |
}
|
| 1272 |
} catch(NumberFormatException ex) {
|
1304 |
} catch(NumberFormatException ex) {
|
| 1273 |
Window.alert("Invalid Selling Price format/value. Value shoule be greater than zero");
|
1305 |
Window.alert("Invalid Selling Price format/value. Value shoule be greater than zero");
|
| 1274 |
return false;
|
1306 |
return false;
|
| 1275 |
}
|
1307 |
}
|
| 1276 |
try {
|
1308 |
try {
|
| 1277 |
if(!weight.getText().trim().isEmpty()) {
|
1309 |
if(!weight.getText().trim().isEmpty()) {
|
| 1278 |
double wtValue = Double.parseDouble(weight.getText().trim());
|
1310 |
double wtValue = Double.parseDouble(weight.getText().trim());
|
| 1279 |
if(wtValue <= 0) {
|
1311 |
if(wtValue <= 0) {
|
| 1280 |
throw new NumberFormatException("Negative value of Weight");
|
1312 |
throw new NumberFormatException("Negative value of Weight");
|
| 1281 |
}
|
1313 |
}
|
| 1282 |
newItem.setWeight(wtValue);
|
1314 |
newItem.setWeight(wtValue);
|
| 1283 |
}
|
1315 |
}
|
| 1284 |
} catch(NumberFormatException ex) {
|
1316 |
} catch(NumberFormatException ex) {
|
| 1285 |
Window.alert("Invalid weight format/value. Value shoule be greater than zero");
|
1317 |
Window.alert("Invalid weight format/value. Value shoule be greater than zero");
|
| 1286 |
return false;
|
1318 |
return false;
|
| 1287 |
}
|
1319 |
}
|
| 1288 |
try {
|
1320 |
try {
|
| 1289 |
if(!startDate.getTextBox().getText().trim().equals("")) {
|
1321 |
if(!startDate.getTextBox().getText().trim().equals("")) {
|
| 1290 |
newItem.setStartDate(startDate.getValue().getTime());
|
1322 |
newItem.setStartDate(startDate.getValue().getTime());
|
| 1291 |
}
|
1323 |
}
|
| 1292 |
} catch(Exception ex) {
|
1324 |
} catch(Exception ex) {
|
| 1293 |
Window.alert("Invalid start date format");
|
1325 |
Window.alert("Invalid start date format");
|
| 1294 |
return false;
|
1326 |
return false;
|
| 1295 |
}
|
1327 |
}
|
| 1296 |
newItem.setBestDealsText(bestDealsText.getText().trim());
|
1328 |
newItem.setBestDealsText(bestDealsText.getText().trim());
|
| 1297 |
newItem.setBestDealsDetailsText(bestDealsDetailsText.getText().trim());
|
1329 |
newItem.setBestDealsDetailsText(bestDealsDetailsText.getText().trim());
|
| 1298 |
newItem.setBestDealsDetailsLink(bestDealsDetailsLink.getText().trim());
|
1330 |
newItem.setBestDealsDetailsLink(bestDealsDetailsLink.getText().trim());
|
| 1299 |
Date comingSoonStartDt = comingSoonStartDate.getValue();
|
1331 |
Date comingSoonStartDt = comingSoonStartDate.getValue();
|
| 1300 |
Date expectedArrivalDt = expectedArrivalDate.getValue();
|
1332 |
Date expectedArrivalDt = expectedArrivalDate.getValue();
|
| 1301 |
if(comingSoonStartDt == null){
|
1333 |
if(comingSoonStartDt == null){
|
| 1302 |
newItem.setComingSoonStartDate(null);
|
1334 |
newItem.setComingSoonStartDate(null);
|
| 1303 |
}else {
|
1335 |
}else {
|
| 1304 |
newItem.setComingSoonStartDate(comingSoonStartDt.getTime());
|
1336 |
newItem.setComingSoonStartDate(comingSoonStartDt.getTime());
|
| 1305 |
}
|
1337 |
}
|
| 1306 |
if(expectedArrivalDt == null){
|
1338 |
if(expectedArrivalDt == null){
|
| 1307 |
newItem.setExpectedArrivalDate(null);
|
1339 |
newItem.setExpectedArrivalDate(null);
|
| 1308 |
}else {
|
1340 |
}else {
|
| 1309 |
newItem.setExpectedArrivalDate(expectedArrivalDt.getTime());
|
1341 |
newItem.setExpectedArrivalDate(expectedArrivalDt.getTime());
|
| 1310 |
}
|
1342 |
}
|
| 1311 |
try {
|
1343 |
try {
|
| 1312 |
if(!bestDealsValue.getText().trim().equals("")) {
|
1344 |
if(!bestDealsValue.getText().trim().equals("")) {
|
| 1313 |
double bdValue = Double.parseDouble(bestDealsValue.getText().trim());
|
1345 |
double bdValue = Double.parseDouble(bestDealsValue.getText().trim());
|
| 1314 |
if(bdValue < 0) {
|
1346 |
if(bdValue < 0) {
|
| 1315 |
throw new NumberFormatException("Negative value of BestDealValue");
|
1347 |
throw new NumberFormatException("Negative value of BestDealValue");
|
| 1316 |
}
|
1348 |
}
|
| 1317 |
newItem.setBestDealsValue(bdValue);
|
1349 |
newItem.setBestDealsValue(bdValue);
|
| 1318 |
}
|
1350 |
}
|
| 1319 |
} catch(NumberFormatException ex) {
|
1351 |
} catch(NumberFormatException ex) {
|
| 1320 |
Window.alert("Invalid best deal value format");
|
1352 |
Window.alert("Invalid best deal value format");
|
| 1321 |
return false;
|
1353 |
return false;
|
| 1322 |
}
|
1354 |
}
|
| 1323 |
|
1355 |
|
| 1324 |
try {
|
1356 |
try {
|
| 1325 |
if(!bestSellingRank.getText().trim().equals("")) {
|
1357 |
if(!bestSellingRank.getText().trim().equals("")) {
|
| 1326 |
long bsrValue = Long.parseLong(bestSellingRank.getText().trim());
|
1358 |
long bsrValue = Long.parseLong(bestSellingRank.getText().trim());
|
| 1327 |
if(bsrValue < 0) {
|
1359 |
if(bsrValue < 0) {
|
| 1328 |
throw new NumberFormatException("Negative value of Best Selling Rank");
|
1360 |
throw new NumberFormatException("Negative value of Best Selling Rank");
|
| 1329 |
}
|
1361 |
}
|
| 1330 |
newItem.setBestSellingRank(bsrValue);
|
1362 |
newItem.setBestSellingRank(bsrValue);
|
| 1331 |
}
|
1363 |
}
|
| 1332 |
} catch(NumberFormatException ex) {
|
1364 |
} catch(NumberFormatException ex) {
|
| 1333 |
Window.alert("Invalid best selling rank format");
|
1365 |
Window.alert("Invalid best selling rank format");
|
| 1334 |
return false;
|
1366 |
return false;
|
| 1335 |
}
|
1367 |
}
|
| 1336 |
newItem.setDefaultForEntity(defaultForEntity.getValue());
|
1368 |
newItem.setDefaultForEntity(defaultForEntity.getValue());
|
| 1337 |
newItem.setRisky(risky.getValue());
|
1369 |
newItem.setRisky(risky.getValue());
|
| 1338 |
|
1370 |
|
| 1339 |
try {
|
1371 |
try {
|
| 1340 |
if(!minStockLevel.getText().trim().equals("")) {
|
1372 |
if(!minStockLevel.getText().trim().equals("")) {
|
| 1341 |
long minStock = Long.parseLong(minStockLevel.getText().trim());
|
1373 |
long minStock = Long.parseLong(minStockLevel.getText().trim());
|
| 1342 |
if(minStock < 0) {
|
1374 |
if(minStock < 0) {
|
| 1343 |
throw new NumberFormatException("Negative value of Minimum Stock Level");
|
1375 |
throw new NumberFormatException("Negative value of Minimum Stock Level");
|
| 1344 |
}
|
1376 |
}
|
| 1345 |
newItem.setMinStockLevel(minStock);
|
1377 |
newItem.setMinStockLevel(minStock);
|
| 1346 |
}
|
1378 |
}
|
| 1347 |
} catch(NumberFormatException ex) {
|
1379 |
} catch(NumberFormatException ex) {
|
| 1348 |
Window.alert("Invalid minimum Stock Level format");
|
1380 |
Window.alert("Invalid minimum Stock Level format");
|
| 1349 |
return false;
|
1381 |
return false;
|
| 1350 |
}
|
1382 |
}
|
| 1351 |
|
1383 |
|
| 1352 |
try {
|
1384 |
try {
|
| 1353 |
if(!numOfDaysStock.getText().trim().equals("")) {
|
1385 |
if(!numOfDaysStock.getText().trim().equals("")) {
|
| 1354 |
long numDays = Long.parseLong(numOfDaysStock.getText().trim());
|
1386 |
long numDays = Long.parseLong(numOfDaysStock.getText().trim());
|
| 1355 |
if(numDays < 0) {
|
1387 |
if(numDays < 0) {
|
| 1356 |
throw new NumberFormatException("Negative value of num Of Days ");
|
1388 |
throw new NumberFormatException("Negative value of num Of Days ");
|
| 1357 |
}
|
1389 |
}
|
| 1358 |
newItem.setNumOfDaysStock(new Long(numDays).intValue());
|
1390 |
newItem.setNumOfDaysStock(new Long(numDays).intValue());
|
| 1359 |
}
|
1391 |
}
|
| 1360 |
} catch(NumberFormatException ex) {
|
1392 |
} catch(NumberFormatException ex) {
|
| 1361 |
Window.alert("Invalid number Of Days format");
|
1393 |
Window.alert("Invalid number Of Days format");
|
| 1362 |
return false;
|
1394 |
return false;
|
| 1363 |
}
|
1395 |
}
|
| 1364 |
newItem.setShowSellingPrice(showSellingPrice.getValue());
|
1396 |
newItem.setShowSellingPrice(showSellingPrice.getValue());
|
| 1365 |
newItem.setHoldOverride(holdOverride.getValue());
|
1397 |
newItem.setHoldOverride(holdOverride.getValue());
|
| 1366 |
try {
|
1398 |
try {
|
| 1367 |
String expectedDelayText = expectedDelay.getText().trim();
|
1399 |
String expectedDelayText = expectedDelay.getText().trim();
|
| 1368 |
if(!expectedDelayText.equals("")){
|
1400 |
if(!expectedDelayText.equals("")){
|
| 1369 |
newItem.setExpectedDelay(Integer.parseInt(expectedDelayText));
|
1401 |
newItem.setExpectedDelay(Integer.parseInt(expectedDelayText));
|
| 1370 |
}
|
1402 |
}
|
| 1371 |
} catch(NumberFormatException nfe) {
|
1403 |
} catch(NumberFormatException nfe) {
|
| 1372 |
Window.alert("Invalid expected delay");
|
1404 |
Window.alert("Invalid expected delay");
|
| 1373 |
return false;
|
1405 |
return false;
|
| 1374 |
}
|
1406 |
}
|
| 1375 |
try {
|
1407 |
try {
|
| 1376 |
if(!freebieItemId.getText().trim().equals("")) {
|
1408 |
if(!freebieItemId.getText().trim().equals("")) {
|
| 1377 |
long freeItemId = Long.parseLong(freebieItemId.getText().trim());
|
1409 |
long freeItemId = Long.parseLong(freebieItemId.getText().trim());
|
| 1378 |
if(freeItemId < 0) {
|
1410 |
if(freeItemId < 0) {
|
| 1379 |
throw new NumberFormatException("Negative value of freebieItemId ");
|
1411 |
throw new NumberFormatException("Negative value of freebieItemId ");
|
| 1380 |
}
|
1412 |
}
|
| 1381 |
newItem.setFreebieItemId(new Long(freeItemId));
|
1413 |
newItem.setFreebieItemId(new Long(freeItemId));
|
| 1382 |
}
|
1414 |
}
|
| 1383 |
} catch(NumberFormatException ex) {
|
1415 |
} catch(NumberFormatException ex) {
|
| 1384 |
Window.alert("Invalid freebie ItemId");
|
1416 |
Window.alert("Invalid freebie ItemId");
|
| 1385 |
return false;
|
1417 |
return false;
|
| 1386 |
}
|
1418 |
}
|
| 1387 |
if((item.getPreferredVendor() == null || item.getVendorPricesMap() == null || item.getVendorPricesMap().isEmpty()) && preferredVendor.getSelectedIndex() == 0) {
|
1419 |
if((item.getPreferredVendor() == null || item.getVendorPricesMap() == null || item.getVendorPricesMap().isEmpty()) && preferredVendor.getSelectedIndex() == 0) {
|
| 1388 |
newItem.setPreferredVendor(item.getPreferredVendor());
|
1420 |
newItem.setPreferredVendor(item.getPreferredVendor());
|
| 1389 |
}
|
1421 |
}
|
| 1390 |
else {
|
1422 |
else {
|
| 1391 |
long vendorId = Utils.getVendorId(preferredVendor.getItemText(preferredVendor.getSelectedIndex()));
|
1423 |
long vendorId = Utils.getVendorId(preferredVendor.getItemText(preferredVendor.getSelectedIndex()));
|
| 1392 |
newItem.setPreferredVendor(vendorId);
|
1424 |
newItem.setPreferredVendor(vendorId);
|
| 1393 |
}
|
1425 |
}
|
| 1394 |
newItem.setPreferredInsurer(Long.parseLong(preferredInsurer.getValue(preferredInsurer.getSelectedIndex())));
|
1426 |
newItem.setPreferredInsurer(Long.parseLong(preferredInsurer.getValue(preferredInsurer.getSelectedIndex())));
|
| 1395 |
newItem.setWarehouseStickiness(warehouseStickiness.getValue());
|
1427 |
newItem.setWarehouseStickiness(warehouseStickiness.getValue());
|
| 1396 |
newItem.setHasItemNo(hasItemNo.getValue());
|
1428 |
newItem.setHasItemNo(hasItemNo.getValue());
|
| 1397 |
newItem.setItemType(itemType.getValue());
|
1429 |
newItem.setItemType(itemType.getValue());
|
| 1398 |
newItem.setAsin(asin.getText().trim());
|
1430 |
newItem.setAsin(asin.getText().trim());
|
| 1399 |
try {
|
1431 |
try {
|
| 1400 |
if(!holdInventory.getText().trim().equals("")) {
|
1432 |
if(!holdInventory.getText().trim().equals("")) {
|
| 1401 |
long hold_inventory = Long.parseLong(holdInventory.getText().trim());
|
1433 |
long hold_inventory = Long.parseLong(holdInventory.getText().trim());
|
| 1402 |
if(hold_inventory < 0) {
|
1434 |
if(hold_inventory < 0) {
|
| 1403 |
throw new NumberFormatException("Negative value of Hold Inventory");
|
1435 |
throw new NumberFormatException("Negative value of Hold Inventory");
|
| 1404 |
}
|
1436 |
}
|
| 1405 |
newItem.setHoldInventory(hold_inventory);
|
1437 |
newItem.setHoldInventory(hold_inventory);
|
| 1406 |
}
|
1438 |
}
|
| 1407 |
} catch(NumberFormatException ex) {
|
1439 |
} catch(NumberFormatException ex) {
|
| 1408 |
Window.alert("Invalid Hold Inventory Value");
|
1440 |
Window.alert("Invalid Hold Inventory Value");
|
| 1409 |
return false;
|
1441 |
return false;
|
| 1410 |
}
|
1442 |
}
|
| 1411 |
|
1443 |
|
| 1412 |
try {
|
1444 |
try {
|
| 1413 |
if(!defaultInventory.getText().trim().equals("")) {
|
1445 |
if(!defaultInventory.getText().trim().equals("")) {
|
| 1414 |
long default_inventory = Long.parseLong(defaultInventory.getText().trim());
|
1446 |
long default_inventory = Long.parseLong(defaultInventory.getText().trim());
|
| 1415 |
if(default_inventory < 0) {
|
1447 |
if(default_inventory < 0) {
|
| 1416 |
throw new NumberFormatException("Negative value of Default Inventory");
|
1448 |
throw new NumberFormatException("Negative value of Default Inventory");
|
| 1417 |
}
|
1449 |
}
|
| 1418 |
newItem.setDefaultInventory(default_inventory);
|
1450 |
newItem.setDefaultInventory(default_inventory);
|
| 1419 |
}
|
1451 |
}
|
| 1420 |
} catch(NumberFormatException ex) {
|
1452 |
} catch(NumberFormatException ex) {
|
| 1421 |
Window.alert("Invalid Default Inventory Value");
|
1453 |
Window.alert("Invalid Default Inventory Value");
|
| 1422 |
return false;
|
1454 |
return false;
|
| 1423 |
}
|
1455 |
}
|
| 1424 |
/*Create an instance of VendorPricings for each row in vendor pricing table. Set the vendor prices to the instance.
|
1456 |
/*Create an instance of VendorPricings for each row in vendor pricing table. Set the vendor prices to the instance.
|
| 1425 |
Add the instance to map and set the map to the item instance created above.*/
|
1457 |
Add the instance to map and set the map to the item instance created above.*/
|
| 1426 |
Map<Long, VendorPricings> vendorPrices = new HashMap<Long, VendorPricings>();
|
1458 |
Map<Long, VendorPricings> vendorPrices = new HashMap<Long, VendorPricings>();
|
| 1427 |
VendorPricings v;
|
1459 |
VendorPricings v;
|
| 1428 |
for(int row = 0; row < tableVendorPrices.getRowCount(); row++) {
|
1460 |
for(int row = 0; row < tableVendorPrices.getRowCount(); row++) {
|
| 1429 |
v = new VendorPricings();
|
1461 |
v = new VendorPricings();
|
| 1430 |
v.setMop(Double.parseDouble(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_MOP)));
|
1462 |
v.setMop(Double.parseDouble(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_MOP)));
|
| 1431 |
v.setDealerPrice(Double.parseDouble(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_DP)));
|
1463 |
v.setDealerPrice(Double.parseDouble(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_DP)));
|
| 1432 |
v.setTransferPrice(Double.parseDouble(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_TP)));
|
1464 |
v.setTransferPrice(Double.parseDouble(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_TP)));
|
| 1433 |
v.setNlc(Double.parseDouble(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_NLC)));
|
1465 |
v.setNlc(Double.parseDouble(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_NLC)));
|
| 1434 |
v.setVendorId(Long.parseLong(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_VENDORID)));
|
1466 |
v.setVendorId(Long.parseLong(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_VENDORID)));
|
| 1435 |
vendorPrices.put(v.getVendorId(), v);
|
1467 |
vendorPrices.put(v.getVendorId(), v);
|
| 1436 |
}
|
1468 |
}
|
| 1437 |
newItem.setVendorPricesMap(vendorPrices);
|
1469 |
newItem.setVendorPricesMap(vendorPrices);
|
| 1438 |
newItem.setItemStatusDesc(statusDesc.getText().trim());
|
1470 |
newItem.setItemStatusDesc(statusDesc.getText().trim());
|
| 1439 |
|
1471 |
|
| 1440 |
/*Create an instance of VendorPricings for each row in vendor pricing table. Set the vendor prices to the instance.
|
1472 |
/*Create an instance of VendorPricings for each row in vendor pricing table. Set the vendor prices to the instance.
|
| 1441 |
Add the instance to map and set the map to the item instance created above.*/
|
1473 |
Add the instance to map and set the map to the item instance created above.*/
|
| 1442 |
Map<String, VendorItemMapping> vendorMappings = new HashMap<String, VendorItemMapping>();
|
1474 |
Map<String, VendorItemMapping> vendorMappings = new HashMap<String, VendorItemMapping>();
|
| 1443 |
VendorItemMapping vMapping;
|
1475 |
VendorItemMapping vMapping;
|
| 1444 |
for(int row = 0; row < tableVendorItemKey.getRowCount(); row++) {
|
1476 |
for(int row = 0; row < tableVendorItemKey.getRowCount(); row++) {
|
| 1445 |
vMapping = new VendorItemMapping();
|
1477 |
vMapping = new VendorItemMapping();
|
| 1446 |
vMapping.setItemKey(tableVendorItemKey.getText(row, TABLE_INDEX_MAPPING_ITEM_KEY));
|
1478 |
vMapping.setItemKey(tableVendorItemKey.getText(row, TABLE_INDEX_MAPPING_ITEM_KEY));
|
| 1447 |
vMapping.setVendorId(Long.parseLong(tableVendorItemKey.getText(row, TABLE_INDEX_MAPPING_VENDORID)));
|
1479 |
vMapping.setVendorId(Long.parseLong(tableVendorItemKey.getText(row, TABLE_INDEX_MAPPING_VENDORID)));
|
| 1448 |
vendorMappings.put(vMapping.getVendorId() + Item.KEY_SEPARATOR + tableVendorItemKey.getText(row, TABLE_INDEX_MAPPING_ITEM_KEY_OLD), vMapping);
|
1480 |
vendorMappings.put(vMapping.getVendorId() + Item.KEY_SEPARATOR + tableVendorItemKey.getText(row, TABLE_INDEX_MAPPING_ITEM_KEY_OLD), vMapping);
|
| 1449 |
}
|
1481 |
}
|
| 1450 |
newItem.setVendorKeysMap(vendorMappings);
|
1482 |
newItem.setVendorKeysMap(vendorMappings);
|
| 1451 |
|
1483 |
|
| 1452 |
/*Create an instance of SourcePricings for each row in source pricing table. Set the source prices to the instance.
|
1484 |
/*Create an instance of SourcePricings for each row in source pricing table. Set the source prices to the instance.
|
| 1453 |
Add the instance to map and set the map to the item instance created above.*/
|
1485 |
Add the instance to map and set the map to the item instance created above.*/
|
| 1454 |
Map<Long, SourcePricings> sourcePrices = new HashMap<Long, SourcePricings>();
|
1486 |
Map<Long, SourcePricings> sourcePrices = new HashMap<Long, SourcePricings>();
|
| 1455 |
SourcePricings s;
|
1487 |
SourcePricings s;
|
| 1456 |
for(int row = 0; row < tableSourcePrices.getRowCount(); row++) {
|
1488 |
for(int row = 0; row < tableSourcePrices.getRowCount(); row++) {
|
| 1457 |
s = new SourcePricings();
|
1489 |
s = new SourcePricings();
|
| 1458 |
s.setMrp(Double.parseDouble(tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_MRP)));
|
1490 |
s.setMrp(Double.parseDouble(tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_MRP)));
|
| 1459 |
s.setSellingPrice(Double.parseDouble(tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE)));
|
1491 |
s.setSellingPrice(Double.parseDouble(tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE)));
|
| 1460 |
s.setSourceId(Long.parseLong(tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID)));
|
1492 |
s.setSourceId(Long.parseLong(tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID)));
|
| 1461 |
sourcePrices.put(s.getSourceId(), s);
|
1493 |
sourcePrices.put(s.getSourceId(), s);
|
| 1462 |
}
|
1494 |
}
|
| 1463 |
newItem.setSourcePricesMap(sourcePrices);
|
1495 |
newItem.setSourcePricesMap(sourcePrices);
|
| 1464 |
|
- |
|
| 1465 |
newItem.setContentCategoryId(item.getContentCategoryId());
|
- |
|
| 1466 |
newItem.setFeatureId(item.getFeatureId());
|
- |
|
| 1467 |
newItem.setFeatureDescription(item.getFeatureDescription());
|
- |
|
| 1468 |
newItem.setAddedOn(item.getAddedOn());
|
- |
|
| 1469 |
newItem.setRetireDate(item.getRetireDate());
|
- |
|
| 1470 |
newItem.setUpdatedOn(item.getUpdatedOn());
|
- |
|
| 1471 |
newItem.setItemStatus(item.getItemStatus());
|
- |
|
| 1472 |
newItem.setItemInventory(item.getItemInventory());
|
- |
|
| 1473 |
newItem.setSimilarItems(item.getSimilarItems());
|
- |
|
| 1474 |
newItem.setVouchersMap(item.getVouchersMap());
|
- |
|
| 1475 |
|
- |
|
| 1476 |
return true;
|
- |
|
| 1477 |
}
|
- |
|
| 1478 |
|
- |
|
| 1479 |
/**
|
- |
|
| 1480 |
* This method is called when Edit button is clicked corresponding to a row in
|
- |
|
| 1481 |
* vendor prices table. It will pop up a form to edit the vendor prices.
|
- |
|
| 1482 |
* @param vendorId
|
- |
|
| 1483 |
* @param row
|
- |
|
| 1484 |
*/
|
- |
|
| 1485 |
private void editVendorPrices(final long vendorId, final int row) {
|
- |
|
| 1486 |
String mop = tableVendorPrices.getText(row, TABLE_INDEX_PRICING_MOP);
|
- |
|
| 1487 |
String dp = tableVendorPrices.getText(row, TABLE_INDEX_PRICING_DP);
|
- |
|
| 1488 |
String tp = tableVendorPrices.getText(row, TABLE_INDEX_PRICING_TP);
|
- |
|
| 1489 |
String nlc = tableVendorPrices.getText(row, TABLE_INDEX_PRICING_NLC);
|
- |
|
| 1490 |
VendorPricesDialog pricesDialog = new VendorPricesDialog(mop, dp, tp, nlc);
|
- |
|
| 1491 |
pricesDialog.updateButton.setText("Update");
|
- |
|
| 1492 |
pricesDialog.setVendorPriceUpdateListener(new VendorPricesDialog.VendorPriceUpdateListener() {
|
- |
|
| 1493 |
@Override
|
- |
|
| 1494 |
public boolean onUpdate(double mop, double dp, double tp, double nlc, long vendorId) {
|
- |
|
| 1495 |
if(!validateVendorPrices(mop, dp, tp, nlc)) {
|
- |
|
| 1496 |
return false;
|
- |
|
| 1497 |
}
|
- |
|
| 1498 |
tableVendorPrices.setText(row, TABLE_INDEX_PRICING_MOP, mop + "");
|
- |
|
| 1499 |
tableVendorPrices.setText(row, TABLE_INDEX_PRICING_DP, dp + "");
|
- |
|
| 1500 |
tableVendorPrices.setText(row, TABLE_INDEX_PRICING_TP, tp + "");
|
- |
|
| 1501 |
tableVendorPrices.setText(row, TABLE_INDEX_PRICING_NLC, nlc + "");
|
- |
|
| 1502 |
return true;
|
- |
|
| 1503 |
}
|
- |
|
| 1504 |
});
|
- |
|
| 1505 |
pricesDialog.show();
|
- |
|
| 1506 |
}
|
- |
|
| 1507 |
|
- |
|
| 1508 |
/**
|
- |
|
| 1509 |
* This method is called when Edit button is clicked corresponding to a row in
|
- |
|
| 1510 |
* vendor prices table. It will pop up a form to edit the vendor prices.
|
- |
|
| 1511 |
* @param vendorId
|
- |
|
| 1512 |
* @param row
|
- |
|
| 1513 |
*/
|
- |
|
| 1514 |
private void editSourcePrices(final long sourceId, final int row) {
|
- |
|
| 1515 |
String mrp = tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_MRP);
|
- |
|
| 1516 |
String sellingPrice = tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE);
|
- |
|
| 1517 |
SourcePricesDialog pricesDialog = new SourcePricesDialog(mrp, sellingPrice);
|
- |
|
| 1518 |
pricesDialog.updateButton.setText("Update");
|
- |
|
| 1519 |
pricesDialog.setSourcePriceUpdateListener(new SourcePricesDialog.SourcePriceUpdateListener() {
|
- |
|
| 1520 |
@Override
|
- |
|
| 1521 |
public boolean onUpdate(double mrp, double sellingPrice, long sourceId) {
|
- |
|
| 1522 |
if(!validateSourcePrices(mrp, sellingPrice)) {
|
- |
|
| 1523 |
return false;
|
- |
|
| 1524 |
}
|
- |
|
| 1525 |
tableSourcePrices.setText(row, TABLE_INDEX_SOURCE_PRICING_MRP, mrp + "");
|
- |
|
| 1526 |
tableSourcePrices.setText(row, TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE, sellingPrice + "");
|
- |
|
| 1527 |
return true;
|
- |
|
| 1528 |
}
|
- |
|
| 1529 |
});
|
- |
|
| 1530 |
pricesDialog.show();
|
- |
|
| 1531 |
}
|
- |
|
| 1532 |
|
- |
|
| 1533 |
|
- |
|
| 1534 |
/**
|
- |
|
| 1535 |
* This method is called when Edit button is clicked corresponding to a row in
|
- |
|
| 1536 |
* vendor item key table. It will pop up a form to edit the item key.
|
- |
|
| 1537 |
* @param vendorId
|
- |
|
| 1538 |
* @param row
|
- |
|
| 1539 |
*/
|
- |
|
| 1540 |
private void editVendorKey(final long vendorId, final int row) {
|
- |
|
| 1541 |
String key = tableVendorItemKey.getText(row, TABLE_INDEX_MAPPING_ITEM_KEY);
|
- |
|
| 1542 |
VendorMappingDialog mappingDialog = new VendorMappingDialog(productGroup.getText().trim(), brand.getText().trim(),
|
- |
|
| 1543 |
modelNumber.getText().trim(), color.getText().trim(), key);
|
- |
|
| 1544 |
mappingDialog.updateButton.setText("Update");
|
- |
|
| 1545 |
mappingDialog.setVendorMappingUpdateListener(new VendorMappingDialog.VendorMappingUpdateListener() {
|
- |
|
| 1546 |
@Override
|
- |
|
| 1547 |
public boolean onUpdate(String itemKey, long vendorId) {
|
- |
|
| 1548 |
if(itemKey == null || itemKey.equals("")) {
|
- |
|
| 1549 |
Window.alert("Item key cannot be empty.");
|
- |
|
| 1550 |
return false;
|
- |
|
| 1551 |
}
|
- |
|
| 1552 |
tableVendorItemKey.setText(row, TABLE_INDEX_MAPPING_ITEM_KEY, itemKey);
|
- |
|
| 1553 |
return true;
|
- |
|
| 1554 |
}
|
- |
|
| 1555 |
});
|
- |
|
| 1556 |
mappingDialog.show();
|
- |
|
| 1557 |
}
|
- |
|
| 1558 |
|
1496 |
|
| 1559 |
/**
|
1497 |
newItem.setContentCategoryId(item.getContentCategoryId());
|
| 1560 |
* This method compares all the editable UI fields values with attributes in the item object.
|
1498 |
newItem.setFeatureId(item.getFeatureId());
|
| 1561 |
* If they differ, the attribute name is appended to a string.
|
1499 |
newItem.setFeatureDescription(item.getFeatureDescription());
|
| 1562 |
* @return String showing attributes which are changed by the user for confirmation.
|
1500 |
newItem.setAddedOn(item.getAddedOn());
|
| 1563 |
* <br>Empty string if nothing is changed.
|
1501 |
newItem.setRetireDate(item.getRetireDate());
|
| 1564 |
*/
|
1502 |
newItem.setUpdatedOn(item.getUpdatedOn());
|
| 1565 |
private String isItemChanged() {
|
1503 |
newItem.setItemStatus(item.getItemStatus());
|
| 1566 |
StringBuilder sb = new StringBuilder("");
|
1504 |
newItem.setItemInventory(item.getItemInventory());
|
| 1567 |
mandatoryChangedValMap = new HashMap<String, Object>();
|
1505 |
newItem.setSimilarItems(item.getSimilarItems());
|
| 1568 |
optionalChangedValMap = new HashMap<String, Object>();
|
1506 |
newItem.setVouchersMap(item.getVouchersMap());
|
| 1569 |
if(!checkParameterIfEqual(brand.getText().trim(), item.getBrand())) {
|
1507 |
|
| 1570 |
mandatoryChangedValMap.put(MANDATORY_BRAND, brand.getText().trim());
|
1508 |
return true;
|
| 1571 |
sb.append("\n-Brand");
|
1509 |
}
|
| 1572 |
}
|
1510 |
|
| 1573 |
if(!checkParameterIfEqual(modelNumber.getText().trim(), item.getModelNumber())) {
|
1511 |
/**
|
| 1574 |
mandatoryChangedValMap.put(MANDATORY_MODEL_NO, modelNumber.getText().trim());
|
1512 |
* This method is called when Edit button is clicked corresponding to a row in
|
| 1575 |
sb.append("\n-Model Number");
|
1513 |
* vendor prices table. It will pop up a form to edit the vendor prices.
|
| 1576 |
}
|
1514 |
* @param vendorId
|
| 1577 |
if(!checkParameterIfEqual(modelName.getText().trim(), item.getModelName())) {
|
1515 |
* @param row
|
| 1578 |
mandatoryChangedValMap.put(MANDATORY_MODEL_NAME, modelName.getText().trim());
|
1516 |
*/
|
| 1579 |
sb.append("\n-Model Name");
|
1517 |
private void editVendorPrices(final long vendorId, final int row) {
|
| 1580 |
}
|
1518 |
String mop = tableVendorPrices.getText(row, TABLE_INDEX_PRICING_MOP);
|
| 1581 |
if(!checkParameterIfEqual(color.getText().trim(), item.getColor())) {
|
1519 |
String dp = tableVendorPrices.getText(row, TABLE_INDEX_PRICING_DP);
|
| 1582 |
sb.append("\n-Color");
|
1520 |
String tp = tableVendorPrices.getText(row, TABLE_INDEX_PRICING_TP);
|
| 1583 |
}
|
1521 |
String nlc = tableVendorPrices.getText(row, TABLE_INDEX_PRICING_NLC);
|
| 1584 |
if(!checkParameterIfEqual(statusDesc.getText().trim(), item.getItemStatusDesc())) {
|
1522 |
VendorPricesDialog pricesDialog = new VendorPricesDialog(mop, dp, tp, nlc);
|
| 1585 |
sb.append("\n-Status Description");
|
1523 |
pricesDialog.updateButton.setText("Update");
|
| 1586 |
}
|
1524 |
pricesDialog.setVendorPriceUpdateListener(new VendorPricesDialog.VendorPriceUpdateListener() {
|
| 1587 |
if(!checkParameterIfEqual(comments.getText().trim(), item.getComments())) {
|
1525 |
@Override
|
| 1588 |
sb.append("\n-Comments");
|
1526 |
public boolean onUpdate(double mop, double dp, double tp, double nlc, long vendorId) {
|
| 1589 |
}
|
1527 |
if(!validateVendorPrices(mop, dp, tp, nlc)) {
|
| 1590 |
if(!checkParameterIfEqual(newItem.getMrp(), item.getMrp())) {
|
1528 |
return false;
|
| 1591 |
mandatoryChangedValMap.put(MANDATORY_MRP, newItem.getMrp());
|
1529 |
}
|
| 1592 |
sb.append("\n-MRP");
|
1530 |
tableVendorPrices.setText(row, TABLE_INDEX_PRICING_MOP, mop + "");
|
| 1593 |
}
|
1531 |
tableVendorPrices.setText(row, TABLE_INDEX_PRICING_DP, dp + "");
|
| 1594 |
if(!checkParameterIfEqual(newItem.getSellingPrice(), item.getSellingPrice())) {
|
1532 |
tableVendorPrices.setText(row, TABLE_INDEX_PRICING_TP, tp + "");
|
| 1595 |
optionalChangedValMap.put(OPTIONAL_SELLING_PRICE, newItem.getSellingPrice());
|
1533 |
tableVendorPrices.setText(row, TABLE_INDEX_PRICING_NLC, nlc + "");
|
| 1596 |
sb.append("\n-Selling Price");
|
1534 |
return true;
|
| 1597 |
}
|
1535 |
}
|
| 1598 |
if(!checkParameterIfEqual(newItem.getWeight(), item.getWeight())) {
|
1536 |
});
|
| 1599 |
mandatoryChangedValMap.put(MANDATORY_WEIGHT, newItem.getWeight());
|
1537 |
pricesDialog.show();
|
| 1600 |
sb.append("\n-Weight");
|
1538 |
}
|
| 1601 |
}
|
1539 |
|
| 1602 |
if(!checkParameterIfEqual(bestDealsText.getText().trim(), item.getBestDealsText())) {
|
1540 |
/**
|
| 1603 |
mandatoryChangedValMap.put(MANDATORY_BEST_DEAL_TEXT, bestDealsText.getText().trim());
|
1541 |
* This method is called when Edit button is clicked corresponding to a row in
|
| 1604 |
sb.append("\n-Best Deal Text");
|
1542 |
* vendor prices table. It will pop up a form to edit the vendor prices.
|
| 1605 |
}
|
1543 |
* @param vendorId
|
| 1606 |
if(!checkParameterIfEqual(bestDealsDetailsText.getText().trim(), item.getBestDealsDetailsText())) {
|
1544 |
* @param row
|
| 1607 |
mandatoryChangedValMap.put(MANDATORY_BEST_DEAL_DETAIL_TEXT, bestDealsDetailsText.getText().trim());
|
1545 |
*/
|
| 1608 |
sb.append("\n-Best Deal Detail Text");
|
1546 |
private void editSourcePrices(final long sourceId, final int row) {
|
| 1609 |
}
|
1547 |
String mrp = tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_MRP);
|
| 1610 |
if(!checkParameterIfEqual(bestDealsDetailsLink.getText().trim(), item.getBestDealsDetailsLink())) {
|
1548 |
String sellingPrice = tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE);
|
| 1611 |
mandatoryChangedValMap.put(MANDATORY_BEST_DEAL_DETAIL_LINK, bestDealsDetailsLink.getText().trim());
|
1549 |
SourcePricesDialog pricesDialog = new SourcePricesDialog(mrp, sellingPrice);
|
| 1612 |
sb.append("\n-Best Deal Detail Link");
|
1550 |
pricesDialog.updateButton.setText("Update");
|
| 1613 |
}
|
1551 |
pricesDialog.setSourcePriceUpdateListener(new SourcePricesDialog.SourcePriceUpdateListener() {
|
| 1614 |
if(!checkParameterIfEqual(newItem.getBestDealsValue(), item.getBestDealsValue())) {
|
1552 |
@Override
|
| 1615 |
sb.append("\n-Best Deal Value");
|
1553 |
public boolean onUpdate(double mrp, double sellingPrice, long sourceId) {
|
| 1616 |
}
|
1554 |
if(!validateSourcePrices(mrp, sellingPrice)) {
|
| 1617 |
if(!checkParameterIfEqual(newItem.getBestSellingRank(), item.getBestSellingRank())) {
|
1555 |
return false;
|
| 1618 |
sb.append("\n-Best Selling Rank");
|
1556 |
}
|
| 1619 |
}
|
1557 |
tableSourcePrices.setText(row, TABLE_INDEX_SOURCE_PRICING_MRP, mrp + "");
|
| 1620 |
if(!checkParameterIfEqual(newItem.getMinStockLevel(), item.getMinStockLevel())) {
|
1558 |
tableSourcePrices.setText(row, TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE, sellingPrice + "");
|
| 1621 |
sb.append("\n-Min Stock Level");
|
1559 |
return true;
|
| 1622 |
}
|
1560 |
}
|
| 1623 |
if(!checkParameterIfEqual(newItem.getNumOfDaysStock(), item.getNumOfDaysStock())) {
|
1561 |
});
|
| 1624 |
sb.append("\n-Number Of Days Of Stock");
|
1562 |
pricesDialog.show();
|
| 1625 |
}
|
1563 |
}
|
| 1626 |
if(item.isDefaultForEntity() != defaultForEntity.getValue()) {
|
1564 |
|
| 1627 |
sb.append("\n-Default For Entity Flag");
|
1565 |
|
| 1628 |
}
|
1566 |
/**
|
| 1629 |
if(item.isRisky() != risky.getValue()) {
|
1567 |
* This method is called when Edit button is clicked corresponding to a row in
|
| 1630 |
sb.append("\n-Risky Flag");
|
1568 |
* vendor item key table. It will pop up a form to edit the item key.
|
| 1631 |
}
|
1569 |
* @param vendorId
|
| 1632 |
if(!checkParameterIfEqual(newItem.getStartDate(), item.getStartDate())) {
|
1570 |
* @param row
|
| 1633 |
sb.append("\n-Start Date");
|
1571 |
*/
|
| 1634 |
}
|
1572 |
private void editVendorKey(final long vendorId, final int row) {
|
| 1635 |
if(!checkParameterIfEqual(newItem.getExpectedArrivalDate(), item.getExpectedArrivalDate())) {
|
1573 |
String key = tableVendorItemKey.getText(row, TABLE_INDEX_MAPPING_ITEM_KEY);
|
| 1636 |
sb.append("\n-Expected Arrival Date");
|
1574 |
VendorMappingDialog mappingDialog = new VendorMappingDialog(productGroup.getText().trim(), brand.getText().trim(),
|
| 1637 |
}
|
1575 |
modelNumber.getText().trim(), color.getText().trim(), key);
|
| 1638 |
if(!checkParameterIfEqual(newItem.getComingSoonStartDate(), item.getComingSoonStartDate())) {
|
1576 |
mappingDialog.updateButton.setText("Update");
|
| 1639 |
sb.append("\n-Coming Soon Start Date");
|
1577 |
mappingDialog.setVendorMappingUpdateListener(new VendorMappingDialog.VendorMappingUpdateListener() {
|
| 1640 |
}
|
1578 |
@Override
|
| 1641 |
if(!checkParameterIfEqual(newItem.getExpectedDelay(), item.getExpectedDelay())) {
|
1579 |
public boolean onUpdate(String itemKey, long vendorId) {
|
| 1642 |
sb.append("\n-Expected Delay");
|
1580 |
if(itemKey == null || itemKey.equals("")) {
|
| 1643 |
}
|
1581 |
Window.alert("Item key cannot be empty.");
|
| 1644 |
if(item.isWarehouseStickiness() != warehouseStickiness.getValue()) {
|
1582 |
return false;
|
| 1645 |
sb.append("\n-Warehouse Stickiness Flag");
|
1583 |
}
|
| 1646 |
}
|
1584 |
tableVendorItemKey.setText(row, TABLE_INDEX_MAPPING_ITEM_KEY, itemKey);
|
| 1647 |
if(!checkParameterIfEqual(newItem.getPreferredVendor(), item.getPreferredVendor())) {
|
1585 |
return true;
|
| 1648 |
optionalChangedValMap.put(OPTIONAL_PREFERRED_VENDOR, newItem.getPreferredVendor());
|
1586 |
}
|
| 1649 |
sb.append("\n-Preferred Vendor");
|
1587 |
});
|
| 1650 |
}
|
1588 |
mappingDialog.show();
|
| 1651 |
if(!checkParameterIfEqual(newItem.getPreferredInsurer(), item.getPreferredInsurer())) {
|
1589 |
}
|
| 1652 |
optionalChangedValMap.put(OPTIONAL_PREFERRED_INSURER, newItem.getPreferredInsurer());
|
1590 |
|
| 1653 |
sb.append("\n-Preferred Insurer");
|
1591 |
/**
|
| 1654 |
}
|
1592 |
* This method compares all the editable UI fields values with attributes in the item object.
|
| 1655 |
if(item.isHasItemNo() != hasItemNo.getValue()) {
|
1593 |
* If they differ, the attribute name is appended to a string.
|
| 1656 |
sb.append("\n-Has Item Number Flag");
|
1594 |
* @return String showing attributes which are changed by the user for confirmation.
|
| 1657 |
}
|
1595 |
* <br>Empty string if nothing is changed.
|
| 1658 |
if(item.isItemType() != itemType.getValue()) {
|
1596 |
*/
|
| 1659 |
sb.append("\n-Has Serial Number Flag");
|
1597 |
private String isItemChanged() {
|
| 1660 |
}
|
1598 |
StringBuilder sb = new StringBuilder("");
|
| 1661 |
if(item.isShowSellingPrice() != showSellingPrice.getValue()) {
|
1599 |
mandatoryChangedValMap = new HashMap<String, Object>();
|
| 1662 |
sb.append("\n-Coming Soon item pricing marked");
|
1600 |
optionalChangedValMap = new HashMap<String, Object>();
|
| 1663 |
}
|
1601 |
if(!checkParameterIfEqual(brand.getText().trim(), item.getBrand())) {
|
| 1664 |
if(item.isHoldOverride() != holdOverride.getValue()) {
|
1602 |
mandatoryChangedValMap.put(MANDATORY_BRAND, brand.getText().trim());
|
| 1665 |
sb.append("\n-Hold Override is marked");
|
1603 |
sb.append("\n-Brand");
|
| 1666 |
}
|
1604 |
}
|
| 1667 |
if(!checkParameterIfEqual(newItem.getFreebieItemId(), item.getFreebieItemId())) {
|
1605 |
if(!checkParameterIfEqual(modelNumber.getText().trim(), item.getModelNumber())) {
|
| 1668 |
optionalChangedValMap.put(OPTIONAL_FREEBIE_ITEM_ID, freebieItemId.getText().trim());
|
1606 |
mandatoryChangedValMap.put(MANDATORY_MODEL_NO, modelNumber.getText().trim());
|
| 1669 |
sb.append("\n-Freebie Item Id");
|
1607 |
sb.append("\n-Model Number");
|
| 1670 |
}
|
1608 |
}
|
| 1671 |
if(!checkParameterIfEqual(asin.getText().trim(), item.getAsin())) {
|
1609 |
if(!checkParameterIfEqual(modelName.getText().trim(), item.getModelName())) {
|
| 1672 |
sb.append("\n-Asin");
|
1610 |
mandatoryChangedValMap.put(MANDATORY_MODEL_NAME, modelName.getText().trim());
|
| 1673 |
}
|
1611 |
sb.append("\n-Model Name");
|
| 1674 |
if(!checkParameterIfEqual(newItem.getHoldInventory(), item.getHoldInventory())) {
|
1612 |
}
|
| 1675 |
sb.append("\n-Hold Inventory");
|
1613 |
if(!checkParameterIfEqual(color.getText().trim(), item.getColor())) {
|
| 1676 |
}
|
1614 |
sb.append("\n-Color");
|
| 1677 |
if(!checkParameterIfEqual(newItem.getDefaultInventory(), item.getDefaultInventory())) {
|
1615 |
}
|
| 1678 |
sb.append("\n-Default Inventory");
|
1616 |
if(!checkParameterIfEqual(statusDesc.getText().trim(), item.getItemStatusDesc())) {
|
| 1679 |
}
|
1617 |
sb.append("\n-Status Description");
|
| 1680 |
VendorPricings vendorPricings;
|
1618 |
}
|
| 1681 |
long vendorId;
|
1619 |
if(!checkParameterIfEqual(comments.getText().trim(), item.getComments())) {
|
| 1682 |
boolean vendorPricingsChanged = false;
|
1620 |
sb.append("\n-Comments");
|
| 1683 |
for(int row = 0; row < tableVendorPrices.getRowCount(); row++) {
|
1621 |
}
|
| 1684 |
vendorId = Long.parseLong(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_VENDORID));
|
1622 |
if(!checkParameterIfEqual(newItem.getMrp(), item.getMrp())) {
|
| 1685 |
vendorPricings = item.getVendorPricesMap().get(vendorId);
|
1623 |
mandatoryChangedValMap.put(MANDATORY_MRP, newItem.getMrp());
|
| 1686 |
if(vendorPricings == null) {
|
1624 |
sb.append("\n-MRP");
|
| 1687 |
sb.append("\n-Vendor Prices (Vendor:" + vendorId + ")");
|
1625 |
}
|
| 1688 |
vendorPricingsChanged = true;
|
1626 |
if(!checkParameterIfEqual(newItem.getSellingPrice(), item.getSellingPrice())) {
|
| 1689 |
continue;
|
1627 |
optionalChangedValMap.put(OPTIONAL_SELLING_PRICE, newItem.getSellingPrice());
|
| 1690 |
}
|
1628 |
sb.append("\n-Selling Price");
|
| 1691 |
if(vendorPricings.getMop() != Double.parseDouble(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_MOP))) {
|
1629 |
}
|
| 1692 |
vendorPricingsChanged = true;
|
1630 |
if(!checkParameterIfEqual(newItem.getWeight(), item.getWeight())) {
|
| 1693 |
sb.append("\n-MOP (Vendor:" + vendorId + ")");
|
1631 |
mandatoryChangedValMap.put(MANDATORY_WEIGHT, newItem.getWeight());
|
| 1694 |
}
|
1632 |
sb.append("\n-Weight");
|
| 1695 |
if(vendorPricings.getDealerPrice() != Double.parseDouble(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_DP))) {
|
1633 |
}
|
| 1696 |
vendorPricingsChanged = true;
|
1634 |
if(!checkParameterIfEqual(bestDealsText.getText().trim(), item.getBestDealsText())) {
|
| 1697 |
sb.append("\n-Dealer Price (Vendor:" + vendorId + ")");
|
1635 |
mandatoryChangedValMap.put(MANDATORY_BEST_DEAL_TEXT, bestDealsText.getText().trim());
|
| 1698 |
}
|
1636 |
sb.append("\n-Best Deal Text");
|
| 1699 |
if(vendorPricings.getTransferPrice() != Double.parseDouble(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_TP))) {
|
1637 |
}
|
| 1700 |
vendorPricingsChanged = true;
|
1638 |
if(!checkParameterIfEqual(bestDealsDetailsText.getText().trim(), item.getBestDealsDetailsText())) {
|
| 1701 |
}
|
1639 |
mandatoryChangedValMap.put(MANDATORY_BEST_DEAL_DETAIL_TEXT, bestDealsDetailsText.getText().trim());
|
| 1702 |
if(vendorPricings.getNlc() != Double.parseDouble(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_NLC))) {
|
1640 |
sb.append("\n-Best Deal Detail Text");
|
| 1703 |
vendorPricingsChanged = true;
|
1641 |
}
|
| 1704 |
}
|
1642 |
if(!checkParameterIfEqual(bestDealsDetailsLink.getText().trim(), item.getBestDealsDetailsLink())) {
|
| 1705 |
}
|
1643 |
mandatoryChangedValMap.put(MANDATORY_BEST_DEAL_DETAIL_LINK, bestDealsDetailsLink.getText().trim());
|
| 1706 |
if(vendorPricingsChanged){
|
1644 |
sb.append("\n-Best Deal Detail Link");
|
| 1707 |
sb.append("\n-Vendor Pricing");
|
1645 |
}
|
| 1708 |
optionalChangedValMap.put(OPTIONAL_VENDOR_PRICING, newItem.getVendorPricesMap());
|
1646 |
if(!checkParameterIfEqual(newItem.getBestDealsValue(), item.getBestDealsValue())) {
|
| 1709 |
}
|
1647 |
sb.append("\n-Best Deal Value");
|
| 1710 |
|
1648 |
}
|
| 1711 |
SourcePricings sourcePricings;
|
1649 |
if(!checkParameterIfEqual(newItem.getBestSellingRank(), item.getBestSellingRank())) {
|
| 1712 |
boolean sourcePricingsChanged = false;
|
1650 |
sb.append("\n-Best Selling Rank");
|
| 1713 |
long sourceId;
|
1651 |
}
|
| 1714 |
for(int row = 0; row < tableSourcePrices.getRowCount(); row++) {
|
1652 |
if(!checkParameterIfEqual(newItem.getMinStockLevel(), item.getMinStockLevel())) {
|
| 1715 |
sourceId = Long.parseLong(tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID));
|
1653 |
sb.append("\n-Min Stock Level");
|
| 1716 |
sourcePricings = item.getSourcePricesMap().get(sourceId);
|
1654 |
}
|
| 1717 |
if(sourcePricings == null) {
|
1655 |
if(!checkParameterIfEqual(newItem.getNumOfDaysStock(), item.getNumOfDaysStock())) {
|
| 1718 |
sourcePricingsChanged = true;
|
1656 |
sb.append("\n-Number Of Days Of Stock");
|
| 1719 |
sb.append("\n-Source Prices (Source:" + sourceId + ")");
|
1657 |
}
|
| 1720 |
continue;
|
1658 |
if(item.isDefaultForEntity() != defaultForEntity.getValue()) {
|
| 1721 |
}
|
1659 |
sb.append("\n-Default For Entity Flag");
|
| 1722 |
if(sourcePricings.getMrp() != Double.parseDouble(tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_MRP))) {
|
1660 |
}
|
| 1723 |
sourcePricingsChanged = true;
|
1661 |
if(item.isRisky() != risky.getValue()) {
|
| 1724 |
sb.append("\n-MRP (Source:" + sourceId + ")");
|
1662 |
sb.append("\n-Risky Flag");
|
| 1725 |
}
|
1663 |
}
|
| 1726 |
if(sourcePricings.getSellingPrice() != Double.parseDouble(tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE))) {
|
1664 |
if(!checkParameterIfEqual(newItem.getStartDate(), item.getStartDate())) {
|
| 1727 |
sourcePricingsChanged = true;
|
1665 |
sb.append("\n-Start Date");
|
| 1728 |
sb.append("\n-Selling Price (Source:" + sourceId + ")");
|
1666 |
}
|
| 1729 |
}
|
1667 |
if(!checkParameterIfEqual(newItem.getExpectedArrivalDate(), item.getExpectedArrivalDate())) {
|
| 1730 |
}
|
1668 |
sb.append("\n-Expected Arrival Date");
|
| 1731 |
if(sourcePricingsChanged){
|
1669 |
}
|
| 1732 |
sb.append("\n-Source Pricing");
|
1670 |
if(!checkParameterIfEqual(newItem.getComingSoonStartDate(), item.getComingSoonStartDate())) {
|
| 1733 |
optionalChangedValMap.put(OPTIONAL_SOURCE_PRICING, newItem.getSourcePricesMap());
|
1671 |
sb.append("\n-Coming Soon Start Date");
|
| 1734 |
}
|
1672 |
}
|
| 1735 |
|
1673 |
if(!checkParameterIfEqual(newItem.getExpectedDelay(), item.getExpectedDelay())) {
|
| 1736 |
|
1674 |
sb.append("\n-Expected Delay");
|
| 1737 |
VendorItemMapping mapping;
|
1675 |
}
|
| 1738 |
String old_key, new_key;
|
1676 |
if(item.isWarehouseStickiness() != warehouseStickiness.getValue()) {
|
| 1739 |
for(int row = 0; row < tableVendorItemKey.getRowCount(); row++) {
|
1677 |
sb.append("\n-Warehouse Stickiness Flag");
|
| 1740 |
vendorId = Long.parseLong(tableVendorItemKey.getText(row, TABLE_INDEX_MAPPING_VENDORID));
|
1678 |
}
|
| 1741 |
old_key = tableVendorItemKey.getText(row, TABLE_INDEX_MAPPING_ITEM_KEY_OLD);
|
1679 |
if(!checkParameterIfEqual(newItem.getPreferredVendor(), item.getPreferredVendor())) {
|
| 1742 |
new_key = tableVendorItemKey.getText(row, TABLE_INDEX_MAPPING_ITEM_KEY);
|
1680 |
optionalChangedValMap.put(OPTIONAL_PREFERRED_VENDOR, newItem.getPreferredVendor());
|
| 1743 |
mapping = item.getVendorKeysMap().get(vendorId + Item.KEY_SEPARATOR + old_key);
|
1681 |
sb.append("\n-Preferred Vendor");
|
| 1744 |
if(mapping == null || !old_key.equals(new_key)) {
|
1682 |
}
|
| 1745 |
sb.append("\n-Vendor Key (Vendor:" + vendorId + ",Key: = " + old_key + ")");
|
1683 |
if(!checkParameterIfEqual(newItem.getPreferredInsurer(), item.getPreferredInsurer())) {
|
| 1746 |
continue;
|
1684 |
optionalChangedValMap.put(OPTIONAL_PREFERRED_INSURER, newItem.getPreferredInsurer());
|
| 1747 |
}
|
1685 |
sb.append("\n-Preferred Insurer");
|
| 1748 |
}
|
1686 |
}
|
| 1749 |
return sb.toString();
|
1687 |
if(item.isHasItemNo() != hasItemNo.getValue()) {
|
| 1750 |
}
|
1688 |
sb.append("\n-Has Item Number Flag");
|
| 1751 |
|
1689 |
}
|
| 1752 |
@SuppressWarnings("unused")
|
1690 |
if(item.isItemType() != itemType.getValue()) {
|
| - |
|
1691 |
sb.append("\n-Has Serial Number Flag");
|
| - |
|
1692 |
}
|
| - |
|
1693 |
if(item.isShowSellingPrice() != showSellingPrice.getValue()) {
|
| - |
|
1694 |
sb.append("\n-Coming Soon item pricing marked");
|
| - |
|
1695 |
}
|
| - |
|
1696 |
if(item.isHoldOverride() != holdOverride.getValue()) {
|
| - |
|
1697 |
sb.append("\n-Hold Override is marked");
|
| - |
|
1698 |
}
|
| - |
|
1699 |
if(!checkParameterIfEqual(newItem.getFreebieItemId(), item.getFreebieItemId())) {
|
| - |
|
1700 |
optionalChangedValMap.put(OPTIONAL_FREEBIE_ITEM_ID, freebieItemId.getText().trim());
|
| - |
|
1701 |
sb.append("\n-Freebie Item Id");
|
| - |
|
1702 |
}
|
| - |
|
1703 |
if(!checkParameterIfEqual(asin.getText().trim(), item.getAsin())) {
|
| - |
|
1704 |
sb.append("\n-Asin");
|
| - |
|
1705 |
}
|
| - |
|
1706 |
if(!checkParameterIfEqual(newItem.getHoldInventory(), item.getHoldInventory())) {
|
| - |
|
1707 |
sb.append("\n-Hold Inventory");
|
| - |
|
1708 |
}
|
| - |
|
1709 |
if(!checkParameterIfEqual(newItem.getDefaultInventory(), item.getDefaultInventory())) {
|
| - |
|
1710 |
sb.append("\n-Default Inventory");
|
| - |
|
1711 |
}
|
| - |
|
1712 |
VendorPricings vendorPricings;
|
| - |
|
1713 |
long vendorId;
|
| - |
|
1714 |
boolean vendorPricingsChanged = false;
|
| - |
|
1715 |
for(int row = 0; row < tableVendorPrices.getRowCount(); row++) {
|
| - |
|
1716 |
vendorId = Long.parseLong(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_VENDORID));
|
| - |
|
1717 |
vendorPricings = item.getVendorPricesMap().get(vendorId);
|
| - |
|
1718 |
if(vendorPricings == null) {
|
| - |
|
1719 |
sb.append("\n-Vendor Prices (Vendor:" + vendorId + ")");
|
| - |
|
1720 |
vendorPricingsChanged = true;
|
| - |
|
1721 |
continue;
|
| - |
|
1722 |
}
|
| - |
|
1723 |
if(vendorPricings.getMop() != Double.parseDouble(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_MOP))) {
|
| - |
|
1724 |
vendorPricingsChanged = true;
|
| - |
|
1725 |
sb.append("\n-MOP (Vendor:" + vendorId + ")");
|
| - |
|
1726 |
}
|
| - |
|
1727 |
if(vendorPricings.getDealerPrice() != Double.parseDouble(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_DP))) {
|
| - |
|
1728 |
vendorPricingsChanged = true;
|
| - |
|
1729 |
sb.append("\n-Dealer Price (Vendor:" + vendorId + ")");
|
| - |
|
1730 |
}
|
| - |
|
1731 |
if(vendorPricings.getTransferPrice() != Double.parseDouble(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_TP))) {
|
| - |
|
1732 |
vendorPricingsChanged = true;
|
| - |
|
1733 |
}
|
| - |
|
1734 |
if(vendorPricings.getNlc() != Double.parseDouble(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_NLC))) {
|
| - |
|
1735 |
vendorPricingsChanged = true;
|
| - |
|
1736 |
}
|
| - |
|
1737 |
}
|
| - |
|
1738 |
if(vendorPricingsChanged){
|
| - |
|
1739 |
sb.append("\n-Vendor Pricing");
|
| - |
|
1740 |
optionalChangedValMap.put(OPTIONAL_VENDOR_PRICING, newItem.getVendorPricesMap());
|
| - |
|
1741 |
}
|
| - |
|
1742 |
|
| - |
|
1743 |
SourcePricings sourcePricings;
|
| - |
|
1744 |
boolean sourcePricingsChanged = false;
|
| - |
|
1745 |
long sourceId;
|
| - |
|
1746 |
for(int row = 0; row < tableSourcePrices.getRowCount(); row++) {
|
| - |
|
1747 |
sourceId = Long.parseLong(tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID));
|
| - |
|
1748 |
sourcePricings = item.getSourcePricesMap().get(sourceId);
|
| - |
|
1749 |
if(sourcePricings == null) {
|
| - |
|
1750 |
sourcePricingsChanged = true;
|
| - |
|
1751 |
sb.append("\n-Source Prices (Source:" + sourceId + ")");
|
| - |
|
1752 |
continue;
|
| - |
|
1753 |
}
|
| - |
|
1754 |
if(sourcePricings.getMrp() != Double.parseDouble(tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_MRP))) {
|
| - |
|
1755 |
sourcePricingsChanged = true;
|
| - |
|
1756 |
sb.append("\n-MRP (Source:" + sourceId + ")");
|
| - |
|
1757 |
}
|
| - |
|
1758 |
if(sourcePricings.getSellingPrice() != Double.parseDouble(tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE))) {
|
| - |
|
1759 |
sourcePricingsChanged = true;
|
| - |
|
1760 |
sb.append("\n-Selling Price (Source:" + sourceId + ")");
|
| - |
|
1761 |
}
|
| - |
|
1762 |
}
|
| - |
|
1763 |
if(sourcePricingsChanged){
|
| - |
|
1764 |
sb.append("\n-Source Pricing");
|
| - |
|
1765 |
optionalChangedValMap.put(OPTIONAL_SOURCE_PRICING, newItem.getSourcePricesMap());
|
| - |
|
1766 |
}
|
| - |
|
1767 |
|
| - |
|
1768 |
|
| - |
|
1769 |
VendorItemMapping mapping;
|
| - |
|
1770 |
String old_key, new_key;
|
| - |
|
1771 |
for(int row = 0; row < tableVendorItemKey.getRowCount(); row++) {
|
| - |
|
1772 |
vendorId = Long.parseLong(tableVendorItemKey.getText(row, TABLE_INDEX_MAPPING_VENDORID));
|
| - |
|
1773 |
old_key = tableVendorItemKey.getText(row, TABLE_INDEX_MAPPING_ITEM_KEY_OLD);
|
| - |
|
1774 |
new_key = tableVendorItemKey.getText(row, TABLE_INDEX_MAPPING_ITEM_KEY);
|
| - |
|
1775 |
mapping = item.getVendorKeysMap().get(vendorId + Item.KEY_SEPARATOR + old_key);
|
| - |
|
1776 |
if(mapping == null || !old_key.equals(new_key)) {
|
| - |
|
1777 |
sb.append("\n-Vendor Key (Vendor:" + vendorId + ",Key: = " + old_key + ")");
|
| - |
|
1778 |
continue;
|
| - |
|
1779 |
}
|
| - |
|
1780 |
}
|
| - |
|
1781 |
return sb.toString();
|
| - |
|
1782 |
}
|
| - |
|
1783 |
|
| - |
|
1784 |
@SuppressWarnings("unused")
|
| 1753 |
private boolean validatePrices() {
|
1785 |
private boolean validatePrices() {
|
| 1754 |
if(newItem.getSellingPrice() > newItem.getMrp()) {
|
1786 |
if(newItem.getSellingPrice() > newItem.getMrp()) {
|
| 1755 |
Window.alert("Selling price cannot be more than MRP");
|
1787 |
Window.alert("Selling price cannot be more than MRP");
|
| 1756 |
return false;
|
1788 |
return false;
|
| 1757 |
}
|
1789 |
}
|
| 1758 |
for(VendorPricings v : newItem.getVendorPricesMap().values()) {
|
1790 |
for(VendorPricings v : newItem.getVendorPricesMap().values()) {
|
| 1759 |
if(newItem.getMrp() < v.getMop()) {
|
1791 |
if(newItem.getMrp() < v.getMop()) {
|
| 1760 |
Window.alert("MRP cannot be less than MOP. Vendor: " + v.getVendorId());
|
1792 |
Window.alert("MRP cannot be less than MOP. Vendor: " + v.getVendorId());
|
| 1761 |
return false;
|
1793 |
return false;
|
| 1762 |
}
|
1794 |
}
|
| 1763 |
if(v.getTransferPrice() > v.getMop()) {
|
1795 |
if(v.getTransferPrice() > v.getMop()) {
|
| 1764 |
Window.alert("Transfer Price cannot be more than MOP. Vendor: " + v.getVendorId());
|
1796 |
Window.alert("Transfer Price cannot be more than MOP. Vendor: " + v.getVendorId());
|
| 1765 |
return false;
|
1797 |
return false;
|
| 1766 |
}
|
1798 |
}
|
| 1767 |
}
|
1799 |
}
|
| 1768 |
return true;
|
1800 |
return true;
|
| 1769 |
}
|
1801 |
}
|
| 1770 |
|
1802 |
|
| 1771 |
private boolean validateVendorPrices(double mop, double dp, double tp, double nlc) {
|
1803 |
private boolean validateVendorPrices(double mop, double dp, double tp, double nlc) {
|
| 1772 |
if(item.getMrp() != null && item.getMrp() < mop) {
|
1804 |
if(item.getMrp() != null && item.getMrp() < mop) {
|
| 1773 |
Window.alert("MOP cannot be more than MRP.");
|
1805 |
Window.alert("MOP cannot be more than MRP.");
|
| 1774 |
return false;
|
1806 |
return false;
|
| 1775 |
}
|
1807 |
}
|
| 1776 |
if(tp > mop) {
|
1808 |
if(tp > mop) {
|
| 1777 |
Window.alert("Transfer Price cannot be more than MOP.");
|
1809 |
Window.alert("Transfer Price cannot be more than MOP.");
|
| 1778 |
return false;
|
1810 |
return false;
|
| 1779 |
}
|
1811 |
}
|
| 1780 |
if(tp < nlc) {
|
1812 |
if(tp < nlc) {
|
| 1781 |
Window.alert("Transfer Price cannot be less than NLC.");
|
1813 |
Window.alert("Transfer Price cannot be less than NLC.");
|
| 1782 |
return false;
|
1814 |
return false;
|
| 1783 |
}
|
1815 |
}
|
| 1784 |
return true;
|
1816 |
return true;
|
| 1785 |
}
|
1817 |
}
|
| 1786 |
|
1818 |
|
| 1787 |
private boolean validateSourcePrices(double mrp, double sellingPrice) {
|
1819 |
private boolean validateSourcePrices(double mrp, double sellingPrice) {
|
| 1788 |
if(sellingPrice > mrp) {
|
1820 |
if(sellingPrice > mrp) {
|
| 1789 |
Window.alert("Selling Price cannot be more than MRP.");
|
1821 |
Window.alert("Selling Price cannot be more than MRP.");
|
| 1790 |
return false;
|
1822 |
return false;
|
| 1791 |
}
|
1823 |
}
|
| 1792 |
return true;
|
1824 |
return true;
|
| 1793 |
}
|
1825 |
}
|
| 1794 |
|
1826 |
|
| 1795 |
|
1827 |
|
| 1796 |
public long getItemId() {
|
1828 |
public long getItemId() {
|
| 1797 |
return item == null ? 0 : item.getId();
|
1829 |
return item == null ? 0 : item.getId();
|
| 1798 |
}
|
1830 |
}
|
| 1799 |
|
1831 |
|
| 1800 |
public Item getItem() {
|
1832 |
public Item getItem() {
|
| 1801 |
return item;
|
1833 |
return item;
|
| 1802 |
}
|
1834 |
}
|
| 1803 |
|
1835 |
|
| 1804 |
private boolean voucherExists(String voucherType) {
|
1836 |
private boolean voucherExists(String voucherType) {
|
| 1805 |
for(int i = 0; i < tableVouchers.getRowCount(); i++) {
|
1837 |
for(int i = 0; i < tableVouchers.getRowCount(); i++) {
|
| 1806 |
if(voucherType.equals(tableVouchers.getText(i, TABLE_INDEX_VOUCHERS_TYPE))) {
|
1838 |
if(voucherType.equals(tableVouchers.getText(i, TABLE_INDEX_VOUCHERS_TYPE))) {
|
| 1807 |
return false;
|
1839 |
return false;
|
| 1808 |
}
|
1840 |
}
|
| 1809 |
}
|
1841 |
}
|
| 1810 |
return true;
|
1842 |
return true;
|
| 1811 |
}
|
1843 |
}
|
| 1812 |
|
1844 |
|
| 1813 |
/**
|
1845 |
/**
|
| 1814 |
* This method is used while adding vendor prices to ensure that there is only one row in the table for a vendor.
|
1846 |
* This method is used while adding vendor prices to ensure that there is only one row in the table for a vendor.
|
| 1815 |
* @param vendorId
|
1847 |
* @param vendorId
|
| 1816 |
* @return true if parameter vendor Id is already added to vendor prices table.
|
1848 |
* @return true if parameter vendor Id is already added to vendor prices table.
|
| 1817 |
* <br>else false
|
1849 |
* <br>else false
|
| 1818 |
*/
|
1850 |
*/
|
| 1819 |
private boolean vendorExists(long vendorId) {
|
1851 |
private boolean vendorExists(long vendorId) {
|
| 1820 |
long id;
|
1852 |
long id;
|
| 1821 |
for(int i = 0; i < tableVendorPrices.getRowCount(); i++) {
|
1853 |
for(int i = 0; i < tableVendorPrices.getRowCount(); i++) {
|
| 1822 |
id = Long.parseLong(tableVendorPrices.getText(i, TABLE_INDEX_PRICING_VENDORID));
|
1854 |
id = Long.parseLong(tableVendorPrices.getText(i, TABLE_INDEX_PRICING_VENDORID));
|
| 1823 |
if(vendorId == id) {
|
1855 |
if(vendorId == id) {
|
| 1824 |
return false;
|
1856 |
return false;
|
| 1825 |
}
|
1857 |
}
|
| 1826 |
}
|
1858 |
}
|
| 1827 |
return true;
|
1859 |
return true;
|
| 1828 |
}
|
1860 |
}
|
| 1829 |
|
1861 |
|
| 1830 |
/**
|
1862 |
/**
|
| 1831 |
* This method is used while adding source prices to ensure that there is only one row in the table for a source.
|
1863 |
* This method is used while adding source prices to ensure that there is only one row in the table for a source.
|
| 1832 |
* @param sourceId
|
1864 |
* @param sourceId
|
| 1833 |
* @return true if parameter vendor Id is already added to source prices table.
|
1865 |
* @return true if parameter vendor Id is already added to source prices table.
|
| 1834 |
* <br>else false
|
1866 |
* <br>else false
|
| 1835 |
*/
|
1867 |
*/
|
| 1836 |
private boolean sourceExists(long sourceId) {
|
1868 |
private boolean sourceExists(long sourceId) {
|
| 1837 |
long id;
|
1869 |
long id;
|
| 1838 |
for(int i = 0; i < tableSourcePrices.getRowCount(); i++) {
|
1870 |
for(int i = 0; i < tableSourcePrices.getRowCount(); i++) {
|
| 1839 |
id = Long.parseLong(tableSourcePrices.getText(i, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID));
|
1871 |
id = Long.parseLong(tableSourcePrices.getText(i, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID));
|
| 1840 |
if(sourceId == id) {
|
1872 |
if(sourceId == id) {
|
| 1841 |
return false;
|
1873 |
return false;
|
| 1842 |
}
|
1874 |
}
|
| 1843 |
}
|
1875 |
}
|
| 1844 |
return true;
|
1876 |
return true;
|
| 1845 |
}
|
1877 |
}
|
| 1846 |
|
1878 |
|
| 1847 |
/**
|
1879 |
/**
|
| 1848 |
* This method is used to check if any of the string item attributes is changed by the user.
|
1880 |
* This method is used to check if any of the string item attributes is changed by the user.
|
| 1849 |
* @param o1
|
1881 |
* @param o1
|
| 1850 |
* @param o2
|
1882 |
* @param o2
|
| 1851 |
* @return true if two strings are equal
|
1883 |
* @return true if two strings are equal
|
| 1852 |
* <br>true if one of them is null and another is empty.
|
1884 |
* <br>true if one of them is null and another is empty.
|
| 1853 |
* <br>false otherwise
|
1885 |
* <br>false otherwise
|
| 1854 |
*/
|
1886 |
*/
|
| 1855 |
private boolean checkParameterIfEqual(Object o1, Object o2) {
|
1887 |
private boolean checkParameterIfEqual(Object o1, Object o2) {
|
| 1856 |
if(o1 == o2) {
|
1888 |
if(o1 == o2) {
|
| 1857 |
return true;
|
1889 |
return true;
|
| 1858 |
}
|
1890 |
}
|
| 1859 |
if(o1 != null && o2 != null && o1.equals(o2)) {
|
1891 |
if(o1 != null && o2 != null && o1.equals(o2)) {
|
| 1860 |
return true;
|
1892 |
return true;
|
| 1861 |
}
|
1893 |
}
|
| 1862 |
if((o1 == null && o2.equals("")) || (o2 == null && o1.equals(""))) {
|
1894 |
if((o1 == null && o2.equals("")) || (o2 == null && o1.equals(""))) {
|
| 1863 |
return true;
|
1895 |
return true;
|
| 1864 |
}
|
1896 |
}
|
| 1865 |
return false;
|
1897 |
return false;
|
| 1866 |
}
|
1898 |
}
|
| 1867 |
|
1899 |
|
| 1868 |
public void setCatalogDashboardPanel(CatalogDashboard catalogDashboardPanel) {
|
1900 |
public void setCatalogDashboardPanel(CatalogDashboard catalogDashboardPanel) {
|
| 1869 |
this.catalogDashboardPanel = catalogDashboardPanel;
|
1901 |
this.catalogDashboardPanel = catalogDashboardPanel;
|
| 1870 |
}
|
1902 |
}
|
| 1871 |
|
1903 |
|
| 1872 |
private String compareSellingPricewithBreakEven() {
|
1904 |
private String compareSellingPricewithBreakEven() {
|
| 1873 |
String message = "false";
|
1905 |
String message = "false";
|
| 1874 |
if(newItem.getWeight() == null) {
|
1906 |
if(newItem.getWeight() == null) {
|
| 1875 |
Window.alert("Weight is empty.");
|
1907 |
Window.alert("Weight is empty.");
|
| 1876 |
return message;
|
1908 |
return message;
|
| 1877 |
}
|
1909 |
}
|
| 1878 |
if(newItem.getSellingPrice() == null) {
|
1910 |
if(newItem.getSellingPrice() == null) {
|
| 1879 |
Window.alert("Selling Price is empty.");
|
1911 |
Window.alert("Selling Price is empty.");
|
| 1880 |
return message;
|
1912 |
return message;
|
| 1881 |
}
|
1913 |
}
|
| 1882 |
|
1914 |
|
| 1883 |
double transferPrice;
|
1915 |
double transferPrice;
|
| 1884 |
if(newItem.getPreferredVendor() == null && !newItem.getVendorPricesMap().isEmpty()) {
|
1916 |
if(newItem.getPreferredVendor() == null && !newItem.getVendorPricesMap().isEmpty()) {
|
| 1885 |
transferPrice = -1;
|
1917 |
transferPrice = -1;
|
| 1886 |
for(VendorPricings vendorDetail : newItem.getVendorPricesMap().values()){
|
1918 |
for(VendorPricings vendorDetail : newItem.getVendorPricesMap().values()){
|
| 1887 |
if(transferPrice > vendorDetail.getNlc() || transferPrice == -1){
|
1919 |
if(transferPrice > vendorDetail.getNlc() || transferPrice == -1){
|
| 1888 |
transferPrice = vendorDetail.getNlc();
|
1920 |
transferPrice = vendorDetail.getNlc();
|
| 1889 |
}
|
1921 |
}
|
| 1890 |
}
|
1922 |
}
|
| 1891 |
}
|
1923 |
}
|
| 1892 |
else if(!newItem.getVendorPricesMap().isEmpty() && newItem.getVendorPricesMap().containsKey(newItem.getPreferredVendor())){
|
1924 |
else if(!newItem.getVendorPricesMap().isEmpty() && newItem.getVendorPricesMap().containsKey(newItem.getPreferredVendor())){
|
| 1893 |
transferPrice = newItem.getVendorPricesMap().get(newItem.getPreferredVendor()).getNlc();
|
1925 |
transferPrice = newItem.getVendorPricesMap().get(newItem.getPreferredVendor()).getNlc();
|
| 1894 |
}
|
1926 |
}
|
| 1895 |
else{
|
1927 |
else{
|
| 1896 |
Window.alert("Add vendor to Vendor Prices and then change the Selling Price.");
|
1928 |
Window.alert("Add vendor to Vendor Prices and then change the Selling Price.");
|
| 1897 |
return message;
|
1929 |
return message;
|
| 1898 |
}
|
1930 |
}
|
| 1899 |
|
1931 |
|
| 1900 |
double weightfactor = Math.ceil((newItem.getWeight() * 1000)/Double.parseDouble(ConfigMap.get("courier_weight_factor")));
|
1932 |
double weightfactor = Math.ceil((newItem.getWeight() * 1000)/Double.parseDouble(ConfigMap.get("courier_weight_factor")));
|
| 1901 |
double couriercost = Double.parseDouble(ConfigMap.get("courier_cost_factor")) * weightfactor;
|
1933 |
double couriercost = Double.parseDouble(ConfigMap.get("courier_cost_factor")) * weightfactor;
|
| 1902 |
double costfactor = (Double.parseDouble(ConfigMap.get("transfer_price_percentage")) * transferPrice)/100;
|
1934 |
double costfactor = (Double.parseDouble(ConfigMap.get("transfer_price_percentage")) * transferPrice)/100;
|
| 1903 |
double breakeven;
|
1935 |
double breakeven;
|
| 1904 |
if(costfactor < Double.parseDouble(ConfigMap.get("transfer_price_factor"))){
|
1936 |
if(costfactor < Double.parseDouble(ConfigMap.get("transfer_price_factor"))){
|
| 1905 |
breakeven = transferPrice + couriercost + Double.parseDouble(ConfigMap.get("breakeven_additon_factor"));
|
1937 |
breakeven = transferPrice + couriercost + Double.parseDouble(ConfigMap.get("breakeven_additon_factor"));
|
| 1906 |
}
|
1938 |
}
|
| 1907 |
else{
|
1939 |
else{
|
| 1908 |
breakeven = (transferPrice + couriercost)/Double.parseDouble(ConfigMap.get("breakeven_divisor"));
|
1940 |
breakeven = (transferPrice + couriercost)/Double.parseDouble(ConfigMap.get("breakeven_divisor"));
|
| 1909 |
}
|
1941 |
}
|
| 1910 |
|
1942 |
|
| 1911 |
if(breakeven > newItem.getSellingPrice()) {
|
1943 |
if(breakeven > newItem.getSellingPrice()) {
|
| 1912 |
message = "Selling Price("+newItem.getSellingPrice()+") is less than Breakeven Price("+breakeven+").";
|
1944 |
message = "Selling Price("+newItem.getSellingPrice()+") is less than Breakeven Price("+breakeven+").";
|
| 1913 |
if(Window.confirm(message)){
|
1945 |
if(Window.confirm(message)){
|
| 1914 |
return message;
|
1946 |
return message;
|
| 1915 |
}
|
1947 |
}
|
| Line 1919... |
Line 1951... |
| 1919 |
return message;
|
1951 |
return message;
|
| 1920 |
}
|
1952 |
}
|
| 1921 |
}
|
1953 |
}
|
| 1922 |
else {
|
1954 |
else {
|
| 1923 |
message = "true";
|
1955 |
message = "true";
|
| 1924 |
return message;
|
1956 |
return message;
|
| 1925 |
}
|
1957 |
}
|
| 1926 |
}
|
1958 |
}
|
| 1927 |
|
1959 |
|
| 1928 |
private String checkTransferPriceforPreferredVendor() {
|
1960 |
private String checkTransferPriceforPreferredVendor() {
|
| 1929 |
String message = "false";
|
1961 |
String message = "false";
|
| 1930 |
if(newItem.getPreferredVendor() == null) {
|
1962 |
if(newItem.getPreferredVendor() == null) {
|
| 1931 |
message = "true";
|
1963 |
message = "true";
|
| 1932 |
return message;
|
1964 |
return message;
|
| 1933 |
}
|
1965 |
}
|
| 1934 |
else if(!newItem.getVendorPricesMap().isEmpty() && newItem.getVendorPricesMap().containsKey(newItem.getPreferredVendor())){
|
1966 |
else if(!newItem.getVendorPricesMap().isEmpty() && newItem.getVendorPricesMap().containsKey(newItem.getPreferredVendor())){
|
| 1935 |
double transferPrice = newItem.getVendorPricesMap().get(newItem.getPreferredVendor()).getTransferPrice();
|
1967 |
double transferPrice = newItem.getVendorPricesMap().get(newItem.getPreferredVendor()).getTransferPrice();
|
| 1936 |
double mintransferPrice = -1;
|
1968 |
double mintransferPrice = -1;
|
| 1937 |
String minvendor = "";
|
1969 |
String minvendor = "";
|
| 1938 |
boolean compareTransferPrices = false;
|
1970 |
boolean compareTransferPrices = false;
|
| 1939 |
for(VendorPricings vendorDetail : newItem.getVendorPricesMap().values()){
|
1971 |
for(VendorPricings vendorDetail : newItem.getVendorPricesMap().values()){
|
| 1940 |
if(mintransferPrice > vendorDetail.getTransferPrice() || mintransferPrice == -1){
|
1972 |
if(mintransferPrice > vendorDetail.getTransferPrice() || mintransferPrice == -1){
|
| 1941 |
mintransferPrice = vendorDetail.getTransferPrice();
|
1973 |
mintransferPrice = vendorDetail.getTransferPrice();
|
| 1942 |
minvendor = Utils.getVendorDesc(vendorDetail.getVendorId());
|
1974 |
minvendor = Utils.getVendorDesc(vendorDetail.getVendorId());
|
| 1943 |
}
|
1975 |
}
|
| Line 1967... |
Line 1999... |
| 1967 |
return message;
|
1999 |
return message;
|
| 1968 |
}
|
2000 |
}
|
| 1969 |
}
|
2001 |
}
|
| 1970 |
else {
|
2002 |
else {
|
| 1971 |
message = "true";
|
2003 |
message = "true";
|
| 1972 |
return message;
|
2004 |
return message;
|
| 1973 |
}
|
2005 |
}
|
| 1974 |
}
|
2006 |
}
|
| 1975 |
else{
|
2007 |
else{
|
| 1976 |
Window.alert("Add vendor to Vendor Prices and then change the Preferred Vendor.");
|
2008 |
Window.alert("Add vendor to Vendor Prices and then change the Preferred Vendor.");
|
| 1977 |
return message;
|
2009 |
return message;
|
| 1978 |
}
|
2010 |
}
|
| 1979 |
}
|
2011 |
}
|
| 1980 |
|
2012 |
|
| 1981 |
public void logAuthorization(String message) {
|
2013 |
public void logAuthorization(String message) {
|
| 1982 |
String username = catalogDashboardPanel.uname;
|
2014 |
String username = catalogDashboardPanel.uname;
|
| 1983 |
catalogService.addAuthorizationLog(newItem.getId(), username, message, new AsyncCallback<Boolean>() {
|
2015 |
catalogService.addAuthorizationLog(newItem.getId(), username, message, new AsyncCallback<Boolean>() {
|
| 1984 |
@Override
|
2016 |
@Override
|
| 1985 |
public void onSuccess(Boolean result) {
|
2017 |
public void onSuccess(Boolean result) {
|
| 1986 |
if(result) {
|
2018 |
if(result) {
|
| 1987 |
GWT.log("Event is added");
|
2019 |
GWT.log("Event is added");
|
| 1988 |
}
|
2020 |
}
|
| 1989 |
else {
|
2021 |
else {
|
| 1990 |
GWT.log("Error adding the event");
|
2022 |
GWT.log("Error adding the event");
|
| 1991 |
Window.alert("Error adding the event");
|
2023 |
Window.alert("Error adding the event");
|
| 1992 |
}
|
2024 |
}
|
| 1993 |
}
|
2025 |
}
|
| 1994 |
@Override
|
2026 |
@Override
|
| 1995 |
public void onFailure(Throwable caught) {
|
2027 |
public void onFailure(Throwable caught) {
|
| 1996 |
caught.printStackTrace();
|
2028 |
caught.printStackTrace();
|
| 1997 |
Window.alert("Error while adding the event");
|
2029 |
Window.alert("Error while adding the event");
|
| 1998 |
}
|
2030 |
}
|
| 1999 |
});
|
2031 |
});
|
| 2000 |
}
|
2032 |
}
|
| 2001 |
|
2033 |
|
| 2002 |
@Override
|
2034 |
@Override
|
| 2003 |
public void setComingSoonStartDate(Date date) {
|
2035 |
public void setComingSoonStartDate(Date date) {
|
| 2004 |
this.comingSoonStartDate.setValue(date);
|
2036 |
this.comingSoonStartDate.setValue(date);
|
| 2005 |
|
2037 |
|
| 2006 |
}
|
2038 |
}
|
| 2007 |
|
2039 |
|
| 2008 |
@Override
|
2040 |
@Override
|
| 2009 |
public void setBestDealsText(String bestDealsText) {
|
2041 |
public void setBestDealsText(String bestDealsText) {
|
| 2010 |
this.bestDealsText.setValue(bestDealsText);
|
2042 |
this.bestDealsText.setValue(bestDealsText);
|
| 2011 |
|
2043 |
|
| 2012 |
}
|
2044 |
}
|
| 2013 |
|
2045 |
|
| 2014 |
@Override
|
2046 |
@Override
|
| 2015 |
public void setExpectedArrivalDate(Date date) {
|
2047 |
public void setExpectedArrivalDate(Date date) {
|
| 2016 |
this.expectedArrivalDate.setValue(date);
|
2048 |
this.expectedArrivalDate.setValue(date);
|
| 2017 |
|
2049 |
|
| 2018 |
}
|
2050 |
}
|
| 2019 |
|
2051 |
|
| 2020 |
@Override
|
2052 |
@Override
|
| 2021 |
public String getBestDealsText() {
|
2053 |
public String getBestDealsText() {
|
| 2022 |
return this.bestDealsText.getValue();
|
2054 |
return this.bestDealsText.getValue();
|
| 2023 |
}
|
2055 |
}
|
| 2024 |
|
2056 |
|
| 2025 |
public void setBestDealsDetailsText(String bestDealsDetailsText) {
|
2057 |
public void setBestDealsDetailsText(String bestDealsDetailsText) {
|
| 2026 |
this.bestDealsDetailsText.setValue(bestDealsDetailsText);
|
2058 |
this.bestDealsDetailsText.setValue(bestDealsDetailsText);
|
| 2027 |
|
2059 |
|
| 2028 |
}
|
2060 |
}
|
| 2029 |
|
2061 |
|
| 2030 |
public String getBestDealsDetailsText() {
|
2062 |
public String getBestDealsDetailsText() {
|
| 2031 |
return this.bestDealsDetailsText.getValue();
|
2063 |
return this.bestDealsDetailsText.getValue();
|
| 2032 |
}
|
2064 |
}
|
| 2033 |
|
2065 |
|
| 2034 |
@Override
|
2066 |
@Override
|
| Line 2043... |
Line 2075... |
| 2043 |
@UiHandler("comingSoonButton")
|
2075 |
@UiHandler("comingSoonButton")
|
| 2044 |
void onComingSoonButtonClick(ClickEvent event) {
|
2076 |
void onComingSoonButtonClick(ClickEvent event) {
|
| 2045 |
ComingSoonDialog cd = new ComingSoonDialog(this);
|
2077 |
ComingSoonDialog cd = new ComingSoonDialog(this);
|
| 2046 |
cd.show();
|
2078 |
cd.show();
|
| 2047 |
}
|
2079 |
}
|
| 2048 |
|
2080 |
|
| 2049 |
private void createDialog(String changedString) {
|
2081 |
private void createDialog(String changedString) {
|
| 2050 |
VerticalPanel vp = new VerticalPanel();
|
2082 |
VerticalPanel vp = new VerticalPanel();
|
| 2051 |
final DialogBox db = new DialogBox();
|
2083 |
final DialogBox db = new DialogBox();
|
| 2052 |
db.setText("Changed fields");
|
2084 |
db.setText("Changed fields");
|
| 2053 |
|
2085 |
|
| 2054 |
vp.add(new Label("Check the fields to update all SKUs with similar entity."));
|
2086 |
vp.add(new Label("Check the fields to update all SKUs with similar entity."));
|
| 2055 |
vp.add(new Label("--------------------------------------------------------"));
|
2087 |
vp.add(new Label("--------------------------------------------------------"));
|
| 2056 |
CheckBox allChecked = new CheckBox("Select all");
|
2088 |
CheckBox allChecked = new CheckBox("Select all");
|
| 2057 |
if(optionalChangedValMap.size()>1){
|
2089 |
if(optionalChangedValMap.size()>1){
|
| 2058 |
allChecked.setName("all");
|
2090 |
allChecked.setName("all");
|
| 2059 |
allChecked.addClickHandler(new ClickHandler() {
|
2091 |
allChecked.addClickHandler(new ClickHandler() {
|
| 2060 |
@Override
|
2092 |
@Override
|
| 2061 |
public void onClick(ClickEvent event) {
|
2093 |
public void onClick(ClickEvent event) {
|
| 2062 |
CheckBox cb = (CheckBox)event.getSource();
|
2094 |
CheckBox cb = (CheckBox)event.getSource();
|
| 2063 |
VerticalPanel vp = (VerticalPanel)cb.getParent();
|
2095 |
VerticalPanel vp = (VerticalPanel)cb.getParent();
|
| 2064 |
Iterator<Widget> iterator = vp.iterator();
|
2096 |
Iterator<Widget> iterator = vp.iterator();
|
| Line 2076... |
Line 2108... |
| 2076 |
}else {
|
2108 |
}else {
|
| 2077 |
cb.setText("Select all");
|
2109 |
cb.setText("Select all");
|
| 2078 |
}
|
2110 |
}
|
| 2079 |
}
|
2111 |
}
|
| 2080 |
});
|
2112 |
});
|
| 2081 |
vp.add(allChecked);
|
2113 |
vp.add(allChecked);
|
| 2082 |
}
|
2114 |
}
|
| 2083 |
String[] changedFields = changedString.split("\n-");
|
2115 |
String[] changedFields = changedString.split("\n-");
|
| 2084 |
for(String changeField : changedFields){
|
2116 |
for(String changeField : changedFields){
|
| 2085 |
if(optionalChangedValMap.containsKey(changeField)){
|
2117 |
if(optionalChangedValMap.containsKey(changeField)){
|
| 2086 |
CheckBox ch = new CheckBox(changeField);
|
2118 |
CheckBox ch = new CheckBox(changeField);
|
| 2087 |
ch.getElement().getStyle().setPadding(10d, Unit.PX);
|
2119 |
ch.getElement().getStyle().setPadding(10d, Unit.PX);
|
| 2088 |
vp.add(ch);
|
2120 |
vp.add(ch);
|
| 2089 |
} else {
|
2121 |
} else {
|
| 2090 |
Label l = new Label(changeField);
|
2122 |
Label l = new Label(changeField);
|
| 2091 |
l.getElement().getStyle().setMarginLeft(10d, Unit.PX);
|
2123 |
l.getElement().getStyle().setMarginLeft(10d, Unit.PX);
|
| 2092 |
l.getElement().getStyle().setPadding(10d, Unit.PX);
|
2124 |
l.getElement().getStyle().setPadding(10d, Unit.PX);
|
| 2093 |
vp.add(l);
|
2125 |
vp.add(l);
|
| 2094 |
}
|
2126 |
}
|
| 2095 |
}
|
2127 |
}
|
| 2096 |
|
2128 |
|
| 2097 |
Button submitButton = new Button();
|
2129 |
Button submitButton = new Button();
|
| 2098 |
submitButton.setText("Update");
|
2130 |
submitButton.setText("Update");
|
| 2099 |
submitButton.addClickHandler(new ClickHandler() {
|
2131 |
submitButton.addClickHandler(new ClickHandler() {
|
| 2100 |
|
2132 |
|
| 2101 |
@Override
|
2133 |
@Override
|
| 2102 |
public void onClick(ClickEvent event) {
|
2134 |
public void onClick(ClickEvent event) {
|
| 2103 |
Button b = (Button)event.getSource();
|
2135 |
Button b = (Button)event.getSource();
|
| 2104 |
VerticalPanel vp = (VerticalPanel)b.getParent();
|
2136 |
VerticalPanel vp = (VerticalPanel)b.getParent();
|
| 2105 |
Iterator<Widget> iterator = vp.iterator();
|
2137 |
Iterator<Widget> iterator = vp.iterator();
|
| Line 2130... |
Line 2162... |
| 2130 |
Window.alert("Unable to fetch item details.");
|
2162 |
Window.alert("Unable to fetch item details.");
|
| 2131 |
}
|
2163 |
}
|
| 2132 |
});
|
2164 |
});
|
| 2133 |
}*/
|
2165 |
}*/
|
| 2134 |
}
|
2166 |
}
|
| 2135 |
|
2167 |
|
| 2136 |
});
|
2168 |
});
|
| 2137 |
vp.add(submitButton);
|
2169 |
vp.add(submitButton);
|
| 2138 |
db.add(vp);
|
2170 |
db.add(vp);
|
| 2139 |
db.center();
|
2171 |
db.center();
|
| 2140 |
db.show();
|
2172 |
db.show();
|
| 2141 |
}
|
2173 |
}
|
| 2142 |
|
2174 |
|
| 2143 |
private void updateItem(Long itemId) {
|
2175 |
private void updateItem(Long itemId) {
|
| 2144 |
catalogService.getItem(itemId, new AsyncCallback<Item>() {
|
2176 |
catalogService.getItem(itemId, new AsyncCallback<Item>() {
|
| 2145 |
@Override
|
2177 |
@Override
|
| 2146 |
public void onSuccess(Item result) {
|
2178 |
public void onSuccess(Item result) {
|
| 2147 |
final Item res = result;
|
2179 |
final Item res = result;
|
| 2148 |
if(mandatoryChangedValMap.containsKey(MANDATORY_BRAND)){
|
2180 |
if(mandatoryChangedValMap.containsKey(MANDATORY_BRAND)){
|
| 2149 |
result.setBrand((String)mandatoryChangedValMap.get(MANDATORY_BRAND));
|
2181 |
result.setBrand((String)mandatoryChangedValMap.get(MANDATORY_BRAND));
|
| 2150 |
}
|
2182 |
}
|
| 2151 |
if(mandatoryChangedValMap.containsKey(MANDATORY_BEST_DEAL_TEXT)){
|
2183 |
if(mandatoryChangedValMap.containsKey(MANDATORY_BEST_DEAL_TEXT)){
|
| 2152 |
result.setBestDealsText((String)mandatoryChangedValMap.get(MANDATORY_BEST_DEAL_TEXT));
|
2184 |
result.setBestDealsText((String)mandatoryChangedValMap.get(MANDATORY_BEST_DEAL_TEXT));
|
| 2153 |
}
|
2185 |
}
|
| 2154 |
if(mandatoryChangedValMap.containsKey(MANDATORY_BEST_DEAL_DETAIL_TEXT)){
|
2186 |
if(mandatoryChangedValMap.containsKey(MANDATORY_BEST_DEAL_DETAIL_TEXT)){
|
| 2155 |
result.setBestDealsDetailsText((String)mandatoryChangedValMap.get(MANDATORY_BEST_DEAL_DETAIL_TEXT));
|
2187 |
result.setBestDealsDetailsText((String)mandatoryChangedValMap.get(MANDATORY_BEST_DEAL_DETAIL_TEXT));
|
| 2156 |
}
|
2188 |
}
|
| 2157 |
if(mandatoryChangedValMap.containsKey(MANDATORY_BEST_DEAL_DETAIL_LINK)){
|
2189 |
if(mandatoryChangedValMap.containsKey(MANDATORY_BEST_DEAL_DETAIL_LINK)){
|
| 2158 |
result.setBestDealsDetailsLink((String)mandatoryChangedValMap.get(MANDATORY_BEST_DEAL_DETAIL_LINK));
|
2190 |
result.setBestDealsDetailsLink((String)mandatoryChangedValMap.get(MANDATORY_BEST_DEAL_DETAIL_LINK));
|
| 2159 |
}
|
2191 |
}
|
| 2160 |
if(mandatoryChangedValMap.containsKey(MANDATORY_MODEL_NAME)){
|
2192 |
if(mandatoryChangedValMap.containsKey(MANDATORY_MODEL_NAME)){
|
| 2161 |
result.setModelName((String)mandatoryChangedValMap.get(MANDATORY_MODEL_NAME));
|
2193 |
result.setModelName((String)mandatoryChangedValMap.get(MANDATORY_MODEL_NAME));
|
| 2162 |
}
|
2194 |
}
|
| 2163 |
if(mandatoryChangedValMap.containsKey(MANDATORY_MODEL_NO)){
|
2195 |
if(mandatoryChangedValMap.containsKey(MANDATORY_MODEL_NO)){
|
| 2164 |
result.setModelNumber((String)mandatoryChangedValMap.get(MANDATORY_MODEL_NO));
|
2196 |
result.setModelNumber((String)mandatoryChangedValMap.get(MANDATORY_MODEL_NO));
|
| 2165 |
}
|
2197 |
}
|
| 2166 |
if(mandatoryChangedValMap.containsKey(MANDATORY_WEIGHT)){
|
2198 |
if(mandatoryChangedValMap.containsKey(MANDATORY_WEIGHT)){
|
| 2167 |
result.setWeight((Double)mandatoryChangedValMap.get(MANDATORY_WEIGHT));
|
2199 |
result.setWeight((Double)mandatoryChangedValMap.get(MANDATORY_WEIGHT));
|
| 2168 |
}
|
2200 |
}
|
| 2169 |
if(mandatoryChangedValMap.containsKey(MANDATORY_MRP)){
|
2201 |
if(mandatoryChangedValMap.containsKey(MANDATORY_MRP)){
|
| 2170 |
result.setMrp((Double)mandatoryChangedValMap.get(MANDATORY_MRP));
|
2202 |
result.setMrp((Double)mandatoryChangedValMap.get(MANDATORY_MRP));
|
| 2171 |
}
|
2203 |
}
|
| 2172 |
if(optionalChangedValMap.containsKey(OPTIONAL_FREEBIE_ITEM_ID)) {
|
2204 |
if(optionalChangedValMap.containsKey(OPTIONAL_FREEBIE_ITEM_ID)) {
|
| 2173 |
result.setFreebieItemId((Long)optionalChangedValMap.get(OPTIONAL_FREEBIE_ITEM_ID));
|
2205 |
result.setFreebieItemId((Long)optionalChangedValMap.get(OPTIONAL_FREEBIE_ITEM_ID));
|
| 2174 |
}
|
2206 |
}
|
| 2175 |
if(optionalChangedValMap.containsKey(OPTIONAL_PREFERRED_VENDOR)){
|
2207 |
if(optionalChangedValMap.containsKey(OPTIONAL_PREFERRED_VENDOR)){
|
| 2176 |
result.setPreferredVendor((Long)optionalChangedValMap.get(OPTIONAL_PREFERRED_VENDOR));
|
2208 |
result.setPreferredVendor((Long)optionalChangedValMap.get(OPTIONAL_PREFERRED_VENDOR));
|
| 2177 |
}
|
2209 |
}
|
| 2178 |
if(optionalChangedValMap.containsKey(OPTIONAL_PREFERRED_INSURER)){
|
2210 |
if(optionalChangedValMap.containsKey(OPTIONAL_PREFERRED_INSURER)){
|
| 2179 |
result.setPreferredInsurer((Long)optionalChangedValMap.get(OPTIONAL_PREFERRED_INSURER));
|
2211 |
result.setPreferredInsurer((Long)optionalChangedValMap.get(OPTIONAL_PREFERRED_INSURER));
|
| 2180 |
}
|
2212 |
}
|
| 2181 |
if(optionalChangedValMap.containsKey(OPTIONAL_SELLING_PRICE)){
|
2213 |
if(optionalChangedValMap.containsKey(OPTIONAL_SELLING_PRICE)){
|
| 2182 |
result.setSellingPrice((Double)optionalChangedValMap.get(OPTIONAL_SELLING_PRICE));
|
2214 |
result.setSellingPrice((Double)optionalChangedValMap.get(OPTIONAL_SELLING_PRICE));
|
| 2183 |
}
|
2215 |
}
|
| 2184 |
if(optionalChangedValMap.containsKey(OPTIONAL_SOURCE_PRICING)){
|
2216 |
if(optionalChangedValMap.containsKey(OPTIONAL_SOURCE_PRICING)){
|
| 2185 |
result.setSourcePricesMap((Map<Long, SourcePricings>) optionalChangedValMap.get(OPTIONAL_SOURCE_PRICING));
|
2217 |
result.setSourcePricesMap((Map<Long, SourcePricings>) optionalChangedValMap.get(OPTIONAL_SOURCE_PRICING));
|
| 2186 |
}
|
2218 |
}
|
| 2187 |
if(optionalChangedValMap.containsKey(OPTIONAL_VENDOR_PRICING)){
|
2219 |
if(optionalChangedValMap.containsKey(OPTIONAL_VENDOR_PRICING)){
|
| 2188 |
result.setVendorPricesMap((Map<Long, VendorPricings>) optionalChangedValMap.get(OPTIONAL_VENDOR_PRICING));
|
2220 |
result.setVendorPricesMap((Map<Long, VendorPricings>) optionalChangedValMap.get(OPTIONAL_VENDOR_PRICING));
|
| 2189 |
}
|
2221 |
}
|
| 2190 |
catalogService.updateItem(result, new AsyncCallback<Boolean>() {
|
2222 |
catalogService.updateItem(result, new AsyncCallback<Boolean>() {
|
| 2191 |
|
2223 |
|
| 2192 |
@Override
|
2224 |
@Override
|
| 2193 |
public void onSuccess(Boolean result1) {
|
2225 |
public void onSuccess(Boolean result1) {
|
| 2194 |
if(result1) {
|
2226 |
if(result1) {
|
| 2195 |
Window.alert(res.getId() + " updated Successfully");
|
2227 |
Window.alert(res.getId() + " updated Successfully");
|
| 2196 |
}
|
2228 |
}
|
| 2197 |
|
2229 |
|
| 2198 |
}
|
2230 |
}
|
| 2199 |
|
2231 |
|
| 2200 |
@Override
|
2232 |
@Override
|
| 2201 |
public void onFailure(Throwable caught) {
|
2233 |
public void onFailure(Throwable caught) {
|
| 2202 |
caught.printStackTrace();
|
2234 |
caught.printStackTrace();
|
| 2203 |
Window.alert("Error updating item " + res.getId());
|
2235 |
Window.alert("Error updating item " + res.getId());
|
| 2204 |
|
2236 |
|
| 2205 |
}
|
2237 |
}
|
| 2206 |
});
|
2238 |
});
|
| 2207 |
}
|
2239 |
}
|
| 2208 |
@Override
|
2240 |
@Override
|
| 2209 |
public void onFailure(Throwable caught) {
|
2241 |
public void onFailure(Throwable caught) {
|
| 2210 |
caught.printStackTrace();
|
2242 |
caught.printStackTrace();
|
| 2211 |
Window.alert("Unable to fetch item details.");
|
2243 |
Window.alert("Unable to fetch item details.");
|
| 2212 |
}
|
2244 |
}
|
| 2213 |
});
|
2245 |
});
|
| 2214 |
}
|
2246 |
}
|
| 2215 |
|
2247 |
|
| 2216 |
@Override
|
2248 |
@Override
|
| 2217 |
public void setShowPrice(boolean b) {
|
2249 |
public void setShowPrice(boolean b) {
|
| 2218 |
this.showSellingPrice.setValue(b);
|
2250 |
this.showSellingPrice.setValue(b);
|