Commit c07bddb7 by Wyh

6.13 完成接單詳情UI,打印機型,其他BUG

parent 6d6f9c24
......@@ -43,7 +43,7 @@ android {
/**
* 版本号
*/
schemaVersion 7
schemaVersion 8
/**
* greendao输出dao的数据库操作实体类文件夹(相对路径 包名+自定义路径名称,包将创建于包名的直接路径下)
*/
......
......@@ -141,10 +141,11 @@ public class TimeUtils {
return sf.format(endDate);
}
/**@param beginTime 開始時間
* @param distance 差距: 昨天天傳負一,今天傳零,明天傳一
* @param type 類型: 1、天 Calendar.DATE 2、年Calendar.YEAR 3、月Calendar.MONTH
* @param sf {@link #DEFAULT_DATE_MD}
/**
* @param beginTime 開始時間
* @param distance 差距: 昨天天傳負一,今天傳零,明天傳一
* @param type 類型: 1、天 Calendar.DATE 2、年Calendar.YEAR 3、月Calendar.MONTH
* @param sf {@link #DEFAULT_DATE_MD}
* @return 獲得從開始時間+distance(偏移時間的年月日)
*/
public static String getBeginDistanceDate(Calendar beginTime, int distance, int type, SimpleDateFormat sf) {
......@@ -473,14 +474,13 @@ public class TimeUtils {
}
/**
*
* @param time
* @param dateFormat
* @return
*/
public static String parseTimeRepeat(String time, SimpleDateFormat dateFormat) {
Date date = null;
if(TextUtils.isEmpty(time)){
if (TextUtils.isEmpty(time)) {
return "";
}
try {
......@@ -498,4 +498,28 @@ public class TimeUtils {
}
return time;
}
/**
* 计算两个日期的相隔天数
*/
public static int daysBetween(Date date1, Date date2) {
Calendar cal = Calendar.getInstance();
cal.setTime(date1);
long time1 = cal.getTimeInMillis();
cal.setTime(date2);
long time2 = cal.getTimeInMillis();
long between_days = (time2 - time1) / (1000 * 3600 * 24);
return Integer.parseInt(String.valueOf(between_days));
}
/**
* 计算两个日期的相隔天数
*/
public static int daysBetween(Calendar startCal, Calendar endCal) {
long time1 = startCal.getTimeInMillis();
long time2 = endCal.getTimeInMillis();
long between_days = (time2 - time1) / (1000 * 3600 * 24);
return Integer.parseInt(String.valueOf(between_days));
}
}
......@@ -23,6 +23,7 @@ public class PrintConstans {
* 2:結賬單
* 3:廚房單
* 4:打印view
* 5:外賣接單打印
*/
public static final String PRINT_TYPE = "type";//打印類型
public static final String PRINT_LOADING = "is_show_loading";//是否顯示加載框
......
package com.gingersoft.gsa.cloud.database.bean;
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 java.io.Serializable;
@Entity
public class PrintModelBean implements Serializable {
private static final long serialVersionUID = 1705321642319997541L;
@Property(nameInDb = "_id")
@Id(autoincrement = true)
private Long dbid;
private int id;
private String paperSpecification;//紙張規格
private String printerName;//名稱
private String model;//型號
@Generated(hash = 1820550615)
public PrintModelBean() {
}
@Generated(hash = 1803312003)
public PrintModelBean(Long dbid, int id, String paperSpecification, String printerName, String model) {
this.dbid = dbid;
this.id = id;
this.paperSpecification = paperSpecification;
this.printerName = printerName;
this.model = model;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getPaperSpecification() {
return paperSpecification;
}
public void setPaperSpecification(String paperSpecification) {
this.paperSpecification = paperSpecification;
}
public String getPrinterName() {
return printerName;
}
public void setPrinterName(String printerName) {
this.printerName = printerName;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public Long getDbid() {
return this.dbid;
}
public void setDbid(Long dbid) {
this.dbid = dbid;
}
}
......@@ -25,10 +25,14 @@ public class PrinterDeviceBean implements Serializable {
private Integer restaurantId;
private String ip;//ip
private Integer port;//端口
private int type;//打印機紙張類型 為1時是58mm,否則是88mm
// private int type;//打印機紙張類型 為1時是58mm,否則是88mm
private Integer status;//2為默認打印機,1為普通打印機
private int printerModelId;//打印機機型id
private String paperSpecification;//紙張規格
private String printerName;//打印機機型名稱
private String model;//打印機型號
/**
* 飛單1打印機id
*/
......@@ -37,6 +41,7 @@ public class PrinterDeviceBean implements Serializable {
* 飛單2 打印機id
*/
private Long defaultPrinterDeviceId;
@Generated(hash = 626885316)
public PrinterDeviceBean() {
}
......@@ -46,30 +51,32 @@ public class PrinterDeviceBean implements Serializable {
this.id = id;
this.restaurantId = restaurantId;
this.ip = ip;
this.port = port;
this.type = type;
// this.type = type;
}
public PrinterDeviceBean(String name, Integer restaurantId, String ip, Integer port, int type) {
this.name = name;
this.restaurantId = restaurantId;
this.ip = ip;
this.port = port;
this.type = type;
// this.type = type;
}
@Generated(hash = 1104327416)
public PrinterDeviceBean(int id, Long dbid, String name, Integer restaurantId, String ip, Integer port,
int type, Integer status, Long printerDeviceId, Long defaultPrinterDeviceId) {
@Generated(hash = 157623255)
public PrinterDeviceBean(int id, Long dbid, String name, Integer restaurantId, String ip, Integer port, Integer status, int printerModelId, String paperSpecification, String printerName, String model, Long printerDeviceId, Long defaultPrinterDeviceId) {
this.id = id;
this.dbid = dbid;
this.name = name;
this.restaurantId = restaurantId;
this.ip = ip;
this.port = port;
this.type = type;
this.status = status;
this.printerModelId = printerModelId;
this.paperSpecification = paperSpecification;
this.printerName = printerName;
this.model = model;
this.printerDeviceId = printerDeviceId;
this.defaultPrinterDeviceId = defaultPrinterDeviceId;
}
......@@ -118,13 +125,13 @@ public class PrinterDeviceBean implements Serializable {
this.port = port;
}
public int getType() {
return this.type;
}
public void setType(int type) {
this.type = type;
}
// public int getType() {
// return this.type;
// }
//
// public void setType(int type) {
// this.type = type;
// }
public void setRestaurantId(Integer restaurantId) {
this.restaurantId = restaurantId;
......@@ -153,4 +160,36 @@ public class PrinterDeviceBean implements Serializable {
public void setDefaultPrinterDeviceId(Long defaultPrinterDeviceId) {
this.defaultPrinterDeviceId = defaultPrinterDeviceId;
}
public int getPrinterModelId() {
return printerModelId;
}
public void setPrinterModelId(int printerModelId) {
this.printerModelId = printerModelId;
}
public String getPaperSpecification() {
return paperSpecification;
}
public void setPaperSpecification(String paperSpecification) {
this.paperSpecification = paperSpecification;
}
public String getPrinterName() {
return printerName;
}
public void setPrinterName(String printerName) {
this.printerName = printerName;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
}
......@@ -14,10 +14,10 @@ import org.greenrobot.greendao.identityscope.IdentityScopeType;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* Master of DAO (schema version 7): knows all DAOs.
* Master of DAO (schema version 8): knows all DAOs.
*/
public class DaoMaster extends AbstractDaoMaster {
public static final int SCHEMA_VERSION = 7;
public static final int SCHEMA_VERSION = 8;
/** Creates underlying database table using DAOs. */
public static void createAllTables(Database db, boolean ifNotExists) {
......@@ -30,6 +30,7 @@ public class DaoMaster extends AbstractDaoMaster {
FunctionDao.createTable(db, ifNotExists);
ModifierDao.createTable(db, ifNotExists);
PrinterDeviceBeanDao.createTable(db, ifNotExists);
PrintModelBeanDao.createTable(db, ifNotExists);
}
/** Drops underlying database table using DAOs. */
......@@ -43,6 +44,7 @@ public class DaoMaster extends AbstractDaoMaster {
FunctionDao.dropTable(db, ifExists);
ModifierDao.dropTable(db, ifExists);
PrinterDeviceBeanDao.dropTable(db, ifExists);
PrintModelBeanDao.dropTable(db, ifExists);
}
/**
......@@ -70,6 +72,7 @@ public class DaoMaster extends AbstractDaoMaster {
registerDaoClass(FunctionDao.class);
registerDaoClass(ModifierDao.class);
registerDaoClass(PrinterDeviceBeanDao.class);
registerDaoClass(PrintModelBeanDao.class);
}
public DaoSession newSession() {
......
......@@ -17,6 +17,7 @@ import com.gingersoft.gsa.cloud.database.bean.FoodModifier;
import com.gingersoft.gsa.cloud.database.bean.Function;
import com.gingersoft.gsa.cloud.database.bean.Modifier;
import com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean;
import com.gingersoft.gsa.cloud.database.bean.PrintModelBean;
import com.gingersoft.gsa.cloud.database.greendao.ComboItemDao;
import com.gingersoft.gsa.cloud.database.greendao.DiscountDao;
......@@ -27,6 +28,7 @@ import com.gingersoft.gsa.cloud.database.greendao.FoodModifierDao;
import com.gingersoft.gsa.cloud.database.greendao.FunctionDao;
import com.gingersoft.gsa.cloud.database.greendao.ModifierDao;
import com.gingersoft.gsa.cloud.database.greendao.PrinterDeviceBeanDao;
import com.gingersoft.gsa.cloud.database.greendao.PrintModelBeanDao;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
......@@ -46,6 +48,7 @@ public class DaoSession extends AbstractDaoSession {
private final DaoConfig functionDaoConfig;
private final DaoConfig modifierDaoConfig;
private final DaoConfig printerDeviceBeanDaoConfig;
private final DaoConfig printModelBeanDaoConfig;
private final ComboItemDao comboItemDao;
private final DiscountDao discountDao;
......@@ -56,6 +59,7 @@ public class DaoSession extends AbstractDaoSession {
private final FunctionDao functionDao;
private final ModifierDao modifierDao;
private final PrinterDeviceBeanDao printerDeviceBeanDao;
private final PrintModelBeanDao printModelBeanDao;
public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
daoConfigMap) {
......@@ -88,6 +92,9 @@ public class DaoSession extends AbstractDaoSession {
printerDeviceBeanDaoConfig = daoConfigMap.get(PrinterDeviceBeanDao.class).clone();
printerDeviceBeanDaoConfig.initIdentityScope(type);
printModelBeanDaoConfig = daoConfigMap.get(PrintModelBeanDao.class).clone();
printModelBeanDaoConfig.initIdentityScope(type);
comboItemDao = new ComboItemDao(comboItemDaoConfig, this);
discountDao = new DiscountDao(discountDaoConfig, this);
expandInfoDao = new ExpandInfoDao(expandInfoDaoConfig, this);
......@@ -97,6 +104,7 @@ public class DaoSession extends AbstractDaoSession {
functionDao = new FunctionDao(functionDaoConfig, this);
modifierDao = new ModifierDao(modifierDaoConfig, this);
printerDeviceBeanDao = new PrinterDeviceBeanDao(printerDeviceBeanDaoConfig, this);
printModelBeanDao = new PrintModelBeanDao(printModelBeanDaoConfig, this);
registerDao(ComboItem.class, comboItemDao);
registerDao(Discount.class, discountDao);
......@@ -107,6 +115,7 @@ public class DaoSession extends AbstractDaoSession {
registerDao(Function.class, functionDao);
registerDao(Modifier.class, modifierDao);
registerDao(PrinterDeviceBean.class, printerDeviceBeanDao);
registerDao(PrintModelBean.class, printModelBeanDao);
}
public void clear() {
......@@ -119,6 +128,7 @@ public class DaoSession extends AbstractDaoSession {
functionDaoConfig.clearIdentityScope();
modifierDaoConfig.clearIdentityScope();
printerDeviceBeanDaoConfig.clearIdentityScope();
printModelBeanDaoConfig.clearIdentityScope();
}
public ComboItemDao getComboItemDao() {
......@@ -157,4 +167,8 @@ public class DaoSession extends AbstractDaoSession {
return printerDeviceBeanDao;
}
public PrintModelBeanDao getPrintModelBeanDao() {
return printModelBeanDao;
}
}
package com.gingersoft.gsa.cloud.database.greendao;
import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;
import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
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.PrintModelBean;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table "PRINT_MODEL_BEAN".
*/
public class PrintModelBeanDao extends AbstractDao<PrintModelBean, Long> {
public static final String TABLENAME = "PRINT_MODEL_BEAN";
/**
* Properties of entity PrintModelBean.<br/>
* Can be used for QueryBuilder and for referencing column names.
*/
public static class Properties {
public final static Property Dbid = new Property(0, Long.class, "dbid", true, "_id");
public final static Property Id = new Property(1, int.class, "id", false, "ID");
public final static Property PaperSpecification = new Property(2, String.class, "paperSpecification", false, "PAPER_SPECIFICATION");
public final static Property PrinterName = new Property(3, String.class, "printerName", false, "PRINTER_NAME");
public final static Property Model = new Property(4, String.class, "model", false, "MODEL");
}
public PrintModelBeanDao(DaoConfig config) {
super(config);
}
public PrintModelBeanDao(DaoConfig config, DaoSession daoSession) {
super(config, daoSession);
}
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
String constraint = ifNotExists? "IF NOT EXISTS ": "";
db.execSQL("CREATE TABLE " + constraint + "\"PRINT_MODEL_BEAN\" (" + //
"\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: dbid
"\"ID\" INTEGER NOT NULL ," + // 1: id
"\"PAPER_SPECIFICATION\" TEXT," + // 2: paperSpecification
"\"PRINTER_NAME\" TEXT," + // 3: printerName
"\"MODEL\" TEXT);"); // 4: model
}
/** Drops the underlying database table. */
public static void dropTable(Database db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"PRINT_MODEL_BEAN\"";
db.execSQL(sql);
}
@Override
protected final void bindValues(DatabaseStatement stmt, PrintModelBean entity) {
stmt.clearBindings();
Long dbid = entity.getDbid();
if (dbid != null) {
stmt.bindLong(1, dbid);
}
stmt.bindLong(2, entity.getId());
String paperSpecification = entity.getPaperSpecification();
if (paperSpecification != null) {
stmt.bindString(3, paperSpecification);
}
String printerName = entity.getPrinterName();
if (printerName != null) {
stmt.bindString(4, printerName);
}
String model = entity.getModel();
if (model != null) {
stmt.bindString(5, model);
}
}
@Override
protected final void bindValues(SQLiteStatement stmt, PrintModelBean entity) {
stmt.clearBindings();
Long dbid = entity.getDbid();
if (dbid != null) {
stmt.bindLong(1, dbid);
}
stmt.bindLong(2, entity.getId());
String paperSpecification = entity.getPaperSpecification();
if (paperSpecification != null) {
stmt.bindString(3, paperSpecification);
}
String printerName = entity.getPrinterName();
if (printerName != null) {
stmt.bindString(4, printerName);
}
String model = entity.getModel();
if (model != null) {
stmt.bindString(5, model);
}
}
@Override
public Long readKey(Cursor cursor, int offset) {
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
}
@Override
public PrintModelBean readEntity(Cursor cursor, int offset) {
PrintModelBean entity = new PrintModelBean( //
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // dbid
cursor.getInt(offset + 1), // id
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // paperSpecification
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // printerName
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4) // model
);
return entity;
}
@Override
public void readEntity(Cursor cursor, PrintModelBean entity, int offset) {
entity.setDbid(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
entity.setId(cursor.getInt(offset + 1));
entity.setPaperSpecification(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
entity.setPrinterName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
entity.setModel(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
}
@Override
protected final Long updateKeyAfterInsert(PrintModelBean entity, long rowId) {
entity.setDbid(rowId);
return rowId;
}
@Override
public Long getKey(PrintModelBean entity) {
if(entity != null) {
return entity.getDbid();
} else {
return null;
}
}
@Override
public boolean hasKey(PrintModelBean entity) {
return entity.getDbid() != null;
}
@Override
protected final boolean isEntityUpdateable() {
return true;
}
}
......@@ -30,10 +30,13 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> {
public final static Property RestaurantId = new Property(3, Integer.class, "restaurantId", false, "RESTAURANT_ID");
public final static Property Ip = new Property(4, String.class, "ip", false, "IP");
public final static Property Port = new Property(5, Integer.class, "port", false, "PORT");
public final static Property Type = new Property(6, int.class, "type", false, "TYPE");
public final static Property Status = new Property(7, Integer.class, "status", false, "STATUS");
public final static Property PrinterDeviceId = new Property(8, Long.class, "printerDeviceId", false, "PRINTER_DEVICE_ID");
public final static Property DefaultPrinterDeviceId = new Property(9, Long.class, "defaultPrinterDeviceId", false, "DEFAULT_PRINTER_DEVICE_ID");
public final static Property Status = new Property(6, Integer.class, "status", false, "STATUS");
public final static Property PrinterModelId = new Property(7, int.class, "printerModelId", false, "PRINTER_MODEL_ID");
public final static Property PaperSpecification = new Property(8, String.class, "paperSpecification", false, "PAPER_SPECIFICATION");
public final static Property PrinterName = new Property(9, String.class, "printerName", false, "PRINTER_NAME");
public final static Property Model = new Property(10, String.class, "model", false, "MODEL");
public final static Property PrinterDeviceId = new Property(11, Long.class, "printerDeviceId", false, "PRINTER_DEVICE_ID");
public final static Property DefaultPrinterDeviceId = new Property(12, Long.class, "defaultPrinterDeviceId", false, "DEFAULT_PRINTER_DEVICE_ID");
}
......@@ -55,10 +58,13 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> {
"\"RESTAURANT_ID\" INTEGER," + // 3: restaurantId
"\"IP\" TEXT," + // 4: ip
"\"PORT\" INTEGER," + // 5: port
"\"TYPE\" INTEGER NOT NULL ," + // 6: type
"\"STATUS\" INTEGER," + // 7: status
"\"PRINTER_DEVICE_ID\" INTEGER," + // 8: printerDeviceId
"\"DEFAULT_PRINTER_DEVICE_ID\" INTEGER);"); // 9: defaultPrinterDeviceId
"\"STATUS\" INTEGER," + // 6: status
"\"PRINTER_MODEL_ID\" INTEGER NOT NULL ," + // 7: printerModelId
"\"PAPER_SPECIFICATION\" TEXT," + // 8: paperSpecification
"\"PRINTER_NAME\" TEXT," + // 9: printerName
"\"MODEL\" TEXT," + // 10: model
"\"PRINTER_DEVICE_ID\" INTEGER," + // 11: printerDeviceId
"\"DEFAULT_PRINTER_DEVICE_ID\" INTEGER);"); // 12: defaultPrinterDeviceId
}
/** Drops the underlying database table. */
......@@ -96,21 +102,36 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> {
if (port != null) {
stmt.bindLong(6, port);
}
stmt.bindLong(7, entity.getType());
Integer status = entity.getStatus();
if (status != null) {
stmt.bindLong(8, status);
stmt.bindLong(7, status);
}
stmt.bindLong(8, entity.getPrinterModelId());
String paperSpecification = entity.getPaperSpecification();
if (paperSpecification != null) {
stmt.bindString(9, paperSpecification);
}
String printerName = entity.getPrinterName();
if (printerName != null) {
stmt.bindString(10, printerName);
}
String model = entity.getModel();
if (model != null) {
stmt.bindString(11, model);
}
Long printerDeviceId = entity.getPrinterDeviceId();
if (printerDeviceId != null) {
stmt.bindLong(9, printerDeviceId);
stmt.bindLong(12, printerDeviceId);
}
Long defaultPrinterDeviceId = entity.getDefaultPrinterDeviceId();
if (defaultPrinterDeviceId != null) {
stmt.bindLong(10, defaultPrinterDeviceId);
stmt.bindLong(13, defaultPrinterDeviceId);
}
}
......@@ -143,21 +164,36 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> {
if (port != null) {
stmt.bindLong(6, port);
}
stmt.bindLong(7, entity.getType());
Integer status = entity.getStatus();
if (status != null) {
stmt.bindLong(8, status);
stmt.bindLong(7, status);
}
stmt.bindLong(8, entity.getPrinterModelId());
String paperSpecification = entity.getPaperSpecification();
if (paperSpecification != null) {
stmt.bindString(9, paperSpecification);
}
String printerName = entity.getPrinterName();
if (printerName != null) {
stmt.bindString(10, printerName);
}
String model = entity.getModel();
if (model != null) {
stmt.bindString(11, model);
}
Long printerDeviceId = entity.getPrinterDeviceId();
if (printerDeviceId != null) {
stmt.bindLong(9, printerDeviceId);
stmt.bindLong(12, printerDeviceId);
}
Long defaultPrinterDeviceId = entity.getDefaultPrinterDeviceId();
if (defaultPrinterDeviceId != null) {
stmt.bindLong(10, defaultPrinterDeviceId);
stmt.bindLong(13, defaultPrinterDeviceId);
}
}
......@@ -175,10 +211,13 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> {
cursor.isNull(offset + 3) ? null : cursor.getInt(offset + 3), // restaurantId
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // ip
cursor.isNull(offset + 5) ? null : cursor.getInt(offset + 5), // port
cursor.getInt(offset + 6), // type
cursor.isNull(offset + 7) ? null : cursor.getInt(offset + 7), // status
cursor.isNull(offset + 8) ? null : cursor.getLong(offset + 8), // printerDeviceId
cursor.isNull(offset + 9) ? null : cursor.getLong(offset + 9) // defaultPrinterDeviceId
cursor.isNull(offset + 6) ? null : cursor.getInt(offset + 6), // status
cursor.getInt(offset + 7), // printerModelId
cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // paperSpecification
cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // printerName
cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // model
cursor.isNull(offset + 11) ? null : cursor.getLong(offset + 11), // printerDeviceId
cursor.isNull(offset + 12) ? null : cursor.getLong(offset + 12) // defaultPrinterDeviceId
);
return entity;
}
......@@ -191,10 +230,13 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> {
entity.setRestaurantId(cursor.isNull(offset + 3) ? null : cursor.getInt(offset + 3));
entity.setIp(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
entity.setPort(cursor.isNull(offset + 5) ? null : cursor.getInt(offset + 5));
entity.setType(cursor.getInt(offset + 6));
entity.setStatus(cursor.isNull(offset + 7) ? null : cursor.getInt(offset + 7));
entity.setPrinterDeviceId(cursor.isNull(offset + 8) ? null : cursor.getLong(offset + 8));
entity.setDefaultPrinterDeviceId(cursor.isNull(offset + 9) ? null : cursor.getLong(offset + 9));
entity.setStatus(cursor.isNull(offset + 6) ? null : cursor.getInt(offset + 6));
entity.setPrinterModelId(cursor.getInt(offset + 7));
entity.setPaperSpecification(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
entity.setPrinterName(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
entity.setModel(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10));
entity.setPrinterDeviceId(cursor.isNull(offset + 11) ? null : cursor.getLong(offset + 11));
entity.setDefaultPrinterDeviceId(cursor.isNull(offset + 12) ? null : cursor.getLong(offset + 12));
}
@Override
......
package com.gingersoft.gsa.cloud.database.utils;//package com.gingersoft.gsa.cloud.database.utils;
import android.content.Context;
import android.util.Log;
import com.gingersoft.gsa.cloud.database.DaoManager;
import com.gingersoft.gsa.cloud.database.bean.PrintModelBean;
import com.gingersoft.gsa.cloud.database.greendao.PrintModelBeanDao;
import org.greenrobot.greendao.query.QueryBuilder;
import java.util.List;
/**
* Created by Wyh on 2020/1/17.
*/
public class PrintModelDaoUtil {
private static final String TAG = PrintModelDaoUtil.class.getSimpleName();
private DaoManager mManager;
public PrintModelDaoUtil(Context context) {
mManager = DaoManager.getInstance();
mManager.init(context);
}
/**
* 完成PrintModelBeanDao记录的插入,如果表未创建,先创建PrintModelBeanDao表
* @return
*/
public boolean insertPrintModelBeanDao(PrintModelBean printerDevice){
boolean flag = false;
flag = mManager.getDaoSession().getPrintModelBeanDao().insert(printerDevice) != -1;
Log.i(TAG, "insert printerDevice :" + flag + "-->" + printerDevice.toString());
return flag;
}
/**
* 插入多条数据,在子线程操作
* @param printerDeviceList
* @return
*/
public boolean insertMultPrintModelBeanDao(final List<PrintModelBeanDao> printerDeviceList) {
boolean flag = false;
try {
mManager.getDaoSession().runInTx(new Runnable() {
@Override
public void run() {
for (PrintModelBeanDao PrintModelBeanDao : printerDeviceList) {
mManager.getDaoSession().insertOrReplace(PrintModelBeanDao);
}
}
});
flag = true;
} catch (Exception e) {
e.printStackTrace();
}
return flag;
}
/**
* 修改一条数据
* @param printerDevice
* @return
*/
public boolean updatePrintModelBeanDao(PrintModelBeanDao printerDevice){
boolean flag = false;
try {
mManager.getDaoSession().update(printerDevice);
flag = true;
}catch (Exception e){
e.printStackTrace();
}
return flag;
}
/**
* 删除单条记录
* @param printerDevice
* @return
*/
public boolean deletePrintModelBeanDao(PrintModelBeanDao printerDevice){
boolean flag = false;
try {
//按照id删除
mManager.getDaoSession().delete(printerDevice);
flag = true;
}catch (Exception e){
e.printStackTrace();
}
return flag;
}
/**
* 删除所有记录
* @return
*/
public boolean deleteAll(){
boolean flag = false;
try {
//按照id删除
mManager.getDaoSession().deleteAll(PrintModelBeanDao.class);
flag = true;
}catch (Exception e){
e.printStackTrace();
}
return flag;
}
/**
* 查询所有记录
* @return
*/
public List<PrintModelBeanDao> queryAllPrintModelBeanDao(){
return mManager.getDaoSession().loadAll(PrintModelBeanDao.class);
}
/**
* 根据主键id查询记录
* @param key
* @return
*/
public PrintModelBeanDao queryPrintModelBeanDaoById(long key){
return mManager.getDaoSession().load(PrintModelBeanDao.class, key);
}
/**
* 使用native sql进行查询操作
*/
public List<PrintModelBeanDao> queryPrintModelBeanDaoByNativeSql(String sql, String[] conditions){
return mManager.getDaoSession().queryRaw(PrintModelBeanDao.class, sql, conditions);
}
/**
* 使用queryBuilder进行查询
* @return
*/
public List<PrintModelBeanDao> queryPrintModelBeanDaoByQueryBuilder(long PrintModelBeanDaoId){
QueryBuilder<PrintModelBeanDao> queryBuilder = mManager.getDaoSession().queryBuilder(PrintModelBeanDao.class);
return queryBuilder.where(PrintModelBeanDao.Properties.Id.eq(PrintModelBeanDaoId)).list();
}
}
......@@ -18,11 +18,6 @@ package com.gingersoft.gsa.cloud.print;
import java.util.List;
/**
* Print
* Created by Alex on 2016/11/10.
*/
public interface PrintDataMaker {
List<byte[]> getPrintData(int type);
List<byte[]> getPrintData();
}
......@@ -28,21 +28,18 @@ import java.util.List;
* Created by Alex on 2016/11/10.
*/
public class PrintExecutor {
private int type;
private PrintSocketHolder holder;
private int mReconnectTimes = 0;
private int time = 0;
private PrintSocketHolder.OnStateChangedListener listener;
private OnPrintResultListener mListener;
public PrintExecutor(BluetoothDevice device, int type) {
public PrintExecutor(BluetoothDevice device) {
holder = new PrintSocketHolder(device);
setType(type);
}
public PrintExecutor(PrinterDeviceBean printerDeviceBean, int type) {
public PrintExecutor(PrinterDeviceBean printerDeviceBean) {
holder = new PrintSocketHolder(printerDeviceBean);
setType(type);
}
/**
......@@ -53,7 +50,7 @@ public class PrintExecutor {
private int doRequest(PrintDataMaker maker) {
if (mReconnectTimes == 0) {
holder.onPrinterStateChanged(PrintSocketHolder.STATE_0);
List<byte[]> data = maker.getPrintData(type);
List<byte[]> data = maker.getPrintData();
if (!holder.isSocketPrepared()) {
int prepare = holder.prepareSocket();
if (prepare != PrintSocketHolder.ERROR_0)
......@@ -62,7 +59,7 @@ public class PrintExecutor {
return holder.sendData(data);
} else {
holder.onPrinterStateChanged(PrintSocketHolder.STATE_0);
List<byte[]> data = maker.getPrintData(type);
List<byte[]> data = maker.getPrintData();
if (holder.isSocketPrepared()) {
if (sendData(data))
return PrintSocketHolder.ERROR_0;
......@@ -138,9 +135,9 @@ public class PrintExecutor {
*
* @param type 打印类型
*/
public void setType(int type) {
this.type = type;
}
// public void setType(int type) {
// this.type = type;
// }
/**
* 设置状态监听
......
......@@ -130,6 +130,18 @@ public abstract class PrinterWriter {
}
/**
* 打开钱箱
*/
public void openCashBox() throws IOException {
bos.write(0x1B);
bos.write(0x70);
bos.write(0);
bos.write(100);
bos.write(80);
bos.flush();
}
/**
* 设置居中
*
* @throws IOException 异常
......
......@@ -20,7 +20,6 @@ import java.io.IOException;
/**
* 纸宽58mm的打印机
* Created by Alex on 2016/6/17.
*/
@SuppressWarnings("unused")
public class PrinterWriter58mm extends PrinterWriter {
......
......@@ -20,7 +20,6 @@ import java.io.IOException;
/**
* 纸宽80mm的打印机
* Created by Alex on 2016/6/17.
*/
@SuppressWarnings("unused")
public class PrinterWriter80mm extends PrinterWriter {
......
/*
* Copyright (C) 2015 AlexMofer
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.gingersoft.gsa.cloud.print;
import java.io.IOException;
/**
* 纸宽58mm的打印机
*/
@SuppressWarnings("unused")
public class PrinterWriterExecutor extends PrinterWriter {
public int width = 380;
public PrinterWriterExecutor() throws IOException {
}
public PrinterWriterExecutor(int parting) throws IOException {
super(parting);
}
public PrinterWriterExecutor(int parting, int width) throws IOException {
super(parting);
this.width = width;
}
@Override
protected int getLineWidth() {
return 16;
}
@Override
protected int getLineStringWidth(int textSize) {
switch (textSize) {
default:
case 0:
return 31;
case 1:
return 15;
}
}
@Override
protected int getDrawableMaxWidth() {
return width;
}
}
......@@ -58,6 +58,7 @@ class OrderDetails {
var DELIVERY_CHARGE: Double = 0.toDouble()
var order_from: Int = 0
var sender: String? = null
var sendMobile: String? = null
var SEND_TIME: String? = null
var PAY_AMOUNT: Double = 0.toDouble()
var ID: Int = 0
......@@ -76,6 +77,18 @@ class OrderDetails {
var estimatedTime: String? = null
var orderStatus: Int = 0
var curStat: Int = 0//訂單已創建 1
// * * Order Assigned To Delivery Man - 配送員已接單 2
// * * Delivery Man Reached Pickup Point Nearby - 配送員已到達店鋪附近 3
// * * Delivery Man Reached Pickup Point - 配送员已到店 4
// * * Delivery In Progress - 訂單正在配送中 5
// * * Delivery Man Reached Destination Nearby - 配送員已到達目的地附近 6
// * * Order Delivered - 訂單已完成 7
// * * Order Cancelled Before Collection - 訂單已取消 - 取餐前 8
// * * Order Cancelled After Collection - 訂單已取消 - 取餐后 9
// * * Order Assigned To Another Delivery Man - 已指派另一位配送員 10
class PRODUCTNAMEBean {
/**
* odsId : 1654481
......
......@@ -9,7 +9,7 @@ import com.gingersoft.gsa.cloud.base.widget.DialogUtils;
public class AppDialog {
public static void showWaringDialog(Context context, String title, DialogOnClickListenter sureOnclickListenter) {
public void showWaringDialog(Context context, String title, DialogOnClickListenter sureOnclickListenter) {
showWaringDialog(context, title, null, null, sureOnclickListenter, null);
}
......@@ -17,7 +17,7 @@ public class AppDialog {
// showWaringDialog(context, title, null, null, sureOnclickListenter, null);
// }
private static void showWaringDialog(Context context, String title, String confimText, String cancelText, DialogOnClickListenter sureOnclickListenter, DialogOnClickListenter cancelOnclickListenter) {
private void showWaringDialog(Context context, String title, String confimText, String cancelText, DialogOnClickListenter sureOnclickListenter, DialogOnClickListenter cancelOnclickListenter) {
//暫停接單,彈窗向用戶確認是否關閉
new DialogUtils(context, R.layout.other_order_pause_orders) {
@Override
......
......@@ -86,11 +86,18 @@ public class LoadingDialog {
if (mLoadingDialog == null) {
mLoadingDialog = new Dialog(context, R.style.ui_loading_dialog);
} else if(mLoadingDialog.isShowing()){
mLoadingDialog.dismiss();
mLoadingDialog = new Dialog(context, R.style.ui_loading_dialog);
}
mLoadingDialog.setCancelable(true);
mLoadingDialog.setCanceledOnTouchOutside(false);
mLoadingDialog.setContentView(view, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
mLoadingDialog.show();
try {
mLoadingDialog.show();
} catch (Exception e) {
e.printStackTrace();
}
return mLoadingDialog;
}
......
......@@ -11,5 +11,4 @@
android:layout_height="match_parent"
android:background="@drawable/shape_white_eight_corners_bg" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<View xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/horizontal_dividing_line"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_0_5"
android:background="@color/grey_200" />
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tv_item_print_model_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center_horizontal"
android:paddingTop="@dimen/dp_8"
android:paddingBottom="@dimen/dp_8"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_16"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/dp_1"
android:background="@color/grey_200" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/iv_default"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_50"
android:src="@drawable/ic_default"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toTopOf="@id/btn_default"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_default_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="暫無數據"
android:textColor="@color/color_ccc"
android:layout_marginTop="@dimen/dp_10"
android:textSize="@dimen/dp_14"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/iv_default" />
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id="@+id/btn_default"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_20"
android:background="@drawable/shape_app_btn"
android:gravity="center"
android:padding="@dimen/dp_10"
android:textColor="@color/white"
android:textSize="@dimen/dp_16"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -485,4 +485,14 @@
<color name="restaurant_color_open">#6FBE8E</color>
<color name="restaurant_color_busy_close">#F56C6C</color>
<color name="restaurant_color_busy_open">#E6A23C</color>
<!-- 確認訂單按鈕背景色-->
<color name="other_order_details_sure_btn_color">#1196DB</color>
<!-- 取消訂單按鈕背景色-->
<color name="other_order_details_cancel_btn_color">#E74E40</color>
<!-- 打印訂單按鈕背景色-->
<color name="other_order_details_print_btn_color">#FFA827</color>
<!-- 取消物流按鈕背景色-->
<color name="other_order_details_cancel_logistics_btn_color">#E74E40</color>
</resources>
......@@ -36,5 +36,8 @@ public interface NewMainContract {
Observable<CheckVersionRequest> checkAppVersion(RequestBody requestBody);
Observable<Object> loginOut(RequestBody requestBody);
Observable<Object> clearHeartbeat(RequestBody requestBody);
}
}
......@@ -61,4 +61,10 @@ public class NewMainModel extends BaseModel implements NewMainContract.Model {
return mRepositoryManager.obtainRetrofitService(MainService.class)
.loginOut(requestBody);
}
@Override
public Observable<Object> clearHeartbeat(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(MainService.class)
.clearHeartbeat(requestBody);
}
}
\ No newline at end of file
......@@ -18,6 +18,10 @@ public interface MainService {
Observable<Object> loginOut(@Body RequestBody requestBody);
@Headers({"Domain-Name: update_version"})
@POST("restaurant/clearHeartbeat" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<Object> clearHeartbeat(@Body RequestBody requestBody);
@Headers({"Domain-Name: update_version"})
@POST("system/checkAppVersion" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<CheckVersionRequest> checkAppVersion(@Body RequestBody requestBody);
}
......@@ -120,8 +120,9 @@ public class NewMainPresenter extends BasePresenter<NewMainContract.Model, NewMa
public void loginOut() {
RequestBody requestBody = new FormBody.Builder()
.add("restaurantId", GsaCloudApplication.getRestaurantId(mApplication) +"")
.build();
mModel.loginOut(requestBody)
mModel.clearHeartbeat(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(null))
.subscribeOn(AndroidSchedulers.mainThread())
......@@ -132,25 +133,37 @@ public class NewMainPresenter extends BasePresenter<NewMainContract.Model, NewMa
@Override
public void onNext(@NonNull Object info) {
mRootView.loginOut();
//清空用戶信息
GsaCloudApplication.clearMemberInfo();
mModel.loginOut(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(null))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<Object>(mErrorHandler) {
@Override
public void onNext(@NonNull Object info) {
mRootView.loginOut();
//清空用戶信息
GsaCloudApplication.clearMemberInfo();
}
});
}
});
}
public void updateAPK(int type, String downApkURL) {
if(type == 4 || type == 5){
if(type == 4){
if (type == 4 || type == 5) {
if (type == 4) {
try {
DeviceUtils.launchAppDetail(IActivity, mApplication.getPackageName(), "com.android.vending");
} catch (Exception e) {
//跳转goole play下载app
WebActivity.startWebActivity_url(IActivity, downApkURL, WebActivity.RIGHT_TYPE_REFRESH);
}
}else{
} else {
try {
DeviceUtils.launchAppDetail(IActivity,mApplication.getPackageName(), "com.android.vending");
DeviceUtils.launchAppDetail(IActivity, mApplication.getPackageName(), "com.android.vending");
} catch (Exception e) {
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
......
......@@ -61,11 +61,11 @@ public class PaymentMethodReportPresenter extends BasePresenter<PaymentMethodRep
this.mApplication = null;
}
public void getPaymentInfo(String restaurandId, String startTime) {
public void getPaymentInfo(String restaurandId, String startTime, String endTime) {
RequestBody requestBody = new FormBody.Builder()
.add("restaurantId", restaurandId)
.add("startTime", startTime)//TimeUtils.getYesterdayTime(TimeUtils.DATE_FORMAT_DATE)
.add("endTime", TimeUtils.getOldDate(1))//TimeUtils.getCurrentTimeInString(TimeUtils.DATE_FORMAT_DATE)
.add("endTime", endTime)//TimeUtils.getCurrentTimeInString(TimeUtils.DATE_FORMAT_DATE)
.build();
mModel.getPaymentInfo(requestBody)
.subscribeOn(Schedulers.io())
......
......@@ -62,11 +62,11 @@ public class SalesPresenter extends BasePresenter<SalesContract.Model, SalesCont
this.mApplication = null;
}
public void getSalesReportInfo(String restaurantId, String startTime) {
public void getSalesReportInfo(String restaurantId, String startTime,String endTime) {
Map<String, Object> map = new HashMap<>();
map.put("restaurantId", restaurantId);
map.put("startTime", startTime);
map.put("endTime", TimeUtils.getOldDate(1));
map.put("endTime", endTime);
mModel.getSalesReportInfo(map)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(""))
......
......@@ -130,7 +130,12 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mPresenter.checkAppVersion();
}
@Override
protected void onResume() {
super.onResume();
// mPresenter.checkAppVersion();
}
@Override
......@@ -235,7 +240,7 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
// }
List<Function> functions = new ArrayList<>();
if (!BuildConfig.DEBUG) {
// if (!BuildConfig.DEBUG) {
// functions.addAll(FunctionManager.getDefault().getFunctionByResModule(this, ComponentMain.main.class, ComponentMain.main.order, "order"));
functions.add(new Function((long) 150, 0, 5, "點餐", 0, 0));
functions.add(new Function((long) 138, 150, 5, "餐檯模式", R.drawable.ic_dining_table_mode, 0));
......@@ -258,11 +263,11 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
functions.add(new Function((long) 147, 152, 5, "員工管理", R.drawable.ic_staff_management_close, 1));
functions.add(new Function((long) 148, 152, 5, "權限管理", R.drawable.ic_authority_management_close, 1));
functions.add(new Function((long) 149, 152, 5, "操作記錄", R.drawable.ic_operation_record_close, 1));
} else {
functions.addAll(FunctionManager.getDefault().getFunctionByResModule(this, ComponentMain.main.class, ComponentMain.main.order, "order"));
functions.addAll(FunctionManager.getDefault().getFunctionByResModule(this, ComponentMain.main.class, ComponentMain.main.manager, "manager"));
functions.addAll(FunctionManager.getDefault().getFunctionByResModule(this, ComponentMain.main.class, ComponentMain.main.employee, "employee"));
}
// } else {
// functions.addAll(FunctionManager.getDefault().getFunctionByResModule(this, ComponentMain.main.class, ComponentMain.main.order, "order"));
// functions.addAll(FunctionManager.getDefault().getFunctionByResModule(this, ComponentMain.main.class, ComponentMain.main.manager, "manager"));
// functions.addAll(FunctionManager.getDefault().getFunctionByResModule(this, ComponentMain.main.class, ComponentMain.main.employee, "employee"));
// }
//將功能列表數據分組
SparseArray<String> parents = new SparseArray<>();
......@@ -303,14 +308,14 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
}
private void functionClick(String name, int status) {
switch (status){
case STATUS_NONACTIVATED:
ToastUtils.show(mContext, "服務暫未開通,請前往開通");
return;
case STATUS_TIME_LIMIT:
ToastUtils.show(mContext, "服務已到期,請前往續費");
return;
}
// switch (status){
// case STATUS_NONACTIVATED:
// ToastUtils.show(mContext, "服務暫未開通,敬請期待");
// return;
// case STATUS_TIME_LIMIT:
// ToastUtils.show(mContext, "服務已到期,請前往續費");
// return;
// }
if (name.equals("餐檯模式")) {
CC.obtainBuilder("Component.Table")
.setActionName("showTableActivity")
......
......@@ -38,6 +38,7 @@ import com.jess.arms.base.BaseFragment;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import java.sql.Time;
import java.text.ParseException;
import java.util.Calendar;
import java.util.Date;
......@@ -75,6 +76,8 @@ public class BusinessReportFragment extends BaseFragment<BusinessReportPresenter
TextView mRestaurantName;
@BindView(R2.id.tv_start_time)
TextView mTvStartTime;
@BindView(R2.id.tv_end_time)
TextView mTvEndTime;
@BindView(R2.id.iv_start_time_triangle)
......@@ -85,7 +88,7 @@ public class BusinessReportFragment extends BaseFragment<BusinessReportPresenter
private BusinessInfoAdapter businessInfoAdapter;
//查詢多少天的數據
private int manyDay = 6;
private int manyDay = 7;
public static BusinessReportFragment newInstance() {
BusinessReportFragment fragment = new BusinessReportFragment();
......@@ -111,14 +114,15 @@ public class BusinessReportFragment extends BaseFragment<BusinessReportPresenter
public void initData(@Nullable Bundle savedInstanceState) {
//獲取一段時間內的營業信息,默認獲取七天的數據
String startTime = TimeUtils.getOldDate(-manyDay);
mPresenter.getRestaurantAmount(GsaCloudApplication.getRestaurantId(mContext) + "", startTime, TimeUtils.getOldDate(1));
mPresenter.getRestaurantBusinessInfo(GsaCloudApplication.getRestaurantId(mContext) + "", startTime, TimeUtils.getOldDate(1));
// mPresenter.getRestaurantAmount(GsaCloudApplication.getRestaurantId(mContext) + "", startTime, TimeUtils.getOldDate(-1));
// mPresenter.getRestaurantBusinessInfo(GsaCloudApplication.getRestaurantId(mContext) + "", startTime, TimeUtils.getOldDate(-1));
mRestaurantName.setText(GsaCloudApplication.getRestaurantName(mContext));
mTvStartTime.setText(startTime);
mTvEndTime.setText(TimeUtils.getOldDate(0));
getBetweenInfo();
}
/**
......@@ -195,7 +199,6 @@ public class BusinessReportFragment extends BaseFragment<BusinessReportPresenter
*/
@Override
public void loadChart(List<MainBusinessBean.DataBean> data) {
manyDay = data.size();
Object[] chartData = new Object[manyDay];
String[] xData = new String[manyDay];
......@@ -339,29 +342,7 @@ public class BusinessReportFragment extends BaseFragment<BusinessReportPresenter
} else {
mTvEndTime.setText(TimeUtils.DATE_FORMAT_DATE.format(date));
}
// Calendar calendar = Calendar.getInstance();
// calendar.setTime(date);
// int month = calendar.get(Calendar.MONTH);
// int day = calendar.get(Calendar.DAY_OF_MONTH);
// calendar.setTime(new Date());
// //如果不是當前月份,那麼報表最多顯示最近七天
// if (month != calendar.get(Calendar.MONTH)) {
// manyDay = 7;
// } else {
// //如果選中的是當前月份,判斷天數是否大於7
// if (calendar.get(Calendar.DAY_OF_MONTH) - day > 7) {
// manyDay = 7;
// } else {
// manyDay = calendar.get(Calendar.DAY_OF_MONTH) - day;
// if (manyDay < 0) {
// manyDay = 0;
// }
// }
// }
mPresenter.getRestaurantAmount(GsaCloudApplication.getRestaurantId(mContext) + "", mTvStartTime.getText().toString(), mTvEndTime.getText().toString());
mPresenter.getRestaurantBusinessInfo(GsaCloudApplication.getRestaurantId(mContext) + "", mTvStartTime.getText().toString(), mTvEndTime.getText().toString());
getBetweenInfo();
}).setOnDismissListener(o -> {
if (triangleView.isOpen()) {
triangleView.toggle();
......@@ -373,4 +354,24 @@ public class BusinessReportFragment extends BaseFragment<BusinessReportPresenter
e.printStackTrace();
}
}
private void getBetweenInfo() {
try {
//計算出兩個日期間隔的天數
Calendar startCal = Calendar.getInstance();
startCal.setTime(TimeUtils.DATE_FORMAT_DATE.parse(mTvStartTime.getText().toString()));
Calendar endCal = Calendar.getInstance();
endCal.setTime(TimeUtils.DATE_FORMAT_DATE.parse(mTvEndTime.getText().toString()));
manyDay = TimeUtils.daysBetween(startCal, endCal) - 1;
if (manyDay < 0) {
manyDay = 0;
}
} catch (ParseException e) {
e.printStackTrace();
}
mPresenter.getRestaurantAmount(GsaCloudApplication.getRestaurantId(mContext) + "", mTvStartTime.getText().toString(), mTvEndTime.getText().toString());
mPresenter.getRestaurantBusinessInfo(GsaCloudApplication.getRestaurantId(mContext) + "", mTvStartTime.getText().toString(), mTvEndTime.getText().toString());
}
}
......@@ -80,6 +80,9 @@ public class PaymentMethodReportFragment extends BaseFragment<PaymentMethodRepor
@BindView(R2.id.iv_payment_time_triangle)
TriangleView triangleView;
@BindView(R2.id.iv_end_time_triangle)
TriangleView endTimeTriangleView;
public static PaymentMethodReportFragment newInstance() {
PaymentMethodReportFragment fragment = new PaymentMethodReportFragment();
return fragment;
......@@ -102,11 +105,14 @@ public class PaymentMethodReportFragment extends BaseFragment<PaymentMethodRepor
@Override
public void initData(@Nullable Bundle savedInstanceState) {
String startTime = TimeUtils.getOldDate(-2);
mPresenter.getPaymentInfo(GsaCloudApplication.getRestaurantId(mContext) + "", startTime);
mTvStartTime.setText(startTime);
mTvStartTime.setText(TimeUtils.getOldDate(-7));
mTvEndTime.setText(TimeUtils.getOldDate(0));
getPayMenthInfo();
}
private void getPayMenthInfo() {
mPresenter.getPaymentInfo(GsaCloudApplication.getRestaurantId(mContext) + "", mTvStartTime.getText().toString(), mTvEndTime.getText().toString());
}
/**
......@@ -279,23 +285,51 @@ public class PaymentMethodReportFragment extends BaseFragment<PaymentMethodRepor
chart.invalidate();
}
@OnClick({R2.id.tv_start_time, R2.id.iv_payment_time_triangle})
@OnClick({R2.id.tv_start_time, R2.id.iv_payment_time_triangle, R2.id.tv_end_time, R2.id.iv_end_time_triangle})
@Override
public void onClick(View v) {
if (v.getId() == R.id.tv_start_time || v.getId() == R.id.iv_payment_time_triangle) {
triangleView.toggle();
int viewId = v.getId();
try {
String time = null;
Calendar startTime = Calendar.getInstance();
startTime.set(Calendar.DAY_OF_YEAR, startTime.getActualMinimum(Calendar.DAY_OF_YEAR));//今年第一天
Calendar endTime = Calendar.getInstance();
if (viewId == R.id.tv_start_time || viewId == R.id.iv_start_time_triangle) {
triangleView.toggle();
time = mTvStartTime.getText().toString();
endTime.setTime(TimeUtils.DATE_FORMAT_DATE.parse(mTvEndTime.getText().toString()));
} else if (viewId == R.id.tv_end_time || viewId == R.id.iv_end_time_triangle) {
endTimeTriangleView.toggle();
time = mTvEndTime.getText().toString();
startTime.setTime(TimeUtils.DATE_FORMAT_DATE.parse(mTvStartTime.getText().toString()));
}
Calendar cal = Calendar.getInstance();
try {
//設置默認時間為當前的起止時間
cal.setTime(TimeUtils.DATE_FORMAT_DATE.parse(mTvStartTime.getText().toString()));
cal.setTime(TimeUtils.DATE_FORMAT_DATE.parse(time));
} catch (ParseException e) {
e.printStackTrace();
}
//打開時間選擇器
TimePickerUtils.showReportTimePicker(mContext, cal, (date, v1) -> {
mTvStartTime.setText(TimeUtils.DATE_FORMAT_DATE.format(date));
mPresenter.getPaymentInfo(GsaCloudApplication.getRestaurantId(mContext) + "", mTvStartTime.getText().toString());
}).setOnDismissListener(o -> triangleView.toggle());
TimePickerUtils.showReportTimePicker(mContext, startTime, endTime, cal, (date, v1) ->
{
if (viewId == R.id.tv_start_time || viewId == R.id.iv_start_time_triangle) {
mTvStartTime.setText(TimeUtils.DATE_FORMAT_DATE.format(date));
} else {
mTvEndTime.setText(TimeUtils.DATE_FORMAT_DATE.format(date));
}
getPayMenthInfo();
}).setOnDismissListener(o -> {
if (triangleView.isOpen()) {
triangleView.toggle();
} else if (endTimeTriangleView.isOpen()) {
endTimeTriangleView.toggle();
}
});
} catch (ParseException e) {
e.printStackTrace();
}
}
}
......@@ -84,6 +84,10 @@ public class SalesFragment extends BaseFragment<SalesPresenter> implements Sales
TextView mTvEndTime;
@BindView(R2.id.iv_sale_time_triangle)
TriangleView triangleView;
@BindView(R2.id.iv_end_time_triangle)
TriangleView endTimeTriangleView;
public static SalesFragment newInstance() {
SalesFragment fragment = new SalesFragment();
return fragment;
......@@ -106,10 +110,9 @@ public class SalesFragment extends BaseFragment<SalesPresenter> implements Sales
@Override
public void initData(@Nullable Bundle savedInstanceState) {
String startTime = TimeUtils.getOldDate(-2);
mPresenter.getSalesReportInfo(GsaCloudApplication.getRestaurantId(mContext) + "", startTime);
mTvStartTime.setText(startTime);
mTvStartTime.setText(TimeUtils.getOldDate(-7));
mTvEndTime.setText(TimeUtils.getOldDate(0));
getSaleReprot();
}
/**
......@@ -352,25 +355,59 @@ public class SalesFragment extends BaseFragment<SalesPresenter> implements Sales
salesChart.invalidate();
}
@OnClick({R2.id.tv_start_time, R2.id.iv_sale_time_triangle})
@OnClick({R2.id.tv_start_time, R2.id.iv_sale_time_triangle, R2.id.tv_end_time, R2.id.iv_end_time_triangle})
@Override
public void onClick(View v) {
if (v.getId() == R.id.tv_start_time || v.getId() == R.id.iv_sale_time_triangle) {
triangleView.toggle();
//打開時間選擇器
int viewId = v.getId();
try {
String time = null;
Calendar startTime = Calendar.getInstance();
startTime.set(Calendar.DAY_OF_YEAR, startTime.getActualMinimum(Calendar.DAY_OF_YEAR));//今年第一天
Calendar endTime = Calendar.getInstance();
if (viewId == R.id.tv_start_time || viewId == R.id.iv_start_time_triangle) {
triangleView.toggle();
time = mTvStartTime.getText().toString();
endTime.setTime(TimeUtils.DATE_FORMAT_DATE.parse(mTvEndTime.getText().toString()));
} else if (viewId == R.id.tv_end_time || viewId == R.id.iv_end_time_triangle) {
endTimeTriangleView.toggle();
time = mTvEndTime.getText().toString();
startTime.setTime(TimeUtils.DATE_FORMAT_DATE.parse(mTvStartTime.getText().toString()));
}
Calendar cal = Calendar.getInstance();
try {
//設置默認時間為當前的起止時間
cal.setTime(TimeUtils.DATE_FORMAT_DATE.parse(mTvStartTime.getText().toString()));
cal.setTime(TimeUtils.DATE_FORMAT_DATE.parse(time));
} catch (ParseException e) {
e.printStackTrace();
}
TimePickerUtils.showReportTimePicker(mContext, cal, (date, v1) -> {
mTvStartTime.setText(TimeUtils.DATE_FORMAT_DATE.format(date));
mPresenter.getSalesReportInfo(GsaCloudApplication.getRestaurantId(mContext) + "", mTvStartTime.getText().toString());
}).setOnDismissListener(o -> triangleView.toggle());
//打開時間選擇器
TimePickerUtils.showReportTimePicker(mContext, startTime, endTime, cal, (date, v1) ->
{
if (viewId == R.id.tv_start_time || viewId == R.id.iv_start_time_triangle) {
mTvStartTime.setText(TimeUtils.DATE_FORMAT_DATE.format(date));
} else {
mTvEndTime.setText(TimeUtils.DATE_FORMAT_DATE.format(date));
}
getSaleReprot();
}).setOnDismissListener(o -> {
if (triangleView.isOpen()) {
triangleView.toggle();
} else if (endTimeTriangleView.isOpen()) {
endTimeTriangleView.toggle();
}
});
} catch (ParseException e) {
e.printStackTrace();
}
}
private void getSaleReprot() {
mPresenter.getSalesReportInfo(GsaCloudApplication.getRestaurantId(mContext) + "", mTvStartTime.getText().toString(), mTvEndTime.getText().toString());
}
}
......@@ -55,10 +55,10 @@
<com.gingersoft.gsa.cloud.ui.view.TriangleView
android:id="@+id/iv_payment_time_triangle"
android:layout_marginLeft="@dimen/dp_2"
android:layout_width="@dimen/dp_8"
app:trv_direction="bottom"
android:layout_height="@dimen/dp_5" />
android:layout_height="@dimen/dp_5"
android:layout_marginLeft="@dimen/dp_2"
app:trv_direction="bottom" />
<TextView
android:layout_width="wrap_content"
......@@ -75,6 +75,13 @@
android:layout_marginLeft="@dimen/dp_7"
android:textColor="#181818"
android:textSize="@dimen/dp_10" />
<com.gingersoft.gsa.cloud.ui.view.TriangleView
android:id="@+id/iv_end_time_triangle"
android:layout_width="@dimen/dp_8"
android:layout_height="@dimen/dp_5"
android:layout_marginLeft="@dimen/dp_2"
app:trv_direction="bottom" />
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
......
......@@ -57,10 +57,10 @@
<com.gingersoft.gsa.cloud.ui.view.TriangleView
android:id="@+id/iv_sale_time_triangle"
android:layout_marginLeft="@dimen/dp_2"
android:layout_width="@dimen/dp_8"
app:trv_direction="bottom"
android:layout_height="@dimen/dp_5"/>
android:layout_height="@dimen/dp_5"
android:layout_marginLeft="@dimen/dp_2"
app:trv_direction="bottom" />
<TextView
android:layout_width="wrap_content"
......@@ -77,6 +77,14 @@
android:layout_marginLeft="@dimen/dp_7"
android:textColor="#181818"
android:textSize="@dimen/sp_10" />
<com.gingersoft.gsa.cloud.ui.view.TriangleView
android:id="@+id/iv_end_time_triangle"
android:layout_width="@dimen/dp_8"
android:layout_height="@dimen/dp_5"
android:layout_marginLeft="@dimen/dp_2"
app:trv_direction="bottom" />
</LinearLayout>
<com.github.mikephil.charting.charts.PieChart
......
......@@ -14,6 +14,7 @@
android:name="com.gingersoft.gsa.cloud.globalconfig.GlobalConfiguration"
android:value="ConfigModule" />
<activity android:name=".ui.activity.DeliverySettingActivity"/>
<activity android:name=".ui.activity.OrderDetailsActivity"/>
</application>
</manifest>
\ No newline at end of file
......@@ -3,6 +3,7 @@
package="com.gingersoft.gsa.other_order_mode">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name="com.gingersoft.gsa.cloud.base.application.GsaCloudApplication"
android:allowBackup="true"
......@@ -11,6 +12,7 @@
android:networkSecurityConfig="@xml/network_android"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".ui.activity.OrderDetailsActivity"></activity>
<activity
android:name=".ui.activity.OtherOrderActivity"
android:label="@string/app_name">
......@@ -23,9 +25,11 @@
</activity>
<service android:name=".service.GetInfoUpdateService" />
<meta-data
android:name="com.gingersoft.gsa.cloud.globalconfig.GlobalConfiguration"
android:value="ConfigModule" />
<activity android:name=".ui.activity.HistoryOrderActivity" />
</application>
......
......@@ -129,12 +129,12 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
network.getDeliveryConfigDTO(requestBody)
}
suspend fun cancelLogistics(shopId: String, orderId: String) = withContext(Dispatchers.IO) {
network.cancelLogistics(getBody("restaurantId" to shopId, "orderId" to orderId))
suspend fun cancelLogistics(shopId: String, orderId: String, reasonId: String, reasonDesc: String) = withContext(Dispatchers.IO) {
network.cancelLogistics(getBody("restaurantId" to shopId, "orderId" to orderId, "reasonId" to reasonId, "reasonDesc" to reasonDesc))
}
suspend fun updateOrderStates(memberId: String, orderId: String, status: String, updateBy: String) = withContext(Dispatchers.IO) {
network.cancelOrder(getBody("memberId" to memberId, "orderId" to orderId, "status" to status, "type" to "2", "updateBy" to updateBy))
suspend fun updateOrderStates(memberId: String, orderId: String, status: String, updateBy: String, reasonId: String, reasonDesc: String) = withContext(Dispatchers.IO) {
network.cancelOrder(getBody("memberId" to memberId, "orderId" to orderId, "status" to status, "type" to "2", "updateBy" to updateBy, "reasonId" to reasonId, "reasonDesc" to reasonDesc))
}
suspend fun getCancelReason(restaurantId: String, type: String) = withContext(Dispatchers.IO) {
......
package com.gingersoft.gsa.other_order_mode.data.model.bean
import com.gingersoft.gsa.other_order_mode.R
class BtnBuilder {
companion object {
val sureBtn = 0
val cancelBtn = 1
val printBtn = 2
val logisticsBtn = 3
val assignDeliveryBtn = 4
val closingBtn = 5
val ProductionCompletedBtn = 6
}
class BtnBean(val type: Int, val btnContent: String, val btnColor: Int, val btnImg: Int)
fun getSureBtn(): BtnBean {
return BtnBean(sureBtn, "確認訂單", R.color.other_order_details_sure_btn_color, R.drawable.ic_sure)
}
fun getProductionCompletedBtn(): BtnBean {
return BtnBean(ProductionCompletedBtn, "製作完成", R.color.other_order_details_sure_btn_color, R.drawable.ic_sure)
}
fun getCancelBtn(): BtnBean {
return BtnBean(cancelBtn, "取消訂單", R.color.other_order_details_cancel_btn_color, R.drawable.ic_cancel)
}
fun getPrintBtn(): BtnBean {
return BtnBean(printBtn, "打印訂單", R.color.other_order_details_print_btn_color, R.drawable.ic_print)
}
fun getLogisticsBtn(): BtnBean {
return BtnBean(logisticsBtn, "取消物流", R.color.other_order_details_cancel_logistics_btn_color, R.drawable.ic_logistics)
}
fun getAssignDeliveryBtn(): BtnBean {
return BtnBean(assignDeliveryBtn, "指派送貨", R.color.other_order_details_sure_btn_color, R.drawable.ic_deliveryman)
}
fun getClosingBtn(): BtnBean {
return BtnBean(closingBtn, "結賬", R.color.other_order_details_cancel_btn_color, R.drawable.ic_closing)
}
}
......@@ -10,12 +10,12 @@ data class CancelReason(
val content: String,
val content2: String,
val content3: String,
val createTime: Int,
val createTime: Long,
val id: Int,
val restaurantId: Int,
val sort: Int,
val type: Int,
val uid: Int,
val updateTime: Int
val updateTime: Long
)
}
\ No newline at end of file
......@@ -2,13 +2,19 @@ package com.gingersoft.gsa.other_order_mode.service
import android.app.Service
import android.content.Intent
import android.media.AudioAttributes
import android.media.AudioManager
import android.media.SoundPool
import android.os.Binder
import android.os.Build
import android.os.Handler
import android.os.IBinder
import android.util.Log
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication
import com.gingersoft.gsa.other_order_mode.R
import com.gingersoft.gsa.other_order_mode.data.network.ServiceCreator
import com.google.gson.Gson
import io.reactivex.Observable
import okhttp3.*
import okio.ByteString
import org.json.JSONObject
......@@ -22,7 +28,7 @@ class GetInfoUpdateService : Service() {
/**
* 心跳检测时间
*/
private val HEART_BEAT_RATE = (15 * 1000).toLong()//每隔15秒进行一次对长连接的心跳检测
private val HEART_BEAT_RATE = (60 * 1000).toLong()//每隔15秒进行一次对长连接的心跳检测
private val WEBSOCKET_HOST_AND_PORT = "${ServiceCreator.ROOT_URL}/ricepon-websocket/js/webSocketServer"//可替换为自己的主机名和端口号
private var mWebSocket: WebSocket? = null
......@@ -64,10 +70,13 @@ class GetInfoUpdateService : Service() {
// 初始化socket
private fun initSocket() {
// Observable.interval(5, 10, TimeUnit.SECONDS)
// .subscribe(Observer())
val client = OkHttpClient.Builder().readTimeout(0, TimeUnit.MILLISECONDS).build()
val request = Request.Builder()
.url(WEBSOCKET_HOST_AND_PORT)
.build()
client.newWebSocket(request, object : WebSocketListener() {
override fun onOpen(webSocket: WebSocket?, response: Response?) {//开启长连接成功的回调
super.onOpen(webSocket, response)
......@@ -82,8 +91,19 @@ class GetInfoUpdateService : Service() {
override fun onMessage(webSocket: WebSocket?, text: String?) {//接收消息的回调
super.onMessage(webSocket, text)
val json = JSONObject(text)
val type = json.optInt("type");
if (postCallBack != null) {
postCallBack!!.callBack(json.optInt("type"))
postCallBack!!.callBack(type)
}
if (type == 3 || type == 4 || type == 5
|| type == 6 || type == 7) {
if (type == 6 || type == 7) {
} else {
//播放提示音
initSoundPool()
}
}
//收到服务器端传过来的消息text
Log.e(TAG, "onMessage:" + text!!)
......@@ -124,7 +144,59 @@ class GetInfoUpdateService : Service() {
}
})
client.dispatcher().executorService().shutdown()
// mHandler.postDelayed(heartBeatRunnable, HEART_BEAT_RATE)//开启心跳检测
mHandler.postDelayed(heartBeatRunnable, HEART_BEAT_RATE)//开启心跳检测
}
private var soundPool: SoundPool? = null
fun initSoundPool() {
//实例化SoundPool
//sdk版本21是SoundPool 的一个分水岭
if (soundPool == null) {
if (Build.VERSION.SDK_INT >= 21) {
val builder = SoundPool.Builder()
//传入最多播放音频数量,
builder.setMaxStreams(1)
//AudioAttributes是一个封装音频各种属性的方法
val attrBuilder = AudioAttributes.Builder()
//设置音频流的合适的属性
attrBuilder.setLegacyStreamType(AudioManager.STREAM_MUSIC)
//加载一个AudioAttributes
builder.setAudioAttributes(attrBuilder.build())
soundPool = builder.build()
} else {
/**
* 第一个参数:int maxStreams:SoundPool对象的最大并发流数
* 第二个参数:int streamType:AudioManager中描述的音频流类型
*第三个参数:int srcQuality:采样率转换器的质量。 目前没有效果。 使用0作为默认值。
*/
soundPool = SoundPool(1, AudioManager.STREAM_MUSIC, 0)
}
}
//可以通过四种途径来记载一个音频资源:
//1.通过一个AssetFileDescriptor对象
//int load(AssetFileDescriptor afd, int priority)
//2.通过一个资源ID
//int load(Context context, int resId, int priority)
//3.通过指定的路径加载
//int load(String path, int priority)
//4.通过FileDescriptor加载
//int load(FileDescriptor fd, long offset, long length, int priority)
//声音ID 加载音频资源,这里用的是第二种,第三个参数为priority,声音的优先级*API中指出,priority参数目前没有效果,建议设置为1。
val voiceId = soundPool!!.load(this, R.raw.newordervocal, 1)
//异步需要等待加载完成,音频才能播放成功
soundPool!!.setOnLoadCompleteListener { soundPool, sampleId, status ->
if (status == 0) {
//第一个参数soundID
//第二个参数leftVolume为左侧音量值(范围= 0.0到1.0)
//第三个参数rightVolume为右的音量值(范围= 0.0到1.0)
//第四个参数priority 为流的优先级,值越大优先级高,影响当同时播放数量超出了最大支持数时SoundPool对该流的处理
//第五个参数loop 为音频重复播放次数,0为值播放一次,-1为无限循环,其他值为播放loop+1次
//第六个参数 rate为播放的速率,范围0.5-2.0(0.5为一半速率,1.0为正常速率,2.0为两倍速率)
soundPool.play(voiceId, 1f, 1f, 1, 0, 1f)
}
}
}
/*获取一条随机字符串*/
......@@ -149,16 +221,16 @@ class GetInfoUpdateService : Service() {
if (System.currentTimeMillis() - sendTime >= HEART_BEAT_RATE) {
val isSuccess = mWebSocket?.send("0")//发送一个空消息给服务器,通过发送消息的成功失败来判断长连接的连接状态
Log.e(TAG, "連接狀態:$isSuccess")
if (isSuccess != null && !isSuccess) {//长连接已断开
// if (isSuccess != null && !isSuccess) {//长连接已断开
mHandler.removeCallbacks(this)
mWebSocket?.cancel()//取消掉以前的长连接
InitSocketThread().start()//创建一个新的连接
} else {//长连接处于连接状态
}
// } else {//长连接处于连接状态
//
// }
sendTime = System.currentTimeMillis()
}
mHandler.postDelayed(this, HEART_BEAT_RATE)//每隔一定的时间,对长连接进行一次心跳检测
// mHandler.postDelayed(this, HEART_BEAT_RATE)//每隔一定的时间,对长连接进行一次心跳检测
}
}
}
......
......@@ -102,7 +102,6 @@ class OtherOrderActivity : BaseActivity() {
btnHeight = btn_open_or_close_info.height.toFloat()
}
pageViewModel.getDeliveryInfo(this)
pageViewModel.getDeliveryConfigDTO(this)
}
/**
......@@ -257,6 +256,7 @@ class OtherOrderActivity : BaseActivity() {
private fun initWebsocket() {
//開啟websocket
val intent = Intent(this, GetInfoUpdateService::class.java)
startService(intent)
bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE)
}
......@@ -274,12 +274,12 @@ class OtherOrderActivity : BaseActivity() {
Log.e("message", "消息類型$type")
if (type == 3 || type == 4 || type == 5
|| type == 6 || type == 7) {
if (type == 6 || type == 7) {
} else {
//播放提示音
initSoundPool()
}
// if (type == 6 || type == 7) {
//
// } else {
// //播放提示音
// initSoundPool()
// }
pageViewModel.refreshState.postValue(selectPosition)
}
}
......@@ -420,6 +420,11 @@ class OtherOrderActivity : BaseActivity() {
startActivity(Intent(this, HistoryOrderActivity::class.java))
pop!!.dismiss()
}
view.findViewById<QMUIAlphaTextView>(R.id.tv_open_cash_box).setOnClickListener {
//開錢箱
pageViewModel.openCashBox()
pop!!.dismiss()
}
} else {
pop!!.show(it)
}
......
......@@ -5,6 +5,7 @@ import android.graphics.drawable.GradientDrawable
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.RecyclerView
import com.gingersoft.gsa.other_order_mode.R
......@@ -13,7 +14,7 @@ import com.gingersoft.gsa.other_order_mode.data.model.bean.OrderList
import com.gingersoft.gsa.other_order_mode.databinding.LayoutHistoryOrderItemBinding
import com.scwang.smartrefresh.layout.util.SmartUtil
class HistoryOrderAdapter(private val context: Context, var data: List<DataBean>?) : RecyclerView.Adapter<HistoryOrderAdapter.ViewHolder>() {
class HistoryOrderAdapter(var stauts: String?, private val context: Context, var data: List<DataBean>?) : RecyclerView.Adapter<HistoryOrderAdapter.ViewHolder>() {
//item點擊事件
private var listenter: ((item: DataBean) -> Unit)? = null
......@@ -72,6 +73,18 @@ class HistoryOrderAdapter(private val context: Context, var data: List<DataBean>
holder.itemView.setOnClickListener {
listenter?.invoke(data)
}
if (stauts != null) {
if (stauts.equals("4")) {
//已完成訂單
holder.iv_end.setImageResource(R.drawable.ic_has_end)
} else if (stauts.equals("6")) {
//已取消訂單
holder.iv_end.setImageResource(R.drawable.img_cancelled)
}
} else {
holder.iv_end.setImageResource(R.drawable.ic_has_end)
}
}
private fun getColor(color: Int): Int {
......@@ -80,6 +93,7 @@ class HistoryOrderAdapter(private val context: Context, var data: List<DataBean>
class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
var binding: LayoutHistoryOrderItemBinding = DataBindingUtil.bind(itemView)!!
var iv_end = itemView.findViewById<ImageView>(R.id.iv_end)
}
fun setOnItemClickListenter(listenter: (item: DataBean) -> Unit) {
......
package com.gingersoft.gsa.other_order_mode.ui.adapter
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.gingersoft.gsa.other_order_mode.R
import com.gingersoft.gsa.other_order_mode.data.model.bean.BtnBuilder
class OrderDetailsAdapter(list: List<BtnBuilder.BtnBean>) : BaseQuickAdapter<BtnBuilder.BtnBean, BaseViewHolder>(R.layout.item_btn, list) {
override fun convert(helper: BaseViewHolder, item: BtnBuilder.BtnBean) {
helper.setText(R.id.tv_btn_content, item.btnContent)
helper.setBackgroundRes(R.id.layout_btn_item, item.btnColor)
helper.setImageResource(R.id.iv_btn_mark, item.btnImg)
}
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
......@@ -18,7 +19,6 @@ import com.gingersoft.gsa.other_order_mode.ui.adapter.DeliveryListAdapter
import com.gingersoft.gsa.other_order_mode.ui.base.BaseFragment
import com.gingersoft.gsa.other_order_mode.util.InjectorUtil
import kotlinx.android.synthetic.main.fragment_delivery_list.*
import kotlin.math.max
class DeliveryFragment : BaseFragment() {
......@@ -30,15 +30,21 @@ class DeliveryFragment : BaseFragment() {
private lateinit var viewModel: DeliveryViewModel
private lateinit var contentView:View
private lateinit var addBtn: Button
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_delivery_list, container, false)
contentView = inflater.inflate(R.layout.fragment_delivery_list, container, false)
addBtn = contentView.findViewById(R.id.btn_default)
return contentView
}
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
viewModel = ViewModelProvider(activity?.viewModelStore!!, InjectorUtil.getDeliveryFactory())[DeliveryViewModel::class.java]
tv_add_delivery.setOnClickListener{
addBtn.text = "+添加配送方式"
addBtn.setOnClickListener{
(activity as DeliverySettingActivity).editDelivery(null)
}
viewModel.otherInfo.observe(viewLifecycleOwner, Observer { it ->
......@@ -53,7 +59,7 @@ class DeliveryFragment : BaseFragment() {
deliveryListAdapter!!.setOnItemChildClickListener { adapter, view, position ->
when (view.id) {
R.id.iv_delete -> {
AppDialog.showWaringDialog(context, "是否確認刪除") { _, dialog ->
AppDialog().showWaringDialog(context, "是否確認刪除") { _, dialog ->
showLoading()
it.data.list[position].apply {
viewModel.updateDeliveryConfig(distributionFeeMin.toString(), distributionFeeMax.toString(), distributionFee.toString(), deliveryCost.toString(), distributionType, type, desc, id, GsaCloudApplication.getRestaurantId(context), GsaCloudApplication.getMemberId(context), lackPrice.toString(), 1) {
......
......@@ -39,6 +39,7 @@ class HistoryFragment : BaseFragment() {
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
viewModel = ViewModelProvider(activity!!.viewModelStore, InjectorUtil.getHistoryModelFactory())[HistoryOrderViewModel::class.java].apply {
historyData.observe(viewLifecycleOwner, Observer{ it ->
cancelDialogForLoading()
refresh_layout.finishRefresh()
......@@ -47,7 +48,7 @@ class HistoryFragment : BaseFragment() {
it?.let { _ ->
refresh_layout.setEnableLoadMore((it.data != null && it.data!!.size > 0))
if (mHistoryOrderAdapter == null) {
mHistoryOrderAdapter = it.data.let { it1 -> context?.let { it2 -> HistoryOrderAdapter(it2, it1) } }
mHistoryOrderAdapter = it.data.let { it1 -> context?.let { it2 -> HistoryOrderAdapter(status.value, it2, it1) } }
rv_other_order.layoutManager = LinearLayoutManager(context)
rv_other_order.adapter = mHistoryOrderAdapter
mHistoryOrderAdapter!!.setOnItemClickListenter { it ->
......@@ -77,6 +78,7 @@ class HistoryFragment : BaseFragment() {
}
} else {
mHistoryOrderAdapter!!.data = it.data
mHistoryOrderAdapter!!.stauts = status.value
mHistoryOrderAdapter!!.notifyDataSetChanged()
}
}
......
package com.gingersoft.gsa.other_order_mode.ui.fragment
import android.content.Intent
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
......@@ -14,6 +15,7 @@ import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils
import com.gingersoft.gsa.cloud.ui.utils.AppDialog
import com.gingersoft.gsa.other_order_mode.R
import com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel
import com.gingersoft.gsa.other_order_mode.ui.activity.OrderDetailsActivity
import com.gingersoft.gsa.other_order_mode.ui.adapter.OtherOrdersAdapter
import com.gingersoft.gsa.other_order_mode.ui.base.BaseFragment
import com.gingersoft.gsa.other_order_mode.util.InjectorUtil
......@@ -35,18 +37,8 @@ class PlaceholderFragment : BaseFragment() {
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
pageViewModel = ViewModelProvider(activity?.viewModelStore!!, InjectorUtil.getWeatherModelFactory())[PageViewModel::class.java].apply {
// 第一次進入獲取數據
// getOrderList(this, false)
// 綁定狀態,如果這個值發生變化
refreshState.observe(viewLifecycleOwner, Observer {
// 觸發刷新,判斷是否更新
// 並且type一致
//如果當前fragment的狀態中包含需要刷新的狀態,獲取數據
// if (PageViewModel.fragmentStatus[arguments?.getInt(INDEX)!!].contains(it.toString())) {
// page = 1
// getOrderList(this, false)
// }
Log.e("eee", "$it 當前:" + arguments?.getInt(INDEX))
if (arguments?.getInt(INDEX) == it) {
page = 1
getOrderList(this, false)
......@@ -60,63 +52,71 @@ class PlaceholderFragment : BaseFragment() {
adapter.setOnItemClickListenter { data ->
// 點擊查詢食品詳情
showLoading()
pageViewModel.getShipanyAndOrderInfo(data.curStat, GsaCloudApplication.getRestaurantId(context).toString(), data.Id.toString()) { it1 ->
cancelDialogForLoading()
//顯示彈窗
if (this@PlaceholderFragment.context != null && it1 != null) {
OtherOrderUtils.showOrderDetailsDialog(this@PlaceholderFragment.context!!, it1, data.STATUS, data.order_type) { view, _, dialog ->
when (view.id) {
R.id.btn_assign_shipping -> {
//修改訂單狀態
pageViewModel.updateOrderStatus(this@PlaceholderFragment.context!!, data, it1) {
dialog.dismiss()
if (it) {
// 關閉彈窗,並刷新當前頁面
refresh()
}
}
}
R.id.btn_cancel_order -> {
//取消訂單,先判斷有沒有物流
if (it1.data!![0].isDelete == 0) {
//第三方物流單
//彈出彈窗詢問是否確認取消
AppDialog.showWaringDialog(context, "是否確認取消第三方派送?") { v, dialog ->
when (v.id) {
R.id.tv_dialog_confirm -> {
//取消物流
showLoading()
pageViewModel.cancelLogistics(GsaCloudApplication.getRestaurantId(context).toString(), data.Id.toString()) {
ToastUtils.show(context, it)
cancelDialogForLoading()
refresh()//刷新當前頁面
}
dialog.dismiss()
}
R.id.tv_dialog_cancel -> dialog.dismiss()
}
}
} else {
//本店配送的單
pageViewModel.cancelOrder(context!!, data.Id.toString()) {
ToastUtils.show(context, if (it) {
"取消訂單成功"
} else {
"取消訂單失敗"
})
cancelDialogForLoading()
refresh()//刷新當前頁面
}
}
dialog.dismiss()
}
}
}
} else {
ToastUtils.show(context, "獲取訂單詳情失敗")
}
}
val intent = Intent(activity, OrderDetailsActivity::class.java)
intent.putExtra("orderId", data.Id.toString())
intent.putExtra("orderType", data.order_type)
intent.putExtra("orderStatus", data.STATUS)
intent.putExtra("orderPayType", data.orderPayType)
startActivity(intent)
// showLoading()
// pageViewModel.getShipanyAndOrderInfo(data.curStat, GsaCloudApplication.getRestaurantId(context).toString(), data.Id.toString()) { it1 ->
// cancelDialogForLoading()
// //顯示彈窗
// if (this@PlaceholderFragment.context != null && it1 != null) {
// OtherOrderUtils.showOrderDetailsDialog(this@PlaceholderFragment.context!!, it1, data.STATUS, data.order_type) { view, _, dialog ->
// when (view.id) {
// R.id.btn_assign_shipping -> {
// //修改訂單狀態
// pageViewModel.updateOrderStatus(this@PlaceholderFragment.context!!, data, it1) {
// dialog.dismiss()
// if (it) {
// // 關閉彈窗,並刷新當前頁面
// refresh()
// }
// }
// }
// R.id.btn_cancel_order -> {
// //取消訂單,先判斷有沒有物流
// if (it1.data!![0].isDelete == 0) {
// //第三方物流單
// //彈出彈窗詢問是否確認取消
// AppDialog.showWaringDialog(context, "是否確認取消第三方派送?") { v, dialog ->
// when (v.id) {
// R.id.tv_dialog_confirm -> {
// //取消物流
// showLoading()
// pageViewModel.cancelLogistics(GsaCloudApplication.getRestaurantId(context).toString(), data.Id.toString()) {
// ToastUtils.show(context, it)
// cancelDialogForLoading()
// refresh()//刷新當前頁面
// }
// dialog.dismiss()
// }
// R.id.tv_dialog_cancel -> dialog.dismiss()
// }
// }
// } else {
// //本店配送的單
// pageViewModel.cancelOrder(context!!, data.Id.toString()) {
// ToastUtils.show(context, if (it) {
// "取消訂單成功"
// } else {
// "取消訂單失敗"
// })
// cancelDialogForLoading()
// refresh()//刷新當前頁面
// }
// }
// dialog.dismiss()
// }
// }
// }
// } else {
// ToastUtils.show(context, "獲取訂單詳情失敗")
// }
// }
}
rv_other_order.adapter = adapter
......@@ -136,7 +136,6 @@ class PlaceholderFragment : BaseFragment() {
refresh()
//重新拉取一遍送貨員和第三方派送信息
pageViewModel.getDeliveryInfo(context!!)
pageViewModel.getDeliveryConfigDTO(context!!)
}
refresh_layout.setOnLoadMoreListener {
page++
......
......@@ -10,12 +10,5 @@
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.qmuiteam.qmui.layout.QMUIButton
android:id="@+id/tv_add_delivery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape_border_bg"
android:text="添加配送方式"
android:padding="@dimen/dp_10"
android:textColor="@color/theme_color" />
<include layout="@layout/layout_default" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:id="@+id/layout_btn_item"
android:layout_height="@dimen/dp_40"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_btn_mark"
android:layout_width="@dimen/dp_19"
android:layout_height="@dimen/dp_19"/>
<TextView
android:id="@+id/tv_btn_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_5"
android:textColor="@color/white"
android:textSize="@dimen/dp_16" />
</LinearLayout>
\ No newline at end of file
......@@ -153,9 +153,9 @@
app:layout_constraintRight_toLeftOf="@id/iv_edit"
app:layout_constraintTop_toTopOf="@id/tv_difference_text" />
<ImageView
<com.qmuiteam.qmui.alpha.QMUIAlphaImageButton
android:id="@+id/iv_edit"
android:layout_width="wrap_content"
android:layout_width="@dimen/dp_30"
android:layout_height="0dp"
android:layout_marginRight="@dimen/dp_10"
android:gravity="center"
......@@ -169,15 +169,15 @@
app:layout_constraintRight_toLeftOf="@id/iv_delete"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
<com.qmuiteam.qmui.alpha.QMUIAlphaImageButton
android:id="@+id/iv_delete"
android:layout_width="wrap_content"
android:layout_width="@dimen/dp_30"
android:layout_height="0dp"
android:layout_marginRight="@dimen/dp_10"
android:gravity="center"
android:paddingLeft="@dimen/dp_5"
android:paddingRight="@dimen/dp_5"
android:src="@drawable/ic_delete_bill_method"
android:src="@drawable/ic_delete"
android:text="刪除"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_12"
......
......@@ -32,5 +32,19 @@
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14" />
<include layout="@layout/include_horizontal_color_ccc_dividing_line" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_open_cash_box"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="@dimen/dp_20"
android:paddingTop="@dimen/dp_10"
android:paddingRight="@dimen/dp_20"
android:paddingBottom="@dimen/dp_10"
android:text="打開錢箱"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14" />
</LinearLayout>
......@@ -14,6 +14,8 @@
android:layout_height="wrap_content"
android:paddingTop="@dimen/dp_8"
android:paddingBottom="@dimen/dp_8"
android:paddingLeft="@dimen/dp_5"
android:paddingRight="@dimen/dp_5"
android:textColor="@color/color_c8"
android:textSize="@dimen/dp_17" />
......
......@@ -19,6 +19,7 @@
android:padding="@dimen/dp_10">
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
......
......@@ -95,4 +95,14 @@
<style name="otherOrder_delivery_setting_layout_style">
<item name="android:paddingRight">@dimen/dp_20</item>
</style>
<style name="otherOrder_details_sixteen_text_Style">
<item name="android:textSize">@dimen/dp_16</item>
<item name="android:textColor">@color/theme_333_color</item>
<item name="android:textStyle">bold</item>
</style>
<style name="otherOrder_details_twelve_text_Style">
<item name="android:textSize">@dimen/dp_12</item>
<item name="android:textColor">@color/color_3c</item>
</style>
</resources>
......@@ -4,11 +4,6 @@
<uses-permission android:name="android.permission.INTERNET" />
<application>
<activity
android:name=".mvp.ui.activity.IpPrintActivity"
android:launchMode="singleTop"
android:theme="@style/print_TranslucentTheme" />
<activity
android:name=".mvp.ui.activity.PrintActivity"
android:launchMode="singleTop"
android:theme="@style/print_TranslucentTheme" />
......
......@@ -23,9 +23,6 @@
android:theme="@style/AppTheme">
<activity android:name=".mvp.ui.activity.PrintActivity" />
<activity android:name=".mvp.ui.activity.PrinterAddActivity" />
<activity
android:name=".mvp.ui.activity.IpPrintActivity"
android:theme="@style/print_TranslucentTheme" />
<activity android:name=".mvp.ui.activity.PrinterListActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......
package com.joe.print;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.view.View;
import com.billy.cc.core.component.CC;
import com.billy.cc.core.component.CCResult;
import com.billy.cc.core.component.CCUtil;
import com.billy.cc.core.component.IComponent;
import com.joe.print.mvp.print.service.PrjService;
import com.joe.print.mvp.ui.activity.IpPrintActivity;
import com.joe.print.mvp.ui.activity.PrintActivity;
import com.joe.print.mvp.ui.activity.PrinterListActivity;
import static com.billy.cc.core.component.CCUtil.EXTRA_KEY_CALL_ID;
public class PrintComponent implements IComponent {
......@@ -54,8 +47,6 @@ public class PrintComponent implements IComponent {
case "getInfo":
getInfo(cc);
break;
case "print_order":
return printOrderInfo(cc);
case "printActivity":
return print(cc);
case "openPrintService":
......@@ -104,20 +95,6 @@ public class PrintComponent implements IComponent {
CC.sendCCResult(cc.getCallId(), CCResult.success());
}
private boolean printOrderInfo(CC cc) {
Context context = cc.getContext();
Intent intent = new Intent(context, IpPrintActivity.class);
if (!(context instanceof Activity)) {
//调用方没有设置context或app间组件跳转,context为application
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
//将cc的callId传给Activity,登录完成后通过这个callId来回传结果
intent.putExtra(EXTRA_KEY_CALL_ID, cc.getCallId());
context.startActivity(intent);
//返回true,不立即调用CC.sendCCResult
return true;
}
private boolean print(CC cc) {
// Context context = cc.getContext();
// Intent intent = new Intent(context, PrintActivity.class);
......
......@@ -24,5 +24,7 @@ public interface IpPrintListActivityContract {
Observable<BaseResult> getPrinterList(int restaurantId);
Observable<BaseResult> deletePrinter(RequestBody requestBody);
Observable<BaseResult> getPrintModel(int restaurantId);
}
}
......@@ -34,5 +34,7 @@ public interface PrinterAddContract {
Observable<BaseResult> addPrinter(RequestBody requestBody);
Observable<BaseResult> updatePrinter(RequestBody requestBody);
Observable<BaseResult> getPrintModel(int restaurantId);
}
}
......@@ -46,4 +46,10 @@ public class IpPrintListActivityModel extends BaseModel implements IpPrintListAc
return mRepositoryManager.obtainRetrofitService(PrintInfoService.class)
.deletePrinterList(requestBody);
}
@Override
public Observable<BaseResult> getPrintModel(int restaurantId) {
return mRepositoryManager.obtainRetrofitService(PrintInfoService.class)
.getPrinterModelList(restaurantId);
}
}
\ No newline at end of file
......@@ -58,4 +58,10 @@ public class PrinterAddModel extends BaseModel implements PrinterAddContract.Mod
.updatePrinter(requestBody);
}
@Override
public Observable<BaseResult> getPrintModel(int restaurantId) {
return mRepositoryManager.obtainRetrofitService(PrintInfoService.class)
.getPrinterModelList(restaurantId);
}
}
\ No newline at end of file
......@@ -16,11 +16,11 @@ import retrofit2.http.Query;
* Created by Wyh on 2019/12/20.
*/
public interface PrintInfoService {
// @Headers({"Domain-Name: yc_location"})
@POST("PrinterDevice/add" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> addPrinter(@Body RequestBody requestBody);
// @Headers({"Domain-Name: yc_location"})
// @Headers({"Domain-Name: yc_location"})
@GET("PrinterDevice/list?" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> getPrinterList(@Query("restaurantId") int restaurantId);
......@@ -30,4 +30,10 @@ public interface PrintInfoService {
// @Headers({"Domain-Name: yc_location"})
@POST("PrinterDevice/update" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> updatePrinter(@Body RequestBody requestBody);
// @Headers({"Domain-Name: yc_location"})
@GET("printerModel/list?" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> getPrinterModelList(@Query("restaurantId") int restaurantId);
}
......@@ -12,6 +12,7 @@ import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.RxLifecycleUtils;
import com.joe.print.mvp.contract.IpPrintListActivityContract;
import com.gingersoft.gsa.cloud.database.bean.PrintModelBean;
import java.util.List;
......@@ -106,4 +107,30 @@ public class IpPrintListActivityPresenter extends BasePresenter<IpPrintListActiv
});
}
private List<PrintModelBean> printModelBeans;
public List<PrintModelBean> getPrintModelBeans() {
return printModelBeans;
}
/**
* 獲取打印機機型列表
*/
public void getModelList(int restaurantId) {
mModel.getPrintModel(restaurantId)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(""))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(BaseResult baseResult) {
if (baseResult.isSuccess()) {
printModelBeans = JsonUtils.parseArray(baseResult.getData(), PrintModelBean.class);
}
}
});
}
}
......@@ -49,4 +49,6 @@ public class PrintListPresenter extends BasePresenter<PrintListContract.Model, P
this.mImageLoader = null;
this.mApplication = null;
}
}
......@@ -11,7 +11,10 @@ import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.RxLifecycleUtils;
import com.joe.print.mvp.contract.PrinterAddContract;
import com.gingersoft.gsa.cloud.database.bean.PrintModelBean;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import javax.inject.Inject;
......@@ -47,6 +50,28 @@ public class PrinterAddPresenter extends BasePresenter<PrinterAddContract.Model,
@Inject
AppManager mAppManager;
// private List<PrintModelBean> printModelBeans;
// private List<String> printModelLabels = new ArrayList<>();
//
// private int modelPosition = -1;
//
// public List<String> getPrintModelLabels() {
// return printModelLabels;
// }
//
// public List<PrintModelBean> getPrintModelBeans() {
// return printModelBeans;
// }
//
// public int getModelPosition() {
// return modelPosition;
// }
//
// public void setModelPosition(int modelPosition) {
// this.modelPosition = modelPosition;
// }
@Inject
public PrinterAddPresenter(PrinterAddContract.Model model, PrinterAddContract.View rootView) {
super(model, rootView);
......@@ -61,6 +86,7 @@ public class PrinterAddPresenter extends BasePresenter<PrinterAddContract.Model,
this.mApplication = null;
}
/**
* 添加打印機
*/
......@@ -110,4 +136,30 @@ public class PrinterAddPresenter extends BasePresenter<PrinterAddContract.Model,
}
/**
* 獲取打印機機型列表
*/
// public void getModelList(int restaurantId) {
// mModel.getPrintModel(restaurantId)
// .subscribeOn(Schedulers.io())
// .doOnSubscribe(disposable -> mRootView.showLoading(""))
// .subscribeOn(AndroidSchedulers.mainThread())
// .observeOn(AndroidSchedulers.mainThread())
// .doAfterTerminate(() -> mRootView.hideLoading())
// .compose(RxLifecycleUtils.bindToLifecycle(mRootView))
// .subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
// @Override
// public void onNext(BaseResult baseResult) {
// if (baseResult.isSuccess()) {
// printModelBeans = JsonUtils.parseArray(baseResult.getData(), PrintModelBean.class);
// if (printModelBeans != null && printModelBeans.size() > 0) {
// for (int i = 0; i < printModelBeans.size(); i++) {
// printModelLabels.add(printModelBeans.get(i).getPrinterName() + "\u3000" + printModelBeans.get(i).getModel());
// }
// }
// }
// }
// });
// }
}
......@@ -7,11 +7,9 @@ import android.graphics.Matrix;
import android.graphics.Rect;
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils;
import com.gingersoft.gsa.cloud.base.utils.view.ImageUtils;
import com.gingersoft.gsa.cloud.print.PrintDataMaker;
import com.gingersoft.gsa.cloud.print.PrinterWriter;
import com.gingersoft.gsa.cloud.print.PrinterWriter58mm;
import com.gingersoft.gsa.cloud.print.PrinterWriter80mm;
import com.gingersoft.gsa.cloud.print.PrinterWriterExecutor;
import java.io.IOException;
import java.util.ArrayList;
......@@ -27,11 +25,6 @@ public class IpPrintMaker implements PrintDataMaker {
private int width; // 打印的圖片寬度,紙張寬度
private List<Bitmap> bitmaps;
public IpPrintMaker(Context context, int width, List<Bitmap> bitmaps) {
this.mContext = context;
this.width = width;
this.bitmaps = bitmaps;
}
public IpPrintMaker(Context context, int width, Bitmap bitmap) {
this.mContext = context;
this.width = width;
......@@ -39,14 +32,12 @@ public class IpPrintMaker implements PrintDataMaker {
this.bitmaps.add(bitmap);
}
@Override
public List<byte[]> getPrintData(int type) {
public List<byte[]> getPrintData() {
ArrayList<byte[]> data = new ArrayList<>();
try {
PrinterWriter printer;
printer = type == PrinterWriter58mm.TYPE_58 ? new PrinterWriter58mm(255, width) : new PrinterWriter80mm(255, width);
printer = new PrinterWriterExecutor(255, width);
printer.setAlignCenter();
data.add(printer.getDataAndReset());
if (bitmaps.size() <= 0) {
......@@ -64,6 +55,7 @@ public class IpPrintMaker implements PrintDataMaker {
printer.feedPaperCutPartial();
data.add(printer.getDataAndReset());
}
// printer.openCashBox();
data.add(printer.getDataAndClose());
return data;
} catch (Exception e) {
......
package com.joe.print.mvp.print;
import com.gingersoft.gsa.cloud.print.PrintDataMaker;
import com.gingersoft.gsa.cloud.print.PrinterWriter;
import com.gingersoft.gsa.cloud.print.PrinterWriterExecutor;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Wyh on 2020/1/9.
* ip打印類
*/
public class OpenCashBoxMaker implements PrintDataMaker {
@Override
public List<byte[]> getPrintData() {
ArrayList<byte[]> data = new ArrayList<>();
try {
PrinterWriter printer;
printer = new PrinterWriterExecutor(255, 0);
printer.openCashBox();
data.add(printer.getDataAndClose());
return data;
} catch (Exception e) {
return new ArrayList<>();
}
}
}
package com.joe.print.mvp.print;
import android.content.Context;
import android.graphics.Bitmap;
import java.util.List;
import java.util.Map;
/**
* 指令打印
*/
public class PrintInstruction extends PrinterRoot {
@Override
public Map<String, List<Bitmap>> getPrintBitmap(Context mContext) {
return null;
}
@Override
public int getPrintCount(Context context) {
return 0;
}
}
......@@ -59,6 +59,7 @@ public abstract class PrinterRoot implements PrintSocketHolder.OnStateChangedLis
public final static int PRINT_KITCHEN = 3;//送單,廚房單
public final static int PRINT_CLEAN_MACHINE = 4;//清機報表
public final static int PRINT_OTHER_ORDER = 5;//接單內容打印
public final static int PRINT_INSTRUCTION = 6;//開錢箱
private final static int SUNMI_PAPER_WIDTH = 360;//商米打印機紙張寬度
private final static int N5_PAPER_WIDTH = 500;//N5打印機紙張寬度
......@@ -86,6 +87,8 @@ public abstract class PrinterRoot implements PrintSocketHolder.OnStateChangedLis
return new PrintCleanMachine();
} else if (type == PRINT_OTHER_ORDER) {
return new PrintOtherOrder();
} else if (type == PRINT_INSTRUCTION) {
return new PrintInstruction();
}
return null;
}
......@@ -134,30 +137,29 @@ public abstract class PrinterRoot implements PrintSocketHolder.OnStateChangedLis
public abstract int getPrintCount(Context context);
public void print(List<PrinterDeviceBean> deviceBeans) {
listMap = getPrintBitmap(mContext);
printSize = listMap.size();
printCount = getPrintCount(mContext);
if (printSize <= 0) {
printListener.printFile();
return;
}
//當配置打印多張時執行
// int x = 2;
// for (int i = 0; i < x; i++) {
// for (Map.Entry<String, List<Bitmap>> entry : listMap.entrySet()) {
// merge2ResultMap(listMap, entry.getKey(), entry.getValue());
// }
// }
// 先不管有沒有默認打印位置
// 第一步先查看map中的key是不是空的"",有key就要獲取打印機列表,找到對應打印機打印。如果沒有找到打印機再去找默認打印機
// 如果沒有key,則是走默認打印機流程
for (Map.Entry<String, List<Bitmap>> entry : listMap.entrySet()) {
if (entry.getKey().equals("") || entry.getKey().equals("null")) {
//沒有打印位置,獲取默認打印位置
defaultPrint(deviceBeans, entry.getValue());
} else {
//有打印位置
hasPrinterSettingPrint(entry.getKey(), entry.getValue(), deviceBeans);
if (this instanceof PrintInstruction) {
//開錢箱
PrintExecutor executor = new PrintExecutor(getDefaultPrintInList(deviceBeans));
executor.doPrinterRequestAsync(new OpenCashBoxMaker());
} else {
listMap = getPrintBitmap(mContext);
printSize = listMap.size();
printCount = getPrintCount(mContext);
if (printSize <= 0) {
printListener.printFile();
return;
}
// 先不管有沒有默認打印位置
// 第一步先查看map中的key是不是空的"",有key就要獲取打印機列表,找到對應打印機打印。如果沒有找到打印機再去找默認打印機
// 如果沒有key,則是走默認打印機流程
for (Map.Entry<String, List<Bitmap>> entry : listMap.entrySet()) {
if (entry.getKey().equals("") || entry.getKey().equals("null")) {
//沒有打印位置,獲取默認打印位置
defaultPrint(deviceBeans, entry.getValue());
} else {
//有打印位置
hasPrinterSettingPrint(entry.getKey(), entry.getValue(), deviceBeans);
}
}
}
}
......@@ -343,6 +345,7 @@ public abstract class PrinterRoot implements PrintSocketHolder.OnStateChangedLis
}
private void defaultPrint(List<PrinterDeviceBean> printerDeviceBeans, List<Bitmap> bitmaps) {
//獲取默認打印方式,本機、IP
String deftultPrint = (String) SPUtils.get(mContext, PrintConstans.DEFAULT_PRINT_METHOD, "");
if (deftultPrint.equals("")) {
// 如果沒有默認打印位置,彈出彈窗讓用戶選擇是本機打印還是ip打印
......@@ -401,25 +404,30 @@ public abstract class PrinterRoot implements PrintSocketHolder.OnStateChangedLis
});
} else if (deftultPrint.equals(PrintConstans.IP_PRINT)) {
// 默認打印方式為ip打印,調用ip打印方法
// 獲取默認ip打印機
// 獲取默認ip打印機
if (printerDeviceBeans != null && printerDeviceBeans.size() > 0) {
//有默認打印機
for (PrinterDeviceBean printerDeviceBean : printerDeviceBeans) {
if (printerDeviceBean.getStatus() == 2) {
//默認打印機
ipDevicePrint(printerDeviceBeans.get(0), bitmaps);
return;
}
}
ipDevicePrint(getDefaultPrintInList(printerDeviceBeans), bitmaps);
} else {
//沒有默認打印機,彈出彈窗,讓用戶選擇ip打印機
showIpPrintDeviceList(printerDeviceBeans, bitmaps);
} else {
//沒有打印機,讓用戶去添加
setPrintState(PrintActivity.ADD_PRINT_DEVICE);
}
} else {
//沒有打印機,讓用戶去添加
setPrintState(PrintActivity.ADD_PRINT_DEVICE);
}
}
private PrinterDeviceBean getDefaultPrintInList(List<PrinterDeviceBean> printerDeviceBeans) {
for (PrinterDeviceBean printerDeviceBean : printerDeviceBeans) {
if (printerDeviceBean.getStatus() == 2) {
//默認打印機
return printerDeviceBean;
}
}
return null;
}
private void showIpPrintDeviceList
(List<PrinterDeviceBean> printerDeviceBeans, List<Bitmap> bitmaps) {
if (printerDeviceBeans != null && printerDeviceBeans.size() > 0) {
......@@ -465,32 +473,26 @@ public abstract class PrinterRoot implements PrintSocketHolder.OnStateChangedLis
public void ipDevicePrint(PrinterDeviceBean
printerDeviceBean, List<Bitmap> bitmaps, PrintSocketHolder.OnStateChangedListener
stateChangedListener, PrintExecutor.OnPrintResultListener resultListener) {
int paperType = printerDeviceBean.getType();//打印紙類型 1:58mm,2::80mm
int printWidth;//打印出來的內容寬度
if (paperType == 1) {
paperType = PrinterWriter58mm.TYPE_58;
printWidth = 580 - 20;//兩邊留20的空隙
if (printerDeviceBean.getPaperSpecification() != null) {
printWidth = Double.valueOf(printerDeviceBean.getPaperSpecification()).intValue();
} else {
paperType = PrinterWriter80mm.TYPE_80;
printWidth = 800 - 20;//兩邊留20的空隙
printWidth = 540;
}
PrintExecutor executor = new PrintExecutor(printerDeviceBean, paperType);
PrintExecutor executor = new PrintExecutor(printerDeviceBean);
executor.setOnStateChangedListener(stateChangedListener);
executor.setOnPrintResultListener(resultListener);
// List<Bitmap> zoomBitmaps = new ArrayList<>();
if (bitmaps != null) {
for (int j = 0; j < printCount; j++) {
for (int i = 0; i < bitmaps.size(); i++) {
// zoomBitmaps.add(ImageUtils.zoomDrawable(bitmaps.get(i), printWidth));
IpPrintMaker maker = new IpPrintMaker(mContext, printWidth, ImageUtils.zoomDrawable(bitmaps.get(i), printWidth));
executor.doPrinterRequestAsync(maker);
}
}
}
// IpPrintMaker maker = new IpPrintMaker(mContext, printWidth, zoomBitmaps);
// executor.doPrinterRequestAsync(maker);
}
/**
* view轉bitmap
*
......
......@@ -35,12 +35,12 @@ public class SendPrint implements PrintDataMaker {
}
@Override
public List<byte[]> getPrintData(int type) {
public List<byte[]> getPrintData() {
ArrayList<byte[]> data = new ArrayList<>();
try {
PrinterWriter printer;
printer = type == PrinterWriter58mm.TYPE_58 ? new PrinterWriter58mm(parting, width) : new PrinterWriter80mm(parting, width);
printer = new PrinterWriter58mm(parting, width);
printer.setAlignCenter();
data.add(printer.getDataAndReset());
List<Bitmap> bitmaps = PrintUtils.getPrintBitmap(mContext, printType, width);//根據打印類型獲得不同的bitmap
......
package com.joe.print.mvp.print;
import android.content.Context;
import android.graphics.Bitmap;
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils;
import com.gingersoft.gsa.cloud.print.PrintDataMaker;
import com.gingersoft.gsa.cloud.print.PrinterWriter;
import com.gingersoft.gsa.cloud.print.PrinterWriter58mm;
import com.gingersoft.gsa.cloud.print.PrinterWriter80mm;
import com.joe.print.R;
import java.util.ArrayList;
import java.util.List;
/**
* 打印測試
* 測試數據生成
*/
public class TestPrintDataMaker implements PrintDataMaker {
private Context context;
// private String qr;
private int width;
private int height;
public TestPrintDataMaker(Context context, int width, int height) {
this.context = context;
// this.qr = qr;
this.width = width;
this.height = height;
}
@Override
public List<byte[]> getPrintData(int type) {
ArrayList<byte[]> data = new ArrayList<>();
try {
PrinterWriter printer;
printer = type == PrinterWriter58mm.TYPE_58 ? new PrinterWriter58mm(height, width) : new PrinterWriter80mm(height, width);
printer.setAlignCenter();
data.add(printer.getDataAndReset());
ArrayList<byte[]> image = printer.getImageByte(context.getResources(), R.mipmap.ic_launcher);
data.addAll(image);
List<Bitmap> bitmaps = PrintUtils.getPrintBitmap(context, -1, width);//根據打印類型獲得不同的bitmap
if (bitmaps.size() <= 0) {
ToastUtils.show(context, "打印失敗");
return null;
}
for (int i = 0; i < bitmaps.size(); i++) {
ArrayList<byte[]> image1 = printer.getImageByte(bitmaps.get(i));
data.addAll(image1);//draw2PxPoint2(bitmaps.get(i)
printer.printLineFeed();
printer.printLineFeed();
printer.printLineFeed();
printer.printLineFeed();
printer.printLineFeed();
printer.feedPaperCutPartial();
}
data.add(printer.getDataAndReset());
// printer.setAlignLeft();
// printer.printLine();
// printer.printLineFeed();
//
// printer.printLineFeed();
// printer.setAlignCenter();
// printer.setEmphasizedOn();
// printer.setFontSize(1);
// printer.print("Selftest");
// printer.printLineFeed();
// printer.setFontSize(0);
// printer.setEmphasizedOff();
// printer.printLineFeed();
//
// printer.print("Gingersoft");
// printer.printLineFeed();
// printer.print("客服电话:××××××××");
// printer.printLineFeed();
//
// printer.setAlignLeft();
// printer.printLineFeed();
//
// printer.print("订单号:88888888888888888");
// printer.printLineFeed();
//
// printer.print("预计送达:" +
// new SimpleDateFormat("yyyy/MM/dd HH:mm", Locale.getDefault())
// .format(new Date(System.currentTimeMillis())));
// printer.printLineFeed();
//
// printer.setEmphasizedOn();
// printer.print("#8(已付款)");
// printer.printLineFeed();
// printer.print("××区××路×××大厦××楼×××室");
// printer.printLineFeed();
// printer.setEmphasizedOff();
// printer.printLineFeed();
// printer.print("备注:多加点辣椒,多加点香菜,多加点酸萝卜,多送点一次性手套");
// printer.printLineFeed();
//
// printer.printLine();
// printer.printLineFeed();
// printer.printLineFeed();
// printer.printLineFeed();
data.add(printer.getDataAndClose());
return data;
} catch (Exception e) {
return new ArrayList<>();
}
}
}
package com.joe.print.mvp.ui.activity;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import com.billy.cc.core.component.CC;
import com.billy.cc.core.component.CCResult;
import com.gingersoft.gsa.cloud.constans.PrintConstans;
import com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean;
import com.gingersoft.gsa.cloud.print.PrintExecutor;
import com.gingersoft.gsa.cloud.print.PrintSocketHolder;
import com.gingersoft.gsa.cloud.print.PrinterWriter58mm;
import com.gingersoft.gsa.cloud.print.PrinterWriter80mm;
import com.joe.print.R;
import com.joe.print.mvp.print.SendPrint;
import com.joe.print.mvp.print.TestPrintDataMaker;
import static com.billy.cc.core.component.CCUtil.EXTRA_KEY_CALL_ID;
/**
* Created by Wyh on 2020/1/7.
*/
public class IpPrintActivity extends Activity implements PrintSocketHolder.OnStateChangedListener, PrintExecutor.OnPrintResultListener, DialogInterface.OnDismissListener {
private Context mContext;
private PrintExecutor executor;
private SendPrint maker;
private String callId;
/**
* -
* 是否打印成功 true:成功
*/
private boolean printStatus = false;
private String ip;
private Integer port;
private int paperType = 1;//打印紙類型 1:58mm,2::80mm
private int printWidth = 560;//打印出來的內容寬度
/**
* -1:打印測試
* 0:上菜紙
* 1:印單
* 2:結賬單
* 3:廚房單
*/
private int type = -1;
private TextView mTvLoadingTip;
private Dialog mLoadingDialog;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
| WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH);
super.onCreate(savedInstanceState);
mContext = this;
getWindow().setBackgroundDrawable(null);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
initDialog();
initIntent();
callId = getIntent().getStringExtra(EXTRA_KEY_CALL_ID);
printOrder(this);
}
private void initDialog() {
try {
View view = LayoutInflater.from(mContext).inflate(R.layout.ui_dialog_loading, null);
mTvLoadingTip = view.findViewById(R.id.tv_loading_dialog_text);
mLoadingDialog = new Dialog(mContext, R.style.ui_loading_dialog);
mLoadingDialog.setCancelable(true);
mLoadingDialog.setCanceledOnTouchOutside(false);
Window window = mLoadingDialog.getWindow();
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
// window.getDecorView().setBackgroundResource(android.R.color.transparent);
mLoadingDialog.setContentView(view, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
mLoadingDialog.show();
mLoadingDialog.setOnDismissListener(dialog -> dismiss());
setLoadingText("加載中...");
} catch (Exception e) {
e.printStackTrace();
}
}
private void setLoadingText(String tip) {
if (mLoadingDialog != null && mLoadingDialog.isShowing()) {
mTvLoadingTip.setText(tip);
}
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
//點擊當前頁面任意地方自動關閉
finish();
return true;
}
private void initIntent() {
Intent intent = getIntent();
ip = intent.getStringExtra("ip");
port = intent.getIntExtra("port", 0);
paperType = intent.getIntExtra("paperType", 1);
type = intent.getIntExtra(PrintConstans.PRINT_TYPE, -1);
if (ip == null || ip.equals("")) {
ip = "192.168.1.217";
}
if (paperType == 1) {
paperType = PrinterWriter58mm.TYPE_58;
printWidth = 580 - 20;//兩邊留20的空隙
} else {
paperType = PrinterWriter80mm.TYPE_80;
printWidth = 800 - 20;//兩邊留20的空隙
}
}
public void printOrder(Context context) {
PrinterDeviceBean printerDeviceBean = new PrinterDeviceBean("", null, ip, port, type);
if (executor == null) {
executor = new PrintExecutor(printerDeviceBean, paperType);
executor.setOnStateChangedListener(this);
executor.setOnPrintResultListener(this);
}
if (maker == null) {
maker = new SendPrint(context, 255, printWidth, type);
}
executor.setIp(printerDeviceBean);
if (type == -1) {
executor.doPrinterRequestAsync(new TestPrintDataMaker(context, 380, 255));
} else {
executor.doPrinterRequestAsync(maker);
}
}
@Override
public void onResult(int errorCode, PrinterDeviceBean printerDeviceBean) {
String tip;
switch (errorCode) {
case PrintSocketHolder.ERROR_0:
tip = "打印成功";
printStatus = true;
setLoadingText(tip);
dismiss();
break;
case PrintSocketHolder.ERROR_1:
tip = "生成打印數據失敗";
printStatus = false;
setLoadingText(tip);
dismiss();
break;
case PrintSocketHolder.ERROR_2:
case PrintSocketHolder.ERROR_3:
tip = "連接打印機失敗";
printStatus = false;
setLoadingText(tip);
dismiss();
break;
case PrintSocketHolder.ERROR_4:
tip = "寫入測試頁面數據失敗";
setLoadingText(tip);
break;
case PrintSocketHolder.ERROR_5:
tip = "必要的參數不能為空";
setLoadingText(tip);
break;
}
}
@Override
public void onStateChanged(int state, PrinterDeviceBean printerDeviceBean) {
String tip = "打印中...";
switch (state) {
case PrintSocketHolder.STATE_0:
case PrintSocketHolder.STATE_1:
tip = "開始創建連接";
break;
case PrintSocketHolder.STATE_2:
tip = "創建連接成功,開始發送數據";
break;
case PrintSocketHolder.STATE_3:
tip = "開始寫入數據";
break;
case PrintSocketHolder.STATE_4:
tip = "關閉中";
break;
}
setLoadingText(tip);
}
private void dismiss() {
//延遲一秒
new Handler().postDelayed(() -> {
if (mLoadingDialog != null) {
mLoadingDialog.dismiss();
//判断是否为CC调用打开本页面
if (callId != null) {
CCResult result;
if (printStatus) {
result = CCResult.success();
} else {
result = CCResult.error("print error");
}
//为确保不管登录成功与否都会调用CC.sendCCResult,在onDestroy方法中调用
CC.sendCCResult(callId, result);
}
}
finish();
}, 1500);
}
@Override
public void onDismiss(DialogInterface dialog) {
finish();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (executor != null)
executor.closeSocket();
}
}
......@@ -105,6 +105,8 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
* 2:結賬單
* 3:廚房單
* 4:打印view
* 5:打印外賣接單
* 6:其他指令
*/
int type = CCUtil.getNavigateParam(this, PRINT_TYPE, -1);
boolean isShowDialog = CCUtil.getNavigateParam(this, PrintConstans.PRINT_LOADING, true);
......
......@@ -6,10 +6,11 @@ import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.Gravity;
import android.view.View;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.Switch;
import android.widget.TextView;
......@@ -24,6 +25,7 @@ import com.gingersoft.gsa.cloud.base.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils;
import com.gingersoft.gsa.cloud.base.widget.DialogUtils;
import com.gingersoft.gsa.cloud.constans.PrintConstans;
import com.gingersoft.gsa.cloud.database.bean.PrintModelBean;
import com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean;
import com.jess.arms.base.BaseActivity;
import com.jess.arms.di.component.AppComponent;
......@@ -35,8 +37,10 @@ import com.joe.print.mvp.contract.PrinterAddContract;
import com.joe.print.mvp.presenter.PrinterAddPresenter;
import com.joe.print.mvp.print.PrinterRoot;
import com.joe.print.mvp.ui.adapter.SelectPrintAdapter;
import com.joe.print.mvp.ui.view.WheelView;
import com.qmuiteam.qmui.widget.QMUITopBar;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
......@@ -60,20 +64,25 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
QMUITopBar topBar;
@BindView(R2.id.add_printer_ed_port)
EditText etPort;
@BindView(R2.id.printer_type)
RadioGroup rgPaperType;
@BindView(R2.id.switch_set_default)
Switch mSwitchDefalute;
@BindView(R2.id.tv_print_fail_one)
TextView mTvFailNameOne;
@BindView(R2.id.tv_print_fail_two)
TextView mTvFailNameTwo;
@BindView(R2.id.print_device_name)
TextView mTvModel;
private List<PrinterDeviceBean> devicess;
private PrinterDeviceBean printerDeviceBean;
private boolean isEditPrinter = false;//是否是編輯打印機
private int oneFailPosition = -1, twoFailPosition = -1;
private List<PrintModelBean> printModelBeans;
private List<String> printModelLabels;
private int modelPosition = -1;
@Override
public void setupActivityComponent(@NonNull AppComponent appComponent) {
......@@ -92,16 +101,20 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
@Override
public void initData(@Nullable Bundle savedInstanceState) {
String[] ips = new String[4];
//如果不為空,則是編輯打印機,初始化信息
if (printerDeviceBean != null) {
mEdPrintName.setText(String.valueOf(printerDeviceBean.getName()));
ips = printerDeviceBean.getIp().split("[.]");
etPort.setText(printerDeviceBean.getPort() + "");
if (printerDeviceBean.getType() == 1) {
rgPaperType.check(R.id.print_paper_size_58);
} else {
rgPaperType.check(R.id.print_paper_size_88);
if (printerDeviceBean.getPrinterName() != null) {
mTvModel.setTextColor(getResources().getColor(R.color.color_3c));
mTvModel.setText(printerDeviceBean.getPrinterName());
if (printerDeviceBean.getModel() != null) {
mTvModel.setText(printerDeviceBean.getPrinterName() + "\u3000" + printerDeviceBean.getModel());
}
}
mSwitchDefalute.setChecked(printerDeviceBean.getStatus() == 2);
if (devicess != null && devicess.size() > 0) {
......@@ -141,6 +154,8 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
public void initIntent() {
int position = getIntent().getIntExtra("printer_position", -1);
devicess = (List<PrinterDeviceBean>) getIntent().getSerializableExtra("printList");
printModelBeans = (List<PrintModelBean>) getIntent().getSerializableExtra("printModelList");
if (devicess != null && position != -1) {
printerDeviceBean = devicess.get(position);
if (printerDeviceBean != null) {
......@@ -148,6 +163,16 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
}
}
isEditPrinter = printerDeviceBean != null;
if (printModelBeans != null) {
printModelLabels = new ArrayList<>();
for (int i = 0; i < printModelBeans.size(); i++) {
printModelLabels.add(printModelBeans.get(i).getPrinterName() + "\u3000" + printModelBeans.get(i).getModel());
if (printerDeviceBean != null && printerDeviceBean.getPrinterModelId() == printModelBeans.get(i).getId()) {
modelPosition = i;
}
}
}
}
@Override
......@@ -205,7 +230,7 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
finish();
}
@OnClick({R2.id.printer_add, R2.id.layout_select_fail_one, R2.id.layout_select_fail_two})
@OnClick({R2.id.printer_add, R2.id.layout_select_fail_one, R2.id.layout_select_fail_two, R2.id.layout_print_device})
@Override
public void onClick(View v) {
int id = v.getId();
......@@ -217,6 +242,36 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
return;
}
selectFailPrint(id);
} else if (id == R.id.layout_print_device) {
if (printModelBeans == null || printModelBeans.size() <= 0) {
ToastUtils.show(mContext, "請先添加打印機機型");
return;
}
//選擇打印機機型
new DialogUtils(this, R.layout.dialog_select_print_device) {
@Override
public void initLayout(ViewHepler hepler, Dialog dialog) {
WheelView wheelView = hepler.getView(R.id.wv_model);
wheelView.setOffset(1);
if (modelPosition >= 0) {
wheelView.setSeletion(modelPosition);
}
wheelView.setItems(printModelLabels);
hepler.getView(R.id.btn_cancel).setOnClickListener(v -> dialog.dismiss());
hepler.getView(R.id.btn_confirm).setOnClickListener(v -> {
modelPosition = wheelView.getSeletedIndex();
mTvModel.setText(wheelView.getSeletedItem());
mTvModel.setTextColor(getResources().getColor(R.color.color_3c));
dialog.dismiss();
});
}
}
.setWidth(WindowManager.LayoutParams.MATCH_PARENT)
.createDialogView()
.setGravity(Gravity.BOTTOM)
.show();
}
}
......@@ -281,12 +336,13 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
ipAddress.append(editText.getText());
ipAddress.append(".");
}
hideKeyBoard();
int paperType = 1;//打印紙類型
if (rgPaperType.getCheckedRadioButtonId() != R.id.print_paper_size_58) {
paperType = 2;
}
// if (rgPaperType.getCheckedRadioButtonId() != R.id.print_paper_size_58) {
// paperType = 2;
// }
String port = etPort.getText().toString();
PrinterDeviceBean deviceBean;
......@@ -302,6 +358,18 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
deviceBean.setDefaultPrinterDeviceId((long) devicess.get(twoFailPosition).getId());
}
deviceBean.setStatus(mSwitchDefalute.isChecked() ? 2 : 1);
//打印機機型ID
if (modelPosition < 0) {
if (printerDeviceBean != null) {
deviceBean.setPrinterModelId(printerDeviceBean.getPrinterModelId());
deviceBean.setPaperSpecification(printerDeviceBean.getPaperSpecification());
}
} else {
if (printModelBeans != null && printModelBeans.size() > modelPosition) {
deviceBean.setPrinterModelId(printModelBeans.get(modelPosition).getId());
deviceBean.setPaperSpecification(printModelBeans.get(modelPosition).getPaperSpecification());
}
}
//添加打印機
if (v.getId() == R.id.printer_add) {
if (isEditPrinter && printerDeviceBean != null) {
......
package com.joe.print.mvp.ui.activity;
class aaa {
public static void main(String[] age) {
int[] arr = new int[]{4, 1, 8, 5, 3, 2, 9, 10, 6, 7};
int[] brr = new int[]{5, 1, 2, 3, 8, 4, 9, 10, 6, 7};
partition(arr, 0, 9);
for (int i = 0; i < arr.length; i++) {
System.out.print(arr[i] + ",");
}
}
public static void quickSort(int[] arr, int startIndex, int endIndex) {
if (arr != null && arr.length > 0) {
int start = startIndex, end = endIndex;
int target = arr[startIndex];
while (start < end) {
while (start < end) {
if (arr[end] < target) {
swap(arr, start, end);
break;
} else {
end--;
}
}
while (start < end) {
if (arr[start] > target) {
swap(arr, start, end);
break;
} else {
start++;
}
}
}
}
}
public static void swap(int[] arr, int index1, int index2) {
int a = arr[index1];
arr[index1] = arr[index2];
arr[index2] = a;
}
// public static int[] getLeastNumbers(int[] arr, int k) {
// if (k == 0 || arr.length == 0) {
// return new int[0];
// }
// // 最后一个参数表示我们要找的是下标为k-1的数
// return quickSearch(arr, 0, arr.length - 1, k - 1);
// }
//
// private static int[] quickSearch(int[] nums, int lo, int hi, int k) {
// // 每快排切分1次,找到排序后下标为j的元素,如果j恰好等于k就返回j以及j左边所有的数;
// int j = partition(nums, lo, hi);
// if (j == k) {
// return Arrays.copyOf(nums, j + 1);
// }
// // 否则根据下标j与k的大小关系来决定继续切分左段还是右段。
// return j > k ? quickSearch(nums, lo, j - 1, k) : quickSearch(nums, j + 1, hi, k);
// }
//
// // 快排切分,返回下标j,使得比nums[j]小的数都在j的左边,比nums[j]大的数都在j的右边。
private static void partition(int[] nums, int lo, int hi) {
int k = nums[lo];
int i = lo, j = hi + 1;
while (true) {
while (++i <= hi && nums[i] < k);
while (--j >= lo && nums[j] > k);
if (i >= j) {
break;
}
// int t = nums[j];最近更新
// nums[j] = nums[i];
// nums[i] = t;
swap(nums, i, j);
}
nums[lo] = nums[j];
nums[j] = k;
swap(nums, i, j);
}
}
\ No newline at end of file
package com.joe.print.mvp.ui.adapter;
import androidx.annotation.Nullable;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.joe.print.R;
import com.gingersoft.gsa.cloud.database.bean.PrintModelBean;
import java.util.List;
public class PrintModelAdapter extends BaseQuickAdapter<PrintModelBean, BaseViewHolder> {
public PrintModelAdapter(@Nullable List<PrintModelBean> data) {
super(R.layout.item_dialog_select_print_model, data);
}
@Override
protected void convert(BaseViewHolder helper, PrintModelBean item) {
helper.setText(R.id.tv_item_print_model_name, item.getPrinterName() + "\u3000" + item.getModel());
}
}
......@@ -31,6 +31,7 @@ import com.joe.print.mvp.contract.IpPrintListActivityContract;
import com.joe.print.mvp.presenter.IpPrintListActivityPresenter;
import com.joe.print.mvp.ui.activity.PrinterAddActivity;
import com.joe.print.mvp.ui.adapter.PrinterListAdapter;
import com.qmuiteam.qmui.alpha.QMUIAlphaButton;
import com.yanzhenjie.recyclerview.SwipeMenuCreator;
import com.yanzhenjie.recyclerview.SwipeRecyclerView;
import com.yanzhenjie.recyclerview.touch.OnItemMoveListener;
......@@ -51,8 +52,8 @@ public class IpPrintListActivityFragment extends BaseFragment<IpPrintListActivit
@BindView(R2.id.rc_ip_print)
SwipeRecyclerView mRvPrintList;
private PrinterListAdapter printListAdapter;
@BindView(R2.id.tv_add_print)
TextView mTvAddPrint;
@BindView(R2.id.btn_default)
QMUIAlphaButton mTvAddPrint;
public static IpPrintListActivityFragment newInstance() {
IpPrintListActivityFragment fragment = new IpPrintListActivityFragment();
......@@ -76,7 +77,8 @@ public class IpPrintListActivityFragment extends BaseFragment<IpPrintListActivit
@Override
public void initData(@Nullable Bundle savedInstanceState) {
mTvAddPrint.setText("+添加打印機");
mPresenter.getModelList(GsaCloudApplication.getRestaurantId(mContext));
}
@Override
......@@ -85,6 +87,12 @@ public class IpPrintListActivityFragment extends BaseFragment<IpPrintListActivit
mPresenter.getPrinterList(GsaCloudApplication.getRestaurantId(mContext));
}
@Override
public void onStart() {
super.onStart();
}
/**
* 通过此方法可以使 Fragment 能够与外界做一些交互和通信, 比如说外部的 Activity 想让自己持有的某个 Fragment 对象执行一些方法,
* 建议在有多个需要与外界交互的方法时, 统一传 {@link Message}, 通过 what 字段来区分不同的方法, 在 {#setData(Object)}
......@@ -262,7 +270,7 @@ public class IpPrintListActivityFragment extends BaseFragment<IpPrintListActivit
});// 监听拖拽和侧滑删除,更新UI和数据源。
printListAdapter = new PrinterListAdapter(devicess, mContext);
printListAdapter.setOnItemChildClickListener((adapter, view, position) -> AppDialog.showWaringDialog(mContext, "是否刪除打印機", (view1, dialog) -> {
printListAdapter.setOnItemChildClickListener((adapter, view, position) -> new AppDialog().showWaringDialog(mContext, "是否刪除打印機", (view1, dialog) -> {
//調用刪除接口
mPresenter.deletePrinter(devicess.get(position).getId() + "");
devicess.remove(position);
......@@ -289,6 +297,9 @@ public class IpPrintListActivityFragment extends BaseFragment<IpPrintListActivit
Intent intent = new Intent(mContext, PrinterAddActivity.class);
intent.putExtra("printer_position", adapterPosition);
intent.putExtra("printList", (Serializable) devicess);
if(mPresenter.getPrintModelBeans() != null){
intent.putExtra("printModelList", (Serializable) mPresenter.getPrintModelBeans());
}
startActivity(intent);
}
......@@ -298,10 +309,10 @@ public class IpPrintListActivityFragment extends BaseFragment<IpPrintListActivit
mTvAddPrint.setVisibility(View.VISIBLE);
}
@OnClick(R2.id.tv_add_print)
@OnClick(R2.id.btn_default)
@Override
public void onClick(View v) {
if (v.getId() == R.id.tv_add_print) {
if (v.getId() == R.id.btn_default) {
startToEditPrint(-1);
}
}
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="@dimen/dp_10"
android:text="打印機型號"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_16" />
<com.joe.print.mvp.ui.view.WheelView
android:id="@+id/wv_model"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="@dimen/dp_20"
android:paddingTop="@dimen/dp_10"
android:paddingRight="@dimen/dp_20"
android:paddingBottom="@dimen/dp_10">
<Button
android:id="@+id/btn_cancel"
android:layout_width="0dp"
android:layout_height="@dimen/dp_40"
android:layout_weight="1"
android:background="@drawable/shape_black_border"
android:text="取消"
android:textColor="@color/theme_333_color" />
<Button
android:id="@+id/btn_confirm"
android:layout_width="0dp"
android:layout_height="@dimen/dp_40"
android:layout_marginLeft="@dimen/dp_10"
android:layout_weight="1"
android:background="@color/theme_color"
android:text="確定"
android:textColor="@color/white" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
......@@ -10,12 +10,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent" />
<TextView
android:id="@+id/tv_add_print"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape_border_bg"
android:text="添加打印機"
android:padding="@dimen/dp_10"
android:textColor="@color/theme_color" />
<include layout="@layout/layout_default" />
</LinearLayout>
\ No newline at end of file
......@@ -190,44 +190,43 @@
<include layout="@layout/include_horizontal_color_ccc_dividing_line" />
<LinearLayout
<RelativeLayout
android:id="@+id/layout_print_device"
style="@style/print_add_printer_input_style"
android:layout_width="match_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_device_model_text"
style="@style/print_add_title_textStyle"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:text="紙張規格" />
android:layout_centerVertical="true"
android:text="打印機型號" />
<RadioGroup
android:id="@+id/printer_type"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:checkedButton="@id/print_paper_size_58"
android:orientation="horizontal">
<RadioButton
android:id="@+id/print_paper_size_58"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="58mm"
android:textColor="@color/normal_color"
android:textSize="@dimen/dp_14" />
<ImageView
android:id="@+id/iv_device_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_black_next_arrow" />
<RadioButton
android:id="@+id/print_paper_size_88"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:text="80mm"
android:textColor="@color/normal_color"
android:textSize="@dimen/dp_14" />
</RadioGroup>
</LinearLayout>
<TextView
android:id="@+id/print_device_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/dp_7"
android:layout_marginRight="@dimen/dp_7"
android:layout_toLeftOf="@id/iv_device_arrow"
android:layout_toRightOf="@id/tv_device_model_text"
android:gravity="right"
android:text="請選擇"
android:textColor="@color/color_c9"
android:textSize="@dimen/dp_16" />
</RelativeLayout>
<include layout="@layout/include_horizontal_color_ccc_dividing_line" />
......@@ -256,7 +255,7 @@
<include layout="@layout/include_horizontal_color_ccc_dividing_line" />
<LinearLayout
<RelativeLayout
android:id="@+id/layout_select_fail_one"
style="@style/print_add_printer_input_style"
android:layout_width="match_parent"
......@@ -264,32 +263,43 @@
android:orientation="horizontal">
<TextView
android:id="@+id/tv_fail_one_text"
style="@style/print_add_title_textStyle"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_weight="1"
android:text="打印失敗由此打印" />
<ImageView
android:id="@+id/iv_fail_one_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_black_next_arrow" />
<TextView
android:id="@+id/tv_print_fail_one"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/dp_7"
android:layout_marginRight="@dimen/dp_7"
android:layout_toLeftOf="@id/iv_fail_one_arrow"
android:layout_toRightOf="@id/tv_fail_one_text"
android:gravity="right"
android:text="請選擇"
android:textColor="@color/color_c9"
android:textSize="@dimen/dp_16"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_black_next_arrow" />
</LinearLayout>
</RelativeLayout>
<include layout="@layout/include_horizontal_color_ccc_dividing_line" />
<LinearLayout
<RelativeLayout
android:id="@+id/layout_select_fail_two"
style="@style/print_add_printer_input_style"
android:layout_width="match_parent"
......@@ -297,28 +307,39 @@
android:orientation="horizontal">
<TextView
android:id="@+id/tv_fail_two_text"
style="@style/print_add_title_textStyle"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_centerVertical="true"
android:text="打印失敗由此打印" />
<ImageView
android:id="@+id/iv_fail_two_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_black_next_arrow" />
<TextView
android:id="@+id/tv_print_fail_two"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/dp_7"
android:layout_marginRight="@dimen/dp_7"
android:layout_toLeftOf="@id/iv_fail_two_arrow"
android:layout_toRightOf="@id/tv_fail_two_text"
android:gravity="right"
android:text="請選擇"
android:textColor="@color/color_c9"
android:textSize="@dimen/dp_16"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_black_next_arrow" />
</LinearLayout>
</RelativeLayout>
<include layout="@layout/include_horizontal_color_ccc_dividing_line" />
......@@ -327,7 +348,7 @@
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id="@+id/printer_add"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
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