Commit 33ba7f75 by Wyh

1、優化prj查詢頁面 2、歷史訂單顯示優化 3、針式打印回調問題修改 4、增加多種打印失敗問題返回給後台 5、供應鏈發送BUG修復 6、打印類修改

parent f410baeb
...@@ -77,6 +77,7 @@ class HistoryOrderViewModel(private val historyOrderRepository: HistoryOrderRepo ...@@ -77,6 +77,7 @@ class HistoryOrderViewModel(private val historyOrderRepository: HistoryOrderRepo
} }
}, { }, {
//出錯 //出錯
it.printStackTrace()
}) })
} }
......
...@@ -120,6 +120,7 @@ public class PrjQueryPresenter extends BasePresenter<PrjQueryContract.Model, Prj ...@@ -120,6 +120,7 @@ public class PrjQueryPresenter extends BasePresenter<PrjQueryContract.Model, Prj
public void onNext(@NonNull BaseResult info) { public void onNext(@NonNull BaseResult info) {
if (info != null) { if (info != null) {
if (info.isSuccess()) { if (info.isSuccess()) {
//打印成功後,再次調用查詢,刷新頁面
getKitchenPrint(orderNo); getKitchenPrint(orderNo);
} else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) { } else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg()); mRootView.showMessage(info.getErrMsg());
......
...@@ -24,6 +24,7 @@ import com.gingersoft.gsa.cloud.print.bean.UpdateBean; ...@@ -24,6 +24,7 @@ import com.gingersoft.gsa.cloud.print.bean.UpdateBean;
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.component.ComponentName; import com.gingersoft.gsa.cloud.component.ComponentName;
import com.gingersoft.gsa.cloud.ui.recylcler.decorator.DividerItemDecoration;
import com.gingersoft.gsa.cloud.ui.utils.AppDialog; import com.gingersoft.gsa.cloud.ui.utils.AppDialog;
import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog; import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog;
import com.gingersoft.gsa.delivery_pick_mode.R; import com.gingersoft.gsa.delivery_pick_mode.R;
...@@ -101,7 +102,7 @@ public class PrjQueryActivity extends BaseActivity<PrjQueryPresenter> implements ...@@ -101,7 +102,7 @@ public class PrjQueryActivity extends BaseActivity<PrjQueryPresenter> implements
if (TextUtil.isNotEmptyOrNullOrUndefined(orderId)) { if (TextUtil.isNotEmptyOrNullOrUndefined(orderId)) {
layoutPrjOrderNumber.setVisibility(View.VISIBLE); layoutPrjOrderNumber.setVisibility(View.VISIBLE);
tvPrjRecordOrderId.setText(orderId); tvPrjRecordOrderId.setText(orderId);
mPresenter.getKitchenPrint(orderId); getKitchenPrintRecord();
} else { } else {
editLayout.setVisibility(View.VISIBLE); editLayout.setVisibility(View.VISIBLE);
} }
...@@ -123,6 +124,9 @@ public class PrjQueryActivity extends BaseActivity<PrjQueryPresenter> implements ...@@ -123,6 +124,9 @@ public class PrjQueryActivity extends BaseActivity<PrjQueryPresenter> implements
topBarPrjPrint.setTitle("廚房打印查詢"); topBarPrjPrint.setTitle("廚房打印查詢");
topBarPrjPrint.setBackgroundColor(ContextCompat.getColor(this, R.color.theme_color)); topBarPrjPrint.setBackgroundColor(ContextCompat.getColor(this, R.color.theme_color));
topBarPrjPrint.addLeftImageButton(R.drawable.icon_return, R.id.iv_left_back).setOnClickListener(v -> killMyself()); topBarPrjPrint.addLeftImageButton(R.drawable.icon_return, R.id.iv_left_back).setOnClickListener(v -> killMyself());
topBarPrjPrint.addRightImageButton(R.drawable.icon_refresh, R.id.topbar_refresh).setOnClickListener(v -> {
getKitchenPrintRecord();
});
} }
@Override @Override
...@@ -175,9 +179,16 @@ public class PrjQueryActivity extends BaseActivity<PrjQueryPresenter> implements ...@@ -175,9 +179,16 @@ public class PrjQueryActivity extends BaseActivity<PrjQueryPresenter> implements
public void onClick(View v) { public void onClick(View v) {
int viewId = v.getId(); int viewId = v.getId();
if (viewId == R.id.iv_search_order_prj) { if (viewId == R.id.iv_search_order_prj) {
if (TextUtil.isNotEmptyOrNullOrUndefined(edOrderNumber)) { getKitchenPrintRecord();
mPresenter.getKitchenPrint(edOrderNumber.getText().toString()); }
} }
private void getKitchenPrintRecord() {
if (TextUtil.isNotEmptyOrNullOrUndefined(edOrderNumber)) {
mPresenter.getKitchenPrint(edOrderNumber.getText().toString());
} else {
showMessage("請輸入訂單號");
edOrderNumber.requestFocus();
} }
} }
...@@ -188,6 +199,7 @@ public class PrjQueryActivity extends BaseActivity<PrjQueryPresenter> implements ...@@ -188,6 +199,7 @@ public class PrjQueryActivity extends BaseActivity<PrjQueryPresenter> implements
if (prjStateAdapter == null) { if (prjStateAdapter == null) {
prjStateAdapter = new PrjStateAdapter(mContext, prjQueryBean.getData()); prjStateAdapter = new PrjStateAdapter(mContext, prjQueryBean.getData());
rvPrjRecordList.setAdapter(prjStateAdapter); rvPrjRecordList.setAdapter(prjStateAdapter);
rvPrjRecordList.addItemDecoration(new DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL_LIST));
prjStateAdapter.setOnItemChildClickListener((adapter, view, position) -> { prjStateAdapter.setOnItemChildClickListener((adapter, view, position) -> {
if (view.getId() == R.id.tv_prj_record_print_operation) { if (view.getId() == R.id.tv_prj_record_print_operation) {
//重印 //重印
......
package com.gingersoft.gsa.delivery_pick_mode.mvp.ui.adapter; package com.gingersoft.gsa.delivery_pick_mode.mvp.ui.adapter;
import android.content.Context; import android.content.Context;
import android.graphics.Color;
import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder; import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
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.gingersoft.gsa.delivery_pick_mode.R; import com.gingersoft.gsa.delivery_pick_mode.R;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
...@@ -20,41 +24,80 @@ public class PrjStateAdapter extends BaseQuickAdapter<PrjBean.DataBean.Bean, Bas ...@@ -20,41 +24,80 @@ public class PrjStateAdapter extends BaseQuickAdapter<PrjBean.DataBean.Bean, Bas
private Context context; private Context context;
private int indentation; private int indentation;
/**
* 打印成功、打印失敗、飛單失敗的顏色
*/
private int successColor, failColor, flyFailColor;
public PrjStateAdapter(Context context, @Nullable List<PrjBean.DataBean.Bean> data) { public PrjStateAdapter(Context context, @Nullable List<PrjBean.DataBean.Bean> data) {
super(R.layout.item_prj_state, data); super(R.layout.item_prj_state, data);
this.context = context; this.context = context;
addChildClickViewIds(R.id.tv_prj_record_print_operation); addChildClickViewIds(R.id.tv_prj_record_print_operation);
successColor = ContextCompat.getColor(context, R.color.order_state4_color);
failColor = ContextCompat.getColor(context, R.color.other_order_details_cancel_btn_color);
flyFailColor = ContextCompat.getColor(context, R.color.bright_orange);
} }
@Override @Override
protected void convert(@NotNull BaseViewHolder baseViewHolder, PrjBean.DataBean.Bean dataBean) { protected void convert(@NotNull BaseViewHolder baseViewHolder, PrjBean.DataBean.Bean dataBean) {
TextView state = baseViewHolder.getView(R.id.tv_prj_record_print_state); //食品組名稱
baseViewHolder.setText(R.id.tv_prj_record_food_group_name, dataBean.getFoodGroupName());
//食品名稱
TextView foodName = baseViewHolder.getView(R.id.tv_prj_record_food_name); TextView foodName = baseViewHolder.getView(R.id.tv_prj_record_food_name);
foodName.setText(dataBean.getProductName()); foodName.setText(dataBean.getProductName());
//打印失敗原因
if (dataBean.getPrinterType() == 3) { TextView tvFailReason = baseViewHolder.getView(R.id.tv_prj_record_fail_reason);
state.setText("已打印"); tvFailReason.setText(UpdateBean.getStateByCode(dataBean.getPrinterType()));
state.setTextColor(ContextCompat.getColor(context, R.color.order_state4_color)); //打印狀態
} else if (dataBean.getPresence() == 0) { foodName.setTextColor(Color.WHITE);
state.setText("未生成打印記錄"); if (dataBean.getPrinterType() == UpdateBean.ALREADY_PRINT) {
state.setTextColor(ContextCompat.getColor(context, R.color.red)); //打印成功
} else if (dataBean.getPrinterDeviceId() == -1) { baseViewHolder.setBackgroundColor(R.id.tv_prj_record_food_name, successColor);
state.setText("未配置打印位置"); tvFailReason.setText("");
state.setTextColor(ContextCompat.getColor(context, R.color.red)); } else if (dataBean.getPrinterType() == UpdateBean.FAILED_PRINT) {
//打印失敗
if (dataBean.getPresence() == PrjBean.DataBean.Bean.NOT_GENERATED_PRJ) {
//未生成PRJ記錄
baseViewHolder.setBackgroundColor(R.id.tv_prj_record_food_name, failColor);
tvFailReason.setText("未生成打印記錄");
} else if (dataBean.getPrinterDeviceId() == -1) {
//打印機id為-1
baseViewHolder.setBackgroundColor(R.id.tv_prj_record_food_name, failColor);
tvFailReason.setText("未配置打印位置");
} else if (TextUtil.isNotEmptyOrNullOrUndefined(dataBean.getFlyingSinglePosition()) && dataBean.getRequests() > PrjBean.DataBean.Bean.REQUEST_COUNT_FLY) {
//飛單位置不為空並且請求次數大於5此,說明飛單打印失敗
baseViewHolder.setBackgroundColor(R.id.tv_prj_record_food_name, flyFailColor);
}
} else { } else {
state.setText("打印失敗"); baseViewHolder.setBackgroundColor(R.id.tv_prj_record_food_name, failColor);
state.setTextColor(ContextCompat.getColor(context, R.color.red));
} }
state.setSelected(true); //設置打印位置
setPrintPosition(baseViewHolder, dataBean);
//請求次數
baseViewHolder.setText(R.id.tv_prj_record_print_count, String.valueOf(dataBean.getRequests() <= 0 ? 1 : dataBean.getRequests()));
//設置縮進
if (baseViewHolder.getAdapterPosition() == 0) { if (baseViewHolder.getAdapterPosition() == 0) {
//只第一次測量一下 //只第一次測量一下
indentation = new BigDecimal(foodName.getPaint().measureText("哈")).setScale(0, BigDecimal.ROUND_HALF_UP).intValue(); indentation = new BigDecimal(foodName.getPaint().measureText("哈")).setScale(0, BigDecimal.ROUND_HALF_UP).intValue();
} }
LinearLayout foodNameLayout = baseViewHolder.getView(R.id.layout_print_state);
if (dataBean.getParentId() != 0) { if (dataBean.getParentId() != 0) {
foodName.setPadding(indentation, foodName.getPaddingTop(), foodName.getPaddingRight(), foodName.getPaddingBottom()); foodNameLayout.setPadding(indentation, foodNameLayout.getPaddingTop(), foodNameLayout.getPaddingRight(), foodNameLayout.getPaddingBottom());
} else {
foodNameLayout.setPadding(0, foodNameLayout.getPaddingTop(), foodNameLayout.getPaddingRight(), foodNameLayout.getPaddingBottom());
}
}
private void setPrintPosition(@NotNull BaseViewHolder baseViewHolder, PrjBean.DataBean.Bean dataBean) {
if (TextUtil.isNotEmptyOrNullOrUndefined(dataBean.getPrintPosition())) {
//打印位置
baseViewHolder.setText(R.id.tv_prj_record_print_position, dataBean.getPrintPosition());
if (TextUtil.isNotEmptyOrNullOrUndefined(dataBean.getFlyingSinglePosition())) {
//打印位置+飛單位置
baseViewHolder.setText(R.id.tv_prj_record_print_position, dataBean.getPrintPosition() + "/" + dataBean.getFlyingSinglePosition());
}
} else { } else {
foodName.setPadding(0, foodName.getPaddingTop(), foodName.getPaddingRight(), foodName.getPaddingBottom()); baseViewHolder.setText(R.id.tv_prj_record_print_position, "");
} }
} }
} }
...@@ -29,13 +29,12 @@ class HistoryFragment : BaseFragment(R.layout.fragment_other_order) { ...@@ -29,13 +29,12 @@ class HistoryFragment : BaseFragment(R.layout.fragment_other_order) {
override fun onActivityCreated(savedInstanceState: Bundle?) { override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState) super.onActivityCreated(savedInstanceState)
viewModel = ViewModelProvider(requireActivity().viewModelStore, InjectorUtil.getHistoryModelFactory())[HistoryOrderViewModel::class.java].apply { viewModel = ViewModelProvider(requireActivity().viewModelStore, InjectorUtil.getHistoryModelFactory())[HistoryOrderViewModel::class.java].apply {
historyData.observe(viewLifecycleOwner, Observer { it -> historyData.observe(viewLifecycleOwner, { it ->
cancelDialogForLoading() cancelDialogForLoading()
refresh_layout.finishRefresh() refresh_layout.finishRefresh()
refresh_layout.finishLoadMore() refresh_layout.finishLoadMore()
it?.let { _ -> it?.let { _ ->
refresh_layout.setEnableLoadMore((it.data != null && it.data.list != null && it.data.list!!.size > 0)) refresh_layout.setEnableLoadMore((it.data.list.size > 0))
if (mHistoryOrderAdapter == null) { if (mHistoryOrderAdapter == null) {
mHistoryOrderAdapter = it.data.list.let { it1 -> context?.let { it2 -> HistoryOrderAdapter(status.value, it2, it1) } } mHistoryOrderAdapter = it.data.list.let { it1 -> context?.let { it2 -> HistoryOrderAdapter(status.value, it2, it1) } }
rv_other_order.layoutManager = LinearLayoutManager(context) rv_other_order.layoutManager = LinearLayoutManager(context)
...@@ -46,18 +45,15 @@ class HistoryFragment : BaseFragment(R.layout.fragment_other_order) { ...@@ -46,18 +45,15 @@ class HistoryFragment : BaseFragment(R.layout.fragment_other_order) {
cancelDialogForLoading() cancelDialogForLoading()
if (it2.data != null && it2.data!!.isNotEmpty()) { if (it2.data != null && it2.data!!.isNotEmpty()) {
//顯示彈窗 //顯示彈窗
context?.let { context -> OtherOrderUtils.showOrderDetailsDialog(requireContext(), it2, it.orderStatus, it.orderType, it.orderPayType, it.payType, it.status, it.reasonDesc, true) { _, _, _ ->
var reasonDesc = it.reasonDesc //重印
OtherOrderUtils.showOrderDetailsDialog(context, it2, it.orderStatus, it.orderType,it.orderPayType,it.payType, it.status, reasonDesc, true) { _, _, _ -> showLoading()
//重印 viewModel.printOrder(requireContext(), it) {
showLoading() cancelDialogForLoading()
viewModel.printOrder(context, it) { if (it) {
cancelDialogForLoading() ToastUtils.show(context, "打印成功")
if (it) { } else {
ToastUtils.show(context, "打印成功") ToastUtils.show(context, "打印失敗")
} else {
ToastUtils.show(context, "打印失敗")
}
} }
} }
} }
...@@ -72,26 +68,27 @@ class HistoryFragment : BaseFragment(R.layout.fragment_other_order) { ...@@ -72,26 +68,27 @@ class HistoryFragment : BaseFragment(R.layout.fragment_other_order) {
mHistoryOrderAdapter!!.notifyDataSetChanged() mHistoryOrderAdapter!!.notifyDataSetChanged()
} }
} }
layout_nodata.setState(it?.data == null || it.data?.list == null || it.data.list!!.size <= 0) layout_nodata.setState(it?.data?.list == null || it.data.list.size <= 0)
}) })
historyStartTime.observe(viewLifecycleOwner, Observer { historyStartTime.observe(viewLifecycleOwner, {
//當時間發生變化,請求數據 //當開始時間發生變化,請求數據
pageIndex = 1 pageIndex = 1
getHistoryInfo() getHistoryInfo()
}) })
historyEndTime.observe(viewLifecycleOwner, Observer { historyEndTime.observe(viewLifecycleOwner, {
//當時間發生變化,請求數據 //當結束時間發生變化,請求數據
pageIndex = 1 pageIndex = 1
getHistoryInfo() getHistoryInfo()
}) })
status.observe(viewLifecycleOwner, Observer { status.observe(viewLifecycleOwner, {
//用戶切換到已取消頁面或切換到已完成頁面 //用戶切換到已取消頁面或切換到已完成頁面
pageIndex = 1 pageIndex = 1
getHistoryInfo() getHistoryInfo()
}) })
searchValue.observe(viewLifecycleOwner, Observer { searchValue.observe(viewLifecycleOwner, {
//搜索
pageIndex = 1 pageIndex = 1
getHistoryInfo() getHistoryInfo()
}) })
......
...@@ -16,44 +16,45 @@ import androidx.recyclerview.widget.LinearLayoutManager ...@@ -16,44 +16,45 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.gingersoft.gsa.cloud.app.GsaCloudApplication import com.gingersoft.gsa.cloud.app.GsaCloudApplication
import com.gingersoft.gsa.cloud.common.core.delivery.OrderDetails import com.gingersoft.gsa.cloud.common.core.delivery.OrderDetails
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.toast.ToastUtils
import com.gingersoft.gsa.cloud.pay.contract.PayTypeContract import com.gingersoft.gsa.cloud.pay.contract.PayTypeContract
import com.gingersoft.gsa.cloud.ui.utils.DialogUtils import com.gingersoft.gsa.cloud.ui.utils.DialogUtils
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.BillBean import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.BillBean
import com.gingersoft.gsa.delivery_pick_mode.databinding.LayoutOrderInfoDialogNewBinding import com.gingersoft.gsa.delivery_pick_mode.databinding.LayoutOrderInfoDialogNewBinding
import com.gingersoft.gsa.delivery_pick_mode.ui.adapter.FoodListAdapter import com.gingersoft.gsa.delivery_pick_mode.ui.adapter.FoodListAdapter
import com.gingersoft.gsa.delivery_pick_mode.ui.adapter.HistoryOrderAdapter
import com.gingersoft.gsa.delivery_pick_mode.ui.adapter.PayBillAdapter import com.gingersoft.gsa.delivery_pick_mode.ui.adapter.PayBillAdapter
import com.jess.arms.utils.ArmsUtils import com.jess.arms.utils.ArmsUtils
import java.lang.Double.parseDouble import java.lang.Double.parseDouble
object OtherOrderUtils { object OtherOrderUtils {
fun showOrderDetailsDialog(context: Context, data: OrderDetails, orderStuats: Int, orderType: Int,orderPayType :Int, payType: Int, refundStatus: Int, reasonDesc: String = "", isHistory: Boolean = false, listenter: ((view: View, data: OrderDetails.DataBean, dialog: Dialog) -> Unit)?) { fun showOrderDetailsDialog(context: Context, data: OrderDetails, orderStuats: Int, orderType: Int,orderPayType :Int, payType: Int, refundStatus: Int, reasonDesc: String? = "", isHistory: Boolean = false, listenter: ((view: View, data: OrderDetails.DataBean, dialog: Dialog) -> Unit)?) {
object : DialogUtils(context, R.layout.layout_order_info_dialog_new) { object : DialogUtils(context, R.layout.layout_order_info_dialog_new) {
override fun initLayout(hepler: ViewHepler, dialog: Dialog) { override fun initLayout(hepler: ViewHepler, dialog: Dialog) {
if (data.data != null) { if (data.data != null) {
val tvStatus = hepler.getView<TextView>(R.id.tv_order_state) val tvStatus = hepler.getView<TextView>(R.id.tv_order_state)
val ivOrderState = hepler.getView<ImageView>(R.id.iv_order_state) val ivOrderState = hepler.getView<ImageView>(R.id.iv_order_state)
var tv_receive_address_text = hepler.getView<TextView>(R.id.tv_receive_address_text) val tvReceiveAddressText = hepler.getView<TextView>(R.id.tv_receive_address_text)
var tv_receive_address = hepler.getView<TextView>(R.id.tv_receive_address) val tvReceiveAddress = hepler.getView<TextView>(R.id.tv_receive_address)
var tv_cancel_reason_text = hepler.getView<TextView>(R.id.tv_cancel_reason_text) val tvCancelReasonText = hepler.getView<TextView>(R.id.tv_cancel_reason_text)
var tv_cancel_reason = hepler.getView<TextView>(R.id.tv_cancel_reason) val tvCancelReason = hepler.getView<TextView>(R.id.tv_cancel_reason)
var tv_refund_reason_text = hepler.getView<TextView>(R.id.tv_refund_reason_text) val tvRefundReasonText = hepler.getView<TextView>(R.id.tv_refund_reason_text)
var tv_refund_reason = hepler.getView<TextView>(R.id.tv_refund_reason) val tvRefundReason = hepler.getView<TextView>(R.id.tv_refund_reason)
val orderData = data.data!![0] val orderData = data.data!![0]
val layoutOrderInfoDialogBinding: LayoutOrderInfoDialogNewBinding = DataBindingUtil.bind(hepler.contentView)!! //訂單編號
var totalAmount = orderData.TOTAL_AMOUNT!!.toDouble() hepler.setOnClickListenter(R.id.tv_order_no) {
orderData.couponList?.let { ClipboardUtils.copyText(orderData.ORDER_NO)
for (coupon in it) { ToastUtils.show(context, "複製成功")
totalAmount = MoneyUtil.sub(totalAmount, coupon.discount_amount)
}
} }
val layoutOrderInfoDialogBinding: LayoutOrderInfoDialogNewBinding = DataBindingUtil.bind(hepler.contentView)!!
val totalAmount = orderData.TOTAL_AMOUNT!!.toDouble()
layoutOrderInfoDialogBinding.data = orderData layoutOrderInfoDialogBinding.data = orderData
layoutOrderInfoDialogBinding.isSelf = orderType == 7 layoutOrderInfoDialogBinding.isSelf = orderType == 7
layoutOrderInfoDialogBinding.totalAmount = totalAmount layoutOrderInfoDialogBinding.totalAmount = orderData.PAY_AMOUNT
//是歷史訂單,就不顯示訂單狀態 //是歷史訂單,就不顯示訂單狀態
layoutOrderInfoDialogBinding.isHistory = isHistory layoutOrderInfoDialogBinding.isHistory = isHistory
var btnContent: String var btnContent: String
...@@ -107,12 +108,12 @@ object OtherOrderUtils { ...@@ -107,12 +108,12 @@ object OtherOrderUtils {
4 -> { 4 -> {
//已完成訂單 //已完成訂單
ivOrderState.setImageResource(R.drawable.ic_has_end) ivOrderState.setImageResource(R.drawable.ic_has_end)
tv_cancel_reason_text.visibility = View.GONE tvCancelReasonText.visibility = View.GONE
tv_cancel_reason.visibility = View.GONE tvCancelReason.visibility = View.GONE
tv_refund_reason_text.visibility = View.GONE tvRefundReasonText.visibility = View.GONE
tv_refund_reason.visibility = View.GONE tvRefundReason.visibility = View.GONE
tv_receive_address_text.visibility = View.GONE tvReceiveAddressText.visibility = View.GONE
tv_receive_address.visibility = View.GONE tvReceiveAddress.visibility = View.GONE
} }
6 -> { 6 -> {
//已取消訂單 //已取消訂單
...@@ -152,6 +153,7 @@ object OtherOrderUtils { ...@@ -152,6 +153,7 @@ object OtherOrderUtils {
if (orderData.DELIVERY_CHARGE != 0.0) { if (orderData.DELIVERY_CHARGE != 0.0) {
billBeans.add(BillBean("送貨費:", orderData.DELIVERY_CHARGE, 0)) billBeans.add(BillBean("送貨費:", orderData.DELIVERY_CHARGE, 0))
} }
billBeans.add(BillBean("總金額:", totalAmount))
// if (orderData.discount_amount != 0.0) { // if (orderData.discount_amount != 0.0) {
// billBeans.add(BillBean("折扣:", orderData.discount_amount, 0)) // billBeans.add(BillBean("折扣:", orderData.discount_amount, 0))
// } // }
...@@ -163,7 +165,7 @@ object OtherOrderUtils { ...@@ -163,7 +165,7 @@ object OtherOrderUtils {
} }
} }
} }
billBeans.add(BillBean("支付金額:", totalAmount, 1)) billBeans.add(BillBean("支付金額:", orderData.PAY_AMOUNT, 1))
orderData.payMultiple?.let { orderData.payMultiple?.let {
for (payMultiple in it) { for (payMultiple in it) {
...@@ -209,7 +211,7 @@ object OtherOrderUtils { ...@@ -209,7 +211,7 @@ object OtherOrderUtils {
.show() .show()
} }
private fun setOrderReason(holder: DialogUtils.ViewHepler, orderStatus: Int, refundStatus: Int, orderPayType: Int,payType: Int, reasonDesc: String) { private fun setOrderReason(holder: DialogUtils.ViewHepler, orderStatus: Int, refundStatus: Int, orderPayType: Int,payType: Int, reasonDesc: String?) {
var tv_address_text = holder.getView<TextView>(R.id.tv_receive_address_text) var tv_address_text = holder.getView<TextView>(R.id.tv_receive_address_text)
var tv_address = holder.getView<TextView>(R.id.tv_receive_address) var tv_address = holder.getView<TextView>(R.id.tv_receive_address)
var tv_cancel_reason_text = holder.getView<TextView>(R.id.tv_cancel_reason_text) var tv_cancel_reason_text = holder.getView<TextView>(R.id.tv_cancel_reason_text)
......
...@@ -19,11 +19,11 @@ ...@@ -19,11 +19,11 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10" android:layout_marginLeft="@dimen/dp_10"
android:visibility="gone"
android:layout_marginRight="@dimen/dp_10" android:layout_marginRight="@dimen/dp_10"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingTop="@dimen/dp_20" android:paddingTop="@dimen/dp_20"
android:paddingBottom="@dimen/dp_20"> android:paddingBottom="@dimen/dp_20"
android:visibility="gone">
<EditText <EditText
android:id="@+id/ed_input_order_number" android:id="@+id/ed_input_order_number"
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
android:background="@drawable/shape_login_edit_border" android:background="@drawable/shape_login_edit_border"
android:hint="請輸入訂單號" android:hint="請輸入訂單號"
android:padding="@dimen/dp_10" android:padding="@dimen/dp_10"
android:maxLength="50"
android:singleLine="true"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<ImageView <ImageView
...@@ -54,6 +56,56 @@ ...@@ -54,6 +56,56 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:gravity="center_vertical"
android:orientation="horizontal">
<View
android:layout_width="@dimen/dp_15"
android:layout_height="@dimen/dp_15"
android:background="@drawable/shape_oval_green" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_5"
android:text="打印成功"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_12" />
<View
android:layout_width="@dimen/dp_15"
android:layout_height="@dimen/dp_15"
android:layout_marginLeft="@dimen/dp_15"
android:background="@drawable/shape_oval_red_wine" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_5"
android:text="打印失敗"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_12" />
<View
android:layout_width="@dimen/dp_15"
android:layout_height="@dimen/dp_15"
android:layout_marginLeft="@dimen/dp_15"
android:background="@drawable/shape_oval_bright_orange" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_5"
android:text="飛單失敗"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_12" />
</LinearLayout>
<LinearLayout
android:id="@+id/layout_prj_order_number" android:id="@+id/layout_prj_order_number"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -90,47 +142,58 @@ ...@@ -90,47 +142,58 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10" android:layout_marginTop="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_10" android:background="@color/theme_color"
android:background="@color/color_e4" android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal">
android:paddingLeft="@dimen/dp_10"
android:paddingTop="@dimen/dp_5"
android:paddingRight="@dimen/dp_10"
android:paddingBottom="@dimen/dp_5">
<TextView <TextView
style="@style/PrjQueryTitleStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="食品名稱" android:layout_weight="0.2"
android:textColor="@color/theme_color" android:text="食品組" />
android:textSize="@dimen/dp_16" />
<include layout="@layout/include_vertical_color_white_dividing_line" />
<TextView <TextView
style="@style/PrjQueryTitleStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="0.2"
android:gravity="center_horizontal" android:text="食品名稱" />
android:text="打印狀態"
android:textColor="@color/theme_color" <include layout="@layout/include_vertical_color_white_dividing_line" />
android:textSize="@dimen/dp_16" />
<TextView <TextView
style="@style/PrjQueryTitleStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="0.5"
android:gravity="center"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="操作" android:layout_weight="0.26"
android:textColor="@color/theme_color" android:text="打印/飛單位置" />
android:textSize="@dimen/dp_16" />
<include layout="@layout/include_vertical_color_white_dividing_line" />
<TextView
style="@style/PrjQueryTitleStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.18"
android:text="嘗試次數" />
<include layout="@layout/include_vertical_color_white_dividing_line" />
<TextView
style="@style/PrjQueryTitleStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.16"
android:text="操作" />
</LinearLayout> </LinearLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_prj_record_list" android:id="@+id/rv_prj_record_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent" />
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10" />
</LinearLayout> </LinearLayout>
\ No newline at end of file
...@@ -3,39 +3,68 @@ ...@@ -3,39 +3,68 @@
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:orientation="horizontal" android:gravity="center_vertical"
android:paddingLeft="@dimen/dp_10" android:orientation="horizontal">
android:paddingTop="@dimen/dp_5"
android:gravity="center"
android:paddingRight="@dimen/dp_10"
android:paddingBottom="@dimen/dp_5">
<TextView <TextView
android:id="@+id/tv_prj_record_food_name" android:id="@+id/tv_prj_record_food_group_name"
style="@style/PrjQueryItemStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="0.2"
android:padding="@dimen/dp_2"
android:textColor="@color/theme_333_color" android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_16" android:textSize="@dimen/dp_16"
tools:text="食品名稱一" /> tools:text="食品組名稱" />
<include layout="@layout/include_vertical_color_ccc_dividing_line" />
<LinearLayout
android:id="@+id/layout_print_state"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:orientation="vertical"
android:paddingLeft="@dimen/dp_5"
android:paddingTop="@dimen/dp_5"
android:paddingRight="@dimen/dp_5">
<TextView
android:id="@+id/tv_prj_record_food_name"
style="@style/PrjQueryItemStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="食品名稱一" />
<TextView
android:id="@+id/tv_prj_record_fail_reason"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_2"
android:textColor="@color/required_color"
android:textSize="@dimen/dp_10"
tools:text="失敗原因" />
</LinearLayout>
<TextView <TextView
android:id="@+id/tv_prj_record_print_state" android:id="@+id/tv_prj_record_print_position"
style="@style/PrjQueryItemStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="0.26"
android:ellipsize="marquee" tools:text="打印位置/飛單位置" />
android:focusableInTouchMode="true"
android:gravity="center" <TextView
android:textColor="@color/theme_333_color" android:id="@+id/tv_prj_record_print_count"
android:textSize="@dimen/dp_16" style="@style/PrjQueryItemStyle"
tools:text="打印狀態" /> android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.18"
tools:text="嘗試次數" />
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="0.5" android:layout_weight="0.16"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
...@@ -53,7 +82,6 @@ ...@@ -53,7 +82,6 @@
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="@dimen/dp_16" /> android:textSize="@dimen/dp_16" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
\ No newline at end of file
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
android:id="@+id/tv_total_amount_text" android:id="@+id/tv_total_amount_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="金額" android:text="支付金額"
android:textColor="@color/color_3c" android:textColor="@color/color_3c"
android:textSize="@dimen/dp_14" android:textSize="@dimen/dp_14"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
app:layout_constraintLeft_toRightOf="@id/tv_take_food_code" app:layout_constraintLeft_toRightOf="@id/tv_take_food_code"
app:layout_constraintTop_toTopOf="@id/tv_take_food_code" /> app:layout_constraintTop_toTopOf="@id/tv_take_food_code" />
<TextView <com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_order_no" android:id="@+id/tv_order_no"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout 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"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:fillViewport="true"
android:orientation="vertical"> android:orientation="vertical">
<RelativeLayout <com.qmuiteam.qmui.widget.QMUITopBar
android:id="@+id/send_order_top_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="@dimen/head_height"
android:orientation="vertical"> app:layout_constraintTop_toTopOf="parent"
app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color"
<com.qmuiteam.qmui.widget.QMUITopBar app:qmui_topbar_title_color="@color/theme_white_color" />
android:id="@+id/send_order_top_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/head_height"
app:layout_constraintTop_toTopOf="parent"
app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color"
app:qmui_topbar_title_color="@color/theme_white_color" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_send_order_foods"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/send_order_top_bar"
android:paddingLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_10"
app:layout_constraintTop_toBottomOf="@id/send_order_top_bar" />
<View <androidx.core.widget.NestedScrollView
android:id="@+id/view_send_order_foods_line" android:layout_width="match_parent"
android:layout_width="match_parent" android:layout_height="match_parent"
android:layout_height="@dimen/dp_5" android:layout_above="@id/layout_btn"
android:layout_below="@id/rv_send_order_foods" android:layout_below="@id/send_order_top_bar"
android:layout_marginTop="@dimen/dp_10" app:layout_constraintTop_toBottomOf="@id/send_order_top_bar">
android:background="@color/color_ccc" />
<androidx.recyclerview.widget.RecyclerView <RelativeLayout
android:id="@+id/rv_send_order_bills"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/view_send_order_foods_line" android:orientation="vertical">
android:fadeScrollbars="false"
android:orientation="vertical"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintTop_toBottomOf="@id/view_send_order_foods_line" />
<androidx.constraintlayout.widget.ConstraintLayout <androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent" android:id="@+id/rv_send_order_foods"
android:layout_height="wrap_content" android:layout_width="match_parent"
android:layout_above="@id/layout_btn"
android:layout_below="@id/rv_send_order_bills"
android:layout_marginTop="@dimen/dp_20"
android:paddingLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_10"
app:layout_constraintTop_toBottomOf="@id/rv_send_order_bills">
<TextView
android:id="@+id/tv_send_order_phone_text"
style="@style/otherOrderSendOrder_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/customer_phone"
app:layout_constraintBottom_toBottomOf="@id/ed_send_order_phone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@id/ed_send_order_phone" />
<EditText
android:id="@+id/ed_send_order_phone"
style="@style/otherOrderSendOrder_textStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@null"
android:gravity="right"
android:hint="@string/please_input_phone"
android:inputType="phone"
android:labelFor="@id/tv_send_order_name_text"
android:padding="@dimen/edit_padding"
app:layout_constraintLeft_toRightOf="@id/tv_send_order_name_text"
app:layout_constraintRight_toLeftOf="@id/iv_send_order_search"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_send_order_search"
android:layout_width="@dimen/dp_40"
android:layout_height="0dp"
android:padding="@dimen/dp_10"
android:src="@drawable/ic_search"
app:layout_constraintBottom_toBottomOf="@id/ed_send_order_phone"
app:layout_constraintLeft_toRightOf="@id/ed_send_order_phone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/ed_send_order_phone" />
<TextView
android:id="@+id/tv_send_order_name_text"
style="@style/otherOrderSendOrder_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/customer_name" android:paddingLeft="@dimen/dp_10"
app:layout_constraintBottom_toBottomOf="@id/ed_send_order_name" android:paddingRight="@dimen/dp_10" />
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@id/ed_send_order_name" />
<EditText
android:id="@+id/ed_send_order_name"
style="@style/otherOrderSendOrder_textStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@null"
android:gravity="right"
android:hint="@string/please_input_name_or_select_members"
android:inputType="text"
android:labelFor="@id/tv_send_order_name_text"
android:padding="@dimen/edit_padding"
app:layout_constraintLeft_toRightOf="@id/tv_send_order_name_text"
app:layout_constraintRight_toLeftOf="@id/iv_select_member_arrow"
app:layout_constraintTop_toBottomOf="@id/ed_send_order_phone" />
<ImageView
android:id="@+id/iv_select_member_arrow"
android:layout_width="@dimen/dp_30"
android:padding="@dimen/dp_8"
android:layout_height="0dp"
android:src="@drawable/ic_black_next_arrow"
app:layout_constraintBottom_toBottomOf="@id/ed_send_order_name"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/ed_send_order_name" />
<View <View
android:layout_width="0dp" android:id="@+id/view_send_order_foods_line"
android:layout_height="@dimen/dp_1" android:layout_width="match_parent"
android:background="@color/color_ccc" android:layout_height="@dimen/dp_5"
app:layout_constraintLeft_toLeftOf="@id/ed_send_order_name" android:layout_below="@id/rv_send_order_foods"
app:layout_constraintRight_toRightOf="parent" android:layout_marginTop="@dimen/dp_10"
app:layout_constraintTop_toBottomOf="@id/ed_send_order_name" /> android:background="@color/color_ccc" />
<View <androidx.recyclerview.widget.RecyclerView
android:layout_width="0dp" android:id="@+id/rv_send_order_bills"
android:layout_height="@dimen/dp_1" android:layout_width="match_parent"
android:background="@color/color_ccc"
app:layout_constraintLeft_toLeftOf="@id/ed_send_order_phone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/ed_send_order_phone" />
<TextView
android:id="@+id/tv_send_order_address_text"
style="@style/otherOrderSendOrder_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/delivery_address" android:layout_below="@id/view_send_order_foods_line"
app:layout_constraintBottom_toBottomOf="@id/ed_send_order_address" android:fadeScrollbars="false"
app:layout_constraintLeft_toLeftOf="parent" android:orientation="vertical"
app:layout_constraintTop_toTopOf="@id/ed_send_order_address" /> app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintTop_toBottomOf="@id/view_send_order_foods_line" />
<EditText
android:id="@+id/ed_send_order_address" <androidx.constraintlayout.widget.ConstraintLayout
style="@style/otherOrderSendOrder_textStyle" android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@null" android:layout_below="@id/rv_send_order_bills"
android:gravity="right" android:layout_marginTop="@dimen/dp_20"
android:hint="@string/please_input_details_address" android:paddingLeft="@dimen/dp_10"
android:inputType="text" android:layout_marginBottom="@dimen/dp_10"
android:labelFor="@id/tv_send_order_name_text" android:paddingRight="@dimen/dp_10"
android:padding="@dimen/edit_padding" app:layout_constraintTop_toBottomOf="@id/rv_send_order_bills">
app:layout_constraintLeft_toRightOf="@id/tv_send_order_name_text"
app:layout_constraintRight_toLeftOf="@id/iv_select_member_arrow"
app:layout_constraintTop_toBottomOf="@id/ed_send_order_name" />
<ImageView
android:id="@+id/iv_select_address_arrow"
android:layout_width="@dimen/dp_30"
android:layout_height="0dp"
android:padding="@dimen/dp_8"
android:src="@drawable/ic_black_next_arrow"
app:layout_constraintBottom_toBottomOf="@id/ed_send_order_address"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/ed_send_order_address" />
<View
android:layout_width="0dp" <TextView
android:layout_height="@dimen/dp_1" android:id="@+id/tv_send_order_phone_text"
android:background="@color/color_ccc" style="@style/otherOrderSendOrder_textStyle"
app:layout_constraintLeft_toLeftOf="@id/ed_send_order_address"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/ed_send_order_address" />
<TextView
android:id="@+id/tv_send_order_distribution_mode_text"
style="@style/otherOrderSendOrder_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/distribution_mode"
app:layout_constraintBottom_toBottomOf="@id/rg_send_order_distribution_mode"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@id/rg_send_order_distribution_mode" />
<RadioGroup
android:id="@+id/rg_send_order_distribution_mode"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_16"
android:orientation="horizontal"
app:layout_constraintLeft_toLeftOf="@id/ed_send_order_address"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/ed_send_order_address">
<RadioButton
android:id="@+id/rb_delivery_shop"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_9" android:text="@string/customer_phone"
android:background="@drawable/s_tran_twenty_blue" app:layout_constraintBottom_toBottomOf="@id/ed_send_order_phone"
android:button="@null" app:layout_constraintLeft_toLeftOf="parent"
android:checked="true" app:layout_constraintTop_toTopOf="@id/ed_send_order_phone" />
android:paddingLeft="@dimen/dp_13"
android:paddingTop="@dimen/dp_8" <EditText
android:paddingRight="@dimen/dp_13" android:id="@+id/ed_send_order_phone"
android:paddingBottom="@dimen/dp_8" style="@style/otherOrderSendOrder_textStyle"
android:text="@string/delivery_shop" android:layout_width="0dp"
android:textColor="@color/s_send_order_radio" android:layout_height="wrap_content"
android:textSize="@dimen/dp_16" /> android:background="@null"
android:gravity="right"
<RadioButton android:hint="@string/please_input_phone"
android:id="@+id/rb_logistics_distribution" android:inputType="phone"
android:labelFor="@id/tv_send_order_name_text"
android:padding="@dimen/edit_padding"
app:layout_constraintLeft_toRightOf="@id/tv_send_order_name_text"
app:layout_constraintRight_toLeftOf="@id/iv_send_order_search"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_send_order_search"
android:layout_width="@dimen/dp_40"
android:layout_height="0dp"
android:padding="@dimen/dp_10"
android:src="@drawable/ic_search"
app:layout_constraintBottom_toBottomOf="@id/ed_send_order_phone"
app:layout_constraintLeft_toRightOf="@id/ed_send_order_phone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/ed_send_order_phone" />
<TextView
android:id="@+id/tv_send_order_name_text"
style="@style/otherOrderSendOrder_textStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/s_tran_twenty_blue" android:text="@string/customer_name"
android:button="@null" app:layout_constraintBottom_toBottomOf="@id/ed_send_order_name"
android:paddingLeft="@dimen/dp_13" app:layout_constraintLeft_toLeftOf="parent"
android:paddingTop="@dimen/dp_8" app:layout_constraintTop_toTopOf="@id/ed_send_order_name" />
android:paddingRight="@dimen/dp_13"
android:paddingBottom="@dimen/dp_8" <EditText
android:text="@string/logistics_distribution" android:id="@+id/ed_send_order_name"
android:textColor="@color/s_send_order_radio" style="@style/otherOrderSendOrder_textStyle"
android:textSize="@dimen/dp_16" android:layout_width="0dp"
android:visibility="gone" /> android:layout_height="wrap_content"
</RadioGroup> android:background="@null"
android:gravity="right"
<TextView android:hint="@string/please_input_name_or_select_members"
android:id="@+id/tv_send_order_pay_mode_text" android:inputType="text"
style="@style/otherOrderSendOrder_textStyle" android:labelFor="@id/tv_send_order_name_text"
android:layout_width="wrap_content" android:padding="@dimen/edit_padding"
android:layout_height="wrap_content" app:layout_constraintLeft_toRightOf="@id/tv_send_order_name_text"
android:text="@string/pay_mode" app:layout_constraintRight_toLeftOf="@id/iv_select_member_arrow"
app:layout_constraintBottom_toBottomOf="@id/rg_send_order_pay_mode" app:layout_constraintTop_toBottomOf="@id/ed_send_order_phone" />
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@id/rg_send_order_pay_mode" /> <ImageView
android:id="@+id/iv_select_member_arrow"
<RadioGroup android:layout_width="@dimen/dp_30"
android:id="@+id/rg_send_order_pay_mode" android:layout_height="0dp"
android:layout_width="0dp" android:padding="@dimen/dp_8"
android:layout_height="wrap_content" android:src="@drawable/ic_black_next_arrow"
android:layout_marginTop="@dimen/dp_10" app:layout_constraintBottom_toBottomOf="@id/ed_send_order_name"
android:orientation="horizontal" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toLeftOf="@id/rg_send_order_distribution_mode" app:layout_constraintTop_toTopOf="@id/ed_send_order_name" />
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/rg_send_order_distribution_mode"> <View
android:layout_width="0dp"
<RadioButton android:layout_height="@dimen/dp_1"
android:id="@+id/rb_new_order_cash_on_delivery" android:background="@color/color_ccc"
app:layout_constraintLeft_toLeftOf="@id/ed_send_order_name"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/ed_send_order_name" />
<View
android:layout_width="0dp"
android:layout_height="@dimen/dp_1"
android:background="@color/color_ccc"
app:layout_constraintLeft_toLeftOf="@id/ed_send_order_phone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/ed_send_order_phone" />
<TextView
android:id="@+id/tv_send_order_address_text"
style="@style/otherOrderSendOrder_textStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_9" android:text="@string/delivery_address"
android:background="@drawable/s_tran_twenty_blue" app:layout_constraintBottom_toBottomOf="@id/ed_send_order_address"
android:button="@null" app:layout_constraintLeft_toLeftOf="parent"
android:checked="true" app:layout_constraintTop_toTopOf="@id/ed_send_order_address" />
android:paddingLeft="@dimen/dp_13"
android:paddingTop="@dimen/dp_8" <EditText
android:paddingRight="@dimen/dp_13" android:id="@+id/ed_send_order_address"
android:paddingBottom="@dimen/dp_8" style="@style/otherOrderSendOrder_textStyle"
android:text="貨到付款" android:layout_width="0dp"
android:textColor="@color/s_send_order_radio" android:layout_height="wrap_content"
android:textSize="@dimen/dp_16" /> android:background="@null"
android:gravity="right"
<RadioButton android:hint="@string/please_input_details_address"
android:id="@+id/rb_new_order_immediately_pay" android:inputType="text"
android:labelFor="@id/tv_send_order_name_text"
android:padding="@dimen/edit_padding"
app:layout_constraintLeft_toRightOf="@id/tv_send_order_name_text"
app:layout_constraintRight_toLeftOf="@id/iv_select_member_arrow"
app:layout_constraintTop_toBottomOf="@id/ed_send_order_name" />
<ImageView
android:id="@+id/iv_select_address_arrow"
android:layout_width="@dimen/dp_30"
android:layout_height="0dp"
android:padding="@dimen/dp_8"
android:src="@drawable/ic_black_next_arrow"
app:layout_constraintBottom_toBottomOf="@id/ed_send_order_address"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/ed_send_order_address" />
<View
android:layout_width="0dp"
android:layout_height="@dimen/dp_1"
android:background="@color/color_ccc"
app:layout_constraintLeft_toLeftOf="@id/ed_send_order_address"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/ed_send_order_address" />
<TextView
android:id="@+id/tv_send_order_distribution_mode_text"
style="@style/otherOrderSendOrder_textStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/s_tran_twenty_blue" android:text="@string/distribution_mode"
android:button="@null" app:layout_constraintBottom_toBottomOf="@id/rg_send_order_distribution_mode"
android:paddingLeft="@dimen/dp_13" app:layout_constraintLeft_toLeftOf="parent"
android:paddingTop="@dimen/dp_8" app:layout_constraintTop_toTopOf="@id/rg_send_order_distribution_mode" />
android:paddingRight="@dimen/dp_13"
android:paddingBottom="@dimen/dp_8" <RadioGroup
android:text="立即支付" android:id="@+id/rg_send_order_distribution_mode"
android:textColor="@color/s_send_order_radio" android:layout_width="0dp"
android:textSize="@dimen/dp_16" android:layout_height="wrap_content"
android:visibility="gone" /> android:layout_marginTop="@dimen/dp_16"
</RadioGroup> android:orientation="horizontal"
app:layout_constraintLeft_toLeftOf="@id/ed_send_order_address"
<TextView app:layout_constraintRight_toRightOf="parent"
android:id="@+id/tv_send_order_delivery_time_text" app:layout_constraintTop_toBottomOf="@id/ed_send_order_address">
style="@style/otherOrderSendOrder_textStyle"
android:layout_width="wrap_content" <RadioButton
android:layout_height="wrap_content" android:id="@+id/rb_delivery_shop"
android:text="@string/delivery_time" android:layout_width="wrap_content"
app:layout_constraintBottom_toBottomOf="@id/tv_delivery_time_type" android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent" android:layout_marginRight="@dimen/dp_9"
app:layout_constraintTop_toTopOf="@id/tv_delivery_time_type" /> android:background="@drawable/s_tran_twenty_blue"
android:button="@null"
<TextView android:checked="true"
android:id="@+id/tv_delivery_time_type" android:paddingLeft="@dimen/dp_13"
android:layout_width="67dp" android:paddingTop="@dimen/dp_8"
android:layout_height="25dp" android:paddingRight="@dimen/dp_13"
android:layout_marginLeft="@dimen/dp_5" android:paddingBottom="@dimen/dp_8"
android:layout_marginTop="@dimen/dp_16" android:text="@string/delivery_shop"
android:layout_weight="1" android:textColor="@color/s_send_order_radio"
android:gravity="right" android:textSize="@dimen/dp_16" />
android:paddingLeft="@dimen/dp_5"
android:text="現在送出" <RadioButton
android:textColor="@color/color_c9" android:id="@+id/rb_logistics_distribution"
app:layout_constraintLeft_toRightOf="@id/tv_send_order_delivery_time_text" android:layout_width="wrap_content"
app:layout_constraintTop_toBottomOf="@id/rg_send_order_pay_mode" /> android:layout_height="wrap_content"
android:background="@drawable/s_tran_twenty_blue"
<ImageView android:button="@null"
android:id="@+id/iv_select_delivery_time" android:paddingLeft="@dimen/dp_13"
android:layout_width="@dimen/dp_20" android:paddingTop="@dimen/dp_8"
android:layout_height="wrap_content" android:paddingRight="@dimen/dp_13"
android:layout_marginLeft="@dimen/dp_5" android:paddingBottom="@dimen/dp_8"
android:src="@drawable/arrow_down_black" android:text="@string/logistics_distribution"
app:layout_constraintBottom_toBottomOf="@id/tv_delivery_time_type" android:textColor="@color/s_send_order_radio"
app:layout_constraintLeft_toRightOf="@id/tv_delivery_time_type" android:textSize="@dimen/dp_16"
app:layout_constraintTop_toTopOf="@id/tv_delivery_time_type" /> android:visibility="gone" />
</RadioGroup>
<View
android:id="@+id/view_delivery_time_mode_line" <TextView
android:layout_width="0dp" android:id="@+id/tv_send_order_pay_mode_text"
android:layout_height="@dimen/dp_1" style="@style/otherOrderSendOrder_textStyle"
android:layout_marginTop="@dimen/dp_10" android:layout_width="wrap_content"
android:background="@color/color_ccc" android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="@id/tv_delivery_time_type" android:text="@string/pay_mode"
app:layout_constraintRight_toRightOf="@id/iv_select_delivery_time" app:layout_constraintBottom_toBottomOf="@id/rg_send_order_pay_mode"
app:layout_constraintTop_toBottomOf="@id/tv_delivery_time_type" /> app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@id/rg_send_order_pay_mode" />
<androidx.constraintlayout.widget.Group
android:id="@+id/group_time" <RadioGroup
android:layout_width="wrap_content" android:id="@+id/rg_send_order_pay_mode"
android:layout_height="wrap_content" android:layout_width="0dp"
android:visibility="gone" android:layout_height="wrap_content"
app:constraint_referenced_ids="view_delivery_time_line,tv_delivery_time_min,tv_delivery_time_colon,tv_delivery_time_hour" /> android:layout_marginTop="@dimen/dp_10"
android:orientation="horizontal"
<TextView app:layout_constraintLeft_toLeftOf="@id/rg_send_order_distribution_mode"
android:id="@+id/tv_delivery_time_hour" app:layout_constraintRight_toRightOf="parent"
android:layout_width="0dp" app:layout_constraintTop_toBottomOf="@id/rg_send_order_distribution_mode">
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10" <RadioButton
android:layout_weight="1" android:id="@+id/rb_new_order_cash_on_delivery"
android:gravity="right" android:layout_width="wrap_content"
android:text="00" android:layout_height="wrap_content"
android:textColor="@color/color_c9" android:layout_marginRight="@dimen/dp_9"
app:layout_constraintBottom_toBottomOf="@id/tv_delivery_time_type" android:background="@drawable/s_tran_twenty_blue"
app:layout_constraintLeft_toRightOf="@id/iv_select_delivery_time" android:button="@null"
app:layout_constraintRight_toLeftOf="@id/tv_delivery_time_colon" android:checked="true"
app:layout_constraintTop_toTopOf="@id/tv_delivery_time_type" /> android:paddingLeft="@dimen/dp_13"
android:paddingTop="@dimen/dp_8"
<TextView android:paddingRight="@dimen/dp_13"
android:id="@+id/tv_delivery_time_colon" android:paddingBottom="@dimen/dp_8"
android:layout_width="wrap_content" android:text="貨到付款"
android:layout_height="wrap_content" android:textColor="@color/s_send_order_radio"
android:layout_marginLeft="@dimen/dp_15" android:textSize="@dimen/dp_16" />
android:layout_marginRight="@dimen/dp_15"
android:layout_weight="1" <RadioButton
android:gravity="right" android:id="@+id/rb_new_order_immediately_pay"
android:paddingLeft="@dimen/dp_5" android:layout_width="wrap_content"
android:text=":" android:layout_height="wrap_content"
android:textColor="@color/color_c9" android:background="@drawable/s_tran_twenty_blue"
app:layout_constraintBottom_toBottomOf="@id/tv_delivery_time_type" android:button="@null"
app:layout_constraintLeft_toRightOf="@id/tv_delivery_time_hour" android:paddingLeft="@dimen/dp_13"
app:layout_constraintRight_toLeftOf="@id/tv_delivery_time_min" android:paddingTop="@dimen/dp_8"
app:layout_constraintTop_toTopOf="@id/tv_delivery_time_type" /> android:paddingRight="@dimen/dp_13"
android:paddingBottom="@dimen/dp_8"
<TextView android:text="立即支付"
android:id="@+id/tv_delivery_time_min" android:textColor="@color/s_send_order_radio"
android:layout_width="0dp" android:textSize="@dimen/dp_16"
android:layout_height="wrap_content" android:visibility="gone" />
android:layout_marginLeft="@dimen/dp_5" </RadioGroup>
android:layout_marginRight="@dimen/dp_2"
android:layout_weight="1" <TextView
android:gravity="left" android:id="@+id/tv_send_order_delivery_time_text"
android:paddingLeft="@dimen/dp_5" style="@style/otherOrderSendOrder_textStyle"
android:text="00" android:layout_width="wrap_content"
android:textColor="@color/color_c9" android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="@id/tv_delivery_time_type" android:text="@string/delivery_time"
app:layout_constraintLeft_toRightOf="@id/tv_delivery_time_colon" app:layout_constraintBottom_toBottomOf="@id/tv_delivery_time_type"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_delivery_time_type" /> app:layout_constraintTop_toTopOf="@id/tv_delivery_time_type" />
<TextView
android:id="@+id/tv_delivery_time_type"
android:layout_width="67dp"
android:layout_height="25dp"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginTop="@dimen/dp_16"
android:layout_weight="1"
android:gravity="right"
android:paddingLeft="@dimen/dp_5"
android:text="現在送出"
android:textColor="@color/color_c9"
app:layout_constraintLeft_toRightOf="@id/tv_send_order_delivery_time_text"
app:layout_constraintTop_toBottomOf="@id/rg_send_order_pay_mode" />
<ImageView
android:id="@+id/iv_select_delivery_time"
android:layout_width="@dimen/dp_20"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_5"
android:src="@drawable/arrow_down_black"
app:layout_constraintBottom_toBottomOf="@id/tv_delivery_time_type"
app:layout_constraintLeft_toRightOf="@id/tv_delivery_time_type"
app:layout_constraintTop_toTopOf="@id/tv_delivery_time_type" />
<View
android:id="@+id/view_delivery_time_mode_line"
android:layout_width="0dp"
android:layout_height="@dimen/dp_1"
android:layout_marginTop="@dimen/dp_10"
android:background="@color/color_ccc"
app:layout_constraintLeft_toLeftOf="@id/tv_delivery_time_type"
app:layout_constraintRight_toRightOf="@id/iv_select_delivery_time"
app:layout_constraintTop_toBottomOf="@id/tv_delivery_time_type" />
<androidx.constraintlayout.widget.Group
android:id="@+id/group_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="view_delivery_time_line,tv_delivery_time_min,tv_delivery_time_colon,tv_delivery_time_hour" />
<View <TextView
android:id="@+id/view_delivery_time_line" android:id="@+id/tv_delivery_time_hour"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="@dimen/dp_1" android:layout_height="wrap_content"
android:background="@color/color_ccc" android:layout_marginLeft="@dimen/dp_10"
app:layout_constraintBottom_toBottomOf="@id/view_delivery_time_mode_line" android:layout_weight="1"
app:layout_constraintLeft_toLeftOf="@id/tv_delivery_time_hour" android:gravity="right"
app:layout_constraintRight_toRightOf="@id/tv_delivery_time_min" android:text="00"
app:layout_constraintTop_toTopOf="@id/view_delivery_time_mode_line" /> android:textColor="@color/color_c9"
</androidx.constraintlayout.widget.ConstraintLayout> app:layout_constraintBottom_toBottomOf="@id/tv_delivery_time_type"
app:layout_constraintLeft_toRightOf="@id/iv_select_delivery_time"
<LinearLayout app:layout_constraintRight_toLeftOf="@id/tv_delivery_time_colon"
android:id="@+id/layout_btn" app:layout_constraintTop_toTopOf="@id/tv_delivery_time_type" />
android:layout_width="match_parent"
android:layout_height="wrap_content" <TextView
android:layout_alignParentBottom="true" android:id="@+id/tv_delivery_time_colon"
android:orientation="horizontal"> android:layout_width="wrap_content"
android:layout_height="wrap_content"
<TextView android:layout_marginLeft="@dimen/dp_15"
android:id="@+id/tv_continue_add_food" android:layout_marginRight="@dimen/dp_15"
android:layout_width="0dp" android:layout_weight="1"
android:layout_height="@dimen/button_height" android:gravity="right"
android:layout_marginLeft="@dimen/dp_10" android:paddingLeft="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_5" android:text=":"
android:layout_marginBottom="@dimen/dp_10" android:textColor="@color/color_c9"
android:layout_weight="1" app:layout_constraintBottom_toBottomOf="@id/tv_delivery_time_type"
android:background="@drawable/shape_app_btn" app:layout_constraintLeft_toRightOf="@id/tv_delivery_time_hour"
android:gravity="center" app:layout_constraintRight_toLeftOf="@id/tv_delivery_time_min"
android:text="繼續點餐" app:layout_constraintTop_toTopOf="@id/tv_delivery_time_type" />
android:textColor="@color/white"
app:layout_constraintBottom_toBottomOf="parent" <TextView
app:layout_constraintLeft_toLeftOf="parent" android:id="@+id/tv_delivery_time_min"
app:layout_constraintRight_toLeftOf="@id/tv_confirm_order" /> android:layout_width="0dp"
android:layout_height="wrap_content"
<TextView android:layout_marginLeft="@dimen/dp_5"
android:id="@+id/tv_confirm_order" android:layout_marginRight="@dimen/dp_2"
android:layout_width="0dp" android:layout_weight="1"
android:layout_height="@dimen/button_height" android:gravity="left"
android:layout_marginLeft="@dimen/dp_5" android:paddingLeft="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_10" android:text="00"
android:layout_marginBottom="@dimen/dp_10" android:textColor="@color/color_c9"
android:layout_weight="1" app:layout_constraintBottom_toBottomOf="@id/tv_delivery_time_type"
android:background="@drawable/shape_app_btn" app:layout_constraintLeft_toRightOf="@id/tv_delivery_time_colon"
android:gravity="center" app:layout_constraintRight_toRightOf="parent"
android:text="確認訂單" app:layout_constraintTop_toTopOf="@id/tv_delivery_time_type" />
android:textColor="@color/white"
app:layout_constraintBottom_toBottomOf="parent" <View
app:layout_constraintLeft_toRightOf="@id/tv_continue_add_food" android:id="@+id/view_delivery_time_line"
app:layout_constraintRight_toRightOf="parent" /> android:layout_width="0dp"
</LinearLayout> android:layout_height="@dimen/dp_1"
</RelativeLayout> android:background="@color/color_ccc"
</ScrollView> app:layout_constraintBottom_toBottomOf="@id/view_delivery_time_mode_line"
\ No newline at end of file app:layout_constraintLeft_toLeftOf="@id/tv_delivery_time_hour"
app:layout_constraintRight_toRightOf="@id/tv_delivery_time_min"
app:layout_constraintTop_toTopOf="@id/view_delivery_time_mode_line" />
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>
</androidx.core.widget.NestedScrollView>
<LinearLayout
android:id="@+id/layout_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_continue_add_food"
android:layout_width="0dp"
android:layout_height="@dimen/button_height"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_5"
android:layout_marginBottom="@dimen/dp_10"
android:layout_weight="1"
android:background="@drawable/shape_app_btn"
android:gravity="center"
android:text="繼續點餐"
android:textColor="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/tv_confirm_order" />
<TextView
android:id="@+id/tv_confirm_order"
android:layout_width="0dp"
android:layout_height="@dimen/button_height"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_10"
android:layout_weight="1"
android:background="@drawable/shape_app_btn"
android:gravity="center"
android:text="確認訂單"
android:textColor="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/tv_continue_add_food"
app:layout_constraintRight_toRightOf="parent" />
</LinearLayout>
</RelativeLayout>
...@@ -52,4 +52,16 @@ ...@@ -52,4 +52,16 @@
<item name="android:textColorHint">@color/color_ccc</item> <item name="android:textColorHint">@color/color_ccc</item>
</style> </style>
<style name="PrjQueryTitleStyle">
<item name="android:textColor">@color/white</item>
<item name="android:textSize">@dimen/dp_14</item>
<item name="android:gravity">center</item>
<item name="android:paddingTop">@dimen/dp_10</item>
<item name="android:paddingBottom">@dimen/dp_10</item>
</style>
<style name="PrjQueryItemStyle">
<item name="android:textColor">@color/theme_333_color</item>
<item name="android:textSize">@dimen/dp_14</item>
<item name="android:gravity">center</item>
</style>
</resources> </resources>
...@@ -8,6 +8,7 @@ import com.epson.epos2.Epos2Exception; ...@@ -8,6 +8,7 @@ import com.epson.epos2.Epos2Exception;
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.printer.plugins.PrinterPlugins;
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.joe.print.mvp.model.bean.PrintInfoBean; import com.joe.print.mvp.model.bean.PrintInfoBean;
...@@ -42,7 +43,7 @@ public class EpsonPrint implements ReceiveListener { ...@@ -42,7 +43,7 @@ public class EpsonPrint implements ReceiveListener {
* *
* @return * @return
*/ */
public boolean initializeObject(Context context, ReceiveListener receiveListener,PrintExecutor.OnPrintResultListener resultListener) { public boolean initializeObject(Context context, ReceiveListener receiveListener, PrintExecutor.OnPrintResultListener resultListener) {
try { try {
this.resultListener = resultListener; this.resultListener = resultListener;
this.receiveListener = receiveListener; this.receiveListener = receiveListener;
...@@ -83,13 +84,16 @@ public class EpsonPrint implements ReceiveListener { ...@@ -83,13 +84,16 @@ public class EpsonPrint implements ReceiveListener {
} }
} }
/**
* 暫不使用這個方法,避免在打印中,另外線程調用,使得邏輯出現問題
*/
public void finalizeObject() { public void finalizeObject() {
if (mPrinter == null) { // if (mPrinter == null) {
return; // return;
} // }
mPrinter.clearCommandBuffer(); // mPrinter.clearCommandBuffer();
mPrinter.setReceiveEventListener(null); // mPrinter.setReceiveEventListener(null);
mPrinter = null; // mPrinter = null;
} }
/** /**
...@@ -127,7 +131,14 @@ public class EpsonPrint implements ReceiveListener { ...@@ -127,7 +131,14 @@ public class EpsonPrint implements ReceiveListener {
*/ */
private boolean isPrint = false; private boolean isPrint = false;
private String ipAddress; private String ipAddress;
/**
* 打印隊列
*/
private List<Bitmap> bitmaps = new ArrayList<>(); private List<Bitmap> bitmaps = new ArrayList<>();
/**
* 打印的食品id隊列
*/
private List<String> ids = new ArrayList<>();
public void putPrintString(String ip, int paperWidth, List<PrintInfoBean> printInfoBeans) { public void putPrintString(String ip, int paperWidth, List<PrintInfoBean> printInfoBeans) {
if (mPrinter == null) { if (mPrinter == null) {
...@@ -254,9 +265,10 @@ public class EpsonPrint implements ReceiveListener { ...@@ -254,9 +265,10 @@ public class EpsonPrint implements ReceiveListener {
} }
} }
public void putPrintData(String ip, Bitmap bitmap) { public void putPrintData(String ip, Bitmap bitmap,String foodId) {
//把bitmap存隊列中,下次打印 //把bitmap存隊列中,下次打印
bitmaps.add(bitmap); bitmaps.add(bitmap);
ids.add(foodId);
if (isPrint) { if (isPrint) {
return; return;
} }
...@@ -264,32 +276,34 @@ public class EpsonPrint implements ReceiveListener { ...@@ -264,32 +276,34 @@ public class EpsonPrint implements ReceiveListener {
printData(ip, bitmap); printData(ip, bitmap);
} }
//重試次數5次
private int resetCount = 5;
private void printData(String ip, Bitmap bitmap) { private void printData(String ip, Bitmap bitmap) {
mPrinter.clearCommandBuffer(); mPrinter.clearCommandBuffer();
if (!createPrintData(bitmap)) { if (!createPrintData(bitmap)) {
updatePrintState(PrintSocketHolder.ERROR_1); updatePrintState(PrintSocketHolder.ERROR_6);
return; return;
} }
//連接打印機
connectByIp(ip, mPrinter.getStatus()); connectByIp(ip, mPrinter.getStatus());
if (mPrinter == null) { if (mPrinter == null) {
updatePrintState(PrintSocketHolder.ERROR_2); //連接失敗
updatePrintState(PrintSocketHolder.ERROR_7);
PrinterPlugins.getOnPrinterFlowHandler().connectionError(new Exception("連接針式打印機失敗:" + ip));
return; return;
} }
PrinterStatusInfo statusInfo = mPrinter.getStatus(); PrinterStatusInfo statusInfo = mPrinter.getStatus();
if (statusInfo.getPaper() == 2) { if (statusInfo.getPaper() == 2) {
//沒紙了 //沒紙了
updatePrintState(PrintSocketHolder.ERROR_2); updatePrintState(PrintSocketHolder.ERROR_11);
return; return;
} else if(statusInfo.getConnection() != 1){ } else if (statusInfo.getConnection() != 1) {
//未連接到打印機 //未連接到打印機
updatePrintState(PrintSocketHolder.ERROR_2); updatePrintState(PrintSocketHolder.ERROR_7);
return;
} }
try { try {
mPrinter.sendData(Printer.PARAM_DEFAULT); mPrinter.sendData(Printer.PARAM_DEFAULT);
} catch (Exception e) { } catch (Exception e) {
updatePrintState(PrintSocketHolder.ERROR_4); updatePrintState(PrintSocketHolder.ERROR_10);
mPrinter.clearCommandBuffer(); mPrinter.clearCommandBuffer();
disconnectPrinter(); disconnectPrinter();
isPrint = false; isPrint = false;
...@@ -347,6 +361,7 @@ public class EpsonPrint implements ReceiveListener { ...@@ -347,6 +361,7 @@ public class EpsonPrint implements ReceiveListener {
mPrinter.connect("TCP:" + ip, Printer.PARAM_DEFAULT); mPrinter.connect("TCP:" + ip, Printer.PARAM_DEFAULT);
} catch (Exception e) { } catch (Exception e) {
Log.e(TAG, "連接打印機報錯" + e.getMessage() + e.getClass().getName()); Log.e(TAG, "連接打印機報錯" + e.getMessage() + e.getClass().getName());
PrinterPlugins.getOnPrinterFlowHandler().connectionError(e);
e.printStackTrace(); e.printStackTrace();
disconnectPrinter(); disconnectPrinter();
finalizeObject(); finalizeObject();
...@@ -355,23 +370,23 @@ public class EpsonPrint implements ReceiveListener { ...@@ -355,23 +370,23 @@ public class EpsonPrint implements ReceiveListener {
return true; return true;
} }
private void updatePrintState(int code){ private void updatePrintState(int code) {
if(resultListener != null){ if (resultListener != null) {
resultListener.onResult(code); resultListener.onResult(code);
} }
} }
public void setPrint(boolean print) {
isPrint = print;
}
@Override @Override
public void onPtrReceive(Printer printer, int i, PrinterStatusInfo printerStatusInfo, String s) { public void onPtrReceive(Printer printer, int i, PrinterStatusInfo printerStatusInfo, String s) {
this.mPrinter = printer; this.mPrinter = printer;
mPrinter.clearCommandBuffer(); mPrinter.clearCommandBuffer();
resetCount = 5;
if (bitmaps.size() > 0) { if (bitmaps.size() > 0) {
if (receiveListener != null) {
receiveListener.onPtrReceive(printer, i, printerStatusInfo, ids.get(0));
}
bitmaps.remove(0); bitmaps.remove(0);
ids.remove(0);
} }
if (bitmaps.size() > 0) { if (bitmaps.size() > 0) {
printData(ipAddress, bitmaps.get(0)); printData(ipAddress, bitmaps.get(0));
...@@ -379,9 +394,7 @@ public class EpsonPrint implements ReceiveListener { ...@@ -379,9 +394,7 @@ public class EpsonPrint implements ReceiveListener {
isPrint = false; isPrint = false;
disconnectPrinter(); disconnectPrinter();
finalizeObject(); finalizeObject();
if (receiveListener != null) {
receiveListener.onPtrReceive(printer, i, printerStatusInfo, s);
}
} }
} }
} }
...@@ -32,7 +32,6 @@ import com.gingersoft.gsa.cloud.common.constans.PrintConstans; ...@@ -32,7 +32,6 @@ 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.restaurant.utils.RestaurantExpandInfoUtils;
import com.gingersoft.gsa.cloud.common.core.table.TableBean;
import com.gingersoft.gsa.cloud.common.logan.LoganManager; import com.gingersoft.gsa.cloud.common.logan.LoganManager;
import com.gingersoft.gsa.cloud.common.printer.AidlUtil; 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;
...@@ -43,10 +42,7 @@ import com.gingersoft.gsa.cloud.common.utils.view.ImageUtils; ...@@ -43,10 +42,7 @@ import com.gingersoft.gsa.cloud.common.utils.view.ImageUtils;
import com.gingersoft.gsa.cloud.common.utils.view.LayoutToBitmapUtils; import com.gingersoft.gsa.cloud.common.utils.view.LayoutToBitmapUtils;
import com.gingersoft.gsa.cloud.common.utils.view.QRCodeUtil; import com.gingersoft.gsa.cloud.common.utils.view.QRCodeUtil;
import com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean; import com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean;
import com.gingersoft.gsa.cloud.order.billItem.BillItem;
import com.gingersoft.gsa.cloud.order.commodity.OrderDetail; import com.gingersoft.gsa.cloud.order.commodity.OrderDetail;
import com.gingersoft.gsa.cloud.order.order.DoshokuOrder;
import com.gingersoft.gsa.cloud.pay.bean.PayMethod;
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.PrinterWriter58mm; import com.gingersoft.gsa.cloud.print.PrinterWriter58mm;
...@@ -67,15 +63,12 @@ import com.joe.print.mvp.model.bean.HtmlLable; ...@@ -67,15 +63,12 @@ import com.joe.print.mvp.model.bean.HtmlLable;
import com.joe.print.mvp.print.common.HtmlContract; import com.joe.print.mvp.print.common.HtmlContract;
import com.joe.print.mvp.print.common.PrinterFinderCallback; import com.joe.print.mvp.print.common.PrinterFinderCallback;
import com.joe.print.mvp.print.common.SendResultCode; import com.joe.print.mvp.print.common.SendResultCode;
import com.joe.print.mvp.print.maker.IpPrintMaker;
import com.joe.print.mvp.print.usb.EscCommand; import com.joe.print.mvp.print.usb.EscCommand;
import com.joe.print.mvp.print.usb.UsbPrint; import com.joe.print.mvp.print.usb.UsbPrint;
import com.joe.print.mvp.print.usb.UsbPrinter; 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.BBposPrint; import com.joe.print.mvp.print.utils.BBposPrint;
import com.joe.print.mvp.ui.adapter.BillAdapter;
import com.joe.print.mvp.ui.adapter.BillItemAdapter;
import com.joe.print.mvp.ui.adapter.BillTypeAdapter;
import com.joe.print.mvp.ui.adapter.FoodAdapter;
import com.joe.print.mvp.ui.view.BillItemView; import com.joe.print.mvp.ui.view.BillItemView;
import com.joe.print.mvp.ui.view.BillTypeView; import com.joe.print.mvp.ui.view.BillTypeView;
import com.joe.print.mvp.ui.view.BillView; import com.joe.print.mvp.ui.view.BillView;
...@@ -287,11 +280,14 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket ...@@ -287,11 +280,14 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket
@Override @Override
public void onRaiseException(int code, String msg) { public void onRaiseException(int code, String msg) {
//接⼝执⾏失败时,返回的异常状态 //接⼝执⾏失败时,返回的异常状态
PrinterPlugins.getOnPrinterFlowHandler().onPrintError(code);
LoganManager.w_printer(TAG, "商米onRaiseException: " + code + msg);
} }
@Override @Override
public void onPrintResult(int code, String msg) { public void onPrintResult(int code, String msg) {
//事务模式下真实的打印结果返回 //事务模式下真实的打印结果返回
PrinterPlugins.getOnPrinterFlowHandler().onPrintSuccess();
} }
}); });
} }
...@@ -305,9 +301,11 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket ...@@ -305,9 +301,11 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket
if (i == 0) { if (i == 0) {
//打印成功 //打印成功
listener.printSuccess(); listener.printSuccess();
PrinterPlugins.getOnPrinterFlowHandler().onPrintSuccess();
} else { } else {
//打印失敗 //打印失敗
listener.printFailure("打印失敗"); listener.printFailure("打印失敗");
PrinterPlugins.getOnPrinterFlowHandler().onPrintError(i);
} }
} }
...@@ -316,7 +314,8 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket ...@@ -316,7 +314,8 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket
return this; return this;
} }
}); });
} catch (RemoteException e) { } catch (
RemoteException e) {
e.printStackTrace(); e.printStackTrace();
//打印失敗 //打印失敗
listener.printFailure("打印失敗"); listener.printFailure("打印失敗");
...@@ -335,11 +334,10 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket ...@@ -335,11 +334,10 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket
if (printerDeviceBean.getModel() != null) { if (printerDeviceBean.getModel() != null) {
if (printerDeviceBean.getModel().toLowerCase().contains("TM-U220B".toLowerCase())) { if (printerDeviceBean.getModel().toLowerCase().contains("TM-U220B".toLowerCase())) {
ThreadPoolManager.getInstence().putExecutableTasks(() -> { ThreadPoolManager.getInstence().putExecutableTasks(() -> {
EpsonPrint mPrinter = EpsonPrint.getInstance(); EpsonPrint mPrinter = new EpsonPrint();
mPrinter.setPrint(false);
mPrinter.initializeObject(GsaCloudApplication.getAppContext(), PrinterRoot.this, PrinterRoot.this); mPrinter.initializeObject(GsaCloudApplication.getAppContext(), PrinterRoot.this, PrinterRoot.this);
for (int j = 0; j < bitmaps.size(); j++) { for (int j = 0; j < bitmaps.size(); j++) {
mPrinter.putPrintData(printerDeviceBean.getIp(), bitmaps.get(j)); mPrinter.putPrintData(printerDeviceBean.getIp(), bitmaps.get(j), "");
} }
} }
); );
...@@ -441,32 +439,25 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket ...@@ -441,32 +439,25 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket
PrinterPlugins.getOnPrinterFlowHandler().onPrintSuccess(); PrinterPlugins.getOnPrinterFlowHandler().onPrintSuccess();
printSuccess(); printSuccess();
return; return;
case PrintSocketHolder.ERROR_1: case PrintSocketHolder.ERROR_6:
LoganManager.w_printer(TAG, "生成打印數據失敗"); LoganManager.w_printer(TAG, "生成打印數據失敗");
printFailure("生成打印數據失敗"); printFailure("生成打印數據失敗");
break; break;
case PrintSocketHolder.ERROR_2: case PrintSocketHolder.ERROR_7:
LoganManager.w_printer(TAG, "連接打印機失敗"); LoganManager.w_printer(TAG, "連接打印機失敗");
printFailure("連接打印機失敗"); printFailure("連接打印機失敗");
break; break;
case PrintSocketHolder.ERROR_3: case PrintSocketHolder.ERROR_10:
LoganManager.w_printer(TAG, "連接打印機失敗(获取输出流失败)"); LoganManager.w_printer(TAG, "連接打印機失敗(写入页面数据失败),Code:" + PrintSocketHolder.ERROR_10);
printFailure("連接打印機失敗"); printFailure("打印失敗,錯誤碼:" + errorCode);
break;
case PrintSocketHolder.ERROR_4:
LoganManager.w_printer(TAG, "連接打印機失敗(写入页面数据失败)");
printFailure("連接打印機失敗");
break; break;
case PrintSocketHolder.ERROR_5: case PrintSocketHolder.ERROR_9:
LoganManager.w_printer(TAG, "連接打印機失敗(必要参数不能为空)"); LoganManager.w_printer(TAG, "連接打印機失敗(必要参数不能为空)");
printFailure("連接打印機失敗"); printFailure("連接打印機失敗,沒有ip地址,錯誤碼:" + errorCode);
break; break;
case PrintSocketHolder.ERROR_6: case PrintSocketHolder.ERROR_66:
LoganManager.w_printer(TAG, "关闭Socket出错"); LoganManager.w_printer(TAG, "关闭Socket出错");
break; break;
case PrintSocketHolder.ERROR_100:
LoganManager.w_printer(TAG, "打印失败");
break;
} }
PrinterPlugins.getOnPrinterFlowHandler().onPrintError(errorCode); PrinterPlugins.getOnPrinterFlowHandler().onPrintError(errorCode);
setPrintState(errorCode); setPrintState(errorCode);
...@@ -924,55 +915,6 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket ...@@ -924,55 +915,6 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket
parentView.findViewById(viewId).setVisibility(isShow ? View.VISIBLE : View.GONE); parentView.findViewById(viewId).setVisibility(isShow ? View.VISIBLE : View.GONE);
} }
protected String getHtmlPrintHeadInfo() {
return getPLable(RestaurantInfoManager.newInstance().getBrandName(), HTML_PRINT_GRAVITY_CENTER) +
getPLable(RestaurantInfoManager.newInstance().getRestaurantName(), HTML_PRINT_GRAVITY_CENTER);
}
protected String getHtmlPrintHeadOrderInfo(TableBean.DataBean tableBean) {
String orderNum = "單號:";
if (TextUtil.isNotEmptyOrNullOrUndefined(DoshokuOrder.getInstance().getOrderNo())) {
orderNum = "單號:" + DoshokuOrder.getInstance().getOrderNo();
}
return getWholeLine() +
getPLable("餐檯:" + tableBean.getTableName(), HTML_PRINT_GRAVITY_LEFT) +
getPLable("人數:" + DoshokuOrder.getInstance().getOpenTableInfo().getPerson(), HTML_PRINT_GRAVITY_LEFT) +
getPLable(orderNum, HTML_PRINT_GRAVITY_LEFT) +
getPLable("日期:" + TimeUtils.parseTimeRepeat(tableBean.getCreateTime(), TimeUtils.DEFAULT_DATE_FORMAT), HTML_PRINT_GRAVITY_LEFT) +
getWholeLine();
}
protected String getHtmlBillInfo() {
//添加合計項
StringBuilder amountStr = new StringBuilder(getPLable("合計 " + DoshokuOrder.getInstance().getShoppingCart().getWholeAmount(), HTML_PRINT_GRAVITY_RIGHT));
//添加其他金額項
if (DoshokuOrder.getInstance().getShoppingCart().getBillItemList().size() > 0) {
for (BillItem item : DoshokuOrder.getInstance().getShoppingCart().getBillItemList()) {
amountStr.append(getPLable(item.getName() + " " + item.getMoney(), HTML_PRINT_GRAVITY_RIGHT));
}
}
amountStr.append(getLine(21, HTML_PRINT_GRAVITY_RIGHT));
amountStr.append("總金額 ").append(DoshokuOrder.getInstance().getShoppingCart().getTotalAmount());
return getLine(21, HTML_PRINT_GRAVITY_RIGHT)
+ amountStr;
}
protected String getHtmlBillPayInfo() {
StringBuilder payInfo = new StringBuilder();
for (PayMethod payMethod : DoshokuOrder.getInstance().getBillMoney()) {
payInfo.append(getPLable(payMethod.getPayName() + " $" + payMethod.getPayMoney(), HTML_PRINT_GRAVITY_LEFT));
}
return getWholeLine() +
payInfo +
getWholeLine();
}
protected String getHtmlFooter() {
return getPLable("Thank you!", HTML_PRINT_GRAVITY_CENTER) +
getPLable(TimeUtils.getCurrentTimeInString(TimeUtils.DEFAULT_DATE_FORMAT), HTML_PRINT_GRAVITY_CENTER);
}
public final int HTML_PRINT_GRAVITY_LEFT = 0; public final int HTML_PRINT_GRAVITY_LEFT = 0;
public final int HTML_PRINT_GRAVITY_CENTER = 1; public final int HTML_PRINT_GRAVITY_CENTER = 1;
public final int HTML_PRINT_GRAVITY_RIGHT = 2; public final int HTML_PRINT_GRAVITY_RIGHT = 2;
......
package com.joe.print.mvp.print; package com.joe.print.mvp.print.maker;
import android.graphics.Bitmap; import android.graphics.Bitmap;
......
package com.joe.print.mvp.print; package com.joe.print.mvp.print.maker;
import com.gingersoft.gsa.cloud.print.PrintDataMaker; import com.gingersoft.gsa.cloud.print.PrintDataMaker;
import com.gingersoft.gsa.cloud.print.PrinterWriter; import com.gingersoft.gsa.cloud.print.PrinterWriter;
......
...@@ -3,6 +3,7 @@ package com.joe.print.mvp.print.maker; ...@@ -3,6 +3,7 @@ package com.joe.print.mvp.print.maker;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import com.gingersoft.gsa.cloud.print.PrintDataMaker; import com.gingersoft.gsa.cloud.print.PrintDataMaker;
import com.gingersoft.gsa.cloud.print.PrintExecutor;
import com.gingersoft.gsa.cloud.print.PrinterWriter; import com.gingersoft.gsa.cloud.print.PrinterWriter;
import com.gingersoft.gsa.cloud.print.PrinterWriterExecutor; import com.gingersoft.gsa.cloud.print.PrinterWriterExecutor;
...@@ -20,6 +21,12 @@ public class PrjPrintMaker implements PrintDataMaker { ...@@ -20,6 +21,12 @@ public class PrjPrintMaker implements PrintDataMaker {
private String ip; private String ip;
private int port; private int port;
private PrintExecutor.OnPrjPrintResultListener onPrjPrintResultListener;
public PrintExecutor.OnPrjPrintResultListener getOnPrjPrintResultListener() {
return onPrjPrintResultListener;
}
public PrjPrintMaker(Map<String, Bitmap> bitmapMap, String ip, int port) { public PrjPrintMaker(Map<String, Bitmap> bitmapMap, String ip, int port) {
this.bitmapMap = bitmapMap; this.bitmapMap = bitmapMap;
this.ip = ip; this.ip = ip;
......
package com.joe.print.mvp.print; package com.joe.print.mvp.print.maker;
import android.graphics.Bitmap; import android.graphics.Bitmap;
......
...@@ -12,11 +12,9 @@ import android.util.Log; ...@@ -12,11 +12,9 @@ import android.util.Log;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.epson.epos2.Epos2Exception;
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.app.GsaCloudApplication;
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;
...@@ -43,9 +41,7 @@ import com.hyweb.n5.lib.constant.PrinterConstant; ...@@ -43,9 +41,7 @@ import com.hyweb.n5.lib.constant.PrinterConstant;
import com.hyweb.n5.lib.util.PrinterUtil; import com.hyweb.n5.lib.util.PrinterUtil;
import com.hyweb.n5.server.aidl.IOnPrintCallback; import com.hyweb.n5.server.aidl.IOnPrintCallback;
import com.joe.print.mvp.print.EpsonPrint; import com.joe.print.mvp.print.EpsonPrint;
import com.joe.print.mvp.print.IpPrintMaker;
import com.joe.print.mvp.print.PrintPrjKitchen; import com.joe.print.mvp.print.PrintPrjKitchen;
import com.joe.print.mvp.print.PrinterRoot;
import com.joe.print.mvp.print.common.PrinterFinderCallback; import com.joe.print.mvp.print.common.PrinterFinderCallback;
import com.joe.print.mvp.print.common.SendResultCode; import com.joe.print.mvp.print.common.SendResultCode;
import com.joe.print.mvp.print.maker.PrjPrintMaker; import com.joe.print.mvp.print.maker.PrjPrintMaker;
...@@ -56,7 +52,6 @@ import com.joe.print.mvp.print.usb.UsbPrinterFinder; ...@@ -56,7 +52,6 @@ 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 com.xuexiang.rxutil2.rxjava.RxJavaUtils;
import com.xuexiang.rxutil2.rxjava.task.RxIOTask;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
...@@ -75,7 +70,6 @@ import java.util.concurrent.TimeUnit; ...@@ -75,7 +70,6 @@ import java.util.concurrent.TimeUnit;
import io.reactivex.Observer; import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
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 jcifs.smb.SmbFile; import jcifs.smb.SmbFile;
import jcifs.smb.SmbFileOutputStream; import jcifs.smb.SmbFileOutputStream;
...@@ -101,7 +95,7 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -101,7 +95,7 @@ public class PrjService extends Service implements ReceiveListener {
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
LoganManager.w_printer(TAG, "onCreate"); LoganManager.w_printer(TAG, "PrjService onCreate");
mContext = this; mContext = this;
initUsbPrint(); initUsbPrint();
} }
...@@ -109,7 +103,7 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -109,7 +103,7 @@ public class PrjService extends Service implements ReceiveListener {
@Override @Override
public int onStartCommand(Intent intent, int flags, int startId) { public int onStartCommand(Intent intent, int flags, int startId) {
mContext = this; mContext = this;
LoganManager.w_printer(TAG, "onStartCommand"); LoganManager.w_printer(TAG, "PrjService onStartCommand");
//開始請求 //開始請求
startGetPrjInfo(); startGetPrjInfo();
return super.onStartCommand(intent, flags, startId); return super.onStartCommand(intent, flags, startId);
...@@ -123,7 +117,7 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -123,7 +117,7 @@ public class PrjService extends Service implements ReceiveListener {
//關閉針式連接 //關閉針式連接
EpsonPrint.getInstance().disconnectPrinter(); EpsonPrint.getInstance().disconnectPrinter();
EpsonPrint.getInstance().finalizeObject(); EpsonPrint.getInstance().finalizeObject();
LoganManager.w_printer(TAG, "onDestroy"); LoganManager.w_printer(TAG, "PrjService onDestroy");
} }
private UsbPrinterFinder printerFinder; private UsbPrinterFinder printerFinder;
...@@ -163,7 +157,7 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -163,7 +157,7 @@ public class PrjService extends Service implements ReceiveListener {
cancel(wakeDisposable); cancel(wakeDisposable);
cancel(pollDisposable); cancel(pollDisposable);
if (!UserContext.newInstance().isLogin()) { if (!UserContext.newInstance().isLogin()) {
LoganManager.w_printer(TAG, "用户未登录!"); LoganManager.w_printer(TAG, "PrjService 用户未登录!");
return; return;
} }
pollDisposable = RxJavaUtils.polling(10, 30, TimeUnit.SECONDS) pollDisposable = RxJavaUtils.polling(10, 30, TimeUnit.SECONDS)
...@@ -228,9 +222,9 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -228,9 +222,9 @@ public class PrjService extends Service implements ReceiveListener {
private int totalPrj; private int totalPrj;
private int currentIndex; private int currentIndex;
private String prjJson = ""; private String prjJson = "{\"success\":true,\"sysTime\":1613789540248,\"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 void newPrint(String json) { private void newPrint(String json) {
// json = prjJson;
Map<String, List<PrjBean.DataBean.Bean>> listMap = new HashMap<>(); Map<String, List<PrjBean.DataBean.Bean>> listMap = new HashMap<>();
currentIndex = 0; currentIndex = 0;
totalPrj = 0; totalPrj = 0;
...@@ -309,9 +303,11 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -309,9 +303,11 @@ public class PrjService extends Service implements ReceiveListener {
//雙重遍歷可以以後優化 //雙重遍歷可以以後優化
//第二步:遍歷 Map<廚房位置,需要打印的數據>,通過廚房位置找到對應的打印機,並且通過數據拿到對應的通用配置 //第二步:遍歷 Map<廚房位置,需要打印的數據>,通過廚房位置找到對應的打印機,並且通過數據拿到對應的通用配置
for (Map.Entry<String, List<PrjBean.DataBean.Bean>> prjMap : listMap.entrySet()) { for (Map.Entry<String, List<PrjBean.DataBean.Bean>> prjMap : listMap.entrySet()) {
boolean isFindDevice = false;
for (PrinterDeviceBean deviceBean : printerDeviceBeans) { for (PrinterDeviceBean deviceBean : printerDeviceBeans) {
//遍歷得到當前打印機,如果沒找到打印機,就不打印 //遍歷得到當前打印機,如果沒找到打印機,就不打印
if (prjMap.getKey().toLowerCase().equals(deviceBean.getName().toLowerCase())) { if (prjMap.getKey().toLowerCase().equals(deviceBean.getName().toLowerCase())) {
isFindDevice = true;
//如果PRJ數據的廚房位置和打印機名稱相同,則就是這台打印機打印 //如果PRJ數據的廚房位置和打印機名稱相同,則就是這台打印機打印
//通過需要打印的數據,得到通用配置 //通過需要打印的數據,得到通用配置
PrintCurrencyBean printCurrencyBean = getPrintCurrencyBean(prjMap.getValue()); PrintCurrencyBean printCurrencyBean = getPrintCurrencyBean(prjMap.getValue());
...@@ -323,6 +319,10 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -323,6 +319,10 @@ public class PrjService extends Service implements ReceiveListener {
generatePrintData(prjMap.getKey(), prjMap.getValue(), configPrinterDeviceBean); generatePrintData(prjMap.getKey(), prjMap.getValue(), configPrinterDeviceBean);
} }
} }
if (!isFindDevice) {
//用戶沒有這個打印機,打印失敗,返回後台原因
updatePrjState(UpdateBean.FAIL_PRINT_BY_NOT_FIND_DEVICE, getPrintIdsByPrjData(prjMap.getValue()));
}
} }
} }
...@@ -359,16 +359,13 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -359,16 +359,13 @@ public class PrjService extends Service implements ReceiveListener {
return printCurrencyBean; return printCurrencyBean;
} }
//打印回調了多少次都要記錄下來,所以一次只能傳遞一張prj過去,等到打印回調再打第二張
private String EpsIds = "";
/** /**
* 生成用於打印的prj的Bitmap * 生成用於打印的prj的Bitmap
*/ */
private void generatePrintData(String key, List<PrjBean.DataBean.Bean> beans, PrinterDeviceBean printerDeviceBean) { private void generatePrintData(String key, List<PrjBean.DataBean.Bean> beans, PrinterDeviceBean printerDeviceBean) {
int orderType = 1; int orderType = 1;
if (beans.size() > 0) { if (beans != null && beans.size() > 0) {
orderType = beans.get(0).getOrderType(); orderType = beans.get(0).getOrderType();
} }
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));
...@@ -395,6 +392,7 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -395,6 +392,7 @@ public class PrjService extends Service implements ReceiveListener {
locationPrint(bitmapMaps); locationPrint(bitmapMaps);
break; break;
case PRINT_USB: case PRINT_USB:
LoganManager.w_printer(TAG, "開始USB打印-->");
//USB打印 //USB打印
usbPrint(bitmapMaps); usbPrint(bitmapMaps);
break; break;
...@@ -513,66 +511,49 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -513,66 +511,49 @@ public class PrjService extends Service implements ReceiveListener {
private void stylusPrinting(String key, List<PrjBean.DataBean.Bean> beans, PrinterDeviceBean printerDeviceBean) { private void stylusPrinting(String key, List<PrjBean.DataBean.Bean> 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);
//獲取prj的id集合
EpsIds = getPrintIds(bitmapMaps); String epsonIds = getPrintIds(bitmapMaps);
EpsonPrint mPrinter = EpsonPrint.getInstance(); EpsonPrint mPrinter = EpsonPrint.getInstance();
mPrinter.setPrint(false); boolean initResult = EpsonPrint.getInstance().initializeObject(this, this, errorCode -> updatePrjState(errorCode, epsonIds));
boolean initResult = EpsonPrint.getInstance().initializeObject(this, this, new PrintExecutor.OnPrintResultListener() {
@Override
public void onResult(int errorCode) {
switch (errorCode) {
case PrintSocketHolder.ERROR_1:
LoganManager.w_printer(TAG, "針式創建打印數據失敗");
break;
case PrintSocketHolder.ERROR_2:
LoganManager.w_printer(TAG, "針式沒紙或未連接");
break;
case PrintSocketHolder.ERROR_4:
LoganManager.w_printer(TAG, "針式發送打印數據失敗");
break;
default:
break;
}
updatePrjFailure(EpsIds);
}
});
if (!initResult) { if (!initResult) {
updatePrjFailure(EpsIds); //初始化打印機失敗
updatePrjState(UpdateBean.FAIL_EPSON_INIT, epsonIds);
return; return;
} }
PrinterPlugins.getOnPrinterFlowHandler().connectionBefore("針式打印機", printerDeviceBean.getIp(), printerDeviceBean.getPort(), 0, 0); PrinterPlugins.getOnPrinterFlowHandler().connectionBefore("針式打印機", printerDeviceBean.getIp(), printerDeviceBean.getPort(), 0, 0);
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()) {
mPrinter.putPrintData(printerDeviceBean.getIp(), mapEntry.getValue()); mPrinter.putPrintData(printerDeviceBean.getIp(), mapEntry.getValue(), epsonIds);
} }
} }
} }
PrintExecutor executor;
/** /**
* ip設備打印 * ip設備打印
*/ */
public void ipPrint(PrinterDeviceBean printerDeviceBean, List<Map<String, Bitmap>> bitmapMaps) { public void ipPrint(PrinterDeviceBean printerDeviceBean, List<Map<String, Bitmap>> bitmapMaps) {
for (int i = 0; i < bitmapMaps.size(); i++) { for (int i = 0; i < bitmapMaps.size(); i++) {
if (executor == null) { // if (executor == null) {
executor = new PrintExecutor().setOnPrjPrintResultListener((errorCode, ids) -> { // executor = new PrintExecutor().setOnPrjPrintResultListener((errorCode, ids) -> {
switch (errorCode) { // switch (errorCode) {
case PrintSocketHolder.ERROR_0: // case PrintSocketHolder.ERROR_0:
//更新狀態 // //更新狀態
updatePrjSuccess(ids); // updatePrjSuccess(ids);
break; // break;
case PrintSocketHolder.ERROR_2: // case PrintSocketHolder.ERROR_2:
updatePrjFailure(ids); // updatePrjFailure(ids);
break; // break;
} // }
}); // });
} // }
// PrjPrintMaker maker = new PrjPrintMaker(bitmapMaps.get(i), printerDeviceBean.getIp(), printerDeviceBean.getPort());
// executor.doPrinterRequestAsync(maker);
PrintExecutor.getInstance().setOnPrjPrintResultListener(this::updatePrjState);
PrjPrintMaker maker = new PrjPrintMaker(bitmapMaps.get(i), printerDeviceBean.getIp(), printerDeviceBean.getPort()); PrjPrintMaker maker = new PrjPrintMaker(bitmapMaps.get(i), printerDeviceBean.getIp(), printerDeviceBean.getPort());
executor.doPrinterRequestAsync(maker); PrintExecutor.getInstance().doPrinterRequestAsync(maker);
} }
} }
...@@ -628,15 +609,32 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -628,15 +609,32 @@ public class PrjService extends Service implements ReceiveListener {
n5Print(bitmapMaps); n5Print(bitmapMaps);
} else if (PrintConstans.PRINT_MODEL_WISEPOS.contains(model)) { } else if (PrintConstans.PRINT_MODEL_WISEPOS.contains(model)) {
//BBPOS,生成data //BBPOS,生成data
ToastUtils.show(this, "BBPOS不支持打印處方單"); ToastUtils.show(this, "BBPOS不支持打印廚房單");
} else { } else {
updatePrjFailure(getPrintIds(bitmapMaps)); updatePrjState(UpdateBean.FAIL_LOCAL_PRINT_NOT_DEVICE, getPrintIds(bitmapMaps));
} }
} }
/** /**
* 獲取本次打印的prj id * 獲取本次打印的prj id
* *
* @return prj的id集合
*/
private String getPrintIdsByPrjData(List<PrjBean.DataBean.Bean> prjBeans) {
StringBuilder stringBuilder = new StringBuilder();
for (PrjBean.DataBean.Bean prjBean : prjBeans) {
stringBuilder.append(prjBean.getId());
if (stringBuilder.toString().lastIndexOf(",") != stringBuilder.length() - 1) {
//如果最後一位不是逗號,才添加
stringBuilder.append(",");
}
}
return stringBuilder.toString();
}
/**
* 獲取本次打印的prj id
*
* @param bitmapMaps * @param bitmapMaps
* @return * @return
*/ */
...@@ -644,19 +642,16 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -644,19 +642,16 @@ public class PrjService extends Service implements ReceiveListener {
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
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()) {
stringBuilder.append(mapEntry.getKey()); stringBuilder.append(mapEntry.getKey()).append(",");
if (stringBuilder.toString().lastIndexOf(",") != stringBuilder.length() - 1) {
//如果最後一位不是逗號,才添加
stringBuilder.append(",");
}
} }
} }
return stringBuilder.toString(); if (stringBuilder.length() <= 0) {
return "";
}
//最後一位是逗號,去掉
return stringBuilder.substring(0, stringBuilder.length() - 1);
} }
private final static int SUNMI_PAPER_WIDTH = 360;//商米打印機紙張寬度
private final static int N5_PAPER_WIDTH = 500;//N5打印機紙張寬度
/** /**
* 商米打印 * 商米打印
*/ */
...@@ -686,7 +681,37 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -686,7 +681,37 @@ public class PrjService extends Service implements ReceiveListener {
@Override @Override
public void onRaiseException(int code, String msg) { public void onRaiseException(int code, String msg) {
//接⼝执⾏失败时,返回的异常状态 //接⼝执⾏失败时,返回的异常状态
LoganManager.w_printer(TAG, "商米onRaiseException: " + msg); PrinterPlugins.getOnPrinterFlowHandler().onPrintError(code);
LoganManager.w_printer(TAG, "商米onRaiseException: " + code + msg);
switch (code) {
case 3:
//通訊異常
updatePrjState(UpdateBean.FAIL_PRINT_BY_NOT_CONNECT, ids);
break;
case 4:
//缺紙
updatePrjState(UpdateBean.FAIL_NOT_PAPER, ids);
break;
case 5:
//過熱
updatePrjState(UpdateBean.FAIL_SUNMI_PRINT_HOT, ids);
break;
case 6:
//蓋子未合上
updatePrjState(UpdateBean.FAIL_LID_NOT_CLOSED_SUNMI, ids);
break;
case 7:
//切刀異常
updatePrjState(UpdateBean.FAIL_CUT_ABNORMAL_SUNMI, ids);
break;
case 9:
//黑標異常
updatePrjState(UpdateBean.FAIL_SUNMI_NO_BLACK_MARK_DETECTED, ids);
break;
default:
updatePrjState(UpdateBean.FAIL_PRINT_BY_NOT_FIND_DEVICE_SUNMI, ids);
break;
}
} }
@Override @Override
...@@ -720,6 +745,7 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -720,6 +745,7 @@ public class PrjService extends Service implements ReceiveListener {
} else { } else {
//打印失敗 //打印失敗
updatePrjFailure(ids); updatePrjFailure(ids);
PrinterPlugins.getOnPrinterFlowHandler().onPrintError(i);
} }
} }
...@@ -818,6 +844,11 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -818,6 +844,11 @@ public class PrjService extends Service implements ReceiveListener {
updatePrjState(UpdateBean.ALREADY_PRINT, ids); updatePrjState(UpdateBean.ALREADY_PRINT, ids);
} }
/**
* 打印失敗,將打印狀態改為未打印,並不是改為打印失敗,失敗是由後台判斷打印失敗次數超過最大限制之後改為打印失敗的
*
* @param ids prj的id集合
*/
private void updatePrjFailure(String ids) { private void updatePrjFailure(String ids) {
updatePrjState(UpdateBean.NO_PRINT, ids); updatePrjState(UpdateBean.NO_PRINT, ids);
} }
...@@ -844,7 +875,6 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -844,7 +875,6 @@ public class PrjService extends Service implements ReceiveListener {
startGetPrjInfo(); startGetPrjInfo();
OkHttp3Utils.post(HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL + "printerRecording/update", requestBody) OkHttp3Utils.post(HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL + "printerRecording/update", requestBody)
.subscribeOn(Schedulers.io())//切换到io线程進行網絡請求 .subscribeOn(Schedulers.io())//切换到io线程進行網絡請求
.observeOn(AndroidSchedulers.mainThread())//切換到主線程處理請求結果
.subscribe(new Observer<String>() { .subscribe(new Observer<String>() {
@Override @Override
...@@ -854,7 +884,7 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -854,7 +884,7 @@ public class PrjService extends Service implements ReceiveListener {
@Override @Override
public void onNext(String s) { public void onNext(String s) {
LoganManager.w_printer(TAG, "修改Prj打印狀態---end----: " + s); LoganManager.w_printer(TAG, "修改Prj打印狀態---end----: " + json + s);
} }
@Override @Override
...@@ -866,7 +896,6 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -866,7 +896,6 @@ public class PrjService extends Service implements ReceiveListener {
} }
}); });
EpsIds = "";
} }
@Override @Override
...@@ -875,11 +904,11 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -875,11 +904,11 @@ public class PrjService extends Service implements ReceiveListener {
if (i == 0) { if (i == 0) {
PrinterPlugins.getOnPrinterFlowHandler().onPrintSuccess(); PrinterPlugins.getOnPrinterFlowHandler().onPrintSuccess();
//打印成功 //打印成功
updatePrjSuccess(EpsIds); updatePrjSuccess(s);
} else { } else {
PrinterPlugins.getOnPrinterFlowHandler().onPrintError(i); PrinterPlugins.getOnPrinterFlowHandler().onPrintError(i);
//打印失敗 //打印失敗
updatePrjFailure(EpsIds); updatePrjFailure(s);
} }
startGetPrjInfo(); startGetPrjInfo();
} }
......
package com.joe.print.mvp.ui.activity; package com.joe.print.mvp.ui.activity;
import android.app.Dialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.billy.cc.core.component.CC; 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.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication; import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
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.gson.GsonUtils; import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.print.NewPrintExecutor;
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;
...@@ -43,42 +28,27 @@ import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; ...@@ -43,42 +28,27 @@ 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.ui.utils.DialogUtils;
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.utils.ArmsUtils; import com.jess.arms.utils.ArmsUtils;
import com.joe.print.R;
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.EpsonPrint;
import com.joe.print.mvp.print.OpenCashBoxMaker; import com.joe.print.mvp.print.maker.OpenCashBoxMaker;
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;
import com.joe.print.mvp.print.PrinterRoot; import com.joe.print.mvp.print.PrinterRoot;
import com.joe.print.mvp.print.utils.MyPrintUtils; import com.joe.print.mvp.print.utils.MyPrintUtils;
import com.joe.print.mvp.ui.adapter.DialogPrinterListAdapter;
import com.joe.print.mvp.ui.adapter.PrintProgressAdapter;
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.lxj.xpopup.core.CenterPopupView;
import com.lxj.xpopup.enums.PopupAnimation; import com.lxj.xpopup.enums.PopupAnimation;
import com.lxj.xpopup.impl.LoadingPopupView; import com.lxj.xpopup.impl.LoadingPopupView;
import com.xuexiang.rxutil2.rxjava.RxJavaUtils;
import com.xuexiang.rxutil2.rxjava.task.RxAsyncTask;
import com.xuexiang.rxutil2.rxjava.task.RxUITask;
import com.yanzhenjie.recyclerview.widget.DefaultItemDecoration;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
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;
...@@ -365,18 +335,17 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print ...@@ -365,18 +335,17 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
case PrintSocketHolder.ERROR_0: case PrintSocketHolder.ERROR_0:
tip = "打印成功"; tip = "打印成功";
break; break;
case PrintSocketHolder.ERROR_1: case PrintSocketHolder.ERROR_6:
tip = "生成打印數據失敗"; tip = "生成打印數據失敗";
break; break;
case PrintSocketHolder.ERROR_2: case PrintSocketHolder.ERROR_7:
case PrintSocketHolder.ERROR_3:
tip = "連接打印機失敗"; tip = "連接打印機失敗";
break; break;
case PrintSocketHolder.ERROR_4: case PrintSocketHolder.ERROR_4:
tip = "寫入測試頁面數據失敗"; tip = "寫入測試頁面數據失敗";
break; break;
case PrintSocketHolder.ERROR_5: case PrintSocketHolder.ERROR_9:
tip = "必要的參數不能為空"; tip = "ip地址不能為空";
break; break;
case PrintSocketHolder.STATE_0: case PrintSocketHolder.STATE_0:
break; break;
...@@ -526,9 +495,6 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print ...@@ -526,9 +495,6 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
//關閉打印頁面時,關閉所有打印連接 //關閉打印頁面時,關閉所有打印連接
//關閉ip打印連接 //關閉ip打印連接
PrintSocketHolder.getInstance().closeSocket(); PrintSocketHolder.getInstance().closeSocket();
//關閉針式打印連接
EpsonPrint.getInstance().disconnectPrinter();
EpsonPrint.getInstance().finalizeObject();
} }
@Override @Override
......
...@@ -221,7 +221,7 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM ...@@ -221,7 +221,7 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM
return currentSelectedSupplier; return currentSelectedSupplier;
} }
public void setSendSuccess(){ public void setSendSuccess() {
SendSupplierMsgBean sendSupplierMsgBean = sendSupplierMsgBeans.get(currentSelectedSupplier); SendSupplierMsgBean sendSupplierMsgBean = sendSupplierMsgBeans.get(currentSelectedSupplier);
sendSupplierMsgBean.setSend(true); sendSupplierMsgBean.setSend(true);
} }
...@@ -237,9 +237,11 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM ...@@ -237,9 +237,11 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM
currentSelectedSupplier = supplierIndex; currentSelectedSupplier = supplierIndex;
supplierId = sendSupplierMsgBeans.get(supplierIndex).getId() + ""; supplierId = sendSupplierMsgBeans.get(supplierIndex).getId() + "";
List<SupplierInfoBean.SupplierContacts> supplierContacts = sendSupplierMsgBeans.get(supplierIndex).getSupplierContacts(); List<SupplierInfoBean.SupplierContacts> supplierContacts = sendSupplierMsgBeans.get(supplierIndex).getSupplierContacts();
//把所有的供應鏈聯繫方式關閉
for (SendSupplierMsgBean sendSupplierMsgBean : sendSupplierMsgBeans) { for (SendSupplierMsgBean sendSupplierMsgBean : sendSupplierMsgBeans) {
sendSupplierMsgBean.setOpen(false); sendSupplierMsgBean.setOpen(false);
} }
//展開當前選中的供應商的聯繫方式
sendSupplierMsgBeans.get(supplierIndex).setOpen(true); sendSupplierMsgBeans.get(supplierIndex).setOpen(true);
if (supplierContacts != null) { if (supplierContacts != null) {
//如果已有聯繫方式,就不用調用接口 //如果已有聯繫方式,就不用調用接口
...@@ -248,14 +250,21 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM ...@@ -248,14 +250,21 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM
mRootView.loadSupplierList(sendSupplierMsgBeans); mRootView.loadSupplierList(sendSupplierMsgBeans);
return; return;
} else { } else {
// getPurchaseOrderQrCode(sendSupplierMsgBeans.get(supplierIndex).getOrderId() + "");
mRootView.loadSupplierList(sendSupplierMsgBeans); mRootView.loadSupplierList(sendSupplierMsgBeans);
} }
} }
} else { } else {
// mRootView.showMessage("未獲取到供應商聯繫方式");
return; return;
} }
getSupplierContactById(supplierIndex, supplierId);
}
/**
* 跟進供應商id 獲取供應商聯繫方式
* @param supplierIndex 供應商下標,獲取到聯繫方式之後刷新
* @param supplierId 供應商id
*/
private void getSupplierContactById(int supplierIndex, String supplierId) {
mModel.getSupplierContact(supplierId) mModel.getSupplierContact(supplierId)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("查詢中...")) .doOnSubscribe(disposable -> mRootView.showLoading("查詢中..."))
...@@ -279,7 +288,6 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM ...@@ -279,7 +288,6 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM
} }
SendSupplierMsgBean sendSupplierMsgBean = sendSupplierMsgBeans.get(supplierIndex); SendSupplierMsgBean sendSupplierMsgBean = sendSupplierMsgBeans.get(supplierIndex);
sendSupplierMsgBean.setSupplierContacts(supplierContacts); sendSupplierMsgBean.setSupplierContacts(supplierContacts);
// getPurchaseOrderQrCode(sendSupplierMsgBean.getOrderId() + "");
mRootView.loadSupplierList(sendSupplierMsgBeans); mRootView.loadSupplierList(sendSupplierMsgBeans);
} else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) { } else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg()); mRootView.showMessage(info.getErrMsg());
......
...@@ -4,7 +4,6 @@ import android.view.View; ...@@ -4,7 +4,6 @@ import android.view.View;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.RadioButton; import android.widget.RadioButton;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
...@@ -41,11 +40,16 @@ public class SendSupplierMsgAdapter extends BaseQuickAdapter<SendSupplierMsgBean ...@@ -41,11 +40,16 @@ public class SendSupplierMsgAdapter extends BaseQuickAdapter<SendSupplierMsgBean
viewHolder.setGone(R.id.tv_supplier_send_state, !sendSupplierMsgBean.isSend()); viewHolder.setGone(R.id.tv_supplier_send_state, !sendSupplierMsgBean.isSend());
RecyclerView rvContacts = viewHolder.getView(R.id.rv_item_send_supplier_msg); RecyclerView rvContacts = viewHolder.getView(R.id.rv_item_send_supplier_msg);
ContactsListAdapter contactsListAdapter = new ContactsListAdapter(sendSupplierMsgBean.getSupplierContacts()); ContactsListAdapter contactsListAdapter = new ContactsListAdapter(sendSupplierMsgBean.getSupplierContacts());
contactsListAdapter.setSelectIndex(sendSupplierMsgBean.getCheckPosition());
contactsListAdapter.setOnItemClickListener((adapter, view, position) -> { contactsListAdapter.setOnItemClickListener((adapter, view, position) -> {
if (DoubleClickUtils.isFastDoubleClick()) {
return;
}
contactsListAdapter.setSelectIndex(position); contactsListAdapter.setSelectIndex(position);
contactsListAdapter.notifyItemChanged(sendSupplierMsgBean.getCheckPosition()); // contactsListAdapter.notifyItemChanged(sendSupplierMsgBean.getCheckPosition());
contactsListAdapter.notifyItemChanged(position); // contactsListAdapter.notifyItemChanged(position);
sendSupplierMsgBean.setCheckPosition(position); sendSupplierMsgBean.setCheckPosition(position);
contactsListAdapter.notifyDataSetChanged();
}); });
rvContacts.setAdapter(contactsListAdapter); rvContacts.setAdapter(contactsListAdapter);
LinearLayout contactsLayout = viewHolder.getView(R.id.layout_send_supplier_msg_hide_show); LinearLayout contactsLayout = viewHolder.getView(R.id.layout_send_supplier_msg_hide_show);
...@@ -81,15 +85,15 @@ public class SendSupplierMsgAdapter extends BaseQuickAdapter<SendSupplierMsgBean ...@@ -81,15 +85,15 @@ public class SendSupplierMsgAdapter extends BaseQuickAdapter<SendSupplierMsgBean
} }
viewHolder.setText(R.id.tv_item_pic_radio_title, SupplierInfoBean.SupplierContacts.getContractTitleByType(item.getType())); viewHolder.setText(R.id.tv_item_pic_radio_title, SupplierInfoBean.SupplierContacts.getContractTitleByType(item.getType()));
viewHolder.setImageResource(R.id.iv_item_pic_radio_pic, getContractPicByType(item.getType())); viewHolder.setImageResource(R.id.iv_item_pic_radio_pic, getContractPicByType(item.getType()));
radioButton.setOnCheckedChangeListener((buttonView, isChecked) -> { // radioButton.setOnCheckedChangeListener((buttonView, isChecked) -> {
if (DoubleClickUtils.isFastDoubleClick()) { // if (DoubleClickUtils.isFastDoubleClick()) {
return; // return;
} // }
if (isChecked) { // if (isChecked) {
setSelectIndex(viewHolder.getAdapterPosition()); // setSelectIndex(viewHolder.getAdapterPosition());
notifyDataSetChanged(); // notifyDataSetChanged();
} // }
}); // });
} }
public void setSelectIndex(int selectIndex) { public void setSelectIndex(int selectIndex) {
...@@ -100,5 +104,4 @@ public class SendSupplierMsgAdapter extends BaseQuickAdapter<SendSupplierMsgBean ...@@ -100,5 +104,4 @@ public class SendSupplierMsgAdapter extends BaseQuickAdapter<SendSupplierMsgBean
return selectIndex; return selectIndex;
} }
} }
} }
...@@ -7,7 +7,6 @@ import android.view.ViewGroup; ...@@ -7,7 +7,6 @@ import android.view.ViewGroup;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.gsa.cloud.common.utils.ClipboardUtils; import com.gingersoft.gsa.cloud.common.utils.ClipboardUtils;
...@@ -117,12 +116,13 @@ public class SendMsgFragment extends BaseSupplyChainFragment<SendMsgPresenter> i ...@@ -117,12 +116,13 @@ public class SendMsgFragment extends BaseSupplyChainFragment<SendMsgPresenter> i
DeviceUtils.shareLine(mContext, "", url); DeviceUtils.shareLine(mContext, "", url);
} else if (type == Kakao_Talk) { } else if (type == Kakao_Talk) {
//分享到kakao //分享到kakao
ToastUtils.show(mContext, "暫未開放此app發送,訂單已複製,請手動打開Kakao粘貼發送"); ToastUtils.show(mContext, "暫未開放此應用發送,訂單鏈接已複製,請手動打開應用粘貼發送");
} }
} }
@Override @Override
public void loadSupplierList(List<SendSupplierMsgBean> sendSupplierMsgBeans) { public void loadSupplierList(List<SendSupplierMsgBean> sendSupplierMsgBeans) {
isSend = false;
if (sendSupplierMsgAdapter == null) { if (sendSupplierMsgAdapter == null) {
sendSupplierMsgAdapter = new SendSupplierMsgAdapter(sendSupplierMsgBeans); sendSupplierMsgAdapter = new SendSupplierMsgAdapter(sendSupplierMsgBeans);
rvSupplier.setAdapter(sendSupplierMsgAdapter); rvSupplier.setAdapter(sendSupplierMsgAdapter);
...@@ -139,7 +139,18 @@ public class SendMsgFragment extends BaseSupplyChainFragment<SendMsgPresenter> i ...@@ -139,7 +139,18 @@ public class SendMsgFragment extends BaseSupplyChainFragment<SendMsgPresenter> i
@Override @Override
public void sendSuccess() { public void sendSuccess() {
isSend = true;
mPresenter.setSendSuccess(); mPresenter.setSendSuccess();
mPresenter.getContactsBySupplier(mPresenter.getCurrentSelectedSupplier() + 1); }
private boolean isSend = false;
@Override
public void onResume() {
super.onResume();
if (isSend) {
sendSupplierMsgAdapter.notifyDataSetChanged();
mPresenter.getContactsBySupplier(mPresenter.getCurrentSelectedSupplier() + 1);
}
} }
} }
package com.gingersoft.supply_chain.mvp.utils; package com.gingersoft.supply_chain.mvp.utils;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils;
/** /**
* @author 宇航. * @author 宇航.
* User: admin * User: admin
...@@ -13,6 +16,7 @@ public class DoubleClickUtils { ...@@ -13,6 +16,7 @@ public class DoubleClickUtils {
public static boolean isFastDoubleClick() { public static boolean isFastDoubleClick() {
long nowTime = System.currentTimeMillis(); long nowTime = System.currentTimeMillis();
if (nowTime - lastClickTime < 500) {//500ms if (nowTime - lastClickTime < 500) {//500ms
ToastUtils.show(GsaCloudApplication.getAppContext(), "請慢一點");
return true; return true;
} }
lastClickTime = nowTime; lastClickTime = nowTime;
......
...@@ -107,12 +107,13 @@ public class DeviceUtils { ...@@ -107,12 +107,13 @@ public class DeviceUtils {
List<PackageInfo> pInfo = packageManager.getInstalledPackages(0); List<PackageInfo> pInfo = packageManager.getInstalledPackages(0);
for (int i = 0; i < pInfo.size(); i++) { for (int i = 0; i < pInfo.size(); i++) {
String pn = pInfo.get(i).packageName; String pn = pInfo.get(i).packageName;
if (app_package.equals(pn)){ if (app_package.equals(pn)) {
return true; return true;
} }
} }
return false; return false;
} }
/** /**
* 直接分享文本到WhatsApp * 直接分享文本到WhatsApp
* *
...@@ -134,6 +135,8 @@ public class DeviceUtils { ...@@ -134,6 +135,8 @@ public class DeviceUtils {
/** /**
* 直接分享文本到微信好友 * 直接分享文本到微信好友
* 由於這樣分享,成功之後會有一個彈窗可以選擇返回第三方工具,但是並不能返回
* 所以我們只需要複製鏈接,打開微信就好,不必要調用分享
* *
* @param context 上下文 * @param context 上下文
*/ */
...@@ -146,7 +149,25 @@ public class DeviceUtils { ...@@ -146,7 +149,25 @@ public class DeviceUtils {
intent.putExtra("android.intent.extra.TEXT", content); intent.putExtra("android.intent.extra.TEXT", content);
// intent.putExtra("sms_body", content); // intent.putExtra("sms_body", content);
intent.putExtra("Kdescription", !TextUtils.isEmpty(content) ? content : ""); intent.putExtra("Kdescription", !TextUtils.isEmpty(content) ? content : "");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
} else {
Toast.makeText(context, "檢測到未安裝微信,請安裝後重試", Toast.LENGTH_LONG).show();
}
}
/**
* 打開微信
* @param context
*/
public static void openWeChat(Context context) {
if (isInstallApp(context, PACKAGE_WECHAT)) {
Intent intent = new Intent();
ComponentName cmp = new ComponentName(PACKAGE_WECHAT, "com.tencent.mm.ui.LauncherUI");
intent.setAction(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setComponent(cmp);
context.startActivity(intent); context.startActivity(intent);
} else { } else {
Toast.makeText(context, "檢測到未安裝微信,請安裝後重試", Toast.LENGTH_LONG).show(); Toast.makeText(context, "檢測到未安裝微信,請安裝後重試", Toast.LENGTH_LONG).show();
...@@ -166,7 +187,7 @@ public class DeviceUtils { ...@@ -166,7 +187,7 @@ public class DeviceUtils {
* line的包名,line的接收资料的类名--》 </intent-filter> MainFist里面 * line的包名,line的接收资料的类名--》 </intent-filter> MainFist里面
*/ */
public static void shareLine(Context context, String title, String content) { public static void shareLine(Context context, String title, String content) {
if(isInstallApp(context, PACKAGE_LINE)) { if (isInstallApp(context, PACKAGE_LINE)) {
ComponentName cn = new ComponentName(PACKAGE_LINE ComponentName cn = new ComponentName(PACKAGE_LINE
, "jp.naver.line.android.activity.selectchat.SelectChatActivity"); , "jp.naver.line.android.activity.selectchat.SelectChatActivity");
Intent shareIntent = new Intent(); Intent shareIntent = new Intent();
...@@ -1112,30 +1133,31 @@ public class DeviceUtils { ...@@ -1112,30 +1133,31 @@ public class DeviceUtils {
/** /**
* 取SHA1 * 取SHA1
*
* @param data 数据 * @param data 数据
* @return 对应的hash值 * @return 对应的hash值
*/ */
private static byte[] getHashByString(String data) private static byte[] getHashByString(String data) {
{ try {
try{
MessageDigest messageDigest = MessageDigest.getInstance("SHA1"); MessageDigest messageDigest = MessageDigest.getInstance("SHA1");
messageDigest.reset(); messageDigest.reset();
messageDigest.update(data.getBytes("UTF-8")); messageDigest.update(data.getBytes("UTF-8"));
return messageDigest.digest(); return messageDigest.digest();
} catch (Exception e){ } catch (Exception e) {
return "".getBytes(); return "".getBytes();
} }
} }
/** /**
* 转16进制字符串 * 转16进制字符串
*
* @param data 数据 * @param data 数据
* @return 16进制字符串 * @return 16进制字符串
*/ */
private static String bytesToHex(byte[] data){ private static String bytesToHex(byte[] data) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
String stmp; String stmp;
for (int n = 0; n < data.length; n++){ for (int n = 0; n < data.length; n++) {
stmp = (Integer.toHexString(data[n] & 0xFF)); stmp = (Integer.toHexString(data[n] & 0xFF));
if (stmp.length() == 1) if (stmp.length() == 1)
sb.append("0"); sb.append("0");
...@@ -1148,7 +1170,7 @@ public class DeviceUtils { ...@@ -1148,7 +1170,7 @@ public class DeviceUtils {
* 判断服务是否正在运行 * 判断服务是否正在运行
* *
* @param serviceName 服务类的全路径名称 例如: com.jaychan.demo.service.PushService * @param serviceName 服务类的全路径名称 例如: com.jaychan.demo.service.PushService
* @param context 上下文对象 * @param context 上下文对象
* @return * @return
*/ */
public static boolean isServiceRunning(String serviceName, Context context) { public static boolean isServiceRunning(String serviceName, Context context) {
......
...@@ -5,6 +5,8 @@ import android.graphics.Bitmap; ...@@ -5,6 +5,8 @@ import android.graphics.Bitmap;
import android.os.RemoteException; import android.os.RemoteException;
import android.widget.Toast; import android.widget.Toast;
import androidx.core.content.ContextCompat;
import com.gingersoft.gsa.cloud.common.utils.LanguageUtils; import com.gingersoft.gsa.cloud.common.utils.LanguageUtils;
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.view.ImageUtils; import com.gingersoft.gsa.cloud.common.utils.view.ImageUtils;
...@@ -303,7 +305,7 @@ public class AidlUtil { ...@@ -303,7 +305,7 @@ public class AidlUtil {
* *
* @return * @return
*/ */
public int updatePrinterState() { public int updatePrinterState(Context context) {
if (sunmiPrinterService == null) { if (sunmiPrinterService == null) {
Toast.makeText(context, LanguageUtils.get_language_system(context, "server.disconnected", "未連接上打印機!"), Toast.LENGTH_LONG).show(); Toast.makeText(context, LanguageUtils.get_language_system(context, "server.disconnected", "未連接上打印機!"), Toast.LENGTH_LONG).show();
return 2; return 2;
......
...@@ -14,12 +14,35 @@ import java.util.Map; ...@@ -14,12 +14,35 @@ import java.util.Map;
* @描述:打印整體打印流程(打印前數據信息,圖片->連接成功(失敗)->打印成功(失敗)->斷開連接) * @描述:打印整體打印流程(打印前數據信息,圖片->連接成功(失敗)->打印成功(失敗)->斷開連接)
*/ */
public interface PrinterFlowListener extends ExternalPrinterConnection { public interface PrinterFlowListener extends ExternalPrinterConnection {
/**
* 打印前,還未生成圖片之前
*
* @param orderType
* @param printType
* @param printerData
* @param printerDeviceInfo
*/
void onPrinterDataBefore(int orderType, int printType, String printerData, String printerDeviceInfo); void onPrinterDataBefore(int orderType, int printType, String printerData, String printerDeviceInfo);
/**
* 生成圖片之後,打印之前
*
* @param orderType
* @param printType
* @param directoryName
* @param bitmaps
*/
void onPrinterBitmapBefore(int orderType, int printType, String directoryName, List<Bitmap> bitmaps); void onPrinterBitmapBefore(int orderType, int printType, String directoryName, List<Bitmap> bitmaps);
/**
* 打印之前
*/
void onPrintSuccess(); void onPrintSuccess();
/**
* 打印失敗
*
* @param errorCode 錯誤碼
*/
void onPrintError(int errorCode); void onPrintError(int errorCode);
} }
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/print_success_color" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<View xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/vertical_dividing_line"
android:layout_width="@dimen/dp_0_5"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical" />
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
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:paddingBottom="@dimen/dp_5"
android:descendantFocusability="blocksDescendants" android:descendantFocusability="blocksDescendants"
android:gravity="center_vertical"
android:paddingTop="@dimen/dp_10" android:paddingTop="@dimen/dp_10"
android:gravity="center_vertical"> android:paddingBottom="@dimen/dp_5">
<ImageView <ImageView
android:id="@+id/iv_item_pic_radio_pic" android:id="@+id/iv_item_pic_radio_pic"
...@@ -30,5 +30,8 @@ ...@@ -30,5 +30,8 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_10" android:layout_marginRight="@dimen/dp_10"
android:button="@drawable/selector_radio_circle_bg" /> android:button="@drawable/selector_radio_circle_bg"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false" />
</LinearLayout> </LinearLayout>
\ No newline at end of file
...@@ -538,4 +538,5 @@ ...@@ -538,4 +538,5 @@
<color name="add_deputy_unit_bg">#F19149</color> <color name="add_deputy_unit_bg">#F19149</color>
<color name="dk_color_999999">#999</color> <color name="dk_color_999999">#999</color>
<color name="bright_orange">#FF7A0E</color> <color name="bright_orange">#FF7A0E</color>
<color name="print_success_color">#019944</color>
</resources> </resources>
\ No newline at end of file
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
<item name="qmui_arch_swipe_layout_in_back" type="id"/> <item name="qmui_arch_swipe_layout_in_back" type="id"/>
<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_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"/>
......
...@@ -31,7 +31,9 @@ public class DaoManager { ...@@ -31,7 +31,9 @@ public class DaoManager {
* @return * @return
*/ */
public static DaoManager getInstance() { public static DaoManager getInstance() {
return manager; synchronized (manager){
return manager;
}
} }
private DaoManager() { private DaoManager() {
......
package com.gingersoft.gsa.cloud.print;
import android.util.Log;
import java.util.List;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.WebSocket;
import okhttp3.WebSocketListener;
import okio.ByteString;
/**
* @author 宇航.
* User: admin
* Date: 2021/2/5
* Time: 16:38
* Use: 將需要打印的數據傳進來,這裡就會進行打印,並且處理對應的狀態
*/
public class NewPrintExecutor {
private static NewPrintExecutor newPrintExecutor;
private String ip;
private int port;
public static NewPrintExecutor getInstance() {
if (newPrintExecutor == null) {
newPrintExecutor = new NewPrintExecutor();
}
return newPrintExecutor;
}
private PrintSocketHolder.OnStateChangedListener onStateChangedListener;
private PrintExecutor.OnPrintResultListener onPrintResultListener;
public NewPrintExecutor setConnect(String ip, int port) {
this.ip = ip;
this.port = port;
return this;
}
public void print() {
Request request = new Request.Builder()
.url("http://" + ip + ":" + port)
.build();
OkHttpClient client = new OkHttpClient();
client.newWebSocket(request, new WebSocketListener() {
@Override
public void onOpen(WebSocket webSocket, Response response) {
super.onOpen(webSocket, response);
Log.e("aaa", "連接已打開");
}
@Override
public void onMessage(WebSocket webSocket, String text) {
super.onMessage(webSocket, text);
Log.e("aaa", "onMessage:" + text);
}
@Override
public void onMessage(WebSocket webSocket, ByteString bytes) {
super.onMessage(webSocket, bytes);
Log.e("aaa", "onMessage2:" + bytes);
}
@Override
public void onClosing(WebSocket webSocket, int code, String reason) {
super.onClosing(webSocket, code, reason);
Log.e("aaa", "onClosing" + code + reason);
}
@Override
public void onClosed(WebSocket webSocket, int code, String reason) {
super.onClosed(webSocket, code, reason);
Log.e("aaa", "onClosed" + code + reason);
}
@Override
public void onFailure(WebSocket webSocket, Throwable t, Response response) {
super.onFailure(webSocket, t, response);
Log.e("aaa", "onFailure" + t.getMessage());
}
});
client.dispatcher().executorService().shutdown();
}
/**
* 设置状态监听
*
* @param listener 监听
*/
public void setOnStateChangedListener(PrintSocketHolder.OnStateChangedListener listener) {
onStateChangedListener = listener;
}
/**
* 设置结果回调
*
* @param listener 回调
*/
public void setOnPrintResultListener(PrintExecutor.OnPrintResultListener listener) {
onPrintResultListener = listener;
}
}
...@@ -26,4 +26,6 @@ public interface PrintDataMaker { ...@@ -26,4 +26,6 @@ public interface PrintDataMaker {
String getIp(); String getIp();
int getPort(); int getPort();
} }
...@@ -18,6 +18,15 @@ import io.reactivex.disposables.Disposable; ...@@ -18,6 +18,15 @@ import io.reactivex.disposables.Disposable;
*/ */
public class PrintExecutor { public class PrintExecutor {
protected final String TAG = this.getClass().getSimpleName(); protected final String TAG = this.getClass().getSimpleName();
private static PrintExecutor printExecutor;
public static PrintExecutor getInstance() {
if (printExecutor == null) {
printExecutor = new PrintExecutor();
}
return printExecutor;
}
private PrintSocketHolder holder; private PrintSocketHolder holder;
/** /**
* 存儲所有prj的id集合 * 存儲所有prj的id集合
......
...@@ -12,8 +12,10 @@ import com.scwang.smartrefresh.layout.listener.OnStateChangedListener; ...@@ -12,8 +12,10 @@ import com.scwang.smartrefresh.layout.listener.OnStateChangedListener;
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.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.Socket; import java.net.Socket;
import java.net.SocketTimeoutException;
import java.util.List; import java.util.List;
/** /**
...@@ -31,30 +33,37 @@ public class PrintSocketHolder { ...@@ -31,30 +33,37 @@ public class PrintSocketHolder {
protected final String TAG = this.getClass().getSimpleName(); protected final String TAG = this.getClass().getSimpleName();
public static final int STATE_0 = 10;// 生成测试页面数据 public static final int STATE_0 = 0;// 生成测试页面数据
public static final int STATE_1 = 1;// 创建Socket连接 public static final int STATE_1 = -1;// 创建Socket连接
public static final int STATE_2 = 2;// 获取输出流 public static final int STATE_2 = -2;// 获取输出流
public static final int STATE_3 = 3;// 写入测试页面数据 public static final int STATE_3 = -3;// 写入测试页面数据
public static final int STATE_4 = 4;// 关闭输出流 public static final int STATE_4 = -4;// 关闭输出流
public static final int ERROR_0 = 0;// 成功
public static final int ERROR_1 = -1;// 生成测试页面数据失败 public static final int ERROR_0 = 3;// 成功
public static final int ERROR_2 = -2;// 创建Socket失败,未連接到打印機 public static final int ERROR_4 = 4;// 打印失败
public static final int ERROR_3 = -3;// 获取输出流失败
public static final int ERROR_4 = -4;// 写入测试页面数据失败 public static final int ERROR_6 = 6;// 生成打印数据失败
public static final int ERROR_5 = -5;// 必要参数不能为空 public static final int ERROR_7 = 7;// 创建Socket失败,未連接到打印機
public static final int ERROR_6 = -6;// 关闭Socket出错 public static final int ERROR_TIMEOUT = 8;// 連接打印機超時
public static final int ERROR_100 = -100;// 失败 public static final int ERROR_9 = 9;// IP地址为空
public static final int ERROR_10 = 10;// 打印機連接成功,獲取輸入流失敗或者發送數據出現問題
public static final int ERROR_11 = 11;// 打印機沒紙了
public static final int ERROR_12 = 12;// 打印機初始化失敗,暫時只有針式打印機有
public static final int ERROR_66 = 66;// 关闭Socket出错
private Socket socket; private Socket socket;
private OutputStream out; private OutputStream out;
private WeakReference<OnStateChangedListener> mListener; private WeakReference<OnStateChangedListener> mListener;
private PrintSocketHolder() { private PrintSocketHolder() {
} }
public int createSocket(String ip, int port) { public int createSocket(String ip, int port) {
onPrinterStateChanged(STATE_1); onPrinterStateChanged(STATE_1);
if (TextUtil.isEmptyOrNullOrUndefined(ip)) { if (TextUtil.isEmptyOrNullOrUndefined(ip)) {
return ERROR_5; return ERROR_9;
} }
try { try {
PrinterPlugins.getOnPrinterFlowHandler().connectionBefore("網絡打印機", ip, port, PrintConstans.SO_TIMEOUT, PrintConstans.PRINT_TIMEOUT); PrinterPlugins.getOnPrinterFlowHandler().connectionBefore("網絡打印機", ip, port, PrintConstans.SO_TIMEOUT, PrintConstans.PRINT_TIMEOUT);
...@@ -64,10 +73,19 @@ public class PrintSocketHolder { ...@@ -64,10 +73,19 @@ 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
} catch (SocketTimeoutException e) {
e.printStackTrace();
LoganManager.w_printer(TAG, "連接打印機超時: " + ip + ":" + port + "." + e.getMessage());
return ERROR_TIMEOUT;
} catch (ConnectException e) {
e.printStackTrace();
LoganManager.w_printer(TAG, "連接打印機失敗: " + ip + ":" + port + "." + e.getMessage());
return ERROR_7;
} catch (Exception e) { } catch (Exception e) {
closeSocket(); closeSocket();
e.printStackTrace(); e.printStackTrace();
return ERROR_2; LoganManager.w_printer(TAG, "連接打印機異常: " + ip + ":" + port + "." + e.getMessage());
return ERROR_7;
} }
return ERROR_0; return ERROR_0;
} }
...@@ -77,8 +95,9 @@ public class PrintSocketHolder { ...@@ -77,8 +95,9 @@ public class PrintSocketHolder {
try { try {
out = socket.getOutputStream(); out = socket.getOutputStream();
} catch (IOException e) { } catch (IOException e) {
LoganManager.w_printer(TAG, "獲取打印機輸入流異常: " + socket.getInetAddress() + e.getMessage());
closeSocket(); closeSocket();
return ERROR_3; return ERROR_10;
} }
return ERROR_0; return ERROR_0;
} }
...@@ -99,16 +118,16 @@ public class PrintSocketHolder { ...@@ -99,16 +118,16 @@ 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) {
return ERROR_0; return ERROR_6;
} }
for (byte[] item : data) { for (byte[] item : data) {
try { try {
out.write(item); out.write(item);
out.flush(); out.flush();
} catch (IOException | NullPointerException e) { } catch (IOException | NullPointerException e) {
LoganManager.w_printer(TAG, "打印异常: " + e.getMessage()); LoganManager.w_printer(TAG, "打印prj寫入數據异常: " + e.getMessage());
closeSocket(); closeSocket();
return ERROR_4; return ERROR_10;
} }
} }
closeSocket();//成功後關閉連接 closeSocket();//成功後關閉連接
...@@ -157,12 +176,12 @@ public class PrintSocketHolder { ...@@ -157,12 +176,12 @@ public class PrintSocketHolder {
LoganManager.w_printer(TAG, "关闭打印机socket连接"); LoganManager.w_printer(TAG, "关闭打印机socket连接");
} }
} catch (IOException e) { } catch (IOException e) {
LoganManager.w_printer(TAG, "关闭打印机连接异常"); LoganManager.w_printer(TAG, "关闭打印机连接异常" + e.getMessage());
socket = null; socket = null;
error = true; error = true;
} }
PrinterPlugins.getOnPrinterFlowHandler().disconnect(); PrinterPlugins.getOnPrinterFlowHandler().disconnect();
return error ? ERROR_6 : ERROR_0; return error ? ERROR_66 : ERROR_0;
} }
/** /**
......
...@@ -54,7 +54,13 @@ public class PrjBean { ...@@ -54,7 +54,13 @@ public class PrjBean {
private String productName2; private String productName2;
private String productName3; private String productName3;
private int parentId; private int parentId;
/**
* 食品类型#3:食品;4:细项;
*/
private int type; private int type;
/**
* 打印狀態
*/
private int printerType; private int printerType;
private Long printerTime; private Long printerTime;
private int number; private int number;
...@@ -62,6 +68,11 @@ public class PrjBean { ...@@ -62,6 +68,11 @@ public class PrjBean {
private Long createTime; private Long createTime;
private int requests; private int requests;
/**
* 請求多少次開始飛單
*/
public static final int REQUEST_COUNT_FLY = 5;
private int actualPrinterDeviceId; private int actualPrinterDeviceId;
private String takeFoodCode; //取餐碼 private String takeFoodCode; //取餐碼
private String billNo;//訂單碼 private String billNo;//訂單碼
...@@ -88,7 +99,6 @@ public class PrjBean { ...@@ -88,7 +99,6 @@ public class PrjBean {
public final static int FOOD_SECONDARY = 2; public final static int FOOD_SECONDARY = 2;
public final static int FOOD_THREE_LEVEL = 3; public final static int FOOD_THREE_LEVEL = 3;
private String sender; private String sender;
private String takeTime; private String takeTime;
...@@ -99,7 +109,12 @@ public class PrjBean { ...@@ -99,7 +109,12 @@ public class PrjBean {
private int isFirstSendOrder;//是否首次送單,1是 2否 private int isFirstSendOrder;//是否首次送單,1是 2否
private int quantity;//統計打印數量 private int quantity;//統計打印數量
private int presence;//presence:是否生成prj記錄 0:否,1:是 private int presence;//presence:是否生成prj記錄 0:否,1:是
public static final int NOT_GENERATED_PRJ = 0;
public static final int GENERATED_PRJ = 1;
private String printPosition;//廚房位置 private String printPosition;//廚房位置
private String foodGroupName;//食品組
private String flyingSinglePosition;//飛單位置
} }
} }
} }
...@@ -11,12 +11,160 @@ import lombok.Data; ...@@ -11,12 +11,160 @@ import lombok.Data;
*/ */
@Data @Data
public class UpdateBean { public class UpdateBean {
// 1未打印 2打印中 3已打印 // 1未打印 2打印中 3已打印 4 打印失敗,5 未查詢到打印機請查詢打印管理配置是否正確,6 未生成打印數據請嘗試重印,7 未連接打印機請重啟打印機,8 打印機連接超時請重啟打印機,9 用戶沒有配置IP請查詢打印管理配置是否正確,10 打印機連接成功數據未發送請嘗試重印
/**
* 1未打印
*/
public static final int NO_PRINT = 1; public static final int NO_PRINT = 1;
/**
* 2打印中
*/
public static final int PRINTING = 2; public static final int PRINTING = 2;
/**
* 3已打印
*/
public static final int ALREADY_PRINT = 3; public static final int ALREADY_PRINT = 3;
/**
* 4 打印失敗
*/
public static final int FAILED_PRINT = 4;
/**
* 5 未查詢到打印機請查詢打印管理配置是否正確
* 通過打印位置沒有找到對應的打印機
*/
public static final int FAIL_PRINT_BY_NOT_FIND_DEVICE = 5;
/**
* 6 未生成打印數據請嘗試重印
* 沒有生成打印數據
*/
public static final int FAIL_PRINT_BY_NOT_PRINT_INFO = 6;
/**
* 7 未連接打印機請重啟打印機
*/
public static final int FAIL_PRINT_BY_NOT_CONNECT = 7;
/**
* 8 打印機連接超時請重啟打印機
*/
public static final int FAIL_PRINT_BY_CONNECT_TIMEOUT = 8;
/**
* 9 用戶沒有配置IP請查詢打印管理配置是否正確
* 沒有配置ip
*/
public static final int FAIL_PRINT_IS_NOT_IP = 9;
/**
* 10 打印機連接成功數據未發送請嘗試重印
* 1、寫入數據時出現異常
* 2、獲取socket輸出流失敗
*/
public static final int FAIL_PRINT_IS_NOT_SEND = 10;
/**
* 11 打印機沒紙
*/
public static final int FAIL_NOT_PAPER = 11;
/**
* 12 針式打印機初始化失敗
*/
public static final int FAIL_EPSON_INIT = 12;
/**
* 13 sunmi打印機過熱
*/
public static final int FAIL_SUNMI_PRINT_HOT = 13;
/**
* 14 SUNMI打印機蓋子未合上
*/
public static final int FAIL_LID_NOT_CLOSED_SUNMI = 14;
/**
* 15 SUNMI打印機切刀異常
*/
public static final int FAIL_CUT_ABNORMAL_SUNMI = 15;
/**
* 16 SUNMI打印機未檢測到黑標
*/
public static final int FAIL_SUNMI_NO_BLACK_MARK_DETECTED = 16;
/**
* 18 本地打印但是沒有找到這個型號的打印機
*/
public static final int FAIL_LOCAL_PRINT_NOT_DEVICE = 17;
/**
* 505 SUNMI未查詢到打印機請查詢打印管理配置是否正確
* 通過打印位置沒有找到對應的打印機
*/
public static final int FAIL_PRINT_BY_NOT_FIND_DEVICE_SUNMI = 505;
/**
* 507 SUNMI打印機固件升級失敗
*/
public static final int FAIL_SUNMI_FIRMWARE_UPGRADE_FAILED = 507;
/**
* -1 N5未知錯誤
*/
public static final int FAIL_N5_PRINT_UNKNOWN = -1;
/**
* -1001 N5打印失败
*/
public static final int FAILED_PRINT_N5 = -1001;
/**
* -1005 N5打印缺紙
*/
public static final int FAILED_PRINT_NOT_PAPER_N5 = -1005;
/**
* -1008 N5打印過熱
*/
public static final int FAIL_N5_PRINT_HOT = -1008;
/**
* -1009 N5打印了但是沒有完全打印完
*/
public static final int FAIL_PRINT_N5_INCOMPLETE = -1009;
public static String getStateByCode(int code) {
switch (code) {
case NO_PRINT:
return "未打印";
case PRINTING:
return "打印中";
case FAIL_PRINT_BY_NOT_FIND_DEVICE:
return "未查詢到打印機,請檢查打印配置是否正確";
case FAIL_PRINT_BY_NOT_PRINT_INFO:
return "生成打印數據失敗,請嘗試重印";
case FAIL_PRINT_BY_NOT_CONNECT:
return "連接打印機失敗,請檢查打印機網絡";
case FAIL_PRINT_BY_CONNECT_TIMEOUT:
return "打印機連接超時,請檢查打印機網絡";
case FAIL_PRINT_IS_NOT_IP:
return "沒有配置IP,請檢查打印配置是否正確";
case FAIL_PRINT_IS_NOT_SEND:
return "打印機連接成功,數據未發送,請嘗試重印";
case FAIL_NOT_PAPER:
return "打印機缺紙,請檢查打印紙";
case FAIL_EPSON_INIT:
return "打印機初始化失敗,請檢查設備";
case FAIL_SUNMI_PRINT_HOT:
return "sunmi打印機過熱,導致無法打印,請檢查設備";
case FAIL_LID_NOT_CLOSED_SUNMI:
return "sunmi打印機未關閉紙蓋,請檢查設備";
case FAIL_CUT_ABNORMAL_SUNMI:
return "sunmi打印機切刀異常,請檢查設備";
case FAIL_SUNMI_NO_BLACK_MARK_DETECTED:
return "sunmi打印機未檢測到黑標,請檢查設備";
case FAIL_LOCAL_PRINT_NOT_DEVICE:
return "未找到對應型號的本地打印機,請檢查設備型號";
case FAIL_PRINT_BY_NOT_FIND_DEVICE_SUNMI:
return "sunmi連接失敗,請檢查設備";
case FAIL_SUNMI_FIRMWARE_UPGRADE_FAILED:
return "sunmi固件升級失敗,請檢查設備";
case FAIL_N5_PRINT_UNKNOWN:
case FAILED_PRINT_N5:
return "NEXGO打印失敗,請重試";
case FAILED_PRINT_NOT_PAPER_N5:
return "NEXGO缺紙,請檢查打印紙";
case FAIL_N5_PRINT_HOT:
return "NEXGO打印過熱終止,請檢查設備";
case FAIL_PRINT_N5_INCOMPLETE:
return "NEXGO打印異常終止,請檢查設備";
default:
return "" + code;
}
}
public UpdateBean(String id, int printerType, Long printerTime) { public UpdateBean(String id, int printerType, Long printerTime) {
this.id = id; this.id = id;
......
...@@ -60,7 +60,7 @@ public class ConnectPrintUtil { ...@@ -60,7 +60,7 @@ public class ConnectPrintUtil {
socketMap.put(ip, socket); socketMap.put(ip, socket);
} catch (IOException e) { } catch (IOException e) {
socketMap.remove(ip); socketMap.remove(ip);
setState(PrintSocketHolder.ERROR_2, "連接失敗" + e.getMessage()); setState(PrintSocketHolder.ERROR_7, "連接失敗" + e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }
} }
......
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