Commit 8e439e3b by Wyh

1、外送自取orderType字段修改 2、外送代碼整理優化 3、外送自取顯示預留電話 4、android 8.0打印頁面閃退問題

parent cae7d692
...@@ -412,9 +412,8 @@ public class ColdChainMainPresenter extends BasePresenter<ColdChainMainContract. ...@@ -412,9 +412,8 @@ public class ColdChainMainPresenter extends BasePresenter<ColdChainMainContract.
private void printColdChainOrder(OrderDetails.DataBean dataBean) { private void printColdChainOrder(OrderDetails.DataBean dataBean) {
if (RestaurantExpandInfoUtils.getValue(ExpandConstant.AutoPrinterPaper, true)) { if (RestaurantExpandInfoUtils.getValue(ExpandConstant.AutoPrinterPaper, true)) {
LogUtil.d("eee", "凍鏈:打印上菜紙");
//打印凍鏈上菜紙 //打印凍鏈上菜紙
dataBean.setOrder_type(8); dataBean.setOrderType(8);
TakeawayOrder.getInstance().getShoppingCart().setDeliveryAndPickupData(dataBean); TakeawayOrder.getInstance().getShoppingCart().setDeliveryAndPickupData(dataBean);
PrintContentAdapter contentAdapter = new PrintContentAdapter(); PrintContentAdapter contentAdapter = new PrintContentAdapter();
PrintContent printContent = contentAdapter.adaptationPrintTakeawayFormContent(dataBean); PrintContent printContent = contentAdapter.adaptationPrintTakeawayFormContent(dataBean);
...@@ -427,7 +426,6 @@ public class ColdChainMainPresenter extends BasePresenter<ColdChainMainContract. ...@@ -427,7 +426,6 @@ public class ColdChainMainPresenter extends BasePresenter<ColdChainMainContract.
.setActionName("printActivity") .setActionName("printActivity")
.build() .build()
.callAsyncCallbackOnMainThread((cc, result) -> { .callAsyncCallbackOnMainThread((cc, result) -> {
Log.e("eee", "打印結果" + result.isSuccess());
if (result.isSuccess()) { if (result.isSuccess()) {
//打印成功 //打印成功
updatePrintOrderStatus(dataBean.getID(), PRINT_COLD_CHAIN_ORDER_SUCCESS); updatePrintOrderStatus(dataBean.getID(), PRINT_COLD_CHAIN_ORDER_SUCCESS);
......
...@@ -503,11 +503,10 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -503,11 +503,10 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
public void printColdChainOrder(boolean isPrint) { public void printColdChainOrder(boolean isPrint) {
if (isPrint) { if (isPrint) {
//打印凍鏈上菜紙 //打印凍鏈上菜紙
dataBean.setOrder_type(8); dataBean.setOrderType(8);
TakeawayOrder.getInstance().getShoppingCart().setDeliveryAndPickupData(dataBean); TakeawayOrder.getInstance().getShoppingCart().setDeliveryAndPickupData(dataBean);
PrintContentAdapter contentAdapter = new PrintContentAdapter(); PrintContentAdapter contentAdapter = new PrintContentAdapter();
PrintContent printContent = contentAdapter.adaptationPrintTakeawayFormContent(dataBean); PrintContent printContent = contentAdapter.adaptationPrintTakeawayFormContent(dataBean);
Log.e("eee", "打印凍鏈上菜紙");
CC.obtainBuilder(ComponentName.COMPONENT_PRINT) CC.obtainBuilder(ComponentName.COMPONENT_PRINT)
.addParam(PrintConstans.PRINT_TYPE, PrintConstans.PRINT_OTHER_ORDER) .addParam(PrintConstans.PRINT_TYPE, PrintConstans.PRINT_OTHER_ORDER)
.addParam(PrintConstans.PRINT_CONTENT, printContent) .addParam(PrintConstans.PRINT_CONTENT, printContent)
...@@ -515,7 +514,6 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -515,7 +514,6 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
.setActionName("printActivity") .setActionName("printActivity")
.build() .build()
.callAsyncCallbackOnMainThread((cc, result) -> { .callAsyncCallbackOnMainThread((cc, result) -> {
Log.e("eee", "打印結果" + result.isSuccess());
updatePrintOrderStatus(dataBean.getID(), result.isSuccess() ? ColdChainMainPresenter.PRINT_COLD_CHAIN_ORDER_SUCCESS : ColdChainMainPresenter.PRINT_COLD_CHAIN_ORDER_FAIL); updatePrintOrderStatus(dataBean.getID(), result.isSuccess() ? ColdChainMainPresenter.PRINT_COLD_CHAIN_ORDER_SUCCESS : ColdChainMainPresenter.PRINT_COLD_CHAIN_ORDER_FAIL);
TakeawayOrder.getInstance().getShoppingCart().setDeliveryAndPickupData(null); TakeawayOrder.getInstance().getShoppingCart().setDeliveryAndPickupData(null);
}); });
......
...@@ -97,7 +97,7 @@ class HistoryOrderViewModel(private val historyOrderRepository: HistoryOrderRepo ...@@ -97,7 +97,7 @@ class HistoryOrderViewModel(private val historyOrderRepository: HistoryOrderRepo
private fun printOrder(orderDetails: OrderDetails, data: HistoryOrderBean.Data.OrderItem, context: Context, listener: (Boolean) -> Unit) { private fun printOrder(orderDetails: OrderDetails, data: HistoryOrderBean.Data.OrderItem, context: Context, listener: (Boolean) -> Unit) {
if (orderDetails.data != null) { if (orderDetails.data != null) {
//訂單信息和廚房單 //訂單信息和廚房單
orderDetails.data!![0].order_type = data.orderType orderDetails.data!![0].orderType = data.orderType
orderDetails.data!![0].orderPayType = data.orderPayType orderDetails.data!![0].orderPayType = data.orderPayType
TakeawayOrder.getInstance().shoppingCart.deliveryAndPickupData = orderDetails.data!![0] TakeawayOrder.getInstance().shoppingCart.deliveryAndPickupData = orderDetails.data!![0]
......
...@@ -217,7 +217,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -217,7 +217,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
} }
if (orderDetail.appointmentType == 0) { if (orderDetail.appointmentType == 0) {
//即時單 //即時單
if (orderDetail.order_type == 7) { if (orderDetail.orderType == 7) {
//如果是自取單,將物流類型改為本店 //如果是自取單,將物流類型改為本店
orderDetail.companyType = 0 orderDetail.companyType = 0
} }
...@@ -599,7 +599,9 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -599,7 +599,9 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}) })
} }
/**
* 結賬
*/
fun closingBill(orderDetails: OrderDetails.DataBean, payMethods: List<PayMethod>, listener: (Int, Boolean) -> Unit) { fun closingBill(orderDetails: OrderDetails.DataBean, payMethods: List<PayMethod>, listener: (Int, Boolean) -> Unit) {
launch({ launch({
val payMultiple = ArrayList<OrderDetails.DataBean.PayMultiple>() val payMultiple = ArrayList<OrderDetails.DataBean.PayMultiple>()
...@@ -607,7 +609,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -607,7 +609,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
payMethods.forEach { payMethods.forEach {
payMultiple.add(OrderDetails.DataBean.PayMultiple(it.payType.toString(), it.payMoney, it.payName, 0.0)) payMultiple.add(OrderDetails.DataBean.PayMultiple(it.payType.toString(), it.payMoney, it.payName, 0.0))
} }
repository.updateOrderPay(orderDetails.ID, OrderDetails.closingAmount, orderDetails.order_type, 3, orderPayInfoVO = payMultiple).apply { repository.updateOrderPay(orderDetails.ID, OrderDetails.closingAmount, orderDetails.orderType, 3, orderPayInfoVO = payMultiple).apply {
orderDetails.payMultiple = payMultiple orderDetails.payMultiple = payMultiple
orderDetails.payTime = TimeUtils.getCurrentTimeInString(TimeUtils.DEFAULT_DATE_FORMAT) orderDetails.payTime = TimeUtils.getCurrentTimeInString(TimeUtils.DEFAULT_DATE_FORMAT)
val bean = GsonUtils.GsonToBean(GsonUtils.GsonString(data), OrderClosingBean::class.java) val bean = GsonUtils.GsonToBean(GsonUtils.GsonString(data), OrderClosingBean::class.java)
...@@ -624,7 +626,9 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -624,7 +626,9 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}) })
} }
/**
* 修改訂單狀態
*/
fun gsUpdateOrderStatus(orderDetails: OrderDetails.DataBean, orderPayInfoVO: List<OrderDetails.DataBean.PayMultiple>?, listener: (Int, Boolean) -> Unit) { fun gsUpdateOrderStatus(orderDetails: OrderDetails.DataBean, orderPayInfoVO: List<OrderDetails.DataBean.PayMultiple>?, listener: (Int, Boolean) -> Unit) {
//驗證訂單金額是否正確 //驗證訂單金額是否正確
if (verificationAmount(orderDetails)) { if (verificationAmount(orderDetails)) {
...@@ -632,7 +636,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -632,7 +636,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
return return
} }
launch({ launch({
repository.gsUpdateOrderStatus(orderDetails.ID, OrderDetails.closingAmount, orderDetails.order_type, 3, orderFrom = 0).apply { repository.gsUpdateOrderStatus(orderDetails.ID, OrderDetails.closingAmount, orderDetails.orderType, 3, orderFrom = 0).apply {
if (orderPayInfoVO != null && orderPayInfoVO.isNotEmpty()) { if (orderPayInfoVO != null && orderPayInfoVO.isNotEmpty()) {
orderDetails.payMultiple = orderPayInfoVO orderDetails.payMultiple = orderPayInfoVO
} }
...@@ -651,6 +655,9 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -651,6 +655,9 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}) })
} }
/**
* 修改訂單狀態並打印
*/
fun updateOrderAndPrint(restaurantId: Int, dataBean: OrderDetails.DataBean, status: Int, isPrint: Boolean = true, listener: (MessageBean) -> Unit) { fun updateOrderAndPrint(restaurantId: Int, dataBean: OrderDetails.DataBean, status: Int, isPrint: Boolean = true, listener: (MessageBean) -> Unit) {
updateOrderAndPrint(restaurantId, dataBean, status, isPrint, isPrint, listener) updateOrderAndPrint(restaurantId, dataBean, status, isPrint, isPrint, listener)
} }
...@@ -658,13 +665,13 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -658,13 +665,13 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
/** /**
* 修改訂單狀態並打印,狀態為0,1,2才打印 * 修改訂單狀態並打印,狀態為0,1,2才打印
*/ */
fun updateOrderAndPrint(restaurantId: Int, dataBean: OrderDetails.DataBean, status: Int, isPrintPrj: Boolean = true, isPrintBill: Boolean = true, listener: (MessageBean) -> Unit) { private fun updateOrderAndPrint(restaurantId: Int, dataBean: OrderDetails.DataBean, status: Int, isPrintPrj: Boolean = true, isPrintBill: Boolean = true, listener: (MessageBean) -> Unit) {
if (verificationAmount(dataBean)) { if (verificationAmount(dataBean)) {
listener.invoke(getMsgBean(0, verifiAmountTip, false)) listener.invoke(getMsgBean(0, verifiAmountTip, false))
return return
} }
launch({ launch({
repository.gsUpdateOrderStatus(dataBean.ID, status, dataBean.order_type, 1, "", "", "", "0", "", 1, 0).apply { repository.gsUpdateOrderStatus(dataBean.ID, status, dataBean.orderType, 1, "", "", "", "0", "", 1, 0).apply {
if (status == 0 || status == 1 || status == 2 || status == 8) { if (status == 0 || status == 1 || status == 2 || status == 8) {
if (this.code == "1") { if (this.code == "1") {
//確認送單 //確認送單
...@@ -710,8 +717,6 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -710,8 +717,6 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
repository.getOrderInfo(dataBean.ID.toString()).apply { repository.getOrderInfo(dataBean.ID.toString()).apply {
if (data != null && data!!.isNotEmpty()) { if (data != null && data!!.isNotEmpty()) {
data?.get(0)?.let { data?.get(0)?.let {
it.order_type = dataBean.order_type
it.orderPayType = dataBean.orderPayType
printOrder(DeliveryPrint, it, listener) printOrder(DeliveryPrint, it, listener)
} }
} else { } else {
...@@ -803,8 +808,6 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -803,8 +808,6 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
TakeawayOrder.getInstance().shoppingCart.deliveryAndPickupData = null TakeawayOrder.getInstance().shoppingCart.deliveryAndPickupData = null
listener.invoke(PrintCode, result.isSuccess) listener.invoke(PrintCode, result.isSuccess)
} }
} }
/** /**
...@@ -938,7 +941,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -938,7 +941,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
return@setOnClickListener return@setOnClickListener
} }
launch({ launch({
repository.gsUpdateOrderStatus(dataBean.ID, status, dataBean.order_type, 1, "", deliveryBean!!.data[deliveryAdapter.selectIndex].userName, deliveryBean!!.data[deliveryAdapter.selectIndex].mobile, "0", "", 1, 0).apply { repository.gsUpdateOrderStatus(dataBean.ID, status, dataBean.orderType, 1, "", deliveryBean!!.data[deliveryAdapter.selectIndex].userName, deliveryBean!!.data[deliveryAdapter.selectIndex].mobile, "0", "", 1, 0).apply {
if (code == "1") { if (code == "1") {
dialog?.dismiss() dialog?.dismiss()
//回調 //回調
......
...@@ -13,6 +13,7 @@ import androidx.core.content.ContextCompat ...@@ -13,6 +13,7 @@ import androidx.core.content.ContextCompat
import androidx.databinding.DataBindingUtil import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.Adapter import androidx.recyclerview.widget.RecyclerView.Adapter
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil
import com.gingersoft.gsa.delivery_pick_mode.R import com.gingersoft.gsa.delivery_pick_mode.R
import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.OrderListBean import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.OrderListBean
import com.gingersoft.gsa.delivery_pick_mode.databinding.LayoutDeliveryOrderItemBinding import com.gingersoft.gsa.delivery_pick_mode.databinding.LayoutDeliveryOrderItemBinding
...@@ -30,10 +31,13 @@ class OrderListAdapter(var context: Context, var outTime: Int, var dataBean: Lis ...@@ -30,10 +31,13 @@ class OrderListAdapter(var context: Context, var outTime: Int, var dataBean: Lis
val data = dataBean[position] val data = dataBean[position]
holder.binding.data = data holder.binding.data = data
//收貨人名稱那一列的數據為 收貨人(會員手機號) //收貨人名稱那一列的數據為 收貨人(會員手機號)
var nameColumn: String = data.receiver + String.format(context.getString(R.string.str_parenthesis_format), data.memberPhone) var nameColumn = ""
if (data.memberPhone != data.phone) { if(TextUtil.isNotEmptyOrNullOrUndefined(data.phone)){
nameColumn = data.receiver + String.format(context.getString(R.string.str_parenthesis_format), data.phone)
}
if (TextUtil.isNotEmptyOrNullOrUndefined(data.memberPhone) && data.memberPhone != data.phone) {
//如果會員手機號和預留號碼不一致,需要再加上預留號碼 //如果會員手機號和預留號碼不一致,需要再加上預留號碼
nameColumn += String.format(context.getString(R.string.str_parenthesis_format), data.phone) nameColumn += String.format(context.getString(R.string.str_parenthesis_format), data.memberPhone)
} }
holder.binding.nameColumnData = nameColumn holder.binding.nameColumnData = nameColumn
holder.binding.isSelf = data.orderType == 7 holder.binding.isSelf = data.orderType == 7
......
...@@ -79,9 +79,6 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) { ...@@ -79,9 +79,6 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) {
// 點擊查詢食品詳情 // 點擊查詢食品詳情
val intent = Intent(activity, OrderDetailsActivity::class.java) val intent = Intent(activity, OrderDetailsActivity::class.java)
intent.putExtra("orderId", data.id.toString()) intent.putExtra("orderId", data.id.toString())
intent.putExtra("orderType", data.orderType)
intent.putExtra("orderStatus", data.status)
intent.putExtra("orderPayType", data.orderPayType)
intent.putExtra("isRead", data.isRead) intent.putExtra("isRead", data.isRead)
//傳遞是否是預約單 //傳遞是否是預約單
if (position <= 1) { if (position <= 1) {
......
...@@ -10,11 +10,11 @@ ...@@ -10,11 +10,11 @@
<import type="com.gingersoft.gsa.cloud.common.utils.MoneyUtil" /> <import type="com.gingersoft.gsa.cloud.common.utils.MoneyUtil" />
<import type="android.view.View" /> <import type="android.view.View" />
<!--總金額-->
<variable <variable
name="totalAmount" name="totalAmount"
type="Double" /> type="Double" />
<!--合計-->
<variable <variable
name="total" name="total"
type="Double" /> type="Double" />
...@@ -44,6 +44,9 @@ ...@@ -44,6 +44,9 @@
name="patMethod" name="patMethod"
type="String" /> type="String" />
<variable
name="phone"
type="String" />
</data> </data>
<RelativeLayout <RelativeLayout
...@@ -270,7 +273,7 @@ ...@@ -270,7 +273,7 @@
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_toRightOf="@id/tv_receive_phone_text" android:layout_toRightOf="@id/tv_receive_phone_text"
android:gravity="right" android:gravity="right"
android:text="@{data.pHONE.equals(data.memberPhone)?data.pHONE:data.memberPhone +'(' + data.pHONE + ')'}" /> android:text="@{phone}" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
...@@ -461,6 +464,7 @@ ...@@ -461,6 +464,7 @@
android:layout_marginLeft="@dimen/other_order_info_dialog_content_marginLeft" android:layout_marginLeft="@dimen/other_order_info_dialog_content_marginLeft"
android:layout_marginRight="@dimen/other_order_info_dialog_content_marginRight" android:layout_marginRight="@dimen/other_order_info_dialog_content_marginRight"
android:layout_marginBottom="@dimen/dp_10" android:layout_marginBottom="@dimen/dp_10"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintTop_toBottomOf="@id/line_food_top" /> app:layout_constraintTop_toBottomOf="@id/line_food_top" />
<include layout="@layout/include_horizontal_color_eee_dividing_line" /> <include layout="@layout/include_horizontal_color_eee_dividing_line" />
......
...@@ -309,7 +309,7 @@ public class PrintInfoBean { ...@@ -309,7 +309,7 @@ public class PrintInfoBean {
printInfoBeans.add(new PrintInfoBean(new String[]{RestaurantInfoManager.newInstance().getBrandName()}, new Boolean[]{true}, new Double[]{2d})); printInfoBeans.add(new PrintInfoBean(new String[]{RestaurantInfoManager.newInstance().getBrandName()}, new Boolean[]{true}, new Double[]{2d}));
printInfoBeans.add(new PrintInfoBean(new String[]{RestaurantInfoManager.newInstance().getRestaurantName()}, new Boolean[]{true}, new Double[]{2d})); printInfoBeans.add(new PrintInfoBean(new String[]{RestaurantInfoManager.newInstance().getRestaurantName()}, new Boolean[]{true}, new Double[]{2d}));
printInfoBeans.add(new PrintInfoBean(new String[]{getLineBorder(data.getOrder_type() == 2 ? "外送" : "自取", 2, paperWidth)}, new Boolean[]{true}, new Double[]{2d})); printInfoBeans.add(new PrintInfoBean(new String[]{getLineBorder(data.getOrderType() == 2 ? "外送" : "自取", 2, paperWidth)}, new Boolean[]{true}, new Double[]{2d}));
String payType = ""; String payType = "";
if (data.getOrderPayType() == 1) { if (data.getOrderPayType() == 1) {
...@@ -323,13 +323,13 @@ public class PrintInfoBean { ...@@ -323,13 +323,13 @@ public class PrintInfoBean {
printInfoBeans.add(new PrintInfoBean(new String[]{payType}, new Boolean[]{true}, new Double[]{2d})); printInfoBeans.add(new PrintInfoBean(new String[]{payType}, new Boolean[]{true}, new Double[]{2d}));
//送達時間或者取餐時間 //送達時間或者取餐時間
printInfoBeans.add(new PrintInfoBean(new String[]{data.getOrder_type() == 2 ? data.getSEND_TIME() : data.getTakeTime()}, new Boolean[]{true}, new Double[]{1d})); printInfoBeans.add(new PrintInfoBean(new String[]{data.getOrderType() == 2 ? data.getSEND_TIME() : data.getTakeTime()}, new Boolean[]{true}, new Double[]{1d}));
//加線 //加線
printInfoBeans.add(new PrintInfoBean(new String[]{getLineBorder("", 2, paperWidth)}, new Double[]{2d})); printInfoBeans.add(new PrintInfoBean(new String[]{getLineBorder("", 2, paperWidth)}, new Double[]{2d}));
printInfoBeans.add(new PrintInfoBean(new String[]{"單號:" + data.getORDER_NO()}, new Double[]{1d}, 0)); printInfoBeans.add(new PrintInfoBean(new String[]{"單號:" + data.getORDER_NO()}, new Double[]{1d}, 0));
if (data.getOrder_type() == 7) { if (data.getOrderType() == 7) {
//自取 顯示 取餐碼 //自取 顯示 取餐碼
if (!TextUtil.isEmptyOrNullOrUndefined(data.getTakeFoodCode())) { if (!TextUtil.isEmptyOrNullOrUndefined(data.getTakeFoodCode())) {
printInfoBeans.add(new PrintInfoBean(new String[]{"取餐碼:" + data.getTakeFoodCode()}, new Double[]{3d}, 0)); printInfoBeans.add(new PrintInfoBean(new String[]{"取餐碼:" + data.getTakeFoodCode()}, new Double[]{3d}, 0));
...@@ -433,7 +433,7 @@ public class PrintInfoBean { ...@@ -433,7 +433,7 @@ public class PrintInfoBean {
printInfoBeans.add(new PrintInfoBean(new String[]{getLineBorder("", 1, paperWidth)}, new Double[]{1d})); printInfoBeans.add(new PrintInfoBean(new String[]{getLineBorder("", 1, paperWidth)}, new Double[]{1d}));
if (data.getOrder_type() == 2) { if (data.getOrderType() == 2) {
printInfoBeans.add(new PrintInfoBean(new String[]{context.getString(R.string.address) + data.getAddressDetail()}, 0)); printInfoBeans.add(new PrintInfoBean(new String[]{context.getString(R.string.address) + data.getAddressDetail()}, 0));
printInfoBeans.add(new PrintInfoBean(new String[]{"收貨人:" + data.getRECEIVER()}, 0)); printInfoBeans.add(new PrintInfoBean(new String[]{"收貨人:" + data.getRECEIVER()}, 0));
} }
......
...@@ -78,135 +78,6 @@ public class PrintOtherOrderClosing extends PrinterRoot<PrintTakeawayCheckoutCon ...@@ -78,135 +78,6 @@ public class PrintOtherOrderClosing extends PrinterRoot<PrintTakeawayCheckoutCon
return RestaurantExpandInfoUtils.getValue(ExpandConstant.DeliveryClosingPC, 1); return RestaurantExpandInfoUtils.getValue(ExpandConstant.DeliveryClosingPC, 1);
} }
private Bitmap initPrintView(Context context, OrderDetails.DataBean data, PrinterDeviceBean deviceBean) {
View view = LayoutInflater.from(context).inflate(R.layout.print_confirm_order_view, null, false);
TextView tvMemberNum = view.findViewById(R.id.tv_member_number);//會員號碼
TextView tvMemberName = view.findViewById(R.id.tv_member_name);//會員名稱
TextView tvMemberPhone = view.findViewById(R.id.tv_member_phone);//會員電話
TextView tvNowPoint = view.findViewById(R.id.tv_nowPoints);//現在的積分
TextView tvAddPoints = view.findViewById(R.id.tv_addPoints);//本次添加積分
TextView tvOldPoints = view.findViewById(R.id.tv_oldPoints);//之前的積分
TextView lineMember = view.findViewById(R.id.line_member_info);
TextView tvOrderClosing = view.findViewById(R.id.tv_order_closing);
TextView tvBillNumber = view.findViewById(R.id.tv_bill_number);
TextView tvPayMethodTwo = view.findViewById(R.id.tv_pay_amount_text_two);
//品牌名
setText(view, R.id.tv_brand_name, RestaurantInfoManager.newInstance().getBrandName());
//餐廳名
setText(view, R.id.tv_restaurant_name, RestaurantInfoManager.newInstance().getRestaurantName());
// 訂單號
setText(view, R.id.tv_order_number, "單號:" + data.getORDER_NO());
tvBillNumber.setVisibility(View.GONE);
if (data.getOrder_type() == 2) {
//外送
// 訂單類型
setText(view, R.id.tv_order_type, "外送");
if (data.getTakeFoodCode() != null && !data.getTakeFoodCode().equals("0")) {
setText(view, R.id.tv_order_take_food_code, "訂單碼:" + data.getTakeFoodCode());
} else if (data.getBillNo() != null && data.getBillNo().length() > 0) {
setText(view, R.id.tv_order_take_food_code, "訂單碼:" + data.getTakeFoodCode());
}
} else {
setText(view, R.id.tv_order_type, "自取");
if (data.getBillNo() != null && data.getBillNo().length() > 0) {
setText(view, R.id.tv_order_take_food_code, "訂單碼:" + data.getBillNo());
} else if (data.getTakeFoodCode() != null && !data.getTakeFoodCode().equals("0")) {
setText(view, R.id.tv_order_take_food_code, "訂單碼:" + data.getTakeFoodCode());
}
}
//訂單創建時間
setText(view, R.id.tv_order_create, context.getString(R.string.create_order_time) + TimeUtils.parseTimeRepeat(data.getCREATE_TIME(), TimeUtils.DEFAULT_DATE_FORMAT));
String amountUnit = context.getString(R.string.amount_unit);
RecyclerView rvBill = view.findViewById(R.id.rv_bill);
List<PrintBillItem> billData = new ArrayList<>();
billData.add(getBillBean("合計:", amountUnit + MoneyUtil.sub(MoneyUtil.sub(Double.parseDouble(data.getTOTAL_AMOUNT()), data.getLunchbox()), data.getDELIVERY_CHARGE())));
if (data.getLunchbox() != 0) {
billData.add(getBillBean("餐盒費:", amountUnit + data.getLunchbox()));
}
if (data.getDELIVERY_CHARGE() != 0) {
billData.add(getBillBean("送貨費:", amountUnit + data.getDELIVERY_CHARGE()));
}
if (data.getCouponList() != null && data.getCouponList().size() > 0) {
for (OrderDetails.DataBean.CouponBean coupon : data.getCouponList()) {
billData.add(getBillBean(coupon.getCouponName() + ":", "-$" + coupon.getDiscount_amount()));
}
}
BillItemAdapter adapter = new BillItemAdapter(billData);
rvBill.setLayoutManager(new LinearLayoutManager(context));
rvBill.setAdapter(adapter);
//總金額
setText(view, R.id.tv_total, amountUnit + data.getTOTAL_AMOUNT());
if (data.getOrderPayType() == 1) {
//貨到付款
setText(view, R.id.tv_pay_type, "貨到付款");
// if (data.getPayName() != null) {
// //支付金額
// setText(view, R.id.tv_pay_amount_text, data.getPayName() + ":" + amountUnit + MoneyUtil.sub(Double.parseDouble(data.getTOTAL_AMOUNT()), data.getDiscount_amount()));
// } else {
setIsShow(view, R.id.tv_pay_amount_text, false);
setIsShow(view, R.id.tv_pay_amount_line, false);
// }
} else if (data.getOrderPayType() == 0) {
setText(view, R.id.tv_pay_type, "店內支付");
} else if (data.getOrderPayType() == 2) {
setText(view, R.id.tv_pay_type, "在線支付");
// setText(view, R.id.tv_pay_amount_text, data.getPayName() + ":" + amountUnit + MoneyUtil.sub(Double.parseDouble(data.getTOTAL_AMOUNT()), data.getDiscount_amount()));
// setText(view, R.id.tv_pay_amount_text, data.getPayName() + ":" + amountUnit + data.getPayAmount());
}
if (data.getPayTime() != null) {
tvOrderClosing.setText("結賬時間:" + data.getPayTime());
tvOrderClosing.setVisibility(View.VISIBLE);
}
//收貨時間
setText(view, R.id.tv_delivery_time, data.getOrder_type() == 2 ? data.getSEND_TIME() : data.getTakeTime());
if (data.getOrder_type() != 2) {
//自取,隱藏地址和收貨人
view.findViewById(R.id.tv_address).setVisibility(View.GONE);
view.findViewById(R.id.tv_receiver).setVisibility(View.GONE);
} else {
//收貨地址
setText(view, R.id.tv_address, context.getString(R.string.address) + data.getAddressDetail());
//收貨人
setText(view, R.id.tv_receiver, "收貨人:" + data.getRECEIVER());
}
//手機號
setText(view, R.id.tv_phone, "手機號:" + data.getPHONE());
//備註
if (data.getRemark() != null && !data.getRemark().isEmpty()) {
setText(view, R.id.tv_remark, "備註:" + data.getRemark());
view.findViewById(R.id.tv_remark).setVisibility(View.VISIBLE);
} else {
view.findViewById(R.id.tv_remark).setVisibility(View.GONE);
}
if (data.getPRODUCT_NAME() != null) {
RecyclerView rvFoodList = view.findViewById(R.id.rv_order_print_food);
rvFoodList.setLayoutManager(new LinearLayoutManager(context));
rvFoodList.setAdapter(new OtherOrderAdapter(context, data.getPRODUCT_NAME(), true));
}
if (data.getAddPoints() != 0 || data.getOldPoints() != 0 || data.getAddPoints() != 0) {
tvAddPoints.setText("本次積分:" + data.getAddPoints());
tvNowPoint.setText("結餘積分:" + data.getNowPoints());
tvOldPoints.setText("上次積分:" + data.getOldPoints());
//名稱中間替換為*號
if (data.getMEMBER_NAME() != null && data.getMEMBER_NAME().length() > 0) {
tvMemberName.setText("會員名稱:" + getReplaceAfter(data.getMEMBER_NAME()));
tvMemberName.setVisibility(View.VISIBLE);
}
if (data.getPHONE() != null && data.getPHONE().length() > 0) {
tvMemberPhone.setText("會員電話:" + getReplaceAfter(data.getPHONE()));
tvMemberPhone.setVisibility(View.VISIBLE);
}
tvMemberName.setVisibility(View.VISIBLE);
tvAddPoints.setVisibility(View.VISIBLE);
tvNowPoint.setVisibility(View.VISIBLE);
tvOldPoints.setVisibility(View.VISIBLE);
lineMember.setVisibility(View.VISIBLE);
}
return viewToZoomBitmap(context, view, deviceBean);
}
private Bitmap getBitmap(Context mContext, OrderDetails.DataBean data, PrinterDeviceBean deviceBean) { private Bitmap getBitmap(Context mContext, OrderDetails.DataBean data, PrinterDeviceBean deviceBean) {
LinearLayout layout = new LinearLayout(mContext); LinearLayout layout = new LinearLayout(mContext);
layout.setOrientation(LinearLayout.VERTICAL); layout.setOrientation(LinearLayout.VERTICAL);
......
...@@ -601,33 +601,7 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintExecut ...@@ -601,33 +601,7 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintExecut
TextView tvRemark = view.findViewById(R.id.tv_print_model_remark); TextView tvRemark = view.findViewById(R.id.tv_print_model_remark);
//訂單類型 //訂單類型
tvOrderType.setText(data.getShowTextByOrderType()); tvOrderType.setText(data.getShowTextByOrderType());
// String payType = "";
tvClosingTime.setVisibility(View.GONE); tvClosingTime.setVisibility(View.GONE);
// if (data.getOrderPayType() == 1) {
// //貨到付款
// payType = "貨到付款";
// } else if (data.getOrderPayType() == 0) {
// payType = "店內支付";
// } else if (data.getOrderPayType() == 2) {
// if (data.getPayMultiple() != null) {
// StringBuilder payName = new StringBuilder();
// for (OrderDetails.DataBean.PayMultiple payMultiple : data.getPayMultiple()) {
// payName.append(payMultiple.getPayName());
// payName.append(",");
// }
// if (payName.length() > 0) {
// payName.deleteCharAt(payName.length() - 1);
// }
// payType = "在線支付:" + payName.toString();
// } else {
// payType = "在線支付";
// }
// //支付時間,只有在線支付有
// if (!TextUtil.isEmptyOrNullOrUndefined(data.getPayTime())) {
// tvClosingTime.setText("支付時間:" + data.getPayTime());
// tvClosingTime.setVisibility(View.VISIBLE);
// }
// }
if (data.getOrderPayType() == 2) { if (data.getOrderPayType() == 2) {
//支付時間,只有在線支付有 //支付時間,只有在線支付有
if (!TextUtil.isEmptyOrNullOrUndefined(data.getPayTime())) { if (!TextUtil.isEmptyOrNullOrUndefined(data.getPayTime())) {
...@@ -640,14 +614,14 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintExecut ...@@ -640,14 +614,14 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintExecut
tvPayType.setText(data.getShowTextByOrderPayType()); tvPayType.setText(data.getShowTextByOrderPayType());
} }
//送達時間 //送達時間
tvDeliveryTime.setText(data.getOrder_type() == 2 ? data.getSEND_TIME() : data.getTakeTime()); tvDeliveryTime.setText(data.getOrderType() == 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())) {
if (DeliveryPickConstans.COLD_CHAIN_TYPE.equals(data.getOrder_type() + "")) { if (DeliveryPickConstans.COLD_CHAIN_TYPE.equals(data.getOrderType() + "")) {
//凍鏈 //凍鏈
tvOrderNumber.setText("訂單號:" + data.getID()); tvOrderNumber.setText("訂單號:" + data.getID());
tvOrderNumber.setVisibility(View.VISIBLE); tvOrderNumber.setVisibility(View.VISIBLE);
...@@ -659,7 +633,7 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintExecut ...@@ -659,7 +633,7 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintExecut
} }
//取餐碼 //取餐碼
if (data.getOrder_type() == 7) { if (data.getOrderType() == 7) {
//自取 顯示 取餐碼+訂單碼 //自取 顯示 取餐碼+訂單碼
if (!TextUtil.isEmptyOrNullOrUndefined(data.getTakeFoodCode())) { if (!TextUtil.isEmptyOrNullOrUndefined(data.getTakeFoodCode())) {
tvTakeFoodCode.setText("取餐碼:" + data.getTakeFoodCode()); tvTakeFoodCode.setText("取餐碼:" + data.getTakeFoodCode());
...@@ -671,9 +645,7 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintExecut ...@@ -671,9 +645,7 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintExecut
if (data.getTakeFoodCode() == null || data.getTakeFoodCode().equals("0")) { if (data.getTakeFoodCode() == null || data.getTakeFoodCode().equals("0")) {
tvTakeFoodCode.setVisibility(View.GONE); tvTakeFoodCode.setVisibility(View.GONE);
} }
tvCreateTime.setText("開單時間:" + TimeUtils.parseTimeRepeat(data.getCREATE_TIME(), TimeUtils.DEFAULT_DATE_FORMAT)); tvCreateTime.setText("開單時間:" + TimeUtils.parseTimeRepeat(data.getCREATE_TIME(), TimeUtils.DEFAULT_DATE_FORMAT));
//備註 //備註
if (!TextUtil.isEmptyOrNullOrUndefined(data.getRemark())) { if (!TextUtil.isEmptyOrNullOrUndefined(data.getRemark())) {
tvRemark.setText("備註:" + data.getRemark()); tvRemark.setText("備註:" + data.getRemark());
...@@ -833,7 +805,7 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintExecut ...@@ -833,7 +805,7 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintExecut
protected void getTakeawayReceiver(Context mContext, OrderDetails.DataBean data, LinearLayout layout) { protected void getTakeawayReceiver(Context mContext, OrderDetails.DataBean data, LinearLayout layout) {
String address = ""; String address = "";
String receiver = ""; String receiver = "";
if (data.getOrder_type() == 2) { if (data.getOrderType() == 2) {
//收貨地址 //收貨地址
address = "地址:" + data.getAddressDetail(); address = "地址:" + data.getAddressDetail();
//收貨人 //收貨人
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<!-- 使用透明背景主題,注意,在8.0設備上不能固定屏幕方向-->
<style name="print_TranslucentTheme" parent="AppTheme"> <style name="print_TranslucentTheme" parent="AppTheme">
<item name="android:windowBackground">@android:color/transparent</item> <item name="android:windowBackground">@android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item> <item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowIsTranslucent">true</item> <item name="android:windowIsTranslucent">true</item>
<!-- <item name="android:windowDisablePreview">true</item>--> <!-- <item name="android:windowDisablePreview">true</item>-->
<item name="android:windowAnimationStyle">@android:style/Animation</item> <item name="android:windowAnimationStyle">@android:style/Animation</item>
<item name="android:windowNoTitle">true</item> <item name="android:windowNoTitle">true</item>
<item name="android:windowContentOverlay">@null</item> <item name="android:windowContentOverlay">@null</item>
...@@ -16,14 +16,15 @@ ...@@ -16,14 +16,15 @@
<item name="android:layout_height">@dimen/printer_add_input_height</item> <item name="android:layout_height">@dimen/printer_add_input_height</item>
<item name="android:paddingLeft">@dimen/printer_add_input_paddingLeft</item> <item name="android:paddingLeft">@dimen/printer_add_input_paddingLeft</item>
<item name="android:paddingRight">@dimen/printer_add_input_paddingLeft</item> <item name="android:paddingRight">@dimen/printer_add_input_paddingLeft</item>
<!-- <item name="android:paddingTop">@dimen/printer_add_input_paddingTop</item>--> <!-- <item name="android:paddingTop">@dimen/printer_add_input_paddingTop</item>-->
<!-- <item name="android:paddingBottom">@dimen/printer_add_input_paddingBottom</item>--> <!-- <item name="android:paddingBottom">@dimen/printer_add_input_paddingBottom</item>-->
</style> </style>
<style name="print_other_order_eighteen_style"> <style name="print_other_order_eighteen_style">
<item name="android:textColor">@color/theme_333_color</item> <item name="android:textColor">@color/theme_333_color</item>
<item name="android:textSize">@dimen/dp_18</item> <item name="android:textSize">@dimen/dp_18</item>
</style> </style>
<style name="print_other_order_food_style"> <style name="print_other_order_food_style">
<item name="android:textColor">@color/theme_333_color</item> <item name="android:textColor">@color/theme_333_color</item>
<item name="android:textSize">@dimen/dp_34</item> <item name="android:textSize">@dimen/dp_34</item>
......
...@@ -91,52 +91,55 @@ dependencies { ...@@ -91,52 +91,55 @@ dependencies {
} }
aspectjx { aspectjx {
enabled true enabled true
exclude 'androidx', 'org.jetbrains.kotlin',"module-info", 'com.google', 'com.squareup', 'org.apache', 'versions.9', 'com.squareup.okio', 'okio', 'leakcanary', 'com.google.firebase', 'com.google.android' exclude 'androidx', 'org.jetbrains.kotlin', "module-info", 'com.google', 'com.squareup', 'org.apache', 'versions.9', 'com.squareup.okio', 'okio', 'leakcanary', 'com.google.firebase', 'com.google.android'
} }
} }
//import org.aspectj.bridge.IMessage import org.aspectj.bridge.IMessage
//import org.aspectj.bridge.MessageHandler import org.aspectj.bridge.MessageHandler
//import org.aspectj.tools.ajc.Main import org.aspectj.tools.ajc.Main
//final def log = project.logger
//final def variants = project.android.applicationVariants if (project.ext.runAsApp) {
// final def log = project.logger
//variants.all { variant -> final def variants = project.android.applicationVariants
// if (!variant.buildType.isDebuggable()) {
// log.debug("Skipping non-debuggable build type '${variant.buildType.name}'.") variants.all { variant ->
// return; if (!variant.buildType.isDebuggable()) {
// } log.debug("Skipping non-debuggable build type '${variant.buildType.name}'.")
// return;
// JavaCompile javaCompile = variant.javaCompile }
// javaCompile.doLast {
// String[] args = ["-showWeaveInfo", JavaCompile javaCompile = variant.javaCompile
// "-1.8", javaCompile.doLast {
// "-inpath", javaCompile.destinationDir.toString(), String[] args = ["-showWeaveInfo",
// "-aspectpath", javaCompile.classpath.asPath, "-1.8",
// "-d", javaCompile.destinationDir.toString(), "-inpath", javaCompile.destinationDir.toString(),
// "-classpath", javaCompile.classpath.asPath, "-aspectpath", javaCompile.classpath.asPath,
// "-bootclasspath", project.android.bootClasspath.join(File.pathSeparator)] "-d", javaCompile.destinationDir.toString(),
// log.debug "ajc args: " + Arrays.toString(args) "-classpath", javaCompile.classpath.asPath,
// "-bootclasspath", project.android.bootClasspath.join(File.pathSeparator)]
// MessageHandler handler = new MessageHandler(true); log.debug "ajc args: " + Arrays.toString(args)
// new Main().run(args, handler);
// for (IMessage message : handler.getMessages(null, true)) { MessageHandler handler = new MessageHandler(true);
// switch (message.getKind()) { new Main().run(args, handler);
// case IMessage.ABORT: for (IMessage message : handler.getMessages(null, true)) {
// case IMessage.ERROR: switch (message.getKind()) {
// case IMessage.FAIL: case IMessage.ABORT:
// log.error message.message, message.thrown case IMessage.ERROR:
// break; case IMessage.FAIL:
// case IMessage.WARNING: log.error message.message, message.thrown
// log.warn message.message, message.thrown break;
// break; case IMessage.WARNING:
// case IMessage.INFO: log.warn message.message, message.thrown
// log.info message.message, message.thrown break;
// break; case IMessage.INFO:
// case IMessage.DEBUG: log.info message.message, message.thrown
// log.debug message.message, message.thrown break;
// break; case IMessage.DEBUG:
// } log.debug message.message, message.thrown
// } break;
// } }
//} }
\ No newline at end of file }
}
}
\ No newline at end of file
...@@ -9,10 +9,7 @@ import androidx.annotation.NonNull; ...@@ -9,10 +9,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.gingersoft.gsa.cloud.common.BuildConfig; import com.gingersoft.gsa.cloud.common.BuildConfig;
import com.gingersoft.gsa.cloud.common.function.click.SingleClick;
import com.gingersoft.gsa.cloud.common.utils.other.SPUtils; import com.gingersoft.gsa.cloud.common.utils.other.SPUtils;
import com.gingersoft.gsa.cloud.database.bean.Function; import com.gingersoft.gsa.cloud.database.bean.Function;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
...@@ -25,7 +22,6 @@ import com.gingersoft.supply_chain.mvp.ui.adapter.FunctionChildAdapter; ...@@ -25,7 +22,6 @@ import com.gingersoft.supply_chain.mvp.ui.adapter.FunctionChildAdapter;
import com.gingersoft.supply_chain.mvp.ui.adapter.PurchaseFunctionAdapter; import com.gingersoft.supply_chain.mvp.ui.adapter.PurchaseFunctionAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.category.CategoryFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.category.CategoryFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.BuyIngredientsFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.food.BuyIngredientsFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodIngredientsFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.MeasurementUnitFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.food.MeasurementUnitFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.inventory.StorageListFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.inventory.StorageListFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.order.PurchaseListFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.order.PurchaseListFragment;
......
...@@ -19,7 +19,7 @@ import android.app.Activity; ...@@ -19,7 +19,7 @@ import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo;
import android.graphics.Color; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.View; import android.view.View;
...@@ -29,16 +29,14 @@ import androidx.annotation.Nullable; ...@@ -29,16 +29,14 @@ import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import com.gyf.immersionbar.ImmersionBar; import com.gyf.immersionbar.ImmersionBar;
import com.jess.arms.R;
import com.jess.arms.base.delegate.IActivity; import com.jess.arms.base.delegate.IActivity;
import com.jess.arms.integration.cache.Cache; import com.jess.arms.integration.cache.Cache;
import com.jess.arms.integration.cache.CacheType; import com.jess.arms.integration.cache.CacheType;
import com.jess.arms.integration.lifecycle.ActivityLifecycleable; import com.jess.arms.integration.lifecycle.ActivityLifecycleable;
import com.jess.arms.mvp.IPresenter; import com.jess.arms.mvp.IPresenter;
import com.jess.arms.utils.AndroidWorkaround;
import com.jess.arms.utils.ArmsUtils; import com.jess.arms.utils.ArmsUtils;
import com.qmuiteam.qmui.util.QMUIDeviceHelper; import com.qmuiteam.qmui.util.QMUIDeviceHelper;
import com.qmuiteam.qmui.util.QMUIStatusBarHelper; import com.qmuiteam.qmui.util.QMUIWindowHelper;
import com.trello.rxlifecycle2.android.ActivityEvent; import com.trello.rxlifecycle2.android.ActivityEvent;
import javax.inject.Inject; import javax.inject.Inject;
...@@ -98,12 +96,17 @@ public abstract class BaseActivity<P extends IPresenter> extends AppCompatActivi ...@@ -98,12 +96,17 @@ public abstract class BaseActivity<P extends IPresenter> extends AppCompatActivi
protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
mContext = this; mContext = this;
if (QMUIDeviceHelper.isTablet(this)) { if (Build.VERSION.SDK_INT == Build.VERSION_CODES.O && QMUIWindowHelper.isTranslucentOrFloating(this)) {
//平板端按照系統方向來 //如果是8.0的設備並且Activity為透明的,這時候設置強制豎屏會報錯,所以不要設置強制豎屏
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); boolean result = QMUIWindowHelper.fixOrientation(this);
} else { } else {
//手機端直接強制竖屏 if (QMUIDeviceHelper.isTablet(this)) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); //平板端按照系統方向來
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
} else {
//手機端直接強制竖屏
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
} }
//DecorView的背景对我来说无用,但是会产生一次Overdraw,这里去掉(过度绘制优化) //DecorView的背景对我来说无用,但是会产生一次Overdraw,这里去掉(过度绘制优化)
getWindow().setBackgroundDrawable(null); getWindow().setBackgroundDrawable(null);
......
...@@ -142,13 +142,11 @@ dependencies { ...@@ -142,13 +142,11 @@ dependencies {
repositories { repositories {
mavenCentral() mavenCentral()
} }
import org.aspectj.bridge.IMessage import org.aspectj.bridge.IMessage
import org.aspectj.bridge.MessageHandler import org.aspectj.bridge.MessageHandler
import org.aspectj.tools.ajc.Main import org.aspectj.tools.ajc.Main
final def log = project.logger final def log = project.logger
android.libraryVariants.all { variant -> android.libraryVariants.all { variant ->
if (!variant.buildType.isDebuggable()) { if (!variant.buildType.isDebuggable()) {
log.debug("Skipping non-debuggable build type '${variant.buildType.name}'.") log.debug("Skipping non-debuggable build type '${variant.buildType.name}'.")
......
...@@ -82,10 +82,11 @@ class OrderDetails { ...@@ -82,10 +82,11 @@ class OrderDetails {
var TOTAL_AMOUNT: String? = null var TOTAL_AMOUNT: String? = null
//訂單類型#1:餐廳訂單;2:線上外賣訂單3:扫码点餐;4固定二维码订单;5:预点餐;6:積分訂單;7:自取订单;8:冷鏈 //訂單類型#1:餐廳訂單;2:線上外賣訂單3:扫码点餐;4固定二维码订单;5:预点餐;6:積分訂單;7:自取订单;8:冷鏈
var order_type: Int = 0 var orderType: Int = 0
//是否是預約單 0 :即時單 1:是預約單 //是否是預約單 0 :即時單 1:是預約單
var appointmentType: Int = 0 var appointmentType: Int = 0
//會員號碼 //會員號碼
var memberPhone: String? = null var memberPhone: String? = null
var orderPayType: Int = 0//0店內支付,1為貨到付款,2是在線支付 var orderPayType: Int = 0//0店內支付,1為貨到付款,2是在線支付
...@@ -119,10 +120,12 @@ class OrderDetails { ...@@ -119,10 +120,12 @@ class OrderDetails {
var labUrl: String? = null //打印文檔鏈接 var labUrl: String? = null //打印文檔鏈接
fun getShowTextByOrderType(): String { fun getShowTextByOrderType(): String {
return when (order_type) { return when (orderType) {
2 -> "外送" 2 -> "外送"
3 -> "掃碼點餐"
8 -> "凍鏈" 8 -> "凍鏈"
else -> "自取" 7 -> "自取"
else -> "未知$orderType"
} }
} }
......
...@@ -415,7 +415,7 @@ class ICommandService : Service() { ...@@ -415,7 +415,7 @@ class ICommandService : Service() {
fun send(currConnectionType: Int) { fun send(currConnectionType: Int) {
// val token = "weixin_" + RestaurantInfoManager.newInstance().restaurantId + "_" + UserContext.newInstance().memberId + "_" + getRandomString(24) // val token = "weixin_" + RestaurantInfoManager.newInstance().restaurantId + "_" + UserContext.newInstance().memberId + "_" + getRandomString(24)
val token = "weixin_" + RestaurantInfoManager.newInstance().restaurantId + "_" + getRandomString(24) val token = "weixin_" + RestaurantInfoManager.newInstance().restaurantId + "_" + getRandomString(24)
LoganManager.w_code(TAG, "token=" + token) LoganManager.w_code(TAG, "token=$token")
if (mWebSocket != null) { if (mWebSocket != null) {
mWebSocket?.send(Gson().toJson(MsgBean(1, getConnectiontype(), token, UserContext.newInstance().memberId, DeviceUtils.getDeviceId(this)))) mWebSocket?.send(Gson().toJson(MsgBean(1, getConnectiontype(), token, UserContext.newInstance().memberId, DeviceUtils.getDeviceId(this))))
} }
......
...@@ -138,9 +138,13 @@ public class GsonUtils { ...@@ -138,9 +138,13 @@ public class GsonUtils {
if (TextUtil.isEmptyOrNullOrUndefined(json)) { if (TextUtil.isEmptyOrNullOrUndefined(json)) {
return null; return null;
} }
JsonArray array = new JsonParser().parse(json).getAsJsonArray(); try {
for (final JsonElement elem : array) { JsonArray array = new JsonParser().parse(json).getAsJsonArray();
mList.add(gson.fromJson(elem, cls)); for (final JsonElement elem : array) {
mList.add(gson.fromJson(elem, cls));
}
} catch (JSONException | JsonSyntaxException | IllegalStateException e) {
e.printStackTrace();
} }
return mList; return mList;
} }
......
...@@ -217,9 +217,7 @@ public class InputFilterUtils { ...@@ -217,9 +217,7 @@ public class InputFilterUtils {
*/ */
private static int getCurLength(CharSequence s) { private static int getCurLength(CharSequence s) {
int length = 0; int length = 0;
if (s == null) { if (s != null) {
return length;
} else {
for (int i = 0; i < s.length(); i++) { for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) < 128) { if (s.charAt(i) < 128) {
length += 1; length += 1;
...@@ -228,7 +226,7 @@ public class InputFilterUtils { ...@@ -228,7 +226,7 @@ public class InputFilterUtils {
} }
} }
} }
return s.length(); return length;
} }
/** /**
......
...@@ -58,6 +58,7 @@ public class PrintContentAdapter implements AdaptationContent { ...@@ -58,6 +58,7 @@ public class PrintContentAdapter implements AdaptationContent {
/** /**
* 清機打印 * 清機打印
*
* @param settlementReport * @param settlementReport
* @return * @return
*/ */
...@@ -76,6 +77,7 @@ public class PrintContentAdapter implements AdaptationContent { ...@@ -76,6 +77,7 @@ public class PrintContentAdapter implements AdaptationContent {
/** /**
* 印單 * 印單
*
* @param doshokuOrder * @param doshokuOrder
* @param tableBean * @param tableBean
* @return * @return
...@@ -100,6 +102,7 @@ public class PrintContentAdapter implements AdaptationContent { ...@@ -100,6 +102,7 @@ public class PrintContentAdapter implements AdaptationContent {
/** /**
* 送單 * 送單
*
* @param doshokuOrder * @param doshokuOrder
* @param tableBean * @param tableBean
* @return * @return
...@@ -121,6 +124,7 @@ public class PrintContentAdapter implements AdaptationContent { ...@@ -121,6 +124,7 @@ public class PrintContentAdapter implements AdaptationContent {
/** /**
* 上菜紙 * 上菜紙
*
* @param doshokuOrder * @param doshokuOrder
* @param tableBean * @param tableBean
* @return * @return
...@@ -142,6 +146,7 @@ public class PrintContentAdapter implements AdaptationContent { ...@@ -142,6 +146,7 @@ public class PrintContentAdapter implements AdaptationContent {
/** /**
* 打印結賬單 * 打印結賬單
*
* @param doshokuOrder * @param doshokuOrder
* @param tableBean * @param tableBean
* @return * @return
...@@ -213,10 +218,12 @@ public class PrintContentAdapter implements AdaptationContent { ...@@ -213,10 +218,12 @@ public class PrintContentAdapter implements AdaptationContent {
} }
takeawayPrintContent.setBrand(RestaurantInfoManager.newInstance().getBrandName()); takeawayPrintContent.setBrand(RestaurantInfoManager.newInstance().getBrandName());
takeawayPrintContent.setResturantName(RestaurantInfoManager.newInstance().getRestaurantName()); takeawayPrintContent.setResturantName(RestaurantInfoManager.newInstance().getRestaurantName());
if (data.getOrder_type() == 2) { if (data.getOrderType() == 2) {
takeawayPrintContent.setOrderType("外送"); takeawayPrintContent.setOrderType("外送");
} else { } else if (data.getOrderType() == 7) {
takeawayPrintContent.setOrderType("自取"); takeawayPrintContent.setOrderType("自取");
} else {
takeawayPrintContent.setOrderType("" + data.getOrderType());
} }
if (data.getPayType() == 2) { if (data.getPayType() == 2) {
if (!TextUtil.isEmptyOrNullOrUndefined(data.getPayTime())) { if (!TextUtil.isEmptyOrNullOrUndefined(data.getPayTime())) {
...@@ -227,7 +234,7 @@ public class PrintContentAdapter implements AdaptationContent { ...@@ -227,7 +234,7 @@ public class PrintContentAdapter implements AdaptationContent {
} }
} }
//取餐碼 //取餐碼
if (data.getOrder_type() == 7) { if (data.getOrderType() == 7) {
//自取 顯示 取餐碼+訂單碼 //自取 顯示 取餐碼+訂單碼
if (!TextUtil.isEmptyOrNullOrUndefined(data.getTakeFoodCode())) { if (!TextUtil.isEmptyOrNullOrUndefined(data.getTakeFoodCode())) {
takeawayPrintContent.setOrderTakeFoodCode("取餐碼:" + data.getTakeFoodCode()); takeawayPrintContent.setOrderTakeFoodCode("取餐碼:" + data.getTakeFoodCode());
...@@ -248,7 +255,7 @@ public class PrintContentAdapter implements AdaptationContent { ...@@ -248,7 +255,7 @@ public class PrintContentAdapter implements AdaptationContent {
takeawayPrintContent.setOrderNo("單號:" + data.getORDER_NO()); takeawayPrintContent.setOrderNo("單號:" + data.getORDER_NO());
//支付類型 //支付類型
takeawayPrintContent.setPayType(getPaytype(data)); takeawayPrintContent.setPayType(getPaytype(data));
takeawayPrintContent.setDeliveryTime(data.getOrder_type() == 2 ? data.getSEND_TIME() : data.getTakeTime()); takeawayPrintContent.setDeliveryTime(data.getOrderType() == 2 ? data.getSEND_TIME() : data.getTakeTime());
takeawayPrintContent.setBillingTime("開單時間:" + TimeUtils.parseTimeRepeat(data.getCREATE_TIME(), TimeUtils.DEFAULT_DATE_FORMAT)); takeawayPrintContent.setBillingTime("開單時間:" + TimeUtils.parseTimeRepeat(data.getCREATE_TIME(), TimeUtils.DEFAULT_DATE_FORMAT));
takeawayPrintContent.setRemark("備註:" + data.getRemark()); takeawayPrintContent.setRemark("備註:" + data.getRemark());
takeawayPrintContent.setFoodItemList(getPrintFoodItemsByProductBeans(data.getPRODUCT_NAME())); takeawayPrintContent.setFoodItemList(getPrintFoodItemsByProductBeans(data.getPRODUCT_NAME()));
...@@ -269,7 +276,7 @@ public class PrintContentAdapter implements AdaptationContent { ...@@ -269,7 +276,7 @@ public class PrintContentAdapter implements AdaptationContent {
takeawayPrintContent.setMemberOldPoints("上次積分: " + data.getOldPoints()); takeawayPrintContent.setMemberOldPoints("上次積分: " + data.getOldPoints());
takeawayPrintContent.setMemberAddPoints("本次積分: " + data.getAddPoints()); takeawayPrintContent.setMemberAddPoints("本次積分: " + data.getAddPoints());
takeawayPrintContent.setMemberNowPoints("結餘積分: " + data.getNowPoints()); takeawayPrintContent.setMemberNowPoints("結餘積分: " + data.getNowPoints());
if (data.getOrder_type() == 2) { if (data.getOrderType() == 2) {
//自取,隱藏地址和收貨人 //自取,隱藏地址和收貨人
// takeawayPrintContent.setAdress("地址: " + data.getAddressDetail()); // takeawayPrintContent.setAdress("地址: " + data.getAddressDetail());
takeawayPrintContent.setAdress(data.getAddressDetail()); takeawayPrintContent.setAdress(data.getAddressDetail());
......
...@@ -16,6 +16,10 @@ ...@@ -16,6 +16,10 @@
package com.qmuiteam.qmui.util; package com.qmuiteam.qmui.util;
import android.app.Activity;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.res.TypedArray;
import android.graphics.Rect; import android.graphics.Rect;
import android.os.Build; import android.os.Build;
import android.view.View; import android.view.View;
...@@ -23,8 +27,10 @@ import android.view.ViewParent; ...@@ -23,8 +27,10 @@ import android.view.ViewParent;
import android.view.WindowManager; import android.view.WindowManager;
import com.qmuiteam.qmui.BuildConfig; import com.qmuiteam.qmui.BuildConfig;
import com.qmuiteam.qmui.R;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Method;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
...@@ -58,7 +64,7 @@ public class QMUIWindowHelper { ...@@ -58,7 +64,7 @@ public class QMUIWindowHelper {
@SuppressWarnings({"JavaReflectionMemberAccess"}) @SuppressWarnings({"JavaReflectionMemberAccess"})
public static Rect unSafeGetWindowVisibleInsets(@NonNull View view) { public static Rect unSafeGetWindowVisibleInsets(@NonNull View view) {
Object attachInfo = getAttachInfoFromView(view); Object attachInfo = getAttachInfoFromView(view);
if(attachInfo == null){ if (attachInfo == null) {
return null; return null;
} }
try { try {
...@@ -81,7 +87,7 @@ public class QMUIWindowHelper { ...@@ -81,7 +87,7 @@ public class QMUIWindowHelper {
@SuppressWarnings({"JavaReflectionMemberAccess"}) @SuppressWarnings({"JavaReflectionMemberAccess"})
public static Rect unSafeGetContentInsets(@NonNull View view) { public static Rect unSafeGetContentInsets(@NonNull View view) {
Object attachInfo = getAttachInfoFromView(view); Object attachInfo = getAttachInfoFromView(view);
if(attachInfo == null){ if (attachInfo == null) {
return null; return null;
} }
try { try {
...@@ -100,15 +106,15 @@ public class QMUIWindowHelper { ...@@ -100,15 +106,15 @@ public class QMUIWindowHelper {
return null; return null;
} }
public static Object getAttachInfoFromView(@NonNull View view){ public static Object getAttachInfoFromView(@NonNull View view) {
Object attachInfo = null; Object attachInfo = null;
if(Build.VERSION.SDK_INT > Build.VERSION_CODES.P){ if (Build.VERSION.SDK_INT > Build.VERSION_CODES.P) {
// Android 10+ can not reflect the View.mAttachInfo // Android 10+ can not reflect the View.mAttachInfo
// fortunately now it is in light greylist in ViewRootImpl // fortunately now it is in light greylist in ViewRootImpl
View rootView = view.getRootView(); View rootView = view.getRootView();
if(rootView != null){ if (rootView != null) {
ViewParent vp = rootView.getParent(); ViewParent vp = rootView.getParent();
if(vp != null){ if (vp != null) {
try { try {
Field field = vp.getClass().getDeclaredField("mAttachInfo"); Field field = vp.getClass().getDeclaredField("mAttachInfo");
field.setAccessible(true); field.setAccessible(true);
...@@ -120,7 +126,7 @@ public class QMUIWindowHelper { ...@@ -120,7 +126,7 @@ public class QMUIWindowHelper {
} }
} }
} }
}else{ } else {
try { try {
// Android P forbid the reflection for @hide filed, // Android P forbid the reflection for @hide filed,
// fortunately now it is in light greylist, just be warned. // fortunately now it is in light greylist, just be warned.
...@@ -135,4 +141,45 @@ public class QMUIWindowHelper { ...@@ -135,4 +141,45 @@ public class QMUIWindowHelper {
} }
return attachInfo; return attachInfo;
} }
/**
* 是不是透明背景Activity
* @param context
* @return
*/
public static boolean isTranslucentOrFloating(Context context) {
boolean isTranslucentOrFloating = false;
try {
int[] styleableRes = (int[]) Class.forName("com.android.internal.R$styleable").getField("Window").get(null);
final TypedArray ta = context.obtainStyledAttributes(styleableRes);
Method m = ActivityInfo.class.getMethod("isTranslucentOrFloating", TypedArray.class);
m.setAccessible(true);
isTranslucentOrFloating = (boolean) m.invoke(null, ta);
m.setAccessible(false);
} catch (Exception e) {
e.printStackTrace();
}
return isTranslucentOrFloating;
}
/**
* 設置屏幕方向
* @param activity
* @return
*/
public static boolean fixOrientation(Activity activity){
try {
Field field = Activity.class.getDeclaredField("mActivityInfo");
field.setAccessible(true);
ActivityInfo o = (ActivityInfo)field.get(activity);
if(o != null){
o.screenOrientation = -1;
}
field.setAccessible(false);
return true;
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment