Commit 5ba0f646 by Wyh

1、修復首頁刷新問題 2、新增歷史清機activity 3、修復新增打印機閃退問題 4、餐檯模式掃碼功能 5、移除一些無用代碼

parent 8b8ca7ab
......@@ -13,6 +13,7 @@ buildscript {
maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
// jcenter()
google()
maven { url 'https://jitpack.io' }
}
dependencies {
......
......@@ -17,7 +17,6 @@
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".ui.activity.HistoryOrderActivity"
android:screenOrientation="portrait" />
......
......@@ -102,15 +102,15 @@ class HistoryOrderAdapter(var stauts: String?, private val context: Context, var
}
private fun setOrderReason(holder: ViewHolder, refundStatus: Int, orderPayType: Int, payType: Int, reasonDesc: String) {
var refundReason = getRefundReasonByStatus(refundStatus, orderPayType, payType);
val refundReason = getRefundReasonByStatus(refundStatus, orderPayType, payType);
if (!TextUtils.isEmpty(refundReason)) {
if (refundStatus == 5) {
holder.tv_refund_reason.setTextColor(getColor(R.color.green_400))
} else {
holder.tv_refund_reason.setTextColor(getColor(R.color.red))
}
holder.tv_refund_reason.setText(refundReason)
holder.tv_refund_reason_text.setText("退款進度:")
holder.tv_refund_reason.text = refundReason
holder.tv_refund_reason_text.text = "退款進度:"
holder.tv_refund_reason_text.visibility = View.VISIBLE
holder.tv_refund_reason.visibility = View.VISIBLE
......@@ -123,15 +123,10 @@ class HistoryOrderAdapter(var stauts: String?, private val context: Context, var
holder.tv_address_text.visibility = View.VISIBLE
holder.tv_address.visibility = View.VISIBLE
}
if (reasonDesc != null) {
holder.tv_cancel_reason.setText(reasonDesc)
holder.tv_cancel_reason_text.setText("取消原因:")
holder.tv_cancel_reason_text.visibility = View.VISIBLE
holder.tv_cancel_reason.visibility = View.VISIBLE
} else {
holder.tv_cancel_reason_text.visibility = View.GONE
holder.tv_cancel_reason.visibility = View.GONE
}
holder.tv_cancel_reason.setText(reasonDesc)
holder.tv_cancel_reason_text.setText("取消原因:")
holder.tv_cancel_reason_text.visibility = View.VISIBLE
holder.tv_cancel_reason.visibility = View.VISIBLE
}
/**
......@@ -143,24 +138,24 @@ class HistoryOrderAdapter(var stauts: String?, private val context: Context, var
return "退款完成"
}
else -> {
when (orderPayType) {
return when (orderPayType) {
1 -> {
return "無"
"無"
}
else -> {
when (payType) {
PayMethodContract.PAY_METHOD_ID_1021 -> { //Google pay需要5-7天
return "退款中(預計5-7個工作日退回原賬戶)"
"退款中(預計5-7個工作日退回原賬戶)"
}
else -> {
return "退款中(預計1-3個工作日退回原賬戶)"
"退款中(預計1-3個工作日退回原賬戶)"
}
}
}
}
}
}
return "";
return ""
}
private fun getColor(color: Int): Int {
......
......@@ -18,7 +18,10 @@
android:resizeableActivity="true"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true">
<activity android:name=".mvp.ui.activity.WelcomeActivity">
<activity
android:name=".mvp.ui.activity.WelcomeActivity"
android:launchMode="singleTop"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......@@ -29,18 +32,26 @@
</activity>
<activity
android:name=".mvp.ui.activity.LoginActivity"
android:launchMode="singleTask" />
android:launchMode="singleTask"
android:screenOrientation="portrait" />
<activity android:name=".mvp.ui.activity.SwitchServerActivity" />
<!-- HywebPOS支付頁 -->
<activity
android:name="com.etps.aca.lib.activity.CommandActivity"
android:exported="true" />
android:exported="true"
android:screenOrientation="portrait" />
<activity android:name=".mvp.ui.activity.ChooseRestaurantActivity" />
<activity android:name=".mvp.ui.activity.LoginOutActivity" />
<activity android:name=".mvp.ui.activity.RecoverPasswordActivity" />
<activity
android:name=".mvp.ui.activity.ChooseRestaurantActivity"
android:screenOrientation="portrait" />
<activity
android:name=".mvp.ui.activity.LoginOutActivity"
android:screenOrientation="portrait" />
<activity
android:name=".mvp.ui.activity.RecoverPasswordActivity"
android:screenOrientation="portrait" />
<meta-data
android:name="com.gingersoft.gsa.cloud.common.config.globalconfig.GlobalConfiguration"
......
......@@ -10,7 +10,6 @@ import java.util.List;
import io.reactivex.Observable;
import okhttp3.RequestBody;
/**
* ================================================
* Description:
......
......@@ -52,7 +52,7 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B
if (autoLogin && UserContext.newInstance().isLogin()) {
int restaurantId = RestaurantInfoManager.newInstance().getRestaurantId();
if (restaurantId != 0) {
if (restaurantId > 0) {
//上一次進入app有選擇餐廳,通過餐廳ID獲取允許的最大登陸數
mPresenter.getLoginLimit(restaurantId, false);
// jumpMainActivity();
......@@ -106,7 +106,7 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B
boolean autoLogin = (boolean) SPUtils.get(UserConstans.AUTO_LOGIN, false);
if (autoLogin) {
int restaurantId = RestaurantInfoManager.newInstance().getRestaurantId();
if (restaurantId != 0) {
if (restaurantId > 0) {
//上一次進入app有選擇餐廳,通過餐廳ID獲取允許的最大登陸數
// mPresenter.getLoginLimit(restaurantId, false);
// jumpMainActivity();
......
......@@ -16,9 +16,6 @@
android:name=".mvp.ui.activity.ExpandListActivity"
android:screenOrientation="portrait" />
<activity
android:name=".mvp.ui.activity.MainActivity"
android:screenOrientation="portrait" />
<activity
android:name=".mvp.ui.activity.ReportActivity"
android:screenOrientation="portrait" />
<activity
......
......@@ -17,6 +17,7 @@
android:networkSecurityConfig="@xml/network_android"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".mvp.ui.activity.LiquidationHistoryActivity" />
<activity android:name=".mvp.ui.activity.menu.ShellActivity" />
<activity
android:name=".mvp.ui.activity.menu.FoodMenuManageActivity"
......@@ -26,15 +27,14 @@
<activity android:name=".mvp.ui.activity.RestaurantQrCodeActivity" />
<activity android:name=".mvp.ui.activity.LanguageActivity" />
<activity android:name=".mvp.ui.activity.ReportActivity" />
<activity android:name=".mvp.ui.activity.MainActivity" />
<activity android:name=".mvp.ui.activity.SettlementActivity" />
<activity android:name=".mvp.ui.activity.SettlementReportActivity" />
<activity android:name=".mvp.ui.activity.LookLogActivity" />
<activity android:name=".mvp.ui.activity.OriginalPrintPaperActivity" />
<activity
android:name=".mvp.ui.activity.NewMainActivity"
android:launchMode="singleTask"
android:alwaysRetainTaskState="true"
android:launchMode="singleTask"
android:theme="@style/MainTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......@@ -55,4 +55,4 @@
android:value="640" />
</application>
</manifest>
</manifest>
\ No newline at end of file
package com.gingersoft.gsa.cloud.main;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
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.gingersoft.gsa.cloud.common.logan.LoganManager;
import com.gingersoft.gsa.cloud.component.ComponentAction;
import com.gingersoft.gsa.cloud.component.ComponentName;
import com.gingersoft.gsa.cloud.common.function.FModule;
import com.gingersoft.gsa.cloud.main.mvp.ui.activity.MainActivity;
import com.gingersoft.gsa.cloud.main.mvp.ui.activity.NewMainActivity;
import com.gingersoft.gsa.cloud.main.mvp.ui.activity.SettlementReportActivity;
import com.gingersoft.gsa.cloud.main.mvp.ui.activity.menu.FoodMenuManageActivity;
import com.jess.arms.integration.AppManager;
import com.jess.arms.utils.ArmsUtils;
public class ComponentMain implements IComponent {
......@@ -112,18 +105,9 @@ public class ComponentMain implements IComponent {
}
private void lifecycleFragmentDoubleText(CC cc) {
// LifecycleFragment lifecycleFragment = cc.getParamItem("fragment");
// if (lifecycleFragment != null) {
// String text = cc.getParamItem("text", "");
// lifecycleFragment.addText(text);
// CC.sendCCResult(cc.getCallId(), CCResult.success());
// } else {
// CC.sendCCResult(cc.getCallId(), CCResult.error("no fragment params"));
// }
}
private void getLifecycleFragment(CC cc) {
// CC.sendCCResult(cc.getCallId(), CCResult.successWithNoKey(new LifecycleFragment()));
}
private void getInfo(CC cc) {
......@@ -132,7 +116,6 @@ public class ComponentMain implements IComponent {
}
private void openActivity(CC cc) {
// Intent intent = new Intent(cc.getContext(), MainActivity.class);
Intent intent = new Intent(cc.getContext(), NewMainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
cc.getContext().startActivity(intent);
......
package com.gingersoft.gsa.cloud.main.di.component;
import dagger.BindsInstance;
import dagger.Component;
import com.jess.arms.di.component.AppComponent;
import com.gingersoft.gsa.cloud.main.di.module.HomeModule;
import com.gingersoft.gsa.cloud.main.mvp.contract.HomeContract;
import com.jess.arms.di.scope.FragmentScope;
import com.gingersoft.gsa.cloud.main.mvp.ui.fragment.HomeFragment;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 01/10/2020 15:02
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@FragmentScope
@Component(modules = HomeModule.class, dependencies = AppComponent.class)
public interface HomeComponent {
void inject(HomeFragment fragment);
@Component.Builder
interface Builder {
@BindsInstance
HomeComponent.Builder view(HomeContract.View view);
HomeComponent.Builder appComponent(AppComponent appComponent);
HomeComponent build();
}
}
\ No newline at end of file
......@@ -2,18 +2,21 @@ package com.gingersoft.gsa.cloud.main.di.component;
import dagger.BindsInstance;
import dagger.Component;
import com.gingersoft.gsa.cloud.main.mvp.contract.MainContract;
import com.gingersoft.gsa.cloud.main.di.module.MainModule;
import com.gingersoft.gsa.cloud.main.mvp.ui.activity.MainActivity;
import com.jess.arms.di.component.AppComponent;
import com.gingersoft.gsa.cloud.main.di.module.LiquidationHistoryModule;
import com.gingersoft.gsa.cloud.main.mvp.contract.LiquidationHistoryContract;
import com.jess.arms.di.scope.ActivityScope;
import com.gingersoft.gsa.cloud.main.mvp.ui.activity.LiquidationHistoryActivity;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 12/26/2019 14:10
* Created by MVPArmsTemplate on 05/26/2021 17:45
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
......@@ -22,14 +25,17 @@ import com.jess.arms.di.scope.ActivityScope;
* ================================================
*/
@ActivityScope
@Component(modules = MainModule.class, dependencies = AppComponent.class)
public interface MainComponent {
void inject(MainActivity activity);
@Component(modules = LiquidationHistoryModule.class, dependencies = AppComponent.class)
public interface LiquidationHistoryComponent {
void inject(LiquidationHistoryActivity activity);
@Component.Builder
interface Builder {
@BindsInstance
MainComponent.Builder view(MainContract.View view);
MainComponent.Builder appComponent(AppComponent appComponent);
MainComponent build();
LiquidationHistoryComponent.Builder view(LiquidationHistoryContract.View view);
LiquidationHistoryComponent.Builder appComponent(AppComponent appComponent);
LiquidationHistoryComponent build();
}
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.main.di.module;
import com.jess.arms.di.scope.ActivityScope;
import dagger.Binds;
import dagger.Module;
import dagger.Provides;
import com.gingersoft.gsa.cloud.main.mvp.contract.LiquidationHistoryContract;
import com.gingersoft.gsa.cloud.main.mvp.model.LiquidationHistoryModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 05/26/2021 17:45
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@Module
public abstract class LiquidationHistoryModule {
@Binds
abstract LiquidationHistoryContract.Model bindLiquidationHistoryModel(LiquidationHistoryModel model);
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.main.mvp.contract;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 05/26/2021 17:45
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public interface LiquidationHistoryContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
}
}
......@@ -29,6 +29,8 @@ public interface MainTopContract {
void loadBusinessInfo(List<MainBusinessBean.DataBean> dataBean);
void loadChart(List<MainOrderInfoChartBean.DataBean> dataBeans);
void onFinishRefresh();
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
......
package com.gingersoft.gsa.cloud.main.mvp.model;
import android.app.Application;
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 com.gingersoft.gsa.cloud.main.mvp.contract.LiquidationHistoryContract;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 05/26/2021 17:45
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@ActivityScope
public class LiquidationHistoryModel extends BaseModel implements LiquidationHistoryContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public LiquidationHistoryModel(IRepositoryManager repositoryManager) {
super(repositoryManager);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mGson = null;
this.mApplication = null;
}
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.main.mvp.model.bean;
import lombok.Data;
/**
* @author 宇航. 1239658231@qq.com
* User: 宇航. 1239658231@qq.com
* Date: 2021/5/26
* Time: 18:23
* Use:
*/
@Data
public class LiquidationBean {
private long createTime;
private String no;
private int id;
}
......@@ -25,7 +25,7 @@ public interface SettlementService {
Observable<SendSettlement> sendSettlement(@Body RequestBody requestBody);
@Headers({"Domain-Name: settlement_report_server"})
@GET("ricepon-report/api/restaurantOperation/report" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
@GET("restaurantOperation/report" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> getSettlementReport(@Query("restaurantId") int restaurantId);
@POST("posPay/addOperation" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
......
package com.gingersoft.gsa.cloud.main.mvp.presenter;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import com.gingersoft.gsa.cloud.database.bean.Function;
import com.gingersoft.gsa.cloud.database.utils.FunctionDaoUtils;
import com.gingersoft.gsa.cloud.main.R;
import com.gingersoft.gsa.cloud.main.mvp.contract.MainContract;
import com.gingersoft.gsa.cloud.main.mvp.ui.adapter.FunctionAdapter;
import com.jess.arms.integration.AppManager;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.http.imageloader.ImageLoader;
import java.util.ArrayList;
import java.util.List;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import javax.inject.Inject;
import com.gingersoft.gsa.cloud.main.mvp.contract.LiquidationHistoryContract;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 12/26/2019 14:10
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
* Description:清機歷史記錄
*/
@ActivityScope
public class MainPresenter extends BasePresenter<MainContract.Model, MainContract.View> {
public class LiquidationHistoryPresenter extends BasePresenter<LiquidationHistoryContract.Model, LiquidationHistoryContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
......@@ -47,12 +29,8 @@ public class MainPresenter extends BasePresenter<MainContract.Model, MainContrac
@Inject
AppManager mAppManager;
private List<Function> mList = new ArrayList<>();
private FunctionAdapter mAdapter;
@Inject
public MainPresenter(MainContract.Model model, MainContract.View rootView) {
public LiquidationHistoryPresenter(LiquidationHistoryContract.Model model, LiquidationHistoryContract.View rootView) {
super(model, rootView);
}
......@@ -64,46 +42,4 @@ public class MainPresenter extends BasePresenter<MainContract.Model, MainContrac
this.mImageLoader = null;
this.mApplication = null;
}
public void initAdapter(Context context) {
initFunctionItem(context);
if (mAdapter == null) {
mAdapter = new FunctionAdapter(context, mList);
mRootView.setFunctionAdapter(mAdapter);
}
}
public void initItemClickListener(Context context) {
mAdapter.setOnItemClickListener(new FunctionAdapter.OnItemClickListener() {
@Override
public void onItemClick(int position) {
String clas = mList.get(position).getResUrl();
if (TextUtils.isEmpty(clas)) {
try {
Intent intent = new Intent(context, Class.forName(clas));
context.startActivity(intent);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
}
});
}
private void initFunctionItem(Context context) {
if (mList.size() > 0) {
mList.clear();
}
FunctionDaoUtils functionDao = new FunctionDaoUtils(context);
List<Function> functionList = functionDao.queryAllFunction();
mList.addAll(functionList);
}
}
......@@ -69,6 +69,7 @@ public class MainTopPresenter extends BasePresenter<MainTopContract.Model, MainT
.subscribeOn(Schedulers.io())
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doOnComplete(() -> mRootView.onFinishRefresh())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<MainBusinessBean>(mErrorHandler) {
......@@ -85,7 +86,7 @@ public class MainTopPresenter extends BasePresenter<MainTopContract.Model, MainT
});
}
public void getOrderInfoChart(String restaurantId){
public void getOrderInfoChart(String restaurantId) {
RequestBody requestBody = new FormBody.Builder()
.add("restaurantId", restaurantId)
.build();
......@@ -93,6 +94,7 @@ public class MainTopPresenter extends BasePresenter<MainTopContract.Model, MainT
.subscribeOn(Schedulers.io())
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doOnComplete(() -> mRootView.onFinishRefresh())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<MainOrderInfoChartBean>(mErrorHandler) {
@Override
......
......@@ -93,10 +93,6 @@ public class NewMainPresenter extends BasePresenter<NewMainContract.Model, NewMa
}
public void checkAppVersion() {
// RequestBody requestBody = new FormBody.Builder()
// .add("version", )
// .add("type", "2")
// .build();
mModel.checkAppVersion(DeviceUtils.getVersionName(mApplication) + "|" + DeviceUtils.getVersionCode(mApplication),
2,
2,
......
......@@ -45,9 +45,6 @@ public class SettlementPresenter extends BasePresenter<SettlementContract.Model,
@Inject
AppManager mAppManager;
@Inject
public SettlementPresenter(SettlementContract.Model model, SettlementContract.View rootView) {
super(model, rootView);
......@@ -64,15 +61,8 @@ public class SettlementPresenter extends BasePresenter<SettlementContract.Model,
public void getSettlementReport(int settlementType) {
int restaurantId = RestaurantInfoManager.newInstance().getRestaurantId();
mModel.getSettlementReport(restaurantId)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(null))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
sendRequest(mModel.getSettlementReport(restaurantId))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(@NonNull BaseResult info) {
if (info != null && info.isSuccess()) {
......
package com.gingersoft.gsa.cloud.main.mvp.ui.activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.gsa.cloud.main.R;
import com.gingersoft.gsa.cloud.main.R2;
import com.gingersoft.gsa.cloud.main.di.component.DaggerLiquidationHistoryComponent;
import com.gingersoft.gsa.cloud.main.mvp.contract.LiquidationHistoryContract;
import com.gingersoft.gsa.cloud.main.mvp.presenter.LiquidationHistoryPresenter;
import com.gingersoft.gsa.cloud.main.mvp.ui.adapter.LiquidationHistoryAdapter;
import com.gingersoft.gsa.cloud.main.mvp.ui.view.StartEndTimePickerView;
import com.gingersoft.gsa.cloud.ui.animator.CustomAnimation1;
import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog;
import com.jess.arms.base.BaseActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import com.qmuiteam.qmui.widget.QMUITopBar;
import butterknife.BindView;
import butterknife.ButterKnife;
import static com.jess.arms.utils.Preconditions.checkNotNull;
/**
* ================================================
* Description:清機歷史記錄
*
* @author admin
*/
public class LiquidationHistoryActivity extends BaseActivity<LiquidationHistoryPresenter> implements LiquidationHistoryContract.View {
@BindView(R2.id.topbar)
QMUITopBar topbar;
@BindView(R2.id.sv_time_select)
StartEndTimePickerView svTimeSelect;
@BindView(R2.id.rv_liquidation_history_list)
RecyclerView rvLiquidationHistoryList;
@Override
public void setupActivityComponent(@NonNull AppComponent appComponent) {
DaggerLiquidationHistoryComponent //如找不到该类,请编译一下项目
.builder()
.appComponent(appComponent)
.view(this)
.build()
.inject(this);
}
@Override
public int initView(@Nullable Bundle savedInstanceState) {
return R.layout.activity_liquidation_history;
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
// LiquidationHistoryAdapter liquidationHistoryAdapter = new LiquidationHistoryAdapter();
// liquidationHistoryAdapter.setAdapterAnimation(new CustomAnimation1());
// rvLiquidationHistoryList.setAdapter(liquidationHistoryAdapter);
}
@Override
public void initIntent() {
}
@Override
public void initTopBar() {
topbar.setOnClickListener(v -> Log.e("eee", "點擊的控件:" + v.getId()));
}
@Override
public void initLanguage() {
}
@Override
public void initLayoutParams() {
}
@Override
public void initLayoutVisible() {
}
@Override
public void showLoading(String message) {
if (message != null) {
LoadingDialog.showDialogForLoading(this, message, true);
} else {
LoadingDialog.showDialogForLoading(this);
}
}
@Override
public void hideLoading() {
LoadingDialog.cancelDialogForLoading();
}
@Override
public void showMessage(@NonNull String message) {
ArmsUtils.makeText(this, message);
}
@Override
public void launchActivity(@NonNull Intent intent) {
checkNotNull(intent);
ArmsUtils.startActivity(intent);
}
@Override
public void killMyself() {
finish();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO: add setContentView(...) invocation
ButterKnife.bind(this);
}
}
package com.gingersoft.gsa.cloud.main.mvp.ui.activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.widget.BaseAdapter;
import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils;
import com.gingersoft.gsa.cloud.main.R;
import com.gingersoft.gsa.cloud.main.R2;
import com.gingersoft.gsa.cloud.main.di.component.DaggerMainComponent;
import com.gingersoft.gsa.cloud.main.mvp.contract.MainContract;
import com.gingersoft.gsa.cloud.main.mvp.presenter.MainPresenter;
import com.gingersoft.gsa.cloud.main.mvp.ui.fragment.HomeFragment;
import com.gingersoft.gsa.cloud.main.mvp.ui.fragment.MyFragment;
import com.gingersoft.gsa.cloud.main.mvp.ui.fragment.ReportListFragment;
import com.gyf.immersionbar.ImmersionBar;
import com.jess.arms.base.BaseFragmentActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import com.qmuiteam.qmui.arch.QMUIFragmentPagerAdapter;
import com.qmuiteam.qmui.util.QMUIDisplayHelper;
import com.qmuiteam.qmui.widget.QMUIViewPager;
import com.qmuiteam.qmui.widget.tab.QMUITab;
import com.qmuiteam.qmui.widget.tab.QMUITabBuilder;
import com.qmuiteam.qmui.widget.tab.QMUITabSegment;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ReportFragment;
import butterknife.BindView;
import static com.jess.arms.utils.Preconditions.checkNotNull;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 12/26/2019 14:10
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public class MainActivity extends BaseFragmentActivity<MainPresenter> implements MainContract.View {
// @BindView(R2.id.topbar)
// QMUITopBar mTopBar;
// @BindView(R2.id.gv_function)
// GridView gv_function;
@BindView(R2.id.main_pager)
QMUIViewPager mViewPager;
@BindView(R2.id.main_tabs)
QMUITabSegment mTabSegment;
@Override
public void setupActivityComponent(@NonNull AppComponent appComponent) {
DaggerMainComponent //如找不到该类,请编译一下项目
.builder()
.appComponent(appComponent)
.view(this)
.build()
.inject(this);
}
@Override
public void configImmersionBar(ImmersionBar immersionBar) {
immersionBar.init();
}
@Override
public int initView(@Nullable Bundle savedInstanceState) {
return R.layout.main_activity_main; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
initTabs();
initPagers();
}
private void initPagers() {
QMUIFragmentPagerAdapter pagerAdapter = new QMUIFragmentPagerAdapter(getSupportFragmentManager()) {
@Override
public Fragment createFragment(int position) {
switch (position) {
case 0:
return HomeFragment.newInstance();
case 1:
return ReportListFragment.newInstance();
default:
return MyFragment.newInstance();
}
}
@Override
public int getCount() {
return 2;
}
@Override
public CharSequence getPageTitle(int position) {
return "";
}
};
mViewPager.setAdapter(pagerAdapter);
mTabSegment.setupWithViewPager(mViewPager, false);
}
private void initTabs() {
QMUITabBuilder builder = mTabSegment.tabBuilder();
builder
.setSelectedIconScale(1.0f)
.setTextSize(QMUIDisplayHelper.sp2px(mContext, 14), QMUIDisplayHelper.sp2px(mContext, 14))
.setNormalIconSizeInfo(75, 75)
.setDynamicChangeIconColor(false);
QMUITab home = builder
.setNormalDrawable(ContextCompat.getDrawable(mContext, R.drawable.ic_normal_main))
.setSelectedDrawable(ContextCompat.getDrawable(mContext, R.drawable.ic_selected_main))
.setText(getString(R.string.main))
.build(mContext);
QMUITab report = builder
.setNormalDrawable(ContextCompat.getDrawable(mContext, R.drawable.ic_normal_report))
.setSelectedDrawable(ContextCompat.getDrawable(mContext, R.drawable.ic_selected_report))
.setText(getString(R.string.report))
.build(mContext);
// QMUITab my = builder
// .setNormalDrawable(ContextCompat.getDrawable(mContext, R.drawable.ic_normal_my))
// .setSelectedDrawable(ContextCompat.getDrawable(mContext, R.drawable.ic_selected_my))
// .setText(getString(R.string.my))
// .build(mContext);
mTabSegment.addTab(home)
.addTab(report);
// .addTab(my);
}
@Override
public void initIntent() {
}
@Override
public void initTopBar() {
// mTopBar.setBackgroundColor(ContextCompat.getColor(this, R.color.theme_color));
// mTopBar.addLeftBackImageButton().setVisibility(View.INVISIBLE);
// mTopBar.setTitle("首頁");
// mTopBar.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// CC.obtainBuilder(ComponentName.COMPONENT_TABLE)
// .setActionName("showTableActivity")
// .build()
// .call();
// }
// });
}
@Override
public void initLanguage() {
}
@Override
public void initLayoutParams() {
}
@Override
public void initLayoutVisible() {
}
@Override
public void showLoading(String message) {
}
@Override
public void hideLoading() {
}
@Override
public void showMessage(@NonNull String message) {
checkNotNull(message);
// ArmsUtils.snackbarText(message);
ToastUtils.show(mContext, message);
}
@Override
public void launchActivity(@NonNull Intent intent) {
checkNotNull(intent);
ArmsUtils.startActivity(intent);
}
@Override
public void killMyself() {
finish();
}
@Override
public void setFunctionAdapter(BaseAdapter adapter) {
// gv_function.setAdapter(adapter);
}
private long mExitTime;
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if ((System.currentTimeMillis() - mExitTime) > 2000) {
showMessage("再按一次退出應用");
mExitTime = System.currentTimeMillis();
} else {
finish();
System.exit(0);
}
return true;
}
return super.onKeyDown(keyCode, event);
}
}
......@@ -26,6 +26,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.billy.cc.core.component.CC;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.common.constans.AppConstans;
import com.gingersoft.gsa.cloud.common.constans.HttpsConstans;
import com.gingersoft.gsa.cloud.common.constans.ResultConstans;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.core.restaurant.bean.BrandsBean;
......@@ -38,7 +39,6 @@ import com.gingersoft.gsa.cloud.common.logan.LoganManager;
import com.gingersoft.gsa.cloud.common.service.IServiceManager;
import com.gingersoft.gsa.cloud.common.utils.AppDevices;
import com.gingersoft.gsa.cloud.common.utils.JsonUtils;
import com.gingersoft.gsa.cloud.common.utils.StytemUtils;
import com.gingersoft.gsa.cloud.common.utils.encryption.Aes;
import com.gingersoft.gsa.cloud.common.utils.other.SPUtils;
import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils;
......@@ -119,7 +119,7 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
@BindView(R2.id.tv_store_name)
TextView tvStoreName;
@BindView(R2.id.tv_version_name)
TextView tv_version_name;
TextView tvVersionName;
@BindView(R2.id.qm_refresh)
SmartRefreshLayout refresh;
@BindViews({R2.id.tv_function_name1, R2.id.tv_function_name2, R2.id.tv_function_name3})
......@@ -150,7 +150,6 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
// XFunctionManager.inJect(this, FunctionMain.class);
super.onCreate(savedInstanceState);
mPresenter.checkAppVersion();
mPresenter.syncRestaurantExtendedConfiguration();
......@@ -169,11 +168,11 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
@Override
public void initData(@Nullable Bundle savedInstanceState) {
// mPresenter.requestExternalStoragePermission();
//初始化側邊欄菜單項
initSideMenu();
FragmentManager fragmentManager = getSupportFragmentManager();
mainTopFragment = (MainTopFragment) fragmentManager.findFragmentById(R.id.main_top_fragment);
tvStoreName.setText(RestaurantInfoManager.newInstance().getRestaurantName());
refresh.setOnRefreshListener(refreshLayout -> {
......@@ -184,7 +183,6 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
}
});
refresh.setEnableLoadMore(false);
// initFuncationData();
updateTitleInfo();
//側滑顯示或關閉時,修改背景圓角
......@@ -205,10 +203,10 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
super.onResume();
initService();
initFuncationData();
if (((int) SPUtils.get("isFormal", 0)) != 0) {
tv_version_name.setText("v_" + DeviceUtils.getVersionName(this) + "\u3000Beta");
if (HttpsConstans.getIsFormal() != HttpsConstans.FORMAL) {
tvVersionName.setText("v_" + DeviceUtils.getVersionName(this) + "\u3000Beta");
} else {
tv_version_name.setText("v_" + DeviceUtils.getVersionName(this));
tvVersionName.setText("v_" + DeviceUtils.getVersionName(this));
}
}
......@@ -229,16 +227,10 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
private void initSideMenu() {
mRvSideMenu.setLayoutManager(new LinearLayoutManager(mContext));
List<MainSideMenuBean> mainSideMenuBeans = new ArrayList<>();
if (BuildConfig.DEBUG) {
// mainSideMenuBeans.add(new MainSideMenuBean(R.drawable.ic_setting, "複製Token"));
// mainSideMenuBeans.add(new MainSideMenuBean(R.drawable.ic_setting, "查看日誌"));
// mainSideMenuBeans.add(new MainSideMenuBean(R.drawable.ic_setting, "廚房單原圖"));
// mainSideMenuBeans.add(new MainSideMenuBean(R.drawable.ic_mall_center, "商城中心"));
mainSideMenuBeans.add(new MainSideMenuBean(R.drawable.ic_setting, "複製Token"));
mainSideMenuBeans.add(new MainSideMenuBean(R.drawable.ic_about_us, "關於我們"));
mainSideMenuBeans.add(new MainSideMenuBean(R.drawable.ic_password, "修改密碼"));
// mainSideMenuBeans.add(new MainSideMenuBean(R.drawable.ic_setting, "設置"));
// mainSideMenuBeans.add(new MainSideMenuBean(R.drawable.ic_setting, "查看日誌"));
mainSideMenuBeans.add(new MainSideMenuBean(R.drawable.ic_setting, "切換環境"));
}
mainSideMenuBeans.add(new MainSideMenuBean(R.drawable.ic_setting, "上傳日誌"));
......@@ -261,7 +253,6 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
.setActionName("switchServer")
.build()
.call();
// finish();
break;
case "複製Token":
String token;
......@@ -293,8 +284,7 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
case "上傳日誌":
LoganManager.uploadLog(mContext, true);
break;
case "廚房單原圖":
default:
break;
}
});
......@@ -334,7 +324,6 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
} else {
ll_staff_management.setVisibility(View.GONE);
}
// }
//將功能列表數據分組
SparseArray<String> parents = new SparseArray<>(3);
......
......@@ -28,16 +28,9 @@ import butterknife.BindView;
import butterknife.OnClick;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 03/04/2020 21:37
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
* Description: 清機頁面
*
* @author admin
*/
public class SettlementActivity extends BaseActivity<SettlementPresenter> implements SettlementContract.View {
......@@ -73,7 +66,6 @@ public class SettlementActivity extends BaseActivity<SettlementPresenter> implem
@Override
public void initData(@Nullable Bundle savedInstanceState) {
// tv_settlement_time.setVisibility(View.GONE);
mPresenter.getSettlementReport(mSettlementType);
}
......@@ -86,14 +78,12 @@ public class SettlementActivity extends BaseActivity<SettlementPresenter> implem
@Override
public void initTopBar() {
mTopBar.setBackgroundColor(ContextCompat.getColor(this, R.color.theme_color));
mTopBar.addLeftBackImageButton().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
killMyself();
}
mTopBar.addLeftBackImageButton().setOnClickListener(v -> killMyself());
mTopBar.addRightTextButton(R.string.str_history_record, R.id.mainId_history_record).setOnClickListener(v -> {
//清機歷史
startActivity(new Intent(mContext, LiquidationHistoryActivity.class));
});
mTopBar.setTitle(LanguageUtils.get_language_system( "funcSelect.settlement", "清機")).setTextColor(ArmsUtils.getColor(this, R.color.theme_white_color));
mTopBar.setTitle(LanguageUtils.get_language_system("funcSelect.settlement", "清機")).setTextColor(ArmsUtils.getColor(this, R.color.theme_white_color));
}
@OnClick({R2.id.btn_settlement_report})
......@@ -144,7 +134,7 @@ public class SettlementActivity extends BaseActivity<SettlementPresenter> implem
public void returnSettlementData(SettlementReport datasBean) {
this.mSettlementReportBean = datasBean;
if (mSettlementReportBean.getRestaurantOperation() != null) {
String lastSettlementText = LanguageUtils.get_language_system( "", "上次清機時間:");
String lastSettlementText = LanguageUtils.get_language_system("", "上次清機時間:");
setLastTime(lastSettlementText + TimeUtils.getStringByFormat(mSettlementReportBean.getRestaurantOperation().getOperationTime(), TimeUtils.DEFAULT_DATE_FORMAT));
}
}
......
package com.gingersoft.gsa.cloud.main.mvp.ui.adapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.main.R;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.LiquidationBean;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
/**
* @author 宇航. 1239658231@qq.com
* User: 宇航. 1239658231@qq.com
* Date: 2021/5/26
* Time: 18:23
* Use:
*/
public class LiquidationHistoryAdapter extends BaseQuickAdapter<LiquidationBean, BaseViewHolder> {
public LiquidationHistoryAdapter(@Nullable List<LiquidationBean> data) {
super(R.layout.item_liquidation_layout, data);
}
@Override
protected void convert(@NotNull BaseViewHolder viewHolder, LiquidationBean liquidationBean) {
viewHolder.setText(R.id.tv_liquidation_time, TimeUtils.getTime(liquidationBean.getCreateTime(), TimeUtils.DEFAULT_DATE_FORMAT));
viewHolder.setText(R.id.tv_liquidation_no, String.format(getContext().getString(R.string.str_clean_up_no), liquidationBean.getNo()));
}
}
......@@ -12,10 +12,10 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentActivity;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.common.utils.okhttpUtils.OkHttp3Utils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.main.R;
......@@ -25,7 +25,6 @@ import com.gingersoft.gsa.cloud.main.mvp.contract.MainTopContract;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.MainBusinessBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.MainOrderInfoChartBean;
import com.gingersoft.gsa.cloud.main.mvp.presenter.MainTopPresenter;
import com.gingersoft.gsa.cloud.main.mvp.ui.activity.MainActivity;
import com.gingersoft.gsa.cloud.main.mvp.ui.activity.NewMainActivity;
import com.gingersoft.gsa.cloud.main.mvp.ui.activity.ReportActivity;
import com.gingersoft.gsa.cloud.ui.AAChartCoreLib.AAChartConfiger.AAChartModel;
......@@ -54,16 +53,8 @@ import static com.jess.arms.utils.Preconditions.checkNotNull;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 02/18/2020 17:21
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
* Description:首頁頂部fragment
* @author admin
*/
public class MainTopFragment extends BaseFragment<MainTopPresenter> implements MainTopContract.View, View.OnClickListener {
private AAChartModel aaChartModel;
......@@ -100,8 +91,6 @@ public class MainTopFragment extends BaseFragment<MainTopPresenter> implements M
@BindView(R2.id.tv_bill_trend)
TextView tvBillTrend;//賬單數量較昨日上漲或下跌數量
private HomeFragment homeFragment;
public static MainTopFragment newInstance() {
MainTopFragment fragment = new MainTopFragment();
return fragment;
......@@ -126,7 +115,6 @@ public class MainTopFragment extends BaseFragment<MainTopPresenter> implements M
@Override
public void initData(@Nullable Bundle savedInstanceState) {
// getInfo();
time.setText(TimeUtils.getCurrentTimeInString(TimeUtils.DATE_FORMAT_YMDE));
}
......@@ -194,7 +182,7 @@ public class MainTopFragment extends BaseFragment<MainTopPresenter> implements M
}
@Subscriber(tag = "onRefreshReport")
private void onRefreshReport(boolean state){
private void onRefreshReport(boolean state) {
getInfo();
}
......@@ -347,7 +335,7 @@ public class MainTopFragment extends BaseFragment<MainTopPresenter> implements M
@Override
public void loadChart(List<MainOrderInfoChartBean.DataBean> dataBeans) {
// homeFragment.onFinishRefresh();//結束刷新
EventBus.getDefault().post(true,"onFinishRefresh");
EventBus.getDefault().post(true, "onFinishRefresh");
Object[] todayData = new Object[24];//今天的數據
Object[] yesterdayData = new Object[24];//昨天的數據
......@@ -397,6 +385,15 @@ public class MainTopFragment extends BaseFragment<MainTopPresenter> implements M
lineChart.aa_drawChartWithChartModel(aaChartModel);
}
@Override
public void onFinishRefresh() {
FragmentActivity activity = getActivity();
if (activity instanceof NewMainActivity) {
NewMainActivity mainActivity = (NewMainActivity) activity;
mainActivity.onFinishRefresh();
}
}
private int getTrendImg(double amount) {
if (amount >= 0) {
return R.drawable.ic_rise;
......@@ -413,8 +410,4 @@ public class MainTopFragment extends BaseFragment<MainTopPresenter> implements M
startActivity(new Intent(mContext, ReportActivity.class));
}
}
public void setHomeFragment(HomeFragment homeFragment) {
this.homeFragment = homeFragment;
}
}
<?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="match_parent"
android:orientation="vertical">
<include layout="@layout/include_main_topbar" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="@dimen/dp_10">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="清機日期"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_16" />
<com.gingersoft.gsa.cloud.main.mvp.ui.view.StartEndTimePickerView
android:id="@+id/sv_time_select"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_liquidation_history_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</LinearLayout>
\ No newline at end of file
......@@ -5,10 +5,7 @@
android:background="@color/white"
android:orientation="vertical">
<com.qmuiteam.qmui.widget.QMUITopBar
android:id="@+id/topbar"
android:layout_width="match_parent"
android:layout_height="@dimen/head_height" />
<include layout="@layout/include_main_topbar" />
<TextView
android:id="@+id/tv_settlement_time"
......
<?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="match_parent"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_title_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shape_main_title_bg"
android:paddingLeft="@dimen/dp_20"
android:paddingTop="@dimen/dp_7"
android:paddingRight="@dimen/dp_12"
android:paddingBottom="@dimen/dp_7"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_personal_center"
android:layout_width="@dimen/dp_37"
android:layout_height="@dimen/dp_37"
android:src="@drawable/ic_my"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_restaurant_name"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:text="店鋪名稱"
android:textColor="@color/white"
android:textSize="@dimen/dp_18"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:layout_width="@dimen/dp_24"
android:layout_height="@dimen/dp_26"
android:src="@drawable/ic_msg"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/qm_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/shape_main_bottom_corners_bg">
<com.gingersoft.gsa.cloud.ui.view.MyScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/dp_10">
<fragment
android:id="@+id/main_top_fragment"
android:name="com.gingersoft.gsa.cloud.main.mvp.ui.fragment.MainTopFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<com.lihang.ShadowLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/layout_ordering_meals"
android:layout_marginLeft="@dimen/dp_13"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_13"
app:hl_cornerRadius="@dimen/dp_4"
app:hl_shadowBackColor="@color/white"
app:hl_shadowLimit="@dimen/dp_0">
<!--管理-->
<LinearLayout
android:id="@+id/layout_management"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="@dimen/dp_16">
<LinearLayout
android:id="@+id/ll_management"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tv_function_name2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_15"
android:textColor="#181818"
android:textSize="@dimen/dp_14" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_management"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/main_recyclerview_marginLeft"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginRight="@dimen/main_recyclerview_marginRight" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/dp_1"
android:background="#F0F0F0"
android:visibility="gone" />
</LinearLayout>
<!-- 員工管理-->
<LinearLayout
android:id="@+id/ll_staff_management"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tv_function_name3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_20"
android:textColor="#181818"
android:textSize="@dimen/dp_14"
android:visibility="visible" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_staff_management"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/main_recyclerview_marginLeft"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/main_recyclerview_marginRight"
android:visibility="visible" />
</LinearLayout>
</LinearLayout>
</com.lihang.ShadowLayout>
<!-- 點餐模塊-->
<com.lihang.ShadowLayout
android:id="@+id/layout_ordering_meals"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/main_top_fragment"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:visibility="visible"
app:hl_cornerRadius="@dimen/dp_4"
app:hl_dy="@dimen/main_shadow_dy"
app:hl_shadowBackColor="@color/white"
app:hl_shadowColor="@color/shadow_color"
app:hl_shadowLimit="@dimen/main_shadow_limit">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="@dimen/dp_15"
android:paddingBottom="@dimen/dp_20">
<TextView
android:id="@+id/tv_function_name1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_22"
android:textColor="#181818"
android:textSize="@dimen/dp_17" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/dp_1"
android:layout_marginTop="@dimen/dp_11"
android:background="#F0F0F0" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_ordering_meals"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/main_recyclerview_marginLeft"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/main_recyclerview_marginRight" />
</LinearLayout>
</com.lihang.ShadowLayout>
</RelativeLayout>
</com.gingersoft.gsa.cloud.ui.view.MyScrollView>
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</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:id="@+id/side_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_15"
android:text="個人中心"
android:textColor="@color/white"
android:textSize="@dimen/dp_17" />
<ImageView
android:layout_width="@dimen/dp_76"
android:layout_height="@dimen/dp_76"
android:layout_marginTop="@dimen/dp_14"
android:src="@drawable/ic_header" />
<TextView
android:id="@+id/tv_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_6"
android:text="NAME"
android:textColor="@color/white"
android:textSize="@dimen/dp_20" />
<TextView
android:id="@+id/tv_store_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:gravity="center"
android:paddingLeft="@dimen/dp_3"
android:paddingRight="@dimen/dp_3"
android:text="店鋪名稱"
android:textColor="@color/white"
android:textSize="@dimen/dp_20" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_side_menu"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_20"
android:layout_weight="1"
android:visibility="visible" />
<LinearLayout
android:id="@+id/layout_login_out"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_45"
android:gravity="center_vertical|bottom"
android:orientation="horizontal">
<ImageView
android:layout_width="@dimen/dp_29"
android:layout_height="@dimen/dp_27"
android:layout_marginLeft="@dimen/dp_18"
android:src="@drawable/ic_loginout" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_6"
android:text="登出"
android:textColor="@color/white"
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>
<?xml version="1.0" encoding="utf-8"?>
<com.qmuiteam.qmui.widget.QMUITopBar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/topbar"
android:layout_width="match_parent"
android:layout_height="@dimen/head_height"
android:background="@color/theme_color"
app:qmui_topbar_left_back_drawable_id="@drawable/qmui_icon_topbar_back" />
\ 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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/dp_5">
<TextView
android:id="@+id/tv_liquidation_time_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/str_clean_up_time_colon"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_12"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_liquidation_time"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="@color/required_color"
android:textSize="@dimen/dp_12"
app:layout_constraintLeft_toRightOf="@id/tv_liquidation_time_text"
app:layout_constraintRight_toLeftOf="@id/tv_liquidation_details_text"
app:layout_constraintTop_toTopOf="parent"
tools:text="2021-05-06 21:59:18" />
<TextView
android:id="@+id/tv_liquidation_no"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_18"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/tv_liquidation_details_text"
app:layout_constraintTop_toBottomOf="@id/tv_liquidation_time_text"
tools:text="清機報表(10010)" />
<TextView
android:id="@+id/tv_liquidation_details_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:text="@string/str_details"
android:textColor="@color/theme_color"
android:textSize="@dimen/dp_14"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -2,4 +2,6 @@
<resources>
<item name="main_home_refresh" type="id"/>
<item name="main_home_msg" type="id"/>
<item name="mainId_history_record" type="id"/>
</resources>
\ No newline at end of file
......@@ -25,4 +25,8 @@
<string name="quit_system">退出系統</string>
<string name="format_one_point">%1$.1f</string>
<string name="str_history_record">歷史記錄</string>
<string name="str_clean_up_time_colon">清機時間:</string>
<string name="str_details">詳情></string>
<string name="str_clean_up_no">清機報表(%1$s)</string>
</resources>
package com.joe.print;
import android.content.Intent;
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.gingersoft.gsa.cloud.common.logan.LoganManager;
import com.gingersoft.gsa.cloud.component.ComponentName;
import com.joe.print.mvp.print.printerManger.PrjPtinterManager;
import com.joe.print.mvp.print.service.PrjService;
import com.joe.print.mvp.ui.activity.PrintActivity;
import com.joe.print.mvp.ui.activity.PrinterListActivity;
......@@ -68,8 +66,8 @@ public class PrintComponent implements IComponent {
CC.sendCCResult(cc.getCallId(), CCResult.success());
break;
case "getPrjData":
PrjPtinterManager.getInstance(cc.getContext()).initUsbPrint();
PrjPtinterManager.getInstance(cc.getContext()).getPrjInfo();
com.joe.print.mvp.print.printerManger.PrjPtinterManager.getInstance(cc.getContext()).initUsbPrint();
com.joe.print.mvp.print.printerManger.PrjPtinterManager.getInstance(cc.getContext()).getPrjInfo();
break;
default:
// cc.callAsync(new IComponentCallback() {
......
......@@ -225,13 +225,13 @@ public class PrjService extends Service implements ReceiveListener {
// private String prjJson = "{\"success\":true,\"sysTime\":1614581072400,\"data\":{\"K2\":[{\"id\":92701,\"printerDeviceId\":65,\"status\":2,\"tableName\":\"2\",\"orderNo\":\"0020\",\"orderTime\":2021,\"person\":2,\"number\":1,\"orderDetailsTime\":\"Mar 27, 2021 11:43:57 AM\",\"orderDetailsId\":59507759,\"productName\":\"海家酸菜魚 (辣)K2\",\"productName2\":\"\",\"productName3\":\"\",\"parentId\":0,\"type\":3,\"createTime\":1616816636920,\"productId\":63323,\"requests\":1,\"actualPrinterDeviceId\":65,\"orderType\":1,\"isFirstSendOrder\":2,\"quantity\":89,\"memberName\":\"BARRY1\"},{\"id\":92702,\"printerDeviceId\":65,\"status\":3,\"tableName\":\"2\",\"orderNo\":\"0020\",\"orderTime\":2021,\"person\":2,\"number\":1,\"orderDetailsTime\":\"Mar 27, 2021 11:43:57 AM\",\"orderDetailsId\":59507760,\"productName\":\"蓮藕\",\"parentId\":59507759,\"type\":4,\"createTime\":1616816636922,\"productId\":29923,\"requests\":1,\"actualPrinterDeviceId\":65,\"orderType\":1,\"isFirstSendOrder\":2,\"quantity\":89,\"memberName\":\"BARRY1\"},{\"id\":92703,\"printerDeviceId\":65,\"status\":3,\"tableName\":\"2\",\"orderNo\":\"0020\",\"orderTime\":2021,\"person\":2,\"number\":1,\"orderDetailsTime\":\"Mar 27, 2021 11:43:57 AM\",\"orderDetailsId\":59507761,\"productName\":\"腐竹\",\"parentId\":59507759,\"type\":4,\"createTime\":1616816636928,\"productId\":29928,\"requests\":1,\"actualPrinterDeviceId\":65,\"orderType\":1,\"isFirstSendOrder\":2,\"quantity\":89,\"memberName\":\"BARRY1\"},{\"id\":92704,\"printerDeviceId\":65,\"status\":3,\"tableName\":\"2\",\"orderNo\":\"0020\",\"orderTime\":2021,\"person\":2,\"number\":1,\"orderDetailsTime\":\"Mar 27, 2021 11:43:57 AM\",\"orderDetailsId\":59507762,\"productName\":\"木耳\",\"parentId\":59507759,\"type\":4,\"createTime\":1616816636934,\"productId\":29924,\"requests\":1,\"actualPrinterDeviceId\":65,\"orderType\":1,\"isFirstSendOrder\":2,\"quantity\":89,\"memberName\":\"BARRY1\"},{\"id\":92705,\"printerDeviceId\":65,\"status\":3,\"tableName\":\"2\",\"orderNo\":\"0020\",\"orderTime\":2021,\"person\":2,\"number\":1,\"orderDetailsTime\":\"Mar 27, 2021 11:43:57 AM\",\"orderDetailsId\":59507763,\"productName\":\"豆乾\",\"parentId\":59507759,\"type\":4,\"createTime\":1616816636939,\"productId\":29929,\"requests\":1,\"actualPrinterDeviceId\":65,\"orderType\":1,\"isFirstSendOrder\":2,\"quantity\":89,\"memberName\":\"BARRY1\"}]}}\n";
private void newPrint(String json) {
Map<String, List<PrjBean>> listMap = new HashMap<>();
int totalPrj = 0;
BaseResult prjBean = JsonUtils.parseObject(json, BaseResult.class);
if (prjBean == null || prjBean.getData() == null) {
LoganManager.w_printer(TAG, "newPrint prjBean == null || prjBean.getData() == null ");
return;
}
Map<String, List<PrjBean>> listMap = new HashMap<>();
//有數據,取消輪詢,等待打印結束。
// cancel(pollDisposable);
//開啟另一個定時,六十秒之後自動請求,避免上面的打印成功或失敗時沒有回調。
......@@ -409,36 +409,37 @@ public class PrjService extends Service implements ReceiveListener {
return;
}
PrinterFlowProxy.newInstance().dispatchPrinterDataBefore(orderType, PrintConstans.PRINT_KITCHEN, GsonUtils.GsonString(beans), GsonUtils.GsonString(printerDeviceBean));
if (isPinPrinter(printerDeviceBean) && printerDeviceBean.getPrinterDeviceType() == PRINT_IP) {
//針式打印
stylusPrinting(key, beans, printerDeviceBean);
} else if (printerDeviceBean.getPrinterDeviceType() == PRINT_PRJ_PC) {
//prj模式,生成文件到共享電腦上
prjToPc(beans, printerDeviceBean);
} else if (printerDeviceBean.getPrinterDeviceType() == PRINT_LOCAL && PrintConstans.PRINT_MODEL_WISEPOS.contains(Build.MODEL)) {
//本機打印並且是BBPOS
} else {
List<Map<String, Bitmap>> bitmapMaps = generatePrintMaps(key, beans, printerDeviceBean);
switch (printerDeviceBean.getPrinterDeviceType()) {
case PRINT_IP:
List<Map<String, Bitmap>> bitmapMaps = generatePrintMaps(key, beans, printerDeviceBean);
switch (printerDeviceBean.getPrinterDeviceType()) {
case PRINT_IP:
if (isPinPrinter(printerDeviceBean)) {
//針式打印
stylusPrinting(key, beans, printerDeviceBean);
} else {
LoganManager.w_printer(TAG, "開始IP打印-->");
//IP打印
ipPrint(printerDeviceBean, bitmapMaps);
break;
case PRINT_LOCAL:
}
break;
case PRINT_LOCAL:
if (PrintConstans.PRINT_MODEL_WISEPOS.contains(Build.MODEL)) {
//BBPOS
} else {
//本地N5或Sunmi打印
locationPrint(bitmapMaps);
break;
case PRINT_USB:
LoganManager.w_printer(TAG, "開始USB打印-->");
//USB打印
usbPrint(bitmapMaps);
break;
default:
break;
}
}
break;
case PRINT_USB:
LoganManager.w_printer(TAG, "開始USB打印-->");
//USB打印
usbPrint(bitmapMaps);
break;
case PRINT_PRJ_PC:
//prj模式,生成文件到共享電腦上
prjToPc(beans, printerDeviceBean);
break;
default:
break;
}
}
......
......@@ -601,7 +601,7 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
oldName = printerDeviceBean.getName();
final String newName = mEdPrintName.getText().toString().trim();
if (oldName.equals(newName)) {
if (newName.equals(oldName)) {
printerDeviceBean.setName("");
} else {
printerDeviceBean.setName(mEdPrintName.getText().toString().trim());
......
......@@ -38,6 +38,8 @@ public class ComponentScan implements IComponent {
switch (actionName) {
case "openScanActivity":
return openScanActivity(cc);
// openScanActivity(cc);
// break;
case "openMultiScanActivity":
CCUtil.navigateTo(cc, MultiScanCodeActivity.class);
return true;
......@@ -55,4 +57,8 @@ public class ComponentScan implements IComponent {
CCUtil.navigateTo(cc, MipcaCaptureActivity.class);
return true;
}
// private void openScanActivity(CC cc) {
// CCUtil.navigateTo(cc, MipcaCaptureActivity.class);
// CC.sendCCResult(cc.getCallId(), CCResult.success());
// }
}
......@@ -10,7 +10,6 @@ import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Parcel;
import android.os.VibrationEffect;
import android.os.Vibrator;
import android.provider.DocumentsContract;
......@@ -37,6 +36,7 @@ import com.google.zxing.DecodeHintType;
import com.google.zxing.FormatException;
import com.google.zxing.NotFoundException;
import com.google.zxing.RGBLuminanceSource;
import com.google.zxing.Reader;
import com.google.zxing.Result;
import com.google.zxing.common.HybridBinarizer;
import com.google.zxing.qrcode.QRCodeReader;
......@@ -47,6 +47,8 @@ import com.jess.arms.mvp.IView;
import com.jess.arms.utils.ArmsUtils;
import com.jess.arms.utils.Preconditions;
import com.qmuiteam.qmui.widget.QMUITopBar;
import com.xuexiang.rxutil2.rxjava.RxJavaUtils;
import com.xuexiang.rxutil2.rxjava.task.RxAsyncTask;
import java.util.Hashtable;
......@@ -54,6 +56,7 @@ import butterknife.BindView;
import butterknife.OnClick;
import cn.bingoogolapple.qrcode.core.BarcodeType;
import cn.bingoogolapple.qrcode.core.QRCodeView;
import cn.bingoogolapple.qrcode.zxing.QRCodeDecoder;
import cn.bingoogolapple.qrcode.zxing.ZXingView;
public class MipcaCaptureActivity extends BaseActivity<BasePresenter> implements IView, QRCodeView.Delegate {
......@@ -80,6 +83,8 @@ public class MipcaCaptureActivity extends BaseActivity<BasePresenter> implements
public final static String SCAN_MODE = "scanMode";
private BarcodeType navigateParam;
@Override
public void setupActivityComponent(@NonNull AppComponent appComponent) {
// DaggerMipcaCaptureComponent //如找不到该类,请编译一下项目
......@@ -98,7 +103,7 @@ public class MipcaCaptureActivity extends BaseActivity<BasePresenter> implements
@Override
public void initData(@Nullable Bundle savedInstanceState) {
mZXingView.setDelegate(this);
BarcodeType navigateParam = CCUtil.getNavigateParam(this, SCAN_MODE, BarcodeType.ALL);
navigateParam = CCUtil.getNavigateParam(this, SCAN_MODE, BarcodeType.ALL);
mZXingView.setType(navigateParam, null);
if (BarcodeType.ONE_DIMENSION == navigateParam) {
mZXingView.changeToScanBarcodeStyle();
......@@ -173,11 +178,11 @@ public class MipcaCaptureActivity extends BaseActivity<BasePresenter> implements
@OnClick({R2.id.btn_album})
public void onClick(View v) {
if (v.getId() == R.id.btn_album) {
if (Build.VERSION.SDK_INT >= 23) {
// if (!PermissionUtils.checkPermissionArray(this, needPermissions, ALBUM_REQUEST_CODE)) {
// return;
// }
}
// if (Build.VERSION.SDK_INT >= 23) {
//// if (!PermissionUtils.checkPermissionArray(this, needPermissions, ALBUM_REQUEST_CODE)) {
//// return;
//// }
// }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Intent openAlbumIntent = new Intent(Intent.ACTION_GET_CONTENT);
openAlbumIntent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*");
......@@ -187,6 +192,10 @@ public class MipcaCaptureActivity extends BaseActivity<BasePresenter> implements
intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*");
startActivityForResult(intent, PHOTOZOOM);
}
// Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
// intent.addCategory(Intent.CATEGORY_OPENABLE);
// intent.setType("image/*");
// startActivityForResult(intent, PHOTOZOOM);
}
}
......@@ -203,13 +212,35 @@ public class MipcaCaptureActivity extends BaseActivity<BasePresenter> implements
}
Uri uri = data.getData();
if (uri != null) {
Result result = parseQRcodeBitmap(uri);
if (result == null) {
showMessage("無法識別!");
killMyself();
return;
}
onScanQRCodeSuccess(result.getText());
// Result result = parseQRcodeBitmap(uri);
// String path = getPath(mContext, uri);
// if (path == null) {
// return;
// }
Bitmap scanBitmap = BitmapUtil.decodeUri(this, uri, 500, 500);
RxJavaUtils.executeAsyncTask(new RxAsyncTask<Bitmap, String>(scanBitmap) {
@Override
public String doInIOThread(Bitmap bitmap) {
return QRCodeDecoder.syncDecodeQRCode(bitmap);
}
@Override
public void doInUIThread(String result) {
if (result == null) {
showMessage("無法識別!");
killMyself();
return;
}
onScanQRCodeSuccess(result);
showMessage("扫描结果:" + result);
}
});
// if (result == null) {
// showMessage("無法識別!");
// killMyself();
// return;
// }
// onScanQRCodeSuccess(result.getText());
}
} else {
finish();
......@@ -218,10 +249,11 @@ public class MipcaCaptureActivity extends BaseActivity<BasePresenter> implements
@Override
public void showLoading(String message) {
if (message != null)
if (message != null) {
LoadingDialog.showDialogForLoading(this, message, true);
else
} else {
LoadingDialog.showDialogForLoading(this);
}
}
@Override
......@@ -258,9 +290,7 @@ public class MipcaCaptureActivity extends BaseActivity<BasePresenter> implements
Intent intent = new Intent();
intent.putExtra(QR_RESULT_CODE, result);
setResult(ScanHelper.CALL_BACK_QR_RESULT, intent);
CC.sendCCResult(CCUtil.getNavigateCallId(this), CCResult.success(QR_RESULT_CODE, result));
killMyself();
}
......@@ -294,6 +324,17 @@ public class MipcaCaptureActivity extends BaseActivity<BasePresenter> implements
return null;
}
Bitmap scanBitmap = BitmapUtil.decodeUri(this, uri, 500, 500);
RxJavaUtils.executeAsyncTask(new RxAsyncTask<Bitmap, String>(scanBitmap) {
@Override
public String doInIOThread(Bitmap bitmap) {
return QRCodeDecoder.syncDecodeQRCode(bitmap);
}
@Override
public void doInUIThread(String s) {
showMessage("扫描结果:" + s);
}
});
Hashtable<DecodeHintType, String> hints = new Hashtable<>();
// 设置二维码内容的编码
......@@ -307,7 +348,7 @@ public class MipcaCaptureActivity extends BaseActivity<BasePresenter> implements
//将图片转换成二进制图片
BinaryBitmap binaryBitmap = new BinaryBitmap(new HybridBinarizer(rgbLuminanceSource));
//初始化解析对象
QRCodeReader reader = new QRCodeReader();
Reader reader = new QRCodeReader();
scanBitmap.recycle();
//开始解析
Result result = null;
......
......@@ -18,7 +18,6 @@ import com.xuexiang.rxutil2.rxjava.RxJavaUtils;
import java.util.ArrayList;
import butterknife.BindView;
import io.reactivex.functions.Consumer;
/**
* 可選多次掃碼
......
......@@ -28,6 +28,11 @@ public class WarehouseDetailsBean implements Serializable {
private String purchase;
private String orderNo;
private int foodQuantity;
/**
* true:查詢過數量了。可以顯示數量
*/
private boolean queriesNumber = false;
private double totalPrice;
// private String createTime;
private String supplierName;
......@@ -62,9 +67,12 @@ public class WarehouseDetailsBean implements Serializable {
* 入庫詳情ids,逗號分隔
*/
private String warehousingOrderDetailsIds;
/**
* 入庫訂單編號
*/
private String warehousingOrderNo;
//入庫
public static final int TYPE_WAREHOUSING_TYPE = 0;
/**
* 出庫詳情ids,逗號分隔
*/
......
package com.gingersoft.supply_chain.mvp.contract;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
import java.util.Map;
import io.reactivex.Observable;
/**
* ================================================
......@@ -24,6 +29,6 @@ public interface InflowWaterContract {
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
Observable<BaseResult> getOutStockDetailsNumber(Map<String, Object> map);
}
}
......@@ -81,6 +81,9 @@ public interface WarehouseDetailsContract {
Observable<BaseResult> getOutStockDetails(Map<String, Object> map);
Observable<BaseResult> getOutStockDetailsNumber(Map<String, Object> map);
Observable<BaseResult> getWarehouseInventoryReason();
/**
......
......@@ -2,6 +2,8 @@ package com.gingersoft.supply_chain.mvp.model;
import android.app.Application;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.supply_chain.mvp.server.SupplierServer;
import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
......@@ -12,6 +14,10 @@ import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.InflowWaterContract;
import java.util.Map;
import io.reactivex.Observable;
/**
* ================================================
......@@ -43,4 +49,9 @@ public class InflowWaterModel extends BaseModel implements InflowWaterContract.M
this.mGson = null;
this.mApplication = null;
}
@Override
public Observable<BaseResult> getOutStockDetailsNumber(Map<String, Object> map) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).getOutStockDetailsNumber(map);
}
}
\ No newline at end of file
......@@ -62,6 +62,11 @@ public class WarehouseDetailsModel extends BaseModel implements WarehouseDetails
}
@Override
public Observable<BaseResult> getOutStockDetailsNumber(Map<String, Object> map) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).getOutStockDetailsNumber(map);
}
@Override
public Observable<BaseResult> getWarehouseInventoryReason() {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).getWarehouseInventoryReason();
}
......
......@@ -2,16 +2,31 @@ package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.supply_chain.mvp.bean.WarehouseDetailsBean;
import com.gingersoft.supply_chain.mvp.content.PurchaseConstant;
import com.google.gson.Gson;
import com.jess.arms.integration.AppManager;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.http.imageloader.ImageLoader;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.InflowWaterContract;
import com.jess.arms.utils.RxLifecycleUtils;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.HashMap;
import java.util.Map;
/**
......@@ -50,4 +65,33 @@ public class InflowWaterPresenter extends BasePresenter<InflowWaterContract.Mode
this.mImageLoader = null;
this.mApplication = null;
}
public void getOutStockDetailsNumber(WarehouseDetailsBean warehouseDetailsBean) {
Map<String, Object> map = new HashMap<>(1);
map.put("consumeOrderId", warehouseDetailsBean.getPurchaseConsumeNoId());
mModel.getOutStockDetailsNumber(map)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.GET_INFO_LOADING))
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(BaseResult baseResult) {
String data = GsonUtils.GsonString(baseResult.getData());
try {
JSONObject jsonObject = new JSONObject(data);
double sum = (double) jsonObject.get("sum");
warehouseDetailsBean.setQueriesNumber(true);
warehouseDetailsBean.setFoodQuantity((int) sum);
} catch (JSONException e) {
e.printStackTrace();
}
}
});
}
}
......@@ -9,31 +9,34 @@ import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.common.utils.view.BitmapUtil;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.DeputyUnitBean;
import com.gingersoft.supply_chain.mvp.bean.NoIsFoodSnTipBean;
import com.gingersoft.supply_chain.mvp.bean.OrderWareHouseBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodEncodeSn;
import com.gingersoft.supply_chain.mvp.bean.PurchaseOrderDetailsBean;
import com.gingersoft.supply_chain.mvp.bean.OrderWareHouseBean;
import com.gingersoft.supply_chain.mvp.bean.WareHousingUnitBean;
import com.gingersoft.supply_chain.mvp.content.PurchaseConstant;
import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart;
import com.google.gson.Gson;
import com.jess.arms.integration.AppManager;
import com.gingersoft.supply_chain.mvp.contract.OrderDetailsContract;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.RxLifecycleUtils;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.inject.Inject;
import io.reactivex.Observable;
import io.reactivex.ObservableEmitter;
import io.reactivex.ObservableOnSubscribe;
import io.reactivex.ObservableSource;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import io.reactivex.internal.operators.observable.ObservableCreate;
import io.reactivex.schedulers.Schedulers;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
......@@ -41,18 +44,6 @@ import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.OrderDetailsContract;
import com.jess.arms.utils.RxLifecycleUtils;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.gingersoft.supply_chain.mvp.content.PurchaseConstant.GET_INFO_ERROR;
import static com.gingersoft.supply_chain.mvp.content.PurchaseConstant.GET_INFO_LOADING;
import static com.gingersoft.supply_chain.mvp.content.PurchaseConstant.NULL_INFO_ERROR;
......@@ -287,7 +278,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
mRootView.killMyself();
} else if (baseResult.getData() != null) {
NoIsFoodSnTipBean noIsFoodSnTipBean = GsonUtils.GsonToBean(baseResult.getData(), NoIsFoodSnTipBean.class);
if(noIsFoodSnTipBean != null){
if (noIsFoodSnTipBean != null) {
mRootView.showMessage("食材SN編碼【" + noIsFoodSnTipBean.getList() + "】已存在,請刪除後重試!");
} else {
mRootView.showMessage(baseResult.getErrMsg());
......@@ -453,7 +444,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
@Override
public void onNext(@NonNull BaseResult info) {
if (info.isSuccess()) {
mRootView.showMessage(PurchaseConstant.DELETE_SUCCESS);
mRootView.showMessage(mApplication.getString(R.string.str_order_del_contact_supplier));
mRootView.killMyself();
}
}
......
......@@ -61,7 +61,7 @@ public class SnCodeListPresenter extends BasePresenter<SnCodeListContract.Model,
* @param warehousingOrderDetailsIds
*/
public void querySnCodeList(int infoType, String warehousingOrderDetailsIds) {
Map<String, Object> map = new HashMap<>();
Map<String, Object> map = new HashMap<>(2);
//入库SN编码查询 statesSn 0
//出库SN编码查询 statesSn 1
map.put("statesSn", infoType);
......@@ -70,7 +70,8 @@ public class SnCodeListPresenter extends BasePresenter<SnCodeListContract.Model,
map.put("warehousingEncodeSnIdList", warehousingOrderDetailsIds);
} else {
if (TextUtil.isEmptyOrNullOrUndefined(warehousingOrderDetailsIds)) {
mRootView.showMessage("出庫單號獲取失敗,請稍後重試");
mRootView.showMessage("出庫單號獲取失敗,請退出重試");
return;
} else {
//出庫傳這個
map.put("consumeEncodeSnIdList", warehousingOrderDetailsIds);
......
......@@ -437,6 +437,13 @@ public interface SupplierServer {
Observable<BaseResult> getOutStockDetails(@QueryMap Map<String, Object> map);
/**
* 查詢出庫流水的出庫數量
*/
@Headers({"Domain-Name: ricepon-purchase"})
@GET("purchaseFood/numberInventoryDetails" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> getOutStockDetailsNumber(@QueryMap Map<String, Object> map);
/**
* 查詢庫存消耗原因
*/
@Headers({"Domain-Name: ricepon-purchase"})
......
......@@ -51,42 +51,10 @@ public class WareHousingDetailsAdapter extends BaseQuickAdapter<WarehouseDetails
// if (item.getFoodQuantity() > 0) {
if (type == WarehouseDetailsFragment.WAREHOUSE_TYPE) {
// 入庫,顯示+
if (item.getFoodQuantity() >= 0) {
//如果大於0,前面顯示+號
viewHolder.setText(R.id.tv_warehouse_details_food_num, String.format(getContext().getString(R.string.str_format_positive_int), item.getFoodQuantity()));
} else {
//小於0,直接顯示負數
viewHolder.setText(R.id.tv_warehouse_details_food_num, String.valueOf(item.getFoodQuantity()));
}
if (TextUtil.isEmptyOrNullOrUndefined(item.getPurchaseTime()) && TextUtil.isNotEmptyOrNullOrUndefined(item.getWarehousingTime())) {
//下單時間為空,入庫時間不為空
//下單時間改為入庫時間,隱藏入庫時間控件
viewHolder.setText(R.id.tv_warehouse_order_time_text, String.format(getContext().getString(R.string.str_format_warehousing_date), item.getWarehousingTime()));
viewHolder.setGone(R.id.tv_warehouse_time_text, true);
} else {
viewHolder.setText(R.id.tv_warehouse_order_time_text, String.format(getContext().getString(R.string.str_format_order_date), item.getPurchaseTime()));
viewHolder.setText(R.id.tv_warehouse_time_text, String.format(getContext().getString(R.string.str_format_warehousing_date), item.getWarehousingTime()));
viewHolder.setGone(R.id.tv_warehouse_time_text, false);
}
viewHolder.setGone(R.id.tv_warehouse_details_remarks, true);
setWarehousingData(viewHolder, item);
} else {
//出庫,顯示-
if (item.getFoodQuantity() >= 0) {
//如果大於0,前面顯示-號
viewHolder.setText(R.id.tv_warehouse_details_food_num, String.format(getContext().getString(R.string.str_format_less), item.getFoodQuantity() + ""));
} else {
//小於0,顯示正數,負負得正
viewHolder.setText(R.id.tv_warehouse_details_food_num, String.format(getContext().getString(R.string.str_format_positive), Math.abs(item.getFoodQuantity()) + ""));
}
// 入庫顯示消耗日期,不顯示入庫日期
viewHolder.setGone(R.id.tv_warehouse_time_text, true);
//消耗日期
viewHolder.setText(R.id.tv_warehouse_order_time_text, String.format(getContext().getString(R.string.str_format_consumption_date), item.getPurchaseTime()));
//顯示備註
viewHolder.setGone(R.id.tv_warehouse_details_remarks, false);
if (TextUtil.isNotEmptyOrNullOrUndefined(item.getRemarks())) {
viewHolder.setText(R.id.tv_warehouse_details_remarks, String.format(getContext().getString(R.string.str_format_remark_colon), item.getRemarks()));
}
setOutStockData(viewHolder, item);
}
//供應商
viewHolder.setText(R.id.tv_warehouse_details_supplier, item.getSupplierName());
......@@ -128,6 +96,58 @@ public class WareHousingDetailsAdapter extends BaseQuickAdapter<WarehouseDetails
}
}
/**
* 設置出庫數據
*/
private void setOutStockData(@NotNull BaseViewHolder viewHolder, WarehouseDetailsBean item) {
if (!item.isQueriesNumber()) {
viewHolder.setGone(R.id.tv_warehouse_details_food_num, true);
} else {
viewHolder.setGone(R.id.tv_warehouse_details_food_num, false);
if (item.getFoodQuantity() >= 0) {
//如果大於0,前面顯示-號
viewHolder.setText(R.id.tv_warehouse_details_food_num, String.format(getContext().getString(R.string.str_format_less), item.getFoodQuantity() + ""));
} else {
//小於0,顯示正數,負負得正
viewHolder.setText(R.id.tv_warehouse_details_food_num, String.format(getContext().getString(R.string.str_format_positive), Math.abs(item.getFoodQuantity()) + ""));
}
// 入庫顯示消耗日期,不顯示入庫日期
viewHolder.setGone(R.id.tv_warehouse_time_text, true);
//消耗日期
viewHolder.setText(R.id.tv_warehouse_order_time_text, String.format(getContext().getString(R.string.str_format_consumption_date), item.getPurchaseTime()));
//顯示備註
viewHolder.setGone(R.id.tv_warehouse_details_remarks, false);
if (TextUtil.isNotEmptyOrNullOrUndefined(item.getRemarks())) {
viewHolder.setText(R.id.tv_warehouse_details_remarks, String.format(getContext().getString(R.string.str_format_remark_colon), item.getRemarks()));
}
}
}
/**
* 設置入庫數據
*/
private void setWarehousingData(@NotNull BaseViewHolder viewHolder, WarehouseDetailsBean item) {
if (item.getFoodQuantity() >= 0) {
//如果大於0,前面顯示+號
viewHolder.setText(R.id.tv_warehouse_details_food_num, String.format(getContext().getString(R.string.str_format_positive_int), item.getFoodQuantity()));
} else {
//小於0,直接顯示負數
viewHolder.setText(R.id.tv_warehouse_details_food_num, String.valueOf(item.getFoodQuantity()));
}
if (TextUtil.isEmptyOrNullOrUndefined(item.getPurchaseTime()) && TextUtil.isNotEmptyOrNullOrUndefined(item.getWarehousingTime())) {
//下單時間為空,入庫時間不為空
//下單時間改為入庫時間,隱藏入庫時間控件
viewHolder.setText(R.id.tv_warehouse_order_time_text, String.format(getContext().getString(R.string.str_format_warehousing_date), item.getWarehousingTime()));
viewHolder.setGone(R.id.tv_warehouse_time_text, true);
} else {
viewHolder.setText(R.id.tv_warehouse_order_time_text, String.format(getContext().getString(R.string.str_format_order_date), item.getPurchaseTime()));
viewHolder.setText(R.id.tv_warehouse_time_text, String.format(getContext().getString(R.string.str_format_warehousing_date), item.getWarehousingTime()));
viewHolder.setGone(R.id.tv_warehouse_time_text, false);
}
viewHolder.setGone(R.id.tv_warehouse_details_remarks, true);
}
private void setExpiresTime(TextView tvExpiresTime, int p, String s, int distanceExpiresTime) {
tvExpiresTime.setBackground(ContextCompat.getDrawable(getContext(), p));
tvExpiresTime.setText(s + distanceExpiresTime + "日");
......
......@@ -31,8 +31,6 @@ import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.WarehousingOrderLis
import com.gingersoft.supply_chain.mvp.ui.widget.UpdateRestaurantInfoPop;
import com.jess.arms.di.component.AppComponent;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.impl.ConfirmPopupView;
import com.lxj.xpopup.interfaces.OnConfirmListener;
import com.qmuiteam.qmui.widget.QMUITopBar;
import java.util.ArrayList;
......
......@@ -207,17 +207,15 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
mPresenter.deleteFoodCategory(foodCategoryTrees, currentLevel, position);
});
});
new XPopup.Builder(getContext())
.asCustom(categoryPopup.setListener(() -> {
//修改分類
if (TextUtil.isEmptyOrNullOrUndefined(categoryPopup.getEditText())) {
showMessage(getString(R.string.str_please_input_category_name));
return;
}
mPresenter.updateFoodCategory(mPresenter.toFoodCategoryBean(foodCategoryTrees.getParentId(), TextUtil.getNotNullStrAndTrim(categoryPopup.getEditText().getText().toString()), foodCategoryTrees.getId()), currentLevel, position);
}, () -> {
}))
.show();
categoryPopup.setListener(() -> {
//修改分類
if (TextUtil.isEmptyOrNullOrUndefined(categoryPopup.getEditText())) {
showMessage(getString(R.string.str_please_input_category_name));
return;
}
mPresenter.updateFoodCategory(mPresenter.toFoodCategoryBean(foodCategoryTrees.getParentId(), TextUtil.getNotNullStrAndTrim(categoryPopup.getEditText().getText().toString()), foodCategoryTrees.getId()), currentLevel, position);
}, ()->{});
AppDialog.getInstance().showCustomPop(requireContext(), categoryPopup);
}
/**
......@@ -558,7 +556,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
//沒有一級分類了
//清除二級三級分類
secondCategoryAdapter.setList(null);
secondCategoryAdapter.setList(null);
thirdCategoryAdapter.setList(null);
setSecondCategoryVisibility();
}
} else if (type == PurchaseConstant.UPDATE) {
......@@ -591,6 +589,8 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
private void updateChildCategory(FoodCategoryAdapter adapter, int type, int hierarchy, String categoryName, int position) {
if (type == PurchaseConstant.DELETE) {
adapter.removeAt(position);
//這裡之所以刷新所有,是為了重新刷新高度
adapter.notifyDataSetChanged();
if (hierarchy == mPresenter.secondCategoryTag) {
thirdCategoryAdapter.setNewInstance(null);
//如果是二級分類,還需要判斷如果分類數量為0時,就不顯示三級分類
......
......@@ -68,6 +68,7 @@ import static com.gingersoft.supply_chain.mvp.ui.fragment.food.NewFoodIngredient
/**
* Description: 選購食材
*
* @author admin
*/
public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredientsPresenter>
......@@ -126,6 +127,8 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
ClassicsHeader classicsHeader;
@BindView(R2.id.tv_select_food_size)
TextView tvSelectFoodSize;
@BindView(R2.id.layout_food_ingredients_top)
LinearLayout mLayoutFoodSearch;
/**
* 購物車數量textview
*/
......@@ -222,65 +225,24 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
* 根據類型加載數據
*/
protected void loadDataByType() {
// if (pageType == GET_FOOD_BY_SUPPLIER) {
// Bundle arguments = getArguments();
// if (arguments != null) {
// int supplierId = arguments.getInt(supplierIdKey);
// String supplierName = arguments.getString(supplierNameKey);
// //設置標題為這個供應商名字
// topbarFoodIngredients.setTitle(supplierName);
// //設置左側顯示數據
// OrderCategoryBean.FoodCategoryTrees supplierToCategory = new OrderCategoryBean.FoodCategoryTrees(supplierId, supplierName, 0);
// //只顯示一個供應商信息,所以隱藏左邊側邊欄
// layoutIngredientsLeft.setVisibility(View.GONE);
// //將顯示模式設置為顯示供應商
// isShowSupplier = true;
// //隱藏二級分類
// setSecondCategoryShowState(View.GONE);
// mPresenter.initSupplierFoods(1);
// //在一級分類中加載食品信息
// initCategoryInfo(Collections.singletonList(supplierToCategory));
// } else {
// killMyself();
// }
// } else {
setSecondCategoryShowState(View.VISIBLE);
//獲取一級分類
mPresenter.getCategoryTrees();
// }
}
protected void initTopBar() {
// if (pageType == FOOD_INGREDIENTS || pageType == GET_FOOD_BY_WAREHOUSING_ORDER) {
// initTopBar(topbarFoodIngredients, "食材管理");
// topbarFoodIngredients.addRightImageButton(R.drawable.ic_circle_new_food_ingredient, R.id.qmui_add_new_food_ingredients).setOnClickListener(v -> {
// //新增食材
// toCreateFood();
// });
// } else {
initTopBar(topbarFoodIngredients, "採購單");
initTopBar(topbarFoodIngredients, getString(R.string.str_title_purchase_order));
View view = View.inflate(requireContext(), R.layout.view_shopping_car, null);
tvShoppingCart = view.findViewById(R.id.tv_purchase_cart_number);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT);
view.setLayoutParams(layoutParams);
view.setOnClickListener(this);
topbarFoodIngredients.addRightView(view, R.id.qmui_shopping_cart);
// }
}
protected void initPage() {
// if (pageType == FOOD_INGREDIENTS) {
// layoutFoodIngredientsBtn.setVisibility(View.GONE);
// btnNewFoodIngredient.setVisibility(View.VISIBLE);
// layoutChooseSize.setVisibility(View.GONE);
// } else if (pageType == GET_FOOD_BY_WAREHOUSING_ORDER) {
// //創建入庫單
// layoutChooseSize.setVisibility(View.VISIBLE);
// btnFoodIngredientsCancel.setVisibility(View.GONE);
// } else {
layoutChooseSize.setVisibility(View.GONE);
layoutFoodIngredientsBtn.setVisibility(View.VISIBLE);
// }
}
/**
......@@ -479,22 +441,8 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
protected void confirm() {
List<PurchaseFoodBean> purchaseFood = mPresenter.getPurchaseFood();
if (CollectionUtils.isNotNullOrEmpty(purchaseFood)) {
// if (pageType == GET_FOOD_BY_WAREHOUSING_ORDER) {
// //採購入庫單
// setFragmentResult(RESULT_OK, null);
// List<Fragment> fragments = requireActivity().getSupportFragmentManager().getFragments();
// for (Fragment fragment : fragments) {
// if (fragment instanceof WarehousingOrderDetailsFragment) {
// //有入庫單詳情
// killMyself();
// return;
// }
// }
// //沒入庫單詳情
// startWithPop(WarehousingOrderDetailsFragment.newInstance(-1, ""));
// } else {
startForResult(ShoppingCatFragment.newInstance(), TO_SHOPPING_CART_REQUEST_CODE);
// }
setFragmentResult(RESULT_OK, null);
} else {
showMessage("請選擇食材");
}
......@@ -511,7 +459,6 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
fullRegister.showSuccess();
if (firstLevelCategoryAdapter == null) {
firstLevelCategoryAdapter = new FirstLevelCategoryAdapter(foodCategoryTrees, requireContext());
// .setIsShowNumber(pageType == ADD_ORDER || pageType == GET_FOOD_BY_WAREHOUSING_ORDER);
rvFirstCategory.setAdapter(firstLevelCategoryAdapter);
firstLevelCategoryAdapter.setOnItemClickListener((adapter, view, position) -> {
firstCategoryClick(position);
......@@ -632,13 +579,6 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
@Override
public void loadFood(List<BuyIngredientsBean> buyIngredientsBeans, boolean addToHead, boolean isReset) {
setRefreshState(false);
// if (pageType == GET_FOOD_BY_SUPPLIER) {
// if (buyIngredientsBeans == null || CollectionUtils.isNullOrEmpty(buyIngredientsBeans.get(0).purchaseFoodList)) {
// //如果是單個供應商,需要判斷食材是不是為空
// fullRegister.showCallback(NotGoodsCallback.class);
// return;
// }
// }
fullRegister.showSuccess();
if (adapter == null) {
adapter = new BuyIngredientsAdapter(requireContext(), buyIngredientsBeans);
......@@ -696,9 +636,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
endIndex += buyIngredientsBean.purchaseFoodList.size() + 1;
}
endIndex += startIndex;
Log.e("eee", "開始:" + startIndex + "結束:" + endIndex);
adapter.addData(addToHead ? 0 : adapter.getData().size(), buyIngredientsBeans, startIndex, endIndex);
// adapter.setList(buyIngredientsBeans);
}
}
}
......
......@@ -253,7 +253,6 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI
if (data != null) {
Uri uri = data.getData();
if (uri != null) {
//有報錯
File file = SelectPicture.getInstance().uriToFileApiQ(requireContext(), uri);
if (file == null) {
showMessage("圖片已損壞,請重新選擇圖片");
......
......@@ -200,7 +200,7 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
if (orderState == PurchaseOrderDetailsBean.COMPLETE_RECEIVED) {
functions = new String[]{"再來一單"};
} else {
functions = new String[]{"再來一單", "删除", "部分收貨", "收貨"};
functions = new String[]{"再來一單", "删除訂單", "部分收貨", "全部收貨"};
}
new XPopup.Builder(mContext)
.atView(v)
......@@ -236,7 +236,7 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
if (data.isChecked()) {
AppDialog.getInstance().showTipDialog(requireContext(), getString(R.string.str_confirm_receipt), () -> {
mPresenter.addWarehouse(state, edRemark.getText() + "", totalAmount, orderDetailsFoodAdapter.getData());
setFragmentResult(RESULT_OK, null);
setBackResult();
});
return;
}
......@@ -255,6 +255,7 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
showMessage("有已收貨食材,訂單不可刪除");
return;
}
setBackResult();
AppDialog.getInstance().showWaringDialog(mContext, "是否刪除訂單", () -> mPresenter.deleteOrder());
} else if (position == 2) {
//部分收貨
......@@ -265,6 +266,9 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
}
};
private void setBackResult(){
setFragmentResult(RESULT_OK, null);
}
/**
* 加載訂單詳情
*
......@@ -422,6 +426,7 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
@Override
public void buyAgain() {
setBackResult();
startWithPop(ShoppingCatFragment.newInstance());
}
......@@ -558,8 +563,8 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
* @param infoVosBean 食材信息
*/
private void isNeedQuerySn(int position, PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean infoVosBean, boolean singerFood) {
if (infoVosBean.getStatus() == PurchaseOrderDetailsBean.WAIT_RECEIVED) {
//沒收過貨的
if (infoVosBean.getStatus() == PurchaseOrderDetailsBean.WAIT_RECEIVED || CollectionUtils.isNotNullOrEmpty(infoVosBean.getPurchaseFoodEncodeSns())) {
//沒收過貨的,並且有SN碼
showScanPopup(position, infoVosBean, singerFood);
} else {
//收過貨的,需要查詢sn碼
......@@ -627,11 +632,11 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
//本次收貨數量=新增掃sn碼數量
DeputyUnitBean showUnit = infoVosBean.getShowUnit();
showUnit.setDeputyValue(newAddSize);
if (newAddSize > 0) {
// if (newAddSize > 0) {
setFoodCheckState(orderDetailsFoodAdapter, position, infoVosBean);
} else {
showMessage("收貨數量必須大於0");
}
// } else {
// showMessage("收貨數量必須大於0");
// }
scanSnPopup.dismissOrHideSoftInput();
if (!scanSnPopup.isDismiss()) {
scanSnPopup.dismiss();
......
......@@ -321,13 +321,13 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
@Override
public void deleteOrder(int position) {
purchaseOrderAdapter.removeAt(position);
showMessage("訂單已刪除,請打電話聯繫供應商訂單刪除!");
showMessage(getString(R.string.str_order_del_contact_supplier));
}
@Override
public void onFragmentResult(int requestCode, int resultCode, Bundle data) {
super.onFragmentResult(requestCode, resultCode, data);
if (requestCode == REQUEST_ORDER_DETAILS_CODE) {
if (requestCode == REQUEST_ORDER_DETAILS_CODE && resultCode == RESULT_OK) {
//用戶對訂單進行了操作,需要對列表進行刷新
pageIndex = 0;
getOrderList();
......
......@@ -175,7 +175,6 @@ public class SendMsgFragment extends BaseSupplyChainFragment<SendMsgPresenter> i
}
//沒有訂單列表
startWithPop(PurchaseListFragment.newInstance());
// startWithPopTo(PurchaseListFragment.newInstance(), this, false);
}
private boolean isSend = false;
......
......@@ -76,10 +76,22 @@ public class InflowWaterFragment extends BaseSupplyChainFragment<InflowWaterPres
if (wareHousingDetailsAdapter == null) {
wareHousingDetailsAdapter = new WareHousingDetailsAdapter(warehouseDetailsBeans, currentIndex);
wareHousingDetailsAdapter.setOnItemClickListener((adapter, view, position) -> {
if (purchaseWarehousingOrderDetailsVO.getFoodMarkSn() == PurchaseFoodBean.HAS_SN) {
//SN食材
BaseFragmentActivity fragmentActivity = (BaseFragmentActivity) requireActivity();
fragmentActivity.start(SnCodeListFragment.newInstance(currentIndex, wareHousingDetailsAdapter.getItem(position)));
WarehouseDetailsBean item = wareHousingDetailsAdapter.getItem(position);
if (currentIndex == WarehouseDetailsFragment.WAREHOUSE_TYPE) {
//入庫
if (purchaseWarehousingOrderDetailsVO.getFoodMarkSn() == PurchaseFoodBean.HAS_SN) {
//SN食材
BaseFragmentActivity fragmentActivity = (BaseFragmentActivity) requireActivity();
fragmentActivity.start(SnCodeListFragment.newInstance(currentIndex, item));
}
} else {
//出庫,如果是SN,進入SN列表,如果不是,就查詢出庫數量
if (purchaseWarehousingOrderDetailsVO.getFoodMarkSn() == PurchaseFoodBean.HAS_SN) {
} else if(!item.isQueriesNumber()){
//如果不是SN食材並且沒有查詢過數量
mPresenter.getOutStockDetailsNumber(item);
}
}
});
recyclerView.setAdapter(wareHousingDetailsAdapter);
......
......@@ -168,6 +168,11 @@ public class WareHouseListFragment extends BaseSupplyChainFragment<WareHouseList
public void finishLoadNoMoreData() {
mTableView.freshAndLoadSuccess();
mTableView.loadMoreSuccessWithNoMoreData();
if (warehousingQueryAdapter == null || warehousingQueryAdapter.getItemCount() <= 0) {
loadService.showCallback(EmptyCallback.class);
} else {
loadService.showSuccess();
}
}
@Override
......
......@@ -255,7 +255,7 @@ public class WarehousingOrderDetailsFragment extends BaseSupplyChainFragment<War
mPresenter.createWarehousingOrder(edRemark.getText().toString());
}
@OnClick(R2.id.tv_order_confirm)
@OnClick({R2.id.tv_order_cancel, R2.id.tv_order_confirm})
@Override
public void onClick(View v) {
int vId = v.getId();
......
package com.gingersoft.supply_chain.mvp.ui.widget;
import android.content.Context;
import android.text.Editable;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ImageView;
......@@ -26,6 +27,8 @@ import com.lxj.xpopup.util.KeyboardUtils;
import com.qmuiteam.qmui.layout.QMUIButton;
import com.qmuiteam.qmui.widget.textview.QMUISpanTouchFixTextView;
import org.w3c.dom.Text;
import butterknife.BindView;
import butterknife.ButterKnife;
......@@ -137,8 +140,24 @@ public class GoodsDetailsPopup extends CenterPopupView {
foodNumberChange(1);
}
});
edFoodIngredientNumber.setOnFocusChangeListener((v, hasFocus) -> {
if (!hasFocus) {
//失去焦點時調用
Editable text = edFoodIngredientNumber.getText();
if (TextUtil.isNotEmptyOrNullOrUndefined(text)) {
int foodQuantity = Integer.parseInt(text.toString());
foodNumberChange(foodQuantity - hasFocusNum);
} else {
foodNumberChange(-purchaseFoodBean.getFoodQuantity());
}
} else {
hasFocusNum = purchaseFoodBean.getFoodQuantity();
}
});
}
private int hasFocusNum;
public GoodsDetailsPopup setEditNumber(boolean editNumber) {
isEditNumber = editNumber;
return this;
......@@ -210,6 +229,9 @@ public class GoodsDetailsPopup extends CenterPopupView {
}
private void foodNumberChange(int changeNum) {
if (changeNum == 0) {
return;
}
purchaseFoodBean.setFoodQuantity(purchaseFoodBean.getFoodQuantity() + changeNum);
edFoodIngredientNumber.setText(String.valueOf(purchaseFoodBean.getFoodQuantity()));
if (onFoodNumberChangeListener != null) {
......
......@@ -43,11 +43,7 @@ public class NewAddCategoryPopup extends ConfirmPopupView {
tvDelete.setOnClickListener(onDeleteListener);
et_input = findViewById(R.id.et_input);
if (TextUtil.isNotEmptyOrNullOrUndefined(inputText)) {
// if (inputText.length() > nameMaxLength) {
// et_input.setText(inputText.substring(0, 4));
// } else {
et_input.setText(inputText);
// }
et_input.setText(inputText);
et_input.setSelection(et_input.length());
}
et_input.setFilters(new InputFilter[]{InputFilterUtils.getLengthFilter(getContext(), 100), InputFilterUtils.getChAndEnAndNumAndPtInputFilter(getContext())});
......
......@@ -57,6 +57,8 @@ public class UpdateRestaurantInfoPop extends ConfirmPopupView {
protected void onCreate() {
super.onCreate();
ButterKnife.bind(this);
edBrandInput.setText(String.valueOf(PurchaseConstant.getBrandId()));
edRestaurantInput.setText(String.valueOf(PurchaseConstant.getRestaurantId()));
tvConfirm.setOnClickListener(v -> {
RestaurantInfoManager.newInstance().setBrandInfo(new BrandInfo(Integer.parseInt(Objects.requireNonNull(edBrandInput.getText()).toString()), ""));
RestaurantInfoManager.newInstance().setResturantInfo(new RestaurantInfo(Integer.parseInt(String.valueOf(edRestaurantInput.getText())), "", ""));
......
......@@ -17,10 +17,12 @@ import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import com.gingersoft.gsa.cloud.common.utils.FileUtils;
import com.gingersoft.gsa.cloud.common.utils.XPermissionUtils;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils;
import com.gingersoft.gsa.cloud.ui.utils.AppDialog;
import com.permissionx.guolindev.PermissionX;
import com.permissionx.guolindev.callback.RequestCallback;
import com.yalantis.ucrop.UCrop;
import java.io.File;
......@@ -29,6 +31,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @author 宇航.
......@@ -65,7 +68,7 @@ public class SelectPicture {
public void showSelectType(Fragment fragment) {
//拍照或者選擇圖片
PermissionX.init(fragment).permissions(Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE)
.onExplainRequestReason((scope, deniedList) -> scope.showRequestReasonDialog(deniedList, "上傳圖片需要讀取文件權限", "確定", "取消"))
.onExplainRequestReason((scope, deniedList) -> scope.showRequestReasonDialog(deniedList, "获取圖片需要讀取文件權限", "確定", "取消"))
.onForwardToSettings((scope, deniedList) -> scope.showForwardToSettingsDialog(deniedList, "您需要去設置當中開啟讀取文件權限", "確定", "取消"))
.request((allGranted, grantedList, deniedList) -> showPictureChoice(fragment));
}
......@@ -78,7 +81,7 @@ public class SelectPicture {
public void showSelectType(FragmentActivity activity) {
//拍照或者選擇圖片
PermissionX.init(activity).permissions(Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE)
.onExplainRequestReason((scope, deniedList) -> scope.showRequestReasonDialog(deniedList, "上傳圖片需要讀取文件權限", "確定", "取消"))
.onExplainRequestReason((scope, deniedList) -> scope.showRequestReasonDialog(deniedList, "获取圖片需要讀取文件權限", "確定", "取消"))
.onForwardToSettings((scope, deniedList) -> scope.showForwardToSettingsDialog(deniedList, "您需要去設置當中開啟讀取文件權限", "確定", "取消"))
.request((allGranted, grantedList, deniedList) -> showPictureChoice(activity));
}
......@@ -89,15 +92,24 @@ public class SelectPicture {
public void showPictureChoice(Fragment fragment) {
AppDialog.getInstance().showListDialog(fragment.requireContext(), items, (view, dialog, position) -> {
if (position == 0) {
takePhoto(fragment);
XPermissionUtils.launchCamera(fragment, (allGranted, grantedList, deniedList) -> {
if (allGranted) {
takePhoto(fragment);
}
});
} else if (position == 1) {
Intent intentToPickPic = new Intent(Intent.ACTION_PICK, null);
intentToPickPic.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*");
fragment.startActivityForResult(intentToPickPic, CHOOSE_PHOTO);
selectPicture(fragment);
}
});
}
private void selectPicture(Fragment fragment) {
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("image/*");
fragment.startActivityForResult(intent, CHOOSE_PHOTO);
}
/**
* 顯示照片選擇
*/
......@@ -144,7 +156,6 @@ public class SelectPicture {
if (takePictureIntent.resolveActivity(fragment.requireContext().getPackageManager()) != null) {
File photoFile;
photoFile = createImageFile(fragment.requireContext());
// currentPhotoPath = image.getAbsolutePath();
mCameraUri = Uri.fromFile(photoFile);
try {
Uri photoUri = FileProvider.getUriForFile(fragment.requireActivity(),
......
......@@ -70,7 +70,6 @@
android:gravity="left|center_vertical"
android:hint="請輸入類別名稱"
android:inputType="text|textCapWords"
android:maxLength="4"
android:paddingLeft="@dimen/new_category_dialog_marginLeft"
android:paddingRight="@dimen/new_category_dialog_marginLeft"
android:textColor="@color/color_3c"
......
......@@ -32,7 +32,8 @@
android:layout_marginTop="@dimen/dp_4"
android:layout_marginRight="@dimen/dp_10"
android:gravity="center_vertical"
android:orientation="horizontal">
android:orientation="horizontal"
android:visibility="gone">
<LinearLayout
android:id="@+id/layout_food_ingredients_search"
......@@ -209,6 +210,7 @@
android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_10"
android:visibility="gone"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -303,7 +305,7 @@
android:layout_marginTop="@dimen/dp_5"
android:layout_marginBottom="@dimen/dp_5"
android:layout_weight="1"
android:text="取消"/>
android:text="取消" />
</LinearLayout>
</RelativeLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
......
......@@ -151,20 +151,26 @@
app:srlAccentColor="@color/theme_333_color"
app:srlEnablePreviewInEditMode="true"
app:srlPrimaryColor="@color/trans">
<!-- 這裡多用一個lineaarlayout是因為需要給消耗的視圖留位置-->
<LinearLayout
android:id="@+id/layout_warehousing_root"
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:orientation="vertical">
android:layout_height="match_parent">
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/vp_warehouse_viewpager"
<!-- 這裡多用一個lineaarlayout是因為需要給消耗的視圖留位置-->
<LinearLayout
android:id="@+id/layout_warehousing_root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_10" />
</LinearLayout>
android:animateLayoutChanges="true"
android:orientation="vertical">
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/vp_warehouse_viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_10" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</LinearLayout>
</ScrollView>
......
......@@ -3,16 +3,17 @@
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/card_purchase_category"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_3"
android:layout_marginTop="@dimen/dp_8"
android:layout_marginRight="@dimen/dp_4"
android:layout_height="wrap_content">
android:layout_marginRight="@dimen/dp_4">
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_second_category_title"
style="@style/Second_Category_Style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:textColor="@color/s_3c_to_white"
android:textSize="@dimen/dp_14"
......@@ -22,7 +23,7 @@
android:id="@+id/iv_category_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
android:layout_gravity="right"
android:src="@drawable/ic_red_circular_delete" />
android:src="@drawable/ic_red_circular_delete"
android:visibility="gone" />
</androidx.cardview.widget.CardView>
\ No newline at end of file
<resources>
<string name="app_name">供應鏈</string>
<string name="str_title_purchase_order">採購單</string>
<string name="minimumAmount">最低採購:$%1$.2f</string>
<string name="search_food_name_no">搜索食材名/編號</string>
......@@ -95,6 +97,6 @@
<string name="str_sn_quantity_consume_must_equla">SN碼數量和消耗庫存數必須保持一致</string>
<string name="str_whether_remove_not_current_food_sn_code">是否移除非當前食材的SN碼</string>
<string name="str_food_info_get_error">食材信息獲取失敗,請稍候重試</string>
<string name="str_order_del_contact_supplier">訂單已刪除,請打電話聯繫供應商訂單刪除!</string>
</resources>
\ No newline at end of file
......@@ -118,18 +118,15 @@ public class MealBillModel extends BaseMealModel implements MealBillContract.Mod
Single ob = mRepositoryManager.obtainRetrofitService(MealService.class)
.addOrderFood(requestBody)
.compose(MyRxSchedulerUtils._io_main_f())
.flatMap(new Function<BaseResult, Single<BaseOrderResponse>>() {
@Override
public Single<BaseOrderResponse> apply(BaseResult info) throws Exception {
if (info != null && info.isSuccess()) {
saveCreateTime(info.getSysTime());
return loadOrder(MealOrder.getInstance().getOrderId());
}
BaseOrderResponse baseOrderRespose = new BaseOrderResponse();
baseOrderRespose.setSuccess(info.isSuccess());
baseOrderRespose.setErrMsg(info.getErrMsg());
return Single.just(baseOrderRespose);
.flatMap((Function<BaseResult, Single<BaseOrderResponse>>) info -> {
if (info != null && info.isSuccess()) {
saveCreateTime(info.getSysTime());
return loadOrder(MealOrder.getInstance().getOrderId());
}
BaseOrderResponse baseOrderRespose = new BaseOrderResponse();
baseOrderRespose.setSuccess(info.isSuccess());
baseOrderRespose.setErrMsg(info.getErrMsg());
return Single.just(baseOrderRespose);
});
return ob;
}
......
......@@ -459,7 +459,6 @@ public abstract class BaseMealPresenter<M extends BaseMealContract.Model, V exte
.build()
.callAsyncCallbackOnMainThread((cc, result) -> {
});
}
......@@ -489,13 +488,10 @@ public abstract class BaseMealPresenter<M extends BaseMealContract.Model, V exte
mShoppingCart.changeNumber(number, orderFood, orderMainFood,
mMealCartAdapter.getSelect_full_start_position(),
mMealCartAdapter.getSelect_full_end_position(),
new ShoppingCartNumberChange.OnNumberChangeListener() {
@Override
public void achieveMaximum(String name) {
String msg = "[" + name + "]" + "已售罄";
LoganManager.w_tableMode(TAG, msg);
CommonTipDialog.showSurpisedDialog(IActivity, msg, null, null, null, null, null);
}
name -> {
String msg = "[" + name + "]" + "已售罄";
LoganManager.w_tableMode(TAG, msg);
CommonTipDialog.showSurpisedDialog(IActivity, msg, null, null, null, null, null);
});
mMealCartAdapter.notifyDataSetChanged();
updateBillInfo();
......@@ -508,7 +504,7 @@ public abstract class BaseMealPresenter<M extends BaseMealContract.Model, V exte
if (mMealCartAdapter.getSelect_start_position() == -1 || mMealCartAdapter.getSelect_start_position() >= mMealCartAdapter.getInfos().size()) {
return false;
}
if (mOrderMealList.get(mMealCartAdapter.getSelect_start_position()).isIsfood() == false) {
if (!mOrderMealList.get(mMealCartAdapter.getSelect_start_position()).isIsfood()) {
return false;
}
//旧食品不可以修改数量
......
......@@ -338,6 +338,7 @@ public class MealStandPresenter extends BaseMealPresenter<MealStandContract.Mode
/**
* 點選購物車
*
* @param rvSelectMeal
*/
public void initSelectMealAdapter(RecyclerView rvSelectMeal) {
......@@ -1379,11 +1380,9 @@ public class MealStandPresenter extends BaseMealPresenter<MealStandContract.Mode
* 更新食品沽清數據
*/
public void updateFoodSoldoutCtrData() {
if (mSoldoutCtrList.size() > 0) {
clearFoodSoldoutCtrData();
addFoodSoldoutCtrItem(mSoldoutCtrList);
setFoodSoldoutCtrData(mSoldoutCtrList);
}
clearFoodSoldoutCtrData();
addFoodSoldoutCtrItem(mSoldoutCtrList);
setFoodSoldoutCtrData(mSoldoutCtrList);
}
/**
......
......@@ -31,6 +31,7 @@ import com.gingersoft.gsa.cloud.common.core.user.UserContext;
import com.gingersoft.gsa.cloud.common.scan.ScanHelper;
import com.gingersoft.gsa.cloud.common.utils.encryption.DESUtil;
import com.gingersoft.gsa.cloud.common.utils.log.LogUtil;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.order.order.BaseOrder;
import com.gingersoft.gsa.cloud.order.order.MealOrder;
......@@ -217,7 +218,7 @@ public class MealBillActivity extends BaseMealActivity<MealBillPresenter> implem
if (BaseOrder.isCurrentOrderType(FoodSummaryConstans.TAKEAWAY_TYPE)) {
btnTable.setText("外賣");
btnPeopleNum.setText(String.format(getString(R.string.meal_numberman_colon), 1));
tvTime.setText("時間:" + TimeUtils.getCurrentDate(TimeUtils.DATE_FORMAT_DATE_HM));
tvTime.setText(String.format(getString(R.string.str_firmat_time), TimeUtils.getCurrentDate(TimeUtils.DATE_FORMAT_DATE_HM)));
tvServerMain.setText("");
tvOrderNo.setVisibility(View.GONE);
} else {
......@@ -231,9 +232,14 @@ public class MealBillActivity extends BaseMealActivity<MealBillPresenter> implem
tableno = tableInfo.getTableName();
}
btnTable.setText(tableno);
tvOrderNo.setText(String.format(getString(R.string.meal_order_number), MealOrder.getInstance().getOrderNo()));
String orderNo = MealOrder.getInstance().getOrderNo();
if (TextUtil.isNotEmptyOrNullOrUndefined(orderNo)) {
tvOrderNo.setText(String.format(getString(R.string.meal_order_number), MealOrder.getInstance().getOrderNo()));
} else {
tvOrderNo.setText("");
}
btnPeopleNum.setText(String.format(getString(R.string.meal_numberman_colon), tableInfo.getPerson()));
tvTime.setText("時間:" + openTime);
tvTime.setText(String.format(getString(R.string.str_firmat_time), openTime));
tvServerMain.setText(UserContext.newInstance().getMemberName());
}
}
......
......@@ -284,10 +284,26 @@ public class MealStandActivity extends BaseMealActivity<MealStandPresenter> impl
initAdapter();
initListener();
initLayoutManager();
initTableDetail();
mPresenter.initMealData();
mPresenter.getCurrentSoldoutFood();
}
private void initTableDetail() {
if (BaseOrder.isCurrentOrderType(FoodSummaryConstans.TAKEAWAY_TYPE)) {
TableBean.DataBean tableBean = new TableBean.DataBean();
tableBean.setPerson(1);
tableBean.setTableName("外賣");
MealOrder.getInstance().setOpenTableInfo(tableBean);
btnSendOrder.setText("送單信息");
} else {
boolean openTableAutoShowKeyboard = GsaCloudApplication.functionConfiguration.getOpenTableAutoShowKeyboardVaule();
if (openTableAutoShowKeyboard && MealOrder.getInstance().getOpenTableInfo().getPerson() == 0) {
showChoosePeopleNumDialog(false);
}
}
}
@Override
public void onResume() {
super.onResume();
......@@ -408,12 +424,7 @@ public class MealStandActivity extends BaseMealActivity<MealStandPresenter> impl
// 如果需要查看调试日志可以设置为true,一般情况忽略即可
PagerConfig.setShowLog(true);
rvFoodGroup.setAdapter(mFoodGroupAdapter);
mFoodGroupAdapter.setOnItemClickListener(new FoodGroupAdapter.OnItemClickListener() {
@Override
public void onItemClick(Food datasBean, int position) {
mPresenter.foodGroupItemClick(datasBean);
}
});
mFoodGroupAdapter.setOnItemClickListener((datasBean, position) -> mPresenter.foodGroupItemClick(datasBean));
int foodGroupBtnHeight = GsaCloudApplication.uiStyleConfiguration.getFoodGroupBtnHeightValue();
int mParentColHeight = foodGroupBtnHeight * rows;
//设置ViewPager适配器
......@@ -499,6 +510,7 @@ public class MealStandActivity extends BaseMealActivity<MealStandPresenter> impl
.build(mContext);
tabSegmentFine.addTab(tab);
}
vPager2Fine.setOrientation(ViewPager2.ORIENTATION_HORIZONTAL);
vPager2Fine.setAdapter(new ViewPager2Adapter(this, createFineFragments()));
vPager2Fine.setCurrentItem(currFinePage);
QMUITabSegmentUtils.setNomalTabSegmentStyle(tabSegmentFine, vPager2Fine);
......
......@@ -195,24 +195,14 @@ public class TableActivity extends BaseFragmentActivity<TablePresenter> implemen
public void initTopBar() {
mTopBar.setBackgroundColor(ContextCompat.getColor(this, R.color.theme_color));
mTopBar.removeAllLeftViews();
mTopBar.addLeftBackImageButton().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
killMyself();
}
});
mTopBar.addLeftBackImageButton().setOnClickListener(v -> killMyself());
QMUIAlphaImageButton rightButton = mTopBar.addRightImageButton(R.drawable.icon_refresh, R.id.btn_right);
QMUIAlphaImageButton rightButton2 = mTopBar.addRightImageButton(R.mipmap.meal_down, R.id.btn_fid);
rightButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LoganManager.w_tableMode(TAG, "手動刷新餐檯數據");
rightButton.setOnClickListener(v -> {
LoganManager.w_tableMode(TAG, "手動刷新餐檯數據");
// launchActivity(new Intent(mContext, CoordinatorlayoutActivity.class));
getTables(true, null);
IServiceManager.startICommandService(GsaCloudApplication.getAppContext());
}
getTables(true, null);
IServiceManager.startICommandService(GsaCloudApplication.getAppContext());
});
rightButton2.setOnClickListener(new View.OnClickListener() {
@Override
......
......@@ -10,6 +10,7 @@ import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.GridLayoutManager;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
......@@ -178,7 +179,7 @@ public class FoodAdapter extends DefaultAdapter<Food> {
tv_soldout.setMinHeight(mSoldoutFoodFlagHeight);
tv_soldout.setTextSize(mSoldoutFoodFlagFontSize);
tv_soldout.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.meal_shape_remaining_number_bg));
tv_soldout.setBackground(ContextCompat.getDrawable(mContext, R.drawable.meal_shape_remaining_number_bg));
tv_soldout.setGravity(Gravity.CENTER);
tv_soldout.setVisibility(View.INVISIBLE);
......
......@@ -28,17 +28,12 @@ import com.kingja.loadsir.callback.Callback;
import com.kingja.loadsir.core.LoadService;
import com.kingja.loadsir.core.LoadSir;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
import org.simple.eventbus.EventBus;
import org.simple.eventbus.Subscriber;
import org.simple.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
......@@ -114,7 +109,6 @@ public class CouponFragment extends BaseFragment<CouponPresenter> implements Cou
loadService = LoadSir.getDefault().register(refreshLayout, (v) -> {
mPresenter.getMemberWalletList(null, false, limitType);
});
initAdapter();
initRefreshLayout();
......@@ -147,18 +141,8 @@ public class CouponFragment extends BaseFragment<CouponPresenter> implements Cou
}
private void initRefreshLayout() {
refreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(@NonNull final RefreshLayout refreshLayout) {
mPresenter.getMemberWalletList(refreshLayout, false, limitType);
}
});
refreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
@Override
public void onLoadMore(@NonNull final RefreshLayout refreshLayout) {
mPresenter.getMemberWalletList(refreshLayout, true, limitType);
}
});
refreshLayout.setOnRefreshListener(refreshLayout -> mPresenter.getMemberWalletList(refreshLayout, false, limitType));
refreshLayout.setOnLoadMoreListener(refreshLayout -> mPresenter.getMemberWalletList(refreshLayout, true, limitType));
refreshLayout.setEnableLoadMore(false);
}
......
......@@ -15,12 +15,11 @@ import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.viewpager2.widget.ViewPager2;
import com.gingersoft.gsa.cloud.order.bean.discount.MemberWalletCoupon;
import com.gingersoft.gsa.cloud.common.core.member.MemberInfo;
import com.gingersoft.gsa.cloud.common.logan.LoganManager;
import com.gingersoft.gsa.cloud.database.bean.Discount;
import com.gingersoft.gsa.cloud.order.bean.discount.MemberWalletCoupon;
import com.gingersoft.gsa.cloud.order.order.MealOrder;
import com.gingersoft.gsa.cloud.table.BuildConfig;
import com.gingersoft.gsa.cloud.table.R;
import com.gingersoft.gsa.cloud.table.R2;
import com.gingersoft.gsa.cloud.ui.adapter.ViewPager2Adapter;
......@@ -92,7 +91,6 @@ public class DiscountDialogFragment extends BaseDialogFragment<BasePresenter> {
@Override
public void initData(@Nullable Bundle savedInstanceState) {
float mShadowAlpha = 0.25f;
int mShadowElevationDp = 14;
llContainer.setRadiusAndShadow(15, QMUIDisplayHelper.dp2px(mContext, mShadowElevationDp), mShadowAlpha);
......@@ -149,29 +147,22 @@ public class DiscountDialogFragment extends BaseDialogFragment<BasePresenter> {
List<Fragment> fragments = new ArrayList<>();
NomalDiscountFragment billDiscountFragment = NomalDiscountFragment.newInstance();
billDiscountFragment.setOnDiscountItemClickListener(new NomalDiscountFragment.OnBillDiscountItemClickListener() {
@Override
public void onItemClick(Discount item, int position) {
if (onDiscountItemClickListener != null) {
onDiscountItemClickListener.onBillDiscountClick(item, position);
}
billDiscountFragment.setOnDiscountItemClickListener((item, position) -> {
if (onDiscountItemClickListener != null) {
onDiscountItemClickListener.onBillDiscountClick(item, position);
}
});
fragments.add(billDiscountFragment);
if (BuildConfig.DEBUG) {
MemberInfo memberInfo = MealOrder.getInstance().getMemberInfo();
if (memberInfo != null) {
couponFragment = CouponFragment.newInstance(CouponFragment.BILL_LIMIT_DISCOUNT);
couponFragment.setOnCouponItemClickListener(new CouponFragment.OnCouponItemClickListener() {
@Override
public void onItemClick(MemberWalletCoupon item, int position) {
if (onDiscountItemClickListener != null) {
onDiscountItemClickListener.onCouponClick(item, position);
}
}
});
fragments.add(couponFragment);
}
//會員錢包優惠券
MemberInfo memberInfo = MealOrder.getInstance().getMemberInfo();
if (memberInfo != null) {
couponFragment = CouponFragment.newInstance(CouponFragment.BILL_LIMIT_DISCOUNT);
couponFragment.setOnCouponItemClickListener((item, position) -> {
if (onDiscountItemClickListener != null) {
onDiscountItemClickListener.onCouponClick(item, position);
}
});
fragments.add(couponFragment);
}
return fragments;
}
......
......@@ -11,12 +11,11 @@ import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.viewpager2.widget.ViewPager2;
import com.gingersoft.gsa.cloud.order.bean.discount.MemberWalletCoupon;
import com.gingersoft.gsa.cloud.common.core.member.MemberInfo;
import com.gingersoft.gsa.cloud.common.logan.LoganManager;
import com.gingersoft.gsa.cloud.database.bean.Discount;
import com.gingersoft.gsa.cloud.order.bean.discount.MemberWalletCoupon;
import com.gingersoft.gsa.cloud.order.order.MealOrder;
import com.gingersoft.gsa.cloud.table.BuildConfig;
import com.gingersoft.gsa.cloud.table.R;
import com.gingersoft.gsa.cloud.table.R2;
import com.gingersoft.gsa.cloud.ui.adapter.ViewPager2Adapter;
......@@ -77,7 +76,6 @@ public class DiscountFragment extends BaseFragment<BasePresenter> implements IVi
@Override
public void initData(@Nullable Bundle savedInstanceState) {
float mShadowAlpha = 0.25f;
int mShadowElevationDp = 14;
llContainer.setRadiusAndShadow(15, QMUIDisplayHelper.dp2px(mContext, mShadowElevationDp), mShadowAlpha);
......@@ -133,18 +131,19 @@ public class DiscountFragment extends BaseFragment<BasePresenter> implements IVi
}
});
fragments.add(billDiscountFragment);
if (BuildConfig.DEBUG) {
MemberInfo memberInfo = MealOrder.getInstance().getMemberInfo();
if (memberInfo != null) {
couponFragment = CouponFragment.newInstance(CouponFragment.FOOD_LIMIT_DISCOUNT);
couponFragment.setOnCouponItemClickListener((item, position) -> {
if (onDiscountItemClickListener != null) {
onDiscountItemClickListener.onCouponClick(item, position);
}
});
fragments.add(couponFragment);
}
// if (BuildConfig.DEBUG) {
//會員錢包優惠券
MemberInfo memberInfo = MealOrder.getInstance().getMemberInfo();
if (memberInfo != null) {
couponFragment = CouponFragment.newInstance(CouponFragment.FOOD_LIMIT_DISCOUNT);
couponFragment.setOnCouponItemClickListener((item, position) -> {
if (onDiscountItemClickListener != null) {
onDiscountItemClickListener.onCouponClick(item, position);
}
});
fragments.add(couponFragment);
}
// }
return fragments;
}
......@@ -186,9 +185,7 @@ public class DiscountFragment extends BaseFragment<BasePresenter> implements IVi
@Override
public void launchActivity(@NonNull Intent intent) {
if (intent != null) {
ArmsUtils.startActivity(intent);
}
ArmsUtils.startActivity(intent);
}
@Override
......
......@@ -103,6 +103,7 @@ public class RiceponMemberDialogFragment extends BaseDialogFragment<RiceponMembe
private TableBean.DataBean mCurrTableBean;
private MemberInfo mMemberInfo;
public final static String QR_RESULT_CODE = "qrCodeResult";
public static RiceponMemberDialogFragment newInstance(TableBean.DataBean currTableBean, MemberInfo memberInfo) {
RiceponMemberDialogFragment fragment = new RiceponMemberDialogFragment();
......@@ -164,19 +165,12 @@ public class RiceponMemberDialogFragment extends BaseDialogFragment<RiceponMembe
private void initTopbar() {
topbar.setBackgroundColor(ContextCompat.getColor(mContext, R.color.theme_color));
topbar.addLeftBackImageButton().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
killMyself();
}
});
topbar.addLeftBackImageButton().setOnClickListener(v -> killMyself());
topbar.setTitle("使用會員");
}
protected void toScanActivity() {
PermissionUtil.launchCamera(new PermissionUtil.RequestPermission() {
@Override
public void onRequestPermissionSuccess() {
String title = null;
......@@ -190,19 +184,21 @@ public class RiceponMemberDialogFragment extends BaseDialogFragment<RiceponMembe
.addParam("title", title)
.build()
.callAsyncCallbackOnMainThread((cc, result) -> {
Object qrCodeResult = result.getDataItem(QR_RESULT_CODE);
processQrResult(qrCodeResult.toString());
});
}
@Override
public void onRequestPermissionFailure(List<String> permissions) {
DeviceUtils.startSetting(mContext);
showMessage(LanguageUtils.get_language_system( "please.open.camera.permissions", "請前往設置開放照相機權限"));
showMessage(LanguageUtils.get_language_system("please.open.camera.permissions", "請前往設置開放照相機權限"));
}
@Override
public void onRequestPermissionFailureWithAskNeverAgain(List<String> permissions) {
DeviceUtils.startSetting(mContext);
showMessage(LanguageUtils.get_language_system( "please.open.camera.permissions", "請前往設置開放照相機權限"));
showMessage(LanguageUtils.get_language_system("please.open.camera.permissions", "請前往設置開放照相機權限"));
}
}, new RxPermissions(_mActivity), mErrorHandler);
}
......@@ -278,17 +274,12 @@ public class RiceponMemberDialogFragment extends BaseDialogFragment<RiceponMembe
showBottomLayoutVisibility(true);
}
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == ScanHelper.CALL_BACK_QR_RESULT) {
String qrCodeResult = data.getStringExtra("qrCodeResult");
if (TextUtils.isEmpty(qrCodeResult)) {
return;
}
TableBean.DataBean dataBean = MealOrder.getInstance().getOpenTableInfo();
mPresenter.queryMember(1, qrCodeResult, RestaurantInfoManager.newInstance().getGsPosShopId(), dataBean.getId(), dataBean.getTableNumber());
private void processQrResult(String qrCodeResult) {
if (TextUtils.isEmpty(qrCodeResult)) {
return;
}
TableBean.DataBean dataBean = MealOrder.getInstance().getOpenTableInfo();
mPresenter.queryMember(1, qrCodeResult, RestaurantInfoManager.newInstance().getGsPosShopId(), dataBean.getId(), dataBean.getTableNumber());
}
public void showBottomLayoutVisibility(boolean show) {
......
......@@ -107,14 +107,11 @@ public class RegionTableFragment extends BaseFragment<RegionTablePresenter> impl
} else if (mContext instanceof MealBillActivity) {
mOrderContentActivity = (MealBillActivity) mContext;
}
loadService = LoadSir.getDefault().register(refreshLayout, new Callback.OnReloadListener() {
@Override
public void onReload(View v) {
if (mContext instanceof TableActivity) {
mTableActivity.getTables(true, refreshLayout);
} else if (mContext instanceof MealBillActivity) {
mOrderContentActivity.getTables(true, refreshLayout);
}
loadService = LoadSir.getDefault().register(refreshLayout, (Callback.OnReloadListener) v -> {
if (mContext instanceof TableActivity) {
mTableActivity.getTables(true, refreshLayout);
} else if (mContext instanceof MealBillActivity) {
mOrderContentActivity.getTables(true, refreshLayout);
}
});
initRefreshLayout();
......@@ -122,21 +119,15 @@ public class RegionTableFragment extends BaseFragment<RegionTablePresenter> impl
}
private void initRefreshLayout() {
refreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(@NonNull final RefreshLayout refreshLayout) {
//刷新餐檯數據
if (mTableActivity != null) {
mTableActivity.getTables(false, refreshLayout);
} else if (mOrderContentActivity != null) {
mOrderContentActivity.getTables(false, refreshLayout);
}
refreshLayout.setOnRefreshListener(refreshLayout -> {
//刷新餐檯數據
if (mTableActivity != null) {
mTableActivity.getTables(false, refreshLayout);
} else if (mOrderContentActivity != null) {
mOrderContentActivity.getTables(false, refreshLayout);
}
});
refreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
@Override
public void onLoadMore(@NonNull final RefreshLayout refreshLayout) {
}
refreshLayout.setOnLoadMoreListener(refreshLayout -> {
});
refreshLayout.setEnableLoadMore(false);
}
......@@ -162,42 +153,40 @@ public class RegionTableFragment extends BaseFragment<RegionTablePresenter> impl
mOrderContentActivity.onPauseRefreshTableData();
}
break;
default:
break;
}
}
});
recycle_all_table.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
int action = event.getAction();
switch (action) {
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_MOVE: //用户滑动 先停止刷新餐台数据
if (mTableActivity != null) {
mTableActivity.onPauseRefreshTableData();
} else if (mOrderContentActivity != null) {
mOrderContentActivity.onPauseRefreshTableData();
}
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
if (mTableActivity != null) {
mTableActivity.onStartRefreshTableData();
} else if (mOrderContentActivity != null) {
mOrderContentActivity.onStartRefreshTableData();
}
//用户手抬起是 继续刷新餐台数据
break;
}
return false;
recycle_all_table.setOnTouchListener((v, event) -> {
int action = event.getAction();
switch (action) {
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_MOVE: //用户滑动 先停止刷新餐台数据
if (mTableActivity != null) {
mTableActivity.onPauseRefreshTableData();
} else if (mOrderContentActivity != null) {
mOrderContentActivity.onPauseRefreshTableData();
}
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
if (mTableActivity != null) {
mTableActivity.onStartRefreshTableData();
} else if (mOrderContentActivity != null) {
mOrderContentActivity.onStartRefreshTableData();
}
//用户手抬起是 继续刷新餐台数据
break;
}
return false;
});
}
@Override
public void setData(@Nullable Object data) {
List<TableBean.DataBean> datasBeans;
if (data != null && data instanceof Message) {
if (data instanceof Message) {
switch (((Message) data).what) {
case 0:
break;
......@@ -279,6 +268,9 @@ public class RegionTableFragment extends BaseFragment<RegionTablePresenter> impl
@Override
public void showLoadSirCall(boolean isSuccess, int size, Throwable t) {
if (recycle_all_table == null) {
return;
}
if (t != null) {
LoadsirUtil.showCallbackByError(t, loadService);
recycle_all_table.setVisibility(View.INVISIBLE);
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/fl_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
......@@ -2,6 +2,7 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/fl_meal_bottom_btn"
android:layout_below="@+id/ll_meals">
<LinearLayout
......@@ -61,86 +62,4 @@
android:layout_above="@+id/ll_modify"
android:visibility="gone" />
<LinearLayout
android:id="@+id/ll_modify"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_45"
android:layout_alignParentBottom="true"
android:visibility="invisible">
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/btn_select_all"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="1dp"
android:layout_weight="0.1"
android:background="#00B9F7"
android:gravity="center"
android:text="@string/all_selection"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/sp_14"
android:visibility="gone" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/btn_anti_selection"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="1dp"
android:layout_weight="0.1"
android:background="#00B9F7"
android:gravity="center"
android:text="@string/anti_selection"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/sp_14"
android:visibility="gone" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/btn_taste"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="1dp"
android:layout_weight="0.1"
android:background="#00B9F7"
android:gravity="center"
android:text="@string/taste"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/sp_14" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/btn_msg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginRight="1dp"
android:layout_weight="0.1"
android:background="#7D8888"
android:gravity="center"
android:text="@string/msg"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/sp_14" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/btn_delete"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="1dp"
android:layout_weight="0.1"
android:background="#FF5024"
android:gravity="center"
android:text="@string/remove"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/sp_14" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/btn_end"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="1dp"
android:layout_weight="0.1"
android:background="@color/Grass_green"
android:gravity="center"
android:text="@string/end"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/sp_14" />
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
<?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"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ll_fine"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
......@@ -29,5 +27,5 @@
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/pager_fine"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="match_parent" />
</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:id="@+id/ll_modify"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_45"
android:layout_alignParentBottom="true"
android:visibility="invisible">
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/btn_select_all"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="1dp"
android:layout_weight="0.1"
android:background="#00B9F7"
android:gravity="center"
android:text="@string/all_selection"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/sp_14"
android:visibility="gone" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/btn_anti_selection"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="1dp"
android:layout_weight="0.1"
android:background="#00B9F7"
android:gravity="center"
android:text="@string/anti_selection"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/sp_14"
android:visibility="gone" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/btn_taste"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="1dp"
android:layout_weight="0.1"
android:background="#00B9F7"
android:gravity="center"
android:text="@string/taste"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/sp_14" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/btn_msg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginRight="1dp"
android:layout_weight="0.1"
android:background="#7D8888"
android:gravity="center"
android:text="@string/msg"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/sp_14" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/btn_delete"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="1dp"
android:layout_weight="0.1"
android:background="#FF5024"
android:gravity="center"
android:text="@string/remove"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/sp_14" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/btn_end"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="1dp"
android:layout_weight="0.1"
android:background="@color/Grass_green"
android:gravity="center"
android:text="@string/end"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/sp_14" />
</LinearLayout>
\ No newline at end of file
......@@ -277,7 +277,7 @@
android:textColor="@color/black"
android:textSize="@dimen/sp_16" />
<com.gingersoft.gsa.cloud.ui.view.PagerSlidingTabStrip xmlns:app="http://schemas.android.com/apk/res-auto"
<com.gingersoft.gsa.cloud.ui.view.PagerSlidingTabStrip
android:id="@+id/tabs_fine"
android:layout_width="wrap_content"
android:layout_height="match_parent"
......@@ -305,8 +305,8 @@
android:id="@+id/scroll_combo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/ll_meals"
android:layout_above="@+id/ll_stand_oper">
android:layout_above="@+id/ll_stand_oper"
android:layout_below="@+id/ll_meals">
<RelativeLayout
android:layout_width="match_parent"
......@@ -326,8 +326,8 @@
android:id="@+id/rv_modifier"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:layout_below="@+id/rv_combo"
android:layout_marginTop="@dimen/dp_10"
android:divider="@null"
android:fadeScrollbars="false"
android:orientation="vertical"
......@@ -335,32 +335,32 @@
</RelativeLayout>
</androidx.core.widget.NestedScrollView>
<!-- <LinearLayout-->
<!-- android:id="@+id/ll_discount"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_above="@+id/ll_stand_oper"-->
<!-- android:layout_below="@+id/ll_meals"-->
<!-- android:visibility="gone">-->
<!-- -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_discount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@null"
android:fadeScrollbars="false"
android:orientation="vertical"
android:visibility="gone"/>
<!-- <androidx.recyclerview.widget.RecyclerView-->
<!-- android:id="@+id/rv_coupon"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:divider="@null"-->
<!-- android:fadeScrollbars="false"-->
<!-- android:orientation="vertical"-->
<!-- android:visibility="gone" />-->
<!-- </LinearLayout>-->
<!-- <LinearLayout-->
<!-- android:id="@+id/ll_discount"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_above="@+id/ll_stand_oper"-->
<!-- android:layout_below="@+id/ll_meals"-->
<!-- android:visibility="gone">-->
<!-- -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_discount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@null"
android:fadeScrollbars="false"
android:orientation="vertical"
android:visibility="gone" />
<!-- <androidx.recyclerview.widget.RecyclerView-->
<!-- android:id="@+id/rv_coupon"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:divider="@null"-->
<!-- android:fadeScrollbars="false"-->
<!-- android:orientation="vertical"-->
<!-- android:visibility="gone" />-->
<!-- </LinearLayout>-->
<FrameLayout
android:id="@+id/fl_discount"
......
......@@ -15,7 +15,8 @@
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="wrap_content"
android:text="功能"
android:layout_marginTop="@dimen/dp_5"
......
......@@ -90,4 +90,6 @@
<string name="meal_numberman_colon">人數:%1$d</string>
<string name="meal_order_number">單號:%1$s</string>
<string name="str_firmat_time">時間:%1$s</string>
</resources>
......@@ -8,7 +8,7 @@ ext {
//正式版: 1.0.3 3
//內部測試版:1.2.0 20
versionCode : 34, //38
versionName : "1.3.4_1" //1.3.8
versionName : "1.3.4_3" //1.3.8
]
version = [
......@@ -133,7 +133,7 @@ ext {
"qmui" : "com.qmuiteam:qmui:2.0.0-alpha03",
"arms" : "me.jessyan:arms:2.5.2",
"fastjson" : "com.alibaba:fastjson:1.2.46",
"zxing" : "cn.yipianfengye.android:zxing-library:2.2",
// "zxing" : "cn.yipianfengye.android:zxing-library:2.2",
"BaseRecyclerViewAdapter" : "com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.4",
"yzjRecyclerView" : "com.yanzhenjie.recyclerview:x:1.3.2",
//搜索view
......
......@@ -19,13 +19,11 @@ import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.graphics.Color;
import android.os.Bundle;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
......@@ -40,10 +38,6 @@ import com.jess.arms.integration.cache.CacheType;
import com.jess.arms.integration.lifecycle.ActivityLifecycleable;
import com.jess.arms.mvp.IPresenter;
import com.jess.arms.utils.ArmsUtils;
import com.jess.arms.utils.DeviceUtils;
import com.jess.arms.utils.SoftHideKeyBoardUtil;
import com.qmuiteam.qmui.arch.QMUIActivity;
import com.qmuiteam.qmui.arch.QMUIFragmentActivity;
import com.qmuiteam.qmui.util.QMUIDeviceHelper;
import com.trello.rxlifecycle2.android.ActivityEvent;
......
//package com.jess.arms.base;
//
//import android.content.Context;
//import android.content.res.AssetManager;
//import android.content.res.Configuration;
//import android.content.res.Resources;
//import android.util.DisplayMetrics;
//
///**
// * @author 宇航. 1239658231@qq.com
// * User: 宇航. 1239658231@qq.com
// * Date: 2021/5/26
// * Time: 16:58
// * Use:
// */
//public class MyLanguageResources extends Resources {
//
// public MyLanguageResources(Resources resources) {
// super(resources.getAssets(), resources.getDisplayMetrics(), resources.getConfiguration());
// }
//
//
//}
......@@ -26,13 +26,17 @@ import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.OnLifecycleEvent;
import com.jess.arms.utils.Preconditions;
import com.jess.arms.utils.RxLifecycleUtils;
import com.trello.rxlifecycle2.RxLifecycle;
import org.simple.eventbus.EventBus;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Action;
import io.reactivex.schedulers.Schedulers;
/**
* ================================================
......@@ -80,13 +84,25 @@ public class BasePresenter<M extends IModel, V extends IView> implements IPresen
onStart();
}
public <T> Observable<T> sendRequest(Observable<T> observable) {
return sendRequest(observable, null);
}
public <T> Observable<T> sendRequest(Observable<T> observable, String loadTip) {
return observable.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(loadTip))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView));
}
@Override
public void onStart() {
//将 LifecycleObserver 注册给 LifecycleOwner 后 @OnLifecycleEvent 才可以正常使用
if (mRootView != null && mRootView instanceof LifecycleOwner) {
((LifecycleOwner) mRootView).getLifecycle().addObserver(this);
if (mModel!= null && mModel instanceof LifecycleObserver){
if (mModel != null && mModel instanceof LifecycleObserver) {
((LifecycleOwner) mRootView).getLifecycle().addObserver((LifecycleObserver) mModel);
}
}
......
......@@ -96,7 +96,7 @@ dependencies {
//商米打印庫
api 'com.sunmi:printerlibrary:1.0.7'
//扫码
api 'cn.bingoogolapple:bga-qrcode-zxing:1.3.7'
api 'com.github.bingoogolapple.BGAQRCode-Android:zxing:1.3.8'
// loadingView
api rootProject.ext.dependencies["loadingIndicatorView"]
//加载反馈页管理
......
......@@ -34,6 +34,7 @@ import com.gingersoft.gsa.cloud.common.loadsir.pos.PosRefundMatterCallback;
import com.gingersoft.gsa.cloud.common.loadsir.pos.PosSettlementMatterCallback;
import com.gingersoft.gsa.cloud.common.loadsir.pos.PosTipsMatterCallback;
import com.gingersoft.gsa.cloud.common.loadsir.pos.PosVoidMatterCallback;
import com.gingersoft.gsa.cloud.common.loadsir.purchase.NotGoodsCallback;
import com.gingersoft.gsa.cloud.common.logan.LoganManager;
import com.gingersoft.gsa.cloud.common.oaId.DeviceID;
import com.gingersoft.gsa.cloud.common.printer.AidlUtil;
......@@ -276,11 +277,12 @@ public class GsaCloudApplication extends BaseApplication {
.addCallback(new PosVoidMatterCallback())
.addCallback(new PosTipsMatterCallback())
.addCallback(new PosSettlementMatterCallback())
.addCallback(new NotGoodsCallback())
.commit();
}
public static void initDomainUrl() {
HttpsConstans.init(mAppContext);
HttpsConstans.init();
//需要單獨配置域名URL的,在接口上添加@Headers({"Domain-Name: settlement_report_server"}),不添加則是使用默認域名
setGlobalDomain();
//清機報表請求地址
......
package com.gingersoft.gsa.cloud.common.aop;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author 宇航. 1239658231@qq.com
* User: 宇航. 1239658231@qq.com
* Date: 2021/5/26
* Time: 16:22
* Use: 語言資源
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface LanguageResources {
/**
* 資源名,在後台配置的名稱
*/
String sourcesName();
/**
* 默認的資源,如果讀取不到資源名稱,就返回默認的資源名
*/
String defaultResource();
}
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