Subversion Repositories SmartDukaan

Rev

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

Rev 5309 Rev 5384
Line 104... Line 104...
104
    @UiField FlexTable headerVendorItemKey, tableVendorItemKey;
104
    @UiField FlexTable headerVendorItemKey, tableVendorItemKey;
105
    @UiField FlexTable headerVendorPrices, tableVendorPrices;
105
    @UiField FlexTable headerVendorPrices, tableVendorPrices;
106
    @UiField FlexTable headerSourcePrices, tableSourcePrices;
106
    @UiField FlexTable headerSourcePrices, tableSourcePrices;
107
    @UiField TextBox bestSellingRank;
107
    @UiField TextBox bestSellingRank;
108
    @UiField TextBox expectedDelay;
108
    @UiField TextBox expectedDelay;
109
    @UiField CheckBox defaultForEntity, risky, warehouseStickiness;
109
    @UiField CheckBox defaultForEntity, risky, warehouseStickiness, itemType, hasItemNo;
110
    @UiField DateBox startDate, expectedArrivalDate, comingSoonStartDate;
110
    @UiField DateBox startDate, expectedArrivalDate, comingSoonStartDate;
111
    @UiField FlexTable headerSimilarItems, tableSimilarItems;
111
    @UiField FlexTable headerSimilarItems, tableSimilarItems;
112
    @UiField ListBox preferredVendor, preferredWarehouse, defaultWarehouse;
112
    @UiField ListBox preferredVendor;
113
    @UiField Button comingSoonButton;
113
    @UiField Button comingSoonButton;
114
 
114
 
115
    public ItemDetails(Item item){
115
    public ItemDetails(Item item){
116
        this();
116
        this();
117
        setItemDetails(item);
117
        setItemDetails(item);
Line 123... Line 123...
123
        initVendorKeysHeader();
123
        initVendorKeysHeader();
124
        initVendorPricingHeader();
124
        initVendorPricingHeader();
125
        initSourcePricingHeader();
125
        initSourcePricingHeader();
126
        initSimilarItemList();
126
        initSimilarItemList();
127
        preferredVendor.addItem("null");
127
        preferredVendor.addItem("null");
128
        preferredWarehouse.addItem("null");
-
 
129
        defaultWarehouse.addItem("null");
-
 
130
        getConfigdataforPriceCompare();
128
        getConfigdataforPriceCompare();
131
    }
129
    }
132
 
130
 
133
    public void getConfigdataforPriceCompare(){
131
    public void getConfigdataforPriceCompare(){
134
    	catalogService.getConfigdataforPriceCompare(new AsyncCallback<Map<String,String>>() {
132
    	catalogService.getConfigdataforPriceCompare(new AsyncCallback<Map<String,String>>() {
Line 188... Line 186...
188
        		index++;
186
        		index++;
189
            	preferredVendor.addItem(Utils.getVendorDesc(item.getPreferredVendor()));
187
            	preferredVendor.addItem(Utils.getVendorDesc(item.getPreferredVendor()));
190
            	preferredVendor.setSelectedIndex(index);
188
            	preferredVendor.setSelectedIndex(index);
191
        	}
189
        	}
192
        }
190
        }
193
 
-
 
194
        index = 0;
-
 
195
        preferredWarehouse.clear();
-
 
196
        defaultWarehouse.clear();
-
 
197
        preferredWarehouse.addItem("null");
-
 
198
        defaultWarehouse.addItem("null");
-
 
199
        for(Entry<Long, String> e : Utils.getAllShippingWarehouses().entrySet()) {
-
 
200
            index++;
-
 
201
            preferredWarehouse.addItem(e.getValue());
-
 
202
            defaultWarehouse.addItem(e.getValue());
-
 
203
            if (e.getKey().equals(item.getPreferredWarehouse())) {
-
 
204
                preferredWarehouse.setSelectedIndex(index);
-
 
205
            }
-
 
206
 
-
 
207
            if (e.getKey().equals(item.getDefaultWarehouse())) {
-
 
208
                defaultWarehouse.setSelectedIndex(index);
-
 
209
            }
-
 
210
        }
191
        
211
 
-
 
212
        mrp.setText(item.getMrp() != null ? item.getMrp()+"" : "");
192
        mrp.setText(item.getMrp() != null ? item.getMrp()+"" : "");
213
        sellingPrice.setText(item.getSellingPrice() != null ? item.getSellingPrice()+"" : "");
193
        sellingPrice.setText(item.getSellingPrice() != null ? item.getSellingPrice()+"" : "");
214
        weight.setText(item.getWeight() != null ? item.getWeight()+"" : "");
194
        weight.setText(item.getWeight() != null ? item.getWeight()+"" : "");
215
        expectedDelay.setValue(item.getExpectedDelay()+"");
195
        expectedDelay.setValue(item.getExpectedDelay()+"");
216
        warehouseStickiness.setValue(item.isWarehouseStickiness());
196
        warehouseStickiness.setValue(item.isWarehouseStickiness());
217
        
197
        
-
 
198
        hasItemNo.setValue(item.isHasItemNo());
-
 
199
        itemType.setValue(item.isItemType());
-
 
200
        
218
        startDate.setValue(new Date(item.getStartDate()));
201
        startDate.setValue(new Date(item.getStartDate()));
219
        if(item.getComingSoonStartDate() != null){
202
        if(item.getComingSoonStartDate() != null){
220
        	comingSoonStartDate.setValue(new Date(item.getComingSoonStartDate()));
203
        	comingSoonStartDate.setValue(new Date(item.getComingSoonStartDate()));
221
        }else {
204
        }else {
222
        	comingSoonStartDate.setValue(null);
205
        	comingSoonStartDate.setValue(null);
Line 976... Line 959...
976
            }
959
            }
977
        } catch(NumberFormatException nfe) {
960
        } catch(NumberFormatException nfe) {
978
            Window.alert("Invalid expected delay");
961
            Window.alert("Invalid expected delay");
979
            return false;
962
            return false;
980
        }
963
        }
981
 
-
 
982
        if(defaultWarehouse.getSelectedIndex() == 0) {
-
 
983
            Window.alert("Invalid Warehouse Selected");
-
 
984
        }
-
 
985
        else {
-
 
986
            newItem.setDefaultWarehouse(Utils.getWarehouseId(defaultWarehouse.getItemText(defaultWarehouse.getSelectedIndex())));
-
 
987
        }
-
 
988
        
964
        
989
        if(preferredWarehouse.getSelectedIndex() == 0) {
-
 
990
            newItem.setPreferredWarehouse(null);
-
 
991
        }
-
 
992
        else {
-
 
993
            newItem.setPreferredWarehouse(Utils.getWarehouseId(preferredWarehouse.getItemText(preferredWarehouse.getSelectedIndex())));
-
 
994
        }
-
 
995
 
-
 
996
        if((item.getPreferredVendor() == null || item.getVendorPricesMap() == null || item.getVendorPricesMap().isEmpty()) && preferredVendor.getSelectedIndex() == 0) {
965
        if((item.getPreferredVendor() == null || item.getVendorPricesMap() == null || item.getVendorPricesMap().isEmpty()) && preferredVendor.getSelectedIndex() == 0) {
997
        	newItem.setPreferredVendor(item.getPreferredVendor());
966
        	newItem.setPreferredVendor(item.getPreferredVendor());
998
        }
967
        }
999
    	else {
968
    	else {
1000
    		long vendorId = Utils.getVendorId(preferredVendor.getItemText(preferredVendor.getSelectedIndex()));
969
    		long vendorId = Utils.getVendorId(preferredVendor.getItemText(preferredVendor.getSelectedIndex()));
1001
            newItem.setPreferredVendor(vendorId);
970
            newItem.setPreferredVendor(vendorId);
1002
    	}
971
    	}
1003
        
972
        
1004
        newItem.setWarehouseStickiness(warehouseStickiness.getValue());
973
        newItem.setWarehouseStickiness(warehouseStickiness.getValue());
-
 
974
        newItem.setHasItemNo(hasItemNo.getValue());
-
 
975
        newItem.setItemType(itemType.getValue());
1005
        
976
        
1006
        /*Create an instance of VendorPricings for each row in vendor pricing table. Set the vendor prices to the instance.
977
        /*Create an instance of VendorPricings for each row in vendor pricing table. Set the vendor prices to the instance.
1007
          Add the instance to map and set the map to the item instance created above.*/
978
          Add the instance to map and set the map to the item instance created above.*/
1008
        Map<Long, VendorPricings> vendorPrices = new HashMap<Long, VendorPricings>();
979
        Map<Long, VendorPricings> vendorPrices = new HashMap<Long, VendorPricings>();
1009
        VendorPricings v;
980
        VendorPricings v;
Line 1195... Line 1166...
1195
        	sb.append("\n-Coming Soon Start Date");
1166
        	sb.append("\n-Coming Soon Start Date");
1196
        }
1167
        }
1197
        if(!checkParameterIfEqual(newItem.getExpectedDelay(), item.getExpectedDelay())) {
1168
        if(!checkParameterIfEqual(newItem.getExpectedDelay(), item.getExpectedDelay())) {
1198
            sb.append("\n-Expected Delay");
1169
            sb.append("\n-Expected Delay");
1199
        }
1170
        }
1200
        if(!checkParameterIfEqual(newItem.getPreferredWarehouse(), item.getPreferredWarehouse())) {
-
 
1201
            sb.append("\n-Preferred Warehouse");
-
 
1202
        }
-
 
1203
        if(!checkParameterIfEqual(newItem.getDefaultWarehouse(), item.getDefaultWarehouse())) {
-
 
1204
            sb.append("\n-Default Warehouse");
-
 
1205
        }
-
 
1206
        if(item.isWarehouseStickiness() != warehouseStickiness.getValue()) {
1171
        if(item.isWarehouseStickiness() != warehouseStickiness.getValue()) {
1207
            sb.append("\n-Warehouse Stickiness Flag");
1172
            sb.append("\n-Warehouse Stickiness Flag");
1208
        }
1173
        }
1209
        if(!checkParameterIfEqual(newItem.getPreferredVendor(), item.getPreferredVendor())) {
1174
        if(!checkParameterIfEqual(newItem.getPreferredVendor(), item.getPreferredVendor())) {
1210
            sb.append("\n-Preferred Vendor");
1175
            sb.append("\n-Preferred Vendor");
1211
        }
1176
        }
-
 
1177
        if(item.isHasItemNo() != hasItemNo.getValue()) {
-
 
1178
            sb.append("\n-Has Item Number Flag");
-
 
1179
        }
-
 
1180
        if(item.isItemType() != itemType.getValue()) {
-
 
1181
            sb.append("\n-Has Serial Number Flag");
-
 
1182
        }
1212
        
1183
        
1213
        VendorPricings vendorPricings;
1184
        VendorPricings vendorPricings;
1214
        long vendorId;
1185
        long vendorId;
1215
        for(int row = 0; row < tableVendorPrices.getRowCount(); row++) {
1186
        for(int row = 0; row < tableVendorPrices.getRowCount(); row++) {
1216
            vendorId = Long.parseLong(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_VENDORID));
1187
            vendorId = Long.parseLong(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_VENDORID));