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
da8dbb14
Commit
da8dbb14
authored
Mar 02, 2021
by
Wyh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
80964ac0
Hide whitespace changes
Inline
Side-by-side
Showing
48 changed files
with
665 additions
and
528 deletions
+665
-528
component-coldchain/src/main/java/com/gingersoft/coldchain_module/mvp/presenter/ColdChainMainPresenter.java
+36
-6
component-coldchain/src/main/java/com/gingersoft/coldchain_module/mvp/presenter/OrderDetailsPresenter.java
+41
-4
component-coldchain/src/main/java/com/gingersoft/coldchain_module/mvp/ui/activity/ColdChainMainActivity.java
+5
-17
component-coldchain/src/main/java/com/gingersoft/coldchain_module/mvp/ui/activity/OrderDetailsActivity.java
+13
-1
component-coldchain/src/main/java/com/gingersoft/coldchain_module/mvp/ui/adapter/OrderListAdapter.java
+3
-0
component-coldchain/src/main/res/layout/cold_chain_order_details.xml
+13
-3
component-coldchain/src/main/res/layout/cold_chain_order_item.xml
+3
-1
component-coldchain/src/main/res/layout/fragment_main.xml
+2
-1
component-coldchain/src/main/res/layout/frozen_chain_main.xml
+2
-1
component-delivery-pick/src/main/java/com/gingersoft/gsa/delivery_pick_mode/model/viewModel/PageViewModel.kt
+57
-68
component-delivery-pick/src/main/java/com/gingersoft/gsa/delivery_pick_mode/ui/activity/DeliveryOrderMainActivity.kt
+4
-9
component-main/src/main/java/com/gingersoft/gsa/cloud/main/mvp/presenter/BusinessReportPresenter.java
+1
-1
component-print/src/main/java/com/joe/print/PrintComponent.java
+1
-3
component-print/src/main/java/com/joe/print/mvp/presenter/IpPrintListActivityPresenter.java
+1
-1
component-print/src/main/java/com/joe/print/mvp/presenter/PrintPresenter.java
+1
-1
component-print/src/main/java/com/joe/print/mvp/print/EpsonPrint.java
+20
-12
component-print/src/main/java/com/joe/print/mvp/print/PrintOtherOrder.java
+3
-5
component-print/src/main/java/com/joe/print/mvp/print/PrinterRoot.java
+39
-25
component-print/src/main/java/com/joe/print/mvp/print/printerManger/PrinterManager.java
+1
-1
component-print/src/main/java/com/joe/print/mvp/print/printerManger/PrjPtinterManager.java
+29
-30
component-print/src/main/java/com/joe/print/mvp/print/service/PrjService.java
+8
-6
component-print/src/main/java/com/joe/print/mvp/ui/activity/PrintActivity.java
+14
-37
component-print/src/main/java/com/joe/print/mvp/ui/fragment/IpPrintListActivityFragment.java
+1
-1
component-print/src/main/java/com/joe/print/mvp/ui/view/PrinterLoadingDialog.java
+68
-104
component-print/src/main/res/layout/print_dialog_loading.xml
+4
-2
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/NewFoodIngredientsPresenter.java
+1
-1
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/NewSupplierPresenter.java
+1
-1
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/fragment/food/FoodUnitPageFragment.java
+1
-1
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/widget/CategoryPopup.java
+10
-10
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/ui/activity/OrderContentActivity.java
+12
-6
component-table/src/main/res/layout/table_activity_order_content.xml
+136
-119
component-table/src/main/res/values/strings.xml
+2
-0
config.gradle
+3
-3
gradle.properties
+8
-1
library-common/src/main/java/com/gingersoft/gsa/cloud/common/constans/HttpsConstans.java
+3
-3
library-common/src/main/java/com/gingersoft/gsa/cloud/common/core/delivery/OrderDetails.kt
+37
-1
library-common/src/main/java/com/gingersoft/gsa/cloud/common/core/restaurant/RestaurantInfoManager.java
+2
-2
library-common/src/main/java/com/gingersoft/gsa/cloud/common/utils/MoneyUtil.java
+15
-1
library-common/src/main/java/com/gingersoft/gsa/cloud/common/utils/inputFilter/InputFilterUtils.java
+17
-31
library-common/src/main/res/drawable-xhdpi/ic_black_copy.png
+0
-0
library-common/src/main/res/drawable-xhdpi/ic_white_print.png
+0
-0
library-common/src/main/res/layout/layout_order_receiving.xml
+4
-3
library-common/src/main/res/values/colors.xml
+1
-0
library-common/src/main/res/values/ids.xml
+2
-0
library-common/src/main/res/values/strings.xml
+1
-0
library-print/src/main/java/com/gingersoft/gsa/cloud/print/PrintExecutor.java
+16
-5
library-print/src/main/java/com/gingersoft/gsa/cloud/print/PrintSocketHolder.java
+22
-0
library-qm-skin-maker/src/main/res/values/theme.xml
+1
-0
No files found.
component-coldchain/src/main/java/com/gingersoft/coldchain_module/mvp/presenter/ColdChainMainPresenter.java
View file @
da8dbb14
...
@@ -3,6 +3,7 @@ package com.gingersoft.coldchain_module.mvp.presenter;
...
@@ -3,6 +3,7 @@ package com.gingersoft.coldchain_module.mvp.presenter;
import
android.app.Application
;
import
android.app.Application
;
import
android.util.Log
;
import
android.util.Log
;
import
com.billy.cc.core.component.CC
;
import
com.gingersoft.coldchain_module.mvp.constans.ColdChainConstants
;
import
com.gingersoft.coldchain_module.mvp.constans.ColdChainConstants
;
import
com.gingersoft.coldchain_module.mvp.contract.ColdChainMainContract
;
import
com.gingersoft.coldchain_module.mvp.contract.ColdChainMainContract
;
import
com.gingersoft.coldchain_module.mvp.model.bean.BalanceBean
;
import
com.gingersoft.coldchain_module.mvp.model.bean.BalanceBean
;
...
@@ -13,12 +14,18 @@ import com.gingersoft.coldchain_module.mvp.model.bean.SupplementInfoBean;
...
@@ -13,12 +14,18 @@ import com.gingersoft.coldchain_module.mvp.model.bean.SupplementInfoBean;
import
com.gingersoft.coldchain_module.mvp.model.bean.ThirdItem
;
import
com.gingersoft.coldchain_module.mvp.model.bean.ThirdItem
;
import
com.gingersoft.coldchain_module.mvp.model.bean.UpdateOrderStatusBean
;
import
com.gingersoft.coldchain_module.mvp.model.bean.UpdateOrderStatusBean
;
import
com.gingersoft.coldchain_module.mvp.model.bean.UpdateRestaurantStateBean
;
import
com.gingersoft.coldchain_module.mvp.model.bean.UpdateRestaurantStateBean
;
import
com.gingersoft.gsa.cloud.common.constans.ExpandConstant
;
import
com.gingersoft.gsa.cloud.common.constans.PrintConstans
;
import
com.gingersoft.gsa.cloud.common.core.delivery.OrderDetails
;
import
com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager
;
import
com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager
;
import
com.gingersoft.gsa.cloud.common.core.user.UserContext
;
import
com.gingersoft.gsa.cloud.common.core.restaurant.utils.RestaurantExpandInfoUtils
;
import
com.gingersoft.gsa.cloud.common.core.restaurant.utils.RestaurantExpandInfoUtils
;
import
com.gingersoft.gsa.cloud.common.core.user.UserContext
;
import
com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils
;
import
com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils
;
import
com.gingersoft.gsa.cloud.common.utils.other.TextUtil
;
import
com.gingersoft.gsa.cloud.common.utils.other.TextUtil
;
import
com.gingersoft.gsa.cloud.common.core.delivery.OrderDetails
;
import
com.gingersoft.gsa.cloud.component.ComponentName
;
import
com.gingersoft.gsa.cloud.order.order.TakeawayOrder
;
import
com.gingersoft.gsa.cloud.print.bean.PrintContent
;
import
com.gingersoft.gsa.cloud.print.bean.adapter.PrintContentAdapter
;
import
com.jess.arms.di.scope.ActivityScope
;
import
com.jess.arms.di.scope.ActivityScope
;
import
com.jess.arms.http.imageloader.ImageLoader
;
import
com.jess.arms.http.imageloader.ImageLoader
;
import
com.jess.arms.integration.AppManager
;
import
com.jess.arms.integration.AppManager
;
...
@@ -27,16 +34,13 @@ import com.jess.arms.utils.RxLifecycleUtils;
...
@@ -27,16 +34,13 @@ import com.jess.arms.utils.RxLifecycleUtils;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
javax.inject.Inject
;
import
javax.inject.Inject
;
import
io.reactivex.Observer
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.annotations.NonNull
;
import
io.reactivex.annotations.NonNull
;
import
io.reactivex.disposables.Disposable
;
import
io.reactivex.disposables.Disposable
;
import
io.reactivex.functions.Consumer
;
import
io.reactivex.schedulers.Schedulers
;
import
io.reactivex.schedulers.Schedulers
;
import
me.jessyan.rxerrorhandler.core.RxErrorHandler
;
import
me.jessyan.rxerrorhandler.core.RxErrorHandler
;
import
me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber
;
import
me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber
;
...
@@ -350,6 +354,29 @@ public class ColdChainMainPresenter extends BasePresenter<ColdChainMainContract.
...
@@ -350,6 +354,29 @@ public class ColdChainMainPresenter extends BasePresenter<ColdChainMainContract.
});
});
}
}
private
void
printColdChainOrder
(
OrderDetails
.
DataBean
dataBean
)
{
if
(
RestaurantExpandInfoUtils
.
getValue
(
ExpandConstant
.
AutoPrinterPaper
,
true
))
{
//打印凍鏈上菜紙
dataBean
.
setOrder_type
(
8
);
TakeawayOrder
.
getInstance
().
getShoppingCart
().
setDeliveryAndPickupData
(
dataBean
);
PrintContentAdapter
contentAdapter
=
new
PrintContentAdapter
();
PrintContent
printContent
=
contentAdapter
.
adaptationPrintTakeawayFormContent
(
dataBean
);
Log
.
e
(
"eee"
,
"打印凍鏈上菜紙"
);
CC
.
obtainBuilder
(
ComponentName
.
COMPONENT_PRINT
)
.
addParam
(
PrintConstans
.
PRINT_TYPE
,
PrintConstans
.
PRINT_OTHER_ORDER
)
.
addParam
(
PrintConstans
.
PRINT_CONTENT
,
printContent
)
.
addParam
(
PrintConstans
.
PRINT_ORDER_NO
,
dataBean
.
getORDER_NO
())
.
setActionName
(
"printActivity"
)
.
build
()
.
callAsyncCallbackOnMainThread
((
cc
,
result
)
->
{
// if (result.isSuccess()) {
//打印成功
// }
TakeawayOrder
.
getInstance
().
getShoppingCart
().
setDeliveryAndPickupData
(
null
);
});
}
}
/**
/**
* 修改訂單狀態
* 修改訂單狀態
*
*
...
@@ -380,6 +407,8 @@ public class ColdChainMainPresenter extends BasePresenter<ColdChainMainContract.
...
@@ -380,6 +407,8 @@ public class ColdChainMainPresenter extends BasePresenter<ColdChainMainContract.
@Override
@Override
public
void
onNext
(
@NonNull
UpdateOrderStatusBean
info
)
{
public
void
onNext
(
@NonNull
UpdateOrderStatusBean
info
)
{
mRootView
.
refreshOrderState
(
dataBean
.
getID
());
mRootView
.
refreshOrderState
(
dataBean
.
getID
());
//打印凍鏈上菜紙
printColdChainOrder
(
dataBean
);
}
}
});
});
}
}
...
@@ -411,7 +440,8 @@ public class ColdChainMainPresenter extends BasePresenter<ColdChainMainContract.
...
@@ -411,7 +440,8 @@ public class ColdChainMainPresenter extends BasePresenter<ColdChainMainContract.
.
add
(
"orderDetailsIds"
,
ids
.
toString
())
.
add
(
"orderDetailsIds"
,
ids
.
toString
())
.
build
();
.
build
();
Disposable
subscribe
=
mModel
.
addPrj
(
requestBody
)
Disposable
subscribe
=
mModel
.
addPrj
(
requestBody
)
.
subscribeOn
(
Schedulers
.
io
()).
subscribe
(
s
->
{});
.
subscribeOn
(
Schedulers
.
io
()).
subscribe
(
s
->
{
});
}
}
}
}
...
...
component-coldchain/src/main/java/com/gingersoft/coldchain_module/mvp/presenter/OrderDetailsPresenter.java
View file @
da8dbb14
package
com
.
gingersoft
.
coldchain_module
.
mvp
.
presenter
;
package
com
.
gingersoft
.
coldchain_module
.
mvp
.
presenter
;
import
android.app.Application
;
import
android.app.Application
;
import
android.util.Log
;
import
com.billy.cc.core.component.CC
;
import
com.gingersoft.coldchain_module.mvp.constans.ColdChainConstants
;
import
com.gingersoft.coldchain_module.mvp.constans.ColdChainConstants
;
import
com.gingersoft.coldchain_module.mvp.contract.OrderDetailsContract
;
import
com.gingersoft.coldchain_module.mvp.contract.OrderDetailsContract
;
import
com.gingersoft.coldchain_module.mvp.model.bean.CancelLogisticsBean
;
import
com.gingersoft.coldchain_module.mvp.model.bean.CancelLogisticsBean
;
...
@@ -10,13 +12,20 @@ import com.gingersoft.coldchain_module.mvp.model.bean.ShipAnyOrdersNewBean;
...
@@ -10,13 +12,20 @@ import com.gingersoft.coldchain_module.mvp.model.bean.ShipAnyOrdersNewBean;
import
com.gingersoft.coldchain_module.mvp.model.bean.ThirdItem
;
import
com.gingersoft.coldchain_module.mvp.model.bean.ThirdItem
;
import
com.gingersoft.coldchain_module.mvp.model.bean.UpdateOrderStatusBean
;
import
com.gingersoft.coldchain_module.mvp.model.bean.UpdateOrderStatusBean
;
import
com.gingersoft.gsa.cloud.common.bean.BaseResult
;
import
com.gingersoft.gsa.cloud.common.bean.BaseResult
;
import
com.gingersoft.gsa.cloud.common.constans.ExpandConstant
;
import
com.gingersoft.gsa.cloud.common.constans.PrintConstans
;
import
com.gingersoft.gsa.cloud.common.core.delivery.OrderDetails
;
import
com.gingersoft.gsa.cloud.common.core.delivery.OrderDetails
;
import
com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager
;
import
com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager
;
import
com.gingersoft.gsa.cloud.common.core.restaurant.utils.RestaurantExpandInfoUtils
;
import
com.gingersoft.gsa.cloud.common.core.user.UserContext
;
import
com.gingersoft.gsa.cloud.common.core.user.UserContext
;
import
com.gingersoft.gsa.cloud.common.utils.FileUtils
;
import
com.gingersoft.gsa.cloud.common.utils.FileUtils
;
import
com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils
;
import
com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils
;
import
com.gingersoft.gsa.cloud.common.utils.log.LogUtil
;
import
com.gingersoft.gsa.cloud.common.utils.log.LogUtil
;
import
com.gingersoft.gsa.cloud.common.utils.other.TextUtil
;
import
com.gingersoft.gsa.cloud.common.utils.other.TextUtil
;
import
com.gingersoft.gsa.cloud.component.ComponentName
;
import
com.gingersoft.gsa.cloud.order.order.TakeawayOrder
;
import
com.gingersoft.gsa.cloud.print.bean.PrintContent
;
import
com.gingersoft.gsa.cloud.print.bean.adapter.PrintContentAdapter
;
import
com.jess.arms.di.scope.ActivityScope
;
import
com.jess.arms.di.scope.ActivityScope
;
import
com.jess.arms.http.imageloader.ImageLoader
;
import
com.jess.arms.http.imageloader.ImageLoader
;
import
com.jess.arms.integration.AppManager
;
import
com.jess.arms.integration.AppManager
;
...
@@ -57,6 +66,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
...
@@ -57,6 +66,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
@Inject
@Inject
AppManager
mAppManager
;
AppManager
mAppManager
;
private
OrderDetails
.
DataBean
dataBean
;
@Inject
@Inject
public
OrderDetailsPresenter
(
OrderDetailsContract
.
Model
model
,
OrderDetailsContract
.
View
rootView
)
{
public
OrderDetailsPresenter
(
OrderDetailsContract
.
Model
model
,
OrderDetailsContract
.
View
rootView
)
{
super
(
model
,
rootView
);
super
(
model
,
rootView
);
...
@@ -95,7 +105,8 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
...
@@ -95,7 +105,8 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
public
void
onNext
(
@NonNull
OrderDetails
info
)
{
public
void
onNext
(
@NonNull
OrderDetails
info
)
{
if
(
info
!=
null
)
{
if
(
info
!=
null
)
{
if
(
info
.
getData
()
!=
null
&&
info
.
getData
().
size
()
>
0
)
{
if
(
info
.
getData
()
!=
null
&&
info
.
getData
().
size
()
>
0
)
{
mRootView
.
loadOrderDetails
(
info
.
getData
().
get
(
0
));
dataBean
=
info
.
getData
().
get
(
0
);
mRootView
.
loadOrderDetails
(
dataBean
);
if
(
isRead
==
0
)
{
if
(
isRead
==
0
)
{
setIsRead
(
info
.
getData
().
get
(
0
).
getID
());
setIsRead
(
info
.
getData
().
get
(
0
).
getID
());
}
}
...
@@ -182,7 +193,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
...
@@ -182,7 +193,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
if
(
info
!=
null
)
{
if
(
info
!=
null
)
{
if
(
info
.
isSuccess
())
{
if
(
info
.
isSuccess
())
{
//修改訂單狀態
//修改訂單狀態
updateOrderState
(
dataBean
,
ColdChainConstants
.
ORDER_CONFIRMED
,
info
.
getData
().
getLab_url
());
updateOrderState
(
ColdChainConstants
.
ORDER_CONFIRMED
,
info
.
getData
().
getLab_url
());
}
else
{
}
else
{
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
info
.
getErrMsg
()))
{
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
info
.
getErrMsg
()))
{
mRootView
.
showMessage
(
info
.
getErrMsg
());
mRootView
.
showMessage
(
info
.
getErrMsg
());
...
@@ -206,7 +217,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
...
@@ -206,7 +217,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
});
});
}
}
public
void
updateOrderState
(
OrderDetails
.
DataBean
dataBean
,
int
status
,
String
labUrl
)
{
public
void
updateOrderState
(
int
status
,
String
labUrl
)
{
//驗證訂單金額是否正確
//驗證訂單金額是否正確
if
(
OrderDetails
.
verificationAmount
(
dataBean
))
{
if
(
OrderDetails
.
verificationAmount
(
dataBean
))
{
mRootView
.
showMessage
(
OrderDetails
.
getVerifiAmountTip
());
mRootView
.
showMessage
(
OrderDetails
.
getVerifiAmountTip
());
...
@@ -232,6 +243,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
...
@@ -232,6 +243,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
if
(
info
!=
null
)
{
if
(
info
!=
null
)
{
//添加PRJ
//添加PRJ
addPrj
(
dataBean
);
addPrj
(
dataBean
);
printColdChainOrder
(
RestaurantExpandInfoUtils
.
getValue
(
ExpandConstant
.
AutoPrinterPaper
,
true
));
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
info
.
getErrorMsg
()))
{
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
info
.
getErrorMsg
()))
{
mRootView
.
showMessage
(
info
.
getErrorMsg
());
mRootView
.
showMessage
(
info
.
getErrorMsg
());
}
}
...
@@ -287,7 +299,8 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
...
@@ -287,7 +299,8 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
.
add
(
"orderDetailsIds"
,
ids
.
toString
())
.
add
(
"orderDetailsIds"
,
ids
.
toString
())
.
build
();
.
build
();
Disposable
subscribe
=
mModel
.
addPrj
(
requestBody
)
Disposable
subscribe
=
mModel
.
addPrj
(
requestBody
)
.
subscribeOn
(
Schedulers
.
io
()).
subscribe
(
s
->
{});
.
subscribeOn
(
Schedulers
.
io
()).
subscribe
(
s
->
{
});
}
}
}
}
...
@@ -486,4 +499,28 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
...
@@ -486,4 +499,28 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
});
});
}
}
public
void
printColdChainOrder
(
boolean
isPrint
)
{
if
(
isPrint
)
{
//打印凍鏈上菜紙
dataBean
.
setOrder_type
(
8
);
TakeawayOrder
.
getInstance
().
getShoppingCart
().
setDeliveryAndPickupData
(
dataBean
);
PrintContentAdapter
contentAdapter
=
new
PrintContentAdapter
();
PrintContent
printContent
=
contentAdapter
.
adaptationPrintTakeawayFormContent
(
dataBean
);
Log
.
e
(
"eee"
,
"打印凍鏈上菜紙"
);
CC
.
obtainBuilder
(
ComponentName
.
COMPONENT_PRINT
)
.
addParam
(
PrintConstans
.
PRINT_TYPE
,
PrintConstans
.
PRINT_OTHER_ORDER
)
.
addParam
(
PrintConstans
.
PRINT_CONTENT
,
printContent
)
.
addParam
(
PrintConstans
.
PRINT_ORDER_NO
,
dataBean
.
getORDER_NO
())
.
setActionName
(
"printActivity"
)
.
build
()
.
callAsyncCallbackOnMainThread
((
cc
,
result
)
->
{
// if (result.isSuccess()) {
//打印成功
// }
TakeawayOrder
.
getInstance
().
getShoppingCart
().
setDeliveryAndPickupData
(
null
);
});
}
}
}
}
component-coldchain/src/main/java/com/gingersoft/coldchain_module/mvp/ui/activity/ColdChainMainActivity.java
View file @
da8dbb14
...
@@ -136,8 +136,6 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre
...
@@ -136,8 +136,6 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre
return
R
.
layout
.
frozen_chain_main
;
//如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
return
R
.
layout
.
frozen_chain_main
;
//如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
}
}
private
Disposable
autoOrderDisposable
;
@Override
@Override
public
void
initData
(
@Nullable
Bundle
savedInstanceState
)
{
public
void
initData
(
@Nullable
Bundle
savedInstanceState
)
{
mPresenter
.
getBalance
();
mPresenter
.
getBalance
();
...
@@ -153,18 +151,7 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre
...
@@ -153,18 +151,7 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre
initService
();
initService
();
initHearBroadcast
();
initHearBroadcast
();
autoReceivingOrders
.
setOnCheckedChangeListener
((
buttonView
,
isChecked
)
->
{
autoReceivingOrders
.
setOnCheckedChangeListener
((
buttonView
,
isChecked
)
->
RestaurantExpandInfoUtils
.
setValue
(
ExpandConstant
.
FrozenChainAutoOrder
,
isChecked
));
RestaurantExpandInfoUtils
.
setValue
(
ExpandConstant
.
FrozenChainAutoOrder
,
isChecked
);
if
(
autoOrderDisposable
!=
null
&&
!
autoOrderDisposable
.
isDisposed
())
{
autoOrderDisposable
.
dispose
();
}
if
(
isChecked
)
{
//開始自動接單
autoOrderDisposable
=
RxJavaUtils
.
polling
(
1
,
autoReceivingOrderInterval
,
aLong
->
mPresenter
.
startToBeConfirmedOrderList
(
restaurantId
));
}
else
{
mPresenter
.
stopAutoReceivingOrders
();
}
});
autoReceivingOrders
.
setChecked
(
RestaurantExpandInfoUtils
.
getValue
(
ExpandConstant
.
FrozenChainAutoOrder
,
false
));
autoReceivingOrders
.
setChecked
(
RestaurantExpandInfoUtils
.
getValue
(
ExpandConstant
.
FrozenChainAutoOrder
,
false
));
}
}
...
@@ -249,6 +236,10 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre
...
@@ -249,6 +236,10 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre
||
type
==
6
||
type
==
7
)
{
//ColdChainConstants.orderType
||
type
==
6
||
type
==
7
)
{
//ColdChainConstants.orderType
fragments
.
get
(
viewPager
.
getCurrentItem
()).
onRefreshData
();
fragments
.
get
(
viewPager
.
getCurrentItem
()).
onRefreshData
();
mPresenter
.
getBalance
();
mPresenter
.
getBalance
();
//判斷要不要自動接單
if
(
autoReceivingOrders
.
isChecked
()){
mPresenter
.
startToBeConfirmedOrderList
(
restaurantId
);
}
}
}
if
(
type
==
3
||
type
==
6
||
type
==
7
)
{
if
(
type
==
3
||
type
==
6
||
type
==
7
)
{
getNumByOrderTypeInvoke
(
"loadNumber"
);
getNumByOrderTypeInvoke
(
"loadNumber"
);
...
@@ -432,9 +423,6 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre
...
@@ -432,9 +423,6 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre
@Override
@Override
protected
void
onDestroy
()
{
protected
void
onDestroy
()
{
super
.
onDestroy
();
super
.
onDestroy
();
if
(
autoOrderDisposable
!=
null
)
{
autoOrderDisposable
.
dispose
();
}
if
(
bind
!=
null
)
{
if
(
bind
!=
null
)
{
bind
.
setOnPostCallBack
(
null
);
bind
.
setOnPostCallBack
(
null
);
}
}
...
...
component-coldchain/src/main/java/com/gingersoft/coldchain_module/mvp/ui/activity/OrderDetailsActivity.java
View file @
da8dbb14
...
@@ -34,6 +34,7 @@ import com.gingersoft.gsa.cloud.common.constans.FunctionManagerConstants;
...
@@ -34,6 +34,7 @@ import com.gingersoft.gsa.cloud.common.constans.FunctionManagerConstants;
import
com.gingersoft.gsa.cloud.common.core.delivery.OrderDetails
;
import
com.gingersoft.gsa.cloud.common.core.delivery.OrderDetails
;
import
com.gingersoft.gsa.cloud.common.function.FunctionManager
;
import
com.gingersoft.gsa.cloud.common.function.FunctionManager
;
import
com.gingersoft.gsa.cloud.common.ui.utils.BtnBuilder
;
import
com.gingersoft.gsa.cloud.common.ui.utils.BtnBuilder
;
import
com.gingersoft.gsa.cloud.common.utils.ClipboardUtils
;
import
com.gingersoft.gsa.cloud.common.utils.MoneyUtil
;
import
com.gingersoft.gsa.cloud.common.utils.MoneyUtil
;
import
com.gingersoft.gsa.cloud.common.utils.other.TextUtil
;
import
com.gingersoft.gsa.cloud.common.utils.other.TextUtil
;
import
com.gingersoft.gsa.cloud.common.utils.time.TimeUtils
;
import
com.gingersoft.gsa.cloud.common.utils.time.TimeUtils
;
...
@@ -67,6 +68,8 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailsPresenter> im
...
@@ -67,6 +68,8 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailsPresenter> im
TextView
mTvOrderStatus
;
TextView
mTvOrderStatus
;
@BindView
(
R2
.
id
.
tv_order_no
)
@BindView
(
R2
.
id
.
tv_order_no
)
TextView
mTvOrderNo
;
TextView
mTvOrderNo
;
@BindView
(
R2
.
id
.
tv_order_id
)
TextView
mTvOrderId
;
@BindView
(
R2
.
id
.
tv_create_time
)
@BindView
(
R2
.
id
.
tv_create_time
)
TextView
mTvCreateTime
;
TextView
mTvCreateTime
;
@BindView
(
R2
.
id
.
tv_receiver
)
@BindView
(
R2
.
id
.
tv_receiver
)
...
@@ -222,6 +225,10 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailsPresenter> im
...
@@ -222,6 +225,10 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailsPresenter> im
@Override
@Override
public
void
loadOrderDetails
(
OrderDetails
.
DataBean
bean
)
{
public
void
loadOrderDetails
(
OrderDetails
.
DataBean
bean
)
{
//打印訂單上菜紙
topBar
.
addRightImageButton
(
R
.
drawable
.
ic_white_print
,
R
.
id
.
id_topbar_print
).
setOnClickListener
(
v
->
mPresenter
.
printColdChainOrder
(
true
)
);
labUrl
=
bean
.
getLabUrl
();
labUrl
=
bean
.
getLabUrl
();
mTvOrderFrom
.
setText
(
getResources
().
getString
(
bean
.
getOrder_from
()
==
7
?
R
.
string
.
h5_order
:
R
.
string
.
ricepon_order
));
mTvOrderFrom
.
setText
(
getResources
().
getString
(
bean
.
getOrder_from
()
==
7
?
R
.
string
.
h5_order
:
R
.
string
.
ricepon_order
));
if
(
bean
.
getOrderStatus
()
==
2
)
{
if
(
bean
.
getOrderStatus
()
==
2
)
{
...
@@ -234,7 +241,12 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailsPresenter> im
...
@@ -234,7 +241,12 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailsPresenter> im
mTvOrderStatus
.
setText
(
"待確認訂單"
);
mTvOrderStatus
.
setText
(
"待確認訂單"
);
mTvOrderStatus
.
setTextColor
(
ContextCompat
.
getColor
(
mContext
,
R
.
color
.
order_state0_color
));
mTvOrderStatus
.
setTextColor
(
ContextCompat
.
getColor
(
mContext
,
R
.
color
.
order_state0_color
));
}
}
mTvOrderNo
.
setText
(
getResources
().
getString
(
R
.
string
.
order_no
)
+
bean
.
getID
());
mTvOrderId
.
setText
(
String
.
format
(
getString
(
R
.
string
.
str_order_id
),
bean
.
getID
()));
mTvOrderNo
.
setText
(
getResources
().
getString
(
R
.
string
.
order_no
)
+
bean
.
getORDER_NO
());
mTvOrderNo
.
setOnClickListener
(
v
->
{
ClipboardUtils
.
copyText
(
bean
.
getORDER_NO
());
showMessage
(
"已複製到剪貼板"
);
});
mTvCreateTime
.
setText
(
getResources
().
getString
(
R
.
string
.
create_order_time
)
+
TimeUtils
.
parseTimeRepeat
(
bean
.
getCREATE_TIME
(),
TimeUtils
.
DEFAULT_DATE_FORMAT
));
mTvCreateTime
.
setText
(
getResources
().
getString
(
R
.
string
.
create_order_time
)
+
TimeUtils
.
parseTimeRepeat
(
bean
.
getCREATE_TIME
(),
TimeUtils
.
DEFAULT_DATE_FORMAT
));
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
bean
.
getRECEIVER
()))
{
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
bean
.
getRECEIVER
()))
{
mTvReceiver
.
setText
(
bean
.
getRECEIVER
());
mTvReceiver
.
setText
(
bean
.
getRECEIVER
());
...
...
component-coldchain/src/main/java/com/gingersoft/coldchain_module/mvp/ui/adapter/OrderListAdapter.java
View file @
da8dbb14
...
@@ -22,6 +22,9 @@ import java.util.List;
...
@@ -22,6 +22,9 @@ import java.util.List;
import
static
com
.
bin
.
david
.
form
.
utils
.
DensityUtils
.
dp2px
;
import
static
com
.
bin
.
david
.
form
.
utils
.
DensityUtils
.
dp2px
;
/**
* @author admin
*/
public
class
OrderListAdapter
extends
BaseQuickAdapter
<
OrderList
.
DataBeanX
.
DataBean
,
BaseViewHolder
>
{
public
class
OrderListAdapter
extends
BaseQuickAdapter
<
OrderList
.
DataBeanX
.
DataBean
,
BaseViewHolder
>
{
...
...
component-coldchain/src/main/res/layout/cold_chain_order_details.xml
View file @
da8dbb14
...
@@ -72,16 +72,26 @@
...
@@ -72,16 +72,26 @@
</RelativeLayout>
</RelativeLayout>
<include
layout=
"@layout/include_horizontal_color_eee_dividing_line"
/>
<include
layout=
"@layout/include_horizontal_color_eee_dividing_line"
/>
<!-- 訂單號-->
<!-- 訂單編號-->
<TextView
<TextView
android:id=
"@+id/tv_order_
no
"
android:id=
"@+id/tv_order_
id
"
style=
"@style/otherOrder_details_twelve_text_Style"
style=
"@style/otherOrder_details_twelve_text_Style"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_margin=
"@dimen/other_order_info_dialog_content_marginLeft"
android:layout_margin=
"@dimen/other_order_info_dialog_content_marginLeft"
android:layout_marginTop=
"@dimen/dp_10"
android:layout_marginTop=
"@dimen/dp_10"
tools:text=
"訂單號:"
/>
tools:text=
"訂單號:"
/>
<!-- 訂單編號-->
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id=
"@+id/tv_order_no"
style=
"@style/otherOrder_details_twelve_text_Style"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/dp_10"
android:layout_marginBottom=
"@dimen/dp_10"
android:drawablePadding=
"@dimen/dp_5"
android:drawableRight=
"@drawable/ic_black_copy"
tools:text=
"訂單編號:"
/>
<TextView
<TextView
android:id=
"@+id/tv_create_time"
android:id=
"@+id/tv_create_time"
...
...
component-coldchain/src/main/res/layout/cold_chain_order_item.xml
View file @
da8dbb14
...
@@ -3,7 +3,8 @@
...
@@ -3,7 +3,8 @@
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
android:layout_height=
"wrap_content"
android:background=
"@color/white"
>
<androidx.cardview.widget.CardView
<androidx.cardview.widget.CardView
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
@@ -17,6 +18,7 @@
...
@@ -17,6 +18,7 @@
<LinearLayout
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:background=
"@color/white"
android:orientation=
"horizontal"
android:orientation=
"horizontal"
android:paddingLeft=
"@dimen/dp_14"
android:paddingLeft=
"@dimen/dp_14"
android:paddingTop=
"@dimen/dp_10"
android:paddingTop=
"@dimen/dp_10"
...
...
component-coldchain/src/main/res/layout/fragment_main.xml
View file @
da8dbb14
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<com.scwang.smartrefresh.layout.SmartRefreshLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<com.scwang.smartrefresh.layout.SmartRefreshLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/cold_chain_refresh_layout"
android:id=
"@+id/cold_chain_refresh_layout"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:background=
"@color/white"
android:layout_height=
"match_parent"
>
android:layout_height=
"match_parent"
>
<FrameLayout
<FrameLayout
...
...
component-coldchain/src/main/res/layout/frozen_chain_main.xml
View file @
da8dbb14
...
@@ -31,8 +31,9 @@
...
@@ -31,8 +31,9 @@
android:id=
"@+id/coldchain_main_tabs"
android:id=
"@+id/coldchain_main_tabs"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:background=
"@color/white"
app:tabBackground=
"@color/white"
app:tabBackground=
"@color/white"
app:tabTextColor=
"@color/color_75"
app:tabSelectedTextColor=
"@color/theme_333_color"
app:tabIndicatorColor=
"@color/theme_color"
app:tabIndicatorColor=
"@color/theme_color"
app:tabPaddingEnd=
"-1dp"
app:tabPaddingEnd=
"-1dp"
app:tabPaddingStart=
"-1dp"
/>
app:tabPaddingStart=
"-1dp"
/>
...
...
component-delivery-pick/src/main/java/com/gingersoft/gsa/delivery_pick_mode/model/viewModel/PageViewModel.kt
View file @
da8dbb14
...
@@ -181,56 +181,50 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -181,56 +181,50 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
})
})
}
}
private
var
autoPolling
:
Disposable
?
=
null
;
/**
/**
* 開始自動確認訂單
* 開始自動確認訂單
*/
*/
fun
startAutoConfirmOrder
()
{
fun
startAutoConfirmOrder
()
{
autoPolling
=
RxJavaUtils
.
polling
(
10
)
{
launch
({
launch
({
//獲取即時單
//獲取即時單
repository
.
requestOrderList
(
restaurantId
.
toString
(),
fragmentStatus
[
1
]
+
",8"
,
fragmentType
[
0
],
"1"
,
orderNo
,
phone
,
0
).
apply
{
repository
.
requestOrderList
(
restaurantId
.
toString
(),
fragmentStatus
[
1
]
+
",8"
,
fragmentType
[
0
],
"1"
,
orderNo
,
phone
,
0
).
apply
{
if
(
isSuccess
())
{
if
(
isSuccess
())
{
val
data
=
getData
()
val
data
=
getData
()
if
(
data
!=
null
)
{
if
(
data
!=
null
)
{
val
dataList
=
data
.
data
val
dataList
=
data
.
data
//這裡判斷數量大於1,默認有一條配置數據,忽略掉
//這裡判斷數量大於1,默認有一條配置數據,忽略掉
if
(
dataList
!=
null
&&
dataList
.
size
>
1
)
{
if
(
dataList
!=
null
&&
dataList
.
size
>
1
)
{
//確認訂單之前得先獲取訂單詳情
//確認訂單之前得先獲取訂單詳情
val
orderInfo
=
repository
.
getOrderInfo
(
dataList
[
0
].
Id
.
toString
())
val
orderInfo
=
repository
.
getOrderInfo
(
dataList
[
0
].
Id
.
toString
())
if
(
orderInfo
.
data
!=
null
&&
orderInfo
.
data
!!
.
isNotEmpty
())
{
if
(
orderInfo
.
data
!=
null
&&
orderInfo
.
data
!!
.
isNotEmpty
())
{
orderInfo
.
data
?.
let
{
it
->
orderInfo
.
data
?.
let
{
it
->
val
orderDetail
=
it
[
0
]
val
orderDetail
=
it
[
0
]
if
(
verificationAmount
(
orderDetail
))
return
@launch
if
(
verificationAmount
(
orderDetail
))
return
@launch
orderDetail
.
order_type
=
dataList
[
0
].
order_type
orderDetail
.
order_type
=
dataList
[
0
].
order_type
orderDetail
.
orderPayType
=
dataList
[
0
].
orderPayType
orderDetail
.
orderPayType
=
dataList
[
0
].
orderPayType
if
(
orderDetail
.
order_type
==
7
)
{
if
(
orderDetail
.
order_type
==
7
)
{
//如果是自取單,將物流類型改為本店
//如果是自取單,將物流類型改為本店
orderDetail
.
companyType
=
0
orderDetail
.
companyType
=
0
}
}
//交通工具類型
//交通工具類型
var
trafficType
=
""
var
trafficType
=
""
if
(
orderDetail
.
companyType
==
2
)
{
if
(
orderDetail
.
companyType
==
2
)
{
//lalamove
//lalamove
val
transportationBean
=
getTransportationConfig
(
restaurantId
)
val
transportationBean
=
getTransportationConfig
(
restaurantId
)
if
(
transportationBean
.
success
&&
transportationBean
.
data
!=
null
&&
transportationBean
.
data
.
list
!=
null
)
{
if
(
transportationBean
.
success
&&
transportationBean
.
data
!=
null
&&
transportationBean
.
data
.
list
!=
null
)
{
for
(
value
in
transportationBean
.
data
.
list
)
{
for
(
value
in
transportationBean
.
data
.
list
)
{
if
(
value
.
status
==
1
)
{
if
(
value
.
status
==
1
)
{
//默認交通工具,判斷價格是不是在這個金額範圍內,如果在,則不提示,如果不在,提示用戶修改交通工具
//默認交通工具,判斷價格是不是在這個金額範圍內,如果在,則不提示,如果不在,提示用戶修改交通工具
trafficType
=
value
.
type
.
toString
()
trafficType
=
value
.
type
.
toString
()
}
}
}
}
}
}
}
confirmOrder
(
orderDetail
,
2
,
trafficType
,
restaurantId
,
isPrintPrj
=
true
,
isPrintBill
=
true
)
{
}
//確認之後,刷新列表
confirmOrder
(
orderDetail
,
2
,
trafficType
,
restaurantId
,
isPrintPrj
=
true
,
isPrintBill
=
true
)
{
refreshState
.
postValue
(
0
)
//確認之後,刷新列表
}
refreshState
.
postValue
(
0
)
}
}
}
}
}
else
{
}
}
}
else
{
}
else
{
...
@@ -238,40 +232,35 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -238,40 +232,35 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}
else
{
}
else
{
}
}
}
}
else
{}
//獲取預約單
}
repository
.
requestOrderList
(
restaurantId
.
toString
(),
fragmentStatus
[
1
],
fragmentType
[
0
],
"1"
,
orderNo
,
phone
,
1
).
apply
{
//獲取預約單
if
(
isSuccess
())
{
repository
.
requestOrderList
(
restaurantId
.
toString
(),
fragmentStatus
[
1
],
fragmentType
[
0
],
"1"
,
orderNo
,
phone
,
1
).
apply
{
val
data
=
getData
()
if
(
isSuccess
())
{
if
(
data
!=
null
)
{
val
data
=
getData
()
val
dataList
=
data
.
data
if
(
data
!=
null
)
{
//這裡判斷數量大於1,默認有一條配置數據,忽略掉
val
dataList
=
data
.
data
if
(
dataList
!=
null
&&
dataList
.
size
>
1
)
{
//這裡判斷數量大於1,默認有一條配置數據,忽略掉
//確認訂單之前得先獲取訂單詳情
if
(
dataList
!=
null
&&
dataList
.
size
>
1
)
{
val
orderInfo
=
repository
.
getOrderInfo
(
dataList
[
0
].
Id
.
toString
())
//確認訂單之前得先獲取訂單詳情
if
(
orderInfo
.
data
!=
null
&&
orderInfo
.
data
!!
.
isNotEmpty
())
{
val
orderInfo
=
repository
.
getOrderInfo
(
dataList
[
0
].
Id
.
toString
())
val
orderDetail
=
orderInfo
.
data
!!
[
0
]
if
(
orderInfo
.
data
!=
null
&&
orderInfo
.
data
!!
.
isNotEmpty
())
{
if
(
verificationAmount
(
orderDetail
))
return
@launch
val
orderDetail
=
orderInfo
.
data
!!
[
0
]
updateOrderAndPrint
(
restaurantId
,
orderDetail
,
8
,
false
)
{
if
(
verificationAmount
(
orderDetail
))
return
@launch
refreshState
.
postValue
(
0
)
updateOrderAndPrint
(
restaurantId
,
orderDetail
,
8
,
false
)
{
}
refreshState
.
postValue
(
0
)
}
}
}
}
}
}
}
}
}
}
},
{
}
//報錯處理
},
{
LoganManager
.
w_delivery
(
LoganManager
.
EVENT_QUERY
,
"自動接單"
+
it
.
message
)
//報錯處理
})
LoganManager
.
w_delivery
(
LoganManager
.
EVENT_QUERY
,
"自動接單"
+
it
.
message
)
}
})
}
fun
stopAutoConfirmOrder
()
{
autoPolling
?.
dispose
()
}
}
private
fun
OrderList
.
loadInfo
(
isLoadMore
:
Boolean
,
position
:
Int
)
{
private
fun
OrderList
.
loadInfo
(
isLoadMore
:
Boolean
,
position
:
Int
)
{
getData
()
?.
statistics
?.
let
{
getData
()
?.
statistics
?.
let
{
bookingOrderNum
.
value
=
it
.
reservationNumber
bookingOrderNum
.
value
=
it
.
reservationNumber
...
...
component-delivery-pick/src/main/java/com/gingersoft/gsa/delivery_pick_mode/ui/activity/DeliveryOrderMainActivity.kt
View file @
da8dbb14
...
@@ -112,19 +112,11 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen
...
@@ -112,19 +112,11 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen
initOrderType
()
initOrderType
()
//是否自動接單
//是否自動接單
cb_takeaway_auto_receiving_orders
.
setOnCheckedChangeListener
{
_
,
isChecked
->
cb_takeaway_auto_receiving_orders
.
setOnCheckedChangeListener
{
_
,
isChecked
->
if
(
isChecked
){
pageViewModel
.
startAutoConfirmOrder
()
}
else
{
pageViewModel
.
stopAutoConfirmOrder
()
}
RestaurantExpandInfoUtils
.
setValue
(
ExpandConstant
.
TakeawayAutoOrder
,
isChecked
)
RestaurantExpandInfoUtils
.
setValue
(
ExpandConstant
.
TakeawayAutoOrder
,
isChecked
)
}
}
cb_takeaway_auto_receiving_orders
.
isChecked
=
RestaurantExpandInfoUtils
.
getValue
<
Boolean
>(
ExpandConstant
.
TakeawayAutoOrder
,
false
)
cb_takeaway_auto_receiving_orders
.
isChecked
=
RestaurantExpandInfoUtils
.
getValue
<
Boolean
>(
ExpandConstant
.
TakeawayAutoOrder
,
false
)
pageViewModel
.
apply
{
pageViewModel
.
apply
{
if
(
cb_takeaway_auto_receiving_orders
.
isChecked
){
startAutoConfirmOrder
()
}
getDeliveryInfo
(
restaurantId
.
toString
(),
memberId
.
toString
())
getDeliveryInfo
(
restaurantId
.
toString
(),
memberId
.
toString
())
balanceBean
.
observe
(
this
@DeliveryOrderMainActivity
,
Observer
{
balanceBean
.
observe
(
this
@DeliveryOrderMainActivity
,
Observer
{
it
?.
data
?.
let
{
data
->
it
?.
data
?.
let
{
data
->
...
@@ -438,7 +430,6 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen
...
@@ -438,7 +430,6 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen
override
fun
onDestroy
()
{
override
fun
onDestroy
()
{
super
.
onDestroy
()
super
.
onDestroy
()
pageViewModel
.
stopAutoConfirmOrder
()
bind
?.
setOnPostCallBack
(
null
)
bind
?.
setOnPostCallBack
(
null
)
bind
?.
execute
{}
bind
?.
execute
{}
cancelDialogForLoading
()
cancelDialogForLoading
()
...
@@ -466,6 +457,10 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen
...
@@ -466,6 +457,10 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen
}
}
//刷新餘額
//刷新餘額
pageViewModel
.
getBanlance
(
RestaurantInfoManager
.
newInstance
().
getBrandId
())
pageViewModel
.
getBanlance
(
RestaurantInfoManager
.
newInstance
().
getBrandId
())
//選擇了自動接單
if
(
cb_takeaway_auto_receiving_orders
.
isChecked
){
pageViewModel
.
startAutoConfirmOrder
()
}
}
}
})
})
it
.
execute
{
it
.
execute
{
...
...
component-main/src/main/java/com/gingersoft/gsa/cloud/main/mvp/presenter/BusinessReportPresenter.java
View file @
da8dbb14
...
@@ -286,7 +286,7 @@ public class BusinessReportPresenter extends BasePresenter<BusinessReportContrac
...
@@ -286,7 +286,7 @@ public class BusinessReportPresenter extends BasePresenter<BusinessReportContrac
businessBeans
.
add
(
new
BusinessBean
(
itemNames
[
5
],
String
.
valueOf
(
MoneyUtil
.
get_ItemDecimals_money
(
dataBean
.
getTisAmount
()))));
businessBeans
.
add
(
new
BusinessBean
(
itemNames
[
5
],
String
.
valueOf
(
MoneyUtil
.
get_ItemDecimals_money
(
dataBean
.
getTisAmount
()))));
businessBeans
.
add
(
new
BusinessBean
(
itemNames
[
6
],
String
.
valueOf
(
MoneyUtil
.
get_ItemDecimals_money
(
dataBean
.
getBoxAmount
()))));
businessBeans
.
add
(
new
BusinessBean
(
itemNames
[
6
],
String
.
valueOf
(
MoneyUtil
.
get_ItemDecimals_money
(
dataBean
.
getBoxAmount
()))));
businessBeans
.
add
(
new
BusinessBean
(
itemNames
[
7
],
String
.
valueOf
(
MoneyUtil
.
get_ItemDecimals_money
(
dataBean
.
getDelAmount
()))));
businessBeans
.
add
(
new
BusinessBean
(
itemNames
[
7
],
String
.
valueOf
(
MoneyUtil
.
get_ItemDecimals_money
(
dataBean
.
getDelAmount
()))));
double
netProfit
=
MoneyUtil
.
su
b
(
dataBean
.
getFoodAmount
(),
dataBean
.
getDisAmount
(),
dataBean
.
getSeramount
(),
dataBean
.
getRoundAmount
(),
dataBean
.
getSaleAmount
(),
dataBean
.
getTisAmount
(),
dataBean
.
getBoxAmount
(),
dataBean
.
getDelAmount
());
double
netProfit
=
MoneyUtil
.
su
m
(
dataBean
.
getFoodAmount
(),
dataBean
.
getDisAmount
(),
dataBean
.
getSeramount
(),
dataBean
.
getRoundAmount
(),
dataBean
.
getSaleAmount
(),
dataBean
.
getTisAmount
(),
dataBean
.
getBoxAmount
(),
dataBean
.
getDelAmount
());
businessBeans
.
add
(
new
BusinessBean
(
itemNames
[
8
],
String
.
valueOf
(
MoneyUtil
.
get_ItemDecimals_money
(
netProfit
))));
businessBeans
.
add
(
new
BusinessBean
(
itemNames
[
8
],
String
.
valueOf
(
MoneyUtil
.
get_ItemDecimals_money
(
netProfit
))));
}
else
{
}
else
{
//為空,全部顯示0
//為空,全部顯示0
...
...
component-print/src/main/java/com/joe/print/PrintComponent.java
View file @
da8dbb14
...
@@ -6,10 +6,8 @@ import com.billy.cc.core.component.CC;
...
@@ -6,10 +6,8 @@ import com.billy.cc.core.component.CC;
import
com.billy.cc.core.component.CCResult
;
import
com.billy.cc.core.component.CCResult
;
import
com.billy.cc.core.component.CCUtil
;
import
com.billy.cc.core.component.CCUtil
;
import
com.billy.cc.core.component.IComponent
;
import
com.billy.cc.core.component.IComponent
;
import
com.gingersoft.gsa.cloud.common.constans.PrintConstans
;
import
com.gingersoft.gsa.cloud.component.ComponentName
;
import
com.gingersoft.gsa.cloud.component.ComponentName
;
import
com.jess.arms.utils.ArmsUtils
;
import
com.joe.print.mvp.print.printerManger.PrjPtinterManager
;
import
com.joe.print.mvp.print.PrinterManger.PrjPtinterManager
;
import
com.joe.print.mvp.print.service.PrjService
;
import
com.joe.print.mvp.print.service.PrjService
;
import
com.joe.print.mvp.ui.activity.PrintActivity
;
import
com.joe.print.mvp.ui.activity.PrintActivity
;
import
com.joe.print.mvp.ui.activity.PrinterListActivity
;
import
com.joe.print.mvp.ui.activity.PrinterListActivity
;
...
...
component-print/src/main/java/com/joe/print/mvp/presenter/IpPrintListActivityPresenter.java
View file @
da8dbb14
...
@@ -3,7 +3,7 @@ package com.joe.print.mvp.presenter;
...
@@ -3,7 +3,7 @@ package com.joe.print.mvp.presenter;
import
android.app.Application
;
import
android.app.Application
;
import
com.gingersoft.gsa.cloud.common.bean.BaseResult
;
import
com.gingersoft.gsa.cloud.common.bean.BaseResult
;
import
com.joe.print.mvp.print.
P
rinterManger.PrinterManager
;
import
com.joe.print.mvp.print.
p
rinterManger.PrinterManager
;
import
com.gingersoft.gsa.cloud.common.utils.JsonUtils
;
import
com.gingersoft.gsa.cloud.common.utils.JsonUtils
;
import
com.gingersoft.gsa.cloud.database.bean.PrintModelBean
;
import
com.gingersoft.gsa.cloud.database.bean.PrintModelBean
;
import
com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean
;
import
com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean
;
...
...
component-print/src/main/java/com/joe/print/mvp/presenter/PrintPresenter.java
View file @
da8dbb14
...
@@ -4,7 +4,7 @@ import android.app.Application;
...
@@ -4,7 +4,7 @@ import android.app.Application;
import
android.content.Context
;
import
android.content.Context
;
import
com.gingersoft.gsa.cloud.common.bean.BaseResult
;
import
com.gingersoft.gsa.cloud.common.bean.BaseResult
;
import
com.joe.print.mvp.print.
P
rinterManger.PrinterManager
;
import
com.joe.print.mvp.print.
p
rinterManger.PrinterManager
;
import
com.gingersoft.gsa.cloud.common.utils.JsonUtils
;
import
com.gingersoft.gsa.cloud.common.utils.JsonUtils
;
import
com.gingersoft.gsa.cloud.database.bean.PrintCurrencyBean
;
import
com.gingersoft.gsa.cloud.database.bean.PrintCurrencyBean
;
import
com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean
;
import
com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean
;
...
...
component-print/src/main/java/com/joe/print/mvp/print/EpsonPrint.java
View file @
da8dbb14
...
@@ -2,6 +2,7 @@ package com.joe.print.mvp.print;
...
@@ -2,6 +2,7 @@ package com.joe.print.mvp.print;
import
android.content.Context
;
import
android.content.Context
;
import
android.graphics.Bitmap
;
import
android.graphics.Bitmap
;
import
android.os.Looper
;
import
android.util.Log
;
import
android.util.Log
;
import
com.epson.epos2.Epos2Exception
;
import
com.epson.epos2.Epos2Exception
;
...
@@ -10,6 +11,7 @@ import com.epson.epos2.printer.PrinterStatusInfo;
...
@@ -10,6 +11,7 @@ import com.epson.epos2.printer.PrinterStatusInfo;
import
com.epson.epos2.printer.ReceiveListener
;
import
com.epson.epos2.printer.ReceiveListener
;
import
com.gingersoft.gsa.cloud.common.logan.LoganManager
;
import
com.gingersoft.gsa.cloud.common.logan.LoganManager
;
import
com.gingersoft.gsa.cloud.common.printer.plugins.PrinterPlugins
;
import
com.gingersoft.gsa.cloud.common.printer.plugins.PrinterPlugins
;
import
com.gingersoft.gsa.cloud.common.utils.log.LogUtil
;
import
com.gingersoft.gsa.cloud.print.PrintExecutor
;
import
com.gingersoft.gsa.cloud.print.PrintExecutor
;
import
com.gingersoft.gsa.cloud.print.PrintSocketHolder
;
import
com.gingersoft.gsa.cloud.print.PrintSocketHolder
;
import
com.gingersoft.gsa.cloud.print.impl.OnPrjPrintResultListener
;
import
com.gingersoft.gsa.cloud.print.impl.OnPrjPrintResultListener
;
...
@@ -19,6 +21,9 @@ import com.joe.print.mvp.print.utils.MyPrintUtils;
...
@@ -19,6 +21,9 @@ import com.joe.print.mvp.print.utils.MyPrintUtils;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
/**
* @author admin
*/
public
class
EpsonPrint
implements
ReceiveListener
{
public
class
EpsonPrint
implements
ReceiveListener
{
private
final
String
TAG
=
this
.
getClass
().
getSimpleName
();
private
final
String
TAG
=
this
.
getClass
().
getSimpleName
();
...
@@ -27,6 +32,7 @@ public class EpsonPrint implements ReceiveListener {
...
@@ -27,6 +32,7 @@ public class EpsonPrint implements ReceiveListener {
private
ReceiveListener
receiveListener
;
private
ReceiveListener
receiveListener
;
private
OnPrjPrintResultListener
onPrjPrintResultListener
;
private
OnPrjPrintResultListener
onPrjPrintResultListener
;
private
static
final
int
SEND_DATA_TIMEOUT
=
20
*
1000
;
private
static
EpsonPrint
epsonPrint
;
private
static
EpsonPrint
epsonPrint
;
public
static
EpsonPrint
public
static
EpsonPrint
...
@@ -278,7 +284,7 @@ public class EpsonPrint implements ReceiveListener {
...
@@ -278,7 +284,7 @@ public class EpsonPrint implements ReceiveListener {
bitmaps
.
add
(
bitmap
);
bitmaps
.
add
(
bitmap
);
prjIds
.
add
(
foodId
);
prjIds
.
add
(
foodId
);
if
(
isPrint
)
{
if
(
isPrint
)
{
Log
.
d
(
"eee"
,
"prj針式打印機隊列中,前面還有"
+
bitmaps
.
size
()
+
"個任務"
);
Log
Util
.
d
(
"eee"
,
"prj針式打印機隊列中,前面還有"
+
bitmaps
.
size
()
+
"個任務"
);
PrinterPlugins
.
getOnPrinterFlowHandler
().
connectionBefore
(
"針式打印機隊列中,前面還有"
+
bitmaps
.
size
()
+
"個任務"
,
ip
,
0
,
0
,
0
);
PrinterPlugins
.
getOnPrinterFlowHandler
().
connectionBefore
(
"針式打印機隊列中,前面還有"
+
bitmaps
.
size
()
+
"個任務"
,
ip
,
0
,
0
,
0
);
return
;
return
;
}
}
...
@@ -288,10 +294,9 @@ public class EpsonPrint implements ReceiveListener {
...
@@ -288,10 +294,9 @@ public class EpsonPrint implements ReceiveListener {
private
void
printData
(
String
ip
,
String
ids
,
Bitmap
bitmap
)
{
private
void
printData
(
String
ip
,
String
ids
,
Bitmap
bitmap
)
{
PrinterPlugins
.
getOnPrinterFlowHandler
().
onPrinterDataBefore
(
0
,
0
,
"針式打印機"
,
ip
);
PrinterPlugins
.
getOnPrinterFlowHandler
().
onPrinterDataBefore
(
0
,
0
,
"針式打印機"
,
ip
);
mPrinter
.
clearCommandBuffer
();
LogUtil
.
d
(
"eee"
,
"prj針式打印機創建數據中,任務數:"
+
bitmaps
.
size
());
Log
.
d
(
"eee"
,
"prj針式打印機創建數據中,任務數:"
+
bitmaps
.
size
());
if
(!
createPrintData
(
bitmap
))
{
if
(!
createPrintData
(
bitmap
))
{
Log
.
d
(
"eee"
,
"prj針式打印機創建數據失敗"
);
Log
Util
.
d
(
"eee"
,
"prj針式打印機創建數據失敗"
);
//如果是創建數據失敗,說明這個數據有問題,移除掉
//如果是創建數據失敗,說明這個數據有問題,移除掉
printErrorProcess
(
ids
,
bitmap
,
new
Exception
(
"針式打印機添加數據失敗"
+
ip
),
PrintSocketHolder
.
ERROR_6
);
printErrorProcess
(
ids
,
bitmap
,
new
Exception
(
"針式打印機添加數據失敗"
+
ip
),
PrintSocketHolder
.
ERROR_6
);
return
;
return
;
...
@@ -300,10 +305,10 @@ public class EpsonPrint implements ReceiveListener {
...
@@ -300,10 +305,10 @@ public class EpsonPrint implements ReceiveListener {
connectByIp
(
ip
,
mPrinter
.
getStatus
());
connectByIp
(
ip
,
mPrinter
.
getStatus
());
//獲取打印機狀態
//獲取打印機狀態
PrinterStatusInfo
statusInfo
=
mPrinter
.
getStatus
();
PrinterStatusInfo
statusInfo
=
mPrinter
.
getStatus
();
Log
.
d
(
"eee"
,
"prj針式打印機:"
+
"紙張狀態:"
+
statusInfo
.
getPaper
()
+
"連接狀態:"
+
statusInfo
.
getConnection
()
+
",任務數:"
+
bitmaps
.
size
());
Log
Util
.
d
(
"eee"
,
"prj針式打印機:"
+
"紙張狀態:"
+
statusInfo
.
getPaper
()
+
"連接狀態:"
+
statusInfo
.
getConnection
()
+
",任務數:"
+
bitmaps
.
size
());
if
(
statusInfo
.
getConnection
()
!=
1
)
{
if
(
statusInfo
.
getConnection
()
!=
1
)
{
//未連接到打印機
//未連接到打印機
Log
.
d
(
"eee"
,
"prj針式打印機連接失敗:"
+
ids
);
Log
Util
.
d
(
"eee"
,
"prj針式打印機連接失敗:"
+
ids
);
printErrorProcess
(
ids
,
bitmap
,
new
Exception
(
"針式打印機連接失敗"
+
ip
),
PrintSocketHolder
.
ERROR_7
);
printErrorProcess
(
ids
,
bitmap
,
new
Exception
(
"針式打印機連接失敗"
+
ip
),
PrintSocketHolder
.
ERROR_7
);
return
;
return
;
}
else
if
(
statusInfo
.
getPaper
()
!=
0
)
{
}
else
if
(
statusInfo
.
getPaper
()
!=
0
)
{
...
@@ -318,11 +323,11 @@ public class EpsonPrint implements ReceiveListener {
...
@@ -318,11 +323,11 @@ public class EpsonPrint implements ReceiveListener {
return
;
return
;
}
}
try
{
try
{
mPrinter
.
sendData
(
Printer
.
PARAM_DEFAUL
T
);
mPrinter
.
sendData
(
SEND_DATA_TIMEOU
T
);
PrinterPlugins
.
getOnPrinterFlowHandler
().
onPrintSuccess
();
PrinterPlugins
.
getOnPrinterFlowHandler
().
onPrintSuccess
();
Log
.
d
(
"eee"
,
"prj針式打印機打印成功"
+
",任務數:"
+
bitmaps
.
size
());
Log
Util
.
d
(
"eee"
,
"prj針式打印機打印成功"
+
",任務數:"
+
bitmaps
.
size
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
Log
.
d
(
"eee"
,
"prj針式打印機打印失敗"
+
",任務數:"
+
bitmaps
.
size
()
+
e
.
getMessage
());
Log
Util
.
d
(
"eee"
,
"prj針式打印機打印失敗"
+
",任務數:"
+
bitmaps
.
size
()
+
e
.
getMessage
());
printErrorProcess
(
ids
,
bitmap
,
new
Exception
(
"針式打印機打印報錯"
+
ip
),
PrintSocketHolder
.
ERROR_10
);
printErrorProcess
(
ids
,
bitmap
,
new
Exception
(
"針式打印機打印報錯"
+
ip
),
PrintSocketHolder
.
ERROR_10
);
mPrinter
.
clearCommandBuffer
();
mPrinter
.
clearCommandBuffer
();
}
}
...
@@ -330,6 +335,7 @@ public class EpsonPrint implements ReceiveListener {
...
@@ -330,6 +335,7 @@ public class EpsonPrint implements ReceiveListener {
/**
/**
* 打印異常處理
* 打印異常處理
*
* @param ids
* @param ids
* @param bitmap
* @param bitmap
*/
*/
...
@@ -414,8 +420,9 @@ public class EpsonPrint implements ReceiveListener {
...
@@ -414,8 +420,9 @@ public class EpsonPrint implements ReceiveListener {
/**
/**
* 打印結果回調
* 打印結果回調
* @param printer 打印類
*
* @param i 打印結果
* @param printer 打印類
* @param i 打印結果
* @param printerStatusInfo 打印機狀態
* @param printerStatusInfo 打印機狀態
* @param s
* @param s
*/
*/
...
@@ -428,6 +435,7 @@ public class EpsonPrint implements ReceiveListener {
...
@@ -428,6 +435,7 @@ public class EpsonPrint implements ReceiveListener {
/**
/**
* 執行下一個打印任務
* 執行下一個打印任務
*
* @param printer
* @param printer
* @param i
* @param i
* @param printerStatusInfo
* @param printerStatusInfo
...
@@ -437,7 +445,7 @@ public class EpsonPrint implements ReceiveListener {
...
@@ -437,7 +445,7 @@ public class EpsonPrint implements ReceiveListener {
if
(
receiveListener
!=
null
)
{
if
(
receiveListener
!=
null
)
{
receiveListener
.
onPtrReceive
(
printer
,
i
,
printerStatusInfo
,
prjIds
.
get
(
0
));
receiveListener
.
onPtrReceive
(
printer
,
i
,
printerStatusInfo
,
prjIds
.
get
(
0
));
}
}
Log
.
d
(
"eee"
,
"prj移除前:onPtrReceive"
+
prjIds
.
get
(
0
)
+
",任務數:"
+
bitmaps
.
size
());
Log
Util
.
d
(
"eee"
,
"prj移除前:onPtrReceive"
+
prjIds
.
get
(
0
)
+
",任務數:"
+
bitmaps
.
size
());
bitmaps
.
remove
(
0
);
bitmaps
.
remove
(
0
);
prjIds
.
remove
(
0
);
prjIds
.
remove
(
0
);
}
}
...
...
component-print/src/main/java/com/joe/print/mvp/print/PrintOtherOrder.java
View file @
da8dbb14
...
@@ -43,11 +43,8 @@ public class PrintOtherOrder extends PrinterRoot<PrintTakeawayFormContent> {
...
@@ -43,11 +43,8 @@ public class PrintOtherOrder extends PrinterRoot<PrintTakeawayFormContent> {
//打印完成之後,返回所有打印結果。
//打印完成之後,返回所有打印結果。
//如果需要打印印單,加上
//如果需要打印印單,加上
List
<
Bitmap
>
bitmaps
=
new
ArrayList
<>();
List
<
Bitmap
>
bitmaps
=
new
ArrayList
<>();
// Bitmap bitmap = initPrintView(mContext, dataBean);
Bitmap
bitmap
=
getBitmap
(
mContext
,
dataBean
,
deviceBean
);
Bitmap
bitmap
=
getBitmap
(
mContext
,
dataBean
,
deviceBean
);
// for (int i = 0; i < getPrintCount(mContext); i++) {
bitmaps
.
add
(
bitmap
);
bitmaps
.
add
(
bitmap
);
// }
merge2ResultMap
(
bitmapMaps
,
""
,
bitmaps
);
merge2ResultMap
(
bitmapMaps
,
""
,
bitmaps
);
return
bitmapMaps
;
return
bitmapMaps
;
}
}
...
@@ -96,6 +93,7 @@ public class PrintOtherOrder extends PrinterRoot<PrintTakeawayFormContent> {
...
@@ -96,6 +93,7 @@ public class PrintOtherOrder extends PrinterRoot<PrintTakeawayFormContent> {
if
(
data
.
getDELIVERY_CHARGE
()
!=
0
)
{
if
(
data
.
getDELIVERY_CHARGE
()
!=
0
)
{
billData
.
add
(
getBillBean
(
"送貨費:"
,
MONETARY_UNIT
+
data
.
getDELIVERY_CHARGE
()));
billData
.
add
(
getBillBean
(
"送貨費:"
,
MONETARY_UNIT
+
data
.
getDELIVERY_CHARGE
()));
}
}
billData
.
add
(
getBillBean
(
"總金額:"
,
MONETARY_UNIT
+
data
.
getTOTAL_AMOUNT
()));
double
totalAmount
=
Double
.
parseDouble
(
data
.
getTOTAL_AMOUNT
());
double
totalAmount
=
Double
.
parseDouble
(
data
.
getTOTAL_AMOUNT
());
if
(
data
.
getCouponList
()
!=
null
&&
data
.
getCouponList
().
size
()
>
0
)
{
if
(
data
.
getCouponList
()
!=
null
&&
data
.
getCouponList
().
size
()
>
0
)
{
for
(
OrderDetails
.
DataBean
.
CouponBean
coupon
:
data
.
getCouponList
())
{
for
(
OrderDetails
.
DataBean
.
CouponBean
coupon
:
data
.
getCouponList
())
{
...
@@ -106,8 +104,8 @@ public class PrintOtherOrder extends PrinterRoot<PrintTakeawayFormContent> {
...
@@ -106,8 +104,8 @@ public class PrintOtherOrder extends PrinterRoot<PrintTakeawayFormContent> {
layout
.
addView
(
getTakeawayBillInfoView
(
mContext
,
billData
));
layout
.
addView
(
getTakeawayBillInfoView
(
mContext
,
billData
));
layout
.
addView
(
getLine
(
mContext
));
layout
.
addView
(
getLine
(
mContext
));
//總金額34sp
//總金額34sp
layout
.
addView
(
getTakeawayLargeAmount
(
mContext
,
"總金額:"
,
MONETARY_UNIT
+
data
.
getTOTAL_AMOUNT
()));
//
layout.addView(getTakeawayLargeAmount(mContext, "總金額:", MONETARY_UNIT + data.getTOTAL_AMOUNT()));
layout
.
addView
(
getLine
(
mContext
));
//
layout.addView(getLine(mContext));
//支付信息
//支付信息
addTakeawayPayViews
(
mContext
,
layout
,
data
.
getPayMultiple
(),
totalAmount
);
addTakeawayPayViews
(
mContext
,
layout
,
data
.
getPayMultiple
(),
totalAmount
);
//用戶信息
//用戶信息
...
...
component-print/src/main/java/com/joe/print/mvp/print/PrinterRoot.java
View file @
da8dbb14
...
@@ -28,6 +28,7 @@ import com.epson.epos2.printer.PrinterStatusInfo;
...
@@ -28,6 +28,7 @@ import com.epson.epos2.printer.PrinterStatusInfo;
import
com.epson.epos2.printer.ReceiveListener
;
import
com.epson.epos2.printer.ReceiveListener
;
import
com.gingersoft.gsa.cloud.app.GsaCloudApplication
;
import
com.gingersoft.gsa.cloud.app.GsaCloudApplication
;
import
com.gingersoft.gsa.cloud.common.constans.AppConstans
;
import
com.gingersoft.gsa.cloud.common.constans.AppConstans
;
import
com.gingersoft.gsa.cloud.common.constans.DeliveryPickConstans
;
import
com.gingersoft.gsa.cloud.common.constans.ExpandConstant
;
import
com.gingersoft.gsa.cloud.common.constans.ExpandConstant
;
import
com.gingersoft.gsa.cloud.common.constans.PrintConstans
;
import
com.gingersoft.gsa.cloud.common.constans.PrintConstans
;
import
com.gingersoft.gsa.cloud.common.core.delivery.OrderDetails
;
import
com.gingersoft.gsa.cloud.common.core.delivery.OrderDetails
;
...
@@ -470,7 +471,7 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket
...
@@ -470,7 +471,7 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket
printFailure
(
"連接打印機失敗"
);
printFailure
(
"連接打印機失敗"
);
break
;
break
;
case
PrintSocketHolder
.
ERROR_10
:
case
PrintSocketHolder
.
ERROR_10
:
LoganManager
.
w_printer
(
TAG
,
"打印機連接成功,發送數據出現問題"
);
LoganManager
.
w_printer
(
TAG
,
"打印機連接成功,發送數據出現問題"
);
PrinterPlugins
.
getOnPrinterFlowHandler
().
onPrintError
(
new
Exception
(
"打印機連接成功,發送數據出現問題"
),
errorCode
);
PrinterPlugins
.
getOnPrinterFlowHandler
().
onPrintError
(
new
Exception
(
"打印機連接成功,發送數據出現問題"
),
errorCode
);
printFailure
(
"打印失敗,錯誤碼:"
+
errorCode
);
printFailure
(
"打印失敗,錯誤碼:"
+
errorCode
);
break
;
break
;
...
@@ -572,28 +573,35 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket
...
@@ -572,28 +573,35 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket
TextView
tvClosingTime
=
view
.
findViewById
(
R
.
id
.
tv_print_model_order_closing_time
);
TextView
tvClosingTime
=
view
.
findViewById
(
R
.
id
.
tv_print_model_order_closing_time
);
TextView
tvRemark
=
view
.
findViewById
(
R
.
id
.
tv_print_model_remark
);
TextView
tvRemark
=
view
.
findViewById
(
R
.
id
.
tv_print_model_remark
);
//訂單類型
//訂單類型
tvOrderType
.
setText
(
data
.
get
Order_type
()
==
2
?
"外送"
:
"自取"
);
tvOrderType
.
setText
(
data
.
get
ShowTextByOrderType
()
);
String
payType
=
""
;
//
String payType = "";
tvClosingTime
.
setVisibility
(
View
.
GONE
);
tvClosingTime
.
setVisibility
(
View
.
GONE
);
if
(
data
.
getOrderPayType
()
==
1
)
{
// if (data.getOrderPayType() == 1) {
//貨到付款
// //貨到付款
payType
=
"貨到付款"
;
// payType = "貨到付款";
}
else
if
(
data
.
getOrderPayType
()
==
0
)
{
// } else if (data.getOrderPayType() == 0) {
payType
=
"店內支付"
;
// payType = "店內支付";
}
else
if
(
data
.
getOrderPayType
()
==
2
)
{
// } else if (data.getOrderPayType() == 2) {
if
(
data
.
getPayMultiple
()
!=
null
)
{
// if (data.getPayMultiple() != null) {
StringBuilder
payName
=
new
StringBuilder
();
// StringBuilder payName = new StringBuilder();
for
(
OrderDetails
.
DataBean
.
PayMultiple
payMultiple
:
data
.
getPayMultiple
())
{
// for (OrderDetails.DataBean.PayMultiple payMultiple : data.getPayMultiple()) {
payName
.
append
(
payMultiple
.
getPayName
());
// payName.append(payMultiple.getPayName());
payName
.
append
(
","
);
// payName.append(",");
}
// }
if
(
payName
.
length
()
>
0
)
{
// if (payName.length() > 0) {
payName
.
deleteCharAt
(
payName
.
length
()
-
1
);
// payName.deleteCharAt(payName.length() - 1);
}
// }
payType
=
"在線支付:"
+
payName
.
toString
();
// payType = "在線支付:" + payName.toString();
}
else
{
// } else {
payType
=
"在線支付"
;
// payType = "在線支付";
}
// }
// //支付時間,只有在線支付有
// if (!TextUtil.isEmptyOrNullOrUndefined(data.getPayTime())) {
// tvClosingTime.setText("支付時間:" + data.getPayTime());
// tvClosingTime.setVisibility(View.VISIBLE);
// }
// }
if
(
data
.
getOrderPayType
()
==
2
)
{
//支付時間,只有在線支付有
//支付時間,只有在線支付有
if
(!
TextUtil
.
isEmptyOrNullOrUndefined
(
data
.
getPayTime
()))
{
if
(!
TextUtil
.
isEmptyOrNullOrUndefined
(
data
.
getPayTime
()))
{
tvClosingTime
.
setText
(
"支付時間:"
+
data
.
getPayTime
());
tvClosingTime
.
setText
(
"支付時間:"
+
data
.
getPayTime
());
...
@@ -601,16 +609,22 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket
...
@@ -601,16 +609,22 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket
}
}
}
}
//支付類型
//支付類型
tvPayType
.
setText
(
payType
);
tvPayType
.
setText
(
data
.
getShowTextByOrderPayType
()
);
//送達時間
//送達時間
tvDeliveryTime
.
setText
(
data
.
getOrder_type
()
==
2
?
data
.
getSEND_TIME
()
:
data
.
getTakeTime
());
tvDeliveryTime
.
setText
(
data
.
getOrder_type
()
==
2
?
data
.
getSEND_TIME
()
:
data
.
getTakeTime
());
if
(
TextUtil
.
isEmptyOrNullOrUndefined
(
tvDeliveryTime
.
getText
().
toString
()))
{
if
(
TextUtil
.
isEmptyOrNullOrUndefined
(
tvDeliveryTime
.
getText
().
toString
()))
{
tvDeliveryTime
.
setVisibility
(
View
.
GONE
);
tvDeliveryTime
.
setVisibility
(
View
.
GONE
);
}
}
tvBillNumber
.
setText
(
"
單
號:"
+
data
.
getORDER_NO
());
tvBillNumber
.
setText
(
"
編
號:"
+
data
.
getORDER_NO
());
if
(
TextUtil
.
isEmptyOrNullOrUndefined
(
data
.
getBillNo
()))
{
if
(
TextUtil
.
isEmptyOrNullOrUndefined
(
data
.
getBillNo
()))
{
tvOrderNumber
.
setVisibility
(
View
.
GONE
);
if
(
DeliveryPickConstans
.
COLD_CHAIN_TYPE
.
equals
(
data
.
getOrder_type
()
+
""
))
{
//凍鏈
tvOrderNumber
.
setText
(
"訂單號:"
+
data
.
getID
());
tvOrderNumber
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
tvOrderNumber
.
setVisibility
(
View
.
GONE
);
}
}
else
{
}
else
{
tvOrderNumber
.
setText
(
"訂單碼:"
+
data
.
getBillNo
());
tvOrderNumber
.
setText
(
"訂單碼:"
+
data
.
getBillNo
());
}
}
...
...
component-print/src/main/java/com/joe/print/mvp/print/
P
rinterManger/PrinterManager.java
→
component-print/src/main/java/com/joe/print/mvp/print/
p
rinterManger/PrinterManager.java
View file @
da8dbb14
package
com
.
joe
.
print
.
mvp
.
print
.
P
rinterManger
;
package
com
.
joe
.
print
.
mvp
.
print
.
p
rinterManger
;
import
com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean
;
import
com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean
;
...
...
component-print/src/main/java/com/joe/print/mvp/print/
P
rinterManger/PrjPtinterManager.java
→
component-print/src/main/java/com/joe/print/mvp/print/
p
rinterManger/PrjPtinterManager.java
View file @
da8dbb14
package
com
.
joe
.
print
.
mvp
.
print
.
P
rinterManger
;
package
com
.
joe
.
print
.
mvp
.
print
.
p
rinterManger
;
import
android.content.Context
;
import
android.content.Context
;
...
@@ -12,6 +12,7 @@ import android.util.Log;
...
@@ -12,6 +12,7 @@ import android.util.Log;
import
com.epson.epos2.printer.Printer
;
import
com.epson.epos2.printer.Printer
;
import
com.epson.epos2.printer.PrinterStatusInfo
;
import
com.epson.epos2.printer.PrinterStatusInfo
;
import
com.epson.epos2.printer.ReceiveListener
;
import
com.epson.epos2.printer.ReceiveListener
;
import
com.gingersoft.gsa.cloud.common.bean.BaseResult
;
import
com.gingersoft.gsa.cloud.common.constans.HttpsConstans
;
import
com.gingersoft.gsa.cloud.common.constans.HttpsConstans
;
import
com.gingersoft.gsa.cloud.common.constans.PrintConstans
;
import
com.gingersoft.gsa.cloud.common.constans.PrintConstans
;
import
com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager
;
import
com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager
;
...
@@ -46,7 +47,6 @@ import com.joe.print.mvp.print.usb.UsbPrinter;
...
@@ -46,7 +47,6 @@ import com.joe.print.mvp.print.usb.UsbPrinter;
import
com.joe.print.mvp.print.usb.UsbPrinterFinder
;
import
com.joe.print.mvp.print.usb.UsbPrinterFinder
;
import
com.joe.print.mvp.print.utils.MyPrintUtils
;
import
com.joe.print.mvp.print.utils.MyPrintUtils
;
import
com.sunmi.peripheral.printer.InnerResultCallbcak
;
import
com.sunmi.peripheral.printer.InnerResultCallbcak
;
import
com.xuexiang.rxutil2.rxjava.RxJavaUtils
;
import
org.json.JSONArray
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONException
;
...
@@ -61,7 +61,6 @@ import java.util.Iterator;
...
@@ -61,7 +61,6 @@ import java.util.Iterator;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.concurrent.TimeUnit
;
import
io.reactivex.Observer
;
import
io.reactivex.Observer
;
import
io.reactivex.disposables.Disposable
;
import
io.reactivex.disposables.Disposable
;
...
@@ -167,17 +166,17 @@ public class PrjPtinterManager implements ReceiveListener {
...
@@ -167,17 +166,17 @@ public class PrjPtinterManager implements ReceiveListener {
if
(
TextUtils
.
isEmpty
(
json
))
{
if
(
TextUtils
.
isEmpty
(
json
))
{
return
;
return
;
}
}
Map
<
String
,
List
<
PrjBean
.
DataBean
.
Bean
>>
listMap
=
new
HashMap
<>();
Map
<
String
,
List
<
PrjBean
>>
listMap
=
new
HashMap
<>();
currentIndex
=
0
;
currentIndex
=
0
;
totalPrj
=
0
;
totalPrj
=
0
;
PrjBean
prjBean
=
JsonUtils
.
parseObject
(
json
,
PrjBean
.
class
);
BaseResult
prjBean
=
JsonUtils
.
parseObject
(
json
,
BaseResult
.
class
);
if
(
prjBean
==
null
||
prjBean
.
getData
()
==
null
)
{
if
(
prjBean
==
null
||
prjBean
.
getData
()
==
null
)
{
LoganManager
.
w_printer
(
TAG
,
"newPrint prjBean == null || prjBean.getData() == null "
);
LoganManager
.
w_printer
(
TAG
,
"newPrint prjBean == null || prjBean.getData() == null "
);
return
;
return
;
}
}
//第一步:解析PRJ數據,格式為 Map<廚房位置,需要打印的數據>
//第一步:解析PRJ數據,格式為 Map<廚房位置,需要打印的數據>
try
{
try
{
JSONObject
jsonObject
=
new
JSONObject
(
prjBean
.
getData
(
));
JSONObject
jsonObject
=
new
JSONObject
(
GsonUtils
.
GsonString
(
prjBean
.
getData
()
));
//通过迭代器获取这段json当中所有的key值
//通过迭代器获取这段json当中所有的key值
Iterator
keys
=
jsonObject
.
keys
();
Iterator
keys
=
jsonObject
.
keys
();
//然后通过一个循环取出所有的key值
//然后通过一个循环取出所有的key值
...
@@ -185,13 +184,13 @@ public class PrjPtinterManager implements ReceiveListener {
...
@@ -185,13 +184,13 @@ public class PrjPtinterManager implements ReceiveListener {
String
key
=
String
.
valueOf
(
keys
.
next
());
String
key
=
String
.
valueOf
(
keys
.
next
());
//最后就可以通过刚刚得到的key值去解析后面的json了
//最后就可以通过刚刚得到的key值去解析后面的json了
JSONArray
dataJson
=
(
JSONArray
)
jsonObject
.
get
(
key
);
JSONArray
dataJson
=
(
JSONArray
)
jsonObject
.
get
(
key
);
List
<
PrjBean
.
DataBean
.
Bean
>
datas
=
JsonUtils
.
parseArray
(
dataJson
.
toString
(),
PrjBean
.
DataBean
.
Bean
.
class
);
List
<
PrjBean
>
datas
=
JsonUtils
.
parseArray
(
dataJson
.
toString
(),
Prj
Bean
.
class
);
if
(
datas
!=
null
&&
datas
.
size
()
>
0
)
{
if
(
datas
!=
null
&&
datas
.
size
()
>
0
)
{
//打印位置和需要打印的數據
//打印位置和需要打印的數據
listMap
.
put
(
key
,
datas
);
listMap
.
put
(
key
,
datas
);
//計算本次打印的prj總張數有沒有不需要切紙的
//計算本次打印的prj總張數有沒有不需要切紙的
boolean
isHasNoCut
=
false
;
boolean
isHasNoCut
=
false
;
for
(
PrjBean
.
DataBean
.
Bean
bean
:
datas
)
{
for
(
PrjBean
bean
:
datas
)
{
if
(
bean
.
getStatus
()
==
2
)
{
if
(
bean
.
getStatus
()
==
2
)
{
//需要切紙,prj總數就+1
//需要切紙,prj總數就+1
totalPrj
++;
totalPrj
++;
...
@@ -213,11 +212,11 @@ public class PrjPtinterManager implements ReceiveListener {
...
@@ -213,11 +212,11 @@ public class PrjPtinterManager implements ReceiveListener {
foreachPrint
(
listMap
,
getPrinterDevices
());
foreachPrint
(
listMap
,
getPrinterDevices
());
}
}
private
Map
<
String
,
List
<
PrjBean
.
DataBean
.
Bean
>>
setPrjIndex
(
Map
<
String
,
List
<
PrjBean
.
DataBean
.
Bean
>>
listMap
,
int
totalPrj
)
{
private
Map
<
String
,
List
<
PrjBean
>>
setPrjIndex
(
Map
<
String
,
List
<
Prj
Bean
>>
listMap
,
int
totalPrj
)
{
for
(
Map
.
Entry
<
String
,
List
<
PrjBean
.
DataBean
.
Bean
>>
prjMap
:
listMap
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
List
<
PrjBean
>>
prjMap
:
listMap
.
entrySet
())
{
//上一個對象是否切紙
//上一個對象是否切紙
boolean
lastIsCute
=
false
;
boolean
lastIsCute
=
false
;
for
(
PrjBean
.
DataBean
.
Bean
bean
:
prjMap
.
getValue
())
{
for
(
PrjBean
bean
:
prjMap
.
getValue
())
{
bean
.
setTotalPrj
(
totalPrj
);
bean
.
setTotalPrj
(
totalPrj
);
if
(
bean
.
getStatus
()
==
2
)
{
if
(
bean
.
getStatus
()
==
2
)
{
//要切紙,紙張數+1
//要切紙,紙張數+1
...
@@ -239,10 +238,10 @@ public class PrjPtinterManager implements ReceiveListener {
...
@@ -239,10 +238,10 @@ public class PrjPtinterManager implements ReceiveListener {
return
listMap
;
return
listMap
;
}
}
private
void
foreachPrint
(
Map
<
String
,
List
<
PrjBean
.
DataBean
.
Bean
>>
listMap
,
List
<
PrinterDeviceBean
>
printerDeviceBeans
)
{
private
void
foreachPrint
(
Map
<
String
,
List
<
PrjBean
>>
listMap
,
List
<
PrinterDeviceBean
>
printerDeviceBeans
)
{
//雙重遍歷可以以後優化
//雙重遍歷可以以後優化
//第二步:遍歷 Map<廚房位置,需要打印的數據>,通過廚房位置找到對應的打印機,並且通過數據拿到對應的通用配置
//第二步:遍歷 Map<廚房位置,需要打印的數據>,通過廚房位置找到對應的打印機,並且通過數據拿到對應的通用配置
for
(
Map
.
Entry
<
String
,
List
<
PrjBean
.
DataBean
.
Bean
>>
prjMap
:
listMap
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
List
<
PrjBean
>>
prjMap
:
listMap
.
entrySet
())
{
boolean
isFindDevice
=
false
;
boolean
isFindDevice
=
false
;
for
(
PrinterDeviceBean
deviceBean
:
printerDeviceBeans
)
{
for
(
PrinterDeviceBean
deviceBean
:
printerDeviceBeans
)
{
//遍歷得到當前打印機,如果沒找到打印機,就不打印
//遍歷得到當前打印機,如果沒找到打印機,就不打印
...
@@ -285,7 +284,7 @@ public class PrjPtinterManager implements ReceiveListener {
...
@@ -285,7 +284,7 @@ public class PrjPtinterManager implements ReceiveListener {
* @param beans prj數據
* @param beans prj數據
* @return 通用配置
* @return 通用配置
*/
*/
private
PrintCurrencyBean
getPrintCurrencyBean
(
List
<
PrjBean
.
DataBean
.
Bean
>
beans
)
{
private
PrintCurrencyBean
getPrintCurrencyBean
(
List
<
PrjBean
>
beans
)
{
PrintCurrencyBean
printCurrencyBean
=
null
;
PrintCurrencyBean
printCurrencyBean
=
null
;
if
(
beans
!=
null
&&
beans
.
size
()
>
0
)
{
if
(
beans
!=
null
&&
beans
.
size
()
>
0
)
{
if
(
beans
.
get
(
0
).
getOrderType
()
==
1
||
beans
.
get
(
0
).
getOrderType
()
==
3
)
{
if
(
beans
.
get
(
0
).
getOrderType
()
==
1
||
beans
.
get
(
0
).
getOrderType
()
==
3
)
{
...
@@ -302,7 +301,7 @@ public class PrjPtinterManager implements ReceiveListener {
...
@@ -302,7 +301,7 @@ public class PrjPtinterManager implements ReceiveListener {
/**
/**
* 生成用於打印的prj的Bitmap
* 生成用於打印的prj的Bitmap
*/
*/
private
void
generatePrintData
(
String
key
,
List
<
PrjBean
.
DataBean
.
Bean
>
beans
,
PrinterDeviceBean
printerDeviceBean
)
{
private
void
generatePrintData
(
String
key
,
List
<
PrjBean
>
beans
,
PrinterDeviceBean
printerDeviceBean
)
{
int
orderType
=
1
;
int
orderType
=
1
;
if
(
beans
!=
null
&&
beans
.
size
()
>
0
)
{
if
(
beans
!=
null
&&
beans
.
size
()
>
0
)
{
...
@@ -348,12 +347,12 @@ public class PrjPtinterManager implements ReceiveListener {
...
@@ -348,12 +347,12 @@ public class PrjPtinterManager implements ReceiveListener {
* @param beans prj數據
* @param beans prj數據
* @param printerDeviceBean 打印設備
* @param printerDeviceBean 打印設備
*/
*/
private
void
prjToPc
(
List
<
PrjBean
.
DataBean
.
Bean
>
beans
,
PrinterDeviceBean
printerDeviceBean
)
{
private
void
prjToPc
(
List
<
PrjBean
>
beans
,
PrinterDeviceBean
printerDeviceBean
)
{
//PRJ模式,生成PRJ文件到共享的電腦上
//PRJ模式,生成PRJ文件到共享的電腦上
ThreadPoolManager
.
getInstence
().
putExecutableTasks
(()
->
{
ThreadPoolManager
.
getInstence
().
putExecutableTasks
(()
->
{
List
<
PrjBean
.
DataBean
.
Bean
>
noCutList
=
new
ArrayList
<>();
List
<
PrjBean
>
noCutList
=
new
ArrayList
<>();
List
<
PrjBean
.
DataBean
.
Bean
>
cutList
=
new
ArrayList
<>();
List
<
PrjBean
>
cutList
=
new
ArrayList
<>();
for
(
PrjBean
.
DataBean
.
Bean
bean
:
beans
)
{
for
(
PrjBean
bean
:
beans
)
{
if
(
bean
.
getStatus
()
==
2
)
{
if
(
bean
.
getStatus
()
==
2
)
{
//需要切紙
//需要切紙
cutList
.
add
(
bean
);
cutList
.
add
(
bean
);
...
@@ -395,7 +394,7 @@ public class PrjPtinterManager implements ReceiveListener {
...
@@ -395,7 +394,7 @@ public class PrjPtinterManager implements ReceiveListener {
createFile
.
createNewFile
();
createFile
.
createNewFile
();
if
(
createFile
.
exists
())
{
if
(
createFile
.
exists
())
{
PrintStream
ps
=
new
PrintStream
(
new
SmbFileOutputStream
(
createFile
));
PrintStream
ps
=
new
PrintStream
(
new
SmbFileOutputStream
(
createFile
));
PrjBean
.
DataBean
.
Bean
bean
=
noCutList
.
get
(
0
);
PrjBean
bean
=
noCutList
.
get
(
0
);
String
tableName
=
""
;
String
tableName
=
""
;
if
(
TextUtil
.
isEmptyOrNullOrUndefined
(
bean
.
getTableName
()))
{
if
(
TextUtil
.
isEmptyOrNullOrUndefined
(
bean
.
getTableName
()))
{
...
@@ -448,13 +447,13 @@ public class PrjPtinterManager implements ReceiveListener {
...
@@ -448,13 +447,13 @@ public class PrjPtinterManager implements ReceiveListener {
* @param beans prj數據
* @param beans prj數據
* @param printerDeviceBean 打印機
* @param printerDeviceBean 打印機
*/
*/
private
void
stylusPrinting
(
String
key
,
List
<
PrjBean
.
DataBean
.
Bean
>
beans
,
PrinterDeviceBean
printerDeviceBean
)
{
private
void
stylusPrinting
(
String
key
,
List
<
PrjBean
>
beans
,
PrinterDeviceBean
printerDeviceBean
)
{
//針式打印機並且打印機類型為IP打印,生成獨特的格式
//針式打印機並且打印機類型為IP打印,生成獨特的格式
List
<
Map
<
String
,
Bitmap
>>
bitmapMaps
=
generatePrintMaps
(
key
,
beans
,
printerDeviceBean
);
List
<
Map
<
String
,
Bitmap
>>
bitmapMaps
=
generatePrintMaps
(
key
,
beans
,
printerDeviceBean
);
//將打印的圖片保存到手機中
//將打印的圖片保存到手機中
hookPrinterBitmap
(
bitmapMaps
,
beans
);
hookPrinterBitmap
(
bitmapMaps
,
beans
);
boolean
initResult
=
EpsonPrint
.
getInstance
().
initializeObject
(
mContext
,
this
,
errorCode
->
updatePrjState
(
errorCode
,
getPrintIds
(
bitmapMaps
))
);
boolean
initResult
=
EpsonPrint
.
getInstance
().
initializeObject
(
mContext
,
this
,
this
::
updatePrjState
);
if
(!
initResult
)
{
if
(!
initResult
)
{
//初始化打印機失敗
//初始化打印機失敗
PrinterPlugins
.
getOnPrinterFlowHandler
().
connectionError
(
new
ConnectException
(
"初始化針式打印機失敗"
));
PrinterPlugins
.
getOnPrinterFlowHandler
().
connectionError
(
new
ConnectException
(
"初始化針式打印機失敗"
));
...
@@ -559,9 +558,9 @@ public class PrjPtinterManager implements ReceiveListener {
...
@@ -559,9 +558,9 @@ public class PrjPtinterManager implements ReceiveListener {
*
*
* @return prj的id集合
* @return prj的id集合
*/
*/
private
String
getPrintIdsByPrjData
(
List
<
PrjBean
.
DataBean
.
Bean
>
prjBeans
)
{
private
String
getPrintIdsByPrjData
(
List
<
PrjBean
>
prjBeans
)
{
StringBuilder
stringBuilder
=
new
StringBuilder
();
StringBuilder
stringBuilder
=
new
StringBuilder
();
for
(
PrjBean
.
DataBean
.
Bean
prjBean
:
prjBeans
)
{
for
(
PrjBean
prjBean
:
prjBeans
)
{
stringBuilder
.
append
(
prjBean
.
getId
());
stringBuilder
.
append
(
prjBean
.
getId
());
if
(
stringBuilder
.
toString
().
lastIndexOf
(
","
)
!=
stringBuilder
.
length
()
-
1
)
{
if
(
stringBuilder
.
toString
().
lastIndexOf
(
","
)
!=
stringBuilder
.
length
()
-
1
)
{
//如果最後一位不是逗號,才添加
//如果最後一位不是逗號,才添加
...
@@ -710,13 +709,13 @@ public class PrjPtinterManager implements ReceiveListener {
...
@@ -710,13 +709,13 @@ public class PrjPtinterManager implements ReceiveListener {
* @param key 打印位置
* @param key 打印位置
* @param beans 打印的食品和其他的一些信息
* @param beans 打印的食品和其他的一些信息
*/
*/
private
List
<
Map
<
String
,
Bitmap
>>
generatePrintMaps
(
String
key
,
List
<
PrjBean
.
DataBean
.
Bean
>
beans
,
PrinterDeviceBean
printerDeviceBean
)
{
private
List
<
Map
<
String
,
Bitmap
>>
generatePrintMaps
(
String
key
,
List
<
PrjBean
>
beans
,
PrinterDeviceBean
printerDeviceBean
)
{
PrintPrjKitchen
printPrjKitchen
=
new
PrintPrjKitchen
();
PrintPrjKitchen
printPrjKitchen
=
new
PrintPrjKitchen
();
//這個Map的key是這張PRJ的所有PRJ記錄的id,然後會同時打印多張,所以是一個List集合
//這個Map的key是這張PRJ的所有PRJ記錄的id,然後會同時打印多張,所以是一個List集合
List
<
Map
<
String
,
Bitmap
>>
bitmapMaps
=
new
ArrayList
<>();
List
<
Map
<
String
,
Bitmap
>>
bitmapMaps
=
new
ArrayList
<>();
List
<
PrjBean
.
DataBean
.
Bean
>
noCut
=
new
ArrayList
<>();
List
<
PrjBean
>
noCut
=
new
ArrayList
<>();
//不帶*號,所有同樣廚房位置的食品都在一張紙上
//不帶*號,所有同樣廚房位置的食品都在一張紙上
for
(
PrjBean
.
DataBean
.
Bean
bean
:
beans
)
{
for
(
PrjBean
bean
:
beans
)
{
if
(
bean
.
getStatus
()
==
2
)
{
if
(
bean
.
getStatus
()
==
2
)
{
Map
<
String
,
Bitmap
>
map
=
new
HashMap
<>();
Map
<
String
,
Bitmap
>
map
=
new
HashMap
<>();
//帶*,需要切紙的,單獨放一張紙
//帶*,需要切紙的,單獨放一張紙
...
@@ -730,7 +729,7 @@ public class PrjPtinterManager implements ReceiveListener {
...
@@ -730,7 +729,7 @@ public class PrjPtinterManager implements ReceiveListener {
Map
<
String
,
Bitmap
>
map
=
new
HashMap
<>();
Map
<
String
,
Bitmap
>
map
=
new
HashMap
<>();
//遍歷拿到這張紙所有的PRJ記錄ID
//遍歷拿到這張紙所有的PRJ記錄ID
StringBuilder
stringBuffer
=
new
StringBuilder
();
StringBuilder
stringBuffer
=
new
StringBuilder
();
for
(
PrjBean
.
DataBean
.
Bean
noCutData
:
noCut
)
{
for
(
PrjBean
noCutData
:
noCut
)
{
stringBuffer
.
append
(
noCutData
.
getId
());
stringBuffer
.
append
(
noCutData
.
getId
());
stringBuffer
.
append
(
","
);
stringBuffer
.
append
(
","
);
}
}
...
@@ -742,12 +741,12 @@ public class PrjPtinterManager implements ReceiveListener {
...
@@ -742,12 +741,12 @@ public class PrjPtinterManager implements ReceiveListener {
return
bitmapMaps
;
return
bitmapMaps
;
}
}
private
void
hookPrinterBitmap
(
List
<
Map
<
String
,
Bitmap
>>
bitmapMaps
,
List
<
PrjBean
.
DataBean
.
Bean
>
beans
)
{
private
void
hookPrinterBitmap
(
List
<
Map
<
String
,
Bitmap
>>
bitmapMaps
,
List
<
PrjBean
>
beans
)
{
if
(
bitmapMaps
.
size
()
>
0
)
{
if
(
bitmapMaps
.
size
()
>
0
)
{
String
prjName
=
String
.
valueOf
(
System
.
currentTimeMillis
());
String
prjName
=
String
.
valueOf
(
System
.
currentTimeMillis
());
int
orderType
=
1
;
int
orderType
=
1
;
if
(
beans
.
size
()
>
0
)
{
if
(
beans
.
size
()
>
0
)
{
PrjBean
.
DataBean
.
Bean
prjBean
=
beans
.
get
(
0
);
PrjBean
prjBean
=
beans
.
get
(
0
);
if
(
prjBean
!=
null
)
{
if
(
prjBean
!=
null
)
{
if
(!
TextUtils
.
isEmpty
(
prjBean
.
getBillNo
()))
{
if
(!
TextUtils
.
isEmpty
(
prjBean
.
getBillNo
()))
{
prjName
=
prjBean
.
getBillNo
();
prjName
=
prjBean
.
getBillNo
();
...
...
component-print/src/main/java/com/joe/print/mvp/print/service/PrjService.java
View file @
da8dbb14
...
@@ -25,6 +25,7 @@ import com.gingersoft.gsa.cloud.common.printer.AidlUtil;
...
@@ -25,6 +25,7 @@ import com.gingersoft.gsa.cloud.common.printer.AidlUtil;
import
com.gingersoft.gsa.cloud.common.printer.plugins.PrinterPlugins
;
import
com.gingersoft.gsa.cloud.common.printer.plugins.PrinterPlugins
;
import
com.gingersoft.gsa.cloud.common.utils.JsonUtils
;
import
com.gingersoft.gsa.cloud.common.utils.JsonUtils
;
import
com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils
;
import
com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils
;
import
com.gingersoft.gsa.cloud.common.utils.log.LogUtil
;
import
com.gingersoft.gsa.cloud.common.utils.okhttpUtils.OkHttp3Utils
;
import
com.gingersoft.gsa.cloud.common.utils.okhttpUtils.OkHttp3Utils
;
import
com.gingersoft.gsa.cloud.common.utils.other.TextUtil
;
import
com.gingersoft.gsa.cloud.common.utils.other.TextUtil
;
import
com.gingersoft.gsa.cloud.common.utils.threadPool.ThreadPoolManager
;
import
com.gingersoft.gsa.cloud.common.utils.threadPool.ThreadPoolManager
;
...
@@ -222,12 +223,11 @@ public class PrjService extends Service implements ReceiveListener {
...
@@ -222,12 +223,11 @@ public class PrjService extends Service implements ReceiveListener {
}
}
}
}
private
String
prjJson
=
"{\"success\":true,\"sysTime\":161
3789540248,\"data\":{\"K1\":[{\"id\":71387,\"printerDeviceId\":186,\"status\":2,\"tableName\":\"堂食1\",\"orderNo\":\"0013\",\"orderTime\":2021,\"person\":1,\"number\":1,\"orderDetailsTime\":\"Feb 23, 2021 1:52:06 PM\",\"orderDetailsId\":372,\"productName\":\"N1. Mr.Arita華盛丼>得獎和牛使用定食\",\"productName2\":\"\",\"productName3\":\"\",\"parentId\":0,\"type\":3,\"createTime\":1614059526281,\"productId\":61256,\"requests\":1,\"actualPrinterDeviceId\":186,\"orderType\":1,\"isFirstSendOrder\":1,\"quantity\":21,\"memberName\":\"96761128\"}]}}
"
;
private
String
prjJson
=
"{\"success\":true,\"sysTime\":161
4581072400,\"data\":{\"K3\":[{\"id\":44419,\"printerDeviceId\":149,\"status\":2,\"orderNo\":\"233212281076117397\",\"orderTime\":2021,\"sender\":\"\",\"sendTime\":\"盡快送達 預計 15:49-16:04\",\"person\":0,\"number\":1,\"orderDetailsTime\":\"Mar 1, 2021 2:43:38 PM\",\"orderDetailsId\":12895,\"productName\":\"鬥獸場大什扒\",\"productName2\":\"\",\"productName3\":\"\",\"parentId\":0,\"type\":3,\"createTime\":1614581044514,\"productId\":27921,\"requests\":1,\"actualPrinterDeviceId\":149,\"flyPrinterDeviceId\":150,\"takeFoodCode\":\"1074\",\"billNo\":\"\",\"orderType\":2,\"userName\":\"wyh\",\"isFirstSendOrder\":1,\"quantity\":49,\"memberName\":\"\"}],\"K4\":[{\"id\":44420,\"printerDeviceId\":150,\"status\":2,\"orderNo\":\"233212281076117397\",\"orderTime\":2021,\"sender\":\"\",\"sendTime\":\"盡快送達 預計 15:49-16:04\",\"person\":0,\"number\":1,\"orderDetailsTime\":\"Mar 1, 2021 2:43:38 PM\",\"orderDetailsId\":12896,\"productName\":\"芝士焗龍蝦\",\"productName2\":\"\",\"productName3\":\"\",\"parentId\":0,\"type\":3,\"createTime\":1614581044521,\"productId\":27926,\"requests\":1,\"actualPrinterDeviceId\":150,\"takeFoodCode\":\"1074\",\"billNo\":\"\",\"orderType\":2,\"userName\":\"wyh\",\"isFirstSendOrder\":1,\"quantity\":50,\"memberName\":\"\"}]}}\n
"
;
private
void
newPrint
(
String
json
)
{
private
void
newPrint
(
String
json
)
{
Map
<
String
,
List
<
PrjBean
>>
listMap
=
new
HashMap
<>();
Map
<
String
,
List
<
PrjBean
>>
listMap
=
new
HashMap
<>();
int
totalPrj
=
0
;
int
totalPrj
=
0
;
BaseResult
prjBean
=
JsonUtils
.
parseObject
(
json
,
BaseResult
.
class
);
BaseResult
prjBean
=
JsonUtils
.
parseObject
(
json
,
BaseResult
.
class
);
if
(
prjBean
==
null
||
prjBean
.
getData
()
==
null
)
{
if
(
prjBean
==
null
||
prjBean
.
getData
()
==
null
)
{
LoganManager
.
w_printer
(
TAG
,
"newPrint prjBean == null || prjBean.getData() == null "
);
LoganManager
.
w_printer
(
TAG
,
"newPrint prjBean == null || prjBean.getData() == null "
);
...
@@ -393,6 +393,9 @@ public class PrjService extends Service implements ReceiveListener {
...
@@ -393,6 +393,9 @@ public class PrjService extends Service implements ReceiveListener {
int
orderType
=
1
;
int
orderType
=
1
;
if
(
beans
!=
null
&&
beans
.
size
()
>
0
)
{
if
(
beans
!=
null
&&
beans
.
size
()
>
0
)
{
orderType
=
beans
.
get
(
0
).
getOrderType
();
orderType
=
beans
.
get
(
0
).
getOrderType
();
}
else
{
PrinterPlugins
.
getOnPrinterFlowHandler
().
onPrintError
(
new
Exception
(
"prj解析數據為空:"
+
GsonUtils
.
GsonString
(
beans
)),
UpdateBean
.
FAIL_PRINT_BY_NOT_PRINT_INFO
);
return
;
}
}
PrinterPlugins
.
getOnPrinterFlowHandler
().
onPrinterDataBefore
(
orderType
,
PrintConstans
.
PRINT_KITCHEN
,
GsonUtils
.
GsonString
(
beans
),
GsonUtils
.
GsonString
(
printerDeviceBean
));
PrinterPlugins
.
getOnPrinterFlowHandler
().
onPrinterDataBefore
(
orderType
,
PrintConstans
.
PRINT_KITCHEN
,
GsonUtils
.
GsonString
(
beans
),
GsonUtils
.
GsonString
(
printerDeviceBean
));
...
@@ -539,17 +542,16 @@ public class PrjService extends Service implements ReceiveListener {
...
@@ -539,17 +542,16 @@ public class PrjService extends Service implements ReceiveListener {
List
<
Map
<
String
,
Bitmap
>>
bitmapMaps
=
generatePrintMaps
(
key
,
beans
,
printerDeviceBean
);
List
<
Map
<
String
,
Bitmap
>>
bitmapMaps
=
generatePrintMaps
(
key
,
beans
,
printerDeviceBean
);
//將打印的圖片保存到手機中
//將打印的圖片保存到手機中
hookPrinterBitmap
(
bitmapMaps
,
beans
);
hookPrinterBitmap
(
bitmapMaps
,
beans
);
boolean
initResult
=
EpsonPrint
.
getInstance
().
initializeObject
(
this
,
this
,
this
::
updatePrjState
);
boolean
initResult
=
EpsonPrint
.
getInstance
().
initializeObject
(
this
,
this
,
this
::
updatePrjState
);
if
(!
initResult
)
{
if
(!
initResult
)
{
//初始化打印機失敗
//初始化打印機失敗
PrinterPlugins
.
getOnPrinterFlowHandler
().
connectionError
(
new
ConnectException
(
"初始化針式打印機失敗"
));
PrinterPlugins
.
getOnPrinterFlowHandler
().
connectionError
(
new
ConnectException
(
"初始化針式打印機失敗"
));
Log
.
e
(
"eee"
,
"prj初始化打印失敗"
+
getPrintIds
(
bitmapMaps
));
Log
Util
.
e
(
"eee"
,
"prj初始化打印失敗"
+
getPrintIds
(
bitmapMaps
));
updatePrjState
(
UpdateBean
.
FAIL_EPSON_INIT
,
getPrintIds
(
bitmapMaps
));
updatePrjState
(
UpdateBean
.
FAIL_EPSON_INIT
,
getPrintIds
(
bitmapMaps
));
return
;
return
;
}
}
PrinterPlugins
.
getOnPrinterFlowHandler
().
connectionBefore
(
"針式打印機"
+
bitmapMaps
.
size
(),
printerDeviceBean
.
getIp
(),
printerDeviceBean
.
getPort
(),
0
,
0
);
PrinterPlugins
.
getOnPrinterFlowHandler
().
connectionBefore
(
"針式打印機"
+
bitmapMaps
.
size
(),
printerDeviceBean
.
getIp
(),
printerDeviceBean
.
getPort
(),
0
,
0
);
Log
.
d
(
"eee"
,
"針式打印機本次PRJ數量:"
+
bitmapMaps
.
size
());
Log
Util
.
d
(
"eee"
,
"針式打印機本次PRJ數量:"
+
bitmapMaps
.
size
());
for
(
int
i
=
0
;
i
<
bitmapMaps
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
bitmapMaps
.
size
();
i
++)
{
for
(
Map
.
Entry
<
String
,
Bitmap
>
mapEntry
:
bitmapMaps
.
get
(
i
).
entrySet
())
{
for
(
Map
.
Entry
<
String
,
Bitmap
>
mapEntry
:
bitmapMaps
.
get
(
i
).
entrySet
())
{
EpsonPrint
.
getInstance
().
putPrintData
(
printerDeviceBean
.
getIp
(),
mapEntry
.
getValue
(),
mapEntry
.
getKey
());
EpsonPrint
.
getInstance
().
putPrintData
(
printerDeviceBean
.
getIp
(),
mapEntry
.
getValue
(),
mapEntry
.
getKey
());
...
@@ -1108,7 +1110,7 @@ public class PrjService extends Service implements ReceiveListener {
...
@@ -1108,7 +1110,7 @@ public class PrjService extends Service implements ReceiveListener {
@Override
@Override
public
void
onPtrReceive
(
Printer
printer
,
int
i
,
PrinterStatusInfo
printerStatusInfo
,
String
public
void
onPtrReceive
(
Printer
printer
,
int
i
,
PrinterStatusInfo
printerStatusInfo
,
String
s
)
{
s
)
{
Log
.
e
(
"eee"
,
"prj針式打印結果"
+
i
);
Log
Util
.
e
(
"eee"
,
"prj針式打印結果"
+
i
);
//針式打印回調
//針式打印回調
if
(
i
==
0
)
{
if
(
i
==
0
)
{
PrinterPlugins
.
getOnPrinterFlowHandler
().
onPrintSuccess
();
PrinterPlugins
.
getOnPrinterFlowHandler
().
onPrintSuccess
();
...
...
component-print/src/main/java/com/joe/print/mvp/ui/activity/PrintActivity.java
View file @
da8dbb14
package
com
.
joe
.
print
.
mvp
.
ui
.
activity
;
package
com
.
joe
.
print
.
mvp
.
ui
.
activity
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.graphics.Bitmap
;
import
android.graphics.Bitmap
;
...
@@ -27,19 +25,17 @@ import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
...
@@ -27,19 +25,17 @@ import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import
com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils
;
import
com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils
;
import
com.gingersoft.gsa.cloud.database.bean.PrintCurrencyBean
;
import
com.gingersoft.gsa.cloud.database.bean.PrintCurrencyBean
;
import
com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean
;
import
com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean
;
import
com.gingersoft.gsa.cloud.database.utils.FoodModifierDaoUtils
;
import
com.gingersoft.gsa.cloud.print.PrintExecutor
;
import
com.gingersoft.gsa.cloud.print.PrintExecutor
;
import
com.gingersoft.gsa.cloud.print.PrintSocketHolder
;
import
com.gingersoft.gsa.cloud.print.PrintSocketHolder
;
import
com.gingersoft.gsa.cloud.print.bean.PrintContent
;
import
com.gingersoft.gsa.cloud.print.bean.PrintContent
;
import
com.gingersoft.gsa.cloud.print.bean.PrjBean
;
import
com.gingersoft.gsa.cloud.print.bean.PrjBean
;
import
com.gingersoft.gsa.cloud.print.bean.UpdateBean
;
import
com.jess.arms.base.BaseActivity
;
import
com.jess.arms.base.BaseActivity
;
import
com.jess.arms.di.component.AppComponent
;
import
com.jess.arms.di.component.AppComponent
;
import
com.jess.arms.integration.AppManager
;
import
com.jess.arms.utils.ArmsUtils
;
import
com.jess.arms.utils.ArmsUtils
;
import
com.joe.print.di.component.DaggerPrintComponent
;
import
com.joe.print.di.component.DaggerPrintComponent
;
import
com.joe.print.mvp.contract.PrintContract
;
import
com.joe.print.mvp.contract.PrintContract
;
import
com.joe.print.mvp.presenter.PrintPresenter
;
import
com.joe.print.mvp.presenter.PrintPresenter
;
import
com.joe.print.mvp.print.EpsonPrint
;
import
com.joe.print.mvp.print.PrintInstruction
;
import
com.joe.print.mvp.print.PrintInstruction
;
import
com.joe.print.mvp.print.PrintListener
;
import
com.joe.print.mvp.print.PrintListener
;
import
com.joe.print.mvp.print.PrintPrjKitchen
;
import
com.joe.print.mvp.print.PrintPrjKitchen
;
...
@@ -49,19 +45,11 @@ import com.joe.print.mvp.print.utils.MyPrintUtils;
...
@@ -49,19 +45,11 @@ import com.joe.print.mvp.print.utils.MyPrintUtils;
import
com.joe.print.mvp.ui.view.PrinterLoadingDialog
;
import
com.joe.print.mvp.ui.view.PrinterLoadingDialog
;
import
com.joe.print.mvp.ui.view.SelectPrintDevicePopup
;
import
com.joe.print.mvp.ui.view.SelectPrintDevicePopup
;
import
com.lxj.xpopup.XPopup
;
import
com.lxj.xpopup.XPopup
;
import
com.xuexiang.rxutil2.rxjava.RxJavaUtils
;
import
com.xuexiang.rxutil2.rxjava.task.RxUITask
;
import
java.net.ConnectException
;
import
java.net.ConnectException
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
javax.inject.Inject
;
import
io.reactivex.Observable
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.functions.Consumer
;
import
static
com
.
gingersoft
.
gsa
.
cloud
.
common
.
constans
.
PrintConstans
.
PRINT_BILL
;
import
static
com
.
gingersoft
.
gsa
.
cloud
.
common
.
constans
.
PrintConstans
.
PRINT_BILL
;
import
static
com
.
gingersoft
.
gsa
.
cloud
.
common
.
constans
.
PrintConstans
.
PRINT_OTHER_CLOSING
;
import
static
com
.
gingersoft
.
gsa
.
cloud
.
common
.
constans
.
PrintConstans
.
PRINT_OTHER_CLOSING
;
import
static
com
.
gingersoft
.
gsa
.
cloud
.
common
.
constans
.
PrintConstans
.
PRINT_OTHER_ORDER
;
import
static
com
.
gingersoft
.
gsa
.
cloud
.
common
.
constans
.
PrintConstans
.
PRINT_OTHER_ORDER
;
...
@@ -138,15 +126,8 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
...
@@ -138,15 +126,8 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
@Override
@Override
public
void
initData
(
@Nullable
Bundle
savedInstanceState
)
{
public
void
initData
(
@Nullable
Bundle
savedInstanceState
)
{
// loadingPopup = new XPopup.Builder(mContext)
// .popupAnimation(PopupAnimation.ScaleAlphaFromCenter)
// .asLoading("加载中...");
// loadingPopup.show();
actionPrinter
();
actionPrinter
();
PrinterPlugins
.
setOnPrinterFlowHandler
(
new
PrinterFlowListener
()
{
PrinterPlugins
.
setOnPrinterFlowHandler
(
new
PrinterFlowListener
()
{
@Override
@Override
public
void
connectionBefore
(
String
deviceName
,
String
IP
,
int
port
,
long
ioTimeout
,
long
printTimeout
)
{
public
void
connectionBefore
(
String
deviceName
,
String
IP
,
int
port
,
long
ioTimeout
,
long
printTimeout
)
{
...
@@ -154,13 +135,13 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
...
@@ -154,13 +135,13 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
@Override
@Override
public
void
connectionSuccess
()
{
public
void
connectionSuccess
()
{
printerLoadingDialog
.
setStep
(
2
,
PrinterLoadingDialog
.
status_success
,
null
);
printerLoadingDialog
.
setStep
(
PrinterLoadingDialog
.
PROGRESS_PRINTING
,
PrinterLoadingDialog
.
STATUS_SUCCESS
,
null
);
}
}
@Override
@Override
public
void
connectionError
(
Exception
e
)
{
public
void
connectionError
(
Exception
e
)
{
printerResult
=
false
;
printerResult
=
false
;
printerLoadingDialog
.
setStep
(
2
,
PrinterLoadingDialog
.
status_error
,
e
.
getMessage
());
printerLoadingDialog
.
setStep
(
PrinterLoadingDialog
.
PROGRESS_PRINTING
,
PrinterLoadingDialog
.
STATUS_ERROR
,
e
.
getMessage
());
}
}
@Override
@Override
...
@@ -169,24 +150,24 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
...
@@ -169,24 +150,24 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
@Override
@Override
public
void
onPrinterDataBefore
(
int
orderType
,
int
printType
,
String
printerData
,
String
printerDeviceInfo
)
{
public
void
onPrinterDataBefore
(
int
orderType
,
int
printType
,
String
printerData
,
String
printerDeviceInfo
)
{
printerLoadingDialog
.
setStep
(
1
,
PrinterLoadingDialog
.
status_success
,
null
);
printerLoadingDialog
.
setStep
(
PrinterLoadingDialog
.
PROGRESS_CONNECTING
,
PrinterLoadingDialog
.
STATUS_SUCCESS
,
null
);
}
}
@Override
@Override
public
void
onPrinterBitmapBefore
(
int
orderType
,
int
printType
,
String
directoryName
,
List
<
Bitmap
>
bitmaps
)
{
public
void
onPrinterBitmapBefore
(
int
orderType
,
int
printType
,
String
directoryName
,
List
<
Bitmap
>
bitmaps
)
{
printerLoadingDialog
.
setStep
(
1
,
PrinterLoadingDialog
.
status_success
,
null
);
printerLoadingDialog
.
setStep
(
PrinterLoadingDialog
.
PROGRESS_CONNECTING
,
PrinterLoadingDialog
.
STATUS_SUCCESS
,
null
);
}
}
@Override
@Override
public
void
onPrintSuccess
()
{
public
void
onPrintSuccess
()
{
printerResult
=
true
;
printerResult
=
true
;
printerLoadingDialog
.
setStep
(
3
,
PrinterLoadingDialog
.
status_success
,
null
);
printerLoadingDialog
.
setStep
(
PrinterLoadingDialog
.
PROGRESS_RESULT
,
PrinterLoadingDialog
.
STATUS_SUCCESS
,
null
);
}
}
@Override
@Override
public
void
onPrintError
(
Exception
e
,
int
errorCode
)
{
public
void
onPrintError
(
Exception
e
,
int
errorCode
)
{
printerResult
=
false
;
printerResult
=
false
;
printerLoadingDialog
.
setStep
(
3
,
PrinterLoadingDialog
.
status_error
,
e
.
getMessage
());
printerLoadingDialog
.
setStep
(
PrinterLoadingDialog
.
PROGRESS_RESULT
,
PrinterLoadingDialog
.
STATUS_ERROR
,
e
.
getMessage
());
}
}
});
});
}
}
...
@@ -223,15 +204,12 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
...
@@ -223,15 +204,12 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
}
else
{
}
else
{
printerLoadingDialog
=
new
PrinterLoadingDialog
(
mContext
).
build
();
printerLoadingDialog
=
new
PrinterLoadingDialog
(
mContext
).
build
();
}
}
printerLoadingDialog
.
setOnCancelListener
(
new
DialogInterface
.
OnCancelListener
()
{
printerLoadingDialog
.
setOnCancelListener
(
dialog
->
{
@Override
finish
();
public
void
onCancel
(
DialogInterface
dialog
)
{
if
(
printerResult
)
{
finish
();
CC
.
sendCCResult
(
callId
,
CCResult
.
success
());
if
(
printerResult
)
{
}
else
{
CC
.
sendCCResult
(
callId
,
CCResult
.
success
());
CC
.
sendCCResult
(
callId
,
CCResult
.
error
(
"print error"
));
}
else
{
CC
.
sendCCResult
(
callId
,
CCResult
.
error
(
"print error"
));
}
}
}
});
});
printerLoadingDialog
.
show
();
printerLoadingDialog
.
show
();
...
@@ -281,7 +259,7 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
...
@@ -281,7 +259,7 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
//如果彈窗已經關閉,打印機還是為空,說明用戶沒有選擇打印機
//如果彈窗已經關閉,打印機還是為空,說明用戶沒有選擇打印機
if
(
this
.
defaultPrint
==
null
)
{
if
(
this
.
defaultPrint
==
null
)
{
printFailure
(
"沒有找到打印機,無法打印"
);
printFailure
(
"沒有找到打印機,無法打印"
);
killMyself
(
);
PrinterPlugins
.
getOnPrinterFlowHandler
().
onPrintError
(
new
Exception
(
"沒有找到打印機,無法打印"
),
UpdateBean
.
FAIL_PRINT_BY_NOT_FIND_DEVICE
);
}
}
});
});
new
XPopup
.
Builder
(
mContext
).
asCustom
(
selectPrintDevicePopup
).
show
();
new
XPopup
.
Builder
(
mContext
).
asCustom
(
selectPrintDevicePopup
).
show
();
...
@@ -375,7 +353,6 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
...
@@ -375,7 +353,6 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
}
}
}
else
{
}
else
{
//獲取打印圖片
//獲取打印圖片
listMap
=
printerInIt
.
getPrintBitmapByCount
(
mContext
,
defaultPrint
);
listMap
=
printerInIt
.
getPrintBitmapByCount
(
mContext
,
defaultPrint
);
if
(
listMap
!=
null
)
{
if
(
listMap
!=
null
)
{
zoomBitmaps
=
listMap
.
get
(
""
);
zoomBitmaps
=
listMap
.
get
(
""
);
...
...
component-print/src/main/java/com/joe/print/mvp/ui/fragment/IpPrintListActivityFragment.java
View file @
da8dbb14
...
@@ -25,7 +25,7 @@ import com.joe.print.di.component.DaggerIpPrintListActivityComponent;
...
@@ -25,7 +25,7 @@ import com.joe.print.di.component.DaggerIpPrintListActivityComponent;
import
com.joe.print.di.module.IpPrintListActivityModule
;
import
com.joe.print.di.module.IpPrintListActivityModule
;
import
com.joe.print.mvp.contract.IpPrintListActivityContract
;
import
com.joe.print.mvp.contract.IpPrintListActivityContract
;
import
com.joe.print.mvp.presenter.IpPrintListActivityPresenter
;
import
com.joe.print.mvp.presenter.IpPrintListActivityPresenter
;
import
com.joe.print.mvp.print.
P
rinterManger.PrinterManager
;
import
com.joe.print.mvp.print.
p
rinterManger.PrinterManager
;
import
com.joe.print.mvp.ui.activity.PrinterAddActivity
;
import
com.joe.print.mvp.ui.activity.PrinterAddActivity
;
import
com.joe.print.mvp.ui.adapter.PrinterListAdapter
;
import
com.joe.print.mvp.ui.adapter.PrinterListAdapter
;
import
com.qmuiteam.qmui.alpha.QMUIAlphaButton
;
import
com.qmuiteam.qmui.alpha.QMUIAlphaButton
;
...
...
component-print/src/main/java/com/joe/print/mvp/ui/view/PrinterLoadingDialog.java
View file @
da8dbb14
...
@@ -2,58 +2,63 @@ package com.joe.print.mvp.ui.view;
...
@@ -2,58 +2,63 @@ package com.joe.print.mvp.ui.view;
import
android.animation.ValueAnimator
;
import
android.animation.ValueAnimator
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.graphics.drawable.Drawable
;
import
android.graphics.drawable.Drawable
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.os.Looper
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.LinearLayout
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.NonNull
;
import
androidx.core.content.ContextCompat
;
import
com.airbnb.lottie.LottieAnimationView
;
import
com.airbnb.lottie.LottieAnimationView
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.constant.HywebActionStatusCode
;
import
com.gingersoft.gsa.cloud.ui.widget.dialog.BaseRetryDialog
;
import
com.gingersoft.gsa.cloud.ui.widget.dialog.BaseRetryDialog
;
import
com.joe.print.R
;
import
com.joe.print.R
;
import
com.qmuiteam.qmui.layout.QMUILinearLayout
;
import
com.qmuiteam.qmui.layout.QMUILinearLayout
;
import
com.qmuiteam.qmui.util.QMUIDisplayHelper
;
import
com.qmuiteam.qmui.util.QMUIDisplayHelper
;
import
butterknife.BindDrawable
;
import
io.reactivex.Observable
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.functions.Consumer
;
/**
/**
* 作者:ELEGANT_BIN
* 作者:ELEGANT_BIN
* 版本:1.6.0
* 版本:1.6.0
* 创建日期:2020-03-28
* 创建日期:2020-03-28
* 修订历史:2020-03-28
* 修订历史:2020-03-28
* 描述:
* 描述:打印進度彈窗
*
* @author admin
*/
*/
public
class
PrinterLoadingDialog
extends
BaseRetryDialog
{
public
class
PrinterLoadingDialog
extends
BaseRetryDialog
{
private
static
final
String
TAG
=
"PrinterLoadingDialog"
;
private
static
final
String
TAG
=
"PrinterLoadingDialog"
;
private
Context
mContext
;
private
Context
mContext
;
private
TextView
tvGeneratePrintData
,
tvConnecting
,
tvPrintResult
,
tvErrorMsg
;
private
TextView
tv_generate_print_data
,
tv_connecting
,
tv_print_result
,
tv_error_msg
;
public
static
final
byte
STATUS_DEFAULT
=
0
;
public
static
final
byte
STATUS_SUCCESS
=
1
;
public
static
final
byte
STATUS_ERROR
=
2
;
public
static
final
byte
status_default
=
0
;
public
static
final
byte
PROGRESS_CONNECTING
=
1
;
public
static
final
byte
status_success
=
1
;
public
static
final
byte
PROGRESS_PRINTING
=
2
;
public
static
final
byte
status_error
=
2
;
public
static
final
byte
PROGRESS_RESULT
=
3
;
private
int
mRadius
;
private
int
mRadius
;
private
float
mShadowAlpha
=
0.25f
;
/**
private
int
mShadowElevationDp
=
14
;
* 結果樣式
*/
private
Drawable
[]
drawables
;
/**
* 進度顯示文字
*/
private
TextView
[]
textViews
;
public
PrinterLoadingDialog
(
@NonNull
Context
context
)
{
public
PrinterLoadingDialog
(
@NonNull
Context
context
)
{
super
(
context
,
R
.
style
.
MyDialogTheme2
);
super
(
context
,
R
.
style
.
MyDialogTheme2
);
mContext
=
context
;
mContext
=
context
;
mRadius
=
QMUIDisplayHelper
.
dp2px
(
mContext
,
8
);
mRadius
=
QMUIDisplayHelper
.
dp2px
(
mContext
,
8
);
drawables
=
new
Drawable
[
3
];
drawables
[
0
]
=
getDrawableByResId
(
R
.
drawable
.
print_grey_point
);
drawables
[
1
]
=
getDrawableByResId
(
R
.
drawable
.
print_green_point
);
drawables
[
2
]
=
getDrawableByResId
(
R
.
drawable
.
print_red_point
);
}
}
@Override
@Override
...
@@ -75,7 +80,7 @@ public class PrinterLoadingDialog extends BaseRetryDialog {
...
@@ -75,7 +80,7 @@ public class PrinterLoadingDialog extends BaseRetryDialog {
public
PrinterLoadingDialog
build
()
{
public
PrinterLoadingDialog
build
()
{
View
contentView
=
buildViews
();
View
contentView
=
buildViews
();
int
screenWidth
=
(
int
)
(
QMUIDisplayHelper
.
getScreenWidth
(
mContext
)
*
0.
85
);
int
screenWidth
=
(
int
)
(
QMUIDisplayHelper
.
getScreenWidth
(
mContext
)
*
0.
9
);
int
screenHeight
=
(
int
)
(
QMUIDisplayHelper
.
getScreenHeight
(
mContext
)
*
0.5
);
int
screenHeight
=
(
int
)
(
QMUIDisplayHelper
.
getScreenHeight
(
mContext
)
*
0.5
);
setContentView
(
contentView
,
new
LinearLayout
.
LayoutParams
(
screenWidth
,
screenHeight
));
setContentView
(
contentView
,
new
LinearLayout
.
LayoutParams
(
screenWidth
,
screenHeight
));
return
this
;
return
this
;
...
@@ -83,91 +88,64 @@ public class PrinterLoadingDialog extends BaseRetryDialog {
...
@@ -83,91 +88,64 @@ public class PrinterLoadingDialog extends BaseRetryDialog {
private
View
buildViews
()
{
private
View
buildViews
()
{
View
view
=
View
.
inflate
(
mContext
,
getContentViewLayoutId
(),
null
);
View
view
=
View
.
inflate
(
mContext
,
getContentViewLayoutId
(),
null
);
QMUILinearLayout
ll
_c
ontainer
=
view
.
findViewById
(
R
.
id
.
ll_container
);
QMUILinearLayout
ll
C
ontainer
=
view
.
findViewById
(
R
.
id
.
ll_container
);
LottieAnimationView
printLottieView
=
view
.
findViewById
(
R
.
id
.
lottieAnimationView
);
LottieAnimationView
printLottieView
=
view
.
findViewById
(
R
.
id
.
lottieAnimationView
);
tv_generate_print_data
=
view
.
findViewById
(
R
.
id
.
tv_generate_print_data
);
tvGeneratePrintData
=
view
.
findViewById
(
R
.
id
.
tv_generate_print_data
);
tv_connecting
=
view
.
findViewById
(
R
.
id
.
tv_connecting
);
tvConnecting
=
view
.
findViewById
(
R
.
id
.
tv_connecting
);
tv_print_result
=
view
.
findViewById
(
R
.
id
.
tv_print_result
);
tvPrintResult
=
view
.
findViewById
(
R
.
id
.
tv_print_result
);
tv_error_msg
=
view
.
findViewById
(
R
.
id
.
tv_error_msg
);
tvErrorMsg
=
view
.
findViewById
(
R
.
id
.
tv_error_msg
);
textViews
=
new
TextView
[]{
tvGeneratePrintData
,
tvConnecting
,
tvPrintResult
};
ll_container
.
setRadiusAndShadow
(
mRadius
,
QMUIDisplayHelper
.
dp2px
(
mContext
,
mShadowElevationDp
),
mShadowAlpha
);
float
mShadowAlpha
=
0.25f
;
int
mShadowElevationDp
=
14
;
llContainer
.
setRadiusAndShadow
(
mRadius
,
QMUIDisplayHelper
.
dp2px
(
mContext
,
mShadowElevationDp
),
mShadowAlpha
);
printLottieView
.
setAnimation
(
R
.
raw
.
printer_loading3
);
printLottieView
.
setAnimation
(
R
.
raw
.
printer_loading3
);
printLottieView
.
loop
(
true
);
printLottieView
.
setRepeatCount
(
ValueAnimator
.
INFINITE
);
// printLottieView.addAnimatorUpdateListener((animation) -> {
// // Do something.动画状态监听回调
//
// });
printLottieView
.
playAnimation
();
//播放动画
printLottieView
.
playAnimation
();
//播放动画
return
view
;
return
view
;
}
}
public
void
setStep
(
int
step
,
int
status
,
String
errorMsg
)
{
public
void
setStep
(
int
step
,
int
status
,
String
errorMsg
)
{
tv_generate_print_data
.
post
(
new
Runnable
()
{
tvGeneratePrintData
.
post
(()
->
{
@Override
if
(!
TextUtils
.
isEmpty
(
errorMsg
))
{
public
void
run
()
{
tvErrorMsg
.
setText
(
errorMsg
);
if
(!
TextUtils
.
isEmpty
(
errorMsg
))
{
tvErrorMsg
.
setVisibility
(
View
.
VISIBLE
);
tv_error_msg
.
setText
(
errorMsg
);
}
else
{
tv_error_msg
.
setVisibility
(
View
.
VISIBLE
);
tvErrorMsg
.
setVisibility
(
View
.
GONE
);
}
else
{
tv_error_msg
.
setVisibility
(
View
.
GONE
);
}
switch
(
step
)
{
case
1
:
if
(
status
==
PrinterLoadingDialog
.
status_success
)
{
tv_generate_print_data
.
setCompoundDrawables
(
null
,
getDrawableByResId
(
R
.
drawable
.
print_green_point
),
null
,
null
);
}
else
if
(
status
==
PrinterLoadingDialog
.
status_error
)
{
tv_generate_print_data
.
setCompoundDrawables
(
null
,
getDrawableByResId
(
R
.
drawable
.
print_red_point
),
null
,
null
);
}
else
{
tv_generate_print_data
.
setCompoundDrawables
(
null
,
getDrawableByResId
(
R
.
drawable
.
print_grey_point
),
null
,
null
);
}
break
;
case
2
:
tv_generate_print_data
.
setCompoundDrawables
(
null
,
getDrawableByResId
(
R
.
drawable
.
print_green_point
),
null
,
null
);
if
(
status
==
PrinterLoadingDialog
.
status_success
)
{
tv_connecting
.
setCompoundDrawables
(
null
,
getDrawableByResId
(
R
.
drawable
.
print_green_point
),
null
,
null
);
}
else
if
(
status
==
PrinterLoadingDialog
.
status_error
)
{
tv_connecting
.
setCompoundDrawables
(
null
,
getDrawableByResId
(
R
.
drawable
.
print_red_point
),
null
,
null
);
}
else
{
tv_connecting
.
setCompoundDrawables
(
null
,
getDrawableByResId
(
R
.
drawable
.
print_grey_point
),
null
,
null
);
}
break
;
case
3
:
if
(
status
==
PrinterLoadingDialog
.
status_success
)
{
tv_print_result
.
setCompoundDrawables
(
null
,
getDrawableByResId
(
R
.
drawable
.
print_green_point
),
null
,
null
);
}
else
if
(
status
==
PrinterLoadingDialog
.
status_error
)
{
tv_print_result
.
setCompoundDrawables
(
null
,
getDrawableByResId
(
R
.
drawable
.
print_red_point
),
null
,
null
);
}
else
{
tv_print_result
.
setCompoundDrawables
(
null
,
getDrawableByResId
(
R
.
drawable
.
print_grey_point
),
null
,
null
);
}
break
;
default
:
break
;
}
setStatusResult
(
step
,
status
);
}
}
//根據狀態修改顯示顏色
if
(
step
==
PROGRESS_PRINTING
)
{
setCompoundDrawableByStatus
(
STATUS_SUCCESS
,
tvGeneratePrintData
);
setCompoundDrawableByStatus
(
status
,
tvConnecting
);
}
else
{
setCompoundDrawableByStatus
(
status
,
textViews
[
step
-
1
]);
}
//設置結果
setStatusResult
(
step
,
status
);
});
});
}
}
private
void
setStatusResult
(
int
step
,
int
status
)
{
private
void
setStatusResult
(
int
step
,
int
status
)
{
switch
(
step
)
{
switch
(
step
)
{
case
2
:
case
PrinterLoadingDialog
.
PROGRESS_PRINTING
:
tv
_generate_print_d
ata
.
setText
(
"生成成功"
);
tv
GeneratePrintD
ata
.
setText
(
"生成成功"
);
if
(
status
==
PrinterLoadingDialog
.
status_success
)
{
if
(
status
==
STATUS_SUCCESS
)
{
tv
_c
onnecting
.
setText
(
"連接成功"
);
tv
C
onnecting
.
setText
(
"連接成功"
);
}
else
if
(
status
==
PrinterLoadingDialog
.
status_error
)
{
}
else
if
(
status
==
STATUS_ERROR
)
{
tv
_c
onnecting
.
setText
(
"連接失敗"
);
tv
C
onnecting
.
setText
(
"連接失敗"
);
}
else
{
}
else
{
tv
_c
onnecting
.
setText
(
"連接中"
);
tv
C
onnecting
.
setText
(
"連接中"
);
}
}
break
;
break
;
case
3
:
case
PrinterLoadingDialog
.
PROGRESS_RESULT
:
if
(
status
==
PrinterLoadingDialog
.
status_success
)
{
if
(
status
==
STATUS_SUCCESS
)
{
tv
_c
onnecting
.
setText
(
"打印成功"
);
tv
C
onnecting
.
setText
(
"打印成功"
);
}
else
if
(
status
==
PrinterLoadingDialog
.
status_error
)
{
}
else
if
(
status
==
STATUS_ERROR
)
{
tv
_c
onnecting
.
setText
(
"打印失敗"
);
tv
C
onnecting
.
setText
(
"打印失敗"
);
}
else
{
}
else
{
tv
_c
onnecting
.
setText
(
"打印結果"
);
tv
C
onnecting
.
setText
(
"打印結果"
);
}
}
break
;
break
;
default
:
default
:
...
@@ -175,29 +153,15 @@ public class PrinterLoadingDialog extends BaseRetryDialog {
...
@@ -175,29 +153,15 @@ public class PrinterLoadingDialog extends BaseRetryDialog {
}
}
}
}
private
void
setCompoundDrawableByStatus
(
int
status
,
TextView
textView
)
{
textView
.
setCompoundDrawablesWithIntrinsicBounds
(
textView
.
getCompoundDrawables
()[
0
],
drawables
[
status
],
textView
.
getCompoundDrawables
()[
2
],
textView
.
getCompoundDrawables
()[
0
]);
}
private
Drawable
getDrawableByResId
(
int
resId
)
{
private
Drawable
getDrawableByResId
(
int
resId
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
return
ContextCompat
.
getDrawable
(
mContext
,
resId
);
Drawable
drawable
=
mContext
.
getDrawable
(
resId
);
drawable
.
setBounds
(
0
,
0
,
drawable
.
getMinimumWidth
(),
drawable
.
getMinimumHeight
());
return
drawable
;
}
Drawable
drawable
=
mContext
.
getResources
().
getDrawable
(
resId
);
drawable
.
setBounds
(
0
,
0
,
drawable
.
getMinimumWidth
(),
drawable
.
getMinimumHeight
());
return
drawable
;
}
}
protected
int
getContentViewLayoutId
()
{
protected
int
getContentViewLayoutId
()
{
return
R
.
layout
.
print_dialog_loading
;
return
R
.
layout
.
print_dialog_loading
;
}
}
private
OnClickListener
onClickListener
;
public
void
setOnClickListener
(
OnClickListener
onClickListener
)
{
this
.
onClickListener
=
onClickListener
;
}
public
interface
OnClickListener
{
// void onItemClick(FoodReason item, int position, int deleteNumber);
}
}
}
component-print/src/main/res/layout/print_dialog_loading.xml
View file @
da8dbb14
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<com.qmuiteam.qmui.layout.QMUILinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<com.qmuiteam.qmui.layout.QMUILinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/ll_container"
android:id=
"@+id/ll_container"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:gravity=
"center"
android:background=
"@color/theme_white_color"
android:background=
"@color/theme_white_color"
android:gravity=
"center"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<com.airbnb.lottie.LottieAnimationView
<com.airbnb.lottie.LottieAnimationView
...
@@ -69,7 +70,7 @@
...
@@ -69,7 +70,7 @@
android:layout_marginTop=
"@dimen/dp_10"
android:layout_marginTop=
"@dimen/dp_10"
android:textColor=
"@color/red"
android:textColor=
"@color/red"
android:textSize=
"@dimen/font_small"
android:textSize=
"@dimen/font_small"
android:text=
"連接打印機超時"
/>
tools:text=
"連接打印機超時"
/>
</com.qmuiteam.qmui.layout.QMUILinearLayout>
</com.qmuiteam.qmui.layout.QMUILinearLayout>
\ No newline at end of file
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/NewFoodIngredientsPresenter.java
View file @
da8dbb14
...
@@ -202,7 +202,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
...
@@ -202,7 +202,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
infoMultiBeans
.
add
(
new
InfoMultiBean
(
InfoMultiBean
.
ITEM_TYPE_LINE
));
infoMultiBeans
.
add
(
new
InfoMultiBean
(
InfoMultiBean
.
ITEM_TYPE_LINE
));
infoMultiBeans
.
add
(
new
InfoMultiBean
(
InfoMultiBean
.
ITEM_TYPE_TITLE
,
"基本信息"
));
infoMultiBeans
.
add
(
new
InfoMultiBean
(
InfoMultiBean
.
ITEM_TYPE_TITLE
,
"基本信息"
));
infoMultiBeans
.
add
(
new
MultiSelectBean
(
InfoMultiBean
.
EDIT_FOOD_ITEM_SELECT
,
"所屬供應商"
,
true
,
"請輸入/選擇供應商"
,
SELECT_SUPPLIER_RESULTCODE
,
true
,
new
InputFilter
[]{
InputFilterUtils
.
getLengthFilter
(
context
,
16
),
InputFilterUtils
.
getChAndEnAndNumInputFilter
(
context
)},
SupplierListFragment
.
class
));
infoMultiBeans
.
add
(
new
MultiSelectBean
(
InfoMultiBean
.
EDIT_FOOD_ITEM_SELECT
,
"所屬供應商"
,
true
,
"請輸入/選擇供應商"
,
SELECT_SUPPLIER_RESULTCODE
,
true
,
new
InputFilter
[]{
InputFilterUtils
.
getLengthFilter
(
context
,
16
),
InputFilterUtils
.
getChAndEnAndNumInputFilter
(
context
)},
SupplierListFragment
.
class
));
infoMultiBeans
.
add
(
new
MultiInputBean
(
InfoMultiBean
.
ITEM_TYPE_INPUT
,
"食材名稱"
,
true
,
"請輸入名稱"
,
new
InputFilter
[]{
InputFilterUtils
.
getLengthFilter
(
context
,
1
6
),
InputFilterUtils
.
getChAndEnAndNum
InputFilter
(
context
)}));
infoMultiBeans
.
add
(
new
MultiInputBean
(
InfoMultiBean
.
ITEM_TYPE_INPUT
,
"食材名稱"
,
true
,
"請輸入名稱"
,
new
InputFilter
[]{
InputFilterUtils
.
getLengthFilter
(
context
,
1
00
),
InputFilterUtils
.
getChAndEnAndNumAndPt
InputFilter
(
context
)}));
infoMultiBeans
.
add
(
new
MultiSelectBean
(
InfoMultiBean
.
EDIT_FOOD_ITEM_SELECT
,
"食材類別"
,
true
,
"請選擇食材類別"
,
SELECT_FOOD_CATEGORY_REQUEST_CODE
,
CategorySelectFragment
.
class
));
infoMultiBeans
.
add
(
new
MultiSelectBean
(
InfoMultiBean
.
EDIT_FOOD_ITEM_SELECT
,
"食材類別"
,
true
,
"請選擇食材類別"
,
SELECT_FOOD_CATEGORY_REQUEST_CODE
,
CategorySelectFragment
.
class
));
infoMultiBeans
.
add
(
new
MultiSelectBean
(
InfoMultiBean
.
EDIT_FOOD_ITEM_SELECT
,
"基本單位"
,
true
,
"請選擇食材單位"
,
SELECT_PACKAGE_SPECIFICATION_REQUEST_CODE
,
FoodUnitPageFragment
.
class
));
infoMultiBeans
.
add
(
new
MultiSelectBean
(
InfoMultiBean
.
EDIT_FOOD_ITEM_SELECT
,
"基本單位"
,
true
,
"請選擇食材單位"
,
SELECT_PACKAGE_SPECIFICATION_REQUEST_CODE
,
FoodUnitPageFragment
.
class
));
infoMultiBeans
.
add
(
new
MultiInputBean
(
InfoMultiBean
.
ITEM_TYPE_INPUT
,
"包裝說明"
,
false
,
"請輸入包裝說明"
,
new
InputFilter
[]{
InputFilterUtils
.
getLengthFilter
(
context
,
10
),
InputFilterUtils
.
getTypeFilter
(
context
,
InputFilterUtils
.
chAndEnAndNumAndSlash
)}));
infoMultiBeans
.
add
(
new
MultiInputBean
(
InfoMultiBean
.
ITEM_TYPE_INPUT
,
"包裝說明"
,
false
,
"請輸入包裝說明"
,
new
InputFilter
[]{
InputFilterUtils
.
getLengthFilter
(
context
,
10
),
InputFilterUtils
.
getTypeFilter
(
context
,
InputFilterUtils
.
chAndEnAndNumAndSlash
)}));
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/NewSupplierPresenter.java
View file @
da8dbb14
...
@@ -134,7 +134,7 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
...
@@ -134,7 +134,7 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
infoMultiBeans
.
add
(
new
InfoMultiBean
(
InfoMultiBean
.
ITEM_TYPE_LINE
));
infoMultiBeans
.
add
(
new
InfoMultiBean
(
InfoMultiBean
.
ITEM_TYPE_LINE
));
infoMultiBeans
.
add
(
new
InfoMultiBean
(
InfoMultiBean
.
ITEM_TYPE_TITLE
,
"基本信息"
));
infoMultiBeans
.
add
(
new
InfoMultiBean
(
InfoMultiBean
.
ITEM_TYPE_TITLE
,
"基本信息"
));
infoMultiBeans
.
add
(
new
MultiInputBean
(
InfoMultiBean
.
ITEM_TYPE_INPUT
,
"供應商編號"
,
false
,
"請輸入編號"
,
new
InputFilter
[]{
new
InputFilter
.
LengthFilter
(
11
),
new
EnAndNumInputFilter
()}));
infoMultiBeans
.
add
(
new
MultiInputBean
(
InfoMultiBean
.
ITEM_TYPE_INPUT
,
"供應商編號"
,
false
,
"請輸入編號"
,
new
InputFilter
[]{
new
InputFilter
.
LengthFilter
(
11
),
new
EnAndNumInputFilter
()}));
infoMultiBeans
.
add
(
new
MultiInputBean
(
InfoMultiBean
.
ITEM_TYPE_INPUT
,
"名稱"
,
true
,
"請輸入名稱"
,
new
InputFilter
[]{
InputFilterUtils
.
getLengthFilter
(
mContext
,
20
),
InputFilterUtils
.
getChAndEnAndNum
InputFilter
(
mContext
)},
mSupplierNameChangeListener
));
infoMultiBeans
.
add
(
new
MultiInputBean
(
InfoMultiBean
.
ITEM_TYPE_INPUT
,
"名稱"
,
true
,
"請輸入名稱"
,
new
InputFilter
[]{
InputFilterUtils
.
getLengthFilter
(
mContext
,
100
),
InputFilterUtils
.
getChAndEnAndNumAndPt
InputFilter
(
mContext
)},
mSupplierNameChangeListener
));
infoMultiBeans
.
add
(
new
MultiInputBean
(
InfoMultiBean
.
ITEM_TYPE_INPUT
,
"聯繫人"
,
true
,
"請輸入聯繫人"
,
new
InputFilter
[]{
InputFilterUtils
.
getLengthFilter
(
mContext
,
20
),
InputFilterUtils
.
getChAndEnAndNumInputFilter
(
mContext
)}));
infoMultiBeans
.
add
(
new
MultiInputBean
(
InfoMultiBean
.
ITEM_TYPE_INPUT
,
"聯繫人"
,
true
,
"請輸入聯繫人"
,
new
InputFilter
[]{
InputFilterUtils
.
getLengthFilter
(
mContext
,
20
),
InputFilterUtils
.
getChAndEnAndNumInputFilter
(
mContext
)}));
infoMultiBeans
.
add
(
new
MultiInputBean
(
InfoMultiBean
.
ITEM_TYPE_INPUT
,
"詳細地址"
,
true
,
"請輸入詳細地址"
,
new
InputFilter
[]{
InputFilterUtils
.
getLengthFilter
(
mContext
,
20
),
InputFilterUtils
.
getChAndEnAndNumInputFilter
(
mContext
)}));
infoMultiBeans
.
add
(
new
MultiInputBean
(
InfoMultiBean
.
ITEM_TYPE_INPUT
,
"詳細地址"
,
true
,
"請輸入詳細地址"
,
new
InputFilter
[]{
InputFilterUtils
.
getLengthFilter
(
mContext
,
20
),
InputFilterUtils
.
getChAndEnAndNumInputFilter
(
mContext
)}));
infoMultiBeans
.
add
(
new
MultiInputBean
(
InfoMultiBean
.
ITEM_TYPE_INPUT
,
"聯繫人電話"
,
true
,
"請輸入聯繫人電話"
,
new
InputFilter
[]{
InputFilterUtils
.
getLengthFilter
(
mContext
,
11
)},
EditorInfo
.
TYPE_CLASS_PHONE
));
infoMultiBeans
.
add
(
new
MultiInputBean
(
InfoMultiBean
.
ITEM_TYPE_INPUT
,
"聯繫人電話"
,
true
,
"請輸入聯繫人電話"
,
new
InputFilter
[]{
InputFilterUtils
.
getLengthFilter
(
mContext
,
11
)},
EditorInfo
.
TYPE_CLASS_PHONE
));
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/fragment/food/FoodUnitPageFragment.java
View file @
da8dbb14
...
@@ -165,7 +165,7 @@ public class FoodUnitPageFragment extends BaseSupplyChainFragment<FoodUnitPagePr
...
@@ -165,7 +165,7 @@ public class FoodUnitPageFragment extends BaseSupplyChainFragment<FoodUnitPagePr
basicUnitAdapter
.
setOnItemClickListener
((
adapter
,
view
,
position
)
->
{
basicUnitAdapter
.
setOnItemClickListener
((
adapter
,
view
,
position
)
->
{
if
(
position
==
basicUnitAdapter
.
getItemCount
()
-
1
)
{
if
(
position
==
basicUnitAdapter
.
getItemCount
()
-
1
)
{
//新增
//新增
EditTextPopup
popup
=
new
EditTextPopup
(
requireContext
(),
new
InputFilter
[]{
InputFilterUtils
.
getLengthFilter
(
mContext
,
4
),
InputFilterUtils
.
getChAndEnAndNum
InputFilter
(
mContext
)});
EditTextPopup
popup
=
new
EditTextPopup
(
requireContext
(),
new
InputFilter
[]{
InputFilterUtils
.
getLengthFilter
(
mContext
,
5
),
InputFilterUtils
.
getEnAndCh
InputFilter
(
mContext
)});
popup
.
setListener
(
text
->
{
popup
.
setListener
(
text
->
{
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
text
))
{
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
text
))
{
mPresenter
.
addBasicUnit
(
text
,
basicUnitAdapter
.
getData
());
mPresenter
.
addBasicUnit
(
text
,
basicUnitAdapter
.
getData
());
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/widget/CategoryPopup.java
View file @
da8dbb14
...
@@ -28,7 +28,7 @@ public class CategoryPopup extends ConfirmPopupView {
...
@@ -28,7 +28,7 @@ public class CategoryPopup extends ConfirmPopupView {
private
EditText
et_input
;
private
EditText
et_input
;
private
OnClickListener
onDeleteListener
;
private
OnClickListener
onDeleteListener
;
private
String
inputText
;
private
String
inputText
;
private
final
int
nameMaxLength
=
4
;
private
final
int
nameMaxLength
=
100
;
public
CategoryPopup
(
@NonNull
Context
context
,
CharSequence
title
,
CharSequence
content
,
CharSequence
hint
,
String
inputText
,
boolean
showDelete
)
{
public
CategoryPopup
(
@NonNull
Context
context
,
CharSequence
title
,
CharSequence
content
,
CharSequence
hint
,
String
inputText
,
boolean
showDelete
)
{
super
(
context
,
R
.
layout
.
dialog_new_category
);
super
(
context
,
R
.
layout
.
dialog_new_category
);
...
@@ -45,15 +45,15 @@ public class CategoryPopup extends ConfirmPopupView {
...
@@ -45,15 +45,15 @@ public class CategoryPopup extends ConfirmPopupView {
tvDelete
.
setVisibility
(
showDelete
?
View
.
VISIBLE
:
GONE
);
tvDelete
.
setVisibility
(
showDelete
?
View
.
VISIBLE
:
GONE
);
tvDelete
.
setOnClickListener
(
onDeleteListener
);
tvDelete
.
setOnClickListener
(
onDeleteListener
);
et_input
=
findViewById
(
R
.
id
.
et_input
);
et_input
=
findViewById
(
R
.
id
.
et_input
);
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
inputText
))
{
//
if (TextUtil.isNotEmptyOrNullOrUndefined(inputText)) {
if
(
inputText
.
length
()
>
nameMaxLength
)
{
//
if (inputText.length() > nameMaxLength) {
et_input
.
setText
(
inputText
.
substring
(
0
,
4
));
//
et_input.setText(inputText.substring(0, 4));
}
else
{
//
} else {
et_input
.
setText
(
inputText
);
//
et_input.setText(inputText);
}
//
}
et_input
.
setSelection
(
et_input
.
length
());
//
et_input.setSelection(et_input.length());
}
//
}
et_input
.
setFilters
(
new
InputFilter
[]{
InputFilterUtils
.
getLengthFilter
(
getContext
(),
4
),
InputFilterUtils
.
getChAndEnAndNum
InputFilter
(
getContext
())});
et_input
.
setFilters
(
new
InputFilter
[]{
InputFilterUtils
.
getLengthFilter
(
getContext
(),
100
),
InputFilterUtils
.
getChAndEnAndNumAndPt
InputFilter
(
getContext
())});
}
}
public
EditText
getEditText
()
{
public
EditText
getEditText
()
{
...
...
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/ui/activity/OrderContentActivity.java
View file @
da8dbb14
...
@@ -55,6 +55,7 @@ import com.jess.arms.di.component.AppComponent;
...
@@ -55,6 +55,7 @@ import com.jess.arms.di.component.AppComponent;
import
com.jess.arms.integration.AppManager
;
import
com.jess.arms.integration.AppManager
;
import
com.jess.arms.utils.ArmsUtils
;
import
com.jess.arms.utils.ArmsUtils
;
import
com.qmuiteam.qmui.alpha.QMUIAlphaButton
;
import
com.qmuiteam.qmui.alpha.QMUIAlphaButton
;
import
com.qmuiteam.qmui.alpha.QMUIAlphaTextView
;
import
com.qmuiteam.qmui.arch.QMUIFragmentPagerAdapter
;
import
com.qmuiteam.qmui.arch.QMUIFragmentPagerAdapter
;
import
com.qmuiteam.qmui.util.QMUIDisplayHelper
;
import
com.qmuiteam.qmui.util.QMUIDisplayHelper
;
import
com.qmuiteam.qmui.widget.popup.QMUIPopup
;
import
com.qmuiteam.qmui.widget.popup.QMUIPopup
;
...
@@ -114,7 +115,9 @@ public class OrderContentActivity extends BaseFragmentActivity<OrderContentPrese
...
@@ -114,7 +115,9 @@ public class OrderContentActivity extends BaseFragmentActivity<OrderContentPrese
@BindView
(
R2
.
id
.
tv_time
)
@BindView
(
R2
.
id
.
tv_time
)
TextView
tv_time
;
TextView
tv_time
;
@BindView
(
R2
.
id
.
btn_people_num
)
@BindView
(
R2
.
id
.
btn_people_num
)
QMUIAlphaButton
btn_people_num
;
QMUIAlphaTextView
btn_people_num
;
@BindView
(
R2
.
id
.
tv_order_no
)
TextView
tvOrderNo
;
@BindView
(
R2
.
id
.
rv_top_function
)
@BindView
(
R2
.
id
.
rv_top_function
)
RecyclerView
rv_top_function
;
RecyclerView
rv_top_function
;
@BindView
(
R2
.
id
.
rv_food
)
@BindView
(
R2
.
id
.
rv_food
)
...
@@ -221,10 +224,11 @@ public class OrderContentActivity extends BaseFragmentActivity<OrderContentPrese
...
@@ -221,10 +224,11 @@ public class OrderContentActivity extends BaseFragmentActivity<OrderContentPrese
private
void
initTopInfo
()
{
private
void
initTopInfo
()
{
if
(
BaseOrder
.
isCurrentOrderType
(
FoodSummaryConstans
.
TAKEAWAY_TYPE
))
{
if
(
BaseOrder
.
isCurrentOrderType
(
FoodSummaryConstans
.
TAKEAWAY_TYPE
))
{
btn_table
.
setText
(
"外賣"
);
btn_table
.
setText
(
"外賣"
);
btn_people_num
.
setText
(
"1"
);
btn_people_num
.
setText
(
String
.
format
(
getString
(
R
.
string
.
meal_numberman_colon
),
1
)
);
tv_time
.
setText
(
"時間:"
+
TimeUtils
.
getCurrentDate
(
TimeUtils
.
DATE_FORMAT_DATE_HM
));
tv_time
.
setText
(
"時間:"
+
TimeUtils
.
getCurrentDate
(
TimeUtils
.
DATE_FORMAT_DATE_HM
));
tv_server_main
.
setText
(
""
);
tv_server_main
.
setText
(
""
);
}
else
{
tvOrderNo
.
setVisibility
(
View
.
GONE
);
}
else
{
TableBean
.
DataBean
tableInfo
=
mDoshokuOrder
.
getOpenTableInfo
();
TableBean
.
DataBean
tableInfo
=
mDoshokuOrder
.
getOpenTableInfo
();
Date
dd
=
mDoshokuOrder
.
getOpenTableTime
();
Date
dd
=
mDoshokuOrder
.
getOpenTableTime
();
String
openTime
=
String
.
format
(
"%tH:%tM"
,
dd
,
dd
);
String
openTime
=
String
.
format
(
"%tH:%tM"
,
dd
,
dd
);
...
@@ -235,7 +239,8 @@ public class OrderContentActivity extends BaseFragmentActivity<OrderContentPrese
...
@@ -235,7 +239,8 @@ public class OrderContentActivity extends BaseFragmentActivity<OrderContentPrese
tableno
=
tableInfo
.
getTableName
();
tableno
=
tableInfo
.
getTableName
();
}
}
btn_table
.
setText
(
tableno
);
btn_table
.
setText
(
tableno
);
btn_people_num
.
setText
(
tableInfo
.
getPerson
()
+
""
);
tvOrderNo
.
setText
(
String
.
format
(
getString
(
R
.
string
.
meal_order_number
),
DoshokuOrder
.
getInstance
().
getOrderNo
()));
btn_people_num
.
setText
(
String
.
format
(
getString
(
R
.
string
.
meal_numberman_colon
),
tableInfo
.
getPerson
()));
tv_time
.
setText
(
"時間:"
+
openTime
);
tv_time
.
setText
(
"時間:"
+
openTime
);
tv_server_main
.
setText
(
UserContext
.
newInstance
().
getMemberName
());
tv_server_main
.
setText
(
UserContext
.
newInstance
().
getMemberName
());
}
}
...
@@ -317,10 +322,11 @@ public class OrderContentActivity extends BaseFragmentActivity<OrderContentPrese
...
@@ -317,10 +322,11 @@ public class OrderContentActivity extends BaseFragmentActivity<OrderContentPrese
@Override
@Override
public
void
showLoading
(
String
message
)
{
public
void
showLoading
(
String
message
)
{
if
(
message
!=
null
)
if
(
message
!=
null
)
{
LoadingDialog
.
showDialogForLoading
(
this
,
message
,
true
);
LoadingDialog
.
showDialogForLoading
(
this
,
message
,
true
);
else
}
else
{
LoadingDialog
.
showDialogForLoading
(
this
);
LoadingDialog
.
showDialogForLoading
(
this
);
}
}
}
@Override
@Override
...
...
component-table/src/main/res/layout/table_activity_order_content.xml
View file @
da8dbb14
...
@@ -20,19 +20,19 @@
...
@@ -20,19 +20,19 @@
android:gravity=
"center_vertical"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
>
android:orientation=
"horizontal"
>
<!-- <com.qmuiteam.qmui.alpha.QMUIAlphaButton-->
<!-- <com.qmuiteam.qmui.alpha.QMUIAlphaButton-->
<!-- android:id="@+id/btn_table"-->
<!-- android:id="@+id/btn_table"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_weight="1"-->
<!-- android:layout_weight="1"-->
<!-- android:drawableLeft="@drawable/qmui_icon_topbar_back"-->
<!-- android:drawableLeft="@drawable/qmui_icon_topbar_back"-->
<!-- android:text="105A-2"-->
<!-- android:text="105A-2"-->
<!-- android:background="#096791"-->
<!-- android:background="#096791"-->
<!-- android:paddingLeft="@dimen/dp_5"-->
<!-- android:paddingLeft="@dimen/dp_5"-->
<!-- android:gravity="center_vertical"-->
<!-- android:gravity="center_vertical"-->
<!-- android:textColor="@color/theme_white_color"-->
<!-- android:textColor="@color/theme_white_color"-->
<!-- android:textSize="@dimen/font_large"-->
<!-- android:textSize="@dimen/font_large"-->
<!-- android:textStyle="bold" />-->
<!-- android:textStyle="bold" />-->
<LinearLayout
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
...
@@ -43,10 +43,10 @@
...
@@ -43,10 +43,10 @@
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"#096791"
android:background=
"#096791"
android:paddingRight=
"@dimen/dp_10"
android:drawableLeft=
"@drawable/qmui_icon_topbar_back"
android:drawableLeft=
"@drawable/qmui_icon_topbar_back"
android:gravity=
"center_vertical"
android:gravity=
"center_vertical"
android:paddingLeft=
"@dimen/dp_5"
android:paddingLeft=
"@dimen/dp_5"
android:paddingRight=
"@dimen/dp_10"
android:text=
"外賣"
android:text=
"外賣"
android:textColor=
"@color/theme_white_color"
android:textColor=
"@color/theme_white_color"
android:textSize=
"@dimen/font_large"
android:textSize=
"@dimen/font_large"
...
@@ -56,51 +56,67 @@
...
@@ -56,51 +56,67 @@
android:id=
"@+id/tv_action_name"
android:id=
"@+id/tv_action_name"
android:layout_width=
"@dimen/dp_60"
android:layout_width=
"@dimen/dp_60"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:gravity=
"center"
android:background=
"#C50000"
android:background=
"#C50000"
android:gravity=
"center"
android:text=
"結賬"
android:text=
"結賬"
android:
visibility=
"gone
"
android:
textColor=
"@color/theme_white_color
"
android:textSize=
"@dimen/sp_18"
android:textSize=
"@dimen/sp_18"
android:
textColor=
"@color/theme_white_color"
/>
android:
visibility=
"gone"
/>
</LinearLayout>
</LinearLayout>
<RelativeLayout
<RelativeLayout
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
android:layout_weight=
"1"
android:
paddingLeft=
"@dimen/dp_5
"
android:
background=
"#0E655F
"
android:gravity=
"center_vertical"
android:gravity=
"center_vertical"
android:
background=
"#0E655F
"
>
android:
paddingLeft=
"@dimen/dp_5
"
>
<TextView
<TextView
android:id=
"@+id/tv_server_main"
android:id=
"@+id/tv_server_main"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:textColor=
"@color/theme_white_color"
android:text=
"Andy Lam"
android:textColor=
"@color/theme_white_color"
android:textSize=
"@dimen/font_normal3"
android:textSize=
"@dimen/font_normal3"
android:textStyle=
"bold"
android:textStyle=
"bold"
/>
android:text=
"Andy Lam"
/>
<TextView
<TextView
android:id=
"@+id/tv_time"
android:id=
"@+id/tv_time"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/tv_server_main"
android:layout_below=
"@+id/tv_server_main"
android:text
Size=
"@dimen/font_normal2
"
android:text
=
"時間:14:30
"
android:textColor=
"@color/theme_white_color"
android:textColor=
"@color/theme_white_color"
android:text
=
"時間:14:30"
/>
android:text
Size=
"@dimen/font_normal2"
/>
<com.qmuiteam.qmui.alpha.QMUIAlpha
Button
<com.qmuiteam.qmui.alpha.QMUIAlpha
TextView
android:id=
"@+id/btn_people_num"
android:id=
"@+id/btn_people_num"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"
match_par
ent"
android:layout_height=
"
wrap_cont
ent"
android:layout_alignParentRight=
"true"
android:layout_alignParentRight=
"true"
android:background=
"@color/trans"
android:background=
"@color/trans"
android:drawableLeft=
"@mipmap/meal_people_num_white"
android:drawableRight=
"@drawable/ic_white_edit"
android:text=
"1"
android:drawablePadding=
"@dimen/dp_4"
android:paddingLeft=
"@dimen/dp_5"
android:paddingRight=
"@dimen/dp_5"
android:text=
"@string/meal_numberman_colon"
android:textColor=
"@color/theme_white_color"
android:textColor=
"@color/theme_white_color"
android:textSize=
"@dimen/font_large"
android:textSize=
"@dimen/font_normal2"
android:textStyle=
"bold"
/>
android:textStyle=
"bold"
/>
<TextView
android:id=
"@+id/tv_order_no"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/tv_server_main"
android:layout_alignParentRight=
"true"
android:paddingLeft=
"@dimen/dp_5"
android:paddingRight=
"@dimen/dp_5"
android:text=
"@string/meal_order_number"
android:textColor=
"@color/theme_white_color"
android:textSize=
"@dimen/font_normal2"
android:textStyle=
"bold"
/>
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
...
@@ -110,106 +126,106 @@
...
@@ -110,106 +126,106 @@
android:layout_marginTop=
"@dimen/dp_50"
android:layout_marginTop=
"@dimen/dp_50"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<androidx.recyclerview.widget.RecyclerView
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_top_function"
android:id=
"@+id/rv_top_function"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
app:layoutManager=
"androidx.recyclerview.widget.LinearLayoutManager"
android:orientation=
"horizontal"
app:spanCount=
"3"
app:layoutManager=
"androidx.recyclerview.widget.LinearLayoutManager"
android:orientation=
"horizontal"
/>
app:spanCount=
"3"
/>
<androidx.recyclerview.widget.RecyclerView
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_food"
android:id=
"@+id/rv_food"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_height=
"0dp"
android:layout_weight=
"1"
android:layout_weight=
"1"
android:divider=
"@null"
android:background=
"@color/theme_white_color"
android:fadeScrollbars=
"false"
android:divider=
"@null"
android:orientation=
"vertical"
android:fadeScrollbars=
"false"
android:background=
"@color/theme_white_color"
android:orientation=
"vertical"
app:layoutManager=
"androidx.recyclerview.widget.LinearLayoutManager"
/>
app:layoutManager=
"androidx.recyclerview.widget.LinearLayoutManager"
/>
<TextView
android:id=
"@+id/tv_whole"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"合計 $1328.0"
android:textSize=
"@dimen/sp_20"
android:textStyle=
"bold"
android:textColor=
"@color/theme_text_color"
android:padding=
"@dimen/dp_10"
android:background=
"@color/theme_white_color"
android:gravity=
"right|center_vertical"
/>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_order_detail"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:divider=
"@null"
android:fadeScrollbars=
"false"
android:orientation=
"vertical"
app:layoutManager=
"androidx.recyclerview.widget.LinearLayoutManager"
/>
<LinearLayout
<TextView
android:layout_width=
"match_parent"
android:id=
"@+id/tv_whole"
android:layout_height=
"@dimen/dp_50"
android:layout_width=
"match_parent"
android:orientation=
"horizontal"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:background=
"@color/theme_white_color"
android:background=
"#006666"
android:gravity=
"right|center_vertical"
android:padding=
"@dimen/dp_5"
>
android:padding=
"@dimen/dp_10"
android:text=
"合計 $1328.0"
android:textColor=
"@color/theme_text_color"
android:textSize=
"@dimen/sp_20"
android:textStyle=
"bold"
/>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_order_detail"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:divider=
"@null"
android:fadeScrollbars=
"false"
android:orientation=
"vertical"
app:layoutManager=
"androidx.recyclerview.widget.LinearLayoutManager"
/>
<RelativeLayout
<LinearLayout
android:id=
"@+id/fl_order_content"
android:layout_width=
"match_parent"
android:layout_width=
"0dp"
android:layout_height=
"@dimen/dp_50"
android:layout_height=
"match_parent"
android:background=
"#006666"
android:layout_weight=
"1"
>
android:gravity=
"center"
android:orientation=
"horizontal"
android:padding=
"@dimen/dp_5"
>
<RelativeLayout
android:id=
"@+id/fl_order_content"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
>
<TextView
android:id=
"@+id/tv_total_text"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_gravity=
"left"
android:gravity=
"right|center_vertical"
android:paddingRight=
"@dimen/dp_10"
android:text=
"Total:"
android:textColor=
"@color/theme_white_color"
android:textSize=
"@dimen/font_large"
android:textStyle=
"bold"
/>
<Button
android:id=
"@+id/btn_order_count"
android:layout_width=
"30dp"
android:layout_height=
"30dp"
android:layout_margin=
"@dimen/dp_2"
android:layout_toRightOf=
"@+id/tv_total_text"
android:background=
"@drawable/ui_shape_red_oval"
android:gravity=
"center"
android:singleLine=
"true"
android:text=
""
android:textColor=
"@color/theme_white_color"
android:visibility=
"invisible"
/>
</RelativeLayout>
<TextView
<TextView
android:id=
"@+id/tv_total
_text
"
android:id=
"@+id/tv_total"
android:layout_width=
"
wrap_content
"
android:layout_width=
"
0dp
"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:text=
"Total:"
android:layout_gravity=
"right"
android:textSize=
"@dimen/font_large"
android:layout_weight=
"1"
android:textStyle=
"bold"
android:gravity=
"right|center_vertical"
android:layout_gravity=
"left"
android:paddingRight=
"@dimen/dp_8"
android:text=
"$1328.0"
android:textColor=
"@color/theme_white_color"
android:textColor=
"@color/theme_white_color"
android:paddingRight=
"@dimen/dp_10"
android:textSize=
"@dimen/font_large"
android:gravity=
"right|center_vertical"
/>
android:textStyle=
"bold"
/>
</LinearLayout>
<Button
android:id=
"@+id/btn_order_count"
android:layout_width=
"30dp"
android:layout_height=
"30dp"
android:background=
"@drawable/ui_shape_red_oval"
android:singleLine=
"true"
android:gravity=
"center"
android:text=
""
android:layout_margin=
"@dimen/dp_2"
android:layout_toRightOf=
"@+id/tv_total_text"
android:visibility=
"invisible"
android:textColor=
"@color/theme_white_color"
/>
</RelativeLayout>
<TextView
android:id=
"@+id/tv_total"
android:layout_width=
"0dp"
android:layout_weight=
"1"
android:layout_height=
"match_parent"
android:text=
"$1328.0"
android:textSize=
"@dimen/font_large"
android:textStyle=
"bold"
android:layout_gravity=
"right"
android:textColor=
"@color/theme_white_color"
android:paddingRight=
"@dimen/dp_8"
android:gravity=
"right|center_vertical"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<ViewStub
<ViewStub
android:id=
"@+id/vs_transfer_food"
android:id=
"@+id/vs_transfer_food"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:layout
=
"@layout/table_stub_transfer_food
"
android:layout
_marginTop=
"@dimen/dp_50
"
android:layout
_marginTop=
"@dimen/dp_50"
/>
android:layout
=
"@layout/table_stub_transfer_food"
/>
</FrameLayout>
</FrameLayout>
\ No newline at end of file
component-table/src/main/res/values/strings.xml
View file @
da8dbb14
...
@@ -88,4 +88,6 @@
...
@@ -88,4 +88,6 @@
<string
name=
"mealheight"
>
菜單高度
</string>
<string
name=
"mealheight"
>
菜單高度
</string>
<string
name=
"datadown"
>
數據下載
</string>
<string
name=
"datadown"
>
數據下載
</string>
<string
name=
"meal_numberman_colon"
>
人數:%1$d
</string>
<string
name=
"meal_order_number"
>
單號:%1$s
</string>
</resources>
</resources>
config.gradle
View file @
da8dbb14
...
@@ -7,8 +7,8 @@ ext {
...
@@ -7,8 +7,8 @@ ext {
targetSdkVersion
:
29
,
targetSdkVersion
:
29
,
//正式版: 1.0.3 3
//正式版: 1.0.3 3
//內部測試版:1.2.0 20
//內部測試版:1.2.0 20
versionCode
:
2
5
,
versionCode
:
2
6
,
versionName
:
"1.2.
5
"
versionName
:
"1.2.
6
"
]
]
version
=
[
version
=
[
...
@@ -27,7 +27,7 @@ ext {
...
@@ -27,7 +27,7 @@ ext {
buildType
=
[
buildType
=
[
debugLogDebug
:
"true"
,
debugLogDebug
:
"true"
,
debugUseCanary
:
"true"
,
debugUseCanary
:
"true"
,
releaseLogDebug
:
"
tru
e"
,
releaseLogDebug
:
"
fals
e"
,
releaseUseCanary:
"false"
releaseUseCanary:
"false"
]
]
...
...
gradle.properties
View file @
da8dbb14
...
@@ -6,7 +6,6 @@
...
@@ -6,7 +6,6 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs
=
-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
...
@@ -46,3 +45,10 @@ DOKIT_METHOD_STRATEGY=0
...
@@ -46,3 +45,10 @@ DOKIT_METHOD_STRATEGY=0
kapt.use.worker.api
=
true
kapt.use.worker.api
=
true
#避免执行注解处理。
#避免执行注解处理。
kapt.include.compile.classpath
=
false
kapt.include.compile.classpath
=
false
#org.gradle.jvmargs=-Xmx1536m
org.gradle.daemon
=
true
org.gradle.jvmargs
=
-Xmx4096m -XX:MaxPermSize=4096m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.parallel
=
true
org.gradle.configureondemand
=
true
\ No newline at end of file
library-common/src/main/java/com/gingersoft/gsa/cloud/common/constans/HttpsConstans.java
View file @
da8dbb14
...
@@ -43,7 +43,7 @@ public class HttpsConstans {
...
@@ -43,7 +43,7 @@ public class HttpsConstans {
public
static
String
RESTAURANT_API_PATH
=
"/ricepon-restaurant/api/"
;
//餐廳模塊路徑
public
static
String
RESTAURANT_API_PATH
=
"/ricepon-restaurant/api/"
;
//餐廳模塊路徑
public
static
String
PURCHASE_API_PATH
=
"/ricepon-purchase/api/"
;
//供應鏈路徑
public
static
String
PURCHASE_API_PATH
=
"/ricepon-purchase/api/"
;
//供應鏈路徑
public
static
String
ROOT_SERVER_YOU_CHANG_HK
=
"http://192.168.1.14
2
:9015/api"
;
//友常本地
public
static
String
ROOT_SERVER_YOU_CHANG_HK
=
"http://192.168.1.14
9
:9015/api"
;
//友常本地
public
static
String
ROOT_SERVER_ZHI_WANG_HK
=
"http://192.168.1.169:9012/api"
;
//世維本地
public
static
String
ROOT_SERVER_ZHI_WANG_HK
=
"http://192.168.1.169:9012/api"
;
//世維本地
public
static
String
ROOT_SERVER_SHI_SHU_HK
=
"http://192.168.1.154:9012/api"
;
//石书本地
public
static
String
ROOT_SERVER_SHI_SHU_HK
=
"http://192.168.1.154:9012/api"
;
//石书本地
...
@@ -97,8 +97,8 @@ public class HttpsConstans {
...
@@ -97,8 +97,8 @@ public class HttpsConstans {
* 修改這個值控制是否是正式
* 修改這個值控制是否是正式
* 0=正式
* 0=正式
* 1=香港
* 1=香港
* 2=
友常
* 2=
預發佈
* 3=
世维
* 3=
友常
* 4=石书
* 4=石书
*/
*/
public
static
int
isFormal
=
0
;
public
static
int
isFormal
=
0
;
...
...
library-common/src/main/java/com/gingersoft/gsa/cloud/common/core/delivery/OrderDetails.kt
View file @
da8dbb14
package
com.gingersoft.gsa.cloud.common.core.delivery
package
com.gingersoft.gsa.cloud.common.core.delivery
import
android.util.Log
import
android.util.Log
import
android.view.View
import
com.gingersoft.gsa.cloud.common.utils.MoneyUtil
import
com.gingersoft.gsa.cloud.common.utils.MoneyUtil
import
com.gingersoft.gsa.cloud.common.utils.other.TextUtil
import
java.io.Serializable
import
java.io.Serializable
import
kotlin.math.abs
import
kotlin.math.abs
...
@@ -110,6 +112,37 @@ class OrderDetails {
...
@@ -110,6 +112,37 @@ class OrderDetails {
var
companyType
:
Int
=
-
1
//物流公司類型 0 本店配送 1:zeek;2:lalamove
var
companyType
:
Int
=
-
1
//物流公司類型 0 本店配送 1:zeek;2:lalamove
var
labUrl
:
String
?
=
null
//打印文檔鏈接
var
labUrl
:
String
?
=
null
//打印文檔鏈接
fun
getShowTextByOrderType
():
String
{
return
when
(
order_type
)
{
2
->
"外送"
8
->
"凍鏈"
else
->
"自取"
}
}
fun
getShowTextByOrderPayType
():
String
{
return
when
(
orderPayType
)
{
1
->
"貨到付款"
0
->
"店內支付"
2
->
({
if
(
payMultiple
!=
null
)
{
val
payName
=
StringBuilder
()
for
(
payMultiple
in
payMultiple
!!
)
{
payName
.
append
(
payMultiple
.
payName
)
payName
.
append
(
","
)
}
if
(
payName
.
isNotEmpty
())
{
payName
.
deleteCharAt
(
payName
.
length
-
1
)
}
"在線支付:$payName"
}
else
{
"在線支付"
}
}).
toString
()
else
->
""
}
}
class
PRODUCTNAMEBean
:
Serializable
{
class
PRODUCTNAMEBean
:
Serializable
{
/**
/**
* odsId : 1654481
* odsId : 1654481
...
@@ -196,10 +229,12 @@ class OrderDetails {
...
@@ -196,10 +229,12 @@ class OrderDetails {
* 店內支付
* 店內支付
*/
*/
const
val
inStorePay
:
Int
=
0
const
val
inStorePay
:
Int
=
0
/**
/**
* 貨到付款
* 貨到付款
*/
*/
const
val
payOnDelivery
:
Int
=
1
const
val
payOnDelivery
:
Int
=
1
/**
/**
* 在線支付
* 在線支付
*/
*/
...
@@ -217,10 +252,11 @@ class OrderDetails {
...
@@ -217,10 +252,11 @@ class OrderDetails {
* 第三方配送
* 第三方配送
*/
*/
const
val
thirdPartyDistribution
:
Int
=
0
const
val
thirdPartyDistribution
:
Int
=
0
/**
/**
* 本店配送
* 本店配送
*/
*/
const
val
ourStoreDelivery
:
Int
=
1
const
val
ourStoreDelivery
:
Int
=
1
//配送方式
//配送方式
...
...
library-common/src/main/java/com/gingersoft/gsa/cloud/common/core/restaurant/RestaurantInfoManager.java
View file @
da8dbb14
...
@@ -31,10 +31,10 @@ public class RestaurantInfoManager {
...
@@ -31,10 +31,10 @@ public class RestaurantInfoManager {
if
(
restaurantInfo
==
null
)
{
if
(
restaurantInfo
==
null
)
{
restaurantInfo
=
new
RestaurantInfo
();
restaurantInfo
=
new
RestaurantInfo
();
}
}
brandInfo
.
setBrandId
((
Integer
)
SPUtils
.
get
(
UserConstans
.
brandId
,
0
));
brandInfo
.
setBrandId
((
Integer
)
SPUtils
.
get
(
UserConstans
.
brandId
,
1
));
brandInfo
.
setBrandName
((
String
)
SPUtils
.
get
(
UserConstans
.
brandName
,
""
));
brandInfo
.
setBrandName
((
String
)
SPUtils
.
get
(
UserConstans
.
brandName
,
""
));
restaurantInfo
.
setGsPosShopId
((
String
)
SPUtils
.
get
(
UserConstans
.
gsPosShopId
,
"-1"
));
restaurantInfo
.
setGsPosShopId
((
String
)
SPUtils
.
get
(
UserConstans
.
gsPosShopId
,
"-1"
));
restaurantInfo
.
setRestaurantId
((
Integer
)
SPUtils
.
get
(
UserConstans
.
restaurantId
,
0
));
restaurantInfo
.
setRestaurantId
((
Integer
)
SPUtils
.
get
(
UserConstans
.
restaurantId
,
26
));
restaurantInfo
.
setRestaurantName
((
String
)
SPUtils
.
get
(
UserConstans
.
restaurantName
,
""
));
restaurantInfo
.
setRestaurantName
((
String
)
SPUtils
.
get
(
UserConstans
.
restaurantName
,
""
));
}
}
...
...
library-common/src/main/java/com/gingersoft/gsa/cloud/common/utils/MoneyUtil.java
View file @
da8dbb14
...
@@ -200,7 +200,21 @@ public class MoneyUtil {
...
@@ -200,7 +200,21 @@ public class MoneyUtil {
BigDecimal
b2
=
BigDecimal
.
valueOf
(
price2
);
BigDecimal
b2
=
BigDecimal
.
valueOf
(
price2
);
return
price
.
add
(
b2
);
return
price
.
add
(
b2
);
}
}
/**
* 計算差
*
* @param v1
* @param v2
* @return
*/
public
static
double
sum
(
double
v1
,
double
...
v2
)
{
BigDecimal
b1
=
BigDecimal
.
valueOf
(
v1
);
for
(
int
i
=
0
;
i
<
v2
.
length
;
i
++)
{
BigDecimal
b2
=
BigDecimal
.
valueOf
(
v2
[
i
]);
b1
=
b1
.
add
(
b2
);
}
return
b1
.
doubleValue
();
}
/**
/**
* 計算差
* 計算差
*
*
...
...
library-common/src/main/java/com/gingersoft/gsa/cloud/common/utils/inputFilter/InputFilterUtils.java
View file @
da8dbb14
...
@@ -21,6 +21,10 @@ public class InputFilterUtils {
...
@@ -21,6 +21,10 @@ public class InputFilterUtils {
/**
/**
* 只能輸入中英文和數字
* 只能輸入中英文和數字
*/
*/
public
static
final
Pattern
chAndEn
=
Pattern
.
compile
(
"[a-zA-Z\u4E00-\u9FA5]+"
);
/**
* 只能輸入中英文和數字
*/
public
static
final
Pattern
chAndEnAndNum
=
Pattern
.
compile
(
"[a-zA-Z0-9\u4E00-\u9FA5]+"
);
public
static
final
Pattern
chAndEnAndNum
=
Pattern
.
compile
(
"[a-zA-Z0-9\u4E00-\u9FA5]+"
);
/**
/**
* 只能輸入英文和數字
* 只能輸入英文和數字
...
@@ -30,7 +34,7 @@ public class InputFilterUtils {
...
@@ -30,7 +34,7 @@ public class InputFilterUtils {
* 只能輸入中英文和數字還有一些標點符號
* 只能輸入中英文和數字還有一些標點符號
* Punctuation
* Punctuation
*/
*/
public
static
final
Pattern
chAndEnAndNumAndPt
=
Pattern
.
compile
(
"[-a-zA-Z0-9\u4E00-\u9FA5/,.;,。;!!??]+"
);
public
static
final
Pattern
chAndEnAndNumAndPt
=
Pattern
.
compile
(
"[-a-zA-Z0-9\u4E00-\u9FA5/,.;,。;!!??
~…&'*()()—+:_@ ̄―#_
]+"
);
/**
/**
* 只能輸入中英文和數字還有/
* 只能輸入中英文和數字還有/
* Punctuation
* Punctuation
...
@@ -45,7 +49,7 @@ public class InputFilterUtils {
...
@@ -45,7 +49,7 @@ public class InputFilterUtils {
Pattern
.
UNICODE_CASE
|
Pattern
.
CASE_INSENSITIVE
);
Pattern
.
UNICODE_CASE
|
Pattern
.
CASE_INSENSITIVE
);
public
static
InputFilter
getChAndEnAndNumAndPtInputFilter
(
Context
mContext
)
{
public
static
InputFilter
getChAndEnAndNumAndPtInputFilter
(
Context
mContext
)
{
return
InputFilterUtils
.
getTypeFilter
(
mContext
,
"請輸入
中英文和數字
"
,
chAndEnAndNumAndPt
);
return
InputFilterUtils
.
getTypeFilter
(
mContext
,
"請輸入
正確的字符
"
,
chAndEnAndNumAndPt
);
}
}
public
static
InputFilter
getTypeFilter
(
Context
mContext
,
Pattern
p
)
{
public
static
InputFilter
getTypeFilter
(
Context
mContext
,
Pattern
p
)
{
...
@@ -60,6 +64,10 @@ public class InputFilterUtils {
...
@@ -60,6 +64,10 @@ public class InputFilterUtils {
return
InputFilterUtils
.
getTypeFilter
(
mContext
,
"請輸入英文和數字"
,
enAndNum
);
return
InputFilterUtils
.
getTypeFilter
(
mContext
,
"請輸入英文和數字"
,
enAndNum
);
}
}
public
static
InputFilter
getEnAndChInputFilter
(
Context
mContext
)
{
return
InputFilterUtils
.
getTypeFilter
(
mContext
,
"只允許輸入中英文"
,
chAndEn
);
}
public
static
InputFilter
getLengthFilter
(
Context
mContext
,
int
maxLength
)
{
public
static
InputFilter
getLengthFilter
(
Context
mContext
,
int
maxLength
)
{
return
InputFilterUtils
.
getMaxLengthFilter
(
mContext
,
"最多輸入"
+
maxLength
+
"個字"
,
maxLength
);
return
InputFilterUtils
.
getMaxLengthFilter
(
mContext
,
"最多輸入"
+
maxLength
+
"個字"
,
maxLength
);
}
}
...
@@ -116,17 +124,21 @@ public class InputFilterUtils {
...
@@ -116,17 +124,21 @@ public class InputFilterUtils {
* @param context
* @param context
* @param tipString 超過最大長度限制的提示
* @param tipString 超過最大長度限制的提示
* @param maxLength 最大長度
* @param maxLength 最大長度
* @return
* @return source 當前輸入內容
* dest 輸入框中的內容
*/
*/
private
static
InputFilter
getMaxLengthFilter
(
Context
context
,
String
tipString
,
int
maxLength
)
{
private
static
InputFilter
getMaxLengthFilter
(
Context
context
,
String
tipString
,
int
maxLength
)
{
return
(
source
,
start
,
end
,
dest
,
dstart
,
dend
)
->
{
return
(
source
,
start
,
end
,
dest
,
dstart
,
dend
)
->
{
int
keep
=
maxLength
-
(
dest
.
length
()
-
(
dend
-
dstart
));
int
destLength
=
TextUtil
.
getStringLength
(
dest
.
toString
());
int
sourceLength
=
TextUtil
.
getStringLength
(
source
.
toString
());
// int keep = maxLength - (dest.length() - (dend - dstart));
int
keep
=
maxLength
-
destLength
;
if
(
keep
<=
0
)
{
if
(
keep
<=
0
)
{
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
source
.
toString
())
&&
TextUtil
.
isNotEmptyOrNullOrUndefined
(
tipString
))
{
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
source
.
toString
())
&&
TextUtil
.
isNotEmptyOrNullOrUndefined
(
tipString
))
{
ToastUtils
.
show
(
context
,
tipString
);
ToastUtils
.
show
(
context
,
tipString
);
}
}
return
""
;
return
""
;
}
else
if
(
keep
>=
end
-
start
)
{
}
else
if
(
keep
>=
sourceLength
)
{
return
null
;
// keep original
return
null
;
// keep original
}
else
{
}
else
{
keep
+=
start
;
keep
+=
start
;
...
@@ -143,31 +155,5 @@ public class InputFilterUtils {
...
@@ -143,31 +155,5 @@ public class InputFilterUtils {
}
}
};
};
}
}
/**
* 輸入最大長度限制
*
* @param maxLength 最大長度
* @return
*/
private
static
InputFilter
getMaxLengthFilter
(
int
maxLength
)
{
return
(
source
,
start
,
end
,
dest
,
dstart
,
dend
)
->
{
int
keep
=
maxLength
-
(
dest
.
length
()
-
(
dend
-
dstart
));
if
(
keep
<=
0
)
{
return
""
;
}
else
if
(
keep
>=
end
-
start
)
{
return
null
;
// keep original
}
else
{
keep
+=
start
;
if
(
Character
.
isHighSurrogate
(
source
.
charAt
(
keep
-
1
)))
{
--
keep
;
if
(
keep
==
start
)
{
return
""
;
}
}
return
source
.
subSequence
(
start
,
keep
);
}
};
}
}
}
library-common/src/main/res/drawable-xhdpi/ic_black_copy.png
0 → 100644
View file @
da8dbb14
544 Bytes
library-common/src/main/res/drawable-xhdpi/ic_white_print.png
0 → 100644
View file @
da8dbb14
637 Bytes
library-common/src/main/res/layout/layout_order_receiving.xml
View file @
da8dbb14
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/white"
android:gravity=
"center_vertical"
android:gravity=
"center_vertical"
android:orientation=
"vertical"
android:orientation=
"vertical"
android:padding=
"@dimen/dp_10"
>
android:padding=
"@dimen/dp_10"
>
...
@@ -43,11 +44,11 @@
...
@@ -43,11 +44,11 @@
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentRight=
"true"
android:layout_alignParentRight=
"true"
android:paddingTop=
"@dimen/dp_10"
android:background=
"@drawable/shape_cloas_btn"
android:paddingBottom=
"@dimen/dp_10"
android:paddingLeft=
"@dimen/dp_10"
android:paddingLeft=
"@dimen/dp_10"
android:paddingTop=
"@dimen/dp_10"
android:paddingRight=
"@dimen/dp_10"
android:paddingRight=
"@dimen/dp_10"
android:
background=
"@drawable/shape_cloas_btn
"
android:
paddingBottom=
"@dimen/dp_10
"
android:text=
"停止接單"
android:text=
"停止接單"
android:textColor=
"@color/white"
android:textColor=
"@color/white"
android:textSize=
"@dimen/dp_14"
/>
android:textSize=
"@dimen/dp_14"
/>
...
...
library-common/src/main/res/values/colors.xml
View file @
da8dbb14
...
@@ -477,6 +477,7 @@
...
@@ -477,6 +477,7 @@
<color
name=
"color_222"
>
#222222
</color>
<color
name=
"color_222"
>
#222222
</color>
<color
name=
"color_53"
>
#535353
</color>
<color
name=
"color_53"
>
#535353
</color>
<color
name=
"color_48"
>
#484848
</color>
<color
name=
"color_48"
>
#484848
</color>
<color
name=
"color_75"
>
#757575
</color>
<color
name=
"tran_twenty_send_order_btn_bg_color"
>
#331196DB
</color>
<color
name=
"tran_twenty_send_order_btn_bg_color"
>
#331196DB
</color>
<color
name=
"tran_fifty_order_state0_color"
>
#7F009788
</color>
<color
name=
"tran_fifty_order_state0_color"
>
#7F009788
</color>
...
...
library-common/src/main/res/values/ids.xml
View file @
da8dbb14
...
@@ -20,6 +20,8 @@
...
@@ -20,6 +20,8 @@
<item
name=
"iv_left_back"
type=
"id"
/>
<item
name=
"iv_left_back"
type=
"id"
/>
<item
name=
"iv_history"
type=
"id"
/>
<item
name=
"iv_history"
type=
"id"
/>
<item
name=
"topbar_refresh"
type=
"id"
/>
<item
name=
"topbar_refresh"
type=
"id"
/>
<item
name=
"id_topbar_print"
type=
"id"
/>
<item
name=
"topbar_right_change_button"
type=
"id"
/>
<item
name=
"topbar_right_change_button"
type=
"id"
/>
<item
name=
"topbar_right_add_button"
type=
"id"
/>
<item
name=
"topbar_right_add_button"
type=
"id"
/>
...
...
library-common/src/main/res/values/strings.xml
View file @
da8dbb14
...
@@ -186,6 +186,7 @@
...
@@ -186,6 +186,7 @@
<string
name=
"open"
>
營業中
</string>
<string
name=
"open"
>
營業中
</string>
<string
name=
"resting"
>
休息中
</string>
<string
name=
"resting"
>
休息中
</string>
<string
name=
"str_order_id"
>
訂單號:%1$d
</string>
<string
name=
"order_no"
>
訂單編號:
</string>
<string
name=
"order_no"
>
訂單編號:
</string>
<string
name=
"deliveryman"
>
送貨員:
</string>
<string
name=
"deliveryman"
>
送貨員:
</string>
<string
name=
"deliveryman_phone"
>
送貨員手機號:
</string>
<string
name=
"deliveryman_phone"
>
送貨員手機號:
</string>
...
...
library-print/src/main/java/com/gingersoft/gsa/cloud/print/PrintExecutor.java
View file @
da8dbb14
package
com
.
gingersoft
.
gsa
.
cloud
.
print
;
package
com
.
gingersoft
.
gsa
.
cloud
.
print
;
import
android.os.AsyncTask
;
import
android.os.AsyncTask
;
import
android.util.Log
;
import
com.gingersoft.gsa.cloud.common.logan.LoganManager
;
import
com.gingersoft.gsa.cloud.common.logan.LoganManager
;
import
com.gingersoft.gsa.cloud.common.utils.log.LogUtil
;
import
com.gingersoft.gsa.cloud.print.impl.OnPrjPrintResultListener
;
import
com.gingersoft.gsa.cloud.print.impl.OnPrjPrintResultListener
;
import
com.xuexiang.rxutil2.rxjava.RxJavaUtils
;
import
com.xuexiang.rxutil2.rxjava.RxJavaUtils
;
...
@@ -58,18 +58,24 @@ public class PrintExecutor {
...
@@ -58,18 +58,24 @@ public class PrintExecutor {
*/
*/
public
void
doPrinterRequestAsync
(
PrintDataMaker
maker
)
{
public
void
doPrinterRequestAsync
(
PrintDataMaker
maker
)
{
if
(
printDataMakers
.
size
()
<=
0
)
{
if
(
printDataMakers
.
size
()
<=
0
)
{
LogUtil
.
i
(
"eee"
,
"prj熱敏打印執行第一個任務"
);
printDataMakers
.
add
(
maker
);
printDataMakers
.
add
(
maker
);
new
PrintTask
().
execute
(
maker
);
new
PrintTask
().
execute
(
maker
);
}
else
{
}
else
{
//如果隊列裡有任務在執行,只添加進去,等待執行完成之後,再來執行這個
//如果隊列裡有任務在執行,只添加進去,等待執行完成之後,再來執行這個
LogUtil
.
i
(
"eee"
,
"prj熱敏打印添加隊列,前面還有"
+
printDataMakers
.
size
()
+
"個任務"
);
printDataMakers
.
add
(
maker
);
printDataMakers
.
add
(
maker
);
startReset
();
startReset
();
}
}
}
}
private
void
startReset
()
{
private
void
startReset
()
{
resetPrintDis
=
RxJavaUtils
.
delay
(
10
,
aLong
->
{
if
(
resetPrintDis
!=
null
)
{
//如果十秒之後,任務還沒在打印完成方法中取消,可能打印程序卡住了,在這裡執行下一個任務
resetPrintDis
.
dispose
();
}
resetPrintDis
=
RxJavaUtils
.
delay
(
30
,
aLong
->
{
//如果三十秒之後,任務還沒在打印完成方法中取消,可能打印程序卡住了,在這裡執行下一個任務
LogUtil
.
e
(
"eee"
,
"prj熱敏打印等待時間超過三十秒,自動重新打印"
);
if
(
printDataMakers
.
size
()
>
0
)
{
if
(
printDataMakers
.
size
()
>
0
)
{
new
PrintTask
().
execute
(
printDataMakers
.
get
(
0
));
new
PrintTask
().
execute
(
printDataMakers
.
get
(
0
));
}
}
...
@@ -88,6 +94,7 @@ public class PrintExecutor {
...
@@ -88,6 +94,7 @@ public class PrintExecutor {
List
<
byte
[]>
data
=
maker
.
getPrintData
();
List
<
byte
[]>
data
=
maker
.
getPrintData
();
//如果是打印prj,需要獲取prj的id
//如果是打印prj,需要獲取prj的id
prjIds
=
maker
.
getPrjIds
();
prjIds
=
maker
.
getPrjIds
();
LogUtil
.
d
(
"eee"
,
"prj doRequest食品id:"
+
prjIds
);
//判斷是否連接,如果未連接就先連接
//判斷是否連接,如果未連接就先連接
int
prepare
=
holder
.
prepareSocket
(
maker
.
getIp
(),
maker
.
getPort
());
int
prepare
=
holder
.
prepareSocket
(
maker
.
getIp
(),
maker
.
getPort
());
if
(
prepare
!=
PrintSocketHolder
.
ERROR_0
)
{
if
(
prepare
!=
PrintSocketHolder
.
ERROR_0
)
{
...
@@ -105,22 +112,25 @@ public class PrintExecutor {
...
@@ -105,22 +112,25 @@ public class PrintExecutor {
@Override
@Override
protected
void
onPreExecute
()
{
protected
void
onPreExecute
()
{
super
.
onPreExecute
();
super
.
onPreExecute
();
Log
.
e
(
"eee"
,
"任務數量:"
+
printDataMakers
.
size
()
);
Log
Util
.
i
(
"eee"
,
"prj熱敏任務onPreExecute"
);
holder
.
setOnStateChangedListener
(
this
);
holder
.
setOnStateChangedListener
(
this
);
}
}
@Override
@Override
protected
Integer
doInBackground
(
PrintDataMaker
...
makers
)
{
protected
Integer
doInBackground
(
PrintDataMaker
...
makers
)
{
LogUtil
.
i
(
"eee"
,
"prj熱敏任務開始"
);
holder
.
closeSocket
();
holder
.
closeSocket
();
if
(
makers
==
null
||
makers
.
length
<
1
)
{
if
(
makers
==
null
||
makers
.
length
<
1
)
{
return
PrintSocketHolder
.
ERROR_0
;
return
PrintSocketHolder
.
ERROR_0
;
}
}
LogUtil
.
e
(
"eee"
,
"prj熱敏任務開始"
+
makers
[
0
].
getPrjIds
());
return
doRequest
(
makers
[
0
]);
return
doRequest
(
makers
[
0
]);
}
}
@Override
@Override
protected
void
onProgressUpdate
(
Integer
...
values
)
{
protected
void
onProgressUpdate
(
Integer
...
values
)
{
super
.
onProgressUpdate
(
values
);
super
.
onProgressUpdate
(
values
);
LogUtil
.
i
(
"eee"
,
"prj熱敏任務onProgressUpdate"
+
values
);
if
(
values
==
null
||
values
.
length
<
1
)
{
if
(
values
==
null
||
values
.
length
<
1
)
{
return
;
return
;
}
}
...
@@ -132,6 +142,7 @@ public class PrintExecutor {
...
@@ -132,6 +142,7 @@ public class PrintExecutor {
@Override
@Override
protected
void
onPostExecute
(
Integer
integer
)
{
protected
void
onPostExecute
(
Integer
integer
)
{
super
.
onPostExecute
(
integer
);
super
.
onPostExecute
(
integer
);
LogUtil
.
i
(
"eee"
,
"prj熱敏任務onPostExecute"
+
integer
);
if
(
resetPrintDis
!=
null
)
{
if
(
resetPrintDis
!=
null
)
{
resetPrintDis
.
dispose
();
resetPrintDis
.
dispose
();
}
}
...
@@ -144,7 +155,7 @@ public class PrintExecutor {
...
@@ -144,7 +155,7 @@ public class PrintExecutor {
new
PrintTask
().
execute
(
printDataMakers
.
get
(
0
));
new
PrintTask
().
execute
(
printDataMakers
.
get
(
0
));
startReset
();
startReset
();
}
}
Log
.
e
(
"eee"
,
"完成後任務數量:
"
+
printDataMakers
.
size
());
Log
Util
.
d
(
"eee"
,
"prj熱敏打印完成後,任務數量
"
+
printDataMakers
.
size
());
//返回結果
//返回結果
if
(
integer
!=
null
)
{
if
(
integer
!=
null
)
{
onResult
(
integer
);
onResult
(
integer
);
...
...
library-print/src/main/java/com/gingersoft/gsa/cloud/print/PrintSocketHolder.java
View file @
da8dbb14
package
com
.
gingersoft
.
gsa
.
cloud
.
print
;
package
com
.
gingersoft
.
gsa
.
cloud
.
print
;
import
android.util.Log
;
import
com.gingersoft.gsa.cloud.common.constans.PrintConstans
;
import
com.gingersoft.gsa.cloud.common.constans.PrintConstans
;
import
com.gingersoft.gsa.cloud.common.logan.LoganManager
;
import
com.gingersoft.gsa.cloud.common.logan.LoganManager
;
import
com.gingersoft.gsa.cloud.common.printer.plugins.PrinterPlugins
;
import
com.gingersoft.gsa.cloud.common.printer.plugins.PrinterPlugins
;
import
com.gingersoft.gsa.cloud.common.utils.log.LogUtil
;
import
com.gingersoft.gsa.cloud.common.utils.other.TextUtil
;
import
com.gingersoft.gsa.cloud.common.utils.other.TextUtil
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
import
java.lang.ref.WeakReference
;
import
java.lang.ref.WeakReference
;
import
java.net.ConnectException
;
import
java.net.ConnectException
;
import
java.net.InetAddress
;
import
java.net.InetSocketAddress
;
import
java.net.InetSocketAddress
;
import
java.net.Socket
;
import
java.net.Socket
;
import
java.net.SocketTimeoutException
;
import
java.net.SocketTimeoutException
;
...
@@ -69,21 +73,33 @@ public class PrintSocketHolder {
...
@@ -69,21 +73,33 @@ public class PrintSocketHolder {
//设置超时时间
//设置超时时间
socket
.
setSoTimeout
(
PrintConstans
.
SO_TIMEOUT
);
socket
.
setSoTimeout
(
PrintConstans
.
SO_TIMEOUT
);
socket
.
connect
(
socketAddress
,
PrintConstans
.
PRINT_TIMEOUT
);
//开始连接ip
socket
.
connect
(
socketAddress
,
PrintConstans
.
PRINT_TIMEOUT
);
//开始连接ip
LogUtil
.
d
(
"eee"
,
"prj 熱敏開始連接打印機"
+
ip
+
":"
+
port
);
// if (socket != null && socket.isConnected()) {
// //如果不為空,並且已連接,可以和當前的ip比較,如果ip是一樣的,就不用再次連接,如果ip不一樣,斷開當前,再鏈接新的ip
//但是要在打印完所有之後關閉socket,避免打印機被這台機器佔用
//還要避免沒打印完的時候,app被關閉了,也要處理斷開
// InetAddress inetAddress = socket.getInetAddress();
// String hostName = inetAddress.getHostName();
// }
}
catch
(
SocketTimeoutException
e
)
{
}
catch
(
SocketTimeoutException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
LoganManager
.
w_printer
(
TAG
,
"連接打印機超時: "
+
ip
+
":"
+
port
+
"."
+
e
.
getMessage
());
LoganManager
.
w_printer
(
TAG
,
"連接打印機超時: "
+
ip
+
":"
+
port
+
"."
+
e
.
getMessage
());
LogUtil
.
e
(
"eee"
,
"prj 熱敏連接打印機超時"
+
ip
+
":"
+
port
);
return
ERROR_TIMEOUT
;
return
ERROR_TIMEOUT
;
}
catch
(
ConnectException
e
)
{
}
catch
(
ConnectException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
LoganManager
.
w_printer
(
TAG
,
"連接打印機失敗: "
+
ip
+
":"
+
port
+
"."
+
e
.
getMessage
());
LoganManager
.
w_printer
(
TAG
,
"連接打印機失敗: "
+
ip
+
":"
+
port
+
"."
+
e
.
getMessage
());
LogUtil
.
e
(
"eee"
,
"prj 熱敏打印機連接失敗:"
+
ip
+
":"
+
port
);
return
ERROR_7
;
return
ERROR_7
;
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
PrinterPlugins
.
getOnPrinterFlowHandler
().
connectionError
(
e
);
PrinterPlugins
.
getOnPrinterFlowHandler
().
connectionError
(
e
);
LogUtil
.
e
(
"eee"
,
"prj 熱敏連接打印機出錯IOException:"
+
ip
+
":"
+
port
+
"詳細:"
+
e
.
getMessage
());
return
ERROR_7
;
return
ERROR_7
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
closeSocket
();
closeSocket
();
e
.
printStackTrace
();
e
.
printStackTrace
();
LogUtil
.
e
(
"eee"
,
"prj 熱敏連接打印機出錯Exception:"
+
ip
+
":"
+
port
+
"詳細:"
+
e
.
getMessage
());
LoganManager
.
w_printer
(
TAG
,
"連接打印機異常: "
+
ip
+
":"
+
port
+
"."
+
e
.
getMessage
());
LoganManager
.
w_printer
(
TAG
,
"連接打印機異常: "
+
ip
+
":"
+
port
+
"."
+
e
.
getMessage
());
return
ERROR_7
;
return
ERROR_7
;
}
}
...
@@ -119,6 +135,7 @@ public class PrintSocketHolder {
...
@@ -119,6 +135,7 @@ public class PrintSocketHolder {
public
int
sendData
(
List
<
byte
[]>
data
)
{
public
int
sendData
(
List
<
byte
[]>
data
)
{
onPrinterStateChanged
(
STATE_3
);
onPrinterStateChanged
(
STATE_3
);
if
(
data
==
null
||
data
.
size
()
<=
0
)
{
if
(
data
==
null
||
data
.
size
()
<=
0
)
{
LogUtil
.
e
(
"eee"
,
"prj 熱敏數據為空"
);
return
ERROR_6
;
return
ERROR_6
;
}
}
for
(
byte
[]
item
:
data
)
{
for
(
byte
[]
item
:
data
)
{
...
@@ -127,6 +144,7 @@ public class PrintSocketHolder {
...
@@ -127,6 +144,7 @@ public class PrintSocketHolder {
out
.
flush
();
out
.
flush
();
}
catch
(
IOException
|
NullPointerException
e
)
{
}
catch
(
IOException
|
NullPointerException
e
)
{
LoganManager
.
w_printer
(
TAG
,
"打印prj寫入數據异常: "
+
e
.
getMessage
());
LoganManager
.
w_printer
(
TAG
,
"打印prj寫入數據异常: "
+
e
.
getMessage
());
LogUtil
.
e
(
"eee"
,
"prj 熱敏寫入數據異常"
+
e
.
getMessage
());
PrinterPlugins
.
getOnPrinterFlowHandler
().
onPrintError
(
e
,
ERROR_10
);
PrinterPlugins
.
getOnPrinterFlowHandler
().
onPrintError
(
e
,
ERROR_10
);
closeSocket
();
closeSocket
();
return
ERROR_10
;
return
ERROR_10
;
...
@@ -138,14 +156,17 @@ public class PrintSocketHolder {
...
@@ -138,14 +156,17 @@ public class PrintSocketHolder {
public
int
prepareSocket
(
String
ip
,
int
port
)
{
public
int
prepareSocket
(
String
ip
,
int
port
)
{
LoganManager
.
w_printer
(
TAG
,
"准备尝试连接打印机"
+
ip
+
":"
+
port
);
LoganManager
.
w_printer
(
TAG
,
"准备尝试连接打印机"
+
ip
+
":"
+
port
);
LogUtil
.
i
(
"eee"
,
"prj 熱敏準備連接打印機"
+
ip
+
":"
+
port
);
//創建連接
//創建連接
int
create
=
createSocket
(
ip
,
port
);
int
create
=
createSocket
(
ip
,
port
);
//判斷連接狀態
//判斷連接狀態
if
(
create
!=
PrintSocketHolder
.
ERROR_0
)
{
if
(
create
!=
PrintSocketHolder
.
ERROR_0
)
{
LogUtil
.
e
(
"eee"
,
"prj 熱敏"
+
ip
+
":"
+
port
+
"狀態:"
+
create
);
return
create
;
return
create
;
}
}
//獲取打印機寫入
//獲取打印機寫入
int
result
=
getOutputStream
();
int
result
=
getOutputStream
();
LogUtil
.
d
(
"eee"
,
"prj 熱敏獲取輸入流:"
+
(
result
==
ERROR_0
));
if
(
result
==
ERROR_0
)
{
if
(
result
==
ERROR_0
)
{
PrinterPlugins
.
getOnPrinterFlowHandler
().
connectionSuccess
();
PrinterPlugins
.
getOnPrinterFlowHandler
().
connectionSuccess
();
}
else
{
}
else
{
...
@@ -158,6 +179,7 @@ public class PrintSocketHolder {
...
@@ -158,6 +179,7 @@ public class PrintSocketHolder {
* 销毁
* 销毁
*/
*/
public
int
closeSocket
()
{
public
int
closeSocket
()
{
LogUtil
.
i
(
"eee"
,
"prj熱敏打印執行closeSocket"
);
onPrinterStateChanged
(
STATE_4
);
onPrinterStateChanged
(
STATE_4
);
boolean
error
=
false
;
boolean
error
=
false
;
try
{
try
{
...
...
library-qm-skin-maker/src/main/res/values/theme.xml
View file @
da8dbb14
...
@@ -88,6 +88,7 @@
...
@@ -88,6 +88,7 @@
<item
name=
"app_skin_span_normal_bg_color"
>
@color/qmui_config_color_gray_8
</item>
<item
name=
"app_skin_span_normal_bg_color"
>
@color/qmui_config_color_gray_8
</item>
<item
name=
"app_skin_span_pressed_bg_color"
>
@color/qmui_config_color_gray_6
</item>
<item
name=
"app_skin_span_pressed_bg_color"
>
@color/qmui_config_color_gray_6
</item>
<item
name=
"app_skin_alpha_test"
>
1
</item>
<item
name=
"app_skin_alpha_test"
>
1
</item>
<item
name=
"android:windowBackground"
>
@color/qmui_config_color_white
</item>
</style>
</style>
<style
name=
"AppTheme.Launcher"
>
<style
name=
"AppTheme.Launcher"
>
...
...
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