Commit 66986a96 by 张建升

增加預計時間 XX小時之後

parent 6b99bb52
......@@ -35,6 +35,10 @@ public class SupplierInfoBean implements Serializable {
private long createTime;
private long updateTime;
private Integer deletes;
/****
* 預計发货时间
* */
private double deliveryTime;
/**
* 最低採購
*/
......
package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.constans.AppConstant;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.mvp.bean.PurchaseOrderDetailsBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseOrderResultBean;
import com.gingersoft.supply_chain.mvp.contract.PurchaseListContract;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.RxLifecycleUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.inject.Inject;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull;
import io.reactivex.schedulers.Schedulers;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
/**
* Description: 菜品食材選擇列表
*/
@FragmentScope
public class FoodListPresenter extends BasePresenter<PurchaseListContract.Model, PurchaseListContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
@Inject
public FoodListPresenter(PurchaseListContract.Model model, PurchaseListContract.View rootView) {
super(model, rootView);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
public void getOrderList(String orderNo, int orderStatus, int pageIndex) {
Map<String, Object> map = new HashMap<>(6);
AppConstant.addRestaurantId(map);
AppConstant.addBrandId(map);
AppConstant.addPageSize(map);
if (TextUtil.isNotEmptyOrNullOrUndefined(orderNo)) {
map.put("orderNo", orderNo);
}
if (orderStatus != 0) {
if (orderStatus == PurchaseOrderDetailsBean.WAIT_RECEIVED) {
//如果是查未完成訂單,需要傳入兩個狀態,未收貨和部分收貨
List<Integer> list = new ArrayList<>();
list.add(PurchaseOrderDetailsBean.WAIT_RECEIVED);
list.add(PurchaseOrderDetailsBean.PART_RECEIVED);
map.put("status", "1,2");
} else {
map.put("status", orderStatus);
}
}
map.put("pageIndex", pageIndex * AppConstant.PAGE_SIZE);
mModel.getOrderList(map)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(AppConstant.GET_INFO_LOADING))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<PurchaseOrderResultBean>(mErrorHandler) {
@Override
public void onNext(@NonNull PurchaseOrderResultBean info) {
if (info.isSuccess()) {
mRootView.loadOrderList(info.getData().getList());
} else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg());
mRootView.loadFail();
} else {
mRootView.loadFail();
}
}
@Override
public void onError(Throwable t) {
super.onError(t);
mRootView.loadError();
}
});
}
/**
* 刪除訂單
*
* @param position 訂單下標
* @param orderId 訂單id
*/
public void deleteOrder(int position, int orderId) {
mModel.deleteOrder(orderId)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(AppConstant.DELETE_LOADING))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(@NonNull BaseResult info) {
if (info.isSuccess()) {
mRootView.deleteOrder(position);
}
}
});
}
}
......@@ -13,6 +13,7 @@ import com.gingersoft.gsa.cloud.common.constans.AppConstant;
import com.gingersoft.gsa.cloud.common.utils.MatchUtils;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.inputFilter.InputFilterUtils;
import com.gingersoft.gsa.cloud.common.utils.log.LogUtil;
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.MultiCheckInputBean;
......@@ -84,15 +85,17 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
public final int lowPurchaseAmount = 7;
//運費
public final int shippingIndex = 8;
//预计时间
public final int expectIndex = 9;
public final int emailIndex = 11;
public final int smsIndex = 16;
public final int remarkIndex = 19;
public final int emailIndex = 12;
public final int smsIndex = 17;
public final int remarkIndex = 20;
public final int WhatsAppIndex = 12;
public final int weChatIndex = 13;
public final int lineIndex = 14;
public final int kakaoIndex = 15;
public final int WhatsAppIndex = 13;
public final int weChatIndex = 14;
public final int lineIndex = 15;
public final int kakaoIndex = 16;
private InfoMultiAdapter infoMultiAdapter;
private SupplierInfoBean supplierBean;
......@@ -155,6 +158,9 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
infoMultiBeans.add(con);
infoMultiBeans.add(price);
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "運費", false, "請輸入運費", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 9)}, EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_FLAG_DECIMAL));
MultiInputBean expect= new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "預計", false, "請輸入預計時間", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 9)}, EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_FLAG_DECIMAL);
expect.setHint("小時後發貨");
infoMultiBeans.add(expect);
infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_LINE));
infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_TITLE, "接收方式"));
......@@ -192,6 +198,7 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
infoMultiBeans.get(remarkIndex).setShowValue(supplierBean.getRemarks());
infoMultiBeans.get(lowPurchaseAmount).setShowValue(supplierBean.getMinimumAmount() + "");
infoMultiBeans.get(shippingIndex).setShowValue(supplierBean.getShipping() + "");
infoMultiBeans.get(expectIndex).setShowValue(supplierBean.getDeliveryTime() + "");
}
infoMultiAdapter = new InfoMultiAdapter(mContext, infoMultiBeans);
infoMultiAdapter.setOnItemChildClickListener((adapter, view, position) -> {
......@@ -544,6 +551,13 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
if (TextUtil.isNotEmptyOrNullOrUndefined(shipping)) {
supplierInfoBean.setShipping(Double.parseDouble(shipping));
}
//預計發貨時間
String expect = infoMultiBeans.get(expectIndex).getShowValue();
LogUtil.e("zjs expect="+expect);
if (TextUtil.isNotEmptyOrNullOrUndefined(expect)) {
supplierInfoBean.setDeliveryTime(Double.parseDouble(expect));
}
//供應商編號如果沒填,就設為空
if (TextUtil.isEmptyOrNullOrUndefined(supplierInfoBean.getSupplierNo())) {
supplierInfoBean.setSupplierNo(null);
......
......@@ -5,7 +5,6 @@ import android.content.Context;
import android.text.Editable;
import android.text.InputFilter;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.CheckBox;
import android.widget.EditText;
......@@ -18,8 +17,8 @@ import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.common.utils.inputFilter.InputFilterUtils;
import com.gingersoft.gsa.cloud.common.utils.log.LogUtil;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.ui.adapter.multi.RemarkProvider;
import com.gingersoft.gsa.cloud.ui.recylcler.decorator.DividerItemDecoration;
import com.gingersoft.gsa.cloud.ui.utils.AnimateUtils;
......@@ -27,7 +26,6 @@ import com.gingersoft.gsa.cloud.ui.utils.AppDialog;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import com.gingersoft.supply_chain.mvp.bean.ShoppingCartBean;
import com.google.android.material.internal.ViewUtils;
import com.google.android.material.textfield.TextInputEditText;
import com.xuexiang.rxutil2.rxjava.RxJavaUtils;
......@@ -62,6 +60,9 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Shop
@Override
protected void convert(@NotNull ViewHolder viewHolder, ShoppingCartBean shoppingCartBean) {
long curTime=System.currentTimeMillis();
LogUtil.e("ZJS","shoppingCartBean.getInitialShippingTime()="+shoppingCartBean.getInitialShippingTime());
viewHolder.setText(R.id.rv_purchase_shopping_estimate_delivery_time, String.format(estimateDeliveryTimeStr, shoppingCartBean.getInitialShippingTime()));
//最低採購金額
setTvMinimumAmount(viewHolder);
......
......@@ -56,6 +56,8 @@ public class WareHousingDetailsAdapter extends BaseQuickAdapter<WarehouseDetails
//出庫,顯示-
setOutStockData(viewHolder, item);
}
//顯示總價
viewHolder.setText(R.id.tv_order_total_price, String.format(getContext().getString(R.string.str_total_amount_colon), item.getTotalPrice()));
//供應商
viewHolder.setText(R.id.tv_warehouse_details_supplier, item.getSupplierName());
//入庫來源
......
......@@ -103,6 +103,7 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi
public final static int ADD_ORDER = 2;
public final static int ORDER_TYPE = 3;
public final static int GET_FOOD_BY_SUPPLIER = 4;
public final static int GET_FOOD_BY_OTHER = 5;
private final static String pageTypeKey = "pageType";
......
......@@ -49,6 +49,7 @@
<include layout="@layout/include_horizontal_color_eee_dividing_line" />
<TextView
tools:visibility="visible"
android:visibility="gone"
android:paddingLeft="@dimen/dp_9"
android:paddingTop="@dimen/dp_9"
......@@ -58,6 +59,16 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
tools:visibility="visible"
android:paddingLeft="@dimen/dp_9"
android:paddingTop="@dimen/dp_9"
android:paddingBottom="@dimen/dp_4"
android:id="@+id/tv_order_total_price"
android:text="@string/str_total_amount_colon"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
......@@ -99,6 +99,5 @@
<string name="str_food_info_get_error">食材信息獲取失敗,請稍候重試</string>
<string name="str_order_del_contact_supplier">訂單已刪除,請打電話聯繫供應商訂單刪除!</string>
<string name="str_order_num">单号:%1$s</string>
<string name="str_order_num">單號:%1$s</string>
</resources>
\ No newline at end of file
......@@ -21,6 +21,7 @@ public class MultiInputBean extends InfoMultiBean {
private int inputType = EditorInfo.TYPE_CLASS_TEXT;
private int maxLength = 0;
private TextWatcher textWatcher;
private String hint;
/**
* 是否可以編輯
*/
......@@ -113,6 +114,14 @@ public class MultiInputBean extends InfoMultiBean {
return this;
}
public void setHint(String hint){
this.hint=hint;
}
public String getHint(){
return hint;
}
public boolean isEdit() {
return isEdit;
}
......
package com.gingersoft.gsa.cloud.ui.adapter.multi;
import android.text.Editable;
import android.text.InputFilter;
import android.text.InputType;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import androidx.core.content.ContextCompat;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.ui.R;
import com.gingersoft.gsa.cloud.ui.adapter.bean.InfoMultiBean;
import com.gingersoft.gsa.cloud.ui.adapter.bean.MultiInputBean;
import com.google.android.material.textfield.TextInputEditText;
import org.jetbrains.annotations.NotNull;
......@@ -56,6 +50,15 @@ public class InputProvider<T extends InfoMultiBean> extends MyBaseItemProvider<T
MultiInputBean infoMultiBean = (MultiInputBean) t;
viewHolder.removeTextWatcher();
if (!TextUtils.isEmpty(infoMultiBean.getHint())) {
baseViewHolder.setVisible(R.id.tv_expect,true);
baseViewHolder.setText(R.id.tv_expect,infoMultiBean.getHint());
}else {
baseViewHolder.setGone(R.id.tv_expect,false);
}
EditText editText = baseViewHolder.getView(R.id.ed_multi_value);
if (infoMultiBean.getTextWatcher() != null) {
editText.removeTextChangedListener(infoMultiBean.getTextWatcher());
......
......@@ -28,7 +28,15 @@
android:maxLines="1"
android:minWidth="@dimen/dp_50"
tool:hint="最小數量" />
<TextView
android:id="@+id/tv_expect"
style="@style/Multi_Input_titleStyle"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_5"
android:padding="@dimen/dp_5"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView
android:layout_width="@dimen/dp_25"
android:layout_height="match_parent"
......
......@@ -44,7 +44,15 @@
android:background="@null"
android:imeOptions="actionNext"
tools:hint="請輸入食品組名稱" />
<TextView
android:id="@+id/tv_expect"
style="@style/Multi_Input_titleStyle"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_5"
android:padding="@dimen/dp_5"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/iv_clear_multi_content"
android:layout_width="@dimen/dp_30"
......
......@@ -19,6 +19,16 @@
android:drawablePadding="@dimen/dp_5"
tools:hint="請輸入食品組名稱" />
<TextView
android:id="@+id/tv_expect"
android:text="小時候發貨"
style="@style/Multi_Input_titleStyle"
android:layout_marginLeft="@dimen/dp_10"
android:padding="@dimen/dp_5"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/iv_clear_multi_content"
android:layout_width="@dimen/dp_30"
......@@ -27,4 +37,5 @@
android:padding="@dimen/dp_5"
android:src="@drawable/ic_clear_text"
android:visibility="gone" />
</LinearLayout>
\ No newline at end of file
......@@ -17,7 +17,15 @@
android:layout_width="0dp"
android:layout_height="0dp"
tools:text="" />
<TextView
android:id="@+id/tv_expect"
style="@style/Multi_Input_titleStyle"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_5"
android:padding="@dimen/dp_5"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/input_layout"
android:layout_width="match_parent"
......
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