Commit 42e42857 by 宁斌

1、新增版本配置

2、版本更新處理
parent f598e606
......@@ -159,6 +159,8 @@ public class GsaCloudApplication extends BaseApplication {
RetrofitUrlManager.getInstance().putDomain("wechat_report", HttpsConstans.WECHAR_REPORT_SERVER_ADDRESS);
//沽清控制請求地址
RetrofitUrlManager.getInstance().putDomain("soldoutctrl", HttpsConstans._SERVER_ADDRESS);
//版本更新請求地址
RetrofitUrlManager.getInstance().putDomain("update_version", HttpsConstans.ROOT_URL);
//友常本地請求地址
RetrofitUrlManager.getInstance().putDomain("yc_location", HttpsConstans.ROOT_SERVER_YOU_CHANG_HK);
}
......
package com.gingersoft.gsa.cloud.database.bean;
import android.graphics.Color;
import android.text.TextUtils;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
......@@ -147,9 +148,9 @@ public class ComboItem {
@Generated(hash = 1123579083)
public ComboItem(Long id, long comId, long fid, long qty, double diffAmt, long seqNo,
long visible, Date createTime, String createBy, Date updateTime, long conditions,
long isRT, byte deletes, long posId, long restaurant_id, byte isMainAccount) {
public ComboItem(Long id, long comId, long fid, long qty, double diffAmt, long seqNo, long visible, Date createTime,
String createBy, Date updateTime, long conditions, long isRT, byte deletes, long posId, long restaurant_id,
byte isMainAccount) {
this.id = id;
this.comId = comId;
this.fid = fid;
......@@ -173,6 +174,13 @@ public class ComboItem {
}
public boolean isSold() {
if(!TextUtils.isEmpty(currentMaxNumber) && ("售罄".equals(currentMaxNumber) || "暫停".equals(currentMaxNumber))){
return true;
}
return false;
}
public Long getId() {
return id;
}
......@@ -209,6 +217,7 @@ public class ComboItem {
this.currentMaxNumber = currentMaxNumber;
}
public Long getQty() {
return qty;
}
......
......@@ -28,14 +28,28 @@ public class Function {
private int parentId;
private int groupId;
private int status;
private long effectiveTime;
private String resName;
private String resUrl;
private String imageURL;
//暫時沒有imageURL,用本地資源代替
private int icRes;
/**狀態
* 0 未开通
* 1 正常
* 2 有時間限制
* 3 關閉
* */
private int status;
@Transient
public static final int STATUS_NONACTIVATED = 0;
@Transient
public static final int STATUS_NONAL = 1;
@Transient
public static final int STATUS_TIME_LIMIT = 2;
@Transient
public static final int STATUS_CLOSE = 3;
/**
* 自定義字段
*/
......@@ -60,19 +74,19 @@ public class Function {
@Transient
private String lable;
@Generated(hash = 816556116)
public Function(Long dbid, @NotNull Long id, int parentId, int groupId, int status,
long effectiveTime, String resName, String resUrl, String imageURL, int icRes) {
@Generated(hash = 756881616)
public Function(Long dbid, @NotNull Long id, int parentId, int groupId, long effectiveTime,
String resName, String resUrl, String imageURL, int icRes, int status) {
this.dbid = dbid;
this.id = id;
this.parentId = parentId;
this.groupId = groupId;
this.status = status;
this.effectiveTime = effectiveTime;
this.resName = resName;
this.resUrl = resUrl;
this.imageURL = imageURL;
this.icRes = icRes;
this.status = status;
}
@Generated(hash = 133141990)
......
package com.gingersoft.gsa.cloud.database.bean;
import android.graphics.Color;
import android.text.TextUtils;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
......@@ -422,25 +423,15 @@ public class Modifier {
@Generated(hash = 385685553)
public Modifier() {
}
@Generated(hash = 1490458360)
public Modifier(Long dbid, long mid, long topId, long restaurantId,
String modifierName, long seqNo, double marketPrice, double price,
double lunchboxPrice, long colorId, String imageUrl, long invisible,
double cost, Date startDate, Date endDate, long like, long totalSold,
long majorMainId, long deptId, String createBy, Date createTime,
String updateBy, Date updateTime, String posFid, String pId,
long autoMod, long blueEdit, long autoMerge, long customMsg,
long isParent, String modifierName1, String modifierName2,
double multiple, String printSet, String ktSetting, long modComm,
long modTaste, long modMsg, long ktFireCourse, long ableDisCount,
long printToBill, long ktPrintMainItem, long ktShowPrice, long ktFont,
long conditions, long isRt, byte visible, long deletes,
long isStatistic) {
public Modifier(Long dbid, long mid, long topId, long restaurantId, String modifierName, long seqNo, double marketPrice,
double price, double lunchboxPrice, long colorId, String imageUrl, long invisible, double cost, Date startDate,
Date endDate, long like, long totalSold, long majorMainId, long deptId, String createBy, Date createTime,
String updateBy, Date updateTime, String posFid, String pId, long autoMod, long blueEdit, long autoMerge,
long customMsg, long isParent, String modifierName1, String modifierName2, double multiple, String printSet,
String ktSetting, long modComm, long modTaste, long modMsg, long ktFireCourse, long ableDisCount,
long printToBill, long ktPrintMainItem, long ktShowPrice, long ktFont, long conditions, long isRt, byte visible,
long deletes, long isStatistic) {
this.dbid = dbid;
this.mid = mid;
this.topId = topId;
......@@ -492,6 +483,11 @@ public class Modifier {
this.isStatistic = isStatistic;
}
@Generated(hash = 385685553)
public Modifier() {
}
public Long getDbid() {
return dbid;
......@@ -501,6 +497,13 @@ public class Modifier {
return mid;
}
public boolean isSold() {
if(!TextUtils.isEmpty(currentMaxNumber) && ("售罄".equals(currentMaxNumber) || "暫停".equals(currentMaxNumber))){
return true;
}
return false;
}
public Long getTopId() {
return topId;
}
......
......@@ -28,12 +28,12 @@ public class FunctionDao extends AbstractDao<Function, Long> {
public final static Property Id = new Property(1, Long.class, "id", false, "ID");
public final static Property ParentId = new Property(2, int.class, "parentId", false, "PARENT_ID");
public final static Property GroupId = new Property(3, int.class, "groupId", false, "GROUP_ID");
public final static Property Status = new Property(4, int.class, "status", false, "STATUS");
public final static Property EffectiveTime = new Property(5, long.class, "effectiveTime", false, "EFFECTIVE_TIME");
public final static Property ResName = new Property(6, String.class, "resName", false, "RES_NAME");
public final static Property ResUrl = new Property(7, String.class, "resUrl", false, "RES_URL");
public final static Property ImageURL = new Property(8, String.class, "imageURL", false, "IMAGE_URL");
public final static Property IcRes = new Property(9, int.class, "icRes", false, "IC_RES");
public final static Property EffectiveTime = new Property(4, long.class, "effectiveTime", false, "EFFECTIVE_TIME");
public final static Property ResName = new Property(5, String.class, "resName", false, "RES_NAME");
public final static Property ResUrl = new Property(6, String.class, "resUrl", false, "RES_URL");
public final static Property ImageURL = new Property(7, String.class, "imageURL", false, "IMAGE_URL");
public final static Property IcRes = new Property(8, int.class, "icRes", false, "IC_RES");
public final static Property Status = new Property(9, int.class, "status", false, "STATUS");
}
......@@ -53,12 +53,12 @@ public class FunctionDao extends AbstractDao<Function, Long> {
"\"ID\" INTEGER NOT NULL ," + // 1: id
"\"PARENT_ID\" INTEGER NOT NULL ," + // 2: parentId
"\"GROUP_ID\" INTEGER NOT NULL ," + // 3: groupId
"\"STATUS\" INTEGER NOT NULL ," + // 4: status
"\"EFFECTIVE_TIME\" INTEGER NOT NULL ," + // 5: effectiveTime
"\"RES_NAME\" TEXT," + // 6: resName
"\"RES_URL\" TEXT," + // 7: resUrl
"\"IMAGE_URL\" TEXT," + // 8: imageURL
"\"IC_RES\" INTEGER NOT NULL );"); // 9: icRes
"\"EFFECTIVE_TIME\" INTEGER NOT NULL ," + // 4: effectiveTime
"\"RES_NAME\" TEXT," + // 5: resName
"\"RES_URL\" TEXT," + // 6: resUrl
"\"IMAGE_URL\" TEXT," + // 7: imageURL
"\"IC_RES\" INTEGER NOT NULL ," + // 8: icRes
"\"STATUS\" INTEGER NOT NULL );"); // 9: status
}
/** Drops the underlying database table. */
......@@ -78,24 +78,24 @@ public class FunctionDao extends AbstractDao<Function, Long> {
stmt.bindLong(2, entity.getId());
stmt.bindLong(3, entity.getParentId());
stmt.bindLong(4, entity.getGroupId());
stmt.bindLong(5, entity.getStatus());
stmt.bindLong(6, entity.getEffectiveTime());
stmt.bindLong(5, entity.getEffectiveTime());
String resName = entity.getResName();
if (resName != null) {
stmt.bindString(7, resName);
stmt.bindString(6, resName);
}
String resUrl = entity.getResUrl();
if (resUrl != null) {
stmt.bindString(8, resUrl);
stmt.bindString(7, resUrl);
}
String imageURL = entity.getImageURL();
if (imageURL != null) {
stmt.bindString(9, imageURL);
stmt.bindString(8, imageURL);
}
stmt.bindLong(10, entity.getIcRes());
stmt.bindLong(9, entity.getIcRes());
stmt.bindLong(10, entity.getStatus());
}
@Override
......@@ -109,24 +109,24 @@ public class FunctionDao extends AbstractDao<Function, Long> {
stmt.bindLong(2, entity.getId());
stmt.bindLong(3, entity.getParentId());
stmt.bindLong(4, entity.getGroupId());
stmt.bindLong(5, entity.getStatus());
stmt.bindLong(6, entity.getEffectiveTime());
stmt.bindLong(5, entity.getEffectiveTime());
String resName = entity.getResName();
if (resName != null) {
stmt.bindString(7, resName);
stmt.bindString(6, resName);
}
String resUrl = entity.getResUrl();
if (resUrl != null) {
stmt.bindString(8, resUrl);
stmt.bindString(7, resUrl);
}
String imageURL = entity.getImageURL();
if (imageURL != null) {
stmt.bindString(9, imageURL);
stmt.bindString(8, imageURL);
}
stmt.bindLong(10, entity.getIcRes());
stmt.bindLong(9, entity.getIcRes());
stmt.bindLong(10, entity.getStatus());
}
@Override
......@@ -141,12 +141,12 @@ public class FunctionDao extends AbstractDao<Function, Long> {
cursor.getLong(offset + 1), // id
cursor.getInt(offset + 2), // parentId
cursor.getInt(offset + 3), // groupId
cursor.getInt(offset + 4), // status
cursor.getLong(offset + 5), // effectiveTime
cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // resName
cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // resUrl
cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // imageURL
cursor.getInt(offset + 9) // icRes
cursor.getLong(offset + 4), // effectiveTime
cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // resName
cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // resUrl
cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // imageURL
cursor.getInt(offset + 8), // icRes
cursor.getInt(offset + 9) // status
);
return entity;
}
......@@ -157,12 +157,12 @@ public class FunctionDao extends AbstractDao<Function, Long> {
entity.setId(cursor.getLong(offset + 1));
entity.setParentId(cursor.getInt(offset + 2));
entity.setGroupId(cursor.getInt(offset + 3));
entity.setStatus(cursor.getInt(offset + 4));
entity.setEffectiveTime(cursor.getLong(offset + 5));
entity.setResName(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
entity.setResUrl(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
entity.setImageURL(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
entity.setIcRes(cursor.getInt(offset + 9));
entity.setEffectiveTime(cursor.getLong(offset + 4));
entity.setResName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
entity.setResUrl(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
entity.setImageURL(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
entity.setIcRes(cursor.getInt(offset + 8));
entity.setStatus(cursor.getInt(offset + 9));
}
@Override
......
......@@ -45,11 +45,25 @@ public class FunctionManager {
if (function.getResUrl().startsWith(resLoction)) {
for (int j = 0; j < fModules.length; j++) {
FModule module = fModules[j];
if(function.getResUrl().equals(module.getKeyRes())){
if (function.getStatus() == 0) {
function.setIconRes(module.getOpenIconRes());
} else {
function.setIconRes(module.getDisableIconRes());
if (function.getResUrl().equals(module.getKeyRes())) {
switch (function.getStatus()) {
case Function.STATUS_NONAL:
function.setIcRes(module.getOpenIconRes());
break;
case Function.STATUS_TIME_LIMIT:
long currentTime = System.currentTimeMillis();
long effectiveTime = function.getEffectiveTime();
if (effectiveTime > currentTime) {
//在有效期内
function.setStatus(Function.STATUS_NONAL);
function.setIcRes(module.getOpenIconRes());
} else {
function.setIcRes(module.getDisableIconRes());
}
break;
default:
function.setIcRes(module.getDisableIconRes());
break;
}
}
}
......
......@@ -6,7 +6,7 @@ ext {
minSdkVersion : 19, //N5收銀機應用安卓開發環境要求Android OS Version: 5.1Android SDK Min Version: 19
targetSdkVersion : 28,
versionCode : 1,
versionName : "1.8"
versionName : "1.0.1"
]
version = [
......
......@@ -99,6 +99,10 @@ public class DownloadPresenter extends BasePresenter<DownloadContract.Model, Dow
HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL + Api.expand_info,
HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL + Api.printerDevice_list};
// private String[] downTitles = {"打印機列表"};
// //下載所佔比例
// private int[] ratios = {100};
// private String urlList[] = {HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL + Api.printerDevice_list};
//当前请求响应成功数
private int responseSuccessCount;
......@@ -269,7 +273,7 @@ public class DownloadPresenter extends BasePresenter<DownloadContract.Model, Dow
public void downFun(int downTag) {
List<Function> functions = getFunctions();
// List<Function> functions = getFunctions();
long userId = GsaCloudApplication.getMemberId(mApplication);
......@@ -293,7 +297,7 @@ public class DownloadPresenter extends BasePresenter<DownloadContract.Model, Dow
if (functionBean.getData() != null) {
FunctionDaoUtils functionDao = new FunctionDaoUtils(IActivity);
functionDao.deleteAll();
functionDao.insertMultFunction(functions);
functionDao.insertMultFunction(functionBean.getData());
}
DataDownLoadState loadState = mList.get(downTag);
......
......@@ -310,7 +310,7 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements
//保存登陸信息
// saveLoginInfo(loginBean);
}
//158 - 189
@Override
public void showChooseRestaurantDialog(List<LoginBean.DataBean.UserBean.BrandsBean> brandsBeans, List<LoginBean.DataBean.UserBean.BrandsBean> brands) {
new ChooseRestaurantDialog.BottomListSheetBuilder(mContext)
......
......@@ -30,14 +30,18 @@
android:layout_marginTop="@dimen/dp_60"
android:src="@mipmap/png_welcome_center" />
<ImageView
<TextView
android:id="@+id/iv_welcome_logo"
android:layout_width="@dimen/dp_56"
android:layout_height="@dimen/dp_56"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/iv_welcome_center"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/dp_16"
android:src="@mipmap/ic_launcher" />
android:layout_marginTop="@dimen/dp_30"
android:drawableTop="@mipmap/ic_launcher"
android:text="Ricepon POS"
android:textSize="@dimen/sp_16"
android:textColor="@color/theme_color"
android:textStyle="bold"/>
<ImageView
android:id="@+id/iv_welcome_bottom"
......
......@@ -12,7 +12,7 @@ import com.gingersoft.gsa.cloud.main.mvp.ui.activity.NewMainActivity;
public class ComponentMain implements IComponent {
public static final class Function{
public static final class main{
/**首頁- 點餐*/
public static final FModule[] order = {
new FModule("main/order", 0,0) ,
......
......@@ -5,6 +5,10 @@ import android.widget.BaseAdapter;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
import io.reactivex.Observable;
import okhttp3.RequestBody;
import retrofit2.http.Body;
/**
* ================================================
......@@ -24,8 +28,10 @@ public interface MainContract {
void setFunctionAdapter(BaseAdapter adapter);
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel{
interface Model extends IModel {
}
}
......@@ -30,6 +30,9 @@ public interface NewMainContract {
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
Observable<Object> checkAppVersion(RequestBody requestBody);
Observable<Object> loginOut(RequestBody requestBody);
}
}
......@@ -2,12 +2,16 @@ package com.gingersoft.gsa.cloud.main.mvp.model;
import android.app.Application;
import com.gingersoft.gsa.cloud.main.mvp.contract.MainContract;
import com.gingersoft.gsa.cloud.main.mvp.model.service.MainReportService;
import com.gingersoft.gsa.cloud.main.mvp.model.service.MainService;
import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import com.jess.arms.di.scope.ActivityScope;
import javax.inject.Inject;
import io.reactivex.Observable;
import okhttp3.RequestBody;
/**
......@@ -40,4 +44,5 @@ public class MainModel extends BaseModel implements MainContract.Model{
this.mGson = null;
this.mApplication = null;
}
}
\ No newline at end of file
......@@ -50,6 +50,12 @@ public class NewMainModel extends BaseModel implements NewMainContract.Model {
}
@Override
public Observable<Object> checkAppVersion(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(MainService.class)
.checkAppVersion(requestBody);
}
@Override
public Observable<Object> loginOut(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(MainService.class)
.loginOut(requestBody);
......
......@@ -130,6 +130,7 @@ public class SettlementReport {
* tipnum : 0
* tipsPrice : 0
* totamount : 256
* deliverycharge : 0
* num : 2
* person : 7
*/
......@@ -142,9 +143,18 @@ public class SettlementReport {
private int tipnum;
private double tipsPrice;
private double totamount;
private double deliverycharge;
private int num;
private int person;
public double getDeliverycharge() {
return deliverycharge;
}
public void setDeliverycharge(double deliverycharge) {
this.deliverycharge = deliverycharge;
}
public double getPrices() {
return prices;
}
......
......@@ -23,6 +23,7 @@ import retrofit2.http.QueryMap;
* 首頁和報表
*/
public interface MainReportService {
//支付分析報表
@Headers({"Domain-Name: wechat_report"})
@POST("wx/findPayMode" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
......
......@@ -4,6 +4,7 @@ import io.reactivex.Observable;
import me.jessyan.retrofiturlmanager.RetrofitUrlManager;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.Headers;
import retrofit2.http.POST;
/**
......@@ -13,4 +14,8 @@ public interface MainService {
@POST("gsa/logout" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<Object> loginOut(@Body RequestBody requestBody);
@Headers({"Domain-Name: update_version"})
@POST("/member-web/api/system/checkAppVersion" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<Object> checkAppVersion(@Body RequestBody requestBody);
}
package com.gingersoft.gsa.cloud.main.mvp.presenter;
import android.app.Application;
import android.text.TextUtils;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.utils.LanguageUtils;
......@@ -11,6 +12,7 @@ import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.ArmsUtils;
import com.jess.arms.utils.DeviceUtils;
import com.jess.arms.utils.PermissionUtil;
import com.jess.arms.utils.RxLifecycleUtils;
......@@ -64,7 +66,38 @@ public class NewMainPresenter extends BasePresenter<NewMainContract.Model, NewMa
this.mApplication = null;
}
public void loginOut(){
public void checkAppVersion() {
RequestBody requestBody = new FormBody.Builder()
.add("version", DeviceUtils.getVersionName(mApplication) + "|" + DeviceUtils.getVersionCode(mApplication))
.build();
mModel.checkAppVersion(requestBody)
.subscribeOn(Schedulers.io())
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<Object>(mErrorHandler) {
@Override
public void onNext(@NonNull Object info) {
if (info != null ) {
// int operate = json.optInt("operate");//操作类型:1、不提示更新 2、提示更新可选择更新 3、强行更新
// if (operate == 2 || operate == 3 || operate == 4 || operate == 5) {
// String updatePath = json.optString("updatePath");
// if (!TextUtils.isEmpty("updatePath") && !updatePath.equals("null")) {
// updateAPK(operate, updatePath);
// } else {
// if (operate == 3) {
// ExitAPP();
// }
// }
// }
} else {
}
}
});
}
public void loginOut() {
RequestBody requestBody = new FormBody.Builder()
.build();
mModel.loginOut(requestBody)
......
......@@ -61,10 +61,10 @@ public class SettlementReportPresenter extends BasePresenter<SettlementReportCon
private SettlementReportActivity IActivity;
private SettlementReportItemAdapter mSettlementReportItemAdapter;
private List<SectionTextItem3> mSettlementReportItemList= new ArrayList<>();
private List<SectionTextItem3> mSettlementReportItemList = new ArrayList<>();
private SettlementReportItem5Adapter mSettlementReportItem5Adapter;
private List<SectionTextItem5> mSettlementReportItem5List= new ArrayList<>();
private List<SectionTextItem5> mSettlementReportItem5List = new ArrayList<>();
public SettlementReportItem5Adapter mPrintAdapter;
......@@ -92,7 +92,7 @@ public class SettlementReportPresenter extends BasePresenter<SettlementReportCon
mSettlementReportItem5Adapter = new SettlementReportItem5Adapter(IActivity, mSettlementReportItem5List);
mRootView.setSettlementReportItem5Adapter(mSettlementReportItem5Adapter);
}
if(mPrintAdapter == null){
if (mPrintAdapter == null) {
mPrintAdapter = new SettlementReportItem5Adapter(IActivity, mSettlementReportItem5List, 24);
}
}
......@@ -142,15 +142,15 @@ public class SettlementReportPresenter extends BasePresenter<SettlementReportCon
//打印清機報表
mRootView.printRepore();
}
} else if(info.getErrCode().equals("restaurant.operation.0003")){
} else if (info.getErrCode().equals("restaurant.operation.0003")) {
Class[] parameterTypes = {};
Object[] parameters = {};
CommonTipDialog.showDoubtDialog(IActivity,"今天已清機過,是否繼續清機", SettlementReportPresenter.class, SettlementReportPresenter.this,
CommonTipDialog.showDoubtDialog(IActivity, "今天已清機過,是否繼續清機", SettlementReportPresenter.class, SettlementReportPresenter.this,
"sendSettlement", parameterTypes, parameters);
}else if(info.getErrCode().equals("restaurant.operation.0004")){
} else if (info.getErrCode().equals("restaurant.operation.0004")) {
Class[] parameterTypes = {};
Object[] parameters = {};
CommonTipDialog.showDoubtDialog(IActivity,"仍有外送訂單未結賬,請先結賬!", SettlementReportPresenter.class, SettlementReportPresenter.this,
CommonTipDialog.showDoubtDialog(IActivity, "仍有外送訂單未結賬,請先結賬!", SettlementReportPresenter.class, SettlementReportPresenter.this,
"", parameterTypes, parameters);
} else {
mRootView.showMessage("清機失敗");
......@@ -170,6 +170,15 @@ public class SettlementReportPresenter extends BasePresenter<SettlementReportCon
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<SettlementReport>(mErrorHandler) {
//{"success":false,"errCode":"data_002","errMsg":"沒有查詢到數據","sysTime":1583573772290}
@Override
public void onSubscribe(Disposable d) {
super.onSubscribe(d);
}
@Override
public void onError(Throwable t) {
super.onError(t);
}
@Override
public void onNext(@NonNull SettlementReport info) {
......
......@@ -12,6 +12,8 @@ import android.text.TextUtils;
import android.util.SparseArray;
import android.view.KeyEvent;
import android.view.View;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;
import androidx.annotation.NonNull;
......@@ -49,6 +51,7 @@ import com.jess.arms.base.BaseActivity;
import com.jess.arms.base.BaseFragmentActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import com.jess.arms.utils.DeviceUtils;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.tbruyelle.rxpermissions2.RxPermissions;
......@@ -59,6 +62,8 @@ import butterknife.BindView;
import butterknife.BindViews;
import butterknife.OnClick;
import static com.gingersoft.gsa.cloud.database.bean.Function.STATUS_NONACTIVATED;
import static com.gingersoft.gsa.cloud.database.bean.Function.STATUS_TIME_LIMIT;
import static com.jess.arms.utils.Preconditions.checkNotNull;
......@@ -99,6 +104,8 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
TextView tvUserName;
@BindView(R2.id.tv_store_name)
TextView tvStoreName;
@BindView(R2.id.tv_version_name)
TextView tv_version_name;
@BindView(R2.id.qm_refresh)
SmartRefreshLayout refresh;
......@@ -126,6 +133,12 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
}
@Override
protected void onResume() {
super.onResume();
// mPresenter.checkAppVersion();
}
@Override
public int initView(@Nullable Bundle savedInstanceState) {
return R.layout.activity_new_main; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
}
......@@ -139,6 +152,7 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
FragmentManager fragmentManager = getSupportFragmentManager();
mainTopFragment = (MainTopFragment) fragmentManager.findFragmentById(R.id.main_top_fragment);
tv_version_name.setText("v_" + DeviceUtils.getVersionName(this));
tvStoreName.setText(GsaCloudApplication.getRestaurantName(mContext));
refresh.setOnRefreshListener(refreshLayout -> {
if (mainTopFragment != null) {
......@@ -149,7 +163,7 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
});
refresh.setEnableLoadMore(false);
initFuncationData();
setTitleInfo();
updateTitleInfo();
//側滑顯示或關閉時,修改背景圓角
GradientDrawable drawable = new GradientDrawable();
......@@ -169,7 +183,7 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
*/
private void initSideMenu() {
mRvSideMenu.setLayoutManager(new LinearLayoutManager(mContext));
List<MainSideMenuBean> mainSideMenuBeans = new ArrayList<>();;
List<MainSideMenuBean> mainSideMenuBeans = new ArrayList<>();
if (BuildConfig.DEBUG) {
mainSideMenuBeans.add(new MainSideMenuBean(R.drawable.ic_setting, "複製Token"));
......@@ -225,29 +239,35 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
// return;
// }
List<Function> functions = new ArrayList<>();
// functions.addAll(FunctionManager.getDefault().getFunctionByResModule(this, ComponentMain.Function.class, ComponentMain.Function.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));
functions.add(new Function((long) 139, 150, 5, "外送模式", R.drawable.ic_delivery_mode_close, 0));
functions.add(new Function((long) 140, 150, 5, "外賣模式", R.drawable.ic_outsourcing_model_close, 0));
functions.add(new Function((long) 141, 150, 5, "預點餐模式", R.drawable.ic_pre_order_mode_close, 1));
// functions.addAll(FunctionManager.getDefault().getFunctionByResModule(this, ComponentMain.Function.class, ComponentMain.Function.manager,"manager"));
functions.add(new Function((long) 151, 0, 5, "管理", 0, 0));
// functions.add(new Function((long) 142, 151, 5, "賬單管理", R.drawable.ic_meals_menu_management, 0));
functions.add(new Function((long) 142, 151, 5, "外賣接單", R.drawable.ic_takeaway_orders, 0));
// functions.add(new Function((long) 143, 151, 5, "餐臺管理", R.drawable.ic_dining_table_management, 0));
functions.add(new Function((long) 144, 151, 5, "打印管理", R.drawable.ic_print_management, 0));
// functions.add(new Function((long) 145, 151, 5, "支付管理", R.drawable.ic_pay_management_close, 1));
// functions.add(new Function((long) 146, 151, 5, "折扣管理", R.drawable.ic_discount_management_close, 1));
// functions.add(new Function((long) 147, 151, 5, "沽清管理", R.drawable.ic_sell_off_manger, 0));
// functions.addAll(FunctionManager.getDefault().getFunctionByResModule(this, ComponentMain.Function.class, ComponentMain.Function.employee,"employee"));
functions.add(new Function((long) 152, 0, 5, "員工", 0, 0));
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));
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));
functions.add(new Function((long) 139, 150, 5, "外送模式", R.drawable.ic_delivery_mode_close, 0));
functions.add(new Function((long) 140, 150, 5, "外賣模式", R.drawable.ic_outsourcing_model_close, 0));
functions.add(new Function((long) 141, 150, 5, "預點餐模式", R.drawable.ic_pre_order_mode_close, 1));
// functions.addAll(FunctionManager.getDefault().getFunctionByResModule(this, ComponentMain.main.class, ComponentMain.main.manager, "manager"));
functions.add(new Function((long) 151, 0, 5, "管理", 0, 0));
//// functions.add(new Function((long) 142, 151, 5, "賬單管理", R.drawable.ic_meals_menu_management, 0));
functions.add(new Function((long) 142, 151, 5, "外賣接單", R.drawable.ic_takeaway_orders, 0));
// functions.add(new Function((long) 143, 151, 5, "餐臺管理", R.drawable.ic_dining_table_management, 0));
functions.add(new Function((long) 144, 151, 5, "打印管理", R.drawable.ic_print_management, 0));
//// functions.add(new Function((long) 145, 151, 5, "支付管理", R.drawable.ic_pay_management_close, 1));
//// functions.add(new Function((long) 146, 151, 5, "折扣管理", R.drawable.ic_discount_management_close, 1));
//// functions.add(new Function((long) 147, 151, 5, "沽清管理", R.drawable.ic_sell_off_manger, 0));
// functions.addAll(FunctionManager.getDefault().getFunctionByResModule(this, ComponentMain.main.class, ComponentMain.main.employee, "employee"));
functions.add(new Function((long) 152, 0, 5, "員工", 0, 0));
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"));
}
//將功能列表數據分組
SparseArray<String> parents = new SparseArray<>();
......@@ -266,9 +286,9 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
}
}
}
// initAdapter(parents, funMap, 0, R.layout.main_home_funcation_item, rvOrdering, 4);
initAdapter(parents, funMap, 0, R.layout.main_home_funcation_item, rvOrdering, 4);
initAdapter(parents, funMap, 1, R.layout.main_home_management_funcation_item, rvManagement, 5);
// initAdapter(parents, funMap, 2, R.layout.main_home_management_funcation_item, rvStaffManagement, 4);
initAdapter(parents, funMap, 2, R.layout.main_home_management_funcation_item, rvStaffManagement, 4);
}
private void initAdapter(SparseArray<String> parents, SparseArray<List<Function>> funMap, int i, int p, RecyclerView rvOrdering, int i2) {
......@@ -288,11 +308,15 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
}
private void functionClick(String name, int status) {
if (status != 0) {
ToastUtils.show(mContext, "服務暫未開通,敬請期待");
return;
switch (status){
case STATUS_NONACTIVATED:
ToastUtils.show(mContext, "服務暫未開通,敬請期待");
return;
case STATUS_TIME_LIMIT:
ToastUtils.show(mContext, "服務已到期,請前往續費");
return;
}
if (name.equals("餐模式")) {
if (name.equals("餐模式")) {
CC.obtainBuilder("Component.Table")
.setActionName("showTableActivity")
.build()
......@@ -317,7 +341,7 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
.setActionName("showSoldoutCtrlActivity")
.build()
.call();
} else if (name.equals("餐管理")) {
} else if (name.equals("餐管理")) {
CC.obtainBuilder("Component.Manager")
.setActionName("showTableManageActivity")
.build()
......@@ -325,7 +349,7 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
}
}
private void setTitleInfo() {
private void updateTitleInfo() {
String restaurantName = GsaCloudApplication.getRestaurantName(this);
String memberName = GsaCloudApplication.getMemberName(this);
if (!TextUtils.isEmpty(restaurantName)) {
......@@ -360,7 +384,8 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
GsaCloudApplication.setRestaurantId(NewMainActivity.this, item.getId());
GsaCloudApplication.setRestaurantName(NewMainActivity.this, item.getText());
setTitleInfo();
updateTitleInfo();
CC.obtainBuilder("Component.Download")
.setActionName("showDownloadActivity")
.addParam("fromPage", 2)
......
......@@ -41,6 +41,7 @@ import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog;
import com.jess.arms.base.BaseActivity;
import com.jess.arms.base.DefaultAdapter;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.integration.AppManager;
import com.jess.arms.utils.ArmsUtils;
import com.jess.arms.utils.DeviceUtils;
import com.qmuiteam.qmui.widget.QMUITopBar;
......@@ -55,6 +56,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.inject.Inject;
import butterknife.BindView;
import butterknife.OnClick;
......@@ -75,6 +78,9 @@ import static com.jess.arms.utils.Preconditions.checkNotNull;
*/
public class SettlementReportActivity extends BaseActivity<SettlementReportPresenter> implements SettlementReportContract.View {
@Inject
AppManager mAppManager;
@BindView(R2.id.topbar)
QMUITopBar mTopBar;
......@@ -261,6 +267,7 @@ public class SettlementReportActivity extends BaseActivity<SettlementReportPrese
String projectTotalSalesText = LanguageUtils.get_language_system(this, "total.project.sales", "項目銷售總額");
String discountText = LanguageUtils.get_language_system(this, "", "折扣");
String serviceFeeText = LanguageUtils.get_language_system(this, "", "服務費");
String deliveryFeeText = LanguageUtils.get_language_system(this, "", "配送費");
String orderCountallText = LanguageUtils.get_language_system(this, "order.countall_litter", "賬單小數");
String netTurnoverText = LanguageUtils.get_language_system(this, "net.turnover", "營業金額淨值");
......@@ -293,8 +300,9 @@ public class SettlementReportActivity extends BaseActivity<SettlementReportPrese
SettlementReport.DataBean.VoBean voBean = datasBean.getVo();
if (voBean != null) {
settlementReportItem5s.add(new SectionTextItem5(projectTotalSalesText, null, null, null, cashStr + df.format(voBean.getPrices())));
settlementReportItem5s.add(new SectionTextItem5(discountText, null, null, null, cashStr + df.format(voBean.getDisamount())));
settlementReportItem5s.add(new SectionTextItem5(discountText, null, null, null, "-"+cashStr + df.format(voBean.getDisamount())));
settlementReportItem5s.add(new SectionTextItem5(serviceFeeText, null, null, null, cashStr + df.format(voBean.getScamount())));
settlementReportItem5s.add(new SectionTextItem5(deliveryFeeText, null, null, null, cashStr + df.format(voBean.getDeliverycharge())));
settlementReportItem5s.add(new SectionTextItem5(netTurnoverText, null, null, null, cashStr + df.format(voBean.getTotamount())));
// if (voBean.getPayNum() > 0) {
......@@ -523,9 +531,11 @@ public class SettlementReportActivity extends BaseActivity<SettlementReportPrese
.callAsyncCallbackOnMainThread((cc, result) -> {
//打印完之後,清除view
PrintTransitUtils.getInstance().setPrintView(null);
if (mPresenter != null) {
mPresenter.getSettlementReport();
}
// if (mPresenter != null) {
// mPresenter.getSettlementReport();
// }
mAppManager.killActivity(SettlementActivity.class);
killMyself();
});
}
......
package com.gingersoft.gsa.cloud.main.mvp.ui.adapter;
import android.widget.BaseAdapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.gingersoft.gsa.cloud.main.R;
......@@ -16,6 +18,7 @@ public class BusinessInfoAdapter extends BaseQuickAdapter<BusinessBean, BaseView
public BusinessInfoAdapter(@Nullable List<BusinessBean> data) {
super(R.layout.report_business_info_item, data);
}
// @Override
......
......@@ -83,6 +83,16 @@
android:textSize="@dimen/dp_17" />
</LinearLayout>
<TextView
android:id="@+id/tv_version_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_18"
android:layout_marginBottom="@dimen/dp_35"
android:gravity="center_vertical|bottom"
android:text=""
android:textColor="@color/white"
android:textSize="@dimen/sp_14" />
</LinearLayout>
<!-- 主頁內容-->
......@@ -227,11 +237,10 @@
android:layout_marginRight="@dimen/dp_10"
app:hl_cornerRadius="@dimen/dp_4"
app:hl_dy="@dimen/main_shadow_dy"
android:visibility="gone"
android:visibility="visible"
app:hl_shadowBackColor="@color/white"
app:hl_shadowColor="@color/shadow_color"
app:hl_shadowLimit="@dimen/main_shadow_limit"
>
app:hl_shadowLimit="@dimen/main_shadow_limit">
<LinearLayout
android:layout_width="match_parent"
......@@ -268,5 +277,6 @@
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</LinearLayout>
</LinearLayout>
</com.gingersoft.gsa.cloud.main.mvp.ui.view.SlidingMenu>
......@@ -41,8 +41,9 @@
<TextView
android:id="@+id/tv_item4"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:maxLines="1"
android:text="item4"
......@@ -59,5 +60,4 @@
android:text="item5"
android:textColor="@color/black"
android:textSize="@dimen/settlement_report_text_size" />
</LinearLayout>
\ No newline at end of file
package com.gingersoft.gsa.other_order_mode.data.model.bean
data class MessageBean(val code: String, val errorMsg: String, val success: Boolean = false, val sysTime: Long = 0, val data: DataBean? = null) {
class DataBean(var msg: String? = null, var num: Int = 0)
/**
* msg : 數據更新成功!
* num : 1
*
* {"code":"1","errorMsg":"成功","data":null}
*/
}
\ No newline at end of file
data class MessageBean(val code: String, val errorMsg: String, val success: Boolean = false, val sysTime: Long = 0, val data: String? = null)
\ No newline at end of file
......@@ -31,10 +31,11 @@
<TextView
android:id="@+id/tv_order_type"
style="@style/print_other_order_twenty_six_style"
style="@style/print_other_order_thirty_bold_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:textSize="@dimen/dp_35"
android:text='外送' />
<TextView
......@@ -91,7 +92,7 @@
<TextView
android:id="@+id/tv_order_take_food_code"
style="@style/print_other_order_twenty_six_style"
style="@style/print_other_order_thirty_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
......
......@@ -5,27 +5,22 @@
android:orientation="vertical">
<!-- 接單的廚房單-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical">
<TextView
android:id="@+id/tv_order_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_26" />
android:textStyle="bold"
android:textSize="@dimen/dp_34" />
<TextView
android:id="@+id/tv_order_number"
style="@style/print_other_order_twenty_six_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_15"
android:text="單號:"
android:textColor="@color/theme_333_color" />
</LinearLayout>
<TextView
android:id="@+id/tv_order_create_time"
......@@ -37,7 +32,7 @@
<TextView
android:id="@+id/tv_order_take_code"
style="@style/print_other_order_twenty_six_style"
style="@style/print_other_order_thirty_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
......
......@@ -30,7 +30,7 @@
<style name="print_other_order_thirty_style">
<item name="android:textColor">@color/theme_333_color</item>
<item name="android:textSize">@dimen/dp_30</item>
<item name="android:textSize">@dimen/dp_34</item>
</style>
<style name="print_other_order_thirty_bold_style" parent="print_other_order_thirty_style">
......
......@@ -12,7 +12,7 @@ import com.gingersoft.gsa.cloud.table.mvp.ui.activity.TableActivity;
public class ComponentTable implements IComponent {
public static final class Function{
public static final class table{
/**餐檯頁*/
public static final FModule[] bottom = {
new FModule("table/bottom/init", R.mipmap.table_init,0) ,
......
......@@ -19,8 +19,6 @@ public class DeleteOrderRequest {
private List<Map<Byte, DeleteOrderRequest.DeleteBean>> mapsDelete;
private long orderId ;
private byte type;
/**賬單小數*/
private Double rounding;
private long reasonId;
public List<Map<Byte, DeleteOrderRequest.DeleteBean>> getMapsDelete() {
......@@ -47,14 +45,6 @@ public class DeleteOrderRequest {
this.type = type;
}
public Double getRounding() {
return rounding;
}
public void setRounding(Double rounding) {
this.rounding = rounding;
}
public long getReasonId() {
return reasonId;
}
......
......@@ -12,6 +12,7 @@ import java.util.Map;
import io.reactivex.Observable;
import me.jessyan.retrofiturlmanager.RetrofitUrlManager;
import okhttp3.FormBody;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.Field;
......@@ -45,6 +46,7 @@ public interface MealService {
@POST("food/updateInvisible" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> updateInvisible(@Body RequestBody requestBody);
@POST("order/send" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> createOrder(@Body RequestBody requestBody);
......
......@@ -663,8 +663,24 @@ public class BaseOrderPresenter<M extends BaseOrderContract.Model, V extends Bas
}
}
}
//删除食品后更新下标
mSelectMealAdapter.setIndex();
}
// protected void reduceSelectedFoodNumber(int number) {
// List<OrderDetail> orderDetails = getOrderFoodLists();
// int start_position = mSelectMealAdapter.getSelect_full_start_position();
// int end_position = mSelectMealAdapter.getSelect_full_end_position();
// for (int i = orderDetails.size() - 1; i >= 0; i--) {
// if (start_position <= i && i <= end_position) {
// OrderDetail orderDetail1 = orderDetails.get(i);
// if (orderDetail1.getType() != DISCOUNT_TYPE) {
// orderDetail1.setNumber(orderDetail1.getNumber() - number);
// }
// }
// }
// }
/**
* 返回未选中的食品
*
......
......@@ -159,15 +159,15 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
mFoodGroupList.addAll(foodGroupList);
Food defalutFoodGroup = getDefalutFoodGroup(mFoodGroupList);
if(defalutFoodGroup != null) {
Food defalutFoodGroup = getDefalutFoodGroup(mFoodGroupList);
if (defalutFoodGroup != null) {
//默認選中第一組
defalutFoodGroup.setSelected(true);
}
IActivity.initFoodGroupView(mFoodGroupList);
if(defalutFoodGroup != null) {
if (defalutFoodGroup != null) {
changedMealByParentId(defalutFoodGroup.getId());
}
}
......@@ -175,8 +175,8 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
private Food getDefalutFoodGroup(List<Food> foodGroupList) {
Food defalutFoodGroup = null;
for (Food food: foodGroupList) {
if(food.getInvisible() == 0){
for (Food food : foodGroupList) {
if (food.getInvisible() == 0) {
defalutFoodGroup = food;
break;
}
......@@ -352,6 +352,11 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
for (int i = 0; i < mFoodComboList.size(); i++) {
//自动添加组合子食品
ComboItem comboItem = mFoodComboList.get(i);
if (comboItem.isSold()) {
String msg = "[" + comboItem.getName() + "]" + comboItem.getCurrentMaxNumber();
CommonTipDialog.showSurpisedDialog(IActivity, msg, null, null, null, null, null);
continue;
}
if (comboItem.getInvisible() != 2) {
int defNumber = Integer.parseInt(comboItem.getDefmodifier());
if (defNumber != 0) {
......@@ -366,6 +371,11 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
//自动添加mixqty>1細項
for (int i = 0; i < mModifierList.size(); i++) {
Modifier modfier = mModifierList.get(i);
if (modfier.isSold()) {
String msg = "[" + modfier.getModifierName() + "]" + modfier.getCurrentMaxNumber();
CommonTipDialog.showSurpisedDialog(IActivity, msg, null, null, null, null, null);
continue;
}
if (modfier.getInvisible() != 2) {
int defNumber = Integer.parseInt(modfier.getDefmodifier());
if (defNumber != 0) {
......@@ -616,6 +626,18 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onComplete() {
super.onComplete();
updateFoodSoldoutCtrData(mSoldoutCtrList);
}
@Override
public void onError(Throwable t) {
super.onError(t);
updateFoodSoldoutCtrData(mSoldoutCtrList);
}
@Override
public void onNext(@NonNull BaseResult info) {
if (info != null && info.isSuccess() && info.getData() != null) {
List<SoldoutCtrFood> soldoutCtrFoods = JsonUtils.parseArray(info.getData(), SoldoutCtrFood.class);
......@@ -625,7 +647,7 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
}
mSoldoutCtrList.addAll(soldoutCtrFoods);
updateFoodSoldoutCtrData(mSoldoutCtrList);
// updateFoodSoldoutCtrData(mSoldoutCtrList);
//設置細項沽清數
IActivity.setFineItemSlodoutListFull(mSoldoutCtrList);
} else {
......@@ -666,7 +688,7 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
MyOrderManage.getInstance().setNewFoodList(getOrderFoodLists());
printSendOrder(true);
} else {
mRootView.showMessage("送單失敗");
mRootView.showMessage(info.getErrMsg());
}
}
});
......@@ -707,7 +729,7 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
}
printSendOrder(false);
} else {
mRootView.showMessage("送單失敗");
mRootView.showMessage(info.getErrMsg());
}
}
}
......@@ -750,23 +772,24 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
// });
}
/**
* 問題:刪除數量 1.賬單小數未更新 世維調整
* 刪除已送單食品
*
* @param maxNumber
* @param deleteNumber
* @param reasonId
*/
public void deleteFood(int maxNumber, int deleteNumber, long reasonId) {
//删除食品前先保存一份
List<OrderDetail> recodeOrderFoods = new ArrayList<>();
recodeOrderFoods.addAll(getOrderFoodLists());
String ids = getSelectedOldFoodIds();
if (TextUtils.isEmpty(ids)) {
return;
}
//删除已选中食品 重新计算账单小数 折扣
removeSelectedFoods();
updateOrderMoneyItem();
DeleteOrderRequest.Request request = getDeleteOrderRequest(ids, reasonId, maxNumber, deleteNumber);
String deleteOrderRequest = GsonUtils.GsonString(request);
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), deleteOrderRequest+",");
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), deleteOrderRequest);
mModel.deleteFood(requestBody)
.subscribeOn(Schedulers.io())
......@@ -777,22 +800,10 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseRespose>(mErrorHandler) {
private void restoreOrderDetails(){
getOrderFoodLists().addAll(recodeOrderFoods);
recodeOrderFoods.clear();
mSelectMealAdapter.notifyDataSetChanged();
}
@Override
public void onError(Throwable t) {
super.onError(t);
restoreOrderDetails();
}
@Override
public void onNext(@NonNull BaseRespose info) {
if (info == null) {
restoreOrderDetails();
mRootView.showMessage("刪除失敗");
return;
}
......@@ -1633,8 +1644,6 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
request.setOrderId(orderId);
request.setType(type);
request.setReasonId(reasonId);
Double rounding = getRounding();
request.setRounding(rounding != null ? rounding : 0);
return request;
}
......
......@@ -23,7 +23,11 @@ import com.gingersoft.gsa.cloud.constans.GoldConstants;
import com.gingersoft.gsa.cloud.constans.PrintConstans;
import com.gingersoft.gsa.cloud.database.bean.Discount;
import com.gingersoft.gsa.cloud.database.bean.Function;
import com.gingersoft.gsa.cloud.function.FunctionManager;
import com.gingersoft.gsa.cloud.print.PrinterUtils;
import com.gingersoft.gsa.cloud.table.ComponentTable;
import com.gingersoft.gsa.cloud.table.R;
import com.gingersoft.gsa.cloud.table.app.TableOperatTypeConstant;
import com.gingersoft.gsa.cloud.table.mvp.contract.OrderContentContract;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.BaseRespose;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.TableDetail;
......@@ -135,6 +139,40 @@ public class OrderContentPresenter extends BaseOrderPresenter<OrderContentContra
if (XClickUtil.isFastDoubleClick(v, 1000)) {
return;
}
// if (function.getResUrl().equals(ComponentTable.table.order[0].getKeyRes())) {
// //送單
// sendOrder(false);
// } else if (function.getResUrl().equals(ComponentTable.table.order[1].getKeyRes())) {
// //印單
// if (!canPrint()) {
// return;
// }
// if (hasNesOrderFoods()) {
// //有未送單食品先送單
// sendOrder(true);
// } else {
// printOrder(OpenTableManage.getDefault().getTableBean().getId(), false);
// }
// } else if (function.getResUrl().equals(ComponentTable.table.order[2].getKeyRes())) {
// //結賬
// if (!canPay()) {
// return;
// }
// mRootView.startActivityForResult(OrderContentActivity.BILL_CODE, OrderPayActivity.class, null);
// } else if (function.getResUrl().equals(ComponentTable.table.order[3].getKeyRes())) {
// //轉移
// if (!canTransfer()) {
// return;
// }
// mRootView.showTransferFoodLayout();
// } else if (function.getResUrl().equals(ComponentTable.table.order[4].getKeyRes())) {
// //折扣
// if (!canDiscount()) {
// return;
// }
// showDiscountDialog();
// }
switch (function.getResName()) {
case "送單":
sendOrder(false);
......@@ -174,7 +212,7 @@ public class OrderContentPresenter extends BaseOrderPresenter<OrderContentContra
@Override
public boolean onItemLongClick(View v, Function datasBean) {
if (datasBean.getResName().equals("印單") || datasBean.getResName().equals("送單")) {
PrinterUtils.switchPrintMethod(IActivity,datasBean, mOrderTopFunctionAdapter);
PrinterUtils.switchPrintMethod(IActivity, datasBean, mOrderTopFunctionAdapter);
}
return false;
}
......@@ -206,11 +244,11 @@ public class OrderContentPresenter extends BaseOrderPresenter<OrderContentContra
mFunctionList.add(new Function("結賬", Color.parseColor("#FFFFFF"), Color.parseColor("#DC0000"), 24));
mFunctionList.add(new Function("轉移", Color.parseColor("#FFFFFF"), Color.parseColor("#FF4B9DFA"), 24));
mFunctionList.add(new Function("折扣", Color.parseColor("#FFFFFF"), Color.parseColor("#008577"), 24));
// List<Function> functions = FunctionManager.getDefault().getFunctionByResModule(IActivity, FunctionModule.Table.class, "order");
// List<Function> functions = FunctionManager.getDefault().getFunctionByResModule(IActivity, ComponentTable.table.class, ComponentTable.table.order, "order");
// for (int i = 0; i < functions.size(); i++) {
// functions.get(i).setTextSize(ArmsUtils.getDimens(IActivity, R.dimen.sp_14));
// functions.get(i).setTextColor(ArmsUtils.getColor(IActivity, R.color.theme_white_color));
// functions.get(i).setIconRes(FunctionModule.Table.order[i].getOpenIconRes());
// if (functions.get(i).getParentId() == 0) {
// functions.remove(i);
// }
// }
// mFunctionList.addAll(functions);
}
......@@ -260,7 +298,7 @@ public class OrderContentPresenter extends BaseOrderPresenter<OrderContentContra
if (isPrint) {
printOrder(OpenTableManage.getDefault().getTableBean().getId(), true);
} else {
mRootView.showMessage("送單失敗");
mRootView.showMessage(info.getErrMsg());
}
}
}
......@@ -302,7 +340,7 @@ public class OrderContentPresenter extends BaseOrderPresenter<OrderContentContra
mRootView.showMessage("送單成功");
// mRootView.sendSuccess();
} else {
mRootView.showMessage("送單失敗");
mRootView.showMessage(info.getErrMsg());
}
}
}
......@@ -520,7 +558,7 @@ public class OrderContentPresenter extends BaseOrderPresenter<OrderContentContra
private void transferFood(TableBean.DataBean dataBean) {
//删除食品前先保存一份
List<OrderDetail> recodeOrderFoods = new ArrayList<>();
List<OrderDetail> recodeOrderFoods = new ArrayList<>();
recodeOrderFoods.addAll(getOrderFoodLists());
String ids = getSelectedOldFoodIds();
......@@ -547,9 +585,11 @@ public class OrderContentPresenter extends BaseOrderPresenter<OrderContentContra
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseRespose>(mErrorHandler) {
private void restoreOrderDetails(){
private void restoreOrderDetails() {
getOrderFoodLists().clear();
getOrderFoodLists().addAll(recodeOrderFoods);
recodeOrderFoods.clear();
mSelectMealAdapter.setIndex();
mSelectMealAdapter.notifyDataSetChanged();
}
......
......@@ -13,6 +13,7 @@ import com.gingersoft.gsa.cloud.base.common.bean.mealManage.MyOrderManage;
import com.gingersoft.gsa.cloud.base.common.bean.mealManage.OpenTableManage;
import com.gingersoft.gsa.cloud.base.utils.CommonConfiguration;
import com.gingersoft.gsa.cloud.base.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils;
import com.gingersoft.gsa.cloud.constans.GoldConstants;
import com.gingersoft.gsa.cloud.database.bean.FoodCombo;
import com.gingersoft.gsa.cloud.database.bean.Function;
......@@ -59,6 +60,8 @@ import okhttp3.RequestBody;
import static com.gingersoft.gsa.cloud.base.common.bean.OrderDetail.FOOD_TYPE;
import static com.gingersoft.gsa.cloud.base.common.bean.OrderDetail.MODIFIER_TYPE;
import static com.gingersoft.gsa.cloud.database.bean.Function.STATUS_NONACTIVATED;
import static com.gingersoft.gsa.cloud.database.bean.Function.STATUS_TIME_LIMIT;
/**
......@@ -151,39 +154,59 @@ public class TablePresenter extends BasePresenter<TableContract.Model, TableCont
@Override
public void onItemClick(View view, int viewType, Object data, int position) {
switch (position) {
case 0:
//重置
mRootView.setCurrentOperatType(TableOperatTypeConstant.init_table_3);
break;
case 1:
//轉檯
mRootView.setCurrentOperatType(TableOperatTypeConstant.move_table_4);
break;
case 2:
//上菜紙
mRootView.setCurrentOperatType(TableOperatTypeConstant.print_parper_2);
break;
Function function = (Function) data;
switch (function.getStatus()) {
case STATUS_NONACTIVATED:
mRootView.showMessage( "服務暫未開通,敬請期待");
return;
case STATUS_TIME_LIMIT:
mRootView.showMessage( "服務已到期,請前往續費");
return;
}
if (function.getResUrl().equals(ComponentTable.table.bottom[0].getKeyRes())) {
//重置
mRootView.setCurrentOperatType(TableOperatTypeConstant.init_table_3);
} else if (function.getResUrl().equals(ComponentTable.table.bottom[1].getKeyRes())) {
//轉檯
mRootView.setCurrentOperatType(TableOperatTypeConstant.move_table_4);
} else if (function.getResUrl().equals(ComponentTable.table.bottom[3].getKeyRes())) {
//上菜紙
mRootView.setCurrentOperatType(TableOperatTypeConstant.print_parper_2);
}
// switch (position) {
// case 0:
// //重置
// mRootView.setCurrentOperatType(TableOperatTypeConstant.init_table_3);
// break;
// case 1:
// //轉檯
// mRootView.setCurrentOperatType(TableOperatTypeConstant.move_table_4);
// break;
// case 2:
// //上菜紙
// mRootView.setCurrentOperatType(TableOperatTypeConstant.print_parper_2);
// break;
// }
}
});
}
public void initBottomFunctionItem() {
// List<Function> functions = FunctionManager.getDefault().getFunctionByResModule(IActivity, ComponentTable.Function.class, ComponentTable.Function.bottom,"bottom");
// for (int i = 0; i < functions.size(); i++) {
// functions.get(i).setTextSize(ArmsUtils.getDimens(IActivity, R.dimen.sp_14));
// functions.get(i).setTextColor(ArmsUtils.getColor(IActivity, R.color.theme_black));
// functions.get(i).setIconRes(ComponentTable.Function.bottom[i].getOpenIconRes());
// }
// mBottomFunctionList.addAll(functions);
mBottomFunctionList.add(new Function((long) 1, "重置檯號", ArmsUtils.getColor(IActivity, R.color.theme_black), ArmsUtils.getDimens(IActivity, R.dimen.sp_14), R.mipmap.table_init));
mBottomFunctionList.add(new Function((long) 2, "轉檯", ArmsUtils.getColor(IActivity, R.color.theme_black), ArmsUtils.getDimens(IActivity, R.dimen.sp_14), R.mipmap.table_move));
List<Function> functions = FunctionManager.getDefault().getFunctionByResModule(IActivity, ComponentTable.table.class, ComponentTable.table.bottom,"bottom");
for (int i = 0; i < functions.size(); i++) {
if(functions.get(i).getParentId() == 0){
functions.remove(i);
}
}
mBottomFunctionList.addAll(functions);
// mBottomFunctionList.add(new Function((long) 1, "重置檯號", ArmsUtils.getColor(IActivity, R.color.theme_black), ArmsUtils.getDimens(IActivity, R.dimen.sp_14), R.mipmap.table_init));
// mBottomFunctionList.add(new Function((long) 2, "轉檯", ArmsUtils.getColor(IActivity, R.color.theme_black), ArmsUtils.getDimens(IActivity, R.dimen.sp_14), R.mipmap.table_move));
// mBottomFunctionList.add(new Function((long) 3, "分檯", ArmsUtils.getColor(IActivity, R.color.theme_black), ArmsUtils.getDimens(IActivity, R.dimen.sp_14), R.mipmap.table_splite));
// mBottomFunctionList.add(new Function((long) 4, "skyorder", ArmsUtils.getColor(IActivity, R.color.theme_black), ArmsUtils.getDimens(IActivity, R.dimen.sp_14), R.mipmap.table_skyorder));
mBottomFunctionList.add(new Function((long) 5, "上菜紙", ArmsUtils.getColor(IActivity, R.color.theme_black), ArmsUtils.getDimens(IActivity, R.dimen.sp_14), R.mipmap.table_paper));
// mBottomFunctionList.add(new Function((long) 5, "上菜紙", ArmsUtils.getColor(IActivity, R.color.theme_black), ArmsUtils.getDimens(IActivity, R.dimen.sp_14), R.mipmap.table_paper));
}
public void getTables(boolean show, RefreshLayout refreshLayout) {
int restaurantId = GsaCloudApplication.getRestaurantId(mApplication);
mModel.getTables(restaurantId)
......@@ -402,7 +425,7 @@ public class TablePresenter extends BasePresenter<TableContract.Model, TableCont
OrderBean.OrderDetailsBean orderDetailsBean = orderDetailsBeans.get(i);
if (orderDetailsBean.getType() == FOOD_TYPE) {
int nextIndex = i + 1;
if (orderDetailsBean.getParentId() == 0 || (orderDetailsBeans.size() > nextIndex && orderDetailsBeans.get(nextIndex).getType() == MODIFIER_TYPE) ) {
if (orderDetailsBean.getParentId() == 0 || (orderDetailsBeans.size() > nextIndex && orderDetailsBeans.get(nextIndex).getType() == MODIFIER_TYPE)) {
paroductId = orderDetailsBean.getProductId();
}
topId = getComboIdByFid(paroductId);
......
......@@ -69,7 +69,7 @@ public class BottomFunctionAdapter extends DefaultAdapter<Function> {
private void initItemData(Function item) {
tv_name.setText(item.getResName());
iv_icon.setImageResource(item.getIconRes());
iv_icon.setImageResource(item.getIcRes());
}
}
......
......@@ -193,10 +193,12 @@ public class FoodGroupAdapter extends DefaultAdapter<Food> {
// } else {
// //后台没有设置颜色当前选中高亮色,没有选中默认使用绿色
if (datasBean.isSelected()) {
tv_name.setBackgroundColor(ArmsUtils.getColor(mContext, R.color.orange_500));
tv_name.setBackgroundColor(Color.parseColor("#3C3C3C"));
// tv_name.setBackgroundColor(ArmsUtils.getColor(mContext, R.color.orange_500));
tv_name.setTextColor(ArmsUtils.getColor(mContext, R.color.theme_white_color));
} else {
tv_name.setBackgroundColor(ArmsUtils.getColor(mContext, R.color.Grass_green));
tv_name.setBackgroundColor(Color.parseColor("#FF9700"));
// tv_name.setBackgroundColor(ArmsUtils.getColor(mContext, R.color.Grass_green));
tv_name.setTextColor(ArmsUtils.getColor(mContext, R.color.theme_white_color));
}
// }
......
......@@ -10,7 +10,8 @@
android:id="@+id/iv_icon"
android:layout_width="@dimen/dp_25"
android:layout_height="@dimen/dp_25"
android:layout_marginTop="@dimen/dp_5" />
android:layout_marginTop="@dimen/dp_5"
android:src="@mipmap/ic_launcher" />
<TextView
android:id="@+id/tv_name"
......
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