Commit 3e324138 by Wyh

1、新增全局點擊時間買點+雙擊攔截aspectjx 2、prj打印服務新增登陸狀態攔截註解 3、供應鏈入庫功能 4、供應鏈BUG修復

parent 69e9e173
......@@ -2,6 +2,7 @@ ext.mainApp = true //设置为true,表示此module为主app module,一直
apply from: rootProject.file("cc-settings.gradle")
apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'com.didi.dokit'
apply plugin: 'android-aspectjx'
android {
signingConfigs {
......@@ -24,7 +25,9 @@ android {
defaultConfig {
minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
if (project.ext.runAsApp) {
applicationId 'com.gingersoft.gsa.cloud'
}
versionCode rootProject.ext.android["versionCode"]
versionName rootProject.ext.android["versionName"]
multiDexEnabled true
......@@ -60,6 +63,7 @@ android {
enabled = true
}
//修改生成的apk名字
if (project.ext.runAsApp) {
applicationVariants.all { variant ->
variant.outputs.all {
def fileName
......@@ -73,6 +77,7 @@ android {
outputFileName = fileName
}
}
}
dexOptions {
// incremental true
javaMaxHeapSize "4g"
......@@ -116,9 +121,8 @@ dokitExt {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
if (project.ext.runAsApp) {
addComponent 'component-main'
addComponent 'component-download'
addComponent 'component-table'
addComponent 'component-print'
addComponent 'component-delivery-pick'
......@@ -128,8 +132,64 @@ dependencies {
addComponent 'component-webview'
addComponent 'component-scan'
addComponent 'component-pay'
}
aspectjx {
enabled true
exclude 'androidx', 'org.jetbrains.kotlin', "module-info", 'com.google', 'com.squareup', 'org.apache', 'versions.9', 'com.squareup.okio', 'okio', 'leakcanary', 'com.google.firebase', 'com.google.android'
}
addComponent 'component-download'
implementation 'androidx.viewpager2:viewpager2:1.0.0-alpha03'
annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]
implementation rootProject.ext.dependencies["autosize"]
}
import org.aspectj.bridge.IMessage
import org.aspectj.bridge.MessageHandler
import org.aspectj.tools.ajc.Main
if (project.ext.runAsApp) {
final def log = project.logger
final def variants = project.android.applicationVariants
variants.all { variant ->
if (!variant.buildType.isDebuggable()) {
log.debug("Skipping non-debuggable build type '${variant.buildType.name}'.")
return;
}
JavaCompile javaCompile = variant.javaCompile
javaCompile.doLast {
String[] args = ["-showWeaveInfo",
"-1.8",
"-inpath", javaCompile.destinationDir.toString(),
"-aspectpath", javaCompile.classpath.asPath,
"-d", javaCompile.destinationDir.toString(),
"-classpath", javaCompile.classpath.asPath,
"-bootclasspath", project.android.bootClasspath.join(File.pathSeparator)]
log.debug "ajc args: " + Arrays.toString(args)
MessageHandler handler = new MessageHandler(true);
new Main().run(args, handler);
for (IMessage message : handler.getMessages(null, true)) {
switch (message.getKind()) {
case IMessage.ABORT:
case IMessage.ERROR:
case IMessage.FAIL:
log.error message.message, message.thrown
break;
case IMessage.WARNING:
log.warn message.message, message.thrown
break;
case IMessage.INFO:
log.info message.message, message.thrown
break;
case IMessage.DEBUG:
log.debug message.message, message.thrown
break;
}
}
}
}
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.login;
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;
......@@ -22,7 +23,7 @@ public class ComponentLogin implements IComponent {
public String getName() {
//组件的名称,调用此组件的方式:
// CC.obtainBuilder("ComponentA")...build().callAsync()
return ComponentName.COMPONENT_LOGIN ;
return ComponentName.COMPONENT_LOGIN;
}
/**
......@@ -42,8 +43,7 @@ public class ComponentLogin implements IComponent {
openWelcomeActivity(cc);
break;
case ComponentAction.Login.OPEN_LOGIN:
openLoginActivity(cc);
break;
return openLoginActivity(cc);
case ComponentAction.Login.OPEN_INIT_HYWEB_PAGE:
hywebOpenActivity();
break;
......@@ -77,9 +77,10 @@ public class ComponentLogin implements IComponent {
CC.sendCCResult(cc.getCallId(), CCResult.success("userName", userName));
}
private void openLoginActivity(CC cc) {
private boolean openLoginActivity(CC cc) {
CCUtil.navigateTo(cc, LoginActivity.class);
CC.sendCCResult(cc.getCallId(), CCResult.success());
// CC.sendCCResult(cc.getCallId(), CCResult.success());
return true;
}
private void openWelcomeActivity(CC cc) {
......@@ -87,8 +88,8 @@ public class ComponentLogin implements IComponent {
CC.sendCCResult(cc.getCallId(), CCResult.success());
}
private void hywebOpenActivity(){
Intent intent = new Intent(GsaCloudApplication.getAppContext(),LoginActivity.class);
private void hywebOpenActivity() {
Intent intent = new Intent(GsaCloudApplication.getAppContext(), LoginActivity.class);
GsaCloudApplication.getAppContext().startActivity(intent);
}
......
......@@ -78,6 +78,8 @@ public class ChooseRestaurantPresenter extends BasePresenter<ChooseRestaurantCon
super.onError(t);
mRootView.showMessage("獲取餐廳信息失敗");
mRootView.killMyself();
//登陸失敗時跳回登陸頁面
mRootView.jumpActivity(LoginActivity.class);
}
});
}
......
......@@ -7,12 +7,16 @@ import android.os.Bundle;
import android.view.Gravity;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.billy.cc.core.component.CC;
import com.billy.cc.core.component.CCResult;
import com.billy.cc.core.component.CCUtil;
import com.gingersoft.gsa.cloud.common.constans.AppConstans;
import com.gingersoft.gsa.cloud.common.core.restaurant.BrandInfo;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfo;
......@@ -46,11 +50,15 @@ import com.qmuiteam.qmui.widget.QMUITopBar;
import com.qmuiteam.qmui.widget.section.QMUISection;
import com.qmuiteam.qmui.widget.section.QMUIStickySectionAdapter;
import com.qmuiteam.qmui.widget.section.QMUIStickySectionLayout;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import javax.inject.Inject;
import butterknife.BindView;
import static com.jess.arms.utils.Preconditions.checkNotNull;
......@@ -140,11 +148,12 @@ public class ChooseRestaurantActivity extends BaseActivity<ChooseRestaurantPrese
@Override
public void showLoading(String message) {
if (message != null)
if (message != null) {
LoadingDialog.showDialogForLoading(this, message, true);
else
} else {
LoadingDialog.showDialogForLoading(this);
}
}
@Override
public void hideLoading() {
......@@ -276,6 +285,7 @@ public class ChooseRestaurantActivity extends BaseActivity<ChooseRestaurantPrese
@Override
public void jumpDownloadActivity() {
killBeforeActivity();
CC.sendCCResult(CCUtil.getNavigateCallId(this), CCResult.success());
CC.obtainBuilder(ComponentName.COMPONENT_DOWNLOAD)
.setActionName("showDownloadActivity")
.addParam("fromPage", 1)
......@@ -304,6 +314,7 @@ public class ChooseRestaurantActivity extends BaseActivity<ChooseRestaurantPrese
@Override
public void jumpMainActivity() {
CC.sendCCResult(CCUtil.getNavigateCallId(this), CCResult.success());
CC.obtainBuilder(ComponentName.COMPONENT_MAIN)
.setActionName("showMainActivity")
.build()
......
......@@ -278,11 +278,12 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements
@Override
public void showLoading(String message) {
if (message != null)
if (message != null) {
LoadingDialog.showDialogForLoading(this, message, true);
else
} else {
LoadingDialog.showDialogForLoading(this);
}
}
@Override
public void hideLoading() {
......@@ -336,8 +337,8 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements
@OnClick({R2.id.btn_gsa_user_login, R2.id.iv_clear_pwd, R2.id.iv_clear_account, R2.id.ic_look_pwd, R2.id.tv_forget_pwd})
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.ic_look_pwd:
int vId = v.getId();
if (vId == R.id.ic_look_pwd) {
passwrodVisibility = !passwrodVisibility;
if (passwrodVisibility) {
//如果选中,显示密码
......@@ -349,8 +350,7 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements
edPwd.setTransformationMethod(PasswordTransformationMethod.getInstance());
}
edPwd.setSelection(edPwd.getText() == null ? 0 : edPwd.getText().toString().length());
break;
case R.id.btn_gsa_user_login:
} else if (vId == R.id.btn_gsa_user_login) {
//登陸
if (edPwd.getText() == null || edPwd.getText().length() < 6) {
edPwd.setError("請輸入6~20位長度的密碼");
......@@ -359,22 +359,17 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements
} else {
mPresenter.login(edAccount.getText().toString(), edPwd.getText().toString());
}
break;
case R.id.iv_clear_account:
} else if (vId == R.id.iv_clear_account) {
//清空賬號框
edAccount.setText("");
icClearAccount.setVisibility(View.GONE);
break;
case R.id.iv_clear_pwd:
} else if (vId == R.id.iv_clear_pwd) {
//清空密碼框
edPwd.setText("");
icClear.setVisibility(View.GONE);
break;
case R.id.tv_forget_pwd:
} else if (vId == R.id.tv_forget_pwd) {
//忘記密碼
startActivity(new Intent(this, RecoverPasswordActivity.class));
break;
}
}
}
......@@ -20,6 +20,7 @@ import com.gingersoft.gsa.cloud.common.constans.HttpsConstans;
import com.gingersoft.gsa.cloud.common.constans.PrintConstans;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.core.user.UserContext;
import com.gingersoft.gsa.cloud.common.function.click.CheckLoginState;
import com.gingersoft.gsa.cloud.common.logan.LoganManager;
import com.gingersoft.gsa.cloud.common.printer.AidlUtil;
import com.gingersoft.gsa.cloud.common.printer.plugins.PrinterFlowProxy;
......@@ -160,6 +161,9 @@ public class PrjService extends Service implements ReceiveListener {
cancel(wakeDisposable);
cancel(pollDisposable);
if (!UserContext.newInstance().isLogin()) {
if (pollDisposable != null && !pollDisposable.isDisposed()) {
pollDisposable.dispose();
}
LoganManager.w_printer(TAG, "PrjService 用户未登录!");
return;
}
......@@ -167,9 +171,9 @@ public class PrjService extends Service implements ReceiveListener {
.subscribe(aLong -> {
LoganManager.w_printer(TAG, "獲取Prj數據-->");
//輪詢時,關閉打印機連接,避免一直佔用打印機socket連接
EpsonPrint.getInstance().disconnectPrinter();
EpsonPrint.getInstance().finalizeObject();
EpsonPrint.getInstance().canNextTask();
// EpsonPrint.getInstance().disconnectPrinter();
// EpsonPrint.getInstance().finalizeObject();
// EpsonPrint.getInstance().canNextTask();
//獲取prj數據
getPrjInfo();
});
......@@ -178,6 +182,7 @@ public class PrjService extends Service implements ReceiveListener {
/**
* 請求prj數據
*/
@CheckLoginState
private void getPrjInfo() {
OkHttp3Utils.get(HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL + "printerRecording/get?restaurantId=" + RestaurantInfoManager.newInstance().getRestaurantId())
.subscribeOn(Schedulers.io())//切换到io线程進行網絡請求
......
package com.gingersoft.supply_chain.di.component;
import dagger.BindsInstance;
import dagger.Component;
import com.jess.arms.di.component.AppComponent;
import com.gingersoft.supply_chain.di.module.InflowWaterModule;
import com.gingersoft.supply_chain.mvp.contract.InflowWaterContract;
import com.jess.arms.di.scope.FragmentScope;
import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.InflowWaterFragment;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 05/08/2021 15:24
* <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 = InflowWaterModule.class, dependencies = AppComponent.class)
public interface InflowWaterComponent {
void inject(InflowWaterFragment fragment);
@Component.Builder
interface Builder {
@BindsInstance
InflowWaterComponent.Builder view(InflowWaterContract.View view);
InflowWaterComponent.Builder appComponent(AppComponent appComponent);
InflowWaterComponent build();
}
}
\ No newline at end of file
package com.gingersoft.supply_chain.di.module;
import com.jess.arms.di.scope.FragmentScope;
import dagger.Binds;
import dagger.Module;
import dagger.Provides;
import com.gingersoft.supply_chain.mvp.contract.InflowWaterContract;
import com.gingersoft.supply_chain.mvp.model.InflowWaterModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 05/08/2021 15:24
* <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 InflowWaterModule {
@Binds
abstract InflowWaterContract.Model bindInflowWaterModel(InflowWaterModel model);
}
\ No newline at end of file
......@@ -21,4 +21,5 @@ public class PurchaseConsumeSnBean {
public String remarks;
//sn食材的sn碼
public List<String> encodeFoodNos;
}
......@@ -12,7 +12,6 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author 宇航.
......
package com.gingersoft.supply_chain.mvp.contract;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 05/08/2021 15:24
* <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 InflowWaterContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
}
}
package com.gingersoft.supply_chain.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.FragmentScope;
import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.InflowWaterContract;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 05/08/2021 15:24
* <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
public class InflowWaterModel extends BaseModel implements InflowWaterContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public InflowWaterModel(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.supply_chain.mvp.presenter;
import android.app.Application;
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 me.jessyan.rxerrorhandler.core.RxErrorHandler;
import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.InflowWaterContract;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 05/08/2021 15:24
* <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
public class InflowWaterPresenter extends BasePresenter<InflowWaterContract.Model, InflowWaterContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
@Inject
public InflowWaterPresenter(InflowWaterContract.Model model, InflowWaterContract.View rootView) {
super(model, rootView);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
}
......@@ -292,7 +292,7 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
if (info != null) {
if (info.isSuccess()) {
//供應商信息修改後,將購物車中的供應商信息修改
supplierInfoBean.setSupplierName(supplierName);
// supplierInfoBean.setSupplierName(supplierName);
SupplyShoppingCart.getInstance().updateSupplier(supplierInfoBean);
// SupplyShoppingCart.getInstance().removeFoodsBySupplier(supplierBean.getId());
mRootView.saveSuccess();
......
......@@ -10,6 +10,7 @@ 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.mvp.bean.DeputyUnitBean;
import com.gingersoft.supply_chain.mvp.bean.NoIsFoodSnTipBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodEncodeSn;
import com.gingersoft.supply_chain.mvp.bean.PurchaseOrderDetailsBean;
......@@ -17,13 +18,22 @@ 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.jess.arms.di.scope.FragmentScope;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.http.imageloader.ImageLoader;
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;
......@@ -112,7 +122,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
mModel.getOrderDetails(orderId)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(GET_INFO_LOADING))
.subscribeOn(AndroidSchedulers.mainThread())
// .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
......@@ -275,6 +285,13 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
if (baseResult.isSuccess()) {
mRootView.showMessage("收貨成功");
mRootView.killMyself();
} else if (baseResult.getData() != null) {
NoIsFoodSnTipBean noIsFoodSnTipBean = GsonUtils.GsonToBean(baseResult.getData(), NoIsFoodSnTipBean.class);
if(noIsFoodSnTipBean != null){
mRootView.showMessage("食材SN編碼【" + noIsFoodSnTipBean.getList() + "】已存在,請刪除後重試!");
} else {
mRootView.showMessage(baseResult.getErrMsg());
}
} else if (TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg());
} else {
......
......@@ -32,18 +32,38 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi
* ADD_ORDER
* ORDER_TYPE
*/
private int adapterType;
// private int adapterType = BuyIngredientsFragment.ADD_ORDER;
/**
* 是否顯示編輯和刪除按鈕
*/
private boolean isEdit = false;
/**
* 是否顯示數量和+-
*/
private boolean isShowNumber = true;
/**
* 是否是顯示單列
*/
private boolean isSinger = true;
private OnFoodNumberChangeListener onFoodNumberChangeListener;
private boolean longClick = false;
private int delayTime = 500;
public BuyIngredientsAdapter(Context context, List<BuyIngredientsBean> buyIngredientsBeans, int adapterType) {
public BuyIngredientsAdapter(Context context, List<BuyIngredientsBean> buyIngredientsBeans) {
super(context, buyIngredientsBeans);
addChildClickViewIds(R.id.iv_commodity_edit, R.id.iv_commodity_delete);
this.adapterType = adapterType;
}
public BuyIngredientsAdapter setEdit(boolean edit) {
isEdit = edit;
return this;
}
public BuyIngredientsAdapter setShowNumber(boolean showNumber) {
isShowNumber = showNumber;
return this;
}
public void setShowSingerRow(boolean showType) {
isSinger = showType;
......@@ -144,16 +164,17 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi
}
}
});
if (adapterType == BuyIngredientsFragment.FOOD_INGREDIENTS) {
//編輯食材頁面,顯示編輯和刪除,隱藏加減和數量
setDisplayStateByType(itemViewHolder, true, false, false);
} else if (adapterType == BuyIngredientsFragment.ADD_ORDER) {
//創建採購單頁面,隱藏編輯和刪除,顯示加減和數量
setDisplayStateByType(itemViewHolder, false, purchaseFoodBean.getFoodQuantity() > 0, true);
} else if (adapterType == BuyIngredientsFragment.GET_FOOD_BY_SUPPLIER) {
//供應商商品列表,編輯和數量都顯示
setDisplayStateByType(itemViewHolder, true, purchaseFoodBean.getFoodQuantity() > 0, true);
}
// if (adapterType == BuyIngredientsFragment.FOOD_INGREDIENTS) {
// //編輯食材頁面,顯示編輯和刪除,隱藏加減和數量
// setDisplayStateByType(itemViewHolder, true, false, false);
// } else if (adapterType == BuyIngredientsFragment.ADD_ORDER) {
// //創建採購單頁面,隱藏編輯和刪除,顯示加減和數量
// setDisplayStateByType(itemViewHolder, false, purchaseFoodBean.getFoodQuantity() > 0, true);
// } else if (adapterType == BuyIngredientsFragment.GET_FOOD_BY_SUPPLIER) {
// //供應商商品列表,編輯和數量都顯示
// setDisplayStateByType(itemViewHolder, true, purchaseFoodBean.getFoodQuantity() > 0, true);
// }
setDisplayStateByType(itemViewHolder, isEdit, isShowNumber && purchaseFoodBean.getFoodQuantity() > 0, isShowNumber);
//輸入框焦點監聽
// itemViewHolder.setOnFocusChangeListener(R.id.ed_food_ingredient_number, (v, hasFocus) -> {
// CharSequence text = itemViewHolder.getText(R.id.ed_food_ingredient_number);
......@@ -164,15 +185,17 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi
// }
// }
// });
}
private void setDisplayStateByType(BaseViewHolder itemViewHolder, boolean b, boolean b2, boolean b3) {
itemViewHolder.setVisible(R.id.iv_commodity_edit, b);
itemViewHolder.setVisible(R.id.iv_commodity_delete, b);
itemViewHolder.setVisible(R.id.btn_food_operation_sub, b2);
itemViewHolder.setVisible(R.id.ed_food_ingredient_number, b2);
itemViewHolder.setVisible(R.id.btn_food_operation_add, b3);
//編輯和刪除
itemViewHolder.setGone(R.id.iv_commodity_edit, !b);
itemViewHolder.setGone(R.id.iv_commodity_delete, !b);
//減號和數量
itemViewHolder.setGone(R.id.btn_food_operation_sub, !b2);
itemViewHolder.setGone(R.id.ed_food_ingredient_number, !b2);
//加號
itemViewHolder.setGone(R.id.btn_food_operation_add, !b3);
}
/**
......@@ -181,8 +204,8 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi
* @param showOrHide 顯示或隱藏 true隱藏,false顯示
*/
private void setSubAndNumShow(BaseViewHolder viewHolder, boolean showOrHide) {
viewHolder.setVisible(R.id.btn_food_operation_sub, !showOrHide);
viewHolder.setVisible(R.id.ed_food_ingredient_number, !showOrHide);
viewHolder.setGone(R.id.btn_food_operation_sub, showOrHide);
viewHolder.setGone(R.id.ed_food_ingredient_number, showOrHide);
}
/**
......
......@@ -33,7 +33,9 @@ public class FirstLevelCategoryAdapter extends BaseQuickAdapter<OrderCategoryBea
private int selectColor = -1;
private int unSelectColor = -1;
/**
* 一級分類是否顯示此分類已選食材數量
*/
private boolean showNumber = true;
public FirstLevelCategoryAdapter(@Nullable List<OrderCategoryBean.FoodCategoryTrees> data, Context context) {
......
package com.gingersoft.supply_chain.mvp.ui.adapter;
import android.content.Context;
import android.view.View;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
......
......@@ -16,22 +16,20 @@
package com.gingersoft.supply_chain.mvp.ui.adapter;
import android.text.Layout;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.LinearLayout;
import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.gsa.cloud.ui.recylcler.decorator.DividerItemDecoration;
import com.gingersoft.gsa.cloud.ui.recylcler.decorator.MarginDecoration;
import com.gingersoft.supply_chain.R;
import com.jess.arms.utils.DeviceUtils;
/**
* RecyclerView Adapter。
* @author admin
*/
public class PurchasePageAdapter extends RecyclerView.Adapter<PurchasePageAdapter.ViewHolder> {
......
......@@ -58,11 +58,16 @@ public class WareHousingDetailsAdapter extends BaseQuickAdapter<WarehouseDetails
//小於0,直接顯示負數
viewHolder.setText(R.id.tv_warehouse_details_food_num, String.valueOf(item.getFoodQuantity()));
}
viewHolder.setGone(R.id.tv_warehouse_time_text, false);
viewHolder.setText(R.id.tv_warehouse_order_time_text, "下單日期:");
//入庫日期
viewHolder.setText(R.id.tv_warehouse_details_time, item.getWarehousingTime());
viewHolder.setGone(R.id.tv_warehouse_details_time, false);
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);
} else {
//出庫,顯示-
......@@ -75,17 +80,14 @@ public class WareHousingDetailsAdapter extends BaseQuickAdapter<WarehouseDetails
}
// 入庫顯示消耗日期,不顯示入庫日期
viewHolder.setGone(R.id.tv_warehouse_time_text, true);
viewHolder.setGone(R.id.tv_warehouse_details_time, true);
//消耗日期
viewHolder.setText(R.id.tv_warehouse_order_time_text, "消耗日期:");
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()));
}
}
//下單時間
viewHolder.setText(R.id.tv_warehouse_details_order_time, item.getPurchaseTime());
//供應商
viewHolder.setText(R.id.tv_warehouse_details_supplier, item.getSupplierName());
//入庫來源
......@@ -107,7 +109,7 @@ public class WareHousingDetailsAdapter extends BaseQuickAdapter<WarehouseDetails
tvState.setTextColor(ContextCompat.getColor(getContext(), R.color.bright_orange));
tvState.setVisibility(View.VISIBLE);
} else {
tvState.setVisibility(View.INVISIBLE);
tvState.setVisibility(View.GONE);
}
if (item.getDistanceExpiresTime() >= 0) {
//即將過期天數大於等於0
......
......@@ -21,9 +21,8 @@ import com.gingersoft.supply_chain.mvp.presenter.FunctionListPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.FunctionChildAdapter;
import com.gingersoft.supply_chain.mvp.ui.adapter.PurchaseFunctionAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.category.CategoryFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.BuyIngredientsFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodManagementFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.MeasurementUnitFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.inventory.StorageListFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.order.PurchaseListFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.supplier.SupplierListFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.WareHouseListFragment;
......@@ -36,8 +35,6 @@ import java.util.List;
import butterknife.BindView;
import static com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodIngredientsFragment.FOOD_INGREDIENTS;
/**
* ================================================
......@@ -112,8 +109,8 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr
start(SupplierListFragment.newInstance(false, null));
break;
case "食材":
// start(FoodIngredientsFragment.newInstance(FOOD_INGREDIENTS));
start(BuyIngredientsFragment.newInstance(FOOD_INGREDIENTS));
start(FoodManagementFragment.newInstance());
// start(BuyIngredientsFragment.newInstance(FOOD_INGREDIENTS));
break;
case "種類":
start(CategoryFragment.newInstance());
......
package com.gingersoft.supply_chain.mvp.ui.fragment.food;
import android.view.View;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.BuyIngredientsBean;
import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import com.gingersoft.supply_chain.mvp.ui.widget.GoodsDetailsPopup;
import java.util.List;
/**
* @author 宇航. 1239658231@qq.com
* User: admin
* Date: 2021/5/7
* Time: 16:07
* Use: 食材管理
*/
public class FoodManagementFragment extends BuyIngredientsFragment {
public static FoodManagementFragment newInstance() {
return new FoodManagementFragment();
}
@Override
protected void initPage() {
super.initPage();
layoutFoodIngredientsBtn.setVisibility(View.GONE);
btnNewFoodIngredient.setVisibility(View.VISIBLE);
layoutChooseSize.setVisibility(View.GONE);
}
@Override
protected void initTopBar() {
initTopBar(topbarFoodIngredients, "食材管理");
topbarFoodIngredients.addRightImageButton(R.drawable.ic_circle_new_food_ingredient, R.id.qmui_add_new_food_ingredients).setOnClickListener(v -> {
//新增食材
toCreateFood();
});
}
@Override
public void initCategoryInfo(List<OrderCategoryBean.FoodCategoryTrees> foodCategoryTrees) {
super.initCategoryInfo(foodCategoryTrees);
if (firstLevelCategoryAdapter != null) {
firstLevelCategoryAdapter.setIsShowNumber(false);
}
}
@Override
public void loadFood(List<BuyIngredientsBean> buyIngredientsBeans, boolean addToHead, boolean isReset) {
super.loadFood(buyIngredientsBeans, addToHead, isReset);
if (adapter != null) {
adapter.setEdit(true).setShowNumber(false);
}
}
@Override
protected GoodsDetailsPopup getFoodDetailsPopup(PurchaseFoodBean purchaseFoodBean) {
return new GoodsDetailsPopup(requireContext(), purchaseFoodBean).setEditNumber(false);
}
}
package com.gingersoft.supply_chain.mvp.ui.fragment.food;
import android.os.Bundle;
import android.view.View;
import androidx.fragment.app.Fragment;
import com.gingersoft.gsa.cloud.common.utils.CollectionUtils;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.WarehousingOrderDetailsFragment;
import java.util.List;
/**
* @author 宇航. 1239658231@qq.com
* User: admin
* Date: 2021/5/7
* Time: 16:32
* Use:入庫單選購食材頁面
*/
public class FoodWarehousingFragment extends BuyIngredientsFragment {
public static FoodWarehousingFragment newInstance() {
return new FoodWarehousingFragment();
}
@Override
protected void initPage() {
super.initPage();
layoutChooseSize.setVisibility(View.VISIBLE);
btnFoodIngredientsCancel.setVisibility(View.GONE);
}
@Override
protected void confirm() {
List<PurchaseFoodBean> purchaseFood = mPresenter.getPurchaseFood();
if (CollectionUtils.isNotNullOrEmpty(purchaseFood)) {
//採購入庫單
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 {
showMessage("請選擇食材");
}
}
}
package com.gingersoft.supply_chain.mvp.ui.fragment.food;
import android.os.Bundle;
import android.view.View;
import com.gingersoft.gsa.cloud.common.loadsir.purchase.NotGoodsCallback;
import com.gingersoft.gsa.cloud.common.utils.CollectionUtils;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.BuyIngredientsBean;
import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean;
import java.util.Collections;
import java.util.List;
/**
* @author 宇航. 1239658231@qq.com
* User: admin
* Date: 2021/5/7
* Time: 16:13
* Use:
*/
public class SupplierFoodFragment extends BuyIngredientsFragment {
private final static String supplierIdKey = "supplierId";
private final static String supplierNameKey = "supplierName";
public static SupplierFoodFragment newInstance(int supplierId, String supplierName) {
SupplierFoodFragment fragment = new SupplierFoodFragment();
Bundle bundle = new Bundle();
bundle.putInt(supplierIdKey, supplierId);
bundle.putString(supplierNameKey, supplierName);
fragment.setArguments(bundle);
return fragment;
}
@Override
protected void loadDataByType() {
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;
//隱藏二級分類
layoutCategory.setVisibility(View.GONE);
mPresenter.initSupplierFoods(1);
//在一級分類中加載食品信息
initCategoryInfo(Collections.singletonList(supplierToCategory));
} else {
killMyself();
}
}
@Override
protected void setSecondCategoryShowState(int visibility) {
layoutCategory.setVisibility(View.GONE);
}
@Override
protected void initTopBar() {
initTopBar(topbarFoodIngredients, "食材管理");
topbarFoodIngredients.addRightImageButton(R.drawable.ic_circle_new_food_ingredient, R.id.qmui_add_new_food_ingredients).setOnClickListener(v -> {
//新增食材
toCreateFood();
});
}
@Override
protected void refreshData() {
mPresenter.getFoodsBySupplier(0, firstLevelCategoryAdapter.getItem(0), false, true);
}
@Override
public void initCategoryInfo(List<OrderCategoryBean.FoodCategoryTrees> foodCategoryTrees) {
super.initCategoryInfo(foodCategoryTrees);
if (firstLevelCategoryAdapter != null) {
firstLevelCategoryAdapter.setIsShowNumber(false);
}
}
@Override
public void loadFood(List<BuyIngredientsBean> buyIngredientsBeans, boolean addToHead, boolean isReset) {
setRefreshState(false);
if (buyIngredientsBeans == null || CollectionUtils.isNullOrEmpty(buyIngredientsBeans.get(0).purchaseFoodList)) {
//如果是單個供應商,需要判斷食材是不是為空
fullRegister.showCallback(NotGoodsCallback.class);
return;
}
super.loadFood(buyIngredientsBeans, addToHead, isReset);
if (adapter != null) {
adapter.setEdit(true).setShowNumber(true);
}
}
}
......@@ -56,8 +56,6 @@ import java.util.List;
import butterknife.BindView;
import butterknife.OnClick;
import static com.gingersoft.supply_chain.mvp.ui.fragment.food.BuyIngredientsFragment.ADD_ORDER;
/**
* Description:採購單列表
......@@ -161,7 +159,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
start(ShoppingCatFragment.newInstance());
} else {
//跳轉到下單頁面
startForResult(BuyIngredientsFragment.newInstance(ADD_ORDER), REQUEST_ORDER_DETAILS_CODE);
toCreateOrder();
}
});
}
......@@ -280,8 +278,12 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
getOrderList();
} else if (viewId == R.id.btn_save) {
//跳轉到下單頁面
startForResult(BuyIngredientsFragment.newInstance(ADD_ORDER), REQUEST_ORDER_DETAILS_CODE);
toCreateOrder();
}
}
private void toCreateOrder() {
startForResult(BuyIngredientsFragment.newInstance(), REQUEST_ORDER_DETAILS_CODE);
}
@Override
......
package com.gingersoft.supply_chain.mvp.ui.fragment.order;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
......@@ -23,7 +22,6 @@ import com.gingersoft.supply_chain.mvp.contract.SendMsgContract;
import com.gingersoft.supply_chain.mvp.presenter.SendMsgPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.SendSupplierMsgAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodIngredientsFragment;
import com.gingersoft.supply_chain.mvp.ui.widget.TextPopup;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.DeviceUtils;
......@@ -36,8 +34,6 @@ import java.util.List;
import butterknife.BindView;
import butterknife.OnClick;
import lombok.val;
import me.yokeyword.fragmentation.ISupportFragment;
import static com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean.SupplierContacts.Kakao_Talk;
import static com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean.SupplierContacts.Line;
......
......@@ -30,6 +30,7 @@ import com.gingersoft.supply_chain.mvp.ui.adapter.SupplierAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.BuyIngredientsFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodIngredientsFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.SupplierFoodFragment;
import com.jess.arms.di.component.AppComponent;
import com.kingja.loadsir.callback.Callback;
import com.kingja.loadsir.core.LoadSir;
......@@ -244,7 +245,7 @@ public class SupplierListFragment extends BaseSupplyChainFragment<SupplierListPr
} else if (view.getId() == R.id.layout_see_ingredients) {
//跳轉到供應商食品詳情
List<SupplierInfoBean> data = supplierAdapter.getData();
start(BuyIngredientsFragment.newInstance(data.get(position).getId(), data.get(position).getSupplierName()));
start(SupplierFoodFragment.newInstance(data.get(position).getId(), data.get(position).getSupplierName()));
}
});
} else {
......
package com.gingersoft.supply_chain.mvp.ui.fragment.warehouse;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.gsa.cloud.common.loadsir.EmptyCallback;
import com.gingersoft.gsa.cloud.common.utils.CollectionUtils;
import com.gingersoft.gsa.cloud.ui.recylcler.decorator.MarginDecoration;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2;
import com.gingersoft.supply_chain.di.component.DaggerInflowWaterComponent;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseWarehousingOrderDetailsVO;
import com.gingersoft.supply_chain.mvp.bean.WarehouseDetailsBean;
import com.gingersoft.supply_chain.mvp.contract.InflowWaterContract;
import com.gingersoft.supply_chain.mvp.presenter.InflowWaterPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.WareHousingDetailsAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.jess.arms.base.BaseFragmentActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.DeviceUtils;
import com.kingja.loadsir.core.LoadSir;
import java.util.List;
import butterknife.BindView;
/**
* 入庫流水列表的 fragment
*
* @author admin
*/
public class InflowWaterFragment extends BaseSupplyChainFragment<InflowWaterPresenter> implements InflowWaterContract.View {
private WareHousingDetailsAdapter wareHousingDetailsAdapter;
@BindView(R2.id.rv_purchase_list_content)
public RecyclerView recyclerView;
public static InflowWaterFragment newInstance() {
InflowWaterFragment fragment = new InflowWaterFragment();
return fragment;
}
@Override
public void setupFragmentComponent(@NonNull AppComponent appComponent) {
DaggerInflowWaterComponent //如找不到该类,请编译一下项目
.builder()
.appComponent(appComponent)
.view(this)
.build()
.inject(this);
}
@Override
public View initView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.recycler_view_item, container, false);
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
recyclerView.addItemDecoration(new MarginDecoration((int) DeviceUtils.dpToPixel(requireContext(), 8)));
loadService = LoadSir.getDefault().register(recyclerView);
}
public void loadData(PurchaseWarehousingOrderDetailsVO purchaseWarehousingOrderDetailsVO, List<WarehouseDetailsBean> warehouseDetailsBeans, int currentIndex) {
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)));
}
});
recyclerView.setAdapter(wareHousingDetailsAdapter);
} else {
wareHousingDetailsAdapter.setType(currentIndex);
wareHousingDetailsAdapter.setList(warehouseDetailsBeans);
}
Log.e("eee", "是否顯示:" + CollectionUtils.isNotNullOrEmpty(warehouseDetailsBeans));
if (CollectionUtils.isNotNullOrEmpty(warehouseDetailsBeans)) {
loadService.showSuccess();
} else {
loadService.showCallback(EmptyCallback.class);
}
}
}
package com.gingersoft.supply_chain.mvp.ui.fragment.warehouse;
import android.animation.LayoutTransition;
import android.app.Dialog;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.LayoutInflater;
......@@ -15,19 +14,20 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.print.PrintHelper;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager2.widget.ViewPager2;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.core.user.UserContext;
import com.gingersoft.gsa.cloud.common.loadsir.EmptyCallback;
import com.gingersoft.gsa.cloud.common.utils.CollectionUtils;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.common.utils.glide.GlideUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.common.utils.view.LayoutToBitmapUtils;
import com.gingersoft.gsa.cloud.ui.adapter.base.BaseFragmentStateAdapter;
import com.gingersoft.gsa.cloud.ui.utils.AppDialog;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2;
......@@ -41,14 +41,11 @@ import com.gingersoft.supply_chain.mvp.bean.WarehouseDetailsBean;
import com.gingersoft.supply_chain.mvp.contract.WarehouseDetailsContract;
import com.gingersoft.supply_chain.mvp.presenter.WarehouseDetailsPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.OutboundOrderAdapter;
import com.gingersoft.supply_chain.mvp.ui.adapter.PurchasePageAdapter;
import com.gingersoft.supply_chain.mvp.ui.adapter.WareHousingDetailsAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.gingersoft.supply_chain.mvp.ui.widget.InventoryConsumptionView;
import com.gingersoft.supply_chain.mvp.ui.widget.ScanSnView;
import com.jess.arms.di.component.AppComponent;
import com.kingja.loadsir.core.LoadSir;
import com.lxj.xpopup.interfaces.OnConfirmListener;
import com.qmuiteam.qmui.widget.QMUITopBar;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
......@@ -105,7 +102,7 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
*/
private ScanSnView scanSnView;
private WareHousingDetailsAdapter wareHousingDetailsAdapter;
private PurchasePageAdapter adapter;
// private PurchasePageAdapter adapter;
public final static String FOOD_INFO_KEY = "purchaseWarehousingBean";
private PurchaseWarehousingOrderDetailsVO purchaseWarehousingOrderDetailsVO;
......@@ -146,7 +143,6 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
Bundle arguments = getArguments();
smartRefreshLayout.setPrimaryColorsId(R.color.trans, R.color.black);
loadService = LoadSir.getDefault().register(smartRefreshLayout);
LayoutTransition layoutTransition = new LayoutTransition();
layoutTransition.enableTransitionType(LayoutTransition.CHANGING);
layoutRoot.setLayoutTransition(layoutTransition);
......@@ -193,7 +189,17 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
mPresenter.getOutStockDetails(purchaseWarehousingOrderDetailsVO.getFoodNo());
}
private BaseFragmentStateAdapter baseFragmentStateAdapter;
private List<Fragment> fragments;
private void initViewPager() {
fragments = new ArrayList<>();
baseFragmentStateAdapter = new BaseFragmentStateAdapter(this);
fragments.add(InflowWaterFragment.newInstance());
fragments.add(InflowWaterFragment.newInstance());
baseFragmentStateAdapter.addFragments(fragments);
vpWarehouseViewpager.setAdapter(baseFragmentStateAdapter);
vpWarehouseViewpager.setOrientation(ViewPager2.ORIENTATION_HORIZONTAL);
vpWarehouseViewpager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
......@@ -241,35 +247,10 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
public void loadAdapter(List<WarehouseDetailsBean> warehouseDetailsBeans) {
smartRefreshLayout.finishRefresh();
smartRefreshLayout.finishLoadMore();
if (warehouseDetailsBeans.size() <= 0) {
loadService.showCallback(EmptyCallback.class);
} else {
loadService.showSuccess();
if (wareHousingDetailsAdapter == null) {
wareHousingDetailsAdapter = new WareHousingDetailsAdapter(warehouseDetailsBeans, vpWarehouseViewpager.getCurrentItem());
if (adapter == null) {
adapter = new PurchasePageAdapter(wareHousingDetailsAdapter, 2);
vpWarehouseViewpager.setAdapter(adapter);
}
wareHousingDetailsAdapter.setOnItemClickListener((adapter, view, position) -> {
if (purchaseWarehousingOrderDetailsVO.getFoodMarkSn() == PurchaseFoodBean.HAS_SN) {
//SN食材
// if (view.getId() == R.id.tv_warehouse_details_food_num) {
//查詢消耗,收貨Sn碼詳情
start(SnCodeListFragment.newInstance(vpWarehouseViewpager.getCurrentItem(), wareHousingDetailsAdapter.getItem(position)));
// if (vpWarehouseViewpager.getCurrentItem() == WAREHOUSE_TYPE) {
// mPresenter.querySnCodeList(vpWarehouseViewpager.getCurrentItem(), item.getFoodQuantity(), "", item.getWarehousingOrderDetailsIds());
// } else {
// mPresenter.querySnCodeList(vpWarehouseViewpager.getCurrentItem(), item.getFoodQuantity(), "", item.getPurchaseConsumeNoId());
// }
// }
}
});
} else {
wareHousingDetailsAdapter.setType(vpWarehouseViewpager.getCurrentItem());
wareHousingDetailsAdapter.setList(warehouseDetailsBeans);
}
Fragment fragment = fragments.get(vpWarehouseViewpager.getCurrentItem());
if (fragment instanceof InflowWaterFragment) {
InflowWaterFragment inflowWaterFragment = (InflowWaterFragment) fragment;
inflowWaterFragment.loadData(purchaseWarehousingOrderDetailsVO, warehouseDetailsBeans, vpWarehouseViewpager.getCurrentItem());
}
}
......@@ -280,7 +261,6 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
button.setOnClickListener(v -> showInventory(consumeReasonBeans));
}
/**
* 顯示庫存消耗
*
......@@ -499,7 +479,7 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
public void showList(int visible) {
vpWarehouseViewpager.setVisibility(visible);
layoutTitle.setVisibility(visible);
loadService.showSuccess();
// loadService.showSuccess();
if (visible == View.VISIBLE) {
removeInventoryView();
} else {
......@@ -525,20 +505,21 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
tvWarehouseInventoryNumber.setText(String.valueOf(num));
}
@OnClick({R2.id.tv_warehousing_record, R2.id.tv_outbound_record, R2.id.tv_warehouse_inventory_number})
@OnClick({R2.id.tv_warehousing_record, R2.id.tv_outbound_record, R2.id.layout_inventory_details})
@Override
public void onClick(View v) {
if (v.getId() == R.id.tv_warehousing_record) {
int viewId = v.getId();
if (viewId == R.id.tv_warehousing_record) {
//入庫流水
vpWarehouseViewpager.setCurrentItem(WAREHOUSE_TYPE);
//查詢入庫
getWarehouseDetails();
} else if (v.getId() == R.id.tv_outbound_record) {
} else if (viewId == R.id.tv_outbound_record) {
//出庫流水
vpWarehouseViewpager.setCurrentItem(OUT_STOCK_TYPE);
//查詢出庫
getOutStockDetails();
} else if (v.getId() == R.id.tv_warehouse_inventory_number) {
} else if (viewId == R.id.layout_inventory_details) {
if (purchaseWarehousingOrderDetailsVO.getFoodMarkSn() == PurchaseFoodBean.HAS_SN) {
//是sn食材,查詢庫中剩餘的sn碼
start(SnCodeListFragment.newInstance(-1, new WarehouseDetailsBean(purchaseWarehousingOrderDetailsVO.getName(), purchaseWarehousingOrderDetailsVO.getFoodNum(), purchaseWarehousingOrderDetailsVO.getFoodNo())));
......
......@@ -29,6 +29,7 @@ import com.gingersoft.supply_chain.mvp.ui.adapter.ConsumptionReasonAdapter;
import com.gingersoft.supply_chain.mvp.ui.adapter.WareHousingOrderFoodAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.BuyIngredientsFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodWarehousingFragment;
import com.gingersoft.supply_chain.mvp.ui.widget.GoodsDetailsPopup;
import com.gingersoft.supply_chain.mvp.ui.widget.ScanSnPopup;
import com.gingersoft.supply_chain.mvp.ui.widget.WarehousingFoodDetailsPopup;
......@@ -170,7 +171,7 @@ public class WarehousingOrderDetailsFragment extends BaseSupplyChainFragment<War
rvWarehousingFood.addItemDecoration(new DefaultItemDecoration(ContextCompat.getColor(requireContext(), R.color.color_ccc), LinearLayout.LayoutParams.MATCH_PARENT, 1));
if (warehousingOrderId == -1) {
//加添加食材按鈕
wareHousingOrderFoodAdapter.addFooterView(getFooter(v -> startForResult(BuyIngredientsFragment.newInstance(BuyIngredientsFragment.GET_FOOD_BY_WAREHOUSING_ORDER), ADD_FOOD_REQUEST_CODE)));
wareHousingOrderFoodAdapter.addFooterView(getFooter(v -> startForResult(FoodWarehousingFragment.newInstance(), ADD_FOOD_REQUEST_CODE)));
} else {
//加一條線
wareHousingOrderFoodAdapter.addFooterView(getLayoutInflater().inflate(R.layout.include_horizontal_color_ccc_dividing_line, rvWarehousingFood, false));
......
......@@ -68,7 +68,7 @@ public class GoodsDetailsPopup extends CenterPopupView {
/**
* 是否可以編輯數量
*/
private boolean isEditNumber;
private boolean isEditNumber = true;
public GoodsDetailsPopup(@NonNull Context context, PurchaseFoodBean purchaseFoodBean) {
super(context);
......
......@@ -2,6 +2,7 @@ package com.gingersoft.supply_chain.mvp.ui.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.inputmethod.EditorInfo;
......@@ -297,6 +298,9 @@ public class ScanSnView extends FrameLayout {
for (String sn : sns) {
for (PurchaseFoodEncodeSn datum : adapter.getData()) {
if (datum.getEncodeSnNo().equals(sn)) {
if (datum.newAdd) {
newCodeSize--;
}
adapter.remove(datum);
break;
}
......
......@@ -92,18 +92,13 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_2"
android:clipChildren="true"
android:hint="@string/str_remark_colon"
android:visibility="gone"
app:counterEnabled="true"
app:counterMaxLength="50">
android:visibility="gone">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/ed_warehouse_order_remark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxHeight="@dimen/dp_40"
android:paddingLeft="@dimen/dp_0"
android:paddingTop="@dimen/dp_5"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_14" />
......
......@@ -20,6 +20,7 @@
android:orientation="vertical">
<LinearLayout
android:id="@+id/layout_inventory_details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
......@@ -150,7 +151,7 @@
app:srlAccentColor="@color/theme_333_color"
app:srlEnablePreviewInEditMode="true"
app:srlPrimaryColor="@color/trans">
<!-- 這裡多用一個lineaarlayout是因為需要給消耗的視圖留位置-->
<LinearLayout
android:id="@+id/layout_warehousing_root"
android:layout_width="match_parent"
......@@ -162,7 +163,6 @@
android:id="@+id/vp_warehouse_viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="true"
android:layout_marginTop="@dimen/dp_10" />
</LinearLayout>
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
......
......@@ -54,6 +54,7 @@
android:textStyle="bold"
tools:text="海鮮天地" />
</LinearLayout>
<TextView
android:id="@+id/tv_food_item_no"
android:layout_width="match_parent"
......@@ -110,15 +111,15 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:divider="@color/color_3c"
android:gravity="center_vertical"
android:gravity="bottom"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_commodity_edit"
android:layout_width="@dimen/dp_26"
android:layout_height="@dimen/dp_26"
android:src="@drawable/ic_blue_edit"
android:padding="@dimen/dp_3"
android:src="@drawable/ic_blue_edit"
android:visibility="gone" />
<ImageView
......@@ -127,8 +128,8 @@
android:layout_height="@dimen/dp_26"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_5"
android:src="@drawable/ic_red_delete"
android:padding="@dimen/dp_3"
android:src="@drawable/ic_red_delete"
android:visibility="gone" />
<com.qmuiteam.qmui.layout.QMUIButton
......@@ -140,7 +141,7 @@
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/ed_food_ingredient_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_4"
android:layout_marginRight="@dimen/dp_4"
android:background="@null"
......@@ -153,7 +154,7 @@
android:minWidth="@dimen/dp_30"
android:textColor="@color/black"
android:textCursorDrawable="@drawable/cursor_theme"
android:textSize="@dimen/dp_22"
android:textSize="@dimen/dp_20"
tools:text="10" />
<com.qmuiteam.qmui.layout.QMUIButton
......
......@@ -116,7 +116,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_4"
android:gravity="center_vertical"
android:gravity="bottom"
android:orientation="horizontal">
<View
......@@ -165,6 +165,7 @@
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="center"
android:includeFontPadding="false"
android:inputType="number"
android:maxLength="4"
android:maxLines="1"
......
......@@ -6,9 +6,9 @@
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:background="@drawable/shape_white_eight_corners_bg"
android:elevation="@dimen/dp_10"
android:elevation="@dimen/dp_4"
android:orientation="vertical"
android:paddingBottom="@dimen/dp_4">
android:paddingBottom="@dimen/dp_6">
<LinearLayout
android:layout_width="match_parent"
......@@ -65,15 +65,6 @@
android:textSize="@dimen/sp_16" />
<TextView
android:id="@+id/tv_warehouse_details_order_time"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/color_3c"
android:textSize="@dimen/sp_16"
tools:text="2020-11-20" />
<TextView
android:id="@+id/tv_warehouse_details_supplier"
android:layout_width="0dp"
android:layout_height="wrap_content"
......@@ -103,18 +94,6 @@
android:visibility="gone" />
<TextView
android:id="@+id/tv_warehouse_details_time"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/tv_warehouse_details_reason"
android:layout_toRightOf="@id/tv_warehouse_time_text"
android:layout_weight="1"
android:textColor="@color/color_3c"
android:textSize="@dimen/sp_16"
android:visibility="gone"
tools:text="2020-11-20" />
<TextView
android:id="@+id/tv_warehouse_details_remarks"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......@@ -164,6 +143,7 @@
android:layout_marginRight="@dimen/dp_4"
android:paddingLeft="@dimen/dp_10"
android:paddingTop="@dimen/dp_4"
android:layout_marginLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_10"
android:paddingBottom="@dimen/dp_4"
android:textColor="@color/white"
......
......@@ -4,5 +4,6 @@
android:id="@+id/rv_purchase_list_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/trans"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
\ No newline at end of file
......@@ -63,5 +63,8 @@
<string name="str_chosen">已選擇</string>
<string name="str_warehousing_order">入庫單</string>
<string name="str_format_warehousing_member">入庫人:%1$s</string>
<string name="str_format_order_date">下單日期:%1$s</string>
<string name="str_format_warehousing_date">入庫日期:%1$s</string>
<string name="str_format_consumption_date">消耗日期:%1$s</string>
</resources>
\ No newline at end of file
package com.gingersoft.gsa.cloud.common.function.click;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.gingersoft.gsa.cloud.common.R;
import com.gingersoft.gsa.cloud.common.logan.LoganManager;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import java.lang.reflect.Method;
import java.util.Calendar;
import butterknife.OnClick;
import butterknife.internal.DebouncingOnClickListener;
/**
* 全局點擊事件AOP
*
* @author admin
*/
@Aspect
public class BaseClickAspect {
static int TIME_TAG = R.id.click_time;
protected final String TAG = this.getClass().getSimpleName();
/**
* 方法切入点
*/
@Pointcut("execution(* android.view.View.OnClickListener.onClick(..))")
public void onClickMethod() {
}
/**
* 在连接点进行方法替换
*
* @param joinPoint
* @throws Throwable
*/
@Around("onClickMethod()")
public void doClickMethod(ProceedingJoinPoint joinPoint) throws Throwable {
View view = null;
Class<?> declaringType = joinPoint.getSignature().getDeclaringType();
if (declaringType == DebouncingOnClickListener.class) {
// 是butterknife註解,不攔截。因為butterknife底層實現也是OnClickListener
// 所以第一次是butterknife,第二次才是真正的執行
joinPoint.proceed();//执行原方法
return;
}
Object[] args = joinPoint.getArgs();
for (Object arg : args) {
if (arg instanceof View) {
view = (View) arg;
}
if (view != null) {
getViewInfo(view);
Object tag = view.getTag(TIME_TAG);
long lastClickTime = ((tag != null) ? (long) tag : 0);
long currentTime = Calendar.getInstance().getTimeInMillis();
if (currentTime - lastClickTime > 500) {//过滤掉500毫秒内的连续点击
view.setTag(TIME_TAG, currentTime);
joinPoint.proceed();//执行原方法
}
}
}
}
private void getViewInfo(View view) {
if (recordText(view)) {
return;
} else if (view instanceof ViewGroup) {
ViewGroup viewGroup = (ViewGroup) view;
int childCount = viewGroup.getChildCount();
for (int i = 0; i < childCount; i++) {
if (recordText(viewGroup.getChildAt(i))) {
return;
}
}
//沒有子view是textview的。就查找子view有沒有有id的
for (int i = 0; i < childCount; i++) {
if (recordId(viewGroup.getChildAt(i))) {
return;
}
}
}
recordId(view);
}
private boolean recordText(View view) {
if (view instanceof TextView) {
TextView textView = (TextView) view;
LoganManager.w_global(TAG, LoganManager.EVENT_CLICK + textView.getText());
return true;
}
return false;
}
private boolean recordId(View view) {
if (view.getId() != View.NO_ID) {
String resourceEntryName = view.getContext().getResources().getResourceEntryName(view.getId());
LoganManager.w_global(TAG, LoganManager.EVENT_CLICK + resourceEntryName);
return true;
}
return false;
}
}
package com.gingersoft.gsa.cloud.common.function.click;
import android.util.Log;
import android.view.View;
import com.gingersoft.gsa.cloud.common.R;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import java.util.Calendar;
/**
* 全局BaseQuickAdapter item點擊事件AOP
*/
@Aspect
public class BaseQueicItemClickAspect {
static int TIME_TAG = R.id.click_time;
/**
* 方法切入点
*/
@Pointcut("execution(* com.chad.library.adapter.base.listener.OnItemClickListener.onItemClick(..))")
public void onItemSingleClickMethod() {
}
/**
* 在连接点进行方法替换
*
* @param joinPoint
* @throws Throwable
*/
@Around("onItemSingleClickMethod()")
public void doItemSingleClickMethod(ProceedingJoinPoint joinPoint) throws Throwable {
View view = null;
for (Object arg : joinPoint.getArgs()) {
if (arg instanceof View) {
view = (View) arg;
}
if (view != null) {
Object tag = view.getTag(TIME_TAG);
long lastClickTime = ((tag != null) ? (long) tag : 0);
Log.d("SingleClickAspect", "lastClickTime:" + lastClickTime);
long currentTime = Calendar.getInstance().getTimeInMillis();
if (currentTime - lastClickTime > 500) {//过滤掉500毫秒内的连续点击
view.setTag(TIME_TAG, currentTime);
Log.d("SingleClickAspect", "currentTime:" + currentTime);
joinPoint.proceed();//执行原方法
} else {
Log.d("SingleClickAspect", "連點了");
}
}
}
}
}
//package com.gingersoft.gsa.cloud.common.function.click;
//
//import android.util.Log;
//import android.view.View;
//
//import com.gingersoft.gsa.cloud.common.R;
//
//import org.aspectj.lang.ProceedingJoinPoint;
//import org.aspectj.lang.annotation.Around;
//import org.aspectj.lang.annotation.Aspect;
//import org.aspectj.lang.annotation.Pointcut;
//
//import java.util.Calendar;
//
///**
// * 全局BaseQuickAdapter item點擊事件AOP
// */
//@Aspect
//public class BaseQueicItemClickAspect {
// static int TIME_TAG = R.id.click_time;
//
// /**
// * 方法切入点
// */
// @Pointcut("execution(* com.chad.library.adapter.base.listener.OnItemClickListener.onItemClick(..))")
// public void onItemSingleClickMethod() {
// }
//
// /**
// * 在连接点进行方法替换
// *
// * @param joinPoint
// * @throws Throwable
// */
// @Around("onItemSingleClickMethod()")
// public void doItemSingleClickMethod(ProceedingJoinPoint joinPoint) throws Throwable {
// View view = null;
// for (Object arg : joinPoint.getArgs()) {
// if (arg instanceof View) {
// view = (View) arg;
// }
// if (view != null) {
// Object tag = view.getTag(TIME_TAG);
// long lastClickTime = ((tag != null) ? (long) tag : 0);
// Log.d("SingleClickAspect", "lastClickTime:" + lastClickTime);
// long currentTime = Calendar.getInstance().getTimeInMillis();
//
// if (currentTime - lastClickTime > 500) {//过滤掉500毫秒内的连续点击
// view.setTag(TIME_TAG, currentTime);
// Log.d("SingleClickAspect", "currentTime:" + currentTime);
// joinPoint.proceed();//执行原方法
// } else {
// Log.d("SingleClickAspect", "連點了");
// }
// }
// }
// }
//}
package com.gingersoft.gsa.cloud.common.function.click;
import android.util.Log;
import com.gingersoft.gsa.cloud.common.core.user.UserContext;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
/**
*
* @author Wyh
* @date 2018/6/13
*/
@Aspect
public class CheckLoginAspect {
@Pointcut("execution(@com.gingersoft.gsa.cloud.common.function.click.CheckLoginState * *(..))")
public void onCheckMethod() {
}
@Around("onCheckMethod()")//在连接点进行方法替换
public void doCheckMethod(ProceedingJoinPoint joinPoint) throws Throwable {
if (UserContext.newInstance().isLogin()) {
//登錄了,执行原方法
joinPoint.proceed();
} else {
//沒登錄,攔截
}
}
}
package com.gingersoft.gsa.cloud.common.function.click;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author 宇航.
* User: admin
* Date: 2021/3/3
* Time: 11:44
* Use: 驗證是否登錄,如果未登錄就攔截,不繼續執行
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface CheckLoginState {
}
package com.gingersoft.gsa.cloud.common.function.click;
import android.util.Log;
import android.view.View;
import com.gingersoft.gsa.cloud.common.R;
......@@ -13,46 +12,54 @@ import org.aspectj.lang.annotation.Pointcut;
import java.util.Calendar;
/**
* Created by jerry on 2018/6/13.
*
* @author Wyh
* @date 2021/01/13
*/
@Aspect
public class SingleClickAspect {
static int TIME_TAG = R.id.click_time;
@Pointcut("execution(@com.gingersoft.gsa.cloud.common.function.click.SingleClick * *(..))")
//方法切入点
public void onSingleClickMethod() {
}
/**
* 對單擊方法進行攔截
* @param joinPoint
* @param singleClick
* @throws Throwable
*/
@Around("onSingleClickMethod() && @annotation(singleClick)")//在连接点进行方法替换
public void doSingleClickMethod(ProceedingJoinPoint joinPoint, SingleClick singleClick) throws Throwable {
View view = null;
for (Object arg : joinPoint.getArgs())
if (arg instanceof View) view = (View) arg;
for (Object arg : joinPoint.getArgs()) {
if (arg instanceof View) {
view = (View) arg;
}
}
if (view != null) {
Object tag = view.getTag(TIME_TAG);
long lastClickTime = ((tag != null) ? (long) tag : 0);
Log.d("SingleClickAspect", "lastClickTime:" + lastClickTime);
long currentTime = Calendar.getInstance().getTimeInMillis();
long value = singleClick.value();
int[] ids = singleClick.ids();
if (currentTime - lastClickTime > value || !hasId(ids, view.getId())) {//过滤掉500毫秒内的连续点击
view.setTag(TIME_TAG, currentTime);
Log.d("SingleClickAspect", "currentTime:" + currentTime);
joinPoint.proceed();//执行原方法
} else {
Log.d("SingleClickAspect", "連點了");
//連點了
}
}
}
public static boolean hasId(int[] arr, int value) {
for (int i : arr) {
if (i == value)
if (i == value) {
return true;
}
}
return false;
}
}
......@@ -78,6 +78,7 @@ public class LoganManager {
private static final String ORDER_BUSINESS_TAG = "order-> ";
private static final String PAY_BUSINESS_TAG = "pay-> ";
private static final String DELIVERY_PICK_TAG = "delivery-> ";
private static final String GLOBAL_ASPECT_TAG = "Global-> ";
/*******************************交互事件類型**************************************/
......@@ -107,6 +108,10 @@ public class LoganManager {
w_business(HOME_BUSINESS_TAG, TAG, eventAndLog);
}
public static void w_global(String TAG, String... eventAndLog) {
w_business(GLOBAL_ASPECT_TAG, TAG, eventAndLog);
}
public static void w_database(String TAG, String... eventAndLog) {
w_business(DATABASE_BUSINESS_TAG, TAG, eventAndLog);
}
......
......@@ -145,10 +145,10 @@ public class AppCrashHandler implements UncaughtExceptionHandler {
* @return true:如果处理了该异常信息;否则返回false
*/
private boolean handleException(Throwable ex) {
LoganManager.w_crash("handleException start--->" + ex.getMessage());
if (ex == null) {
return false;
}
LoganManager.w_crash("handleException start--->" + ex.getMessage());
Observable.just(0)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
......
......@@ -49,7 +49,6 @@ public class PrintSocketHolder {
public static final int ERROR_66 = 66;// 关闭Socket出错
private Socket socket;
private OutputStream out;
private WeakReference<OnStateChangedListener> mListener;
......
package com.gingersoft.gsa.cloud.ui.adapter.base;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;
import com.gingersoft.gsa.cloud.common.utils.CollectionUtils;
import androidx.lifecycle.Lifecycle;
import androidx.viewpager2.adapter.FragmentStateAdapter;
import java.util.ArrayList;
import java.util.List;
public class BaseFragmentStateAdapter extends FragmentStatePagerAdapter {
/**
* @author admin
*/
public class BaseFragmentStateAdapter extends FragmentStateAdapter {
List<Fragment> fragmentList = new ArrayList<>();
private List<String> mTitles;
List<Fragment> fragmentList;
public BaseFragmentStateAdapter(FragmentManager fm, List<Fragment> fragmentList) {
super(fm);
this.fragmentList = fragmentList;
public BaseFragmentStateAdapter(@NonNull FragmentActivity fragmentActivity) {
super(fragmentActivity);
fragmentList = new ArrayList<>();
}
public BaseFragmentStateAdapter(FragmentManager fm, List<Fragment> fragmentList, List<String> mTitles) {
super(fm);
this.fragmentList = fragmentList;
this.mTitles = mTitles;
public BaseFragmentStateAdapter(@NonNull Fragment fragment) {
super(fragment);
fragmentList = new ArrayList<>();
}
@Override
public CharSequence getPageTitle(int position) {
return !CollectionUtils.isNullOrEmpty(mTitles) ? mTitles.get(position) : "";
public BaseFragmentStateAdapter(@NonNull FragmentManager fragmentManager, @NonNull Lifecycle lifecycle) {
super(fragmentManager, lifecycle);
fragmentList = new ArrayList<>();
}
public void addFragment(Fragment fragment) {
fragmentList.add(fragment);
notifyDataSetChanged();
}
public void addFragments(List<Fragment> fragments) {
fragmentList.addAll(fragments);
notifyDataSetChanged();
}
public void removeFragment() {
if (fragmentList.size() > 0) {
fragmentList.remove(fragmentList.size() - 1);
notifyDataSetChanged();
}
}
@NonNull
@Override
public Fragment getItem(int position) {
public Fragment createFragment(int position) {
return fragmentList.get(position);
}
@Override
public int getCount() {
public int getItemCount() {
return fragmentList.size();
}
......
......@@ -21,9 +21,7 @@
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/input_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:counterEnabled="true"
app:counterMaxLength="@integer/remark_max_length">
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/ed_multi_value"
......
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