Commit 3e324138 by Wyh

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

parent 69e9e173
...@@ -2,6 +2,7 @@ ext.mainApp = true //设置为true,表示此module为主app module,一直 ...@@ -2,6 +2,7 @@ ext.mainApp = true //设置为true,表示此module为主app module,一直
apply from: rootProject.file("cc-settings.gradle") apply from: rootProject.file("cc-settings.gradle")
apply plugin: 'com.jakewharton.butterknife' apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'com.didi.dokit' apply plugin: 'com.didi.dokit'
apply plugin: 'android-aspectjx'
android { android {
signingConfigs { signingConfigs {
...@@ -24,7 +25,9 @@ android { ...@@ -24,7 +25,9 @@ android {
defaultConfig { defaultConfig {
minSdkVersion rootProject.ext.android["minSdkVersion"] minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"] targetSdkVersion rootProject.ext.android["targetSdkVersion"]
if (project.ext.runAsApp) {
applicationId 'com.gingersoft.gsa.cloud' applicationId 'com.gingersoft.gsa.cloud'
}
versionCode rootProject.ext.android["versionCode"] versionCode rootProject.ext.android["versionCode"]
versionName rootProject.ext.android["versionName"] versionName rootProject.ext.android["versionName"]
multiDexEnabled true multiDexEnabled true
...@@ -60,6 +63,7 @@ android { ...@@ -60,6 +63,7 @@ android {
enabled = true enabled = true
} }
//修改生成的apk名字 //修改生成的apk名字
if (project.ext.runAsApp) {
applicationVariants.all { variant -> applicationVariants.all { variant ->
variant.outputs.all { variant.outputs.all {
def fileName def fileName
...@@ -73,6 +77,7 @@ android { ...@@ -73,6 +77,7 @@ android {
outputFileName = fileName outputFileName = fileName
} }
} }
}
dexOptions { dexOptions {
// incremental true // incremental true
javaMaxHeapSize "4g" javaMaxHeapSize "4g"
...@@ -116,9 +121,8 @@ dokitExt { ...@@ -116,9 +121,8 @@ dokitExt {
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
if (project.ext.runAsApp) {
addComponent 'component-main' addComponent 'component-main'
addComponent 'component-download'
addComponent 'component-table' addComponent 'component-table'
addComponent 'component-print' addComponent 'component-print'
addComponent 'component-delivery-pick' addComponent 'component-delivery-pick'
...@@ -128,8 +132,64 @@ dependencies { ...@@ -128,8 +132,64 @@ dependencies {
addComponent 'component-webview' addComponent 'component-webview'
addComponent 'component-scan' addComponent 'component-scan'
addComponent 'component-pay' 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' implementation 'androidx.viewpager2:viewpager2:1.0.0-alpha03'
annotationProcessor rootProject.ext.dependencies["dagger2-compiler"] annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]
implementation rootProject.ext.dependencies["autosize"] 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; package com.gingersoft.gsa.cloud.login;
import android.content.Intent; import android.content.Intent;
import com.billy.cc.core.component.CC; import com.billy.cc.core.component.CC;
import com.billy.cc.core.component.CCResult; import com.billy.cc.core.component.CCResult;
import com.billy.cc.core.component.CCUtil; import com.billy.cc.core.component.CCUtil;
...@@ -22,7 +23,7 @@ public class ComponentLogin implements IComponent { ...@@ -22,7 +23,7 @@ public class ComponentLogin implements IComponent {
public String getName() { public String getName() {
//组件的名称,调用此组件的方式: //组件的名称,调用此组件的方式:
// CC.obtainBuilder("ComponentA")...build().callAsync() // CC.obtainBuilder("ComponentA")...build().callAsync()
return ComponentName.COMPONENT_LOGIN ; return ComponentName.COMPONENT_LOGIN;
} }
/** /**
...@@ -42,8 +43,7 @@ public class ComponentLogin implements IComponent { ...@@ -42,8 +43,7 @@ public class ComponentLogin implements IComponent {
openWelcomeActivity(cc); openWelcomeActivity(cc);
break; break;
case ComponentAction.Login.OPEN_LOGIN: case ComponentAction.Login.OPEN_LOGIN:
openLoginActivity(cc); return openLoginActivity(cc);
break;
case ComponentAction.Login.OPEN_INIT_HYWEB_PAGE: case ComponentAction.Login.OPEN_INIT_HYWEB_PAGE:
hywebOpenActivity(); hywebOpenActivity();
break; break;
...@@ -77,9 +77,10 @@ public class ComponentLogin implements IComponent { ...@@ -77,9 +77,10 @@ public class ComponentLogin implements IComponent {
CC.sendCCResult(cc.getCallId(), CCResult.success("userName", userName)); CC.sendCCResult(cc.getCallId(), CCResult.success("userName", userName));
} }
private void openLoginActivity(CC cc) { private boolean openLoginActivity(CC cc) {
CCUtil.navigateTo(cc, LoginActivity.class); CCUtil.navigateTo(cc, LoginActivity.class);
CC.sendCCResult(cc.getCallId(), CCResult.success()); // CC.sendCCResult(cc.getCallId(), CCResult.success());
return true;
} }
private void openWelcomeActivity(CC cc) { private void openWelcomeActivity(CC cc) {
...@@ -87,8 +88,8 @@ public class ComponentLogin implements IComponent { ...@@ -87,8 +88,8 @@ public class ComponentLogin implements IComponent {
CC.sendCCResult(cc.getCallId(), CCResult.success()); CC.sendCCResult(cc.getCallId(), CCResult.success());
} }
private void hywebOpenActivity(){ private void hywebOpenActivity() {
Intent intent = new Intent(GsaCloudApplication.getAppContext(),LoginActivity.class); Intent intent = new Intent(GsaCloudApplication.getAppContext(), LoginActivity.class);
GsaCloudApplication.getAppContext().startActivity(intent); GsaCloudApplication.getAppContext().startActivity(intent);
} }
......
...@@ -78,6 +78,8 @@ public class ChooseRestaurantPresenter extends BasePresenter<ChooseRestaurantCon ...@@ -78,6 +78,8 @@ public class ChooseRestaurantPresenter extends BasePresenter<ChooseRestaurantCon
super.onError(t); super.onError(t);
mRootView.showMessage("獲取餐廳信息失敗"); mRootView.showMessage("獲取餐廳信息失敗");
mRootView.killMyself(); mRootView.killMyself();
//登陸失敗時跳回登陸頁面
mRootView.jumpActivity(LoginActivity.class);
} }
}); });
} }
......
...@@ -7,12 +7,16 @@ import android.os.Bundle; ...@@ -7,12 +7,16 @@ import android.os.Bundle;
import android.view.Gravity; import android.view.Gravity;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.billy.cc.core.component.CC; 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.constans.AppConstans;
import com.gingersoft.gsa.cloud.common.core.restaurant.BrandInfo; import com.gingersoft.gsa.cloud.common.core.restaurant.BrandInfo;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfo; import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfo;
...@@ -46,11 +50,15 @@ import com.qmuiteam.qmui.widget.QMUITopBar; ...@@ -46,11 +50,15 @@ import com.qmuiteam.qmui.widget.QMUITopBar;
import com.qmuiteam.qmui.widget.section.QMUISection; import com.qmuiteam.qmui.widget.section.QMUISection;
import com.qmuiteam.qmui.widget.section.QMUIStickySectionAdapter; import com.qmuiteam.qmui.widget.section.QMUIStickySectionAdapter;
import com.qmuiteam.qmui.widget.section.QMUIStickySectionLayout; import com.qmuiteam.qmui.widget.section.QMUIStickySectionLayout;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import javax.inject.Inject; import javax.inject.Inject;
import butterknife.BindView; import butterknife.BindView;
import static com.jess.arms.utils.Preconditions.checkNotNull; import static com.jess.arms.utils.Preconditions.checkNotNull;
...@@ -140,11 +148,12 @@ public class ChooseRestaurantActivity extends BaseActivity<ChooseRestaurantPrese ...@@ -140,11 +148,12 @@ public class ChooseRestaurantActivity extends BaseActivity<ChooseRestaurantPrese
@Override @Override
public void showLoading(String message) { public void showLoading(String message) {
if (message != null) if (message != null) {
LoadingDialog.showDialogForLoading(this, message, true); LoadingDialog.showDialogForLoading(this, message, true);
else } else {
LoadingDialog.showDialogForLoading(this); LoadingDialog.showDialogForLoading(this);
} }
}
@Override @Override
public void hideLoading() { public void hideLoading() {
...@@ -276,6 +285,7 @@ public class ChooseRestaurantActivity extends BaseActivity<ChooseRestaurantPrese ...@@ -276,6 +285,7 @@ public class ChooseRestaurantActivity extends BaseActivity<ChooseRestaurantPrese
@Override @Override
public void jumpDownloadActivity() { public void jumpDownloadActivity() {
killBeforeActivity(); killBeforeActivity();
CC.sendCCResult(CCUtil.getNavigateCallId(this), CCResult.success());
CC.obtainBuilder(ComponentName.COMPONENT_DOWNLOAD) CC.obtainBuilder(ComponentName.COMPONENT_DOWNLOAD)
.setActionName("showDownloadActivity") .setActionName("showDownloadActivity")
.addParam("fromPage", 1) .addParam("fromPage", 1)
...@@ -304,6 +314,7 @@ public class ChooseRestaurantActivity extends BaseActivity<ChooseRestaurantPrese ...@@ -304,6 +314,7 @@ public class ChooseRestaurantActivity extends BaseActivity<ChooseRestaurantPrese
@Override @Override
public void jumpMainActivity() { public void jumpMainActivity() {
CC.sendCCResult(CCUtil.getNavigateCallId(this), CCResult.success());
CC.obtainBuilder(ComponentName.COMPONENT_MAIN) CC.obtainBuilder(ComponentName.COMPONENT_MAIN)
.setActionName("showMainActivity") .setActionName("showMainActivity")
.build() .build()
......
...@@ -278,11 +278,12 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements ...@@ -278,11 +278,12 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements
@Override @Override
public void showLoading(String message) { public void showLoading(String message) {
if (message != null) if (message != null) {
LoadingDialog.showDialogForLoading(this, message, true); LoadingDialog.showDialogForLoading(this, message, true);
else } else {
LoadingDialog.showDialogForLoading(this); LoadingDialog.showDialogForLoading(this);
} }
}
@Override @Override
public void hideLoading() { public void hideLoading() {
...@@ -336,8 +337,8 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements ...@@ -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}) @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 @Override
public void onClick(View v) { public void onClick(View v) {
switch (v.getId()) { int vId = v.getId();
case R.id.ic_look_pwd: if (vId == R.id.ic_look_pwd) {
passwrodVisibility = !passwrodVisibility; passwrodVisibility = !passwrodVisibility;
if (passwrodVisibility) { if (passwrodVisibility) {
//如果选中,显示密码 //如果选中,显示密码
...@@ -349,8 +350,7 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements ...@@ -349,8 +350,7 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements
edPwd.setTransformationMethod(PasswordTransformationMethod.getInstance()); edPwd.setTransformationMethod(PasswordTransformationMethod.getInstance());
} }
edPwd.setSelection(edPwd.getText() == null ? 0 : edPwd.getText().toString().length()); edPwd.setSelection(edPwd.getText() == null ? 0 : edPwd.getText().toString().length());
break; } else if (vId == R.id.btn_gsa_user_login) {
case R.id.btn_gsa_user_login:
//登陸 //登陸
if (edPwd.getText() == null || edPwd.getText().length() < 6) { if (edPwd.getText() == null || edPwd.getText().length() < 6) {
edPwd.setError("請輸入6~20位長度的密碼"); edPwd.setError("請輸入6~20位長度的密碼");
...@@ -359,22 +359,17 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements ...@@ -359,22 +359,17 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements
} else { } else {
mPresenter.login(edAccount.getText().toString(), edPwd.getText().toString()); mPresenter.login(edAccount.getText().toString(), edPwd.getText().toString());
} }
break; } else if (vId == R.id.iv_clear_account) {
case R.id.iv_clear_account:
//清空賬號框 //清空賬號框
edAccount.setText(""); edAccount.setText("");
icClearAccount.setVisibility(View.GONE); icClearAccount.setVisibility(View.GONE);
break; } else if (vId == R.id.iv_clear_pwd) {
case R.id.iv_clear_pwd:
//清空密碼框 //清空密碼框
edPwd.setText(""); edPwd.setText("");
icClear.setVisibility(View.GONE); icClear.setVisibility(View.GONE);
break; } else if (vId == R.id.tv_forget_pwd) {
case R.id.tv_forget_pwd:
//忘記密碼 //忘記密碼
startActivity(new Intent(this, RecoverPasswordActivity.class)); startActivity(new Intent(this, RecoverPasswordActivity.class));
break;
} }
} }
} }
...@@ -20,6 +20,7 @@ import com.gingersoft.gsa.cloud.common.constans.HttpsConstans; ...@@ -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.constans.PrintConstans;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager; import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.core.user.UserContext; 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.logan.LoganManager;
import com.gingersoft.gsa.cloud.common.printer.AidlUtil; import com.gingersoft.gsa.cloud.common.printer.AidlUtil;
import com.gingersoft.gsa.cloud.common.printer.plugins.PrinterFlowProxy; import com.gingersoft.gsa.cloud.common.printer.plugins.PrinterFlowProxy;
...@@ -160,6 +161,9 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -160,6 +161,9 @@ public class PrjService extends Service implements ReceiveListener {
cancel(wakeDisposable); cancel(wakeDisposable);
cancel(pollDisposable); cancel(pollDisposable);
if (!UserContext.newInstance().isLogin()) { if (!UserContext.newInstance().isLogin()) {
if (pollDisposable != null && !pollDisposable.isDisposed()) {
pollDisposable.dispose();
}
LoganManager.w_printer(TAG, "PrjService 用户未登录!"); LoganManager.w_printer(TAG, "PrjService 用户未登录!");
return; return;
} }
...@@ -167,9 +171,9 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -167,9 +171,9 @@ public class PrjService extends Service implements ReceiveListener {
.subscribe(aLong -> { .subscribe(aLong -> {
LoganManager.w_printer(TAG, "獲取Prj數據-->"); LoganManager.w_printer(TAG, "獲取Prj數據-->");
//輪詢時,關閉打印機連接,避免一直佔用打印機socket連接 //輪詢時,關閉打印機連接,避免一直佔用打印機socket連接
EpsonPrint.getInstance().disconnectPrinter(); // EpsonPrint.getInstance().disconnectPrinter();
EpsonPrint.getInstance().finalizeObject(); // EpsonPrint.getInstance().finalizeObject();
EpsonPrint.getInstance().canNextTask(); // EpsonPrint.getInstance().canNextTask();
//獲取prj數據 //獲取prj數據
getPrjInfo(); getPrjInfo();
}); });
...@@ -178,6 +182,7 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -178,6 +182,7 @@ public class PrjService extends Service implements ReceiveListener {
/** /**
* 請求prj數據 * 請求prj數據
*/ */
@CheckLoginState
private void getPrjInfo() { private void getPrjInfo() {
OkHttp3Utils.get(HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL + "printerRecording/get?restaurantId=" + RestaurantInfoManager.newInstance().getRestaurantId()) OkHttp3Utils.get(HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL + "printerRecording/get?restaurantId=" + RestaurantInfoManager.newInstance().getRestaurantId())
.subscribeOn(Schedulers.io())//切换到io线程進行網絡請求 .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 { ...@@ -21,4 +21,5 @@ public class PurchaseConsumeSnBean {
public String remarks; public String remarks;
//sn食材的sn碼 //sn食材的sn碼
public List<String> encodeFoodNos; public List<String> encodeFoodNos;
} }
...@@ -12,7 +12,6 @@ import java.util.HashMap; ...@@ -12,7 +12,6 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @author 宇航. * @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 ...@@ -292,7 +292,7 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
if (info != null) { if (info != null) {
if (info.isSuccess()) { if (info.isSuccess()) {
//供應商信息修改後,將購物車中的供應商信息修改 //供應商信息修改後,將購物車中的供應商信息修改
supplierInfoBean.setSupplierName(supplierName); // supplierInfoBean.setSupplierName(supplierName);
SupplyShoppingCart.getInstance().updateSupplier(supplierInfoBean); SupplyShoppingCart.getInstance().updateSupplier(supplierInfoBean);
// SupplyShoppingCart.getInstance().removeFoodsBySupplier(supplierBean.getId()); // SupplyShoppingCart.getInstance().removeFoodsBySupplier(supplierBean.getId());
mRootView.saveSuccess(); mRootView.saveSuccess();
......
...@@ -10,6 +10,7 @@ import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils; ...@@ -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.other.TextUtil;
import com.gingersoft.gsa.cloud.common.utils.view.BitmapUtil; import com.gingersoft.gsa.cloud.common.utils.view.BitmapUtil;
import com.gingersoft.supply_chain.mvp.bean.DeputyUnitBean; 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.PurchaseFoodBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodEncodeSn; import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodEncodeSn;
import com.gingersoft.supply_chain.mvp.bean.PurchaseOrderDetailsBean; import com.gingersoft.supply_chain.mvp.bean.PurchaseOrderDetailsBean;
...@@ -17,13 +18,22 @@ import com.gingersoft.supply_chain.mvp.bean.OrderWareHouseBean; ...@@ -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.bean.WareHousingUnitBean;
import com.gingersoft.supply_chain.mvp.content.PurchaseConstant; import com.gingersoft.supply_chain.mvp.content.PurchaseConstant;
import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart; import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart;
import com.google.gson.Gson;
import com.jess.arms.integration.AppManager; import com.jess.arms.integration.AppManager;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.mvp.BasePresenter; import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.http.imageloader.ImageLoader; 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.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull; 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 io.reactivex.schedulers.Schedulers;
import me.jessyan.rxerrorhandler.core.RxErrorHandler; import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber; import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
...@@ -112,7 +122,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -112,7 +122,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
mModel.getOrderDetails(orderId) mModel.getOrderDetails(orderId)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(GET_INFO_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(GET_INFO_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) // .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView)) .compose(RxLifecycleUtils.bindToLifecycle(mRootView))
...@@ -275,6 +285,13 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -275,6 +285,13 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
if (baseResult.isSuccess()) { if (baseResult.isSuccess()) {
mRootView.showMessage("收貨成功"); mRootView.showMessage("收貨成功");
mRootView.killMyself(); 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())) { } else if (TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg()); mRootView.showMessage(baseResult.getErrMsg());
} else { } else {
......
...@@ -32,18 +32,38 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi ...@@ -32,18 +32,38 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi
* ADD_ORDER * ADD_ORDER
* ORDER_TYPE * ORDER_TYPE
*/ */
private int adapterType; // private int adapterType = BuyIngredientsFragment.ADD_ORDER;
/**
* 是否顯示編輯和刪除按鈕
*/
private boolean isEdit = false;
/**
* 是否顯示數量和+-
*/
private boolean isShowNumber = true;
/**
* 是否是顯示單列
*/
private boolean isSinger = true; private boolean isSinger = true;
private OnFoodNumberChangeListener onFoodNumberChangeListener; private OnFoodNumberChangeListener onFoodNumberChangeListener;
private boolean longClick = false; private boolean longClick = false;
private int delayTime = 500; private int delayTime = 500;
public BuyIngredientsAdapter(Context context, List<BuyIngredientsBean> buyIngredientsBeans, int adapterType) { public BuyIngredientsAdapter(Context context, List<BuyIngredientsBean> buyIngredientsBeans) {
super(context, buyIngredientsBeans); super(context, buyIngredientsBeans);
addChildClickViewIds(R.id.iv_commodity_edit, R.id.iv_commodity_delete); 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) { public void setShowSingerRow(boolean showType) {
isSinger = showType; isSinger = showType;
...@@ -144,16 +164,17 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi ...@@ -144,16 +164,17 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi
} }
} }
}); });
if (adapterType == BuyIngredientsFragment.FOOD_INGREDIENTS) { // if (adapterType == BuyIngredientsFragment.FOOD_INGREDIENTS) {
//編輯食材頁面,顯示編輯和刪除,隱藏加減和數量 // //編輯食材頁面,顯示編輯和刪除,隱藏加減和數量
setDisplayStateByType(itemViewHolder, true, false, false); // setDisplayStateByType(itemViewHolder, true, false, false);
} else if (adapterType == BuyIngredientsFragment.ADD_ORDER) { // } else if (adapterType == BuyIngredientsFragment.ADD_ORDER) {
//創建採購單頁面,隱藏編輯和刪除,顯示加減和數量 // //創建採購單頁面,隱藏編輯和刪除,顯示加減和數量
setDisplayStateByType(itemViewHolder, false, purchaseFoodBean.getFoodQuantity() > 0, true); // setDisplayStateByType(itemViewHolder, false, purchaseFoodBean.getFoodQuantity() > 0, true);
} else if (adapterType == BuyIngredientsFragment.GET_FOOD_BY_SUPPLIER) { // } else if (adapterType == BuyIngredientsFragment.GET_FOOD_BY_SUPPLIER) {
//供應商商品列表,編輯和數量都顯示 // //供應商商品列表,編輯和數量都顯示
setDisplayStateByType(itemViewHolder, true, purchaseFoodBean.getFoodQuantity() > 0, true); // 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) -> { // itemViewHolder.setOnFocusChangeListener(R.id.ed_food_ingredient_number, (v, hasFocus) -> {
// CharSequence text = itemViewHolder.getText(R.id.ed_food_ingredient_number); // CharSequence text = itemViewHolder.getText(R.id.ed_food_ingredient_number);
...@@ -164,15 +185,17 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi ...@@ -164,15 +185,17 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi
// } // }
// } // }
// }); // });
} }
private void setDisplayStateByType(BaseViewHolder itemViewHolder, boolean b, boolean b2, boolean b3) { 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.setGone(R.id.iv_commodity_edit, !b);
itemViewHolder.setVisible(R.id.btn_food_operation_sub, b2); itemViewHolder.setGone(R.id.iv_commodity_delete, !b);
itemViewHolder.setVisible(R.id.ed_food_ingredient_number, b2); //減號和數量
itemViewHolder.setVisible(R.id.btn_food_operation_add, b3); 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 ...@@ -181,8 +204,8 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi
* @param showOrHide 顯示或隱藏 true隱藏,false顯示 * @param showOrHide 顯示或隱藏 true隱藏,false顯示
*/ */
private void setSubAndNumShow(BaseViewHolder viewHolder, boolean showOrHide) { private void setSubAndNumShow(BaseViewHolder viewHolder, boolean showOrHide) {
viewHolder.setVisible(R.id.btn_food_operation_sub, !showOrHide); viewHolder.setGone(R.id.btn_food_operation_sub, showOrHide);
viewHolder.setVisible(R.id.ed_food_ingredient_number, !showOrHide); viewHolder.setGone(R.id.ed_food_ingredient_number, showOrHide);
} }
/** /**
......
...@@ -33,7 +33,9 @@ public class FirstLevelCategoryAdapter extends BaseQuickAdapter<OrderCategoryBea ...@@ -33,7 +33,9 @@ public class FirstLevelCategoryAdapter extends BaseQuickAdapter<OrderCategoryBea
private int selectColor = -1; private int selectColor = -1;
private int unSelectColor = -1; private int unSelectColor = -1;
/**
* 一級分類是否顯示此分類已選食材數量
*/
private boolean showNumber = true; private boolean showNumber = true;
public FirstLevelCategoryAdapter(@Nullable List<OrderCategoryBean.FoodCategoryTrees> data, Context context) { public FirstLevelCategoryAdapter(@Nullable List<OrderCategoryBean.FoodCategoryTrees> data, Context context) {
......
package com.gingersoft.supply_chain.mvp.ui.adapter; package com.gingersoft.supply_chain.mvp.ui.adapter;
import android.content.Context; import android.content.Context;
import android.view.View;
import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
......
...@@ -16,22 +16,20 @@ ...@@ -16,22 +16,20 @@
package com.gingersoft.supply_chain.mvp.ui.adapter; package com.gingersoft.supply_chain.mvp.ui.adapter;
import android.text.Layout;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.LinearLayout;
import androidx.recyclerview.widget.RecyclerView; 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.gsa.cloud.ui.recylcler.decorator.MarginDecoration;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
import com.jess.arms.utils.DeviceUtils; import com.jess.arms.utils.DeviceUtils;
/** /**
* RecyclerView Adapter。 * RecyclerView Adapter。
* @author admin
*/ */
public class PurchasePageAdapter extends RecyclerView.Adapter<PurchasePageAdapter.ViewHolder> { public class PurchasePageAdapter extends RecyclerView.Adapter<PurchasePageAdapter.ViewHolder> {
......
...@@ -58,11 +58,16 @@ public class WareHousingDetailsAdapter extends BaseQuickAdapter<WarehouseDetails ...@@ -58,11 +58,16 @@ public class WareHousingDetailsAdapter extends BaseQuickAdapter<WarehouseDetails
//小於0,直接顯示負數 //小於0,直接顯示負數
viewHolder.setText(R.id.tv_warehouse_details_food_num, String.valueOf(item.getFoodQuantity())); viewHolder.setText(R.id.tv_warehouse_details_food_num, String.valueOf(item.getFoodQuantity()));
} }
viewHolder.setGone(R.id.tv_warehouse_time_text, false); if (TextUtil.isEmptyOrNullOrUndefined(item.getPurchaseTime()) && TextUtil.isNotEmptyOrNullOrUndefined(item.getWarehousingTime())) {
viewHolder.setText(R.id.tv_warehouse_order_time_text, "下單日期:"); //下單時間為空,入庫時間不為空
//入庫日期 //下單時間改為入庫時間,隱藏入庫時間控件
viewHolder.setText(R.id.tv_warehouse_details_time, 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_details_time, false); // 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); viewHolder.setGone(R.id.tv_warehouse_details_remarks, true);
} else { } else {
//出庫,顯示- //出庫,顯示-
...@@ -75,17 +80,14 @@ public class WareHousingDetailsAdapter extends BaseQuickAdapter<WarehouseDetails ...@@ -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_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); viewHolder.setGone(R.id.tv_warehouse_details_remarks, false);
if (TextUtil.isNotEmptyOrNullOrUndefined(item.getRemarks())) { 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_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()); viewHolder.setText(R.id.tv_warehouse_details_supplier, item.getSupplierName());
//入庫來源 //入庫來源
...@@ -107,7 +109,7 @@ public class WareHousingDetailsAdapter extends BaseQuickAdapter<WarehouseDetails ...@@ -107,7 +109,7 @@ public class WareHousingDetailsAdapter extends BaseQuickAdapter<WarehouseDetails
tvState.setTextColor(ContextCompat.getColor(getContext(), R.color.bright_orange)); tvState.setTextColor(ContextCompat.getColor(getContext(), R.color.bright_orange));
tvState.setVisibility(View.VISIBLE); tvState.setVisibility(View.VISIBLE);
} else { } else {
tvState.setVisibility(View.INVISIBLE); tvState.setVisibility(View.GONE);
} }
if (item.getDistanceExpiresTime() >= 0) { if (item.getDistanceExpiresTime() >= 0) {
//即將過期天數大於等於0 //即將過期天數大於等於0
......
...@@ -21,9 +21,8 @@ import com.gingersoft.supply_chain.mvp.presenter.FunctionListPresenter; ...@@ -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.FunctionChildAdapter;
import com.gingersoft.supply_chain.mvp.ui.adapter.PurchaseFunctionAdapter; 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.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.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.order.PurchaseListFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.supplier.SupplierListFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.supplier.SupplierListFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.WareHouseListFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.WareHouseListFragment;
...@@ -36,8 +35,6 @@ import java.util.List; ...@@ -36,8 +35,6 @@ import java.util.List;
import butterknife.BindView; 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 ...@@ -112,8 +109,8 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr
start(SupplierListFragment.newInstance(false, null)); start(SupplierListFragment.newInstance(false, null));
break; break;
case "食材": case "食材":
// start(FoodIngredientsFragment.newInstance(FOOD_INGREDIENTS)); start(FoodManagementFragment.newInstance());
start(BuyIngredientsFragment.newInstance(FOOD_INGREDIENTS)); // start(BuyIngredientsFragment.newInstance(FOOD_INGREDIENTS));
break; break;
case "種類": case "種類":
start(CategoryFragment.newInstance()); start(CategoryFragment.newInstance());
......
...@@ -14,7 +14,6 @@ import android.widget.TextView; ...@@ -14,7 +14,6 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.cardview.widget.CardView; import androidx.cardview.widget.CardView;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.RecyclerView.OnScrollListener; import androidx.recyclerview.widget.RecyclerView.OnScrollListener;
...@@ -30,16 +29,13 @@ import com.gingersoft.supply_chain.di.component.DaggerBuyIngredientsComponent; ...@@ -30,16 +29,13 @@ import com.gingersoft.supply_chain.di.component.DaggerBuyIngredientsComponent;
import com.gingersoft.supply_chain.mvp.bean.BuyIngredientsBean; import com.gingersoft.supply_chain.mvp.bean.BuyIngredientsBean;
import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean; import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean; import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart;
import com.gingersoft.supply_chain.mvp.contract.BuyIngredientsContract; import com.gingersoft.supply_chain.mvp.contract.BuyIngredientsContract;
import com.gingersoft.supply_chain.mvp.presenter.BuyIngredientsPresenter; import com.gingersoft.supply_chain.mvp.presenter.BuyIngredientsPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.BuyIngredientsAdapter; import com.gingersoft.supply_chain.mvp.ui.adapter.BuyIngredientsAdapter;
import com.gingersoft.supply_chain.mvp.ui.adapter.FirstLevelCategoryAdapter; import com.gingersoft.supply_chain.mvp.ui.adapter.FirstLevelCategoryAdapter;
import com.gingersoft.supply_chain.mvp.ui.adapter.SecondCategoryAdapter; import com.gingersoft.supply_chain.mvp.ui.adapter.SecondCategoryAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.order.PurchaseListFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.order.ShoppingCatFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.order.ShoppingCatFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.WarehousingOrderDetailsFragment;
import com.gingersoft.supply_chain.mvp.ui.widget.CenterLayoutManager; import com.gingersoft.supply_chain.mvp.ui.widget.CenterLayoutManager;
import com.gingersoft.supply_chain.mvp.ui.widget.GoodsDetailsPopup; import com.gingersoft.supply_chain.mvp.ui.widget.GoodsDetailsPopup;
import com.gingersoft.supply_chain.mvp.ui.widget.GroupedGridLayoutManager; import com.gingersoft.supply_chain.mvp.ui.widget.GroupedGridLayoutManager;
...@@ -62,7 +58,6 @@ import com.scwang.smartrefresh.layout.header.ClassicsHeader; ...@@ -62,7 +58,6 @@ import com.scwang.smartrefresh.layout.header.ClassicsHeader;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.Collections;
import java.util.List; import java.util.List;
import butterknife.BindView; import butterknife.BindView;
...@@ -73,6 +68,7 @@ import static com.gingersoft.supply_chain.mvp.ui.fragment.food.NewFoodIngredient ...@@ -73,6 +68,7 @@ import static com.gingersoft.supply_chain.mvp.ui.fragment.food.NewFoodIngredient
/** /**
* Description: 選購食材 * Description: 選購食材
* @author admin
*/ */
public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredientsPresenter> public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredientsPresenter>
implements BuyIngredientsContract.View, View.OnClickListener { implements BuyIngredientsContract.View, View.OnClickListener {
...@@ -89,7 +85,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -89,7 +85,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
QMUIAlphaTextView tvSwitchFoodIngredientsShowType; QMUIAlphaTextView tvSwitchFoodIngredientsShowType;
@BindView(R2.id.rv_food_ingredients_category) @BindView(R2.id.rv_food_ingredients_category)
RecyclerView rvFirstCategory; RecyclerView rvFirstCategory;
private FirstLevelCategoryAdapter firstLevelCategoryAdapter; protected FirstLevelCategoryAdapter firstLevelCategoryAdapter;
@BindView(R2.id.layout_ingredients_left) @BindView(R2.id.layout_ingredients_left)
LinearLayout layoutIngredientsLeft; LinearLayout layoutIngredientsLeft;
...@@ -97,7 +93,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -97,7 +93,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
RecyclerView rvSecondCategory; RecyclerView rvSecondCategory;
private SecondCategoryAdapter secondCategoryAdapter; private SecondCategoryAdapter secondCategoryAdapter;
private BuyIngredientsAdapter adapter; protected BuyIngredientsAdapter adapter;
@BindView(R2.id.rv_food_ingredients) @BindView(R2.id.rv_food_ingredients)
RecyclerView rvFoodIngredients; RecyclerView rvFoodIngredients;
@BindView(R2.id.srl_supplier) @BindView(R2.id.srl_supplier)
...@@ -142,57 +138,24 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -142,57 +138,24 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
* 0單列 * 0單列
* 1雙列 * 1雙列
*/ */
private boolean isSinger = true; protected boolean isSinger = true;
/** /**
* 是否顯示供應商食材 * 是否顯示供應商食材
* true 是 false 否,顯示分類食材 * true 是 false 否,顯示分類食材
*/ */
private boolean isShowSupplier = false; protected boolean isShowSupplier = false;
private LoadService fullRegister; protected LoadService fullRegister;
/**
* 頁面類型越來越多了,有時間重寫一下,區分出不同的頁面來
*/
/**
* 頁面類型
* FOOD_INGREDIENTS 為編輯食材頁面
* ADD_ORDER 為添加訂單頁面
* GET_FOOD_BY_SUPPLIER 根据供應商顯示食品列表
* GET_FOOD_BY_WAREHOUSING_ORDER 入庫訂單選購食材
*/
private int pageType = 1;
public final static int FOOD_INGREDIENTS = 1;
public final static int ADD_ORDER = 2;
public final static int GET_FOOD_BY_SUPPLIER = 3;
public final static int GET_FOOD_BY_WAREHOUSING_ORDER = 4;
private final static String pageTypeKey = "pageType";
private final static String supplierIdKey = "supplierId";
private final static String supplierNameKey = "supplierName";
/** /**
* 購物車requestCode * 購物車requestCode
*/ */
public final static int TO_SHOPPING_CART_REQUEST_CODE = 1001; protected final static int TO_SHOPPING_CART_REQUEST_CODE = 1001;
/** /**
* 新增/編輯食材 request_code * 新增/編輯食材 request_code
*/ */
private final int EDIT_FOOD_REQUEST_CODE = 1050; protected final int EDIT_FOOD_REQUEST_CODE = 1050;
public static BuyIngredientsFragment newInstance(int pageType) { public static BuyIngredientsFragment newInstance() {
BuyIngredientsFragment fragment = new BuyIngredientsFragment(); return new BuyIngredientsFragment();
Bundle bundle = new Bundle();
bundle.putInt(pageTypeKey, pageType);
fragment.setArguments(bundle);
return fragment;
}
public static BuyIngredientsFragment newInstance(int supplierId, String supplierName) {
BuyIngredientsFragment fragment = new BuyIngredientsFragment();
Bundle bundle = new Bundle();
bundle.putInt(pageTypeKey, GET_FOOD_BY_SUPPLIER);
bundle.putInt(supplierIdKey, supplierId);
bundle.putString(supplierNameKey, supplierName);
fragment.setArguments(bundle);
return fragment;
} }
@Override @Override
...@@ -212,14 +175,13 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -212,14 +175,13 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
@Override @Override
public void initData(@Nullable Bundle savedInstanceState) { public void initData(@Nullable Bundle savedInstanceState) {
Bundle arguments = getArguments();
if (arguments != null) {
pageType = arguments.getInt(pageTypeKey);
}
initTopBar(); initTopBar();
initViewByPageType(); initPage();
initLoadSir(); initLoadSir();
initRefresh(); initRefresh();
//將購物車中的食品數據導出
//初始化購物車數量
setTvShoppingCartNum(mPresenter.statisticsFoodQuantity());
loadDataByType(); loadDataByType();
} }
...@@ -259,46 +221,43 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -259,46 +221,43 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
/** /**
* 根據類型加載數據 * 根據類型加載數據
*/ */
private void loadDataByType() { protected void loadDataByType() {
//將購物車中的食品數據導出 // if (pageType == GET_FOOD_BY_SUPPLIER) {
//初始化購物車數量 // Bundle arguments = getArguments();
setTvShoppingCartNum(mPresenter.statisticsFoodQuantity()); // if (arguments != null) {
if (pageType == GET_FOOD_BY_SUPPLIER) { // int supplierId = arguments.getInt(supplierIdKey);
Bundle arguments = getArguments(); // String supplierName = arguments.getString(supplierNameKey);
if (arguments != null) { // //設置標題為這個供應商名字
int supplierId = arguments.getInt(supplierIdKey); // topbarFoodIngredients.setTitle(supplierName);
String supplierName = arguments.getString(supplierNameKey); // //設置左側顯示數據
//設置標題為這個供應商名字 // OrderCategoryBean.FoodCategoryTrees supplierToCategory = new OrderCategoryBean.FoodCategoryTrees(supplierId, supplierName, 0);
topbarFoodIngredients.setTitle(supplierName); // //只顯示一個供應商信息,所以隱藏左邊側邊欄
//設置左側顯示數據 // layoutIngredientsLeft.setVisibility(View.GONE);
OrderCategoryBean.FoodCategoryTrees supplierToCategory = new OrderCategoryBean.FoodCategoryTrees(supplierId, supplierName, 0); // //將顯示模式設置為顯示供應商
//只顯示一個供應商信息,所以隱藏左邊側邊欄 // isShowSupplier = true;
layoutIngredientsLeft.setVisibility(View.GONE); // //隱藏二級分類
//將顯示模式設置為顯示供應商 // setSecondCategoryShowState(View.GONE);
isShowSupplier = true; // mPresenter.initSupplierFoods(1);
//隱藏二級分類 // //在一級分類中加載食品信息
setSecondCategoryShowState(View.GONE); // initCategoryInfo(Collections.singletonList(supplierToCategory));
mPresenter.initSupplierFoods(1); // } else {
//在一級分類中加載食品信息 // killMyself();
initCategoryInfo(Collections.singletonList(supplierToCategory)); // }
} else { // } else {
killMyself();
}
} else {
setSecondCategoryShowState(View.VISIBLE); setSecondCategoryShowState(View.VISIBLE);
//獲取一級分類 //獲取一級分類
mPresenter.getCategoryTrees(); mPresenter.getCategoryTrees();
} // }
} }
private void initTopBar() { protected void initTopBar() {
if (pageType == FOOD_INGREDIENTS || pageType == GET_FOOD_BY_WAREHOUSING_ORDER) { // if (pageType == FOOD_INGREDIENTS || pageType == GET_FOOD_BY_WAREHOUSING_ORDER) {
initTopBar(topbarFoodIngredients, "食材管理"); // initTopBar(topbarFoodIngredients, "食材管理");
topbarFoodIngredients.addRightImageButton(R.drawable.ic_circle_new_food_ingredient, R.id.qmui_add_new_food_ingredients).setOnClickListener(v -> { // topbarFoodIngredients.addRightImageButton(R.drawable.ic_circle_new_food_ingredient, R.id.qmui_add_new_food_ingredients).setOnClickListener(v -> {
//新增食材 // //新增食材
toCreateFood(); // toCreateFood();
}); // });
} else { // } else {
initTopBar(topbarFoodIngredients, "採購單"); initTopBar(topbarFoodIngredients, "採購單");
View view = View.inflate(requireContext(), R.layout.view_shopping_car, null); View view = View.inflate(requireContext(), R.layout.view_shopping_car, null);
tvShoppingCart = view.findViewById(R.id.tv_purchase_cart_number); tvShoppingCart = view.findViewById(R.id.tv_purchase_cart_number);
...@@ -306,28 +265,28 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -306,28 +265,28 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
view.setLayoutParams(layoutParams); view.setLayoutParams(layoutParams);
view.setOnClickListener(this); view.setOnClickListener(this);
topbarFoodIngredients.addRightView(view, R.id.qmui_shopping_cart); topbarFoodIngredients.addRightView(view, R.id.qmui_shopping_cart);
} // }
} }
private void initViewByPageType() { protected void initPage() {
if (pageType == FOOD_INGREDIENTS) { // if (pageType == FOOD_INGREDIENTS) {
layoutFoodIngredientsBtn.setVisibility(View.GONE); // layoutFoodIngredientsBtn.setVisibility(View.GONE);
btnNewFoodIngredient.setVisibility(View.VISIBLE); // btnNewFoodIngredient.setVisibility(View.VISIBLE);
layoutChooseSize.setVisibility(View.GONE); // layoutChooseSize.setVisibility(View.GONE);
} else if (pageType == GET_FOOD_BY_WAREHOUSING_ORDER) { // } else if (pageType == GET_FOOD_BY_WAREHOUSING_ORDER) {
//創建入庫單 // //創建入庫單
layoutChooseSize.setVisibility(View.VISIBLE); // layoutChooseSize.setVisibility(View.VISIBLE);
btnFoodIngredientsCancel.setVisibility(View.GONE); // btnFoodIngredientsCancel.setVisibility(View.GONE);
} else { // } else {
layoutChooseSize.setVisibility(View.GONE); layoutChooseSize.setVisibility(View.GONE);
layoutFoodIngredientsBtn.setVisibility(View.VISIBLE); layoutFoodIngredientsBtn.setVisibility(View.VISIBLE);
} // }
} }
/** /**
* 新建食品 * 新建食品
*/ */
private void toCreateFood() { protected void toCreateFood() {
String defaultName = getCurrentCategoryName(); String defaultName = getCurrentCategoryName();
if (isShowSupplier) { if (isShowSupplier) {
startForResult(NewFoodIngredientsFragment.newInstance(defaultName, ""), EDIT_FOOD_REQUEST_CODE); startForResult(NewFoodIngredientsFragment.newInstance(defaultName, ""), EDIT_FOOD_REQUEST_CODE);
...@@ -517,25 +476,25 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -517,25 +476,25 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
/** /**
* 確認,進入購物車頁面 * 確認,進入購物車頁面
*/ */
private void confirm() { protected void confirm() {
List<PurchaseFoodBean> purchaseFood = mPresenter.getPurchaseFood(); List<PurchaseFoodBean> purchaseFood = mPresenter.getPurchaseFood();
if (CollectionUtils.isNotNullOrEmpty(purchaseFood)) { if (CollectionUtils.isNotNullOrEmpty(purchaseFood)) {
if (pageType == GET_FOOD_BY_WAREHOUSING_ORDER) { // if (pageType == GET_FOOD_BY_WAREHOUSING_ORDER) {
//採購入庫單 // //採購入庫單
setFragmentResult(RESULT_OK, null); // setFragmentResult(RESULT_OK, null);
List<Fragment> fragments = requireActivity().getSupportFragmentManager().getFragments(); // List<Fragment> fragments = requireActivity().getSupportFragmentManager().getFragments();
for (Fragment fragment : fragments) { // for (Fragment fragment : fragments) {
if (fragment instanceof WarehousingOrderDetailsFragment) { // if (fragment instanceof WarehousingOrderDetailsFragment) {
//有入庫單詳情 // //有入庫單詳情
killMyself(); // killMyself();
return; // return;
} // }
} // }
//沒入庫單詳情 // //沒入庫單詳情
startWithPop(WarehousingOrderDetailsFragment.newInstance(-1, "")); // startWithPop(WarehousingOrderDetailsFragment.newInstance(-1, ""));
} else { // } else {
startForResult(ShoppingCatFragment.newInstance(), TO_SHOPPING_CART_REQUEST_CODE); startForResult(ShoppingCatFragment.newInstance(), TO_SHOPPING_CART_REQUEST_CODE);
} // }
} else { } else {
showMessage("請選擇食材"); showMessage("請選擇食材");
} }
...@@ -551,8 +510,8 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -551,8 +510,8 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
if (CollectionUtils.isNotNullOrEmpty(foodCategoryTrees)) { if (CollectionUtils.isNotNullOrEmpty(foodCategoryTrees)) {
fullRegister.showSuccess(); fullRegister.showSuccess();
if (firstLevelCategoryAdapter == null) { if (firstLevelCategoryAdapter == null) {
firstLevelCategoryAdapter = new FirstLevelCategoryAdapter(foodCategoryTrees, requireContext()) firstLevelCategoryAdapter = new FirstLevelCategoryAdapter(foodCategoryTrees, requireContext());
.setIsShowNumber(pageType == ADD_ORDER || pageType == GET_FOOD_BY_WAREHOUSING_ORDER); // .setIsShowNumber(pageType == ADD_ORDER || pageType == GET_FOOD_BY_WAREHOUSING_ORDER);
rvFirstCategory.setAdapter(firstLevelCategoryAdapter); rvFirstCategory.setAdapter(firstLevelCategoryAdapter);
firstLevelCategoryAdapter.setOnItemClickListener((adapter, view, position) -> { firstLevelCategoryAdapter.setOnItemClickListener((adapter, view, position) -> {
firstCategoryClick(position); firstCategoryClick(position);
...@@ -673,30 +632,31 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -673,30 +632,31 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
@Override @Override
public void loadFood(List<BuyIngredientsBean> buyIngredientsBeans, boolean addToHead, boolean isReset) { public void loadFood(List<BuyIngredientsBean> buyIngredientsBeans, boolean addToHead, boolean isReset) {
setRefreshState(false); setRefreshState(false);
if (pageType == GET_FOOD_BY_SUPPLIER) { // if (pageType == GET_FOOD_BY_SUPPLIER) {
if (buyIngredientsBeans == null || CollectionUtils.isNullOrEmpty(buyIngredientsBeans.get(0).purchaseFoodList)) { // if (buyIngredientsBeans == null || CollectionUtils.isNullOrEmpty(buyIngredientsBeans.get(0).purchaseFoodList)) {
//如果是單個供應商,需要判斷食材是不是為空 // //如果是單個供應商,需要判斷食材是不是為空
fullRegister.showCallback(NotGoodsCallback.class); // fullRegister.showCallback(NotGoodsCallback.class);
return; // return;
} // }
} // }
fullRegister.showSuccess(); fullRegister.showSuccess();
if (adapter == null) { if (adapter == null) {
adapter = new BuyIngredientsAdapter(requireContext(), buyIngredientsBeans, pageType); adapter = new BuyIngredientsAdapter(requireContext(), buyIngredientsBeans);
rvFoodIngredients.setAdapter(adapter); rvFoodIngredients.setAdapter(adapter);
adapter.setOnItemClickListener((a, holder, groupPosition, childPosition) -> { adapter.setOnItemClickListener((a, holder, groupPosition, childPosition) -> {
BuyIngredientsBean buyIngredientsBean = adapter.getData().get(groupPosition); BuyIngredientsBean buyIngredientsBean = adapter.getData().get(groupPosition);
PurchaseFoodBean purchaseFoodBean = buyIngredientsBean.purchaseFoodList.get(childPosition); PurchaseFoodBean purchaseFoodBean = buyIngredientsBean.purchaseFoodList.get(childPosition);
//显示弹窗 //显示弹窗
new XPopup.Builder(requireContext()) GoodsDetailsPopup foodDetailsPopup = getFoodDetailsPopup(purchaseFoodBean)
.autoOpenSoftInput(false)
.autoFocusEditText(false)
.asCustom(new GoodsDetailsPopup(requireContext(), purchaseFoodBean)
.setOnFoodNumberChangeListener((purchaseFoodBean1, p, c, beforeNum, currentNum) -> { .setOnFoodNumberChangeListener((purchaseFoodBean1, p, c, beforeNum, currentNum) -> {
foodNumberChanger(purchaseFoodBean, groupPosition, beforeNum, currentNum); foodNumberChanger(purchaseFoodBean, groupPosition, beforeNum, currentNum);
//需要刷新列表 //需要刷新列表
adapter.notifyChildChanged(groupPosition, childPosition); adapter.notifyChildChanged(groupPosition, childPosition);
}).setEditNumber(pageType != FOOD_INGREDIENTS)) });
new XPopup.Builder(requireContext())
.autoOpenSoftInput(false)
.autoFocusEditText(false)
.asCustom(foodDetailsPopup)
.show(); .show();
}); });
adapter.setOnItemChildClickListener((a, view, groupPosition, position) -> { adapter.setOnItemChildClickListener((a, view, groupPosition, position) -> {
...@@ -743,6 +703,10 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -743,6 +703,10 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
} }
} }
protected GoodsDetailsPopup getFoodDetailsPopup(PurchaseFoodBean purchaseFoodBean) {
return new GoodsDetailsPopup(requireContext(), purchaseFoodBean);
}
/** /**
* 食品数量改变时调用 * 食品数量改变时调用
* *
...@@ -776,12 +740,8 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -776,12 +740,8 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
setTvShoppingCartNum(shoppingCartNum); setTvShoppingCartNum(shoppingCartNum);
} }
private void setSecondCategoryShowState(int visibility) { protected void setSecondCategoryShowState(int visibility) {
if (pageType != GET_FOOD_BY_SUPPLIER) {
layoutCategory.setVisibility(visibility); layoutCategory.setVisibility(visibility);
} else {
layoutCategory.setVisibility(View.GONE);
}
} }
private void setTvShoppingCartNum(int num) { private void setTvShoppingCartNum(int num) {
...@@ -798,7 +758,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -798,7 +758,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
shoppingCartNum = num; shoppingCartNum = num;
} }
private void setRefreshState(boolean noMoreData) { public void setRefreshState(boolean noMoreData) {
refreshLayout.finishRefresh(); refreshLayout.finishRefresh();
refreshLayout.finishLoadMore(); refreshLayout.finishLoadMore();
refreshLayout.setEnableRefresh(true); refreshLayout.setEnableRefresh(true);
...@@ -851,13 +811,13 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -851,13 +811,13 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
public void onFragmentResult(int requestCode, int resultCode, Bundle data) { public void onFragmentResult(int requestCode, int resultCode, Bundle data) {
super.onFragmentResult(requestCode, resultCode, data); super.onFragmentResult(requestCode, resultCode, data);
if (requestCode == TO_SHOPPING_CART_REQUEST_CODE && resultCode == RESULT_OK) { if (requestCode == TO_SHOPPING_CART_REQUEST_CODE && resultCode == RESULT_OK) {
refreshAllData(); resetData();
} else if (requestCode == EDIT_FOOD_REQUEST_CODE && resultCode == EDIT_FOOD_RESULT_CODE) { } else if (requestCode == EDIT_FOOD_REQUEST_CODE && resultCode == EDIT_FOOD_RESULT_CODE) {
refreshAllData(); resetData();
} }
} }
private void refreshAllData() { private void resetData() {
//之前去到購物車頁面,現在回到這個頁面 //之前去到購物車頁面,現在回到這個頁面
//如果修改了供應商和分類信息,可以清除掉緩存再獲取,就能刷新頁面 //如果修改了供應商和分類信息,可以清除掉緩存再獲取,就能刷新頁面
//購物車食材數量發生了變化,需要刷新當前頁面的食材數量 //購物車食材數量發生了變化,需要刷新當前頁面的食材數量
...@@ -867,12 +827,16 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -867,12 +827,16 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
mPresenter.clearSupplierFoods(); mPresenter.clearSupplierFoods();
mPresenter.clearSupplierCache(); mPresenter.clearSupplierCache();
mPresenter.clearCategoryTreesCache(); mPresenter.clearCategoryTreesCache();
refreshData();
}
protected void refreshData() {
if (isShowSupplier) { if (isShowSupplier) {
if (pageType == GET_FOOD_BY_SUPPLIER) { // if (pageType == GET_FOOD_BY_SUPPLIER) {
mPresenter.getFoodsBySupplier(0, firstLevelCategoryAdapter.getItem(0), false, true); // mPresenter.getFoodsBySupplier(0, firstLevelCategoryAdapter.getItem(0), false, true);
} else { // } else {
mPresenter.loadFoodIngredientsData(-1, true); mPresenter.loadFoodIngredientsData(-1, true);
} // }
} else { } else {
mPresenter.getCategoryTrees(); mPresenter.getCategoryTrees();
} }
......
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; ...@@ -56,8 +56,6 @@ import java.util.List;
import butterknife.BindView; import butterknife.BindView;
import butterknife.OnClick; import butterknife.OnClick;
import static com.gingersoft.supply_chain.mvp.ui.fragment.food.BuyIngredientsFragment.ADD_ORDER;
/** /**
* Description:採購單列表 * Description:採購單列表
...@@ -161,7 +159,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr ...@@ -161,7 +159,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
start(ShoppingCatFragment.newInstance()); start(ShoppingCatFragment.newInstance());
} else { } else {
//跳轉到下單頁面 //跳轉到下單頁面
startForResult(BuyIngredientsFragment.newInstance(ADD_ORDER), REQUEST_ORDER_DETAILS_CODE); toCreateOrder();
} }
}); });
} }
...@@ -280,8 +278,12 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr ...@@ -280,8 +278,12 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
getOrderList(); getOrderList();
} else if (viewId == R.id.btn_save) { } 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 @Override
......
package com.gingersoft.supply_chain.mvp.ui.fragment.order; package com.gingersoft.supply_chain.mvp.ui.fragment.order;
import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
...@@ -23,7 +22,6 @@ import com.gingersoft.supply_chain.mvp.contract.SendMsgContract; ...@@ -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.presenter.SendMsgPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.SendSupplierMsgAdapter; 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.BaseSupplyChainFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodIngredientsFragment;
import com.gingersoft.supply_chain.mvp.ui.widget.TextPopup; import com.gingersoft.supply_chain.mvp.ui.widget.TextPopup;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.DeviceUtils; import com.jess.arms.utils.DeviceUtils;
...@@ -36,8 +34,6 @@ import java.util.List; ...@@ -36,8 +34,6 @@ import java.util.List;
import butterknife.BindView; import butterknife.BindView;
import butterknife.OnClick; 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.Kakao_Talk;
import static com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean.SupplierContacts.Line; import static com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean.SupplierContacts.Line;
......
...@@ -30,6 +30,7 @@ import com.gingersoft.supply_chain.mvp.ui.adapter.SupplierAdapter; ...@@ -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.BaseSupplyChainFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.BuyIngredientsFragment; 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.FoodIngredientsFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.SupplierFoodFragment;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.kingja.loadsir.callback.Callback; import com.kingja.loadsir.callback.Callback;
import com.kingja.loadsir.core.LoadSir; import com.kingja.loadsir.core.LoadSir;
...@@ -244,7 +245,7 @@ public class SupplierListFragment extends BaseSupplyChainFragment<SupplierListPr ...@@ -244,7 +245,7 @@ public class SupplierListFragment extends BaseSupplyChainFragment<SupplierListPr
} else if (view.getId() == R.id.layout_see_ingredients) { } else if (view.getId() == R.id.layout_see_ingredients) {
//跳轉到供應商食品詳情 //跳轉到供應商食品詳情
List<SupplierInfoBean> data = supplierAdapter.getData(); 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 { } 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; package com.gingersoft.supply_chain.mvp.ui.fragment.warehouse;
import android.animation.LayoutTransition; import android.animation.LayoutTransition;
import android.app.Dialog;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
...@@ -15,19 +14,20 @@ import android.widget.TextView; ...@@ -15,19 +14,20 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.print.PrintHelper; import androidx.print.PrintHelper;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager2.widget.ViewPager2; import androidx.viewpager2.widget.ViewPager2;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager; import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.core.user.UserContext; 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.CollectionUtils;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil; import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.common.utils.glide.GlideUtils; 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.other.TextUtil;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils; import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.common.utils.view.LayoutToBitmapUtils; 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.gsa.cloud.ui.utils.AppDialog;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2; import com.gingersoft.supply_chain.R2;
...@@ -41,14 +41,11 @@ import com.gingersoft.supply_chain.mvp.bean.WarehouseDetailsBean; ...@@ -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.contract.WarehouseDetailsContract;
import com.gingersoft.supply_chain.mvp.presenter.WarehouseDetailsPresenter; 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.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.adapter.WareHousingDetailsAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment; 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.InventoryConsumptionView;
import com.gingersoft.supply_chain.mvp.ui.widget.ScanSnView; import com.gingersoft.supply_chain.mvp.ui.widget.ScanSnView;
import com.jess.arms.di.component.AppComponent; 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.qmuiteam.qmui.widget.QMUITopBar;
import com.scwang.smartrefresh.layout.SmartRefreshLayout; import com.scwang.smartrefresh.layout.SmartRefreshLayout;
...@@ -105,7 +102,7 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD ...@@ -105,7 +102,7 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
*/ */
private ScanSnView scanSnView; private ScanSnView scanSnView;
private WareHousingDetailsAdapter wareHousingDetailsAdapter; private WareHousingDetailsAdapter wareHousingDetailsAdapter;
private PurchasePageAdapter adapter; // private PurchasePageAdapter adapter;
public final static String FOOD_INFO_KEY = "purchaseWarehousingBean"; public final static String FOOD_INFO_KEY = "purchaseWarehousingBean";
private PurchaseWarehousingOrderDetailsVO purchaseWarehousingOrderDetailsVO; private PurchaseWarehousingOrderDetailsVO purchaseWarehousingOrderDetailsVO;
...@@ -146,7 +143,6 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD ...@@ -146,7 +143,6 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
Bundle arguments = getArguments(); Bundle arguments = getArguments();
smartRefreshLayout.setPrimaryColorsId(R.color.trans, R.color.black); smartRefreshLayout.setPrimaryColorsId(R.color.trans, R.color.black);
loadService = LoadSir.getDefault().register(smartRefreshLayout);
LayoutTransition layoutTransition = new LayoutTransition(); LayoutTransition layoutTransition = new LayoutTransition();
layoutTransition.enableTransitionType(LayoutTransition.CHANGING); layoutTransition.enableTransitionType(LayoutTransition.CHANGING);
layoutRoot.setLayoutTransition(layoutTransition); layoutRoot.setLayoutTransition(layoutTransition);
...@@ -193,7 +189,17 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD ...@@ -193,7 +189,17 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
mPresenter.getOutStockDetails(purchaseWarehousingOrderDetailsVO.getFoodNo()); mPresenter.getOutStockDetails(purchaseWarehousingOrderDetailsVO.getFoodNo());
} }
private BaseFragmentStateAdapter baseFragmentStateAdapter;
private List<Fragment> fragments;
private void initViewPager() { 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() { vpWarehouseViewpager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
@Override @Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
...@@ -241,35 +247,10 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD ...@@ -241,35 +247,10 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
public void loadAdapter(List<WarehouseDetailsBean> warehouseDetailsBeans) { public void loadAdapter(List<WarehouseDetailsBean> warehouseDetailsBeans) {
smartRefreshLayout.finishRefresh(); smartRefreshLayout.finishRefresh();
smartRefreshLayout.finishLoadMore(); smartRefreshLayout.finishLoadMore();
if (warehouseDetailsBeans.size() <= 0) { Fragment fragment = fragments.get(vpWarehouseViewpager.getCurrentItem());
loadService.showCallback(EmptyCallback.class); if (fragment instanceof InflowWaterFragment) {
} else { InflowWaterFragment inflowWaterFragment = (InflowWaterFragment) fragment;
loadService.showSuccess(); inflowWaterFragment.loadData(purchaseWarehousingOrderDetailsVO, warehouseDetailsBeans, vpWarehouseViewpager.getCurrentItem());
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);
}
} }
} }
...@@ -280,7 +261,6 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD ...@@ -280,7 +261,6 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
button.setOnClickListener(v -> showInventory(consumeReasonBeans)); button.setOnClickListener(v -> showInventory(consumeReasonBeans));
} }
/** /**
* 顯示庫存消耗 * 顯示庫存消耗
* *
...@@ -499,7 +479,7 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD ...@@ -499,7 +479,7 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
public void showList(int visible) { public void showList(int visible) {
vpWarehouseViewpager.setVisibility(visible); vpWarehouseViewpager.setVisibility(visible);
layoutTitle.setVisibility(visible); layoutTitle.setVisibility(visible);
loadService.showSuccess(); // loadService.showSuccess();
if (visible == View.VISIBLE) { if (visible == View.VISIBLE) {
removeInventoryView(); removeInventoryView();
} else { } else {
...@@ -525,20 +505,21 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD ...@@ -525,20 +505,21 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
tvWarehouseInventoryNumber.setText(String.valueOf(num)); 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 @Override
public void onClick(View v) { 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); vpWarehouseViewpager.setCurrentItem(WAREHOUSE_TYPE);
//查詢入庫 //查詢入庫
getWarehouseDetails(); getWarehouseDetails();
} else if (v.getId() == R.id.tv_outbound_record) { } else if (viewId == R.id.tv_outbound_record) {
//出庫流水 //出庫流水
vpWarehouseViewpager.setCurrentItem(OUT_STOCK_TYPE); vpWarehouseViewpager.setCurrentItem(OUT_STOCK_TYPE);
//查詢出庫 //查詢出庫
getOutStockDetails(); 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) { if (purchaseWarehousingOrderDetailsVO.getFoodMarkSn() == PurchaseFoodBean.HAS_SN) {
//是sn食材,查詢庫中剩餘的sn碼 //是sn食材,查詢庫中剩餘的sn碼
start(SnCodeListFragment.newInstance(-1, new WarehouseDetailsBean(purchaseWarehousingOrderDetailsVO.getName(), purchaseWarehousingOrderDetailsVO.getFoodNum(), purchaseWarehousingOrderDetailsVO.getFoodNo()))); 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; ...@@ -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.adapter.WareHousingOrderFoodAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment; 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.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.GoodsDetailsPopup;
import com.gingersoft.supply_chain.mvp.ui.widget.ScanSnPopup; import com.gingersoft.supply_chain.mvp.ui.widget.ScanSnPopup;
import com.gingersoft.supply_chain.mvp.ui.widget.WarehousingFoodDetailsPopup; import com.gingersoft.supply_chain.mvp.ui.widget.WarehousingFoodDetailsPopup;
...@@ -170,7 +171,7 @@ public class WarehousingOrderDetailsFragment extends BaseSupplyChainFragment<War ...@@ -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)); rvWarehousingFood.addItemDecoration(new DefaultItemDecoration(ContextCompat.getColor(requireContext(), R.color.color_ccc), LinearLayout.LayoutParams.MATCH_PARENT, 1));
if (warehousingOrderId == -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 { } else {
//加一條線 //加一條線
wareHousingOrderFoodAdapter.addFooterView(getLayoutInflater().inflate(R.layout.include_horizontal_color_ccc_dividing_line, rvWarehousingFood, false)); wareHousingOrderFoodAdapter.addFooterView(getLayoutInflater().inflate(R.layout.include_horizontal_color_ccc_dividing_line, rvWarehousingFood, false));
......
...@@ -68,7 +68,7 @@ public class GoodsDetailsPopup extends CenterPopupView { ...@@ -68,7 +68,7 @@ public class GoodsDetailsPopup extends CenterPopupView {
/** /**
* 是否可以編輯數量 * 是否可以編輯數量
*/ */
private boolean isEditNumber; private boolean isEditNumber = true;
public GoodsDetailsPopup(@NonNull Context context, PurchaseFoodBean purchaseFoodBean) { public GoodsDetailsPopup(@NonNull Context context, PurchaseFoodBean purchaseFoodBean) {
super(context); super(context);
......
...@@ -2,6 +2,7 @@ package com.gingersoft.supply_chain.mvp.ui.widget; ...@@ -2,6 +2,7 @@ package com.gingersoft.supply_chain.mvp.ui.widget;
import android.content.Context; import android.content.Context;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
...@@ -297,6 +298,9 @@ public class ScanSnView extends FrameLayout { ...@@ -297,6 +298,9 @@ public class ScanSnView extends FrameLayout {
for (String sn : sns) { for (String sn : sns) {
for (PurchaseFoodEncodeSn datum : adapter.getData()) { for (PurchaseFoodEncodeSn datum : adapter.getData()) {
if (datum.getEncodeSnNo().equals(sn)) { if (datum.getEncodeSnNo().equals(sn)) {
if (datum.newAdd) {
newCodeSize--;
}
adapter.remove(datum); adapter.remove(datum);
break; break;
} }
......
...@@ -92,18 +92,13 @@ ...@@ -92,18 +92,13 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_2" android:layout_marginTop="@dimen/dp_2"
android:clipChildren="true"
android:hint="@string/str_remark_colon" android:hint="@string/str_remark_colon"
android:visibility="gone" android:visibility="gone">
app:counterEnabled="true"
app:counterMaxLength="50">
<com.google.android.material.textfield.TextInputEditText <com.google.android.material.textfield.TextInputEditText
android:id="@+id/ed_warehouse_order_remark" android:id="@+id/ed_warehouse_order_remark"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxHeight="@dimen/dp_40"
android:paddingLeft="@dimen/dp_0"
android:paddingTop="@dimen/dp_5" android:paddingTop="@dimen/dp_5"
android:textColor="@color/color_3c" android:textColor="@color/color_3c"
android:textSize="@dimen/dp_14" /> android:textSize="@dimen/dp_14" />
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
android:id="@+id/layout_inventory_details"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10" android:layout_marginLeft="@dimen/dp_10"
...@@ -150,7 +151,7 @@ ...@@ -150,7 +151,7 @@
app:srlAccentColor="@color/theme_333_color" app:srlAccentColor="@color/theme_333_color"
app:srlEnablePreviewInEditMode="true" app:srlEnablePreviewInEditMode="true"
app:srlPrimaryColor="@color/trans"> app:srlPrimaryColor="@color/trans">
<!-- 這裡多用一個lineaarlayout是因為需要給消耗的視圖留位置-->
<LinearLayout <LinearLayout
android:id="@+id/layout_warehousing_root" android:id="@+id/layout_warehousing_root"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -162,7 +163,6 @@ ...@@ -162,7 +163,6 @@
android:id="@+id/vp_warehouse_viewpager" android:id="@+id/vp_warehouse_viewpager"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:clipChildren="true"
android:layout_marginTop="@dimen/dp_10" /> android:layout_marginTop="@dimen/dp_10" />
</LinearLayout> </LinearLayout>
</com.scwang.smartrefresh.layout.SmartRefreshLayout> </com.scwang.smartrefresh.layout.SmartRefreshLayout>
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
android:textStyle="bold" android:textStyle="bold"
tools:text="海鮮天地" /> tools:text="海鮮天地" />
</LinearLayout> </LinearLayout>
<TextView <TextView
android:id="@+id/tv_food_item_no" android:id="@+id/tv_food_item_no"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -110,15 +111,15 @@ ...@@ -110,15 +111,15 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:divider="@color/color_3c" android:divider="@color/color_3c"
android:gravity="center_vertical" android:gravity="bottom"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
android:id="@+id/iv_commodity_edit" android:id="@+id/iv_commodity_edit"
android:layout_width="@dimen/dp_26" android:layout_width="@dimen/dp_26"
android:layout_height="@dimen/dp_26" android:layout_height="@dimen/dp_26"
android:src="@drawable/ic_blue_edit"
android:padding="@dimen/dp_3" android:padding="@dimen/dp_3"
android:src="@drawable/ic_blue_edit"
android:visibility="gone" /> android:visibility="gone" />
<ImageView <ImageView
...@@ -127,8 +128,8 @@ ...@@ -127,8 +128,8 @@
android:layout_height="@dimen/dp_26" android:layout_height="@dimen/dp_26"
android:layout_marginLeft="@dimen/dp_10" android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_5" android:layout_marginRight="@dimen/dp_5"
android:src="@drawable/ic_red_delete"
android:padding="@dimen/dp_3" android:padding="@dimen/dp_3"
android:src="@drawable/ic_red_delete"
android:visibility="gone" /> android:visibility="gone" />
<com.qmuiteam.qmui.layout.QMUIButton <com.qmuiteam.qmui.layout.QMUIButton
...@@ -140,7 +141,7 @@ ...@@ -140,7 +141,7 @@
<com.google.android.material.textfield.TextInputEditText <com.google.android.material.textfield.TextInputEditText
android:id="@+id/ed_food_ingredient_number" android:id="@+id/ed_food_ingredient_number"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_4" android:layout_marginLeft="@dimen/dp_4"
android:layout_marginRight="@dimen/dp_4" android:layout_marginRight="@dimen/dp_4"
android:background="@null" android:background="@null"
...@@ -153,7 +154,7 @@ ...@@ -153,7 +154,7 @@
android:minWidth="@dimen/dp_30" android:minWidth="@dimen/dp_30"
android:textColor="@color/black" android:textColor="@color/black"
android:textCursorDrawable="@drawable/cursor_theme" android:textCursorDrawable="@drawable/cursor_theme"
android:textSize="@dimen/dp_22" android:textSize="@dimen/dp_20"
tools:text="10" /> tools:text="10" />
<com.qmuiteam.qmui.layout.QMUIButton <com.qmuiteam.qmui.layout.QMUIButton
......
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_4" android:layout_marginTop="@dimen/dp_4"
android:gravity="center_vertical" android:gravity="bottom"
android:orientation="horizontal"> android:orientation="horizontal">
<View <View
...@@ -165,6 +165,7 @@ ...@@ -165,6 +165,7 @@
android:focusable="true" android:focusable="true"
android:focusableInTouchMode="true" android:focusableInTouchMode="true"
android:gravity="center" android:gravity="center"
android:includeFontPadding="false"
android:inputType="number" android:inputType="number"
android:maxLength="4" android:maxLength="4"
android:maxLines="1" android:maxLines="1"
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
android:layout_marginLeft="@dimen/dp_10" android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10" android:layout_marginRight="@dimen/dp_10"
android:background="@drawable/shape_white_eight_corners_bg" android:background="@drawable/shape_white_eight_corners_bg"
android:elevation="@dimen/dp_10" android:elevation="@dimen/dp_4"
android:orientation="vertical" android:orientation="vertical"
android:paddingBottom="@dimen/dp_4"> android:paddingBottom="@dimen/dp_6">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -65,15 +65,6 @@ ...@@ -65,15 +65,6 @@
android:textSize="@dimen/sp_16" /> android:textSize="@dimen/sp_16" />
<TextView <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:id="@+id/tv_warehouse_details_supplier"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -103,18 +94,6 @@ ...@@ -103,18 +94,6 @@
android:visibility="gone" /> android:visibility="gone" />
<TextView <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:id="@+id/tv_warehouse_details_remarks"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -164,6 +143,7 @@ ...@@ -164,6 +143,7 @@
android:layout_marginRight="@dimen/dp_4" android:layout_marginRight="@dimen/dp_4"
android:paddingLeft="@dimen/dp_10" android:paddingLeft="@dimen/dp_10"
android:paddingTop="@dimen/dp_4" android:paddingTop="@dimen/dp_4"
android:layout_marginLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_10" android:paddingRight="@dimen/dp_10"
android:paddingBottom="@dimen/dp_4" android:paddingBottom="@dimen/dp_4"
android:textColor="@color/white" android:textColor="@color/white"
......
...@@ -4,5 +4,6 @@ ...@@ -4,5 +4,6 @@
android:id="@+id/rv_purchase_list_content" android:id="@+id/rv_purchase_list_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/trans"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_behavior="@string/appbar_scrolling_view_behavior" /> app:layout_behavior="@string/appbar_scrolling_view_behavior" />
\ No newline at end of file
...@@ -63,5 +63,8 @@ ...@@ -63,5 +63,8 @@
<string name="str_chosen">已選擇</string> <string name="str_chosen">已選擇</string>
<string name="str_warehousing_order">入庫單</string> <string name="str_warehousing_order">入庫單</string>
<string name="str_format_warehousing_member">入庫人:%1$s</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> </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; //package com.gingersoft.gsa.cloud.common.function.click;
//
import android.util.Log; //import android.util.Log;
import android.view.View; //import android.view.View;
//
import com.gingersoft.gsa.cloud.common.R; //import com.gingersoft.gsa.cloud.common.R;
//
import org.aspectj.lang.ProceedingJoinPoint; //import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around; //import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect; //import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut; //import org.aspectj.lang.annotation.Pointcut;
//
import java.util.Calendar; //import java.util.Calendar;
//
/** ///**
* 全局BaseQuickAdapter item點擊事件AOP // * 全局BaseQuickAdapter item點擊事件AOP
*/ // */
@Aspect //@Aspect
public class BaseQueicItemClickAspect { //public class BaseQueicItemClickAspect {
static int TIME_TAG = R.id.click_time; // static int TIME_TAG = R.id.click_time;
//
/** // /**
* 方法切入点 // * 方法切入点
*/ // */
@Pointcut("execution(* com.chad.library.adapter.base.listener.OnItemClickListener.onItemClick(..))") // @Pointcut("execution(* com.chad.library.adapter.base.listener.OnItemClickListener.onItemClick(..))")
public void onItemSingleClickMethod() { // public void onItemSingleClickMethod() {
} // }
//
/** // /**
* 在连接点进行方法替换 // * 在连接点进行方法替换
* // *
* @param joinPoint // * @param joinPoint
* @throws Throwable // * @throws Throwable
*/ // */
@Around("onItemSingleClickMethod()") // @Around("onItemSingleClickMethod()")
public void doItemSingleClickMethod(ProceedingJoinPoint joinPoint) throws Throwable { // public void doItemSingleClickMethod(ProceedingJoinPoint joinPoint) throws Throwable {
View view = null; // View view = null;
for (Object arg : joinPoint.getArgs()) { // for (Object arg : joinPoint.getArgs()) {
if (arg instanceof View) { // if (arg instanceof View) {
view = (View) arg; // view = (View) arg;
} // }
if (view != null) { // if (view != null) {
Object tag = view.getTag(TIME_TAG); // Object tag = view.getTag(TIME_TAG);
long lastClickTime = ((tag != null) ? (long) tag : 0); // long lastClickTime = ((tag != null) ? (long) tag : 0);
Log.d("SingleClickAspect", "lastClickTime:" + lastClickTime); // Log.d("SingleClickAspect", "lastClickTime:" + lastClickTime);
long currentTime = Calendar.getInstance().getTimeInMillis(); // long currentTime = Calendar.getInstance().getTimeInMillis();
//
if (currentTime - lastClickTime > 500) {//过滤掉500毫秒内的连续点击 // if (currentTime - lastClickTime > 500) {//过滤掉500毫秒内的连续点击
view.setTag(TIME_TAG, currentTime); // view.setTag(TIME_TAG, currentTime);
Log.d("SingleClickAspect", "currentTime:" + currentTime); // Log.d("SingleClickAspect", "currentTime:" + currentTime);
joinPoint.proceed();//执行原方法 // joinPoint.proceed();//执行原方法
} else { // } else {
Log.d("SingleClickAspect", "連點了"); // 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; package com.gingersoft.gsa.cloud.common.function.click;
import android.util.Log;
import android.view.View; import android.view.View;
import com.gingersoft.gsa.cloud.common.R; import com.gingersoft.gsa.cloud.common.R;
...@@ -13,46 +12,54 @@ import org.aspectj.lang.annotation.Pointcut; ...@@ -13,46 +12,54 @@ import org.aspectj.lang.annotation.Pointcut;
import java.util.Calendar; import java.util.Calendar;
/** /**
* Created by jerry on 2018/6/13. *
* @author Wyh
* @date 2021/01/13
*/ */
@Aspect @Aspect
public class SingleClickAspect { public class SingleClickAspect {
static int TIME_TAG = R.id.click_time; static int TIME_TAG = R.id.click_time;
@Pointcut("execution(@com.gingersoft.gsa.cloud.common.function.click.SingleClick * *(..))") @Pointcut("execution(@com.gingersoft.gsa.cloud.common.function.click.SingleClick * *(..))")
//方法切入点
public void onSingleClickMethod() { public void onSingleClickMethod() {
} }
/**
* 對單擊方法進行攔截
* @param joinPoint
* @param singleClick
* @throws Throwable
*/
@Around("onSingleClickMethod() && @annotation(singleClick)")//在连接点进行方法替换 @Around("onSingleClickMethod() && @annotation(singleClick)")//在连接点进行方法替换
public void doSingleClickMethod(ProceedingJoinPoint joinPoint, SingleClick singleClick) throws Throwable { public void doSingleClickMethod(ProceedingJoinPoint joinPoint, SingleClick singleClick) throws Throwable {
View view = null; View view = null;
for (Object arg : joinPoint.getArgs()) for (Object arg : joinPoint.getArgs()) {
if (arg instanceof View) view = (View) arg; if (arg instanceof View) {
view = (View) arg;
}
}
if (view != null) { if (view != null) {
Object tag = view.getTag(TIME_TAG); Object tag = view.getTag(TIME_TAG);
long lastClickTime = ((tag != null) ? (long) tag : 0); long lastClickTime = ((tag != null) ? (long) tag : 0);
Log.d("SingleClickAspect", "lastClickTime:" + lastClickTime);
long currentTime = Calendar.getInstance().getTimeInMillis(); long currentTime = Calendar.getInstance().getTimeInMillis();
long value = singleClick.value(); long value = singleClick.value();
int[] ids = singleClick.ids(); int[] ids = singleClick.ids();
if (currentTime - lastClickTime > value || !hasId(ids, view.getId())) {//过滤掉500毫秒内的连续点击 if (currentTime - lastClickTime > value || !hasId(ids, view.getId())) {//过滤掉500毫秒内的连续点击
view.setTag(TIME_TAG, currentTime); view.setTag(TIME_TAG, currentTime);
Log.d("SingleClickAspect", "currentTime:" + currentTime);
joinPoint.proceed();//执行原方法 joinPoint.proceed();//执行原方法
} else { } else {
Log.d("SingleClickAspect", "連點了"); //連點了
} }
} }
} }
public static boolean hasId(int[] arr, int value) { public static boolean hasId(int[] arr, int value) {
for (int i : arr) { for (int i : arr) {
if (i == value) if (i == value) {
return true; return true;
} }
}
return false; return false;
} }
} }
...@@ -78,6 +78,7 @@ public class LoganManager { ...@@ -78,6 +78,7 @@ public class LoganManager {
private static final String ORDER_BUSINESS_TAG = "order-> "; private static final String ORDER_BUSINESS_TAG = "order-> ";
private static final String PAY_BUSINESS_TAG = "pay-> "; private static final String PAY_BUSINESS_TAG = "pay-> ";
private static final String DELIVERY_PICK_TAG = "delivery-> "; private static final String DELIVERY_PICK_TAG = "delivery-> ";
private static final String GLOBAL_ASPECT_TAG = "Global-> ";
/*******************************交互事件類型**************************************/ /*******************************交互事件類型**************************************/
...@@ -107,6 +108,10 @@ public class LoganManager { ...@@ -107,6 +108,10 @@ public class LoganManager {
w_business(HOME_BUSINESS_TAG, TAG, eventAndLog); 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) { public static void w_database(String TAG, String... eventAndLog) {
w_business(DATABASE_BUSINESS_TAG, TAG, eventAndLog); w_business(DATABASE_BUSINESS_TAG, TAG, eventAndLog);
} }
......
...@@ -145,10 +145,10 @@ public class AppCrashHandler implements UncaughtExceptionHandler { ...@@ -145,10 +145,10 @@ public class AppCrashHandler implements UncaughtExceptionHandler {
* @return true:如果处理了该异常信息;否则返回false * @return true:如果处理了该异常信息;否则返回false
*/ */
private boolean handleException(Throwable ex) { private boolean handleException(Throwable ex) {
LoganManager.w_crash("handleException start--->" + ex.getMessage());
if (ex == null) { if (ex == null) {
return false; return false;
} }
LoganManager.w_crash("handleException start--->" + ex.getMessage());
Observable.just(0) Observable.just(0)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
......
...@@ -49,7 +49,6 @@ public class PrintSocketHolder { ...@@ -49,7 +49,6 @@ public class PrintSocketHolder {
public static final int ERROR_66 = 66;// 关闭Socket出错 public static final int ERROR_66 = 66;// 关闭Socket出错
private Socket socket; private Socket socket;
private OutputStream out; private OutputStream out;
private WeakReference<OnStateChangedListener> mListener; private WeakReference<OnStateChangedListener> mListener;
......
package com.gingersoft.gsa.cloud.ui.adapter.base; package com.gingersoft.gsa.cloud.ui.adapter.base;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter; import androidx.lifecycle.Lifecycle;
import com.gingersoft.gsa.cloud.common.utils.CollectionUtils; import androidx.viewpager2.adapter.FragmentStateAdapter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class BaseFragmentStateAdapter extends FragmentStatePagerAdapter { /**
* @author admin
*/
public class BaseFragmentStateAdapter extends FragmentStateAdapter {
List<Fragment> fragmentList = new ArrayList<>(); List<Fragment> fragmentList;
private List<String> mTitles;
public BaseFragmentStateAdapter(FragmentManager fm, List<Fragment> fragmentList) { public BaseFragmentStateAdapter(@NonNull FragmentActivity fragmentActivity) {
super(fm); super(fragmentActivity);
this.fragmentList = fragmentList; fragmentList = new ArrayList<>();
} }
public BaseFragmentStateAdapter(FragmentManager fm, List<Fragment> fragmentList, List<String> mTitles) { public BaseFragmentStateAdapter(@NonNull Fragment fragment) {
super(fm); super(fragment);
this.fragmentList = fragmentList; fragmentList = new ArrayList<>();
this.mTitles = mTitles;
} }
@Override public BaseFragmentStateAdapter(@NonNull FragmentManager fragmentManager, @NonNull Lifecycle lifecycle) {
public CharSequence getPageTitle(int position) { super(fragmentManager, lifecycle);
return !CollectionUtils.isNullOrEmpty(mTitles) ? mTitles.get(position) : ""; 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 @Override
public Fragment getItem(int position) { public Fragment createFragment(int position) {
return fragmentList.get(position); return fragmentList.get(position);
} }
@Override @Override
public int getCount() { public int getItemCount() {
return fragmentList.size(); return fragmentList.size();
} }
......
...@@ -21,9 +21,7 @@ ...@@ -21,9 +21,7 @@
<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:id="@+id/input_layout" android:id="@+id/input_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content">
app:counterEnabled="true"
app:counterMaxLength="@integer/remark_max_length">
<com.google.android.material.textfield.TextInputEditText <com.google.android.material.textfield.TextInputEditText
android:id="@+id/ed_multi_value" 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