Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
supplier
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王宇航
supplier
Commits
04c3d010
Commit
04c3d010
authored
May 26, 2020
by
Wyh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
5.26 外賣接單取消物流,取消訂單,打印機邏輯,服務器配置
parent
43817993
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
477 additions
and
166 deletions
+477
-166
base-module/src/main/java/com/gingersoft/gsa/cloud/base/application/GsaCloudApplication.java
+8
-12
base-module/src/main/java/com/gingersoft/gsa/cloud/base/utils/MoneyUtil.java
+12
-1
base-module/src/main/java/com/gingersoft/gsa/cloud/base/widget/DialogUtils.java
+31
-18
base-module/src/main/java/com/gingersoft/gsa/cloud/constans/HttpsConstans.java
+19
-9
base-module/src/main/java/com/gingersoft/gsa/cloud/ui/utils/AppDialog.java
+47
-0
base-module/src/main/res/layout/other_order_pause_orders.xml
+0
-0
login-module/src/main/java/com/gingersoft/gsa/cloud/login/mvp/ui/activity/mvp/ui/activity/SwitchServerActivity.java
+13
-2
login-module/src/main/res/layout/activity_switch_server.xml
+8
-0
main-module/src/main/java/com/gingersoft/gsa/cloud/main/mvp/ui/activity/NewMainActivity.java
+5
-5
main-module/src/main/res/layout/activity_new_main.xml
+1
-1
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/data/WeatherRepository.kt
+22
-0
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/data/model/bean/CancelLogisticsBean.kt
+6
-0
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/data/network/CoolWeatherNetwork.kt
+17
-1
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/data/network/ServiceCreator.kt
+10
-7
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/data/network/api/WeatherService.kt
+7
-0
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/model/viewModel/HistoryOrderViewModel.kt
+3
-5
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/model/viewModel/PageViewModel.kt
+49
-4
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/activity/HistoryOrderActivity.kt
+22
-20
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/activity/OtherOrderActivity.kt
+0
-4
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/fragment/PlaceholderFragment.kt
+36
-13
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/util/OtherOrderUtils.kt
+19
-8
other_order_mode/src/main/res/layout/layout_order_info_dialog_new.xml
+47
-3
other_order_mode/src/main/res/layout/layout_other_order_item.xml
+2
-2
print-module/src/main/java/com/joe/print/mvp/print/PrintOtherOrder.java
+1
-1
print-module/src/main/java/com/joe/print/mvp/ui/activity/PrintActivity.java
+2
-2
print-module/src/main/java/com/joe/print/mvp/ui/activity/PrinterAddActivity.java
+11
-7
print-module/src/main/java/com/joe/print/mvp/ui/activity/PrinterListActivity.java
+9
-2
print-module/src/main/java/com/joe/print/mvp/ui/adapter/PrinterListAdapter.java
+4
-0
print-module/src/main/java/com/joe/print/mvp/ui/fragment/IpPrintListActivityFragment.java
+46
-35
print-module/src/main/res/layout/print_confirm_order_view.xml
+1
-1
print-module/src/main/res/layout/printer_item.xml
+18
-2
print-module/src/main/res/values/strings.xml
+1
-1
No files found.
base-module/src/main/java/com/gingersoft/gsa/cloud/base/application/GsaCloudApplication.java
View file @
04c3d010
...
@@ -80,20 +80,14 @@ public class GsaCloudApplication extends BaseApplication {
...
@@ -80,20 +80,14 @@ public class GsaCloudApplication extends BaseApplication {
*/
*/
static
{
static
{
//设置全局的Header构建器
//设置全局的Header构建器
SmartRefreshLayout
.
setDefaultRefreshHeaderCreator
(
new
DefaultRefreshHeaderCreator
()
{
SmartRefreshLayout
.
setDefaultRefreshHeaderCreator
((
context
,
layout
)
->
{
@Override
layout
.
setPrimaryColorsId
(
R
.
color
.
theme_color
,
android
.
R
.
color
.
white
);
//全局设置主题颜色
public
RefreshHeader
createRefreshHeader
(
Context
context
,
RefreshLayout
layout
)
{
return
new
ClassicsHeader
(
context
);
//.setTimeFormat(new DynamicTimeFormat("更新于 %s"));//指定为经典Header,默认是 贝塞尔雷达Header
layout
.
setPrimaryColorsId
(
R
.
color
.
theme_color
,
android
.
R
.
color
.
white
);
//全局设置主题颜色
return
new
ClassicsHeader
(
context
);
//.setTimeFormat(new DynamicTimeFormat("更新于 %s"));//指定为经典Header,默认是 贝塞尔雷达Header
}
});
});
//设置全局的Footer构建器
//设置全局的Footer构建器
SmartRefreshLayout
.
setDefaultRefreshFooterCreator
(
new
DefaultRefreshFooterCreator
()
{
SmartRefreshLayout
.
setDefaultRefreshFooterCreator
((
context
,
layout
)
->
{
@Override
//指定为经典Footer,默认是 BallPulseFooter
public
RefreshFooter
createRefreshFooter
(
Context
context
,
RefreshLayout
layout
)
{
return
new
ClassicsFooter
(
context
).
setDrawableSize
(
20
);
//指定为经典Footer,默认是 BallPulseFooter
return
new
ClassicsFooter
(
context
).
setDrawableSize
(
20
);
}
});
});
}
}
...
@@ -116,6 +110,7 @@ public class GsaCloudApplication extends BaseApplication {
...
@@ -116,6 +110,7 @@ public class GsaCloudApplication extends BaseApplication {
initPrint
();
initPrint
();
//初始化日誌管理庫
//初始化日誌管理庫
initXLog
();
initXLog
();
//初始化服務器地址
initDomainUrl
();
initDomainUrl
();
//初始化crash記錄
//初始化crash記錄
AppCrashHandler
.
getInstance
().
init
(
this
);
AppCrashHandler
.
getInstance
().
init
(
this
);
...
@@ -185,6 +180,7 @@ public class GsaCloudApplication extends BaseApplication {
...
@@ -185,6 +180,7 @@ public class GsaCloudApplication extends BaseApplication {
public
static
void
setGlobalDomain
()
{
public
static
void
setGlobalDomain
()
{
//配置全局默認URL
//配置全局默認URL
//取出SharedPreferences中存儲的默認服務器地址
RetrofitUrlManager
.
getInstance
().
setGlobalDomain
(
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL
);
RetrofitUrlManager
.
getInstance
().
setGlobalDomain
(
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL
);
}
}
...
...
base-module/src/main/java/com/gingersoft/gsa/cloud/base/utils/MoneyUtil.java
View file @
04c3d010
...
@@ -224,25 +224,33 @@ public class MoneyUtil {
...
@@ -224,25 +224,33 @@ public class MoneyUtil {
public
static
BigDecimal
divide
(
double
v1
,
double
v2
)
{
public
static
BigDecimal
divide
(
double
v1
,
double
v2
)
{
BigDecimal
b1
=
new
BigDecimal
(
Double
.
toString
(
v1
));
BigDecimal
b1
=
new
BigDecimal
(
Double
.
toString
(
v1
));
BigDecimal
b2
=
new
BigDecimal
(
Double
.
toString
(
v2
));
BigDecimal
b2
=
new
BigDecimal
(
Double
.
toString
(
v2
));
if
(
b2
.
intValue
()
<=
0
)
{
return
b2
;
}
return
b1
.
divide
(
b2
,
2
,
ROUND_HALF_UP
);
return
b1
.
divide
(
b2
,
2
,
ROUND_HALF_UP
);
}
}
/**
/**
* 計算除
* 計算除
*
* @param v1
* @param v1
* @param v2
* @param v2
* @param scale 保留幾位小數
* @param scale
保留幾位小數
* @param RoundingMode ROUND_HALF_UP為四捨五入
* @param RoundingMode ROUND_HALF_UP為四捨五入
* @return
* @return
*/
*/
public
static
float
divide
(
double
v1
,
double
v2
,
int
scale
,
int
RoundingMode
)
{
public
static
float
divide
(
double
v1
,
double
v2
,
int
scale
,
int
RoundingMode
)
{
BigDecimal
b1
=
new
BigDecimal
(
Double
.
toString
(
v1
));
BigDecimal
b1
=
new
BigDecimal
(
Double
.
toString
(
v1
));
BigDecimal
b2
=
new
BigDecimal
(
Double
.
toString
(
v2
));
BigDecimal
b2
=
new
BigDecimal
(
Double
.
toString
(
v2
));
if
(
b2
.
intValue
()
<=
0
)
{
return
0
f
;
}
return
b1
.
divide
(
b2
,
scale
,
RoundingMode
).
floatValue
();
return
b1
.
divide
(
b2
,
scale
,
RoundingMode
).
floatValue
();
}
}
/**
/**
* 計算除
* 計算除
*
* @param v1
* @param v1
* @param v2
* @param v2
* @param scale 保留幾位小數
* @param scale 保留幾位小數
...
@@ -251,6 +259,9 @@ public class MoneyUtil {
...
@@ -251,6 +259,9 @@ public class MoneyUtil {
public
static
float
divide
(
double
v1
,
double
v2
,
int
scale
)
{
public
static
float
divide
(
double
v1
,
double
v2
,
int
scale
)
{
BigDecimal
b1
=
new
BigDecimal
(
Double
.
toString
(
v1
));
BigDecimal
b1
=
new
BigDecimal
(
Double
.
toString
(
v1
));
BigDecimal
b2
=
new
BigDecimal
(
Double
.
toString
(
v2
));
BigDecimal
b2
=
new
BigDecimal
(
Double
.
toString
(
v2
));
if
(
b2
.
intValue
()
<=
0
)
{
return
0
f
;
}
return
b1
.
divide
(
b2
,
scale
,
ROUND_HALF_UP
).
floatValue
();
return
b1
.
divide
(
b2
,
scale
,
ROUND_HALF_UP
).
floatValue
();
}
}
...
...
base-module/src/main/java/com/gingersoft/gsa/cloud/base/widget/DialogUtils.java
View file @
04c3d010
...
@@ -30,7 +30,7 @@ import com.gingersoft.gsa.cloud.base.R;
...
@@ -30,7 +30,7 @@ import com.gingersoft.gsa.cloud.base.R;
*/
*/
public
abstract
class
DialogUtils
{
public
abstract
class
DialogUtils
{
private
Context
mContext
;
private
Context
mContext
;
private
Dialog
dialog
=
null
;
private
Dialog
dialog
2
=
null
;
private
View
view
;
private
View
view
;
private
int
style
=
R
.
style
.
PhotoDialog
;
private
int
style
=
R
.
style
.
PhotoDialog
;
private
int
mWidth
=
WindowManager
.
LayoutParams
.
WRAP_CONTENT
;
private
int
mWidth
=
WindowManager
.
LayoutParams
.
WRAP_CONTENT
;
...
@@ -43,6 +43,15 @@ public abstract class DialogUtils {
...
@@ -43,6 +43,15 @@ public abstract class DialogUtils {
view
=
LayoutInflater
.
from
(
mContext
).
inflate
(
xmlLayout
,
null
);
view
=
LayoutInflater
.
from
(
mContext
).
inflate
(
xmlLayout
,
null
);
}
}
private
Dialog
getInstance
()
{
synchronized
(
this
)
{
if
(
dialog2
==
null
)
{
dialog2
=
new
Dialog
(
mContext
,
style
);
}
return
dialog2
;
}
}
public
DialogUtils
(
Context
mContext
,
View
view
)
{
public
DialogUtils
(
Context
mContext
,
View
view
)
{
this
.
mContext
=
mContext
;
this
.
mContext
=
mContext
;
this
.
view
=
view
;
this
.
view
=
view
;
...
@@ -64,19 +73,18 @@ public abstract class DialogUtils {
...
@@ -64,19 +73,18 @@ public abstract class DialogUtils {
}
}
public
DialogUtils
createDialogView
()
{
public
DialogUtils
createDialogView
()
{
dialog
=
new
Dialog
(
mContext
,
style
);
viewHepler
=
getViewHepler
();
viewHepler
=
getViewHepler
();
initLayout
(
viewHepler
,
dialog
);
initLayout
(
viewHepler
,
getInstance
()
);
dialog
.
setContentView
(
viewHepler
.
getContentView
());
getInstance
()
.
setContentView
(
viewHepler
.
getContentView
());
Window
dialogWindow
=
dialog
.
getWindow
();
Window
dialogWindow
=
getInstance
()
.
getWindow
();
// WindowManager.LayoutParams lp = dialogWindow.getAttributes();
// WindowManager.LayoutParams lp = dialogWindow.getAttributes();
dialogWindow
.
setGravity
(
Gravity
.
CENTER
);
dialogWindow
.
setGravity
(
Gravity
.
CENTER
);
//将对话框的大小按屏幕大小的百分比设置
//将对话框的大小按屏幕大小的百分比设置
// WindowManager m = activity.getWindowManager();
// WindowManager m = activity.getWindowManager();
// Display d = m.getDefaultDisplay(); // 获取屏幕宽、高用
// Display d = m.getDefaultDisplay(); // 获取屏幕宽、高用
WindowManager
.
LayoutParams
p
=
dialogWindow
.
getAttributes
();
// 获取对话框当前的参数值
WindowManager
.
LayoutParams
p
=
dialogWindow
.
getAttributes
();
// 获取对话框当前的参数值
Window
window
=
dialog
.
getWindow
();
Window
window
=
getInstance
()
.
getWindow
();
if
(
window
!=
null
)
{
if
(
window
!=
null
)
{
window
.
setBackgroundDrawable
(
new
ColorDrawable
(
Color
.
TRANSPARENT
));
window
.
setBackgroundDrawable
(
new
ColorDrawable
(
Color
.
TRANSPARENT
));
window
.
getDecorView
().
setBackgroundResource
(
android
.
R
.
color
.
transparent
);
window
.
getDecorView
().
setBackgroundResource
(
android
.
R
.
color
.
transparent
);
...
@@ -97,33 +105,32 @@ public abstract class DialogUtils {
...
@@ -97,33 +105,32 @@ public abstract class DialogUtils {
dialogWindow
.
setAttributes
(
p
);
dialogWindow
.
setAttributes
(
p
);
// android Activity改成dialog样式后 怎设置点击空白处关闭窗体,点击窗体以外的地方关闭窗体
// android Activity改成dialog样式后 怎设置点击空白处关闭窗体,点击窗体以外的地方关闭窗体
dialog
.
setCanceledOnTouchOutside
(
true
);
getInstance
()
.
setCanceledOnTouchOutside
(
true
);
dialog
.
setCancelable
(
true
);
getInstance
()
.
setCancelable
(
true
);
// dialog.show();
// dialog.show();
return
this
;
return
this
;
}
}
public
Dialog
getDialog
()
{
public
Dialog
getDialog
()
{
return
dialog
;
return
getInstance
()
;
}
}
public
DialogUtils
dismiss
()
{
public
DialogUtils
dismiss
()
{
if
(
dialog
!=
null
)
{
getInstance
().
dismiss
();
dialog
.
dismiss
();
}
return
this
;
return
this
;
}
}
public
DialogUtils
setGravity
(
int
gravity
)
{
public
DialogUtils
setGravity
(
int
gravity
)
{
if
(
dialog
!=
null
&&
dialog
.
getWindow
()
!=
null
)
{
if
(
getInstance
()
.
getWindow
()
!=
null
)
{
dialog
.
getWindow
().
setGravity
(
gravity
);
getInstance
()
.
getWindow
().
setGravity
(
gravity
);
}
}
return
this
;
return
this
;
}
}
public
DialogUtils
show
()
{
public
DialogUtils
show
()
{
dialog
.
show
();
dismiss
();
getInstance
().
show
();
return
this
;
return
this
;
}
}
...
@@ -136,11 +143,11 @@ public abstract class DialogUtils {
...
@@ -136,11 +143,11 @@ public abstract class DialogUtils {
}
}
public
boolean
isShowing
()
{
public
boolean
isShowing
()
{
return
dialog
!=
null
&&
dialog
.
isShowing
();
return
getInstance
()
!=
null
&&
getInstance
()
.
isShowing
();
}
}
public
DialogUtils
setOnDismissListener
(
DialogInterface
.
OnDismissListener
dismissListener
)
{
public
DialogUtils
setOnDismissListener
(
DialogInterface
.
OnDismissListener
dismissListener
)
{
dialog
.
setOnDismissListener
(
dismissListener
);
getInstance
()
.
setOnDismissListener
(
dismissListener
);
return
this
;
return
this
;
}
}
...
@@ -152,7 +159,7 @@ public abstract class DialogUtils {
...
@@ -152,7 +159,7 @@ public abstract class DialogUtils {
public
DialogUtils
setCanceledOnTouchOutside
(
boolean
cancel
)
{
public
DialogUtils
setCanceledOnTouchOutside
(
boolean
cancel
)
{
dialog
.
setCanceledOnTouchOutside
(
cancel
);
getInstance
()
.
setCanceledOnTouchOutside
(
cancel
);
return
this
;
return
this
;
}
}
...
@@ -204,6 +211,12 @@ public abstract class DialogUtils {
...
@@ -204,6 +211,12 @@ public abstract class DialogUtils {
return
(
T
)
view
;
return
(
T
)
view
;
}
}
public
ViewHepler
setOnClickListenter
(
int
viewId
,
View
.
OnClickListener
onClickListener
)
{
getView
(
viewId
).
setOnClickListener
(
onClickListener
);
return
this
;
}
/**
/**
* 为TextView设置字符串
* 为TextView设置字符串
*
*
...
...
base-module/src/main/java/com/gingersoft/gsa/cloud/constans/HttpsConstans.java
View file @
04c3d010
...
@@ -4,17 +4,27 @@ package com.gingersoft.gsa.cloud.constans;
...
@@ -4,17 +4,27 @@ package com.gingersoft.gsa.cloud.constans;
* Created by Wyh on 2019/12/21.
* Created by Wyh on 2019/12/21.
*/
*/
public
class
HttpsConstans
{
public
class
HttpsConstans
{
//默認為香港
public
static
String
ROOT_
SERVER_ADDRESS_FORMAL
=
"http://a.ricepon.com:58201/ricepon-cloud-gsa/api/"
;
public
static
String
ROOT_
ADDRESS_FORMAL
=
"https://m.ricepon.com:8444/ricepon-cloud-gsa/api/"
;
//正式服務器
public
static
final
String
ROOT_SERVER_ADDRESS_FORMAL_SZ
=
"http://gingersoft.tpddns.cn:58201/ricepon-cloud-gsa/api/"
;
//深圳服务器
public
static
final
String
ROOT_SERVER_ADDRESS_FORMAL_SZ
=
"http://gingersoft.tpddns.cn:58201/ricepon-cloud-gsa/api/"
;
//深圳服务器
public
static
final
String
ROOT_SERVER_ADDRESS_FORMAL_HK
=
"http://a.ricepon.com:58201/ricepon-cloud-gsa/api/"
;
//香港服务器
public
static
final
String
ROOT_SERVER_ADDRESS_FORMAL_HK
=
"http://a.ricepon.com:58201/ricepon-cloud-gsa/api/"
;
//香港服务器
public
static
String
ROOT_SERVER_YOU_CHANG_HK
=
"http://192.168.1.142:9012/api/"
;
//友常本地
public
static
String
ROOT_SERVER_YOU_CHANG_HK
=
"http://192.168.1.142:9012/api/"
;
//友常本地
public
static
String
ROOT_SERVER_SHI_WEI_HK
=
"http://192.168.1.154:9012/api/"
;
//世維本地
public
static
String
ROOT_SERVER_SHI_WEI_HK
=
"http://192.168.1.154:9012/api/"
;
//世維本地
//默認為正式
public
static
String
ROOT_SE
TTLEMENT_REPORT_SERVER_ADDRESS_FORMAL
=
"http://a.ricepon.com:58201/"
;
//清機接口地址
public
static
String
ROOT_SE
RVER_ADDRESS_FORMAL
=
ROOT_ADDRESS_FORMAL
;
public
static
String
REPORT_SERVER_ADDRESS
=
"http://a.ricepon.com:58201/ricepon-report/api/"
;
//報表地址
//外賣接單
public
static
String
WECHAR_REPORT_SERVER_ADDRESS
=
"http://a.ricepon.com:61177/member-web/api/"
;
//微信公眾號報表地址:首頁曲線圖數據,支付分析報表數據
public
static
final
String
ROOT_SZ_URL
=
"http://192.168.1.74:6060"
;
//友常本地
public
static
final
String
ROOT_HK_TEST_URL
=
"https://hktest.ricepon.com:64377"
;
//香港測試
public
static
final
String
ROOT_FORMAL_URL
=
"https://m.ricepon.com"
;
//正式
public
static
String
ROOT_URL
=
HttpsConstans
.
ROOT_FORMAL_URL
;
public
static
String
_SERVER_ADDRESS
=
"http://a.ricepon.com:61177/member-web/api/"
;
//報表地址
//清機接口地址
public
static
String
ROOT_SETTLEMENT_REPORT_SERVER_ADDRESS_FORMAL
=
"http://a.ricepon.com:58201/"
;
//報表地址
public
static
String
REPORT_SERVER_ADDRESS
=
"http://a.ricepon.com:58201/ricepon-report/api/"
;
//微信公眾號報表地址:首頁曲線圖數據,支付分析報表數據
public
static
String
WECHAR_REPORT_SERVER_ADDRESS
=
"http://a.ricepon.com:61177/member-web/api/"
;
//報表地址
public
static
String
_SERVER_ADDRESS
=
"http://a.ricepon.com:61177/member-web/api/"
;
}
}
base-module/src/main/java/com/gingersoft/gsa/cloud/ui/utils/AppDialog.java
0 → 100644
View file @
04c3d010
package
com
.
gingersoft
.
gsa
.
cloud
.
ui
.
utils
;
import
android.app.Dialog
;
import
android.content.Context
;
import
android.view.View
;
import
com.gingersoft.gsa.cloud.base.R
;
import
com.gingersoft.gsa.cloud.base.widget.DialogUtils
;
public
class
AppDialog
{
public
static
void
showWaringDialog
(
Context
context
,
String
title
,
DialogOnClickListenter
sureOnclickListenter
)
{
showWaringDialog
(
context
,
title
,
null
,
null
,
sureOnclickListenter
,
null
);
}
// public static void showWaringDialog(Context context, String title, DialogOnClickListenter sureOnclickListenter) {
// showWaringDialog(context, title, null, null, sureOnclickListenter, null);
// }
private
static
void
showWaringDialog
(
Context
context
,
String
title
,
String
confimText
,
String
cancelText
,
DialogOnClickListenter
sureOnclickListenter
,
DialogOnClickListenter
cancelOnclickListenter
)
{
//暫停接單,彈窗向用戶確認是否關閉
new
DialogUtils
(
context
,
R
.
layout
.
other_order_pause_orders
)
{
@Override
public
void
initLayout
(
ViewHepler
hepler
,
Dialog
dialog
)
{
if
(
title
!=
null
)
hepler
.
setText
(
R
.
id
.
tv_warning_title
,
title
);
if
(
confimText
!=
null
)
hepler
.
setText
(
R
.
id
.
tv_dialog_confirm
,
confimText
);
if
(
sureOnclickListenter
!=
null
)
{
hepler
.
getView
(
R
.
id
.
tv_dialog_confirm
).
setOnClickListener
(
v
->
sureOnclickListenter
.
onclick
(
v
,
dialog
));
}
if
(
cancelText
!=
null
)
hepler
.
setText
(
R
.
id
.
tv_dialog_cancel
,
cancelText
);
if
(
cancelOnclickListenter
!=
null
)
hepler
.
getView
(
R
.
id
.
tv_dialog_cancel
).
setOnClickListener
(
v
->
cancelOnclickListenter
.
onclick
(
v
,
dialog
));
else
hepler
.
getView
(
R
.
id
.
tv_dialog_cancel
).
setOnClickListener
(
v
->
dialog
.
dismiss
());
}
}.
createDialogView
().
show
();
}
public
interface
DialogOnClickListenter
{
void
onclick
(
View
view
,
Dialog
dialog
);
}
}
other_order_mod
e/src/main/res/layout/other_order_pause_orders.xml
→
base-modul
e/src/main/res/layout/other_order_pause_orders.xml
View file @
04c3d010
File moved
login-module/src/main/java/com/gingersoft/gsa/cloud/login/mvp/ui/activity/mvp/ui/activity/SwitchServerActivity.java
View file @
04c3d010
...
@@ -45,6 +45,8 @@ public class SwitchServerActivity extends BaseActivity<SwitchServerPresenter> im
...
@@ -45,6 +45,8 @@ public class SwitchServerActivity extends BaseActivity<SwitchServerPresenter> im
RadioButton
rbHK
;
RadioButton
rbHK
;
@BindView
(
R2
.
id
.
rb_youchang_hk
)
@BindView
(
R2
.
id
.
rb_youchang_hk
)
RadioButton
rb_youchang_hk
;
RadioButton
rb_youchang_hk
;
@BindView
(
R2
.
id
.
rb_server_formal
)
RadioButton
rbFormal
;
@BindView
(
R2
.
id
.
btn_switch_server
)
@BindView
(
R2
.
id
.
btn_switch_server
)
Button
switchServer
;
Button
switchServer
;
@BindView
(
R2
.
id
.
tv_now_server
)
@BindView
(
R2
.
id
.
tv_now_server
)
...
@@ -73,20 +75,29 @@ public class SwitchServerActivity extends BaseActivity<SwitchServerPresenter> im
...
@@ -73,20 +75,29 @@ public class SwitchServerActivity extends BaseActivity<SwitchServerPresenter> im
rbHK
.
setText
(
"香港服務器:"
+
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL_HK
);
rbHK
.
setText
(
"香港服務器:"
+
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL_HK
);
rbSZ
.
setText
(
"深圳服務器:"
+
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL_SZ
);
rbSZ
.
setText
(
"深圳服務器:"
+
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL_SZ
);
rb_youchang_hk
.
setText
(
"世維本地:"
+
HttpsConstans
.
ROOT_SERVER_YOU_CHANG_HK
);
rb_youchang_hk
.
setText
(
"世維本地:"
+
HttpsConstans
.
ROOT_SERVER_YOU_CHANG_HK
);
rbFormal
.
setText
(
"正式服務器:"
+
HttpsConstans
.
ROOT_ADDRESS_FORMAL
);
if
(
nowServer
.
equals
(
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL_SZ
))
{
if
(
nowServer
.
equals
(
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL_SZ
))
{
rbSZ
.
setChecked
(
true
);
rbSZ
.
setChecked
(
true
);
}
else
if
(
nowServer
.
equals
(
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL_HK
))
{
}
else
if
(
nowServer
.
equals
(
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL_HK
))
{
rbHK
.
setChecked
(
true
);
rbHK
.
setChecked
(
true
);
}
else
{
}
else
if
(
nowServer
.
equals
(
HttpsConstans
.
ROOT_ADDRESS_FORMAL
))
{
rbFormal
.
setChecked
(
true
);
}
else
{
rb_youchang_hk
.
setChecked
(
true
);
rb_youchang_hk
.
setChecked
(
true
);
}
}
switchServer
.
setOnClickListener
(
v
->
{
switchServer
.
setOnClickListener
(
v
->
{
if
(
rbSZ
.
isChecked
())
{
if
(
rbSZ
.
isChecked
())
{
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL
=
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL_SZ
;
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL
=
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL_SZ
;
HttpsConstans
.
ROOT_URL
=
HttpsConstans
.
ROOT_SZ_URL
;
}
else
if
(
rbHK
.
isChecked
())
{
}
else
if
(
rbHK
.
isChecked
())
{
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL
=
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL_HK
;
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL
=
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL_HK
;
}
else
{
HttpsConstans
.
ROOT_URL
=
HttpsConstans
.
ROOT_HK_TEST_URL
;
}
else
if
(
rbFormal
.
isChecked
())
{
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL
=
HttpsConstans
.
ROOT_ADDRESS_FORMAL
;
HttpsConstans
.
ROOT_URL
=
HttpsConstans
.
ROOT_FORMAL_URL
;
}
else
{
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL
=
HttpsConstans
.
ROOT_SERVER_SHI_WEI_HK
;
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL
=
HttpsConstans
.
ROOT_SERVER_SHI_WEI_HK
;
HttpsConstans
.
ROOT_URL
=
HttpsConstans
.
ROOT_HK_TEST_URL
;
}
}
GsaCloudApplication
.
setGlobalDomain
();
GsaCloudApplication
.
setGlobalDomain
();
finish
();
finish
();
...
...
login-module/src/main/res/layout/activity_switch_server.xml
View file @
04c3d010
...
@@ -36,6 +36,14 @@
...
@@ -36,6 +36,14 @@
android:textColor=
"@color/theme_333_color"
android:textColor=
"@color/theme_333_color"
android:textSize=
"@dimen/sp_16"
/>
android:textSize=
"@dimen/sp_16"
/>
<RadioButton
android:id=
"@+id/rb_server_formal"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:padding=
"@dimen/dp_10"
android:text=
"正式環境"
android:textColor=
"@color/theme_333_color"
android:textSize=
"@dimen/sp_16"
/>
</RadioGroup>
</RadioGroup>
<TextView
<TextView
...
...
main-module/src/main/java/com/gingersoft/gsa/cloud/main/mvp/ui/activity/NewMainActivity.java
View file @
04c3d010
...
@@ -172,12 +172,12 @@ public class NewMainActivity extends BaseActivity<NewMainPresenter> implements N
...
@@ -172,12 +172,12 @@ public class NewMainActivity extends BaseActivity<NewMainPresenter> implements N
if
(
BuildConfig
.
DEBUG
)
{
if
(
BuildConfig
.
DEBUG
)
{
mainSideMenuBeans
.
add
(
new
MainSideMenuBean
(
R
.
drawable
.
ic_setting
,
"複製Token"
));
mainSideMenuBeans
.
add
(
new
MainSideMenuBean
(
R
.
drawable
.
ic_setting
,
"複製Token"
));
mainSideMenuBeans
.
add
(
new
MainSideMenuBean
(
R
.
drawable
.
ic_mall_center
,
"商城中心"
));
mainSideMenuBeans
.
add
(
new
MainSideMenuBean
(
R
.
drawable
.
ic_about_us
,
"關於我們"
));
mainSideMenuBeans
.
add
(
new
MainSideMenuBean
(
R
.
drawable
.
ic_password
,
"修改密碼"
));
mainSideMenuBeans
.
add
(
new
MainSideMenuBean
(
R
.
drawable
.
ic_setting
,
"設置"
));
}
}
mainSideMenuBeans
.
add
(
new
MainSideMenuBean
(
R
.
drawable
.
ic_mall_center
,
"商城中心"
));
mainSideMenuBeans
.
add
(
new
MainSideMenuBean
(
R
.
drawable
.
ic_about_us
,
"關於我們"
));
mainSideMenuBeans
.
add
(
new
MainSideMenuBean
(
R
.
drawable
.
ic_password
,
"修改密碼"
));
mainSideMenuBeans
.
add
(
new
MainSideMenuBean
(
R
.
drawable
.
ic_setting
,
"清機"
));
mainSideMenuBeans
.
add
(
new
MainSideMenuBean
(
R
.
drawable
.
ic_setting
,
"清機"
));
mainSideMenuBeans
.
add
(
new
MainSideMenuBean
(
R
.
drawable
.
ic_setting
,
"設置"
));
if
(
BuildConfig
.
DEBUG
)
{
if
(
BuildConfig
.
DEBUG
)
{
mainSideMenuBeans
.
add
(
new
MainSideMenuBean
(
R
.
drawable
.
ic_setting
,
"切換環境"
));
mainSideMenuBeans
.
add
(
new
MainSideMenuBean
(
R
.
drawable
.
ic_setting
,
"切換環境"
));
}
}
...
@@ -316,7 +316,7 @@ public class NewMainActivity extends BaseActivity<NewMainPresenter> implements N
...
@@ -316,7 +316,7 @@ public class NewMainActivity extends BaseActivity<NewMainPresenter> implements N
.
setActionName
(
"showSoldoutCtrlActivity"
)
.
setActionName
(
"showSoldoutCtrlActivity"
)
.
build
()
.
build
()
.
call
();
.
call
();
}
else
if
(
name
.
equals
(
"餐臺管理"
))
{
}
else
if
(
name
.
equals
(
"餐臺管理"
))
{
CC
.
obtainBuilder
(
"Component.Manager"
)
CC
.
obtainBuilder
(
"Component.Manager"
)
.
setActionName
(
"showTableManageActivity"
)
.
setActionName
(
"showTableManageActivity"
)
.
build
()
.
build
()
...
...
main-module/src/main/res/layout/activity_new_main.xml
View file @
04c3d010
...
@@ -58,7 +58,7 @@
...
@@ -58,7 +58,7 @@
android:layout_marginTop=
"@dimen/dp_20"
android:layout_marginTop=
"@dimen/dp_20"
android:layout_marginBottom=
"@dimen/dp_20"
android:layout_marginBottom=
"@dimen/dp_20"
android:layout_weight=
"1"
android:layout_weight=
"1"
android:visibility=
"
in
visible"
/>
android:visibility=
"visible"
/>
<LinearLayout
<LinearLayout
android:id=
"@+id/layout_login_out"
android:id=
"@+id/layout_login_out"
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/data/WeatherRepository.kt
View file @
04c3d010
...
@@ -6,6 +6,8 @@ import com.google.gson.Gson
...
@@ -6,6 +6,8 @@ import com.google.gson.Gson
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.withContext
import
kotlinx.coroutines.withContext
import
okhttp3.FormBody
import
okhttp3.FormBody
import
okhttp3.RequestBody
import
kotlin.Pair
as
Pair1
class
WeatherRepository
private
constructor
(
private
val
network
:
CoolWeatherNetwork
)
{
class
WeatherRepository
private
constructor
(
private
val
network
:
CoolWeatherNetwork
)
{
...
@@ -96,6 +98,26 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
...
@@ -96,6 +98,26 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
network
.
getDeliveryConfigDTO
(
requestBody
)
network
.
getDeliveryConfigDTO
(
requestBody
)
}
}
suspend
fun
cancelLogistics
(
shopId
:
String
,
orderId
:
String
)
=
withContext
(
Dispatchers
.
IO
)
{
network
.
cancelLogistics
(
getBody
(
"shopId"
to
shopId
,
"orderId"
to
orderId
))
}
suspend
fun
updateOrderStates
(
memberId
:
String
,
orderId
:
String
,
status
:
String
,
updateBy
:
String
)
=
withContext
(
Dispatchers
.
IO
)
{
network
.
cancelOrder
(
getBody
(
"memberId"
to
memberId
,
"orderId"
to
orderId
,
"status"
to
status
,
"type"
to
"2"
,
"updateBy"
to
updateBy
))
}
fun
getBody
(
vararg
pair
:
Pair1
<
String
,
String
>):
RequestBody
{
val
requestBody
=
FormBody
.
Builder
()
requestBody
.
apply
{
pair
.
forEach
{
requestBody
.
add
(
it
.
first
,
it
.
second
)
}
}
return
requestBody
.
build
()
}
companion
object
{
companion
object
{
private
lateinit
var
instance
:
WeatherRepository
private
lateinit
var
instance
:
WeatherRepository
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/data/model/bean/CancelLogisticsBean.kt
0 → 100644
View file @
04c3d010
package
com.gingersoft.gsa.other_order_mode.data.model.bean
class
CancelLogisticsBean
(
val
success
:
Boolean
,
val
errCode
:
String
,
val
errMsg
:
String
,
val
sysTime
:
Long
)
{
}
\ No newline at end of file
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/data/network/CoolWeatherNetwork.kt
View file @
04c3d010
...
@@ -16,27 +16,43 @@ class CoolWeatherNetwork {
...
@@ -16,27 +16,43 @@ class CoolWeatherNetwork {
private
val
service
=
ServiceCreator
.
create2
(
WeatherService
::
class
.
java
)
private
val
service
=
ServiceCreator
.
create2
(
WeatherService
::
class
.
java
)
private
val
gsposService
=
ServiceCreator
.
create3
(
WeatherService
::
class
.
java
)
private
val
gsposService
=
ServiceCreator
.
create3
(
WeatherService
::
class
.
java
)
//獲取訂單列表
suspend
fun
fetchOrderList
(
requestBody
:
RequestBody
)
=
orderService
.
getOrderList
(
requestBody
).
await
()
suspend
fun
fetchOrderList
(
requestBody
:
RequestBody
)
=
orderService
.
getOrderList
(
requestBody
).
await
()
//修改餐廳營業狀態
suspend
fun
updateRestOpenStatus
(
requestBody
:
RequestBody
)
=
service
.
updateRestOpenStatus
(
requestBody
).
await
()
suspend
fun
updateRestOpenStatus
(
requestBody
:
RequestBody
)
=
service
.
updateRestOpenStatus
(
requestBody
).
await
()
//獲取訂單分組數量,例:待確認訂單數量,製作中訂單數量。。。
suspend
fun
getOrderGroupNum
(
requestBody
:
RequestBody
)
=
orderService
.
getOrderGroupNum
(
requestBody
).
await
()
suspend
fun
getOrderGroupNum
(
requestBody
:
RequestBody
)
=
orderService
.
getOrderGroupNum
(
requestBody
).
await
()
//獲取訂單信息
suspend
fun
getOrderInfo
(
requestBody
:
RequestBody
)
=
orderService
.
getOrderDesc
(
requestBody
).
await
()
suspend
fun
getOrderInfo
(
requestBody
:
RequestBody
)
=
orderService
.
getOrderDesc
(
requestBody
).
await
()
//修改訂單狀態
suspend
fun
updateOrderStatus
(
requestBody
:
RequestBody
)
=
orderService
.
updateOrderStatus
(
requestBody
).
await
()
suspend
fun
updateOrderStatus
(
requestBody
:
RequestBody
)
=
orderService
.
updateOrderStatus
(
requestBody
).
await
()
//第三方配送接口
suspend
fun
thirdDelivery
(
requestBody
:
RequestBody
)
=
gsposService
.
thirdDelivery
(
requestBody
).
await
()
suspend
fun
thirdDelivery
(
requestBody
:
RequestBody
)
=
gsposService
.
thirdDelivery
(
requestBody
).
await
()
//修改自取訂單狀態
suspend
fun
updateSelfOrderStatus
(
requestBody
:
RequestBody
)
=
orderService
.
updateSelfOrderStatus
(
requestBody
).
await
()
suspend
fun
updateSelfOrderStatus
(
requestBody
:
RequestBody
)
=
orderService
.
updateSelfOrderStatus
(
requestBody
).
await
()
// 獲取餐廳配送人員信息
suspend
fun
getDeliveryInfo
(
requestBody
:
RequestBody
)
=
orderService
.
getDeliveryInfo
(
requestBody
).
await
()
suspend
fun
getDeliveryInfo
(
requestBody
:
RequestBody
)
=
orderService
.
getDeliveryInfo
(
requestBody
).
await
()
//獲取物流配置
suspend
fun
getDeliveryConfigDTO
(
requestBody
:
RequestBody
)
=
gsposService
.
getDeliveryConfigDTO
(
requestBody
).
await
()
suspend
fun
getDeliveryConfigDTO
(
requestBody
:
RequestBody
)
=
gsposService
.
getDeliveryConfigDTO
(
requestBody
).
await
()
//獲取歷史訂單
suspend
fun
getHistoryOrderList
(
requestBody
:
RequestBody
)
=
orderService
.
getHistoryOrderList
(
requestBody
).
await
()
suspend
fun
getHistoryOrderList
(
requestBody
:
RequestBody
)
=
orderService
.
getHistoryOrderList
(
requestBody
).
await
()
//取消物流
suspend
fun
cancelLogistics
(
requestBody
:
RequestBody
)
=
gsposService
.
cancelLogistics
(
requestBody
).
await
()
//取消訂單,有物流需要提示先取消物流
suspend
fun
cancelOrder
(
requestBody
:
RequestBody
)
=
service
.
cancelOrder
(
requestBody
).
await
()
private
suspend
fun
<
T
>
Call
<
T
>.
await
():
T
{
private
suspend
fun
<
T
>
Call
<
T
>.
await
():
T
{
return
suspendCoroutine
{
continuation
->
return
suspendCoroutine
{
continuation
->
enqueue
(
object
:
Callback
<
T
>
{
enqueue
(
object
:
Callback
<
T
>
{
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/data/network/ServiceCreator.kt
View file @
04c3d010
package
com.gingersoft.gsa.other_order_mode.data.network
package
com.gingersoft.gsa.other_order_mode.data.network
import
android.util.Log
import
com.gingersoft.gsa.cloud.constans.HttpsConstans
import
com.gingersoft.gsa.cloud.globalconfig.applyOptions.intercept.LoggingInterceptor
import
com.gingersoft.gsa.cloud.globalconfig.applyOptions.intercept.LoggingInterceptor
import
okhttp3.OkHttpClient
import
okhttp3.OkHttpClient
import
retrofit2.Retrofit
import
retrofit2.Retrofit
...
@@ -8,17 +10,15 @@ import retrofit2.converter.scalars.ScalarsConverterFactory
...
@@ -8,17 +10,15 @@ import retrofit2.converter.scalars.ScalarsConverterFactory
import
java.util.concurrent.TimeUnit
import
java.util.concurrent.TimeUnit
object
ServiceCreator
{
object
ServiceCreator
{
private
val
httpClient
=
OkHttpClient
.
Builder
().
connectTimeout
(
15
,
TimeUnit
.
SECONDS
).
addInterceptor
(
LoggingInterceptor
())
private
val
httpClient
=
OkHttpClient
.
Builder
().
connectTimeout
(
15
,
TimeUnit
.
SECONDS
).
addInterceptor
(
LoggingInterceptor
())
private
const
val
ROOT_SZ_URL
=
"http://192.168.1.74:6060"
var
ROOT_URL
:
String
=
HttpsConstans
.
ROOT_URL
private
const
val
ROOT_HK_TEST_URL
=
"https://hktest.ricepon.com:64377"
private
const
val
ROOT_FORMAL_URL
=
"https://m.ricepon.com"
const
val
ROOT_URL
=
ROOT_HK_TEST_URL
private
var
BASE_URL
=
"$ROOT_URL/ricepon-wechat/api/"
private
var
BASE_URL2
=
"$ROOT_URL/member-web/api/"
private
var
BASE_URL3
=
"$ROOT_URL/member-web/ricepon-gsa/api/"
private
const
val
BASE_URL
=
"$ROOT_URL/ricepon-wechat/api/"
private
const
val
BASE_URL2
=
"$ROOT_URL/member-web/api/"
private
const
val
BASE_URL3
=
"$ROOT_URL/member-web/ricepon-gsa/api/"
private
val
builder
=
Retrofit
.
Builder
()
private
val
builder
=
Retrofit
.
Builder
()
...
@@ -26,6 +26,9 @@ object ServiceCreator {
...
@@ -26,6 +26,9 @@ object ServiceCreator {
.
client
(
httpClient
.
build
())
.
client
(
httpClient
.
build
())
.
addConverterFactory
(
ScalarsConverterFactory
.
create
())
.
addConverterFactory
(
ScalarsConverterFactory
.
create
())
.
addConverterFactory
(
GsonConverterFactory
.
create
())
.
addConverterFactory
(
GsonConverterFactory
.
create
())
.
apply
{
Log
.
e
(
"eee"
,
"服務器地址$ROOT_URL"
)
}
private
val
builder2
=
Retrofit
.
Builder
()
private
val
builder2
=
Retrofit
.
Builder
()
.
baseUrl
(
BASE_URL2
)
.
baseUrl
(
BASE_URL2
)
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/data/network/api/WeatherService.kt
View file @
04c3d010
...
@@ -38,4 +38,10 @@ interface WeatherService {
...
@@ -38,4 +38,10 @@ interface WeatherService {
@POST
(
"wechat/findHistoryOrderList"
)
@POST
(
"wechat/findHistoryOrderList"
)
fun
getHistoryOrderList
(
@Body
requestBody
:
RequestBody
):
Call
<
HistoryOrderBean
>
fun
getHistoryOrderList
(
@Body
requestBody
:
RequestBody
):
Call
<
HistoryOrderBean
>
@POST
(
"gsa/cancelOrder"
)
fun
cancelLogistics
(
@Body
requestBody
:
RequestBody
):
Call
<
CancelLogisticsBean
>
@POST
(
"order/updateOrderStatus"
)
fun
cancelOrder
(
@Body
requestBody
:
RequestBody
):
Call
<
String
>
}
}
\ No newline at end of file
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/model/viewModel/HistoryOrderViewModel.kt
View file @
04c3d010
...
@@ -13,10 +13,7 @@ import kotlinx.coroutines.launch
...
@@ -13,10 +13,7 @@ import kotlinx.coroutines.launch
class
HistoryOrderViewModel
(
private
val
historyOrderRepository
:
HistoryOrderRepository
)
:
ViewModel
()
{
class
HistoryOrderViewModel
(
private
val
historyOrderRepository
:
HistoryOrderRepository
)
:
ViewModel
()
{
var
data
=
MutableLiveData
<
HistoryOrderBean
>()
var
data
=
MutableLiveData
<
HistoryOrderBean
>()
/**
fun
getHistoryOrderList
(
context
:
Context
,
pageIndex
:
String
,
orderNum
:
String
=
""
,
listener
:
(
HistoryOrderBean
?)
->
Unit
)
{
* 根據訂單id獲取訂單詳細信息
*/
fun
getHistoryOrderList
(
context
:
Context
,
pageIndex
:
String
,
orderNum
:
String
=
""
,
listener
:
(
HistoryOrderBean
)
->
Unit
)
{
launch
({
launch
({
var
phone
=
""
var
phone
=
""
var
orderNumber
=
""
var
orderNumber
=
""
...
@@ -39,11 +36,12 @@ class HistoryOrderViewModel(private val historyOrderRepository: HistoryOrderRepo
...
@@ -39,11 +36,12 @@ class HistoryOrderViewModel(private val historyOrderRepository: HistoryOrderRepo
if
(
pageIndex
==
"1"
)
{
if
(
pageIndex
==
"1"
)
{
data
.
value
=
this
data
.
value
=
this
}
}
listener
.
invoke
(
data
.
value
!!
)
listener
.
invoke
(
data
.
value
)
}
}
},
{
},
{
//出錯
//出錯
it
.
printStackTrace
()
it
.
printStackTrace
()
listener
.
invoke
(
null
)
})
})
}
}
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/model/viewModel/PageViewModel.kt
View file @
04c3d010
...
@@ -73,7 +73,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -73,7 +73,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
launch
({
launch
({
repository
.
getOrderGroup
(
restaurantId
).
apply
{
repository
.
getOrderGroup
(
restaurantId
).
apply
{
//先把所有置0
//先把所有置0
for
(
i
in
mOrderNum
)
{
for
(
i
in
mOrderNum
)
{
i
.
value
=
0
i
.
value
=
0
}
}
//遍歷獲得外賣自取的 待確認和製作中的總單數
//遍歷獲得外賣自取的 待確認和製作中的總單數
...
@@ -176,7 +176,6 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -176,7 +176,6 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
*/
*/
fun
setRestaurantState
(
context
:
Context
,
state
:
Boolean
)
{
fun
setRestaurantState
(
context
:
Context
,
state
:
Boolean
)
{
launch
({
launch
({
Log
.
e
(
"eee"
,
"點擊狀態$state"
)
if
(
state
)
{
if
(
state
)
{
updateRestOpenStatus
(
state
,
context
)
updateRestOpenStatus
(
state
,
context
)
}
else
{
}
else
{
...
@@ -315,6 +314,9 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -315,6 +314,9 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
})
})
}
}
/**
* 修改訂單狀態並打印
*/
private
suspend
fun
updateOrderAndPrint
(
data
:
OrderList
.
DataBeanX
.
DataBean
,
status
:
Int
,
isPush
:
Int
,
orderDetails
:
OrderDetails
,
context
:
Context
,
listener
:
(
Boolean
)
->
Unit
)
{
private
suspend
fun
updateOrderAndPrint
(
data
:
OrderList
.
DataBeanX
.
DataBean
,
status
:
Int
,
isPush
:
Int
,
orderDetails
:
OrderDetails
,
context
:
Context
,
listener
:
(
Boolean
)
->
Unit
)
{
updateOrderStatus
(
data
.
Id
.
toString
(),
""
,
status
,
""
,
""
,
isPush
,
data
.
order_type
).
apply
{
updateOrderStatus
(
data
.
Id
.
toString
(),
""
,
status
,
""
,
""
,
isPush
,
data
.
order_type
).
apply
{
if
(
status
==
0
||
status
==
1
||
status
==
2
)
{
if
(
status
==
0
||
status
==
1
||
status
==
2
)
{
...
@@ -323,18 +325,24 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -323,18 +325,24 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
//打印
//打印
//初始化用於打印的view
//初始化用於打印的view
//送單成功後,再調用接口獲取取餐碼
//送單成功後,再調用接口獲取取餐碼
getOrderInfo
(
data
.
Id
.
toString
()){
showLoading
(
context
)
if
(
it
!=
null
){
getOrderInfo
(
data
.
Id
.
toString
())
{
if
(
it
!=
null
)
{
printOrder
(
it
,
data
,
context
,
listener
)
printOrder
(
it
,
data
,
context
,
listener
)
}
}
cancelDialogForLoading
()
}
}
}
else
{
}
else
{
ToastUtils
.
show
(
context
,
"送單失敗"
)
ToastUtils
.
show
(
context
,
"送單失敗"
)
}
}
}
}
cancelDialogForLoading
()
}
}
}
}
/**
* 打印訂單
*/
private
fun
printOrder
(
orderDetails
:
OrderDetails
,
data
:
OrderList
.
DataBeanX
.
DataBean
,
context
:
Context
,
listener
:
(
Boolean
)
->
Unit
)
{
private
fun
printOrder
(
orderDetails
:
OrderDetails
,
data
:
OrderList
.
DataBeanX
.
DataBean
,
context
:
Context
,
listener
:
(
Boolean
)
->
Unit
)
{
if
(
orderDetails
.
data
!=
null
)
{
if
(
orderDetails
.
data
!=
null
)
{
//訂單信息和廚房單
//訂單信息和廚房單
...
@@ -457,6 +465,9 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -457,6 +465,9 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
})
})
}
}
/**
* 獲取餐廳第三方物流信息
*/
fun
getDeliveryConfigDTO
(
context
:
Context
)
{
fun
getDeliveryConfigDTO
(
context
:
Context
)
{
launch
({
launch
({
repository
.
getDeliveryConfigDTO
(
GsaCloudApplication
.
getRestaurantId
(
context
).
toString
()).
apply
{
repository
.
getDeliveryConfigDTO
(
GsaCloudApplication
.
getRestaurantId
(
context
).
toString
()).
apply
{
...
@@ -467,6 +478,34 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -467,6 +478,34 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
})
})
}
}
/**
* 取消物流
*/
fun
cancelLogistics
(
shopId
:
String
,
orderId
:
String
,
listener
:
(
String
)
->
Unit
)
{
launch
({
repository
.
cancelLogistics
(
shopId
,
orderId
).
apply
{
Log
.
e
(
"eee"
,
"請求結果$errMsg"
)
listener
.
invoke
(
errMsg
)
}
},
{
listener
.
invoke
(
"取消物流失敗"
)
})
}
/**
* 取消訂單,如果有物流需要先提示取消物流
*/
fun
cancelOrder
(
context
:
Context
,
orderId
:
String
,
listener
:
(
String
)
->
Unit
)
{
launch
({
repository
.
updateOrderStates
(
GsaCloudApplication
.
getMemberId
(
context
).
toString
(),
orderId
,
"6"
,
GsaCloudApplication
.
getMemberName
(
context
)).
apply
{
Log
.
e
(
"eee"
,
"取消訂單請求結果$this"
)
listener
.
invoke
(
this
)
}
},
{
listener
.
invoke
(
"取消訂單失敗"
)
})
}
private
fun
launch
(
block
:
suspend
()
->
Unit
,
error
:
suspend
(
Throwable
)
->
Unit
)
=
viewModelScope
.
launch
{
private
fun
launch
(
block
:
suspend
()
->
Unit
,
error
:
suspend
(
Throwable
)
->
Unit
)
=
viewModelScope
.
launch
{
try
{
try
{
...
@@ -476,4 +515,9 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -476,4 +515,9 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}
}
}
}
override
fun
onCleared
()
{
super
.
onCleared
()
cancelDialogForLoading
()
}
}
}
\ No newline at end of file
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/activity/HistoryOrderActivity.kt
View file @
04c3d010
...
@@ -47,31 +47,33 @@ class HistoryOrderActivity : BaseActivity() {
...
@@ -47,31 +47,33 @@ class HistoryOrderActivity : BaseActivity() {
showLoading
()
showLoading
()
mViewModel
.
getHistoryOrderList
(
this
,
page
.
toString
(),
orderNum
)
{
mViewModel
.
getHistoryOrderList
(
this
,
page
.
toString
(),
orderNum
)
{
cancelDialogForLoading
()
cancelDialogForLoading
()
refreshLayout
.
setEnableLoadMore
(
it
.
getData
()
!=
null
)
it
?.
let
{
refreshLayout
.
finishRefresh
()
refreshLayout
.
setEnableLoadMore
(
it
.
getData
()
!=
null
)
refreshLayout
.
finishLoadMore
()
refreshLayout
.
finishRefresh
()
if
(
mHistoryOrderAdapter
==
null
)
{
refreshLayout
.
finishLoadMore
()
mHistoryOrderAdapter
=
it
.
getData
()
?.
let
{
it1
->
HistoryOrderAdapter
(
this
@HistoryOrderActivity
,
it1
)
}
if
(
mHistoryOrderAdapter
==
null
)
{
rvOrderList
.
adapter
=
mHistoryOrderAdapter
mHistoryOrderAdapter
=
it
.
getData
()
?.
let
{
it1
->
HistoryOrderAdapter
(
this
@HistoryOrderActivity
,
it1
)
}
mHistoryOrderAdapter
!!
.
setOnItemClickListenter
{
rvOrderList
.
adapter
=
mHistoryOrderAdapter
showLoading
()
mHistoryOrderAdapter
!!
.
setOnItemClickListenter
{
mViewModel
.
getOrderInfo
(
it
.
Id
.
toString
())
{
it2
->
showLoading
()
cancelDialogForLoading
()
mViewModel
.
getOrderInfo
(
it
.
Id
.
toString
())
{
it2
->
if
(
it2
.
data
!=
null
&&
it2
.
data
!!
.
isNotEmpty
())
{
cancelDialogForLoading
()
//顯示彈窗
if
(
it2
.
data
!=
null
&&
it2
.
data
!!
.
isNotEmpty
())
{
OtherOrderUtils
.
showOrderDetailsDialog
(
this
@HistoryOrderActivity
,
it2
,
it
.
STATUS
,
it
.
order_type
,
false
)
{
_
,
_
->
//顯示彈窗
//確認訂單、指派送貨點擊事件
OtherOrderUtils
.
showOrderDetailsDialog
(
this
@HistoryOrderActivity
,
it2
,
it
.
STATUS
,
it
.
order_type
,
false
)
{
view
,
_
,
_
->
//確認訂單、指派送貨點擊事件
}
}
else
{
ToastUtils
.
show
(
this
,
"未查詢到訂單信息"
)
}
}
}
else
{
ToastUtils
.
show
(
this
,
"未查詢到訂單信息"
)
}
}
}
}
}
else
{
mHistoryOrderAdapter
!!
.
data
=
it
.
getData
()
mHistoryOrderAdapter
!!
.
notifyDataSetChanged
()
}
}
}
else
{
mHistoryOrderAdapter
!!
.
data
=
it
.
getData
()
mHistoryOrderAdapter
!!
.
notifyDataSetChanged
()
}
}
layoutNoData
.
setState
(
it
.
getData
()
==
null
||
it
.
getData
()
!!
.
size
<=
0
)
layoutNoData
.
setState
(
it
?
.
getData
()
==
null
||
it
.
getData
()
!!
.
size
<=
0
)
}
}
}
}
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/activity/OtherOrderActivity.kt
View file @
04c3d010
...
@@ -6,23 +6,19 @@ import android.content.Context
...
@@ -6,23 +6,19 @@ import android.content.Context
import
android.content.Intent
import
android.content.Intent
import
android.content.ServiceConnection
import
android.content.ServiceConnection
import
android.graphics.drawable.Drawable
import
android.graphics.drawable.Drawable
import
android.graphics.drawable.GradientDrawable
import
android.media.AudioAttributes
import
android.media.AudioAttributes
import
android.media.AudioManager
import
android.media.AudioManager
import
android.media.SoundPool
import
android.media.SoundPool
import
android.os.Build
import
android.os.Build
import
android.os.Bundle
import
android.os.Bundle
import
android.os.IBinder
import
android.os.IBinder
import
android.util.Log
import
android.view.View
import
android.view.View
import
android.widget.TextView
import
android.widget.TextView
import
androidx.core.animation.doOnEnd
import
androidx.databinding.DataBindingUtil
import
androidx.databinding.DataBindingUtil
import
androidx.lifecycle.MutableLiveData
import
androidx.lifecycle.MutableLiveData
import
androidx.lifecycle.Observer
import
androidx.lifecycle.Observer
import
androidx.lifecycle.ViewModelProvider
import
androidx.lifecycle.ViewModelProvider
import
androidx.viewpager.widget.ViewPager
import
androidx.viewpager.widget.ViewPager
import
com.gingersoft.gsa.cloud.base.application.GsaCloudApplication
import
com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils
import
com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils
import
com.gingersoft.gsa.cloud.ui.view.SwitchButton
import
com.gingersoft.gsa.cloud.ui.view.SwitchButton
import
com.gingersoft.gsa.other_order_mode.R
import
com.gingersoft.gsa.other_order_mode.R
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/fragment/PlaceholderFragment.kt
View file @
04c3d010
...
@@ -9,6 +9,8 @@ import androidx.lifecycle.MutableLiveData
...
@@ -9,6 +9,8 @@ import androidx.lifecycle.MutableLiveData
import
androidx.lifecycle.Observer
import
androidx.lifecycle.Observer
import
androidx.lifecycle.ViewModelProvider
import
androidx.lifecycle.ViewModelProvider
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.LinearLayoutManager
import
com.gingersoft.gsa.cloud.base.application.GsaCloudApplication
import
com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils
import
com.gingersoft.gsa.other_order_mode.R
import
com.gingersoft.gsa.other_order_mode.R
import
com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel
import
com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel
import
com.gingersoft.gsa.other_order_mode.ui.adapter.OtherOrdersAdapter
import
com.gingersoft.gsa.other_order_mode.ui.adapter.OtherOrdersAdapter
...
@@ -17,6 +19,7 @@ import com.gingersoft.gsa.other_order_mode.util.InjectorUtil
...
@@ -17,6 +19,7 @@ import com.gingersoft.gsa.other_order_mode.util.InjectorUtil
import
com.gingersoft.gsa.other_order_mode.util.OtherOrderUtils
import
com.gingersoft.gsa.other_order_mode.util.OtherOrderUtils
import
com.gingersoft.gsa.other_order_mode.util.setState
import
com.gingersoft.gsa.other_order_mode.util.setState
import
kotlinx.android.synthetic.main.fragment_other_order.*
import
kotlinx.android.synthetic.main.fragment_other_order.*
import
kotlin.String
as
String1
/**
/**
* A placeholder fragment containing a simple view.
* A placeholder fragment containing a simple view.
...
@@ -37,10 +40,10 @@ class PlaceholderFragment : BaseFragment() {
...
@@ -37,10 +40,10 @@ class PlaceholderFragment : BaseFragment() {
// 並且type一致
// 並且type一致
//如果當前fragment的狀態中包含需要刷新的狀態,獲取數據
//如果當前fragment的狀態中包含需要刷新的狀態,獲取數據
Log
.
e
(
"eee"
,
"$it,當前fragment的"
+
PageViewModel
.
fragmentStatus
[
arguments
?.
getInt
(
INDEX
)
!!
])
Log
.
e
(
"eee"
,
"$it,當前fragment的"
+
PageViewModel
.
fragmentStatus
[
arguments
?.
getInt
(
INDEX
)
!!
])
if
(
PageViewModel
.
fragmentStatus
[
arguments
?.
getInt
(
INDEX
)
!!
].
contains
(
it
.
toString
()))
{
if
(
PageViewModel
.
fragmentStatus
[
arguments
?.
getInt
(
INDEX
)
!!
].
contains
(
it
.
toString
()))
{
page
=
1
page
=
1
getOrderList
(
this
,
false
)
getOrderList
(
this
,
false
)
}
}
})
})
}
}
...
@@ -50,20 +53,40 @@ class PlaceholderFragment : BaseFragment() {
...
@@ -50,20 +53,40 @@ class PlaceholderFragment : BaseFragment() {
adapter
.
setOnItemClickListenter
{
data
->
adapter
.
setOnItemClickListenter
{
data
->
// 點擊查詢食品詳情
// 點擊查詢食品詳情
showLoading
()
pageViewModel
.
getOrderInfo
(
data
.
Id
.
toString
())
{
it1
->
pageViewModel
.
getOrderInfo
(
data
.
Id
.
toString
())
{
it1
->
//顯示彈窗
//顯示彈窗
cancelDialogForLoading
()
if
(
this
@PlaceholderFragment
.
context
!=
null
&&
it1
!=
null
)
{
if
(
this
@PlaceholderFragment
.
context
!=
null
&&
it1
!=
null
)
{
OtherOrderUtils
.
showOrderDetailsDialog
(
this
@PlaceholderFragment
.
context
!!
,
it1
,
data
.
STATUS
,
data
.
order_type
)
{
_
,
dialog
->
OtherOrderUtils
.
showOrderDetailsDialog
(
this
@PlaceholderFragment
.
context
!!
,
it1
,
data
.
STATUS
,
data
.
order_type
)
{
view
,
_
,
dialog
->
pageViewModel
.
updateOrderStatus
(
this
@PlaceholderFragment
.
context
!!
,
data
,
it1
)
{
when
(
view
.
id
)
{
dialog
.
dismiss
()
R
.
id
.
btn_assign_shipping
->
{
if
(
it
)
{
//修改訂單狀態
// 關閉彈窗,並刷新當前頁面
pageViewModel
.
updateOrderStatus
(
this
@PlaceholderFragment
.
context
!!
,
data
,
it1
)
{
refresh
()
dialog
.
dismiss
()
// pageViewModel.refreshState.postValue(pageViewModel.refreshState.value!! + 1)
if
(
it
)
{
// 關閉彈窗,並刷新當前頁面
refresh
()
}
}
}
R
.
id
.
btn_cancel_order
->
{
//取消訂單,先判斷有沒有物流
showLoading
()
if
(
it1
.
data
!!
[
0
].
isDelete
==
1
)
{
//本店配送的單,應該先需要召回
pageViewModel
.
cancelOrder
(
context
!!
,
data
.
Id
.
toString
()){
ToastUtils
.
show
(
context
,
it
)
cancelDialogForLoading
()
}
}
else
{
//第三方物流單,得先取消物流
pageViewModel
.
cancelLogistics
(
GsaCloudApplication
.
getRestaurantId
(
context
).
toString
(),
data
.
Id
.
toString
())
{
ToastUtils
.
show
(
context
,
it
)
cancelDialogForLoading
()
}
}
}
}
}
}
}
}
}
}
}
}
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/util/OtherOrderUtils.kt
View file @
04c3d010
...
@@ -2,7 +2,7 @@ package com.gingersoft.gsa.other_order_mode.util
...
@@ -2,7 +2,7 @@ package com.gingersoft.gsa.other_order_mode.util
import
android.app.Dialog
import
android.app.Dialog
import
android.content.Context
import
android.content.Context
import
android.
widget.Button
import
android.
view.View
import
android.widget.ImageView
import
android.widget.ImageView
import
android.widget.TextView
import
android.widget.TextView
import
androidx.databinding.DataBindingUtil
import
androidx.databinding.DataBindingUtil
...
@@ -17,7 +17,7 @@ import com.jess.arms.utils.ArmsUtils
...
@@ -17,7 +17,7 @@ import com.jess.arms.utils.ArmsUtils
object
OtherOrderUtils
{
object
OtherOrderUtils
{
fun
showOrderDetailsDialog
(
context
:
Context
,
data
:
OrderDetails
,
orderStuats
:
Int
,
orderType
:
Int
,
showBtn
:
Boolean
=
true
,
listenter
:
((
data
:
OrderDetails
.
DataBean
,
dialog
:
Dialog
)
->
Unit
)?)
{
fun
showOrderDetailsDialog
(
context
:
Context
,
data
:
OrderDetails
,
orderStuats
:
Int
,
orderType
:
Int
,
showBtn
:
Boolean
=
true
,
listenter
:
((
view
:
View
,
data
:
OrderDetails
.
DataBean
,
dialog
:
Dialog
)
->
Unit
)?)
{
object
:
DialogUtils
(
context
,
R
.
layout
.
layout_order_info_dialog_new
)
{
object
:
DialogUtils
(
context
,
R
.
layout
.
layout_order_info_dialog_new
)
{
override
fun
initLayout
(
hepler
:
ViewHepler
,
dialog
:
Dialog
)
{
override
fun
initLayout
(
hepler
:
ViewHepler
,
dialog
:
Dialog
)
{
if
(
data
.
data
!=
null
)
{
if
(
data
.
data
!=
null
)
{
...
@@ -30,7 +30,9 @@ object OtherOrderUtils {
...
@@ -30,7 +30,9 @@ object OtherOrderUtils {
//如果有物流號,就不顯示指派送貨按鈕
//如果有物流號,就不顯示指派送貨按鈕
layoutOrderInfoDialogBinding
.
showBtn
=
showBtn
layoutOrderInfoDialogBinding
.
showBtn
=
showBtn
val
btnContent
:
String
val
btnContent
:
String
val
type
=
if
(
orderType
==
7
)
"自取"
else
"外賣"
var
cancelBtnContent
=
""
val
type
=
if
(
orderType
==
7
)
"自取"
else
"外送"
val
orderStatus
:
String
val
orderStatus
:
String
when
(
orderStuats
)
{
when
(
orderStuats
)
{
...
@@ -40,10 +42,12 @@ object OtherOrderUtils {
...
@@ -40,10 +42,12 @@ object OtherOrderUtils {
btnContent
=
"製作完成"
btnContent
=
"製作完成"
tvStatus
.
setTextColor
(
context
.
resources
.
getColor
(
R
.
color
.
order_state0_color
))
tvStatus
.
setTextColor
(
context
.
resources
.
getColor
(
R
.
color
.
order_state0_color
))
}
else
{
}
else
{
btnContent
=
if
(
orderData
.
isDelete
==
1
)
{
if
(
orderData
.
isDelete
==
1
)
{
"指派送貨"
btnContent
=
"指派送貨"
cancelBtnContent
=
"取消訂單"
}
else
{
}
else
{
"重印"
btnContent
=
"重印"
cancelBtnContent
=
"取消物流"
}
}
tvStatus
.
setTextColor
(
context
.
resources
.
getColor
(
R
.
color
.
order_state1_color
))
tvStatus
.
setTextColor
(
context
.
resources
.
getColor
(
R
.
color
.
order_state1_color
))
}
}
...
@@ -64,19 +68,26 @@ object OtherOrderUtils {
...
@@ -64,19 +68,26 @@ object OtherOrderUtils {
btnContent
=
"確認訂單"
btnContent
=
"確認訂單"
orderStatus
=
"待確認"
orderStatus
=
"待確認"
tvStatus
.
setTextColor
(
context
.
resources
.
getColor
(
R
.
color
.
order_state0_color
))
tvStatus
.
setTextColor
(
context
.
resources
.
getColor
(
R
.
color
.
order_state0_color
))
cancelBtnContent
=
"取消訂單"
}
}
}
}
layoutOrderInfoDialogBinding
.
orderStatus
=
type
+
orderStatus
layoutOrderInfoDialogBinding
.
orderStatus
=
type
+
orderStatus
layoutOrderInfoDialogBinding
.
btnContent
=
btnContent
layoutOrderInfoDialogBinding
.
btnContent
=
btnContent
layoutOrderInfoDialogBinding
.
cancelBtnContent
=
cancelBtnContent
}
}
val
rvFood
:
RecyclerView
=
hepler
.
getView
(
R
.
id
.
rv_food
)
val
rvFood
:
RecyclerView
=
hepler
.
getView
(
R
.
id
.
rv_food
)
rvFood
.
layoutManager
=
LinearLayoutManager
(
context
)
rvFood
.
layoutManager
=
LinearLayoutManager
(
context
)
rvFood
.
adapter
=
FoodListAdapter
(
context
,
data
.
data
!!
[
0
].
PRODUCT_NAME
!!
)
rvFood
.
adapter
=
FoodListAdapter
(
context
,
data
.
data
!!
[
0
].
PRODUCT_NAME
!!
)
hepler
.
getView
<
Button
>(
R
.
id
.
btn_assign_shipping
).
setOnClickListener
{
hepler
.
setOnClickListenter
(
R
.
id
.
btn_assign_shipping
)
{
//指派送貨或是確認訂單?
//指派送貨或是確認訂單?
//確認訂單,調用接口,並打印
//確認訂單,調用接口,並打印
listenter
?.
invoke
(
data
.
data
!!
[
0
],
dialog
)
listenter
?.
invoke
(
it
,
data
.
data
!!
[
0
],
dialog
)
}
hepler
.
setOnClickListenter
(
R
.
id
.
btn_cancel_order
)
{
//取消訂單
listenter
?.
invoke
(
it
,
data
.
data
!!
[
0
],
dialog
)
}
}
hepler
.
getView
<
ImageView
>(
R
.
id
.
iv_close
).
setOnClickListener
{
hepler
.
getView
<
ImageView
>(
R
.
id
.
iv_close
).
setOnClickListener
{
...
...
other_order_mode/src/main/res/layout/layout_order_info_dialog_new.xml
View file @
04c3d010
...
@@ -28,6 +28,10 @@
...
@@ -28,6 +28,10 @@
type=
"String"
/>
type=
"String"
/>
<variable
<variable
name=
"cancelBtnContent"
type=
"String"
/>
<variable
name=
"orderStatus"
name=
"orderStatus"
type=
"String"
/>
type=
"String"
/>
...
@@ -43,8 +47,8 @@
...
@@ -43,8 +47,8 @@
<androidx.constraintlayout.widget.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_height=
"0dp"
android:background=
"@drawable/shape_dialog_bg"
android:layout_marginBottom=
"@dimen/dp_10"
android:layout_marginBottom=
"@dimen/dp_10"
android:background=
"@drawable/shape_dialog_bg"
android:paddingTop=
"@dimen/dp_15"
android:paddingTop=
"@dimen/dp_15"
android:paddingBottom=
"@dimen/dp_15"
android:paddingBottom=
"@dimen/dp_15"
app:layout_constraintBottom_toTopOf=
"@id/iv_close"
app:layout_constraintBottom_toTopOf=
"@id/iv_close"
...
@@ -247,6 +251,31 @@
...
@@ -247,6 +251,31 @@
<TextView
<TextView
android:id=
"@+id/tv_remark_text"
style=
"@style/otherOrderReceiving_title_textStyle"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/other_order_info_dialog_content_marginLeft"
android:layout_marginTop=
"@dimen/dp_8"
android:text=
"備註:"
android:visibility=
"@{data.remark==null||data.remark.length() == 0?View.GONE:View.VISIBLE}"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/tv_receive_address"
/>
<TextView
android:id=
"@+id/tv_remark"
style=
"@style/otherOrderReceiving_information_textStyle"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginRight=
"@dimen/other_order_info_dialog_content_marginRight"
android:gravity=
"right"
android:text=
"@{data.remark}"
android:visibility=
"@{data.remark==null||data.remark.length() == 0?View.GONE:View.VISIBLE}"
app:layout_constraintLeft_toRightOf=
"@id/tv_remark_text"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"@id/tv_remark_text"
/>
<TextView
android:id=
"@+id/tv_delivery_man_name_text"
android:id=
"@+id/tv_delivery_man_name_text"
style=
"@style/otherOrderReceiving_title_textStyle"
style=
"@style/otherOrderReceiving_title_textStyle"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
...
@@ -256,7 +285,7 @@
...
@@ -256,7 +285,7 @@
android:gravity=
"right"
android:gravity=
"right"
android:text=
"@string/deliveryman"
android:text=
"@string/deliveryman"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/tv_re
ceive_address
"
/>
app:layout_constraintTop_toBottomOf=
"@id/tv_re
mark
"
/>
<!-- android:visibility="@{(data.delivery_man_name==null || data.delivery_man_name.length()==0) ? View.GONE : View.VISIBLE}"-->
<!-- android:visibility="@{(data.delivery_man_name==null || data.delivery_man_name.length()==0) ? View.GONE : View.VISIBLE}"-->
...
@@ -290,8 +319,8 @@
...
@@ -290,8 +319,8 @@
style=
"@style/otherOrderReceiving_information_textStyle"
style=
"@style/otherOrderReceiving_information_textStyle"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:gravity=
"right"
android:layout_marginRight=
"@dimen/other_order_info_dialog_content_marginRight"
android:layout_marginRight=
"@dimen/other_order_info_dialog_content_marginRight"
android:gravity=
"right"
android:text=
"@{data.delivery_man_phone_num}"
android:text=
"@{data.delivery_man_phone_num}"
app:layout_constraintLeft_toRightOf=
"@id/tv_delivery_man_phone_text"
app:layout_constraintLeft_toRightOf=
"@id/tv_delivery_man_phone_text"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
...
@@ -522,6 +551,21 @@
...
@@ -522,6 +551,21 @@
android:textColor=
"@color/white"
android:textColor=
"@color/white"
android:textSize=
"@dimen/dp_16"
android:textSize=
"@dimen/dp_16"
android:visibility=
"@{showBtn?View.VISIBLE:View.GONE}"
android:visibility=
"@{showBtn?View.VISIBLE:View.GONE}"
app:layout_constraintBottom_toTopOf=
"@id/btn_cancel_order"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
/>
<Button
android:id=
"@+id/btn_cancel_order"
android:layout_width=
"0dp"
android:layout_height=
"@dimen/dp_40"
android:layout_marginLeft=
"@dimen/other_order_info_dialog_content_marginLeft"
android:layout_marginRight=
"@dimen/other_order_info_dialog_content_marginRight"
android:background=
"@drawable/shape_green_btn"
android:text=
"@{cancelBtnContent}"
android:textColor=
"@color/white"
android:textSize=
"@dimen/dp_16"
android:visibility=
"@{(cancelBtnContent==null||cancelBtnContent.length()==0)?View.GONE:View.VISIBLE}"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
/>
app:layout_constraintRight_toRightOf=
"parent"
/>
...
...
other_order_mode/src/main/res/layout/layout_other_order_item.xml
View file @
04c3d010
...
@@ -100,13 +100,14 @@
...
@@ -100,13 +100,14 @@
<TextView
<TextView
android:id=
"@+id/tv_order_user_name"
android:id=
"@+id/tv_order_user_name"
android:layout_width=
"
wrap_content
"
android:layout_width=
"
0dp
"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_5"
android:layout_marginTop=
"@dimen/dp_5"
android:text=
"@{data.rECEIVER}"
android:text=
"@{data.rECEIVER}"
android:textColor=
"@color/theme_text_color"
android:textColor=
"@color/theme_text_color"
android:textSize=
"@dimen/sp_14"
android:textSize=
"@dimen/sp_14"
android:textStyle=
"bold"
android:textStyle=
"bold"
app:layout_constraintRight_toLeftOf=
"@id/tv_order_time"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/tv_ordering_method"
/>
app:layout_constraintTop_toBottomOf=
"@id/tv_ordering_method"
/>
...
@@ -117,7 +118,6 @@
...
@@ -117,7 +118,6 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/dp_5"
android:layout_marginLeft=
"@dimen/dp_5"
android:text=
"@{TimeUtils.parseTimeRepeat(data.cREATE_TIME,TimeUtils.DEFAULT_DATE_FORMAT)}"
android:text=
"@{TimeUtils.parseTimeRepeat(data.cREATE_TIME,TimeUtils.DEFAULT_DATE_FORMAT)}"
app:layout_constraintBottom_toBottomOf=
"@id/tv_order_user_name"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"@id/tv_order_user_name"
/>
app:layout_constraintTop_toTopOf=
"@id/tv_order_user_name"
/>
...
...
print-module/src/main/java/com/joe/print/mvp/print/PrintOtherOrder.java
View file @
04c3d010
...
@@ -184,7 +184,7 @@ public class PrintOtherOrder extends PrinterRoot {
...
@@ -184,7 +184,7 @@ public class PrintOtherOrder extends PrinterRoot {
private
Bitmap
initPrintView
(
Context
context
,
OrderDetails
.
DataBean
data
)
{
private
Bitmap
initPrintView
(
Context
context
,
OrderDetails
.
DataBean
data
)
{
View
view
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
print_confirm_order_view
,
null
,
false
);
View
view
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
print_confirm_order_view
,
null
,
false
);
// 訂單類型
// 訂單類型
setText
(
view
,
R
.
id
.
tv_order_type
,
data
.
getOrder_type
()
==
2
?
"外
賣
"
:
"自取"
);
setText
(
view
,
R
.
id
.
tv_order_type
,
data
.
getOrder_type
()
==
2
?
"外
送
"
:
"自取"
);
// 訂單號
// 訂單號
setText
(
view
,
R
.
id
.
tv_order_number
,
"訂單號:"
+
data
.
getORDER_NO
());
setText
(
view
,
R
.
id
.
tv_order_number
,
"訂單號:"
+
data
.
getORDER_NO
());
if
(
data
.
getTakeFoodCode
()
!=
null
&&
!
data
.
getTakeFoodCode
().
equals
(
"0"
))
{
if
(
data
.
getTakeFoodCode
()
!=
null
&&
!
data
.
getTakeFoodCode
().
equals
(
"0"
))
{
...
...
print-module/src/main/java/com/joe/print/mvp/ui/activity/PrintActivity.java
View file @
04c3d010
...
@@ -119,9 +119,8 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
...
@@ -119,9 +119,8 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
if
(
printerInIt
!=
null
)
{
if
(
printerInIt
!=
null
)
{
printerInIt
.
setmContext
(
mContext
).
setPrintListener
(
this
);
printerInIt
.
setmContext
(
mContext
).
setPrintListener
(
this
);
}
}
PrinterDeviceDaoUtils
printerDeviceDaoUtils
=
new
PrinterDeviceDaoUtils
(
mContext
);
PrinterDeviceDaoUtils
printerDeviceDaoUtils
=
new
PrinterDeviceDaoUtils
(
this
);
printerDeviceBeans
=
printerDeviceDaoUtils
.
queryAllPrinterDeviceBean
();
printerDeviceBeans
=
printerDeviceDaoUtils
.
queryAllPrinterDeviceBean
();
if
(
type
==
PrinterRoot
.
PRINT_TEST
)
{
if
(
type
==
PrinterRoot
.
PRINT_TEST
)
{
if
(
deviceBean
!=
null
)
{
if
(
deviceBean
!=
null
)
{
printerInIt
.
ipDevicePrint
(
deviceBean
,
printerInIt
.
getPrintBitmap
(
mContext
).
get
(
""
));
printerInIt
.
ipDevicePrint
(
deviceBean
,
printerInIt
.
getPrintBitmap
(
mContext
).
get
(
""
));
...
@@ -311,6 +310,7 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
...
@@ -311,6 +310,7 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
private
void
addPrintDevice
()
{
private
void
addPrintDevice
()
{
ToastUtils
.
show
(
mContext
,
"沒有打印機,請添加"
);
ToastUtils
.
show
(
mContext
,
"沒有打印機,請添加"
);
printFile
();
// startActivityForResult(new Intent(mContext, PrinterAddActivity.class), ADD_PRINT_CODE);
// startActivityForResult(new Intent(mContext, PrinterAddActivity.class), ADD_PRINT_CODE);
}
}
...
...
print-module/src/main/java/com/joe/print/mvp/ui/activity/PrinterAddActivity.java
View file @
04c3d010
...
@@ -139,9 +139,9 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
...
@@ -139,9 +139,9 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
@Override
@Override
public
void
initIntent
()
{
public
void
initIntent
()
{
int
position
=
getIntent
().
getIntExtra
(
"printer_position"
,
0
);
int
position
=
getIntent
().
getIntExtra
(
"printer_position"
,
-
1
);
devicess
=
(
List
<
PrinterDeviceBean
>)
getIntent
().
getSerializableExtra
(
"printList"
);
devicess
=
(
List
<
PrinterDeviceBean
>)
getIntent
().
getSerializableExtra
(
"printList"
);
if
(
devicess
!=
null
)
{
if
(
devicess
!=
null
&&
position
!=
-
1
)
{
printerDeviceBean
=
devicess
.
get
(
position
);
printerDeviceBean
=
devicess
.
get
(
position
);
if
(
printerDeviceBean
!=
null
)
{
if
(
printerDeviceBean
!=
null
)
{
devicess
.
remove
(
position
);
//從打印機列表中移除掉當前打印機,選擇飛單時不能選擇當前打印機
devicess
.
remove
(
position
);
//從打印機列表中移除掉當前打印機,選擇飛單時不能選擇當前打印機
...
@@ -245,11 +245,15 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
...
@@ -245,11 +245,15 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
.
createDialogView
()
.
createDialogView
()
.
setOnDismissListener
(
dialog
->
{
.
setOnDismissListener
(
dialog
->
{
if
(
viewId
==
R
.
id
.
layout_select_fail_one
)
{
if
(
viewId
==
R
.
id
.
layout_select_fail_one
)
{
mTvFailNameOne
.
setText
(
devicess
.
get
(
oneFailPosition
).
getName
());
if
(
oneFailPosition
<
devicess
.
size
()
&&
oneFailPosition
>=
0
)
{
mTvFailNameOne
.
setTextColor
(
getResources
().
getColor
(
R
.
color
.
color_3c
));
mTvFailNameOne
.
setText
(
devicess
.
get
(
oneFailPosition
).
getName
());
mTvFailNameOne
.
setTextColor
(
getResources
().
getColor
(
R
.
color
.
color_3c
));
}
}
else
{
}
else
{
mTvFailNameTwo
.
setText
(
devicess
.
get
(
twoFailPosition
).
getName
());
if
(
twoFailPosition
<
devicess
.
size
()
&&
twoFailPosition
>=
0
)
{
mTvFailNameTwo
.
setTextColor
(
getResources
().
getColor
(
R
.
color
.
color_3c
));
mTvFailNameTwo
.
setText
(
devicess
.
get
(
twoFailPosition
).
getName
());
mTvFailNameTwo
.
setTextColor
(
getResources
().
getColor
(
R
.
color
.
color_3c
));
}
}
}
})
})
.
show
();
.
show
();
...
@@ -259,7 +263,7 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
...
@@ -259,7 +263,7 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
* 添加或測試打印機
* 添加或測試打印機
*/
*/
private
void
addOrTestPrint
(
View
v
)
{
private
void
addOrTestPrint
(
View
v
)
{
if
(
mEdPrintName
.
getText
()
==
null
||
mEdPrintName
.
getText
().
toString
().
isEmpty
())
{
if
(
mEdPrintName
.
getText
()
==
null
||
mEdPrintName
.
getText
().
toString
().
isEmpty
())
{
ToastUtils
.
show
(
mContext
,
"請輸入打印機名稱"
);
ToastUtils
.
show
(
mContext
,
"請輸入打印機名稱"
);
return
;
return
;
}
}
...
...
print-module/src/main/java/com/joe/print/mvp/ui/activity/PrinterListActivity.java
View file @
04c3d010
...
@@ -76,6 +76,8 @@ public class PrinterListActivity extends BaseActivity<PrintListPresenter> implem
...
@@ -76,6 +76,8 @@ public class PrinterListActivity extends BaseActivity<PrintListPresenter> implem
initViewPager
();
initViewPager
();
}
}
private
IpPrintListActivityFragment
ipPrintListActivityFragment
;
/**
/**
* 设置Viewpager的适配器
* 设置Viewpager的适配器
*/
*/
...
@@ -87,7 +89,8 @@ public class PrinterListActivity extends BaseActivity<PrintListPresenter> implem
...
@@ -87,7 +89,8 @@ public class PrinterListActivity extends BaseActivity<PrintListPresenter> implem
mFragments
.
add
(
LocalPrintFragment
.
newInstance
());
mFragments
.
add
(
LocalPrintFragment
.
newInstance
());
}
}
titles
.
add
(
"網絡打印"
);
titles
.
add
(
"網絡打印"
);
mFragments
.
add
(
IpPrintListActivityFragment
.
newInstance
());
ipPrintListActivityFragment
=
IpPrintListActivityFragment
.
newInstance
();
mFragments
.
add
(
ipPrintListActivityFragment
);
//实例化适配器
//实例化适配器
mTabFragmentAdapter
=
new
TabFragmentAdapter
(
getSupportFragmentManager
(),
1
);
mTabFragmentAdapter
=
new
TabFragmentAdapter
(
getSupportFragmentManager
(),
1
);
...
@@ -109,7 +112,11 @@ public class PrinterListActivity extends BaseActivity<PrintListPresenter> implem
...
@@ -109,7 +112,11 @@ public class PrinterListActivity extends BaseActivity<PrintListPresenter> implem
topBar
.
setTitle
(
"打印設置"
);
topBar
.
setTitle
(
"打印設置"
);
topBar
.
setBackgroundColor
(
getResources
().
getColor
(
R
.
color
.
theme_color
));
topBar
.
setBackgroundColor
(
getResources
().
getColor
(
R
.
color
.
theme_color
));
topBar
.
addLeftImageButton
(
R
.
drawable
.
icon_return
,
R
.
id
.
iv_left_back
).
setOnClickListener
(
v
->
finish
());
topBar
.
addLeftImageButton
(
R
.
drawable
.
icon_return
,
R
.
id
.
iv_left_back
).
setOnClickListener
(
v
->
finish
());
topBar
.
addRightImageButton
(
R
.
drawable
.
ic_add
,
R
.
id
.
printer_add
).
setOnClickListener
(
v
->
startActivity
(
new
Intent
(
mContext
,
PrinterAddActivity
.
class
)));
topBar
.
addRightImageButton
(
R
.
drawable
.
ic_add
,
R
.
id
.
printer_add
).
setOnClickListener
(
v
->
{
if
(
ipPrintListActivityFragment
!=
null
&&
ipPrintListActivityFragment
.
isAdded
())
{
ipPrintListActivityFragment
.
startToEditPrint
(-
1
);
}
});
}
}
@Override
@Override
...
...
print-module/src/main/java/com/joe/print/mvp/ui/adapter/PrinterListAdapter.java
View file @
04c3d010
...
@@ -39,9 +39,13 @@ public class PrinterListAdapter extends BaseQuickAdapter<PrinterDeviceBean, Base
...
@@ -39,9 +39,13 @@ public class PrinterListAdapter extends BaseQuickAdapter<PrinterDeviceBean, Base
}
}
((
RadioButton
)
helper
.
getView
(
R
.
id
.
cb_printer_item
)).
setChecked
(
item
.
getStatus
()
==
2
);
((
RadioButton
)
helper
.
getView
(
R
.
id
.
cb_printer_item
)).
setChecked
(
item
.
getStatus
()
==
2
);
helper
.
getView
(
R
.
id
.
tv_default_print
).
setVisibility
(
item
.
getStatus
()
==
2
?
View
.
VISIBLE
:
View
.
GONE
);
helper
.
getView
(
R
.
id
.
tv_default_print
).
setVisibility
(
item
.
getStatus
()
==
2
?
View
.
VISIBLE
:
View
.
GONE
);
// helper.setOnItemSelectedClickListener(R.id.layout_delete,)
helper
.
addOnClickListener
(
R
.
id
.
layout_delete
);
}
}
public
int
getSelectPosition
()
{
public
int
getSelectPosition
()
{
return
selectPosition
;
return
selectPosition
;
}
}
...
...
print-module/src/main/java/com/joe/print/mvp/ui/fragment/IpPrintListActivityFragment.java
View file @
04c3d010
package
com
.
joe
.
print
.
mvp
.
ui
.
fragment
;
package
com
.
joe
.
print
.
mvp
.
ui
.
fragment
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.graphics.Color
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.os.Message
;
import
android.os.Message
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
...
@@ -18,10 +17,9 @@ import androidx.recyclerview.widget.RecyclerView;
...
@@ -18,10 +17,9 @@ import androidx.recyclerview.widget.RecyclerView;
import
com.gingersoft.gsa.cloud.base.application.GsaCloudApplication
;
import
com.gingersoft.gsa.cloud.base.application.GsaCloudApplication
;
import
com.gingersoft.gsa.cloud.base.common.bean.PrinterManger.PrinterManager
;
import
com.gingersoft.gsa.cloud.base.common.bean.PrinterManger.PrinterManager
;
import
com.gingersoft.gsa.cloud.base.utils.JsonUtils
;
import
com.gingersoft.gsa.cloud.base.utils.other.SPUtils
;
import
com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean
;
import
com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean
;
import
com.gingersoft.gsa.cloud.database.utils.PrinterDeviceDaoUtils
;
import
com.gingersoft.gsa.cloud.database.utils.PrinterDeviceDaoUtils
;
import
com.gingersoft.gsa.cloud.ui.utils.AppDialog
;
import
com.jess.arms.base.BaseFragment
;
import
com.jess.arms.base.BaseFragment
;
import
com.jess.arms.di.component.AppComponent
;
import
com.jess.arms.di.component.AppComponent
;
import
com.jess.arms.utils.ArmsUtils
;
import
com.jess.arms.utils.ArmsUtils
;
...
@@ -31,15 +29,12 @@ import com.joe.print.di.component.DaggerIpPrintListActivityComponent;
...
@@ -31,15 +29,12 @@ import com.joe.print.di.component.DaggerIpPrintListActivityComponent;
import
com.joe.print.di.module.IpPrintListActivityModule
;
import
com.joe.print.di.module.IpPrintListActivityModule
;
import
com.joe.print.mvp.contract.IpPrintListActivityContract
;
import
com.joe.print.mvp.contract.IpPrintListActivityContract
;
import
com.joe.print.mvp.presenter.IpPrintListActivityPresenter
;
import
com.joe.print.mvp.presenter.IpPrintListActivityPresenter
;
import
com.gingersoft.gsa.cloud.constans.PrintConstans
;
import
com.joe.print.mvp.ui.activity.PrinterAddActivity
;
import
com.joe.print.mvp.ui.activity.PrinterAddActivity
;
import
com.joe.print.mvp.ui.adapter.PrinterListAdapter
;
import
com.joe.print.mvp.ui.adapter.PrinterListAdapter
;
import
com.yanzhenjie.recyclerview.SwipeMenuCreator
;
import
com.yanzhenjie.recyclerview.SwipeMenuCreator
;
import
com.yanzhenjie.recyclerview.SwipeMenuItem
;
import
com.yanzhenjie.recyclerview.SwipeRecyclerView
;
import
com.yanzhenjie.recyclerview.SwipeRecyclerView
;
import
com.yanzhenjie.recyclerview.touch.OnItemMoveListener
;
import
com.yanzhenjie.recyclerview.touch.OnItemMoveListener
;
import
com.yanzhenjie.recyclerview.touch.OnItemStateChangedListener
;
import
com.yanzhenjie.recyclerview.touch.OnItemStateChangedListener
;
import
com.yanzhenjie.recyclerview.widget.DefaultItemDecoration
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.Collections
;
import
java.util.Collections
;
...
@@ -166,16 +161,16 @@ public class IpPrintListActivityFragment extends BaseFragment<IpPrintListActivit
...
@@ -166,16 +161,16 @@ public class IpPrintListActivityFragment extends BaseFragment<IpPrintListActivit
// 1. MATCH_PARENT 自适应高度,保持和Item一样高;
// 1. MATCH_PARENT 自适应高度,保持和Item一样高;
// 2. 指定具体的高,比如80;
// 2. 指定具体的高,比如80;
// 3. WRAP_CONTENT,自身高度,不推荐;
// 3. WRAP_CONTENT,自身高度,不推荐;
int
height
=
ViewGroup
.
LayoutParams
.
MATCH_PARENT
;
//
int height = ViewGroup.LayoutParams.MATCH_PARENT;
// 添加右侧的按鈕。
// 添加右侧的按鈕。
SwipeMenuItem
deleteItem
=
new
SwipeMenuItem
(
mContext
).
setBackground
(
//
SwipeMenuItem deleteItem = new SwipeMenuItem(mContext).setBackground(
R
.
color
.
theme_color
)
//
R.color.theme_color)
// .setImage(R.drawable.ic_action_delete)
//
//
.setImage(R.drawable.ic_action_delete)
.
setText
(
"刪除"
)
//
.setText("刪除")
.
setTextColor
(
Color
.
WHITE
)
//
.setTextColor(Color.WHITE)
.
setWidth
(
width
)
//
.setWidth(width)
.
setHeight
(
height
);
//
.setHeight(height);
swipeRightMenu
.
addMenuItem
(
deleteItem
);
// 添加一个按钮到右侧侧菜单。
//
swipeRightMenu.addMenuItem(deleteItem);// 添加一个按钮到右侧侧菜单。
};
};
/**
/**
...
@@ -216,27 +211,24 @@ public class IpPrintListActivityFragment extends BaseFragment<IpPrintListActivit
...
@@ -216,27 +211,24 @@ public class IpPrintListActivityFragment extends BaseFragment<IpPrintListActivit
if
(
printListAdapter
==
null
)
{
if
(
printListAdapter
==
null
)
{
mRvPrintList
.
setOnItemClickListener
((
view
,
adapterPosition
)
->
{
mRvPrintList
.
setOnItemClickListener
((
view
,
adapterPosition
)
->
{
//item點擊事件 打開打印機詳情
//item點擊事件 打開打印機詳情
Intent
intent
=
new
Intent
(
mContext
,
PrinterAddActivity
.
class
);
startToEditPrint
(
adapterPosition
);
intent
.
putExtra
(
"printer_position"
,
adapterPosition
);
intent
.
putExtra
(
"printList"
,
(
Serializable
)
devicess
);
startActivity
(
intent
);
});
});
//menu 右侧菜單點擊事件
//menu 右侧菜單點擊事件
mRvPrintList
.
setOnItemMenuClickListener
((
menuBridge
,
position
)
->
{
//
mRvPrintList.setOnItemMenuClickListener((menuBridge, position) -> {
//刪除按鈕點擊事件
//
//刪除按鈕點擊事件
menuBridge
.
closeMenu
();
//
menuBridge.closeMenu();
//調用刪除接口
//
//調用刪除接口
mPresenter
.
deletePrinter
(
devicess
.
get
(
position
).
getId
()
+
""
);
//
mPresenter.deletePrinter(devicess.get(position).getId() + "");
if
(
printListAdapter
.
getSelectPosition
()
==
position
)
{
//
if (printListAdapter.getSelectPosition() == position) {
//如果刪除的是當前選中的默認打印機,那麼移除默認打印機
//
//如果刪除的是當前選中的默認打印機,那麼移除默認打印機
SPUtils
.
remove
(
mContext
,
PrintConstans
.
DEFAULT_PRINT_IP
);
//
SPUtils.remove(mContext, PrintConstans.DEFAULT_PRINT_IP);
SPUtils
.
remove
(
mContext
,
PrintConstans
.
DEFAULT_PRINT_PORT
);
//
SPUtils.remove(mContext, PrintConstans.DEFAULT_PRINT_PORT);
SPUtils
.
remove
(
mContext
,
PrintConstans
.
DEFAULT_PRINT_PAPER
);
//
SPUtils.remove(mContext, PrintConstans.DEFAULT_PRINT_PAPER);
printListAdapter
.
setSelectPosition
(-
1
);
//
printListAdapter.setSelectPosition(-1);
}
//
}
devicess
.
remove
(
position
);
//
devicess.remove(position);
printListAdapter
.
notifyItemRemoved
(
position
);
//
printListAdapter.notifyItemRemoved(position);
});
//
});
// Item的Menu点击。
// Item的Menu点击。
mRvPrintList
.
setOnItemStateChangedListener
(
mOnItemStateChangedListener
);
// 监听Item的手指状态,拖拽、侧滑、松开。
mRvPrintList
.
setOnItemStateChangedListener
(
mOnItemStateChangedListener
);
// 监听Item的手指状态,拖拽、侧滑、松开。
mRvPrintList
.
setLongPressDragEnabled
(
true
);
// 长按拖拽,默认关闭。
mRvPrintList
.
setLongPressDragEnabled
(
true
);
// 长按拖拽,默认关闭。
...
@@ -270,6 +262,18 @@ public class IpPrintListActivityFragment extends BaseFragment<IpPrintListActivit
...
@@ -270,6 +262,18 @@ public class IpPrintListActivityFragment extends BaseFragment<IpPrintListActivit
});
// 监听拖拽和侧滑删除,更新UI和数据源。
});
// 监听拖拽和侧滑删除,更新UI和数据源。
printListAdapter
=
new
PrinterListAdapter
(
devicess
,
mContext
);
printListAdapter
=
new
PrinterListAdapter
(
devicess
,
mContext
);
printListAdapter
.
setOnItemChildClickListener
((
adapter
,
view
,
position
)
->
AppDialog
.
showWaringDialog
(
mContext
,
"是否刪除打印機"
,
(
view1
,
dialog
)
->
{
//調用刪除接口
mPresenter
.
deletePrinter
(
devicess
.
get
(
position
).
getId
()
+
""
);
devicess
.
remove
(
position
);
printListAdapter
.
notifyItemRemoved
(
position
);
dialog
.
dismiss
();
if
(
devicess
==
null
||
devicess
.
size
()
==
0
)
{
mTvAddPrint
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
mTvAddPrint
.
setVisibility
(
View
.
GONE
);
}
}));
mRvPrintList
.
setLayoutManager
(
new
LinearLayoutManager
(
mContext
));
mRvPrintList
.
setLayoutManager
(
new
LinearLayoutManager
(
mContext
));
//分割线
//分割线
// mRvPrintList.addItemDecoration(new DefaultItemDecoration(ContextCompat.getColor(mContext, R.color.line_color)));
// mRvPrintList.addItemDecoration(new DefaultItemDecoration(ContextCompat.getColor(mContext, R.color.line_color)));
...
@@ -281,6 +285,13 @@ public class IpPrintListActivityFragment extends BaseFragment<IpPrintListActivit
...
@@ -281,6 +285,13 @@ public class IpPrintListActivityFragment extends BaseFragment<IpPrintListActivit
}
}
}
}
public
void
startToEditPrint
(
int
adapterPosition
)
{
Intent
intent
=
new
Intent
(
mContext
,
PrinterAddActivity
.
class
);
intent
.
putExtra
(
"printer_position"
,
adapterPosition
);
intent
.
putExtra
(
"printList"
,
(
Serializable
)
devicess
);
startActivity
(
intent
);
}
@Override
@Override
public
void
loadFile
()
{
public
void
loadFile
()
{
mRvPrintList
.
setVisibility
(
View
.
GONE
);
mRvPrintList
.
setVisibility
(
View
.
GONE
);
...
@@ -291,7 +302,7 @@ public class IpPrintListActivityFragment extends BaseFragment<IpPrintListActivit
...
@@ -291,7 +302,7 @@ public class IpPrintListActivityFragment extends BaseFragment<IpPrintListActivit
@Override
@Override
public
void
onClick
(
View
v
)
{
public
void
onClick
(
View
v
)
{
if
(
v
.
getId
()
==
R
.
id
.
tv_add_print
)
{
if
(
v
.
getId
()
==
R
.
id
.
tv_add_print
)
{
start
Activity
(
new
Intent
(
mContext
,
PrinterAddActivity
.
class
)
);
start
ToEditPrint
(-
1
);
}
}
}
}
}
}
print-module/src/main/res/layout/print_confirm_order_view.xml
View file @
04c3d010
...
@@ -97,7 +97,7 @@
...
@@ -97,7 +97,7 @@
style=
"@style/printOtherOrderTextStyle_font_style_twenty"
style=
"@style/printOtherOrderTextStyle_font_style_twenty"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
'
下
單時間'
/>
android:text=
'
開
單時間'
/>
<TextView
<TextView
android:id=
"@+id/tv_remark"
android:id=
"@+id/tv_remark"
...
...
print-module/src/main/res/layout/printer_item.xml
View file @
04c3d010
...
@@ -74,13 +74,29 @@
...
@@ -74,13 +74,29 @@
android:id=
"@+id/tv_printer_edit"
android:id=
"@+id/tv_printer_edit"
android:layout_width=
"@dimen/dp_17"
android:layout_width=
"@dimen/dp_17"
android:layout_height=
"@dimen/dp_17"
android:layout_height=
"@dimen/dp_17"
android:layout_marginRight=
"@dimen/dp_1
9
"
android:layout_marginRight=
"@dimen/dp_1
0
"
android:src=
"@drawable/ic_edit"
android:src=
"@drawable/ic_edit"
android:text=
"編輯"
android:text=
"編輯"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintRight_to
RightOf=
"parent
"
app:layout_constraintRight_to
LeftOf=
"@id/layout_delete
"
app:layout_constraintTop_toTopOf=
"parent"
/>
app:layout_constraintTop_toTopOf=
"parent"
/>
<FrameLayout
android:id=
"@+id/layout_delete"
android:layout_width=
"wrap_content"
android:layout_height=
"0dp"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginRight=
"@dimen/dp_19"
android:src=
"@drawable/ic_delete_bill_method"
/>
</FrameLayout>
<View
<View
android:id=
"@+id/horizontal_dividing_line"
android:id=
"@+id/horizontal_dividing_line"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
...
print-module/src/main/res/values/strings.xml
View file @
04c3d010
...
@@ -3,6 +3,6 @@
...
@@ -3,6 +3,6 @@
<string
name=
"print_port"
>
端口號:%1$s
</string>
<string
name=
"print_port"
>
端口號:%1$s
</string>
<string
name=
"create_order_time"
>
下
單時間:
</string>
<string
name=
"create_order_time"
>
開
單時間:
</string>
<string
name=
"address"
>
地址:
</string>
<string
name=
"address"
>
地址:
</string>
</resources>
</resources>
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