Commit 90585346 by Wyh

1、外送頁面接口拆分。優化代碼 2、更多報表頁面切換日期底部報表數據不刷新問題處理 3、供應鏈新增食材,sn碼

parent b5f2771d
...@@ -30,7 +30,6 @@ public class OrderListBean { ...@@ -30,7 +30,6 @@ public class OrderListBean {
* printStatus : 0 * printStatus : 0
* timeSecond : 406956678 * timeSecond : 406956678
*/ */
private int id; private int id;
private String createTime; private String createTime;
//訂單編號 //訂單編號
......
...@@ -2,7 +2,6 @@ package com.gingersoft.gsa.delivery_pick_mode.model.viewModel ...@@ -2,7 +2,6 @@ package com.gingersoft.gsa.delivery_pick_mode.model.viewModel
import android.app.Dialog import android.app.Dialog
import android.content.Context import android.content.Context
import android.util.Log
import android.view.Gravity import android.view.Gravity
import android.view.WindowManager import android.view.WindowManager
import android.widget.TextView import android.widget.TextView
...@@ -40,8 +39,6 @@ import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.* ...@@ -40,8 +39,6 @@ import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.*
import com.gingersoft.gsa.delivery_pick_mode.ui.adapter.DeliveryAdapter import com.gingersoft.gsa.delivery_pick_mode.ui.adapter.DeliveryAdapter
import com.gingersoft.gsa.delivery_pick_mode.util.OtherOrderUtils import com.gingersoft.gsa.delivery_pick_mode.util.OtherOrderUtils
import com.jess.arms.utils.ArmsUtils import com.jess.arms.utils.ArmsUtils
import com.xuexiang.rxutil2.rxjava.RxJavaUtils
import io.reactivex.disposables.Disposable
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
...@@ -49,7 +46,11 @@ import kotlinx.coroutines.withContext ...@@ -49,7 +46,11 @@ import kotlinx.coroutines.withContext
class PageViewModel(private val repository: WeatherRepository) : ViewModel() { class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
companion object { companion object {
//0,1
var fragmentStatus = arrayOf("0,1,2,3,8", "0,1", "2", "3", "3") var fragmentStatus = arrayOf("0,1,2,3,8", "0,1", "2", "3", "3")
//訂單類型:0為所有,2是外送,7是自取。
//第四個為2(外送),是因為第四個頁面是“送貨中”,只有外送有
//第五個為7(自取),因為第五個頁面是待取餐,只有自取有
var fragmentType = arrayOf(0, 0, 0, 2, 7) var fragmentType = arrayOf(0, 0, 0, 2, 7)
val PrintCode = 1001//打印 val PrintCode = 1001//打印
val SendCode = 1002//指派送貨 val SendCode = 1002//指派送貨
...@@ -99,7 +100,8 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -99,7 +100,8 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
//餐廳營業信息 //餐廳營業信息
val restaurantBusinessInfo = MutableLiveData<RestaurantBusinessInfo>() val restaurantBusinessInfo = MutableLiveData<RestaurantBusinessInfo>()
var appointmentType = MutableLiveData<Int>() //0為即時單,1為預約單
var appointmentType = 0 //0為即時單,1為預約單
//服務費 //服務費
var addServiceChargeBean = MutableLiveData<AddServiceChargeBean>() var addServiceChargeBean = MutableLiveData<AddServiceChargeBean>()
...@@ -214,33 +216,36 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -214,33 +216,36 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
LoganManager.w_delivery(LoganManager.EVENT_ERROR, "金額驗證不通過:${GsonUtils.GsonString(orderInfo)}") LoganManager.w_delivery(LoganManager.EVENT_ERROR, "金額驗證不通過:${GsonUtils.GsonString(orderInfo)}")
return@launch return@launch
} }
//即時單 if (orderDetail.appointmentType == 0) {
// orderDetail.order_type = dataList[0].order_type //即時單
if (orderDetail.order_type == 7) { if (orderDetail.order_type == 7) {
//如果是自取單,將物流類型改為本店 //如果是自取單,將物流類型改為本店
orderDetail.companyType = 0 orderDetail.companyType = 0
} }
//交通工具類型 //交通工具類型
var trafficType = "" var trafficType = ""
if (orderDetail.companyType == 2) { //是不是lalamove
//lalamove if (orderDetail.companyType == 2) {
val transportationBean = getTransportationConfig(restaurantId) val transportationBean = getTransportationConfig(restaurantId)
if (transportationBean.success && transportationBean.data != null && transportationBean.data.list != null) { if (transportationBean.success && transportationBean.data != null && transportationBean.data.list != null) {
for (value in transportationBean.data.list) { for (value in transportationBean.data.list) {
if (value.status == 1) { if (value.status == 1) {
//默認交通工具,判斷價格是不是在這個金額範圍內,如果在,則不提示,如果不在,提示用戶修改交通工具 //默認交通工具
trafficType = value.type.toString() trafficType = value.type.toString()
}
} }
} }
} }
//狀態改為已確認
confirmOrder(orderDetail, 2, trafficType, restaurantId, isPrintPrj = true, isPrintBill = true) {
receiveNextOrder()
}
} else {
// 預約單,狀態改為待製作
updateOrderAndPrint(restaurantId, orderDetail, 8, false) {
receiveNextOrder()
}
} }
// confirmOrder(orderDetail, 2, trafficType, restaurantId, isPrintPrj = true, isPrintBill = true) {
// receiveNextOrder()
// }
// //預約單
// updateOrderAndPrint(restaurantId, orderDetail, 8, false) {
// receiveNextOrder()
// }
} }
} }
} }
...@@ -274,10 +279,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -274,10 +279,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
*/ */
fun getNewOrderList(page: Int, status: String, type: Int, orderNo: String = "") { fun getNewOrderList(page: Int, status: String, type: Int, orderNo: String = "") {
launch({ launch({
if (appointmentType.value == null) { repository.getNewOrderList(restaurantId, appointmentType, page, 10, status, orderNo, phone, type).apply {
appointmentType.value = 0
}
repository.getNewOrderList(restaurantId, appointmentType.value!!, page, 10, status, orderNo, phone, type).apply {
val jsonToList = GsonUtils.jsonToList(data, OrderListBean::class.java) val jsonToList = GsonUtils.jsonToList(data, OrderListBean::class.java)
if (page > 1) { if (page > 1) {
//加載更多 //加載更多
......
...@@ -196,14 +196,16 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen ...@@ -196,14 +196,16 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen
layout_booking_order.background = ContextCompat.getDrawable(this, R.drawable.shape_right_white_radius_btn) layout_booking_order.background = ContextCompat.getDrawable(this, R.drawable.shape_right_white_radius_btn)
tv_immediate_order.setTextColor(ContextCompat.getColor(this, R.color.white)) tv_immediate_order.setTextColor(ContextCompat.getColor(this, R.color.white))
tv_booking_order.setTextColor(ContextCompat.getColor(this, R.color.theme_333_color)) tv_booking_order.setTextColor(ContextCompat.getColor(this, R.color.theme_333_color))
pageViewModel.appointmentType.postValue(0) pageViewModel.appointmentType = 0
getCurrentPageOrderList()
} }
layout_booking_order.setOnClickListener { layout_booking_order.setOnClickListener {
it.background = ContextCompat.getDrawable(this, R.drawable.shape_right_themecolor_radius_btn) it.background = ContextCompat.getDrawable(this, R.drawable.shape_right_themecolor_radius_btn)
layout_immediate_order.background = ContextCompat.getDrawable(this, R.drawable.shape_left_white_radius_btn) layout_immediate_order.background = ContextCompat.getDrawable(this, R.drawable.shape_left_white_radius_btn)
tv_booking_order.setTextColor(ContextCompat.getColor(this, R.color.white)) tv_booking_order.setTextColor(ContextCompat.getColor(this, R.color.white))
tv_immediate_order.setTextColor(ContextCompat.getColor(this, R.color.theme_333_color)) tv_immediate_order.setTextColor(ContextCompat.getColor(this, R.color.theme_333_color))
pageViewModel.appointmentType.postValue(1) pageViewModel.appointmentType = 1
getCurrentPageOrderList()
} }
} }
......
...@@ -43,33 +43,12 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) { ...@@ -43,33 +43,12 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) {
refresh_layout.finishRefresh() refresh_layout.finishRefresh()
refresh_layout.finishLoadMore() refresh_layout.finishLoadMore()
}) })
// 綁定狀態,如果這個值發生變化,並且是當前頁,就去獲取訂單列表
// refreshState.observe(viewLifecycleOwner, Observer {
// if (position == it) {
// page = 1
// getOrderList()
// }
// })
// 綁定監聽當前fragment的數據項
// mFragmentData[position].observe(viewLifecycleOwner, Observer {
// it?.let {
// layout_nodata.setState(it.size <= 0)
// adapter.setData(it)
// }
// })
newOrderList.observe(viewLifecycleOwner, Observer { newOrderList.observe(viewLifecycleOwner, Observer {
it?.let { it?.let {
layout_nodata.setState(it.size <= 0) layout_nodata.setState(it.size <= 0)
adapter.setData(it) adapter.setData(it)
} }
}) })
//切換預約單狀態監聽
appointmentType.observe(viewLifecycleOwner, Observer {
if (position <= 1) {
//判斷小於1是因為只有 前兩個狀態才有預約單
refresh()
}
})
} }
// 初始化recyclerview // 初始化recyclerview
initRecyclerView() initRecyclerView()
...@@ -105,7 +84,7 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) { ...@@ -105,7 +84,7 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) {
intent.putExtra("isRead", data.isRead) intent.putExtra("isRead", data.isRead)
//傳遞是否是預約單 //傳遞是否是預約單
if (position <= 1) { if (position <= 1) {
if (pageViewModel.appointmentType.value == 1) { if (pageViewModel.appointmentType == 1) {
//預約單 //預約單
intent.putExtra("isBookingOrder", true) intent.putExtra("isBookingOrder", true)
} }
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<activity android:name=".mvp.ui.activity.menu.ShellActivity" /> <activity android:name=".mvp.ui.activity.menu.ShellActivity" />
<activity <activity
android:name=".mvp.ui.activity.NewMainActivity" android:name=".mvp.ui.activity.menu.FoodMenuManageActivity"
android:launchMode="singleTask" android:launchMode="singleTask"
android:alwaysRetainTaskState="true" /> android:alwaysRetainTaskState="true" />
<activity android:name=".mvp.ui.activity.ExpandListActivity" /> <activity android:name=".mvp.ui.activity.ExpandListActivity" />
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<activity android:name=".mvp.ui.activity.LookLogActivity" /> <activity android:name=".mvp.ui.activity.LookLogActivity" />
<activity android:name=".mvp.ui.activity.OriginalPrintPaperActivity" /> <activity android:name=".mvp.ui.activity.OriginalPrintPaperActivity" />
<activity <activity
android:name=".mvp.ui.activity.menu.FoodMenuManageActivity" android:name=".mvp.ui.activity.NewMainActivity"
android:launchMode="singleTask" android:launchMode="singleTask"
android:theme="@style/MainTheme"> android:theme="@style/MainTheme">
<intent-filter> <intent-filter>
......
...@@ -55,7 +55,6 @@ import java.util.Map; ...@@ -55,7 +55,6 @@ import java.util.Map;
import butterknife.BindView; import butterknife.BindView;
import butterknife.OnClick; import butterknife.OnClick;
import static com.gingersoft.gsa.cloud.common.utils.time.TimeUtils.DEFAULT_DATE_Y;
import static com.jess.arms.utils.Preconditions.checkNotNull; import static com.jess.arms.utils.Preconditions.checkNotNull;
...@@ -236,16 +235,20 @@ public class BusinessReportFragment extends BaseFragment<BusinessReportPresenter ...@@ -236,16 +235,20 @@ public class BusinessReportFragment extends BaseFragment<BusinessReportPresenter
//將數據以時間為key,數據為value存入map //將數據以時間為key,數據為value存入map
Map<String, MainBusinessBean.DataBean> map = new HashMap<>(); Map<String, MainBusinessBean.DataBean> map = new HashMap<>();
for (int i = 0; i < data.size(); i++) { int size = manyDay;
if (data.size() <= manyDay) {
size = data.size();
}
for (int i = 0; i < size; i++) {
map.put(data.get(i).getStartingTime(), data.get(i)); map.put(data.get(i).getStartingTime(), data.get(i));
} }
//y軸 數據間隔 //y軸 數據間隔
double yAxisTickInterval = 0; double yAxisTickInterval = 0;
//第一條線 //第一條線
int year = cal.get(Calendar.YEAR);
for (int i = 0; i < manyDay; i++) { for (int i = 0; i < manyDay; i++) {
//通過今年年份+月份+日期,獲取對應的對象 //通過今年年份+月份+日期,獲取對應的對象
MainBusinessBean.DataBean bean = map.get(TimeUtils.getDistanceDate(0, Calendar.YEAR, DEFAULT_DATE_Y) + xData[i]); MainBusinessBean.DataBean bean = map.get(year + "-" + xData[i]);
if (bean != null) { if (bean != null) {
chartData[i] = bean.getTotalAmount(); chartData[i] = bean.getTotalAmount();
yAxisTickInterval = Math.max(yAxisTickInterval, bean.getTotalAmount()); yAxisTickInterval = Math.max(yAxisTickInterval, bean.getTotalAmount());
...@@ -308,10 +311,25 @@ public class BusinessReportFragment extends BaseFragment<BusinessReportPresenter ...@@ -308,10 +311,25 @@ public class BusinessReportFragment extends BaseFragment<BusinessReportPresenter
); );
} }
/**
* 每日營業詳情
*/
private DailyBusinessView dailyBusinessView; private DailyBusinessView dailyBusinessView;
/**
* 賬單分析
*/
private BillingAnalysisReportView billingAnalysisReportView; private BillingAnalysisReportView billingAnalysisReportView;
/**
* 營業金額淨值詳情
*/
private OperatingReportView netOperatingAmountView; private OperatingReportView netOperatingAmountView;
/**
* 訂單詳情
*/
private OperatingReportView orderDetailsReportView; private OperatingReportView orderDetailsReportView;
/**
* 折扣詳情
*/
private OperatingReportView discountDetailsReportView; private OperatingReportView discountDetailsReportView;
private View[] printViews = new View[5]; private View[] printViews = new View[5];
...@@ -382,7 +400,7 @@ public class BusinessReportFragment extends BaseFragment<BusinessReportPresenter ...@@ -382,7 +400,7 @@ public class BusinessReportFragment extends BaseFragment<BusinessReportPresenter
} }
} }
} else { } else {
netOperatingAmountView.notifyData(dailyReportBeans); netOperatingAmountView.setNewData(dailyReportBeans);
} }
} }
...@@ -400,7 +418,7 @@ public class BusinessReportFragment extends BaseFragment<BusinessReportPresenter ...@@ -400,7 +418,7 @@ public class BusinessReportFragment extends BaseFragment<BusinessReportPresenter
} }
} }
} else { } else {
orderDetailsReportView.notifyData(dailyReportBeans); orderDetailsReportView.setNewData(dailyReportBeans);
} }
} }
...@@ -415,7 +433,7 @@ public class BusinessReportFragment extends BaseFragment<BusinessReportPresenter ...@@ -415,7 +433,7 @@ public class BusinessReportFragment extends BaseFragment<BusinessReportPresenter
layout_report_print.addView(discountDetailsReportView); layout_report_print.addView(discountDetailsReportView);
} }
} else { } else {
discountDetailsReportView.notifyData(dailyReportBeans); discountDetailsReportView.setNewData(dailyReportBeans);
} }
} }
...@@ -424,7 +442,7 @@ public class BusinessReportFragment extends BaseFragment<BusinessReportPresenter ...@@ -424,7 +442,7 @@ public class BusinessReportFragment extends BaseFragment<BusinessReportPresenter
public void onClick(View v) { public void onClick(View v) {
int viewId = v.getId(); int viewId = v.getId();
if (viewId == R.id.btn_print_business) { if (viewId == R.id.btn_print_business) {
if(printViews != null) { if (printViews != null) {
//打印 //打印
LinearLayout layout = new LinearLayout(mContext); LinearLayout layout = new LinearLayout(mContext);
layout.removeAllViews(); layout.removeAllViews();
......
...@@ -267,7 +267,7 @@ public class SalesFragment extends BaseFragment<SalesPresenter> implements Sales ...@@ -267,7 +267,7 @@ public class SalesFragment extends BaseFragment<SalesPresenter> implements Sales
netOperatingAmountView.setOnReLoadListener(() -> getDeliveryReport()); netOperatingAmountView.setOnReLoadListener(() -> getDeliveryReport());
layoutSales.addView(netOperatingAmountView); layoutSales.addView(netOperatingAmountView);
} else { } else {
netOperatingAmountView.notifyData(dailyReportBeans); netOperatingAmountView.setNewData(dailyReportBeans);
} }
} }
......
...@@ -41,7 +41,6 @@ public class DailyBusinessView extends BaseReloadView { ...@@ -41,7 +41,6 @@ public class DailyBusinessView extends BaseReloadView {
this.businessBeans = businessBeans; this.businessBeans = businessBeans;
} }
public DailyBusinessView(@NonNull Context context, @Nullable AttributeSet attrs) { public DailyBusinessView(@NonNull Context context, @Nullable AttributeSet attrs) {
this(context, attrs, -1); this(context, attrs, -1);
} }
...@@ -75,10 +74,10 @@ public class DailyBusinessView extends BaseReloadView { ...@@ -75,10 +74,10 @@ public class DailyBusinessView extends BaseReloadView {
@Override @Override
public void refreshData() { public void refreshData() {
notifyData(); setData();
} }
public void notifyData() { public void setData() {
if (printBusinessInfoAdapter == null) { if (printBusinessInfoAdapter == null) {
mBusinessDetails.setLayoutManager(new GridLayoutManager(getContext(), 3) { mBusinessDetails.setLayoutManager(new GridLayoutManager(getContext(), 3) {
@Override @Override
......
...@@ -69,7 +69,6 @@ public class OperatingReportView extends BaseReloadView { ...@@ -69,7 +69,6 @@ public class OperatingReportView extends BaseReloadView {
if (isPrint) { if (isPrint) {
tvTitle.setTextSize(30); tvTitle.setTextSize(30);
} }
notifyData(dailyReportBeans);
return view.findViewById(R.id.layout_business_info); return view.findViewById(R.id.layout_business_info);
} }
...@@ -82,31 +81,9 @@ public class OperatingReportView extends BaseReloadView { ...@@ -82,31 +81,9 @@ public class OperatingReportView extends BaseReloadView {
} }
} }
// private void init(Context mContext, String title, List<DailyReportBean> dailyReportBeans, int spanCount) { public void setNewData(List<DailyReportBean> dailyReportBeans) {
// View view = View.inflate(mContext, R.layout.layout_report_net_operating_value_details, null);
// TextView tvTitle = view.findViewById(R.id.tv_report_title);
// tvTitle.setText(title);
//
// RecyclerView rv = view.findViewById(R.id.rv_business_details);
// LinearLayoutManager linearLayoutManager = new LinearLayoutManager(mContext) {
// @Override
// public boolean canScrollVertically() {
// return false;
// }
// };
// rv.setLayoutManager(linearLayoutManager);
// adapter = new DailyBusinessAdapter(mContext, dailyReportBeans, spanCount, isPrint);
// rv.setAdapter(adapter);
//
// if (isPrint) {
// tvTitle.setTextSize(30);
// }
// notifyData(dailyReportBeans);
// addView(view);
// }
public void notifyData(List<DailyReportBean> dailyReportBeans) {
this.dailyReportBeans = dailyReportBeans; this.dailyReportBeans = dailyReportBeans;
notifyData();
} }
} }
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_business_details" android:id="@+id/rv_business_details"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="wrap_content" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</com.lihang.ShadowLayout> </com.lihang.ShadowLayout>
\ No newline at end of file
...@@ -58,6 +58,10 @@ dependencies { ...@@ -58,6 +58,10 @@ dependencies {
annotationProcessor rootProject.ext.dependencies["butterknife-compiler"] annotationProcessor rootProject.ext.dependencies["butterknife-compiler"]
implementation rootProject.ext.dependencies["BaseRecyclerViewAdapter"] implementation rootProject.ext.dependencies["BaseRecyclerViewAdapter"]
debugImplementation rootProject.ext.dependencies["canary-debug"]
releaseImplementation rootProject.ext.dependencies["canary-release"]
testImplementation rootProject.ext.dependencies["canary-release"]
implementation rootProject.ext.dependencies["glide"] implementation rootProject.ext.dependencies["glide"]
annotationProcessor rootProject.ext.dependencies["glide-compiler"] annotationProcessor rootProject.ext.dependencies["glide-compiler"]
implementation 'com.github.yalantis:ucrop:2.2.6' implementation 'com.github.yalantis:ucrop:2.2.6'
......
package com.gingersoft.supply_chain.di.component;
import dagger.BindsInstance;
import dagger.Component;
import com.jess.arms.di.component.AppComponent;
import com.gingersoft.supply_chain.di.module.BuyIngredientsModule;
import com.gingersoft.supply_chain.mvp.contract.BuyIngredientsContract;
import com.jess.arms.di.scope.FragmentScope;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.BuyIngredientsFragment;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 03/10/2021 14:55
* <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 = BuyIngredientsModule.class, dependencies = AppComponent.class)
public interface BuyIngredientsComponent {
void inject(BuyIngredientsFragment fragment);
@Component.Builder
interface Builder {
@BindsInstance
BuyIngredientsComponent.Builder view(BuyIngredientsContract.View view);
BuyIngredientsComponent.Builder appComponent(AppComponent appComponent);
BuyIngredientsComponent 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.BuyIngredientsContract;
import com.gingersoft.supply_chain.mvp.model.BuyIngredientsModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 03/10/2021 14:55
* <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 BuyIngredientsModule {
@Binds
abstract BuyIngredientsContract.Model bindBuyIngredientsModel(BuyIngredientsModel model);
}
\ No newline at end of file
package com.gingersoft.supply_chain.mvp.contract;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.ui.bean.view.CategoryBean;
import com.gingersoft.supply_chain.mvp.bean.FoodByCategoryResultBean;
import com.gingersoft.supply_chain.mvp.bean.FoodListInfoBean;
import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
import com.qmuiteam.qmui.widget.section.QMUISection;
import java.util.List;
import java.util.Map;
import io.reactivex.Observable;
import okhttp3.RequestBody;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 03/10/2021 14:55
* <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 BuyIngredientsContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
/**
* 加載分類
*
* @param foodCategoryTrees 所有分類層級信息
*/
void loadCategory(List<OrderCategoryBean.FoodCategoryTrees> foodCategoryTrees);
/**
* 加載右側食品
* @param purchaseFoodListVOS 食品信息
*/
void loadRightFoodIngredients(List<PurchaseFoodBean> purchaseFoodListVOS);
/**
* 加載失敗
*/
void loadFail();
/**
* 加載食品
* @param food
*/
void loadFood(List<QMUISection<CategoryBean, PurchaseFoodBean>> food);
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
Observable<FoodListInfoBean> getFoodIngredientsData(Map<String, Object> map);
Observable<BaseResult> getFoodBySupplierId(Map<String, Object> map);
Observable<BaseResult> deleteFood(int foodId);
Observable<OrderCategoryBean> getCategoryTrees(Map<String, Object> map);
Observable<FoodByCategoryResultBean> getFoodByCategory(Map<String, Object> map);
}
}
package com.gingersoft.supply_chain.mvp.model;
import android.app.Application;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.supply_chain.mvp.bean.FoodByCategoryResultBean;
import com.gingersoft.supply_chain.mvp.bean.FoodListInfoBean;
import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean;
import com.gingersoft.supply_chain.mvp.server.SupplierServer;
import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import com.jess.arms.di.scope.FragmentScope;
import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.BuyIngredientsContract;
import java.util.Map;
import io.reactivex.Observable;
import okhttp3.RequestBody;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 03/10/2021 14:55
* <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 BuyIngredientsModel extends BaseModel implements BuyIngredientsContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public BuyIngredientsModel(IRepositoryManager repositoryManager) {
super(repositoryManager);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mGson = null;
this.mApplication = null;
}
@Override
public Observable<FoodListInfoBean> getFoodIngredientsData(Map<String, Object> map) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).getFoodIngredientsData(map);
}
@Override
public Observable<BaseResult> getFoodBySupplierId(Map<String, Object> map) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).getFoodBySupplierId(map);
}
@Override
public Observable<BaseResult> deleteFood(int foodId) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).deleteFood(foodId);
}
@Override
public Observable<OrderCategoryBean> getCategoryTrees(Map<String, Object> map) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).getCategoryTrees(map);
}
@Override
public Observable<FoodByCategoryResultBean> getFoodByCategory(Map<String, Object> map) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).getFoodByCategory(map);
}
}
\ No newline at end of file
...@@ -353,12 +353,16 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr ...@@ -353,12 +353,16 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
totalAmount = MoneyUtil.sum(totalAmount, value); totalAmount = MoneyUtil.sum(totalAmount, value);
setTotalAmount(); setTotalAmount();
}); });
//食材點擊事件
orderDetailsFoodAdapter.setOnItemClickListener((adapter, view, position) -> { orderDetailsFoodAdapter.setOnItemClickListener((adapter, view, position) -> {
PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean infoVosBean = orderDetailsFoodAdapter.getData().get(position); PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean infoVosBean = orderDetailsFoodAdapter.getData().get(position);
// if(infoVosBean.getStatus() == PurchaseOrderDetailsBean.COMPLETE_RECEIVED){ // if(infoVosBean.getStatus() == PurchaseOrderDetailsBean.COMPLETE_RECEIVED){
// //已經全部收貨的,不讓選中 // //已經全部收貨的,不讓選中
// return; // return;
// } // }
//判斷是不是sn食材
infoVosBean.setChecked(!infoVosBean.isChecked()); infoVosBean.setChecked(!infoVosBean.isChecked());
adapter.notifyItemChanged(position); adapter.notifyItemChanged(position);
//修改選中狀態後,重新計算入庫總價 //修改選中狀態後,重新計算入庫總價
...@@ -413,7 +417,6 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr ...@@ -413,7 +417,6 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
}); });
} }
@Override @Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
......
...@@ -33,4 +33,5 @@ ...@@ -33,4 +33,5 @@
<string name="str_determine">確定</string> <string name="str_determine">確定</string>
<string name="str_delete_category_tip">是否確認刪除該類別【%1$s】,子類和食材將一同刪除?</string> <string name="str_delete_category_tip">是否確認刪除該類別【%1$s】,子類和食材將一同刪除?</string>
<string name="str_preview">預覽</string> <string name="str_preview">預覽</string>
</resources> </resources>
\ No newline at end of file
...@@ -65,7 +65,7 @@ public class MyAppLifecycles implements AppLifecycles { ...@@ -65,7 +65,7 @@ public class MyAppLifecycles implements AppLifecycles {
private void initLeakCanary(Application application) { private void initLeakCanary(Application application) {
//leakCanary内存泄露检查 //leakCanary内存泄露检查
mRefWatcher = BuildConfig.USE_CANARY ? LeakCanary.install(application) : RefWatcher.DISABLED; // mRefWatcher = BuildConfig.USE_CANARY ? LeakCanary.install(application) : RefWatcher.DISABLED;
} }
public RefWatcher getRefWatcher() { public RefWatcher getRefWatcher() {
......
...@@ -81,8 +81,11 @@ class OrderDetails { ...@@ -81,8 +81,11 @@ class OrderDetails {
var RECEIVER: String? = null var RECEIVER: String? = null
var TOTAL_AMOUNT: String? = null var TOTAL_AMOUNT: String? = null
//後台不會返回 //訂單類型#1:餐廳訂單;2:線上外賣訂單3:扫码点餐;4固定二维码订单;5:预点餐;6:積分訂單;7:自取订单;8:冷鏈
var order_type: Int = 0 var order_type: Int = 0
//是否是預約單 0 :即時單 1:是預約單
var appointmentType: Int = 0
var orderPayType: Int = 0//0店內支付,1為貨到付款,2是在線支付 var orderPayType: Int = 0//0店內支付,1為貨到付款,2是在線支付
var isDelete: Int = 1 //默認為1,為0是第三方物流,其他則是本店配送 var isDelete: Int = 1 //默認為1,為0是第三方物流,其他則是本店配送
var payTime: String? = null var payTime: String? = null
......
...@@ -103,6 +103,9 @@ public class TimePickerUtils { ...@@ -103,6 +103,9 @@ public class TimePickerUtils {
*/ */
public static TimePickerView showReportTimePicker(Context mContext, Calendar startTime, Calendar endTime, Calendar defaultTime, OnTimeSelectListener onTimeSelectListener) { public static TimePickerView showReportTimePicker(Context mContext, Calendar startTime, Calendar endTime, Calendar defaultTime, OnTimeSelectListener onTimeSelectListener) {
//打開時間選擇器 //打開時間選擇器
Calendar rangStartTime = Calendar.getInstance();
rangStartTime.set(2015, 1, 1);
rangStartTime.set(Calendar.DAY_OF_YEAR, rangStartTime.getActualMinimum(Calendar.DAY_OF_YEAR));
TimePickerView pvTime = new TimePickerBuilder(mContext, onTimeSelectListener) TimePickerView pvTime = new TimePickerBuilder(mContext, onTimeSelectListener)
.setType(new boolean[]{true, true, true, false, false, false}) .setType(new boolean[]{true, true, true, false, false, false})
.setCancelText("取消")//取消按钮文字 .setCancelText("取消")//取消按钮文字
...@@ -119,7 +122,7 @@ public class TimePickerUtils { ...@@ -119,7 +122,7 @@ public class TimePickerUtils {
// .setTitleBgColor(0xFF666666)//标题背景颜色 Night mode // .setTitleBgColor(0xFF666666)//标题背景颜色 Night mode
// .setBgColor(0xFF333333)//滚轮背景颜色 Night mode // .setBgColor(0xFF333333)//滚轮背景颜色 Night mode
// .setDate(selectedDate)// 如果不设置的话,默认是系统时间*/ // .setDate(selectedDate)// 如果不设置的话,默认是系统时间*/
.setRangDate(startTime, endTime)//時間是今年第一天到今天 .setRangDate(rangStartTime, endTime)//時間是2015年到今天
.setLabel("", "", "", "", "", "") .setLabel("", "", "", "", "", "")
.isCenterLabel(false) //是否只显示中间选中项的label文字,false则每项item全部都带有label。 .isCenterLabel(false) //是否只显示中间选中项的label文字,false则每项item全部都带有label。
// .isDialog(true)//是否显示为对话框样式 // .isDialog(true)//是否显示为对话框样式
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/Multi_Layout_Style" style="@style/Multi_Layout_Style"
android:layout_width="match_parent" android:layout_width="match_parent"
android:gravity="center_vertical"> android:gravity="center_vertical">
...@@ -15,6 +16,8 @@ ...@@ -15,6 +16,8 @@
android:id="@+id/switch_multi_boolean_state" android:id="@+id/switch_multi_boolean_state"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:shadowColor="@color/trans"
android:thumb="@drawable/shape_thumb_on" android:thumb="@drawable/shape_thumb_on"
android:track="@drawable/selector_switch_track" /> android:track="@drawable/selector_switch_track"
app:trackTint="@color/theme_color" />
</LinearLayout> </LinearLayout>
\ No newline at end of file
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