Commit 84718696 by Wyh

1、外賣接單結賬打印(顯示會員信息和積分未完成,需要等待接口)

2、添加編輯打印機邏輯修改
3、登陸頁面鍵盤擋住輸入框問題
4、外賣確認訂單閃退問題修復
parent c58b0c54
......@@ -43,7 +43,7 @@ android {
/**
* 版本号
*/
schemaVersion 8
schemaVersion 9
/**
* greendao输出dao的数据库操作实体类文件夹(相对路径 包名+自定义路径名称,包将创建于包名的直接路径下)
*/
......
......@@ -24,6 +24,8 @@ public class PrintConstans {
* 3:廚房單
* 4:打印view
* 5:外賣接單打印
* 6:開錢箱
* 7:外賣接單結賬單
*/
public static final String PRINT_TYPE = "type";//打印類型
public static final String PRINT_LOADING = "is_show_loading";//是否顯示加載框
......
......@@ -24,6 +24,8 @@ public class PrinterDeviceBean implements Serializable {
private String name;
private Integer restaurantId;
private String ip;//ip
private int uid;
private Integer port;//端口
// private int type;//打印機紙張類型 為1時是58mm,否則是88mm
......@@ -51,9 +53,7 @@ public class PrinterDeviceBean implements Serializable {
this.id = id;
this.restaurantId = restaurantId;
this.ip = ip;
this.port = port;
// this.type = type;
}
public PrinterDeviceBean(String name, Integer restaurantId, String ip, Integer port, int type) {
......@@ -61,16 +61,16 @@ public class PrinterDeviceBean implements Serializable {
this.restaurantId = restaurantId;
this.ip = ip;
this.port = port;
// this.type = type;
}
@Generated(hash = 157623255)
public PrinterDeviceBean(int id, Long dbid, String name, Integer restaurantId, String ip, Integer port, Integer status, int printerModelId, String paperSpecification, String printerName, String model, Long printerDeviceId, Long defaultPrinterDeviceId) {
@Generated(hash = 815182145)
public PrinterDeviceBean(int id, Long dbid, String name, Integer restaurantId, String ip, int uid, Integer port, Integer status, int printerModelId, String paperSpecification, String printerName, String model, Long printerDeviceId, Long defaultPrinterDeviceId) {
this.id = id;
this.dbid = dbid;
this.name = name;
this.restaurantId = restaurantId;
this.ip = ip;
this.uid = uid;
this.port = port;
this.status = status;
this.printerModelId = printerModelId;
......@@ -192,4 +192,13 @@ public class PrinterDeviceBean implements Serializable {
public void setModel(String model) {
this.model = model;
}
public int getUid() {
return uid;
}
public void setUid(int uid) {
this.uid = uid;
}
}
......@@ -14,10 +14,10 @@ import org.greenrobot.greendao.identityscope.IdentityScopeType;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* Master of DAO (schema version 8): knows all DAOs.
* Master of DAO (schema version 9): knows all DAOs.
*/
public class DaoMaster extends AbstractDaoMaster {
public static final int SCHEMA_VERSION = 8;
public static final int SCHEMA_VERSION = 9;
/** Creates underlying database table using DAOs. */
public static void createAllTables(Database db, boolean ifNotExists) {
......
......@@ -80,6 +80,11 @@ class OrderDetails {
var estimatedTime: String? = null
var orderStatus: Int = 0
var addPoints: Double = 0.toDouble()//本次加多少積分
var oldPoints: Double = 0.toDouble()//之前有多少積分
var nowPoints: Double = 0.toDouble()//現在有多少積分
var curStat: Int = 0//訂單已創建 1
// * * Order Assigned To Delivery Man - 配送員已接單 2
// * * Delivery Man Reached Pickup Point Nearby - 配送員已到達店鋪附近 3
......@@ -91,7 +96,7 @@ class OrderDetails {
// * * Order Cancelled After Collection - 訂單已取消 - 取餐后 9
// * * Order Assigned To Another Delivery Man - 已指派另一位配送員 10
class PRODUCTNAMEBean : Serializable{
class PRODUCTNAMEBean : Serializable {
/**
* odsId : 1654481
* PRICE : 760.0
......@@ -108,7 +113,7 @@ class OrderDetails {
var child: List<ChildBeanX>? = null
var printseting: String? = null
class ChildBeanX : Serializable{
class ChildBeanX : Serializable {
/**
* odsId : 1654482
* PRICE : 0.0
......@@ -125,7 +130,7 @@ class OrderDetails {
var child: List<ChildBean>? = null
var printseting: String? = null
class ChildBean : Serializable{
class ChildBean : Serializable {
/**
* odsId : 1654488
* PRICE : 0.0
......
......@@ -94,7 +94,7 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements
@Override
public int initView(@Nullable Bundle savedInstanceState) {
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);//SOFT_INPUT_ADJUST_NOTHING
return R.layout.user_login_activity_login; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
}
......
......@@ -4,15 +4,14 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/theme_white_color"
android:clipChildren="true"
android:fillViewport="true"
android:orientation="vertical"
android:fillViewport="true"
android:paddingLeft="@dimen/dp_18"
android:paddingRight="@dimen/dp_18">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="match_parent">
<TextView
android:id="@+id/login_title"
......@@ -188,6 +187,8 @@
android:gravity="center"
android:text="登錄"
android:textColor="@color/white"
app:layout_constraintVertical_bias="1"
app:layout_constraintTop_toBottomOf="@id/rb_auto_login"
android:textSize="@dimen/dp_16"
app:layout_constraintBottom_toBottomOf="parent" />
......
package com.gingersoft.gsa.other_order_mode.data.model.bean
data class OrderClosingBean(
var code: String,
var data: DataX,
var errorMsg: String) {
data class DataX (
var addPoints: Double = 0.toDouble(),
var nowPoints: Double = 0.toDouble(),
var oldPoints: Double = 0.toDouble()
)
}
\ No newline at end of file
......@@ -28,7 +28,7 @@ interface WeatherService {
fun updateOrderStatus(@Body requestBody: RequestBody): Call<UpdateOrderBean>
@POST("order/updateOrderStatus")
fun gsUpdateOrderStatus(@Body requestBody: RequestBody): Call<MessageBean>
fun gsUpdateOrderStatus(@Body requestBody: RequestBody): Call<OrderClosingBean>
@POST("gsa/shipAnyOrdersNew")
fun thirdDelivery(@Body requestBody: RequestBody): Call<ThirdSend>
......
......@@ -2,7 +2,6 @@ package com.gingersoft.gsa.other_order_mode.model.viewModel
import android.app.Dialog
import android.content.Context
import android.util.Log
import android.view.Gravity
import android.view.WindowManager
import android.widget.TextView
......@@ -18,8 +17,6 @@ import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils
import com.gingersoft.gsa.cloud.base.widget.DialogUtils
import com.gingersoft.gsa.cloud.constans.PrintConstans
import com.gingersoft.gsa.cloud.print.bean.OrderDetails
import com.gingersoft.gsa.cloud.ui.utils.AppDialog
import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog
import com.gingersoft.gsa.other_order_mode.R
import com.gingersoft.gsa.other_order_mode.data.WeatherRepository
import com.gingersoft.gsa.other_order_mode.data.model.bean.*
......@@ -299,13 +296,19 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
})
}
fun gsUpdateOrderStatus(orderId: String, orderType: Int, payTypeId: Int = 0, listener: (Int, Boolean) -> Unit) {
fun gsUpdateOrderStatus(orderDetails: OrderDetails.DataBean, payTypeId: Int = 0, listener: (Int, Boolean) -> Unit) {
launch({
repository.gsUpdateOrderStatus(orderId, 4, orderType, 3, "", "", "", "0", "", 1, 0, payTypeId).apply {
listener.invoke(OrderDelivery, code == "1")
repository.gsUpdateOrderStatus(orderDetails.ID.toString(), 4, orderDetails.order_type, 3, "", "", "", "0", "", 1, 0, payTypeId).apply {
orderDetails.payType = payTypeId
orderDetails.oldPoints = data.oldPoints
orderDetails.nowPoints = data.nowPoints
orderDetails.addPoints = data.addPoints
printOrderClosing(orderDetails, listener)
}
}, {
listener.invoke(OrderDelivery, false)
// integralBean.postValue(null)
})
}
......@@ -451,6 +454,21 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}
/**
* 打印結賬單
*/
private fun printOrderClosing(dataBean: OrderDetails.DataBean, listener: (Int, Boolean) -> Unit) {
MyOrderManage.setDataBean(dataBean)
CC.obtainBuilder("Component.Print")
.addParam(PrintConstans.PRINT_TYPE, 7)
.setActionName("printActivity")
.build()
.callAsyncCallbackOnMainThread { _, result ->
MyOrderManage.setDataBean(null)
listener.invoke(PrintCode, result.isSuccess)
}
}
/**
* 打開錢箱
*/
fun openCashBox() {
......
......@@ -173,7 +173,7 @@ class OrderDetailsActivity : BaseActivity() {
BtnBuilder.closingBtn -> {
//如果是在線支付的訂單,就直接修改訂單狀態
if (orderPayType != 1) {
gsUpdateOrderStatus(orderDetails.ID.toString(), orderDetails.order_type) { status, isSuccess ->
gsUpdateOrderStatus(orderDetails, orderDetails.order_type) { status, isSuccess ->
if (isSuccess) {
finish()
} else {
......
......@@ -62,6 +62,7 @@ class PayActivity : BaseActivity() {
// other_pay_view.loadInfo(this, PayTypeInfo.getPayMethodByPayType(it), MoneyUtil.sub(orderDetails.TOTAL_AMOUNT!!.toDouble(), orderDetails.discount_amount), foodCount)
other_pay_view.notifyBillMethodAdapter(PayTypeInfo.getPayMethodByPayType(it))
})
other_pay_view.setmOnSureClickLisenter {payMethods->
//確認結賬,調用結賬接口
object : DialogUtils(this, R.layout.other_order_pause_orders) {
......@@ -70,7 +71,7 @@ class PayActivity : BaseActivity() {
hepler.getView<TextView>(R.id.tv_dialog_confirm).setOnClickListener {
dialog.dismiss()
showLoading()
pageViewModel.gsUpdateOrderStatus(orderDetails.ID.toString(), orderDetails.order_type, payMethods[0].id) { status, isSuccess ->
pageViewModel.gsUpdateOrderStatus(orderDetails, payMethods[0].id) { _, _ ->
cancelDialogForLoading()
setResult(RESULT_OK)
finish()
......
......@@ -5,6 +5,7 @@ import android.content.Context
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
......@@ -29,7 +30,7 @@ object OtherOrderUtils {
layoutOrderInfoDialogBinding.totalAmount = orderData.TOTAL_AMOUNT!!.toDouble()
//是歷史訂單,就不顯示訂單狀態
layoutOrderInfoDialogBinding.isHistory = isHistory
var btnContent =""
var btnContent = ""
var cancelBtnContent = ""
val type = if (orderType == 7) "自取" else "外送"
......@@ -40,7 +41,7 @@ object OtherOrderUtils {
if (orderType == 7) {
//自取
btnContent = "製作完成"
tvStatus.setTextColor(context.resources.getColor(R.color.order_state0_color))
tvStatus.setTextColor(ContextCompat.getColor(context, R.color.order_state0_color))
cancelBtnContent = "取消訂單"
} else {
if (orderData.isDelete == 0) {
......@@ -50,7 +51,7 @@ object OtherOrderUtils {
btnContent = "指派送貨"
cancelBtnContent = "取消訂單"
}
tvStatus.setTextColor(context.resources.getColor(R.color.order_state1_color))
tvStatus.setTextColor(ContextCompat.getColor(context, R.color.order_state1_color))
}
orderStatus = "製作中"
}
......@@ -59,20 +60,20 @@ object OtherOrderUtils {
if (orderType == 7) {
//自取
orderStatus = "待取餐"
tvStatus.setTextColor(context.resources.getColor(R.color.order_state3_color))
tvStatus.setTextColor(ContextCompat.getColor(context, R.color.order_state3_color))
} else {
if(orderData.isDelete == 0){
if (orderData.isDelete == 0) {
//如果是第三方物流,不顯示結賬按鈕
btnContent = "重印"
}
orderStatus = "派送中"
tvStatus.setTextColor(context.resources.getColor(R.color.order_state2_color))
tvStatus.setTextColor(ContextCompat.getColor(context, R.color.order_state2_color))
}
}
else -> {
btnContent = "確認訂單"
orderStatus = "待確認"
tvStatus.setTextColor(context.resources.getColor(R.color.order_state0_color))
tvStatus.setTextColor(ContextCompat.getColor(context, R.color.order_state0_color))
cancelBtnContent = "取消訂單"
}
}
......
package com.joe.print.mvp.print;
import android.content.Context;
import android.graphics.Bitmap;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.common.bean.mealManage.MyOrderManage;
import com.gingersoft.gsa.cloud.base.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.base.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.constans.ExpandConstant;
import com.gingersoft.gsa.cloud.database.bean.ExpandInfo;
import com.gingersoft.gsa.cloud.database.utils.ExpandInfoDaoUtils;
import com.gingersoft.gsa.cloud.print.bean.OrderDetails;
import com.joe.print.R;
import com.joe.print.mvp.model.bean.PrintBillBean;
import com.joe.print.mvp.ui.adapter.BillItemAdapter;
import com.joe.print.mvp.ui.adapter.OtherOrderAdapter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 打印外賣接單結賬單
*/
public class PrintOtherOrderClosing extends PrinterRoot {
@Override
public Map<String, List<Bitmap>> getPrintBitmap(Context mContext) {
OrderDetails.DataBean dataBean = MyOrderManage.getDataBean();
if (dataBean != null) {
Map<String, List<Bitmap>> bitmapMaps = new HashMap<>();
List<Bitmap> bitmaps = new ArrayList<>();
bitmaps.add(initPrintView(mContext, dataBean));
bitmapMaps.put("", bitmaps);
return bitmapMaps;
}
return null;
}
@Override
public int getPrintCount(Context context) {
ExpandInfoDaoUtils expandInfoDaoUtils = new ExpandInfoDaoUtils(context);
List<ExpandInfo> expandInfos = expandInfoDaoUtils.queryAllExpandInfo();
int printCount = 1;
if (expandInfos != null) {
for (ExpandInfo expandInfo : expandInfos) {
if (expandInfo.getSettingName().equals(ExpandConstant.DeliveryPrintCount)) {
printCount = expandInfo.getValueInt();
}
}
}
return printCount;
}
private Bitmap initPrintView(Context context, OrderDetails.DataBean data) {
View view = LayoutInflater.from(context).inflate(R.layout.print_confirm_order_view, null, false);
TextView tvNowPoint = view.findViewById(R.id.tv_nowPoints);
TextView tvAddPoints = view.findViewById(R.id.tv_addPoints);
TextView tvOldPoints = view.findViewById(R.id.tv_oldPoints);
//品牌名
setText(view, R.id.tv_brand_name, GsaCloudApplication.getBrandName(context));
//餐廳名
setText(view, R.id.tv_restaurant_name, GsaCloudApplication.getRestaurantName(context));
// 訂單類型
setText(view, R.id.tv_order_type, data.getOrder_type() == 2 ? "外送" : "自取");
// 訂單號
setText(view, R.id.tv_order_number, "單號:" + data.getORDER_NO());
if (data.getTakeFoodCode() != null && !data.getTakeFoodCode().equals("0")) {
setText(view, R.id.tv_order_take_food_code, "取餐碼:#" + data.getTakeFoodCode());
} else {
view.findViewById(R.id.tv_order_take_food_code).setVisibility(View.GONE);
}
//訂單創建時間
setText(view, R.id.tv_order_create, context.getString(R.string.create_order_time) + TimeUtils.parseTimeRepeat(data.getCREATE_TIME(), TimeUtils.DEFAULT_DATE_FORMAT));
String amountUnit = context.getString(R.string.amount_unit);
RecyclerView rvBill = view.findViewById(R.id.rv_bill);
List<PrintBillBean> billData = new ArrayList<>();
billData.add(getBillBean("合計:", amountUnit + MoneyUtil.sub(MoneyUtil.sub(Double.parseDouble(data.getTOTAL_AMOUNT()), data.getLunchbox()), data.getDELIVERY_CHARGE())));
if (data.getLunchbox() != 0) {
billData.add(getBillBean("餐盒費:", amountUnit + data.getLunchbox()));
}
if (data.getDELIVERY_CHARGE() != 0) {
billData.add(getBillBean("送貨費:", amountUnit + data.getDELIVERY_CHARGE()));
}
if (data.getCouponList() != null && data.getCouponList().size() > 0) {
for (OrderDetails.DataBean.CouponBean coupon : data.getCouponList()) {
billData.add(getBillBean(coupon.getCouponName() + ":", "-$" + coupon.getDiscount_amount()));
}
}
BillItemAdapter adapter = new BillItemAdapter(billData);
rvBill.setLayoutManager(new LinearLayoutManager(context));
rvBill.setAdapter(adapter);
//總金額
setText(view, R.id.tv_total, amountUnit + data.getTOTAL_AMOUNT());
//支付金額
setText(view, R.id.tv_pay_amount_text, "支付金額:" + amountUnit + MoneyUtil.sub(Double.parseDouble(data.getTOTAL_AMOUNT()), data.getDiscount_amount()));
//支付類型:貨到付款,在線支付
String payType = "";
if (data.getPayType() == 1) {
payType = ":積分支付";
} else if (data.getPayType() == 2) {
payType = ":支付寶";
} else if (data.getPayType() == 3) {
payType = ":财付通";
} else if (data.getPayType() == 4) {
payType = ":微信支付";
} else if (data.getPayType() == 5) {
payType = ":貨到付款";
} else if (data.getPayType() == 6) {
payType = ":其他支付";
}
if (data.getOrderPayType() == 1) {
//貨到付款
setText(view, R.id.tv_pay_type, "貨到付款");
} else {
setText(view, R.id.tv_pay_type, "在線支付" + payType);
}
//收貨時間
setText(view, R.id.tv_delivery_time, data.getOrder_type() == 2 ? data.getSEND_TIME() : data.getTakeTime());
if (data.getOrder_type() != 2) {
//自取,隱藏地址和收貨人
view.findViewById(R.id.tv_address).setVisibility(View.GONE);
view.findViewById(R.id.tv_receiver).setVisibility(View.GONE);
} else {
//收貨地址
setText(view, R.id.tv_address, context.getString(R.string.address) + data.getAddressDetail());
//收貨人
setText(view, R.id.tv_receiver, "收貨人:" + data.getRECEIVER());
}
//手機號
setText(view, R.id.tv_phone, "手機號:" + data.getPHONE());
//備註
if (data.getRemark() != null && !data.getRemark().isEmpty()) {
setText(view, R.id.tv_remark, "備註:" + data.getRemark());
view.findViewById(R.id.tv_remark).setVisibility(View.VISIBLE);
} else {
view.findViewById(R.id.tv_remark).setVisibility(View.GONE);
}
if (data.getPRODUCT_NAME() != null) {
RecyclerView rvFoodList = view.findViewById(R.id.rv_order_print_food);
rvFoodList.setLayoutManager(new LinearLayoutManager(context));
rvFoodList.setAdapter(new OtherOrderAdapter(context, data.getPRODUCT_NAME(), true));
}
if (data.getAddPoints() != 0 || data.getOldPoints() !=0 || data.getAddPoints() != 0) {
tvAddPoints.setText("" + data.getNowPoints());
tvNowPoint.setText("" + data.getOldPoints());
tvOldPoints.setText("" + data.getAddPoints());
tvAddPoints.setVisibility(View.VISIBLE);
tvNowPoint.setVisibility(View.VISIBLE);
tvOldPoints.setVisibility(View.VISIBLE);
}
return viewToBitmap(context, view);
}
private PrintBillBean getBillBean(String title, String value) {
return new PrintBillBean(title, value);
}
private void setAmount(Double data, TextView tvText, TextView tvAmount, String amountUnit) {
if (data <= 0) {
tvText.setVisibility(View.GONE);
tvAmount.setVisibility(View.GONE);
} else {
tvText.setVisibility(View.VISIBLE);
tvAmount.setVisibility(View.VISIBLE);
tvAmount.setText(amountUnit + data.toString());
}
}
}
\ No newline at end of file
......@@ -110,17 +110,26 @@ public class PrintPrjKitchen extends PrinterRoot {
tvKitChenLocation.setVisibility(View.GONE);
}
}
if (OpenTableManage.getDefault().getTableBean() != null) {
//台號
tvTableNumber.setText(data.get(0).getTableName());
tvTableNumber2.setText(data.get(0).getTableName());
//人數
tvPeople.setText(data.get(0).getPerson() + "");
//訂單號
tvOrderNumber.setText(data.get(0).getOrderNo());
//開台時間
tvOpeningTime.setText(TimeUtils.parseTimeRepeat(data.get(0).getOrderDetailsTime(), TimeUtils.DEFAULT_DATE_FORMAT));
}
tvTableNumber.setText(data.get(0).getTableName());
tvTableNumber2.setText(data.get(0).getTableName());
//人數
tvPeople.setText(data.get(0).getPerson() + "");
//訂單號
tvOrderNumber.setText(data.get(0).getOrderNo());
//開台時間
tvOpeningTime.setText(TimeUtils.parseTimeRepeat(data.get(0).getOrderDetailsTime(), TimeUtils.DEFAULT_DATE_FORMAT));
// if (OpenTableManage.getDefault().getTableBean() != null) {
// //台號
// tvTableNumber.setText(data.get(0).getTableName());
// tvTableNumber2.setText(data.get(0).getTableName());
// //人數
// tvPeople.setText(data.get(0).getPerson() + "");
// //訂單號
// tvOrderNumber.setText(data.get(0).getOrderNo());
// //開台時間
// tvOpeningTime.setText(TimeUtils.parseTimeRepeat(data.get(0).getOrderDetailsTime(), TimeUtils.DEFAULT_DATE_FORMAT));
// }
//落單時間,為當前時間
tvOrderTime.setText(TimeUtils.getCurrentTimeInString(TimeUtils.DEFAULT_DATE_FORMAT));
//操作人員
......
......@@ -60,6 +60,7 @@ public abstract class PrinterRoot implements PrintSocketHolder.OnStateChangedLis
public final static int PRINT_CLEAN_MACHINE = 4;//清機報表
public final static int PRINT_OTHER_ORDER = 5;//接單內容打印
public final static int PRINT_INSTRUCTION = 6;//開錢箱
public final static int PRINT_OTHER_CLOSING = 7;//外賣結賬單
private final static int SUNMI_PAPER_WIDTH = 360;//商米打印機紙張寬度
private final static int N5_PAPER_WIDTH = 500;//N5打印機紙張寬度
......@@ -89,6 +90,8 @@ public abstract class PrinterRoot implements PrintSocketHolder.OnStateChangedLis
return new PrintOtherOrder();
} else if (type == PRINT_INSTRUCTION) {
return new PrintInstruction();
} else if (type == PRINT_OTHER_CLOSING) {
return new PrintOtherOrderClosing();
}
return null;
}
......@@ -107,6 +110,7 @@ public abstract class PrinterRoot implements PrintSocketHolder.OnStateChangedLis
((TextView) parentView.findViewById(viewId)).setText(text);
}
/**
* 把Map中Key相同,则各个value添加到一起,汇总值
* 把partMap数据合并放到resultMap中。
......@@ -143,6 +147,10 @@ public abstract class PrinterRoot implements PrintSocketHolder.OnStateChangedLis
executor.doPrinterRequestAsync(new OpenCashBoxMaker());
} else {
listMap = getPrintBitmap(mContext);
if (listMap == null) {
printListener.printFile();
return;
}
printSize = listMap.size();
printCount = getPrintCount(mContext);
if (printSize <= 0) {
......
......@@ -344,19 +344,32 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
String port = etPort.getText().toString();
PrinterDeviceBean deviceBean;
if (printerDeviceBean != null) {
deviceBean = printerDeviceBean;
} else {
deviceBean = new PrinterDeviceBean();
}
deviceBean.setPrinterName(mEdPrintName.getText().toString().trim());
deviceBean.setId(0);
deviceBean.setRestaurantId(GsaCloudApplication.getRestaurantId(mContext));
deviceBean.setIp(ipAddress.substring(0, ipAddress.lastIndexOf(".")));
if (TextUtil.isEmptyOrNullOrUndefined(port)) {
deviceBean = new PrinterDeviceBean(mEdPrintName.getText().toString().trim(), 0, GsaCloudApplication.getRestaurantId(mContext), ipAddress.substring(0, ipAddress.lastIndexOf(".")), 9100, paperType);
deviceBean.setPort(9100);
} else {
deviceBean = new PrinterDeviceBean(mEdPrintName.getText().toString().trim(), 0, GsaCloudApplication.getRestaurantId(mContext), ipAddress.substring(0, ipAddress.lastIndexOf(".")), Integer.parseInt(port), paperType);
deviceBean.setPort(Integer.parseInt(port));
}
//飛單打印機
if (oneFailPosition != -1) {
deviceBean.setPrinterDeviceId((long) devicess.get(oneFailPosition).getId());
}
if (twoFailPosition != -1) {
deviceBean.setDefaultPrinterDeviceId((long) devicess.get(twoFailPosition).getId());
}
//是否默認
deviceBean.setStatus(mSwitchDefalute.isChecked() ? 2 : 1);
//打印機機型ID
//打印機機型
if (modelPosition < 0) {
if (printerDeviceBean != null) {
deviceBean.setPrinterModelId(printerDeviceBean.getPrinterModelId());
......
......@@ -15,7 +15,7 @@ import java.util.List;
public class BillItemAdapter extends BaseQuickAdapter<PrintBillBean, BaseViewHolder> {
public BillItemAdapter(@Nullable List<PrintBillBean> data) {
super(R.layout.print_item_bill, data);
super(R.layout.print_bill_adapter_item_bill, data);
}
@Override
......
......@@ -237,11 +237,39 @@
android:text="手機號:" />
<TextView
android:id="@+id/tv_oldPoints"
style="@style/print_other_order_twenty_six_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:text="上次積分:"
android:visibility="gone" />
<TextView
android:id="@+id/tv_nowPoints"
style="@style/print_other_order_twenty_six_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:text="現在積分:"
android:visibility="gone" />
<TextView
android:id="@+id/tv_addPoints"
style="@style/print_other_order_twenty_six_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:text="本次增加:"
android:visibility="gone" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="@string/print_split_line"
android:textColor="@color/theme_333_color" />
android:textColor="@color/theme_333_color"
android:visibility="visible" />
<TextView
style="@style/print_other_order_twenty_six_style"
......
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