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
65c6b704
Commit
65c6b704
authored
Jun 22, 2020
by
Wyh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
6.22 登出心跳清除接口代碼 外賣接單訂單詳情加載速度優化
parent
3f5df67d
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
240 additions
and
528 deletions
+240
-528
base-module/src/main/java/com/gingersoft/gsa/cloud/print/PrintSocketHolder.java
+0
-1
base-module/src/main/res/values/strings.xml
+2
-0
main-module/src/main/java/com/gingersoft/gsa/cloud/main/mvp/presenter/NewMainPresenter.java
+17
-7
main-module/src/main/java/com/gingersoft/gsa/cloud/main/mvp/ui/activity/NewMainActivity.java
+17
-25
other_order_mode/build.gradle
+2
-0
other_order_mode/debug/2020-04-25_GSA-Cloud_1.0_debug_.apk
+0
-0
other_order_mode/debug/2020-05-07_GSA-Cloud_1.0_debug_.apk
+0
-0
other_order_mode/debug/2020-05-09_GSA-Cloud_1.0_debug_.apk
+0
-0
other_order_mode/debug/other_order_mode-debug.apk
+0
-0
other_order_mode/debug/output.json
+0
-2
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/data/model/bean/DeliveryConfig.kt
+2
-1
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/model/viewModel/PageViewModel.kt
+13
-25
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/activity/DeliverySettingActivity.kt
+2
-0
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/activity/OrderDetailsActivity.kt
+20
-35
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/activity/OtherOrderActivity.kt
+57
-60
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/adapter/DeliveryListAdapter.kt
+0
-2
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/adapter/OtherOrdersAdapter.kt
+0
-1
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/base/BaseFragment.kt
+4
-1
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/fragment/DeliveryFragment.kt
+10
-19
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/fragment/HistoryFragment.kt
+1
-7
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/fragment/PlaceholderFragment.kt
+5
-10
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/fragment/UpdateDeliveryFragment.kt
+1
-7
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/util/ViewUtil.kt
+0
-7
other_order_mode/src/main/res/layout/activity_order_details.xml
+14
-13
other_order_mode/src/main/res/layout/fragment_other_order.xml
+1
-0
other_order_mode/src/main/res/layout/layout_other_order_item.xml
+0
-278
other_order_mode/src/main/res/layout/layout_other_order_item_new.xml
+0
-4
print-module/src/main/java/com/joe/print/mvp/model/bean/PrjBean.java
+3
-0
print-module/src/main/java/com/joe/print/mvp/print/service/PrjService.java
+68
-23
print-module/src/main/res/layout/printer_activity_add.xml
+1
-0
No files found.
base-module/src/main/java/com/gingersoft/gsa/cloud/print/PrintSocketHolder.java
View file @
65c6b704
...
...
@@ -88,7 +88,6 @@ public class PrintSocketHolder {
}
}
catch
(
Exception
e
)
{
closeSocket
();
// Log.e("eee", "連接報錯:" + e.getMessage());
e
.
printStackTrace
();
return
ERROR_2
;
}
...
...
base-module/src/main/res/values/strings.xml
View file @
65c6b704
...
...
@@ -149,5 +149,7 @@
<string
name=
"wai"
>
外
</string>
<string
name=
"amount_unit"
>
$
</string>
<string
name=
"edit_digits_number_words"
>
0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
</string>
<string
name=
"print_split_line"
>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
</string>
</resources>
main-module/src/main/java/com/gingersoft/gsa/cloud/main/mvp/presenter/NewMainPresenter.java
View file @
65c6b704
...
...
@@ -5,25 +5,19 @@ import android.content.Intent;
import
android.net.Uri
;
import
android.text.TextUtils
;
import
com.billy.cc.core.component.CC
;
import
com.gingersoft.gsa.cloud.base.application.GsaCloudApplication
;
import
com.gingersoft.gsa.cloud.base.utils.LanguageUtils
;
import
com.gingersoft.gsa.cloud.main.R
;
import
com.gingersoft.gsa.cloud.main.mvp.contract.NewMainContract
;
import
com.gingersoft.gsa.cloud.main.mvp.model.bean.CheckVersionRequest
;
import
com.gingersoft.gsa.cloud.main.mvp.ui.activity.NewMainActivity
;
import
com.gingersoft.gsa.cloud.ui.activity.WebActivity
;
import
com.jess.arms.base.delegate.IActivity
;
import
com.jess.arms.di.scope.ActivityScope
;
import
com.jess.arms.http.imageloader.ImageLoader
;
import
com.jess.arms.integration.AppManager
;
import
com.jess.arms.mvp.BasePresenter
;
import
com.jess.arms.utils.ArmsUtils
;
import
com.jess.arms.utils.DeviceUtils
;
import
com.jess.arms.utils.PermissionUtil
;
import
com.jess.arms.utils.RxLifecycleUtils
;
import
java.util.List
;
import
javax.inject.Inject
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
...
...
@@ -120,7 +114,22 @@ public class NewMainPresenter extends BasePresenter<NewMainContract.Model, NewMa
public
void
loginOut
()
{
RequestBody
requestBody
=
new
FormBody
.
Builder
()
.
add
(
"restaurantId"
,
GsaCloudApplication
.
getRestaurantId
(
mApplication
)
+
""
)
.
build
();
CC
.
obtainBuilder
(
"Component.OtherOrder"
)
.
setActionName
(
"closeHeart"
)
.
build
()
.
call
();
mModel
.
clearHeartbeat
(
requestBody
)
.
subscribeOn
(
Schedulers
.
io
())
.
subscribe
(
new
ErrorHandleSubscriber
<
Object
>(
mErrorHandler
)
{
@Override
public
void
onNext
(
@NonNull
Object
info
)
{
}
});
mModel
.
loginOut
(
requestBody
)
.
subscribeOn
(
Schedulers
.
io
())
.
doOnSubscribe
(
disposable
->
mRootView
.
showLoading
(
null
))
...
...
@@ -135,6 +144,7 @@ public class NewMainPresenter extends BasePresenter<NewMainContract.Model, NewMa
mRootView
.
loginOut
();
//清空用戶信息
GsaCloudApplication
.
clearMemberInfo
();
}
});
}
...
...
main-module/src/main/java/com/gingersoft/gsa/cloud/main/mvp/ui/activity/NewMainActivity.java
View file @
65c6b704
...
...
@@ -12,8 +12,6 @@ import android.text.TextUtils;
import
android.util.SparseArray
;
import
android.view.KeyEvent
;
import
android.view.View
;
import
android.widget.BaseAdapter
;
import
android.widget.ListView
;
import
android.widget.TextView
;
import
androidx.annotation.NonNull
;
...
...
@@ -30,10 +28,7 @@ import com.gingersoft.gsa.cloud.base.utils.RestaurantInfoUtils;
import
com.gingersoft.gsa.cloud.base.utils.encryption.Aes
;
import
com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils
;
import
com.gingersoft.gsa.cloud.database.bean.Function
;
import
com.gingersoft.gsa.cloud.database.utils.FunctionDaoUtils
;
import
com.gingersoft.gsa.cloud.function.FunctionManager
;
import
com.gingersoft.gsa.cloud.main.BuildConfig
;
import
com.gingersoft.gsa.cloud.main.ComponentMain
;
import
com.gingersoft.gsa.cloud.main.R
;
import
com.gingersoft.gsa.cloud.main.R2
;
import
com.gingersoft.gsa.cloud.main.di.component.DaggerNewMainComponent
;
...
...
@@ -47,7 +42,6 @@ import com.gingersoft.gsa.cloud.main.mvp.ui.view.SlidingMenu;
import
com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean
;
import
com.gingersoft.gsa.cloud.ui.widget.dialog.ChooseRestaurantDialog
;
import
com.gingersoft.gsa.cloud.ui.widget.dialog.CommonTipDialog
;
import
com.jess.arms.base.BaseActivity
;
import
com.jess.arms.base.BaseFragmentActivity
;
import
com.jess.arms.di.component.AppComponent
;
import
com.jess.arms.utils.ArmsUtils
;
...
...
@@ -62,8 +56,6 @@ import butterknife.BindView;
import
butterknife.BindViews
;
import
butterknife.OnClick
;
import
static
com
.
gingersoft
.
gsa
.
cloud
.
database
.
bean
.
Function
.
STATUS_NONACTIVATED
;
import
static
com
.
gingersoft
.
gsa
.
cloud
.
database
.
bean
.
Function
.
STATUS_TIME_LIMIT
;
import
static
com
.
jess
.
arms
.
utils
.
Preconditions
.
checkNotNull
;
...
...
@@ -236,25 +228,25 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
List
<
Function
>
functions
=
new
ArrayList
<>();
// 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_close
,
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
)
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
)
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_close
,
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
)
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));
//// functions.add(new Function((long) 146, 151, 5, "折扣管理", R.drawable.ic_discount_management_close, 1));
functions
.
add
(
new
Function
((
long
)
147
,
151
,
5
,
"沽清管理"
,
R
.
drawable
.
ic_sell_off_manger
,
0
));
functions
.
add
(
new
Function
((
long
)
147
,
151
,
5
,
"沽清管理"
,
R
.
drawable
.
ic_sell_off_manger
,
0
));
functions
.
add
(
new
Function
((
long
)
152
,
0
,
5
,
"員工"
,
0
,
0
));
functions
.
add
(
new
Function
((
long
)
147
,
152
,
5
,
"員工管理"
,
R
.
drawable
.
ic_staff_management_close
,
1
));
functions
.
add
(
new
Function
((
long
)
148
,
152
,
5
,
"權限管理"
,
R
.
drawable
.
ic_authority_management_close
,
1
));
functions
.
add
(
new
Function
((
long
)
149
,
152
,
5
,
"操作記錄"
,
R
.
drawable
.
ic_operation_record_close
,
1
));
functions
.
add
(
new
Function
((
long
)
152
,
0
,
5
,
"員工"
,
0
,
0
));
functions
.
add
(
new
Function
((
long
)
147
,
152
,
5
,
"員工管理"
,
R
.
drawable
.
ic_staff_management_close
,
1
));
functions
.
add
(
new
Function
((
long
)
148
,
152
,
5
,
"權限管理"
,
R
.
drawable
.
ic_authority_management_close
,
1
));
functions
.
add
(
new
Function
((
long
)
149
,
152
,
5
,
"操作記錄"
,
R
.
drawable
.
ic_operation_record_close
,
1
));
// } else {
// functions.addAll(FunctionManager.getDefault().getFunctionByResModule(this, ComponentMain.main.class, ComponentMain.main.order, "order"));
// functions.addAll(FunctionManager.getDefault().getFunctionByResModule(this, ComponentMain.main.class, ComponentMain.main.manager, "manager"));
...
...
@@ -377,7 +369,7 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
GsaCloudApplication
.
setRestaurantName
(
NewMainActivity
.
this
,
item
.
getText
());
updateTitleInfo
();
CC
.
obtainBuilder
(
"Component.Download"
)
.
setActionName
(
"showDownloadActivity"
)
.
addParam
(
"fromPage"
,
2
)
...
...
other_order_mode/build.gradle
View file @
65c6b704
...
...
@@ -77,6 +77,8 @@ dependencies {
androidTestImplementation
'androidx.test.espresso:espresso-core:3.2.0'
implementation
'com.ethanhua:skeleton:1.1.2'
implementation
'io.supercharge:shimmerlayout:2.1.0'
implementation
'com.ditclear:bindinglistadapter:1.0.0'
if
(
project
.
ext
.
runAsApp
)
{
addComponent
'print-module'
}
...
...
other_order_mode/debug/2020-04-25_GSA-Cloud_1.0_debug_.apk
deleted
100644 → 0
View file @
3f5df67d
File deleted
other_order_mode/debug/2020-05-07_GSA-Cloud_1.0_debug_.apk
deleted
100644 → 0
View file @
3f5df67d
File deleted
other_order_mode/debug/2020-05-09_GSA-Cloud_1.0_debug_.apk
deleted
100644 → 0
View file @
3f5df67d
File deleted
other_order_mode/debug/other_order_mode-debug.apk
deleted
100644 → 0
View file @
3f5df67d
File deleted
other_order_mode/debug/output.json
deleted
100644 → 0
View file @
3f5df67d
[{
"outputType"
:{
"type"
:
"APK"
},
"apkData"
:{
"type"
:
"MAIN"
,
"splits"
:[],
"versionCode"
:
1
,
"versionName"
:
"1.0"
,
"enabled"
:
true
,
"outputFile"
:
"2020-05-15_GSA-Cloud_1.0_debug_.apk"
,
"fullName"
:
"debug"
,
"baseName"
:
"debug"
},
"path"
:
"2020-05-15_GSA-Cloud_1.0_debug_.apk"
,
"properties"
:{}}]
\ No newline at end of file
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/data/model/bean/DeliveryConfig.kt
View file @
65c6b704
package
com.gingersoft.gsa.other_order_mode.data.model.bean
import
androidx.databinding.ObservableArrayList
import
java.io.Serializable
data class
DeliveryConfig
(
...
...
@@ -7,7 +8,7 @@ data class DeliveryConfig(
val
success
:
Boolean
,
val
sysTime
:
Long
)
{
data class
Data
(
val
list
:
List
<
DeliveryInfo
>)
{
data class
Data
(
val
list
:
ObservableArray
List
<
DeliveryInfo
>)
{
data class
DeliveryInfo
(
val
addressDetail
:
String
,
val
deliveryCost
:
Double
,
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/model/viewModel/PageViewModel.kt
View file @
65c6b704
...
...
@@ -115,7 +115,6 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
})
}
/**
* 獲取訂單列表
*/
...
...
@@ -242,18 +241,17 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
// }
fun
getShipanyAndOrderInfo
(
restaurantId
:
String
,
orderId
:
String
,
listener
:
(
OrderDetails
?)
->
Unit
)
{
var
orderDetails
=
MutableLiveData
<
OrderDetails
>()
//待优化,将订单详情和物流送达时间分开,通过监听者通知更新物流时间
fun
getShipanyAndOrderInfo
(
restaurantId
:
String
,
orderId
:
String
)
{
launch
({
withContext
(
Dispatchers
.
IO
)
{
val
orderDetail
=
withContext
(
Dispatchers
.
Default
)
{
repository
.
getOrderInfo
(
orderId
)
}
orderDetails
.
postValue
(
orderDetail
)
if
(
orderDetail
.
data
!=
null
&&
orderDetail
.
data
!!
.
isNotEmpty
())
{
//訂單詳情不為空
if
(
orderDetail
.
data
!!
[
0
].
isDelete
!=
0
)
{
//如果不是第三方物流單
withContext
(
Dispatchers
.
Main
)
{
listener
.
invoke
(
orderDetail
)
}
}
else
{
if
(
orderDetail
.
data
!!
[
0
].
isDelete
==
0
)
{
//為0是第三方物流單
if
(
orderDetail
.
data
!!
[
0
].
curStat
!=
0
)
{
val
data
=
orderDetail
.
data
!!
[
0
]
val
type
:
Int
...
...
@@ -277,26 +275,18 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}
}
val
estimatedBean
=
withContext
(
Dispatchers
.
Default
)
{
repository
.
getShipanyOrderTime
(
restaurantId
,
orderId
,
type
)
}
//1、预计整张订单完成时间2、預計配送員接單時間3、預計配送員到店時間4、配送員預計送達時間
if
(
estimatedBean
?.
data
!=
null
&&
estimatedBean
.
data
.
estimated_time
>
0
)
{
data
.
estimatedTime
=
estimatedTime
+
(
"${estimatedBean.data.estimated_time}分鐘後"
)
}
else
{
data
.
estimatedTime
=
""
}
}
withContext
(
Dispatchers
.
Main
)
{
listener
.
invoke
(
orderDetail
)
// if (estimatedBean.data.estimated_time > 0) {
data
.
estimatedTime
=
estimatedTime
+
(
"${estimatedBean.data.estimated_time}分鐘後"
)
orderDetails
.
postValue
(
orderDetail
)
// } else {
// data.estimatedTime = ""
// }
}
}
}
else
{
withContext
(
Dispatchers
.
Main
)
{
listener
.
invoke
(
null
)
}
}
}
},
{
withContext
(
Dispatchers
.
Main
)
{
listener
.
invoke
(
null
)
}
orderDetails
.
postValue
(
null
)
})
}
...
...
@@ -727,7 +717,6 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
fun
getPayMethod
(
orderId
:
String
)
{
launch
({
repository
.
getPayMethod
(
orderId
).
apply
{
Log
.
e
(
"eee"
,
"獲取支付方式$this"
)
if
(
this
.
code
==
"1"
&&
this
.
data
!=
null
)
{
payTypeBean
.
postValue
(
this
.
data
)
}
else
{
...
...
@@ -735,7 +724,6 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}
}
},
{
Log
.
e
(
"eee"
,
"獲取支付方式報錯${it.message}"
)
payTypeBean
.
postValue
(
null
)
})
}
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/activity/DeliverySettingActivity.kt
View file @
65c6b704
package
com.gingersoft.gsa.other_order_mode.ui.activity
import
android.os.Bundle
import
androidx.databinding.ObservableArrayList
import
com.gingersoft.gsa.other_order_mode.R
import
com.gingersoft.gsa.other_order_mode.data.model.bean.DeliveryConfig
import
com.gingersoft.gsa.other_order_mode.ui.base.BaseActivity
import
com.gingersoft.gsa.other_order_mode.ui.fragment.DeliveryFragment
import
com.gingersoft.gsa.other_order_mode.ui.fragment.UpdateDeliveryFragment
import
io.ditclear.bindingadapter.SingleTypeAdapter
import
kotlinx.android.synthetic.main.activity_delivery.*
class
DeliverySettingActivity
:
BaseActivity
()
{
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/activity/OrderDetailsActivity.kt
View file @
65c6b704
package
com.gingersoft.gsa.other_order_mode.ui.activity
import
android.app.Dialog
import
android.content.Intent
import
android.os.Bundle
import
android.util.Log
import
android.view.View
import
android
.widget.TextView
import
android
x.core.content.ContextCompat
import
androidx.databinding.DataBindingUtil
import
androidx.lifecycle.Observer
import
androidx.lifecycle.ViewModelProvider
import
androidx.recyclerview.widget.GridLayoutManager
import
androidx.recyclerview.widget.LinearLayoutManager
...
...
@@ -13,7 +14,6 @@ import com.ethanhua.skeleton.Skeleton
import
com.ethanhua.skeleton.ViewSkeletonScreen
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.cloud.print.bean.OrderDetails
import
com.gingersoft.gsa.cloud.ui.utils.AppDialog
import
com.gingersoft.gsa.other_order_mode.R
...
...
@@ -30,9 +30,6 @@ import com.gingersoft.gsa.other_order_mode.ui.base.BaseActivity
import
com.gingersoft.gsa.other_order_mode.util.InjectorUtil
import
com.qmuiteam.qmui.widget.QMUITopBar
import
kotlinx.android.synthetic.main.activity_order_details.*
import
kotlinx.android.synthetic.main.activity_order_details.rv_food
import
kotlinx.android.synthetic.main.activity_order_details.tv_order_state
import
kotlinx.android.synthetic.main.activity_order_details_loading.*
class
OrderDetailsActivity
:
BaseActivity
()
{
...
...
@@ -70,12 +67,14 @@ class OrderDetailsActivity : BaseActivity() {
private
fun
initTopBar
(
topbar
:
QMUITopBar
)
{
topbar
.
setTitle
(
GsaCloudApplication
.
getRestaurantName
(
this
@OrderDetailsActivity
))
topbar
.
addLeftImageButton
(
R
.
drawable
.
icon_return
,
R
.
id
.
iv_left_back
).
setOnClickListener
{
finish
()
}
topbar
.
setBackgroundColor
(
resources
.
getColor
(
R
.
color
.
theme_color
))
topbar
.
setBackgroundColor
(
ContextCompat
.
getColor
(
this
,
R
.
color
.
theme_color
))
}
private
fun
PageViewModel
.
getOrderDetails
(
orderId
:
String
,
binding
:
ActivityOrderDetailsBinding
)
{
getShipanyAndOrderInfo
(
GsaCloudApplication
.
getRestaurantId
(
this
@OrderDetailsActivity
).
toString
(),
orderId
)
{
it
->
skeletonScreen
.
hide
()
orderDetails
.
observe
(
this
@OrderDetailsActivity
,
Observer
{
skeletonScreen
.
hide
()
//隱藏骨架屏
Log
.
e
(
"eee"
,
"收到"
)
if
(
it
?.
data
!=
null
&&
it
.
data
!!
.
isNotEmpty
())
{
val
orderDetails
=
it
.
data
!!
[
0
]
orderDetails
.
order_type
=
orderType
...
...
@@ -90,6 +89,7 @@ class OrderDetailsActivity : BaseActivity() {
val
orderStatusText
:
String
val
type
=
if
(
orderDetails
.
order_type
==
7
)
"自取"
else
"外送"
when
(
orderDetails
.
orderStatus
)
{
2
->
{
//製作中
btnList
.
add
(
BtnBuilder
().
getPrintBtn
())
...
...
@@ -148,7 +148,6 @@ class OrderDetailsActivity : BaseActivity() {
else
->
""
}
binding
.
orderStatus
=
type
+
orderStatusText
binding
.
estimatedTime
=
orderDetails
.
estimatedTime
rv_food
.
layoutManager
=
LinearLayoutManager
(
this
@OrderDetailsActivity
)
rv_food
.
adapter
=
FoodListAdapter
(
this
@OrderDetailsActivity
,
orderDetails
.
PRODUCT_NAME
!!
)
...
...
@@ -160,6 +159,9 @@ class OrderDetailsActivity : BaseActivity() {
}
val
orderBtnAdapter
=
OrderDetailsAdapter
(
btnList
)
rv_order_details_btn
.
adapter
=
orderBtnAdapter
//--------------------------------------------------------------不同按鈕點擊事件----------------------------------------------------------------------------------------
orderBtnAdapter
.
setOnItemClickListener
{
adapter
,
view
,
position
->
when
(
btnList
[
position
].
type
)
{
BtnBuilder
.
logisticsBtn
->
...
...
@@ -171,26 +173,7 @@ class OrderDetailsActivity : BaseActivity() {
BtnBuilder
.
cancelBtn
->
//取消訂單
cancelOrder
(
orderDetails
)
BtnBuilder
.
closingBtn
->
//結賬,彈窗確認是否結賬
// 自取結賬,外賣結賬,第三方物流沒有結賬
// object : DialogUtils(this@OrderDetailsActivity, R.layout.other_order_pause_orders) {
// override fun initLayout(hepler: ViewHepler, dialog: Dialog) {
// hepler.setText(R.id.tv_warning_title, "是否確認結賬?")
// hepler.getView<TextView>(R.id.tv_dialog_confirm).setOnClickListener {
// dialog.dismiss()
// showLoading()
// gsUpdateOrderStatus(orderDetails.ID.toString(), orderDetails.order_type) { status, isSuccess ->
// cancelDialogForLoading()
// finish()
// }
// }
// hepler.getView<TextView>(R.id.tv_dialog_cancel).setOnClickListener {
// dialog.dismiss()
// }
// }
// }.show()
{
BtnBuilder
.
closingBtn
->
{
val
intent
=
Intent
(
this
@OrderDetailsActivity
,
PayActivity
::
class
.
java
)
intent
.
putExtra
(
"orderDetails"
,
orderDetails
)
startActivityForResult
(
intent
,
1001
)
...
...
@@ -209,9 +192,9 @@ class OrderDetailsActivity : BaseActivity() {
}
SendCode
->
{
ToastUtils
.
show
(
this
@OrderDetailsActivity
,
if
(
isSuccess
)
{
"
成功
"
"
已成功指派
"
}
else
{
"失敗"
"
指派送貨
失敗"
})
}
OrderDelivery
->
{
...
...
@@ -252,7 +235,9 @@ class OrderDetailsActivity : BaseActivity() {
ToastUtils
.
show
(
this
@OrderDetailsActivity
,
"獲取訂單詳情失敗"
)
finish
()
}
}
})
getShipanyAndOrderInfo
(
GsaCloudApplication
.
getRestaurantId
(
this
@OrderDetailsActivity
).
toString
(),
orderId
)
}
/**
...
...
@@ -343,9 +328,9 @@ class OrderDetailsActivity : BaseActivity() {
override
fun
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
?)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
)
if
(
requestCode
==
1001
)
{
if
(
requestCode
==
1001
)
{
//結賬頁面
if
(
resultCode
==
RESULT_OK
)
{
if
(
resultCode
==
RESULT_OK
)
{
finish
()
}
}
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/activity/OtherOrderActivity.kt
View file @
65c6b704
...
...
@@ -17,6 +17,7 @@ import android.util.Log
import
android.view.LayoutInflater
import
android.view.View
import
android.widget.TextView
import
androidx.core.content.ContextCompat
import
androidx.databinding.DataBindingUtil
import
androidx.lifecycle.MutableLiveData
import
androidx.lifecycle.Observer
...
...
@@ -40,7 +41,7 @@ import kotlinx.android.synthetic.main.activity_other_order.*
class
OtherOrderActivity
:
BaseActivity
()
{
private
lateinit
var
pageViewModel
:
PageViewModel
private
val
pageViewModel
by
lazy
{
ViewModelProvider
(
this
,
InjectorUtil
.
getWeatherModelFactory
())[
PageViewModel
::
class
.
java
]
}
private
val
instance
by
lazy
{
this
}
private
val
ints
=
arrayOf
(
...
...
@@ -67,7 +68,6 @@ class OtherOrderActivity : BaseActivity() {
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
val
binding
:
ActivityOtherOrderBinding
=
DataBindingUtil
.
setContentView
(
this
,
R
.
layout
.
activity_other_order
)
pageViewModel
=
ViewModelProvider
(
this
,
InjectorUtil
.
getWeatherModelFactory
())[
PageViewModel
::
class
.
java
]
initWebsocket
()
initAppTop
()
...
...
@@ -182,9 +182,6 @@ class OtherOrderActivity : BaseActivity() {
private
fun
initSwitchRestStatus
()
{
stateBg
.
cornerRadius
=
QMUIDisplayHelper
.
dp2px
(
this
,
4
).
toFloat
()
btnOpenBg
=
resources
.
getDrawable
(
R
.
drawable
.
shape_white_bottom_border
)
btnCloseBg
=
resources
.
getDrawable
(
R
.
drawable
.
shape_dialog_bg
)
//切換營業狀態
tv_restaurant_state
.
setOnClickListener
{
if
(
restaurantPopup
==
null
)
{
...
...
@@ -226,19 +223,19 @@ class OtherOrderActivity : BaseActivity() {
when
(
it
)
{
0
->
{
tv_restaurant_state
.
text
=
"休息中"
stateBg
.
setColor
(
resources
.
getColor
(
R
.
color
.
color_c8
))
stateBg
.
setColor
(
ContextCompat
.
getColor
(
this
,
R
.
color
.
color_c8
))
}
1
->
{
tv_restaurant_state
.
text
=
"營業中"
stateBg
.
setColor
(
resources
.
getColor
(
R
.
color
.
restaurant_color_open
))
stateBg
.
setColor
(
ContextCompat
.
getColor
(
this
,
R
.
color
.
restaurant_color_open
))
}
2
->
{
tv_restaurant_state
.
text
=
"繁忙不接"
stateBg
.
setColor
(
resources
.
getColor
(
R
.
color
.
restaurant_color_busy_close
))
stateBg
.
setColor
(
ContextCompat
.
getColor
(
this
,
R
.
color
.
restaurant_color_busy_close
))
}
3
->
{
tv_restaurant_state
.
text
=
"繁忙可接"
stateBg
.
setColor
(
resources
.
getColor
(
R
.
color
.
restaurant_color_busy_open
))
stateBg
.
setColor
(
ContextCompat
.
getColor
(
this
,
R
.
color
.
restaurant_color_busy_open
))
}
}
tv_restaurant_state
.
background
=
stateBg
...
...
@@ -291,59 +288,59 @@ class OtherOrderActivity : BaseActivity() {
}
}
private
var
soundPool
:
SoundPool
?
=
null
fun
initSoundPool
()
{
//实例化SoundPool
//sdk版本21是SoundPool 的一个分水岭
if
(
soundPool
==
null
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
21
)
{
val
builder
=
SoundPool
.
Builder
()
//传入最多播放音频数量,
builder
.
setMaxStreams
(
1
)
//AudioAttributes是一个封装音频各种属性的方法
val
attrBuilder
=
AudioAttributes
.
Builder
()
//设置音频流的合适的属性
attrBuilder
.
setLegacyStreamType
(
AudioManager
.
STREAM_MUSIC
)
//加载一个AudioAttributes
builder
.
setAudioAttributes
(
attrBuilder
.
build
())
soundPool
=
builder
.
build
()
}
else
{
/**
* 第一个参数:int maxStreams:SoundPool对象的最大并发流数
* 第二个参数:int streamType:AudioManager中描述的音频流类型
*第三个参数:int srcQuality:采样率转换器的质量。 目前没有效果。 使用0作为默认值。
*/
soundPool
=
SoundPool
(
1
,
AudioManager
.
STREAM_MUSIC
,
0
)
}
}
//可以通过四种途径来记载一个音频资源:
//1.通过一个AssetFileDescriptor对象
//int load(AssetFileDescriptor afd, int priority)
//2.通过一个资源ID
//int load(Context context, int resId, int priority)
//3.通过指定的路径加载
//int load(String path, int priority)
//4.通过FileDescriptor加载
//int load(FileDescriptor fd, long offset, long length, int priority)
//声音ID 加载音频资源,这里用的是第二种,第三个参数为priority,声音的优先级*API中指出,priority参数目前没有效果,建议设置为1。
val
voiceId
=
soundPool
!!
.
load
(
this
,
R
.
raw
.
newordervocal
,
1
)
//异步需要等待加载完成,音频才能播放成功
soundPool
!!
.
setOnLoadCompleteListener
{
soundPool
,
sampleId
,
status
->
if
(
status
==
0
)
{
//第一个参数soundID
//第二个参数leftVolume为左侧音量值(范围= 0.0到1.0)
//第三个参数rightVolume为右的音量值(范围= 0.0到1.0)
//第四个参数priority 为流的优先级,值越大优先级高,影响当同时播放数量超出了最大支持数时SoundPool对该流的处理
//第五个参数loop 为音频重复播放次数,0为值播放一次,-1为无限循环,其他值为播放loop+1次
//第六个参数 rate为播放的速率,范围0.5-2.0(0.5为一半速率,1.0为正常速率,2.0为两倍速率)
soundPool
.
play
(
voiceId
,
1f
,
1f
,
1
,
0
,
1f
)
}
}
}
//
private var soundPool: SoundPool? = null
//
fun initSoundPool() {
//
//实例化SoundPool
//
//sdk版本21是SoundPool 的一个分水岭
//
if (soundPool == null) {
//
if (Build.VERSION.SDK_INT >= 21) {
//
val builder = SoundPool.Builder()
//
//传入最多播放音频数量,
//
builder.setMaxStreams(1)
//
//AudioAttributes是一个封装音频各种属性的方法
//
val attrBuilder = AudioAttributes.Builder()
//
//设置音频流的合适的属性
//
attrBuilder.setLegacyStreamType(AudioManager.STREAM_MUSIC)
//
//加载一个AudioAttributes
//
builder.setAudioAttributes(attrBuilder.build())
//
soundPool = builder.build()
//
} else {
//
/**
//
* 第一个参数:int maxStreams:SoundPool对象的最大并发流数
//
* 第二个参数:int streamType:AudioManager中描述的音频流类型
//
*第三个参数:int srcQuality:采样率转换器的质量。 目前没有效果。 使用0作为默认值。
//
*/
//
soundPool = SoundPool(1, AudioManager.STREAM_MUSIC, 0)
//
}
//
}
//
//可以通过四种途径来记载一个音频资源:
//
//1.通过一个AssetFileDescriptor对象
//
//int load(AssetFileDescriptor afd, int priority)
//
//2.通过一个资源ID
//
//int load(Context context, int resId, int priority)
//
//3.通过指定的路径加载
//
//int load(String path, int priority)
//
//4.通过FileDescriptor加载
//
//int load(FileDescriptor fd, long offset, long length, int priority)
//
//声音ID 加载音频资源,这里用的是第二种,第三个参数为priority,声音的优先级*API中指出,priority参数目前没有效果,建议设置为1。
//
val voiceId = soundPool!!.load(this, R.raw.newordervocal, 1)
//
//异步需要等待加载完成,音频才能播放成功
//
soundPool!!.setOnLoadCompleteListener { soundPool, sampleId, status ->
//
if (status == 0) {
//
//第一个参数soundID
//
//第二个参数leftVolume为左侧音量值(范围= 0.0到1.0)
//
//第三个参数rightVolume为右的音量值(范围= 0.0到1.0)
//
//第四个参数priority 为流的优先级,值越大优先级高,影响当同时播放数量超出了最大支持数时SoundPool对该流的处理
//
//第五个参数loop 为音频重复播放次数,0为值播放一次,-1为无限循环,其他值为播放loop+1次
//
//第六个参数 rate为播放的速率,范围0.5-2.0(0.5为一半速率,1.0为正常速率,2.0为两倍速率)
//
soundPool.play(voiceId, 1f, 1f, 1, 0, 1f)
//
}
//
}
//
}
private
var
isOpen
:
Boolean
=
true
private
lateinit
var
btnOpenBg
:
Drawable
private
lateinit
var
btnCloseBg
:
Drawable
private
val
btnOpenBg
by
lazy
{
ContextCompat
.
getDrawable
(
this
,
R
.
drawable
.
shape_white_bottom_border
)
!!
}
private
val
btnCloseBg
by
lazy
{
ContextCompat
.
getDrawable
(
this
,
R
.
drawable
.
shape_dialog_bg
)
!!
}
/**
* 顯示或收起餐廳營業信息
*/
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/adapter/DeliveryListAdapter.kt
View file @
65c6b704
...
...
@@ -15,13 +15,11 @@ import com.gingersoft.gsa.other_order_mode.databinding.ItemDeliveryLayoutBinding
class
DeliveryListAdapter
(
val
context
:
Context
,
data
:
List
<
DeliveryConfig
.
Data
.
DeliveryInfo
>)
:
BaseQuickAdapter
<
DeliveryConfig
.
Data
.
DeliveryInfo
,
DeliveryListAdapter
.
ViewHolder
>(
data
)
{
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
ViewHolder
{
val
view
=
LayoutInflater
.
from
(
parent
.
context
).
inflate
(
R
.
layout
.
item_delivery_layout
,
null
)
return
ViewHolder
(
view
)
}
override
fun
convert
(
helper
:
ViewHolder
?,
item
:
DeliveryConfig
.
Data
.
DeliveryInfo
?)
{
helper
?.
let
{
helper
->
helper
.
binding
.
apply
{
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/adapter/OtherOrdersAdapter.kt
View file @
65c6b704
...
...
@@ -14,7 +14,6 @@ import androidx.recyclerview.widget.RecyclerView
import
androidx.recyclerview.widget.RecyclerView.Adapter
import
com.gingersoft.gsa.other_order_mode.R
import
com.gingersoft.gsa.other_order_mode.data.model.bean.OrderList
import
com.gingersoft.gsa.other_order_mode.databinding.LayoutOtherOrderItemBinding
import
com.gingersoft.gsa.other_order_mode.databinding.LayoutOtherOrderItemNewBinding
import
com.scwang.smartrefresh.layout.util.SmartUtil.dp2px
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/base/BaseFragment.kt
View file @
65c6b704
...
...
@@ -3,7 +3,10 @@ package com.gingersoft.gsa.other_order_mode.ui.base
import
androidx.fragment.app.Fragment
import
com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog
open
class
BaseFragment
:
Fragment
()
{
open
class
BaseFragment
(
contentLayoutId
:
Int
)
:
Fragment
(
contentLayoutId
)
{
constructor
()
:
this
(
0
)
fun
showLoading
(
message
:
String
?
=
null
)
{
if
(
message
!=
null
)
LoadingDialog
.
showDialogForLoading
(
activity
,
message
,
true
)
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/fragment/DeliveryFragment.kt
View file @
65c6b704
package
com.gingersoft.gsa.other_order_mode.ui.fragment
import
android.os.Bundle
import
android.util.Log
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
android.widget.Button
import
androidx.fragment.app.Fragment
import
androidx.lifecycle.Observer
import
androidx.lifecycle.ViewModelProvider
import
androidx.recyclerview.widget.LinearLayoutManager
...
...
@@ -18,35 +16,32 @@ import com.gingersoft.gsa.other_order_mode.ui.activity.DeliverySettingActivity
import
com.gingersoft.gsa.other_order_mode.ui.adapter.DeliveryListAdapter
import
com.gingersoft.gsa.other_order_mode.ui.base.BaseFragment
import
com.gingersoft.gsa.other_order_mode.util.InjectorUtil
import
com.gingersoft.gsa.other_order_mode.util.setState
import
kotlinx.android.synthetic.main.fragment_delivery_list.*
class
DeliveryFragment
:
BaseFragment
()
{
companion
object
{
fun
newInstance
()
=
DeliveryFragment
()
}
var
deliveryListAdapter
:
DeliveryListAdapter
?
=
null
private
lateinit
var
viewModel
:
DeliveryViewModel
private
val
viewModel
by
lazy
{
ViewModelProvider
(
activity
?.
viewModelStore
!!
,
InjectorUtil
.
getDeliveryFactory
())[
DeliveryViewModel
::
class
.
java
]
}
private
lateinit
var
contentView
:
View
private
lateinit
var
addBtn
:
Button
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?):
View
?
{
contentView
=
inflater
.
inflate
(
R
.
layout
.
fragment_delivery_list
,
container
,
false
)
val
contentView
=
inflater
.
inflate
(
R
.
layout
.
fragment_delivery_list
,
container
,
false
)
addBtn
=
contentView
.
findViewById
(
R
.
id
.
btn_default
)
return
contentView
}
override
fun
onActivityCreated
(
savedInstanceState
:
Bundle
?)
{
super
.
onActivityCreated
(
savedInstanceState
)
viewModel
=
ViewModelProvider
(
activity
?.
viewModelStore
!!
,
InjectorUtil
.
getDeliveryFactory
())[
DeliveryViewModel
::
class
.
java
]
// childFragmentManager.beginTransaction().remove(this).add(null, "").addToBackStack(null).commit()
addBtn
.
text
=
"+添加配送方式"
addBtn
.
setOnClickListener
{
addBtn
.
setOnClickListener
{
(
activity
as
DeliverySettingActivity
).
editDelivery
(
null
)
}
viewModel
.
otherInfo
.
observe
(
viewLifecycleOwner
,
Observer
{
it
->
if
(
it
?.
data
?.
list
!=
null
&&
it
.
data
.
list
.
isNotEmpty
())
{
if
(
deliveryListAdapter
==
null
)
{
...
...
@@ -62,7 +57,7 @@ class DeliveryFragment : BaseFragment() {
AppDialog
().
showWaringDialog
(
context
,
"是否確認刪除"
)
{
_
,
dialog
->
showLoading
()
it
.
data
.
list
[
position
].
apply
{
viewModel
.
updateDeliveryConfig
(
distributionFeeMin
.
toString
(),
distributionFeeMax
.
toString
(),
distributionFee
.
toString
(),
deliveryCost
.
toString
(),
distributionType
,
type
,
desc
,
id
,
GsaCloudApplication
.
getRestaurantId
(
context
),
GsaCloudApplication
.
getMemberId
(
context
),
lackPrice
.
toString
(),
1
)
{
viewModel
.
updateDeliveryConfig
(
distributionFeeMin
.
toString
(),
distributionFeeMax
.
toString
(),
distributionFee
.
toString
(),
deliveryCost
.
toString
(),
distributionType
,
type
,
desc
,
id
,
GsaCloudApplication
.
getRestaurantId
(
context
),
GsaCloudApplication
.
getMemberId
(
context
),
lackPrice
.
toString
(),
1
)
{
dialog
.
dismiss
()
cancelDialogForLoading
()
}
...
...
@@ -74,13 +69,9 @@ class DeliveryFragment : BaseFragment() {
}
//查看詳情---編輯
}
}
rv_delivery
?.
let
{
it
.
visibility
=
View
.
VISIBLE
}
rv_delivery
.
setState
(
true
)
}
else
{
rv_delivery
?.
let
{
it
.
visibility
=
View
.
GONE
}
rv_delivery
.
setState
(
false
)
}
})
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/fragment/HistoryFragment.kt
View file @
65c6b704
...
...
@@ -19,7 +19,7 @@ import com.gingersoft.gsa.other_order_mode.util.OtherOrderUtils
import
com.gingersoft.gsa.other_order_mode.util.setState
import
kotlinx.android.synthetic.main.fragment_other_order.*
class
HistoryFragment
:
BaseFragment
()
{
class
HistoryFragment
:
BaseFragment
(
R
.
layout
.
fragment_other_order
)
{
companion
object
{
fun
newInstance
()
=
HistoryFragment
()
...
...
@@ -30,12 +30,6 @@ class HistoryFragment : BaseFragment() {
private
var
pageIndex
=
1
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?):
View
?
{
return
inflater
.
inflate
(
R
.
layout
.
fragment_other_order
,
container
,
false
)
}
override
fun
onActivityCreated
(
savedInstanceState
:
Bundle
?)
{
super
.
onActivityCreated
(
savedInstanceState
)
viewModel
=
ViewModelProvider
(
activity
!!
.
viewModelStore
,
InjectorUtil
.
getHistoryModelFactory
())[
HistoryOrderViewModel
::
class
.
java
].
apply
{
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/fragment/PlaceholderFragment.kt
View file @
65c6b704
...
...
@@ -29,7 +29,7 @@ import kotlin.String as String1
/**
* A placeholder fragment containing a simple view.
*/
class
PlaceholderFragment
:
BaseFragment
()
{
class
PlaceholderFragment
:
BaseFragment
(
R
.
layout
.
fragment_other_order
)
{
private
lateinit
var
pageViewModel
:
PageViewModel
private
var
page
=
1
...
...
@@ -158,18 +158,13 @@ class PlaceholderFragment : BaseFragment() {
getOrderList
(
pageViewModel
,
false
)
}
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?):
View
?
{
return
inflater
.
inflate
(
R
.
layout
.
fragment_other_order
,
container
,
false
)
}
private
fun
getOrderList
(
pageViewModel
:
PageViewModel
,
isLoadMore
:
Boolean
)
{
pageViewModel
.
getOrderList
(
activity
!!
,
arguments
?.
getInt
(
INDEX
)
?:
0
,
page
.
toString
(),
isLoadMore
)
{
// if (!isLoadMore) {
// layout_nodata.setState(it <= 0)
// }
refresh_layout
.
finishRefresh
()
refresh_layout
.
finishLoadMore
()
if
(
refresh_layout
!=
null
)
{
refresh_layout
.
finishRefresh
()
refresh_layout
.
finishLoadMore
()
}
}
}
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/fragment/UpdateDeliveryFragment.kt
View file @
65c6b704
...
...
@@ -25,7 +25,7 @@ import com.zhy.autolayout.utils.ScreenUtils
import
kotlinx.android.synthetic.main.update_delivery_fragment.*
import
org.w3c.dom.Text
class
UpdateDeliveryFragment
:
BaseFragment
()
{
class
UpdateDeliveryFragment
:
BaseFragment
(
R
.
layout
.
update_delivery_fragment
)
{
companion
object
{
private
const
val
info
=
"info"
...
...
@@ -42,12 +42,6 @@ class UpdateDeliveryFragment : BaseFragment() {
private
lateinit
var
viewModel
:
DeliveryViewModel
var
deliveryConfig
:
DeliveryConfig
.
Data
.
DeliveryInfo
?
=
null
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?):
View
?
{
return
inflater
.
inflate
(
R
.
layout
.
update_delivery_fragment
,
container
,
false
)
}
var
pop
:
QMUIPopup
?
=
null
var
deliveryType
=
arrayListOf
(
"短途送"
,
"中途送"
,
"長途送"
)
var
deliveryMethod
=
arrayListOf
(
"本店配送"
,
"第三方"
)
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/util/ViewUtil.kt
View file @
65c6b704
package
com.gingersoft.gsa.other_order_mode.util
import
android.content.Context
import
android.graphics.drawable.Drawable
import
android.view.View
fun
View
.
setState
(
state
:
Boolean
)
{
...
...
@@ -12,7 +10,3 @@ fun View.setState(state: Boolean) {
}
}
fun
Context
.
getDrawable
(
drawable
:
Int
):
Drawable
{
return
this
.
resources
.
getDrawable
(
drawable
)
}
\ No newline at end of file
other_order_mode/src/main/res/layout/activity_order_details.xml
View file @
65c6b704
...
...
@@ -39,9 +39,6 @@
name=
"patMethod"
type=
"String"
/>
<variable
name=
"estimatedTime"
type=
"String"
/>
</data>
<RelativeLayout
...
...
@@ -107,9 +104,7 @@
android:layout_margin=
"@dimen/other_order_info_dialog_content_marginRight"
android:text=
"@{orderStatus}"
android:textColor=
"#009788"
android:textSize=
"@dimen/dp_15"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
android:textSize=
"@dimen/dp_15"
/>
</RelativeLayout>
<include
layout=
"@layout/include_horizontal_color_eee_dividing_line"
/>
...
...
@@ -122,20 +117,26 @@
android:layout_height=
"wrap_content"
android:layout_margin=
"@dimen/other_order_info_dialog_content_marginLeft"
android:layout_marginTop=
"@dimen/dp_10"
android:text=
"@{@string/order_no + data.oRDER_NO}"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/tv_order_num"
/>
android:text=
"@{@string/order_no + data.oRDER_NO}"
/>
<TextView
android:id=
"@+id/tv_create_time"
style=
"@style/otherOrder_details_twelve_text_Style"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/other_order_info_dialog_content_marginLeft"
android:layout_marginRight=
"@dimen/dp_10"
android:text=
"@{@string/create_order_time + TimeUtils.parseTimeRepeat(data.cREATE_TIME,TimeUtils.DEFAULT_DATE_FORMAT)}"
/>
<TextView
style=
"@style/otherOrder_details_twelve_text_Style"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/other_order_info_dialog_content_marginLeft"
android:text=
"@{@string/create_order_time + TimeUtils.parseTimeRepeat(data.cREATE_TIME,TimeUtils.DEFAULT_DATE_FORMAT)}"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/tv_order_no"
/>
android:layout_marginTop=
"@dimen/dp_10"
android:layout_marginRight=
"@dimen/other_order_info_dialog_content_marginRight"
android:text=
"@{data.estimatedTime}"
android:visibility=
"@{data.estimatedTime.length()>0?View.VISIBLE:View.GONE}"
/>
</LinearLayout>
<LinearLayout
...
...
@@ -372,8 +373,8 @@
android:layout_marginLeft=
"@dimen/dp_10"
android:layout_marginTop=
"@dimen/dp_10"
android:layout_marginRight=
"@dimen/dp_10"
android:background=
"@drawable/shape_dialog_bg"
android:layout_marginBottom=
"@dimen/dp_10"
android:background=
"@drawable/shape_dialog_bg"
android:orientation=
"vertical"
android:paddingBottom=
"@dimen/dp_10"
>
...
...
other_order_mode/src/main/res/layout/fragment_other_order.xml
View file @
65c6b704
...
...
@@ -17,4 +17,5 @@
android:id=
"@+id/layout_nodata"
layout=
"@layout/layout_no_data"
/>
</FrameLayout>
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
other_order_mode/src/main/res/layout/layout_other_order_item.xml
deleted
100644 → 0
View file @
3f5df67d
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
>
<data>
<import
type=
"com.gingersoft.gsa.cloud.base.utils.time.TimeUtils"
/>
<import
type=
"android.view.View"
/>
<variable
name=
"data"
type=
"com.gingersoft.gsa.other_order_mode.data.model.bean.OrderList.DataBeanX.DataBean"
/>
<variable
name=
"delivery_state"
type=
"String"
/>
<variable
name=
"state"
type=
"String"
/>
<variable
name=
"orderingMethod"
type=
"String"
/>
<variable
name=
"payMethod"
type=
"String"
/>
<variable
name=
"orderingMethodBg"
type=
"android.graphics.drawable.Drawable"
/>
<variable
name=
"stateBg"
type=
"android.graphics.drawable.Drawable"
/>
<variable
name=
"payMethodBg"
type=
"android.graphics.drawable.Drawable"
/>
<!-- 是否自取-->
<variable
name=
"isSelf"
type=
"Boolean"
/>
</data>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/dp_3"
android:layout_marginTop=
"@dimen/dp_7"
android:layout_marginRight=
"@dimen/dp_3"
>
<com.lihang.ShadowLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:hl_cornerRadius=
"@dimen/dp_8"
app:hl_shadowLimit=
"@dimen/dp_3"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<TextView
android:id=
"@+id/tv_delivery_method"
android:layout_width=
"@dimen/dp_19"
android:layout_height=
"0dp"
android:background=
"@{orderingMethodBg}"
android:gravity=
"center"
android:text=
"@{orderingMethod}"
tools:text=
"外送"
tools:textColor=
"@color/theme_333_color"
android:textColor=
"@color/white"
android:textSize=
"@dimen/dp_14"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:id=
"@+id/tv_payment_method"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_5"
android:background=
"@{payMethodBg}"
android:paddingLeft=
"@dimen/dp_10"
android:paddingTop=
"@dimen/dp_2"
android:paddingRight=
"@dimen/dp_10"
tools:text=
"支付方式案發生的阿斯蒂芬阿薩德發送發送"
tools:textColor=
"@color/theme_333_color"
android:paddingBottom=
"@dimen/dp_2"
android:text=
"@{payMethod}"
android:textColor=
"@color/white"
android:textSize=
"@dimen/sp_10"
app:layout_constraintLeft_toLeftOf=
"@id/tv_order_user_name"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:id=
"@+id/tv_order_time"
style=
"@style/otherOrder_item_create_time_textStyle"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginRight=
"@dimen/dp_10"
android:gravity=
"right"
android:textSize=
"@dimen/dp_10"
tools:text=
"訂單時間水電費垃圾撒旦法阿斯蒂芬阿斯蒂芬"
tools:textColor=
"@color/theme_333_color"
android:text=
"@{TimeUtils.parseTimeRepeat(data.cREATE_TIME,TimeUtils.DEFAULT_DATE_FORMAT)}"
app:layout_constraintLeft_toRightOf=
"@id/tv_payment_method"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"@id/tv_payment_method"
app:layout_constraintTop_toTopOf=
"@id/tv_payment_method"
/>
<TextView
android:id=
"@+id/tv_order_user_name"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/dp_4"
android:layout_marginTop=
"@dimen/dp_6"
android:layout_marginRight=
"@dimen/dp_10"
tools:text=
"用戶名+手機號啊實打實啊實打實大阿達"
tools:textColor=
"@color/theme_333_color"
android:textColor=
"@color/theme_text_color"
android:textSize=
"@dimen/sp_14"
android:text=
"@{data.rECEIVER + @string/left_parenthesis+data.pHONE + @string/right_parenthesis}"
android:textStyle=
"bold"
app:layout_constraintLeft_toRightOf=
"@id/tv_delivery_method"
app:layout_constraintRight_toLeftOf=
"@id/barrier_order_right_line"
app:layout_constraintTop_toBottomOf=
"@id/tv_payment_method"
/>
<TextView
android:id=
"@+id/tv_delivery_state"
style=
"@style/otherOrder_item_info_title_textStyle"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_18"
android:gravity=
"right"
android:text=
"@{delivery_state}"
tools:text=
"用戶名+手"
tools:textColor=
"@color/theme_333_color"
android:textColor=
"@color/color_3c"
app:layout_constraintRight_toRightOf=
"@id/tv_order_time"
app:layout_constraintTop_toBottomOf=
"@id/tv_order_time"
/>
<androidx.constraintlayout.widget.Barrier
android:id=
"@+id/barrier_order_right_line"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
app:barrierDirection=
"left"
app:constraint_referenced_ids=
"tv_order_time,tv_order_amount,tv_delivery_state,tv_order_state"
/>
<androidx.constraintlayout.widget.Barrier
android:id=
"@+id/barrier_order_info"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
app:barrierDirection=
"right"
app:constraint_referenced_ids=
"tv_address_text,tv_order_num_text"
/>
<TextView
android:id=
"@+id/tv_delivery_time"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_9"
android:text=
"@{data.sendTime}"
android:textColor=
"#EC2D2D"
tools:text=
"送達時間Adasd奧術大師大所多啊實打實大啊實打實大阿薩德"
tools:textColor=
"@color/theme_333_color"
android:textSize=
"@dimen/dp_12"
android:visibility=
"visible"
app:layout_constraintHorizontal_bias=
"0"
app:layout_constraintRight_toLeftOf=
"@id/barrier_order_right_line"
app:layout_constraintLeft_toLeftOf=
"@id/tv_order_user_name"
app:layout_constraintTop_toBottomOf=
"@id/tv_order_user_name"
/>
<TextView
android:id=
"@+id/tv_order_num_text"
style=
"@style/otherOrder_item_info_title_textStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_8"
android:text=
"取餐碼:"
app:layout_constraintLeft_toLeftOf=
"@id/tv_order_user_name"
app:layout_constraintTop_toBottomOf=
"@id/tv_delivery_time"
/>
<TextView
android:id=
"@+id/tv_order_num"
style=
"@style/otherOrder_item_info_title_textStyle"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:text=
'@{data.takeFoodCode.equals("0")? @string/take_food_code_omit:data.takeFoodCode}'
android:textSize=
"@dimen/dp_14"
tools:text=
"012121201阿達as244342313154446455443434242"
tools:textColor=
"@color/theme_333_color"
android:textStyle=
"bold"
app:layout_constraintHorizontal_bias=
"0"
app:layout_constraintBottom_toBottomOf=
"@id/tv_order_num_text"
app:layout_constraintLeft_toRightOf=
"@id/barrier_order_info"
app:layout_constraintRight_toLeftOf=
"@id/barrier_order_right_line"
app:layout_constraintTop_toTopOf=
"@id/tv_order_num_text"
/>
<TextView
android:id=
"@+id/tv_order_state"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_14"
android:background=
"@{stateBg}"
android:padding=
"@dimen/dp_5"
android:text=
"@{state}"
tools:text=
"訂單狀態"
tools:textColor=
"@color/theme_333_color"
android:textColor=
"@color/white"
android:textSize=
"@dimen/dp_14"
app:layout_constraintRight_toRightOf=
"@id/tv_order_time"
app:layout_constraintTop_toBottomOf=
"@id/tv_delivery_state"
/>
<TextView
android:id=
"@+id/tv_address_text"
style=
"@style/otherOrder_item_info_title_textStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"0dp"
android:layout_marginTop=
"@dimen/dp_9"
tools:text=
"地址"
tools:textColor=
"@color/theme_333_color"
android:text=
"@{@string/address}"
android:visibility=
"@{isSelf?View.GONE:View.VISIBLE}"
app:layout_constraintBottom_toBottomOf=
"@id/tv_address"
app:layout_constraintLeft_toLeftOf=
"@id/tv_order_user_name"
app:layout_constraintTop_toBottomOf=
"@id/tv_order_num_text"
/>
<TextView
android:id=
"@+id/tv_address"
style=
"@style/otherOrder_item_info_textStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginRight=
"@dimen/dp_5"
android:layout_marginBottom=
"@dimen/dp_10"
android:text=
"@{data.aDDRESS_DETAIL}"
app:layout_constraintHorizontal_bias=
"0"
tools:text=
"地址安居客收到貨卡和山東傻了發哈連接阿斯蒂芬"
tools:textColor=
"@color/theme_333_color"
android:visibility=
"@{isSelf?View.GONE:View.VISIBLE}"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toRightOf=
"@id/barrier_order_info"
app:layout_constraintRight_toLeftOf=
"@id/barrier_order_right_line"
app:layout_constraintTop_toTopOf=
"@id/tv_address_text"
/>
<TextView
android:id=
"@+id/tv_order_amount"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_3"
android:layout_marginRight=
"@dimen/dp_10"
android:text=
"@{@string/amount_unit + data.pAY_AMOUNT}"
android:textColor=
"@color/red_600"
android:textSize=
"@dimen/sp_16"
tools:text=
"$1412121331345643"
tools:textColor=
"@color/theme_333_color"
app:layout_constraintTop_toBottomOf=
"@id/tv_delivery_state"
app:layout_constraintRight_toRightOf=
"@id/tv_order_time"
app:layout_constraintTop_toTopOf=
"@id/tv_address_text"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.lihang.ShadowLayout>
<FrameLayout
android:id=
"@+id/fl_border"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@drawable/shape_order_border"
android:visibility=
"gone"
/>
</FrameLayout>
</layout>
\ No newline at end of file
other_order_mode/src/main/res/layout/layout_other_order_item_new.xml
View file @
65c6b704
...
...
@@ -167,10 +167,6 @@
android:textColor=
"#EC2D2D"
android:textSize=
"@dimen/dp_12"
android:visibility=
"visible"
app:layout_constraintHorizontal_bias=
"0"
app:layout_constraintLeft_toLeftOf=
"@id/tv_order_user_name"
app:layout_constraintRight_toLeftOf=
"@id/barrier_order_right_line"
app:layout_constraintTop_toBottomOf=
"@id/tv_order_user_name"
tools:text=
"送達時間Adasd奧術大師大所多啊實打實大啊實打實大阿薩德"
tools:textColor=
"@color/theme_333_color"
/>
...
...
print-module/src/main/java/com/joe/print/mvp/model/bean/PrjBean.java
View file @
65c6b704
...
...
@@ -70,6 +70,9 @@ public class PrjBean {
private
int
type
;
private
int
printerType
;
private
Long
printerTime
;
private
String
number
;
private
String
productId
;
private
Long
createTime
;
/***
* 層級
* 1:主食品
...
...
print-module/src/main/java/com/joe/print/mvp/print/service/PrjService.java
View file @
65c6b704
...
...
@@ -56,9 +56,13 @@ public class PrjService extends Service implements PrintSocketHolder.OnStateChan
public
void
onCreate
()
{
super
.
onCreate
();
//讀取本地ip打印機
PrinterDeviceDaoUtils
printerDeviceDaoUtils
=
new
PrinterDeviceDaoUtils
(
this
);
printerDeviceBeans
=
printerDeviceDaoUtils
.
queryAllPrinterDeviceBean
();
//開始請求
Log
.
e
(
"eee"
,
"開啟打印服務"
);
// if (printerDeviceBeans == null) {
// PrinterDeviceDaoUtils printerDeviceDaoUtils = new PrinterDeviceDaoUtils(this);
// printerDeviceBeans = printerDeviceDaoUtils.queryAllPrinterDeviceBean();
// printerDeviceDaoUtils.closeConnection();
// }
// //開始請求
// startGetPrjInfo();
}
...
...
@@ -75,7 +79,7 @@ public class PrjService extends Service implements PrintSocketHolder.OnStateChan
if
(
wakeDisposable
!=
null
&&
!
wakeDisposable
.
isDisposed
())
{
wakeDisposable
.
dispose
();
}
Observable
.
interval
(
5
,
1
0
,
TimeUnit
.
SECONDS
)
Observable
.
interval
(
5
,
3
0
,
TimeUnit
.
SECONDS
)
.
subscribe
(
new
Observer
<
Long
>()
{
@Override
public
void
onSubscribe
(
Disposable
d
)
{
...
...
@@ -104,7 +108,7 @@ public class PrjService extends Service implements PrintSocketHolder.OnStateChan
* 請求prj數據
*/
private
void
getPrjInfo
()
{
OkHttp3Utils
.
get
(
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL
+
"prg/get?restaurantId="
+
GsaCloudApplication
.
getRestaurantId
(
this
))
OkHttp3Utils
.
get
(
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL
+
"pr
interRecordin
g/get?restaurantId="
+
GsaCloudApplication
.
getRestaurantId
(
this
))
.
subscribeOn
(
Schedulers
.
io
())
//切换到io线程進行網絡請求
.
observeOn
(
AndroidSchedulers
.
mainThread
())
//切換到主線程處理請求結果
.
subscribe
(
new
Observer
<
String
>()
{
...
...
@@ -116,6 +120,8 @@ public class PrjService extends Service implements PrintSocketHolder.OnStateChan
@Override
public
void
onNext
(
String
s
)
{
Log
.
e
(
"eee"
,
"請求到PRJ數據:"
+
s
);
//請求到數據,停止輪詢,開始打印,在打印完之後再重新開始輪詢
startPrint
(
s
);
//開啟另一個定時,三十秒之後自動請求,避免上面的打印成功或失敗時沒有回調。
...
...
@@ -171,7 +177,7 @@ public class PrjService extends Service implements PrintSocketHolder.OnStateChan
private
void
startPrint
(
String
json
)
{
printDatas
.
clear
();
PrjBean
prjBean
=
JsonUtils
.
parseObject
(
json
,
PrjBean
.
class
);
if
(
prjBean
.
getData
()
==
null
)
{
if
(
prjBean
==
null
||
prjBean
.
getData
()
==
null
)
{
return
;
}
try
{
...
...
@@ -187,6 +193,7 @@ public class PrjService extends Service implements PrintSocketHolder.OnStateChan
// if (key.equals("-1")) {
// PrintPrjKitchen.getPrjMap().put("", datas);
// } else {
Log
.
e
(
"eee"
,
"打印數據條數:"
+
datas
.
size
());
PrintPrjKitchen
.
getPrjMap
().
put
(
key
,
datas
);
// }
printDatas
.
addAll
(
datas
);
...
...
@@ -194,11 +201,13 @@ public class PrjService extends Service implements PrintSocketHolder.OnStateChan
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
// updatePrjState(3);
if
(
printerInIt
==
null
)
{
printerInIt
=
PrinterRoot
.
getPrinterByType
(
PRINT_KITCHEN
);
}
if
(
printerInIt
!=
null
)
{
printerInIt
.
setmContext
(
this
);
for
(
Map
.
Entry
<
String
,
List
<
Bitmap
>>
entry
:
printerInIt
.
getPrintBitmap
(
this
).
entrySet
())
{
//遍歷所有的需要打印的內容
for
(
int
i
=
0
;
i
<
printerDeviceBeans
.
size
();
i
++)
{
...
...
@@ -223,15 +232,19 @@ public class PrjService extends Service implements PrintSocketHolder.OnStateChan
if
(
printState
==
3
)
{
time
=
TimeUtils
.
getCurrentTimeInLong
();
}
for
(
int
i
=
0
;
i
<
printDatas
.
size
();
i
++)
{
printDatas
.
get
(
i
).
setPrinterType
(
printState
);
printDatas
.
get
(
i
).
setPrinterTime
(
time
);
List
<
UpdateBean
>
updateBeans
=
new
ArrayList
<>();
for
(
PrjBean
.
DataBean
.
Bean
bean
:
printDatas
)
{
updateBeans
.
add
(
new
UpdateBean
(
String
.
valueOf
(
bean
.
getId
()),
printState
,
time
));
}
RequestBody
requestBody
=
RequestBody
.
create
(
MediaType
.
parse
(
"application/json"
),
JsonUtils
.
toJson
(
printDatas
));
String
json
=
JsonUtils
.
toJson
(
updateBeans
);
Log
.
e
(
"eee"
,
""
+
json
);
RequestBody
requestBody
=
RequestBody
.
create
(
MediaType
.
parse
(
"application/json"
),
json
);
//打印過後,直接再讀數據,不用管是否已更新狀態。
startGetPrjInfo
();
OkHttp3Utils
.
post
(
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL
+
"prg/update"
,
requestBody
)
OkHttp3Utils
.
post
(
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL
+
"pr
interRecordin
g/update"
,
requestBody
)
.
subscribeOn
(
Schedulers
.
io
())
//切换到io线程進行網絡請求
.
observeOn
(
AndroidSchedulers
.
mainThread
())
//切換到主線程處理請求結果
.
subscribe
(
new
Observer
<
String
>()
{
...
...
@@ -243,6 +256,7 @@ public class PrjService extends Service implements PrintSocketHolder.OnStateChan
@Override
public
void
onNext
(
String
s
)
{
Log
.
e
(
"eee"
,
"修改打印狀態:"
+
s
);
}
@Override
...
...
@@ -261,46 +275,36 @@ public class PrjService extends Service implements PrintSocketHolder.OnStateChan
String
tip
=
"加載中"
;
switch
(
state
)
{
case
PrintSocketHolder
.
ERROR_0
:
// Log.e("eee", "打印成功");
tip
=
"打印成功"
;
break
;
case
PrintSocketHolder
.
ERROR_1
:
// Log.e("eee", "生成測試頁面數據失敗");
tip
=
"生成打印數據失敗"
;
break
;
case
PrintSocketHolder
.
ERROR_2
:
// Log.e("eee", "連接打印機失敗" + System.currentTimeMillis());
case
PrintSocketHolder
.
ERROR_3
:
// Log.e("eee", "獲取輸出流失敗");
tip
=
"連接打印機失敗"
;
break
;
case
PrintSocketHolder
.
ERROR_4
:
// Log.e("eee", "寫入測試頁面數據失敗");
tip
=
"寫入測試頁面數據失敗"
;
break
;
case
PrintSocketHolder
.
ERROR_5
:
// Log.e("eee", "必要的參數不能為空");
tip
=
"必要的參數不能為空"
;
break
;
case
PrintSocketHolder
.
STATE_0
:
// Log.e("eee", "生成測試頁數據");
case
PrintSocketHolder
.
STATE_1
:
// Log.e("eee", "開始創建連接");
tip
=
"開始創建連接"
;
break
;
case
PrintSocketHolder
.
STATE_2
:
// Log.e("eee", "創建連接成功,開始發送數據");
tip
=
"創建連接成功,開始發送數據"
;
break
;
case
PrintSocketHolder
.
STATE_3
:
// Log.e("eee", "開始寫入數據");
tip
=
"開始寫入數據"
;
break
;
case
PrintSocketHolder
.
STATE_4
:
// Log.e("eee", "關閉中");
tip
=
"關閉中"
;
break
;
}
Log
.
e
(
"eee"
,
"打印機狀態:"
+
tip
);
}
@Override
...
...
@@ -309,19 +313,60 @@ public class PrjService extends Service implements PrintSocketHolder.OnStateChan
case
PrintSocketHolder
.
ERROR_0
:
//更新狀態
updatePrjState
(
3
);
Log
.
e
(
"eee"
,
"打印成功"
);
break
;
case
PrintSocketHolder
.
ERROR_1
:
break
;
case
PrintSocketHolder
.
ERROR_2
:
Log
.
e
(
"eee"
,
"创建Socket失败"
);
//再次打開輪詢
updatePrjState
(
1
);
updatePrjState
(
4
);
case
PrintSocketHolder
.
ERROR_3
:
Log
.
e
(
"eee"
,
"获取输出流失败"
);
break
;
case
PrintSocketHolder
.
ERROR_4
:
Log
.
e
(
"eee"
,
"写入测试页面数据失败"
);
break
;
case
PrintSocketHolder
.
ERROR_5
:
Log
.
e
(
"eee"
,
"必要参数不能为空"
);
break
;
}
}
public
class
UpdateBean
{
private
String
id
;
private
int
printerType
;
private
Long
printerTime
;
public
UpdateBean
(
String
id
,
int
printerType
,
Long
printerTime
)
{
this
.
id
=
id
;
this
.
printerType
=
printerType
;
this
.
printerTime
=
printerTime
;
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
int
getPrinterType
()
{
return
printerType
;
}
public
void
setPrinterType
(
int
printerType
)
{
this
.
printerType
=
printerType
;
}
public
Long
getPrinterTime
()
{
return
printerTime
;
}
public
void
setPrinterTime
(
Long
printerTime
)
{
this
.
printerTime
=
printerTime
;
}
}
}
print-module/src/main/res/layout/printer_activity_add.xml
View file @
65c6b704
...
...
@@ -32,6 +32,7 @@
android:layout_alignParentRight=
"true"
android:layout_weight=
"0.7"
android:background=
"@null"
android:digits=
"@string/edit_digits_number_words"
android:hint=
"請輸入打印機名稱"
android:maxLength=
"20"
android:singleLine=
"true"
...
...
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