//PromoCompliance Default Toggle Changes
This commit is contained in:
@@ -132,6 +132,9 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
db.execSQL(TableBean.getMappingSosTarget());
|
||||
|
||||
db.execSQL(TableBean.getShelfMaster());
|
||||
|
||||
db.execSQL(CommonString.CREATE_TABLE_INSERT_STOCK_FACING_PLANOGRAM_TRACKER_HEADER);
|
||||
db.execSQL(CommonString.CREATE_TABLE_INSERT_STOCK_FACING_PLANOGRAM_TRACKER_CHILD);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
Toast.makeText(context, "Error -" + e.toString(), Toast.LENGTH_SHORT).show();
|
||||
@@ -182,6 +185,8 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
|
||||
db.delete(CommonString.TABLE_INSERT_T2P_COMPLIANCE, null, null);
|
||||
|
||||
db.delete(CommonString.TABLE_INSERT_STOCK_FACING_PLANOGRAM_TRACKER_HEADER, null, null);
|
||||
db.delete(CommonString.TABLE_INSERT_STOCK_FACING_PLANOGRAM_TRACKER_CHILD, null, null);
|
||||
}
|
||||
|
||||
public void InsertJCP(JourneyPlanGetterSetter data) {
|
||||
@@ -3550,6 +3555,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
}
|
||||
}
|
||||
|
||||
//Stock Facing Planogram Tracker
|
||||
public void InsertSHELF_MASTER(ShelfMasterGetterSetter data) {
|
||||
db.delete("SHELF_MASTER", null, null);
|
||||
|
||||
@@ -3647,4 +3653,86 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public void InsertStock_Facing_PlanogramTracker(String storeId, String categoryId, String company_id, String brand_id, String sub_category_id,
|
||||
List<StockFacing_PlanogramTrackerDataGetterSetter> hashMapListHeaderData,
|
||||
HashMap<StockFacing_PlanogramTrackerDataGetterSetter, List<StockFacing_PlanogramTrackerDataGetterSetter>> hashMapListChildData) {
|
||||
ContentValues values = new ContentValues();
|
||||
ContentValues values1 = new ContentValues();
|
||||
|
||||
try {
|
||||
db.beginTransaction();
|
||||
for (int i = 0; i < hashMapListHeaderData.size(); i++) {
|
||||
StockFacing_PlanogramTrackerDataGetterSetter data1 = hashMapListHeaderData.get(i);
|
||||
|
||||
values1.put("store_id", storeId);
|
||||
values1.put("category_id", categoryId);
|
||||
values1.put("company_id", company_id);
|
||||
values1.put("brand_id", brand_id);
|
||||
values1.put("sub_category_id", sub_category_id);
|
||||
values1.put("Shelf", data1.getSp_addShelf());
|
||||
values1.put("Shelf_id", data1.getSp_addShelf_id());
|
||||
values1.put("Shelf_Position", data1.getSp_shelfPosition());
|
||||
|
||||
long pos = db.insert(CommonString.TABLE_INSERT_STOCK_FACING_PLANOGRAM_TRACKER_HEADER, null, values1);
|
||||
|
||||
for (int j = 0; j < hashMapListChildData.get(hashMapListHeaderData.get(i)).size(); j++) {
|
||||
StockFacing_PlanogramTrackerDataGetterSetter data = hashMapListChildData.get(hashMapListHeaderData.get(i)).get(j);
|
||||
|
||||
values.put("common_id", pos);
|
||||
values.put("Shelf", data1.getSp_addShelf());
|
||||
values.put("Shelf_id", data.getSp_addShelf_id());
|
||||
values.put("Shelf_Position", data1.getSp_shelfPosition());
|
||||
values.put("sku", data.getSku());
|
||||
values.put("sku_id", data.getSku_id());
|
||||
values.put("checkbox_sku", data.getCheckbox_sku());
|
||||
|
||||
db.insert(CommonString.TABLE_INSERT_STOCK_FACING_PLANOGRAM_TRACKER_CHILD, null, values);
|
||||
}
|
||||
}
|
||||
db.setTransactionSuccessful();
|
||||
db.endTransaction();
|
||||
} catch (Exception ex) {
|
||||
Log.d("Exception ", " in Insert Stock Facing Planogram Tracker " + ex.toString());
|
||||
}
|
||||
}
|
||||
|
||||
//Stock Facing Planogram Server Upload Data
|
||||
public ArrayList<StockFacing_PlanogramTrackerDataGetterSetter> getStockAndFacingPlanogramServerUploadData(String store_id) {
|
||||
ArrayList<StockFacing_PlanogramTrackerDataGetterSetter> list = new ArrayList<>();
|
||||
Cursor dbcursor = null;
|
||||
|
||||
try {
|
||||
dbcursor = db.rawQuery("Select C.Shelf_id,C.Shelf_Position,C.sku_id,C.checkbox_sku,H.category_id,H.company_id,H.brand_id,H.sub_category_id " +
|
||||
"from Stock_Facing_Planogram_Header_Data H " +
|
||||
"inner join Stock_Facing_Planogram_Child_Data C " +
|
||||
"on H.KEY_ID=C.common_id AND H.Shelf_id=C.Shelf_id " +
|
||||
"where H.store_id='" + store_id + "'", null);
|
||||
|
||||
if (dbcursor != null) {
|
||||
dbcursor.moveToFirst();
|
||||
while (!dbcursor.isAfterLast()) {
|
||||
StockFacing_PlanogramTrackerDataGetterSetter cd = new StockFacing_PlanogramTrackerDataGetterSetter();
|
||||
|
||||
cd.setSp_addShelf_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("Shelf_id")));
|
||||
cd.setSp_shelfPosition(dbcursor.getString(dbcursor.getColumnIndexOrThrow("Shelf_Position")));
|
||||
cd.setSku_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("sku_id")));
|
||||
cd.setCheckbox_sku(dbcursor.getString(dbcursor.getColumnIndexOrThrow("checkbox_sku")));
|
||||
cd.setCategory_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("category_id")));
|
||||
cd.setCompany_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("company_id")));
|
||||
cd.setBrand_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("brand_id")));
|
||||
cd.setSub_category_id(dbcursor.getString(dbcursor.getColumnIndexOrThrow("sub_category_id")));
|
||||
|
||||
list.add(cd);
|
||||
dbcursor.moveToNext();
|
||||
}
|
||||
dbcursor.close();
|
||||
return list;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d("Exception ", "get Stock Facing Planogram server upload !" + e.toString());
|
||||
return list;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -550,4 +550,69 @@ public class CommonString {
|
||||
+ KEY_SKU + " VARCHAR"
|
||||
+ ")";
|
||||
|
||||
|
||||
public static final String TABLE_INSERT_STOCK_FACING_PLANOGRAM_TRACKER_HEADER = "Stock_Facing_Planogram_Header_Data";
|
||||
|
||||
public static final String CREATE_TABLE_INSERT_STOCK_FACING_PLANOGRAM_TRACKER_HEADER = "CREATE TABLE IF NOT EXISTS "
|
||||
+ TABLE_INSERT_STOCK_FACING_PLANOGRAM_TRACKER_HEADER
|
||||
+ "("
|
||||
+ "KEY_ID"
|
||||
+ " INTEGER PRIMARY KEY AUTOINCREMENT ,"
|
||||
|
||||
+ "store_id"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "category_id"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "company_id"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "brand_id"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "sub_category_id"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "Shelf"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "Shelf_id"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "Shelf_Position"
|
||||
+ " VARCHAR"
|
||||
|
||||
+ ")";
|
||||
|
||||
public static final String TABLE_INSERT_STOCK_FACING_PLANOGRAM_TRACKER_CHILD = "Stock_Facing_Planogram_Child_Data";
|
||||
|
||||
public static final String CREATE_TABLE_INSERT_STOCK_FACING_PLANOGRAM_TRACKER_CHILD = "CREATE TABLE IF NOT EXISTS "
|
||||
+ TABLE_INSERT_STOCK_FACING_PLANOGRAM_TRACKER_CHILD
|
||||
+ "("
|
||||
+ "KEY_ID"
|
||||
+ " INTEGER PRIMARY KEY AUTOINCREMENT ,"
|
||||
|
||||
+ "common_id"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "Shelf"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "Shelf_id"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "Shelf_Position"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "sku"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "sku_id"
|
||||
+ " VARCHAR,"
|
||||
|
||||
+ "checkbox_sku"
|
||||
+ " VARCHAR"
|
||||
|
||||
+ ")";
|
||||
}
|
||||
|
||||
+193
-35
@@ -6,7 +6,10 @@ import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
@@ -17,10 +20,13 @@ import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.CardView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
@@ -36,6 +42,7 @@ import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -43,6 +50,7 @@ import java.util.List;
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB;
|
||||
import cpm.com.gskmtorange.R;
|
||||
import cpm.com.gskmtorange.constant.CommonString;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MAPPING_PLANOGRAM_DataGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.StockFacing_PlanogramTrackerDataGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.Stock_FacingGetterSetter;
|
||||
|
||||
@@ -56,8 +64,11 @@ public class StockFacing_PlanogramTrackerActivity extends AppCompatActivity {
|
||||
GSKOrangeDB db;
|
||||
PlanogramExpandableListAdapter adapter;
|
||||
String categoryName, categoryId, Error_Message = "";
|
||||
boolean checkflag = true;
|
||||
|
||||
List<Integer> checkHeaderArray = new ArrayList<>();
|
||||
ArrayList<StockFacing_PlanogramTrackerDataGetterSetter> headerDataList = new ArrayList<>();
|
||||
ArrayList<StockFacing_PlanogramTrackerDataGetterSetter> tempHeaderDataList;
|
||||
ArrayList<StockFacing_PlanogramTrackerDataGetterSetter> childDataList, tempChildDataList;
|
||||
HashMap<StockFacing_PlanogramTrackerDataGetterSetter, List<StockFacing_PlanogramTrackerDataGetterSetter>> hashMapListChildData = new HashMap<>();
|
||||
|
||||
@@ -72,6 +83,8 @@ public class StockFacing_PlanogramTrackerActivity extends AppCompatActivity {
|
||||
try {
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setHomeButtonEnabled(true);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
db = new GSKOrangeDB(this);
|
||||
db.open();
|
||||
@@ -119,17 +132,6 @@ public class StockFacing_PlanogramTrackerActivity extends AppCompatActivity {
|
||||
shelfAdapter.add(shelfList.get(j).getShelf());
|
||||
}
|
||||
|
||||
//Add Shelf Header Data
|
||||
//prepareHeaderList(headerDataList);
|
||||
|
||||
/*StockFacing_PlanogramTrackerDataGetterSetter sb = new StockFacing_PlanogramTrackerDataGetterSetter();
|
||||
sb.setSp_addShelf_id("1");
|
||||
sb.setSp_addShelf("Shelf1");
|
||||
sb.setSp_shelfPosition("1");
|
||||
|
||||
headerDataList.add(sb);
|
||||
prepareHeaderList(headerDataList);*/
|
||||
|
||||
btn_addShelf.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(final View view1) {
|
||||
@@ -190,13 +192,14 @@ public class StockFacing_PlanogramTrackerActivity extends AppCompatActivity {
|
||||
public void onClick(View view) {
|
||||
|
||||
if (!data.getSp_addShelf_id().equals("0") && !data.getSp_shelfPosition().equals("Select")) {
|
||||
tempHeaderDataList = new ArrayList<>();
|
||||
|
||||
headerDataList.add(data);
|
||||
//tempHeaderDataList.add(data);
|
||||
|
||||
dialog.dismiss();
|
||||
prepareHeaderList(headerDataList);
|
||||
} else {
|
||||
/*Snackbar.make(view1, getResources().getString(R.string.empty_field), Snackbar.LENGTH_LONG)
|
||||
.setAction("Action", null).show();*/
|
||||
Toast.makeText(StockFacing_PlanogramTrackerActivity.this, getResources().getString(R.string.empty_field), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
@@ -211,10 +214,47 @@ public class StockFacing_PlanogramTrackerActivity extends AppCompatActivity {
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
|
||||
.setAction("Action", null).show();
|
||||
/*Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
|
||||
.setAction("Action", null).show();*/
|
||||
|
||||
if (validateData(headerDataList, hashMapListChildData)) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(StockFacing_PlanogramTrackerActivity.this);
|
||||
builder.setMessage(getResources().getString(R.string.check_save_message))
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
|
||||
db.InsertStock_Facing_PlanogramTracker(store_id, categoryId, company_id, brand_id,
|
||||
sub_category_id, headerDataList, hashMapListChildData);
|
||||
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
} else {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(StockFacing_PlanogramTrackerActivity.this);
|
||||
//builder.setMessage(getResources().getString(R.string.empty_field))
|
||||
builder.setMessage(Error_Message)
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
expandableListView.setOnScrollListener(new AbsListView.OnScrollListener() {
|
||||
@Override
|
||||
@@ -225,9 +265,9 @@ public class StockFacing_PlanogramTrackerActivity extends AppCompatActivity {
|
||||
fab.setVisibility(View.VISIBLE);
|
||||
} else if (lastItem == totalItemCount) {
|
||||
fab.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
} /*else {
|
||||
fab.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -324,10 +364,10 @@ public class StockFacing_PlanogramTrackerActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
private void prepareHeaderList(ArrayList<StockFacing_PlanogramTrackerDataGetterSetter> headerDataList) {
|
||||
private void prepareHeaderList(ArrayList<StockFacing_PlanogramTrackerDataGetterSetter> headerDataList1) {
|
||||
try {
|
||||
//Header Data
|
||||
if (headerDataList.size() > 0) {
|
||||
if (headerDataList1.size() > 0) {
|
||||
|
||||
/*for (int i = 0; i < headerDataList.size(); i++) {
|
||||
hashMapListChildData.put(headerDataList.get(i), childDataList);
|
||||
@@ -343,7 +383,7 @@ public class StockFacing_PlanogramTrackerActivity extends AppCompatActivity {
|
||||
}*//*
|
||||
}*/
|
||||
|
||||
adapter = new PlanogramExpandableListAdapter(this, headerDataList, hashMapListChildData);
|
||||
adapter = new PlanogramExpandableListAdapter(this, headerDataList1, hashMapListChildData);
|
||||
expandableListView.setAdapter(adapter);
|
||||
|
||||
if (childDataList != null && childDataList.size() > 0) {
|
||||
@@ -376,7 +416,9 @@ public class StockFacing_PlanogramTrackerActivity extends AppCompatActivity {
|
||||
|
||||
/* adapter = new PlanogramExpandableListAdapter(this, headerDataList, hashMapListChildData);
|
||||
expandableListView.setAdapter(adapter);*/
|
||||
expandableListView.invalidate();
|
||||
|
||||
adapter.notifyDataSetChanged();
|
||||
//expandableListView.invalidate();
|
||||
|
||||
|
||||
if (childDataList != null && childDataList.size() > 0) {
|
||||
@@ -428,6 +470,7 @@ public class StockFacing_PlanogramTrackerActivity extends AppCompatActivity {
|
||||
if (convertView == null) {
|
||||
LayoutInflater infalInflater = (LayoutInflater) _context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
convertView = infalInflater.inflate(R.layout.item_stock_facing_planogram_header, null, false);
|
||||
}
|
||||
|
||||
TextView txt_shelfHeader = (TextView) convertView.findViewById(R.id.txt_shelfHeader);
|
||||
Button btn_addSku = (Button) convertView.findViewById(R.id.btn_addSku);
|
||||
@@ -497,16 +540,40 @@ public class StockFacing_PlanogramTrackerActivity extends AppCompatActivity {
|
||||
/*headerTitle.getShelf_id();
|
||||
childDataList.size();*/
|
||||
|
||||
/*prepareSkuList(childDataList, headerTitle);
|
||||
dialog1.dismiss();*/
|
||||
|
||||
boolean flag = false;
|
||||
for (int i = 0; i < childDataList.size(); i++) {
|
||||
if (childDataList.get(i).getCheckbox_sku().equals("1")) {
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
prepareSkuList(childDataList, headerTitle);
|
||||
dialog1.dismiss();
|
||||
} else {
|
||||
Snackbar.make(view, "Please select atleast one sku", Snackbar.LENGTH_LONG)
|
||||
.setAction("Action", null).show();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
dialog1.show();
|
||||
}
|
||||
});
|
||||
|
||||
if (!checkflag) {
|
||||
if (checkHeaderArray.contains(groupPosition)) {
|
||||
txt_shelfHeader.setTextColor(getResources().getColor(android.R.color.holo_red_dark));
|
||||
} else {
|
||||
txt_shelfHeader.setTextColor(getResources().getColor(R.color.colorPrimaryDark));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return convertView;
|
||||
}
|
||||
|
||||
@@ -529,30 +596,33 @@ public class StockFacing_PlanogramTrackerActivity extends AppCompatActivity {
|
||||
public View getChildView(int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
|
||||
StockFacing_PlanogramTrackerDataGetterSetter childData =
|
||||
(StockFacing_PlanogramTrackerDataGetterSetter) getChild(groupPosition, childPosition);
|
||||
//ViewHolder holder = null;
|
||||
ViewHolder holder = null;
|
||||
|
||||
if (childData != null) {
|
||||
if (convertView == null) {
|
||||
LayoutInflater infalInflater = (LayoutInflater) _context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
convertView = infalInflater.inflate(R.layout.item_stock_facing_planogram_child, null, false);
|
||||
|
||||
//holder = new ViewHolder();
|
||||
TextView txt_skuChild = (TextView) convertView.findViewById(R.id.txt_skuChild);
|
||||
CheckBox checkBox = (CheckBox) convertView.findViewById(R.id.chk_sku);
|
||||
//checkBox.setVisibility(View.GONE);
|
||||
checkBox.setEnabled(false);
|
||||
holder = new ViewHolder();
|
||||
holder.txt_skuChild = (TextView) convertView.findViewById(R.id.txt_skuChild);
|
||||
holder.checkBox = (CheckBox) convertView.findViewById(R.id.chk_sku);
|
||||
|
||||
txt_skuChild.setText(childData.getSku());
|
||||
|
||||
if (childData.getCheckbox_sku().equals("1")) {
|
||||
checkBox.setChecked(true);
|
||||
convertView.setTag(holder);
|
||||
} else {
|
||||
holder = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
|
||||
//holder.checkBox.setVisibility(View.GONE);
|
||||
holder.checkBox.setEnabled(false);
|
||||
|
||||
//convertView.setTag(holder);
|
||||
} /*else {
|
||||
holder = (ViewHolder) convertView.getTag();
|
||||
}*/
|
||||
holder.txt_skuChild.setText(childData.getSku());
|
||||
|
||||
if (childData.getCheckbox_sku().equals("1")) {
|
||||
holder.checkBox.setChecked(true);
|
||||
} else {
|
||||
holder.checkBox.setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
return convertView;
|
||||
}
|
||||
@@ -572,4 +642,92 @@ public class StockFacing_PlanogramTrackerActivity extends AppCompatActivity {
|
||||
TextView txt_skuChild;
|
||||
CheckBox checkBox;
|
||||
}
|
||||
|
||||
boolean validateData(List<StockFacing_PlanogramTrackerDataGetterSetter> listDataHeader,
|
||||
HashMap<StockFacing_PlanogramTrackerDataGetterSetter, List<StockFacing_PlanogramTrackerDataGetterSetter>> listDataChild) {
|
||||
boolean flag = true;
|
||||
checkHeaderArray.clear();
|
||||
|
||||
for (int i = 0; i < listDataHeader.size(); i++) {
|
||||
|
||||
if (listDataChild.get(listDataHeader.get(i)) == null) {
|
||||
if (!checkHeaderArray.contains(i)) {
|
||||
checkHeaderArray.add(i);
|
||||
}
|
||||
|
||||
checkflag = false;
|
||||
Error_Message = "add sku shelf can not be empty";
|
||||
break;
|
||||
} else {
|
||||
if (listDataChild.get(listDataHeader.get(i)).size() <= 0) {
|
||||
if (!checkHeaderArray.contains(i)) {
|
||||
checkHeaderArray.add(i);
|
||||
}
|
||||
|
||||
flag = false;
|
||||
Error_Message = "add sku shelf can not be empty";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag == false) {
|
||||
checkflag = false;
|
||||
break;
|
||||
} else {
|
||||
checkflag = true;
|
||||
}
|
||||
}
|
||||
|
||||
//expListView.invalidate();
|
||||
adapter.notifyDataSetChanged();
|
||||
|
||||
return checkflag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
//super.onBackPressed();
|
||||
|
||||
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(StockFacing_PlanogramTrackerActivity.this);
|
||||
builder.setTitle(getResources().getString(R.string.dialog_title));
|
||||
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
||||
.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
finish();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
}
|
||||
});
|
||||
android.app.AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
int id = item.getItemId();
|
||||
|
||||
if (id == android.R.id.home) {
|
||||
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(StockFacing_PlanogramTrackerActivity.this);
|
||||
builder.setTitle(getResources().getString(R.string.dialog_title));
|
||||
builder.setMessage(getResources().getString(R.string.data_will_be_lost)).setCancelable(false)
|
||||
.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
finish();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
}
|
||||
});
|
||||
android.app.AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.GapsChecklistGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.Promo_Compliance_DataGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.SkuGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.StockFacing_PlanogramTrackerDataGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.Stock_FacingGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlGetterSetter.T2PGetterSetter;
|
||||
import cpm.com.gskmtorange.xmlHandlers.FailureXMLHandler;
|
||||
@@ -79,9 +80,10 @@ public class UploadActivity extends AppCompatActivity {
|
||||
private SharedPreferences preferences;
|
||||
private int factor, k = 0;
|
||||
Object result = "";
|
||||
|
||||
Toolbar toolbar;
|
||||
|
||||
ArrayList<StockFacing_PlanogramTrackerDataGetterSetter> stockFacingPlanogramDataList;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -826,6 +828,64 @@ public class UploadActivity extends AppCompatActivity {
|
||||
data.name = getString(R.string.t2p_data_uploading);
|
||||
publishProgress(data);
|
||||
|
||||
|
||||
String stock_facing_planogram_xml = "";
|
||||
onXML = "";
|
||||
stockFacingPlanogramDataList = db.getStockAndFacingPlanogramServerUploadData(coverageList.get(i).getStoreId());
|
||||
|
||||
if (stockFacingPlanogramDataList.size() > 0) {
|
||||
|
||||
for (int i1 = 0; i1 < stockFacingPlanogramDataList.size(); i1++) {
|
||||
onXML = "[STOCK_FACING_PLANOGRAM_DATA]"
|
||||
+ "[MID]" + mid + "[/MID]"
|
||||
+ "[USER_ID]" + userId + "[/USER_ID]"
|
||||
+ "[SKU_ID]" + Integer.parseInt(stockFacingPlanogramDataList.get(i1).getSku_id()) + "[/SKU_ID]"
|
||||
//+ "[category_id]" + Integer.parseInt(stockFacingPlanogramDataList.get(i1).getCategory_id()) + "[/category_id]"
|
||||
//+ "[company_id]" + Integer.parseInt(stockFacingPlanogramDataList.get(i1).getCompany_id()) + "[/company_id]"
|
||||
//+ "[sub_category_id]" + Integer.parseInt(stockFacingPlanogramDataList.get(i1).getSub_category_id()) + "[/sub_category_id]"
|
||||
+ "[BRAND_ID]" + Integer.parseInt(stockFacingPlanogramDataList.get(i1).getBrand_id()) + "[/BRAND_ID]"
|
||||
+ "[SHELF_ID]" + Integer.parseInt(stockFacingPlanogramDataList.get(i1).getSp_addShelf_id()) + "[/SHELF_ID]"
|
||||
+ "[SHELF_POSITION]" + Integer.parseInt(stockFacingPlanogramDataList.get(i1).getSp_shelfPosition()) + "[/SHELF_POSITION]"
|
||||
+ "[CHECKBOX]" + Integer.parseInt(stockFacingPlanogramDataList.get(i1).getCheckbox_sku()) + "[/CHECKBOX]"
|
||||
+ "[/STOCK_FACING_PLANOGRAM_DATA]";
|
||||
|
||||
stock_facing_planogram_xml = stock_facing_planogram_xml + onXML;
|
||||
}
|
||||
|
||||
final String sos_xml = "[DATA]" + stock_facing_planogram_xml + "[/DATA]";
|
||||
|
||||
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_UPLOAD_STOCK_XML_DATA);
|
||||
request.addProperty("XMLDATA", sos_xml);
|
||||
request.addProperty("KEYS", "STOCK_FACING_PLANOGRAM_DATA");
|
||||
request.addProperty("USERNAME", userId);
|
||||
request.addProperty("MID", mid);
|
||||
|
||||
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
|
||||
result = envelope.getResponse();
|
||||
|
||||
if (!result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
|
||||
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
|
||||
}
|
||||
|
||||
if (result.toString().equalsIgnoreCase(CommonString.KEY_NO_DATA)) {
|
||||
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
|
||||
}
|
||||
|
||||
if (result.toString().equalsIgnoreCase(CommonString.KEY_FAILURE)) {
|
||||
return CommonString.METHOD_UPLOAD_STOCK_XML_DATA;
|
||||
}
|
||||
}
|
||||
data.value = 50;
|
||||
data.name = getString(R.string.stock_planogram_data_uploading);
|
||||
publishProgress(data);
|
||||
|
||||
|
||||
//Image Upload
|
||||
|
||||
//Stock Facing Images Upload
|
||||
|
||||
@@ -29,6 +29,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
app:srcCompat="@android:drawable/ic_dialog_email" />
|
||||
app:srcCompat="@drawable/save_icon" />
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
||||
@@ -270,4 +270,7 @@
|
||||
|
||||
<string name="datanotfound">Data not found in</string>
|
||||
|
||||
<!--Stock Facing Planogram Tracker-->
|
||||
<string name="stock_planogram_data_uploading">Stock Planogram Data Uploading</string>
|
||||
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user