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
0fc0adee
Commit
0fc0adee
authored
Jun 23, 2020
by
Wyh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
6.23 心跳優化,接單一些生命週期問題優化,接單功能首頁位置調整,打印自取單不顯示收貨人信息
parent
ea569098
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
133 additions
and
86 deletions
+133
-86
config.gradle
+2
-2
main-module/src/main/java/com/gingersoft/gsa/cloud/main/mvp/ui/activity/NewMainActivity.java
+3
-3
other_order_mode/src/main/AndroidManifest.xml
+10
-6
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/model/viewModel/PageViewModel.kt
+16
-47
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/service/GetInfoUpdateService.kt
+48
-6
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/activity/OtherOrderActivity.kt
+30
-6
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/fragment/PlaceholderFragment.kt
+7
-8
print-module/build.gradle
+4
-3
print-module/src/main/java/com/joe/print/mvp/print/PrintOtherOrder.java
+13
-5
No files found.
config.gradle
View file @
0fc0adee
...
...
@@ -5,8 +5,8 @@ ext {
buildToolsVersion:
'28.0.3'
,
minSdkVersion
:
19
,
//N5收銀機應用安卓開發環境要求Android OS Version: 5.1Android SDK Min Version: 19
targetSdkVersion
:
28
,
versionCode
:
1
,
versionName
:
"1.0.
0
"
versionCode
:
6
,
versionName
:
"1.0.
6
"
]
version
=
[
...
...
main-module/src/main/java/com/gingersoft/gsa/cloud/main/mvp/ui/activity/NewMainActivity.java
View file @
0fc0adee
...
...
@@ -230,13 +230,13 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
// if (!BuildConfig.DEBUG) {
functions
.
add
(
new
Function
((
long
)
150
,
0
,
5
,
"點餐"
,
0
,
0
));
functions
.
add
(
new
Function
((
long
)
138
,
150
,
5
,
"餐檯模式"
,
R
.
drawable
.
ic_dining_table_mode
,
0
));
functions
.
add
(
new
Function
((
long
)
139
,
150
,
5
,
"外送
模式"
,
R
.
drawable
.
ic_delivery_mode_clos
e
,
0
));
functions
.
add
(
new
Function
((
long
)
139
,
150
,
5
,
"外送
/自取"
,
R
.
drawable
.
ic_delivery_mod
e
,
0
));
functions
.
add
(
new
Function
((
long
)
140
,
150
,
5
,
"外賣模式"
,
R
.
drawable
.
ic_outsourcing_model_close
,
0
));
functions
.
add
(
new
Function
((
long
)
141
,
150
,
5
,
"預點餐模式"
,
R
.
drawable
.
ic_pre_order_mode_close
,
1
));
functions
.
add
(
new
Function
((
long
)
151
,
0
,
5
,
"管理"
,
0
,
0
));
functions
.
add
(
new
Function
((
long
)
142
,
151
,
5
,
"賬單管理"
,
R
.
drawable
.
ic_meals_menu_management
,
0
));
functions
.
add
(
new
Function
((
long
)
142
,
151
,
5
,
"外賣接單"
,
R
.
drawable
.
ic_takeaway_orders
,
0
));
//
functions.add(new Function((long) 142, 151, 5, "外賣接單", R.drawable.ic_takeaway_orders, 0));
functions
.
add
(
new
Function
((
long
)
143
,
151
,
5
,
"餐檯管理"
,
R
.
drawable
.
ic_dining_table_management
,
0
));
functions
.
add
(
new
Function
((
long
)
144
,
151
,
5
,
"打印管理"
,
R
.
drawable
.
ic_print_management
,
0
));
//// functions.add(new Function((long) 145, 151, 5, "支付管理", R.drawable.ic_pay_management_close, 1));
...
...
@@ -315,7 +315,7 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
.
setActionName
(
"showOrderCenterActivity"
)
.
build
()
.
call
();
}
else
if
(
name
.
equals
(
"外
賣接單
"
))
{
}
else
if
(
name
.
equals
(
"外
送/自取
"
))
{
CC
.
obtainBuilder
(
"Component.OtherOrder"
)
.
setActionName
(
"orderActivity"
)
.
build
()
...
...
other_order_mode/src/main/AndroidManifest.xml
View file @
0fc0adee
...
...
@@ -3,19 +3,22 @@
package=
"com.gingersoft.gsa.other_order_mode"
>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.FOREGROUND_SERVICE"
/>
<application>
<activity
android:name=
".ui.activity.OtherOrderActivity"
android:launchMode=
"singleTop"
android:label=
"@string/app_name"
/>
<service
android:name=
".service.GetInfoUpdateService"
/>
android:label=
"@string/app_name"
android:launchMode=
"singleTop"
/>
<service
android:name=
".service.GetInfoUpdateService"
/>
<activity
android:name=
".ui.activity.HistoryOrderActivity"
/>
<meta-data
android:name=
"com.gingersoft.gsa.cloud.globalconfig.GlobalConfiguration"
android:value=
"ConfigModule"
/>
<activity
android:name=
".ui.activity.DeliverySettingActivity"
/>
<activity
android:name=
".ui.activity.OrderDetailsActivity"
/>
<activity
android:name=
".ui.activity.PayActivity"
/>
<activity
android:name=
".ui.activity.DeliverySettingActivity"
/>
<activity
android:name=
".ui.activity.OrderDetailsActivity"
/>
<activity
android:name=
".ui.activity.PayActivity"
/>
</application>
</manifest>
\ No newline at end of file
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/model/viewModel/PageViewModel.kt
View file @
0fc0adee
...
...
@@ -118,20 +118,19 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
/**
* 獲取訂單列表
*/
fun
getOrderList
(
context
:
Context
,
position
:
Int
,
page
:
String
,
isLoadMore
:
Boolean
,
listener
:
(
Int
)
->
Unit
)
{
fun
getOrderList
(
restaurantId
:
String
,
position
:
Int
,
page
:
String
,
isLoadMore
:
Boolean
)
{
launch
({
val
restId
=
GsaCloudApplication
.
getRestaurantId
(
context
).
toString
()
repository
.
requestOrderList
(
restId
,
fragmentStatus
[
position
],
fragmentType
[
position
],
page
,
orderNo
,
phone
).
apply
{
getOrderGroupNum
(
restId
)
loadInfo
(
listener
,
isLoadMore
,
position
)
repository
.
requestOrderList
(
restaurantId
,
fragmentStatus
[
position
],
fragmentType
[
position
],
page
,
orderNo
,
phone
).
apply
{
getOrderGroupNum
(
restaurantId
)
loadInfo
(
isLoadMore
,
position
)
}
},
{
//出錯
listener
.
invoke
(
0
)
mOrderList
[
position
].
value
=
null
})
}
private
fun
OrderList
.
loadInfo
(
listener
:
(
Int
)
->
Unit
,
isLoadMore
:
Boolean
,
position
:
Int
)
{
private
fun
OrderList
.
loadInfo
(
isLoadMore
:
Boolean
,
position
:
Int
)
{
if
(
getData
()
!=
null
&&
getData
()
?.
data
!=
null
)
{
val
myData
:
ArrayList
<
OrderList
.
DataBeanX
.
DataBean
>
=
getData
()
?.
data
as
ArrayList
<
OrderList
.
DataBeanX
.
DataBean
>
if
(
myData
.
isNotEmpty
())
{
...
...
@@ -143,23 +142,22 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
if
(
position
==
0
)
{
//查詢全部訂單時才加載這些數據
otherInfo
.
value
=
myData
[
myData
.
size
-
1
]
}
listener
.
invoke
(
myData
.
size
-
1
)
//移除掉最後一個對象
myData
.
removeAt
(
myData
.
size
-
1
)
//如果是加載更多
if
(
isLoadMore
)
{
if
(
mOrderList
[
position
].
value
!=
null
)
{
mOrderList
[
position
].
value
!!
.
addAll
(
myData
)
mOrderList
[
position
].
postValue
(
mOrderList
[
position
].
value
)
}
}
else
{
mOrderList
[
position
].
value
=
myData
}
// mOrderList[position].postValue(mOrderList[position].value)
}
else
{
listener
.
invoke
(
0
)
mOrderList
[
position
].
value
=
null
}
}
else
{
listener
.
invoke
(
0
)
mOrderList
[
position
].
value
=
null
}
}
...
...
@@ -171,30 +169,12 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
* 修改餐廳營業狀態
* 0=休息中, 1=營業中,2=繁忙中不可接單,3繁忙可接單
*/
fun
setRestaurantState
(
context
:
Context
,
state
:
Int
)
{
fun
updateRestOpenStatus
(
state
:
Int
,
restaurantId
:
String
)
{
launch
({
if
(
state
!=
0
&&
state
!=
2
)
{
updateRestOpenStatus
(
state
,
context
)
}
else
{
//暫停接單,彈窗向用戶確認是否關閉
object
:
DialogUtils
(
context
,
R
.
layout
.
other_order_pause_orders
)
{
override
fun
initLayout
(
hepler
:
ViewHepler
,
dialog
:
Dialog
)
{
hepler
.
getView
<
TextView
>(
R
.
id
.
tv_dialog_confirm
).
setOnClickListener
{
it
.
isClickable
=
false
launch
({
updateRestOpenStatus
(
state
,
context
).
let
{
dialog
.
dismiss
()
}
},
{
ToastUtils
.
show
(
context
,
"修改失敗"
)
dialog
.
dismiss
()
})
}
hepler
.
getView
<
TextView
>(
R
.
id
.
tv_dialog_cancel
).
setOnClickListener
{
dialog
.
dismiss
()
}
}
}.
show
()
repository
.
updateRestOpenStatus
(
state
,
restaurantId
).
apply
{
if
(
success
)
{
restaurantState
.
value
=
state
}
}
},
{
...
...
@@ -202,17 +182,6 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}
/**
* 修改餐廳營業狀態
*/
suspend
fun
updateRestOpenStatus
(
state
:
Int
,
context
:
Context
)
{
repository
.
updateRestOpenStatus
(
state
,
GsaCloudApplication
.
getRestaurantId
(
context
).
toString
()).
apply
{
if
(
success
)
{
restaurantState
.
value
=
state
}
}
}
/**
* 根據訂單id獲取訂單詳細信息
*/
fun
getOrderInfo
(
orderId
:
String
,
listener
:
(
OrderDetails
?)
->
Unit
)
{
...
...
@@ -644,9 +613,9 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
/**
* 獲取配送員信息
*/
fun
getDeliveryInfo
(
context
:
Context
)
{
fun
getDeliveryInfo
(
restaurantId
:
String
,
memberId
:
String
)
{
launch
({
repository
.
getDeliveryInfo
(
GsaCloudApplication
.
getRestaurantId
(
context
).
toString
(),
GsaCloudApplication
.
getMemberId
(
context
).
toString
()
).
apply
{
repository
.
getDeliveryInfo
(
restaurantId
,
memberId
).
apply
{
deliveryBean
=
this
}
},
{
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/service/GetInfoUpdateService.kt
View file @
0fc0adee
package
com.gingersoft.gsa.other_order_mode.service
import
android.app.Service
import
android.app.*
import
android.content.Context
import
android.content.Intent
import
android.graphics.BitmapFactory
import
android.media.AudioAttributes
import
android.media.AudioManager
import
android.media.SoundPool
import
android.os.Binder
import
android.os.Build
import
android.os.Handler
import
android.os.IBinder
import
android.util.Log
import
androidx.annotation.RequiresApi
import
androidx.core.app.NotificationCompat
import
com.gingersoft.gsa.cloud.base.application.GsaCloudApplication
import
com.gingersoft.gsa.other_order_mode.R
import
com.gingersoft.gsa.other_order_mode.data.network.ServiceCreator
import
com.gingersoft.gsa.other_order_mode.ui.activity.OtherOrderActivity
import
com.gingersoft.gsa.other_order_mode.util.RxTimerUtil
import
com.google.gson.Gson
import
io.reactivex.Observable
import
okhttp3.*
import
okio.ByteString
import
org.json.JSONObject
import
java.text.SimpleDateFormat
import
java.util.*
import
java.util.concurrent.TimeUnit
...
...
@@ -38,7 +40,6 @@ class GetInfoUpdateService : Service() {
var
postCallBack
:
PostCallBack
?
=
null
override
fun
onBind
(
intent
:
Intent
?):
IBinder
?
{
// TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
return
MyBind
()
}
...
...
@@ -46,6 +47,47 @@ class GetInfoUpdateService : Service() {
fun
callBack
(
type
:
Int
)
}
override
fun
onStartCommand
(
intent
:
Intent
?,
flags
:
Int
,
startId
:
Int
):
Int
{
Log
.
d
(
TAG
,
"onStartCommand()"
)
// 在API11之后构建Notification的方式
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
createNotificationChannel
()
}
return
super
.
onStartCommand
(
intent
,
flags
,
startId
)
}
val
CHANNEL_ID
=
"cloud_gsa"
/**
* 创建通知渠道
*/
@RequiresApi
(
Build
.
VERSION_CODES
.
O
)
fun
createNotificationChannel
()
{
//设定的通知渠道名称
val
channelName
=
"New Order Notification"
//设置通知的重要程度
val
importance
=
NotificationManager
.
IMPORTANCE_LOW
//构建通知渠道
val
channel
=
NotificationChannel
(
CHANNEL_ID
,
channelName
,
importance
)
channel
.
description
=
"New Order Notification"
val
intent
=
Intent
(
this
,
OtherOrderActivity
::
class
.
java
)
val
pendingIntent
=
PendingIntent
.
getActivity
(
this
,
0
,
intent
,
0
)
//在创建的通知渠道上发送通知
val
builder
=
NotificationCompat
.
Builder
(
this
,
CHANNEL_ID
)
builder
.
setSmallIcon
(
R
.
mipmap
.
ic_launcher
)
//设置通知图标
.
setContentTitle
(
"Ricepon Pos"
)
//设置通知标题
.
setContentText
(
"外賣接單服務"
)
//设置通知内容Takeaway order service
.
setContentIntent
(
pendingIntent
)
.
setAutoCancel
(
false
)
//用户触摸时,自动关闭
.
setOngoing
(
true
)
//设置处于运行状态
//向系统注册通知渠道,注册后不能改变重要性以及其他通知行为
val
notificationManager
=
getSystemService
(
Context
.
NOTIFICATION_SERVICE
)
as
NotificationManager
notificationManager
.
createNotificationChannel
(
channel
)
//将服务置于启动状态 NOTIFICATION_ID指的是创建的通知的ID
startForeground
(
123
,
builder
.
build
())
}
inner
class
MyBind
:
Binder
()
{
fun
getService
():
GetInfoUpdateService
{
return
this
@GetInfoUpdateService
...
...
@@ -54,7 +96,6 @@ class GetInfoUpdateService : Service() {
fun
setOnPostCallBack
(
postCallBack
:
PostCallBack
?)
{
this
@GetInfoUpdateService
.
postCallBack
=
postCallBack
}
}
...
...
@@ -256,6 +297,7 @@ class GetInfoUpdateService : Service() {
// mHandler.removeCallbacks(heartBeatRunnable)
}
RxTimerUtil
.
cancel
()
stopForeground
(
true
)
}
class
MsgBean
(
var
type
:
Int
,
var
token
:
String
)
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/activity/OtherOrderActivity.kt
View file @
0fc0adee
package
com.gingersoft.gsa.other_order_mode.ui.activity
import
android.animation.ValueAnimator
import
android.app.Dialog
import
android.content.ComponentName
import
android.content.Context
import
android.content.Intent
...
...
@@ -25,6 +26,7 @@ import androidx.lifecycle.ViewModelProvider
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.widget.DialogUtils
import
com.gingersoft.gsa.other_order_mode.R
import
com.gingersoft.gsa.other_order_mode.databinding.ActivityOtherOrderBinding
import
com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel
...
...
@@ -44,6 +46,9 @@ class OtherOrderActivity : BaseActivity() {
private
val
pageViewModel
by
lazy
{
ViewModelProvider
(
this
,
InjectorUtil
.
getWeatherModelFactory
())[
PageViewModel
::
class
.
java
]
}
private
val
instance
by
lazy
{
this
}
private
val
restaurantId
by
lazy
{
GsaCloudApplication
.
getRestaurantId
(
this
)
}
private
val
memberId
by
lazy
{
GsaCloudApplication
.
getMemberId
(
this
)
}
private
val
ints
=
arrayOf
(
R
.
string
.
tab_text_1
,
R
.
string
.
tab_text_2
,
...
...
@@ -101,7 +106,7 @@ class OtherOrderActivity : BaseActivity() {
btn_open_or_close_info
.
post
{
btnHeight
=
btn_open_or_close_info
.
height
.
toFloat
()
}
pageViewModel
.
getDeliveryInfo
(
this
)
pageViewModel
.
getDeliveryInfo
(
restaurantId
.
toString
(),
memberId
.
toString
()
)
}
/**
...
...
@@ -165,9 +170,8 @@ class OtherOrderActivity : BaseActivity() {
//搜索
if
(
ed_order_num_search
.
text
!=
null
&&
ed_order_num_search
.
text
.
isNotEmpty
())
{
pageViewModel
.
phone
=
ed_order_num_search
.
text
.
toString
()
pageViewModel
.
getOrderList
(
this
,
viewPager
.
currentItem
,
"0"
,
false
)
{
ToastUtils
.
show
(
this
@OtherOrderActivity
,
"搜索到$it"
+
"條數據"
)
}
pageViewModel
.
getOrderList
(
restaurantId
.
toString
(),
viewPager
.
currentItem
,
"0"
,
false
)
// ToastUtils.show(this@OtherOrderActivity, "搜索到$it" + "條數據")
}
else
{
ToastUtils
.
show
(
this
@OtherOrderActivity
,
"請輸入手機號或訂單號"
)
}
...
...
@@ -246,14 +250,34 @@ class OtherOrderActivity : BaseActivity() {
}
private
fun
updateRestaurantState
(
state
:
Int
)
{
pageViewModel
.
setRestaurantState
(
this
@OtherOrderActivity
,
state
)
if
(
state
!=
0
&&
state
!=
2
)
{
pageViewModel
.
updateRestOpenStatus
(
state
,
restaurantId
.
toString
())
}
else
{
//暫停接單,彈窗向用戶確認是否關閉
object
:
DialogUtils
(
this
,
R
.
layout
.
other_order_pause_orders
)
{
override
fun
initLayout
(
hepler
:
ViewHepler
,
dialog
:
Dialog
)
{
hepler
.
getView
<
TextView
>(
R
.
id
.
tv_dialog_confirm
).
setOnClickListener
{
it
.
isClickable
=
false
pageViewModel
.
updateRestOpenStatus
(
state
,
restaurantId
.
toString
())
dialog
.
dismiss
()
}
hepler
.
getView
<
TextView
>(
R
.
id
.
tv_dialog_cancel
).
setOnClickListener
{
dialog
.
dismiss
()
}
}
}.
show
()
}
restaurantPopup
?.
dismiss
()
}
private
fun
initWebsocket
()
{
//開啟websocket
val
intent
=
Intent
(
this
,
GetInfoUpdateService
::
class
.
java
)
startService
(
intent
)
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
startForegroundService
(
intent
)
}
else
{
startService
(
intent
)
}
bindService
(
intent
,
serviceConnection
,
Context
.
BIND_AUTO_CREATE
)
}
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/fragment/PlaceholderFragment.kt
View file @
0fc0adee
...
...
@@ -34,6 +34,9 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) {
private
lateinit
var
pageViewModel
:
PageViewModel
private
var
page
=
1
private
val
restaurantId
by
lazy
{
GsaCloudApplication
.
getRestaurantId
(
activity
)
}
private
val
memberId
by
lazy
{
GsaCloudApplication
.
getMemberId
(
activity
)
}
override
fun
onActivityCreated
(
savedInstanceState
:
Bundle
?)
{
super
.
onActivityCreated
(
savedInstanceState
)
pageViewModel
=
ViewModelProvider
(
activity
?.
viewModelStore
!!
,
InjectorUtil
.
getWeatherModelFactory
())[
PageViewModel
::
class
.
java
].
apply
{
...
...
@@ -126,6 +129,8 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) {
}
// 綁定監聽當前fragment的數據項
pageViewModel
.
mOrderList
[
arguments
?.
getInt
(
INDEX
)
!!
].
observe
(
viewLifecycleOwner
,
Observer
{
refresh_layout
.
finishRefresh
()
refresh_layout
.
finishLoadMore
()
it
?.
let
{
layout_nodata
.
setState
(
it
.
size
<=
0
)
adapter
.
setData
(
it
)
...
...
@@ -138,7 +143,7 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) {
refresh_layout
.
setOnRefreshListener
{
refresh
()
//重新拉取一遍送貨員信息
pageViewModel
.
getDeliveryInfo
(
context
!!
)
pageViewModel
.
getDeliveryInfo
(
restaurantId
.
toString
(),
memberId
.
toString
()
)
}
refresh_layout
.
setOnLoadMoreListener
{
page
++
...
...
@@ -159,13 +164,7 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) {
}
private
fun
getOrderList
(
pageViewModel
:
PageViewModel
,
isLoadMore
:
Boolean
)
{
pageViewModel
.
getOrderList
(
activity
!!
,
arguments
?.
getInt
(
INDEX
)
?:
0
,
page
.
toString
(),
isLoadMore
)
{
if
(
refresh_layout
!=
null
)
{
refresh_layout
.
finishRefresh
()
refresh_layout
.
finishLoadMore
()
}
}
pageViewModel
.
getOrderList
(
GsaCloudApplication
.
getRestaurantId
(
activity
).
toString
(),
arguments
?.
getInt
(
INDEX
)
?:
0
,
page
.
toString
(),
isLoadMore
)
}
companion
object
{
...
...
print-module/build.gradle
View file @
0fc0adee
...
...
@@ -40,13 +40,14 @@ android {
dependencies
{
implementation
fileTree
(
include:
[
'*.jar'
],
dir:
'libs'
)
implementation
'androidx.appcompat:appcompat:1.1.0'
//不要超過1.0.2,不然android5.1.1用webview會有問題
implementation
'androidx.appcompat:appcompat:1.1.0'
//不要超過1.0.2,不然android5.1.1用webview會有問題
androidTestImplementation
'androidx.test:runner:1.2.0'
androidTestImplementation
'androidx.test.espresso:espresso-core:3.2.0'
annotationProcessor
rootProject
.
ext
.
dependencies
[
"dagger2-compiler"
]
// implementation 'am.util:printer:2.1.0'//打印
// implementation 'am.util:printer:2.1.0'//打印
implementation
rootProject
.
ext
.
dependencies
[
"BaseRecyclerViewAdapter"
]
// implementation rootProject.ext.dependencies["yzjRecyclerView"]//可長按拖動 側滑刪除的recyclerview
// implementation rootProject.ext.dependencies["yzjRecyclerView"]//可長按拖動 側滑刪除的recyclerview
// implementation rootProject.ext.dependencies["fastjson"]
debugImplementation
rootProject
.
ext
.
dependencies
[
"canary-debug"
]
releaseImplementation
rootProject
.
ext
.
dependencies
[
"canary-release"
]
...
...
print-module/src/main/java/com/joe/print/mvp/print/PrintOtherOrder.java
View file @
0fc0adee
...
...
@@ -229,7 +229,7 @@ public class PrintOtherOrder extends PrinterRoot {
RecyclerView
rvBill
=
view
.
findViewById
(
R
.
id
.
rv_bill
);
List
<
PrintBillBean
>
billData
=
new
ArrayList
<>();
billData
.
add
(
getBillBean
(
"合計:"
,
amountUnit
+
MoneyUtil
.
sub
(
MoneyUtil
.
sub
(
Double
.
parseDouble
(
data
.
getTOTAL_AMOUNT
()),
data
.
getLunchbox
()),
data
.
getDELIVERY_CHARGE
())));
billData
.
add
(
getBillBean
(
"合計:"
,
amountUnit
+
MoneyUtil
.
sub
(
MoneyUtil
.
sub
(
Double
.
parseDouble
(
data
.
getTOTAL_AMOUNT
()),
data
.
getLunchbox
()),
data
.
getDELIVERY_CHARGE
())));
if
(
data
.
getLunchbox
()
!=
0
)
{
billData
.
add
(
getBillBean
(
"餐盒費:"
,
amountUnit
+
data
.
getLunchbox
()));
}
...
...
@@ -280,10 +280,16 @@ public class PrintOtherOrder extends PrinterRoot {
}
//收貨時間
setText
(
view
,
R
.
id
.
tv_delivery_time
,
data
.
getOrder_type
()
==
2
?
data
.
getSEND_TIME
()
:
data
.
getTakeTime
());
//收貨地址
setText
(
view
,
R
.
id
.
tv_address
,
context
.
getString
(
R
.
string
.
address
)
+
data
.
getAddressDetail
());
//收貨人
setText
(
view
,
R
.
id
.
tv_receiver
,
"收貨人:"
+
data
.
getRECEIVER
());
if
(
data
.
getOrder_type
()
!=
2
)
{
//自取,隱藏地址和收貨人
view
.
findViewById
(
R
.
id
.
tv_address
).
setVisibility
(
View
.
GONE
);
view
.
findViewById
(
R
.
id
.
tv_receiver
).
setVisibility
(
View
.
GONE
);
}
else
{
//收貨地址
setText
(
view
,
R
.
id
.
tv_address
,
context
.
getString
(
R
.
string
.
address
)
+
data
.
getAddressDetail
());
//收貨人
setText
(
view
,
R
.
id
.
tv_receiver
,
"收貨人:"
+
data
.
getRECEIVER
());
}
//手機號
setText
(
view
,
R
.
id
.
tv_phone
,
"手機號:"
+
data
.
getPHONE
());
//底部時間
...
...
@@ -302,6 +308,8 @@ public class PrintOtherOrder extends PrinterRoot {
rvFoodList
.
setLayoutManager
(
new
LinearLayoutManager
(
context
));
rvFoodList
.
setAdapter
(
new
OtherOrderAdapter
(
context
,
data
.
getPRODUCT_NAME
(),
true
));
}
return
viewToBitmap
(
context
,
view
);
}
...
...
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