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
da93bfc3
Commit
da93bfc3
authored
Apr 06, 2020
by
Wyh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
04-06 修改打印邏輯前
parent
0fd819b0
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
670 additions
and
61 deletions
+670
-61
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/OtherOrderComponent.java
+1
-0
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/data/WeatherRepository.kt
+10
-0
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/data/model/bean/OrderDetails.kt
+107
-0
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/data/network/CoolWeatherNetwork.kt
+3
-1
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/ui/adapter/OtherOrdersAdapter.kt
+11
-1
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/main/PageViewModel.kt
+14
-0
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/main/PlaceholderFragment.kt
+26
-2
other_order_mode/src/main/res/drawable/shape_dialog_bg.xml
+9
-0
other_order_mode/src/main/res/layout/layout_order_info_dialog.xml
+363
-0
other_order_mode/src/main/res/layout/layout_other_order_item.xml
+3
-1
other_order_mode/src/main/res/values/styles.xml
+20
-6
print-module/src/main/java/com/joe/print/mvp/print/PrintUtils.java
+76
-36
print-module/src/main/java/com/joe/print/mvp/ui/activity/IpPrintActivity.java
+0
-11
public-base/src/main/java/com/gingersoft/gsa/cloud/base/utils/MoneyUtil.java
+13
-0
public-base/src/main/res/layout/print_kitchen.xml
+3
-3
user-login/build.gradle
+4
-0
No files found.
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/OtherOrderComponent.java
View file @
da93bfc3
...
@@ -41,6 +41,7 @@ public class OtherOrderComponent implements IComponent {
...
@@ -41,6 +41,7 @@ public class OtherOrderComponent implements IComponent {
break
;
break
;
case
"orderActivity"
:
case
"orderActivity"
:
CCUtil
.
navigateTo
(
cc
,
OtherOrderActivity
.
class
);
CCUtil
.
navigateTo
(
cc
,
OtherOrderActivity
.
class
);
CC
.
sendCCResult
(
cc
.
getCallId
(),
CCResult
.
success
());
break
;
break
;
default
:
default
:
// cc.callAsync(new IComponentCallback() {
// cc.callAsync(new IComponentCallback() {
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/data/WeatherRepository.kt
View file @
da93bfc3
...
@@ -31,6 +31,16 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
...
@@ -31,6 +31,16 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
}
}
suspend
fun
getOrderInfo
(
orderId
:
String
)
=
withContext
(
Dispatchers
.
IO
)
{
val
requestBody
=
FormBody
.
Builder
()
.
add
(
"orderId"
,
orderId
)
.
build
()
val
data
=
network
.
getOrderInfo
(
requestBody
)
data
}
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/OrderDetails.kt
0 → 100644
View file @
da93bfc3
package
com.gingersoft.gsa.other_order_mode.data.model.bean
class
OrderDetails
{
/**
* success : true
* sysTime : 1585823531720
* data : [{"Order_ID":50349,"NUMBER":1,"MEMBER_NAME":"忆逝1","PRICE":88,"discount_amount":0,"PHONE":"15728241877","ORDER_NO":"26202811401145744","Lunchbox":0,"remark":"","pid":0,"PRODUCT_NAME":[{"odsId":"1650249","PRICE":"88.0","num":"1","pid":"0","PRODUCT_NAME":"脆炸粟米蟹肉餅"}],"odsId":1650249,"addressDetail":"香港長沙灣青山道479 - 479A號麗昌工廠大廈 704 室及 802 室(接待處於 704 室蘋果迷你倉 - 荔枝角 (麗昌分店)分店","DELIVERY_CHARGE":0,"order_from":7,"sender":"","SEND_TIME":"盡快送達 18:27","PAY_AMOUNT":88,"ID":50349,"CREATE_TIME":"2020-04-02 17:57:29.0","takeFoodCode":"0","RECEIVER":"張學友 先生","TOTAL_AMOUNT":"88.0"}]
*/
private
var
success
:
Boolean
=
false
private
var
sysTime
:
Long
=
0
private
var
data
:
List
<
DataBean
>?
=
null
fun
isSuccess
():
Boolean
{
return
success
}
fun
setSuccess
(
success
:
Boolean
)
{
this
.
success
=
success
}
fun
getSysTime
():
Long
{
return
sysTime
}
fun
setSysTime
(
sysTime
:
Long
)
{
this
.
sysTime
=
sysTime
}
fun
getData
():
List
<
DataBean
>?
{
return
data
}
fun
setData
(
data
:
List
<
DataBean
>)
{
this
.
data
=
data
}
class
DataBean
{
/**
* Order_ID : 50349
* NUMBER : 1
* MEMBER_NAME : 忆逝1
* PRICE : 88.0
* discount_amount : 0.0
* PHONE : 15728241877
* ORDER_NO : 26202811401145744
* Lunchbox : 0.0
* remark :
* pid : 0
* PRODUCT_NAME : [{"odsId":"1650249","PRICE":"88.0","num":"1","pid":"0","PRODUCT_NAME":"脆炸粟米蟹肉餅"}]
* odsId : 1650249
* addressDetail : 香港長沙灣青山道479 - 479A號麗昌工廠大廈 704 室及 802 室(接待處於 704 室蘋果迷你倉 - 荔枝角 (麗昌分店)分店
* DELIVERY_CHARGE : 0.0
* order_from : 7
* sender :
* SEND_TIME : 盡快送達 18:27
* PAY_AMOUNT : 88.0
* ID : 50349
* CREATE_TIME : 2020-04-02 17:57:29.0
* takeFoodCode : 0
* RECEIVER : 張學友 先生
* TOTAL_AMOUNT : 88.0
*/
var
Order_ID
:
Int
=
0
var
NUMBER
:
Int
=
0
var
MEMBER_NAME
:
String
?
=
null
var
PRICE
:
Double
=
0
.
toDouble
()
var
discount_amount
:
Double
=
0
.
toDouble
()
var
PHONE
:
String
?
=
null
var
ORDER_NO
:
String
?
=
null
var
Lunchbox
:
Double
=
0
.
toDouble
()
var
remark
:
String
?
=
null
var
pid
:
Int
=
0
var
odsId
:
Int
=
0
var
addressDetail
:
String
?
=
null
var
DELIVERY_CHARGE
:
Double
=
0
.
toDouble
()
var
order_from
:
Int
=
0
var
sender
:
String
?
=
null
var
SEND_TIME
:
String
?
=
null
var
PAY_AMOUNT
:
Double
=
0
.
toDouble
()
var
ID
:
Int
=
0
var
CREATE_TIME
:
String
?
=
null
var
takeFoodCode
:
String
?
=
null
var
RECEIVER
:
String
?
=
null
var
TOTAL_AMOUNT
:
String
?
=
null
var
PRODUCT_NAME
:
List
<
PRODUCTNAMEBean
>?
=
null
class
PRODUCTNAMEBean
{
/**
* odsId : 1650249
* PRICE : 88.0
* num : 1
* pid : 0
* PRODUCT_NAME : 脆炸粟米蟹肉餅
*/
var
odsId
:
String
?
=
null
var
price
:
String
?
=
null
var
num
:
String
?
=
null
var
pid
:
String
?
=
null
var
producT_NAME
:
String
?
=
null
}
}
}
\ No newline at end of file
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/data/network/CoolWeatherNetwork.kt
View file @
da93bfc3
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.other_order_mode.data.network.api.WeatherService
import
com.gingersoft.gsa.other_order_mode.data.network.api.WeatherService
import
okhttp3.RequestBody
import
okhttp3.RequestBody
import
retrofit2.Call
import
retrofit2.Call
...
@@ -20,6 +19,9 @@ class CoolWeatherNetwork {
...
@@ -20,6 +19,9 @@ class CoolWeatherNetwork {
suspend
fun
updateRestOpenStatus
(
requestBody
:
RequestBody
)
=
service
.
updateRestOpenStatus
(
requestBody
).
await
()
suspend
fun
updateRestOpenStatus
(
requestBody
:
RequestBody
)
=
service
.
updateRestOpenStatus
(
requestBody
).
await
()
suspend
fun
getOrderInfo
(
requestBody
:
RequestBody
)
=
orderService
.
getOrderDesc
(
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/api/WeatherService.kt
View file @
da93bfc3
package
com.gingersoft.gsa.other_order_mode.data.network.api
package
com.gingersoft.gsa.other_order_mode.data.network.api
import
com.gingersoft.gsa.other_order_mode.data.model.bean.MessageBean
import
com.gingersoft.gsa.other_order_mode.data.model.bean.MessageBean
import
com.gingersoft.gsa.other_order_mode.data.model.bean.OrderDetails
import
com.gingersoft.gsa.other_order_mode.data.model.bean.OrderList
import
com.gingersoft.gsa.other_order_mode.data.model.bean.OrderList
import
okhttp3.RequestBody
import
okhttp3.RequestBody
import
retrofit2.Call
import
retrofit2.Call
...
@@ -14,4 +15,9 @@ interface WeatherService {
...
@@ -14,4 +15,9 @@ interface WeatherService {
@POST
(
"wx/updateRestOpenStatus"
)
@POST
(
"wx/updateRestOpenStatus"
)
fun
updateRestOpenStatus
(
@Body
requestBody
:
RequestBody
):
Call
<
MessageBean
>
fun
updateRestOpenStatus
(
@Body
requestBody
:
RequestBody
):
Call
<
MessageBean
>
@POST
(
"wechat/findOrderDetails"
)
fun
getOrderDesc
(
@Body
requestBody
:
RequestBody
):
Call
<
OrderDetails
>
}
}
\ No newline at end of file
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/adapter/OtherOrdersAdapter.kt
View file @
da93bfc3
...
@@ -20,6 +20,12 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View
...
@@ -20,6 +20,12 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View
private
var
databeans
:
List
<
OrderList
.
DataBeanX
.
DataBean
>?
=
null
private
var
databeans
:
List
<
OrderList
.
DataBeanX
.
DataBean
>?
=
null
private
var
listenter
:
((
item
:
OrderList
.
DataBeanX
.
DataBean
)
->
Unit
)?
=
null
fun
setOnItemClickListenter
(
listenter
:
(
item
:
OrderList
.
DataBeanX
.
DataBean
)
->
Unit
)
{
this
.
listenter
=
listenter
}
fun
setData
(
databeans
:
List
<
OrderList
.
DataBeanX
.
DataBean
>)
{
fun
setData
(
databeans
:
List
<
OrderList
.
DataBeanX
.
DataBean
>)
{
this
.
databeans
=
databeans
this
.
databeans
=
databeans
notifyDataSetChanged
()
notifyDataSetChanged
()
...
@@ -100,6 +106,10 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View
...
@@ -100,6 +106,10 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View
}
}
}
}
holder
.
binding
.
payMethodBg
=
payMethodBg
holder
.
binding
.
payMethodBg
=
payMethodBg
holder
.
itemView
.
setOnClickListener
{
listenter
?.
invoke
(
data
)
}
}
}
override
fun
getItemCount
():
Int
{
override
fun
getItemCount
():
Int
{
...
@@ -110,7 +120,7 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View
...
@@ -110,7 +120,7 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View
}
}
}
}
fun
getColor
(
color
:
Int
):
Int
{
private
fun
getColor
(
color
:
Int
):
Int
{
return
context
.
resources
.
getColor
(
color
)
return
context
.
resources
.
getColor
(
color
)
}
}
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/main/PageViewModel.kt
View file @
da93bfc3
...
@@ -5,6 +5,7 @@ import androidx.lifecycle.MutableLiveData
...
@@ -5,6 +5,7 @@ import androidx.lifecycle.MutableLiveData
import
androidx.lifecycle.ViewModel
import
androidx.lifecycle.ViewModel
import
androidx.lifecycle.viewModelScope
import
androidx.lifecycle.viewModelScope
import
com.gingersoft.gsa.other_order_mode.data.WeatherRepository
import
com.gingersoft.gsa.other_order_mode.data.WeatherRepository
import
com.gingersoft.gsa.other_order_mode.data.model.bean.OrderDetails
import
com.gingersoft.gsa.other_order_mode.data.model.bean.OrderList
import
com.gingersoft.gsa.other_order_mode.data.model.bean.OrderList
import
kotlinx.coroutines.launch
import
kotlinx.coroutines.launch
...
@@ -90,6 +91,19 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -90,6 +91,19 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
})
})
}
}
/**
* 根據訂單id獲取訂單詳細信息
*/
fun
getOrderInfo
(
orderId
:
String
,
listener
:
(
OrderDetails
)
->
Unit
)
{
launch
({
repository
.
getOrderInfo
(
orderId
).
apply
{
listener
.
invoke
(
this
)
}
},
{
//出錯
})
}
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
{
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/main/PlaceholderFragment.kt
View file @
da93bfc3
package
com.gingersoft.gsa.other_order_mode.ui.main
package
com.gingersoft.gsa.other_order_mode.ui.main
import
android.app.Dialog
import
android.os.Bundle
import
android.os.Bundle
import
android.view.LayoutInflater
import
android.view.LayoutInflater
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
import
androidx.databinding.DataBindingUtil
import
androidx.fragment.app.Fragment
import
androidx.fragment.app.Fragment
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.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.LinearLayoutManager
import
com.gingersoft.gsa.cloud.base.widget.DialogUtils
import
com.gingersoft.gsa.other_order_mode.R
import
com.gingersoft.gsa.other_order_mode.R
import
com.gingersoft.gsa.other_order_mode.databinding.LayoutOrderInfoDialogBinding
import
com.gingersoft.gsa.other_order_mode.ui.adapter.OtherOrdersAdapter
import
com.gingersoft.gsa.other_order_mode.ui.adapter.OtherOrdersAdapter
import
com.gingersoft.gsa.other_order_mode.util.InjectorUtil
import
com.gingersoft.gsa.other_order_mode.util.InjectorUtil
import
com.jess.arms.utils.ArmsUtils
import
kotlinx.android.synthetic.main.fragment_other_order.*
import
kotlinx.android.synthetic.main.fragment_other_order.*
/**
/**
...
@@ -39,9 +44,25 @@ class PlaceholderFragment : Fragment() {
...
@@ -39,9 +44,25 @@ class PlaceholderFragment : Fragment() {
}
}
//初始化recyclerview
//初始化recyclerview
rv_other_order
.
layoutManager
=
LinearLayoutManager
(
activity
)
rv_other_order
.
layoutManager
=
LinearLayoutManager
(
activity
)
var
adapter
=
OtherOrdersAdapter
(
activity
!!
)
val
adapter
=
OtherOrdersAdapter
(
activity
!!
)
rv_other_order
.
adapter
=
adapter
adapter
.
setOnItemClickListenter
{
//點擊查詢食品詳情
pageViewModel
.
getOrderInfo
(
it
.
Id
.
toString
())
{
it1
->
//顯示彈窗
object
:
DialogUtils
(
activity
,
R
.
layout
.
layout_order_info_dialog
)
{
override
fun
initLayout
(
hepler
:
ViewHepler
,
dialog
:
Dialog
)
{
if
(
it1
.
getData
()
!=
null
&&
it1
.
getData
()
!!
.
isNotEmpty
())
{
val
layoutOrderInfoDialogBinding
:
LayoutOrderInfoDialogBinding
=
DataBindingUtil
.
bind
(
hepler
.
contentView
)
!!
layoutOrderInfoDialogBinding
.
data
=
it1
.
getData
()
!!
[
0
]
}
}
}.
setHeight
((
ArmsUtils
.
getScreenHeidth
(
activity
)
*
0.6
).
toInt
())
.
createDialogView
()
.
show
()
}
}
rv_other_order
.
adapter
=
adapter
while
(
pageViewModel
.
mOrderList
.
size
<=
arguments
?.
getInt
(
INDEX
)
!!
)
{
while
(
pageViewModel
.
mOrderList
.
size
<=
arguments
?.
getInt
(
INDEX
)
!!
)
{
pageViewModel
.
mOrderList
.
add
(
MutableLiveData
())
pageViewModel
.
mOrderList
.
add
(
MutableLiveData
())
...
@@ -63,6 +84,9 @@ class PlaceholderFragment : Fragment() {
...
@@ -63,6 +84,9 @@ class PlaceholderFragment : Fragment() {
page
++
page
++
getOrderList
(
pageViewModel
,
true
)
getOrderList
(
pageViewModel
,
true
)
}
}
// rv_other_order
}
}
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?):
View
?
{
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?):
View
?
{
...
...
other_order_mode/src/main/res/drawable/shape_dialog_bg.xml
0 → 100644
View file @
da93bfc3
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"@color/white"
/>
<corners
android:radius=
"@dimen/dp_8"
/>
</shape>
\ No newline at end of file
other_order_mode/src/main/res/layout/layout_order_info_dialog.xml
0 → 100644
View file @
da93bfc3
<?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"
>
<data>
<import
type=
"com.gingersoft.gsa.cloud.base.utils.time.TimeUtils"
/>
<import
type=
"com.gingersoft.gsa.cloud.base.utils.MoneyUtil"
/>
<import
type=
"android.view.View"
/>
<variable
name=
"data"
type=
"com.gingersoft.gsa.other_order_mode.data.model.bean.OrderDetails.DataBean"
/>
</data>
<!-- OrderList.DataBeanX.DataBean-->
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@drawable/shape_dialog_bg"
android:orientation=
"vertical"
android:padding=
"@dimen/dp_10"
>
<TextView
android:id=
"@+id/tv_order_name"
style=
"@style/otherOrderInfoDialogBoldTextStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"H5訂單"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
style=
"@style/otherOrderInfoDialogBoldTextStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/dp_10"
android:text=
"訂單號:"
app:layout_constraintHorizontal_bias=
"1"
app:layout_constraintLeft_toRightOf=
"@id/tv_order_name"
app:layout_constraintRight_toLeftOf=
"@id/tv_order_num"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:id=
"@+id/tv_order_num"
style=
"@style/otherOrderInfoDialogTextStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@{data.oRDER_NO}"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<View
android:id=
"@+id/line_info_top"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/dp_1"
android:layout_marginTop=
"@dimen/dp_5"
android:background=
"@color/color_ccc"
app:layout_constraintTop_toBottomOf=
"@id/tv_order_num"
/>
<androidx.core.widget.NestedScrollView
android:id=
"@+id/scroll_order_info"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:fillViewport=
"true"
app:layout_constraintBottom_toTopOf=
"@id/btn_assign_shipping"
app:layout_constraintTop_toBottomOf=
"@id/line_info_top"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/cl_order_info"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_10"
android:orientation=
"vertical"
android:paddingBottom=
"@dimen/dp_10"
>
<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_create_time_text,tv_receiver_text,tv_receive_phone_text,tv_receive_time_text,tv_receive_address_text,tv_receive_address_text"
/>
<TextView
android:id=
"@+id/tv_create_time_text"
style=
"@style/otherOrderInfoDialogBoldTextStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_10"
android:text=
"下單時間:"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:id=
"@+id/tv_create_time"
style=
"@style/otherOrderInfoDialogTextStyle"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:text=
"@{TimeUtils.parseTimeRepeat(data.cREATE_TIME,TimeUtils.DEFAULT_DATE_FORMAT)}"
app:layout_constraintLeft_toRightOf=
"@id/tv_create_time_text"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"@id/tv_create_time_text"
/>
<TextView
android:id=
"@+id/tv_receiver_text"
style=
"@style/otherOrderInfoDialogBoldTextStyle"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_5"
android:gravity=
"right"
android:text=
"收貨人:"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toLeftOf=
"@id/barrier_order_info"
app:layout_constraintTop_toBottomOf=
"@id/tv_create_time"
/>
<TextView
android:id=
"@+id/tv_receiver"
style=
"@style/otherOrderInfoDialogTextStyle"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:text=
"@{data.rECEIVER}"
app:layout_constraintLeft_toRightOf=
"@id/barrier_order_info"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"@id/tv_receiver_text"
/>
<TextView
android:id=
"@+id/tv_receive_phone_text"
style=
"@style/otherOrderInfoDialogBoldTextStyle"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_10"
android:text=
"收貨電話:"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toLeftOf=
"@id/barrier_order_info"
app:layout_constraintTop_toBottomOf=
"@id/tv_receiver"
/>
<TextView
android:id=
"@+id/tv_receive_phone"
style=
"@style/otherOrderInfoDialogTextStyle"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:text=
"@{data.pHONE}"
app:layout_constraintLeft_toRightOf=
"@id/barrier_order_info"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"@id/tv_receive_phone_text"
/>
<TextView
android:id=
"@+id/tv_receive_time_text"
style=
"@style/otherOrderInfoDialogBoldTextStyle"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_10"
android:gravity=
"right"
android:text=
"收貨時間:"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toLeftOf=
"@id/barrier_order_info"
app:layout_constraintTop_toBottomOf=
"@id/tv_receive_phone"
/>
<TextView
android:id=
"@+id/tv_receive_time"
style=
"@style/otherOrderInfoDialogTextStyle"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:text=
"@{data.sEND_TIME}"
app:layout_constraintLeft_toRightOf=
"@id/barrier_order_info"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"@id/tv_receive_time_text"
/>
<TextView
android:id=
"@+id/tv_receive_address_text"
style=
"@style/otherOrderInfoDialogBoldTextStyle"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_10"
android:gravity=
"right"
android:text=
"收貨地址:"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toLeftOf=
"@id/barrier_order_info"
app:layout_constraintTop_toBottomOf=
"@id/tv_receive_time"
/>
<TextView
android:id=
"@+id/tv_receive_address"
style=
"@style/otherOrderInfoDialogTextStyle"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:text=
"@{data.addressDetail}"
app:layout_constraintLeft_toRightOf=
"@id/barrier_order_info"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"@id/tv_receive_address_text"
/>
<View
android:id=
"@+id/line_info_bottom"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/dp_1"
android:layout_marginTop=
"@dimen/dp_5"
android:background=
"@color/color_ccc"
app:layout_constraintTop_toBottomOf=
"@id/tv_receive_address"
/>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_food"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:layout_constraintTop_toBottomOf=
"@id/line_info_bottom"
/>
<View
android:id=
"@+id/line_food_bottom"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/dp_1"
android:layout_marginTop=
"@dimen/dp_5"
android:background=
"@color/color_ccc"
app:layout_constraintTop_toBottomOf=
"@id/rv_food"
/>
<TextView
android:id=
"@+id/tv_total_text"
style=
"@style/otherOrderInfoDialogBoldTextStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_10"
android:text=
"合計"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/line_food_bottom"
/>
<TextView
android:id=
"@+id/tv_total"
style=
"@style/otherOrderInfoDialogBoldTextStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@{@string/amount_unit + MoneyUtil.sub(MoneyUtil.sub(Double.parseDouble(data.tOTAL_AMOUNT), data.lunchbox),data.dELIVERY_CHARGE)}"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"@id/tv_total_text"
/>
<TextView
android:id=
"@+id/tv_lunchbox_cost_text"
style=
"@style/otherOrderInfoDialogBoldTextStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_10"
android:text=
"餐盒費"
android:visibility=
"@{data.lunchbox==0?View.GONE:View.VISIBLE}"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/tv_total"
/>
<TextView
android:id=
"@+id/tv_lunchbox_cost"
style=
"@style/otherOrderInfoDialogBoldTextStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@{@string/amount_unit + data.lunchbox}"
android:visibility=
"@{data.lunchbox==0?View.GONE:View.VISIBLE}"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"@id/tv_lunchbox_cost_text"
/>
<TextView
android:id=
"@+id/tv_delivery_fee_text"
style=
"@style/otherOrderInfoDialogBoldTextStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_10"
android:text=
"配送費"
android:visibility=
"@{data.dELIVERY_CHARGE==0?View.GONE:View.VISIBLE}"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/tv_lunchbox_cost"
/>
<TextView
android:id=
"@+id/tv_delivery_fee"
style=
"@style/otherOrderInfoDialogBoldTextStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@{@string/amount_unit + data.dELIVERY_CHARGE}"
android:visibility=
"@{data.dELIVERY_CHARGE==0?View.GONE:View.VISIBLE}"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"@id/tv_delivery_fee_text"
/>
<TextView
android:id=
"@+id/tv_discount_text"
style=
"@style/otherOrderInfoDialogBoldTextStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_10"
android:text=
"折扣"
android:visibility=
"@{data.discount_amount==0?View.GONE:View.VISIBLE}"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/tv_delivery_fee"
/>
<TextView
android:id=
"@+id/tv_discount"
style=
"@style/otherOrderInfoDialogBoldTextStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@{@string/amount_unit + data.discount_amount}"
android:visibility=
"@{data.discount_amount==0?View.GONE:View.VISIBLE}"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"@id/tv_discount_text"
/>
<TextView
android:id=
"@+id/tv_total_amount_text"
style=
"@style/otherOrderInfoDialogBoldTextStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_10"
android:text=
"總金額"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/tv_discount"
/>
<TextView
android:id=
"@+id/tv_total_amount"
style=
"@style/otherOrderInfoDialogBoldTextStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@{@string/amount_unit + data.tOTAL_AMOUNT}"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"@id/tv_total_amount_text"
/>
<TextView
android:id=
"@+id/tv_pay_amount_text"
style=
"@style/otherOrderInfoDialogBoldTextStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_10"
android:text=
"支付金額"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/tv_total_amount_text"
/>
<TextView
android:id=
"@+id/tv_pay_amount"
style=
"@style/otherOrderInfoDialogBoldTextStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@{@string/amount_unit + MoneyUtil.sub(data.pAY_AMOUNT, data.discount_amount)}"
android:textColor=
"#FF0000"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"@id/tv_pay_amount_text"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
<Button
android:id=
"@+id/btn_assign_shipping"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/dp_40"
android:background=
"@color/theme_color"
android:text=
"指派送貨"
android:textColor=
"@color/white"
android:textSize=
"@dimen/dp_14"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/scroll_order_info"
app:layout_constraintVertical_bias=
"1"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
other_order_mode/src/main/res/layout/layout_other_order_item.xml
View file @
da93bfc3
...
@@ -186,12 +186,14 @@
...
@@ -186,12 +186,14 @@
<TextView
<TextView
android:id=
"@+id/tv_address"
android:id=
"@+id/tv_address"
android:layout_width=
"
wrap_content
"
android:layout_width=
"
0dp
"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginRight=
"@dimen/dp_5"
android:text=
"@{data.aDDRESS_DETAIL}"
android:text=
"@{data.aDDRESS_DETAIL}"
android:textColor=
"@color/color_ccc"
android:textColor=
"@color/color_ccc"
android:textSize=
"@dimen/sp_12"
android:textSize=
"@dimen/sp_12"
app:layout_constraintLeft_toLeftOf=
"@id/tv_cellphone_num"
app:layout_constraintLeft_toLeftOf=
"@id/tv_cellphone_num"
app:layout_constraintRight_toLeftOf=
"@id/tv_order_amount"
app:layout_constraintTop_toTopOf=
"@id/tv_address_text"
/>
app:layout_constraintTop_toTopOf=
"@id/tv_address_text"
/>
<TextView
<TextView
...
...
other_order_mode/src/main/res/values/styles.xml
View file @
da93bfc3
<resources>
<resources>
<!-- Base application theme. -->
<!-- Base application theme. -->
<!-- <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">-->
<!-- <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">-->
<!-- <!– Customize your theme here. –>-->
<!-- <!– Customize your theme here. –>-->
<!-- <item name="colorPrimary">@color/colorPrimary</item>-->
<!-- <item name="colorPrimary">@color/colorPrimary</item>-->
<!-- <item name="colorPrimaryDark">@color/colorPrimaryDark</item>-->
<!-- <item name="colorPrimaryDark">@color/colorPrimaryDark</item>-->
<!-- <item name="colorAccent">@color/colorAccent</item>-->
<!-- <item name="colorAccent">@color/colorAccent</item>-->
<!-- </style>-->
<!-- </style>-->
<style
name=
"AppTheme.NoActionBar"
>
<style
name=
"AppTheme.NoActionBar"
>
<item
name=
"windowActionBar"
>
false
</item>
<item
name=
"windowActionBar"
>
false
</item>
...
@@ -17,4 +17,18 @@
...
@@ -17,4 +17,18 @@
<style
name=
"AppTheme.PopupOverlay"
parent=
"ThemeOverlay.AppCompat.Light"
/>
<style
name=
"AppTheme.PopupOverlay"
parent=
"ThemeOverlay.AppCompat.Light"
/>
<style
name=
"otherOrderInfoDialogBoldTextStyle"
>
<item
name=
"android:textSize"
>
@dimen/dp_14
</item>
<item
name=
"android:textColor"
>
@color/theme_333_color
</item>
<item
name=
"android:textStyle"
>
bold
</item>
</style>
<style
name=
"otherOrderInfoDialogTextStyle"
>
<item
name=
"android:textSize"
>
@dimen/dp_14
</item>
<item
name=
"android:textColor"
>
@color/theme_333_color
</item>
<item
name=
"android:textStyle"
>
normal
</item>
</style>
</resources>
</resources>
print-module/src/main/java/com/joe/print/mvp/print/PrintUtils.java
View file @
da93bfc3
...
@@ -23,6 +23,7 @@ import com.gingersoft.gsa.cloud.base.common.bean.mealManage.MyOrderManage;
...
@@ -23,6 +23,7 @@ import com.gingersoft.gsa.cloud.base.common.bean.mealManage.MyOrderManage;
import
com.gingersoft.gsa.cloud.base.common.bean.mealManage.OpenTableManage
;
import
com.gingersoft.gsa.cloud.base.common.bean.mealManage.OpenTableManage
;
import
com.gingersoft.gsa.cloud.base.utils.MoneyUtil
;
import
com.gingersoft.gsa.cloud.base.utils.MoneyUtil
;
import
com.gingersoft.gsa.cloud.base.utils.PrintTransitUtils
;
import
com.gingersoft.gsa.cloud.base.utils.PrintTransitUtils
;
import
com.gingersoft.gsa.cloud.base.utils.other.TextUtil
;
import
com.gingersoft.gsa.cloud.base.utils.time.TimeUtils
;
import
com.gingersoft.gsa.cloud.base.utils.time.TimeUtils
;
import
com.gingersoft.gsa.cloud.base.utils.view.ImageUtils
;
import
com.gingersoft.gsa.cloud.base.utils.view.ImageUtils
;
import
com.gingersoft.gsa.cloud.base.utils.view.LayoutToBitmapUtils
;
import
com.gingersoft.gsa.cloud.base.utils.view.LayoutToBitmapUtils
;
...
@@ -33,7 +34,7 @@ import java.util.ArrayList;
...
@@ -33,7 +34,7 @@ import java.util.ArrayList;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.
stream.Collector
s
;
import
java.util.
Object
s
;
/**
/**
* Created by Wyh on 2020/2/10.
* Created by Wyh on 2020/2/10.
...
@@ -78,71 +79,105 @@ public class PrintUtils {
...
@@ -78,71 +79,105 @@ public class PrintUtils {
return
bitmaps
;
return
bitmaps
;
}
}
private
static
List
<
Bitmap
>
getKitchenBitmap
(
Context
mContext
)
{
private
static
List
<
Bitmap
>
getKitchenBitmap
(
Context
mContext
)
{
List
<
Bitmap
>
bitmaps
=
new
ArrayList
<>();
List
<
Bitmap
>
bitmaps
=
new
ArrayList
<>();
List
<
OrderDetail
>
orderDetails
=
MyOrderManage
.
getInstance
().
getNewFoodList
();
List
<
OrderDetail
>
orderDetails
=
MyOrderManage
.
getInstance
().
getNewFoodList
();
if
(
orderDetails
!=
null
)
{
if
(
orderDetails
!=
null
)
{
// 將沒有打印位置的歸類到一起
//廚房單,可能會有多個IP打印
// 如果沒有打印位置,向上尋找,如果都沒有,就不打印
//獲得ip打印列表,
//再將食品數據根據打印位置分組。
//打印一組之後,關閉連接,切換第二台打印機ip,如此循環
//打印完成之後,返回所有打印結果。
Map
<
String
,
List
<
OrderDetail
>>
foodMaps
=
new
HashMap
<>();
String
emptyPrintLocation
=
"null"
;
//部分食品沒有打印位置時設置為此key,比如這是第一個食品,沒有打印位置時
int
lastEmptyPrintLocationIndex
=
0
;
//上一次遍歷到第一個食品時都沒有打印位置時,開始的食品位置
//將所有食品進行遍歷,分組
for
(
int
i
=
0
;
i
<
orderDetails
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
orderDetails
.
size
();
i
++)
{
//需要判斷大於0的原因是,如果為0,是第一個食品,則不需要向上尋找,直接不打印
OrderDetail
food
=
orderDetails
.
get
(
i
);
if
(
orderDetails
.
get
(
i
).
getPrintseting
().
equals
(
""
)
&&
i
>
0
)
{
if
(
TextUtil
.
isEmptyOrNullOrUndefined
(
food
.
getPrintseting
()))
{
//沒有打印位置的食品,向上尋找
//如果沒有打印位置,向上尋找
for
(
int
j
=
i
-
1
;
j
>=
0
;
j
--)
{
if
(
i
==
0
)
{
if
(!
orderDetails
.
get
(
j
).
getPrintseting
().
equals
(
""
))
{
food
.
setPrintseting
(
emptyPrintLocation
);
//找到打印位置不為空的食品
addToMap
(
foodMaps
,
food
);
}
else
{
for
(
int
j
=
i
-
1
;
j
>=
lastEmptyPrintLocationIndex
;
j
--)
{
//一直遍歷,直到找到有打印位置的食品
// 如果所有食品都沒有打印位置的情況,為了避免多次遍歷
// 如果本次遍歷到第一個食品,都沒有打印位置,記錄下這一次開始遍歷的下標,下一次遍歷到這個位置就停止
if
(!
TextUtil
.
isEmptyOrNullOrUndefined
(
orderDetails
.
get
(
j
).
getPrintseting
()))
{
//一直遍歷,直到找到有打印位置的食品
//判斷是否帶*號
if
(
orderDetails
.
get
(
j
).
getPrintseting
().
contains
(
"*"
))
{
if
(
orderDetails
.
get
(
j
).
getPrintseting
().
contains
(
"*"
))
{
//如果找到的打印位置包含*號,則將這些食品單獨分為一組
//帶*號,則需要取得通過下標加去掉*號的標識來取得map中的集合,將i食品裝進去,這樣就能打印在一張紙上
//因為帶*號的食品會單獨打印一張紙,需求是將這些沒有打印位置的打印到向上能找到的食品的打印位置上,不管有沒有*號,都打印到一張紙上
//如果沒取得集合,則通過打印位置去map取得集合,將j食品從map中移除,將這個j食品的和i食品裝一起
//所以如果帶*號,就要特殊處理
// 生成新的key。為當前下標+去掉*的打印位置,不帶*的key取得的食品集合才能打印在一張紙上。
String
newPrintSetting
=
orderDetails
.
get
(
j
).
getPrintseting
();
String
newKey
=
j
+
orderDetails
.
get
(
j
).
getPrintseting
().
replaceAll
(
"\\*"
,
""
);
orderDetails
.
get
(
i
).
setPrintseting
(
newPrintSetting
);
//通過newKey取得map中的集合
List
<
OrderDetail
>
newKeyfoods
=
foodMaps
.
get
(
newKey
);
if
(
newKeyfoods
!=
null
)
{
newKeyfoods
.
add
(
food
);
}
else
{
}
else
{
orderDetails
.
get
(
i
).
setPrintseting
(
orderDetails
.
get
(
j
).
getPrintseting
());
List
<
OrderDetail
>
printsetingFoods
=
foodMaps
.
get
(
orderDetails
.
get
(
j
).
getPrintseting
());
if
(
printsetingFoods
!=
null
)
{
//理論上不會為空
printsetingFoods
.
remove
(
printsetingFoods
.
lastIndexOf
(
orderDetails
.
get
(
j
)));
//移除掉之後,put到newkey中
List
<
OrderDetail
>
newFoods
=
new
ArrayList
<>();
newFoods
.
add
(
orderDetails
.
get
(
j
));
newFoods
.
add
(
food
);
foodMaps
.
put
(
newKey
,
newFoods
);
}
}
}
}
break
;
}
else
{
//沒有*號,不需要做多餘的操作
food
.
setPrintseting
(
orderDetails
.
get
(
j
).
getPrintseting
());
addToMap
(
foodMaps
,
food
);
}
}
}
else
if
(
j
==
lastEmptyPrintLocationIndex
)
{
//從i到0的打印位置都沒有,記錄下i,下次只遍歷到i就停下來
lastEmptyPrintLocationIndex
=
i
;
//如果找到最初的那個食品,也沒有打印位置,設置打印位置為"null"
food
.
setPrintseting
(
emptyPrintLocation
);
addToMap
(
foodMaps
,
food
);
}
}
}
}
//將所有送單的食品通過打印位置分組,不同的打印位置在不同的打印紙上。
Map
<
String
,
List
<
OrderDetail
>>
map
=
new
HashMap
<>();
if
(
android
.
os
.
Build
.
VERSION
.
SDK_INT
>=
android
.
os
.
Build
.
VERSION_CODES
.
N
)
{
map
=
orderDetails
.
stream
().
collect
(
Collectors
.
groupingBy
(
OrderDetail:
:
getPrintseting
));
}
else
{
for
(
OrderDetail
orderDetail
:
orderDetails
)
{
if
(
map
.
containsKey
(
orderDetail
.
getPrintseting
()))
{
map
.
get
(
orderDetail
.
getPrintseting
()).
add
(
orderDetail
);
}
else
{
List
<
OrderDetail
>
orderDetailList
=
new
ArrayList
<>();
orderDetailList
.
add
(
orderDetail
);
map
.
put
(
orderDetail
.
getPrintseting
(),
orderDetailList
);
}
}
}
else
{
//有打印位置,
//已經保存過這個位置的,
addToMap
(
foodMaps
,
food
);
}
}
}
}
//通過打印位置生成多張用於打印的bitmap
//通過打印位置生成多張用於打印的bitmap
for
(
Map
.
Entry
<
String
,
List
<
OrderDetail
>>
entry
:
map
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
List
<
OrderDetail
>>
entry
:
foodMaps
.
entrySet
())
{
String
key
=
entry
.
getKey
();
String
key
=
entry
.
getKey
();
if
(
key
.
contains
(
"*"
))
{
if
(
key
.
contains
(
"*"
))
{
//如果帶*號,這個集合就需要切紙,每個食品都需要單獨在一張廚房單上
//如果帶*號,這個集合就需要切紙,每個食品都需要單獨在一張廚房單上
for
(
OrderDetail
orderDetail
:
entry
.
getValue
())
{
for
(
OrderDetail
orderDetail
:
entry
.
getValue
())
{
List
<
OrderDetail
>
orders
=
new
ArrayList
<>();
//這裡new集合是
應
為下面的方法需要的參數是list集合
List
<
OrderDetail
>
orders
=
new
ArrayList
<>();
//這裡new集合是
因
為下面的方法需要的參數是list集合
orders
.
add
(
orderDetail
);
orders
.
add
(
orderDetail
);
bitmaps
.
add
(
PrintUtils
.
getKitChenPrintBitmap
(
mContext
,
orders
));
bitmaps
.
add
(
PrintUtils
.
getKitChenPrintBitmap
(
mContext
,
orders
));
}
}
}
}
else
{
// else if (key.equals("")) {
// //如果沒有打印位置,向上尋找,如果都沒有,就不打印
//
// }
else
{
//不帶*號,所有同樣廚房位置的食品都在一張紙上
//不帶*號,所有同樣廚房位置的食品都在一張紙上
bitmaps
.
add
(
PrintUtils
.
getKitChenPrintBitmap
(
mContext
,
entry
.
getValue
()));
bitmaps
.
add
(
PrintUtils
.
getKitChenPrintBitmap
(
mContext
,
entry
.
getValue
()));
}
}
}
}
}
}
//通過遍歷map進行打印
return
bitmaps
;
return
bitmaps
;
}
}
private
static
void
addToMap
(
Map
<
String
,
List
<
OrderDetail
>>
foodMaps
,
OrderDetail
food
)
{
if
(
foodMaps
.
get
(
food
.
getPrintseting
())
!=
null
)
{
Objects
.
requireNonNull
(
foodMaps
.
get
(
food
.
getPrintseting
())).
add
(
food
);
}
else
{
List
<
OrderDetail
>
newFoods
=
new
ArrayList
<>();
newFoods
.
add
(
food
);
foodMaps
.
put
(
food
.
getPrintseting
(),
newFoods
);
}
}
private
static
Bitmap
getPrintBitmap
(
Context
context
)
{
private
static
Bitmap
getPrintBitmap
(
Context
context
)
{
return
getPrintBitmap
(
context
,
MyOrderManage
.
getInstance
().
getOrderFoodList
());
return
getPrintBitmap
(
context
,
MyOrderManage
.
getInstance
().
getOrderFoodList
());
...
@@ -317,7 +352,12 @@ public class PrintUtils {
...
@@ -317,7 +352,12 @@ public class PrintUtils {
rvFood
.
setLayoutManager
(
new
LinearLayoutManager
(
context
));
rvFood
.
setLayoutManager
(
new
LinearLayoutManager
(
context
));
rvFood
.
setAdapter
(
foodAdapter
);
rvFood
.
setAdapter
(
foodAdapter
);
//廚房位置
//廚房位置
tvKitChenLocation
.
setText
(
foodList
.
get
(
0
).
getPrintseting
().
replace
(
"*"
,
""
));
if
(!
TextUtil
.
isEmptyOrNullOrUndefined
(
foodList
.
get
(
0
).
getPrintseting
()))
{
tvKitChenLocation
.
setText
(
foodList
.
get
(
0
).
getPrintseting
());
//.replace("*", "")
tvKitChenLocation
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
tvKitChenLocation
.
setVisibility
(
View
.
GONE
);
}
}
}
if
(
OpenTableManage
.
getDefault
().
getTableBean
()
!=
null
)
{
if
(
OpenTableManage
.
getDefault
().
getTableBean
()
!=
null
)
{
// 台號
// 台號
...
...
print-module/src/main/java/com/joe/print/mvp/ui/activity/IpPrintActivity.java
View file @
da93bfc3
...
@@ -76,20 +76,9 @@ public class IpPrintActivity extends Activity implements PrintSocketHolder.OnSta
...
@@ -76,20 +76,9 @@ public class IpPrintActivity extends Activity implements PrintSocketHolder.OnSta
initDialog
();
initDialog
();
initIntent
();
initIntent
();
callId
=
getIntent
().
getStringExtra
(
EXTRA_KEY_CALL_ID
);
callId
=
getIntent
().
getStringExtra
(
EXTRA_KEY_CALL_ID
);
// if (type == 3) {
//廚房單,可能會有多個IP打印
//獲得ip打印列表,
//再將食品數據根據打印位置分組。
//打印一組之後,關閉連接,切換第二台打印機ip,如此循環
//打印完成之後,返回所有打印結果。
// } else {
printOrder
(
this
);
printOrder
(
this
);
// }
}
}
private
void
initDialog
()
{
private
void
initDialog
()
{
try
{
try
{
View
view
=
LayoutInflater
.
from
(
mContext
).
inflate
(
R
.
layout
.
ui_dialog_loading
,
null
);
View
view
=
LayoutInflater
.
from
(
mContext
).
inflate
(
R
.
layout
.
ui_dialog_loading
,
null
);
...
...
public-base/src/main/java/com/gingersoft/gsa/cloud/base/utils/MoneyUtil.java
View file @
da93bfc3
...
@@ -305,6 +305,19 @@ public class MoneyUtil {
...
@@ -305,6 +305,19 @@ public class MoneyUtil {
}
}
/**
/**
* 計算差
*
* @param v1
* @param v2
* @return
*/
// public static double sub(String v1, double v2) {
// BigDecimal b1 = new BigDecimal(Double.toString(v1));
// BigDecimal b2 = new BigDecimal(Double.toString(v2));
// return b1.subtract(b2).doubleValue();
// }
/**
* 計算除 保留兩位小數,四捨五入
* 計算除 保留兩位小數,四捨五入
*
*
* @param v1
* @param v1
...
...
public-base/src/main/res/layout/print_kitchen.xml
View file @
da93bfc3
...
@@ -79,8 +79,8 @@
...
@@ -79,8 +79,8 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/dp_10"
android:layout_marginLeft=
"@dimen/dp_10"
android:text=
"K1 廚房"
android:text=
"K1 廚房"
app:layout_constraintLeft_to
RightOf=
"@id/tv_order_time
"
app:layout_constraintLeft_to
LeftOf=
"parent
"
app:layout_constraintTop_to
Top
Of=
"@id/tv_order_time"
/>
app:layout_constraintTop_to
Bottom
Of=
"@id/tv_order_time"
/>
<TextView
<TextView
android:id=
"@+id/tv_people_text"
android:id=
"@+id/tv_people_text"
...
@@ -89,7 +89,7 @@
...
@@ -89,7 +89,7 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"人數:"
android:text=
"人數:"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/tv_
order_time_text
"
/>
app:layout_constraintTop_toBottomOf=
"@id/tv_
kitchen_location
"
/>
<TextView
<TextView
android:id=
"@+id/tv_people"
android:id=
"@+id/tv_people"
...
...
user-login/build.gradle
View file @
da93bfc3
...
@@ -52,6 +52,9 @@ android {
...
@@ -52,6 +52,9 @@ android {
lintOptions
{
lintOptions
{
abortOnError
false
abortOnError
false
}
}
dataBinding
{
enabled
=
true
}
//修改生成的apk名字
//修改生成的apk名字
applicationVariants
.
all
{
variant
->
applicationVariants
.
all
{
variant
->
variant
.
outputs
.
all
{
variant
.
outputs
.
all
{
...
@@ -78,6 +81,7 @@ dependencies {
...
@@ -78,6 +81,7 @@ dependencies {
addComponent
'download-data'
addComponent
'download-data'
addComponent
'table-mode'
addComponent
'table-mode'
addComponent
'print-module'
addComponent
'print-module'
addComponent
'other_order_mode'
annotationProcessor
rootProject
.
ext
.
dependencies
[
"dagger2-compiler"
]
annotationProcessor
rootProject
.
ext
.
dependencies
[
"dagger2-compiler"
]
...
...
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