Commit 6781f282 by Wyh

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	component-print/src/main/java/com/joe/print/mvp/print/EpsonPrint.java
#	component-print/src/main/java/com/joe/print/mvp/print/PrinterRoot.java
#	component-print/src/main/java/com/joe/print/mvp/print/service/PrjService.java
#	component-print/src/main/java/com/joe/print/mvp/ui/activity/PrintActivity.java
#	library-common/src/main/java/com/gingersoft/gsa/cloud/app/GsaCloudApplication.java
#	library-print/src/main/java/com/gingersoft/gsa/cloud/print/PrintSocketHolder.java
parents 23c33633 9a060bbb
......@@ -53,8 +53,6 @@ dependencies {
annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]
implementation rootProject.ext.dependencies["constraintlayout"]
implementation 'org.jetbrains:annotations:15.0'
//日誌管理
implementation 'com.elvishew:xlog:1.6.1'
//lombok
implementation 'org.projectlombok:lombok:1.18.10'
annotationProcessor 'org.projectlombok:lombok:1.18.10'
......
package com.gingersoft.gsa.delivery_pick_mode.data.network
import com.gingersoft.gsa.cloud.common.config.OkHttpConfig
import com.gingersoft.gsa.cloud.common.config.globalconfig.applyOptions.intercept.HeadersInterceptor
import com.gingersoft.gsa.cloud.common.config.globalconfig.applyOptions.intercept.LoggingInterceptor
import com.gingersoft.gsa.cloud.common.constans.HttpsConstans
import com.gingersoft.gsa.cloud.common.constans.HttpsConstans.ROOT_SERVER
import com.gingersoft.gsa.cloud.common.constans.HttpsConstans.URK_RICEPON_GSA
import com.jess.arms.http.log.RequestInterceptor
import okhttp3.Cache
import okhttp3.OkHttpClient
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.converter.scalars.ScalarsConverterFactory
import java.io.File
import java.util.concurrent.TimeUnit
object ServiceCreator {
......@@ -19,6 +22,7 @@ object ServiceCreator {
.callTimeout(30, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)
.writeTimeout(30, TimeUnit.SECONDS)
.cache(Cache(File(OkHttpConfig.CACHE_DIRECTORY), OkHttpConfig.CACHE_MAXSIZE))
.addInterceptor(RequestInterceptor())
.addInterceptor(HeadersInterceptor())
.addInterceptor(LoggingInterceptor())
......
......@@ -28,7 +28,6 @@ import com.epson.epos2.printer.PrinterStatusInfo;
import com.epson.epos2.printer.ReceiveListener;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.common.constans.AppConstans;
import com.gingersoft.gsa.cloud.common.constans.DeliveryPickConstans;
import com.gingersoft.gsa.cloud.common.constans.ExpandConstant;
import com.gingersoft.gsa.cloud.common.constans.PrintConstans;
import com.gingersoft.gsa.cloud.common.core.delivery.OrderDetails;
......@@ -38,8 +37,8 @@ import com.gingersoft.gsa.cloud.common.logan.LoganManager;
import com.gingersoft.gsa.cloud.common.printer.AidlUtil;
import com.gingersoft.gsa.cloud.common.printer.plugins.PrinterPlugins;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.log.LogUtil;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.common.utils.threadPool.ThreadPoolManager;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.common.utils.view.ImageUtils;
import com.gingersoft.gsa.cloud.common.utils.view.LayoutToBitmapUtils;
......@@ -56,7 +55,6 @@ import com.gingersoft.gsa.cloud.print.bean.UpdateBean;
import com.gingersoft.gsa.cloud.print.bean.base.PrintBillItem;
import com.gingersoft.gsa.cloud.print.bean.base.PrintFoodItem;
import com.gingersoft.gsa.cloud.print.bean.base.PrintPayTypeItem;
import com.gingersoft.gsa.cloud.print.impl.OnPrjPrintResultListener;
import com.google.zxing.WriterException;
import com.hyweb.n5.lib.constant.PrinterConstant;
import com.hyweb.n5.lib.util.PrinterUtil;
......@@ -109,7 +107,6 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintExecut
private final static int N5_PAPER_WIDTH = 500;//N5打印機紙張寬度
final static String DELIMITER = "/";//將打印位置區分開來。。。。,暫時只有廚房單用到
// private PrintListener printListener;
private static SparseArray<PrinterRoot> mPrinterStrategy = new SparseArray<>();
......@@ -143,10 +140,6 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintExecut
protected void setPrintContent(T printContent) {
}
// public PrinterRoot setPrintListener(PrintListener printListener) {
// this.printListener = printListener;
// return this;
// }
/**
* 把Map中Key相同,则各个value添加到一起,汇总值
......@@ -178,7 +171,6 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintExecut
*/
public Map<String, List<Bitmap>> getPrintBitmapByCount(Context mContext, PrinterDeviceBean deviceBean) {
int printCount = getPrintCount(mContext);
LogUtil.e("eee", "打印次數" + printCount);
if (printCount <= 0) {
return null;
}
......@@ -237,7 +229,8 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintExecut
//打印結果示例:<?xml version="1.0" encoding= "UTF-8" ?><WAPIResult><status>SUCCESS</status><requestType>PRINT</requestType><state>IDLE</state><systemInfo><appVersion>1.22.4.4.007</appVersion><OSVersion>9</OSVersion><ip>192.168.1.162</ip><mac>2059a018d3d6</mac><serialNumber>WSS503013000075</serialNumber><firmware>WSS50.501-02 (5.00.01.02.beta7)</firmware><hardware></hardware><terminalConfig>GNZZ_MTIPD_v13_with_AE_v1</terminalConfig><key>034040XXXXXXXXXXXXXX</key><bootloader>6.00.00.20 (6.00.00.34)</bootloader></systemInfo><timestamp>1601021267673</timestamp></WAPIResult>
new BBposPrint().print(BBPosPrintDatas, false);
} else {
printFailure("暫不支持本機型打印", UpdateBean.FAIL_LOCAL_PRINT_NOT_DEVICE);
// listener.printFailure("暫不支持本機型打印");
PrinterFlowProxy.newInstance().dispatchConnectionError(new Exception("暫不支持本機型打印"));
}
}
......@@ -267,7 +260,7 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintExecut
*/
private void sunmiPrint(List<Bitmap> bitmaps) {
//商米打印
PrinterPlugins.getOnPrinterFlowHandler().connectionSuccess();
PrinterFlowProxy.newInstance().dispatchConnectionSuccess();
AidlUtil.getInstance().printBitmaps(bitmaps, SUNMI_PAPER_WIDTH, new InnerResultCallbcak() {
@Override
public void onRunResult(boolean isSuccess) {
......@@ -287,14 +280,14 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintExecut
@Override
public void onRaiseException(int code, String msg) {
//接⼝执⾏失败时,返回的异常状态
PrinterPlugins.getOnPrinterFlowHandler().onPrintError(new Exception(msg), code);
PrinterFlowProxy.newInstance().dispatchPrintError(new Exception(msg), code);
LoganManager.w_printer(TAG, "商米onRaiseException: " + code + msg);
}
@Override
public void onPrintResult(int code, String msg) {
//事务模式下真实的打印结果返回
PrinterPlugins.getOnPrinterFlowHandler().onPrintSuccess();
PrinterFlowProxy.newInstance().dispatchPrintSuccess();
}
});
}
......@@ -308,7 +301,7 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintExecut
if (i == 0) {
//打印成功
printSuccess();
PrinterPlugins.getOnPrinterFlowHandler().onPrintSuccess();
PrinterFlowProxy.newInstance().dispatchPrintSuccess();
} else {
//打印失敗
printFailure("打印失敗", i);
......@@ -661,7 +654,6 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintExecut
tvTakeFoodCode.setText("訂單碼:" + data.getTakeFoodCode());
}
if (data.getTakeFoodCode() == null || data.getTakeFoodCode().equals("0")) {
LogUtil.e("eee", "訂單碼:" + data.getTakeFoodCode());
tvTakeFoodCode.setVisibility(View.GONE);
}
......
......@@ -18,7 +18,7 @@ import com.gingersoft.gsa.cloud.common.constans.PrintConstans;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.logan.LoganManager;
import com.gingersoft.gsa.cloud.common.printer.AidlUtil;
import com.gingersoft.gsa.cloud.common.printer.plugins.PrinterPlugins;
import com.gingersoft.gsa.cloud.common.printer.plugins.PrinterFlowProxy;
import com.gingersoft.gsa.cloud.common.utils.JsonUtils;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.okhttpUtils.OkHttp3Utils;
......@@ -308,7 +308,7 @@ public class PrjPtinterManager implements ReceiveListener {
if (beans != null && beans.size() > 0) {
orderType = beans.get(0).getOrderType();
}
PrinterPlugins.getOnPrinterFlowHandler().onPrinterDataBefore(orderType, PrintConstans.PRINT_KITCHEN, GsonUtils.GsonString(beans), GsonUtils.GsonString(printerDeviceBean));
PrinterFlowProxy.newInstance().dispatchPrinterDataBefore(orderType, PrintConstans.PRINT_KITCHEN, GsonUtils.GsonString(beans), GsonUtils.GsonString(printerDeviceBean));
if (isPinPrinter(printerDeviceBean) && printerDeviceBean.getPrinterDeviceType() == PRINT_IP) {
//針式打印
......@@ -457,11 +457,11 @@ public class PrjPtinterManager implements ReceiveListener {
boolean initResult = EpsonPrint.getInstance().initializeObject(mContext, this, this::updatePrjState);
if (!initResult) {
//初始化打印機失敗
PrinterPlugins.getOnPrinterFlowHandler().connectionError(new ConnectException("初始化針式打印機失敗"));
PrinterFlowProxy.newInstance().dispatchConnectionError(new ConnectException("初始化針式打印機失敗"));
updatePrjState(UpdateBean.FAIL_EPSON_INIT, getPrintIds(bitmapMaps));
return;
}
PrinterPlugins.getOnPrinterFlowHandler().connectionBefore("針式打印機" + bitmapMaps.size(), printerDeviceBean.getIp(), printerDeviceBean.getPort(), 0, 0);
PrinterFlowProxy.newInstance().dispatchConnectionBefore("針式打印機" + bitmapMaps.size(), printerDeviceBean.getIp(), printerDeviceBean.getPort(), 0, 0);
Log.d("eee", "針式打印機本次PRJ數量:" + bitmapMaps.size());
for (int i = 0; i < bitmapMaps.size(); i++) {
for (Map.Entry<String, Bitmap> mapEntry : bitmapMaps.get(i).entrySet()) {
......@@ -506,10 +506,10 @@ public class PrjPtinterManager implements ReceiveListener {
UsbPrint usbPrint = new UsbPrint(mContext, (code, printId) -> {
//打印結果
if (code == SendResultCode.SEND_SUCCESS) {
PrinterPlugins.getOnPrinterFlowHandler().onPrintSuccess();
PrinterFlowProxy.newInstance().dispatchPrintSuccess();
updatePrjSuccess(key);
} else if (code == SendResultCode.SEND_FAILED) {
PrinterPlugins.getOnPrinterFlowHandler().onPrintError(new Exception("發送打印數據失敗"), code);
PrinterFlowProxy.newInstance().dispatchPrintError(new Exception("發送打印數據失敗"), code);
updatePrjFailure(key);
}
});
......@@ -620,7 +620,7 @@ public class PrjPtinterManager implements ReceiveListener {
@Override
public void onRaiseException(int code, String msg) {
//接⼝执⾏失败时,返回的异常状态
PrinterPlugins.getOnPrinterFlowHandler().onPrintError(new Exception(msg), code);
PrinterFlowProxy.newInstance().dispatchPrintError(new Exception(msg), code);
LoganManager.w_printer(TAG, "商米onRaiseException: " + code + msg);
switch (code) {
case 3:
......@@ -683,7 +683,7 @@ public class PrjPtinterManager implements ReceiveListener {
updatePrjSuccess(ids);
} else {
//打印失敗
PrinterPlugins.getOnPrinterFlowHandler().onPrintError(new Exception(UpdateBean.getStateByCode(i)), i);
PrinterFlowProxy.newInstance().dispatchPrintError(new Exception(UpdateBean.getStateByCode(i)), i);
updatePrjState(i, ids);
}
}
......@@ -696,7 +696,7 @@ public class PrjPtinterManager implements ReceiveListener {
});
} catch (RemoteException e) {
e.printStackTrace();
PrinterPlugins.getOnPrinterFlowHandler().onPrintError(e, i);
PrinterFlowProxy.newInstance().dispatchPrintError(e, i);
LoganManager.w_printer(TAG, "N5 RemoteException :" + e.getLocalizedMessage());
updatePrjFailure(ids);
}
......@@ -765,7 +765,7 @@ public class PrjPtinterManager implements ReceiveListener {
bitmapList.add(bitmapIterator.next().getValue());
}
}
PrinterPlugins.getOnPrinterFlowHandler().onPrinterBitmapBefore(orderType, PrintConstans.PRINT_KITCHEN, prjName, bitmapList);
PrinterFlowProxy.newInstance().dispatchPrinterBitmapBefore(orderType, PrintConstans.PRINT_KITCHEN, prjName, bitmapList);
}
}
......@@ -840,11 +840,11 @@ public class PrjPtinterManager implements ReceiveListener {
public void onPtrReceive(Printer printer, int i, PrinterStatusInfo printerStatusInfo, String s) {
//針式打印回調
if (i == 0) {
PrinterPlugins.getOnPrinterFlowHandler().onPrintSuccess();
PrinterFlowProxy.newInstance().dispatchPrintSuccess();
//打印成功
updatePrjSuccess(s);
} else {
PrinterPlugins.getOnPrinterFlowHandler().onPrintError(new Exception("打印失敗"), i);
PrinterFlowProxy.newInstance().dispatchPrintError(new Exception("打印失敗"), i);
//打印失敗
updatePrjFailure(s);
}
......
......@@ -15,14 +15,13 @@ import androidx.annotation.Nullable;
import com.epson.epos2.printer.Printer;
import com.epson.epos2.printer.PrinterStatusInfo;
import com.epson.epos2.printer.ReceiveListener;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.constans.HttpsConstans;
import com.gingersoft.gsa.cloud.common.constans.PrintConstans;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.core.user.UserContext;
import com.gingersoft.gsa.cloud.common.logan.LoganManager;
import com.gingersoft.gsa.cloud.common.printer.AidlUtil;
import com.gingersoft.gsa.cloud.common.printer.plugins.PrinterPlugins;
import com.gingersoft.gsa.cloud.common.printer.plugins.PrinterFlowProxy;
import com.gingersoft.gsa.cloud.common.utils.JsonUtils;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.log.LogUtil;
......@@ -55,7 +54,6 @@ import com.joe.print.mvp.print.utils.MyPrintUtils;
import com.sunmi.peripheral.printer.InnerResultCallbcak;
import com.xuexiang.rxutil2.rxjava.RxJavaUtils;
import org.jetbrains.annotations.NotNull;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
......@@ -397,7 +395,7 @@ public class PrjService extends Service implements ReceiveListener {
PrinterPlugins.getOnPrinterFlowHandler().onPrintError(new Exception("prj解析數據為空:" + GsonUtils.GsonString(beans)), UpdateBean.FAIL_PRINT_BY_NOT_PRINT_INFO);
return;
}
PrinterPlugins.getOnPrinterFlowHandler().onPrinterDataBefore(orderType, PrintConstans.PRINT_KITCHEN, GsonUtils.GsonString(beans), GsonUtils.GsonString(printerDeviceBean));
PrinterFlowProxy.newInstance().dispatchPrinterDataBefore(orderType, PrintConstans.PRINT_KITCHEN, GsonUtils.GsonString(beans), GsonUtils.GsonString(printerDeviceBean));
if (isPinPrinter(printerDeviceBean) && printerDeviceBean.getPrinterDeviceType() == PRINT_IP) {
//針式打印
......@@ -545,13 +543,13 @@ public class PrjService extends Service implements ReceiveListener {
boolean initResult = EpsonPrint.getInstance().initializeObject(this, this, this::updatePrjState);
if (!initResult) {
//初始化打印機失敗
PrinterPlugins.getOnPrinterFlowHandler().connectionError(new ConnectException("初始化針式打印機失敗"));
LogUtil.e("eee", "prj初始化打印失敗" + getPrintIds(bitmapMaps));
PrinterFlowProxy.newInstance().dispatchConnectionError(new ConnectException("初始化針式打印機失敗"));
updatePrjState(UpdateBean.FAIL_EPSON_INIT, getPrintIds(bitmapMaps));
return;
}
PrinterPlugins.getOnPrinterFlowHandler().connectionBefore("針式打印機" + bitmapMaps.size(), printerDeviceBean.getIp(), printerDeviceBean.getPort(), 0, 0);
LogUtil.d("eee", "針式打印機本次PRJ數量:" + bitmapMaps.size());
PrinterFlowProxy.newInstance().dispatchConnectionBefore("針式打印機" + bitmapMaps.size(), printerDeviceBean.getIp(), printerDeviceBean.getPort(), 0, 0);
for (int i = 0; i < bitmapMaps.size(); i++) {
for (Map.Entry<String, Bitmap> mapEntry : bitmapMaps.get(i).entrySet()) {
EpsonPrint.getInstance().putPrintData(printerDeviceBean.getIp(), mapEntry.getValue(), mapEntry.getKey());
......@@ -595,10 +593,10 @@ public class PrjService extends Service implements ReceiveListener {
UsbPrint usbPrint = new UsbPrint(mContext, (code, printId) -> {
//打印結果
if (code == SendResultCode.SEND_SUCCESS) {
PrinterPlugins.getOnPrinterFlowHandler().onPrintSuccess();
PrinterFlowProxy.newInstance().dispatchPrintSuccess();
updatePrjSuccess(key);
} else if (code == SendResultCode.SEND_FAILED) {
PrinterPlugins.getOnPrinterFlowHandler().onPrintError(new Exception("發送打印數據失敗"), code);
PrinterFlowProxy.newInstance().dispatchPrintError(new Exception("發送打印數據失敗"), code);
updatePrjFailure(key);
}
});
......@@ -709,7 +707,7 @@ public class PrjService extends Service implements ReceiveListener {
@Override
public void onRaiseException(int code, String msg) {
//接⼝执⾏失败时,返回的异常状态
PrinterPlugins.getOnPrinterFlowHandler().onPrintError(new Exception(msg), code);
PrinterFlowProxy.newInstance().dispatchPrintError(new Exception(msg), code);
LoganManager.w_printer(TAG, "商米onRaiseException: " + code + msg);
switch (code) {
case 3:
......@@ -772,7 +770,7 @@ public class PrjService extends Service implements ReceiveListener {
updatePrjSuccess(ids);
} else {
//打印失敗
PrinterPlugins.getOnPrinterFlowHandler().onPrintError(new Exception(UpdateBean.getStateByCode(i)), i);
PrinterFlowProxy.newInstance().dispatchPrintError(new Exception(UpdateBean.getStateByCode(i)), i);
updatePrjState(i, ids);
}
}
......@@ -785,7 +783,7 @@ public class PrjService extends Service implements ReceiveListener {
});
} catch (RemoteException e) {
e.printStackTrace();
PrinterPlugins.getOnPrinterFlowHandler().onPrintError(e, i);
PrinterFlowProxy.newInstance().dispatchPrintError(e, i);
LoganManager.w_printer(TAG, "N5 RemoteException :" + e.getLocalizedMessage());
updatePrjFailure(ids);
}
......@@ -1033,7 +1031,7 @@ public class PrjService extends Service implements ReceiveListener {
bitmapList.add(bitmapIterator.next().getValue());
}
}
PrinterPlugins.getOnPrinterFlowHandler().onPrinterBitmapBefore(orderType, PrintConstans.PRINT_KITCHEN, prjName, bitmapList);
PrinterFlowProxy.newInstance().dispatchPrinterBitmapBefore(orderType, PrintConstans.PRINT_KITCHEN, prjName, bitmapList);
}
}
......@@ -1112,13 +1110,14 @@ public class PrjService extends Service implements ReceiveListener {
LogUtil.e("eee", "prj針式打印結果" + i);
//針式打印回調
if (i == 0) {
PrinterPlugins.getOnPrinterFlowHandler().onPrintSuccess();
PrinterFlowProxy.newInstance().dispatchPrintSuccess();
//打印成功
updatePrjSuccess(s);
} else {
PrinterPlugins.getOnPrinterFlowHandler().onPrintError(new Exception("打印失敗"), i);
PrinterFlowProxy.newInstance().dispatchPrintError(new Exception("打印失敗"), i);
//打印失敗
updatePrjFailure(s);
}
startGetPrjInfo();
}
}
package com.joe.print.mvp.ui.activity;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Build;
......@@ -19,24 +22,26 @@ import com.gingersoft.gsa.cloud.common.logan.LoganManager;
import com.gingersoft.gsa.cloud.common.printer.plugins.PrinterFlowListener;
import com.gingersoft.gsa.cloud.common.printer.plugins.PrinterPlugins;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.log.LogUtil;
import com.gingersoft.gsa.cloud.common.utils.other.SPUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils;
import com.gingersoft.gsa.cloud.database.bean.PrintCurrencyBean;
import com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean;
import com.gingersoft.gsa.cloud.database.utils.FoodModifierDaoUtils;
import com.gingersoft.gsa.cloud.print.PrintExecutor;
import com.gingersoft.gsa.cloud.print.PrintSocketHolder;
import com.gingersoft.gsa.cloud.print.bean.PrintContent;
import com.gingersoft.gsa.cloud.print.bean.PrjBean;
import com.gingersoft.gsa.cloud.print.bean.UpdateBean;
import com.jess.arms.base.BaseActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.integration.AppManager;
import com.jess.arms.utils.ArmsUtils;
import com.joe.print.di.component.DaggerPrintComponent;
import com.joe.print.mvp.contract.PrintContract;
import com.joe.print.mvp.presenter.PrintPresenter;
import com.joe.print.mvp.print.EpsonPrint;
import com.joe.print.mvp.print.PrintInstruction;
import com.joe.print.mvp.print.PrintListener;
import com.joe.print.mvp.print.PrintPrjKitchen;
import com.joe.print.mvp.print.PrinterRoot;
import com.joe.print.mvp.print.maker.OpenCashBoxMaker;
......@@ -44,11 +49,16 @@ import com.joe.print.mvp.print.utils.MyPrintUtils;
import com.joe.print.mvp.ui.view.PrinterLoadingDialog;
import com.joe.print.mvp.ui.view.SelectPrintDevicePopup;
import com.lxj.xpopup.XPopup;
import com.xuexiang.rxutil2.rxjava.RxJavaUtils;
import java.net.ConnectException;
import java.util.List;
import java.util.Map;
import java.util.TimerTask;
import javax.inject.Inject;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import static com.gingersoft.gsa.cloud.common.constans.PrintConstans.PRINT_BILL;
......@@ -120,7 +130,8 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
@Override
public void initData(@Nullable Bundle savedInstanceState) {
PrinterPlugins.setOnPrinterFlowHandler(new PrinterFlowListener() {
PrinterFlowProxy.newInstance().registerPrinterFlowListener(new PrinterFlowListener() {
@Override
public void connectionBefore(String deviceName, String IP, int port, long ioTimeout, long printTimeout) {
......@@ -128,13 +139,11 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
@Override
public void connectionSuccess() {
LoganManager.w_code(TAG, "PrinterPlugins connectionSuccess ThreadName=" + Thread.currentThread().getName());
printerLoadingDialog.setStep(PrinterLoadingDialog.PROGRESS_PRINTING, PrinterLoadingDialog.STATUS_SUCCESS, null);
}
@Override
public void connectionError(Exception e) {
LoganManager.w_code(TAG, "PrinterPlugins connectionError ThreadName=" + Thread.currentThread().getName());
printerResult = false;
printerLoadingDialog.setStep(PrinterLoadingDialog.PROGRESS_PRINTING, PrinterLoadingDialog.STATUS_ERROR, e.getMessage());
}
......@@ -145,19 +154,16 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
@Override
public void onPrinterDataBefore(int orderType, int printType, String printerData, String printerDeviceInfo) {
LoganManager.w_code(TAG, "PrinterPlugins onPrinterDataBefore ThreadName=" + Thread.currentThread().getName());
printerLoadingDialog.setStep(PrinterLoadingDialog.PROGRESS_CONNECTING, PrinterLoadingDialog.STATUS_SUCCESS, null);
}
@Override
public void onPrinterBitmapBefore(int orderType, int printType, String directoryName, List<Bitmap> bitmaps) {
LoganManager.w_code(TAG, "PrinterPlugins onPrinterBitmapBefore ThreadName=" + Thread.currentThread().getName());
printerLoadingDialog.setStep(PrinterLoadingDialog.PROGRESS_CONNECTING, PrinterLoadingDialog.STATUS_SUCCESS, null);
}
@Override
public void onPrintSuccess() {
LoganManager.w_code(TAG, "PrinterPlugins onPrintSuccess ThreadName=" + Thread.currentThread().getName());
printerResult = true;
printerLoadingDialog.setStep(PrinterLoadingDialog.PROGRESS_RESULT, PrinterLoadingDialog.STATUS_SUCCESS, null);
printSuccess();
......@@ -165,9 +171,8 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
@Override
public void onPrintError(Exception e, int errorCode) {
LoganManager.w_code(TAG, "PrinterPlugins onPrintError ThreadName=" + Thread.currentThread().getName());
printerResult = true;
printerLoadingDialog.setStep(PrinterLoadingDialog.PROGRESS_PRINTING, PrinterLoadingDialog.STATUS_ERROR, e.getMessage());
printerResult = false;
printerLoadingDialog.setStep(PrinterLoadingDialog.PROGRESS_RESULT, PrinterLoadingDialog.STATUS_ERROR, e.getMessage());
//延遲兩秒關閉
RxJavaUtils.delay(2, aLong -> {
LogUtil.e("eee", "打印失敗");
......@@ -234,7 +239,9 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
private void initPrintConfig(PrintContent printContent) {
//開始
PrinterPlugins.getOnPrinterFlowHandler().onPrinterDataBefore(type, type, GsonUtils.GsonString(printContent), GsonUtils.GsonString(defaultPrint));
PrinterPlugins.getOnPrinterFlowHandler().dispatchPrinterDataBefore(type, type, GsonUtils.GsonString(printContent), GsonUtils.GsonString(defaultPrint));
PrinterFlowProxy.newInstance().dispatchPrinterDataBefore(type, type, GsonUtils.GsonString(printContent), GsonUtils.GsonString(defaultPrint));
//獲取通用打印配置
PrintCurrencyBean printCurrencyBean = getCurrencyConfig();
......@@ -410,7 +417,7 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
private void setPrinterBitmapToLocation(int orderType, int printType, String orderNo, Map<String, List<Bitmap>> bitmapMaps) {
if (bitmapMaps.size() > 0 && bitmapMaps.get("") != null) {
String prjName = orderNo + "-" + System.currentTimeMillis();
PrinterPlugins.getOnPrinterFlowHandler().onPrinterBitmapBefore(orderType, printType, prjName, bitmapMaps.get(""));
PrinterFlowProxy.newInstance().dispatchPrinterBitmapBefore(orderType, printType, prjName, bitmapMaps.get(""));
}
}
......@@ -523,9 +530,9 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
@Override
public void killMyself() {
if (printerResult) {
finish();
}
// if (printerResult) {
finish();
// }
}
@Override
......
......@@ -2,12 +2,15 @@ package com.gingersoft.gsa.cloud.table.mvp.contract;
import android.app.Activity;
import com.gingersoft.gsa.cloud.database.bean.Modifier;
import com.jess.arms.base.DefaultAdapter;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
import androidx.recyclerview.widget.RecyclerView;
import java.util.List;
/**
* ================================================
......@@ -43,5 +46,13 @@ public interface FineItemAllContract {
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
List<Modifier> queryDB_ModifierByModMsgAndVisibleQueryBuilder();
List<Modifier> queryDB_ModifierByModModTasteVisibleQueryBuilder();
List<Modifier> queryDB_ModifierByModModCommVisibleQueryBuilder();
List<Modifier> queryDB_ModifierByTopidAndVisibleQueryBuilder(long fid);
}
}
......@@ -2,12 +2,17 @@ package com.gingersoft.gsa.cloud.table.mvp.model;
import android.app.Application;
import com.gingersoft.gsa.cloud.database.bean.Modifier;
import com.gingersoft.gsa.cloud.database.utils.ModifierDaoUtils;
import com.gingersoft.gsa.cloud.table.mvp.contract.FineItemAllContract;
import com.gingersoft.gsa.cloud.table.mvp.model.utils.MealStyleUtils;
import com.google.gson.Gson;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import java.util.List;
import javax.inject.Inject;
......@@ -41,4 +46,33 @@ public class FineItemAllModel extends BaseModel implements FineItemAllContract.M
this.mGson = null;
this.mApplication = null;
}
@Override
public List<Modifier> queryDB_ModifierByModMsgAndVisibleQueryBuilder() {
//获取数据
ModifierDaoUtils modifierDaoUtils = new ModifierDaoUtils(mApplication);
List<Modifier> modifierList = modifierDaoUtils.queryModifierByModMsgAndVisibleQueryBuilder();
return MealStyleUtils.assemblyModifiersColor(modifierList);
}
@Override
public List<Modifier> queryDB_ModifierByModModTasteVisibleQueryBuilder() {
ModifierDaoUtils modifierDaoUtils = new ModifierDaoUtils(mApplication);
List<Modifier> modifierList = modifierDaoUtils.queryModifierByModModTasteVisibleQueryBuilder();
return MealStyleUtils.assemblyModifiersColor(modifierList);
}
@Override
public List<Modifier> queryDB_ModifierByModModCommVisibleQueryBuilder() {
ModifierDaoUtils modifierDaoUtils = new ModifierDaoUtils(mApplication);
List<Modifier> modifierList = modifierDaoUtils.queryModifierByModModCommVisibleQueryBuilder();
return MealStyleUtils.assemblyModifiersColor(modifierList);
}
@Override
public List<Modifier> queryDB_ModifierByTopidAndVisibleQueryBuilder(long fid) {
ModifierDaoUtils modifierDaoUtils = new ModifierDaoUtils(mApplication);
List<Modifier> modifierList = modifierDaoUtils.queryModifierByTopidAndVisibleQueryBuilder(fid);
return MealStyleUtils.assemblyModifiersColor(modifierList);
}
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ import com.gingersoft.gsa.cloud.database.bean.Modifier;
import com.gingersoft.gsa.cloud.database.utils.ComboItemDaoUtils;
import com.gingersoft.gsa.cloud.database.utils.ModifierDaoUtils;
import com.gingersoft.gsa.cloud.table.mvp.contract.FineItemOneselfContract;
import com.gingersoft.gsa.cloud.table.mvp.model.utils.MealStyleUtils;
import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
......@@ -52,7 +53,7 @@ public class FineItemOneselfModel extends BaseModel implements FineItemOneselfCo
@Override
public List<Modifier> queryDB_ModifierList(long fid, int mode) {
ModifierDaoUtils daoUtils = new ModifierDaoUtils(mApplication);
return daoUtils.queryModifiersByFid(fid, mode);
return MealStyleUtils.assemblyModifiersColor(daoUtils.queryModifiersByFid(fid, mode));
}
@Override
......
......@@ -21,6 +21,7 @@ import com.gingersoft.gsa.cloud.table.mvp.model.service.MealService;
import com.gingersoft.gsa.cloud.table.mvp.model.service.MemberService;
import com.gingersoft.gsa.cloud.table.mvp.model.service.OrderPayService;
import com.gingersoft.gsa.cloud.table.mvp.model.utils.MealConditionFilterUtils;
import com.gingersoft.gsa.cloud.table.mvp.model.utils.MealStyleUtils;
import com.google.gson.Gson;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.integration.IRepositoryManager;
......@@ -77,27 +78,27 @@ public class MealStandModel extends BaseModel implements MealStandContract.Model
public List<Food> queryDB_FoodGroupList(int foodSummary) {
FoodDaoUtils foodDaoUtils = new FoodDaoUtils(mApplication);
List<Food> foods = foodDaoUtils.queryFoodGroupByQueryBuilder(foodSummary);
return MealConditionFilterUtils.foodConditionFilter(foods,foodSummary);
return MealStyleUtils.assemblyFoodsColor(MealConditionFilterUtils.foodConditionFilter(foods, foodSummary));
}
@Override
public List<Food> queryDB_FoodList(long parentId, int foodSummary) {
FoodDaoUtils foodDaoUtils = new FoodDaoUtils(mApplication);
List<Food> foods = foodDaoUtils.queryFoodByQueryBuilder(parentId, foodSummary);
return MealConditionFilterUtils.foodConditionFilter(foods,foodSummary);
return MealStyleUtils.assemblyFoodsColor(MealConditionFilterUtils.foodConditionFilter(foods, foodSummary));
}
@Override
public List<Modifier> queryDB_ModifierList(long fid, int mode) {
ModifierDaoUtils daoUtils = new ModifierDaoUtils(mApplication);
return daoUtils.queryModifiersByFid(fid, mode);
return MealStyleUtils.assemblyModifiersColor(daoUtils.queryModifiersByFid(fid, mode)) ;
}
@Override
public List<ComboItem> queryDB_ComboList(long fid, int foodSummary) {
ComboItemDaoUtils comboItemDao = new ComboItemDaoUtils(mApplication);
List<ComboItem> foodCombos = comboItemDao.queryComboItemsByFidQueryBuilder(fid, foodSummary);
return MealConditionFilterUtils.comboConditionFilter(foodCombos,foodSummary);
return MealConditionFilterUtils.comboConditionFilter(foodCombos, foodSummary);
}
@Override
......@@ -115,7 +116,7 @@ public class MealStandModel extends BaseModel implements MealStandContract.Model
public List<Discount> queryDB_DiscountList(byte discountScope, byte discountType) {
DiscountDaoUtils discountDaoUtils = new DiscountDaoUtils(mApplication);
List<Discount> discountList = discountDaoUtils.queryDiscountByQueryBuilder();
return MealConditionFilterUtils.discountConditionFilter(discountList,discountScope,discountType);
return MealConditionFilterUtils.discountConditionFilter(discountList, discountScope, discountType);
}
@Override
......
package com.gingersoft.gsa.cloud.table.mvp.model.utils;
import com.gingersoft.gsa.cloud.common.utils.okhttpUtils.OkHttp3Utils;
import com.gingersoft.gsa.cloud.database.bean.Food;
import com.gingersoft.gsa.cloud.database.bean.Modifier;
import java.util.List;
/**
* @作者: bin
* @創建時間: 2021-03-04 15:12
* @更新時間: 2021-03-04 15:12
* @描述:
*/
public class MealStyleUtils {
public static List<Food> assemblyFoodsColor(List<Food> foodList) {
for (Food food : foodList) {
food.getColorBean();
}
return foodList;
}
public static List<Modifier> assemblyModifiersColor(List<Modifier> modifierList) {
// for (Modifier modifier : modifierList) {
// modifier.getColorBean();
// }
return modifierList;
}
}
......@@ -17,8 +17,8 @@ import com.gingersoft.gsa.cloud.table.R;
import com.gingersoft.gsa.cloud.table.mvp.contract.FineItemAllContract;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.SoldoutCtrFood;
import com.gingersoft.gsa.cloud.table.mvp.ui.activity.MealStandActivity;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.FineItemOneAdapter;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.FineItemTwoAdapter;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.FineItemOneAdapter;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.FineItemTwoAdapter;
import com.gingersoft.gsa.cloud.ui.widget.dialog.CommonTipDialog;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader;
......@@ -186,8 +186,7 @@ public class FineItemAllPresenter extends BasePresenter<FineItemAllContract.Mode
mFineItemOneLastPosition = -1;
//获取数据
ModifierDaoUtils modifierDaoUtils = new ModifierDaoUtils(mApplication);
List<Modifier> modifierList = modifierDaoUtils.queryModifierByModMsgAndVisibleQueryBuilder();
List<Modifier> modifierList = mModel.queryDB_ModifierByModMsgAndVisibleQueryBuilder();
if (modifierList == null || modifierList.size() == 0) {
mFineItemOneList.clear();
......@@ -208,8 +207,7 @@ public class FineItemAllPresenter extends BasePresenter<FineItemAllContract.Mode
mFineItemOneLastPosition = -1;
//获取数据
ModifierDaoUtils modifierDaoUtils = new ModifierDaoUtils(mApplication);
List<Modifier> modifierList = modifierDaoUtils.queryModifierByModModTasteVisibleQueryBuilder();
List<Modifier> modifierList = mModel.queryDB_ModifierByModModTasteVisibleQueryBuilder();
if (modifierList == null || modifierList.size() == 0) {
mFineItemOneList.clear();
......@@ -230,8 +228,7 @@ public class FineItemAllPresenter extends BasePresenter<FineItemAllContract.Mode
mFineItemOneLastPosition = -1;
//获取数据
ModifierDaoUtils modifierDaoUtils = new ModifierDaoUtils(mApplication);
List<Modifier> modifierList = modifierDaoUtils.queryModifierByModModCommVisibleQueryBuilder();
List<Modifier> modifierList = mModel.queryDB_ModifierByModModCommVisibleQueryBuilder();
if (modifierList == null || modifierList.size() == 0) {
mFineItemOneList.clear();
......@@ -250,8 +247,7 @@ public class FineItemAllPresenter extends BasePresenter<FineItemAllContract.Mode
public void initChildFineItemItemData(long fid) {
//获取数据
ModifierDaoUtils modifierDaoUtils = new ModifierDaoUtils(mApplication);
List<Modifier> modifierList = modifierDaoUtils.queryModifierByTopidAndVisibleQueryBuilder(fid);
List<Modifier> modifierList = mModel.queryDB_ModifierByTopidAndVisibleQueryBuilder(fid);
if (modifierList == null || modifierList.size() == 0) {
return;
......
......@@ -20,6 +20,7 @@ import com.gingersoft.gsa.cloud.common.utils.LanguageUtils;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.component.ComponentName;
import com.gingersoft.gsa.cloud.database.bean.ColorBean;
import com.gingersoft.gsa.cloud.database.bean.ComboItem;
import com.gingersoft.gsa.cloud.database.bean.Discount;
import com.gingersoft.gsa.cloud.database.bean.Food;
......@@ -1820,6 +1821,10 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
* @param parentId
*/
private void updateFoodData(List<Food> foodList, long parentId) {
for (Food food : foodList) {
ColorBean colorBean = food.getColorBean();
int i = 0;
}
setTopId(foodList, parentId);
setFoodComboListStatus(foodList);
mFoodList.clear();
......
......@@ -5,10 +5,22 @@ import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.gingersoft.gsa.cloud.common.utils.threadPool.ThreadPoolManager;
import com.gingersoft.gsa.cloud.table.R;
import com.jess.arms.base.BaseActivity;
import com.jess.arms.di.component.AppComponent;
import java.util.Timer;
import java.util.concurrent.DelayQueue;
import java.util.concurrent.Executors;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.Future;
import java.util.concurrent.RecursiveTask;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import io.reactivex.internal.schedulers.ScheduledDirectTask;
/**
* @作者: bin
* @創建時間: 2021-02-02 11:42
......@@ -34,7 +46,6 @@ public class CoordinatorlayoutActivity extends BaseActivity {
@Override
public void initIntent() {
}
@Override
......
......@@ -244,7 +244,7 @@ public class SoldoutCtrlActivity extends BaseFragmentActivity<SoldoutCtrlPresent
public void initFoodGroupView(List<Food> foodGroupList) {
//总的页数向上取整
totalPage = (int) Math.ceil(foodGroupList.size() * 1.0 / GoldConstants.foodGriupPageSize);
totalPage = (int) Math.ceil(foodGroupList.size() * 1.0 / (foodGroupColumn * foodGroupRow));
int Rows = foodGroupRow;
if (foodGroupList.size() <= foodGroupColumn) {
......@@ -315,19 +315,17 @@ public class SoldoutCtrlActivity extends BaseFragmentActivity<SoldoutCtrlPresent
//循坏加入点点图片组
ivPoints[i] = new ImageView(this);
if (i == 0) {
ivPoints[i].setImageResource(R.drawable.base_red_point);
ivPoints[i].setImageResource(R.drawable.meal_food_group_point_focuese);
} else {
ivPoints[i].setImageResource(R.drawable.base_grey_point);
ivPoints[i].setImageResource(R.drawable.meal_food_group_point_unfocused);
}
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ArmsUtils.dip2px(this, 20), ArmsUtils.dip2px(this, 12));
lp.leftMargin = ArmsUtils.dip2px(this, 5);
ivPoints[i].setLayoutParams(lp);
ivPoints[i].setPadding(0, 0, 0, 0);
ll_food_group_point.addView(ivPoints[i]);
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) ivPoints[i].getLayoutParams();
layoutParams.height = ll_food_group_point.getLayoutParams().height;
layoutParams.width = ArmsUtils.getScreenWidth(this) / totalPage;
ivPoints[i].setLayoutParams(layoutParams);
}
if (foodGroupList.size() > 10) {
if (foodGroupList.size() > (Rows * foodGroupColumn)) {
ll_food_group_point.setVisibility(View.VISIBLE);
} else {
ll_food_group_point.setVisibility(View.GONE);
......@@ -714,9 +712,9 @@ public class SoldoutCtrlActivity extends BaseFragmentActivity<SoldoutCtrlPresent
mPageIndex = pageIndex;
for (int i = 0; i < totalPage; i++) {
if (i == pageIndex) {
ivPoints[i].setImageResource(R.drawable.base_red_point);
ivPoints[i].setImageResource(R.drawable.meal_food_group_point_focuese);
} else {
ivPoints[i].setImageResource(R.drawable.base_grey_point);
ivPoints[i].setImageResource(R.drawable.meal_food_group_point_unfocused);
}
}
}
......
......@@ -99,6 +99,7 @@ public class ComboAdapter extends DefaultAdapter<ComboItem> {
if (!datasBean.isModifier()) {
initComboName(datasBean);
initComboColor(datasBean);
} else {
initModifierName(datasBean.getModifier());
initModifierSoldout(datasBean.getModifier());
......@@ -132,29 +133,11 @@ public class ComboAdapter extends DefaultAdapter<ComboItem> {
// if (desc == null || desc.trim().length() == 0) {
// desc = datasBean.getDesc1();
// }
tv_name.setText(desc);
// com.elegant.bin.gsa.mvp.main.model.bean.Color.DatasBean bgAndFontColor = datasBean.getBgAndFontColor();
// if (bgAndFontColor != null) {
// if (!TextUtils.isEmpty(bgAndFontColor.getAndroidColor())) {
// tv_name.setBackgroundColor(Color.parseColor(bgAndFontColor.getAndroidColor()));
// } else {
tv_name.setBackgroundColor(ArmsUtils.getColor(mContext, R.color.keyboard_paybill_normal));
// }
// if (!TextUtils.isEmpty(bgAndFontColor.getAndroidfontcolor())) {
// tv_name.setTextColor(Color.parseColor(bgAndFontColor.getAndroidfontcolor()));
// } else {
tv_name.setTextColor(ArmsUtils.getColor(mContext, R.color.theme_white_color));
// }
// }
// tv_name.setHeight(ColHeight);
// tv_name.setWidth(ColWidth);
// tv_name.setMaxWidth(ColHeight);
// tv_name.setMinWidth(ColWidth);
tv_name.setBackgroundColor(datasBean.getBgColor());
tv_name.setTextColor(datasBean.getFontColor());
tv_name.setGravity(Gravity.CENTER);
tv_name.setTextSize(FontSize);
tv_name.setText(desc);
}
private void initModifierSoldout(Modifier datasBean) {
......@@ -175,8 +158,6 @@ public class ComboAdapter extends DefaultAdapter<ComboItem> {
String Fname = datasBean.getName();
tv_name.setText(Fname);
tv_name.setTextSize(FontSize);
initComboColor(datasBean);
}
private void setSolodStatus(ComboItem datasBean) {
......@@ -199,7 +180,7 @@ public class ComboAdapter extends DefaultAdapter<ComboItem> {
if (TextUtils.isEmpty(qty)) {
tv_soldout.setVisibility(View.INVISIBLE);
} else {
if (qty.equalsIgnoreCase("售罄") || qty.equalsIgnoreCase("暫停") ) {
if (qty.equalsIgnoreCase("售罄") || qty.equalsIgnoreCase("暫停")) {
blv_soldout.setLableText(qty);
blv_soldout.setVisibility(View.VISIBLE);
} else {
......
package com.gingersoft.gsa.cloud.table.mvp.ui.adapter;
package com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal;
import android.content.Context;
import android.graphics.Color;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
......@@ -12,6 +13,7 @@ import android.widget.TextView;
import androidx.recyclerview.widget.GridLayoutManager;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.database.bean.ColorBean;
import com.gingersoft.gsa.cloud.database.bean.Modifier;
import com.gingersoft.gsa.cloud.table.R;
import com.gingersoft.gsa.cloud.table.R2;
......@@ -139,16 +141,6 @@ public class FineItemOneAdapter extends DefaultAdapter<Modifier> {
desc = datasBean.getModifierName();
// }
// tv_food_name.setMaxWidth(mColwidth);
// tv_food_name.setMinWidth(mColwidth);
// tv_food_name.setWidth(mColwidth);
tv_food_name.setText(desc);
tv_food_name.setTextSize(mModFontSize);
tv_food_name.setHeight(mColHeight);
tv_food_name.setGravity(Gravity.CENTER);
tv_food_name.setSingleLine(false);
GridLayoutManager.LayoutParams lp = (GridLayoutManager.LayoutParams) rl_container.getLayoutParams();
lp.height = mColHeight;
lp.width = mColwidth;
......@@ -157,38 +149,19 @@ public class FineItemOneAdapter extends DefaultAdapter<Modifier> {
/**
* 设置字体颜色以及块颜色
*/
// if (mColorList != null) {
// //后台有设置颜色当前选中高亮色,没有选中默认使用后台配置的颜色
// if (datasBean.isSelected()) {
// tv_food_name.setBackgroundColor(ArmsUtils.getColor(mContext, R.color.colorAccent));
// tv_food_name.setTextColor(ArmsUtils.getColor(mContext, R.color.theme_white_color));
// } else {
// for (Color.DatasBean cs : mColorList) {
// if (cs.getColorid() == datasBean.getColor()) {
// if (!TextUtils.isEmpty(cs.getAndroidColor())) {
// tv_food_name.setBackgroundColor(android.graphics.Color.parseColor(cs.getAndroidColor()));
// } else {
// tv_food_name.setBackgroundColor(ArmsUtils.getColor(mContext, R.color.Grass_green));
// }
// if (!TextUtils.isEmpty(cs.getAndroidfontcolor())) {
// tv_food_name.setTextColor(android.graphics.Color.parseColor(cs.getAndroidfontcolor()));
// } else {
// tv_food_name.setTextColor(ArmsUtils.getColor(mContext, R.color.theme_white_color));
// }
// break;
// }
// }
// }
// } else {
//后台没有设置颜色当前选中高亮色,没有选中默认使用绿色
// if (datasBean.isSelected()) {
// tv_food_name.setBackgroundColor(ArmsUtils.getColor(mContext, R.color.orange_500));
// tv_food_name.setTextColor(ArmsUtils.getColor(mContext, R.color.theme_white_color));
// } else {
tv_food_name.setBackgroundColor(ArmsUtils.getColor(mContext, R.color.Grass_green));
tv_food_name.setTextColor(ArmsUtils.getColor(mContext, R.color.theme_white_color));
// }
// }
if (datasBean.getBgColor() != -1) {
tv_food_name.setBackgroundColor(datasBean.getBgColor());
tv_food_name.setTextColor(datasBean.getFontColor());
} else {
tv_food_name.setBackgroundColor(ArmsUtils.getColor(mContext, R.color.Grass_green));
tv_food_name.setTextColor(ArmsUtils.getColor(mContext, R.color.theme_white_color));
}
tv_food_name.setHeight(mColHeight);
tv_food_name.setGravity(Gravity.CENTER);
tv_food_name.setSingleLine(false);
tv_food_name.setTextSize(mModFontSize);
tv_food_name.setText(desc);
}
public void setNumber(Modifier datasBean) {
......
package com.gingersoft.gsa.cloud.table.mvp.ui.adapter;
package com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal;
import android.content.Context;
import android.graphics.Color;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
......@@ -11,6 +12,7 @@ import android.widget.TextView;
import androidx.recyclerview.widget.GridLayoutManager;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.database.bean.ColorBean;
import com.gingersoft.gsa.cloud.database.bean.Modifier;
import com.gingersoft.gsa.cloud.table.R;
import com.gingersoft.gsa.cloud.table.R2;
......@@ -170,12 +172,6 @@ public class FineItemTwoAdapter extends DefaultAdapter<Modifier> {
tv_food_name.setMinWidth(mColwidth);
tv_food_name.setWidth(mColwidth);
tv_food_name.setText(desc);
tv_food_name.setTextSize(mModFontSize);
tv_food_name.setHeight(mColHeight);
tv_food_name.setGravity(Gravity.CENTER);
tv_food_name.setSingleLine(false);
GridLayoutManager.LayoutParams lp = (GridLayoutManager.LayoutParams) rl_container.getLayoutParams();
lp.height = mColHeight;
lp.width = mColwidth;
......@@ -184,38 +180,19 @@ public class FineItemTwoAdapter extends DefaultAdapter<Modifier> {
/**
* 设置字体颜色以及块颜色
*/
// if (mColorList != null) {
// //后台有设置颜色当前选中高亮色,没有选中默认使用后台配置的颜色
// if (datasBean.isSelected()) {
// tv_food_name.setBackgroundColor(ArmsUtils.getColor(mContext, R.color.colorAccent));
// tv_food_name.setTextColor(ArmsUtils.getColor(mContext, R.color.theme_white_color));
// } else {
// for (Color.DatasBean cs : mColorList) {
// if (cs.getColorid() == datasBean.getColor()) {
// if (!TextUtils.isEmpty(cs.getAndroidColor())) {
// tv_food_name.setBackgroundColor(android.graphics.Color.parseColor(cs.getAndroidColor()));
// } else {
// tv_food_name.setBackgroundColor(ArmsUtils.getColor(mContext, R.color.Grass_green));
// }
// if (!TextUtils.isEmpty(cs.getAndroidfontcolor())) {
// tv_food_name.setTextColor(android.graphics.Color.parseColor(cs.getAndroidfontcolor()));
// } else {
// tv_food_name.setTextColor(ArmsUtils.getColor(mContext, R.color.theme_white_color));
// }
// break;
// }
// }
// }
// } else {
//后台没有设置颜色当前选中高亮色,没有选中默认使用绿色
// if (datasBean.isSelected()) {
// tv_food_name.setBackgroundColor(ArmsUtils.getColor(mContext, R.color.orange_500));
// tv_food_name.setTextColor(ArmsUtils.getColor(mContext, R.color.theme_white_color));
// } else {
tv_food_name.setBackgroundColor(ArmsUtils.getColor(mContext, R.color.Grass_green));
tv_food_name.setTextColor(ArmsUtils.getColor(mContext, R.color.theme_white_color));
// }
// }
if (datasBean.getBgColor() != -1) {
tv_food_name.setBackgroundColor(datasBean.getBgColor());
tv_food_name.setTextColor(datasBean.getFontColor());
} else {
tv_food_name.setBackgroundColor(ArmsUtils.getColor(mContext, R.color.Grass_green));
tv_food_name.setTextColor(ArmsUtils.getColor(mContext, R.color.theme_white_color));
}
tv_food_name.setHeight(mColHeight);
tv_food_name.setGravity(Gravity.CENTER);
tv_food_name.setSingleLine(false);
tv_food_name.setTextSize(mModFontSize);
tv_food_name.setText(desc);
}
public void setNumber(Modifier datasBean) {
......@@ -277,11 +254,6 @@ public class FineItemTwoAdapter extends DefaultAdapter<Modifier> {
}
}
//
public void setCurrentSlodoutFoodList_Full(List<SoldoutCtrFood> currentSlodoutFoodList_Full) {
this.mCurrentSlodoutFoodList_Full = currentSlodoutFoodList_Full;
}
public int getUser_qty() {
return user_qty;
}
......
package com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal;
import android.content.Context;
import android.graphics.Color;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
......@@ -12,6 +13,7 @@ import android.widget.TextView;
import androidx.recyclerview.widget.GridLayoutManager;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.database.bean.ColorBean;
import com.gingersoft.gsa.cloud.database.bean.Food;
import com.gingersoft.gsa.cloud.table.R;
import com.gingersoft.gsa.cloud.table.R2;
......@@ -200,8 +202,14 @@ public class FoodAdapter extends DefaultAdapter<Food> {
tv_food_name.setBackgroundColor(ArmsUtils.getColor(mContext, R.color.orange_500));
tv_food_name.setTextColor(ArmsUtils.getColor(mContext, R.color.theme_white_color));
} else {
tv_food_name.setBackgroundColor(ArmsUtils.getColor(mContext, R.color.light_blue_500));
tv_food_name.setTextColor(ArmsUtils.getColor(mContext, R.color.theme_white_color));
if (datasBean.getColorBean() != null) {
ColorBean colorBean = datasBean.getColorBean();
tv_food_name.setBackgroundColor(Color.parseColor(colorBean.getAndroidColor()));
tv_food_name.setTextColor(Color.parseColor(colorBean.getAndroidFontColor()));
} else {
tv_food_name.setBackgroundColor(ArmsUtils.getColor(mContext, R.color.light_blue_500));
tv_food_name.setTextColor(ArmsUtils.getColor(mContext, R.color.theme_white_color));
}
}
}
}
......
......@@ -9,6 +9,7 @@ import android.widget.RelativeLayout;
import android.widget.TextView;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.database.bean.ColorBean;
import com.gingersoft.gsa.cloud.database.bean.Food;
import com.gingersoft.gsa.cloud.table.R;
import com.gingersoft.gsa.cloud.table.R2;
......@@ -100,6 +101,7 @@ public class FoodGroupAdapter extends DefaultAdapter<Food> {
setFoodGroup(datasBean);
setNumber(datasBean);
setColor(datasBean);
setSoldoutStatus(datasBean);
setOnItemClickListener(new OnViewClickListener() {
......@@ -180,15 +182,13 @@ public class FoodGroupAdapter extends DefaultAdapter<Food> {
// }
// } else {
// //后台没有设置颜色当前选中高亮色,没有选中默认使用绿色
if (datasBean.isSelected()) {
tv_name.setBackgroundColor(Color.parseColor("#3C3C3C"));
// tv_name.setBackgroundColor(ArmsUtils.getColor(mContext, R.color.orange_500));
tv_name.setTextColor(ArmsUtils.getColor(mContext, R.color.theme_white_color));
} else {
tv_name.setBackgroundColor(Color.parseColor("#FF9700"));
// tv_name.setBackgroundColor(ArmsUtils.getColor(mContext, R.color.Grass_green));
tv_name.setTextColor(ArmsUtils.getColor(mContext, R.color.theme_white_color));
}
// if (datasBean.isSelected()) {
// tv_name.setBackgroundColor(Color.parseColor("#3C3C3C"));
// tv_name.setTextColor(ArmsUtils.getColor(mContext, R.color.theme_white_color));
// } else {
// tv_name.setBackgroundColor(Color.parseColor("#FF9700"));
// tv_name.setTextColor(ArmsUtils.getColor(mContext, R.color.theme_white_color));
// }
// }
}
......@@ -212,6 +212,22 @@ public class FoodGroupAdapter extends DefaultAdapter<Food> {
}
}
private void setColor(Food datasBean) {
if (datasBean.isSelected()) {
tv_name.setBackgroundColor(Color.parseColor("#3C3C3C"));
tv_name.setTextColor(ArmsUtils.getColor(mContext, R.color.theme_white_color));
} else {
if (datasBean.getColorBean() != null) {
ColorBean colorBean = datasBean.getColorBean();
tv_name.setBackgroundColor(Color.parseColor(colorBean.getAndroidColor()));
tv_name.setTextColor(Color.parseColor(colorBean.getAndroidFontColor()));
} else {
tv_name.setBackgroundColor(ArmsUtils.getColor(mContext, R.color.orange_500));
tv_name.setTextColor(ArmsUtils.getColor(mContext, R.color.theme_white_color));
}
}
}
public void setSoldoutStatus(Food datasBean) {
tv_soldout.setMaxHeight(mOrderNumberShowSize);
tv_soldout.setMinHeight(mOrderNumberShowSize);
......
package com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal;
import android.content.Context;
import android.graphics.Color;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
......@@ -9,6 +10,7 @@ import android.widget.ImageView;
import android.widget.TextView;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.database.bean.ColorBean;
import com.gingersoft.gsa.cloud.database.bean.Modifier;
import com.gingersoft.gsa.cloud.table.R;
import com.gingersoft.gsa.cloud.table.R2;
......@@ -104,43 +106,16 @@ public class ModifierAdapter extends DefaultAdapter<Modifier> {
private void initModifierName(Modifier datasBean) {
String desc = datasBean.getModifierName();
// switch (GSAApplication.androidSetting.getDataLanguage()) {
// case 1:
// desc = datasBean.getDesc1();
// break;
// case 2:
// desc = datasBean.getDesc2();
// break;
// case 3:
// desc = datasBean.getDesc3();
// break;
// }
// if (desc == null || desc.trim().length() == 0) {
// desc = datasBean.getDesc1();
// }
if (datasBean.getBgColor() != -1) {
tv_name.setBackgroundColor(datasBean.getBgColor());
tv_name.setTextColor(datasBean.getFontColor());
} else {
tv_name.setBackgroundColor(ArmsUtils.getColor(mContext, R.color.keyboard_paybill_normal));
tv_name.setTextColor(ArmsUtils.getColor(mContext, R.color.theme_white_color));
}
tv_name.setTextSize(FontSize);
tv_name.setText(desc);
// com.elegant.bin.gsa.mvp.main.model.bean.Color.DatasBean bgAndFontColor = datasBean.getBgAndFontColor();
// if (bgAndFontColor != null) {
// if (!TextUtils.isEmpty(bgAndFontColor.getAndroidColor())) {
// tv_name.setBackgroundColor(Color.parseColor(bgAndFontColor.getAndroidColor()));
// } else {
tv_name.setBackgroundColor(ArmsUtils.getColor(mContext, R.color.keyboard_paybill_normal));
// }
// if (!TextUtils.isEmpty(bgAndFontColor.getAndroidfontcolor())) {
// tv_name.setTextColor(Color.parseColor(bgAndFontColor.getAndroidfontcolor()));
// } else {
tv_name.setTextColor(ArmsUtils.getColor(mContext, R.color.theme_white_color));
// }
// }
// tv_name.setHeight(ColHeight);
// tv_name.setWidth(ColWidth);
// tv_name.setMaxWidth(ColHeight);
// tv_name.setMinWidth(ColWidth);
tv_name.setGravity(Gravity.CENTER);
tv_name.setTextSize(FontSize);
}
private void initModifierSoldout(Modifier datasBean) {
......@@ -158,7 +133,7 @@ public class ModifierAdapter extends DefaultAdapter<Modifier> {
if (TextUtils.isEmpty(qty)) {
tv_soldout.setVisibility(View.INVISIBLE);
} else {
if (qty.equalsIgnoreCase("售罄") || qty.equalsIgnoreCase("暫停") ) {
if (qty.equalsIgnoreCase("售罄") || qty.equalsIgnoreCase("暫停")) {
blv_soldout.setLableText(qty);
blv_soldout.setVisibility(View.VISIBLE);
} else {
......
......@@ -72,15 +72,18 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycle_food_group"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:divider="@null"
android:fadeScrollbars="false"
android:orientation="vertical" />
<LinearLayout
android:id="@+id/ll_food_group_point"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_5"
android:background="@color/theme_grey_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal"
android:visibility="invisible" />
android:visibility="visible" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
......
......@@ -39,6 +39,7 @@ import io.rx_cache2.internal.RxCache;
import io.victoralbertos.jolyglot.GsonSpeaker;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.listener.ResponseErrorListener;
import okhttp3.Cache;
import okhttp3.HttpUrl;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
......
......@@ -15,7 +15,7 @@ public class LoganConfig {
public static final String EncryptIV16 = "0123456789012345";
public static final String APP_ID = "gingersoft1008611";
// public static final String UPLOAD_LOG_URL = HttpsConstans.HTTP_ADDRESS_URL_HK+ "/logan-web/logan/upload.json";
public static String UPLOAD_LOG_URL = "http://192.168.1.131:8080/logan-web/logan/upload.json";
public static String UPLOAD_LOG_URL = "https://hktest.ricepon.com:64377/logan-web/logan/upload.json";
/**
* 日誌保留天數
......
package com.gingersoft.gsa.cloud.common.config;
import android.os.Environment;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import java.io.File;
/**
* @author : bin
* @create date: 2020-11-21
......@@ -9,6 +15,15 @@ package com.gingersoft.gsa.cloud.common.config;
public class OkHttpConfig {
/**
* okhttp cache目录
*/
public static final String CACHE_DIRECTORY = GsaCloudApplication.getAppContext().getExternalFilesDir(null).getAbsolutePath() + File.separator + "okhttpCache";
/**
* okhttp cache大小
*/
public static final long CACHE_MAXSIZE = 1024 * 1024 * 5;
/**
* okhttp连接超时20秒
*/
public static final byte CONNECT_TIMEOUT = 20;
......
......@@ -5,10 +5,12 @@ import android.content.Context;
import com.gingersoft.gsa.cloud.common.config.OkHttpConfig;
import com.jess.arms.di.module.ClientModule;
import java.io.File;
import java.util.concurrent.TimeUnit;
import me.jessyan.progressmanager.ProgressManager;
import me.jessyan.retrofiturlmanager.RetrofitUrlManager;
import okhttp3.Cache;
import okhttp3.OkHttpClient;
/**
......@@ -26,6 +28,7 @@ public class MyOkhttpConfiguration implements ClientModule.OkhttpConfiguration {
builder.connectTimeout(OkHttpConfig.CONNECT_TIMEOUT, TimeUnit.SECONDS);
builder.writeTimeout(OkHttpConfig.REQUEST_TIMEOUT, TimeUnit.SECONDS);
builder.readTimeout(OkHttpConfig.REQUEST_TIMEOUT, TimeUnit.SECONDS);
builder.cache(new Cache(new File(OkHttpConfig.CACHE_DIRECTORY), OkHttpConfig.CACHE_MAXSIZE));
//使用一行代码监听 Retrofit/Okhttp 上传下载进度监听,以及 Glide 加载进度监听 详细使用方法查看 https://github.com/JessYanCoding/ProgressManager
ProgressManager.getInstance().with(builder);
//让 Retrofit 同时支持多个 BaseUrl 以及动态改变 BaseUrl. 详细使用请方法查看 https://github.com/JessYanCoding/RetrofitUrlManager
......
......@@ -2,8 +2,15 @@ package com.gingersoft.gsa.cloud.common.config.globalconfig.applyOptions;
import android.content.Context;
import com.gingersoft.gsa.cloud.common.BuildConfig;
import com.gingersoft.gsa.cloud.common.config.OkHttpConfig;
import com.jess.arms.di.module.ClientModule;
import java.io.File;
import java.util.concurrent.TimeUnit;
import me.jessyan.progressmanager.ProgressManager;
import me.jessyan.retrofiturlmanager.RetrofitUrlManager;
import okhttp3.Cache;
import okhttp3.OkHttpClient;
import retrofit2.Retrofit;
......@@ -12,12 +19,9 @@ public class MyRetrofitConfiguration implements ClientModule.RetrofitConfigurati
@Override
public void configRetrofit(Context context, Retrofit.Builder builder) {
// 配置多BaseUrl支持
OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder();
if (BuildConfig.DEBUG) {
// clientBuilder.addInterceptor(new LoggingInterceptor());//使用自定义的Log拦截器
}
// clientBuilder.addInterceptor(new RequestInterceptor());
// clientBuilder.addInterceptor(new HeadersInterceptor());//使用自定义User-Agent
// builder.client(RetrofitUrlManager.getInstance().with(clientBuilder).build());
// OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder();
// if (BuildConfig.DEBUG) {
//// clientBuilder.addInterceptor(new LoggingInterceptor());//使用自定义的Log拦截器
// }
}
}
......@@ -11,6 +11,7 @@ import com.gingersoft.gsa.cloud.common.core.user.UserContext;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.common.BuildConfig;
import com.gingersoft.gsa.cloud.common.utils.log.LogUtil;
import com.gingersoft.gsa.cloud.common.utils.okhttpUtils.OkHttp3Utils;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.common.config.LoganConfig;
import com.jess.arms.utils.ArmsUtils;
......
package com.gingersoft.gsa.cloud.common.printer.plugins;
import android.graphics.Bitmap;
import java.util.ArrayList;
import java.util.List;
import io.reactivex.annotations.NonNull;
import io.reactivex.annotations.Nullable;
import io.reactivex.functions.Consumer;
/**
* @作者: bin
* @創建時間: 2021-01-25 9:46
* @更新時間: 2021-01-25 9:46
* @描述:
*/
public class PrinterFlowProxy {
private static volatile PrinterFlowProxy sPrinterPlugins = null;
private ArrayList<PrinterFlowListener> mPrinterFlowListeners = new ArrayList<>();
@Nullable
private Consumer<? super Throwable> errorHandler;
private PrinterFlowProxy() {
}
public static PrinterFlowProxy newInstance() {
if (sPrinterPlugins == null) {
synchronized (PrinterFlowProxy.class) {
if (sPrinterPlugins == null) {
sPrinterPlugins = new PrinterFlowProxy();
}
}
}
return sPrinterPlugins;
}
public void onError(@NonNull Throwable error) {
Consumer<? super Throwable> f = errorHandler;
if (error == null) {
error = new NullPointerException("onError called with null");
}
if (f != null) {
try {
f.accept(error);
return;
} catch (Throwable e) {
e.printStackTrace();
uncaught(e);
}
}
error.printStackTrace();
uncaught(error);
}
void uncaught(@NonNull Throwable error) {
Thread currentThread = Thread.currentThread();
Thread.UncaughtExceptionHandler handler = currentThread.getUncaughtExceptionHandler();
handler.uncaughtException(currentThread, error);
}
public void setErrorHandler(Consumer<? super Throwable> errorHandler) {
this.errorHandler = errorHandler;
}
public void registerPrinterFlowListener(PrinterFlowListener listener) {
mPrinterFlowListeners.add(listener);
}
public void unregisterPrinterFlowListener(PrinterFlowListener listener) {
mPrinterFlowListeners.remove(listener);
}
public void dispatchPrinterDataBefore(int orderType, int printType, String printerData, String printerDeviceInfo) {
Object[] listeners = collectPrinterFlowListener();
if (listeners != null) {
for (int i = 0; i < listeners.length; i++) {
((PrinterFlowListener) listeners[i]).onPrinterDataBefore(orderType, printType, printerData, printerDeviceInfo);
}
}
}
public void dispatchPrinterBitmapBefore(int orderType, int printType, String directoryName, List<Bitmap> bitmaps) {
Object[] listeners = collectPrinterFlowListener();
if (listeners != null) {
for (int i = 0; i < listeners.length; i++) {
((PrinterFlowListener) listeners[i]).onPrinterBitmapBefore(orderType, printType, directoryName, bitmaps);
}
}
}
public void dispatchPrintSuccess() {
Object[] listeners = collectPrinterFlowListener();
if (listeners != null) {
for (int i = 0; i < listeners.length; i++) {
((PrinterFlowListener) listeners[i]).onPrintSuccess();
}
}
}
public void dispatchPrintError(Exception e, int errorCode) {
Object[] listeners = collectPrinterFlowListener();
if (listeners != null) {
for (int i = 0; i < listeners.length; i++) {
((PrinterFlowListener) listeners[i]).onPrintError(e, errorCode);
}
}
}
public void dispatchConnectionBefore(String deviceName, String IP, int port, long ioTimeout, long printTimeout) {
Object[] listeners = collectPrinterFlowListener();
if (listeners != null) {
for (int i = 0; i < listeners.length; i++) {
((PrinterFlowListener) listeners[i]).connectionBefore(deviceName, IP, port, ioTimeout, printTimeout);
}
}
}
public void dispatchConnectionSuccess() {
Object[] listeners = collectPrinterFlowListener();
if (listeners != null) {
for (int i = 0; i < listeners.length; i++) {
((PrinterFlowListener) listeners[i]).connectionSuccess();
}
}
}
public void dispatchConnectionError(Exception e) {
Object[] listeners = collectPrinterFlowListener();
if (listeners != null) {
for (int i = 0; i < listeners.length; i++) {
((PrinterFlowListener) listeners[i]).connectionError(e);
}
}
}
public void dispatchDisconnect(Exception e) {
Object[] listeners = collectPrinterFlowListener();
if (listeners != null) {
for (int i = 0; i < listeners.length; i++) {
((PrinterFlowListener) listeners[i]).disconnect(e);
}
}
}
private Object[] collectPrinterFlowListener() {
Object[] listeners = null;
synchronized (mPrinterFlowListeners) {
if (mPrinterFlowListeners.size() > 0) {
listeners = mPrinterFlowListeners.toArray();
}
}
return listeners;
}
}
package com.gingersoft.gsa.cloud.common.printer.plugins;
import io.reactivex.annotations.NonNull;
import io.reactivex.annotations.Nullable;
import io.reactivex.functions.Consumer;
/**
* @作者: bin
* @創建時間: 2021-01-25 9:46
* @更新時間: 2021-01-25 9:46
* @描述:
*/
public class PrinterPlugins {
@Nullable
static volatile Consumer<? super Throwable> errorHandler;
@Nullable
static volatile PrinterFlowListener onPrinterFlowHandler;
public static void onError(@NonNull Throwable error) {
Consumer<? super Throwable> f = errorHandler;
if (error == null) {
error = new NullPointerException("onError called with null");
}
if (f != null) {
try {
f.accept(error);
return;
} catch (Throwable e) {
e.printStackTrace();
uncaught(e);
}
}
error.printStackTrace();
uncaught(error);
}
static void uncaught(@NonNull Throwable error) {
Thread currentThread = Thread.currentThread();
Thread.UncaughtExceptionHandler handler = currentThread.getUncaughtExceptionHandler();
handler.uncaughtException(currentThread, error);
}
public static void setErrorHandler(Consumer<? super Throwable> errorHandler) {
PrinterPlugins.errorHandler = errorHandler;
}
public static PrinterFlowListener getOnPrinterFlowHandler() {
if (onPrinterFlowHandler == null) {
new NullPointerException("onPrinterFlowHandler called with null");
}
return onPrinterFlowHandler;
}
public static void setOnPrinterFlowHandler(PrinterFlowListener onPrinterFlowHandler) {
PrinterPlugins.onPrinterFlowHandler = onPrinterFlowHandler;
}
}
......@@ -10,11 +10,7 @@ import android.os.Environment;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
import android.text.TextUtils;
import com.elvishew.xlog.XLog;
import com.gingersoft.gsa.cloud.common.utils.encryption.BASE64Encoder;
import com.gingersoft.gsa.cloud.common.utils.view.BitmapUtil;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
......
......@@ -9,8 +9,6 @@ import android.os.Looper;
import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;
import com.elvishew.xlog.XLog;
import com.gingersoft.gsa.cloud.common.Api;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.constans.HttpsConstans;
......
......@@ -18,6 +18,7 @@ import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.schedulers.Schedulers;
import okhttp3.Cache;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
......@@ -47,6 +48,7 @@ public class OkHttp3Utils {
mOkHttpClient = new OkHttpClient.Builder()
.connectTimeout(OkHttpConfig.REQUEST_TIMEOUT, TimeUnit.SECONDS)
.readTimeout(OkHttpConfig.REQUEST_TIMEOUT, TimeUnit.SECONDS)
.cache(new Cache(new File(OkHttpConfig.CACHE_DIRECTORY), OkHttpConfig.CACHE_MAXSIZE))
.addInterceptor(new HeadersInterceptor())
.addInterceptor(new RequestInterceptor())
.build();
......@@ -219,7 +221,6 @@ public class OkHttp3Utils {
}
/**
* 心跳接口報錯,推送給相關人員
* 版本,時間,RP_HD001,Gingersoft,GS1,26ErrorMsg:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
......
package com.gingersoft.gsa.cloud.common.utils.xlog;
import com.elvishew.xlog.printer.file.naming.FileNameGenerator;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.jess.arms.utils.DeviceUtils;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
/**
* 作者:ELEGANT_BIN
* 版本:1.6.0
* 创建日期:2019-12-06
* 修订历史:2019-12-06
* 描述:
*/
public class DateFileNameGenerator implements FileNameGenerator {
ThreadLocal<SimpleDateFormat> mLocalDateFormat = new ThreadLocal<SimpleDateFormat>() {
@Override
protected SimpleDateFormat initialValue() {
return new SimpleDateFormat("yyyy-MM-dd", Locale.US);
}
};
@Override
public boolean isFileNameChangeable() {
return true;
}
/**
* Generate a file name which represent a specific date.
*/
@Override
public String generateFileName(int logLevel, long timestamp) {
SimpleDateFormat sdf = mLocalDateFormat.get();
sdf.setTimeZone(TimeZone.getDefault());
String machineName = "test_machine";
String fileName = machineName + "-" + DeviceUtils.getVersionName(GsaCloudApplication.getAppContext()) + "-" + sdf.format(new Date(timestamp));
return fileName;
}
}
package com.gingersoft.gsa.cloud.common.utils.xlog;
import com.elvishew.xlog.printer.file.backup.BackupStrategy;
import java.io.File;
/**
* 作者:ELEGANT_BIN
* 版本:1.6.0
* 创建日期:2019-12-05
* 修订历史:2019-12-05
* 描述:
*/
public class MyBackupStrategy implements BackupStrategy {
private long maxSize;
/**
* Constructor.
*
* @param maxSize the max size the file can reach
*/
public MyBackupStrategy(long maxSize) {
this.maxSize = maxSize;
}
@Override
public boolean shouldBackup(File file) {
return file.length() > maxSize;
}
}
......@@ -23,7 +23,7 @@ public class ColorBean {
* editTime : Dec 12, 2018 6:03:58 PM
*/
// @Property(nameInDb = "_id")
@Id(autoincrement = true)
@Id
private Long colorId;
private String colorStart;
private String colorStop;
......
......@@ -293,8 +293,9 @@ public class Food {
* 顏色ID
*/
private long colorId;
// @ToOne(joinProperty = "colorId") //这个是注解绑定 hid就是上面一行的colorId
// private ColorBean colorBean;
@ToOne(joinProperty = "colorId") //这个是注解绑定 hid就是上面一行的colorId
private ColorBean colorBean;
/**
* 自定義字段
......@@ -324,6 +325,14 @@ public class Food {
/**是否组合食品*/
@Transient
private boolean isComboFood = false;
/** Used to resolve relations */
@Generated(hash = 2040040024)
private transient DaoSession daoSession;
/** Used for active entity operations. */
@Generated(hash = 1296197325)
private transient FoodDao myDao;
@Generated(hash = 292980300)
private transient Long colorBean__resolvedKey;
@Generated(hash = 60268763)
public Food(Long id, long parentId, long restaurantId, byte isParent, long seqNo, String foodName,
String foodName1, String foodName2, String plu, String posFid, String foodDesc,
......@@ -1211,4 +1220,80 @@ public class Food {
this.isStatistic = isStatistic;
}
/** To-one relationship, resolved on first access. */
@Generated(hash = 972194621)
public ColorBean getColorBean() {
long __key = this.colorId;
if (colorBean__resolvedKey == null || !colorBean__resolvedKey.equals(__key)) {
final DaoSession daoSession = this.daoSession;
if (daoSession == null) {
throw new DaoException("Entity is detached from DAO context");
}
ColorBeanDao targetDao = daoSession.getColorBeanDao();
ColorBean colorBeanNew = targetDao.load(__key);
synchronized (this) {
colorBean = colorBeanNew;
colorBean__resolvedKey = __key;
}
}
return colorBean;
}
/** called by internal mechanisms, do not call yourself. */
@Generated(hash = 453682256)
public void setColorBean(@NotNull ColorBean colorBean) {
if (colorBean == null) {
throw new DaoException(
"To-one property 'colorId' has not-null constraint; cannot set to-one to null");
}
synchronized (this) {
this.colorBean = colorBean;
colorId = colorBean.getColorId();
colorBean__resolvedKey = colorId;
}
}
/**
* Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
* Entity must attached to an entity context.
*/
@Generated(hash = 128553479)
public void delete() {
if (myDao == null) {
throw new DaoException("Entity is detached from DAO context");
}
myDao.delete(this);
}
/**
* Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
* Entity must attached to an entity context.
*/
@Generated(hash = 1942392019)
public void refresh() {
if (myDao == null) {
throw new DaoException("Entity is detached from DAO context");
}
myDao.refresh(this);
}
/**
* Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
* Entity must attached to an entity context.
*/
@Generated(hash = 713229351)
public void update() {
if (myDao == null) {
throw new DaoException("Entity is detached from DAO context");
}
myDao.update(this);
}
/** called by internal mechanisms, do not call yourself. */
@Generated(hash = 505459956)
public void __setDaoSession(DaoSession daoSession) {
this.daoSession = daoSession;
myDao = daoSession != null ? daoSession.getFoodDao() : null;
}
}
......@@ -7,9 +7,15 @@ import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Property;
import org.greenrobot.greendao.annotation.ToOne;
import org.greenrobot.greendao.annotation.Transient;
import java.util.Date;
import org.greenrobot.greendao.DaoException;
import com.gingersoft.gsa.cloud.database.greendao.DaoSession;
import com.gingersoft.gsa.cloud.database.greendao.ColorBeanDao;
import org.greenrobot.greendao.annotation.NotNull;
import com.gingersoft.gsa.cloud.database.greendao.ModifierDao;
/**
* 作者:ELEGANT_BIN
......@@ -46,7 +52,6 @@ public class Modifier {
*/
private double lunchboxPrice;
private long colorId;
/**
* 圖片
*/
......@@ -203,6 +208,14 @@ public class Modifier {
* 是否參與會員喜好統計 0 參與 1 不參與
*/
private long isStatistic;
/**
* 顏色ID
*/
private long colorId;
@ToOne(joinProperty = "colorId") //这个是注解绑定 hid就是上面一行的colorId
private ColorBean colorBean;
/**
* 自定義字段
......@@ -241,17 +254,28 @@ public class Modifier {
/**是否細項組返回按鈕*/
private boolean isReturn = false;
/** Used to resolve relations */
@Generated(hash = 2040040024)
private transient DaoSession daoSession;
/** Used for active entity operations. */
@Generated(hash = 811918038)
private transient ModifierDao myDao;
@Generated(hash = 292980300)
private transient Long colorBean__resolvedKey;
@Generated(hash = 1490458360)
@Generated(hash = 1099399041)
public Modifier(Long dbid, long mid, long topId, long restaurantId, String modifierName, long seqNo, double marketPrice,
double price, double lunchboxPrice, long colorId, String imageUrl, long invisible, double cost, Date startDate,
Date endDate, long like, long totalSold, long majorMainId, long deptId, String createBy, Date createTime,
String updateBy, Date updateTime, String posFid, String pId, long autoMod, long blueEdit, long autoMerge,
long customMsg, long isParent, String modifierName1, String modifierName2, double multiple, String printSet,
String ktSetting, long modComm, long modTaste, long modMsg, long ktFireCourse, long ableDisCount,
long printToBill, long ktPrintMainItem, long ktShowPrice, long ktFont, long conditions, long isRt, byte visible,
long deletes, long isStatistic) {
double price, double lunchboxPrice, String imageUrl, long invisible, double cost, Date startDate, Date endDate,
long like, long totalSold, long majorMainId, long deptId, String createBy, Date createTime, String updateBy,
Date updateTime, String posFid, String pId, long autoMod, long blueEdit, long autoMerge, long customMsg,
long isParent, String modifierName1, String modifierName2, double multiple, String printSet, String ktSetting,
long modComm, long modTaste, long modMsg, long ktFireCourse, long ableDisCount, long printToBill,
long ktPrintMainItem, long ktShowPrice, long ktFont, long conditions, long isRt, byte visible, long deletes,
long isStatistic, long colorId) {
this.dbid = dbid;
this.mid = mid;
this.topId = topId;
......@@ -261,7 +285,6 @@ public class Modifier {
this.marketPrice = marketPrice;
this.price = price;
this.lunchboxPrice = lunchboxPrice;
this.colorId = colorId;
this.imageUrl = imageUrl;
this.invisible = invisible;
this.cost = cost;
......@@ -301,6 +324,7 @@ public class Modifier {
this.visible = visible;
this.deletes = deletes;
this.isStatistic = isStatistic;
this.colorId = colorId;
}
@Generated(hash = 385685553)
......@@ -946,4 +970,79 @@ public class Modifier {
public void setSelectQty(int selectQty) {
this.selectQty = selectQty;
}
/** To-one relationship, resolved on first access. */
@Generated(hash = 972194621)
public ColorBean getColorBean() {
long __key = this.colorId;
if (colorBean__resolvedKey == null || !colorBean__resolvedKey.equals(__key)) {
final DaoSession daoSession = this.daoSession;
if (daoSession == null) {
throw new DaoException("Entity is detached from DAO context");
}
ColorBeanDao targetDao = daoSession.getColorBeanDao();
ColorBean colorBeanNew = targetDao.load(__key);
synchronized (this) {
colorBean = colorBeanNew;
colorBean__resolvedKey = __key;
}
}
return colorBean;
}
/** called by internal mechanisms, do not call yourself. */
@Generated(hash = 453682256)
public void setColorBean(@NotNull ColorBean colorBean) {
if (colorBean == null) {
throw new DaoException("To-one property 'colorId' has not-null constraint; cannot set to-one to null");
}
synchronized (this) {
this.colorBean = colorBean;
colorId = colorBean.getColorId();
colorBean__resolvedKey = colorId;
}
}
/**
* Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
* Entity must attached to an entity context.
*/
@Generated(hash = 128553479)
public void delete() {
if (myDao == null) {
throw new DaoException("Entity is detached from DAO context");
}
myDao.delete(this);
}
/**
* Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
* Entity must attached to an entity context.
*/
@Generated(hash = 1942392019)
public void refresh() {
if (myDao == null) {
throw new DaoException("Entity is detached from DAO context");
}
myDao.refresh(this);
}
/**
* Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
* Entity must attached to an entity context.
*/
@Generated(hash = 713229351)
public void update() {
if (myDao == null) {
throw new DaoException("Entity is detached from DAO context");
}
myDao.update(this);
}
/** called by internal mechanisms, do not call yourself. */
@Generated(hash = 956718133)
public void __setDaoSession(DaoSession daoSession) {
this.daoSession = daoSession;
myDao = daoSession != null ? daoSession.getModifierDao() : null;
}
}
......@@ -47,7 +47,7 @@ public class ColorBeanDao extends AbstractDao<ColorBean, Long> {
public static void createTable(Database db, boolean ifNotExists) {
String constraint = ifNotExists? "IF NOT EXISTS ": "";
db.execSQL("CREATE TABLE " + constraint + "\"COLOR_BEAN\" (" + //
"\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: colorId
"\"_id\" INTEGER PRIMARY KEY ," + // 0: colorId
"\"COLOR_START\" TEXT," + // 1: colorStart
"\"COLOR_STOP\" TEXT," + // 2: colorStop
"\"FONT_COLOR\" TEXT," + // 3: fontColor
......
package com.gingersoft.gsa.cloud.database.greendao;
import java.util.List;
import java.util.ArrayList;
import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;
import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.internal.SqlUtils;
import org.greenrobot.greendao.internal.DaoConfig;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;
import com.gingersoft.gsa.cloud.database.bean.ColorBean;
import com.gingersoft.gsa.cloud.database.bean.Food;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
......@@ -93,6 +98,8 @@ public class FoodDao extends AbstractDao<Food, Long> {
public final static Property ColorId = new Property(66, long.class, "colorId", false, "COLOR_ID");
}
private DaoSession daoSession;
public FoodDao(DaoConfig config) {
super(config);
......@@ -100,6 +107,7 @@ public class FoodDao extends AbstractDao<Food, Long> {
public FoodDao(DaoConfig config, DaoSession daoSession) {
super(config, daoSession);
this.daoSession = daoSession;
}
/** Creates the underlying database table. */
......@@ -470,6 +478,12 @@ public class FoodDao extends AbstractDao<Food, Long> {
}
@Override
protected final void attachEntity(Food entity) {
super.attachEntity(entity);
entity.__setDaoSession(daoSession);
}
@Override
public Long readKey(Cursor cursor, int offset) {
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
}
......@@ -644,4 +658,97 @@ public class FoodDao extends AbstractDao<Food, Long> {
return true;
}
private String selectDeep;
protected String getSelectDeep() {
if (selectDeep == null) {
StringBuilder builder = new StringBuilder("SELECT ");
SqlUtils.appendColumns(builder, "T", getAllColumns());
builder.append(',');
SqlUtils.appendColumns(builder, "T0", daoSession.getColorBeanDao().getAllColumns());
builder.append(" FROM FOOD T");
builder.append(" LEFT JOIN COLOR_BEAN T0 ON T.\"COLOR_ID\"=T0.\"_id\"");
builder.append(' ');
selectDeep = builder.toString();
}
return selectDeep;
}
protected Food loadCurrentDeep(Cursor cursor, boolean lock) {
Food entity = loadCurrent(cursor, 0, lock);
int offset = getAllColumns().length;
ColorBean colorBean = loadCurrentOther(daoSession.getColorBeanDao(), cursor, offset);
if(colorBean != null) {
entity.setColorBean(colorBean);
}
return entity;
}
public Food loadDeep(Long key) {
assertSinglePk();
if (key == null) {
return null;
}
StringBuilder builder = new StringBuilder(getSelectDeep());
builder.append("WHERE ");
SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
String sql = builder.toString();
String[] keyArray = new String[] { key.toString() };
Cursor cursor = db.rawQuery(sql, keyArray);
try {
boolean available = cursor.moveToFirst();
if (!available) {
return null;
} else if (!cursor.isLast()) {
throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
}
return loadCurrentDeep(cursor, true);
} finally {
cursor.close();
}
}
/** Reads all available rows from the given cursor and returns a list of new ImageTO objects. */
public List<Food> loadAllDeepFromCursor(Cursor cursor) {
int count = cursor.getCount();
List<Food> list = new ArrayList<Food>(count);
if (cursor.moveToFirst()) {
if (identityScope != null) {
identityScope.lock();
identityScope.reserveRoom(count);
}
try {
do {
list.add(loadCurrentDeep(cursor, false));
} while (cursor.moveToNext());
} finally {
if (identityScope != null) {
identityScope.unlock();
}
}
}
return list;
}
protected List<Food> loadDeepAllAndCloseCursor(Cursor cursor) {
try {
return loadAllDeepFromCursor(cursor);
} finally {
cursor.close();
}
}
/** A raw-style query where you can pass any WHERE clause and arguments. */
public List<Food> queryDeep(String where, String... selectionArg) {
Cursor cursor = db.rawQuery(getSelectDeep() + where, selectionArg);
return loadDeepAllAndCloseCursor(cursor);
}
}
......@@ -2,6 +2,7 @@ package com.gingersoft.gsa.cloud.database.utils;
import android.content.Context;
import android.database.Cursor;
import android.graphics.Color;
import android.text.TextUtils;
import android.util.Log;
......@@ -166,44 +167,62 @@ public class ComboItemDaoUtils {
// sql = "SELECT c.*,f.FOOD_NAME,f.FOOD_NAME1,f.FOOD_NAME2,f.PRICE,f.FOOD_SUMMARY,f.AUTO_MOD,f.PRINT_SETING,f.ABLE_DISCOUNT,SELECT_QTY,DEF_MODIFIER,INVISIBLE,POINTS_ADD,POINTS_RATIO,POINTS_REDEEM,SERVICE_CHARGE,c.DIFF_AMT FROM COMBO_ITEM c join FOOD f on c.FID=f.FID and f.INVISIBLE!=1 and where FOOD_SUMMARY LIKE %s join FOOD_COMBO r on r.COM_ID=c.COM_ID and r.DELETES!=1";
// sql = String.format(sql, foodSummary);
// } else {
sql = "SELECT c.*,f.FOOD_NAME,f.FOOD_NAME1,f.FOOD_NAME2,f.PRICE,f.FOOD_SUMMARY,f.AUTO_MOD,f.PRINT_SETING,f.ABLE_DISCOUNT,SELECT_QTY,DEF_MODIFIER,INVISIBLE,POINTS_ADD,POINTS_RATIO,POINTS_REDEEM,SERVICE_CHARGE,c.DIFF_AMT,c.SEQ_NO FROM COMBO_ITEM c join FOOD f on c.FID=f.FID and f.INVISIBLE!=1 join FOOD_COMBO r on r.COM_ID=c.COM_ID and r.DELETES!=1";
sql = "SELECT c.*,f.FOOD_NAME,f.FOOD_NAME1,f.FOOD_NAME2,f.PRICE,f.FOOD_SUMMARY,f.AUTO_MOD,f.PRINT_SETING,f.ABLE_DISCOUNT,SELECT_QTY,DEF_MODIFIER,INVISIBLE,POINTS_ADD,POINTS_RATIO,POINTS_REDEEM,SERVICE_CHARGE,c.DIFF_AMT,c.SEQ_NO,col.ANDROID_COLOR,col.ANDROID_FONT_COLOR FROM COMBO_ITEM c join FOOD f on c.FID=f.FID and f.INVISIBLE!=1 join FOOD_COMBO r on r.COM_ID=c.COM_ID and r.DELETES!=1 join COLOR_BEAN col on f.COLOR_ID=col._id";
// }
if (fid > 0) {
sql = sql + " where r.FID='" + fid + "' order by c.COM_ID,f.CREATE_TIME desc";
}
Cursor c = mManager.getDaoSession().getFoodDao().getDatabase().rawQuery(sql, null);
while (c.moveToNext()) {
ComboItem item = new ComboItem();
item.setFid(c.getLong(c.getColumnIndex("FID")));
item.setComId(c.getLong(c.getColumnIndex("COM_ID")));
Cursor c = null;
try {
c = mManager.getDaoSession().getFoodDao().getDatabase().rawQuery(sql, null);
while (c.moveToNext()) {
ComboItem item = new ComboItem();
item.setFid(c.getLong(c.getColumnIndex("FID")));
item.setComId(c.getLong(c.getColumnIndex("COM_ID")));
// item.setPrice(c.getDouble(c.getColumnIndex("PRICE")));
item.setPrice(c.getDouble(c.getColumnIndex("DIFF_AMT")));
item.setSeqNo(c.getLong(c.getColumnIndex("SEQ_NO")));
item.setQty(c.getLong(c.getColumnIndex("QTY")));
item.setName(c.getString(c.getColumnIndex("FOOD_NAME")));
item.setName1(c.getString(c.getColumnIndex("FOOD_NAME1")));
item.setName2(c.getString(c.getColumnIndex("FOOD_NAME2")));
item.setVisible(c.getLong(c.getColumnIndex("VISIBLE")));
item.setAutoMode(c.getInt(c.getColumnIndex("AUTO_MOD")));
item.setSelectQty(c.getInt(c.getColumnIndex("SELECT_QTY")));
item.setFoodSummary(c.getString(c.getColumnIndex("FOOD_SUMMARY")));
item.setInvisible(c.getLong(c.getColumnIndex("INVISIBLE")));
item.setPrintSeting(c.getString(c.getColumnIndex("PRINT_SETING")));
item.setAblediscount(c.getLong(c.getColumnIndex("ABLE_DISCOUNT")));
item.setPointsAdd(c.getDouble(c.getColumnIndex("POINTS_ADD")));
item.setPointsRatio(c.getLong(c.getColumnIndex("POINTS_RATIO")));
item.setPointsRedeem(c.getDouble(c.getColumnIndex("POINTS_REDEEM")));
item.setServiceCharge(c.getInt(c.getColumnIndex("SERVICE_CHARGE")));
String defmodifier = c.getString(c.getColumnIndex("DEF_MODIFIER"));
if (!TextUtils.isEmpty(defmodifier) && !", ".equals(defmodifier)) {
item.setDefmodifier(defmodifier);
}
item.setPrice(c.getDouble(c.getColumnIndex("DIFF_AMT")));
item.setSeqNo(c.getLong(c.getColumnIndex("SEQ_NO")));
item.setQty(c.getLong(c.getColumnIndex("QTY")));
item.setName(c.getString(c.getColumnIndex("FOOD_NAME")));
item.setName1(c.getString(c.getColumnIndex("FOOD_NAME1")));
item.setName2(c.getString(c.getColumnIndex("FOOD_NAME2")));
item.setVisible(c.getLong(c.getColumnIndex("VISIBLE")));
item.setAutoMode(c.getInt(c.getColumnIndex("AUTO_MOD")));
item.setSelectQty(c.getInt(c.getColumnIndex("SELECT_QTY")));
item.setFoodSummary(c.getString(c.getColumnIndex("FOOD_SUMMARY")));
item.setInvisible(c.getLong(c.getColumnIndex("INVISIBLE")));
item.setPrintSeting(c.getString(c.getColumnIndex("PRINT_SETING")));
item.setAblediscount(c.getLong(c.getColumnIndex("ABLE_DISCOUNT")));
item.setPointsAdd(c.getDouble(c.getColumnIndex("POINTS_ADD")));
item.setPointsRatio(c.getLong(c.getColumnIndex("POINTS_RATIO")));
item.setPointsRedeem(c.getDouble(c.getColumnIndex("POINTS_REDEEM")));
item.setServiceCharge(c.getInt(c.getColumnIndex("SERVICE_CHARGE")));
String defmodifier = c.getString(c.getColumnIndex("DEF_MODIFIER"));
if (!TextUtils.isEmpty(defmodifier) && !", ".equals(defmodifier)) {
item.setDefmodifier(defmodifier);
}
String backgroupColor = c.getString(c.getColumnIndex("ANDROID_COLOR"));
String fontColor = c.getString(c.getColumnIndex("ANDROID_FONT_COLOR"));
if (!TextUtils.isEmpty(backgroupColor)) {
item.setBgColor(Color.parseColor(backgroupColor));
}
if (!TextUtils.isEmpty(fontColor)) {
item.setFontColor(Color.parseColor(fontColor));
}
// if (item.isVisible()) {
comboItems.add(item);
comboItems.add(item);
// }
}
} catch (Exception e) {
if (c != null) {
c.close();
}
} finally {
if (c != null) {
c.close();
}
}
c.close();
return comboItems;
}
......
......@@ -163,7 +163,7 @@ public class FoodDaoUtils {
public List<Food> queryFoodGroupByQueryBuilder() {
QueryBuilder<Food> queryBuilder = mManager.getDaoSession().queryBuilder(Food.class);
long currentTime = System.currentTimeMillis();
return queryBuilder.where(queryBuilder.and(
return queryBuilder.where(queryBuilder.and(
FoodDao.Properties.ParentId.eq(0),
FoodDao.Properties.StartDate.le(currentTime),
FoodDao.Properties.EndDate.ge(currentTime))).orderAsc(FoodDao.Properties.SeqNo).list();
......@@ -206,11 +206,14 @@ public class FoodDaoUtils {
public List<Food> queryFoodByQueryBuilder(long parentId, int foodSummary) {
QueryBuilder<Food> queryBuilder = mManager.getDaoSession().queryBuilder(Food.class);
long currentTime = System.currentTimeMillis();
return queryBuilder.where(queryBuilder.and(
// queryBuilder.join(ColorBeanDao.Properties.AndroidColor, Food.class, FoodDao.Properties.ColorId);
queryBuilder.where(queryBuilder.and(
FoodDao.Properties.ParentId.eq(parentId),
FoodDao.Properties.Invisible.notEq(1),
FoodDao.Properties.StartDate.le(currentTime),
FoodDao.Properties.EndDate.ge(currentTime))).orderAsc(FoodDao.Properties.SeqNo).list();
FoodDao.Properties.EndDate.ge(currentTime)));
return queryBuilder.orderAsc(FoodDao.Properties.SeqNo).list();
}
public List<Food> queryAllFoodByQueryBuilder() {
......
......@@ -2,6 +2,7 @@ package com.gingersoft.gsa.cloud.database.utils;
import android.content.Context;
import android.database.Cursor;
import android.graphics.Color;
import android.text.TextUtils;
import android.util.Log;
......@@ -196,13 +197,10 @@ public class ModifierDaoUtils {
ArrayList<Modifier> fms = new ArrayList<>();
// QueryBuilder<Modifier> queryBuilder = mManager.getDaoSession().queryBuilder(Modifier.class);
// String parentSql = "SELECT * FROM MODIFIER WHERE MOD_MSG=1 and VISIBLE=0 and IS_PARENT=1";
String parentSql = "SELECT * FROM MODIFIER WHERE MOD_MSG=1 and IS_PARENT=1";
String parentSql = "SELECT m.*,col.ANDROID_COLOR,col.ANDROID_FONT_COLOR FROM MODIFIER m join COLOR_BEAN col on m.COLOR_ID=col._id where MOD_MSG=1 and IS_PARENT=1";
List<Modifier> parentModifiers = query_modifier_Child_new(parentSql, 0);
// String childSql = "SELECT * FROM MODIFIER WHERE MOD_MSG=1 and VISIBLE=0 and IS_PARENT=0";
String childSql = "SELECT * FROM MODIFIER WHERE MOD_MSG=1 and IS_PARENT=0";
String childSql = "SELECT m.*,col.ANDROID_COLOR,col.ANDROID_FONT_COLOR FROM MODIFIER m join COLOR_BEAN col on m.COLOR_ID=col._id where MOD_MSG=1 and IS_PARENT=0";
List<Modifier> childModifiers = query_modifier_Child_new(childSql, 0);
fms.addAll(parentModifiers);
......@@ -233,11 +231,12 @@ public class ModifierDaoUtils {
// ModifierDao.Properties.IsParent.eq(0))).orderAsc(ModifierDao.Properties.SeqNo).list();
// String parentSql = "SELECT * FROM MODIFIER WHERE MOD_TASTE=1 and VISIBLE=0 and IS_PARENT=1";
String parentSql = "SELECT * FROM MODIFIER WHERE MOD_TASTE=1 and IS_PARENT=1";
String parentSql = "SELECT m.*,col.ANDROID_COLOR,col.ANDROID_FONT_COLOR FROM MODIFIER m join COLOR_BEAN col on m.COLOR_ID=col._id where MOD_TASTE=1 and IS_PARENT=1";
List<Modifier> parentModifiers = query_modifier_Child_new(parentSql, 0);
// String childSql = "SELECT * FROM MODIFIER WHERE MOD_TASTE=1 and VISIBLE=0 and IS_PARENT=0";
String childSql = "SELECT * FROM MODIFIER WHERE MOD_TASTE=1 and IS_PARENT=0";
String childSql = "SELECT m.*,col.ANDROID_COLOR,col.ANDROID_FONT_COLOR FROM MODIFIER m join COLOR_BEAN col on m.COLOR_ID=col._id where MOD_TASTE=1 and IS_PARENT=0";
// String childSql = "SELECT * FROM MODIFIER WHERE MOD_TASTE=1 and IS_PARENT=0";
List<Modifier> childModifiers = query_modifier_Child_new(childSql, 0);
fms.addAll(parentModifiers);
......@@ -268,11 +267,14 @@ public class ModifierDaoUtils {
// ModifierDao.Properties.IsParent.eq(0))).orderAsc(ModifierDao.Properties.SeqNo).list();
// String parentSql = "SELECT * FROM MODIFIER WHERE MOD_COMM=1 and VISIBLE=0 and IS_PARENT=1";
String parentSql = "SELECT * FROM MODIFIER WHERE MOD_COMM=1 and IS_PARENT=1";
// String parentSql = "SELECT * FROM MODIFIER WHERE MOD_COMM=1 and IS_PARENT=1";
String parentSql = "SELECT m.*,col.ANDROID_COLOR,col.ANDROID_FONT_COLOR FROM MODIFIER m join COLOR_BEAN col on m.COLOR_ID=col._id where MOD_COMM=1 and IS_PARENT=1";
List<Modifier> parentModifiers = query_modifier_Child_new(parentSql, 0);
// String childSql = "SELECT * FROM MODIFIER WHERE MOD_COMM=1 and VISIBLE=0 and IS_PARENT=0";
String childSql = "SELECT * FROM MODIFIER WHERE MOD_COMM=1 and IS_PARENT=0";
// String childSql = "SELECT * FROM MODIFIER WHERE MOD_COMM=1 and IS_PARENT=0";
String childSql = "SELECT m.*,col.ANDROID_COLOR,col.ANDROID_FONT_COLOR FROM MODIFIER m join COLOR_BEAN col on m.COLOR_ID=col._id where MOD_COMM=1 and IS_PARENT=0";
List<Modifier> childModifiers = query_modifier_Child_new(childSql, 0);
fms.addAll(parentModifiers);
......@@ -303,10 +305,12 @@ public class ModifierDaoUtils {
// ModifierDao.Properties.Visible.eq(0),
// ModifierDao.Properties.IsParent.eq(0))).orderAsc(ModifierDao.Properties.SeqNo).list();
String parentSql = "SELECT * FROM MODIFIER WHERE TOP_ID='" + topid + "' and VISIBLE=0 and IS_PARENT=1";
// String parentSql = "SELECT * FROM MODIFIER WHERE TOP_ID='" + topid + "' and VISIBLE=0 and IS_PARENT=1";
String parentSql = "SELECT m.*,col.ANDROID_COLOR,col.ANDROID_FONT_COLOR FROM MODIFIER m join COLOR_BEAN col on m.COLOR_ID=col._id where TOP_ID='" + topid + "' and VISIBLE=0 and IS_PARENT=1";
List<Modifier> parentModifiers = query_modifier_Child_new(parentSql, 0);
String childSql = "SELECT * FROM MODIFIER WHERE TOP_ID='" + topid + "' and VISIBLE=0 and IS_PARENT=0";
// String childSql = "SELECT * FROM MODIFIER WHERE TOP_ID='" + topid + "' and VISIBLE=0 and IS_PARENT=0";
String childSql = "SELECT m.*,col.ANDROID_COLOR,col.ANDROID_FONT_COLOR FROM MODIFIER m join COLOR_BEAN col on m.COLOR_ID=col._id where TOP_ID='" + topid + "' and VISIBLE=0 and IS_PARENT=0";
List<Modifier> childModifiers = query_modifier_Child_new(childSql, 0);
fms.addAll(parentModifiers);
......@@ -321,8 +325,8 @@ public class ModifierDaoUtils {
// String sql = " SELECT MODIFIER.mid,MODIFIER_NAME,MODIFIER_NAME1,MODIFIER_NAME2,TOP_ID,PRICE,MOD_COMM,MOD_TASTE,MOD_MSG,VISIBLE,MULTIPLE,IS_PARENT" +
// " FROM MODIFIER join FOOD_MODIFIER on MODIFIER.MID=FOOD_MODIFIER.MID where MODIFIER.VISIBLE=0 and FOOD_MODIFIER.FID='" + fid + "' order by FOOD_MODIFIER.seq,MODIFIER.SEQ_NO";
String sql = " SELECT MODIFIER.MID,MODIFIER_NAME,MODIFIER_NAME1,MODIFIER_NAME2,TOP_ID,PRICE,MOD_COMM,MOD_TASTE,MOD_MSG,INVISIBLE,VISIBLE,MULTIPLE,IS_PARENT,MAX_QTY,MIN_QTY,ABLE_DIS_COUNT,PRINT_SET,COST" +
" FROM MODIFIER join FOOD_MODIFIER fm on MODIFIER.MID=FOOD_MODIFIER.MID where MODIFIER.INVISIBLE!=1 and FOOD_MODIFIER.FID='" + fid + "' order by FOOD_MODIFIER.SEQ_NO,MODIFIER.TOP_ID,MODIFIER.SEQ_NO";
String sql = " SELECT MODIFIER.MID,MODIFIER_NAME,MODIFIER_NAME1,MODIFIER_NAME2,TOP_ID,PRICE,MOD_COMM,MOD_TASTE,MOD_MSG,INVISIBLE,VISIBLE,MULTIPLE,IS_PARENT,MAX_QTY,MIN_QTY,ABLE_DIS_COUNT,PRINT_SET,COST,col.ANDROID_COLOR,col.ANDROID_FONT_COLOR" +
" FROM MODIFIER join FOOD_MODIFIER fm on MODIFIER.MID=FOOD_MODIFIER.MID join COLOR_BEAN col on m.COLOR_ID=col._id where MODIFIER.INVISIBLE!=1 and FOOD_MODIFIER.FID='" + fid + "' order by FOOD_MODIFIER.SEQ_NO,MODIFIER.TOP_ID,MODIFIER.SEQ_NO";
List<Modifier> mfs_child = new ArrayList<>();
......@@ -334,15 +338,15 @@ public class ModifierDaoUtils {
switch (mode) {
case modifierMode_All:
sqlstr = " SELECT m.MID,MODIFIER_NAME,MODIFIER_NAME1,MODIFIER_NAME2,TOP_ID,PRICE,MOD_COMM,MOD_TASTE,MOD_MSG,INVISIBLE,VISIBLE,MULTIPLE,IS_PARENT,DEFMODIFIER,MAX_QTY,MIN_QTY,ABLE_DIS_COUNT,PRINT_SET,KT_SETTING,COST" +
" FROM MODIFIER m join FOOD_MODIFIER fm on m.TOP_ID=fm.MID where m.INVISIBLE!=1 and m.IS_PARENT=1 and fm.FID='" + fid + "' order by fm.SEQ_NO,m.TOP_ID,m.SEQ_NO";
sqlstr = " SELECT m.MID,MODIFIER_NAME,MODIFIER_NAME1,MODIFIER_NAME2,TOP_ID,PRICE,MOD_COMM,MOD_TASTE,MOD_MSG,INVISIBLE,VISIBLE,MULTIPLE,IS_PARENT,DEFMODIFIER,MAX_QTY,MIN_QTY,ABLE_DIS_COUNT,PRINT_SET,KT_SETTING,COST,col.ANDROID_COLOR,col.ANDROID_FONT_COLOR" +
" FROM MODIFIER m join FOOD_MODIFIER fm on m.TOP_ID=fm.MID join COLOR_BEAN col on m.COLOR_ID=col._id where m.INVISIBLE!=1 and m.IS_PARENT=1 and fm.FID='" + fid + "' order by fm.SEQ_NO,m.TOP_ID,m.SEQ_NO";
mfs_child1 = query_modifier_Child_new(sqlstr, fid);
List<Modifier> mfs_child2 = new ArrayList<>();
sqlstr = " SELECT m.MID,MODIFIER_NAME,MODIFIER_NAME1,MODIFIER_NAME2,TOP_ID,PRICE,MOD_COMM,MOD_TASTE,MOD_MSG,INVISIBLE,VISIBLE,MULTIPLE,IS_PARENT,DEFMODIFIER,MAX_QTY,MIN_QTY,ABLE_DIS_COUNT,PRINT_SET,KT_SETTING,COST" +
" FROM MODIFIER m join FOOD_MODIFIER fm on m.TOP_ID=fm.MID where m.INVISIBLE!=1 and m.IS_PARENT=0 and fm.FID='" + fid + "' order by fm.SEQ_NO,m.TOP_ID,m.SEQ_NO";
sqlstr = " SELECT m.MID,MODIFIER_NAME,MODIFIER_NAME1,MODIFIER_NAME2,TOP_ID,PRICE,MOD_COMM,MOD_TASTE,MOD_MSG,INVISIBLE,VISIBLE,MULTIPLE,IS_PARENT,DEFMODIFIER,MAX_QTY,MIN_QTY,ABLE_DIS_COUNT,PRINT_SET,KT_SETTING,COST,col.ANDROID_COLOR,col.ANDROID_FONT_COLOR" +
" FROM MODIFIER m join FOOD_MODIFIER fm on m.TOP_ID=fm.MID join COLOR_BEAN col on m.COLOR_ID=col._id where m.INVISIBLE!=1 and m.IS_PARENT=0 and fm.FID='" + fid + "' order by fm.SEQ_NO,m.TOP_ID,m.SEQ_NO";
mfs_child2 = query_modifier_Child_new(sqlstr, fid);
mfs_child1.addAll(mfs_child2);
......@@ -407,6 +411,15 @@ public class ModifierDaoUtils {
modifier.setDefmodifier(defmodifier);
}
}
String backgroupColor = c.getString(c.getColumnIndex("ANDROID_COLOR"));
String fontColor = c.getString(c.getColumnIndex("ANDROID_FONT_COLOR"));
if (!TextUtils.isEmpty(backgroupColor)) {
modifier.setBgColor(Color.parseColor(backgroupColor));
}
if (!TextUtils.isEmpty(fontColor)) {
modifier.setFontColor(Color.parseColor(fontColor));
}
// if (order.isVisible()) {
modifiers.add(modifier);
// }
......
package com.gingersoft.gsa.cloud.print;
import android.util.Log;
import com.gingersoft.gsa.cloud.common.constans.PrintConstans;
import com.gingersoft.gsa.cloud.common.logan.LoganManager;
import com.gingersoft.gsa.cloud.common.printer.plugins.PrinterPlugins;
import com.gingersoft.gsa.cloud.common.utils.log.LogUtil;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.ref.WeakReference;
import java.net.ConnectException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketTimeoutException;
......@@ -66,7 +62,7 @@ public class PrintSocketHolder {
return ERROR_9;
}
try {
PrinterPlugins.getOnPrinterFlowHandler().connectionBefore("網絡打印機", ip, port, PrintConstans.SO_TIMEOUT, PrintConstans.PRINT_TIMEOUT);
PrinterFlowProxy.newInstance().dispatchConnectionBefore("網絡打印機", ip, port, PrintConstans.SO_TIMEOUT, PrintConstans.PRINT_TIMEOUT);
socket = new Socket();
//建立連接
InetSocketAddress socketAddress = new InetSocketAddress(ip, port);
......@@ -93,8 +89,8 @@ public class PrintSocketHolder {
return ERROR_7;
} catch (IOException e) {
e.printStackTrace();
PrinterPlugins.getOnPrinterFlowHandler().connectionError(e);
LogUtil.e("eee", "prj 熱敏連接打印機出錯IOException:" + ip + ":" + port + "詳細:" + e.getMessage());
PrinterFlowProxy.newInstance().dispatchConnectionError(e);
return ERROR_7;
} catch (Exception e) {
closeSocket();
......@@ -113,7 +109,7 @@ public class PrintSocketHolder {
} catch (IOException e) {
LoganManager.w_printer(TAG, "獲取打印機輸入流異常: " + socket.getInetAddress() + e.getMessage());
closeSocket();
PrinterPlugins.getOnPrinterFlowHandler().connectionError(e);
PrinterFlowProxy.newInstance().dispatchConnectionError(e);
return ERROR_10;
}
return ERROR_0;
......@@ -144,8 +140,7 @@ public class PrintSocketHolder {
out.flush();
} catch (IOException | NullPointerException e) {
LoganManager.w_printer(TAG, "打印prj寫入數據异常: " + e.getMessage());
LogUtil.e("eee", "prj 熱敏寫入數據異常" + e.getMessage());
PrinterPlugins.getOnPrinterFlowHandler().onPrintError(e, ERROR_10);
PrinterFlowProxy.newInstance().dispatchPrintError(e, ERROR_10);
closeSocket();
return ERROR_10;
}
......@@ -168,9 +163,9 @@ public class PrintSocketHolder {
int result = getOutputStream();
LogUtil.d("eee", "prj 熱敏獲取輸入流:" + (result == ERROR_0));
if (result == ERROR_0) {
PrinterPlugins.getOnPrinterFlowHandler().connectionSuccess();
PrinterFlowProxy.newInstance().dispatchConnectionSuccess();
} else {
PrinterPlugins.getOnPrinterFlowHandler().connectionError(new Exception("失敗"));
PrinterFlowProxy.newInstance().dispatchConnectionError(new Exception("失敗"));
}
return result;
}
......@@ -204,7 +199,7 @@ public class PrintSocketHolder {
socket = null;
error = true;
}
PrinterPlugins.getOnPrinterFlowHandler().disconnect(null);
PrinterFlowProxy.newInstance().dispatchDisconnect(null);
return error ? ERROR_66 : ERROR_0;
}
......
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