Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
StockAuditEAN
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ramesh Babu Puvvadi
StockAuditEAN
Commits
e542492b
Commit
e542492b
authored
Jul 26, 2024
by
Ramesh Babu Puvvadi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Integrated new apis
parent
ae31de10
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
220 additions
and
159 deletions
+220
-159
Constants.java
app/src/main/java/w/soulofpluto/stockauditean/Constants.java
+2
-3
HomeActivity.java
...c/main/java/w/soulofpluto/stockauditean/HomeActivity.java
+8
-9
MainActivity.java
...c/main/java/w/soulofpluto/stockauditean/MainActivity.java
+34
-33
PlanDetails.java
...rc/main/java/w/soulofpluto/stockauditean/PlanDetails.java
+102
-85
Plans.java
app/src/main/java/w/soulofpluto/stockauditean/Plans.java
+19
-0
SearchByBarcode.java
...ain/java/w/soulofpluto/stockauditean/SearchByBarcode.java
+42
-18
icon1.png
app/src/main/res/drawable-xxhdpi/icon1.png
+0
-0
activity_plandetials.xml
app/src/main/res/layout/activity_plandetials.xml
+10
-8
plansdetails_item.xml
app/src/main/res/layout/plansdetails_item.xml
+3
-3
No files found.
app/src/main/java/w/soulofpluto/stockauditean/Constants.java
View file @
e542492b
...
...
@@ -31,17 +31,16 @@ public class Constants{
//public static String BASE_URL = "http://182.18.167.139/";
//public static String BASE_URL = "http://192.168.34.16/";
public
static
String
BASE_URL
=
"http://posapi.plutokm.com/"
;
//public static String BASE_URL = "http://192.168.34.16/";
public
static
String
MenuBar
=
Constants
.
BASE_URL
+
"/Users/generateUserMenuBarLinksForAndroidApp"
;
public
static
String
Logout
=
Constants
.
BASE_URL
+
"/login/doLogout/"
;
public
static
String
Login
=
Constants
.
BASE_URL
+
"/login/doLogin"
;
public
static
String
StoreId
=
Constants
.
BASE_URL
+
"login/getStoresMappedToUser/"
;
public
static
String
Dashboard
=
Constants
.
BASE_URL
+
"/stockaudit/listOfStockAuditsOfLoginStore"
;
public
static
String
BarcodeUpload
=
Constants
.
BASE_URL
+
"/stockaudit/validateStockAuditBarcode"
;
public
static
String
BarcodeUpload
=
Constants
.
BASE_URL
+
"/stockaudit/validateStockAudit
Ean
Barcode"
;
public
static
String
BarcodeDelete
=
Constants
.
BASE_URL
+
"/stockaudit/deleteBarcodeAndQuantityFromStockAudit"
;
public
static
String
BarcodeComplete
=
Constants
.
BASE_URL
+
"/stockaudit/batchScanningCompleted"
;
public
static
String
RackWiseQty
=
Constants
.
BASE_URL
+
"/stockaudit/stockAuditPlanBarcodesScannedInformation"
;
public
static
String
BarcodeSearch
=
Constants
.
BASE_URL
+
"/stockaudit/stockAudit
BarcodeRackInformation
"
;
public
static
String
BarcodeSearch
=
Constants
.
BASE_URL
+
"/stockaudit/stockAudit
PlanBarcodesScannedInformationWithBarcode
"
;
public
static
String
GenerateSlip
=
Constants
.
BASE_URL
+
"/Sales/generateDeliverySlip"
;
public
static
String
Type
=
"Content-Type"
;
public
static
String
App_json
=
"application/json"
;
...
...
app/src/main/java/w/soulofpluto/stockauditean/HomeActivity.java
View file @
e542492b
...
...
@@ -54,7 +54,7 @@ import static w.soulofpluto.stockauditean.Constants.Logout;
recyclerView
=
findViewById
(
R
.
id
.
menu_list
);
preferenceManager
=
new
PreferenceManager
(
this
);
setSupportActionBar
(
home_toolbar
);
Objects
.
requireNonNull
(
getSupportActionBar
()).
setTitle
(
Html
.
fromHtml
(
" "
+
getResources
().
getString
(
R
.
string
.
home
)));
Objects
.
requireNonNull
(
getSupportActionBar
()).
setTitle
(
Html
.
fromHtml
(
" "
+
getResources
().
getString
(
R
.
string
.
home
)));
version
.
setText
(
Html
.
fromHtml
(
Constants
.
Ver_Text
+
Constants
.
VERSION
));
if
(
Constants
.
isNetworkAvailable
(
HomeActivity
.
this
))
{
setUI
();
...
...
@@ -102,7 +102,6 @@ import static w.soulofpluto.stockauditean.Constants.Logout;
.
addHeader
(
getResources
().
getString
(
R
.
string
.
accesstoken
),
preferenceManager
.
getCustToken
())
.
addHeader
(
getResources
().
getString
(
R
.
string
.
storeidtoken
),
preferenceManager
.
getStoreId
())
.
build
();
client
.
newCall
(
request
).
enqueue
(
new
Callback
(){
@Override
public
void
onFailure
(
Request
request
,
final
IOException
e
){
...
...
@@ -117,15 +116,15 @@ import static w.soulofpluto.stockauditean.Constants.Logout;
Constants
.
ProgressDialogDismiss
();
arrayList
=
new
ArrayList
<>();
final
String
Response
=
response
.
body
().
string
();
Log
.
e
(
"MenuBar Response "
,
Response
);
//
Log.e("MenuBar Response " , Response);
if
(
response
.
code
()
==
200
)
{
final
JSONObject
object
=
new
JSONObject
(
Response
);
if
(
object
.
getInt
(
"success"
)
==
1
)
{
JSONArray
jsonArray
=
object
.
getJSONArray
(
"data"
);
for
(
int
i
=
0
;
i
<
jsonArray
.
length
();
i
++)
{
if
(
jsonArray
.
get
(
i
).
equals
(
"Stock Audit"
))
{
arrayList
.
add
(
jsonArray
.
get
(
i
).
toString
());
}
if
(
jsonArray
.
get
(
i
).
equals
(
"Stock Audit"
))
{
arrayList
.
add
(
jsonArray
.
get
(
i
).
toString
());
}
}
Handler
handler
=
new
Handler
(
Looper
.
getMainLooper
());
handler
.
post
(()
->
{
...
...
@@ -133,11 +132,11 @@ import static w.soulofpluto.stockauditean.Constants.Logout;
MenuAdapter
menuAdapter
=
new
MenuAdapter
(
HomeActivity
.
this
,
arrayList
);
recyclerView
.
setAdapter
(
menuAdapter
);
});
Log
.
e
(
"Size"
,
String
.
valueOf
(
arrayList
.
size
()));
//
Log.e("Size", String.valueOf(arrayList.size()));
}
else
if
(
object
.
getInt
(
"success"
)
==
3
)
{
runOnUiThread
(()
->
{
try
{
Log
.
e
(
"session"
,
object
.
getString
(
"msg"
));
//
Log.e("session", object.getString("msg"));
Constants
.
getToast
(
HomeActivity
.
this
,
object
.
getString
(
"msg"
));
Login
.
Logout
(
HomeActivity
.
this
);
}
catch
(
JSONException
e
)
{
...
...
@@ -145,7 +144,7 @@ import static w.soulofpluto.stockauditean.Constants.Logout;
}
});
}
}
else
{
}
else
{
runOnUiThread
(()
->
Constants
.
getToast
(
HomeActivity
.
this
,
Response
));
}
}
catch
(
NullPointerException
|
JSONException
io
){
...
...
app/src/main/java/w/soulofpluto/stockauditean/MainActivity.java
View file @
e542492b
...
...
@@ -27,6 +27,7 @@ import java.io.IOException;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Objects
;
import
java.util.concurrent.TimeUnit
;
import
static
w
.
soulofpluto
.
stockauditean
.
Constants
.
JSON
;
...
...
@@ -54,11 +55,11 @@ public class MainActivity extends AppCompatActivity {
@Override
protected
void
onStart
()
{
if
(
Constants
.
isNetworkAvailable
(
MainActivity
.
this
))
{
AppUtils
.
deleteCache
(
MainActivity
.
this
);
FetchData
(
Constants
.
Dashboard
);
Constants
.
ProgressDialogShow
(
MainActivity
.
this
);
AppUtils
.
deleteCache
(
MainActivity
.
this
);
FetchData
(
Constants
.
Dashboard
);
Constants
.
ProgressDialogShow
(
MainActivity
.
this
);
}
else
{
Constants
.
getToast
(
MainActivity
.
this
,
getResources
().
getString
(
R
.
string
.
connection
));
Constants
.
getToast
(
MainActivity
.
this
,
getResources
().
getString
(
R
.
string
.
connection
));
}
super
.
onStart
();
}
...
...
@@ -94,11 +95,11 @@ public class MainActivity extends AppCompatActivity {
Login
.
Logout
(
MainActivity
.
this
);
}
else
{
runOnUiThread
(()
->
{
try
{
Constants
.
getToast
(
MainActivity
.
this
,
jsonObject
.
getString
(
getResources
().
getString
(
R
.
string
.
msg
)));
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
try
{
Constants
.
getToast
(
MainActivity
.
this
,
jsonObject
.
getString
(
getResources
().
getString
(
R
.
string
.
msg
)));
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
});
}
}
...
...
@@ -144,10 +145,8 @@ public class MainActivity extends AppCompatActivity {
Date
todayDate
=
new
Date
();
Date
from
=
getDateWithOffset
(-
Constants
.
Value
,
new
Date
());
String
fromDate
=
currentDate
.
format
(
from
);
Log
.
e
(
"From Date"
,
fromDate
);
String
thisDate
=
currentDate
.
format
(
todayDate
);
Log
.
e
(
"Today Date"
,
thisDate
);
object
.
put
(
getResources
().
getString
(
R
.
string
.
auditstatus
),
"In Progress"
);
object
.
put
(
getResources
().
getString
(
R
.
string
.
auditstatus
),
"In Progress"
);
object
.
put
(
getResources
().
getString
(
R
.
string
.
fromdate
),
fromDate
);
object
.
put
(
getResources
().
getString
(
R
.
string
.
todate
),
thisDate
);
object
.
put
(
getResources
().
getString
(
R
.
string
.
android_version
),
Constants
.
VERSION
);
...
...
@@ -191,29 +190,31 @@ public class MainActivity extends AppCompatActivity {
if
(
object1
.
has
(
getResources
().
getString
(
R
.
string
.
data
)))
{
plansArrayList
.
clear
();
JSONArray
jsonArray
=
object1
.
getJSONArray
(
getResources
().
getString
(
R
.
string
.
data
));
if
(
jsonArray
.
length
()>
0
)
{
if
(
jsonArray
.
length
()>
0
)
{
for
(
int
i
=
0
;
i
<
jsonArray
.
length
();
i
++)
{
JSONObject
jsonObject
=
jsonArray
.
getJSONObject
(
i
);
Plans
plans
=
new
Plans
();
plans
.
setPlanId
(
String
.
valueOf
(
jsonObject
.
getInt
(
"id"
)));
plans
.
setName
(
jsonObject
.
getString
(
"stock_audit_name"
));
plans
.
setDivision
(
Constants
.
convertString
(
jsonObject
.
getString
(
"item_divisions"
)));
plans
.
setSection
(
Constants
.
convertString
(
jsonObject
.
getString
(
"item_sections"
)));
plansArrayList
.
add
(
plans
);
Log
.
e
(
"Object Data "
,
jsonObject
.
toString
());
if
(
jsonObject
.
getString
(
"is_ean_stock_audit"
).
equals
(
"Y"
))
{
Plans
plans
=
new
Plans
();
plans
.
setPlanId
(
String
.
valueOf
(
jsonObject
.
getInt
(
"id"
)));
plans
.
setName
(
jsonObject
.
getString
(
"stock_audit_name"
));
plans
.
setDivision
(
Constants
.
convertString
(
jsonObject
.
getString
(
"item_divisions"
)));
plans
.
setSection
(
Constants
.
convertString
(
jsonObject
.
getString
(
"item_sections"
)));
plansArrayList
.
add
(
plans
);
}
}
CustomAdapter
customAdapter
=
new
CustomAdapter
(
MainActivity
.
this
,
plansArrayList
);
plans_list
.
setLayoutManager
(
new
LinearLayoutManager
(
MainActivity
.
this
,
LinearLayoutManager
.
VERTICAL
,
false
));
plans_list
.
setAdapter
(
customAdapter
);
}
else
if
(
object1
.
has
(
getResources
().
getString
(
R
.
string
.
msg
)))
{
runOnUiThread
(()
->
{
try
{
Constants
.
getToast
(
MainActivity
.
this
,
object1
.
getString
(
getResources
().
getString
(
R
.
string
.
msg
)));
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
});
}
else
if
(
object1
.
has
(
getResources
().
getString
(
R
.
string
.
msg
)))
{
runOnUiThread
(()
->
{
try
{
Constants
.
getToast
(
MainActivity
.
this
,
object1
.
getString
(
getResources
().
getString
(
R
.
string
.
msg
)));
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
});
}
}
else
if
(
object1
.
has
(
getResources
().
getString
(
R
.
string
.
msg
)))
{
runOnUiThread
(()
->
{
try
{
...
...
@@ -225,11 +226,11 @@ public class MainActivity extends AppCompatActivity {
}
}
else
if
(
object1
.
getInt
(
getResources
().
getString
(
R
.
string
.
success
))
==
3
)
{
runOnUiThread
(()
->
{
try
{
Constants
.
getToast
(
MainActivity
.
this
,
object1
.
getString
(
getResources
().
getString
(
R
.
string
.
msg
)));
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
try
{
Constants
.
getToast
(
MainActivity
.
this
,
object1
.
getString
(
getResources
().
getString
(
R
.
string
.
msg
)));
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
});
preferenceManager
.
setUserId
(
""
);
preferenceManager
.
setLogged
(
false
);
...
...
app/src/main/java/w/soulofpluto/stockauditean/PlanDetails.java
View file @
e542492b
...
...
@@ -35,6 +35,8 @@ import com.squareup.okhttp.OkHttpClient;
import
com.squareup.okhttp.Request
;
import
com.squareup.okhttp.RequestBody
;
import
com.squareup.okhttp.Response
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.io.IOException
;
...
...
@@ -67,21 +69,25 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
MediaPlayer
mp
;
String
Rack_No
;
public
static
void
start
(
Context
context
,
Plans
plans
,
String
rackNo
){
Intent
in
=
new
Intent
(
context
,
PlanDetails
.
class
);
in
.
putExtra
(
"key"
,
plans
);
in
.
putExtra
(
"rack"
,
rackNo
);
context
.
startActivity
(
in
);
public
static
void
start
(
Context
context
,
Plans
plans
,
String
rackNo
)
{
try
{
Intent
in
=
new
Intent
(
context
,
PlanDetails
.
class
);
in
.
putExtra
(
"key"
,
plans
);
in
.
putExtra
(
"rack"
,
rackNo
);
context
.
startActivity
(
in
);
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
}
}
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
){
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
setContentView
(
R
.
layout
.
activity_plandetials
);
super
.
onCreate
(
savedInstanceState
);
setupdate
();
}
private
void
setupdate
(){
private
void
setupdate
()
{
planDetails_toolbar
=
findViewById
(
R
.
id
.
plandetails_toolbar
);
barcode
=
findViewById
(
R
.
id
.
barcode
);
qty
=
findViewById
(
R
.
id
.
qty
);
...
...
@@ -108,7 +114,7 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
plandetails_name
.
setText
(
Html
.
fromHtml
(
Constants
.
Name
+
plans
.
getName
()));
ScanComplete
.
setOnClickListener
(
this
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
){
barcode
.
setShowSoftInputOnFocus
(
false
);
barcode
.
setShowSoftInputOnFocus
(
false
);
}
barcode
.
addTextChangedListener
(
new
AutoChecked
());
rack_number
.
setText
(
Rack_No
);
...
...
@@ -122,21 +128,19 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
});
}
public
void
PiecesClicked
(
View
view
){
public
void
PiecesClicked
(
View
view
)
{
boolean
checked
=
((
RadioButton
)
view
).
isChecked
();
switch
(
view
.
getId
()){
case
R
.
id
.
pieces
:
if
(
checked
){
status
=
true
;
qty
.
setVisibility
(
View
.
INVISIBLE
);
dummy_qty
.
setVisibility
(
View
.
INVISIBLE
);
barcode
.
setText
(
""
);
}
else
{
status
=
false
;
qty
.
setVisibility
(
View
.
VISIBLE
);
dummy_qty
.
setVisibility
(
View
.
VISIBLE
);
}
break
;
if
(
view
.
getId
()
==
R
.
id
.
pieces
)
{
if
(
checked
)
{
status
=
true
;
qty
.
setVisibility
(
View
.
INVISIBLE
);
dummy_qty
.
setVisibility
(
View
.
INVISIBLE
);
barcode
.
setText
(
""
);
}
else
{
status
=
false
;
qty
.
setVisibility
(
View
.
VISIBLE
);
dummy_qty
.
setVisibility
(
View
.
VISIBLE
);
}
}
}
...
...
@@ -158,78 +162,76 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
@Override
public
boolean
onOptionsItemSelected
(
@NonNull
MenuItem
item
){
switch
(
item
.
getItemId
())
{
case
android
.
R
.
id
.
home
:
finish
();
break
;
if
(
item
.
getItemId
()
==
android
.
R
.
id
.
home
)
{
finish
();
}
return
super
.
onOptionsItemSelected
(
item
);
}
public
class
AutoChecked
implements
TextWatcher
{
public
class
AutoChecked
implements
TextWatcher
{
@Override
public
void
beforeTextChanged
(
CharSequence
charSequence
,
int
i
,
int
i1
,
int
i2
)
{
}
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
N
)
@Override
public
void
onTextChanged
(
CharSequence
val
,
int
i
,
int
i1
,
int
i2
){
public
void
onTextChanged
(
CharSequence
val
,
int
i
,
int
i1
,
int
i2
)
{
try
{
if
(
Constants
.
isNetworkAvailable
(
PlanDetails
.
this
))
{
if
(
val
.
toString
().
contains
(
"\n"
))
{
if
(
status
)
{
if
(
Constants
.
isNetworkAvailable
(
PlanDetails
.
this
))
{
if
(!
arrayList
.
isEmpty
())
{
boolean
itemExistsBasedOnProp
=
arrayList
.
stream
().
map
(
Plans:
:
getBarcode
).
anyMatch
(
barcode
.
getText
().
toString
().
replace
(
"\n"
,
""
)::
equals
);
Log
.
e
(
"Barcode Status ====>"
,
String
.
valueOf
(
itemExistsBasedOnProp
));
if
(
Constants
.
Existing
(
arrayList
,
barcode
.
getText
().
toString
().
replace
(
"\n"
,
""
)))
{
if
(!(
PlanDetails
.
this
).
isFinishing
())
{
getNotification
(
"Already scanned this item"
);
return
;
}
}
}
try
{
if
(
Constants
.
isNetworkAvailable
(
PlanDetails
.
this
))
{
if
(
val
.
toString
().
contains
(
"\n"
))
{
if
(
status
)
{
if
(
Constants
.
isNetworkAvailable
(
PlanDetails
.
this
))
{
// if (!arrayList.isEmpty())
{
//
boolean itemExistsBasedOnProp = arrayList.stream().map(Plans::getBarcode).anyMatch(barcode.getText().toString().replace("\n", "")::equals);
//
Log.e("Barcode Status ====>" , String.valueOf(itemExistsBasedOnProp));
// if(Constants.Existing(arrayList, barcode.getText().toString().replace("\n", "")))
{
//
if(!(PlanDetails.this).isFinishing()) {
//
getNotification("Already scanned this item");
//
return;
//
}
//
}
//
}
try
{
UploadBarcode
(
barcode
.
getText
().
toString
().
replace
(
"\n"
,
""
),
"1"
,
plans
.
getPlanId
());
Constants
.
ProgressDialogShow
(
PlanDetails
.
this
);
barcode
.
setText
(
""
);
}
catch
(
NullPointerException
np
)
{
}
catch
(
NullPointerException
np
)
{
np
.
printStackTrace
();
}
}
else
{
}
else
{
runOnUiThread
(()
->
Constants
.
getToast
(
PlanDetails
.
this
,
getResources
().
getString
(
R
.
string
.
connection
)));
}
}
else
{
if
(
TextUtils
.
isEmpty
(
qty
.
getText
().
toString
()))
{
}
else
{
if
(
TextUtils
.
isEmpty
(
qty
.
getText
().
toString
()))
{
runOnUiThread
(()
->
{
barcode
.
setText
(
""
);
runOnUiThread
(()
->
Constants
.
getToast
(
PlanDetails
.
this
,
"Enter Qty"
));
});
}
else
{
}
else
{
float
value
=
Float
.
parseFloat
(
qty
.
getText
().
toString
());
if
(
value
>
0
){
if
(
Constants
.
isNetworkAvailable
(
PlanDetails
.
this
)){
if
(!
arrayList
.
isEmpty
())
{
if
(
Constants
.
Existing
(
arrayList
,
barcode
.
getText
().
toString
().
replace
(
"\n"
,
""
)))
{
if
(!(
PlanDetails
.
this
).
isFinishing
())
{
getNotification
(
"Already scanned this item"
);
return
;
}
}
}
try
{
if
(
value
>
0
)
{
if
(
Constants
.
isNetworkAvailable
(
PlanDetails
.
this
))
{
//
if(!arrayList.isEmpty()) {
//
if (Constants.Existing(arrayList, barcode.getText().toString().replace("\n", ""))) {
//
if(!(PlanDetails.this).isFinishing()) {
//
getNotification("Already scanned this item");
//
return;
//
}
//
}
//
}
try
{
UploadBarcode
(
barcode
.
getText
().
toString
().
replace
(
"\n"
,
""
),
qty
.
getText
().
toString
(),
plans
.
getPlanId
());
Constants
.
ProgressDialogShow
(
PlanDetails
.
this
);
}
catch
(
NullPointerException
np
)
{
}
catch
(
NullPointerException
np
)
{
np
.
printStackTrace
();
}
}
else
{
}
else
{
runOnUiThread
(()
->
Constants
.
getToast
(
PlanDetails
.
this
,
getResources
().
getString
(
R
.
string
.
connection
)));
}
}
}
}
}
}
else
{
}
else
{
runOnUiThread
(()
->
Constants
.
getToast
(
PlanDetails
.
this
,
getResources
().
getString
(
R
.
string
.
connection
)));
}
}
catch
(
NullPointerException
np
){
...
...
@@ -240,14 +242,15 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
public
void
afterTextChanged
(
Editable
editable
)
{
}
}
@Override
public
void
onClick
(
View
view
){
switch
(
view
.
getId
()){
case
R
.
id
.
ScanComplete
:
if
(
Constants
.
isNetworkAvailable
(
PlanDetails
.
this
)){
if
(
arrayList
.
size
()
>
0
){
if
(
!
arrayList
.
isEmpty
()
){
if
(
Constants
.
isNetworkAvailable
(
PlanDetails
.
this
)){
if
(
rack_number
.
getText
().
toString
().
length
()>
0
){
if
(
!
rack_number
.
getText
().
toString
().
isEmpty
()
){
Constants
.
ProgressDialogShow
(
PlanDetails
.
this
);
UploadAllBarCodes
(
Constants
.
BarcodeComplete
,
rack_number
.
getText
().
toString
());
}
else
{
...
...
@@ -262,7 +265,7 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
}
else
{
runOnUiThread
(()
->
Constants
.
getToast
(
PlanDetails
.
this
,
getResources
().
getString
(
R
.
string
.
connection
)));
}
break
;
break
;
}
}
...
...
@@ -410,6 +413,7 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
object
.
put
(
getResources
().
getString
(
R
.
string
.
rule_id
),
Id
);
object
.
put
(
getResources
().
getString
(
R
.
string
.
quantity_upload
),
qty
);
object
.
put
(
getResources
().
getString
(
R
.
string
.
android_version
),
Constants
.
VERSION
);
object
.
put
(
"stock_audit_type"
,
"initiate"
);
}
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
...
...
@@ -447,26 +451,39 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
if
(
object1
.
has
(
getResources
().
getString
(
R
.
string
.
success
)))
{
if
(
object1
.
getInt
(
getResources
().
getString
(
R
.
string
.
success
))
==
1
){
Log
.
e
(
"Barcode"
,
object1
.
toString
());
barcode
.
requestFocus
();
Plans
plans
=
new
Plans
();
plans
.
setQty
(
qty
);
plans
.
setPlanId
(
Id
);
plans
.
setBarcode
(
Barcode
);
if
(
arrayList
.
size
()
>
0
)
{
plans
.
setColumnId
(
arrayList
.
size
()
+
1
);
}
else
{
plans
.
setColumnId
(
1
);
}
arrayList
.
add
(
plans
);
Collections
.
sort
(
arrayList
,
Plans
.
sortById
);
setUI
(
arrayList
);
if
(
arrayList
.
size
()
>
0
){
runOnUiThread
(()
->
{
planDetailsAdapter
=
new
PlanDetailsAdapter
(
PlanDetails
.
this
,
arrayList
);
barcode_recylerview
.
setLayoutManager
(
new
LinearLayoutManager
(
PlanDetails
.
this
));
barcode_recylerview
.
setAdapter
(
planDetailsAdapter
);
});
JSONArray
dataArray
=
object1
.
getJSONArray
(
"data"
);
if
(
dataArray
.
length
()
>
0
)
{
JSONObject
firstObject
=
dataArray
.
getJSONObject
(
0
);
// Extract the 'our_barcode' value
if
(
firstObject
.
has
(
"our_barcode"
))
{
String
ourBarcode
=
firstObject
.
getString
(
"our_barcode"
);
Log
.
d
(
"Barcode"
,
"Our Barcode: "
+
ourBarcode
);
barcode
.
requestFocus
();
Plans
plans
=
new
Plans
();
plans
.
setQty
(
qty
);
plans
.
setPlanId
(
Id
);
plans
.
setBarcode
(
Barcode
);
plans
.
setOurBarcode
(
ourBarcode
);
if
(!
arrayList
.
isEmpty
())
{
plans
.
setColumnId
(
arrayList
.
size
()
+
1
);
}
else
{
plans
.
setColumnId
(
1
);
}
arrayList
.
add
(
plans
);
Collections
.
sort
(
arrayList
,
Plans
.
sortById
);
setUI
(
arrayList
);
if
(!
arrayList
.
isEmpty
()){
runOnUiThread
(()
->
{
planDetailsAdapter
=
new
PlanDetailsAdapter
(
PlanDetails
.
this
,
arrayList
);
barcode_recylerview
.
setLayoutManager
(
new
LinearLayoutManager
(
PlanDetails
.
this
));
barcode_recylerview
.
setAdapter
(
planDetailsAdapter
);
});
}
}
}
}
else
if
(
object1
.
getInt
(
getResources
().
getString
(
R
.
string
.
success
))
==
3
){
runOnUiThread
(()
->
{
try
{
...
...
@@ -501,7 +518,7 @@ public class PlanDetails extends AppCompatActivity implements View.OnClickListen
final
JSONObject
object
=
new
JSONObject
();
try
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
){
object
.
put
(
getResources
().
getString
(
R
.
string
.
barcode_upload
),
plans
.
getBarcode
());
object
.
put
(
getResources
().
getString
(
R
.
string
.
barcode_upload
),
plans
.
get
Our
Barcode
());
object
.
put
(
getResources
().
getString
(
R
.
string
.
rule_id
),
plans
.
getPlanId
());
object
.
put
(
getResources
().
getString
(
R
.
string
.
quantity_upload
),
plans
.
getQty
());
object
.
put
(
getResources
().
getString
(
R
.
string
.
android_version
),
Constants
.
VERSION
);
...
...
app/src/main/java/w/soulofpluto/stockauditean/Plans.java
View file @
e542492b
...
...
@@ -16,6 +16,7 @@ public class Plans implements Parcelable {
String
division
;
String
Barcode
;
String
Qty
;
String
OurBarcode
;
int
ColumnId
;
public
int
getColumnId
()
{
...
...
@@ -26,6 +27,22 @@ public class Plans implements Parcelable {
ColumnId
=
columnId
;
}
public
String
getOurBarcode
()
{
return
OurBarcode
;
}
public
void
setOurBarcode
(
String
ourBarcode
)
{
OurBarcode
=
ourBarcode
;
}
public
static
Comparator
<
Plans
>
getSortById
()
{
return
sortById
;
}
public
static
void
setSortById
(
Comparator
<
Plans
>
sortById
)
{
Plans
.
sortById
=
sortById
;
}
protected
Plans
(
Parcel
in
)
{
PlanId
=
in
.
readString
();
Name
=
in
.
readString
();
...
...
@@ -34,6 +51,7 @@ public class Plans implements Parcelable {
Barcode
=
in
.
readString
();
Qty
=
in
.
readString
();
ColumnId
=
in
.
readInt
();
OurBarcode
=
in
.
readString
();
}
public
static
final
Creator
<
Plans
>
CREATOR
=
new
Creator
<
Plans
>()
{
...
...
@@ -94,6 +112,7 @@ public class Plans implements Parcelable {
return
Qty
;
}
public
void
setQty
(
String
qty
)
{
Qty
=
qty
;
}
...
...
app/src/main/java/w/soulofpluto/stockauditean/SearchByBarcode.java
View file @
e542492b
package
w
.
soulofpluto
.
stockauditean
;
import
android.annotation.SuppressLint
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Handler
;
...
...
@@ -84,8 +85,10 @@ import static w.soulofpluto.stockauditean.Constants.getDateWithOffset;
try
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
){
object
.
put
(
getResources
().
getString
(
R
.
string
.
plan_id
),
planId
);
object
.
put
(
getResources
().
getString
(
R
.
string
.
barcode_upload
),
Barcode
);
object
.
put
(
getResources
().
getString
(
R
.
string
.
android_version
),
Constants
.
VERSION
);
object
.
put
(
"search_barcode"
,
Barcode
);
//object.put(getResources().getString(R.string.android_version),Constants.VERSION);
}
}
catch
(
JSONException
e
){
e
.
printStackTrace
();
...
...
@@ -99,7 +102,7 @@ import static w.soulofpluto.stockauditean.Constants.getDateWithOffset;
Request
request
=
new
Request
.
Builder
()
.
url
(
Constants
.
BarcodeSearch
)
.
post
(
body
)
.
addHeader
(
Constants
.
Type
,
Constants
.
App_json
)
.
addHeader
(
Constants
.
Type
,
Constants
.
App_json
)
.
addHeader
(
getResources
().
getString
(
R
.
string
.
accesstoken
),
preferenceManager
.
getCustToken
())
.
addHeader
(
getResources
().
getString
(
R
.
string
.
storeidtoken
),
preferenceManager
.
getStoreId
())
.
build
();
...
...
@@ -111,6 +114,7 @@ import static w.soulofpluto.stockauditean.Constants.getDateWithOffset;
Constants
.
ProgressDialogDismiss
();
});
}
@SuppressLint
(
"SetTextI18n"
)
@Override
public
void
onResponse
(
final
com
.
squareup
.
okhttp
.
Response
response
)
throws
IOException
{
try
{
...
...
@@ -127,17 +131,37 @@ import static w.soulofpluto.stockauditean.Constants.getDateWithOffset;
Log
.
e
(
"Length"
,
String
.
valueOf
(
getResources
().
getString
(
R
.
string
.
data
).
length
()));
if
(
object1
.
has
(
getResources
().
getString
(
R
.
string
.
data
))){
if
(
object1
.
getString
(
getResources
().
getString
(
R
.
string
.
msg
)).
equalsIgnoreCase
(
"no data found"
)){
searchBy_barcode
.
setText
(
""
);
searchByBarcode_rack
.
setText
(
object1
.
getString
(
getResources
().
getString
(
R
.
string
.
msg
)));
searchBy_barcode
.
setText
(
""
);
searchByBarcode_rack
.
setText
(
object1
.
getString
(
getResources
().
getString
(
R
.
string
.
msg
)));
//Constants.getToast(SearchByBarcode.this, object.getString(getResources().getString(R.string.msg)));
}
else
{
searchBy_barcode
.
setText
(
""
);
searchBy_barcode
.
setText
(
""
);
try
{
JSONObject
jsonObject
=
object1
.
getJSONObject
(
getResources
().
getString
(
R
.
string
.
data
));
searchByBarcode_rack
.
setText
(
Html
.
fromHtml
(
Constants
.
Id
)
+
jsonObject
.
getString
(
"rack_id"
)
+
"\n"
+
(
Html
.
fromHtml
(
Constants
.
Barcode
)
+
jsonObject
.
getString
(
"barcode"
))
+
"\n"
+
(
Html
.
fromHtml
(
Constants
.
From
)
+
jsonObject
.
getString
(
"scanning_start_at"
))
+
"\n"
+
(
Html
.
fromHtml
(
Constants
.
To
)
+
jsonObject
.
getString
(
"scanning_end_at"
)));
JSONObject
jsonObject
=
object1
.
getJSONObject
(
getResources
().
getString
(
R
.
string
.
data
));
if
(
jsonObject
.
has
(
"rack_info"
))
{
JSONArray
rackInfoArray
=
jsonObject
.
getJSONArray
(
"rack_info"
);
if
(
rackInfoArray
.
length
()
>
0
)
{
StringBuilder
rackInfoBuilder
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
rackInfoArray
.
length
();
i
++)
{
JSONObject
rackObject
=
rackInfoArray
.
getJSONObject
(
i
);
if
(
rackObject
.
has
(
"barcode"
))
{
rackInfoBuilder
.
append
(
Html
.
fromHtml
(
Constants
.
Id
))
.
append
(
rackObject
.
getString
(
"rack_id"
))
.
append
(
"\n"
)
.
append
(
Html
.
fromHtml
(
Constants
.
Barcode
))
.
append
(
rackObject
.
getString
(
"barcode"
))
.
append
(
"\n"
)
.
append
(
Html
.
fromHtml
(
Constants
.
From
))
.
append
(
rackObject
.
getString
(
"scanning_start_at"
))
.
append
(
"\n"
)
.
append
(
Html
.
fromHtml
(
Constants
.
To
))
.
append
(
rackObject
.
getString
(
"scanning_end_at"
))
.
append
(
"\n\n"
);
// Add extra new line for separation between entries
}
}
searchByBarcode_rack
.
setText
(
rackInfoBuilder
.
toString
());
}
}
}
catch
(
JSONException
e
){
e
.
printStackTrace
();
}
...
...
@@ -152,13 +176,13 @@ import static w.soulofpluto.stockauditean.Constants.getDateWithOffset;
}
});
}
else
{
runOnUiThread
(()
->
{
try
{
Constants
.
getToast
(
SearchByBarcode
.
this
,
object1
.
getString
(
getResources
().
getString
(
R
.
string
.
msg
)));
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
});
runOnUiThread
(()
->
{
try
{
Constants
.
getToast
(
SearchByBarcode
.
this
,
object1
.
getString
(
getResources
().
getString
(
R
.
string
.
msg
)));
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
});
}
}
}
...
...
app/src/main/res/drawable-xxhdpi/icon1.png
deleted
100644 → 0
View file @
ae31de10
21.9 KB
app/src/main/res/layout/activity_plandetials.xml
View file @
e542492b
...
...
@@ -29,7 +29,7 @@
android:id=
"@+id/plandetails_id"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_margin=
"
3
dp"
android:layout_margin=
"
5
dp"
android:textColor=
"@android:color/black"
style=
"@style/textfont"
/>
...
...
@@ -38,7 +38,7 @@
android:id=
"@+id/plandetails_name"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_margin=
"
3
dp"
android:layout_margin=
"
5
dp"
android:textColor=
"@android:color/black"
style=
"@style/textfont"
/>
...
...
@@ -71,7 +71,8 @@
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:weightSum=
"1"
>
android:weightSum=
"1"
android:layout_margin=
"5dp"
>
<androidx.appcompat.widget.AppCompatRadioButton
android:id=
"@+id/pieces"
...
...
@@ -167,7 +168,8 @@
android:hint=
"TG21489489"
android:layout_alignParentLeft=
"true"
android:maxLines=
"2"
android:layout_marginTop=
"5dp"
android:layout_margin=
"5dp"
android:inputType=
"number"
style=
"@style/textfont"
/>
<LinearLayout
...
...
@@ -175,13 +177,13 @@
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:weightSum=
"1"
android:layout_margin=
"
3
dp"
>
android:layout_margin=
"
5
dp"
>
<androidx.appcompat.widget.AppCompatTextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:text=
"@string/barcode"
android:layout_weight=
"0.
33
"
android:layout_weight=
"0.
40
"
android:textColor=
"@android:color/black"
style=
"@style/headerfont"
/>
...
...
@@ -189,14 +191,14 @@
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:text=
"@string/qty"
android:layout_weight=
"0.3
3
"
android:layout_weight=
"0.3
0
"
android:textColor=
"@android:color/black"
style=
"@style/headerfont"
/>
<androidx.appcompat.widget.AppCompatTextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"0.3
3
"
android:layout_weight=
"0.3
0
"
android:textColor=
"@android:color/black"
/>
</LinearLayout>
...
...
app/src/main/res/layout/plansdetails_item.xml
View file @
e542492b
...
...
@@ -19,7 +19,7 @@
android:id=
"@+id/plandetails_barcode"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"0.
33
"
android:layout_weight=
"0.
40
"
android:textColor=
"@android:color/black"
style=
"@style/textfont"
android:layout_gravity=
"center"
...
...
@@ -29,7 +29,7 @@
android:id=
"@+id/plandetails_qty"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"0.3
3
"
android:layout_weight=
"0.3
0
"
android:textColor=
"@android:color/black"
style=
"@style/textfont"
android:layout_gravity=
"center"
...
...
@@ -37,7 +37,7 @@
<RelativeLayout
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"0.3
3
"
android:layout_weight=
"0.3
0
"
android:gravity=
"center"
>
<ImageView
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment