# Conflicts:
#	GSKMTOrange/src/main/AndroidManifest.xml
This commit is contained in:
Gagan290
2017-01-12 13:04:42 +05:30
parent 9384adeec3
commit 2b7f9fe882
6 changed files with 337 additions and 169 deletions
@@ -18,6 +18,7 @@ import cpm.com.gskmtorange.GetterSetter.StoreBean;
import cpm.com.gskmtorange.xmlGetterSetter.CategoryWisePerformaceGetterSetter;
import cpm.com.gskmtorange.GetterSetter.AdditionalDialogGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MAPPING_PLANOGRAM_MasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.NonWorkingReasonGetterSetter;
import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.xmlGetterSetter.BrandMasterGetterSetter;
@@ -50,8 +51,8 @@ import cpm.com.gskmtorange.xmlGetterSetter.TableBean;
public class GSKOrangeDB extends SQLiteOpenHelper {
public static final String DATABASE_NAME = "GSK_ORANGE";
public static final int DATABASE_VERSION = 13;
private SQLiteDatabase db;
TableBean tableBean;
private SQLiteDatabase db;
public GSKOrangeDB(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
@@ -110,6 +111,8 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
db.execSQL(CommonString.CREATE_TABLE_INSERT_T2P_COMPLIANCE);
db.execSQL(CommonString.CREATE_TABLE_INSERT_T2P_GAPS);
db.execSQL(CommonString.CREATE_TABLE_INSERT_T2P_SKU);
db.execSQL(TableBean.getMappingPlanogram());
}
@Override
@@ -2544,4 +2547,27 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
return list;
}
//Gagan start new code 2
public void InsertMAPPING_PLANOGRAM(MAPPING_PLANOGRAM_MasterGetterSetter data) {
db.delete("MAPPING_PLANOGRAM", null, null);
ContentValues values = new ContentValues();
try {
for (int i = 0; i < data.getKEYACCOUNT_ID().size(); i++) {
values.put("KEYACCOUNT_ID", data.getKEYACCOUNT_ID().get(i));
values.put("STORETYPE_ID", data.getSTORETYPE_ID().get(i));
values.put("CLASS_ID", data.getCLASS_ID().get(i));
values.put("PLANOGRAM_IMAGE", data.getPLANOGRAM_IMAGE().get(i));
values.put("IMAGE_PATH", data.getIMAGE_PATH().get(i));
db.insert("MAPPING_PLANOGRAM", null, values);
}
} catch (Exception ex) {
Log.d("Exception ", " MAPPING_PLANOGRAM " + ex.toString());
}
}
//Gagan end new code 2
}
@@ -35,6 +35,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.DisplayMasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.JourneyPlanGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MAPPINGT2PGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MAPPING_ADDITIONAL_PROMOTION_MasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MAPPING_PLANOGRAM_MasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MappingDisplayChecklistGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MappingPromotionGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MappingStockGetterSetter;
@@ -47,15 +48,10 @@ import cpm.com.gskmtorange.xmlHandlers.XMLHandlers;
public class DownloadActivity extends AppCompatActivity {
private Dialog dialog;
private ProgressBar pb;
private TextView percentage, message;
Data data;
int eventType;
GSKOrangeDB db;
private SharedPreferences preferences = null;
String userId, culture_id;
JourneyPlanGetterSetter jcpgettersetter;
SkuMasterGetterSetter skumastergettersetter;
BrandMasterGetterSetter brandMasterGetterSetter;
@@ -70,6 +66,11 @@ public class DownloadActivity extends AppCompatActivity {
MappingPromotionGetterSetter mappingPromotionGetterSetter;
MAPPING_ADDITIONAL_PROMOTION_MasterGetterSetter mapping_additional_promotion_masterGetterSetter;
STORE_PERFORMANCE_MasterGetterSetter store_performance_masterGetterSetter;
MAPPING_PLANOGRAM_MasterGetterSetter mapping_planogram_masterGetterSetter;
private Dialog dialog;
private ProgressBar pb;
private TextView percentage, message;
private SharedPreferences preferences = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -84,6 +85,24 @@ public class DownloadActivity extends AppCompatActivity {
new UploadTask(DownloadActivity.this).execute();
}
public void showAlert(String str) {
AlertDialog.Builder builder = new AlertDialog.Builder(DownloadActivity.this);
builder.setTitle("Parinaam");
builder.setMessage(str).setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
/* Intent i = new Intent(activity, StorelistActivity.class);
activity.startActivity(i);
activity.finish();*/
}
});
AlertDialog alert = builder.create();
alert.show();
}
class Data {
int value;
String name;
@@ -137,7 +156,7 @@ public class DownloadActivity extends AppCompatActivity {
HttpTransportSE androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
Object result = (Object) envelope.getResponse();
Object result = envelope.getResponse();
if (result.toString() != null) {
//InputStream stream = new ByteArrayInputStream(result.toString().getBytes("UTF-8"));
@@ -177,7 +196,7 @@ public class DownloadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse();
result = envelope.getResponse();
if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString()));
@@ -213,7 +232,7 @@ public class DownloadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse();
result = envelope.getResponse();
if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString()));
@@ -249,7 +268,7 @@ public class DownloadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse();
result = envelope.getResponse();
if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString()));
@@ -284,7 +303,7 @@ public class DownloadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse();
result = envelope.getResponse();
if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString()));
@@ -319,7 +338,7 @@ public class DownloadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse();
result = envelope.getResponse();
if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString()));
@@ -354,7 +373,7 @@ public class DownloadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse();
result = envelope.getResponse();
if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString()));
@@ -389,7 +408,7 @@ public class DownloadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse();
result = envelope.getResponse();
if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString()));
@@ -423,7 +442,7 @@ public class DownloadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse();
result = envelope.getResponse();
if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString()));
@@ -457,7 +476,7 @@ public class DownloadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse();
result = envelope.getResponse();
if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString()));
@@ -492,7 +511,7 @@ public class DownloadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse();
result = envelope.getResponse();
if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString()));
@@ -527,7 +546,7 @@ public class DownloadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse();
result = envelope.getResponse();
if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString()));
@@ -564,7 +583,7 @@ public class DownloadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse();
result = envelope.getResponse();
if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString()));
@@ -600,7 +619,7 @@ public class DownloadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = (Object) envelope.getResponse();
result = envelope.getResponse();
if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString()));
@@ -623,6 +642,42 @@ public class DownloadActivity extends AppCompatActivity {
publishProgress(data);
//MAPPING_PLANOGRAM
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_NAME_UNIVERSAL_DOWNLOAD);
request.addProperty("UserName", userId);
request.addProperty("Type", "MAPPING_PLANOGRAM");
request.addProperty("cultureid", culture_id);
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UNIVERSAL, envelope);
result = envelope.getResponse();
if (result.toString() != null) {
xpp.setInput(new StringReader(result.toString()));
xpp.next();
eventType = xpp.getEventType();
mapping_planogram_masterGetterSetter = XMLHandlers.MAPPING_PLANOGRAM_XMLHandler(xpp, eventType);
if (mapping_planogram_masterGetterSetter.getKEYACCOUNT_ID().size() > 0) {
String table_mapping_planogram = mapping_planogram_masterGetterSetter.getTable_MAPPING_PLANOGRAM();
if (table_mapping_planogram != null) {
resultHttp = CommonString.KEY_SUCCESS;
TableBean.setMappingPlanogram(table_mapping_planogram);
}
} else {
//return "MAPPING_PLANOGRAM";
}
data.value = 100;
data.name = "MAPPING_PLANOGRAM Data Download";
}
publishProgress(data);
//Gagan end code
@@ -645,6 +700,7 @@ public class DownloadActivity extends AppCompatActivity {
db.insertNonWorkingData(nonWorkingReasonGetterSetter);
db.InsertSTORE_PERFORMANCE(store_performance_masterGetterSetter);
db.InsertMAPPING_PLANOGRAM(mapping_planogram_masterGetterSetter);
} catch (MalformedURLException e) {
/*final AlertMessage message = new AlertMessage(
@@ -704,22 +760,4 @@ public class DownloadActivity extends AppCompatActivity {
}
}
public void showAlert(String str) {
AlertDialog.Builder builder = new AlertDialog.Builder(DownloadActivity.this);
builder.setTitle("Parinaam");
builder.setMessage(str).setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
/* Intent i = new Intent(activity, StorelistActivity.class);
activity.startActivity(i);
activity.finish();*/
}
});
AlertDialog alert = builder.create();
alert.show();
}
}
@@ -45,31 +45,27 @@ import cpm.com.gskmtorange.xmlHandlers.FailureXMLHandler;
public class UploadActivity extends AppCompatActivity {
private Dialog dialog;
private ProgressBar pb;
private TextView percentage, message;
GSKOrangeDB db;
ArrayList<CoverageBean> coverageList;
private FailureGetterSetter failureGetterSetter = null;
private SharedPreferences preferences;
String date, userId, app_version;
StoreBean storeData;
String datacheck = "";
String[] words;
String validity;
int mid;
private int factor, k = 0;
String errormsg = "", Path;
Data data;
ArrayList<MSL_AvailabilityGetterSetter> msl_availabilityList;
ArrayList<Stock_FacingGetterSetter> stock_facingHeaderList, stock_facingChildList;
ArrayList<Promo_Compliance_DataGetterSetter> promotionSkuList, additionalPromotionList;
ArrayList<AddittionalGetterSetter> additionalVisibilityList;
ArrayList<AddittionalGetterSetter> additionalVisibilityList;
ArrayList<AdditionalDialogGetterSetter> additionalVisibilitySkuList;
private Dialog dialog;
private ProgressBar pb;
private TextView percentage, message;
private FailureGetterSetter failureGetterSetter = null;
private SharedPreferences preferences;
private int factor, k = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -92,6 +88,85 @@ public class UploadActivity extends AppCompatActivity {
new UploadTask(this).execute();
}
public String UploadImage(String path, String folder_name) throws Exception {
errormsg = "";
BitmapFactory.Options o = new BitmapFactory.Options();
o.inJustDecodeBounds = true;
BitmapFactory.decodeFile(Path + path, o);
// The new size we want to scale to
final int REQUIRED_SIZE = 1639;
// Find the correct scale value. It should be the power of 2.
int width_tmp = o.outWidth, height_tmp = o.outHeight;
int scale = 1;
while (true) {
if (width_tmp < REQUIRED_SIZE && height_tmp < REQUIRED_SIZE)
break;
width_tmp /= 2;
height_tmp /= 2;
scale *= 2;
}
// Decode with inSampleSize
BitmapFactory.Options o2 = new BitmapFactory.Options();
o2.inSampleSize = scale;
Bitmap bitmap = BitmapFactory.decodeFile(Path + path, o2);
ByteArrayOutputStream bao = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, bao);
byte[] ba = bao.toByteArray();
String ba1 = Base64.encodeBytes(ba);
SoapObject request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_UPLOAD_IMAGE);
String[] split = path.split("/");
String path1 = split[split.length - 1];
request.addProperty("img", ba1);
request.addProperty("name", path1);
request.addProperty("FolderName", folder_name);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UPLOAD_IMAGE, envelope);
Object result = envelope.getResponse();
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
if (result.toString().equalsIgnoreCase(CommonString.KEY_FALSE)) {
return CommonString.KEY_FALSE;
}
SAXParserFactory saxPF = SAXParserFactory.newInstance();
SAXParser saxP = saxPF.newSAXParser();
XMLReader xmlR = saxP.getXMLReader();
// for failure
FailureXMLHandler failureXMLHandler = new FailureXMLHandler();
xmlR.setContentHandler(failureXMLHandler);
InputSource is = new InputSource();
is.setCharacterStream(new StringReader(result.toString()));
xmlR.parse(is);
failureGetterSetter = failureXMLHandler.getFailureGetterSetter();
if (failureGetterSetter.getStatus().equalsIgnoreCase(CommonString.KEY_FAILURE)) {
errormsg = failureGetterSetter.getErrorMsg();
return CommonString.KEY_FAILURE;
}
} else {
new File(Path + path).delete();
}
return result.toString();
}
class Data {
int value;
String name;
@@ -180,7 +255,7 @@ public class UploadActivity extends AppCompatActivity {
HttpTransportSE androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UPLOAD_STORE_COVERAGE, envelope);
Object result = (Object) envelope.getResponse();
Object result = envelope.getResponse();
datacheck = result.toString();
words = datacheck.split("\\;");
@@ -212,6 +287,7 @@ public class UploadActivity extends AppCompatActivity {
+ "[CATEGORY_ID]" + Integer.parseInt(msl_availabilityList.get(j).getCategory_id()) + "[/CATEGORY_ID]"
+ "[BRAND_ID]" + Integer.parseInt(msl_availabilityList.get(j).getBrand_id()) + "[/BRAND_ID]"
+ "[SKU_ID]" + Integer.parseInt(msl_availabilityList.get(j).getSku_id()) + "[/SKU_ID]"
+ "[MBQ]" + Integer.parseInt(msl_availabilityList.get(j).getMbq()) + "[/MBQ]"
//+ "[SKU]" + msl_availabilityList.get(j).getSku() + "[/SKU]"
+ "[TOGGLE_VALUE]" + Integer.parseInt(msl_availabilityList.get(j).getToggleValue()) + "[/TOGGLE_VALUE]"
+ "[/MSL_AVAILABILITY_DATA]";
@@ -235,7 +311,7 @@ public class UploadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
result = (Object) envelope.getResponse();
result = envelope.getResponse();
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
@@ -304,7 +380,7 @@ public class UploadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
result = (Object) envelope.getResponse();
result = envelope.getResponse();
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
@@ -363,7 +439,7 @@ public class UploadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
result = (Object) envelope.getResponse();
result = envelope.getResponse();
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
@@ -422,7 +498,7 @@ public class UploadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
result = (Object) envelope.getResponse();
result = envelope.getResponse();
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
@@ -440,7 +516,7 @@ public class UploadActivity extends AppCompatActivity {
data.name = "Additional Promotion Data Uploading";
publishProgress(data);
////ashish open
////ashish open
//Additional Visibility Data
String additional_visibility_data_xml = "";
@@ -452,11 +528,11 @@ public class UploadActivity extends AppCompatActivity {
if (additionalVisibilityList.size() > 0) {
for (int J = 0; J < additionalVisibilityList.size(); J++) {
String KeyID = additionalVisibilityList.get(J).getKey_id();
String KeyID = additionalVisibilityList.get(J).getKey_id();
additionalVisibilitySkuList = db.getDialogStock(KeyID);
additionalVisibilitySkuList = db.getDialogStock(KeyID);
for (int k = 0; k < additionalVisibilitySkuList.size(); k++) {
for (int k = 0; k < additionalVisibilitySkuList.size(); k++) {
onXMLdIALOG = "[VISIBILITY_DAILOG]"
@@ -478,34 +554,34 @@ public class UploadActivity extends AppCompatActivity {
+ "[/QUANTITY]"
+ "[/VISIBILITY_DAILOG]";
additional_visibility_dialog_xml = additional_visibility_dialog_xml + onXMLdIALOG;
additional_visibility_dialog_xml = additional_visibility_dialog_xml + onXMLdIALOG;
}
}
onXML = "[ADDITIONAL_VISIBILITY_DATA]"
+ "[MID]" + mid + "[/MID]"
+ "[USER_ID]"
+ userId
+ "[/USER_ID]"
+ "[KEY_ID]"
+ additionalVisibilityList.get(J).getKey_id()
+ "[/KEY_ID]"
+ "[ADDITIONAL_DISPLAY]"
+ additionalVisibilityList.get(J).getBtn_toogle()
+ "[/ADDITIONAL_DISPLAY]"
+ "[BRAND_ID]"
+ additionalVisibilityList.get(J).getBrand_id()
+ "[/BRAND_ID]"
+ "[IMAGE_URL]"
+ additionalVisibilityList.get(J).getImage()
+ "[/IMAGE_URL]"
+ "[DISPLAY_ID]"
+ additionalVisibilityList.get(J).getSku_id()
+ "[/DISPLAY_ID]"
+ "[SKU_LIST]"
+ additional_visibility_dialog_xml
+ "[/SKU_LIST]"
+ "[/ADDITIONAL_VISIBILITY_DATA]";
onXML = "[ADDITIONAL_VISIBILITY_DATA]"
+ "[MID]" + mid + "[/MID]"
+ "[USER_ID]"
+ userId
+ "[/USER_ID]"
+ "[KEY_ID]"
+ additionalVisibilityList.get(J).getKey_id()
+ "[/KEY_ID]"
+ "[ADDITIONAL_DISPLAY]"
+ additionalVisibilityList.get(J).getBtn_toogle()
+ "[/ADDITIONAL_DISPLAY]"
+ "[BRAND_ID]"
+ additionalVisibilityList.get(J).getBrand_id()
+ "[/BRAND_ID]"
+ "[IMAGE_URL]"
+ additionalVisibilityList.get(J).getImage()
+ "[/IMAGE_URL]"
+ "[DISPLAY_ID]"
+ additionalVisibilityList.get(J).getSku_id()
+ "[/DISPLAY_ID]"
+ "[SKU_LIST]"
+ additional_visibility_dialog_xml
+ "[/SKU_LIST]"
+ "[/ADDITIONAL_VISIBILITY_DATA]";
additional_visibility_data_xml = additional_visibility_data_xml + onXML;
@@ -526,7 +602,7 @@ public class UploadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
result = (Object) envelope.getResponse();
result = envelope.getResponse();
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
@@ -545,13 +621,9 @@ public class UploadActivity extends AppCompatActivity {
publishProgress(data);
/////ashish close
//Image Upload
//Stock Facing Images Upload
@@ -626,7 +698,7 @@ public class UploadActivity extends AppCompatActivity {
androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_COVERAGE_STATUS, envelope);
result = (Object) envelope.getResponse();
result = envelope.getResponse();
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
return CommonString.METHOD_UPLOAD_COVERAGE_STATUS;
@@ -669,83 +741,4 @@ public class UploadActivity extends AppCompatActivity {
}
}
}
public String UploadImage(String path, String folder_name) throws Exception {
errormsg = "";
BitmapFactory.Options o = new BitmapFactory.Options();
o.inJustDecodeBounds = true;
BitmapFactory.decodeFile(Path + path, o);
// The new size we want to scale to
final int REQUIRED_SIZE = 1639;
// Find the correct scale value. It should be the power of 2.
int width_tmp = o.outWidth, height_tmp = o.outHeight;
int scale = 1;
while (true) {
if (width_tmp < REQUIRED_SIZE && height_tmp < REQUIRED_SIZE)
break;
width_tmp /= 2;
height_tmp /= 2;
scale *= 2;
}
// Decode with inSampleSize
BitmapFactory.Options o2 = new BitmapFactory.Options();
o2.inSampleSize = scale;
Bitmap bitmap = BitmapFactory.decodeFile(Path + path, o2);
ByteArrayOutputStream bao = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, bao);
byte[] ba = bao.toByteArray();
String ba1 = Base64.encodeBytes(ba);
SoapObject request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_UPLOAD_IMAGE);
String[] split = path.split("/");
String path1 = split[split.length - 1];
request.addProperty("img", ba1);
request.addProperty("name", path1);
request.addProperty("FolderName", folder_name);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(CommonString.URL);
androidHttpTransport.call(CommonString.SOAP_ACTION_UPLOAD_IMAGE, envelope);
Object result = (Object) envelope.getResponse();
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
if (result.toString().equalsIgnoreCase(CommonString.KEY_FALSE)) {
return CommonString.KEY_FALSE;
}
SAXParserFactory saxPF = SAXParserFactory.newInstance();
SAXParser saxP = saxPF.newSAXParser();
XMLReader xmlR = saxP.getXMLReader();
// for failure
FailureXMLHandler failureXMLHandler = new FailureXMLHandler();
xmlR.setContentHandler(failureXMLHandler);
InputSource is = new InputSource();
is.setCharacterStream(new StringReader(result.toString()));
xmlR.parse(is);
failureGetterSetter = failureXMLHandler.getFailureGetterSetter();
if (failureGetterSetter.getStatus().equalsIgnoreCase(CommonString.KEY_FAILURE)) {
errormsg = failureGetterSetter.getErrorMsg();
return CommonString.KEY_FAILURE;
}
} else {
new File(Path + path).delete();
}
return result.toString();
}
}
@@ -0,0 +1,65 @@
package cpm.com.gskmtorange.xmlGetterSetter;
import java.util.ArrayList;
/**
* Created by gagang on 12-01-2017.
*/
public class MAPPING_PLANOGRAM_MasterGetterSetter {
String table_MAPPING_PLANOGRAM;
ArrayList<String> KEYACCOUNT_ID = new ArrayList<>();
ArrayList<String> STORETYPE_ID = new ArrayList<>();
ArrayList<String> CLASS_ID = new ArrayList<>();
ArrayList<String> PLANOGRAM_IMAGE = new ArrayList<>();
ArrayList<String> IMAGE_PATH = new ArrayList<>();
public String getTable_MAPPING_PLANOGRAM() {
return table_MAPPING_PLANOGRAM;
}
public void setTable_MAPPING_PLANOGRAM(String table_MAPPING_PLANOGRAM) {
this.table_MAPPING_PLANOGRAM = table_MAPPING_PLANOGRAM;
}
public ArrayList<String> getKEYACCOUNT_ID() {
return KEYACCOUNT_ID;
}
public void setKEYACCOUNT_ID(String KEYACCOUNT_ID) {
this.KEYACCOUNT_ID.add(KEYACCOUNT_ID);
}
public ArrayList<String> getSTORETYPE_ID() {
return STORETYPE_ID;
}
public void setSTORETYPE_ID(String STORETYPE_ID) {
this.STORETYPE_ID.add(STORETYPE_ID);
}
public ArrayList<String> getCLASS_ID() {
return CLASS_ID;
}
public void setCLASS_ID(String CLASS_ID) {
this.CLASS_ID.add(CLASS_ID);
}
public ArrayList<String> getPLANOGRAM_IMAGE() {
return PLANOGRAM_IMAGE;
}
public void setPLANOGRAM_IMAGE(String PLANOGRAM_IMAGE) {
this.PLANOGRAM_IMAGE.add(PLANOGRAM_IMAGE);
}
public ArrayList<String> getIMAGE_PATH() {
return IMAGE_PATH;
}
public void setIMAGE_PATH(String IMAGE_PATH) {
this.IMAGE_PATH.add(IMAGE_PATH);
}
}
@@ -22,6 +22,7 @@ public class TableBean {
//Gagan start code
public static String MAPPING_ADDITIONAL_PROMOTION;
public static String STORE_PERFORMANCE;
public static String MAPPING_PLANOGRAM;
//Gagan end code
@@ -139,5 +140,13 @@ public class TableBean {
STORE_PERFORMANCE = storePerformance;
}
public static String getMappingPlanogram() {
return MAPPING_PLANOGRAM;
}
public static void setMappingPlanogram(String mappingPlanogram) {
MAPPING_PLANOGRAM = mappingPlanogram;
}
//Gagan end code
}
@@ -14,6 +14,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.JourneyPlanGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.LoginGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MAPPINGT2PGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MAPPING_ADDITIONAL_PROMOTION_MasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MAPPING_PLANOGRAM_MasterGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MappingDisplayChecklistGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MappingPromotionGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.MappingStockGetterSetter;
@@ -670,5 +671,41 @@ public class XMLHandlers {
}
return st;
}
public static MAPPING_PLANOGRAM_MasterGetterSetter MAPPING_PLANOGRAM_XMLHandler(XmlPullParser xpp, int eventType) {
MAPPING_PLANOGRAM_MasterGetterSetter st = new MAPPING_PLANOGRAM_MasterGetterSetter();
try {
while (xpp.getEventType() != XmlPullParser.END_DOCUMENT) {
if (xpp.getEventType() == XmlPullParser.START_TAG) {
if (xpp.getName().equals("META_DATA")) {
st.setTable_MAPPING_PLANOGRAM(xpp.nextText());
}
if (xpp.getName().equals("KEYACCOUNT_ID")) {
st.setKEYACCOUNT_ID(xpp.nextText());
}
if (xpp.getName().equals("STORETYPE_ID")) {
st.setSTORETYPE_ID(xpp.nextText());
}
if (xpp.getName().equals("CLASS_ID")) {
st.setCLASS_ID(xpp.nextText());
}
if (xpp.getName().equals("PLANOGRAM_IMAGE")) {
st.setPLANOGRAM_IMAGE(xpp.nextText());
}
if (xpp.getName().equals("IMAGE_PATH")) {
st.setIMAGE_PATH(xpp.nextText());
}
}
xpp.next();
}
} catch (XmlPullParserException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return st;
}
//Gagan End Code
}