Commit 2d520f03 by 张建升

菜品 boom 代码同步

parent f0a91a2d
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.OtherFunctionModule;
import com.gingersoft.supply_chain.mvp.contract.OtherFunctionContract;
import com.jess.arms.di.scope.FragmentScope;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.OtherFunctionFragment;
/**
* ================================================
* Created by zjs on 07/07/2021 21:11
* Description
* ================================================
*/
@FragmentScope
@Component(modules = OtherFunctionModule.class, dependencies = AppComponent.class)
public interface OtherFunctionComponent {
void inject(OtherFunctionFragment fragment);
@Component.Builder
interface Builder {
@BindsInstance
OtherFunctionComponent.Builder view(OtherFunctionContract.View view);
OtherFunctionComponent.Builder appComponent(AppComponent appComponent);
OtherFunctionComponent build();
}
}
\ No newline at end of file
package com.gingersoft.supply_chain.di.module;
import com.gingersoft.supply_chain.mvp.contract.OtherFunctionContract;
import com.gingersoft.supply_chain.mvp.model.OtherFunctionModel;
import dagger.Binds;
import dagger.Module;
/**
* ================================================
* Created by zjs on 07/07/2021 21:11
* Description
* ================================================
*/
@Module
public abstract class OtherFunctionModule {
@Binds
abstract OtherFunctionContract.Model bindOtherFunctionModel(OtherFunctionModel 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.supply_chain.mvp.bean.BuyIngredientsBean;
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.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
import java.util.List;
import java.util.Map;
import io.reactivex.Observable;
/**
* ================================================
* Created by zjs on 07/07/2021 21:11
* Description
* ================================================
*/
public interface OtherFunctionContract {
interface View extends IView {
/**
* 加載分類
*
* @param foodCategoryTrees 所有分類層級信息
*/
void initCategoryInfo(List<OrderCategoryBean.FoodCategoryTrees> foodCategoryTrees);
/**
* 加載失敗
*/
void loadFail();
/**
* 結束加載並且沒有更多數據了
*/
void finishLoad(boolean noData);
/**
* 加載食品
*
* @param buyIngredientsBeans 顯示的食材
* @param addToHead 是否添加到頭部
* @param isReset 是否重新設置數據
*/
void loadFood(List<BuyIngredientsBean> buyIngredientsBeans, boolean addToHead, boolean isReset);
void selectFirstCategoryByIndex(int position);
/**
* 食材列表滾動到指定位置
*
* @param index 指定位置
*/
void scrollToPosition(int index);
}
//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.OtherFunctionContract;
import java.util.Map;
import io.reactivex.Observable;
/**
* ================================================
* Created by zjs on 07/07/2021 21:11
* Description
* ================================================
*/
@FragmentScope
public class OtherFunctionModel extends BaseModel implements OtherFunctionContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public OtherFunctionModel(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
......@@ -23,6 +23,7 @@ import com.gingersoft.supply_chain.mvp.ui.adapter.PurchaseFunctionAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.category.CategoryFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodManagementFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.MeasurementUnitFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.OtherFunctionFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.order.PurchaseListFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.supplier.SupplierListFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.SnInOutboundRecordsFragment;
......@@ -104,6 +105,11 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr
}
purchaseFunctionBeans.add(new PurchaseFunctionBean("庫存管理", storage));
List<Function> otherFunction = new ArrayList<>();
otherFunction.add(new Function("菜品Boom", R.drawable.ic_inventory_inquiry));
purchaseFunctionBeans.add(new PurchaseFunctionBean("其他功能", otherFunction));
PurchaseFunctionAdapter purchaseFunctionAdapter = new PurchaseFunctionAdapter(mContext, purchaseFunctionBeans);
purchaseFunctionAdapter.setFunctionClickListener((adapter, view, position) -> {
FunctionChildAdapter functionChildAdapter = (FunctionChildAdapter) adapter;
......@@ -150,6 +156,9 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr
case "設置":
new XPopup.Builder(requireContext()).asCustom(new UpdateRestaurantInfoPop(requireContext())).show();
break;
case "菜品Boom":
start(OtherFunctionFragment.newInstance());
break;
default:
break;
......
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