Commit 9029ddf2 by 宁斌

bbpos打印細節調整,新增擴展自動(點選支付方式是否彈出輸入框,餐檯模式開檯自動彈出輸入人數彈窗)

parent 70d85024
......@@ -103,6 +103,16 @@ public class FunctionExtendedConfiguration {
.remark("餐檯模式下單頁多少秒不操作返回餐檯頁面")
.build();
private ExpandInfoSetting SelectPaymentAutoShowKeyboard = ExpandInfoSetting.builder()
.valueBoolean(false)
.remark("點選支付方式是否彈出輸入框")
.build();
private ExpandInfoSetting OpenTableAutoShowKeyboard = ExpandInfoSetting.builder()
.valueBoolean(true)
.remark("餐檯模式開檯自動彈出輸入人數彈窗")
.build();
/**
* skyorder相關
*/
......@@ -216,4 +226,13 @@ public class FunctionExtendedConfiguration {
public <T> T getSkyQRCodePrintBottomInfoVaule() {
return SkyQRCodePrintBottomInfo.getValue();
}
public <T> T getSelectPaymentAutoShowKeyboardVaule() {
return SelectPaymentAutoShowKeyboard.getValue();
}
public <T> T getOpenTableAutoShowKeyboardVaule() {
return OpenTableAutoShowKeyboard.getValue();
}
}
package com.gingersoft.gsa.cloud.common.core.print.bean;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import com.gingersoft.gsa.cloud.common.core.settlement.SettlementReport;
import com.gingersoft.gsa.cloud.database.bean.Discount;
import java.util.List;
import lombok.Data;
/**
* @author : bin
......@@ -10,9 +18,56 @@ import com.gingersoft.gsa.cloud.common.core.settlement.SettlementReport;
* @update date: 2020-11-27
* @description:
*/
public class PrintCleanMachineContent extends SettlementReport implements PrintContent {
@Data
public class PrintCleanMachineContent implements PrintContent, Parcelable {
private String yesterdayTime;
private SettlementReport.VoBean vo;
private String restaurantOperationTime;
private List<SettlementReport.AnalysisBean> analysis;
private List<SettlementReport.CashBean> cash;
private String currentTime;
private String startTime;
public PrintCleanMachineContent() {
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.yesterdayTime);
dest.writeParcelable(this.vo, flags);
dest.writeString(this.restaurantOperationTime);
dest.writeTypedList(this.analysis);
dest.writeTypedList(this.cash);
dest.writeString(this.currentTime);
dest.writeString(this.startTime);
}
protected PrintCleanMachineContent(Parcel in) {
super(in);
this.yesterdayTime = in.readString();
this.vo = in.readParcelable(SettlementReport.VoBean.class.getClassLoader());
this.restaurantOperationTime = in.readString();
this.analysis = in.createTypedArrayList(SettlementReport.AnalysisBean.CREATOR);
this.cash = in.createTypedArrayList(SettlementReport.CashBean.CREATOR);
this.currentTime = in.readString();
this.startTime = in.readString();
}
public static final Creator<PrintCleanMachineContent> CREATOR = new Creator<PrintCleanMachineContent>() {
@Override
public PrintCleanMachineContent createFromParcel(Parcel source) {
return new PrintCleanMachineContent(source);
}
@Override
public PrintCleanMachineContent[] newArray(int size) {
return new PrintCleanMachineContent[size];
}
};
}
package com.gingersoft.gsa.cloud.common.core.print.bean;
import android.os.Parcel;
import android.os.Parcelable;
import com.gingersoft.gsa.cloud.common.core.order.commodity.OrderDetail;
import java.util.List;
import lombok.Data;
/**
* @author : bin
* @create date: 2020-12-03
* @update date: 2020-12-03
* @description:堂食上菜紙打印內容
*/
@Data
public class PrintServingPaperContent implements PrintContent {
private String brand;
private String resturantName;
private String orderNo;
private int person;
private String createTime;
private List<OrderDetail> foodList;
//禮貌用語
private String politeLanguage;
}
package com.gingersoft.gsa.cloud.common.core.print.bean;
import android.os.Parcelable;
import com.gingersoft.gsa.cloud.common.core.order.billItem.BillItem;
import com.gingersoft.gsa.cloud.common.core.order.commodity.OrderDetail;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;
/**
* @author : bin
* @create date: 2020-12-03
* @update date: 2020-12-03
* @description:堂食印單打印內容
* */
@Data
public class PrintSlipContent implements PrintContent {
private String brand;
private String resturantName;
private String tableName;
private String orderNo;
private int person;
private String createTime;
private List<OrderDetail> foodList;
private List<BillItem> billItemList;
private double wholeAmount;
private double totalAmount;
//禮貌用語
private String politeLanguage;
}
......@@ -20,16 +20,21 @@ public class PrintTakeawayFormContent implements PrintContent, Parcelable {
private String brand;
private String resturantName;
/**
* 2=外送
* 其他=自取
*/
private String orderType;
/**
* 支付類型:在線支付,貨到付款
*/
private String payType;
//送達時間
private String deliveryTime;
//單號
private String orderNumber;
private String orderNo;
//訂單碼
private String billNumber;
//取餐碼
private String billNo;
//取餐碼/訂單碼
private String orderTakeFoodCode;
//開單時間
private String billingTime;
......@@ -40,7 +45,7 @@ public class PrintTakeawayFormContent implements PrintContent, Parcelable {
//訂單實體
private List<PrintFoodItem> foodItemList;
private List<PrintBillItem> billItemList;
private List<PrintPayTypeItem> printPayTypeItemList;
// private List<PrintPayTypeItem> printPayTypeItemList;
//總金額
private String totalAmountText;
private String totalAmount;
......@@ -66,6 +71,7 @@ public class PrintTakeawayFormContent implements PrintContent, Parcelable {
public PrintTakeawayFormContent() {
}
@Override
public int describeContents() {
return 0;
......@@ -75,22 +81,23 @@ public class PrintTakeawayFormContent implements PrintContent, Parcelable {
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.brand);
dest.writeString(this.resturantName);
dest.writeString(this.orderType);
dest.writeString(this.payType);
dest.writeString(this.deliveryTime);
dest.writeString(this.orderNumber);
dest.writeString(this.billNumber);
dest.writeString(this.orderNo);
dest.writeString(this.billNo);
dest.writeString(this.orderTakeFoodCode);
dest.writeString(this.billingTime);
dest.writeString(this.payTime);
dest.writeString(this.remark);
dest.writeTypedList(this.foodItemList);
dest.writeTypedList(this.billItemList);
dest.writeTypedList(this.printPayTypeItemList);
dest.writeString(this.totalAmountText);
dest.writeString(this.totalAmount);
dest.writeString(this.payAmountText);
dest.writeString(this.payAmount);
dest.writeString(this.memberNumber);
dest.writeString(this.memberName);
dest.writeString(this.memberNumber);
dest.writeString(this.memberPhone);
dest.writeString(this.memberOldPoints);
dest.writeString(this.memberAddPoints);
......@@ -105,22 +112,23 @@ public class PrintTakeawayFormContent implements PrintContent, Parcelable {
protected PrintTakeawayFormContent(Parcel in) {
this.brand = in.readString();
this.resturantName = in.readString();
this.orderType = in.readString();
this.payType = in.readString();
this.deliveryTime = in.readString();
this.orderNumber = in.readString();
this.billNumber = in.readString();
this.orderNo = in.readString();
this.billNo = in.readString();
this.orderTakeFoodCode = in.readString();
this.billingTime = in.readString();
this.payTime = in.readString();
this.remark = in.readString();
this.foodItemList = in.createTypedArrayList(PrintFoodItem.CREATOR);
this.billItemList = in.createTypedArrayList(PrintBillItem.CREATOR);
this.printPayTypeItemList = in.createTypedArrayList(PrintPayTypeItem.CREATOR);
this.totalAmountText = in.readString();
this.totalAmount = in.readString();
this.payAmountText = in.readString();
this.payAmount = in.readString();
this.memberNumber = in.readString();
this.memberName = in.readString();
this.memberNumber = in.readString();
this.memberPhone = in.readString();
this.memberOldPoints = in.readString();
this.memberAddPoints = in.readString();
......@@ -143,6 +151,4 @@ public class PrintTakeawayFormContent implements PrintContent, Parcelable {
return new PrintTakeawayFormContent[size];
}
};
}
......@@ -2,6 +2,7 @@ package com.gingersoft.gsa.cloud.common.core.print.bean.adapter;
import com.gingersoft.gsa.cloud.common.core.print.bean.OrderDetails;
import com.gingersoft.gsa.cloud.common.core.print.bean.PrintContent;
import com.gingersoft.gsa.cloud.common.core.settlement.SettlementReport;
/**
* @author : bin
......@@ -17,6 +18,6 @@ public interface AdaptationContent {
PrintContent adaptationPrintTakeawayFormContent(OrderDetails.DataBean data);
PrintContent adaptationPrintCleanMachineContent();
PrintContent adaptationPrintCleanMachineContent(SettlementReport settlementReport);
}
package com.gingersoft.gsa.cloud.common.core.print.bean.adapter;
import android.text.TextUtils;
import android.view.View;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.common.R;
import com.gingersoft.gsa.cloud.common.constans.AppConstans;
import com.gingersoft.gsa.cloud.common.constans.ExpandConstant;
import com.gingersoft.gsa.cloud.common.core.order.commodity.OrderDetail;
import com.gingersoft.gsa.cloud.common.core.print.bean.PrintCleanMachineContent;
import com.gingersoft.gsa.cloud.common.core.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.common.core.print.bean.OrderDetails;
import com.gingersoft.gsa.cloud.common.core.print.bean.PrintContent;
......@@ -11,8 +17,16 @@ import com.gingersoft.gsa.cloud.common.core.print.bean.PrintTakeawayFormContent;
import com.gingersoft.gsa.cloud.common.core.print.bean.base.PrintBillItem;
import com.gingersoft.gsa.cloud.common.core.print.bean.base.PrintFoodItem;
import com.gingersoft.gsa.cloud.common.core.print.bean.base.PrintPayTypeItem;
import com.gingersoft.gsa.cloud.common.core.restaurant.utils.RestaurantExpandInfoUtils;
import com.gingersoft.gsa.cloud.common.core.settlement.SettlementReport;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.jess.arms.utils.ArmsUtils;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;
/**
......@@ -44,47 +58,115 @@ public class PrintContentAdapter implements AdaptationContent {
}
@Override
public PrintContent adaptationPrintCleanMachineContent() {
return null;
public PrintContent adaptationPrintCleanMachineContent(SettlementReport settlementReport) {
PrintCleanMachineContent cleanMachineContent = new PrintCleanMachineContent();
cleanMachineContent.setYesterdayTime(settlementReport.getYesterdayTime());
cleanMachineContent.setVo(settlementReport.getVo());
cleanMachineContent.setCash(settlementReport.getCash());
cleanMachineContent.setAnalysis(settlementReport.getAnalysis());
cleanMachineContent.setRestaurantOperationTime(TimeUtils.getStringByFormat(settlementReport.getRestaurantOperation().getOperationTime(), TimeUtils.DEFAULT_DATE_FORMAT));
cleanMachineContent.setStartTime(settlementReport.getStartTime());
cleanMachineContent.setCurrentTime(settlementReport.getCurrentTime());
return cleanMachineContent;
}
public PrintTakeawayFormContent getPrintTakeawayFormContent(OrderDetails.DataBean data, int type) {
PrintTakeawayFormContent takeawayPrintContent;
if (type == 1) {
takeawayPrintContent = new PrintTakeawayCheckoutContent();
PrintTakeawayCheckoutContent checkoutContent = (PrintTakeawayCheckoutContent) takeawayPrintContent;
checkoutContent.setPayTypeList(getPrintPayTypeItemsByPayMultiple(data.getPayMultiple()));
} else {
takeawayPrintContent = new PrintTakeawayFormContent();
}
takeawayPrintContent.setBrand(ResturantInfoManager.newInstance().getBrandName());
takeawayPrintContent.setResturantName(ResturantInfoManager.newInstance().getRestaurantName());
takeawayPrintContent.setPayType(String.valueOf(data.getPayType()));
if (data.getOrder_type() == 2) {
takeawayPrintContent.setOrderType("外送");
} else {
takeawayPrintContent.setOrderType("自取");
}
if (data.getPayType() == 2) {
if (!TextUtil.isEmptyOrNullOrUndefined(data.getPayTime())) {
//支付時間,只有在線支付有
if (!TextUtil.isEmptyOrNullOrUndefined(data.getPayTime())) {
takeawayPrintContent.setPayTime("支付時間:" + data.getPayTime());
}
}
}
//取餐碼
if (data.getOrder_type() == 7) {
//自取 顯示 取餐碼+訂單碼
if (!TextUtil.isEmptyOrNullOrUndefined(data.getTakeFoodCode())) {
takeawayPrintContent.setOrderTakeFoodCode("取餐碼:" + data.getTakeFoodCode());
}
} else {
//外送 顯示訂單碼
takeawayPrintContent.setOrderTakeFoodCode("訂單碼:" + data.getTakeFoodCode());
}
if (data.getTakeFoodCode() == null || data.getTakeFoodCode().equals("0")) {
takeawayPrintContent.setOrderTakeFoodCode("");
}
if (!TextUtil.isEmptyOrNullOrUndefined(data.getRemark())) {
takeawayPrintContent.setRemark("備註:" + data.getRemark());
}
if (!TextUtil.isEmptyOrNullOrUndefined(data.getBillNo())) {
takeawayPrintContent.setBillNo("訂單碼:" + data.getBillNo());
}
takeawayPrintContent.setOrderNo("單號:" + data.getORDER_NO());
//支付類型
takeawayPrintContent.setPayType(getPaytype(data));
takeawayPrintContent.setDeliveryTime(data.getOrder_type() == 2 ? data.getSEND_TIME() : data.getTakeTime());
takeawayPrintContent.setOrderNumber(data.getORDER_NO());
takeawayPrintContent.setBillNumber(data.getBillNo());
takeawayPrintContent.setOrderTakeFoodCode(data.getTakeFoodCode());
takeawayPrintContent.setBillingTime(data.getCREATE_TIME());
takeawayPrintContent.setPayTime(data.getPayTime());
takeawayPrintContent.setRemark(data.getRemark());
takeawayPrintContent.setBillingTime("開單時間:" + TimeUtils.parseTimeRepeat(data.getCREATE_TIME(), TimeUtils.DEFAULT_DATE_FORMAT));
takeawayPrintContent.setRemark("備註:" + data.getRemark());
takeawayPrintContent.setFoodItemList(getPrintFoodItemsByProductBeans(data.getPRODUCT_NAME()));
takeawayPrintContent.setBillItemList(getBillItemListByInfo(data.getTOTAL_AMOUNT(), data.getLunchbox(), data.getDELIVERY_CHARGE()));
takeawayPrintContent.setPrintPayTypeItemList(getPrintPayTypeItemsByPayMultiple(data.getPayMultiple()));
takeawayPrintContent.setBillItemList(getBillItemListByInfo(data.getTOTAL_AMOUNT(), data.getLunchbox(), data.getDELIVERY_CHARGE(), data.getCouponList()));
takeawayPrintContent.setTotalAmountText("總金額: ");
takeawayPrintContent.setTotalAmount(data.getTOTAL_AMOUNT());
takeawayPrintContent.setTotalAmount(AppConstans.CARSH_STR + data.getTOTAL_AMOUNT());
takeawayPrintContent.setPayAmountText("支付金額: ");
takeawayPrintContent.setPayAmount(String.valueOf(data.getPAY_AMOUNT()));
takeawayPrintContent.setMemberName(data.getMEMBER_NAME());
takeawayPrintContent.setPayAmount(AppConstans.CARSH_STR + MoneyUtil.sub(Double.parseDouble(data.getTOTAL_AMOUNT()), data.getDiscount_amount()));
takeawayPrintContent.setMemberName("會員名稱: " + data.getMEMBER_NAME());
// takeawayPrintContent.setMemberNumber(data.getm);
takeawayPrintContent.setMemberPhone(data.getPHONE());
takeawayPrintContent.setMemberOldPoints(String.valueOf(data.getOldPoints()));
takeawayPrintContent.setMemberAddPoints(String.valueOf(data.getAddPoints()));
takeawayPrintContent.setMemberNowPoints(String.valueOf(data.getNowPoints()));
takeawayPrintContent.setMemberPhone("會員電話: " + data.getPHONE());
takeawayPrintContent.setMemberOldPoints("上次積分: " + data.getOldPoints());
takeawayPrintContent.setMemberAddPoints("本次積分: " + data.getAddPoints());
takeawayPrintContent.setMemberNowPoints("結餘積分: " + data.getNowPoints());
if (data.getOrder_type() == 2) {
//自取,隱藏地址和收貨人
// takeawayPrintContent.setAdress("地址: " + data.getAddressDetail());
takeawayPrintContent.setAdress(data.getAddressDetail());
takeawayPrintContent.setReceiver(data.getRECEIVER());
takeawayPrintContent.setPhone(data.getPHONE());
takeawayPrintContent.setReceiver("收貨人: " + data.getRECEIVER());
}
takeawayPrintContent.setPhone("手機號: " + data.getPHONE());
takeawayPrintContent.setPoliteLanguage("謝謝光臨!");
return takeawayPrintContent;
}
private String getPaytype(OrderDetails.DataBean data) {
String payTypeStr = null;
if (data.getPayType() == 1) {
//貨到付款
payTypeStr = "貨到付款";
} else if (data.getPayType() == 0) {
payTypeStr = "店內支付";
} else if (data.getPayType() == 2) {
if (data.getPayMultiple() != null) {
StringBuilder payName = new StringBuilder();
for (OrderDetails.DataBean.PayMultiple payMultiple : data.getPayMultiple()) {
payName.append(payMultiple.getPayName());
payName.append(",");
}
if (payName.length() > 0) {
payName.deleteCharAt(payName.length() - 1);
}
payTypeStr = "在線支付:" + payName.toString();
} else {
payTypeStr = "在線支付";
}
}
return payTypeStr;
}
private List<PrintFoodItem> getPrintFoodItemsByProductBeans(List<OrderDetails.DataBean.PRODUCTNAMEBean> productnameBeanList) {
List<OrderDetail> orderDetailList = OrderDetail.productMameBeanToOrderDetail(1, productnameBeanList);
List<PrintFoodItem> printFoodItems = new ArrayList<>();
......@@ -94,16 +176,19 @@ public class PrintContentAdapter implements AdaptationContent {
return printFoodItems;
}
private List<PrintBillItem> getBillItemListByInfo(String totalAmount, double lunchbox, double deliveryCharge) {
private List<PrintBillItem> getBillItemListByInfo(String totalAmount, double lunchbox, double deliveryCharge, List<OrderDetails.DataBean.CouponBean> couponBeanList) {
List<PrintBillItem> billItems = new ArrayList<>();
if (TextUtils.isEmpty(totalAmount)) {
billItems.add(new PrintBillItem("合計: ", String.valueOf(totalAmount)));
}
billItems.add(new PrintBillItem("合計: ", AppConstans.CARSH_STR + MoneyUtil.sub(MoneyUtil.sub(Double.parseDouble(totalAmount), lunchbox), deliveryCharge)));
if (lunchbox != 0.0) {
billItems.add(new PrintBillItem("餐盒費: ", String.valueOf(lunchbox)));
billItems.add(new PrintBillItem("餐盒費: ", AppConstans.CARSH_STR + lunchbox));
}
if (deliveryCharge != 0.0) {
billItems.add(new PrintBillItem("送貨費: ", String.valueOf(deliveryCharge)));
billItems.add(new PrintBillItem("送貨費: ", AppConstans.CARSH_STR + deliveryCharge));
}
if (couponBeanList != null && couponBeanList.size() > 0) {
for (OrderDetails.DataBean.CouponBean couponBean : couponBeanList) {
billItems.add(new PrintBillItem(couponBean.getCouponName(), AppConstans.CARSH_STR + couponBean.getDiscount_amount()));
}
}
return billItems;
}
......@@ -111,7 +196,7 @@ public class PrintContentAdapter implements AdaptationContent {
private List<PrintPayTypeItem> getPrintPayTypeItemsByPayMultiple(List<OrderDetails.DataBean.PayMultiple> payMultiples) {
List<PrintPayTypeItem> printPayTypeItems = new ArrayList<>();
for (OrderDetails.DataBean.PayMultiple payMultiple : payMultiples) {
printPayTypeItems.add(new PrintPayTypeItem(payMultiple.getPayName(), String.valueOf(payMultiple.getAmount())));
printPayTypeItems.add(new PrintPayTypeItem(payMultiple.getPayName(), AppConstans.CARSH_STR + payMultiple.getAmount()));
}
return printPayTypeItems;
}
......
......@@ -274,6 +274,18 @@ public class SettlementReport implements Parcelable {
}
public static final Creator<SettlementReport> CREATOR = new Creator<SettlementReport>() {
@Override
public SettlementReport createFromParcel(Parcel in) {
return new SettlementReport(in);
}
@Override
public SettlementReport[] newArray(int size) {
return new SettlementReport[size];
}
};
@Override
public int describeContents() {
return 0;
......@@ -300,15 +312,4 @@ public class SettlementReport implements Parcelable {
this.startTime = in.readString();
}
public static final Creator<SettlementReport> CREATOR = new Creator<SettlementReport>() {
@Override
public SettlementReport createFromParcel(Parcel source) {
return new SettlementReport(source);
}
@Override
public SettlementReport[] newArray(int size) {
return new SettlementReport[size];
}
};
}
......@@ -195,6 +195,11 @@ public class OrderPayView extends LinearLayout {
//設置差額狀態
setDifferenceText(context);
boolean selectPaymentAutoShowKeyboard = GsaCloudApplication.functionConfiguration.getSelectPaymentAutoShowKeyboardVaule();
if (selectPaymentAutoShowKeyboard) {
//彈出支付金額鍵盤
view.findViewById(R.id.layout_keypad).performClick();
}
if (onSelectPayClickLisenter != null) {
onSelectPayClickLisenter.addClick(method);
}
......
......@@ -7,8 +7,8 @@ ext {
targetSdkVersion : 29,
//正式版: 1.0.3 3
//內部測試版:1.2.0 20
versionCode : 12,
versionName : "1.1.2"
versionCode : 13,
versionName : "1.1.3"
]
version = [
......
......@@ -13,6 +13,7 @@ import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils
import com.gingersoft.gsa.cloud.component.ComponentName
import com.gingersoft.gsa.cloud.common.constans.PrintConstans
import com.gingersoft.gsa.cloud.common.core.print.bean.OrderDetails
import com.gingersoft.gsa.cloud.common.core.print.bean.adapter.PrintContentAdapter
import com.gingersoft.gsa.delivery_pick_mode.data.HistoryOrderRepository
import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.HistoryOrderBean
import kotlinx.coroutines.launch
......@@ -89,8 +90,13 @@ class HistoryOrderViewModel(private val historyOrderRepository: HistoryOrderRepo
orderDetails.data!![0].order_type = data.order_type
orderDetails.data!![0].orderPayType = data.orderPayType
TakeawayOrder.getInstance().shoppingCart.deliveryAndPickupData = orderDetails.data!![0]
var contentAdapter = PrintContentAdapter()
var printContent = contentAdapter.adaptationPrintTakeawayFormContent(TakeawayOrder.getInstance().shoppingCart.deliveryAndPickupData)
CC.obtainBuilder(ComponentName.COMPONENT_PRINT)
.addParam(PrintConstans.PRINT_TYPE, PrintConstans.PRINT_OTHER_ORDER)
.addParam(PrintConstans.PRINT_CONTENT, printContent)
.setActionName("printActivity")
.build()
.callAsyncCallbackOnMainThread { _, result ->
......
......@@ -620,8 +620,13 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
fun printOrder(code: Int, dataBean: OrderDetails.DataBean, listener: (MessageBean) -> Unit) {
//訂單信息和廚房單,打印前需要修改dataBean的order_type和orderPayType
TakeawayOrder.getInstance().shoppingCart.deliveryAndPickupData = dataBean
var contentAdapter = PrintContentAdapter()
var printContent = contentAdapter.adaptationPrintTakeawayFormContent(dataBean)
CC.obtainBuilder(ComponentName.COMPONENT_PRINT)
.addParam(PrintConstans.PRINT_TYPE, PrintConstans.PRINT_OTHER_ORDER)
.addParam(PrintConstans.PRINT_CONTENT, printContent)
.setActionName("printActivity")
.build()
.callAsyncCallbackOnMainThread { _, result ->
......
......@@ -103,10 +103,12 @@ public class WelcomeActivity extends LoginInterfaceImpl<WelcomePresenter> implem
boolean isLogin = (boolean) SPUtils.get(UserConstans.AUTO_LOGIN, false);
if (isLogin) {
if (!TextUtils.isEmpty(UserContext.newInstance().getLoginToken()) && ResturantInfoManager.newInstance(). getRestaurantId() != 0) {
if (!TextUtils.isEmpty(UserContext.newInstance().getLoginToken()) && ResturantInfoManager.newInstance().getRestaurantId() != 0) {
//自動登陸
String pwd = Aes.aesDecrypt((String) SPUtils.get(UserConstans.LOGIN_PASSWORD, ""));
mPresenter.login(SPUtils.get(UserConstans.LOGIN_USERNAME, "") + "", pwd);
} else {
startActivity(new Intent(mContext, LoginActivity.class));
}
} else {
startActivity(new Intent(mContext, LoginActivity.class));
......
......@@ -22,6 +22,8 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.billy.cc.core.component.CC;
import com.gingersoft.gsa.cloud.common.core.print.bean.PrintContent;
import com.gingersoft.gsa.cloud.common.core.print.bean.adapter.PrintContentAdapter;
import com.gingersoft.gsa.cloud.common.core.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.common.core.user.UserContext;
import com.gingersoft.gsa.cloud.common.core.pay.PayMethod;
......@@ -122,6 +124,7 @@ public class SettlementReportActivity extends BaseActivity<SettlementReportPrese
private int type;
private SettlementReport mSettlementReport;
/**
* 1#全部計入到10號清機數據
* 2#全部計入到12號清機數據
......@@ -296,6 +299,7 @@ public class SettlementReportActivity extends BaseActivity<SettlementReportPrese
@Override
public void returnSettlementData(SettlementReport datasBean) {
this.mSettlementReport = datasBean;
if (datasBean.getVo() != null && datasBean.getVo().getPrices() > 0) {
//保存下次重印數據
SPUtils.put(PrintConstans.SETTLEMENT_REPORT, JsonUtils.toJson(datasBean));
......@@ -575,11 +579,18 @@ public class SettlementReportActivity extends BaseActivity<SettlementReportPrese
@Override
public void printRepore() {
if (mSettlementReport == null) {
return;
}
View view = initPrintView();
//清機成功,打印
PrintTransitUtils.getInstance().setPrintView(view);
PrintContent printContent = new PrintContentAdapter().adaptationPrintCleanMachineContent(mSettlementReport);
CC.obtainBuilder(ComponentName.COMPONENT_PRINT)
.addParam(PrintConstans.PRINT_TYPE, PrintConstans.PRINT_CLEAN_MACHINE)//清機打印
.addParam(PrintConstans.PRINT_CONTENT, printContent)//清機內容
.setActionName("printActivity")
.build()
.callAsyncCallbackOnMainThread((cc, result) -> {
......
package com.joe.print.mvp.model.bean;
import lombok.Data;
/**
* @author : bin
* @create date: 2020-12-03
* @update date: 2020-12-03
* @description:
*/
@Data
public class FontStyle {
private int foodComplexion;//食品顔色 0 黑色 2 紅色
private int modifierComplexion;//細項顔色 0 黑色 2 紅色
private int foodIsBold;//食品是否加粗 0預設 1是 2否
private String foodFont;//食品字體大小 0預設
private int foodIsItalic;//食品是否斜體 0預設 1是 2否
private int modifierIsBold;//細項是否加粗 0預設 1是 2否
private String modifierFont;//細項字號 0預設
private int modifierIsItalic;//細項是否斜體 0預設 1是 2否
private int numberIsFlip;//數量大於1顔色是否翻轉 0預設 1是 2否
}
......@@ -23,13 +23,17 @@ import java.util.List;
import java.util.Map;
import static com.joe.print.mvp.print.common.HtmlContract.ATTRIBUTES_ALIGN;
import static com.joe.print.mvp.print.common.HtmlContract.ATTRIBUTES_FONT_SIZE;
import static com.joe.print.mvp.print.common.HtmlContract.ATTRIBUTES_OFFSET;
import static com.joe.print.mvp.print.common.HtmlContract.LABLE_COLUMN;
import static com.joe.print.mvp.print.common.HtmlContract.LABLE_DIV;
import static com.joe.print.mvp.print.common.HtmlContract.LABLE_P;
import static com.joe.print.mvp.print.common.HtmlContract.value_align_center;
import static com.joe.print.mvp.print.common.HtmlContract.value_offset_last;
import static com.joe.print.mvp.print.common.HtmlContract.value_offset_percentage30;
import static com.joe.print.mvp.print.common.HtmlContract.value_offset_percentage35;
import static com.joe.print.mvp.print.common.HtmlContract.value_offset_percentage60;
import static com.joe.print.mvp.print.common.HtmlContract.value_offset_percentage65;
/**
* 清機打印
......@@ -41,9 +45,11 @@ public class PrintCleanMachine extends PrinterRoot<PrintCleanMachineContent> {
@Override
protected void setPrintContent(PrintCleanMachineContent printContent) {
if (printContent != null) {
this.mCleanMachineContent = printContent;
this.mAnalysisBeanMap = getAnalysisBeanMap(mCleanMachineContent.getAnalysis());
}
}
private Map<String, SettlementReport.AnalysisBean> getAnalysisBeanMap(List<SettlementReport.AnalysisBean> analysisBeanList) {
Map<String, SettlementReport.AnalysisBean> analysisBeanMap = new HashMap<>();
......@@ -77,8 +83,11 @@ public class PrintCleanMachine extends PrinterRoot<PrintCleanMachineContent> {
getHtmlCumulativeThisMonth() +
getHtmlEndInfo()
+ "</body></html>";
String[] pritContent = new String[1];
pritContent[0] = stringBuilder;
int printCount = getPrintCount(mContext);
String[] pritContent = new String[printCount];
for (int i = 0; i < printCount; i++) {
pritContent[i] = stringBuilder;
}
return pritContent;
}
......@@ -103,13 +112,18 @@ public class PrintCleanMachine extends PrinterRoot<PrintCleanMachineContent> {
private String getHtmlHeadInfo() {
List<HtmlLable> htmlLables = new ArrayList<>();
htmlLables.add(new HtmlLable(LABLE_P, "上次清機時間:" + mCleanMachineContent.getRestaurantOperation().getOperationTime()));
htmlLables.add(new HtmlLable(LABLE_P, "品牌名稱:" + ResturantInfoManager.newInstance().getBrandName()));
htmlLables.add(new HtmlLable(LABLE_P, "店鋪名稱:" + ResturantInfoManager.newInstance().getRestaurantName()));
htmlLables.add(new HtmlLable(LABLE_P, "每日營業報表"));
htmlLables.add(new HtmlLable(LABLE_P, "由營業日期:" + mCleanMachineContent.getStartTime()));
htmlLables.add(new HtmlLable(LABLE_P, "到營業日期:" + mCleanMachineContent.getCurrentTime()));
htmlLables.add(new HtmlLable(LABLE_P, HtmlContract.dividing_line));
List<String> items = new ArrayList<>();
items.add("上次清機時間:" + mCleanMachineContent.getRestaurantOperationTime());
items.add("品牌名稱:" + ResturantInfoManager.newInstance().getBrandName());
items.add("店鋪名稱:" + ResturantInfoManager.newInstance().getRestaurantName());
items.add("每日營業報表");
items.add("由營業日期:" + mCleanMachineContent.getStartTime());
items.add("到營業日期:" + mCleanMachineContent.getCurrentTime());
for (String item : items) {
htmlLables.addAll(getRowInformation(new HtmlLable[]{new HtmlLable(LABLE_COLUMN, item)}, 24));
}
htmlLables.add(new HtmlLable(LABLE_DIV, HtmlContract.dividing_line));
return getHtmlLables(htmlLables.toArray(new HtmlLable[htmlLables.size()]));
}
......@@ -120,35 +134,34 @@ public class PrintCleanMachine extends PrinterRoot<PrintCleanMachineContent> {
List<HtmlLable> htmlLables = new ArrayList<>();
String[] items = {"項目銷售總額", "折扣", "服務費", "送貨費", "營業今個淨值", "現金核數", "營業金額淨值"};
String[] items = {"項目銷售總額", "折扣", "服務費", "送貨費", "營業今個淨值", "", "現金核數", "營業金額淨值"};
List<String> items2 = new ArrayList<>();
items2.add(String.valueOf(voBean.getPrices()));
items2.add(String.valueOf(voBean.getDisamount()));
items2.add(String.valueOf(voBean.getScamount()));
items2.add(String.valueOf(voBean.getDeliverycharge()));
items2.add(String.valueOf(voBean.getTotamount()));
items2.add(AppConstans.CARSH_STR + voBean.getPrices());
items2.add(AppConstans.CARSH_STR + voBean.getDisamount());
items2.add(AppConstans.CARSH_STR + voBean.getScamount());
items2.add(AppConstans.CARSH_STR + voBean.getDeliverycharge());
items2.add(AppConstans.CARSH_STR + voBean.getTotamount());
items2.add("");
items2.add("");
items2.add(String.valueOf(voBean.getTotamount()));
items2.add(AppConstans.CARSH_STR + voBean.getTotamount());
for (int i = 0; i < items.length; i++) {
htmlLables.add(new HtmlLable(getRowLableStart()));
htmlLables.add(new HtmlLable(LABLE_COLUMN, items[i]));
if (items2.size() > (i + 1)) {
htmlLables.add(new HtmlLable(LABLE_COLUMN, String.valueOf(items2.get(i)), new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_last)));
}
htmlLables.add(new HtmlLable(getRowLableEnd()));
htmlLables.addAll(getRowInformation(new HtmlLable[]{
new HtmlLable(LABLE_COLUMN, items[i]),
new HtmlLable(LABLE_COLUMN, String.valueOf(items2.get(i)), new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_last))},
24));
}
if (cashs != null) {
for (SettlementReport.CashBean cashBean : cashs) {
htmlLables.add(new HtmlLable(getRowLableStart()));
htmlLables.add(new HtmlLable(LABLE_COLUMN, cashBean.getPayName()));
htmlLables.add(new HtmlLable(LABLE_COLUMN, String.valueOf(cashBean.getPayNum()), new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_percentage60)));
htmlLables.add(new HtmlLable(LABLE_COLUMN, String.valueOf(cashBean.getPayAmount()), new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_last)));
htmlLables.add(new HtmlLable(getRowLableEnd()));
htmlLables.addAll(getRowInformation(new HtmlLable[]{
new HtmlLable(LABLE_COLUMN, cashBean.getPayName()),
new HtmlLable(LABLE_COLUMN, String.valueOf(cashBean.getPayNum()), new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_percentage60)),
new HtmlLable(LABLE_COLUMN, AppConstans.CARSH_STR + cashBean.getPayAmount(), new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_last))
}, 24));
}
}
htmlLables.add(new HtmlLable(LABLE_P, HtmlContract.dividing_line));
// htmlLables.add(new HtmlLable(LABLE_P, HtmlContract.dividing_line));
htmlLables.add(new HtmlLable(LABLE_P, HtmlContract.dividing_line));
return getHtmlLables(htmlLables.toArray(new HtmlLable[htmlLables.size()]));
}
......@@ -164,20 +177,26 @@ public class PrintCleanMachine extends PrinterRoot<PrintCleanMachineContent> {
return "";
}
List<HtmlLable> htmlLables = new ArrayList<>();
htmlLables.add(new HtmlLable(LABLE_P, "現金詳情", new HtmlLable.Attributes(ATTRIBUTES_ALIGN, value_align_center)));
htmlLables.add(new HtmlLable(LABLE_P, "現金詳情",
new HtmlLable.Attributes(ATTRIBUTES_FONT_SIZE, "26"),
new HtmlLable.Attributes(ATTRIBUTES_ALIGN, value_align_center, HtmlContract.value_type_string)));
for (SettlementReport.CashBean cashBean : cashs) {
if (cashBean.getPayType() == PayMethod.PAY_TYPE_CASH) {
htmlLables.add(new HtmlLable(getRowLableStart()));
htmlLables.add(new HtmlLable(LABLE_COLUMN, cashBean.getPayName()));
htmlLables.add(new HtmlLable(LABLE_COLUMN, String.valueOf(cashBean.getPayNum()), new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_percentage60)));
htmlLables.add(new HtmlLable(LABLE_COLUMN, String.valueOf(cashBean.getPayAmount()), new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_last)));
htmlLables.add(new HtmlLable(getRowLableEnd()));
htmlLables.addAll(getRowInformation(new HtmlLable[]{
new HtmlLable(LABLE_COLUMN, cashBean.getPayName()),
new HtmlLable(LABLE_COLUMN, String.valueOf(cashBean.getPayNum()), new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_percentage60)),
new HtmlLable(LABLE_COLUMN, AppConstans.CARSH_STR + cashBean.getPayAmount(), new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_last))
}, 22));
break;
}
}
if (htmlLables.size() > 0) {
htmlLables.add(new HtmlLable(LABLE_P, HtmlContract.dividing_line));
htmlLables.add(new HtmlLable(LABLE_P, HtmlContract.dividing_line));
// htmlLables.add(new HtmlLable(LABLE_P, HtmlContract.dividing_line));
}
if (htmlLables.size() == 1) {
return "";
}
return getHtmlLables(htmlLables.toArray(new HtmlLable[htmlLables.size()]));
}
......@@ -193,35 +212,39 @@ public class PrintCleanMachine extends PrinterRoot<PrintCleanMachineContent> {
List<HtmlLable> htmlLables = new ArrayList<>();
htmlLables.add(new HtmlLable(LABLE_P, "分析統計", new HtmlLable.Attributes(ATTRIBUTES_ALIGN, value_align_center)));
htmlLables.add(new HtmlLable(LABLE_P, "分析統計",
new HtmlLable.Attributes(ATTRIBUTES_FONT_SIZE, "26"),
new HtmlLable.Attributes(ATTRIBUTES_ALIGN, value_align_center, HtmlContract.value_type_string)));
htmlLables.add(new HtmlLable(getRowLableStart()));
htmlLables.add(new HtmlLable(LABLE_COLUMN, "帳單金額總數"));
htmlLables.add(new HtmlLable(LABLE_COLUMN, String.valueOf(voBean.getTotamount()), new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_last)));
htmlLables.add(new HtmlLable(getRowLableEnd()));
htmlLables.addAll(getRowInformation(new HtmlLable[]{
new HtmlLable(LABLE_COLUMN, "帳單金額總數"),
new HtmlLable(LABLE_COLUMN, AppConstans.CARSH_STR + voBean.getTotamount(), new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_last))
}, 22));
htmlLables.add(new HtmlLable(getRowLableStart()));
String averagePrice = "0.00";
if (voBean.getNum() != 0) {
averagePrice = String.valueOf(MoneyUtil.get_ItemDecimals_money(voBean.getPrices() / voBean.getNum()));
}
htmlLables.add(new HtmlLable(LABLE_COLUMN, "帳單數目"));
htmlLables.add(new HtmlLable(LABLE_COLUMN, String.valueOf(voBean.getNum()), new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_percentage60)));
htmlLables.add(new HtmlLable(LABLE_COLUMN, averagePrice, new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_last)));
htmlLables.add(new HtmlLable(getRowLableEnd()));
htmlLables.addAll(getRowInformation(new HtmlLable[]{
new HtmlLable(LABLE_COLUMN, "帳單數目"),
new HtmlLable(LABLE_COLUMN, String.valueOf(voBean.getNum()), new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_percentage60)),
new HtmlLable(LABLE_COLUMN, AppConstans.CARSH_STR + averagePrice, new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_last))
}, 22));
htmlLables.add(new HtmlLable(getRowLableStart()));
String averageConsumption = "0.00";
if (voBean.getPerson() != 0) {
averageConsumption = String.valueOf(MoneyUtil.get_ItemDecimals_money(voBean.getPrices() / voBean.getPerson()));
}
htmlLables.add(new HtmlLable(LABLE_COLUMN, "人數 / 平均消費"));
htmlLables.add(new HtmlLable(LABLE_COLUMN, String.valueOf(voBean.getPerson()), new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_percentage60)));
htmlLables.add(new HtmlLable(LABLE_COLUMN, averageConsumption, new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_last)));
htmlLables.add(new HtmlLable(getRowLableEnd()));
htmlLables.add(new HtmlLable(LABLE_P, HtmlContract.dividing_line));
htmlLables.addAll(getRowInformation(new HtmlLable[]{
new HtmlLable(LABLE_COLUMN, "人數 / 平均消費"),
new HtmlLable(LABLE_COLUMN, String.valueOf(voBean.getPerson()), new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_percentage60)),
new HtmlLable(LABLE_COLUMN, AppConstans.CARSH_STR + averageConsumption, new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_last))
}, 22));
// htmlLables.add(new HtmlLable(LABLE_P, HtmlContract.dividing_line));
htmlLables.add(new HtmlLable(LABLE_P, HtmlContract.dividing_line));
return getHtmlLables(htmlLables.toArray(new HtmlLable[htmlLables.size()]));
......@@ -235,7 +258,9 @@ public class PrintCleanMachine extends PrinterRoot<PrintCleanMachineContent> {
private String getHtmlBillingStatisticsItems() {
List<HtmlLable> htmlLables = new ArrayList<>();
htmlLables.add(new HtmlLable(LABLE_P, "賬單統計", new HtmlLable.Attributes(ATTRIBUTES_ALIGN, value_align_center)));
htmlLables.add(new HtmlLable(LABLE_P, "賬單統計",
new HtmlLable.Attributes(ATTRIBUTES_FONT_SIZE, "26"),
new HtmlLable.Attributes(ATTRIBUTES_ALIGN, value_align_center, HtmlContract.value_type_string)));
List<SettlementReport.AnalysisBean> analysisBeanList = mCleanMachineContent.getAnalysis();
SettlementReport.VoBean voBean = mCleanMachineContent.getVo();
......@@ -246,6 +271,9 @@ public class PrintCleanMachine extends PrinterRoot<PrintCleanMachineContent> {
htmlLables.addAll(getHtmlBillingStatisticsItem(analysisBean, voBean));
}
}
if (htmlLables.size() == 1) {
return "";
}
return getHtmlLables(htmlLables.toArray(new HtmlLable[htmlLables.size()]));
}
......@@ -255,10 +283,11 @@ public class PrintCleanMachine extends PrinterRoot<PrintCleanMachineContent> {
List<String> items2 = new ArrayList<>();
List<HtmlLable> htmlLables = new ArrayList<>();
htmlLables.add(new HtmlLable(getRowLableStart()));
htmlLables.add(new HtmlLable(LABLE_COLUMN, "類別"));
htmlLables.add(new HtmlLable(LABLE_COLUMN, analysisBean.getTypeName(), new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_last)));
htmlLables.add(new HtmlLable(getRowLableEnd()));
htmlLables.addAll(getRowInformation(new HtmlLable[]{
new HtmlLable(LABLE_COLUMN, "類別"),
new HtmlLable(LABLE_COLUMN, analysisBean.getTypeName(), new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_last)),
}, 24));
String averagePrice = "";
String percentage = "";
......@@ -273,13 +302,13 @@ public class PrintCleanMachine extends PrinterRoot<PrintCleanMachineContent> {
}
items2.add(analysisBean.getTypeName());
items2.add(String.valueOf(analysisBean.getNum()));
items2.add(String.valueOf(analysisBean.getAmount()));
items2.add(averagePrice);
items2.add(percentage);
items2.add(AppConstans.CARSH_STR + analysisBean.getAmount());
items2.add(AppConstans.CARSH_STR + averagePrice);
items2.add(AppConstans.CARSH_STR + percentage);
for (int i = 0; i < items.length; i++) {
htmlLables.add(new HtmlLable(getRowLableStart()));
htmlLables.add(new HtmlLable(getRowLableStart(new HtmlLable.Attributes(ATTRIBUTES_FONT_SIZE, "22"))));
htmlLables.add(new HtmlLable(LABLE_COLUMN, items[i]));
if (items2.size() > (i + 1)) {
if (items2.size() > i) {
htmlLables.add(new HtmlLable(LABLE_COLUMN, items2.get(i), new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_last)));
}
htmlLables.add(new HtmlLable(getRowLableEnd()));
......@@ -308,7 +337,9 @@ public class PrintCleanMachine extends PrinterRoot<PrintCleanMachineContent> {
items4.add("金額");
List<HtmlLable> htmlLables = new ArrayList<>();
htmlLables.add(new HtmlLable(LABLE_P, "賬單現況", new HtmlLable.Attributes(ATTRIBUTES_ALIGN, value_align_center)));
htmlLables.add(new HtmlLable(LABLE_P, "賬單現況",
new HtmlLable.Attributes(ATTRIBUTES_FONT_SIZE, "26"),
new HtmlLable.Attributes(ATTRIBUTES_ALIGN, value_align_center, HtmlContract.value_type_string)));
for (int i = 0; i < analysisBeanList.size(); i++) {
SettlementReport.AnalysisBean analysisBean = analysisBeanList.get(i);
......@@ -316,24 +347,38 @@ public class PrintCleanMachine extends PrinterRoot<PrintCleanMachineContent> {
items.add(analysisBean.getTypeName());
items2.add(String.valueOf(analysisBean.getNum()));
items3.add(String.valueOf(analysisBean.getPerson()));
items4.add(String.valueOf(analysisBean.getAmount()));
items4.add(AppConstans.CARSH_STR + analysisBean.getAmount());
}
}
for (int i = 0; i < items.size(); i++) {
htmlLables.add(new HtmlLable(getRowLableStart()));
htmlLables.add(new HtmlLable(getRowLableStart(new HtmlLable.Attributes(ATTRIBUTES_FONT_SIZE, "22"))));
htmlLables.add(new HtmlLable(LABLE_COLUMN, items.get(i)));
if (items2.size() > (i + 1)) {
if (items2.size() > i) {
if (i > 0) {
htmlLables.add(new HtmlLable(LABLE_COLUMN, items2.get(i), new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_percentage35)));
} else {
htmlLables.add(new HtmlLable(LABLE_COLUMN, items2.get(i), new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_percentage30)));
}
if (items3.size() > (i + 1)) {
}
if (items3.size() > i) {
if (i > 0) {
htmlLables.add(new HtmlLable(LABLE_COLUMN, items3.get(i), new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_percentage65)));
} else {
htmlLables.add(new HtmlLable(LABLE_COLUMN, items3.get(i), new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_percentage60)));
}
if (items4.size() > (i + 1)) {
}
if (items4.size() > i) {
if (i > 0) {
htmlLables.add(new HtmlLable(LABLE_COLUMN, items4.get(i), new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_last)));
} else {
htmlLables.add(new HtmlLable(LABLE_COLUMN, items4.get(i), new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_last)));
}
}
htmlLables.add(new HtmlLable(getRowLableEnd()));
}
htmlLables.add(new HtmlLable(LABLE_P, HtmlContract.dividing_line));
htmlLables.add(new HtmlLable(getBrLable()));
return getHtmlLables(htmlLables.toArray(new HtmlLable[htmlLables.size()]));
}
......@@ -365,13 +410,14 @@ public class PrintCleanMachine extends PrinterRoot<PrintCleanMachineContent> {
}
for (int i = 0; i < items.size(); i++) {
htmlLables.add(new HtmlLable(getRowLableStart()));
htmlLables.add(new HtmlLable(getRowLableStart(new HtmlLable.Attributes(ATTRIBUTES_FONT_SIZE, "24"))));
htmlLables.add(new HtmlLable(LABLE_COLUMN, items.get(i)));
if (items2.size() > (i + 1)) {
if (items2.size() > i) {
htmlLables.add(new HtmlLable(LABLE_COLUMN, items2.get(i), new HtmlLable.Attributes(ATTRIBUTES_OFFSET, value_offset_last)));
}
htmlLables.add(new HtmlLable(getRowLableEnd()));
}
htmlLables.add(new HtmlLable(LABLE_P, HtmlContract.dividing_line));
return getHtmlLables(htmlLables.toArray(new HtmlLable[htmlLables.size()]));
}
......@@ -388,7 +434,7 @@ public class PrintCleanMachine extends PrinterRoot<PrintCleanMachineContent> {
items.add("讀取人員:" + UserContext.newInstance().getMemberName());
items.add(currentDate);
for (int i = 0; i < items.size(); i++) {
htmlLables.add(new HtmlLable(getRowLableStart()));
htmlLables.add(new HtmlLable(getRowLableStart(new HtmlLable.Attributes(ATTRIBUTES_FONT_SIZE, "24"))));
htmlLables.add(new HtmlLable(LABLE_COLUMN, items.get(i)));
htmlLables.add(new HtmlLable(getRowLableEnd()));
}
......
......@@ -63,13 +63,14 @@ public class PrintOtherOrder extends PrinterRoot<PrintTakeawayFormContent> {
String stringBuilder = "<html><body>" +
getTakewayPrintContent(printTakeawayFormContent,deviceBean) +
"</body></html>";
String[] pritContent = new String[1];
pritContent[0] = stringBuilder;
int printCount = getPrintCount(mContext);
String[] pritContent = new String[printCount];
for (int i = 0; i < printCount; i++) {
pritContent[i] = stringBuilder;
}
return pritContent;
}
@Override
public int getPrintCount(Context context) {
return RestaurantExpandInfoUtils.getValue(ExpandConstant.DeliveryPrintCount,1);
......
......@@ -65,8 +65,11 @@ public class PrintOtherOrderClosing extends PrinterRoot<PrintTakeawayCheckoutCon
String stringBuilder = "<html><body>" +
getTakewayPrintContent(mTakeawayCheckoutContent, deviceBean) +
"</body></html>";
String[] pritContent = new String[1];
pritContent[0] = stringBuilder;
int printCount = getPrintCount(mContext);
String[] pritContent = new String[printCount];
for (int i = 0; i < printCount; i++) {
pritContent[i] = stringBuilder;
}
return pritContent;
}
......
......@@ -146,7 +146,7 @@ public class PrintPrjKitchen extends PrinterRoot {
if (RestaurantExpandInfoUtils.getValue(ExpandConstant.PrintFirstOrder, false)) {
htmlLables.add(new HtmlLable(HtmlContract.LABLE_P, getTableName(prjBean),
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_FONT_SIZE, font_size_first_order),
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_ALIGN, HtmlContract.value_align_center)));
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_ALIGN, HtmlContract.value_align_center,HtmlContract.value_type_string)));
}
//統計打印數
if (RestaurantExpandInfoUtils.getValue(ExpandConstant.PrintStatisticsAmount, false)) {
......@@ -221,7 +221,7 @@ public class PrintPrjKitchen extends PrinterRoot {
if (RestaurantExpandInfoUtils.getValue(ExpandConstant.PrintPage, false)) {
htmlLables.add(new HtmlLable(HtmlContract.LABLE_P, prjBean.getCurrentIndex() + "/" + prjBean.getTotalPrj(),
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_FONT_SIZE, font_size_prj_page_index),
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_ALIGN, HtmlContract.value_align_center)));
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_ALIGN, HtmlContract.value_align_center,HtmlContract.value_type_string)));
}
return getHtmlLables(htmlLables.toArray(new HtmlLable[htmlLables.size()]));
}
......
......@@ -53,8 +53,11 @@ public class PrintQRCode extends PrinterRoot<PrintQRCodeContent> {
String stringBuilder = "<html><body>" +
getHtmlContent() +
"</body></html>";
String[] pritContent = new String[1];
pritContent[0] = stringBuilder;
int printCount = getPrintCount(mContext);
String[] pritContent = new String[printCount];
for (int i = 0; i < printCount; i++) {
pritContent[i] = stringBuilder;
}
return pritContent;
}
......@@ -62,9 +65,9 @@ public class PrintQRCode extends PrinterRoot<PrintQRCodeContent> {
List<HtmlLable> htmlLables = new ArrayList<>();
//頭部
htmlLables.add(new HtmlLable(HtmlContract.LABLE_H3,mQRCodeBean.getPrintTableName(), new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_ALIGN, HtmlContract.value_align_center)));
htmlLables.add(new HtmlLable(HtmlContract.LABLE_H3,mQRCodeBean.getPrintTableName(), new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_ALIGN, HtmlContract.value_align_center,HtmlContract.value_type_string)));
htmlLables.add(new HtmlLable(HtmlContract.LABLE_P,mQRCodeBean.getPrintTopInfo(),
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_ALIGN, HtmlContract.value_align_center),
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_ALIGN, HtmlContract.value_align_center,HtmlContract.value_type_string),
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_FONT_SIZE,"25")));
//qrcode
......
......@@ -5,23 +5,37 @@ import android.graphics.Bitmap;
import android.view.Gravity;
import android.widget.LinearLayout;
import com.gingersoft.gsa.cloud.common.constans.ExpandConstant;
import com.gingersoft.gsa.cloud.common.core.order.commodity.OrderDetail;
import com.gingersoft.gsa.cloud.common.core.order.order.DoshokuOrder;
import com.gingersoft.gsa.cloud.common.core.print.bean.PrintServingPaperContent;
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.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean;
import com.joe.print.R;
import com.joe.print.mvp.model.bean.HtmlLable;
import com.joe.print.mvp.print.common.HtmlContract;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.joe.print.mvp.print.common.HtmlContract.LABLE_DIV;
/**
* 上菜紙打印 已改新版
*/
public class PrintServe extends PrinterRoot {
public class PrintServe extends PrinterRoot<PrintServingPaperContent> {
private PrintServingPaperContent mPrintServingPaperContent;
@Override
protected void setPrintContent(PrintServingPaperContent printContent) {
this.mPrintServingPaperContent = printContent;
}
@Override
public Map<String, List<Bitmap>> getPrintBitmap(Context mContext, PrinterDeviceBean printerDeviceBean) {
......@@ -35,6 +49,9 @@ public class PrintServe extends PrinterRoot {
@Override
public String[] getPrintDatas(Context mContext, PrinterDeviceBean deviceBean) {
if(mPrintServingPaperContent == null){
return new String[]{"<html><body></body></html>"};
}
List<OrderDetail> foodList = DoshokuOrder.getInstance().getShoppingCart().getOrderCommodityList();
TableBean.DataBean tableBean = DoshokuOrder.getInstance().getOpenTableInfo();
......@@ -48,11 +65,51 @@ public class PrintServe extends PrinterRoot {
generateHtmlFoodInfoTwoColumns(foodList) +
getWholeLine() +
getHtmlFooter() + "</body></html>";
String[] pritContent = new String[1];
pritContent[0] = stringBuilder;
int printCount = getPrintCount(mContext);
String[] pritContent = new String[printCount];
for (int i = 0; i < printCount; i++) {
pritContent[i] = stringBuilder;
}
return pritContent;
}
private String getHtmlContent() {
List<HtmlLable> htmlLables = new ArrayList<>();
/**
* 頭部
*/
htmlLables.add(new HtmlLable(LABLE_DIV, mPrintServingPaperContent.getBrand(),
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_ALIGN, HtmlContract.value_align_center, HtmlContract.value_type_string),
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_FONT_SIZE, "28")));
htmlLables.add(new HtmlLable(LABLE_DIV, mPrintServingPaperContent.getResturantName(),
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_ALIGN, HtmlContract.value_align_center, HtmlContract.value_type_string),
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_FONT_SIZE, "28")));
/**
* 訂單
*/
/**
* 食品
*/
/**
* 賬單項
*/
/**
* 底部
*/
return getHtmlLables(htmlLables.toArray(new HtmlLable[htmlLables.size()]));
}
@Override
public int getPrintCount(Context context) {
return 1;
......
......@@ -5,6 +5,8 @@ import android.graphics.Bitmap;
import android.view.Gravity;
import android.widget.LinearLayout;
import com.gingersoft.gsa.cloud.common.core.print.bean.PrintSlipContent;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.joe.print.mvp.model.bean.BillingBean;
import com.gingersoft.gsa.cloud.common.core.order.billItem.BillItem;
import com.gingersoft.gsa.cloud.common.core.order.cart.ShoppingCart;
......@@ -16,16 +18,29 @@ import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.common.constans.ExpandConstant;
import com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean;
import com.joe.print.R;
import com.joe.print.mvp.model.bean.HtmlLable;
import com.joe.print.mvp.print.common.HtmlContract;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.joe.print.mvp.print.common.HtmlContract.LABLE_COLUMN;
import static com.joe.print.mvp.print.common.HtmlContract.LABLE_DIV;
import static com.joe.print.mvp.print.common.HtmlContract.LABLE_P;
/**
* 印單打印 已改新版
*/
public class PrintSlip extends PrinterRoot {
public class PrintSlip extends PrinterRoot<PrintSlipContent> {
private PrintSlipContent mPrintSlipContent;
@Override
protected void setPrintContent(PrintSlipContent printContent) {
this.mPrintSlipContent = printContent;
}
@Override
public Map<String, List<Bitmap>> getPrintBitmap(Context mContext, PrinterDeviceBean deviceBean) {
......@@ -46,6 +61,11 @@ public class PrintSlip extends PrinterRoot {
@Override
public String[] getPrintDatas(Context mContext, PrinterDeviceBean deviceBean) {
if (mPrintSlipContent == null) {
return new String[]{"<html><body></body></html>"};
}
List<OrderDetail> foodList = DoshokuOrder.getInstance().getShoppingCart().getOrderCommodityList();
TableBean.DataBean tableBean = DoshokuOrder.getInstance().getOpenTableInfo();
......@@ -61,11 +81,58 @@ public class PrintSlip extends PrinterRoot {
getWholeLine() +
getHtmlFooter() + "</body></html>";
String[] pritContent = new String[1];
pritContent[0] = stringBuilder;
int printCount = getPrintCount(mContext);
String[] pritContent = new String[printCount];
for (int i = 0; i < printCount; i++) {
pritContent[i] = stringBuilder;
}
return pritContent;
}
private String getHtmlContent() {
List<HtmlLable> htmlLables = new ArrayList<>();
/**
* 頭部
*/
htmlLables.add(new HtmlLable(LABLE_DIV, mPrintSlipContent.getBrand(),
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_ALIGN, HtmlContract.value_align_center, HtmlContract.value_type_string),
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_FONT_SIZE, "28")));
htmlLables.add(new HtmlLable(LABLE_DIV, mPrintSlipContent.getResturantName(),
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_ALIGN, HtmlContract.value_align_center, HtmlContract.value_type_string),
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_FONT_SIZE, "28")));
/**
* 訂單
*/
String orderNum = "單號:";
if (TextUtil.isNotEmptyOrNullOrUndefined(DoshokuOrder.getInstance().getOrderNo())) {
orderNum = "單號:" + DoshokuOrder.getInstance().getOrderNo();
}
htmlLables.addAll(getRowInformation(new HtmlLable[]{new HtmlLable(LABLE_COLUMN, "餐檯:" + mPrintSlipContent.getTableName())}, 24));
htmlLables.addAll(getRowInformation(new HtmlLable[]{new HtmlLable(LABLE_COLUMN, "人數:" + mPrintSlipContent.getPerson())}, 24));
htmlLables.addAll(getRowInformation(new HtmlLable[]{new HtmlLable(LABLE_COLUMN, orderNum)}, 24));
htmlLables.addAll(getRowInformation(new HtmlLable[]{new HtmlLable(LABLE_COLUMN, "日期:" + TimeUtils.parseTimeRepeat(mPrintSlipContent.getCreateTime(), TimeUtils.DEFAULT_DATE_FORMAT))}, 24));
htmlLables.add(new HtmlLable(LABLE_P, HtmlContract.dividing_line));
/**
* 食品
*/
/**
* 賬單項
*/
/**
* 底部
*/
return getHtmlLables(htmlLables.toArray(new HtmlLable[htmlLables.size()]));
}
private String getPLable(String content) {
return "<p>" + content + "</p>";
}
......@@ -95,7 +162,7 @@ public class PrintSlip extends PrinterRoot {
layout.addView(getLine(mContext));
//訂單信息
layout.addView(getDiningTableOrderInfo(mContext, "餐檯:" + tableBean.getTableName(), "人數:" + doshokuOrder.getOpenTableInfo().getPerson(), "單號:" +doshokuOrder.getOrderNo(), "日期:" + TimeUtils.getCurrentTimeInString(TimeUtils.DEFAULT_DATE_FORMAT)));
layout.addView(getDiningTableOrderInfo(mContext, "餐檯:" + tableBean.getTableName(), "人數:" + doshokuOrder.getOpenTableInfo().getPerson(), "單號:" + doshokuOrder.getOrderNo(), "日期:" + TimeUtils.getCurrentTimeInString(TimeUtils.DEFAULT_DATE_FORMAT)));
layout.addView(getLine(mContext));
layout.addView(getDiningFoodList(mContext, foodList, printerDeviceBean, 0, true));
......
......@@ -16,13 +16,16 @@ import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.ColorRes;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.epson.epos2.printer.Printer;
import com.epson.epos2.printer.PrinterStatusInfo;
import com.epson.epos2.printer.ReceiveListener;
import com.gingersoft.gsa.cloud.common.constans.AppConstans;
import com.gingersoft.gsa.cloud.common.core.restaurant.ResturantInfoManager;
import com.joe.print.mvp.ui.adapter.BillAdapter;
import com.joe.print.mvp.ui.adapter.BillTypeAdapter;
......@@ -73,15 +76,21 @@ import com.joe.print.mvp.print.usb.UsbPrinterFinder;
import com.joe.print.mvp.print.utils.BBposPrint;
import com.joe.print.mvp.ui.adapter.BillItemAdapter;
import com.sunmi.peripheral.printer.InnerResultCallbcak;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import javax.inject.Inject;
import lombok.Getter;
import static com.joe.print.mvp.print.common.HtmlContract.LABLE_COLUMN;
import static com.joe.print.mvp.print.common.HtmlContract.LABLE_DIV;
import static com.joe.print.mvp.print.common.HtmlContract.LABLE_H2;
import static com.joe.print.mvp.print.common.HtmlContract.LABLE_H3;
import static com.joe.print.mvp.print.common.HtmlContract.LABLE_P;
......@@ -168,6 +177,7 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket
return null;
}
Map<String, List<Bitmap>> printBitmap = getPrintBitmap(mContext, deviceBean);
if (printBitmap != null) {
List<Bitmap> bitmapList = printBitmap.get("");
//根據打印次數,複製
if (bitmapList != null) {
......@@ -181,6 +191,8 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket
}
return printBitmap;
}
return null;
}
/**
* @param mContext
......@@ -1001,79 +1013,115 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket
/**
* 頭部
*/
htmlLables.addAll(getRowInformation(new HtmlLable(printContent.getBrand(), new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_ALIGN, HtmlContract.value_align_center))));
htmlLables.addAll(getRowInformation(new HtmlLable(printContent.getResturantName(), new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_ALIGN, HtmlContract.value_align_center))));
htmlLables.add(new HtmlLable(LABLE_P, HtmlContract.dividing_line_half + "外送" + HtmlContract.dividing_line_half));
htmlLables.add(new HtmlLable(LABLE_H3, printContent.getPayType(), new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_ALIGN, HtmlContract.value_align_center)));
htmlLables.add(new HtmlLable(LABLE_H3, printContent.getDeliveryTime()));
htmlLables.add(new HtmlLable(LABLE_DIV, printContent.getBrand(),
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_ALIGN, HtmlContract.value_align_center, HtmlContract.value_type_string),
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_FONT_SIZE, "28")));
htmlLables.add(new HtmlLable(LABLE_DIV, printContent.getResturantName(),
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_ALIGN, HtmlContract.value_align_center, HtmlContract.value_type_string),
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_FONT_SIZE, "28")));
htmlLables.add(new HtmlLable(LABLE_DIV, HtmlContract.dividing_line_half + printContent.getOrderType() + HtmlContract.dividing_line_half, new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_FONT_SIZE, "28")));
htmlLables.add(new HtmlLable(LABLE_DIV, printContent.getPayType(),
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_ALIGN, HtmlContract.value_align_center, HtmlContract.value_type_string),
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_FONT_SIZE, "35")));
// htmlLables.addAll(getRowInformation(new HtmlLable[]{new HtmlLable(LABLE_COLUMN, printContent.getDeliveryTime())}, 28));
htmlLables.add(new HtmlLable(LABLE_DIV, printContent.getDeliveryTime(), new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_FONT_SIZE, "26")));
/**
* 訂單信息
*/
htmlLables.add(new HtmlLable(LABLE_P, HtmlContract.dividing_line));
htmlLables.addAll(getRowInformation(new HtmlLable(printContent.getOrderNumber())));
htmlLables.add(new HtmlLable(LABLE_H3, printContent.getBillNumber()));
htmlLables.addAll(getRowInformation(new HtmlLable(printContent.getBillingTime())));
// htmlLables.add(new HtmlLable(LABLE_DIV, HtmlContract.dividing_line));
if (!TextUtils.isEmpty(printContent.getOrderNo())) {
htmlLables.addAll(getRowInformation(new HtmlLable[]{new HtmlLable(LABLE_COLUMN, printContent.getOrderNo())}, 26));
}
if (!TextUtils.isEmpty(printContent.getBillNo())) {
htmlLables.addAll(getRowInformation(new HtmlLable[]{new HtmlLable(LABLE_COLUMN, printContent.getBillNo())}, 26));
}
if (!TextUtils.isEmpty(printContent.getOrderTakeFoodCode())) {
htmlLables.addAll(getRowInformation(new HtmlLable[]{new HtmlLable(LABLE_COLUMN, printContent.getOrderTakeFoodCode())}, 48));
}
if (!TextUtils.isEmpty(printContent.getBillingTime())) {
htmlLables.addAll(getRowInformation(new HtmlLable[]{new HtmlLable(LABLE_COLUMN, printContent.getBillingTime())}, 24));
}
if (!TextUtil.isEmptyOrNullOrUndefined(printContent.getPayTime())) {
//支付時間
htmlLables.addAll(getRowInformation(new HtmlLable[]{new HtmlLable(LABLE_COLUMN, printContent.getPayTime())}, 24));
}
/**
* 食品信息
*/
htmlLables.add(new HtmlLable(LABLE_P, HtmlContract.dividing_line_half + "項目" + HtmlContract.dividing_line_half, new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_FONT_SIZE, "28")));
htmlLables.addAll(getBBPosFoodLineString(printContent.getFoodItemList(), deviceBean));
htmlLables.add(new HtmlLable(LABLE_P, HtmlContract.dividing_line));
/**
* 總金額,支付信息
*/
//賬單項(合計,送貨費)
List<PrintBillItem> billItemList = printContent.getBillItemList();
if (billItemList.size() > 0) {
for (PrintBillItem billItem : billItemList) {
htmlLables.addAll(getRowInformation(
new HtmlLable(billItem.getBillName()),
new HtmlLable(billItem.getBillAmount(), new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_OFFSET, HtmlContract.value_offset_last))));
htmlLables.addAll(getRowInformation(new HtmlLable[]{
new HtmlLable(LABLE_COLUMN, billItem.getBillName()),
new HtmlLable(LABLE_COLUMN, billItem.getBillAmount(), new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_OFFSET, HtmlContract.value_offset_last))}, 28));
}
htmlLables.add(new HtmlLable(LABLE_P, HtmlContract.dividing_line));
}
//總金額
htmlLables.addAll(getRowInformation(
new HtmlLable(printContent.getTotalAmountText(), new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_FONT_SIZE, font_size_total_amount)),
new HtmlLable(printContent.getTotalAmount(), new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_OFFSET, HtmlContract.value_offset_last), new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_FONT_SIZE, font_size_total_amount))));
htmlLables.addAll(getRowInformation(new HtmlLable[]{
new HtmlLable(LABLE_COLUMN, printContent.getTotalAmountText()),
new HtmlLable(LABLE_COLUMN, printContent.getTotalAmount(), new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_OFFSET, HtmlContract.value_offset_last))}, 35));
htmlLables.add(new HtmlLable(LABLE_P, HtmlContract.dividing_line));
if (printContent instanceof PrintTakeawayCheckoutContent) {
//TODO 外送結賬有支付方式
PrintTakeawayCheckoutContent takeawayCheckoutContent = (PrintTakeawayCheckoutContent) printContent;
//支付方式
List<PrintPayTypeItem> payTypeList = takeawayCheckoutContent.getPayTypeList();
if (payTypeList != null) {
for (PrintPayTypeItem payTypeItem : payTypeList) {
htmlLables.addAll(getRowInformation(
new HtmlLable(payTypeItem.getPayName(), new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_FONT_SIZE, font_size_pay_type)),
new HtmlLable(payTypeItem.getPayAmount(), new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_OFFSET, HtmlContract.value_offset_last), new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_FONT_SIZE, font_size_pay_type))));
if (!TextUtils.isEmpty(payTypeItem.getPayAmount())) {
htmlLables.addAll(getRowInformation(new HtmlLable[]{
new HtmlLable(LABLE_COLUMN, payTypeItem.getPayName()),
new HtmlLable(LABLE_COLUMN, payTypeItem.getPayAmount(), new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_OFFSET, HtmlContract.value_offset_last))}, 30));
}
}
}
htmlLables.add(new HtmlLable(LABLE_P, HtmlContract.dividing_line));
}
//支付金額
htmlLables.addAll(getRowInformation(
new HtmlLable(printContent.getPayAmountText(), new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_FONT_SIZE, font_size_pay_amuount)),
new HtmlLable(printContent.getPayAmount(), new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_OFFSET, HtmlContract.value_offset_last), new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_FONT_SIZE, font_size_pay_amuount))));
htmlLables.addAll(getRowInformation(new HtmlLable[]{
new HtmlLable(LABLE_COLUMN, printContent.getPayAmountText()),
new HtmlLable(LABLE_COLUMN, printContent.getPayAmount(), new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_OFFSET, HtmlContract.value_offset_last))}, 35));
htmlLables.add(new HtmlLable(LABLE_P, HtmlContract.dividing_line));
/**
* 會員積分
* 會員積分、配送信息
*/
htmlLables.addAll(getRowInformation(new HtmlLable(printContent.getMemberName())));
htmlLables.addAll(getRowInformation(new HtmlLable(printContent.getMemberNumber())));
htmlLables.addAll(getRowInformation(new HtmlLable(printContent.getMemberPhone())));
htmlLables.addAll(getRowInformation(new HtmlLable(printContent.getMemberOldPoints())));
htmlLables.addAll(getRowInformation(new HtmlLable(printContent.getMemberAddPoints())));
htmlLables.addAll(getRowInformation(new HtmlLable(printContent.getMemberNowPoints())));
/**
* 配送信息
*/
htmlLables.addAll(getRowInformation(new HtmlLable(printContent.getAdress())));
htmlLables.addAll(getRowInformation(new HtmlLable(printContent.getReceiver())));
htmlLables.addAll(getRowInformation(new HtmlLable(printContent.getPhone())));
return getHtmlLables((HtmlLable[]) htmlLables.toArray());
List<String> items = new ArrayList<>();
if (RestaurantExpandInfoUtils.getValue(ExpandConstant.PrintMemberInfo, false)) {
items.add(printContent.getMemberName());
items.add(printContent.getMemberNumber());
items.add(printContent.getMemberPhone());
items.add(printContent.getMemberOldPoints());
items.add(printContent.getMemberAddPoints());
items.add(printContent.getMemberNowPoints());
items.add(HtmlContract.dividing_line);
}
if (!TextUtils.isEmpty(printContent.getAdress())) {
items.add("地址: " + printContent.getAdress());
}
if (!TextUtils.isEmpty(printContent.getReceiver())) {
items.add(printContent.getReceiver());
}
items.add(printContent.getPhone());
for (String item : items) {
if (!TextUtils.isEmpty(item)) {
// htmlLables.addAll(getRowInformation(new HtmlLable[]{new HtmlLable(LABLE_COLUMN, item)}, 22));
htmlLables.add(new HtmlLable(LABLE_DIV, item, new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_FONT_SIZE, "24")));
}
}
return getHtmlLables(htmlLables.toArray(new HtmlLable[htmlLables.size()]));
}
......@@ -1086,6 +1134,11 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket
protected List<HtmlLable> getBBPosFoodLineString(List<PrintFoodItem> foodItemList, PrinterDeviceBean printerDeviceBean) {
int foodFontSize = 24;
int modifierFontSize = 24;
/**
* 0預設
* 1是
* 2否
*/
int foodIsBold = printerDeviceBean.getFoodIsBold();
int modifierIsBold = printerDeviceBean.getModifierIsBold();
int foodIsItalic = printerDeviceBean.getFoodIsItalic();
......@@ -1116,12 +1169,27 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket
String name = nameList.get(i);
int num = 0;
double price = -9999;
if (numList.size() > (i + 1)) {
int fontSize = 24;
boolean isBold = false;
boolean isItalic = false;
if (numList.size() > i) {
num = numList.get(i);
}
if (priceList.size() > (i + 1)) {
if (priceList.size() > i) {
price = priceList.get(i);
}
if (itemTypes.size() > i) {
int itemType = itemTypes.get(i);
if (itemType == 3) {
fontSize = modifierFontSize;
isBold = modifierIsBold == 1 ? true : false;
isItalic = modifierIsItalic == 1 ? true : false;
} else {
fontSize = foodFontSize;
isBold = foodIsBold == 1 ? true : false;
isItalic = foodIsItalic == 1 ? true : false;
}
}
List<String> name1s = PrintUtils.getFormatList(name, PrintUtils.foodNameSpace, PrintUtils.BBPOS_Chinese_Length);
if (name1s.size() > 1) {
//食品名需要獨佔一行,甚至換行顯示
......@@ -1130,16 +1198,16 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket
if (lines > 1) {
//大於一行
for (int j = 0; j < lines; j++) {
htmlLables.addAll(getRowFoodInformation(name));
htmlLables.addAll(getRowFoodInformation(name, fontSize, isBold, isItalic));
}
htmlLables.addAll(getRowFoodInformation(num, price));
htmlLables.addAll(getRowFoodInformation(num, price, fontSize, isBold, isItalic));
} else {
//一行
htmlLables.addAll(getRowFoodInformation(name));
htmlLables.addAll(getRowFoodInformation(num, price));
htmlLables.addAll(getRowFoodInformation(name, fontSize, isBold, isItalic));
htmlLables.addAll(getRowFoodInformation(num, price, fontSize, isBold, isItalic));
}
} else {
htmlLables.addAll(getRowFoodInformation(name, num, price));
htmlLables.addAll(getRowFoodInformation(name, num, price, fontSize, isBold, isItalic));
}
}
return htmlLables;
......@@ -1148,6 +1216,9 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket
protected String getHtmlLables(HtmlLable... lables) {
StringBuilder stringBuilder = new StringBuilder();
for (HtmlLable lable : lables) {
if (TextUtils.isEmpty(lable.getLablename()) || (!lable.getLablename().contains("row") && TextUtils.isEmpty(lable.getValue()))) {
continue;
}
if (lable.getLablename().contains("row") || lable.getLablename().contains("br")) {
//<row>,<br>標籤直接追加即可
stringBuilder.append(lable.getLablename());
......@@ -1172,45 +1243,49 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket
if (attributes.getValueType() == HtmlContract.value_type_string) {
stringBuilder.append("\"" + attributes.getAttributesVaule() + "\"");
} else {
if (StringUtils.isNumeric(attributesVaule)) {
// if (StringUtils.isNumeric(attributesVaule)) {
stringBuilder.append(attributes.getAttributesVaule());
} else {
stringBuilder.append("\"" + attributes.getAttributesVaule() + "\"");
}
// } else {
// stringBuilder.append("\"" + attributes.getAttributesVaule() + "\"");
// }
}
}
return stringBuilder.toString();
}
/**
* 獲取一行信息,多個column
* 獲取一行信息,多個column 可配置字體大小
*
* @param lables
* @param fontSize
* @return
*/
protected List<HtmlLable> getRowInformation(HtmlLable... lables) {
protected List<HtmlLable> getRowInformation(HtmlLable[] lables, int fontSize) {
List<HtmlLable> htmlLables = new ArrayList<>();
htmlLables.add(new HtmlLable(getRowLableStart()));
htmlLables.add(new HtmlLable(getRowLableStart(new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_FONT_SIZE, String.valueOf(fontSize)))));
if (lables != null) {
for (HtmlLable lable : lables) {
htmlLables.add(new HtmlLable(HtmlContract.LABLE_COLUMN, lable.getValue(), lable.getAttributesList()));
htmlLables.add(new HtmlLable(LABLE_COLUMN, lable.getValue(), lable.getAttributesList()));
}
}
htmlLables.add(new HtmlLable(getRowLableEnd()));
return htmlLables;
}
/**
* 獲取一行食品信息(食品名稱)
*
* @param name
* @return
*/
private List<HtmlLable> getRowFoodInformation(String name) {
private List<HtmlLable> getRowFoodInformation(String name, int fontSize, boolean isBold, boolean isItalic) {
List<HtmlLable> htmlLables = new ArrayList<>();
htmlLables.add(new HtmlLable(getRowLableStart()));
htmlLables.add(new HtmlLable(HtmlContract.LABLE_COLUMN, name));
htmlLables.add(new HtmlLable(getRowLableStart(new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_FONT_SIZE, String.valueOf(fontSize)))));
if (isBold) {
htmlLables.add(new HtmlLable(LABLE_COLUMN, name, new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_BOLD, HtmlContract.value_bold_1)));
} else {
htmlLables.add(new HtmlLable(LABLE_COLUMN, name));
}
htmlLables.add(new HtmlLable(getRowLableEnd()));
return htmlLables;
}
......@@ -1222,12 +1297,25 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket
* @param amount
* @return
*/
private List<HtmlLable> getRowFoodInformation(int num, double amount) {
private List<HtmlLable> getRowFoodInformation(int num, double amount, int fontSize, boolean isBold, boolean isItalic) {
List<HtmlLable> htmlLables = new ArrayList<>();
htmlLables.add(new HtmlLable(getRowLableStart()));
htmlLables.add(new HtmlLable(HtmlContract.LABLE_COLUMN, String.valueOf(num), new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_OFFSET, HtmlContract.value_offset_percentage_foodNum)));
htmlLables.add(new HtmlLable(getRowLableStart(new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_FONT_SIZE, String.valueOf(fontSize)))));
if (isBold) {
htmlLables.add(new HtmlLable(LABLE_COLUMN, String.valueOf(num),
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_BOLD, HtmlContract.value_bold_1),
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_OFFSET, HtmlContract.value_offset_percentage_foodNum)));
} else {
htmlLables.add(new HtmlLable(LABLE_COLUMN, String.valueOf(num),
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_OFFSET, HtmlContract.value_offset_percentage_foodNum)));
}
if (amount != -9999) {
htmlLables.add(new HtmlLable(HtmlContract.LABLE_COLUMN, String.valueOf(amount), new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_OFFSET, HtmlContract.value_offset_last)));
if (isBold) {
htmlLables.add(new HtmlLable(LABLE_COLUMN, AppConstans.CARSH_STR + amount,
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_BOLD, HtmlContract.value_bold_1),
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_OFFSET, HtmlContract.value_offset_last)));
} else {
htmlLables.add(new HtmlLable(LABLE_COLUMN, AppConstans.CARSH_STR + amount, new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_OFFSET, HtmlContract.value_offset_last)));
}
}
htmlLables.add(new HtmlLable(getRowLableEnd()));
return htmlLables;
......@@ -1241,13 +1329,30 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket
* @param amount
* @return
*/
private List<HtmlLable> getRowFoodInformation(String name, int num, double amount) {
private List<HtmlLable> getRowFoodInformation(String name, int num, double amount, int fontSize, boolean isBold, boolean isItalic) {
List<HtmlLable> htmlLables = new ArrayList<>();
htmlLables.add(new HtmlLable(getRowLableStart()));
htmlLables.add(new HtmlLable(HtmlContract.LABLE_COLUMN, name));
htmlLables.add(new HtmlLable(HtmlContract.LABLE_COLUMN, String.valueOf(num), new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_OFFSET, HtmlContract.value_offset_percentage_foodNum)));
htmlLables.add(new HtmlLable(getRowLableStart(new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_FONT_SIZE, String.valueOf(fontSize)))));
if (isBold) {
htmlLables.add(new HtmlLable(LABLE_COLUMN, name,
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_BOLD, HtmlContract.value_bold_1)));
} else {
htmlLables.add(new HtmlLable(LABLE_COLUMN, name));
}
if (isBold) {
htmlLables.add(new HtmlLable(LABLE_COLUMN, String.valueOf(num),
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_BOLD, HtmlContract.value_bold_1),
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_OFFSET, HtmlContract.value_offset_percentage_foodNum)));
} else {
htmlLables.add(new HtmlLable(LABLE_COLUMN, String.valueOf(num), new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_OFFSET, HtmlContract.value_offset_percentage_foodNum)));
}
if (amount != -9999) {
htmlLables.add(new HtmlLable(HtmlContract.LABLE_COLUMN, String.valueOf(amount), new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_OFFSET, HtmlContract.value_offset_last)));
if (isBold) {
htmlLables.add(new HtmlLable(LABLE_COLUMN, AppConstans.CARSH_STR + amount,
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_BOLD, HtmlContract.value_bold_1),
new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_OFFSET, HtmlContract.value_offset_last)));
} else {
htmlLables.add(new HtmlLable(LABLE_COLUMN, AppConstans.CARSH_STR + amount, new HtmlLable.Attributes(HtmlContract.ATTRIBUTES_OFFSET, HtmlContract.value_offset_last)));
}
}
htmlLables.add(new HtmlLable(getRowLableEnd()));
return htmlLables;
......
......@@ -23,11 +23,13 @@ public class HtmlContract {
public static final String ATTRIBUTES_ALIGN = "align";
public static final String ATTRIBUTES_BOLD = "bold";
public static final String ATTRIBUTES_SCALE = "scale";
public static final String ATTRIBUTES_FONT_SIZE = "font-size";
public static final String ATTRIBUTES_FONT_SIZE = "size";
public static final String value_offset_last = "last";
public static final String value_offset_percentage70 = "0.7";
public static final String value_offset_percentage60 = "0.6";
public static final String value_offset_percentage65 = "0.65";
public static final String value_offset_percentage50 = "0.5";
public static final String value_offset_percentage40 = "0.4";
public static final String value_offset_percentage30 = "0.3";
......@@ -36,15 +38,14 @@ public class HtmlContract {
public static final String value_offset_percentage_foodNum = "0.6";
public static final String value_bold_1 = "1";
public static final String value_scale_1 = "2";
public static final String value_align_center = "center";
public static final String value_align_right = "right";
public static final byte value_type_default = 0;
public static final byte value_type_string = 1;
public static final String dividing_line="-----------------------------------------------------------------";
public static final String dividing_line_half="---------------------------------";
public static final String dividing_line_half="------------------";
}
......@@ -138,7 +138,7 @@ public class TablePresenter extends BasePresenter<TableContract.Model, TableCont
public TablePresenter(TableContract.Model model, TableContract.View rootView) {
super(model, rootView);
this.IActivity = (TableActivity) rootView;
XFunctionManager.newInstance().inJect(this, FunctionTable.class);
XFunctionManager.inJect(this, FunctionTable.class);
startTablePolling();
}
......
......@@ -344,7 +344,8 @@ public class MealStandActivity extends BaseFragmentActivity<MealStandPresenter>
DoshokuOrder.getInstance().setOpenTableInfo(tableBean);
btn_send_order.setText("送單信息");
} else {
if (DoshokuOrder.getInstance().getOpenTableInfo().getPerson() == 0) {
boolean openTableAutoShowKeyboard = GsaCloudApplication.functionConfiguration.getOpenTableAutoShowKeyboardVaule();
if (openTableAutoShowKeyboard && DoshokuOrder.getInstance().getOpenTableInfo().getPerson() == 0) {
showChoosePeopleNumDialog(false);
}
}
......
......@@ -9,7 +9,9 @@ import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import com.billy.cc.core.component.CC;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.common.core.user.UserContext;
import com.gingersoft.gsa.cloud.common.core.member.MemberInfo;
import com.gingersoft.gsa.cloud.common.core.pay.PayMethod;
......
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