Commit 68fb2115 by Wyh

1、外送接單頁數問題 2、所有頁面去掉fitsSystemWindows 3、部分頁面單獨適配狀態欄 4、外送支付方式不為空時才顯示…

1、外送接單頁數問題 2、所有頁面去掉fitsSystemWindows  3、部分頁面單獨適配狀態欄 4、外送支付方式不為空時才顯示 5、新增不能點擊的edittext 6、增加自定義recyclerview動畫
parent bc11e1a2
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
android:id="@+id/cold_chain_history_order_top_bar" android:id="@+id/cold_chain_history_order_top_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/head_height" android:layout_height="@dimen/head_height"
android:fitsSystemWindows="true"
app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color" app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color"
app:qmui_topbar_title_color="@color/theme_white_color" /> app:qmui_topbar_title_color="@color/theme_white_color" />
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
android:id="@+id/cold_chain_supplement_order_top_bar" android:id="@+id/cold_chain_supplement_order_top_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/head_height" android:layout_height="@dimen/head_height"
android:fitsSystemWindows="true"
app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color" app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color"
app:qmui_topbar_title_color="@color/theme_white_color" /> app:qmui_topbar_title_color="@color/theme_white_color" />
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
android:id="@+id/cold_chain_order_detail_top_bar" android:id="@+id/cold_chain_order_detail_top_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/head_height" android:layout_height="@dimen/head_height"
android:fitsSystemWindows="true"
app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color" app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color"
app:qmui_topbar_title_color="@color/theme_white_color" /> app:qmui_topbar_title_color="@color/theme_white_color" />
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
android:id="@+id/coldchain_main_top_bar" android:id="@+id/coldchain_main_top_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/head_height" android:layout_height="@dimen/head_height"
android:fitsSystemWindows="true"
app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color" app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color"
app:qmui_topbar_title_color="@color/theme_white_color" /> app:qmui_topbar_title_color="@color/theme_white_color" />
......
...@@ -99,6 +99,8 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -99,6 +99,8 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
//訂單列表 //訂單列表
val newOrderList = MutableLiveData<MutableList<OrderListBean>>() val newOrderList = MutableLiveData<MutableList<OrderListBean>>()
//記錄請求的頁數,之後各個fragment的頁數從這裡刷新
var pageSize = 1
//餐廳營業信息 //餐廳營業信息
val restaurantBusinessInfo = MutableLiveData<RestaurantBusinessInfo>() val restaurantBusinessInfo = MutableLiveData<RestaurantBusinessInfo>()
...@@ -282,6 +284,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -282,6 +284,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
launch({ launch({
repository.getNewOrderList(restaurantId, appointmentType, page, 10, status, orderNo, phone, type).apply { repository.getNewOrderList(restaurantId, appointmentType, page, 10, status, orderNo, phone, type).apply {
val jsonToList = GsonUtils.jsonToList(data, OrderListBean::class.java) val jsonToList = GsonUtils.jsonToList(data, OrderListBean::class.java)
pageSize = page
if (page > 1) { if (page > 1) {
//加載更多 //加載更多
var value = newOrderList.value var value = newOrderList.value
...@@ -602,7 +605,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -602,7 +605,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
val payMultiple = ArrayList<OrderDetails.DataBean.PayMultiple>() val payMultiple = ArrayList<OrderDetails.DataBean.PayMultiple>()
payMethods.forEach { payMethods.forEach {
payMultiple.add(OrderDetails.DataBean.PayMultiple(it.id.toString(), it.payMoney, it.payName, 0.0)) payMultiple.add(OrderDetails.DataBean.PayMultiple(it.payType.toString(), it.payMoney, it.payName, 0.0))
} }
repository.updateOrderPay(orderDetails.ID, OrderDetails.closingAmount, orderDetails.order_type, 3, orderPayInfoVO = payMultiple).apply { repository.updateOrderPay(orderDetails.ID, OrderDetails.closingAmount, orderDetails.order_type, 3, orderPayInfoVO = payMultiple).apply {
orderDetails.payMultiple = payMultiple orderDetails.payMultiple = payMultiple
......
...@@ -44,6 +44,8 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) { ...@@ -44,6 +44,8 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) {
refresh_layout.finishLoadMore() refresh_layout.finishLoadMore()
}) })
newOrderList.observe(viewLifecycleOwner, Observer { newOrderList.observe(viewLifecycleOwner, Observer {
//由於會從Activity中刷新,但是fragment並不知道頁數,有可能會重置頁數,這裡就修改一下
page = pageSize
it?.let { it?.let {
layout_nodata.setState(it.size <= 0) layout_nodata.setState(it.size <= 0)
adapter.setData(it) adapter.setData(it)
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
android:id="@+id/top_bar_delivery" android:id="@+id/top_bar_delivery"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/head_height" android:layout_height="@dimen/head_height"
android:fitsSystemWindows="true"
app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color" app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color"
app:qmui_topbar_title_color="@color/theme_white_color" /> app:qmui_topbar_title_color="@color/theme_white_color" />
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
android:id="@+id/qm_other_order_bar" android:id="@+id/qm_other_order_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/head_height" android:layout_height="@dimen/head_height"
android:fitsSystemWindows="true"
app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color" app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color"
app:qmui_topbar_title_color="@color/theme_white_color" /> app:qmui_topbar_title_color="@color/theme_white_color" />
......
...@@ -55,7 +55,6 @@ ...@@ -55,7 +55,6 @@
android:id="@+id/qm_order_details_bar" android:id="@+id/qm_order_details_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/head_height" android:layout_height="@dimen/head_height"
android:fitsSystemWindows="true"
app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color" app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color"
app:qmui_topbar_title_color="@color/theme_white_color" /> app:qmui_topbar_title_color="@color/theme_white_color" />
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
android:id="@+id/qm_other_order_bar" android:id="@+id/qm_other_order_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/head_height" android:layout_height="@dimen/head_height"
android:fitsSystemWindows="true"
app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color" app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color"
app:qmui_topbar_title_color="@color/theme_white_color" /> app:qmui_topbar_title_color="@color/theme_white_color" />
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
android:id="@+id/qm_order_pay_bar" android:id="@+id/qm_order_pay_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/head_height" android:layout_height="@dimen/head_height"
android:fitsSystemWindows="true"
app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color" app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color"
app:qmui_topbar_title_color="@color/theme_white_color" /> app:qmui_topbar_title_color="@color/theme_white_color" />
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
android:id="@+id/top_bar_prj_print" android:id="@+id/top_bar_prj_print"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/head_height" android:layout_height="@dimen/head_height"
android:fitsSystemWindows="true"
app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color" app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color"
app:qmui_topbar_title_color="@color/theme_white_color" /> app:qmui_topbar_title_color="@color/theme_white_color" />
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
android:id="@+id/top_bar_update_delivery" android:id="@+id/top_bar_update_delivery"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/head_height" android:layout_height="@dimen/head_height"
android:fitsSystemWindows="true"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color" app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color"
app:qmui_topbar_title_color="@color/theme_white_color" /> app:qmui_topbar_title_color="@color/theme_white_color" />
......
package com.gingersoft.gsa.cloud.download.mvp.ui.activity; package com.gingersoft.gsa.cloud.download.mvp.ui.activity;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
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.CCUtil; import com.billy.cc.core.component.CCUtil;
import com.gingersoft.gsa.cloud.common.constans.ResultConstans; import com.gingersoft.gsa.cloud.common.constans.ResultConstans;
...@@ -28,13 +24,14 @@ import com.gingersoft.gsa.cloud.download.mvp.presenter.DownloadPresenter; ...@@ -28,13 +24,14 @@ import com.gingersoft.gsa.cloud.download.mvp.presenter.DownloadPresenter;
import com.gingersoft.gsa.cloud.ui.view.WaveHelper; import com.gingersoft.gsa.cloud.ui.view.WaveHelper;
import com.gingersoft.gsa.cloud.ui.view.WaveView; import com.gingersoft.gsa.cloud.ui.view.WaveView;
import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog; import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog;
import com.gyf.immersionbar.ImmersionBar;
import com.jess.arms.base.BaseActivity; import com.jess.arms.base.BaseActivity;
import com.jess.arms.base.DefaultAdapter; import com.jess.arms.base.DefaultAdapter;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils; import com.jess.arms.utils.ArmsUtils;
import com.jess.arms.utils.StatusBarUtil;
import butterknife.BindView; import butterknife.BindView;
import static com.jess.arms.utils.Preconditions.checkNotNull; import static com.jess.arms.utils.Preconditions.checkNotNull;
...@@ -65,7 +62,8 @@ public class DownloadActivity extends BaseActivity<DownloadPresenter> implements ...@@ -65,7 +62,8 @@ public class DownloadActivity extends BaseActivity<DownloadPresenter> implements
TextView tv_progress; TextView tv_progress;
@BindView(R2.id.wave_download) @BindView(R2.id.wave_download)
WaveView waveView; WaveView waveView;
@BindView(R2.id.layout_download_title)
RelativeLayout layoutTitle;
private WaveHelper mWaveHelper; private WaveHelper mWaveHelper;
/** /**
* 那個頁面跳轉下載 * 那個頁面跳轉下載
...@@ -85,12 +83,6 @@ public class DownloadActivity extends BaseActivity<DownloadPresenter> implements ...@@ -85,12 +83,6 @@ public class DownloadActivity extends BaseActivity<DownloadPresenter> implements
} }
@Override @Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTransparent(this);
}
@Override
public int initView(@Nullable Bundle savedInstanceState) { public int initView(@Nullable Bundle savedInstanceState) {
return R.layout.download_data_activity_download; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0 return R.layout.download_data_activity_download; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
} }
...@@ -104,6 +96,14 @@ public class DownloadActivity extends BaseActivity<DownloadPresenter> implements ...@@ -104,6 +96,14 @@ public class DownloadActivity extends BaseActivity<DownloadPresenter> implements
} }
@Override @Override
public void configImmersionBar(ImmersionBar immersionBar) {
immersionBar
.transparentBar()
.titleBarMarginTop(layoutTitle)
.init();
}
@Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
if (mWaveHelper != null) if (mWaveHelper != null)
...@@ -136,7 +136,7 @@ public class DownloadActivity extends BaseActivity<DownloadPresenter> implements ...@@ -136,7 +136,7 @@ public class DownloadActivity extends BaseActivity<DownloadPresenter> implements
.setActionName("showMainActivity") .setActionName("showMainActivity")
.build() .build()
.call(); .call();
}else { } else {
setResult(ResultConstans.DOWNLOAD_PAGE_BACK); setResult(ResultConstans.DOWNLOAD_PAGE_BACK);
} }
finish(); finish();
...@@ -187,7 +187,6 @@ public class DownloadActivity extends BaseActivity<DownloadPresenter> implements ...@@ -187,7 +187,6 @@ public class DownloadActivity extends BaseActivity<DownloadPresenter> implements
@Override @Override
public void showMessage(@NonNull String message) { public void showMessage(@NonNull String message) {
checkNotNull(message); checkNotNull(message);
// ArmsUtils.snackbarText(message);
ToastUtils.show(mContext, message); ToastUtils.show(mContext, message);
} }
...@@ -223,51 +222,6 @@ public class DownloadActivity extends BaseActivity<DownloadPresenter> implements ...@@ -223,51 +222,6 @@ public class DownloadActivity extends BaseActivity<DownloadPresenter> implements
} }
/**
* 设置状态栏全透明
*
* @param activity 需要设置的activity
*/
public static void setTransparent(Activity activity) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return;
}
transparentStatusBar(activity);
// setRootView(activity);
}
/**
* 使状态栏透明
*/
@TargetApi(Build.VERSION_CODES.KITKAT)
private static void transparentStatusBar(Activity activity) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
//需要设置这个flag contentView才能延伸到状态栏
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
//状态栏覆盖在contentView上面,设置透明使contentView的背景透出来
activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
} else {
//让contentView延伸到状态栏并且设置状态栏颜色透明
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
}
/**
* 设置根布局参数
*/
private static void setRootView(Activity activity) {
ViewGroup parent = (ViewGroup) activity.findViewById(android.R.id.content);
for (int i = 0, count = parent.getChildCount(); i < count; i++) {
View childView = parent.getChildAt(i);
if (childView instanceof ViewGroup) {
childView.setFitsSystemWindows(true);
((ViewGroup) childView).setClipToPadding(true);
}
}
}
public int getFromPage() { public int getFromPage() {
return fromPage; return fromPage;
} }
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
android:background="@mipmap/down_decoration"> android:background="@mipmap/down_decoration">
<RelativeLayout <RelativeLayout
android:id="@+id/layout_download_title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dp_50" android:layout_height="@dimen/dp_50"
android:layout_marginTop="@dimen/dp_30"
android:background="@color/trans"> android:background="@color/trans">
<com.qmuiteam.qmui.alpha.QMUIAlphaImageButton <com.qmuiteam.qmui.alpha.QMUIAlphaImageButton
......
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
android:theme="@style/AppTheme" android:theme="@style/AppTheme"
tools:replace="android:label"> tools:replace="android:label">
<!-- &lt;!&ndash;适配android 7.0文件访问 &ndash;&gt;--> <!-- &lt;!&ndash;适配android 7.0文件访问 &ndash;&gt;-->
<provider <provider
android:name="androidx.core.content.FileProvider" android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider" android:authorities="${applicationId}.fileprovider"
......
...@@ -14,10 +14,12 @@ ...@@ -14,10 +14,12 @@
android:allowBackup="true" android:allowBackup="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/user_login_name" android:label="@string/user_login_name"
android:maxAspectRatio="2.4"
android:resizeableActivity="true"
android:roundIcon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true" android:supportsRtl="true">
android:theme="@style/AppTheme">
<activity android:name=".mvp.ui.activity.mvp.ui.activity.WelcomeActivity"> <activity android:name=".mvp.ui.activity.mvp.ui.activity.WelcomeActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
...@@ -25,7 +27,6 @@ ...@@ -25,7 +27,6 @@
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
android:name=".mvp.ui.activity.mvp.ui.activity.LoginActivity" android:name=".mvp.ui.activity.mvp.ui.activity.LoginActivity"
android:launchMode="singleTask" /> android:launchMode="singleTask" />
...@@ -50,6 +51,17 @@ ...@@ -50,6 +51,17 @@
<meta-data <meta-data
android:name="design_height_in_dp" android:name="design_height_in_dp"
android:value="640" /> android:value="640" />
<meta-data
android:name="android.max_aspect"
android:value="2.4" />
<!--适配华为(huawei)刘海屏-->
<meta-data
android:name="android.notch_support"
android:value="true" />
<!--适配小米(xiaomi)刘海屏-->
<meta-data
android:name="notch.config"
android:value="portrait|landscape" />
</application> </application>
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
......
...@@ -118,8 +118,7 @@ public class ChooseRestaurantActivity extends BaseActivity<ChooseRestaurantPrese ...@@ -118,8 +118,7 @@ public class ChooseRestaurantActivity extends BaseActivity<ChooseRestaurantPrese
@Override @Override
public void initTopBar() { public void initTopBar() {
mTopBar.setBackgroundColor(ContextCompat.getColor(mContext, mTopBar.setBackgroundColor(ContextCompat.getColor(mContext, R.color.theme_color));
com.gingersoft.gsa.cloud.common.R.color.theme_color));
mTopBar.addLeftBackImageButton().setOnClickListener(v -> { mTopBar.addLeftBackImageButton().setOnClickListener(v -> {
if (TextUtil.isNotEmptyOrNullOrUndefined(form) && form.equals(WelcomeActivity.class.getName())) { if (TextUtil.isNotEmptyOrNullOrUndefined(form) && form.equals(WelcomeActivity.class.getName())) {
launchActivity(new Intent(mContext, LoginActivity.class)); launchActivity(new Intent(mContext, LoginActivity.class));
......
...@@ -80,7 +80,8 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements ...@@ -80,7 +80,8 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements
ImageView mIvSeePwd; ImageView mIvSeePwd;
@BindView(R2.id.btn_gsa_user_login) @BindView(R2.id.btn_gsa_user_login)
QMUIAlphaButton mBtnLogin; QMUIAlphaButton mBtnLogin;
@BindView(R2.id.iv_top_bg)
ImageView ivTopBg;
private boolean passwrodVisibility = false; private boolean passwrodVisibility = false;
...@@ -101,31 +102,13 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements ...@@ -101,31 +102,13 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements
} }
@Override @Override
public int getStatusBarColor() { public void configImmersionBar(ImmersionBar immersionBar) {
return Color.parseColor("#E7F2FF"); immersionBar.fitsSystemWindows(true).statusBarColor("#E7F2FF").init();
}
@Override
public boolean useLightMode() {
return true;
}
@SuppressLint("ResourceType")
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ImmersionBar.with(this)
.statusBarColor("#E7F2FF") //状态栏颜色,不写默认透明色
.statusBarDarkFont(true) //原理:如果当前设备支持状态栏字体变色,会设置状态栏字体为黑色,如果当前设备不支持
.fitsSystemWindows(true)
// .fullScreen(true)
.init();
} }
@Override @Override
public void initData(@Nullable Bundle savedInstanceState) { public void initData(@Nullable Bundle savedInstanceState) {
((ImageView) findViewById(R.id.iv_top_bg)).setAdjustViewBounds(true); ivTopBg.setAdjustViewBounds(true);
mPresenter.requestExternalStoragePermission(); mPresenter.requestExternalStoragePermission();
//顯示記住的登錄名 //顯示記住的登錄名
if (!Objects.equals(SPUtils.get(UserConstans.LOGIN_USERNAME, ""), "")) { if (!Objects.equals(SPUtils.get(UserConstans.LOGIN_USERNAME, ""), "")) {
......
...@@ -6,6 +6,7 @@ import android.content.Intent; ...@@ -6,6 +6,7 @@ import android.content.Intent;
import android.graphics.Color; import android.graphics.Color;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
...@@ -13,6 +14,7 @@ import android.view.animation.Animation; ...@@ -13,6 +14,7 @@ import android.view.animation.Animation;
import android.view.animation.AnimationUtils; import android.view.animation.AnimationUtils;
import android.view.animation.DecelerateInterpolator; import android.view.animation.DecelerateInterpolator;
import android.view.animation.ScaleAnimation; import android.view.animation.ScaleAnimation;
import android.widget.ImageView;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
...@@ -64,7 +66,8 @@ public class WelcomeActivity extends LoginInterfaceImpl<WelcomePresenter> implem ...@@ -64,7 +66,8 @@ public class WelcomeActivity extends LoginInterfaceImpl<WelcomePresenter> implem
ConstraintLayout guideView; ConstraintLayout guideView;
@BindView(R2.id.vp2_guide) @BindView(R2.id.vp2_guide)
ViewPager2 mVpGuide; ViewPager2 mVpGuide;
@BindView(R2.id.iv_guide_close)
ImageView ivCloseGuide;
@BindView(R2.id.guide_magic_indicator) @BindView(R2.id.guide_magic_indicator)
UIndicator magicIndicator; UIndicator magicIndicator;
...@@ -88,29 +91,13 @@ public class WelcomeActivity extends LoginInterfaceImpl<WelcomePresenter> implem ...@@ -88,29 +91,13 @@ public class WelcomeActivity extends LoginInterfaceImpl<WelcomePresenter> implem
} }
@Override @Override
public int getStatusBarColor() { public int initView(@Nullable Bundle savedInstanceState) {
return ArmsUtils.getColor(this, R.color.theme_white_color); return R.layout.activity_welcome; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
}
@Override
public boolean useLightMode() {
return true;
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ImmersionBar.with(this)
.statusBarColor(R.color.theme_white_color) //状态栏颜色,不写默认透明色
.statusBarDarkFont(true) //原理:如果当前设备支持状态栏字体变色,会设置状态栏字体为黑色,如果当前设备不支持
.fitsSystemWindows(true)
// .fullScreen(true)
.init();
} }
@Override @Override
public int initView(@Nullable Bundle savedInstanceState) { public void configImmersionBar(ImmersionBar immersionBar) {
return R.layout.activity_welcome; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0 immersionBar.autoDarkModeEnable(true).statusBarDarkFont(true).init();
} }
@Override @Override
...@@ -119,7 +106,6 @@ public class WelcomeActivity extends LoginInterfaceImpl<WelcomePresenter> implem ...@@ -119,7 +106,6 @@ public class WelcomeActivity extends LoginInterfaceImpl<WelcomePresenter> implem
animation.setDuration(2000); animation.setDuration(2000);
animation.setFillAfter(true); animation.setFillAfter(true);
contentView.setAnimation(animation); contentView.setAnimation(animation);
animation.setAnimationListener(new Animation.AnimationListener() { animation.setAnimationListener(new Animation.AnimationListener() {
@Override @Override
public void onAnimationStart(Animation animation) { public void onAnimationStart(Animation animation) {
...@@ -190,14 +176,6 @@ public class WelcomeActivity extends LoginInterfaceImpl<WelcomePresenter> implem ...@@ -190,14 +176,6 @@ public class WelcomeActivity extends LoginInterfaceImpl<WelcomePresenter> implem
public void onPageSelected(int position) { public void onPageSelected(int position) {
super.onPageSelected(position); super.onPageSelected(position);
ImmersionBar.with(WelcomeActivity.this)
.statusBarColor(R.color.theme_color) //状态栏颜色,不写默认透明色
.statusBarDarkFont(true) //原理:如果当前设备支持状态栏字体变色,会设置状态栏字体为黑色,如果当前设备不支持
.fitsSystemWindows(true)
.keyboardEnable(true)
.navigationBarColor(R.color.red)
.init();
updateUI(position); updateUI(position);
if (++position == guideBeanList.size() && mTvExperience.getVisibility() != View.VISIBLE) { if (++position == guideBeanList.size() && mTvExperience.getVisibility() != View.VISIBLE) {
//當前選中最後一個page,顯示進入按鈕 //當前選中最後一個page,顯示進入按鈕
...@@ -247,6 +225,12 @@ public class WelcomeActivity extends LoginInterfaceImpl<WelcomePresenter> implem ...@@ -247,6 +225,12 @@ public class WelcomeActivity extends LoginInterfaceImpl<WelcomePresenter> implem
* 顯示引導圖 * 顯示引導圖
*/ */
private void showGuide() { private void showGuide() {
//重新設置一下狀態欄
ImmersionBar.with(WelcomeActivity.this)
.statusBarDarkFont(false)
.titleBarMarginTop(ivCloseGuide)
.navigationBarDarkIcon(false) //导航栏图标是深色,不写默认为亮色
.init();
Animation hideAnim = AnimationUtils.loadAnimation(mContext, R.anim.anim_alpha_hide); Animation hideAnim = AnimationUtils.loadAnimation(mContext, R.anim.anim_alpha_hide);
hideAnim.setAnimationListener(new Animation.AnimationListener() { hideAnim.setAnimationListener(new Animation.AnimationListener() {
@Override @Override
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
android:id="@+id/topbar" android:id="@+id/topbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/head_height" android:layout_height="@dimen/head_height"
android:fitsSystemWindows="true"
app:qmui_topbar_title_color="@color/theme_white_color" /> app:qmui_topbar_title_color="@color/theme_white_color" />
<com.qmuiteam.qmui.widget.section.QMUIStickySectionLayout <com.qmuiteam.qmui.widget.section.QMUIStickySectionLayout
......
...@@ -4,16 +4,11 @@ ...@@ -4,16 +4,11 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="@dimen/dp_30"
android:background="@color/theme_white_color"/>
<RelativeLayout <RelativeLayout
android:id="@+id/content_view" android:id="@+id/content_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_30" android:visibility="visible"
android:background="@color/theme_white_color"> android:background="@color/theme_white_color">
<TextView <TextView
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/white" android:background="@color/white"
android:fitsSystemWindows="true"
android:orientation="vertical"> android:orientation="vertical">
<ImageView <ImageView
......
...@@ -4,19 +4,13 @@ ...@@ -4,19 +4,13 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/theme_white_color" android:background="@color/theme_white_color"
android:orientation="vertical" android:orientation="vertical">
android:fitsSystemWindows="true">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="@dimen/dp_50"
android:background="#E7F2FF"/>
<ImageView <ImageView
android:id="@+id/iv_top_bg" android:id="@+id/iv_top_bg"
android:layout_width="match_parent" android:layout_width="match_parent"
......
...@@ -162,10 +162,14 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl ...@@ -162,10 +162,14 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
} }
@Override @Override
public void configImmersionBar(ImmersionBar immersionBar) {
immersionBar.titleBar(R.id.cl_title_layout).init();
immersionBar.titleBar(R.id.side_layout).navigationBarAlpha(1).init();
}
@Override
public void initData(@Nullable Bundle savedInstanceState) { public void initData(@Nullable Bundle savedInstanceState) {
// mPresenter.requestExternalStoragePermission(); // mPresenter.requestExternalStoragePermission();
ImmersionBar.with(this).titleBar(R.id.cl_title_layout).init();
ImmersionBar.with(this).titleBar(R.id.side_layout).navigationBarAlpha(1).init();
//初始化側邊欄菜單項 //初始化側邊欄菜單項
initSideMenu(); initSideMenu();
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
android:id="@+id/log_top_bar" android:id="@+id/log_top_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/pickerview_topbar_height" android:layout_height="@dimen/pickerview_topbar_height"
android:fitsSystemWindows="true"
app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color" app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color"
app:qmui_topbar_title_color="@color/theme_white_color" /> app:qmui_topbar_title_color="@color/theme_white_color" />
......
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
android:id="@+id/topbar_new_food" android:id="@+id/topbar_new_food"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/head_height" android:layout_height="@dimen/head_height"
android:background="@color/theme_color"
android:fitsSystemWindows="true"
app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color" app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color"
app:qmui_topbar_title_color="@color/theme_white_color" /> app:qmui_topbar_title_color="@color/theme_white_color" />
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
android:id="@+id/top_bar" android:id="@+id/top_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/pickerview_topbar_height" android:layout_height="@dimen/pickerview_topbar_height"
android:fitsSystemWindows="true"
app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color" app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color"
app:qmui_topbar_title_color="@color/theme_white_color" /> app:qmui_topbar_title_color="@color/theme_white_color" />
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/head_height" android:layout_height="@dimen/head_height"
android:background="@color/theme_color" android:background="@color/theme_color"
android:fitsSystemWindows="true"
app:qmui_topbar_title_color="@color/theme_white_color" /> app:qmui_topbar_title_color="@color/theme_white_color" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/head_height" android:layout_height="@dimen/head_height"
android:background="@color/theme_color" android:background="@color/theme_color"
android:fitsSystemWindows="true"
app:qmui_topbar_title_color="@color/theme_white_color" /> app:qmui_topbar_title_color="@color/theme_white_color" />
<LinearLayout <LinearLayout
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/head_height" android:layout_height="@dimen/head_height"
android:background="@color/theme_color" android:background="@color/theme_color"
android:fitsSystemWindows="true"
app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color" app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color"
app:qmui_topbar_title_color="@color/theme_white_color" /> app:qmui_topbar_title_color="@color/theme_white_color" />
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
android:id="@+id/topBar" android:id="@+id/topBar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/pickerview_topbar_height" android:layout_height="@dimen/pickerview_topbar_height"
android:fitsSystemWindows="true"
app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color" app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color"
app:qmui_topbar_title_color="@color/theme_white_color" /> app:qmui_topbar_title_color="@color/theme_white_color" />
......
...@@ -10,8 +10,7 @@ ...@@ -10,8 +10,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginBottom="@dimen/head_height" android:layout_marginBottom="@dimen/head_height"
android:background="?attr/app_content_bg_color" android:background="?attr/app_content_bg_color"/>
android:fitsSystemWindows="true" />
<com.qmuiteam.qmui.widget.tab.QMUITabSegment <com.qmuiteam.qmui.widget.tab.QMUITabSegment
android:id="@+id/main_tabs" android:id="@+id/main_tabs"
......
...@@ -155,7 +155,7 @@ public class AddAreaFragment extends BaseFragment<AddAreaPresenter> implements A ...@@ -155,7 +155,7 @@ public class AddAreaFragment extends BaseFragment<AddAreaPresenter> implements A
ed_area_sort.setBackgroundColor(ContextCompat.getColor(mContext, R.color.trans)); ed_area_sort.setBackgroundColor(ContextCompat.getColor(mContext, R.color.trans));
areaSortItemView.addAccessoryCustomView(ed_area_sort); areaSortItemView.addAccessoryCustomView(ed_area_sort);
areaSortItemView.showNewTip(true); areaSortItemView.showNewTip(true);
areaSortItemView.setNewTipImage(R.drawable.question_prompt); areaSortItemView.setNewTipImage(R.drawable.ic_question_prompt);
areaSortItemView.setNewTipClick(new View.OnClickListener() { areaSortItemView.setNewTipClick(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
......
...@@ -13,8 +13,7 @@ ...@@ -13,8 +13,7 @@
<com.qmuiteam.qmui.widget.QMUIEmptyView <com.qmuiteam.qmui.widget.QMUIEmptyView
android:id="@+id/emptyView" android:id="@+id/emptyView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"/>
android:fitsSystemWindows="true" />
<com.scwang.smartrefresh.layout.SmartRefreshLayout <com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/refreshLayout" android:id="@+id/refreshLayout"
......
...@@ -33,8 +33,7 @@ ...@@ -33,8 +33,7 @@
<com.qmuiteam.qmui.widget.QMUIEmptyView <com.qmuiteam.qmui.widget.QMUIEmptyView
android:id="@+id/emptyView" android:id="@+id/emptyView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent" />
android:fitsSystemWindows="true" />
<TextView <TextView
android:id="@+id/tv_add_table" android:id="@+id/tv_add_table"
......
...@@ -635,8 +635,10 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintExecut ...@@ -635,8 +635,10 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintExecut
tvClosingTime.setVisibility(View.VISIBLE); tvClosingTime.setVisibility(View.VISIBLE);
} }
} }
//支付類型 if (TextUtil.isNotEmptyOrNullOrUndefined(data.getShowTextByOrderPayType())) {
tvPayType.setText(data.getShowTextByOrderPayType()); //支付類型
tvPayType.setText(data.getShowTextByOrderPayType());
}
//送達時間 //送達時間
tvDeliveryTime.setText(data.getOrder_type() == 2 ? data.getSEND_TIME() : data.getTakeTime()); tvDeliveryTime.setText(data.getOrder_type() == 2 ? data.getSEND_TIME() : data.getTakeTime());
if (TextUtil.isEmptyOrNullOrUndefined(tvDeliveryTime.getText().toString())) { if (TextUtil.isEmptyOrNullOrUndefined(tvDeliveryTime.getText().toString())) {
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
android:id="@+id/printer_home_bar" android:id="@+id/printer_home_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/head_height" android:layout_height="@dimen/head_height"
android:fitsSystemWindows="true"
app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color" app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color"
app:qmui_topbar_title_color="@color/theme_white_color" /> app:qmui_topbar_title_color="@color/theme_white_color" />
......
...@@ -36,6 +36,15 @@ ...@@ -36,6 +36,15 @@
android:name="com.yalantis.ucrop.UCropActivity" android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
<provider
android:name="com.gingersoft.supply_chain.mvp.utils.PurchaseFileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/gsa_purchase_paths" />
</provider>
</application> </application>
</manifest> </manifest>
\ No newline at end of file
package com.gingersoft.supply_chain.di.component;
import dagger.BindsInstance;
import dagger.Component;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodIngredientCategoryFragment;
import com.jess.arms.di.component.AppComponent;
import com.gingersoft.supply_chain.di.module.FoodIngredientCategoryModule;
import com.gingersoft.supply_chain.mvp.contract.FoodIngredientCategoryContract;
import com.jess.arms.di.scope.FragmentScope;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/25/2020 11:42
* <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 = FoodIngredientCategoryModule.class, dependencies = AppComponent.class)
public interface FoodIngredientCategoryComponent {
void inject(FoodIngredientCategoryFragment fragment);
@Component.Builder
interface Builder {
@BindsInstance
Builder view(FoodIngredientCategoryContract.View view);
Builder appComponent(AppComponent appComponent);
FoodIngredientCategoryComponent 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.FoodIngredientCategoryContract;
import com.gingersoft.supply_chain.mvp.model.FoodIngredientCategoryModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/25/2020 11:42
* <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 FoodIngredientCategoryModule {
@Binds
abstract FoodIngredientCategoryContract.Model bindFoodIngredientCategoryModel(FoodIngredientCategoryModel model);
}
\ No newline at end of file
...@@ -37,6 +37,13 @@ public class BuyIngredientsBean { ...@@ -37,6 +37,13 @@ public class BuyIngredientsBean {
this.parentId = parentId; this.parentId = parentId;
} }
public BuyIngredientsBean(int id, String categoryName, int parentId, List<PurchaseFoodBean> purchaseFoodList) {
this.id = id;
this.categoryName = categoryName;
this.parentId = parentId;
this.purchaseFoodList = purchaseFoodList;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;
...@@ -48,6 +55,16 @@ public class BuyIngredientsBean { ...@@ -48,6 +55,16 @@ public class BuyIngredientsBean {
} }
@Override @Override
public String toString() {
return "BuyIngredientsBean{" +
"id=" + id +
", categoryName='" + categoryName + '\'' +
", parentId=" + parentId +
", purchaseFoodList=" + purchaseFoodList +
'}';
}
@Override
public int hashCode() { public int hashCode() {
return Objects.hash(id, categoryName, parentId); return Objects.hash(id, categoryName, parentId);
} }
......
...@@ -18,4 +18,13 @@ public class ConsumeWareHousingBean { ...@@ -18,4 +18,13 @@ public class ConsumeWareHousingBean {
private String description; private String description;
private int quantity; private int quantity;
private String supplierName; private String supplierName;
/**
* 入庫詳情ids,逗號分隔
*/
private String warehousingOrderDetailsIds;
/**
* 出庫詳情ids,逗號分隔
*/
private String purchaseConsumeNoId;
} }
...@@ -12,19 +12,13 @@ import java.util.List; ...@@ -12,19 +12,13 @@ import java.util.List;
public class PurchaseConsumeSnBean { public class PurchaseConsumeSnBean {
public int brandId; public int brandId;
public int restaurantId; public int restaurantId;
//食材編號
public String foodNo; public String foodNo;
//消耗數量
public int consumeQuantity; public int consumeQuantity;
//原因id
public int purchaseConsumeReasonId; public int purchaseConsumeReasonId;
public String remarks; public String remarks;
// public String encodeFoodNos; //sn食材的sn碼
public List<String> encodeFoodNos; public List<String> encodeFoodNos;
// public List<PurchaseFoodEncodeSn> purchaseFoodEncodeSn;
//
// public static class PurchaseFoodEncodeSn {
// public PurchaseFoodEncodeSn(String encodeSnNo) {
// this.encodeSnNo = encodeSnNo;
// }
//
// public String encodeSnNo;
// }
} }
...@@ -10,6 +10,7 @@ import java.io.ObjectInputStream; ...@@ -10,6 +10,7 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream; import java.io.ObjectOutputStream;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import java.util.Objects;
import lombok.Data; import lombok.Data;
...@@ -93,6 +94,9 @@ public class PurchaseFoodBean implements Serializable, QMUISection.Model<Purchas ...@@ -93,6 +94,9 @@ public class PurchaseFoodBean implements Serializable, QMUISection.Model<Purchas
* 所以需要在這裡建這幾個字段,用於接收 * 所以需要在這裡建這幾個字段,用於接收
*/ */
private Integer inventoryWarningId; private Integer inventoryWarningId;
/**
* 審核 0否 1是
*/
private boolean reviews; private boolean reviews;
private int minimumInventory; private int minimumInventory;
private int shelfLife; private int shelfLife;
...@@ -180,4 +184,48 @@ public class PurchaseFoodBean implements Serializable, QMUISection.Model<Purchas ...@@ -180,4 +184,48 @@ public class PurchaseFoodBean implements Serializable, QMUISection.Model<Purchas
return foodNo.equals(other.foodNo); return foodNo.equals(other.foodNo);
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PurchaseFoodBean that = (PurchaseFoodBean) o;
return reviews == that.reviews &&
minimumInventory == that.minimumInventory &&
shelfLife == that.shelfLife &&
warningDays == that.warningDays &&
foodMarkSn == that.foodMarkSn &&
Objects.equals(supplierName, that.supplierName) &&
Objects.equals(images, that.images) &&
Objects.equals(foodNo, that.foodNo) &&
Objects.equals(name, that.name) &&
Objects.equals(unitPrice, that.unitPrice) &&
Objects.equals(foodCategoryName, that.foodCategoryName) &&
Objects.equals(remarks, that.remarks) &&
Objects.equals(packingDescription, that.packingDescription) &&
Objects.equals(basicUnitName, that.basicUnitName) &&
Objects.equals(foodCategoryId, that.foodCategoryId) &&
Objects.equals(supplierId, that.supplierId) &&
Objects.equals(inventoryWarningId, that.inventoryWarningId) &&
Objects.equals(foodUnits, that.foodUnits);
}
public void initPartValue() {
if (getUnitPrice() == null) {
setUnitPrice(0d);
}
if (getName() == null) {
setName("");
}
if (getPackingDescription() == null) {
setPackingDescription("");
}
if (getBasicUnitName() == null) {
setBasicUnitName("");
}
}
@Override
public int hashCode() {
return Objects.hash(supplierName, images, foodNo, name, unitPrice, foodCategoryName, remarks, quantityStarts, quantityEnd, packingDescription, basicUnitName, foodCategoryId, supplierId, inventoryAlarm, inventoryWarningId, reviews, minimumInventory, shelfLife, warningDays, foodMarkSn, foodUnits);
}
} }
package com.gingersoft.supply_chain.mvp.bean; package com.gingersoft.supply_chain.mvp.bean;
import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -13,7 +14,7 @@ import lombok.Data; ...@@ -13,7 +14,7 @@ import lombok.Data;
* Use: * Use:
*/ */
@Data @Data
public class WarehouseDetailsBean { public class WarehouseDetailsBean implements Serializable {
/** /**
* name : 去微软 * name : 去微软
* purchase : 採購入庫 * purchase : 採購入庫
...@@ -59,16 +60,29 @@ public class WarehouseDetailsBean { ...@@ -59,16 +60,29 @@ public class WarehouseDetailsBean {
* 入庫詳情ids,逗號分隔 * 入庫詳情ids,逗號分隔
*/ */
private String warehousingOrderDetailsIds; private String warehousingOrderDetailsIds;
//入庫
public static final int TYPE_WAREHOUSING_TYPE = 0;
/** /**
* 出庫詳情ids,逗號分隔 * 出庫詳情ids,逗號分隔
*/ */
private String purchaseConsumeNoId; private String purchaseConsumeNoId;
//出庫
public static final int TYPE_DELIVERY_HOUSE_TYPE = 1;
public final static int WAREHOUSE_STATE_NEVER_CONSUMED = 1; public final static int WAREHOUSE_STATE_NEVER_CONSUMED = 1;
public final static int WAREHOUSE_STATE_PART_CONSUMED = 2; public final static int WAREHOUSE_STATE_PART_CONSUMED = 2;
public final static int WAREHOUSE_STATE_ALL_CONSUMED = 3; public final static int WAREHOUSE_STATE_ALL_CONSUMED = 3;
public WarehouseDetailsBean() {
}
public WarehouseDetailsBean(String name, int foodQuantity, String warehousingOrderDetailsIds) {
this.name = name;
this.foodQuantity = foodQuantity;
this.warehousingOrderDetailsIds = warehousingOrderDetailsIds;
}
public static WarehouseDetailsBean getWarehousingByConsume(ConsumeWareHousingBean consumeWareHousingBean) { public static WarehouseDetailsBean getWarehousingByConsume(ConsumeWareHousingBean consumeWareHousingBean) {
WarehouseDetailsBean warehousingBean = new WarehouseDetailsBean(); WarehouseDetailsBean warehousingBean = new WarehouseDetailsBean();
warehousingBean.name = consumeWareHousingBean.getName(); warehousingBean.name = consumeWareHousingBean.getName();
...@@ -78,6 +92,8 @@ public class WarehouseDetailsBean { ...@@ -78,6 +92,8 @@ public class WarehouseDetailsBean {
warehousingBean.foodQuantity = consumeWareHousingBean.getQuantity(); warehousingBean.foodQuantity = consumeWareHousingBean.getQuantity();
warehousingBean.purchaseTime = consumeWareHousingBean.getDates(); warehousingBean.purchaseTime = consumeWareHousingBean.getDates();
warehousingBean.supplierName = consumeWareHousingBean.getSupplierName(); warehousingBean.supplierName = consumeWareHousingBean.getSupplierName();
warehousingBean.purchaseConsumeNoId = consumeWareHousingBean.getPurchaseConsumeNoId();
warehousingBean.warehousingOrderDetailsIds = consumeWareHousingBean.getWarehousingOrderDetailsIds();
return warehousingBean; return warehousingBean;
} }
......
...@@ -38,26 +38,32 @@ public interface BuyIngredientsContract { ...@@ -38,26 +38,32 @@ public interface BuyIngredientsContract {
* *
* @param foodCategoryTrees 所有分類層級信息 * @param foodCategoryTrees 所有分類層級信息
*/ */
void loadCategory(List<OrderCategoryBean.FoodCategoryTrees> foodCategoryTrees); void initCategoryInfo(List<OrderCategoryBean.FoodCategoryTrees> foodCategoryTrees);
/**
* 加載右側食品
* @param purchaseFoodListVOS 食品信息
*/
void loadRightFoodIngredients(List<PurchaseFoodBean> purchaseFoodListVOS);
/** /**
* 加載失敗 * 加載失敗
*/ */
void loadFail(); void loadFail();
/** /**
* 結束加載並且沒有更多數據了
*/
void finishLoadNoMoreData();
/**
* 加載食品 * 加載食品
* @param index 需要滾動到的位置 *
* @param buyIngredientsBeans 顯示的食材 * @param buyIngredientsBeans 顯示的食材
* @param addToHead 是否添加到頭部
* @param isReset 是否重新設置數據
*/ */
void loadFood(int index, List<BuyIngredientsBean> buyIngredientsBeans); void loadFood(List<BuyIngredientsBean> buyIngredientsBeans, boolean addToHead, boolean isReset);
void selectFirstCategoryByIndex(int position);
/** /**
* 食材列表滾動到指定位置 * 食材列表滾動到指定位置
*
* @param index 指定位置 * @param index 指定位置
*/ */
void scrollToPosition(int index); void scrollToPosition(int index);
......
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 11/25/2020 11:42
* <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 FoodIngredientCategoryContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
}
}
package com.gingersoft.supply_chain.mvp.contract; package com.gingersoft.supply_chain.mvp.contract;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodEncodeSn;
import com.jess.arms.mvp.IView; import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel; import com.jess.arms.mvp.IModel;
import java.util.List;
import java.util.Map;
import io.reactivex.Observable;
/** /**
* ================================================ * ================================================
...@@ -19,11 +26,21 @@ import com.jess.arms.mvp.IModel; ...@@ -19,11 +26,21 @@ import com.jess.arms.mvp.IModel;
public interface SnCodeListContract { public interface SnCodeListContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息 //对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView { interface View extends IView {
void initAdapter(List<PurchaseFoodEncodeSn> purchaseFoodEncodeSns);
} }
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存 //Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel { interface Model extends IModel {
/**
* 獲取出入庫流水的Sn列表
*/
Observable<BaseResult> querySnCodeList(Map<String, Object> map);
/**
* 獲取庫存中的Sn
* @param foodNo 食材編號
*/
Observable<BaseResult> queryInStockSnCodes(String foodNo);
} }
} }
...@@ -31,9 +31,11 @@ public interface WareHouseListContract { ...@@ -31,9 +31,11 @@ public interface WareHouseListContract {
void loadListInfo(List<PurchaseWarehousingOrderDetailsVO> purchaseWarehousingOrderDetailsVos); void loadListInfo(List<PurchaseWarehousingOrderDetailsVO> purchaseWarehousingOrderDetailsVos);
void finishLoad(); void finishLoadNoMoreData();
void loadFail(); void loadFail();
void loadSortData(List<PurchaseWarehousingOrderDetailsVO> purchaseWarehousingOrderDetailsVos);
} }
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存 //Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
......
...@@ -69,13 +69,6 @@ public interface WarehouseDetailsContract { ...@@ -69,13 +69,6 @@ public interface WarehouseDetailsContract {
*/ */
void printConsumeOrder(List<String> snCodes, String consumeReasonDesc, int consumptionNum); void printConsumeOrder(List<String> snCodes, String consumeReasonDesc, int consumptionNum);
/**
* 跳转到sn码页面
*
* @param remark
* @param sns
*/
void jumpSnList(int foodQuantity, String remark, List<PurchaseFoodEncodeSn> sns);
} }
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存 //Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
...@@ -98,16 +91,5 @@ public interface WarehouseDetailsContract { ...@@ -98,16 +91,5 @@ public interface WarehouseDetailsContract {
* 獲取庫存數量 * 獲取庫存數量
*/ */
Observable<BaseResult> getWarehousingNum(Map<String, Object> map); Observable<BaseResult> getWarehousingNum(Map<String, Object> map);
/**
* 獲取庫存中的Sn
* @param foodNo 食材編號
*/
Observable<BaseResult> queryInStockSnCodes(String foodNo);
/**
* 獲取出入庫流水的Sn列表
*/
Observable<BaseResult> querySnCodeList(Map<String, Object> map);
} }
} }
...@@ -27,7 +27,7 @@ import okhttp3.RequestBody; ...@@ -27,7 +27,7 @@ import okhttp3.RequestBody;
public interface WarehousingInventoryContract { public interface WarehousingInventoryContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息 //对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView { interface View extends IView {
void updateSuccess(); void updateSuccess(int consumeQuantity);
void loadRecord(List<InventoryRecordBean> inventoryRecordBeans); void loadRecord(List<InventoryRecordBean> inventoryRecordBeans);
} }
...@@ -40,7 +40,7 @@ public interface WarehousingInventoryContract { ...@@ -40,7 +40,7 @@ public interface WarehousingInventoryContract {
* @param requestBody * @param requestBody
* @return * @return
*/ */
Observable<BaseResult> consumeWareHousing(RequestBody requestBody); Observable<BaseResult> wareHousingInventory(RequestBody requestBody);
/** /**
* 獲取庫存消耗記錄 * 獲取庫存消耗記錄
...@@ -49,5 +49,7 @@ public interface WarehousingInventoryContract { ...@@ -49,5 +49,7 @@ public interface WarehousingInventoryContract {
* @return * @return
*/ */
Observable<BaseResult> getWarehousingRecord(Map<String, Object> map); Observable<BaseResult> getWarehousingRecord(Map<String, Object> map);
} }
} }
package com.gingersoft.supply_chain.mvp.model;
import android.app.Application;
import com.gingersoft.supply_chain.mvp.contract.FoodIngredientCategoryContract;
import com.google.gson.Gson;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import javax.inject.Inject;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/25/2020 11:42
* <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 FoodIngredientCategoryModel extends BaseModel implements FoodIngredientCategoryContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public FoodIngredientCategoryModel(IRepositoryManager repositoryManager) {
super(repositoryManager);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mGson = null;
this.mApplication = null;
}
}
\ No newline at end of file
...@@ -2,6 +2,8 @@ package com.gingersoft.supply_chain.mvp.model; ...@@ -2,6 +2,8 @@ package com.gingersoft.supply_chain.mvp.model;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.supply_chain.mvp.server.SupplierServer;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager; import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel; import com.jess.arms.mvp.BaseModel;
...@@ -12,6 +14,10 @@ import javax.inject.Inject; ...@@ -12,6 +14,10 @@ import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.SnCodeListContract; import com.gingersoft.supply_chain.mvp.contract.SnCodeListContract;
import java.util.Map;
import io.reactivex.Observable;
/** /**
* ================================================ * ================================================
...@@ -43,4 +49,14 @@ public class SnCodeListModel extends BaseModel implements SnCodeListContract.Mod ...@@ -43,4 +49,14 @@ public class SnCodeListModel extends BaseModel implements SnCodeListContract.Mod
this.mGson = null; this.mGson = null;
this.mApplication = null; this.mApplication = null;
} }
@Override
public Observable<BaseResult> querySnCodeList(Map<String, Object> map) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).querySnCodeList(map);
}
@Override
public Observable<BaseResult> queryInStockSnCodes(String foodNo) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).queryInStockSnCodes(foodNo);
}
} }
\ No newline at end of file
...@@ -76,15 +76,4 @@ public class WarehouseDetailsModel extends BaseModel implements WarehouseDetails ...@@ -76,15 +76,4 @@ public class WarehouseDetailsModel extends BaseModel implements WarehouseDetails
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).getWarehousingNum(map); return mRepositoryManager.obtainRetrofitService(SupplierServer.class).getWarehousingNum(map);
} }
@Override
public Observable<BaseResult> queryInStockSnCodes(String foodNo) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).queryInStockSnCodes(foodNo);
}
@Override
public Observable<BaseResult> querySnCodeList(Map<String, Object> map) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).querySnCodeList(map);
}
} }
\ No newline at end of file
...@@ -52,8 +52,8 @@ public class WarehousingInventoryModel extends BaseModel implements WarehousingI ...@@ -52,8 +52,8 @@ public class WarehousingInventoryModel extends BaseModel implements WarehousingI
} }
@Override @Override
public Observable<BaseResult> consumeWareHousing(RequestBody requestBody) { public Observable<BaseResult> wareHousingInventory(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).consumeWareHousing(requestBody); return mRepositoryManager.obtainRetrofitService(SupplierServer.class).wareHousingInventory(requestBody);
} }
@Override @Override
......
...@@ -129,7 +129,6 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat ...@@ -129,7 +129,6 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView)) .compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) { .subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override @Override
public void onNext(@NonNull BaseResult info) { public void onNext(@NonNull BaseResult info) {
if (info != null) { if (info != null) {
......
package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application;
import com.gingersoft.supply_chain.mvp.contract.FoodIngredientCategoryContract;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import javax.inject.Inject;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/25/2020 11:42
* <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 FoodIngredientCategoryPresenter extends BasePresenter<FoodIngredientCategoryContract.Model, FoodIngredientCategoryContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
@Inject
public FoodIngredientCategoryPresenter(FoodIngredientCategoryContract.Model model, FoodIngredientCategoryContract.View rootView) {
super(model, rootView);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
}
...@@ -209,7 +209,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient ...@@ -209,7 +209,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_LINE)); infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_LINE));
infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_TITLE, "基本信息")); infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_TITLE, "基本信息"));
infoMultiBeans.add(new MultiSelectBean(InfoMultiBean.EDIT_FOOD_ITEM_SELECT, "所屬供應商", true, "請輸入/選擇供應商", SELECT_SUPPLIER_RESULTCODE, true, new InputFilter[]{InputFilterUtils.getLengthFilter(context, 16), InputFilterUtils.getChAndEnAndNumInputFilter(context)}, SupplierListFragment.class)); infoMultiBeans.add(new MultiSelectBean(InfoMultiBean.EDIT_FOOD_ITEM_SELECT, "所屬供應商", true, "請輸入/選擇供應商", SELECT_SUPPLIER_RESULTCODE, true, new InputFilter[]{InputFilterUtils.getLengthFilter(context, 16), InputFilterUtils.getChAndEnAndNumInputFilter(context)}, SupplierListFragment.class));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "食材名稱", true, "請輸入名稱", new InputFilter[]{InputFilterUtils.getLengthFilter(context, 100), InputFilterUtils.getChAndEnAndNumAndPtInputFilter(context)})); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "食材名稱", true, "請輸入名稱", new InputFilter[]{InputFilterUtils.getLengthFilter(context, 100), InputFilterUtils.getChAndEnAndNumAndPtInputFilter(context)}, InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES));
infoMultiBeans.add(new MultiSelectBean(InfoMultiBean.EDIT_FOOD_ITEM_SELECT, "食材類別", true, "請選擇食材類別", SELECT_FOOD_CATEGORY_REQUEST_CODE, CategorySelectFragment.class)); infoMultiBeans.add(new MultiSelectBean(InfoMultiBean.EDIT_FOOD_ITEM_SELECT, "食材類別", true, "請選擇食材類別", SELECT_FOOD_CATEGORY_REQUEST_CODE, CategorySelectFragment.class));
infoMultiBeans.add(new MultiSelectBean(InfoMultiBean.EDIT_FOOD_ITEM_SELECT, "基本單位", true, "請選擇食材單位", SELECT_PACKAGE_SPECIFICATION_REQUEST_CODE, FoodUnitPageFragment.class)); infoMultiBeans.add(new MultiSelectBean(InfoMultiBean.EDIT_FOOD_ITEM_SELECT, "基本單位", true, "請選擇食材單位", SELECT_PACKAGE_SPECIFICATION_REQUEST_CODE, FoodUnitPageFragment.class));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "包裝說明", false, "請輸入包裝說明", new InputFilter[]{InputFilterUtils.getLengthFilter(context, 10), InputFilterUtils.getTypeFilter(context, InputFilterUtils.chAndEnAndNumAndSlash)})); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "包裝說明", false, "請輸入包裝說明", new InputFilter[]{InputFilterUtils.getLengthFilter(context, 10), InputFilterUtils.getTypeFilter(context, InputFilterUtils.chAndEnAndNumAndSlash)}));
...@@ -224,10 +224,17 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient ...@@ -224,10 +224,17 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "保質期預警(天)", false, "請輸入預警天數", new InputFilter[]{InputFilterUtils.getLengthFilter(context, 5)}, EditorInfo.TYPE_CLASS_NUMBER)); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "保質期預警(天)", false, "請輸入預警天數", new InputFilter[]{InputFilterUtils.getLengthFilter(context, 5)}, EditorInfo.TYPE_CLASS_NUMBER));
infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_LINE)); infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_LINE));
infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_TITLE, "備註")); infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_TITLE, "備註"));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_MULTIPLE_INPUT_REMARK, "", false, "請輸入備註", new InputFilter[]{InputFilterUtils.getLengthFilter(context, RemarkProvider.REMARK_TEXT_LENGTH), InputFilterUtils.getChAndEnAndNumAndPtInputFilter(context)})); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_MULTIPLE_INPUT_REMARK, "", false, "請輸入備註", new InputFilter[]{InputFilterUtils.getLengthFilter(context, RemarkProvider.REMARK_TEXT_LENGTH), InputFilterUtils.getChAndEnNumPtWrapInputFilter(context)}).setInputType(EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE));
if (purchaseFoodBean != null) { if (purchaseFoodBean != null) {
//供應商名稱 //供應商名稱
infoMultiBeans.get(supplierIndex).setShowValue(purchaseFoodBean.getSupplierName()); String supplierName = purchaseFoodBean.getSupplierName();
infoMultiBeans.get(supplierIndex).setShowValue(supplierName);
// if (TextUtil.isNotEmptyOrNullOrUndefined(supplierName)) {
InfoMultiBean inputMulti = infoMultiBeans.get(supplierIndex);
if (inputMulti instanceof MultiSelectBean) {
((MultiSelectBean) inputMulti).setEdit(false);
}
// }
//食品名稱 //食品名稱
infoMultiBeans.get(foodNameIndex).setShowValue(purchaseFoodBean.getName()); infoMultiBeans.get(foodNameIndex).setShowValue(purchaseFoodBean.getName());
//食品分類 //食品分類
...@@ -456,6 +463,12 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient ...@@ -456,6 +463,12 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
return deputyUnitBeans; return deputyUnitBeans;
} }
/**
* 獲取商品信息
*
* @param infoMultiBeans 商品的各項數據
* @return 商品類
*/
public PurchaseFoodBean getFoodInfoByInfoMulti(List<InfoMultiBean> infoMultiBeans) { public PurchaseFoodBean getFoodInfoByInfoMulti(List<InfoMultiBean> infoMultiBeans) {
if (purchaseFoodBean == null) { if (purchaseFoodBean == null) {
purchaseFoodBean = new PurchaseFoodBean(); purchaseFoodBean = new PurchaseFoodBean();
...@@ -560,4 +573,12 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient ...@@ -560,4 +573,12 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
purchaseFoodBean.setRestaurantId(Constant.getRestaurantId()); purchaseFoodBean.setRestaurantId(Constant.getRestaurantId());
return purchaseFoodBean; return purchaseFoodBean;
} }
public boolean isUpdate(List<InfoMultiBean> infoMultiBeans) {
PurchaseFoodBean foodInfoByInfoMulti = getFoodInfoByInfoMulti(infoMultiBeans);
purchaseFoodBean.initPartValue();
return !foodInfoByInfoMulti.equals(purchaseFoodBean);
}
} }
...@@ -139,7 +139,7 @@ public class NewFoodUnitPresenter extends BasePresenter<NewFoodUnitContract.Mode ...@@ -139,7 +139,7 @@ public class NewFoodUnitPresenter extends BasePresenter<NewFoodUnitContract.Mode
} }
} }
foodUnit.setUnitContent(infoMultiBeans.get(1).getShowValue()); foodUnit.setUnitContent(infoMultiBeans.get(1).getShowValue());
foodUnit.setRemarks(infoMultiBeans.get(2).getShowValue()); foodUnit.setRemarks(infoMultiBeans.get(2).getShowValue().trim());
return foodUnit; return foodUnit;
} }
} }
...@@ -134,9 +134,11 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode ...@@ -134,9 +134,11 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_LINE)); infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_LINE));
infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_TITLE, "基本信息")); infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_TITLE, "基本信息"));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "供應商編號", false, "請輸入編號", new InputFilter[]{new InputFilter.LengthFilter(11), new EnAndNumInputFilter()})); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "供應商編號", false, "請輸入編號", new InputFilter[]{new InputFilter.LengthFilter(11), new EnAndNumInputFilter()}));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "名稱", true, "請輸入名稱", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 100), InputFilterUtils.getChAndEnAndNumAndPtInputFilter(mContext)}, mSupplierNameChangeListener)); MultiInputBean multiInputSupplierName = new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "名稱", true, "請輸入名稱", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 100), InputFilterUtils.getChAndEnAndNumAndPtInputFilter(mContext)}, mSupplierNameChangeListener);
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "聯繫人", true, "請輸入聯繫人", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)})); multiInputSupplierName.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "詳細地址", true, "請輸入詳細地址", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)})); infoMultiBeans.add(multiInputSupplierName);
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "聯繫人", true, "請輸入聯繫人", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}, InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_WORDS));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "詳細地址", true, "請輸入詳細地址", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 150), InputFilterUtils.getChAndEnAndNumAndPtInputFilter(mContext)}, InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "聯繫人電話", true, "請輸入聯繫人電話", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 11)}, EditorInfo.TYPE_CLASS_PHONE)); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "聯繫人電話", true, "請輸入聯繫人電話", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 11)}, EditorInfo.TYPE_CLASS_PHONE));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "最低採購金額", false, "請輸入最低金額", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 9)}, EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_FLAG_DECIMAL)); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "最低採購金額", false, "請輸入最低金額", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 9)}, EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_FLAG_DECIMAL));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "運費", false, "請輸入運費", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 9)}, EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_FLAG_DECIMAL)); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "運費", false, "請輸入運費", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 9)}, EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_FLAG_DECIMAL));
...@@ -155,16 +157,16 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode ...@@ -155,16 +157,16 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
MultiCheckInputBean emailInputBean = new MultiCheckInputBean(InfoMultiBean.ITEM_MULTIPLE_CHECKBOX, "Email", false, "請輸入Email", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20)}, R.drawable.ic_email, false); MultiCheckInputBean emailInputBean = new MultiCheckInputBean(InfoMultiBean.ITEM_MULTIPLE_CHECKBOX, "Email", false, "請輸入Email", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20)}, R.drawable.ic_email, false);
emailInputBean.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS); emailInputBean.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
contactInfo.add(emailInputBean); contactInfo.add(emailInputBean);
contactInfo.add(new MultiCheckInputBean(InfoMultiBean.ITEM_MULTIPLE_CHECKBOX, "WhatsApp", false, "請輸入WhatsApp", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}, R.drawable.ic_whatsapp, false)); contactInfo.add(new MultiCheckInputBean(InfoMultiBean.ITEM_MULTIPLE_CHECKBOX, "WhatsApp", false, "請輸入WhatsApp", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}, R.drawable.ic_whatsapp, false).setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES));
contactInfo.add(new MultiCheckInputBean(InfoMultiBean.ITEM_MULTIPLE_CHECKBOX, "WeChat", false, "請輸入WeChat", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}, R.drawable.ic_wechat, false)); contactInfo.add(new MultiCheckInputBean(InfoMultiBean.ITEM_MULTIPLE_CHECKBOX, "WeChat", false, "請輸入WeChat", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}, R.drawable.ic_wechat, false));
contactInfo.add(new MultiCheckInputBean(InfoMultiBean.ITEM_MULTIPLE_CHECKBOX, "Line", false, "請輸入Line", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}, R.drawable.ic_line, false)); contactInfo.add(new MultiCheckInputBean(InfoMultiBean.ITEM_MULTIPLE_CHECKBOX, "Line", false, "請輸入Line", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}, R.drawable.ic_line, false));
contactInfo.add(new MultiCheckInputBean(InfoMultiBean.ITEM_MULTIPLE_CHECKBOX, "Kakao Talk", false, "請輸入Kakao Talk", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}, R.drawable.ic_talk, false)); contactInfo.add(new MultiCheckInputBean(InfoMultiBean.ITEM_MULTIPLE_CHECKBOX, "Kakao Talk", false, "請輸入Kakao Talk", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}, R.drawable.ic_talk, false));
contactInfo.add(new MultiCheckInputBean(InfoMultiBean.ITEM_MULTIPLE_CHECKBOX, "SMS", false, "請輸入SMS", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}, R.drawable.ic_sms, false)); contactInfo.add(new MultiCheckInputBean(InfoMultiBean.ITEM_MULTIPLE_CHECKBOX, "SMS", false, "請輸入SMS", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}, R.drawable.ic_sms, false));
infoMultiBeans.addAll(contactInfo); infoMultiBeans.addAll(contactInfo);
infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_LINE)); infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_LINE));
infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_TITLE, "備註")); infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_TITLE, "備註").setInputType(EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE));
MultiInputBean remarkInputBean = new MultiInputBean(InfoMultiBean.ITEM_MULTIPLE_INPUT_REMARK, null, false, "請輸入備註", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, RemarkProvider.REMARK_TEXT_LENGTH), InputFilterUtils.getChAndEnAndNumAndPtInputFilter(mContext)}); MultiInputBean remarkInputBean = new MultiInputBean(InfoMultiBean.ITEM_MULTIPLE_INPUT_REMARK, null, false, "請輸入備註", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, RemarkProvider.REMARK_TEXT_LENGTH), InputFilterUtils.getChAndEnNumPtWrapInputFilter(mContext)}).setInputType(EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE);
remarkInputBean.setMaxLength(RemarkProvider.REMARK_TEXT_LENGTH); remarkInputBean.setMaxLength(RemarkProvider.REMARK_TEXT_LENGTH);
infoMultiBeans.add(remarkInputBean); infoMultiBeans.add(remarkInputBean);
...@@ -508,16 +510,16 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode ...@@ -508,16 +510,16 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
supplierInfoBean = new SupplierInfoBean(); supplierInfoBean = new SupplierInfoBean();
} }
//供應商編號 //供應商編號
supplierInfoBean.setSupplierNo(infoMultiBeans.get(supplierNoIndex).getShowValue()); supplierInfoBean.setSupplierNo(infoMultiBeans.get(supplierNoIndex).getShowValue().trim());
//供應商名稱 //供應商名稱
supplierInfoBean.setSupplierName(infoMultiBeans.get(supplierNameIndex).getShowValue()); supplierInfoBean.setSupplierName(infoMultiBeans.get(supplierNameIndex).getShowValue().trim());
//聯繫人 //聯繫人
supplierInfoBean.setContacts(infoMultiBeans.get(contactsIndex).getShowValue()); supplierInfoBean.setContacts(infoMultiBeans.get(contactsIndex).getShowValue().trim());
//手機號碼 //手機號碼
String telephone = infoMultiBeans.get(telephoneIndex).getShowValue(); String telephone = infoMultiBeans.get(telephoneIndex).getShowValue().trim();
supplierInfoBean.setContactInformation(telephone); supplierInfoBean.setContactInformation(telephone);
//地址 //地址
supplierInfoBean.setAddress(infoMultiBeans.get(addressIndex).getShowValue()); supplierInfoBean.setAddress(infoMultiBeans.get(addressIndex).getShowValue().trim());
//餐廳信息 //餐廳信息
supplierInfoBean.setRestaurantId(Constant.getRestaurantId()); supplierInfoBean.setRestaurantId(Constant.getRestaurantId());
supplierInfoBean.setBrandId(Constant.getBrandId()); supplierInfoBean.setBrandId(Constant.getBrandId());
...@@ -564,7 +566,7 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode ...@@ -564,7 +566,7 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
} }
deleteNullContact(contacts); deleteNullContact(contacts);
supplierInfoBean.setSupplierContacts(contacts); supplierInfoBean.setSupplierContacts(contacts);
supplierInfoBean.setRemarks(infoMultiBeans.get(remarkIndex).getShowValue()); supplierInfoBean.setRemarks(infoMultiBeans.get(remarkIndex).getShowValue().trim());
return supplierInfoBean; return supplierInfoBean;
} }
......
...@@ -49,12 +49,9 @@ public class PurchaseListPresenter extends BasePresenter<PurchaseListContract.Mo ...@@ -49,12 +49,9 @@ public class PurchaseListPresenter extends BasePresenter<PurchaseListContract.Mo
@Inject @Inject
AppManager mAppManager; AppManager mAppManager;
private List<OrderBean> orderList;
@Inject @Inject
public PurchaseListPresenter(PurchaseListContract.Model model, PurchaseListContract.View rootView) { public PurchaseListPresenter(PurchaseListContract.Model model, PurchaseListContract.View rootView) {
super(model, rootView); super(model, rootView);
orderList = new ArrayList<>();
} }
@Override @Override
...@@ -88,7 +85,7 @@ public class PurchaseListPresenter extends BasePresenter<PurchaseListContract.Mo ...@@ -88,7 +85,7 @@ public class PurchaseListPresenter extends BasePresenter<PurchaseListContract.Mo
map.put("pageIndex", pageIndex * PAGE_SIZE); map.put("pageIndex", pageIndex * PAGE_SIZE);
mModel.getOrderList(map) mModel.getOrderList(map)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("獲取中...")) .doOnSubscribe(disposable -> mRootView.showLoading(Constant.GET_INFO_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -97,11 +94,7 @@ public class PurchaseListPresenter extends BasePresenter<PurchaseListContract.Mo ...@@ -97,11 +94,7 @@ public class PurchaseListPresenter extends BasePresenter<PurchaseListContract.Mo
@Override @Override
public void onNext(@NonNull PurchaseOrderResultBean info) { public void onNext(@NonNull PurchaseOrderResultBean info) {
if (info.isSuccess()) { if (info.isSuccess()) {
if (pageIndex == 0) { mRootView.loadOrderList(info.getData().getList());
orderList.clear();
}
orderList.addAll(info.getData().getList());
mRootView.loadOrderList(orderList);
} else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) { } else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg()); mRootView.showMessage(info.getErrMsg());
mRootView.loadFail(); mRootView.loadFail();
...@@ -120,8 +113,9 @@ public class PurchaseListPresenter extends BasePresenter<PurchaseListContract.Mo ...@@ -120,8 +113,9 @@ public class PurchaseListPresenter extends BasePresenter<PurchaseListContract.Mo
/** /**
* 刪除訂單 * 刪除訂單
*
* @param position 訂單下標 * @param position 訂單下標
* @param orderId 訂單id * @param orderId 訂單id
*/ */
public void deleteOrder(int position, int orderId) { public void deleteOrder(int position, int orderId) {
mModel.deleteOrder(orderId) mModel.deleteOrder(orderId)
......
...@@ -2,16 +2,29 @@ package com.gingersoft.supply_chain.mvp.presenter; ...@@ -2,16 +2,29 @@ package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodEncodeSn;
import com.gingersoft.supply_chain.mvp.content.Constant;
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.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import me.jessyan.rxerrorhandler.core.RxErrorHandler; import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import javax.inject.Inject; import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.SnCodeListContract; import com.gingersoft.supply_chain.mvp.contract.SnCodeListContract;
import com.jess.arms.utils.RxLifecycleUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
...@@ -42,6 +55,66 @@ public class SnCodeListPresenter extends BasePresenter<SnCodeListContract.Model, ...@@ -42,6 +55,66 @@ public class SnCodeListPresenter extends BasePresenter<SnCodeListContract.Model,
super(model, rootView); super(model, rootView);
} }
/**
* 查詢sn碼記錄
*
* @param infoType 數據類型 0入庫流水SN碼,1出庫流水SN碼
* @param warehousingOrderDetailsIds
*/
public void querySnCodeList(int infoType, String warehousingOrderDetailsIds) {
Map<String, Object> map = new HashMap<>();
//入库SN编码查询 statesSn 0
//出库SN编码查询 statesSn 1
map.put("statesSn", infoType);
if (infoType == 0) {
//入庫傳這個
map.put("warehousingEncodeSnIdList", warehousingOrderDetailsIds);
} else {
if (TextUtil.isEmptyOrNullOrUndefined(warehousingOrderDetailsIds)) {
mRootView.showMessage("出庫單號獲取失敗,請稍後重試");
} else {
//出庫傳這個
map.put("consumeEncodeSnIdList", warehousingOrderDetailsIds);
}
}
mModel.querySnCodeList(map)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.QUERY_LOADING))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(BaseResult baseResult) {
if (baseResult != null && baseResult.isSuccess()) {
mRootView.initAdapter(GsonUtils.jsonToList(baseResult.getData(), PurchaseFoodEncodeSn.class));
}
}
});
}
/**
* 查詢sn碼記錄
*/
public void queryInStockSnCodes(String foodNo) {
mModel.queryInStockSnCodes(foodNo)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.QUERY_LOADING))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(BaseResult baseResult) {
if (baseResult != null && baseResult.isSuccess()) {
mRootView.initAdapter(GsonUtils.jsonToList(baseResult.getData(), PurchaseFoodEncodeSn.class));
}
}
});
}
@Override @Override
public void onDestroy() { public void onDestroy() {
super.onDestroy(); super.onDestroy();
......
...@@ -6,6 +6,7 @@ import android.util.Log; ...@@ -6,6 +6,7 @@ import android.util.Log;
import com.gingersoft.gsa.cloud.common.bean.BaseResult; import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.utils.CollectionUtils; import com.gingersoft.gsa.cloud.common.utils.CollectionUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.mvp.bean.PurchaseWarehousingOrderDetailsVO;
import com.gingersoft.supply_chain.mvp.bean.SupplierResultBean; import com.gingersoft.supply_chain.mvp.bean.SupplierResultBean;
import com.gingersoft.supply_chain.mvp.bean.WareHouseListBean; import com.gingersoft.supply_chain.mvp.bean.WareHouseListBean;
import com.gingersoft.supply_chain.mvp.content.Constant; import com.gingersoft.supply_chain.mvp.content.Constant;
...@@ -16,6 +17,7 @@ import com.jess.arms.http.imageloader.ImageLoader; ...@@ -16,6 +17,7 @@ import com.jess.arms.http.imageloader.ImageLoader;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
import lombok.experimental.FieldDefaults;
import me.jessyan.rxerrorhandler.core.RxErrorHandler; import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber; import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
...@@ -60,7 +62,6 @@ public class WareHouseListPresenter extends BasePresenter<WareHouseListContract. ...@@ -60,7 +62,6 @@ public class WareHouseListPresenter extends BasePresenter<WareHouseListContract.
public final int SORT_UNIT_PRICE = 1; public final int SORT_UNIT_PRICE = 1;
public final int SORT_WAREHOUSING_NUM = 2; public final int SORT_WAREHOUSING_NUM = 2;
public final int SORT_TOTAL_AMOUNT = 3; public final int SORT_TOTAL_AMOUNT = 3;
private WareHouseListBean.WareHousingDataBean data;
@Inject @Inject
public WareHouseListPresenter(WareHouseListContract.Model model, WareHouseListContract.View rootView) { public WareHouseListPresenter(WareHouseListContract.Model model, WareHouseListContract.View rootView) {
...@@ -82,12 +83,12 @@ public class WareHouseListPresenter extends BasePresenter<WareHouseListContract. ...@@ -82,12 +83,12 @@ public class WareHouseListPresenter extends BasePresenter<WareHouseListContract.
* @param type 類型 * @param type 類型
* @param isAscending 升序或降序 * @param isAscending 升序或降序
*/ */
public void sortByType(int type, boolean isAscending) { public void sortByType(int type, boolean isAscending, List<PurchaseWarehousingOrderDetailsVO> purchaseWarehousingOrderDetailsVOS) {
if (data == null || data.getPurchaseWarehousingOrderDetailsVOS() == null) { if (CollectionUtils.isNullOrEmpty(purchaseWarehousingOrderDetailsVOS)) {
return; return;
} }
if (type == SORT_UNIT_PRICE) { if (type == SORT_UNIT_PRICE) {
Collections.sort(data.getPurchaseWarehousingOrderDetailsVOS(), (o1, o2) -> { Collections.sort(purchaseWarehousingOrderDetailsVOS, (o1, o2) -> {
if (isAscending) { if (isAscending) {
return (int) (o1.getFoodPrice() - o2.getFoodPrice()); return (int) (o1.getFoodPrice() - o2.getFoodPrice());
} else { } else {
...@@ -96,7 +97,7 @@ public class WareHouseListPresenter extends BasePresenter<WareHouseListContract. ...@@ -96,7 +97,7 @@ public class WareHouseListPresenter extends BasePresenter<WareHouseListContract.
}); });
} else if (type == SORT_WAREHOUSING_NUM) { } else if (type == SORT_WAREHOUSING_NUM) {
//庫存數量 //庫存數量
Collections.sort(data.getPurchaseWarehousingOrderDetailsVOS(), (o1, o2) -> { Collections.sort(purchaseWarehousingOrderDetailsVOS, (o1, o2) -> {
if (isAscending) { if (isAscending) {
return o1.getFoodNum() - o2.getFoodNum(); return o1.getFoodNum() - o2.getFoodNum();
} else { } else {
...@@ -105,7 +106,7 @@ public class WareHouseListPresenter extends BasePresenter<WareHouseListContract. ...@@ -105,7 +106,7 @@ public class WareHouseListPresenter extends BasePresenter<WareHouseListContract.
}); });
} else if (type == SORT_TOTAL_AMOUNT) { } else if (type == SORT_TOTAL_AMOUNT) {
//總價 //總價
Collections.sort(data.getPurchaseWarehousingOrderDetailsVOS(), (o1, o2) -> { Collections.sort(purchaseWarehousingOrderDetailsVOS, (o1, o2) -> {
if (isAscending) { if (isAscending) {
return (int) (o1.getFoodAmount() - o2.getFoodAmount()); return (int) (o1.getFoodAmount() - o2.getFoodAmount());
} else { } else {
...@@ -113,7 +114,7 @@ public class WareHouseListPresenter extends BasePresenter<WareHouseListContract. ...@@ -113,7 +114,7 @@ public class WareHouseListPresenter extends BasePresenter<WareHouseListContract.
} }
}); });
} }
mRootView.loadListInfo(data.getPurchaseWarehousingOrderDetailsVOS()); mRootView.loadSortData(purchaseWarehousingOrderDetailsVOS);
} }
public void getWarehousing(int pageIndex, String foodName) { public void getWarehousing(int pageIndex, String foodName) {
...@@ -136,14 +137,18 @@ public class WareHouseListPresenter extends BasePresenter<WareHouseListContract. ...@@ -136,14 +137,18 @@ public class WareHouseListPresenter extends BasePresenter<WareHouseListContract.
@Override @Override
public void onNext(WareHouseListBean wareHouseListBean) { public void onNext(WareHouseListBean wareHouseListBean) {
if (wareHouseListBean.isSuccess()) { if (wareHouseListBean.isSuccess()) {
mRootView.finishLoad(); // if (data == null || pageIndex == 0) {
if (data == null || pageIndex == 0) { // data = new WareHouseListBean.WareHousingDataBean();
data = new WareHouseListBean.WareHousingDataBean(); // data.setPurchaseWarehousingOrderDetailsVOS(new ArrayList<>());
data.setPurchaseWarehousingOrderDetailsVOS(new ArrayList<>()); // data.getPurchaseWarehousingOrderDetailsVOS().add(new PurchaseWarehousingOrderDetailsVO());
// }
// data.setTotal(wareHouseListBean.getData().getTotal());
if (CollectionUtils.isNullOrEmpty(wareHouseListBean.getData().getPurchaseWarehousingOrderDetailsVOS())) {
mRootView.finishLoadNoMoreData();
} else {
mRootView.loadWarehousingInfo(wareHouseListBean.getData());
} }
data.setTotal(wareHouseListBean.getData().getTotal()); // data.getPurchaseWarehousingOrderDetailsVOS().addAll(wareHouseListBean.getData().getPurchaseWarehousingOrderDetailsVOS());
data.getPurchaseWarehousingOrderDetailsVOS().addAll(wareHouseListBean.getData().getPurchaseWarehousingOrderDetailsVOS());
mRootView.loadWarehousingInfo(data);
} else if (TextUtil.isNotEmptyOrNullOrUndefined(wareHouseListBean.getErrMsg())) { } else if (TextUtil.isNotEmptyOrNullOrUndefined(wareHouseListBean.getErrMsg())) {
mRootView.showMessage(wareHouseListBean.getErrMsg()); mRootView.showMessage(wareHouseListBean.getErrMsg());
mRootView.loadFail(); mRootView.loadFail();
......
...@@ -254,69 +254,4 @@ public class WarehouseDetailsPresenter extends BasePresenter<WarehouseDetailsCon ...@@ -254,69 +254,4 @@ public class WarehouseDetailsPresenter extends BasePresenter<WarehouseDetailsCon
} }
}); });
} }
/**
* 查詢sn碼記錄
*
* @param infoType 數據類型 0入庫流水SN碼,1出庫流水SN碼
* @param foodQuantity 數量
* @param remark 備註
* @param warehousingOrderDetailsIds
*/
public void querySnCodeList(int infoType, int foodQuantity, String remark, String warehousingOrderDetailsIds) {
Map<String, Object> map = new HashMap<>();
//入库SN编码查询 statesSn 0
//出库SN编码查询 statesSn 1
map.put("statesSn", infoType);
if (infoType == 0) {
//入庫傳這個
map.put("warehousingEncodeSnIdList", warehousingOrderDetailsIds);
} else {
//出庫傳這個
map.put("consumeEncodeSnIdList", warehousingOrderDetailsIds);
}
mModel.querySnCodeList(map)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.QUERY_LOADING))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(BaseResult baseResult) {
if (baseResult != null && baseResult.isSuccess()) {
List<PurchaseFoodEncodeSn> purchaseFoodEncodeSns = GsonUtils.jsonToList(baseResult.getData(), PurchaseFoodEncodeSn.class);
mRootView.jumpSnList(foodQuantity, remark, purchaseFoodEncodeSns);
}
}
});
}
/**
* 查詢sn碼記錄
*
* @param infoType 數據類型 0入庫流水SN碼,1出庫流水SN碼
* @param foodQuantity 數量
* @param remark 備註
* @param warehousingOrderDetailsIds
*/
public void queryInStockSnCodes(int foodQuantity, String remark, String foodNo) {
mModel.queryInStockSnCodes(foodNo)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.QUERY_LOADING))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(BaseResult baseResult) {
if (baseResult != null && baseResult.isSuccess()) {
List<PurchaseFoodEncodeSn> purchaseFoodEncodeSns = GsonUtils.jsonToList(baseResult.getData(), PurchaseFoodEncodeSn.class);
mRootView.jumpSnList(foodQuantity, remark, purchaseFoodEncodeSns);
}
}
});
}
} }
...@@ -3,10 +3,14 @@ package com.gingersoft.supply_chain.mvp.presenter; ...@@ -3,10 +3,14 @@ package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.common.bean.BaseResult; import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.utils.CollectionUtils;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils; 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.supply_chain.mvp.bean.InventoryRecordBean; import com.gingersoft.supply_chain.mvp.bean.InventoryRecordBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseConsumeSnBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodEncodeSn;
import com.gingersoft.supply_chain.mvp.content.Constant; import com.gingersoft.supply_chain.mvp.content.Constant;
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;
...@@ -17,6 +21,9 @@ import io.reactivex.schedulers.Schedulers; ...@@ -17,6 +21,9 @@ 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;
import okhttp3.FormBody; import okhttp3.FormBody;
import okhttp3.MediaType;
import okhttp3.Request;
import okhttp3.RequestBody;
import javax.inject.Inject; import javax.inject.Inject;
...@@ -68,20 +75,37 @@ public class WarehousingInventoryPresenter extends BasePresenter<WarehousingInve ...@@ -68,20 +75,37 @@ public class WarehousingInventoryPresenter extends BasePresenter<WarehousingInve
this.mApplication = null; this.mApplication = null;
} }
public void consumeWareHousing(String foodNo, int consumeQuantity) {
consumeWareHousing(getPurchaseConsumeSnBean(foodNo, consumeQuantity, null));
}
public void consumeWareHousing(String foodNo, int consumeQuantity, List<PurchaseFoodEncodeSn> snCodes) {
consumeWareHousing(getPurchaseConsumeSnBean(foodNo, consumeQuantity, snCodes));
}
public PurchaseConsumeSnBean getPurchaseConsumeSnBean(String foodNo, int consumeQuantity, List<PurchaseFoodEncodeSn> snCodes) {
PurchaseConsumeSnBean purchaseConsumeSnBean = new PurchaseConsumeSnBean();
purchaseConsumeSnBean.brandId = Constant.getBrandId();
purchaseConsumeSnBean.restaurantId = Constant.getRestaurantId();
purchaseConsumeSnBean.foodNo = foodNo;
purchaseConsumeSnBean.consumeQuantity = consumeQuantity;
purchaseConsumeSnBean.purchaseConsumeReasonId = Constant.INVENTORY_CONSUME_ID;
if (CollectionUtils.isNotNullOrEmpty(snCodes)) {
purchaseConsumeSnBean.encodeFoodNos = new ArrayList<>();
for (PurchaseFoodEncodeSn snCode : snCodes) {
purchaseConsumeSnBean.encodeFoodNos.add(snCode.getEncodeSnNo());
}
}
return purchaseConsumeSnBean;
}
/** /**
* 庫存消耗 * 庫存消耗——盤點
*
* @param foodNo 食材編號
* @param consumeQuantity 消耗數量
*/ */
public void consumeWareHousing(String foodNo, int consumeQuantity) { public void consumeWareHousing(PurchaseConsumeSnBean purchaseConsumeSnBean) {
FormBody.Builder formBody = new FormBody.Builder() RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(purchaseConsumeSnBean));
.add("foodNo", foodNo) mModel.wareHousingInventory(requestBody)
.add("consumeQuantity", String.valueOf(consumeQuantity))
.add("purchaseConsumeReasonId", String.valueOf(Constant.INVENTORY_CONSUME_ID));
Constant.addRestaurantId(formBody);
Constant.addBrandId(formBody);
mModel.consumeWareHousing(formBody.build())
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.SAVE_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(Constant.SAVE_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
...@@ -94,8 +118,7 @@ public class WarehousingInventoryPresenter extends BasePresenter<WarehousingInve ...@@ -94,8 +118,7 @@ public class WarehousingInventoryPresenter extends BasePresenter<WarehousingInve
if (baseResult != null && baseResult.isSuccess()) { if (baseResult != null && baseResult.isSuccess()) {
//消耗完之後,關閉頁面 //消耗完之後,關閉頁面
mRootView.showMessage(Constant.SAVE_SUCCESS); mRootView.showMessage(Constant.SAVE_SUCCESS);
mRootView.updateSuccess(); mRootView.updateSuccess(purchaseConsumeSnBean.consumeQuantity);
mRootView.killMyself();
} else if (baseResult != null && TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) { } else if (baseResult != null && TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg()); mRootView.showMessage(baseResult.getErrMsg());
} else { } else {
...@@ -115,7 +138,7 @@ public class WarehousingInventoryPresenter extends BasePresenter<WarehousingInve ...@@ -115,7 +138,7 @@ public class WarehousingInventoryPresenter extends BasePresenter<WarehousingInve
map.put("pageIndex", pageIndex * Constant.PAGE_SIZE); map.put("pageIndex", pageIndex * Constant.PAGE_SIZE);
mModel.getWarehousingRecord(map) mModel.getWarehousingRecord(map)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.SAVE_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(Constant.QUERY_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
......
...@@ -451,6 +451,13 @@ public interface SupplierServer { ...@@ -451,6 +451,13 @@ public interface SupplierServer {
Observable<BaseResult> consumeWareHousing(@Body RequestBody requestBody); Observable<BaseResult> consumeWareHousing(@Body RequestBody requestBody);
/** /**
* 庫存盤點
*/
@Headers({"Domain-Name: ricepon-purchase"})
@POST("purchaseConsume/addCheck" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> wareHousingInventory(@Body RequestBody requestBody);
/**
* 查詢庫存數量 * 查詢庫存數量
*/ */
@Headers({"Domain-Name: ricepon-purchase"}) @Headers({"Domain-Name: ricepon-purchase"})
......
...@@ -3,7 +3,6 @@ package com.gingersoft.supply_chain.mvp.ui.adapter; ...@@ -3,7 +3,6 @@ package com.gingersoft.supply_chain.mvp.ui.adapter;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.util.SparseArray; import android.util.SparseArray;
import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
...@@ -12,13 +11,11 @@ import androidx.databinding.DataBindingUtil; ...@@ -12,13 +11,11 @@ import androidx.databinding.DataBindingUtil;
import androidx.databinding.ViewDataBinding; import androidx.databinding.ViewDataBinding;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import org.w3c.dom.Text;
/** /**
* 通用的RecyclerView.ViewHolder。提供了根据viewId获取View的方法。 * 通用的RecyclerView.ViewHolder。提供了根据viewId获取View的方法。
* 提供了对View、TextView、ImageView的常用设置方法。 * 提供了对View、TextView、ImageView的常用设置方法。
*/ */
public class BaseViewHolder<VH extends RecyclerView.ViewHolder> extends RecyclerView.ViewHolder { public class BaseViewHolder extends RecyclerView.ViewHolder {
private SparseArray<View> mViews; private SparseArray<View> mViews;
......
...@@ -28,16 +28,14 @@ import java.util.List; ...@@ -28,16 +28,14 @@ import java.util.List;
public class FirstLevelCategoryAdapter extends BaseQuickAdapter<OrderCategoryBean.FoodCategoryTrees, BaseViewHolder> { public class FirstLevelCategoryAdapter extends BaseQuickAdapter<OrderCategoryBean.FoodCategoryTrees, BaseViewHolder> {
private int selectedIndex = 0; private int selectedIndex = 0;
private Drawable selectedBg; private int selectedBg = R.drawable.shape_left_radio_shadow;
private Drawable unSelectedBg; private int unSelectedBg = R.color.trans;
private int selectColor = -1; private int selectColor = -1;
private int unSelectColor = -1; private int unSelectColor = -1;
public FirstLevelCategoryAdapter(@Nullable List<OrderCategoryBean.FoodCategoryTrees> data, Context context) { public FirstLevelCategoryAdapter(@Nullable List<OrderCategoryBean.FoodCategoryTrees> data, Context context) {
super(R.layout.item_first_level_category, data); super(R.layout.item_first_level_category, data);
selectedBg = ContextCompat.getDrawable(context, R.drawable.shape_left_radio_shadow);
unSelectedBg = ContextCompat.getDrawable(context, R.color.trans);
selectColor = ContextCompat.getColor(context, R.color.other_order_details_sure_btn_color); selectColor = ContextCompat.getColor(context, R.color.other_order_details_sure_btn_color);
unSelectColor = ContextCompat.getColor(context, R.color.color_3c); unSelectColor = ContextCompat.getColor(context, R.color.color_3c);
} }
...@@ -55,32 +53,32 @@ public class FirstLevelCategoryAdapter extends BaseQuickAdapter<OrderCategoryBea ...@@ -55,32 +53,32 @@ public class FirstLevelCategoryAdapter extends BaseQuickAdapter<OrderCategoryBea
} }
//選中時的背景和文字顏色 //選中時的背景和文字顏色
if (viewHolder.getAdapterPosition() == selectedIndex) { if (viewHolder.getAdapterPosition() == selectedIndex) {
if (selectedBg != null) { view.setBackground(ContextCompat.getDrawable(getContext(), selectedBg));
view.setBackground(selectedBg);
}
if (selectColor != -1) { if (selectColor != -1) {
tvCategoryName.setTextColor(selectColor); tvCategoryName.setTextColor(selectColor);
} }
tvCategoryName.setSelected(true); tvCategoryName.setSelected(true);
} else { } else {
tvCategoryName.setSelected(false); tvCategoryName.setSelected(false);
if (unSelectedBg != null) { view.setBackground(ContextCompat.getDrawable(getContext(), unSelectedBg));
view.setBackground(unSelectedBg);
}
if (unSelectColor != -1) { if (unSelectColor != -1) {
tvCategoryName.setTextColor(unSelectColor); tvCategoryName.setTextColor(unSelectColor);
} }
} }
} }
public FirstLevelCategoryAdapter setSelectedBg(Drawable selectedBg) { @Override
this.selectedBg = selectedBg; protected void convert(@NotNull BaseViewHolder holder, OrderCategoryBean.FoodCategoryTrees item, @NotNull List<?> payloads) {
return this; if (payloads.isEmpty()) {
} convert(holder, item);
} else {
public FirstLevelCategoryAdapter setUnSelectedBg(Drawable unSelectedBg) { if (item.getSize() > 0) {
this.unSelectedBg = unSelectedBg; holder.setText(R.id.tv_category_number, String.valueOf(item.getSize()));
return this; holder.setGone(R.id.tv_category_number, false);
} else {
holder.setGone(R.id.tv_category_number, true);
}
}
} }
public FirstLevelCategoryAdapter setSelectColor(int selectColor) { public FirstLevelCategoryAdapter setSelectColor(int selectColor) {
......
...@@ -81,12 +81,12 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Shop ...@@ -81,12 +81,12 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Shop
//備註 //備註
viewHolder.setText(R.id.ed_purchase_shopping_remarks, shoppingCartBean.getRemarks()); viewHolder.setText(R.id.ed_purchase_shopping_remarks, shoppingCartBean.getRemarks());
EditText mEdRemarks = viewHolder.getView(R.id.ed_purchase_shopping_remarks); EditText mEdRemarks = viewHolder.getView(R.id.ed_purchase_shopping_remarks);
mEdRemarks.setFilters(new InputFilter[]{InputFilterUtils.getLengthFilter(getContext(), RemarkProvider.REMARK_TEXT_LENGTH), InputFilterUtils.getChAndEnAndNumAndPtInputFilter(getContext())}); mEdRemarks.setFilters(new InputFilter[]{InputFilterUtils.getLengthFilter(getContext(), RemarkProvider.REMARK_TEXT_LENGTH), InputFilterUtils.getChAndEnNumPtWrapInputFilter(getContext())});
mEdRemarks.setOnFocusChangeListener((v, hasFocus) -> { mEdRemarks.setOnFocusChangeListener((v, hasFocus) -> {
if (!hasFocus) { if (!hasFocus) {
//失去焦點時修改備註 //失去焦點時修改備註
ShoppingCartBean currentShoppingBean = getData().get(viewHolder.getAdapterPosition()); ShoppingCartBean currentShoppingBean = getData().get(viewHolder.getAdapterPosition());
currentShoppingBean.setRemarks(mEdRemarks.getText() + ""); currentShoppingBean.setRemarks(mEdRemarks.getText().toString().trim());
} }
}); });
if (shoppingCartBean.isFlashing()) { if (shoppingCartBean.isFlashing()) {
......
...@@ -32,7 +32,7 @@ public class SupplierAdapter extends BaseQuickAdapter<SupplierInfoBean, BaseView ...@@ -32,7 +32,7 @@ public class SupplierAdapter extends BaseQuickAdapter<SupplierInfoBean, BaseView
public SupplierAdapter(@Nullable List<SupplierInfoBean> data, boolean isSelect) { public SupplierAdapter(@Nullable List<SupplierInfoBean> data, boolean isSelect) {
super(R.layout.item_supplier, data); super(R.layout.item_supplier, data);
addChildClickViewIds(R.id.iv_supplier_delete, R.id.layout_supplier_food_info); addChildClickViewIds(R.id.iv_supplier_delete, R.id.layout_see_ingredients);
this.isSelect = isSelect; this.isSelect = isSelect;
} }
......
...@@ -55,7 +55,7 @@ public class WareHousingDetailsAdapter extends BaseQuickAdapter<WarehouseDetails ...@@ -55,7 +55,7 @@ public class WareHousingDetailsAdapter extends BaseQuickAdapter<WarehouseDetails
// 入庫,顯示+ // 入庫,顯示+
if (purchaseWarehousingOrderDetailsContentsBean.getFoodQuantity() >= 0) { if (purchaseWarehousingOrderDetailsContentsBean.getFoodQuantity() >= 0) {
//如果大於0,前面顯示+號 //如果大於0,前面顯示+號
viewHolder.setText(R.id.tv_warehouse_details_food_num, String.format(getContext().getString(R.string.str_format_positive), MoneyUtil.formatDouble(purchaseWarehousingOrderDetailsContentsBean.getFoodQuantity()))); viewHolder.setText(R.id.tv_warehouse_details_food_num, String.format(getContext().getString(R.string.str_format_positive_int), purchaseWarehousingOrderDetailsContentsBean.getFoodQuantity()));
} else { } else {
//小於0,直接顯示負數 //小於0,直接顯示負數
viewHolder.setText(R.id.tv_warehouse_details_food_num, String.valueOf(purchaseWarehousingOrderDetailsContentsBean.getFoodQuantity())); viewHolder.setText(R.id.tv_warehouse_details_food_num, String.valueOf(purchaseWarehousingOrderDetailsContentsBean.getFoodQuantity()));
...@@ -69,10 +69,10 @@ public class WareHousingDetailsAdapter extends BaseQuickAdapter<WarehouseDetails ...@@ -69,10 +69,10 @@ public class WareHousingDetailsAdapter extends BaseQuickAdapter<WarehouseDetails
//出庫,顯示- //出庫,顯示-
if (purchaseWarehousingOrderDetailsContentsBean.getFoodQuantity() >= 0) { if (purchaseWarehousingOrderDetailsContentsBean.getFoodQuantity() >= 0) {
//如果大於0,前面顯示-號 //如果大於0,前面顯示-號
viewHolder.setText(R.id.tv_warehouse_details_food_num, String.format(getContext().getString(R.string.str_format_less), MoneyUtil.formatDouble(purchaseWarehousingOrderDetailsContentsBean.getFoodQuantity()))); viewHolder.setText(R.id.tv_warehouse_details_food_num, String.format(getContext().getString(R.string.str_format_less), purchaseWarehousingOrderDetailsContentsBean.getFoodQuantity() + ""));
} else { } else {
//小於0,顯示正數,負負得正 //小於0,顯示正數,負負得正
viewHolder.setText(R.id.tv_warehouse_details_food_num, String.format(getContext().getString(R.string.str_format_positive), MoneyUtil.formatDouble(Math.abs(purchaseWarehousingOrderDetailsContentsBean.getFoodQuantity())))); viewHolder.setText(R.id.tv_warehouse_details_food_num, String.format(getContext().getString(R.string.str_format_positive), Math.abs(purchaseWarehousingOrderDetailsContentsBean.getFoodQuantity()) + ""));
} }
// 入庫顯示消耗日期,不顯示入庫日期 // 入庫顯示消耗日期,不顯示入庫日期
viewHolder.setGone(R.id.tv_warehouse_time_text, true); viewHolder.setGone(R.id.tv_warehouse_time_text, true);
...@@ -98,7 +98,7 @@ public class WareHousingDetailsAdapter extends BaseQuickAdapter<WarehouseDetails ...@@ -98,7 +98,7 @@ public class WareHousingDetailsAdapter extends BaseQuickAdapter<WarehouseDetails
tvExpiresTime.setVisibility(View.GONE); tvExpiresTime.setVisibility(View.GONE);
} else { } else {
//部分消耗 //部分消耗
if(purchaseWarehousingOrderDetailsContentsBean.getConsumeStatus() == WarehouseDetailsBean.WAREHOUSE_STATE_PART_CONSUMED){ if (purchaseWarehousingOrderDetailsContentsBean.getConsumeStatus() == WarehouseDetailsBean.WAREHOUSE_STATE_PART_CONSUMED) {
tvState.setText("部分使用"); tvState.setText("部分使用");
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);
...@@ -113,6 +113,7 @@ public class WareHousingDetailsAdapter extends BaseQuickAdapter<WarehouseDetails ...@@ -113,6 +113,7 @@ public class WareHousingDetailsAdapter extends BaseQuickAdapter<WarehouseDetails
setExpiresTime(tvExpiresTime, R.drawable.shape_oval_bright_orange, "即将過期:", purchaseWarehousingOrderDetailsContentsBean.getDistanceExpiresTime()); setExpiresTime(tvExpiresTime, R.drawable.shape_oval_bright_orange, "即将過期:", purchaseWarehousingOrderDetailsContentsBean.getDistanceExpiresTime());
} else { } else {
tvExpiresTime.setVisibility(View.GONE); tvExpiresTime.setVisibility(View.GONE);
tvState.setVisibility(View.GONE);
} }
} else { } else {
//天數為負,則是已過期 //天數為負,則是已過期
......
package com.gingersoft.supply_chain.mvp.ui.adapter;
import android.content.Context;
import androidx.core.content.ContextCompat;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.PurchaseWarehousingOrderDetailsVO;
import org.jetbrains.annotations.NotNull;
import java.util.List;
/**
* @author 宇航.
* User: admin
* Date: 2021/1/6
* Time: 16:36
* Use:庫存查詢列表的首列
*/
public class WarehousingFirstColumnAdapter extends BaseQuickAdapter<PurchaseWarehousingOrderDetailsVO, BaseViewHolder> {
private Context context;
private int[] colors = new int[]{R.color.color_f9, R.color.white};
public WarehousingFirstColumnAdapter(Context context, List<PurchaseWarehousingOrderDetailsVO> purchaseWarehousingOrderDetailsVosBeans) {
super(R.layout.item_warehousing_head, purchaseWarehousingOrderDetailsVosBeans);
this.context = context;
}
@Override
protected void convert(@NotNull BaseViewHolder viewHolder, PurchaseWarehousingOrderDetailsVO item) {
viewHolder.setText(R.id.tv_warehouse_item_ingredients_name, item.getName());
viewHolder.setGone(R.id.tv_warehouse_item_ingredients_name, false);
viewHolder.setText(R.id.tv_warehouse_item_ingredients_species, item.getFoodCategoryName());
viewHolder.setText(R.id.tv_warehouse_item_unit, item.getUnitName());
viewHolder.setText(R.id.tv_warehouse_item_unit_price, item.getFoodPrice() + "");
viewHolder.setText(R.id.tv_warehouse_item_inventory_quantity, item.getFoodNum() + "");
viewHolder.setText(R.id.tv_warehouse_item_total_amount, item.getFoodAmount() + "");
viewHolder.setGone(R.id.tv_warehouse_item_ingredients_species, true);
viewHolder.setGone(R.id.tv_warehouse_item_unit, true);
viewHolder.setGone(R.id.tv_warehouse_item_unit_price, true);
viewHolder.setGone(R.id.tv_warehouse_item_inventory_quantity, true);
viewHolder.setGone(R.id.tv_warehouse_item_total_amount, true);
int textColorRes = getColor(R.color.color_3c);
viewHolder.setTextColor(R.id.tv_warehouse_item_ingredients_name, textColorRes);
int colorRes = getColor(colors[viewHolder.getAdapterPosition() % 2]);
viewHolder.setBackgroundColor(R.id.tv_warehouse_item_ingredients_name, colorRes);
viewHolder.setBackgroundColor(R.id.tv_head_layout_res_id, getColor(R.color.trans));
}
private int getColor(int colorRes) {
return ContextCompat.getColor(context, colorRes);
}
}
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 android.view.ViewGroup;
import android.widget.LinearLayout;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder; import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.PurchaseWarehousingOrderDetailsVO; import com.gingersoft.supply_chain.mvp.bean.PurchaseWarehousingOrderDetailsVO;
import com.gingersoft.supply_chain.mvp.bean.WareHouseListBean; import com.gingersoft.supply_chain.mvp.bean.WareHouseListBean;
...@@ -28,33 +32,28 @@ public class WarehousingQueryAdapter extends BaseQuickAdapter<PurchaseWarehousin ...@@ -28,33 +32,28 @@ public class WarehousingQueryAdapter extends BaseQuickAdapter<PurchaseWarehousin
public WarehousingQueryAdapter(Context context, List<PurchaseWarehousingOrderDetailsVO> purchaseWarehousingOrderDetailsVosBeans) { public WarehousingQueryAdapter(Context context, List<PurchaseWarehousingOrderDetailsVO> purchaseWarehousingOrderDetailsVosBeans) {
super(R.layout.item_warehousing_query, purchaseWarehousingOrderDetailsVosBeans); super(R.layout.item_warehousing_query, purchaseWarehousingOrderDetailsVosBeans);
addChildClickViewIds(R.id.tv_warehouse_item_inventory_quantity); addChildClickViewIds(R.id.layout_inventory_quantity);
this.context = context; this.context = context;
} }
@Override @Override
protected void convert(@NotNull BaseViewHolder viewHolder, PurchaseWarehousingOrderDetailsVO item) { protected void convert(@NotNull BaseViewHolder viewHolder, PurchaseWarehousingOrderDetailsVO item) {
viewHolder.setText(R.id.tv_warehouse_item_ingredients_name, item.getName()); viewHolder.setText(R.id.tv_warehouse_item_ingredients_name, item.getName());
viewHolder.setGone(R.id.tv_warehouse_item_ingredients_name, false);
viewHolder.setText(R.id.tv_warehouse_item_ingredients_species, item.getFoodCategoryName()); viewHolder.setText(R.id.tv_warehouse_item_ingredients_species, item.getFoodCategoryName());
viewHolder.setText(R.id.tv_warehouse_item_unit, item.getUnitName()); viewHolder.setText(R.id.tv_warehouse_item_unit, item.getUnitName());
viewHolder.setText(R.id.tv_warehouse_item_unit_price, item.getFoodPrice() + ""); // viewHolder.setText(R.id.tv_warehouse_item_unit_price, String.format(context.getString(R.string.str_amount_tran_s), MoneyUtil.formatDouble(item.getFoodPrice())));
viewHolder.setText(R.id.tv_warehouse_item_unit_price, MoneyUtil.formatDouble(item.getFoodPrice()));
viewHolder.setText(R.id.tv_warehouse_item_inventory_quantity, item.getFoodNum() + ""); viewHolder.setText(R.id.tv_warehouse_item_inventory_quantity, item.getFoodNum() + "");
viewHolder.setText(R.id.tv_warehouse_item_total_amount, item.getFoodAmount() + ""); // viewHolder.setText(R.id.tv_warehouse_item_total_amount, String.format(context.getString(R.string.str_amount_tran_s), MoneyUtil.formatDouble(item.getFoodAmount())));
viewHolder.setText(R.id.tv_warehouse_item_total_amount, MoneyUtil.formatDouble(item.getFoodAmount()));
int textColorRes = getColor(R.color.color_3c); int textColorRes = getColor(R.color.color_3c);
setTextColor(viewHolder, textColorRes); setTextColor(viewHolder, textColorRes);
int colorRes = getColor(colors[viewHolder.getAdapterPosition() % 2]); int colorRes = getColor(colors[viewHolder.getAdapterPosition() % 2]);
viewHolder.setBackgroundColor(R.id.layout_warehousing, colorRes); viewHolder.setBackgroundColor(R.id.tv_head_layout_res_id, colorRes);
// setBgColor(viewHolder, colorRes); viewHolder.setGone(R.id.iv_unit_price_sort, true);
} viewHolder.setGone(R.id.iv_inventory_quantity_sort, true);
viewHolder.setGone(R.id.iv_total_amount_sort, true);
private void setBgColor(@NotNull BaseViewHolder viewHolder, int bgColorRes) {
viewHolder.setBackgroundColor(R.id.tv_warehouse_item_ingredients_name, bgColorRes);
viewHolder.setBackgroundColor(R.id.tv_warehouse_item_ingredients_species, bgColorRes);
viewHolder.setBackgroundColor(R.id.tv_warehouse_item_supplier, bgColorRes);
viewHolder.setBackgroundColor(R.id.tv_warehouse_item_unit, bgColorRes);
viewHolder.setBackgroundColor(R.id.tv_warehouse_item_unit_price, bgColorRes);
viewHolder.setBackgroundColor(R.id.tv_warehouse_item_inventory_quantity, bgColorRes);
viewHolder.setBackgroundColor(R.id.tv_warehouse_item_total_amount, bgColorRes);
} }
private void setTextColor(@NotNull BaseViewHolder viewHolder, int textColorRes) { private void setTextColor(@NotNull BaseViewHolder viewHolder, int textColorRes) {
......
...@@ -114,8 +114,7 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr ...@@ -114,8 +114,7 @@ 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(FoodIngredientsFragment.newInstance(FOOD_INGREDIENTS));
start(BuyIngredientsFragment.newInstance());
break; break;
case "種類": case "種類":
start(CategoryFragment.newInstance()); start(CategoryFragment.newInstance());
......
...@@ -163,7 +163,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -163,7 +163,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
showMessage("請輸入分類名稱"); showMessage("請輸入分類名稱");
return; return;
} }
mPresenter.updateFoodCategory(mPresenter.toFoodCategoryBean(foodCategoryTrees.getParentId(), categoryPopup.getEditText().getText().toString(), foodCategoryTrees.getId()), currentLevel, position); mPresenter.updateFoodCategory(mPresenter.toFoodCategoryBean(foodCategoryTrees.getParentId(), categoryPopup.getEditText().getText().toString().trim(), foodCategoryTrees.getId()), currentLevel, position);
}, () -> { }, () -> {
})) }))
.show(); .show();
...@@ -236,7 +236,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -236,7 +236,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
return; return;
} }
//創建分類 //創建分類
mPresenter.addCategory(parentId, categoryPopup.getEditText().getText().toString(), level); mPresenter.addCategory(parentId, categoryPopup.getEditText().getText().toString().trim(), level);
}, () -> { }, () -> {
})) }))
.show(); .show();
...@@ -345,6 +345,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -345,6 +345,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
//重置選中 //重置選中
secondCategoryAdapter.setSelectIndex(-1); secondCategoryAdapter.setSelectIndex(-1);
secondCategoryAdapter.setNewInstance(data); secondCategoryAdapter.setNewInstance(data);
secondCategoryAdapter.notifyDataSetChanged();
} }
} }
......
package com.gingersoft.supply_chain.mvp.ui.fragment.food;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.di.component.DaggerFoodIngredientCategoryComponent;
import com.gingersoft.supply_chain.mvp.contract.FoodIngredientCategoryContract;
import com.gingersoft.supply_chain.mvp.presenter.FoodIngredientCategoryPresenter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.jess.arms.di.component.AppComponent;
/**
* ================================================
* Description: 食材類別
*/
public class FoodIngredientCategoryFragment extends BaseSupplyChainFragment<FoodIngredientCategoryPresenter> implements FoodIngredientCategoryContract.View {
public static FoodIngredientCategoryFragment newInstance() {
FoodIngredientCategoryFragment fragment = new FoodIngredientCategoryFragment();
return fragment;
}
@Override
public void setupFragmentComponent(@NonNull AppComponent appComponent) {
DaggerFoodIngredientCategoryComponent //如找不到该类,请编译一下项目
.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.fragment_food_ingredient_category, container, false);
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
}
}
...@@ -289,7 +289,11 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi ...@@ -289,7 +289,11 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi
* 新建食品 * 新建食品
*/ */
private void toCreateFood() { private void toCreateFood() {
startForResult(NewFoodIngredientsFragment.newInstance(currentSupplierName, currentCategoryName), EDIT_FOOD_REQUEST_CODE); if (isSupplier) {
startForResult(NewFoodIngredientsFragment.newInstance(currentSupplierName, ""), EDIT_FOOD_REQUEST_CODE);
} else {
startForResult(NewFoodIngredientsFragment.newInstance("", currentCategoryName), EDIT_FOOD_REQUEST_CODE);
}
} }
private void moveToCenter(LinearLayoutManager leftLayoutManager, int sectionPosition) { private void moveToCenter(LinearLayoutManager leftLayoutManager, int sectionPosition) {
......
package com.gingersoft.supply_chain.mvp.ui.fragment.food; package com.gingersoft.supply_chain.mvp.ui.fragment.food;
import android.Manifest; import android.Manifest;
import android.content.ContentResolver;
import android.content.Intent; import android.content.Intent;
import android.database.Cursor;
import android.net.Uri; import android.net.Uri;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.provider.OpenableColumns;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log;
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 androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.core.content.FileProvider;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.gsa.cloud.common.utils.FileUtils; import com.gingersoft.gsa.cloud.common.utils.FileUtils;
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.toast.ToastUtils; import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils;
import com.gingersoft.gsa.cloud.common.utils.view.ImageUtils;
import com.gingersoft.gsa.cloud.ui.adapter.bean.InfoMultiBean; import com.gingersoft.gsa.cloud.ui.adapter.bean.InfoMultiBean;
import com.gingersoft.gsa.cloud.ui.adapter.bean.MultiSelectBean; import com.gingersoft.gsa.cloud.ui.adapter.bean.MultiSelectBean;
import com.gingersoft.gsa.cloud.ui.adapter.multi.InfoMultiAdapter; import com.gingersoft.gsa.cloud.ui.adapter.multi.InfoMultiAdapter;
import com.gingersoft.gsa.cloud.ui.bean.SectionCheckItem;
import com.gingersoft.gsa.cloud.ui.recylcler.decorator.DividerItemDecoration; import com.gingersoft.gsa.cloud.ui.recylcler.decorator.DividerItemDecoration;
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;
...@@ -51,19 +41,11 @@ import com.qmuiteam.qmui.widget.QMUITopBar; ...@@ -51,19 +41,11 @@ import com.qmuiteam.qmui.widget.QMUITopBar;
import com.yalantis.ucrop.UCrop; import com.yalantis.ucrop.UCrop;
import java.io.File; import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List; import java.util.List;
import butterknife.BindView; import butterknife.BindView;
import butterknife.OnClick; import butterknife.OnClick;
import cn.bingoogolapple.photopicker.activity.BGAPhotoPickerActivity;
import static com.gingersoft.gsa.cloud.ui.recylcler.decorator.DividerItemDecoration.VERTICAL_LIST; import static com.gingersoft.gsa.cloud.ui.recylcler.decorator.DividerItemDecoration.VERTICAL_LIST;
import static com.gingersoft.supply_chain.mvp.ui.fragment.category.CategorySelectFragment.SELECT_CATEGORY_DATA_KEY; import static com.gingersoft.supply_chain.mvp.ui.fragment.category.CategorySelectFragment.SELECT_CATEGORY_DATA_KEY;
...@@ -164,7 +146,7 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI ...@@ -164,7 +146,7 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI
String categoryName = arguments.getString(CATEGORY_NAME_KEY); String categoryName = arguments.getString(CATEGORY_NAME_KEY);
if (TextUtil.isNotEmptyOrNullOrUndefined(categoryName)) { if (TextUtil.isNotEmptyOrNullOrUndefined(categoryName)) {
//分類不為空,設置分類信息 //分類不為空,設置分類信息
List<String> categoryNames= new ArrayList<>(); List<String> categoryNames = new ArrayList<>();
categoryNames.add(categoryName); categoryNames.add(categoryName);
mPresenter.setCategoryNames(categoryNames); mPresenter.setCategoryNames(categoryNames);
purchaseFoodBean.setFoodCategoryName(categoryName); purchaseFoodBean.setFoodCategoryName(categoryName);
...@@ -218,15 +200,19 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI ...@@ -218,15 +200,19 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI
int viewId = v.getId(); int viewId = v.getId();
if (viewId == R.id.btn_save_new_food_ingredients) { if (viewId == R.id.btn_save_new_food_ingredients) {
//保存 //保存
String msg = mPresenter.verificationData(infoMultiAdapter.getData()); saveGoodsInfo();
if (TextUtil.isNotEmptyOrNullOrUndefined(msg)) { }
ToastUtils.show(mContext, msg); }
private void saveGoodsInfo() {
String msg = mPresenter.verificationData(infoMultiAdapter.getData());
if (TextUtil.isNotEmptyOrNullOrUndefined(msg)) {
ToastUtils.show(mContext, msg);
} else {
if (isUpdate) {
mPresenter.updateFood(mPresenter.getFoodInfoByInfoMulti(infoMultiAdapter.getData()));
} else { } else {
if (isUpdate) { mPresenter.addFoodInfo(mPresenter.getFoodInfoByInfoMulti(infoMultiAdapter.getData()));
mPresenter.updateFood(mPresenter.getFoodInfoByInfoMulti(infoMultiAdapter.getData()));
} else {
mPresenter.addFoodInfo(mPresenter.getFoodInfoByInfoMulti(infoMultiAdapter.getData()));
}
} }
} }
} }
...@@ -301,7 +287,29 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI ...@@ -301,7 +287,29 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI
bundle.putString(SUPPLIER_NAME_KEY, supplierName); bundle.putString(SUPPLIER_NAME_KEY, supplierName);
bundle.putString(CATEGORY_NAME_KEY, categoryName); bundle.putString(CATEGORY_NAME_KEY, categoryName);
setFragmentResult(EDIT_FOOD_RESULT_CODE, bundle); setFragmentResult(EDIT_FOOD_RESULT_CODE, bundle);
isLeave = true;
killMyself(); killMyself();
} }
/**
* 用戶是否決定離開這個頁面
*/
private boolean isLeave = false;
@Override
public boolean onBackPressedSupport() {
if (mPresenter.isUpdate(infoMultiAdapter.getData()) && !isLeave) {
//用戶修改了數據,提示是否保存
AppDialog.getInstance().showTipDialog(requireContext(), getString(R.string.str_info_no_save_leave), getString(R.string.str_save), getString(R.string.str_leave), (view, dialog) -> {
dialog.dismiss();
saveGoodsInfo();
}, (view, dialog) -> {
dialog.dismiss();
isLeave = true;
killMyself();
});
return true;
}
return super.onBackPressedSupport();
}
} }
...@@ -5,6 +5,7 @@ import android.text.InputFilter; ...@@ -5,6 +5,7 @@ import android.text.InputFilter;
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.view.inputmethod.EditorInfo;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
...@@ -98,7 +99,7 @@ public class NewFoodUnitFragment extends BaseSupplyChainFragment<NewFoodUnitPres ...@@ -98,7 +99,7 @@ public class NewFoodUnitFragment extends BaseSupplyChainFragment<NewFoodUnitPres
infoMultiBeans.add(unitType); infoMultiBeans.add(unitType);
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "計量單位", false, "請輸入計量單位", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 4), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)})); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "計量單位", false, "請輸入計量單位", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 4), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_MULTIPLE_INPUT_REMARK, "備註", false, "請輸入備註", new InputFilter[]{InputFilterUtils.getChAndEnAndNumAndPtInputFilter(mContext)})); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_MULTIPLE_INPUT_REMARK, "備註", false, "請輸入備註", new InputFilter[]{InputFilterUtils.getChAndEnAndNumAndPtInputFilter(mContext)}).setInputType(EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE));
if(foodUnit != null){ if(foodUnit != null){
units.get(foodUnit.getType()).setChecked(true); units.get(foodUnit.getType()).setChecked(true);
infoMultiBeans.get(1).setShowValue(foodUnit.getUnitContent()); infoMultiBeans.get(1).setShowValue(foodUnit.getUnitContent());
......
...@@ -57,6 +57,7 @@ import com.gingersoft.supply_chain.mvp.ui.widget.ScanSnPopup; ...@@ -57,6 +57,7 @@ import com.gingersoft.supply_chain.mvp.ui.widget.ScanSnPopup;
import com.gingersoft.supply_chain.mvp.ui.widget.ScanSnView; import com.gingersoft.supply_chain.mvp.ui.widget.ScanSnView;
import com.gingersoft.supply_chain.mvp.utils.SelectPicture; import com.gingersoft.supply_chain.mvp.utils.SelectPicture;
import com.google.android.material.checkbox.MaterialCheckBox; import com.google.android.material.checkbox.MaterialCheckBox;
import com.google.android.material.textfield.TextInputLayout;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.jess.arms.http.imageloader.ImageLoader; import com.jess.arms.http.imageloader.ImageLoader;
import com.lxj.xpopup.XPopup; import com.lxj.xpopup.XPopup;
...@@ -119,10 +120,12 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr ...@@ -119,10 +120,12 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
QMUIAlphaTextView tvOrderDetailsPartialReceipt; QMUIAlphaTextView tvOrderDetailsPartialReceipt;
@BindView(R2.id.tv_order_details_receipt) @BindView(R2.id.tv_order_details_receipt)
QMUIAlphaTextView tvOrderDetailsReceipt; QMUIAlphaTextView tvOrderDetailsReceipt;
@BindView(R2.id.layout_input_remark)
TextInputLayout layoutInputRemark;
@BindView(R2.id.ed_warehouse_order_remark) @BindView(R2.id.ed_warehouse_order_remark)
EditText edRemark; EditText edRemark;
@BindView(R2.id.layout_ed_remark) // @BindView(R2.id.layout_ed_remark)
LinearLayout layoutEdRemark; // LinearLayout layoutEdRemark;
private OrderDetailsFoodAdapter orderDetailsFoodAdapter; private OrderDetailsFoodAdapter orderDetailsFoodAdapter;
...@@ -167,8 +170,7 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr ...@@ -167,8 +170,7 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
public void initData(@Nullable Bundle savedInstanceState) { public void initData(@Nullable Bundle savedInstanceState) {
initTopBar(supplyTopBar, "入庫單"); initTopBar(supplyTopBar, "入庫單");
supplyTopBar.addRightImageButton(R.drawable.ic_white_more, R.id.id_more).setOnClickListener(this); supplyTopBar.addRightImageButton(R.drawable.ic_white_more, R.id.id_more).setOnClickListener(this);
supplyTopBar.addRightImageButton(R.drawable.ic_take_pictures, R.id.id_take_pictures).setOnClickListener(this); edRemark.setFilters(new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, RemarkProvider.REMARK_TEXT_LENGTH), InputFilterUtils.getChAndEnNumPtWrapInputFilter(mContext)});
edRemark.setFilters(new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, RemarkProvider.REMARK_TEXT_LENGTH), InputFilterUtils.getChAndEnAndNumAndPtInputFilter(mContext)});
Bundle arguments = getArguments(); Bundle arguments = getArguments();
if (arguments != null) { if (arguments != null) {
int orderId = arguments.getInt(ORDER_DETAILS_ORDER_ID, 0); int orderId = arguments.getInt(ORDER_DETAILS_ORDER_ID, 0);
...@@ -199,7 +201,7 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr ...@@ -199,7 +201,7 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
//更多:刪除。發送。再次購買 //更多:刪除。發送。再次購買
String[] functions; String[] functions;
if (orderState == PurchaseOrderDetailsBean.COMPLETE_RECEIVED) { if (orderState == PurchaseOrderDetailsBean.COMPLETE_RECEIVED) {
functions = new String[]{"再來一單", "删除"}; functions = new String[]{"再來一單"};
} else { } else {
functions = new String[]{"再來一單", "删除", "部分收貨", "收貨"}; functions = new String[]{"再來一單", "删除", "部分收貨", "收貨"};
} }
...@@ -219,7 +221,7 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr ...@@ -219,7 +221,7 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
addWarehouse(PurchaseOrderDetailsBean.COMPLETE_RECEIVED); addWarehouse(PurchaseOrderDetailsBean.COMPLETE_RECEIVED);
} else if (viewId == R.id.layout_remarks) { } else if (viewId == R.id.layout_remarks) {
//備註,顯示備註輸入框 //備註,顯示備註輸入框
layoutEdRemark.setVisibility(layoutEdRemark.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE); layoutInputRemark.setVisibility(layoutInputRemark.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE);
} }
} }
...@@ -264,9 +266,14 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr ...@@ -264,9 +266,14 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
public void loadOrderDetails(PurchaseOrderDetailsBean orderDetailsBean) { public void loadOrderDetails(PurchaseOrderDetailsBean orderDetailsBean) {
//判斷有沒有SN食材,如果沒有,就顯示全選按妞 //判斷有沒有SN食材,如果沒有,就顯示全選按妞
if (orderDetailsBean.getStatus() == PurchaseOrderDetailsBean.COMPLETE_RECEIVED) { if (orderDetailsBean.getStatus() == PurchaseOrderDetailsBean.COMPLETE_RECEIVED) {
//全部收貨,顯示備註,備註不可編輯
edRemark.setEnabled(false);
edRemark.setFocusable(false);
edRemark.setBackground(null);
cbOrderDetailsAllSelected.setVisibility(View.VISIBLE); cbOrderDetailsAllSelected.setVisibility(View.VISIBLE);
} else { } else {
cbOrderDetailsAllSelected.setVisibility(mPresenter.hasSnFood(orderDetailsBean.getPurchaseOrderDetailsInfoVOS()) ? View.GONE : View.VISIBLE); cbOrderDetailsAllSelected.setVisibility(mPresenter.hasSnFood(orderDetailsBean.getPurchaseOrderDetailsInfoVOS()) ? View.GONE : View.VISIBLE);
supplyTopBar.addRightImageButton(R.drawable.ic_take_pictures, R.id.id_take_pictures).setOnClickListener(this);
} }
if (TextUtil.isNotEmptyOrNullOrUndefined(orderDetailsBean.getWarehousingRemarks())) { if (TextUtil.isNotEmptyOrNullOrUndefined(orderDetailsBean.getWarehousingRemarks())) {
edRemark.setText(orderDetailsBean.getWarehousingRemarks()); edRemark.setText(orderDetailsBean.getWarehousingRemarks());
...@@ -377,7 +384,7 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr ...@@ -377,7 +384,7 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
@Override @Override
public void uploadPicSuccess(String imgUrl) { public void uploadPicSuccess(String imgUrl) {
if (imageAdapter == null) { if (imageAdapter == null) {
imageAdapter = new ImageAdapter(mPresenter.orderState == PurchaseOrderDetailsBean.ALL); imageAdapter = new ImageAdapter(mPresenter.orderState == PurchaseOrderDetailsBean.COMPLETE_RECEIVED);
rvOrderDetailsPictures.setAdapter(imageAdapter); rvOrderDetailsPictures.setAdapter(imageAdapter);
rvOrderDetailsPictures.setLayoutManager(new GridLayoutManager(requireContext(), 4)); rvOrderDetailsPictures.setLayoutManager(new GridLayoutManager(requireContext(), 4));
imageAdapter.setOnItemChildClickListener((adapter, view, position) -> { imageAdapter.setOnItemChildClickListener((adapter, view, position) -> {
......
...@@ -12,8 +12,12 @@ import androidx.annotation.Nullable; ...@@ -12,8 +12,12 @@ import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.viewpager2.widget.ViewPager2; import androidx.viewpager2.widget.ViewPager2;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.gingersoft.gsa.cloud.common.loadsir.EmptyCallback; import com.gingersoft.gsa.cloud.common.loadsir.EmptyCallback;
import com.gingersoft.gsa.cloud.common.loadsir.ErrorCallback; import com.gingersoft.gsa.cloud.common.loadsir.ErrorCallback;
import com.gingersoft.gsa.cloud.ui.animator.CustomAnimation1;
import com.gingersoft.gsa.cloud.ui.animator.CustomAnimation3;
import com.gingersoft.gsa.cloud.ui.animator.CustomAnimation4;
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;
...@@ -27,7 +31,7 @@ import com.gingersoft.supply_chain.mvp.presenter.PurchaseListPresenter; ...@@ -27,7 +31,7 @@ import com.gingersoft.supply_chain.mvp.presenter.PurchaseListPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.PurchaseOrderAdapter; import com.gingersoft.supply_chain.mvp.ui.adapter.PurchaseOrderAdapter;
import com.gingersoft.supply_chain.mvp.ui.adapter.PurchasePageAdapter; import com.gingersoft.supply_chain.mvp.ui.adapter.PurchasePageAdapter;
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.fragment.food.BuyIngredientsFragment;
import com.gingersoft.supply_chain.mvp.ui.widget.PurchaseListMorePopup; import com.gingersoft.supply_chain.mvp.ui.widget.PurchaseListMorePopup;
import com.gingersoft.supply_chain.mvp.ui.widget.ScreenView; import com.gingersoft.supply_chain.mvp.ui.widget.ScreenView;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
...@@ -51,7 +55,7 @@ import java.util.List; ...@@ -51,7 +55,7 @@ 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.FoodIngredientsFragment.ADD_ORDER; import static com.gingersoft.supply_chain.mvp.ui.fragment.food.BuyIngredientsFragment.ADD_ORDER;
/** /**
...@@ -129,6 +133,9 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr ...@@ -129,6 +133,9 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
} }
private void getOrderList() { private void getOrderList() {
if (pageIndex == 0 && purchaseOrderAdapter != null) {
purchaseOrderAdapter.setNewInstance(null);
}
mPresenter.getOrderList("", orderState[orderStateIndex], pageIndex); mPresenter.getOrderList("", orderState[orderStateIndex], pageIndex);
} }
...@@ -157,7 +164,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr ...@@ -157,7 +164,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
start(ShoppingCatFragment.newInstance()); start(ShoppingCatFragment.newInstance());
} else { } else {
//跳轉到下單頁面 //跳轉到下單頁面
startForResult(FoodIngredientsFragment.newInstance(ADD_ORDER), REQUEST_ORDER_DETAILS_CODE); startForResult(BuyIngredientsFragment.newInstance(ADD_ORDER), REQUEST_ORDER_DETAILS_CODE);
} }
}); });
} }
...@@ -172,6 +179,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr ...@@ -172,6 +179,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
purchaseOrderAdapter.setOnItemClickListener((adapter, view, position) -> purchaseOrderAdapter.setOnItemClickListener((adapter, view, position) ->
startForResult(OrderDetailsFragment.newInstance(purchaseOrderAdapter.getData().get(position).getId(), orderState[orderStateIndex]), REQUEST_ORDER_DETAILS_CODE) startForResult(OrderDetailsFragment.newInstance(purchaseOrderAdapter.getData().get(position).getId(), orderState[orderStateIndex]), REQUEST_ORDER_DETAILS_CODE)
); );
purchaseOrderAdapter.setAnimationWithDefault(BaseQuickAdapter.AnimationType.AlphaIn);
purchaseOrderAdapter.setOnItemChildClickListener((adapter, view, position) -> { purchaseOrderAdapter.setOnItemChildClickListener((adapter, view, position) -> {
int viewId = view.getId(); int viewId = view.getId();
if (viewId == R.id.iv_purchase_order_more) { if (viewId == R.id.iv_purchase_order_more) {
...@@ -214,6 +222,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr ...@@ -214,6 +222,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
@Override @Override
public void onTabSelected(int index) { public void onTabSelected(int index) {
orderStateIndex = index; orderStateIndex = index;
pageIndex = 0;
getOrderList(); getOrderList();
} }
...@@ -253,10 +262,11 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr ...@@ -253,10 +262,11 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
//篩選 //篩選
screenView.setVisibility(screenView.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE); screenView.setVisibility(screenView.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE);
} else if (viewId == R.id.iv_purchase_list_search) { } else if (viewId == R.id.iv_purchase_list_search) {
pageIndex = 0;
getOrderList(); getOrderList();
} else if (viewId == R.id.btn_save) { } else if (viewId == R.id.btn_save) {
//跳轉到下單頁面 //跳轉到下單頁面
startForResult(FoodIngredientsFragment.newInstance(ADD_ORDER), REQUEST_ORDER_DETAILS_CODE); startForResult(BuyIngredientsFragment.newInstance(ADD_ORDER), REQUEST_ORDER_DETAILS_CODE);
} }
} }
...@@ -269,8 +279,8 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr ...@@ -269,8 +279,8 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
loadService.showCallback(EmptyCallback.class); loadService.showCallback(EmptyCallback.class);
} else { } else {
loadService.showCallback(SuccessCallback.class); loadService.showCallback(SuccessCallback.class);
purchaseOrderAdapter.addData(list);
} }
purchaseOrderAdapter.setList(list);
} }
private void closeLoading() { private void closeLoading() {
...@@ -303,6 +313,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr ...@@ -303,6 +313,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
super.onFragmentResult(requestCode, resultCode, data); super.onFragmentResult(requestCode, resultCode, data);
if (requestCode == REQUEST_ORDER_DETAILS_CODE) { if (requestCode == REQUEST_ORDER_DETAILS_CODE) {
//用戶對訂單進行了操作,需要對列表進行刷新 //用戶對訂單進行了操作,需要對列表進行刷新
pageIndex = 0;
getOrderList(); getOrderList();
} }
} }
......
...@@ -12,11 +12,9 @@ import android.widget.TextView; ...@@ -12,11 +12,9 @@ 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.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil; import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.common.utils.log.LogUtil;
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;
...@@ -36,7 +34,6 @@ import java.util.List; ...@@ -36,7 +34,6 @@ import java.util.List;
import butterknife.BindView; import butterknife.BindView;
import butterknife.OnClick; import butterknife.OnClick;
import me.yokeyword.fragmentation.ISupportFragment;
import static com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodIngredientsFragment.ADD_ORDER; import static com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodIngredientsFragment.ADD_ORDER;
...@@ -78,7 +75,6 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres ...@@ -78,7 +75,6 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres
private Drawable canClick; private Drawable canClick;
private Drawable notCanClick; private Drawable notCanClick;
public static ShoppingCatFragment newInstance() { public static ShoppingCatFragment newInstance() {
return new ShoppingCatFragment(); return new ShoppingCatFragment();
} }
...@@ -122,8 +118,9 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres ...@@ -122,8 +118,9 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres
if (viewId == R.id.tv_order_content_complete) { if (viewId == R.id.tv_order_content_complete) {
//完成,篩選出選擇的食品 //完成,篩選出選擇的食品
if (mPresenter.filterData(shoppingCartAdapter.getData())) { if (mPresenter.filterData(shoppingCartAdapter.getData())) {
AppDialog.getInstance().showWaringDialog(requireContext(), "確認創建訂單?", (view, dialog) -> { AppDialog.getInstance().showTipDialog(requireContext(), "確認創建訂單?", (view, dialog) -> {
mPresenter.createOrder(shoppingCartAdapter.getData()); mPresenter.createOrder(shoppingCartAdapter.getData());
dialog.dismiss();
}); });
} }
} else if (viewId == R.id.btn_order_content_order_template) { } else if (viewId == R.id.btn_order_content_order_template) {
...@@ -157,6 +154,7 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres ...@@ -157,6 +154,7 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres
} }
setAllSelect(shoppingCartAdapterData); setAllSelect(shoppingCartAdapterData);
mPresenter.verificationMixAmount(shoppingCartAdapter.getData()); mPresenter.verificationMixAmount(shoppingCartAdapter.getData());
setFragmentResult(RESULT_OK, null);
}); });
rvOrderContent.setAdapter(shoppingCartAdapter); rvOrderContent.setAdapter(shoppingCartAdapter);
setAllSelect(shoppingCartBeans); setAllSelect(shoppingCartBeans);
...@@ -168,6 +166,7 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres ...@@ -168,6 +166,7 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres
//這裡應該可以再加一個回調接口,用來專門處理食材的選中狀態切換 //這裡應該可以再加一個回調接口,用來專門處理食材的選中狀態切換
setAllSelect(shoppingCartAdapter.getData()); setAllSelect(shoppingCartAdapter.getData());
mPresenter.verificationMixAmount(shoppingCartAdapter.getData()); mPresenter.verificationMixAmount(shoppingCartAdapter.getData());
setFragmentResult(RESULT_OK, null);
}); });
} }
......
...@@ -15,6 +15,7 @@ import androidx.annotation.NonNull; ...@@ -15,6 +15,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.gingersoft.gsa.cloud.common.loadsir.EmptyCallback; import com.gingersoft.gsa.cloud.common.loadsir.EmptyCallback;
import com.gingersoft.gsa.cloud.common.loadsir.ErrorCallback; import com.gingersoft.gsa.cloud.common.loadsir.ErrorCallback;
import com.gingersoft.gsa.cloud.common.utils.inputFilter.InputFilterUtils; import com.gingersoft.gsa.cloud.common.utils.inputFilter.InputFilterUtils;
...@@ -116,7 +117,7 @@ public class SupplierListFragment extends BaseSupplyChainFragment<SupplierListPr ...@@ -116,7 +117,7 @@ public class SupplierListFragment extends BaseSupplyChainFragment<SupplierListPr
} }
btnConfirm.setVisibility(isSelect ? View.VISIBLE : View.GONE); btnConfirm.setVisibility(isSelect ? View.VISIBLE : View.GONE);
btnCancel.setVisibility(isSelect ? View.VISIBLE : View.GONE); btnCancel.setVisibility(isSelect ? View.VISIBLE : View.GONE);
btnNewSupplier.setVisibility(isSelect ? View.GONE : View.VISIBLE); // btnNewSupplier.setVisibility(isSelect ? View.GONE : View.VISIBLE);
loadService = LoadSir.getDefault().register(smartRefreshLayout, (Callback.OnReloadListener) v -> { loadService = LoadSir.getDefault().register(smartRefreshLayout, (Callback.OnReloadListener) v -> {
// 重新加载逻辑 // 重新加载逻辑
...@@ -158,9 +159,10 @@ public class SupplierListFragment extends BaseSupplyChainFragment<SupplierListPr ...@@ -158,9 +159,10 @@ public class SupplierListFragment extends BaseSupplyChainFragment<SupplierListPr
private void initTopBar() { private void initTopBar() {
initTopBar(mTopBarSupplierList, "供應商"); initTopBar(mTopBarSupplierList, "供應商");
if (mTopBarSupplierList.getLeftViewList().size() <= 0) { // if (mTopBarSupplierList.getLeftViewList().size() <= 0) {
mTopBarSupplierList.addRightImageButton(R.drawable.ic_screen, R.id.topbar_right_screen_button).setOnClickListener(this); // mTopBarSupplierList.addRightImageButton(R.drawable.ic_screen, R.id.topbar_right_screen_button).setOnClickListener(this);
} // }
mTopBarSupplierList.addRightImageButton(R.drawable.ic_circle_new_food_ingredient, R.id.topbar_right_add_button).setOnClickListener(this);
} }
@OnClick({R2.id.btn_new_supplier, R2.id.btn_supplier_search, R2.id.btn_supplier_confirm, R2.id.btn_supplier_cancel}) @OnClick({R2.id.btn_new_supplier, R2.id.btn_supplier_search, R2.id.btn_supplier_confirm, R2.id.btn_supplier_cancel})
...@@ -170,10 +172,15 @@ public class SupplierListFragment extends BaseSupplyChainFragment<SupplierListPr ...@@ -170,10 +172,15 @@ public class SupplierListFragment extends BaseSupplyChainFragment<SupplierListPr
if (viewId == R.id.topbar_right_screen_button) { if (viewId == R.id.topbar_right_screen_button) {
//篩選 //篩選
} else if (viewId == R.id.btn_new_supplier) { } else if (viewId == R.id.topbar_right_add_button) {
//新增供應商 //新增供應商
startForResult(NewSupplierFragment.newInstance(null), SUPPLIER_LIST); startForResult(NewSupplierFragment.newInstance(null), SUPPLIER_LIST);
} else if (viewId == R.id.btn_supplier_search) { }
// else if (viewId == R.id.btn_new_supplier) {
// //新增供應商
// startForResult(NewSupplierFragment.newInstance(null), SUPPLIER_LIST);
// }
else if (viewId == R.id.btn_supplier_search) {
//搜索供應商 //搜索供應商
pageIndex = 0; pageIndex = 0;
getSupplierList(); getSupplierList();
...@@ -222,7 +229,7 @@ public class SupplierListFragment extends BaseSupplyChainFragment<SupplierListPr ...@@ -222,7 +229,7 @@ public class SupplierListFragment extends BaseSupplyChainFragment<SupplierListPr
if (supplierAdapter == null) { if (supplierAdapter == null) {
supplierAdapter = new SupplierAdapter(supplierBeanList, isSelect); supplierAdapter = new SupplierAdapter(supplierBeanList, isSelect);
rvSupplierList.setAdapter(supplierAdapter); rvSupplierList.setAdapter(supplierAdapter);
supplierAdapter.setAnimationWithDefault(BaseQuickAdapter.AnimationType.AlphaIn);
supplierAdapter.setOnItemClickListener((adapter, view, position) -> { supplierAdapter.setOnItemClickListener((adapter, view, position) -> {
List<SupplierInfoBean> data = supplierAdapter.getData(); List<SupplierInfoBean> data = supplierAdapter.getData();
startForResult(NewSupplierFragment.newInstance(data.get(position)), SUPPLIER_LIST); startForResult(NewSupplierFragment.newInstance(data.get(position)), SUPPLIER_LIST);
...@@ -233,7 +240,7 @@ public class SupplierListFragment extends BaseSupplyChainFragment<SupplierListPr ...@@ -233,7 +240,7 @@ public class SupplierListFragment extends BaseSupplyChainFragment<SupplierListPr
List<SupplierInfoBean> data = supplierAdapter.getData(); List<SupplierInfoBean> data = supplierAdapter.getData();
mPresenter.deleteSupplier(data.get(position).getId(), position); mPresenter.deleteSupplier(data.get(position).getId(), position);
}); });
} else if (view.getId() == R.id.layout_supplier_food_info) { } else if (view.getId() == R.id.layout_see_ingredients) {
//跳轉到供應商食品詳情 //跳轉到供應商食品詳情
List<SupplierInfoBean> data = supplierAdapter.getData(); List<SupplierInfoBean> data = supplierAdapter.getData();
start(FoodIngredientsFragment.newInstance(data.get(position).getId(), data.get(position).getSupplierName())); start(FoodIngredientsFragment.newInstance(data.get(position).getId(), data.get(position).getSupplierName()));
......
...@@ -14,6 +14,7 @@ import com.gingersoft.supply_chain.R; ...@@ -14,6 +14,7 @@ import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2; import com.gingersoft.supply_chain.R2;
import com.gingersoft.supply_chain.di.component.DaggerSnCodeListComponent; import com.gingersoft.supply_chain.di.component.DaggerSnCodeListComponent;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodEncodeSn; import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodEncodeSn;
import com.gingersoft.supply_chain.mvp.bean.WarehouseDetailsBean;
import com.gingersoft.supply_chain.mvp.contract.SnCodeListContract; import com.gingersoft.supply_chain.mvp.contract.SnCodeListContract;
import com.gingersoft.supply_chain.mvp.presenter.SnCodeListPresenter; import com.gingersoft.supply_chain.mvp.presenter.SnCodeListPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.SnCodesAdapter; import com.gingersoft.supply_chain.mvp.ui.adapter.SnCodesAdapter;
...@@ -30,23 +31,12 @@ import butterknife.BindView; ...@@ -30,23 +31,12 @@ import butterknife.BindView;
/** /**
* ================================================ * Description: 顯示SN碼列表
* Description:
* <p>
* Created by MVPArmsTemplate on 03/26/2021 19:26
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/ */
public class SnCodeListFragment extends BaseSupplyChainFragment<SnCodeListPresenter> implements SnCodeListContract.View { public class SnCodeListFragment extends BaseSupplyChainFragment<SnCodeListPresenter> implements SnCodeListContract.View {
final static String FOOD_NAME_KEY = "FoodNameKey"; final static String WAREHOUSE_DETAILS_KEY = "warehouseDetailsKey";
final static String REMARK_KEY = "RemarkKey"; final static String INFO_TYPE_KEY = "infoTypeKey";
final static String SN_KEY = "snKey";
final static String HOUSING_NUM_KEY = "housingNumKey";
@BindView(R2.id.supply_top_bar) @BindView(R2.id.supply_top_bar)
QMUITopBar supplyTopBar; QMUITopBar supplyTopBar;
@BindView(R2.id.tv_remark) @BindView(R2.id.tv_remark)
...@@ -56,13 +46,15 @@ public class SnCodeListFragment extends BaseSupplyChainFragment<SnCodeListPresen ...@@ -56,13 +46,15 @@ public class SnCodeListFragment extends BaseSupplyChainFragment<SnCodeListPresen
@BindView(R2.id.tv_sn_housing_num) @BindView(R2.id.tv_sn_housing_num)
TextView tvHousingNum; TextView tvHousingNum;
public static SnCodeListFragment newInstance(String foodName, String remarks, int housingNum, List<PurchaseFoodEncodeSn> sns) { /**
* @param infoType 數據類型 0入庫流水SN碼,1出庫流水SN碼
* @param warehouseDetailsBean 出入庫類
*/
public static SnCodeListFragment newInstance(int infoType, WarehouseDetailsBean warehouseDetailsBean) {
SnCodeListFragment fragment = new SnCodeListFragment(); SnCodeListFragment fragment = new SnCodeListFragment();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putString(FOOD_NAME_KEY, foodName); bundle.putSerializable(WAREHOUSE_DETAILS_KEY, warehouseDetailsBean);
bundle.putSerializable(SN_KEY, (Serializable) sns); bundle.putInt(INFO_TYPE_KEY, infoType);
bundle.putString(REMARK_KEY, remarks);
bundle.putInt(HOUSING_NUM_KEY, housingNum);
fragment.setArguments(bundle); fragment.setArguments(bundle);
return fragment; return fragment;
} }
...@@ -86,20 +78,36 @@ public class SnCodeListFragment extends BaseSupplyChainFragment<SnCodeListPresen ...@@ -86,20 +78,36 @@ public class SnCodeListFragment extends BaseSupplyChainFragment<SnCodeListPresen
public void initData(@Nullable Bundle savedInstanceState) { public void initData(@Nullable Bundle savedInstanceState) {
Bundle arguments = getArguments(); Bundle arguments = getArguments();
if (arguments != null) { if (arguments != null) {
initTopBar(supplyTopBar, arguments.getString(FOOD_NAME_KEY)); WarehouseDetailsBean warehouseDetailsBean = (WarehouseDetailsBean) arguments.getSerializable(WAREHOUSE_DETAILS_KEY);
int housingNum = arguments.getInt(HOUSING_NUM_KEY, 0); initTopBar(supplyTopBar, warehouseDetailsBean.getName());
if (housingNum > 0) { int infoType = arguments.getInt(INFO_TYPE_KEY, 0);
tvHousingNum.setText("+" + housingNum); tvRemark.setText(String.format(getString(R.string.str_format_remark), ""));
if (infoType == WarehouseDetailsBean.TYPE_WAREHOUSING_TYPE) {
//查入庫
mPresenter.querySnCodeList(infoType, warehouseDetailsBean.getWarehousingOrderDetailsIds());
tvHousingNum.setText(String.valueOf(warehouseDetailsBean.getFoodQuantity()));
} else if (infoType == WarehouseDetailsBean.TYPE_DELIVERY_HOUSE_TYPE) {
//查出庫
mPresenter.querySnCodeList(infoType, warehouseDetailsBean.getPurchaseConsumeNoId());
if (warehouseDetailsBean.getFoodQuantity() < 0) {
tvHousingNum.setText(String.format(getString(R.string.str_format_positive), Math.abs(warehouseDetailsBean.getFoodQuantity()) + ""));
} else {
tvHousingNum.setText(String.format(getString(R.string.str_format_less), warehouseDetailsBean.getFoodQuantity() + ""));
}
} else { } else {
tvHousingNum.setText(String.valueOf(housingNum)); //查剩餘
mPresenter.queryInStockSnCodes(warehouseDetailsBean.getWarehousingOrderDetailsIds());
tvHousingNum.setText(String.valueOf(warehouseDetailsBean.getFoodQuantity()));
} }
tvRemark.setText(String.format(getString(R.string.str_format_remark), arguments.getString(REMARK_KEY)));
List<PurchaseFoodEncodeSn> sns = (List<PurchaseFoodEncodeSn>) arguments.getSerializable(SN_KEY);
SnCodesAdapter adapter = new SnCodesAdapter(sns);
rvSn.setAdapter(adapter);
} else { } else {
showMessage("獲取數據失敗"); showMessage("獲取數據失敗");
killMyself(); killMyself();
} }
} }
@Override
public void initAdapter(List<PurchaseFoodEncodeSn> purchaseFoodEncodeSns) {
SnCodesAdapter adapter = new SnCodesAdapter(purchaseFoodEncodeSns);
rvSn.setAdapter(adapter);
}
} }
...@@ -58,6 +58,7 @@ import butterknife.OnClick; ...@@ -58,6 +58,7 @@ import butterknife.OnClick;
/** /**
* Description: 入庫詳情 * Description: 入庫詳情
*
* @author admin * @author admin
*/ */
public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseDetailsPresenter> implements WarehouseDetailsContract.View, View.OnClickListener { public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseDetailsPresenter> implements WarehouseDetailsContract.View, View.OnClickListener {
...@@ -243,18 +244,19 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD ...@@ -243,18 +244,19 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
adapter = new PurchasePageAdapter(wareHousingDetailsAdapter, 2); adapter = new PurchasePageAdapter(wareHousingDetailsAdapter, 2);
vpWarehouseViewpager.setAdapter(adapter); vpWarehouseViewpager.setAdapter(adapter);
} }
wareHousingDetailsAdapter.setOnItemChildClickListener((adapter, view, position) -> { wareHousingDetailsAdapter.setOnItemClickListener((adapter, view, position) -> {
if (purchaseWarehousingOrderDetailsVO.getFoodMarkSn() == PurchaseFoodBean.HAS_SN) { if (purchaseWarehousingOrderDetailsVO.getFoodMarkSn() == PurchaseFoodBean.HAS_SN) {
//SN食材 //SN食材
if (view.getId() == R.id.tv_warehouse_details_food_num) { // if (view.getId() == R.id.tv_warehouse_details_food_num) {
WarehouseDetailsBean item = wareHousingDetailsAdapter.getItem(position); //查詢消耗,收貨Sn碼詳情
//查詢消耗,收貨Sn碼詳情
if (vpWarehouseViewpager.getCurrentItem() == WAREHOUSE_TYPE) { start(SnCodeListFragment.newInstance(vpWarehouseViewpager.getCurrentItem(), wareHousingDetailsAdapter.getItem(position)));
mPresenter.querySnCodeList(vpWarehouseViewpager.getCurrentItem(), item.getFoodQuantity(), "", item.getWarehousingOrderDetailsIds()); // if (vpWarehouseViewpager.getCurrentItem() == WAREHOUSE_TYPE) {
} else { // mPresenter.querySnCodeList(vpWarehouseViewpager.getCurrentItem(), item.getFoodQuantity(), "", item.getWarehousingOrderDetailsIds());
mPresenter.querySnCodeList(vpWarehouseViewpager.getCurrentItem(), item.getFoodQuantity(), "", item.getPurchaseConsumeNoId()); // } else {
} // mPresenter.querySnCodeList(vpWarehouseViewpager.getCurrentItem(), item.getFoodQuantity(), "", item.getPurchaseConsumeNoId());
} // }
// }
} }
}); });
} else { } else {
...@@ -297,7 +299,7 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD ...@@ -297,7 +299,7 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
return; return;
} }
//初始化掃碼view //初始化掃碼view
scanSnView = new ScanSnView(this, null, (popup, scanResult) -> { scanSnView = new ScanSnView(this).setOnScanResultListener((popup, scanResult) -> {
if (scanResult.isEmpty()) { if (scanResult.isEmpty()) {
showMessage("請掃碼SN碼"); showMessage("請掃碼SN碼");
return; return;
...@@ -354,8 +356,8 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD ...@@ -354,8 +356,8 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
* 消耗方法 * 消耗方法
* *
* @param consumeReasonBeans 消耗原因 * @param consumeReasonBeans 消耗原因
* @param snCodes snCode集合 * @param snCodes snCode集合
* @param whetherPrint 是否打印 * @param whetherPrint 是否打印
*/ */
private void inventory(List<ConsumeReasonBean> consumeReasonBeans, List<String> snCodes, boolean whetherPrint) { private void inventory(List<ConsumeReasonBean> consumeReasonBeans, List<String> snCodes, boolean whetherPrint) {
//獲取用戶輸入的消耗數量 //獲取用戶輸入的消耗數量
...@@ -373,11 +375,6 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD ...@@ -373,11 +375,6 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
onPrintPdf(snCodes, consumeReasonDesc, inventoryConsumptionView.getRemark(), consumptionNum); onPrintPdf(snCodes, consumeReasonDesc, inventoryConsumptionView.getRemark(), consumptionNum);
} }
@Override
public void jumpSnList(int foodQuantity, String remark, List<PurchaseFoodEncodeSn> sns) {
start(SnCodeListFragment.newInstance(purchaseWarehousingOrderDetailsVO.getName(), remark, foodQuantity, sns));
}
private void onPrintPdf(List<String> snCodes, String consumptionReason, String remarks, int foodNum) { private void onPrintPdf(List<String> snCodes, String consumptionReason, String remarks, int foodNum) {
PrintHelper printHelper = new PrintHelper(requireContext()); PrintHelper printHelper = new PrintHelper(requireContext());
boolean b = PrintHelper.systemSupportsPrint(); boolean b = PrintHelper.systemSupportsPrint();
...@@ -465,6 +462,7 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD ...@@ -465,6 +462,7 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
@Override @Override
public void setWarehousingNum(int num) { public void setWarehousingNum(int num) {
purchaseWarehousingOrderDetailsVO.setFoodNum(num);
tvWarehouseInventoryNumber.setText(String.valueOf(num)); tvWarehouseInventoryNumber.setText(String.valueOf(num));
} }
...@@ -484,7 +482,7 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD ...@@ -484,7 +482,7 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
} else if (v.getId() == R.id.tv_warehouse_inventory_number) { } else if (v.getId() == R.id.tv_warehouse_inventory_number) {
if (purchaseWarehousingOrderDetailsVO.getFoodMarkSn() == PurchaseFoodBean.HAS_SN) { if (purchaseWarehousingOrderDetailsVO.getFoodMarkSn() == PurchaseFoodBean.HAS_SN) {
//是sn食材,查詢庫中剩餘的sn碼 //是sn食材,查詢庫中剩餘的sn碼
mPresenter.queryInStockSnCodes(purchaseWarehousingOrderDetailsVO.getFoodNum(), "", purchaseWarehousingOrderDetailsVO.getFoodNo()); start(SnCodeListFragment.newInstance(-1, new WarehouseDetailsBean(purchaseWarehousingOrderDetailsVO.getName(), purchaseWarehousingOrderDetailsVO.getFoodNum(), purchaseWarehousingOrderDetailsVO.getFoodNo())));
} }
} }
} }
......
package com.gingersoft.supply_chain.mvp.ui.widget;
/**
* @author 宇航.
* User: admin
* Date: 2021/4/15
* Time: 10:07
* Use:
*/
public class GoodsDetailsPopup {
}
...@@ -65,7 +65,7 @@ public class InventoryConsumptionView extends FrameLayout { ...@@ -65,7 +65,7 @@ public class InventoryConsumptionView extends FrameLayout {
ButterKnife.bind(this, rootView); ButterKnife.bind(this, rootView);
addView(rootView); addView(rootView);
this.maxConsumption = maxConsumption; this.maxConsumption = maxConsumption;
edRemarks.setFilters(new InputFilter[]{InputFilterUtils.getLengthFilter(getContext(), RemarkProvider.REMARK_TEXT_LENGTH), InputFilterUtils.getChAndEnAndNumAndPtInputFilter(getContext())}); edRemarks.setFilters(new InputFilter[]{InputFilterUtils.getLengthFilter(getContext(), RemarkProvider.REMARK_TEXT_LENGTH), InputFilterUtils.getChAndEnNumPtWrapInputFilter(getContext())});
consumptionReasonAdapter = new ConsumptionReasonAdapter(consumeReasonBeans); consumptionReasonAdapter = new ConsumptionReasonAdapter(consumeReasonBeans);
consumptionReasonAdapter.setOnItemChildClickListener((adapter, view, position) -> consumptionReasonAdapter.setSelectIndex(position)); consumptionReasonAdapter.setOnItemChildClickListener((adapter, view, position) -> consumptionReasonAdapter.setSelectIndex(position));
rvConsumptionReason.setLayoutManager(new GridLayoutManager(getContext(), 3)); rvConsumptionReason.setLayoutManager(new GridLayoutManager(getContext(), 3));
...@@ -80,7 +80,7 @@ public class InventoryConsumptionView extends FrameLayout { ...@@ -80,7 +80,7 @@ public class InventoryConsumptionView extends FrameLayout {
if (i > maxConsumption) { if (i > maxConsumption) {
edInput.setError("不能超過當前庫存數量:" + maxConsumption); edInput.setError("不能超過當前庫存數量:" + maxConsumption);
} else { } else {
onConfirmClickListener.onConfirm(i, consumptionReasonAdapter.getSelectIndex(), edRemarks.getText().toString()); onConfirmClickListener.onConfirm(i, consumptionReasonAdapter.getSelectIndex(), edRemarks.getText().toString().trim());
} }
} else { } else {
ToastUtils.show(getContext(), "請輸入消耗庫存數"); ToastUtils.show(getContext(), "請輸入消耗庫存數");
......
package com.gingersoft.supply_chain.mvp.ui.widget;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import com.scwang.smartrefresh.layout.api.RefreshHeader;
import com.scwang.smartrefresh.layout.header.ClassicsHeader;
/**
* @author 宇航.
* User: admin
* Date: 2021/4/6
* Time: 10:08
* Use:
*/
public class LoadRefreshHeader extends ClassicsHeader implements RefreshHeader {
public LoadRefreshHeader(Context context) {
super(context);
}
public LoadRefreshHeader(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public ClassicsHeader setArrowDrawable(Drawable drawable) {
return super.setArrowDrawable(drawable);
}
public ClassicsHeader setTitle(String text) {
mTitleText.setText(text);
return this;
}
}
...@@ -8,6 +8,7 @@ import android.widget.EditText; ...@@ -8,6 +8,7 @@ import android.widget.EditText;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.gingersoft.gsa.cloud.common.utils.inputFilter.InputFilterUtils; import com.gingersoft.gsa.cloud.common.utils.inputFilter.InputFilterUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
import com.lxj.xpopup.impl.ConfirmPopupView; import com.lxj.xpopup.impl.ConfirmPopupView;
import com.qmuiteam.qmui.alpha.QMUIAlphaTextView; import com.qmuiteam.qmui.alpha.QMUIAlphaTextView;
...@@ -41,14 +42,14 @@ public class NewAddCategoryPopup extends ConfirmPopupView { ...@@ -41,14 +42,14 @@ public class NewAddCategoryPopup extends ConfirmPopupView {
tvDelete.setVisibility(showDelete ? View.VISIBLE : GONE); tvDelete.setVisibility(showDelete ? View.VISIBLE : GONE);
tvDelete.setOnClickListener(onDeleteListener); tvDelete.setOnClickListener(onDeleteListener);
et_input = findViewById(R.id.et_input); et_input = findViewById(R.id.et_input);
// if (TextUtil.isNotEmptyOrNullOrUndefined(inputText)) { if (TextUtil.isNotEmptyOrNullOrUndefined(inputText)) {
// if (inputText.length() > nameMaxLength) { // if (inputText.length() > nameMaxLength) {
// et_input.setText(inputText.substring(0, 4)); // et_input.setText(inputText.substring(0, 4));
// } else { // } else {
// et_input.setText(inputText); et_input.setText(inputText);
// } // }
// et_input.setSelection(et_input.length()); et_input.setSelection(et_input.length());
// } }
et_input.setFilters(new InputFilter[]{InputFilterUtils.getLengthFilter(getContext(), 100), InputFilterUtils.getChAndEnAndNumAndPtInputFilter(getContext())}); et_input.setFilters(new InputFilter[]{InputFilterUtils.getLengthFilter(getContext(), 100), InputFilterUtils.getChAndEnAndNumAndPtInputFilter(getContext())});
} }
......
...@@ -81,7 +81,8 @@ public class ScanSnPopup extends BottomPopupView { ...@@ -81,7 +81,8 @@ public class ScanSnPopup extends BottomPopupView {
tvFoodIngredientsName.setText(foodName); tvFoodIngredientsName.setText(foodName);
tvFoodInboundQuantity.setText(String.valueOf(snCodes.size())); tvFoodInboundQuantity.setText(String.valueOf(snCodes.size()));
if (operable) { if (operable) {
rootLayout.addView(new ScanSnView(fragment, snCodes, (popup, scanResult) -> onScanResultListener.onScanResult(ScanSnPopup.this, scanResult)) rootLayout.addView(new ScanSnView(fragment, snCodes)
.setOnScanResultListener((popup, scanResult) -> onScanResultListener.onScanResult(ScanSnPopup.this, scanResult))
.setOnDeleteSnCodeListener(onDeleteListener) .setOnDeleteSnCodeListener(onDeleteListener)
.setOnCancelListener(this::dismiss) .setOnCancelListener(this::dismiss)
.setMinCodeSize(minCodeSize) .setMinCodeSize(minCodeSize)
......
package com.gingersoft.supply_chain.mvp.ui.widget; package com.gingersoft.supply_chain.mvp.ui.widget;
import android.content.Context; import android.content.Context;
import android.os.Build;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
...@@ -12,6 +13,7 @@ import com.gingersoft.supply_chain.mvp.ui.adapter.SecondCategoryAdapter; ...@@ -12,6 +13,7 @@ import com.gingersoft.supply_chain.mvp.ui.adapter.SecondCategoryAdapter;
import com.google.android.flexbox.FlexWrap; import com.google.android.flexbox.FlexWrap;
import com.google.android.flexbox.FlexboxLayoutManager; import com.google.android.flexbox.FlexboxLayoutManager;
import com.lxj.xpopup.core.AttachPopupView; import com.lxj.xpopup.core.AttachPopupView;
import com.lxj.xpopup.util.XPopupUtils;
import java.util.List; import java.util.List;
...@@ -29,19 +31,18 @@ public class ShowSecondCategoryPopup extends AttachPopupView { ...@@ -29,19 +31,18 @@ public class ShowSecondCategoryPopup extends AttachPopupView {
private final int width; private final int width;
private final List<OrderCategoryBean.FoodCategoryTrees> foodCategoryTreesList; private final List<OrderCategoryBean.FoodCategoryTrees> foodCategoryTreesList;
private final OnItemClickListener onItemClickListener;
private final int defaultSelect; private final int defaultSelect;
/** /**
* 當前是否是顯示三級分類 * 當前顯示的是几級分類
*/ */
private boolean showThirdCategory = false; private int categoryLevel = 2;
public ShowSecondCategoryPopup(@NonNull Context context, int width, int defaultSelect, List<OrderCategoryBean.FoodCategoryTrees> foodCategoryTreesList, OnItemClickListener onItemClickListener) { public ShowSecondCategoryPopup(@NonNull Context context, int width, int defaultSelect, List<OrderCategoryBean.FoodCategoryTrees> foodCategoryTreesList) {
super(context); super(context);
this.width = width; this.width = width;
this.defaultSelect = defaultSelect; this.defaultSelect = defaultSelect;
this.foodCategoryTreesList = foodCategoryTreesList; this.foodCategoryTreesList = foodCategoryTreesList;
this.onItemClickListener = onItemClickListener; bgDrawableMargin = 0;
} }
@Override @Override
...@@ -59,26 +60,37 @@ public class ShowSecondCategoryPopup extends AttachPopupView { ...@@ -59,26 +60,37 @@ public class ShowSecondCategoryPopup extends AttachPopupView {
SecondCategoryAdapter secondCategoryAdapter = new SecondCategoryAdapter(getContext(), foodCategoryTreesList); SecondCategoryAdapter secondCategoryAdapter = new SecondCategoryAdapter(getContext(), foodCategoryTreesList);
secondCategoryAdapter.setSelectedIndex(defaultSelect); secondCategoryAdapter.setSelectedIndex(defaultSelect);
secondCategoryAdapter.setOnItemClickListener((adapter, view, position) -> { secondCategoryAdapter.setOnItemClickListener((adapter, view, position) -> {
if (!showThirdCategory) { if (categoryLevel == 2) {
//三級分類就不回調 //二級分類
onItemClickListener.onItemClick(adapter, view, position); onCategoryClickListener.onClick(secondCategoryAdapter.getItem(position), position, categoryLevel);
val foodCategoryTrees = foodCategoryTreesList.get(position).getFoodCategoryTrees(); val foodCategoryTrees = foodCategoryTreesList.get(position).getFoodCategoryTrees();
//有三級分類就顯示三級分類,沒有三級分類,關閉彈窗,食材列表定位到所選中的二級分類 //有三級分類就顯示三級分類,沒有三級分類,關閉彈窗
if (foodCategoryTrees != null && foodCategoryTrees.size() > 0) { if (foodCategoryTrees != null && foodCategoryTrees.size() > 0) {
//顯示三級分類 //顯示三級分類
showThirdCategory = true; categoryLevel = 3;
secondCategoryAdapter.setNewInstance(foodCategoryTreesList.get(position).getFoodCategoryTrees()); secondCategoryAdapter.setNewInstance(foodCategoryTreesList.get(position).getFoodCategoryTrees());
} else { } else {
//關閉彈窗,食材列表清空,第一條顯示當前分類 //沒有三級分類,關閉彈窗
dismiss();
} }
} else { } else {
//當前是三級分類點擊,彈窗關閉,食材列表清空,第一條顯示當前分類 //當前是三級分類點擊
onCategoryClickListener.onClick(secondCategoryAdapter.getItem(position), position, categoryLevel);
dismiss();
} }
}); });
recyclerView.setAdapter(secondCategoryAdapter); recyclerView.setAdapter(secondCategoryAdapter);
defaultOffsetY = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
attachPopupContainer.setElevation(XPopupUtils.dp2px(getContext(), 2));
}
}
private OnCategoryClickListener onCategoryClickListener;
public ShowSecondCategoryPopup setOnCategoryClickListener(OnCategoryClickListener onCategoryClickListener) {
this.onCategoryClickListener = onCategoryClickListener;
return this;
} }
@Override @Override
...@@ -90,4 +102,8 @@ public class ShowSecondCategoryPopup extends AttachPopupView { ...@@ -90,4 +102,8 @@ public class ShowSecondCategoryPopup extends AttachPopupView {
protected int getMaxWidth() { protected int getMaxWidth() {
return width; return width;
} }
public interface OnCategoryClickListener {
void onClick(OrderCategoryBean.FoodCategoryTrees foodCategoryTrees, int position, int categoryLevel);
}
} }
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