Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
StockTransferReceive
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
StockTransferReceive
Commits
2db04546
Commit
2db04546
authored
Mar 02, 2021
by
User
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added keyboard open searchbybarcode
parent
40384fd7
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
80 additions
and
87 deletions
+80
-87
ApiService.java
app/src/main/java/w/soulofpluto/posstock/ApiService.java
+11
-14
Constants.java
app/src/main/java/w/soulofpluto/posstock/Constants.java
+3
-6
DashBoardActivity.java
...c/main/java/w/soulofpluto/posstock/DashBoardActivity.java
+25
-34
MainActivity.java
app/src/main/java/w/soulofpluto/posstock/MainActivity.java
+12
-12
RackWiseQty.java
app/src/main/java/w/soulofpluto/posstock/RackWiseQty.java
+1
-1
SearchByBarcode.java
...src/main/java/w/soulofpluto/posstock/SearchByBarcode.java
+28
-20
No files found.
app/src/main/java/w/soulofpluto/posstock/ApiService.java
View file @
2db04546
...
...
@@ -2,8 +2,6 @@ package w.soulofpluto.posstock;
import
com.squareup.okhttp.RequestBody
;
import
com.squareup.okhttp.Response
;
import
org.json.JSONObject
;
import
retrofit2.Call
;
import
retrofit2.http.Body
;
import
retrofit2.http.GET
;
...
...
@@ -15,24 +13,23 @@ import retrofit2.http.Path;
* Created by Ramesh on 05/09/20.
*/
public
interface
ApiService
{
//String BASE_URL = "https://aeebe1.emporter.eu/pos_actions/";
//String Token
= "41f34d7009db337f6213be52f7151108";
//String StoreId
= "980";
/*@Headers({"Pos-Access-Token:" + Token,"Pos-User-Access-Store-Id:"+StoreId,
public
interface
ApiService
{
//String BASE_URL = "https://aeebe1.emporter.eu/pos_actions/";
//String Token
= "41f34d7009db337f6213be52f7151108";
//String StoreId
= "980";
/*@Headers({"Pos-Access-Token:" + Token,"Pos-User-Access-Store-Id:"+StoreId,
"Accept: application/json","Content-Type:multipart/form-data"})*/
/*@Multipart
@POST("uploadBarcodeImages")
Call<ResponseBody> uploadMultiple(
@Part("Pos-Access-Token") RequestBody token
,
@Part("Pos-User-Access-Store-Id") RequestBody storeId
,
@Part("barcode") RequestBody barcode,
@Part List<MultipartBody.Part> files);*/
Call<ResponseBody> uploadMultiple(
@Part("Pos-Access-Token") RequestBody token,
@Part("Pos-User-Access-Store-Id") RequestBody storeId
,
@Part("barcode") RequestBody barcode
,
@Part List<MultipartBody.Part> files);*/
@Headers
({
"Content-type: application/json"
})
@POST
(
"/login/doLogin"
)
Call
<
Response
>
login
(
@Body
RequestBody
body
);
@GET
(
"/login/getStoresMappedToUser/{id}"
)
Call
<
Response
>
getStoreId
(
@Path
(
"id"
)
String
id
);
}
}
app/src/main/java/w/soulofpluto/posstock/Constants.java
View file @
2db04546
...
...
@@ -9,25 +9,21 @@ import android.view.Gravity;
import
android.view.inputmethod.InputMethodManager
;
import
android.widget.EditText
;
import
android.widget.Toast
;
import
com.squareup.okhttp.MediaType
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
java.io.IOException
;
import
java.security.MessageDigest
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.StringTokenizer
;
/*
Create by Ramesh Babu
*/
public
class
Constants
{
//public static String BASE_URL = "http://182.18.167.139/";
public
static
String
BASE_URL
=
"http://posapi.plutokm.com/"
;
//public static String BASE_URL
= "http://182.18.167.139/";
public
static
String
BASE_URL
=
"http://posapi.plutokm.com/"
;
//public static String BASE_URL = "https://7fad42.emporter.eu/";
public
static
String
Logout
=
Constants
.
BASE_URL
+
"/login/doLogout/"
;
public
static
String
Login
=
Constants
.
BASE_URL
+
"/login/doLogin"
;
...
...
@@ -54,6 +50,7 @@ public class Constants{
public
static
String
Plan_Id
=
"<font color=#3700B3><b>PLAN ID : </b></font>"
;
public
static
String
Name
=
"<font color=#3700B3><b>NAME : </b></font>"
;
public
static
String
VERSION
=
"1.1"
;
public
static
int
Value
=
7
;
public
static
ProgressDialog
progressDialog
;
public
static
void
getToast
(
Context
context
,
String
data
){
...
...
app/src/main/java/w/soulofpluto/posstock/DashBoardActivity.java
View file @
2db04546
...
...
@@ -10,8 +10,6 @@ import android.view.MenuItem;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
androidx.annotation.NonNull
;
import
androidx.appcompat.app.AlertDialog
;
import
androidx.appcompat.app.AppCompatActivity
;
...
...
@@ -23,49 +21,42 @@ import com.squareup.okhttp.Response;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.io.IOException
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.concurrent.TimeUnit
;
/*
Create by Ramesh Babu
*/
public
class
DashBoardActivity
extends
AppCompatActivity
implements
View
.
OnClickListener
{
Toolbar
dashboad_toolbar
;
Toolbar
dashboa
r
d_toolbar
;
Button
stock_audit
,
rack_qty
,
searchby_barcode
;
TextView
version
;
PreferenceManager
preferenceManager
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
){
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_dashboard
);
stock_audit
=
findViewById
(
R
.
id
.
stock_audit
);
rack_qty
=
findViewById
(
R
.
id
.
rack_qty
);
searchby_barcode
=
findViewById
(
R
.
id
.
searchby_barcode
);
dashboa
d_toolbar
=
findViewById
(
R
.
id
.
dashboard_toolbar
);
dashboa
rd_toolbar
=
findViewById
(
R
.
id
.
dashboard_toolbar
);
version
=
findViewById
(
R
.
id
.
version
);
preferenceManager
=
new
PreferenceManager
(
this
);
setSupportActionBar
(
dashboad_toolbar
);
setSupportActionBar
(
dashboa
r
d_toolbar
);
getSupportActionBar
().
setTitle
(
getResources
().
getString
(
R
.
string
.
dashboard
));
stock_audit
.
setOnClickListener
(
this
);
rack_qty
.
setOnClickListener
(
this
);
searchby_barcode
.
setOnClickListener
(
this
);
version
.
setText
(
Html
.
fromHtml
(
Constants
.
Ver_Text
+
Constants
.
VERSION
));
}
@Override
public
boolean
onCreateOptionsMenu
(
Menu
menu
){
getMenuInflater
().
inflate
(
R
.
menu
.
menu
,
menu
);
return
super
.
onCreateOptionsMenu
(
menu
);
}
@Override
public
boolean
onOptionsItemSelected
(
@NonNull
MenuItem
item
){
switch
(
item
.
getItemId
()){
/*case android.R.id.home:
finish();
break;*/
case
R
.
id
.
dashboard_logout
:
if
(
Constants
.
isNetworkAvailable
(
DashBoardActivity
.
this
)){
Logout
(
Constants
.
Logout
+
preferenceManager
.
getUserId
());
...
...
@@ -99,7 +90,7 @@ public class DashBoardActivity extends AppCompatActivity implements View.OnClick
if
(
response
.
isSuccessful
()){
String
res
=
response
.
body
().
string
();
Log
.
e
(
"Dashboard Logout "
,
res
);
try
{
try
{
JSONObject
jsonObject
=
new
JSONObject
(
res
);
if
(
jsonObject
.
has
(
"success"
)){
if
(
jsonObject
.
getInt
(
"success"
)
==
1
){
...
...
@@ -112,19 +103,19 @@ public class DashBoardActivity extends AppCompatActivity implements View.OnClick
Constants
.
getToast
(
DashBoardActivity
.
this
,
jsonObject
.
getString
(
"msg"
));
}
}
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
catch
(
NullPointerException
np
){
np
.
printStackTrace
();
np
.
printStackTrace
();
}
}
}
}
});
}
@Override
public
void
onClick
(
View
view
){
switch
(
view
.
getId
()){
switch
(
view
.
getId
()){
case
R
.
id
.
stock_audit
:
Intent
in_main
=
new
Intent
(
this
,
MainActivity
.
class
);
startActivity
(
in_main
);
...
...
@@ -147,20 +138,20 @@ public class DashBoardActivity extends AppCompatActivity implements View.OnClick
super
.
onBackPressed
();
}
else
{
AlertDialog
alert
=
new
AlertDialog
.
Builder
(
this
)
.
setTitle
(
"Are you sure you want to close this app"
)
//.setMessage("Are you sure to Exit")
.
setPositiveButton
(
"Yes"
,
new
DialogInterface
.
OnClickListener
(){
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
finish
();
}
})
.
setNegativeButton
(
"No"
,
new
DialogInterface
.
OnClickListener
(){
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
}
})
.
show
();
.
setTitle
(
"Are you sure you want to close this app"
)
//.setMessage("Are you sure to Exit")
.
setPositiveButton
(
"Yes"
,
new
DialogInterface
.
OnClickListener
(){
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
finish
();
}
})
.
setNegativeButton
(
"No"
,
new
DialogInterface
.
OnClickListener
(){
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
}
})
.
show
();
}
}
}
app/src/main/java/w/soulofpluto/posstock/MainActivity.java
View file @
2db04546
package
w
.
soulofpluto
.
posstock
;
import
androidx.annotation.NonNull
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.appcompat.widget.Toolbar
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.RecyclerView
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Handler
;
...
...
@@ -13,13 +11,11 @@ import android.os.Looper;
import
android.util.Log
;
import
android.view.Menu
;
import
android.view.MenuItem
;
import
com.squareup.okhttp.Callback
;
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
;
...
...
@@ -28,7 +24,6 @@ import java.text.SimpleDateFormat;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.concurrent.TimeUnit
;
import
static
w
.
soulofpluto
.
posstock
.
Constants
.
JSON
;
import
static
w
.
soulofpluto
.
posstock
.
Constants
.
getDateWithOffset
;
...
...
@@ -37,6 +32,7 @@ public class MainActivity extends AppCompatActivity {
RecyclerView
plans_list
;
PreferenceManager
preferenceManager
;
ArrayList
<
Plans
>
plansArrayList
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
){
super
.
onCreate
(
savedInstanceState
);
...
...
@@ -49,6 +45,7 @@ public class MainActivity extends AppCompatActivity {
getSupportActionBar
().
setDisplayHomeAsUpEnabled
(
true
);
getSupportActionBar
().
setTitle
(
getResources
().
getString
(
R
.
string
.
test
)+
" UserId : "
+
preferenceManager
.
getUserId
());
}
@Override
protected
void
onStart
(){
if
(
Constants
.
isNetworkAvailable
(
MainActivity
.
this
)){
...
...
@@ -59,6 +56,7 @@ public class MainActivity extends AppCompatActivity {
}
super
.
onStart
();
}
public
void
Logout
(
String
Url
){
final
OkHttpClient
client
=
new
OkHttpClient
();
client
.
setConnectTimeout
(
250
,
TimeUnit
.
SECONDS
);
...
...
@@ -101,14 +99,16 @@ public class MainActivity extends AppCompatActivity {
}
});
}
@Override
public
boolean
onCreateOptionsMenu
(
Menu
menu
){
getMenuInflater
().
inflate
(
R
.
menu
.
menu
,
menu
);
return
super
.
onCreateOptionsMenu
(
menu
);
}
@Override
public
boolean
onOptionsItemSelected
(
@NonNull
MenuItem
item
){
switch
(
item
.
getItemId
()){
public
boolean
onOptionsItemSelected
(
MenuItem
item
){
switch
(
item
.
getItemId
()){
case
android
.
R
.
id
.
home
:
finish
();
break
;
...
...
@@ -123,18 +123,19 @@ public class MainActivity extends AppCompatActivity {
}
return
super
.
onOptionsItemSelected
(
item
);
}
private
void
FetchData
(
String
Url
){
JSONObject
object
=
new
JSONObject
();
try
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
){
SimpleDateFormat
currentDate
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Date
todayDate
=
new
Date
();
Date
from
=
getDateWithOffset
(-
7
,
new
Date
());
String
from
d
ate
=
currentDate
.
format
(
from
);
Date
from
=
getDateWithOffset
(-
Constants
.
Value
,
new
Date
());
String
from
D
ate
=
currentDate
.
format
(
from
);
String
thisDate
=
currentDate
.
format
(
todayDate
);
Log
.
e
(
"Last date"
,
from
d
ate
);
Log
.
e
(
"Last date"
,
from
D
ate
);
object
.
put
(
getResources
().
getString
(
R
.
string
.
auditstatus
),
"In Progress"
);
object
.
put
(
getResources
().
getString
(
R
.
string
.
fromdate
),
from
d
ate
);
object
.
put
(
getResources
().
getString
(
R
.
string
.
fromdate
),
from
D
ate
);
object
.
put
(
getResources
().
getString
(
R
.
string
.
todate
),
thisDate
);
object
.
put
(
getResources
().
getString
(
R
.
string
.
android_version
),
Constants
.
VERSION
);
}
...
...
@@ -186,7 +187,6 @@ public class MainActivity extends AppCompatActivity {
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"
)));
...
...
app/src/main/java/w/soulofpluto/posstock/RackWiseQty.java
View file @
2db04546
...
...
@@ -87,7 +87,7 @@ public class RackWiseQty extends AppCompatActivity implements AdapterView.OnItem
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
){
SimpleDateFormat
currentDate
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Date
todayDate
=
new
Date
();
Date
from
=
getDateWithOffset
(-
7
,
new
Date
());
Date
from
=
getDateWithOffset
(-
Constants
.
Value
,
new
Date
());
String
fromDate
=
currentDate
.
format
(
from
);
String
thisDate
=
currentDate
.
format
(
todayDate
);
Log
.
e
(
"Last date"
,
fromDate
);
...
...
app/src/main/java/w/soulofpluto/posstock/SearchByBarcode.java
View file @
2db04546
...
...
@@ -64,10 +64,11 @@ import static w.soulofpluto.posstock.Constants.getDateWithOffset;
}
else
{
Constants
.
getToast
(
SearchByBarcode
.
this
,
getResources
().
getString
(
R
.
string
.
connection
));
}
searchbybarcode_spinner
.
setOnItemSelectedListener
(
this
);
searchbybarcode_spinner
.
setOnItemSelectedListener
(
this
);
/*
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
searchby_barcode.setShowSoftInputOnFocus(false);
}
}
*/
searchby_barcode
.
addTextChangedListener
(
new
Checked
());
}
...
...
@@ -95,9 +96,9 @@ import static w.soulofpluto.posstock.Constants.getDateWithOffset;
Log
.
e
(
"Search"
,
object
.
toString
());
RequestBody
body
=
RequestBody
.
create
(
JSON
,
object
.
toString
());
final
OkHttpClient
client
=
new
OkHttpClient
();
client
.
setConnectTimeout
(
25
0
,
TimeUnit
.
SECONDS
);
client
.
setReadTimeout
(
25
0
,
TimeUnit
.
SECONDS
);
client
.
setWriteTimeout
(
25
0
,
TimeUnit
.
SECONDS
);
client
.
setConnectTimeout
(
25
,
TimeUnit
.
SECONDS
);
client
.
setReadTimeout
(
25
,
TimeUnit
.
SECONDS
);
client
.
setWriteTimeout
(
25
,
TimeUnit
.
SECONDS
);
Request
request
=
new
Request
.
Builder
()
.
url
(
Constants
.
BarcodeSearch
)
.
post
(
body
)
...
...
@@ -191,19 +192,26 @@ import static w.soulofpluto.posstock.Constants.getDateWithOffset;
@Override
public
void
onTextChanged
(
CharSequence
val
,
int
i
,
int
i1
,
int
i2
){
try
{
if
(
Constants
.
isNetworkAvailable
(
SearchByBarcode
.
this
)){
if
(
val
.
toString
().
contains
(
"\n"
)){
if
(
Constants
.
isNetworkAvailable
(
SearchByBarcode
.
this
)){
if
(
planid
.
equalsIgnoreCase
(
"0"
)){
Constants
.
getToast
(
SearchByBarcode
.
this
,
"Choose Plan Id"
);
searchby_barcode
.
setText
(
""
);
}
else
{
getBarcodeCheck
(
planid
,
searchby_barcode
.
getText
().
toString
().
replace
(
"\n"
,
""
));
}
if
(
Constants
.
isNetworkAvailable
(
SearchByBarcode
.
this
))
{
if
(
val
.
toString
().
length
()
>
0
)
{
if
(
planid
.
equalsIgnoreCase
(
"0"
))
{
Constants
.
getToast
(
SearchByBarcode
.
this
,
"Choose Plan Id"
);
searchby_barcode
.
setText
(
""
);
}
if
(
val
.
toString
().
contains
(
"\n"
))
{
if
(
Constants
.
isNetworkAvailable
(
SearchByBarcode
.
this
))
{
if
(
planid
.
equalsIgnoreCase
(
"0"
))
{
Constants
.
getToast
(
SearchByBarcode
.
this
,
"Choose Plan Id"
);
searchby_barcode
.
setText
(
""
);
}
else
{
getBarcodeCheck
(
planid
,
searchby_barcode
.
getText
().
toString
().
replace
(
"\n"
,
""
));
Constants
.
ProgressDialogShow
(
SearchByBarcode
.
this
);
}
}
else
{
Constants
.
getToast
(
SearchByBarcode
.
this
,
getResources
().
getString
(
R
.
string
.
connection
));
}
}
}
}
else
{
Constants
.
getToast
(
SearchByBarcode
.
this
,
getResources
().
getString
(
R
.
string
.
connection
));
}
}
catch
(
NullPointerException
np
){
np
.
printStackTrace
();
...
...
@@ -220,7 +228,7 @@ import static w.soulofpluto.posstock.Constants.getDateWithOffset;
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
){
SimpleDateFormat
currentDate
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Date
todayDate
=
new
Date
();
Date
from
=
getDateWithOffset
(-
7
,
new
Date
());
Date
from
=
getDateWithOffset
(-
Constants
.
Value
,
new
Date
());
String
fromDate
=
currentDate
.
format
(
from
);
String
thisDate
=
currentDate
.
format
(
todayDate
);
Log
.
e
(
"Last date"
,
fromDate
);
...
...
@@ -234,9 +242,9 @@ import static w.soulofpluto.posstock.Constants.getDateWithOffset;
Log
.
e
(
"Searchby object ====>"
,
object
.
toString
());
RequestBody
body
=
RequestBody
.
create
(
JSON
,
object
.
toString
());
final
OkHttpClient
client
=
new
OkHttpClient
();
client
.
setConnectTimeout
(
25
0
,
TimeUnit
.
SECONDS
);
client
.
setReadTimeout
(
25
0
,
TimeUnit
.
SECONDS
);
client
.
setWriteTimeout
(
25
0
,
TimeUnit
.
SECONDS
);
client
.
setConnectTimeout
(
25
,
TimeUnit
.
SECONDS
);
client
.
setReadTimeout
(
25
,
TimeUnit
.
SECONDS
);
client
.
setWriteTimeout
(
25
,
TimeUnit
.
SECONDS
);
Request
request
=
new
Request
.
Builder
()
.
url
(
Url
)
.
post
(
body
)
...
...
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