Commit bc11e1a2 by Wyh

1、供應鏈SN食材代碼提交 2、自動登錄加上餐廳人數校驗 3、baseCategory類

parent 9427843b
...@@ -138,9 +138,7 @@ public class BaseLoginPresenter<M extends BaseLoginContract.Model, V extends Bas ...@@ -138,9 +138,7 @@ public class BaseLoginPresenter<M extends BaseLoginContract.Model, V extends Bas
@Override @Override
public void onNext(BaseResult s) { public void onNext(BaseResult s) {
if (s != null && s.isSuccess()) { if (s != null && s.isSuccess()) {
List<LoginLimitBean> loginLimitBeans = new Gson().fromJson(GsonUtils.GsonString(s.getData()), new TypeToken<List<LoginLimitBean>>() { List<LoginLimitBean> loginLimitBeans = GsonUtils.jsonToList(s.getData(), LoginLimitBean.class);
}.getType());
// List<LoginLimitBean> logins = GsonUtils.GsonToList("", LoginLimitBean.class);
if (loginLimitBeans == null || loginLimitBeans.size() <= 0) { if (loginLimitBeans == null || loginLimitBeans.size() <= 0) {
if (isDownload) { if (isDownload) {
mRootView.jumpDownloadActivity(); mRootView.jumpDownloadActivity();
......
...@@ -4,14 +4,12 @@ import android.annotation.SuppressLint; ...@@ -4,14 +4,12 @@ import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.graphics.Color; import android.graphics.Color;
import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.text.method.HideReturnsTransformationMethod; import android.text.method.HideReturnsTransformationMethod;
import android.text.method.PasswordTransformationMethod; import android.text.method.PasswordTransformationMethod;
import android.view.View; import android.view.View;
import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.ImageView; import android.widget.ImageView;
...@@ -33,27 +31,19 @@ import com.gingersoft.gsa.cloud.login.mvp.contract.LoginInterfaceImpl; ...@@ -33,27 +31,19 @@ import com.gingersoft.gsa.cloud.login.mvp.contract.LoginInterfaceImpl;
import com.gingersoft.gsa.cloud.login.mvp.presenter.LoginPresenter; import com.gingersoft.gsa.cloud.login.mvp.presenter.LoginPresenter;
import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog; import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog;
import com.google.android.material.textfield.TextInputEditText; import com.google.android.material.textfield.TextInputEditText;
import com.gyf.immersionbar.BarHide;
import com.gyf.immersionbar.ImmersionBar; import com.gyf.immersionbar.ImmersionBar;
import com.gyf.immersionbar.OnKeyboardListener;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.jess.arms.integration.AppManager; import com.jess.arms.integration.AppManager;
import com.jess.arms.utils.ArmsUtils; import com.jess.arms.utils.ArmsUtils;
import com.jess.arms.utils.StatusBarUtil;
import com.qmuiteam.qmui.alpha.QMUIAlphaButton; import com.qmuiteam.qmui.alpha.QMUIAlphaButton;
import com.qmuiteam.qmui.util.QMUIStatusBarHelper;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import javax.inject.Inject; import javax.inject.Inject;
import butterknife.BindView; import butterknife.BindView;
import butterknife.OnClick; import butterknife.OnClick;
import me.jessyan.autosize.utils.LogUtils;
import static com.jess.arms.utils.Preconditions.checkNotNull; import static com.jess.arms.utils.Preconditions.checkNotNull;
...@@ -361,6 +351,7 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements ...@@ -361,6 +351,7 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements
} }
@OnClick({R2.id.btn_gsa_user_login, R2.id.iv_clear_pwd, R2.id.iv_clear_account, R2.id.ic_look_pwd, R2.id.tv_forget_pwd}) @OnClick({R2.id.btn_gsa_user_login, R2.id.iv_clear_pwd, R2.id.iv_clear_account, R2.id.ic_look_pwd, R2.id.tv_forget_pwd})
@Override
public void onClick(View v) { public void onClick(View v) {
switch (v.getId()) { switch (v.getId()) {
case R.id.ic_look_pwd: case R.id.ic_look_pwd:
......
...@@ -142,7 +142,9 @@ public class WelcomeActivity extends LoginInterfaceImpl<WelcomePresenter> implem ...@@ -142,7 +142,9 @@ public class WelcomeActivity extends LoginInterfaceImpl<WelcomePresenter> implem
int restaurantId = RestaurantInfoManager.newInstance().getRestaurantId(); int restaurantId = RestaurantInfoManager.newInstance().getRestaurantId();
if (restaurantId != 0) { if (restaurantId != 0) {
//已经选择过餐厅 直接进入 //已经选择过餐厅 直接进入
jumpDownloadActivity(); // jumpDownloadActivity();
//需要驗證登陸人數
mPresenter.getLoginLimit(restaurantId, true);
return; return;
} }
//调整选择餐厅页面 //调整选择餐厅页面
......
...@@ -94,40 +94,6 @@ public class SalesPresenter extends BasePresenter<SalesContract.Model, SalesCont ...@@ -94,40 +94,6 @@ public class SalesPresenter extends BasePresenter<SalesContract.Model, SalesCont
}); });
} }
/**
* 獲取微信公眾號的報表數據
*
* @param startTime
*/
public void getSalesReportInfo(String startTime) {
RequestBody requestBody = new FormBody.Builder()
.add("restaurantId", "26")
.add("startTime", startTime)
.add("endTime", TimeUtils.getOldDate(1))
.build();
mModel.getSalesReportInfo(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(""))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<SalesFoodsBean>(mErrorHandler) {
@Override
public void onNext(@NonNull SalesFoodsBean info) {
if (info != null && info.isSuccess()) {
if (info.getData() != null) {
// info.getData().removeAll(Collections.singleton(null));
// mRootView.loadInfo(info.getData());
}
} else {
mRootView.showMessage("銷售信息獲取失敗");
}
}
});
}
public void getDeliveryOrderCurveInfo(String restaurantId, String startTime, String endTime) { public void getDeliveryOrderCurveInfo(String restaurantId, String startTime, String endTime) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("restaurantId", restaurantId); map.put("restaurantId", restaurantId);
......
...@@ -127,11 +127,17 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print ...@@ -127,11 +127,17 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
@Override @Override
public void connectionSuccess() { public void connectionSuccess() {
if(printerLoadingDialog == null){
return;
}
printerLoadingDialog.setStep(PrinterLoadingDialog.PROGRESS_PRINTING, PrinterLoadingDialog.STATUS_SUCCESS, null); printerLoadingDialog.setStep(PrinterLoadingDialog.PROGRESS_PRINTING, PrinterLoadingDialog.STATUS_SUCCESS, null);
} }
@Override @Override
public void connectionError(Exception e) { public void connectionError(Exception e) {
if(printerLoadingDialog == null){
return;
}
printerLoadingDialog.setStep(PrinterLoadingDialog.PROGRESS_PRINTING, PrinterLoadingDialog.STATUS_ERROR, e.getMessage()); printerLoadingDialog.setStep(PrinterLoadingDialog.PROGRESS_PRINTING, PrinterLoadingDialog.STATUS_ERROR, e.getMessage());
printFail(); printFail();
} }
...@@ -142,23 +148,35 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print ...@@ -142,23 +148,35 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
@Override @Override
public void onPrinterDataBefore(int orderType, int printType, String printerData, String printerDeviceInfo) { public void onPrinterDataBefore(int orderType, int printType, String printerData, String printerDeviceInfo) {
if(printerLoadingDialog == null){
return;
}
printerLoadingDialog.setStep(PrinterLoadingDialog.PROGRESS_CONNECTING, PrinterLoadingDialog.STATUS_SUCCESS, null); printerLoadingDialog.setStep(PrinterLoadingDialog.PROGRESS_CONNECTING, PrinterLoadingDialog.STATUS_SUCCESS, null);
} }
@Override @Override
public void onPrinterBitmapBefore(int orderType, int printType, String directoryName, List<Bitmap> bitmaps) { public void onPrinterBitmapBefore(int orderType, int printType, String directoryName, List<Bitmap> bitmaps) {
if(printerLoadingDialog == null){
return;
}
printerLoadingDialog.setStep(PrinterLoadingDialog.PROGRESS_CONNECTING, PrinterLoadingDialog.STATUS_SUCCESS, null); printerLoadingDialog.setStep(PrinterLoadingDialog.PROGRESS_CONNECTING, PrinterLoadingDialog.STATUS_SUCCESS, null);
} }
@Override @Override
public void onPrintSuccess() { public void onPrintSuccess() {
printerResult = true; printerResult = true;
if(printerLoadingDialog == null){
return;
}
printerLoadingDialog.setStep(PrinterLoadingDialog.PROGRESS_RESULT, PrinterLoadingDialog.STATUS_SUCCESS, null); printerLoadingDialog.setStep(PrinterLoadingDialog.PROGRESS_RESULT, PrinterLoadingDialog.STATUS_SUCCESS, null);
printSuccess(); printSuccess();
} }
@Override @Override
public void onPrintError(Exception e, int errorCode) { public void onPrintError(Exception e, int errorCode) {
if(printerLoadingDialog == null){
return;
}
printerLoadingDialog.setStep(PrinterLoadingDialog.PROGRESS_RESULT, PrinterLoadingDialog.STATUS_ERROR, e.getMessage()); printerLoadingDialog.setStep(PrinterLoadingDialog.PROGRESS_RESULT, PrinterLoadingDialog.STATUS_ERROR, e.getMessage());
printFail(); printFail();
} }
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
<!--相机权限--> <!--相机权限-->
<uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" /> <uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" /> <uses-permission android:name="android.permission.FLASHLIGHT" />
...@@ -27,15 +28,15 @@ ...@@ -27,15 +28,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--> <provider
<!-- android:name="androidx.core.content.FileProvider"--> android:name="com.gingersoft.supply_chain.mvp.utils.PurchaseFileProvider"
<!-- android:authorities="${applicationId}.fileprovider"--> android:authorities="${applicationId}.fileprovider"
<!-- android:exported="false"--> android:exported="false"
<!-- android:grantUriPermissions="true">--> android:grantUriPermissions="true">
<!-- <meta-data--> <meta-data
<!-- android:name="android.support.FILE_PROVIDER_PATHS"--> android:name="android.support.FILE_PROVIDER_PATHS"
<!-- android:resource="@xml/gsa_purchase_paths" />--> android:resource="@xml/gsa_purchase_paths" />
<!-- </provider>--> </provider>
</application> </application>
</manifest> </manifest>
\ No newline at end of file
package com.gingersoft.supply_chain.mvp.bean; package com.gingersoft.supply_chain.mvp.bean;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* @author 宇航. * @author 宇航.
...@@ -26,4 +27,28 @@ public class BuyIngredientsBean { ...@@ -26,4 +27,28 @@ public class BuyIngredientsBean {
* 食材信息 * 食材信息
*/ */
public List<PurchaseFoodBean> purchaseFoodList; public List<PurchaseFoodBean> purchaseFoodList;
public BuyIngredientsBean() {
}
public BuyIngredientsBean(int id, String categoryName, int parentId) {
this.id = id;
this.categoryName = categoryName;
this.parentId = parentId;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
BuyIngredientsBean that = (BuyIngredientsBean) o;
return id == that.id &&
parentId == that.parentId &&
Objects.equals(categoryName, that.categoryName);
}
@Override
public int hashCode() {
return Objects.hash(id, categoryName, parentId);
}
} }
...@@ -3,6 +3,7 @@ package com.gingersoft.supply_chain.mvp.bean; ...@@ -3,6 +3,7 @@ package com.gingersoft.supply_chain.mvp.bean;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager; import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil; import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils; import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.supply_chain.mvp.content.Constant;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
...@@ -52,8 +53,8 @@ public class ConfirmOrderBean { ...@@ -52,8 +53,8 @@ public class ConfirmOrderBean {
PurchaseOrder purchaseOrder = new PurchaseOrder(); PurchaseOrder purchaseOrder = new PurchaseOrder();
purchaseOrder.setSupplierId(shoppingCartBean.getSupplierId()); purchaseOrder.setSupplierId(shoppingCartBean.getSupplierId());
purchaseOrder.setSupplierName(shoppingCartBean.getSupplierName()); purchaseOrder.setSupplierName(shoppingCartBean.getSupplierName());
purchaseOrder.setBrandId(RestaurantInfoManager.newInstance().getBrandId()); purchaseOrder.setBrandId(Constant.getBrandId());
purchaseOrder.setRestaurantId(RestaurantInfoManager.newInstance().getRestaurantId()); purchaseOrder.setRestaurantId(Constant.getRestaurantId());
purchaseOrder.setRemarks(shoppingCartBean.getRemarks()); purchaseOrder.setRemarks(shoppingCartBean.getRemarks());
purchaseOrder.setInitialShippingTime(shoppingCartBean.getInitialShippingTime()); purchaseOrder.setInitialShippingTime(shoppingCartBean.getInitialShippingTime());
purchaseOrder.setShipping(shoppingCartBean.getShipping()); purchaseOrder.setShipping(shoppingCartBean.getShipping());
......
...@@ -2,6 +2,7 @@ package com.gingersoft.supply_chain.mvp.bean; ...@@ -2,6 +2,7 @@ package com.gingersoft.supply_chain.mvp.bean;
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;
...@@ -25,6 +26,7 @@ public class OrderCategoryBean implements Serializable { ...@@ -25,6 +26,7 @@ public class OrderCategoryBean implements Serializable {
private int id; private int id;
private String name; private String name;
private int parentId; private int parentId;
private int size;
private List<FoodCategoryTrees> foodCategoryTrees; private List<FoodCategoryTrees> foodCategoryTrees;
/** /**
* 該分類下的食材信息,需要從接口獲取 * 該分類下的食材信息,需要從接口獲取
...@@ -33,11 +35,32 @@ public class OrderCategoryBean implements Serializable { ...@@ -33,11 +35,32 @@ public class OrderCategoryBean implements Serializable {
public FoodCategoryTrees() { public FoodCategoryTrees() {
} }
public FoodCategoryTrees(int id, String name, int parentId) {
this.id = id;
this.name = name;
this.parentId = parentId;
}
public FoodCategoryTrees(int id) { public FoodCategoryTrees(int id) {
this.id = id; this.id = id;
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
FoodCategoryTrees that = (FoodCategoryTrees) o;
return id == that.id &&
parentId == that.parentId &&
Objects.equals(name, that.name);
} }
@Override
public int hashCode() {
return Objects.hash(id, name, parentId);
}
}
} }
...@@ -59,6 +59,12 @@ public class WarehouseDetailsBean { ...@@ -59,6 +59,12 @@ public class WarehouseDetailsBean {
* 入庫詳情ids,逗號分隔 * 入庫詳情ids,逗號分隔
*/ */
private String warehousingOrderDetailsIds; private String warehousingOrderDetailsIds;
/**
* 出庫詳情ids,逗號分隔
*/
private String purchaseConsumeNoId;
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;
......
...@@ -3,6 +3,7 @@ package com.gingersoft.supply_chain.mvp.content; ...@@ -3,6 +3,7 @@ package com.gingersoft.supply_chain.mvp.content;
import com.gingersoft.gsa.cloud.common.bean.BaseResult; import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager; import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.BuildConfig;
import java.util.Map; import java.util.Map;
...@@ -60,22 +61,33 @@ public class Constant { ...@@ -60,22 +61,33 @@ public class Constant {
public static final String DELETE_SUCCESS = "刪除成功"; public static final String DELETE_SUCCESS = "刪除成功";
public static final String DELETE_FAIL = "刪除失敗,請稍後重試"; public static final String DELETE_FAIL = "刪除失敗,請稍後重試";
public static int getBrandId() {
// return RestaurantInfoManager.newInstance().getBrandId();
return BuildConfig.DEBUG ? 1 : RestaurantInfoManager.newInstance().getBrandId();
}
public static int getRestaurantId() {
// return RestaurantInfoManager.newInstance().getRestaurantId();
return BuildConfig.DEBUG ? 26 : RestaurantInfoManager.newInstance().getRestaurantId();
}
public static void addBrandId(@NonNull Map<String, Object> map) { public static void addBrandId(@NonNull Map<String, Object> map) {
map.put("brandId", RestaurantInfoManager.newInstance().getBrandId()); map.put("brandId", getBrandId());
} }
public static void addRestaurantId(@NonNull Map<String, Object> map) { public static void addRestaurantId(@NonNull Map<String, Object> map) {
map.put("restaurantId", RestaurantInfoManager.newInstance().getRestaurantId()); map.put("restaurantId", getRestaurantId());
} }
public static void addBrandId(@NonNull FormBody.Builder builder) { public static void addBrandId(@NonNull FormBody.Builder builder) {
builder.add("brandId", String.valueOf(RestaurantInfoManager.newInstance().getBrandId())); builder.add("brandId", String.valueOf(getBrandId()));
} }
public static void addRestaurantId(@NonNull FormBody.Builder builder) { public static void addRestaurantId(@NonNull FormBody.Builder builder) {
builder.add("restaurantId", String.valueOf(RestaurantInfoManager.newInstance().getRestaurantId())); builder.add("restaurantId", String.valueOf(getRestaurantId()));
} }
public static void addPageSize(Map<String, Object> map) { public static void addPageSize(Map<String, Object> map) {
map.put("pageSize", PAGE_SIZE); map.put("pageSize", PAGE_SIZE);
} }
......
...@@ -51,9 +51,16 @@ public interface BuyIngredientsContract { ...@@ -51,9 +51,16 @@ public interface BuyIngredientsContract {
/** /**
* 加載食品 * 加載食品
* @param food * @param index 需要滾動到的位置
* @param buyIngredientsBeans 顯示的食材
*/ */
void loadFood(List<BuyIngredientsBean> buyIngredientsBeans); void loadFood(int index, List<BuyIngredientsBean> buyIngredientsBeans);
/**
* 食材列表滾動到指定位置
* @param index 指定位置
*/
void scrollToPosition(int index);
} }
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存 //Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
......
...@@ -162,8 +162,8 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat ...@@ -162,8 +162,8 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat
*/ */
public FoodCategoryResultBean.DataBean.FoodCategoryBean toFoodCategoryBean(int parentId, String categoryName, int id) { public FoodCategoryResultBean.DataBean.FoodCategoryBean toFoodCategoryBean(int parentId, String categoryName, int id) {
FoodCategoryResultBean.DataBean.FoodCategoryBean foodCategoryBean = new FoodCategoryResultBean.DataBean.FoodCategoryBean(); FoodCategoryResultBean.DataBean.FoodCategoryBean foodCategoryBean = new FoodCategoryResultBean.DataBean.FoodCategoryBean();
foodCategoryBean.setBrandId(RestaurantInfoManager.newInstance().getBrandId()); foodCategoryBean.setBrandId(Constant.getBrandId());
foodCategoryBean.setRestaurantId(RestaurantInfoManager.newInstance().getRestaurantId()); foodCategoryBean.setRestaurantId(Constant.getRestaurantId());
foodCategoryBean.setName(categoryName); foodCategoryBean.setName(categoryName);
foodCategoryBean.setParentId(parentId); foodCategoryBean.setParentId(parentId);
foodCategoryBean.setId(id); foodCategoryBean.setId(id);
...@@ -180,8 +180,8 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat ...@@ -180,8 +180,8 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat
public void deleteFoodCategory(OrderCategoryBean.FoodCategoryTrees foodCategoryTrees, int hierarchy, int position) { public void deleteFoodCategory(OrderCategoryBean.FoodCategoryTrees foodCategoryTrees, int hierarchy, int position) {
RequestBody requestBody = new FormBody.Builder() RequestBody requestBody = new FormBody.Builder()
.add("id", foodCategoryTrees.getId() + "") .add("id", foodCategoryTrees.getId() + "")
.add("brandId", RestaurantInfoManager.newInstance().getBrandId() + "") .add("brandId", Constant.getBrandId() + "")
.add("restaurantId", RestaurantInfoManager.newInstance().getRestaurantId() + "") .add("restaurantId", Constant.getRestaurantId() + "")
.build(); .build();
mModel.deleteFoodCategory(requestBody) mModel.deleteFoodCategory(requestBody)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
......
...@@ -122,8 +122,8 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr ...@@ -122,8 +122,8 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr
Map<String, Object> map = new HashMap<>(5); Map<String, Object> map = new HashMap<>(5);
map.put("pageSize", 1000); map.put("pageSize", 1000);
map.put("pageIndex", 0); map.put("pageIndex", 0);
map.put("restaurantId", RestaurantInfoManager.newInstance().getRestaurantId()); Constant.addBrandId(map);
map.put("brandId", RestaurantInfoManager.newInstance().getBrandId()); Constant.addRestaurantId(map);
if (supplierId != -1) { if (supplierId != -1) {
map.put("supplierId", supplierId); map.put("supplierId", supplierId);
} }
...@@ -222,8 +222,8 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr ...@@ -222,8 +222,8 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr
Map<String, Object> map = new HashMap<>(5); Map<String, Object> map = new HashMap<>(5);
map.put("pageSize", 1000); map.put("pageSize", 1000);
map.put("pageIndex", 0); map.put("pageIndex", 0);
map.put("restaurantId", RestaurantInfoManager.newInstance().getRestaurantId()); Constant.addBrandId(map);
map.put("brandId", RestaurantInfoManager.newInstance().getBrandId()); Constant.addRestaurantId(map);
if (supplierId != -1) { if (supplierId != -1) {
map.put("supplierId", supplierId); map.put("supplierId", supplierId);
} }
......
...@@ -125,7 +125,7 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo ...@@ -125,7 +125,7 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo
* 獲取副單位 快捷輸入列表數據集合 * 獲取副單位 快捷輸入列表數據集合
*/ */
public void getDeputyUnitList() { public void getDeputyUnitList() {
mModel.getDeputyUnitList(RestaurantInfoManager.newInstance().getBrandId(), RestaurantInfoManager.newInstance().getRestaurantId()) mModel.getDeputyUnitList(Constant.getBrandId(), Constant.getRestaurantId())
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(GET_INFO_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(GET_INFO_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
...@@ -245,8 +245,8 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo ...@@ -245,8 +245,8 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo
} }
} }
DeputyUnitBean unitBean = new DeputyUnitBean(); DeputyUnitBean unitBean = new DeputyUnitBean();
unitBean.setBrandId(RestaurantInfoManager.newInstance().getBrandId()); unitBean.setBrandId(Constant.getBrandId());
unitBean.setRestaurantId(RestaurantInfoManager.newInstance().getRestaurantId()); unitBean.setRestaurantId(Constant.getRestaurantId());
unitBean.setPurchaseFoodId(foodId); unitBean.setPurchaseFoodId(foodId);
deputyUnitBeans.add(unitBean); deputyUnitBeans.add(unitBean);
mRootView.loadDeputyUnitAdapter(deputyUnitBeans); mRootView.loadDeputyUnitAdapter(deputyUnitBeans);
...@@ -268,8 +268,8 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo ...@@ -268,8 +268,8 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
try { try {
jsonObject.put("content", content); jsonObject.put("content", content);
jsonObject.put("brandId", RestaurantInfoManager.newInstance().getBrandId() + ""); jsonObject.put("brandId", Constant.getBrandId() + "");
jsonObject.put("restaurantId", RestaurantInfoManager.newInstance().getRestaurantId() + ""); jsonObject.put("restaurantId", Constant.getRestaurantId() + "");
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -7,6 +7,7 @@ import com.gingersoft.gsa.cloud.common.bean.BaseResult; ...@@ -7,6 +7,7 @@ import com.gingersoft.gsa.cloud.common.bean.BaseResult;
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.MeasurementUnitBean; import com.gingersoft.supply_chain.mvp.bean.MeasurementUnitBean;
import com.gingersoft.supply_chain.mvp.content.Constant;
import com.gingersoft.supply_chain.mvp.contract.MeasurementUnitContract; import com.gingersoft.supply_chain.mvp.contract.MeasurementUnitContract;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader; import com.jess.arms.http.imageloader.ImageLoader;
...@@ -75,8 +76,8 @@ public class MeasurementUnitPresenter extends BasePresenter<MeasurementUnitContr ...@@ -75,8 +76,8 @@ public class MeasurementUnitPresenter extends BasePresenter<MeasurementUnitContr
if (!TextUtil.isEmptyOrNullOrUndefined(unitContent)) { if (!TextUtil.isEmptyOrNullOrUndefined(unitContent)) {
map.put("unitContent", unitContent); map.put("unitContent", unitContent);
} }
map.put("brandId", RestaurantInfoManager.newInstance().getBrandId()); map.put("brandId", Constant.getBrandId());
map.put("restaurantId", RestaurantInfoManager.newInstance().getRestaurantId()); map.put("restaurantId", Constant.getRestaurantId());
map.put("pageIndex", pageIndex); map.put("pageIndex", pageIndex);
mModel.getMeasurementUnitList(map) mModel.getMeasurementUnitList(map)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
......
...@@ -309,8 +309,8 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient ...@@ -309,8 +309,8 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
infoMultiBeans.get(basicUnitIndex).setShowValue(basicUnitName); infoMultiBeans.get(basicUnitIndex).setShowValue(basicUnitName);
if (deputyUnitBeans != null) { if (deputyUnitBeans != null) {
for (DeputyUnitBean deputyUnitBean : deputyUnitBeans) { for (DeputyUnitBean deputyUnitBean : deputyUnitBeans) {
deputyUnitBean.setRestaurantId(RestaurantInfoManager.newInstance().getRestaurantId()); deputyUnitBean.setRestaurantId(Constant.getRestaurantId());
deputyUnitBean.setBrandId(RestaurantInfoManager.newInstance().getBrandId()); deputyUnitBean.setBrandId(Constant.getBrandId());
} }
} }
this.deputyUnitBeans = deputyUnitBeans; this.deputyUnitBeans = deputyUnitBeans;
...@@ -318,6 +318,9 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient ...@@ -318,6 +318,9 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
} }
public void setCategoryInfo(List<OrderCategoryBean.FoodCategoryTrees> foodCategoryTrees, List<InfoMultiBean> infoMultiBeans) { public void setCategoryInfo(List<OrderCategoryBean.FoodCategoryTrees> foodCategoryTrees, List<InfoMultiBean> infoMultiBeans) {
if (CollectionUtils.isNullOrEmpty(foodCategoryTrees)) {
return;
}
StringBuilder categoryName = new StringBuilder(); StringBuilder categoryName = new StringBuilder();
if (categoryNames == null) { if (categoryNames == null) {
categoryNames = new ArrayList<>(); categoryNames = new ArrayList<>();
...@@ -329,7 +332,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient ...@@ -329,7 +332,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
categoryName.append(categoryTrees.getName()) categoryName.append(categoryTrees.getName())
.append(PurchaseFoodBean.CATEGORY_DIVIDER); .append(PurchaseFoodBean.CATEGORY_DIVIDER);
} }
if (purchaseFoodBean != null) { if (purchaseFoodBean != null && foodCategoryTrees.size() > 0) {
//食材信息不為空,設置分類id為最後一個分類的id //食材信息不為空,設置分類id為最後一個分類的id
//例如:選擇了一個三級分類,下標0為父類,1為子類,2位當前分類 //例如:選擇了一個三級分類,下標0為父類,1為子類,2位當前分類
purchaseFoodBean.setFoodCategoryId(foodCategoryTrees.get(foodCategoryTrees.size() - 1).getId()); purchaseFoodBean.setFoodCategoryId(foodCategoryTrees.get(foodCategoryTrees.size() - 1).getId());
...@@ -552,9 +555,9 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient ...@@ -552,9 +555,9 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
purchaseFoodBean.setFoodUnits(deputyUnitBeans); purchaseFoodBean.setFoodUnits(deputyUnitBeans);
} }
//品牌id //品牌id
purchaseFoodBean.setBrandId(RestaurantInfoManager.newInstance().getBrandId()); purchaseFoodBean.setBrandId(Constant.getBrandId());
//餐廳id //餐廳id
purchaseFoodBean.setRestaurantId(RestaurantInfoManager.newInstance().getRestaurantId()); purchaseFoodBean.setRestaurantId(Constant.getRestaurantId());
return purchaseFoodBean; return purchaseFoodBean;
} }
} }
...@@ -8,6 +8,7 @@ import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils; ...@@ -8,6 +8,7 @@ import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.ui.adapter.bean.InfoMultiBean; import com.gingersoft.gsa.cloud.ui.adapter.bean.InfoMultiBean;
import com.gingersoft.supply_chain.mvp.bean.MeasurementUnitBean; import com.gingersoft.supply_chain.mvp.bean.MeasurementUnitBean;
import com.gingersoft.supply_chain.mvp.content.Constant;
import com.gingersoft.supply_chain.mvp.contract.NewFoodUnitContract; import com.gingersoft.supply_chain.mvp.contract.NewFoodUnitContract;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader; import com.jess.arms.http.imageloader.ImageLoader;
...@@ -129,8 +130,8 @@ public class NewFoodUnitPresenter extends BasePresenter<NewFoodUnitContract.Mode ...@@ -129,8 +130,8 @@ public class NewFoodUnitPresenter extends BasePresenter<NewFoodUnitContract.Mode
if (foodUnit == null) { if (foodUnit == null) {
foodUnit = new MeasurementUnitBean.DataBean.Unit(); foodUnit = new MeasurementUnitBean.DataBean.Unit();
} }
foodUnit.setBrandId(RestaurantInfoManager.newInstance().getBrandId()); foodUnit.setBrandId(Constant.getBrandId());
foodUnit.setRestaurantId(RestaurantInfoManager.newInstance().getRestaurantId()); foodUnit.setRestaurantId(Constant.getRestaurantId());
List<InfoMultiBean> units = infoMultiBeans.get(0).getInfoMultiBeans(); List<InfoMultiBean> units = infoMultiBeans.get(0).getInfoMultiBeans();
for (int i = 0; i < units.size(); i++) { for (int i = 0; i < units.size(); i++) {
if (units.get(i).isChecked()) { if (units.get(i).isChecked()) {
......
...@@ -519,8 +519,8 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode ...@@ -519,8 +519,8 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
//地址 //地址
supplierInfoBean.setAddress(infoMultiBeans.get(addressIndex).getShowValue()); supplierInfoBean.setAddress(infoMultiBeans.get(addressIndex).getShowValue());
//餐廳信息 //餐廳信息
supplierInfoBean.setRestaurantId(RestaurantInfoManager.newInstance().getRestaurantId()); supplierInfoBean.setRestaurantId(Constant.getRestaurantId());
supplierInfoBean.setBrandId(RestaurantInfoManager.newInstance().getBrandId()); supplierInfoBean.setBrandId(Constant.getBrandId());
//最低採購金額 //最低採購金額
String minimumAmount = infoMultiBeans.get(lowPurchaseAmount).getShowValue(); String minimumAmount = infoMultiBeans.get(lowPurchaseAmount).getShowValue();
if (TextUtil.isNotEmptyOrNullOrUndefined(minimumAmount)) { if (TextUtil.isNotEmptyOrNullOrUndefined(minimumAmount)) {
......
...@@ -4,6 +4,7 @@ import android.app.Application; ...@@ -4,6 +4,7 @@ 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.core.restaurant.RestaurantInfoManager; import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.utils.CollectionUtils;
import com.gingersoft.gsa.cloud.common.utils.JsonUtils; import com.gingersoft.gsa.cloud.common.utils.JsonUtils;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil; import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils; import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
...@@ -202,6 +203,12 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -202,6 +203,12 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
} }
purchaseOrderDetailsInfoVO.setShowUnit(warehouseUnit); purchaseOrderDetailsInfoVO.setShowUnit(warehouseUnit);
purchaseOrderDetailsInfoVO.setFoodUnits(Collections.singletonList(warehouseUnit)); purchaseOrderDetailsInfoVO.setFoodUnits(Collections.singletonList(warehouseUnit));
} else {
wareHousingUnitBean = new WareHousingUnitBean(purchaseOrderDetailsInfoVO.getId(), purchaseOrderDetailsInfoVO.getBasicUnitName(), purchaseOrderDetailsInfoVO.getWarehousingQuantity(), 0);
purchaseOrderDetailsInfoVO.setPurchaseWarehousingUnit(wareHousingUnitBean);
purchaseOrderDetailsInfoVO.setShowUnit(new DeputyUnitBean(purchaseOrderDetailsInfoVO.getBasicUnitName(), purchaseOrderDetailsInfoVO.getWarehousingQuantity()));
mRootView.showMessage("沒有入庫單位,請聯繫開發人員");
mRootView.killMyself();
} }
} }
purchaseOrderDetailsInfoVO.setWarehousingAmount(warehousingAmount); purchaseOrderDetailsInfoVO.setWarehousingAmount(warehousingAmount);
...@@ -252,6 +259,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -252,6 +259,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
List<OrderWareHouseBean.PurchaseWarehousingOrderDetail> purchaseWarehousingOrderDetails = transformWareHoses(wareHouseBean, purchaseOrderDetailsInfoVosBeans); List<OrderWareHouseBean.PurchaseWarehousingOrderDetail> purchaseWarehousingOrderDetails = transformWareHoses(wareHouseBean, purchaseOrderDetailsInfoVosBeans);
wareHouseBean = getWareHouseBean(state, remark, totalAmount, wareHouseBean, purchaseWarehousingOrderDetails); wareHouseBean = getWareHouseBean(state, remark, totalAmount, wareHouseBean, purchaseWarehousingOrderDetails);
if (wareHouseBean == null) { if (wareHouseBean == null) {
mRootView.killMyself();
return; return;
} }
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(wareHouseBean)); RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(wareHouseBean));
...@@ -296,7 +304,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -296,7 +304,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(GET_INFO_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(GET_INFO_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.doAfterNext(disposable -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView)) .compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) { .subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
...@@ -327,7 +335,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -327,7 +335,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
* 生成入庫對象 * 生成入庫對象
*/ */
private OrderWareHouseBean getWareHouseBean(int state, String remark, double totalAmount, OrderWareHouseBean orderWareHouseBean, List<OrderWareHouseBean.PurchaseWarehousingOrderDetail> purchaseWarehousingOrderDetails) { private OrderWareHouseBean getWareHouseBean(int state, String remark, double totalAmount, OrderWareHouseBean orderWareHouseBean, List<OrderWareHouseBean.PurchaseWarehousingOrderDetail> purchaseWarehousingOrderDetails) {
if (purchaseWarehousingOrderDetails == null) { if (CollectionUtils.isNullOrEmpty(purchaseWarehousingOrderDetails)) {
return null; return null;
} }
orderWareHouseBean.setStatus(state); orderWareHouseBean.setStatus(state);
...@@ -342,13 +350,17 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -342,13 +350,17 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
String substring = files.substring(0, files.length()); String substring = files.substring(0, files.length());
purchaseWarehousingOrder.setFiles(substring); purchaseWarehousingOrder.setFiles(substring);
} }
purchaseWarehousingOrder.setRestaurantId(RestaurantInfoManager.newInstance().getRestaurantId()); purchaseWarehousingOrder.setRestaurantId(Constant.getRestaurantId());
purchaseWarehousingOrder.setBrandId(RestaurantInfoManager.newInstance().getBrandId()); purchaseWarehousingOrder.setBrandId(Constant.getBrandId());
purchaseWarehousingOrder.setRemarks(remark); purchaseWarehousingOrder.setRemarks(remark);
purchaseWarehousingOrder.setTotalPrice(totalAmount); purchaseWarehousingOrder.setTotalPrice(totalAmount);
orderWareHouseBean.setPurchaseWarehousingOrder(purchaseWarehousingOrder); orderWareHouseBean.setPurchaseWarehousingOrder(purchaseWarehousingOrder);
orderWareHouseBean.setPurchaseWarehousingOrderDetailsTOS(purchaseWarehousingOrderDetails); orderWareHouseBean.setPurchaseWarehousingOrderDetailsTOS(purchaseWarehousingOrderDetails);
if (purchaseWarehousingOrderDetails.size() <= 0) {
mRootView.showMessage("請選擇需要操作的食品");
return null;
}
return orderWareHouseBean; return orderWareHouseBean;
} }
...@@ -372,12 +384,16 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -372,12 +384,16 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
purchaseWarehousingOrderDetail.setTotalPrice(MoneyUtil.priceCalculation(purchaseOrderDetailsInfoVosBean.getFoodPrice(), purchaseOrderDetailsInfoVosBean.getFoodQuantity())); purchaseWarehousingOrderDetail.setTotalPrice(MoneyUtil.priceCalculation(purchaseOrderDetailsInfoVosBean.getFoodPrice(), purchaseOrderDetailsInfoVosBean.getFoodQuantity()));
DeputyUnitBean deputyUnitBean = purchaseOrderDetailsInfoVosBean.getShowUnit(); DeputyUnitBean deputyUnitBean = purchaseOrderDetailsInfoVosBean.getShowUnit();
WareHousingUnitBean wareHousingUnitBean = DeputyUnitBean.getWareHousingUnitByDeputyUnit(deputyUnitBean); WareHousingUnitBean wareHousingUnitBean = DeputyUnitBean.getWareHousingUnitByDeputyUnit(deputyUnitBean);
// if(wareHousingUnitBean.getUnitValue()<=0){
// //如果入庫數量小於等於0,就不管這個食品
// continue;
// }
if (purchaseOrderDetailsInfoVosBean.getStatus() != PurchaseOrderDetailsBean.WAIT_RECEIVED && deputyUnitBean.getId() != null) { if (purchaseOrderDetailsInfoVosBean.getStatus() != PurchaseOrderDetailsBean.WAIT_RECEIVED && deputyUnitBean.getId() != null) {
//不是待收貨狀態才設置id,因為如果已經收過貨才有id //不是待收貨狀態才設置id,因為如果已經收過貨才有id
wareHousingUnitBean.setId(deputyUnitBean.getId()); wareHousingUnitBean.setId(deputyUnitBean.getId());
} }
wareHousingUnitBean.setBrandId(RestaurantInfoManager.newInstance().getBrandId()); wareHousingUnitBean.setBrandId(Constant.getBrandId());
wareHousingUnitBean.setRestaurantId(RestaurantInfoManager.newInstance().getRestaurantId()); wareHousingUnitBean.setRestaurantId(Constant.getRestaurantId());
purchaseWarehousingOrderDetail.setPurchaseWarehousingUnit(wareHousingUnitBean); purchaseWarehousingOrderDetail.setPurchaseWarehousingUnit(wareHousingUnitBean);
//sn碼 //sn碼
List<PurchaseFoodEncodeSn> snList = null; List<PurchaseFoodEncodeSn> snList = null;
...@@ -398,10 +414,6 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -398,10 +414,6 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
purchaseWarehousingOrderDetails.add(purchaseWarehousingOrderDetail); purchaseWarehousingOrderDetails.add(purchaseWarehousingOrderDetail);
} }
} }
if (purchaseWarehousingOrderDetails.size() <= 0) {
mRootView.showMessage("請選擇需要操作的食品");
return null;
}
return purchaseWarehousingOrderDetails; return purchaseWarehousingOrderDetails;
} }
...@@ -446,6 +458,24 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -446,6 +458,24 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
} }
/** /**
* 是否有sn食材
*
* @param purchaseOrderDetailsInfoVOS 食材信息
* @return
*/
public boolean hasSnFood(List<PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean> purchaseOrderDetailsInfoVOS) {
if (purchaseOrderDetailsInfoVOS != null) {
for (PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean datum : purchaseOrderDetailsInfoVOS) {
if (datum.getFoodMarkSn() == PurchaseFoodBean.HAS_SN) {
return true;
}
}
return false;
}
return false;
}
/**
* 刪除Sn碼 * 刪除Sn碼
*/ */
public void deleteSn(String enCodeOrderNo, String encodeFoodNo, String encodeSnNo) { public void deleteSn(String enCodeOrderNo, String encodeFoodNo, String encodeSnNo) {
......
...@@ -15,6 +15,7 @@ import com.gingersoft.supply_chain.mvp.bean.NewPurchaseOrderBean; ...@@ -15,6 +15,7 @@ import com.gingersoft.supply_chain.mvp.bean.NewPurchaseOrderBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean; import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import com.gingersoft.supply_chain.mvp.bean.ShoppingCartBean; import com.gingersoft.supply_chain.mvp.bean.ShoppingCartBean;
import com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean; import com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean;
import com.gingersoft.supply_chain.mvp.content.Constant;
import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart; import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart;
import com.gingersoft.supply_chain.mvp.contract.ShoppingCatContract; import com.gingersoft.supply_chain.mvp.contract.ShoppingCatContract;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
...@@ -225,8 +226,8 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode ...@@ -225,8 +226,8 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
public void addNewPurchaseOrder(List<PurchaseFoodBean> purchaseFoodBeans, String remarks) { public void addNewPurchaseOrder(List<PurchaseFoodBean> purchaseFoodBeans, String remarks) {
NewPurchaseOrderBean newPurchaseOrderBean = new NewPurchaseOrderBean(); NewPurchaseOrderBean newPurchaseOrderBean = new NewPurchaseOrderBean();
newPurchaseOrderBean.setBrandId(RestaurantInfoManager.newInstance().getBrandId()); newPurchaseOrderBean.setBrandId(Constant.getBrandId());
newPurchaseOrderBean.setRestaurantId(RestaurantInfoManager.newInstance().getRestaurantId()); newPurchaseOrderBean.setRestaurantId(Constant.getRestaurantId());
double totalAmount = 0; double totalAmount = 0;
for (PurchaseFoodBean purchaseFoodBean : purchaseFoodBeans) { for (PurchaseFoodBean purchaseFoodBean : purchaseFoodBeans) {
totalAmount = MoneyUtil.sum(totalAmount, MoneyUtil.priceCalculation(purchaseFoodBean.getUnitPrice(), purchaseFoodBean.getFoodQuantity())); totalAmount = MoneyUtil.sum(totalAmount, MoneyUtil.priceCalculation(purchaseFoodBean.getUnitPrice(), purchaseFoodBean.getFoodQuantity()));
......
...@@ -7,6 +7,7 @@ import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager; ...@@ -7,6 +7,7 @@ import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
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.WareHousingOrderBean; import com.gingersoft.supply_chain.mvp.bean.WareHousingOrderBean;
import com.gingersoft.supply_chain.mvp.content.Constant;
import com.gingersoft.supply_chain.mvp.contract.StorageListContract; import com.gingersoft.supply_chain.mvp.contract.StorageListContract;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader; import com.jess.arms.http.imageloader.ImageLoader;
...@@ -70,8 +71,8 @@ public class StorageListPresenter extends BasePresenter<StorageListContract.Mode ...@@ -70,8 +71,8 @@ public class StorageListPresenter extends BasePresenter<StorageListContract.Mode
Map<String, Object> map = new HashMap<>(6); Map<String, Object> map = new HashMap<>(6);
map.put("pageSize", 10); map.put("pageSize", 10);
map.put("pageIndex", pageIndex); map.put("pageIndex", pageIndex);
map.put("restaurantId", RestaurantInfoManager.newInstance().getRestaurantId()); Constant.addBrandId(map);
map.put("brandId", RestaurantInfoManager.newInstance().getBrandId()); Constant.addRestaurantId(map);
map.put("status", status); map.put("status", status);
if (TextUtil.isNotEmptyOrNullOrUndefined(orderNo)) { if (TextUtil.isNotEmptyOrNullOrUndefined(orderNo)) {
map.put("orderNo", orderNo); map.put("orderNo", orderNo);
......
...@@ -93,8 +93,8 @@ public class SupplierListPresenter extends BasePresenter<SupplierListContract.Mo ...@@ -93,8 +93,8 @@ public class SupplierListPresenter extends BasePresenter<SupplierListContract.Mo
Map<String, Object> map = new HashMap<>(5); Map<String, Object> map = new HashMap<>(5);
map.put("pageSize", Constant.PAGE_SIZE); map.put("pageSize", Constant.PAGE_SIZE);
map.put("pageIndex", pageIndex * Constant.PAGE_SIZE); map.put("pageIndex", pageIndex * Constant.PAGE_SIZE);
map.put("restaurantId", RestaurantInfoManager.newInstance().getRestaurantId()); Constant.addRestaurantId(map);
map.put("brandId", RestaurantInfoManager.newInstance().getBrandId()); Constant.addBrandId(map);
if (!TextUtil.isEmptyOrNullOrUndefined(content)) { if (!TextUtil.isEmptyOrNullOrUndefined(content)) {
map.put("content", content); map.put("content", content);
} }
......
...@@ -181,8 +181,8 @@ public class WarehouseDetailsPresenter extends BasePresenter<WarehouseDetailsCon ...@@ -181,8 +181,8 @@ public class WarehouseDetailsPresenter extends BasePresenter<WarehouseDetailsCon
*/ */
public void consumeWareHousing(PurchaseWarehousingOrderDetailsVO purchaseWarehousingOrderDetailsVO, int consumeQuantity, ConsumeReasonBean consumeReasonBean, String remarks, List<String> snCodes, boolean whetherPrint) { public void consumeWareHousing(PurchaseWarehousingOrderDetailsVO purchaseWarehousingOrderDetailsVO, int consumeQuantity, ConsumeReasonBean consumeReasonBean, String remarks, List<String> snCodes, boolean whetherPrint) {
PurchaseConsumeSnBean purchaseConsumeSnBean = new PurchaseConsumeSnBean(); PurchaseConsumeSnBean purchaseConsumeSnBean = new PurchaseConsumeSnBean();
purchaseConsumeSnBean.brandId = RestaurantInfoManager.newInstance().getBrandId(); purchaseConsumeSnBean.brandId = Constant.getBrandId();
purchaseConsumeSnBean.restaurantId = RestaurantInfoManager.newInstance().getRestaurantId(); purchaseConsumeSnBean.restaurantId = Constant.getRestaurantId();
purchaseConsumeSnBean.foodNo = purchaseWarehousingOrderDetailsVO.getFoodNo(); purchaseConsumeSnBean.foodNo = purchaseWarehousingOrderDetailsVO.getFoodNo();
purchaseConsumeSnBean.purchaseConsumeReasonId = consumeReasonBean.getId(); purchaseConsumeSnBean.purchaseConsumeReasonId = consumeReasonBean.getId();
purchaseConsumeSnBean.remarks = remarks; purchaseConsumeSnBean.remarks = remarks;
......
...@@ -3,6 +3,7 @@ package com.gingersoft.supply_chain.mvp.ui.adapter; ...@@ -3,6 +3,7 @@ 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;
...@@ -11,11 +12,13 @@ import androidx.databinding.DataBindingUtil; ...@@ -11,11 +12,13 @@ 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 extends RecyclerView.ViewHolder { public class BaseViewHolder<VH extends RecyclerView.ViewHolder> extends RecyclerView.ViewHolder {
private SparseArray<View> mViews; private SparseArray<View> mViews;
...@@ -58,6 +61,13 @@ public class BaseViewHolder extends RecyclerView.ViewHolder { ...@@ -58,6 +61,13 @@ public class BaseViewHolder extends RecyclerView.ViewHolder {
return this; return this;
} }
public BaseViewHolder setText(int viewId, CharSequence text, TextView.BufferType type) {
TextView tv = get(viewId);
tv.setText(text, type);
return this;
}
public BaseViewHolder setText(int viewId, int textRes) { public BaseViewHolder setText(int viewId, int textRes) {
TextView tv = get(viewId); TextView tv = get(viewId);
tv.setText(textRes); tv.setText(textRes);
...@@ -119,4 +129,45 @@ public class BaseViewHolder extends RecyclerView.ViewHolder { ...@@ -119,4 +129,45 @@ public class BaseViewHolder extends RecyclerView.ViewHolder {
view.setVisibility(visible); view.setVisibility(visible);
return this; return this;
} }
public BaseViewHolder setInvisible(int viewId, boolean invisible) {
View view = get(viewId);
view.setVisibility(invisible ? View.INVISIBLE : View.VISIBLE);
return this;
}
public BaseViewHolder setInvisible(int viewId, int invisible) {
View view = get(viewId);
view.setVisibility(invisible);
return this;
}
public BaseViewHolder setOnClickListener(int viewId, View.OnClickListener onClickListener) {
View view = get(viewId);
view.setOnClickListener(onClickListener);
return this;
}
public BaseViewHolder setOnLongClickListener(int viewId, View.OnLongClickListener l) {
View view = get(viewId);
view.setOnLongClickListener(l);
return this;
}
public BaseViewHolder setOnTouchListener(int viewId, View.OnTouchListener l) {
View view = get(viewId);
view.setOnTouchListener(l);
return this;
}
public BaseViewHolder setOnFocusChangeListener(int viewId, View.OnFocusChangeListener onFocusChangeListener) {
View view = get(viewId);
view.setOnFocusChangeListener(onFocusChangeListener);
return this;
}
public <T extends TextView> CharSequence getText(int viewId) {
T view = get(viewId);
return view.getText();
}
} }
...@@ -47,6 +47,12 @@ public class FirstLevelCategoryAdapter extends BaseQuickAdapter<OrderCategoryBea ...@@ -47,6 +47,12 @@ public class FirstLevelCategoryAdapter extends BaseQuickAdapter<OrderCategoryBea
TextView tvCategoryName = viewHolder.getView(R.id.tv_category_name); TextView tvCategoryName = viewHolder.getView(R.id.tv_category_name);
tvCategoryName.setText(categoryBean.getName()); tvCategoryName.setText(categoryBean.getName());
CardView view = viewHolder.getView(R.id.layout_category); CardView view = viewHolder.getView(R.id.layout_category);
if (categoryBean.getSize() > 0) {
viewHolder.setText(R.id.tv_category_number, String.valueOf(categoryBean.getSize()));
viewHolder.setGone(R.id.tv_category_number, false);
} else {
viewHolder.setGone(R.id.tv_category_number, true);
}
//選中時的背景和文字顏色 //選中時的背景和文字顏色
if (viewHolder.getAdapterPosition() == selectedIndex) { if (viewHolder.getAdapterPosition() == selectedIndex) {
if (selectedBg != null) { if (selectedBg != null) {
......
...@@ -26,7 +26,7 @@ public class ImageAdapter extends BaseQuickAdapter<String, BaseViewHolder> { ...@@ -26,7 +26,7 @@ public class ImageAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
@Override @Override
protected void convert(@NotNull BaseViewHolder viewHolder, String s) { protected void convert(@NotNull BaseViewHolder viewHolder, String s) {
GlideUtils.display(getContext(), viewHolder.getView(R.id.iv_img), s); GlideUtils.display(getContext(), viewHolder.getView(R.id.iv_img), s, R.drawable.img_small_default);
viewHolder.setGone(R.id.iv_img_delete, notShowDelete); viewHolder.setGone(R.id.iv_img_delete, notShowDelete);
} }
} }
...@@ -24,6 +24,7 @@ import com.gingersoft.gsa.cloud.common.utils.inputFilter.MoneyInputFilter; ...@@ -24,6 +24,7 @@ import com.gingersoft.gsa.cloud.common.utils.inputFilter.MoneyInputFilter;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.DeputyUnitBean; import com.gingersoft.supply_chain.mvp.bean.DeputyUnitBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseOrderDetailsBean; import com.gingersoft.supply_chain.mvp.bean.PurchaseOrderDetailsBean;
import com.xuexiang.rxutil2.rxjava.RxJavaUtils; import com.xuexiang.rxutil2.rxjava.RxJavaUtils;
...@@ -111,6 +112,14 @@ public class OrderDetailsFoodAdapter extends BaseQuickAdapter<PurchaseOrderDetai ...@@ -111,6 +112,14 @@ public class OrderDetailsFoodAdapter extends BaseQuickAdapter<PurchaseOrderDetai
viewHolder.setText(R.id.tv_order_details_item_warehouse_total_amount, String.format(formatAmount, item.getTotalAmount())); viewHolder.setText(R.id.tv_order_details_item_warehouse_total_amount, String.format(formatAmount, item.getTotalAmount()));
//食品數量 //食品數量
EditText edFoodNum = viewHolder.getView(R.id.ed_food_num); EditText edFoodNum = viewHolder.getView(R.id.ed_food_num);
//SN食材不可編輯數量
if(item.getFoodMarkSn() == PurchaseFoodBean.HAS_SN){
edFoodNum.setEnabled(false);
edFoodNum.setTextColor(ContextCompat.getColor(getContext(), R.color.color_aaa));
} else {
edFoodNum.setTextColor(ContextCompat.getColor(getContext(), R.color.color_3c));
edFoodNum.setEnabled(true);
}
edFoodNum.setFilters(inputFilters); edFoodNum.setFilters(inputFilters);
//已入庫數量 //已入庫數量
viewHolder.setText(R.id.tv_order_details_item_warehouse_warehousing_num, MoneyUtil.formatDouble(item.getWarehousingQuantity())); viewHolder.setText(R.id.tv_order_details_item_warehouse_warehousing_num, MoneyUtil.formatDouble(item.getWarehousingQuantity()));
...@@ -157,7 +166,7 @@ public class OrderDetailsFoodAdapter extends BaseQuickAdapter<PurchaseOrderDetai ...@@ -157,7 +166,7 @@ public class OrderDetailsFoodAdapter extends BaseQuickAdapter<PurchaseOrderDetai
edFoodNum.setOnFocusChangeListener((v, hasFocus) -> { edFoodNum.setOnFocusChangeListener((v, hasFocus) -> {
if (hasFocus) { if (hasFocus) {
edFoodNum.addTextChangedListener(watcher); edFoodNum.addTextChangedListener(watcher);
if("0".equals(edFoodNum.getText().toString())){ if ("0".equals(edFoodNum.getText().toString())) {
edFoodNum.setText(""); edFoodNum.setText("");
} }
} else { } else {
...@@ -208,7 +217,7 @@ public class OrderDetailsFoodAdapter extends BaseQuickAdapter<PurchaseOrderDetai ...@@ -208,7 +217,7 @@ public class OrderDetailsFoodAdapter extends BaseQuickAdapter<PurchaseOrderDetai
if (hasFocus) { if (hasFocus) {
if (TextUtil.isNotEmptyOrNullOrUndefined(edUnitPrice)) { if (TextUtil.isNotEmptyOrNullOrUndefined(edUnitPrice)) {
double price = Double.parseDouble(edUnitPrice.getText().toString()); double price = Double.parseDouble(edUnitPrice.getText().toString());
if(price == 0){ if (price == 0) {
edUnitPrice.setText(""); edUnitPrice.setText("");
} }
} }
......
...@@ -12,6 +12,7 @@ import androidx.recyclerview.widget.RecyclerView; ...@@ -12,6 +12,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemClickListener; import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.gingersoft.gsa.cloud.common.BuildConfig; import com.gingersoft.gsa.cloud.common.BuildConfig;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.utils.other.SPUtils; import com.gingersoft.gsa.cloud.common.utils.other.SPUtils;
import com.gingersoft.gsa.cloud.database.bean.Function; import com.gingersoft.gsa.cloud.database.bean.Function;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
...@@ -113,8 +114,8 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr ...@@ -113,8 +114,8 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr
start(SupplierListFragment.newInstance(false, null)); start(SupplierListFragment.newInstance(false, null));
break; break;
case "食材": case "食材":
start(FoodIngredientsFragment.newInstance(FOOD_INGREDIENTS)); // start(FoodIngredientsFragment.newInstance(FOOD_INGREDIENTS));
// start(BuyIngredientsFragment.newInstance()); start(BuyIngredientsFragment.newInstance());
break; break;
case "種類": case "種類":
start(CategoryFragment.newInstance()); start(CategoryFragment.newInstance());
......
...@@ -17,7 +17,7 @@ import androidx.recyclerview.widget.RecyclerView; ...@@ -17,7 +17,7 @@ import androidx.recyclerview.widget.RecyclerView;
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.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.mvp.ui.adapter.BaseCategoryAdapter; import com.gingersoft.gsa.cloud.ui.adapter.BaseCategoryAdapter;
import com.gingersoft.gsa.cloud.ui.bean.view.CategoryBean; import com.gingersoft.gsa.cloud.ui.bean.view.CategoryBean;
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;
...@@ -358,7 +358,7 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi ...@@ -358,7 +358,7 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi
supplierId = categoryBeans.get(0).getId(); supplierId = categoryBeans.get(0).getId();
} }
if (listSelectAdapter == null) { if (listSelectAdapter == null) {
listSelectAdapter = new BaseCategoryAdapter(categoryBeans); listSelectAdapter = new BaseCategoryAdapter(R.layout.item_base_category, categoryBeans);
listSelectAdapter.setUnSelectColor(ContextCompat.getColor(mContext, R.color.color_3c)) listSelectAdapter.setUnSelectColor(ContextCompat.getColor(mContext, R.color.color_3c))
.setSelectColor(ContextCompat.getColor(mContext, R.color.theme_color)); .setSelectColor(ContextCompat.getColor(mContext, R.color.theme_color));
listSelectAdapter.setOnItemClickListener((adapter, view, position) -> { listSelectAdapter.setOnItemClickListener((adapter, view, position) -> {
......
...@@ -223,6 +223,11 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr ...@@ -223,6 +223,11 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
} }
} }
/**
* 收貨操作
*
* @param state 狀態,全部收貨還是部分收貨
*/
private void addWarehouse(int state) { private void addWarehouse(int state) {
AppDialog.getInstance().showWaringDialog(requireContext(), "是否確認收貨?", (view, dialog) -> { AppDialog.getInstance().showWaringDialog(requireContext(), "是否確認收貨?", (view, dialog) -> {
mPresenter.addWarehouse(state, edRemark.getText() + "", totalAmount, orderDetailsFoodAdapter.getData()); mPresenter.addWarehouse(state, edRemark.getText() + "", totalAmount, orderDetailsFoodAdapter.getData());
...@@ -250,8 +255,19 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr ...@@ -250,8 +255,19 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
} }
}; };
/**
* 加載訂單詳情
*
* @param orderDetailsBean 訂單詳情
*/
@Override @Override
public void loadOrderDetails(PurchaseOrderDetailsBean orderDetailsBean) { public void loadOrderDetails(PurchaseOrderDetailsBean orderDetailsBean) {
//判斷有沒有SN食材,如果沒有,就顯示全選按妞
if (orderDetailsBean.getStatus() == PurchaseOrderDetailsBean.COMPLETE_RECEIVED) {
cbOrderDetailsAllSelected.setVisibility(View.VISIBLE);
} else {
cbOrderDetailsAllSelected.setVisibility(mPresenter.hasSnFood(orderDetailsBean.getPurchaseOrderDetailsInfoVOS()) ? View.GONE : View.VISIBLE);
}
if (TextUtil.isNotEmptyOrNullOrUndefined(orderDetailsBean.getWarehousingRemarks())) { if (TextUtil.isNotEmptyOrNullOrUndefined(orderDetailsBean.getWarehousingRemarks())) {
edRemark.setText(orderDetailsBean.getWarehousingRemarks()); edRemark.setText(orderDetailsBean.getWarehousingRemarks());
} }
...@@ -302,6 +318,9 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr ...@@ -302,6 +318,9 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
}); });
} }
/**
* 全選,以前的需求,全選時要一個一個遍歷,掃SN碼的就彈窗,掃完一個又彈下一個
*/
private void checkAllForEach() { private void checkAllForEach() {
int itemCount = orderDetailsFoodAdapter.getItemCount(); int itemCount = orderDetailsFoodAdapter.getItemCount();
if (currentFoodIndex >= itemCount) { if (currentFoodIndex >= itemCount) {
...@@ -309,6 +328,12 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr ...@@ -309,6 +328,12 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
cbOrderDetailsAllSelected.setChecked(typesOfFood == itemCount); cbOrderDetailsAllSelected.setChecked(typesOfFood == itemCount);
setTypesOfFood(); setTypesOfFood();
} }
if (mPresenter.orderState == PurchaseOrderDetailsBean.COMPLETE_RECEIVED) {
//全部收貨的全選
for (PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean datum : orderDetailsFoodAdapter.getData()) {
selectFood(datum);
}
} else {
for (int i = currentFoodIndex; i < itemCount; i++) { for (int i = currentFoodIndex; i < itemCount; i++) {
PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean datum = orderDetailsFoodAdapter.getItem(i); PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean datum = orderDetailsFoodAdapter.getItem(i);
// 如果是sn,判斷這個食品是否已選中,並且本次狀態要為選中 // 如果是sn,判斷這個食品是否已選中,並且本次狀態要為選中
...@@ -318,7 +343,7 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr ...@@ -318,7 +343,7 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
if (datum.getFoodMarkSn() == PurchaseFoodBean.HAS_SN && checkState && datum.getStatus() != PurchaseOrderDetailsBean.COMPLETE_RECEIVED) { if (datum.getFoodMarkSn() == PurchaseFoodBean.HAS_SN && checkState && datum.getStatus() != PurchaseOrderDetailsBean.COMPLETE_RECEIVED) {
DeputyUnitBean showUnit = datum.getShowUnit(); DeputyUnitBean showUnit = datum.getShowUnit();
int newSnCodeSize = mPresenter.getNewSnCodeSize(datum.getPurchaseFoodEncodeSns()); int newSnCodeSize = mPresenter.getNewSnCodeSize(datum.getPurchaseFoodEncodeSns());
if(showUnit.getDeputyValue() != newSnCodeSize){ if (showUnit.getDeputyValue() != newSnCodeSize) {
isNeedQuerySn(orderDetailsFoodAdapter.getItemPosition(datum), datum, false); isNeedQuerySn(orderDetailsFoodAdapter.getItemPosition(datum), datum, false);
currentFoodIndex = i; currentFoodIndex = i;
} else { } else {
...@@ -332,6 +357,7 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr ...@@ -332,6 +357,7 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
} }
} }
} }
}
private void selectFood(PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean datum) { private void selectFood(PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean datum) {
datum.setChecked(checkState); datum.setChecked(checkState);
...@@ -506,14 +532,14 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr ...@@ -506,14 +532,14 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
} }
} }
}) })
.setMinCodeSize((int) infoVosBean.getShowUnit().getDeputyValue()) // .setMinCodeSize((int) infoVosBean.getShowUnit().getDeputyValue())
.setOnScanResultListener((popup, scanResult) -> { .setOnScanResultListener((popup, scanResult) -> {
//當前食材infoVosBean裡面有個sn碼集合,將scanResult添加進去 //當前食材infoVosBean裡面有個sn碼集合,將scanResult添加進去
if (scanResult != null && scanResult.size() > 0) { if (scanResult != null && scanResult.size() > 0) {
//过滤出新增的 //过滤出新增的
List<PurchaseFoodEncodeSn> newAddSnCodes = new ArrayList<>(scanResult.size()); List<PurchaseFoodEncodeSn> newAddSnCodes = new ArrayList<>(scanResult.size());
for (PurchaseFoodEncodeSn purchaseFoodEncodeSn : scanResult) { for (PurchaseFoodEncodeSn purchaseFoodEncodeSn : scanResult) {
if (purchaseFoodEncodeSn.newAdd) { if (foodEncodeSns == null || (purchaseFoodEncodeSn.newAdd && !foodEncodeSns.contains(purchaseFoodEncodeSn))) {
//判斷這個snCode是不是已經收過貨了,沒收過貨,新增的就為true //判斷這個snCode是不是已經收過貨了,沒收過貨,新增的就為true
PurchaseFoodEncodeSn newSnCodeBean = new PurchaseFoodEncodeSn(); PurchaseFoodEncodeSn newSnCodeBean = new PurchaseFoodEncodeSn();
newSnCodeBean.setEncodeFoodNo(infoVosBean.getFoodNo()); newSnCodeBean.setEncodeFoodNo(infoVosBean.getFoodNo());
...@@ -549,10 +575,11 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr ...@@ -549,10 +575,11 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
} }
//本次收貨數量=新增掃sn碼數量 //本次收貨數量=新增掃sn碼數量
DeputyUnitBean showUnit = infoVosBean.getShowUnit(); DeputyUnitBean showUnit = infoVosBean.getShowUnit();
if (newAddSize != showUnit.getDeputyValue()) {
showMessage("新增SN数量必须和入库数一致"); // if (newAddSize != showUnit.getDeputyValue()) {
return; // showMessage("新增SN数量必须和入库数一致");
} // return;
// }
showUnit.setDeputyValue(newAddSize); showUnit.setDeputyValue(newAddSize);
setFoodCheckState(orderDetailsFoodAdapter, position, infoVosBean); setFoodCheckState(orderDetailsFoodAdapter, position, infoVosBean);
popup.dismiss(); popup.dismiss();
......
...@@ -151,6 +151,7 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres ...@@ -151,6 +151,7 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres
if (foodListVosBean.isChecked()) { if (foodListVosBean.isChecked()) {
totalSpecies = MoneyUtil.sub(totalSpecies, 1); totalSpecies = MoneyUtil.sub(totalSpecies, 1);
totalAmount = MoneyUtil.sub(totalAmount, MoneyUtil.priceCalculation(foodListVosBean.getUnitPrice(), foodListVosBean.getFoodQuantity())); totalAmount = MoneyUtil.sub(totalAmount, MoneyUtil.priceCalculation(foodListVosBean.getUnitPrice(), foodListVosBean.getFoodQuantity()));
totalAmount = MoneyUtil.sub(totalAmount, foodListVosBean.getShipping());
setTotalInfo(totalSpecies, totalAmount); setTotalInfo(totalSpecies, totalAmount);
} }
} }
......
...@@ -249,7 +249,11 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD ...@@ -249,7 +249,11 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
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); WarehouseDetailsBean item = wareHousingDetailsAdapter.getItem(position);
//查詢消耗,收貨Sn碼詳情 //查詢消耗,收貨Sn碼詳情
if (vpWarehouseViewpager.getCurrentItem() == WAREHOUSE_TYPE) {
mPresenter.querySnCodeList(vpWarehouseViewpager.getCurrentItem(), item.getFoodQuantity(), "", item.getWarehousingOrderDetailsIds()); mPresenter.querySnCodeList(vpWarehouseViewpager.getCurrentItem(), item.getFoodQuantity(), "", item.getWarehousingOrderDetailsIds());
} else {
mPresenter.querySnCodeList(vpWarehouseViewpager.getCurrentItem(), item.getFoodQuantity(), "", item.getPurchaseConsumeNoId());
}
} }
} }
}); });
...@@ -439,6 +443,7 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD ...@@ -439,6 +443,7 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
public void showList(int visible) { public void showList(int visible) {
vpWarehouseViewpager.setVisibility(visible); vpWarehouseViewpager.setVisibility(visible);
layoutTitle.setVisibility(visible); layoutTitle.setVisibility(visible);
loadService.showSuccess();
if (visible == View.VISIBLE) { if (visible == View.VISIBLE) {
removeInventoryView(); removeInventoryView();
} else { } else {
......
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;
}
}
...@@ -47,9 +47,9 @@ public class ScanSnPopup extends BottomPopupView { ...@@ -47,9 +47,9 @@ public class ScanSnPopup extends BottomPopupView {
*/ */
private int maxCodeSize = -1; private int maxCodeSize = -1;
/** /**
* 最少掃碼數量 * 最少掃碼數量,-1不判斷
*/ */
private int minCodeSize = 0; private int minCodeSize = -1;
public ScanSnPopup(@NonNull Fragment fragment, String foodName, List<PurchaseFoodEncodeSn> purchaseFoodEncodeSns, boolean operable) { public ScanSnPopup(@NonNull Fragment fragment, String foodName, List<PurchaseFoodEncodeSn> purchaseFoodEncodeSns, boolean operable) {
super(fragment.requireContext()); super(fragment.requireContext());
......
...@@ -87,7 +87,7 @@ public class ScanSnView extends FrameLayout { ...@@ -87,7 +87,7 @@ public class ScanSnView extends FrameLayout {
/** /**
* 最少掃碼數量 * 最少掃碼數量
*/ */
private int minCodeSize = 0; private int minCodeSize = -1;
public ScanSnView(Fragment fragment, List<PurchaseFoodEncodeSn> purchaseFoodEncodeSns, ScanSnPopup.OnScanResultListener onScanResultListener) { public ScanSnView(Fragment fragment, List<PurchaseFoodEncodeSn> purchaseFoodEncodeSns, ScanSnPopup.OnScanResultListener onScanResultListener) {
super(fragment.requireContext()); super(fragment.requireContext());
...@@ -97,7 +97,7 @@ public class ScanSnView extends FrameLayout { ...@@ -97,7 +97,7 @@ public class ScanSnView extends FrameLayout {
this.purchaseFoodEncodeSns = purchaseFoodEncodeSns; this.purchaseFoodEncodeSns = purchaseFoodEncodeSns;
} }
initCodeSize = this.purchaseFoodEncodeSns.size(); initCodeSize = this.purchaseFoodEncodeSns.size();
for (PurchaseFoodEncodeSn purchaseFoodEncodeSn : purchaseFoodEncodeSns) { for (PurchaseFoodEncodeSn purchaseFoodEncodeSn : this.purchaseFoodEncodeSns) {
if (purchaseFoodEncodeSn.newAdd) { if (purchaseFoodEncodeSn.newAdd) {
newCodeSize++; newCodeSize++;
} }
...@@ -197,7 +197,7 @@ public class ScanSnView extends FrameLayout { ...@@ -197,7 +197,7 @@ public class ScanSnView extends FrameLayout {
} }
public void setConfirmBtnState() { public void setConfirmBtnState() {
if (minCodeSize > 0 && newCodeSize == minCodeSize) { if (minCodeSize == -1 || newCodeSize == minCodeSize) {
btnFoodIngredientsConfirm.setBackground(ContextCompat.getDrawable(getContext(), R.drawable.shape_app_btn)); btnFoodIngredientsConfirm.setBackground(ContextCompat.getDrawable(getContext(), R.drawable.shape_app_btn));
} else { } else {
btnFoodIngredientsConfirm.setBackground(ContextCompat.getDrawable(getContext(), R.drawable.shape_btn_unclick)); btnFoodIngredientsConfirm.setBackground(ContextCompat.getDrawable(getContext(), R.drawable.shape_btn_unclick));
...@@ -206,12 +206,14 @@ public class ScanSnView extends FrameLayout { ...@@ -206,12 +206,14 @@ public class ScanSnView extends FrameLayout {
private void commitSnCode(SnCodeAdapter adapter) { private void commitSnCode(SnCodeAdapter adapter) {
if (TextUtil.isNotEmptyOrNullOrUndefined(edInputSn)) { if (TextUtil.isNotEmptyOrNullOrUndefined(edInputSn)) {
if (adapter.getData().contains(edInputSn.getText().toString())) {
ToastUtils.show(getContext(), "商品已存在,不能重複添加");
} else {
String snCode = edInputSn.getText().toString(); String snCode = edInputSn.getText().toString();
addSnCode(adapter, snCode); for (PurchaseFoodEncodeSn datum : adapter.getData()) {
if (datum.getEncodeSnNo().equals(snCode)) {
ToastUtils.show(getContext(), "商品已存在,不能重複添加");
return;
}
} }
addSnCode(adapter, snCode);
} else { } else {
ToastUtils.show(getContext(), "請輸入SN碼"); ToastUtils.show(getContext(), "請輸入SN碼");
} }
......
...@@ -15,7 +15,7 @@ import androidx.recyclerview.widget.LinearLayoutManager; ...@@ -15,7 +15,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager; import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import com.chad.library.adapter.base.viewholder.BaseViewHolder; import com.gingersoft.supply_chain.mvp.ui.adapter.BaseViewHolder;
import com.gingersoft.supply_chain.mvp.ui.adapter.GroupedRecyclerViewAdapter; import com.gingersoft.supply_chain.mvp.ui.adapter.GroupedRecyclerViewAdapter;
import java.lang.reflect.Method; import java.lang.reflect.Method;
...@@ -85,16 +85,16 @@ public class StickyHeaderLayout extends FrameLayout { ...@@ -85,16 +85,16 @@ public class StickyHeaderLayout extends FrameLayout {
* 添加滚动监听 * 添加滚动监听
*/ */
private void addOnScrollListener() { private void addOnScrollListener() {
if (isSticky) {
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override @Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) { public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
// 在滚动的时候,需要不断的更新吸顶布局。 // 在滚动的时候,需要不断的更新吸顶布局。
if (isSticky) {
updateStickyView(false); updateStickyView(false);
} }
}
}); });
} }
}
/** /**
* 添加吸顶容器 * 添加吸顶容器
...@@ -173,7 +173,7 @@ public class StickyHeaderLayout extends FrameLayout { ...@@ -173,7 +173,7 @@ public class StickyHeaderLayout extends FrameLayout {
} }
} }
if (mRecyclerView.computeVerticalScrollOffset() == 0){ if (mRecyclerView.computeVerticalScrollOffset() == 0) {
// 滑动到顶部 // 滑动到顶部
recycle(); recycle();
} }
...@@ -249,6 +249,13 @@ public class StickyHeaderLayout extends FrameLayout { ...@@ -249,6 +249,13 @@ public class StickyHeaderLayout extends FrameLayout {
return null; return null;
} }
/***
* @return 當前吸頂的view下標
*/
public int getCurrentStickyGroup() {
return mCurrentStickyGroup;
}
/** /**
* 回收并移除吸顶布局 * 回收并移除吸顶布局
*/ */
...@@ -320,9 +327,10 @@ public class StickyHeaderLayout extends FrameLayout { ...@@ -320,9 +327,10 @@ public class StickyHeaderLayout extends FrameLayout {
private int getMin(int[] arr) { private int getMin(int[] arr) {
int min = arr[0]; int min = arr[0];
for (int x = 1; x < arr.length; x++) { for (int x = 1; x < arr.length; x++) {
if (arr[x] < min) if (arr[x] < min) {
min = arr[x]; min = arr[x];
} }
}
return min; return min;
} }
......
package com.gingersoft.supply_chain.mvp.utils;
import androidx.core.content.FileProvider;
/**
* @author 宇航.
* User: admin
* Date: 2021/4/2
* Time: 11:15
* Use:
*/
public class PurchaseFileProvider extends FileProvider {
}
...@@ -8,6 +8,7 @@ import android.content.Intent; ...@@ -8,6 +8,7 @@ import android.content.Intent;
import android.database.Cursor; import android.database.Cursor;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Environment;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.provider.OpenableColumns; import android.provider.OpenableColumns;
...@@ -16,6 +17,7 @@ import androidx.fragment.app.Fragment; ...@@ -16,6 +17,7 @@ import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentActivity;
import com.gingersoft.gsa.cloud.common.utils.FileUtils; import com.gingersoft.gsa.cloud.common.utils.FileUtils;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils; import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils;
import com.gingersoft.gsa.cloud.ui.utils.AppDialog; import com.gingersoft.gsa.cloud.ui.utils.AppDialog;
import com.permissionx.guolindev.PermissionX; import com.permissionx.guolindev.PermissionX;
...@@ -45,7 +47,7 @@ public class SelectPicture { ...@@ -45,7 +47,7 @@ public class SelectPicture {
* 當前圖片的絕對路徑 * 當前圖片的絕對路徑
*/ */
// private String currentPhotoPath; // private String currentPhotoPath;
final String[] items = new String[]{"拍照", "從相冊選擇", "取消"}; final String[] items = new String[]{"拍照", "從相冊選擇"};
public static final int CHOOSE_PHOTO = 101; public static final int CHOOSE_PHOTO = 101;
public static final int TAKE_PHOTO = 102; public static final int TAKE_PHOTO = 102;
public static final int PHOTO_CROP = 103; public static final int PHOTO_CROP = 103;
...@@ -164,7 +166,7 @@ public class SelectPicture { ...@@ -164,7 +166,7 @@ public class SelectPicture {
*/ */
public File createImageFile(Context mContext) { public File createImageFile(Context mContext) {
// Create an image file name // Create an image file name
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); String timeStamp = TimeUtils.DEFAULT_DATE_FORMAT_YMDHM.format(new Date());
String imageFileName = "JPEG_" + timeStamp + "_"; String imageFileName = "JPEG_" + timeStamp + "_";
File cacheDir = mContext.getCacheDir(); File cacheDir = mContext.getCacheDir();
File image = null; File image = null;
...@@ -183,6 +185,18 @@ public class SelectPicture { ...@@ -183,6 +185,18 @@ public class SelectPicture {
return image; return image;
} }
/**
* 創建照片保存路徑,然後再進行拍照
*/
public File createImageFile2(Context mContext) {
String image = mContext.getCacheDir() + File.separator + "purchase" + File.separator + "images" + File.separator + System.currentTimeMillis() + ".jpg";
File outputFile = new File(image);
if (!outputFile.exists()) {
outputFile.mkdir();
}
return outputFile;
}
/** /**
* uri轉換為文件路徑,適配android Q * uri轉換為文件路徑,適配android Q
......
...@@ -120,8 +120,7 @@ ...@@ -120,8 +120,7 @@
<!-- 二級分類 --> <!-- 二級分類 -->
<com.google.android.material.appbar.CollapsingToolbarLayout <com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content">
app:layout_scrollFlags="scroll|enterAlways">
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_food_ingredients_second_category" android:id="@+id/rv_food_ingredients_second_category"
...@@ -172,7 +171,17 @@ ...@@ -172,7 +171,17 @@
android:layout_height="match_parent" android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"> app:layout_behavior="@string/appbar_scrolling_view_behavior">
<com.gingersoft.supply_chain.mvp.ui.widget.LoadRefreshHeader
android:id="@+id/fresh_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:srlAccentColor="#aaa"
app:srlTextPulling="@string/str_purchase_loading"
app:srlDrawableArrow="@drawable/brvah_sample_footer_loading"
app:srlPrimaryColor="@color/trans" />
<com.gingersoft.supply_chain.mvp.ui.widget.StickyHeaderLayout <com.gingersoft.supply_chain.mvp.ui.widget.StickyHeaderLayout
android:id="@+id/view_stick_head"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
...@@ -180,7 +189,6 @@ ...@@ -180,7 +189,6 @@
android:id="@+id/rv_food_ingredients" android:id="@+id/rv_food_ingredients"
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_5"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" /> app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</com.gingersoft.supply_chain.mvp.ui.widget.StickyHeaderLayout> </com.gingersoft.supply_chain.mvp.ui.widget.StickyHeaderLayout>
......
...@@ -62,19 +62,19 @@ ...@@ -62,19 +62,19 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_9" android:layout_marginTop="@dimen/dp_9"
tools:text="採購單號:"
android:textColor="@color/color_3c" android:textColor="@color/color_3c"
android:textSize="@dimen/dp_14" /> android:textSize="@dimen/dp_14"
tools:text="採購單號:" />
<TextView <TextView
android:id="@+id/tv_warehouse_order_no" android:id="@+id/tv_warehouse_order_no"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
tools:text="入庫單號:"
android:textColor="@color/color_3c" android:textColor="@color/color_3c"
android:textSize="@dimen/dp_14"
android:visibility="gone" android:visibility="gone"
android:textSize="@dimen/dp_14" /> tools:text="入庫單號:" />
<LinearLayout <LinearLayout
android:id="@+id/layout_ed_remark" android:id="@+id/layout_ed_remark"
...@@ -150,8 +150,8 @@ ...@@ -150,8 +150,8 @@
<HorizontalScrollView <HorizontalScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone" android:layout_marginTop="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_10"> android:visibility="gone">
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_order_details_food_name" android:id="@+id/rv_order_details_food_name"
...@@ -180,18 +180,19 @@ ...@@ -180,18 +180,19 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingRight="@dimen/dp_25"> android:paddingTop="@dimen/dp_5"
android:paddingRight="@dimen/dp_25"
android:paddingBottom="@dimen/dp_5">
<com.google.android.material.checkbox.MaterialCheckBox <com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/cb_order_details_all_selected" android:id="@+id/cb_order_details_all_selected"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_25" android:layout_marginLeft="@dimen/dp_25"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginBottom="@dimen/dp_5"
android:text="全選" android:text="全選"
android:textColor="@color/color_3c" android:textColor="@color/color_3c"
android:textSize="@dimen/dp_14" /> android:textSize="@dimen/dp_14"
android:visibility="gone" />
<TextView <TextView
style="@style/supplier_chain_222_16" style="@style/supplier_chain_222_16"
......
...@@ -3,13 +3,17 @@ ...@@ -3,13 +3,17 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/layout_shopping_cart" android:id="@+id/layout_shopping_cart"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="wrap_content">
<ImageView <ImageView
android:id="@+id/iv_shopping_cart" android:id="@+id/iv_shopping_cart"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/ic_shopping_car" /> android:src="@drawable/ic_shopping_car"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView <TextView
android:id="@+id/tv_purchase_cart_number" android:id="@+id/tv_purchase_cart_number"
...@@ -19,7 +23,8 @@ ...@@ -19,7 +23,8 @@
android:autoSizeMinTextSize="@dimen/dp_4" android:autoSizeMinTextSize="@dimen/dp_4"
android:background="@drawable/ui_shape_red_oval" android:background="@drawable/ui_shape_red_oval"
android:gravity="center" android:gravity="center"
android:text="3" android:includeFontPadding="false"
android:text="0"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="@dimen/dp_6" android:textSize="@dimen/dp_6"
app:layout_constraintRight_toRightOf="@id/iv_shopping_cart" app:layout_constraintRight_toRightOf="@id/iv_shopping_cart"
......
...@@ -35,4 +35,5 @@ ...@@ -35,4 +35,5 @@
<string name="str_device_not_print">您的設備不支持打印</string> <string name="str_device_not_print">您的設備不支持打印</string>
<string name="str_sn_codes">SN嗎:%1$s</string> <string name="str_sn_codes">SN嗎:%1$s</string>
<string name="str_en_num_digits">ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789</string> <string name="str_en_num_digits">ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789</string>
<string name="str_purchase_loading">飛速加載中</string>
</resources> </resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!-- <root-path/> :代表设备的根目录new File("/")
<!-- <root-path/> :代表设备的根目录new File("/")
<files-path/> : 代表context.getFilesDir() <files-path/> : 代表context.getFilesDir()
<cache-path/> : 代表context.getCacheDir() <cache-path/> : 代表context.getCacheDir()
<external-path/> : 代表Environment.getExternalStorageDirectory() <external-path/> : 代表Environment.getExternalStorageDirectory()
...@@ -37,6 +36,12 @@ ...@@ -37,6 +36,12 @@
<paths xmlns:android="http://schemas.android.com/apk/res/android"> <paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path <external-path
name="" name="purchase_images"
path="purchase_image" /> path="purchase" />
<cache-path
name="purchase_images"
path="*" />
<root-path
name="root-path"
path="" />
</paths> </paths>
...@@ -57,43 +57,6 @@ android { ...@@ -57,43 +57,6 @@ android {
} }
} }
////dokit 扩展
//dokitExt {
// //通用设置
// comm {
// //地图经纬度开关
// gpsSwitch true
// //网络开关
// networkSwitch true
// //大图开关
// bigImgSwitch true
// //webView js 抓包
// webViewSwitch true
// }
//
// slowMethod {
// //调用栈模式配置
// stackMethod {
// //默认值为 5ms 小于该值的函数在调用栈中不显示
// thresholdTime 5
// //调用栈函数入口
// enterMethods = ["com.didichuxing.doraemondemo.MainDebugActivity.test1"]
// //黑名单 粒度最小到类 暂不支持到方法
// methodBlacklist = ["com.facebook.drawee.backends.pipeline.Fresco"]
// }
// //普通模式配置
// normalMethod {
// //默认值为 500ms 小于该值的函数在运行时不会在控制台中被打印
// thresholdTime 100
// //需要针对函数插装的包名
// packageNames = ["com.didichuxing.doraemondemo"]
// //不需要针对函数插装的包名和类名
// methodBlacklist = ["com.didichuxing.doraemondemo.dokit"]
// }
// }
//}
dependencies { dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs') implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation files('libs/javabase64-1.2.jar') implementation files('libs/javabase64-1.2.jar')
......
...@@ -48,6 +48,23 @@ public class GlideUtils { ...@@ -48,6 +48,23 @@ public class GlideUtils {
.build()); .build());
} }
public static void display(Context context, ImageView imageView, String url, int placeholder) {
if (imageView == null) {
throw new IllegalArgumentException("argument error");
}
//可以在任何可以拿到 Context 的地方,拿到 AppComponent,从而得到用 Dagger 管理的单例对象
AppComponent mAppComponent = ArmsUtils.obtainAppComponentFromContext(context);
ImageLoader mImageLoader = mAppComponent.imageLoader();//用于加载图片的管理类,默认使用 Glide,使用策略模式,可替换框架
mImageLoader.loadImage(context,
ImageConfigImpl
.builder()
.url(url)
.placeholder(placeholder)
.imageView(imageView)
.build());
}
public static void display(Context context, ImageView imageView, String url, int placeholder, int error, int fallback) { public static void display(Context context, ImageView imageView, String url, int placeholder, int error, int fallback) {
......
package com.gingersoft.gsa.cloud.common.utils.gson; package com.gingersoft.gsa.cloud.common.utils.gson;
import com.alibaba.fastjson.JSONException; import com.alibaba.fastjson.JSONException;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.JsonArray; import com.google.gson.JsonArray;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import com.google.gson.JsonSyntaxException; import com.google.gson.JsonSyntaxException;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
...@@ -116,6 +116,7 @@ public class GsonUtils { ...@@ -116,6 +116,7 @@ public class GsonUtils {
// } // }
// return list; // return list;
// } // }
/** /**
* json字符串转成list * json字符串转成list
* *
...@@ -125,6 +126,7 @@ public class GsonUtils { ...@@ -125,6 +126,7 @@ public class GsonUtils {
public static <T> List<T> jsonToList(Object object, Class<T> cls) { public static <T> List<T> jsonToList(Object object, Class<T> cls) {
return jsonToList(GsonString(object), cls); return jsonToList(GsonString(object), cls);
} }
/** /**
* json字符串转成list * json字符串转成list
* *
...@@ -133,7 +135,9 @@ public class GsonUtils { ...@@ -133,7 +135,9 @@ public class GsonUtils {
*/ */
public static <T> List<T> jsonToList(String json, Class<T> cls) { public static <T> List<T> jsonToList(String json, Class<T> cls) {
ArrayList<T> mList = new ArrayList<>(); ArrayList<T> mList = new ArrayList<>();
if (TextUtil.isEmptyOrNullOrUndefined(json)) {
return null;
}
JsonArray array = new JsonParser().parse(json).getAsJsonArray(); JsonArray array = new JsonParser().parse(json).getAsJsonArray();
for (final JsonElement elem : array) { for (final JsonElement elem : array) {
mList.add(gson.fromJson(elem, cls)); mList.add(gson.fromJson(elem, cls));
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" <androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/layout_category" android:id="@+id/item_layout_root"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:elevation="@dimen/dp_5" android:elevation="@dimen/dp_5"
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
android:paddingBottom="@dimen/dp_5"> android:paddingBottom="@dimen/dp_5">
<TextView <TextView
android:id="@+id/tv_category_name" android:id="@+id/tv_base_item_title"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
......
...@@ -32,17 +32,19 @@ ...@@ -32,17 +32,19 @@
tools:text="果蔬類看書福利卡駕駛的垃圾死了阿斯蘭大家啦款手機愛上了的框架拉三季度阿薩德科技拉屎" /> tools:text="果蔬類看書福利卡駕駛的垃圾死了阿斯蘭大家啦款手機愛上了的框架拉三季度阿薩德科技拉屎" />
<TextView <TextView
android:id="@+id/tv_category_number"
android:layout_width="@dimen/dp_14" android:layout_width="@dimen/dp_14"
android:layout_height="@dimen/dp_14" android:layout_height="@dimen/dp_14"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/dp_5" android:layout_marginLeft="@dimen/dp_2"
android:layout_marginRight="@dimen/dp_2"
android:autoSizeMaxTextSize="@dimen/dp_12" android:autoSizeMaxTextSize="@dimen/dp_12"
android:autoSizeMinTextSize="@dimen/dp_6" android:autoSizeMinTextSize="@dimen/dp_6"
android:background="@drawable/ui_shape_theme_oval" android:background="@drawable/ui_shape_theme_oval"
android:gravity="center" android:gravity="center"
android:includeFontPadding="false"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="@dimen/dp_12" android:textSize="@dimen/dp_12"
android:visibility="gone"
tools:text="6" /> tools:text="6" />
</LinearLayout> </LinearLayout>
......
package com.gingersoft.supply_chain.mvp.ui.adapter; package com.gingersoft.gsa.cloud.ui.adapter;
import android.view.View;
import android.widget.TextView; import android.widget.TextView;
import androidx.cardview.widget.CardView;
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.R; import com.gingersoft.gsa.cloud.ui.R;
import com.gingersoft.gsa.cloud.ui.bean.view.CategoryBean; import com.gingersoft.gsa.cloud.ui.bean.view.CategoryBean;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
...@@ -28,8 +28,8 @@ public class BaseCategoryAdapter extends BaseQuickAdapter<CategoryBean, BaseView ...@@ -28,8 +28,8 @@ public class BaseCategoryAdapter extends BaseQuickAdapter<CategoryBean, BaseView
private int selectedBg; private int selectedBg;
private int unSelectedBg; private int unSelectedBg;
private int selectColor = -1; private int selectColor;
private int unSelectColor = -1; private int unSelectColor;
private boolean showDelete = false; private boolean showDelete = false;
public BaseCategoryAdapter(@Nullable List<CategoryBean> data) { public BaseCategoryAdapter(@Nullable List<CategoryBean> data) {
...@@ -37,27 +37,47 @@ public class BaseCategoryAdapter extends BaseQuickAdapter<CategoryBean, BaseView ...@@ -37,27 +37,47 @@ public class BaseCategoryAdapter extends BaseQuickAdapter<CategoryBean, BaseView
addChildClickViewIds(R.id.iv_category_delete); addChildClickViewIds(R.id.iv_category_delete);
selectedBg = R.drawable.shape_left_radio_shadow; selectedBg = R.drawable.shape_left_radio_shadow;
unSelectedBg = R.color.trans; unSelectedBg = R.color.trans;
selectColor = R.color.s_btn_blue_3c_text;
unSelectColor = R.color.color_ccc;
}
public BaseCategoryAdapter(int layoutRes, @Nullable List<CategoryBean> data) {
super(layoutRes, data);
addChildClickViewIds(R.id.iv_category_delete);
selectedBg = R.drawable.shape_left_radio_shadow;
unSelectedBg = R.color.trans;
selectColor = R.color.s_btn_blue_3c_text;
unSelectColor = R.color.color_ccc;
} }
@Override @Override
protected void convert(@NotNull BaseViewHolder viewHolder, CategoryBean categoryBean) { protected void convert(@NotNull BaseViewHolder viewHolder, CategoryBean categoryBean) {
TextView tvCategoryName = viewHolder.getView(R.id.tv_category_name); viewHolder.setText(R.id.tv_base_item_title, categoryBean.getCategoryName());
tvCategoryName.setText(categoryBean.getCategoryName()); notifyCheckState(viewHolder.getAdapterPosition(), viewHolder.getView(R.id.tv_base_item_title), viewHolder.getView(R.id.item_layout_root));
CardView view = viewHolder.getView(R.id.layout_category); viewHolder.setGone(R.id.iv_category_delete, !showDelete);
if (viewHolder.getAdapterPosition() == selectedIndex) {
view.setBackground(ContextCompat.getDrawable(getContext(), selectedBg));
if (selectColor != -1) {
tvCategoryName.setTextColor(selectColor);
} }
tvCategoryName.setSelected(true);
@Override
public void onBindViewHolder(@NotNull BaseViewHolder holder, int position, @NotNull List<Object> payloads) {
super.onBindViewHolder(holder, position, payloads);
//list为空时,必须调用两个参数的onBindViewHolder(@NonNull LabelHolder holder, int position)
if (payloads.isEmpty()) {
onBindViewHolder(holder, position);
} else { } else {
tvCategoryName.setSelected(false); notifyCheckState(position, holder.getView(R.id.tv_base_item_title), holder.getView(R.id.item_layout_root));
view.setBackground(ContextCompat.getDrawable(getContext(), unSelectedBg));
if (unSelectColor != -1) {
tvCategoryName.setTextColor(unSelectColor);
} }
} }
viewHolder.setGone(R.id.iv_category_delete, !showDelete);
private void notifyCheckState(int position, TextView tvName, View view) {
if (position == selectedIndex) {
view.setBackground(ContextCompat.getDrawable(getContext(), selectedBg));
tvName.setTextColor(selectColor);
tvName.setSelected(true);
} else {
view.setBackground(ContextCompat.getDrawable(getContext(), unSelectedBg));
tvName.setTextColor(unSelectColor);
tvName.setSelected(false);
}
} }
public void setShowDelete(boolean showDelete) { public void setShowDelete(boolean showDelete) {
...@@ -85,9 +105,10 @@ public class BaseCategoryAdapter extends BaseQuickAdapter<CategoryBean, BaseView ...@@ -85,9 +105,10 @@ public class BaseCategoryAdapter extends BaseQuickAdapter<CategoryBean, BaseView
return this; return this;
} }
public void setSelectedIndex(int selectedIndex) { public BaseCategoryAdapter setSelectedIndex(int selectedIndex) {
this.selectedIndex = selectedIndex; this.selectedIndex = selectedIndex;
notifyDataSetChanged(); notifyDataSetChanged();
return this;
} }
public int getSelectedIndex() { public int getSelectedIndex() {
......
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