Commit 890979d5 by 宁斌

Merge branch 'dev' of http://gitlab.ricepon.com/ningbin/GSA-Cloud into dev

 Conflicts:
	component-table/src/main/res/layout/table_dialog_cancel_food.xml
parents ef2056da 94e2feb7
...@@ -372,7 +372,7 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre ...@@ -372,7 +372,7 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre
view.findViewById(R.id.layout_history_order).setOnClickListener(v1 -> { view.findViewById(R.id.layout_history_order).setOnClickListener(v1 -> {
CC.obtainBuilder(com.gingersoft.gsa.cloud.component.ComponentName.COMPONENT_DELIVERYPICK) CC.obtainBuilder(com.gingersoft.gsa.cloud.component.ComponentName.COMPONENT_DELIVERYPICK)
.setActionName("historyActivity") .setActionName("historyActivity")
.addParam(DeliveryPickConstans.ORDER_TYPE, "1") .addParam(DeliveryPickConstans.ORDER_TYPE, DeliveryPickConstans.COLD_CHAIN_TYPE)
.build() .build()
.call(); .call();
pop.dismiss(); pop.dismiss();
......
...@@ -235,7 +235,7 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailsPresenter> im ...@@ -235,7 +235,7 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailsPresenter> im
mTvOrderStatus.setText("待確認訂單"); mTvOrderStatus.setText("待確認訂單");
mTvOrderStatus.setTextColor(ContextCompat.getColor(mContext, R.color.order_state0_color)); mTvOrderStatus.setTextColor(ContextCompat.getColor(mContext, R.color.order_state0_color));
} }
mTvOrderNo.setText(getResources().getString(R.string.order_no) + bean.getORDER_NO()); mTvOrderNo.setText(getResources().getString(R.string.order_no) + bean.getID());
mTvCreateTime.setText(getResources().getString(R.string.create_order_time) + TimeUtils.parseTimeRepeat(bean.getCREATE_TIME(), TimeUtils.DEFAULT_DATE_FORMAT)); mTvCreateTime.setText(getResources().getString(R.string.create_order_time) + TimeUtils.parseTimeRepeat(bean.getCREATE_TIME(), TimeUtils.DEFAULT_DATE_FORMAT));
if (TextUtil.isNotEmptyOrNullOrUndefined(bean.getRECEIVER())) { if (TextUtil.isNotEmptyOrNullOrUndefined(bean.getRECEIVER())) {
mTvReceiver.setText(bean.getRECEIVER()); mTvReceiver.setText(bean.getRECEIVER());
......
...@@ -26,7 +26,7 @@ public class OrderListAdapter extends BaseQuickAdapter<OrderList.DataBeanX.DataB ...@@ -26,7 +26,7 @@ public class OrderListAdapter extends BaseQuickAdapter<OrderList.DataBeanX.DataB
public OrderListAdapter(@Nullable List<OrderList.DataBeanX.DataBean> data) { public OrderListAdapter(@Nullable List<OrderList.DataBeanX.DataBean> data) {
super(R.layout.cold_chain_order_item2, data); super(R.layout.cold_chain_order_item, data);
} }
...@@ -48,7 +48,7 @@ public class OrderListAdapter extends BaseQuickAdapter<OrderList.DataBeanX.DataB ...@@ -48,7 +48,7 @@ public class OrderListAdapter extends BaseQuickAdapter<OrderList.DataBeanX.DataB
baseViewHolder.setText(R.id.tv_address, "地址:" + dataBean.getADDRESS_DETAIL()); baseViewHolder.setText(R.id.tv_address, "地址:" + dataBean.getADDRESS_DETAIL());
baseViewHolder.setText(R.id.tv_delivery_state, getStatus(dataBean.getCurStat())); baseViewHolder.setText(R.id.tv_delivery_state, getStatus(dataBean.getCurStat()));
baseViewHolder.setText(R.id.tv_order_amount, "$" + dataBean.getPAY_AMOUNT()); baseViewHolder.setText(R.id.tv_order_amount, "$" + dataBean.getPAY_AMOUNT());
baseViewHolder.setText(R.id.tv_order_code, String.format(getContext().getString(R.string.str_order_code), dataBean.getTakeFoodCode()));
if (dataBean.getIsRead() == 0) { if (dataBean.getIsRead() == 0) {
baseViewHolder.setVisible(R.id.fl_border, true); baseViewHolder.setVisible(R.id.fl_border, true);
alphaAnimator(baseViewHolder.getView(R.id.fl_border)); alphaAnimator(baseViewHolder.getView(R.id.fl_border));
......
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="@dimen/other_order_info_dialog_content_marginLeft" android:layout_margin="@dimen/other_order_info_dialog_content_marginLeft"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
tools:text="訂單號:" /> tools:text="訂單號:" />
<TextView <TextView
android:id="@+id/tv_create_time" android:id="@+id/tv_create_time"
...@@ -149,7 +149,7 @@ ...@@ -149,7 +149,7 @@
style="@style/otherOrderReceiving_title_textStyle" style="@style/otherOrderReceiving_title_textStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="訂單:" /> android:text="訂單:" />
<TextView <TextView
android:id="@+id/tv_bill_num" android:id="@+id/tv_bill_num"
......
...@@ -73,21 +73,33 @@ ...@@ -73,21 +73,33 @@
app:layout_constraintRight_toLeftOf="@id/tv_order_state" app:layout_constraintRight_toLeftOf="@id/tv_order_state"
app:layout_constraintTop_toBottomOf="@id/tv_pay_method" app:layout_constraintTop_toBottomOf="@id/tv_pay_method"
app:layout_constraintTop_toTopOf="@id/tv_order_state" app:layout_constraintTop_toTopOf="@id/tv_order_state"
tools:text="用戶名+手機號(1234567862)安居房三級分類誰的簡歷福克斯就"
tools:textColor="@color/theme_333_color" />
<TextView
android:id="@+id/tv_order_code"
android:layout_width="0dp"
android:layout_height="match_parent"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@color/theme_text_color"
android:textSize="@dimen/sp_14"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/tv_order_state"
app:layout_constraintTop_toBottomOf="@id/tv_order_user_name"
tools:text="用戶名+手機號(1234567862)" tools:text="用戶名+手機號(1234567862)"
tools:textColor="@color/theme_333_color" /> tools:textColor="@color/theme_333_color" />
<TextView <TextView
android:id="@+id/tv_address" android:id="@+id/tv_address"
style="@style/order_item_info_textStyle" style="@style/order_item_info_textStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_15"
android:layout_marginRight="@dimen/dp_10" android:layout_marginRight="@dimen/dp_10"
android:textColor="@color/color_3c" android:textColor="@color/color_3c"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/tv_order_amount" app:layout_constraintRight_toLeftOf="@id/tv_order_amount"
app:layout_constraintTop_toBottomOf="@id/tv_order_user_name" app:layout_constraintTop_toBottomOf="@id/tv_order_code"
app:layout_constraintVertical_bias="1" app:layout_constraintVertical_bias="1"
tools:text="用戶收貨地址" tools:text="用戶收貨地址"
tools:textColor="#868686" /> tools:textColor="#868686" />
......
...@@ -7,17 +7,17 @@ ...@@ -7,17 +7,17 @@
android:background="@color/white" android:background="@color/white"
android:orientation="vertical"> android:orientation="vertical">
<androidx.coordinatorlayout.widget.CoordinatorLayout <androidx.cardview.widget.CardView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/color_f0" android:background="@color/color_f0"
app:cardElevation="@dimen/dp_2"
tools:context=".ui.activity.DeliveryOrderMainActivity"> tools:context=".ui.activity.DeliveryOrderMainActivity">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/white" android:background="@color/white">
app:elevation="@dimen/dp_0">
<com.qmuiteam.qmui.widget.QMUITopBar <com.qmuiteam.qmui.widget.QMUITopBar
android:id="@+id/coldchain_main_top_bar" android:id="@+id/coldchain_main_top_bar"
...@@ -198,11 +198,10 @@ ...@@ -198,11 +198,10 @@
android:padding="@dimen/dp_10" android:padding="@dimen/dp_10"
android:text="餘額:" android:text="餘額:"
android:textColor="@color/theme_333_color" android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_16" android:textSize="@dimen/dp_16" />
android:visibility="gone" />
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.cardview.widget.CardView>
<androidx.viewpager.widget.ViewPager <androidx.viewpager.widget.ViewPager
android:id="@+id/view_pager" android:id="@+id/view_pager"
......
<resources> <resources>
<string name="cold_chain_name">凍鏈</string> <string name="cold_chain_name">凍鏈</string>
<string name="str_order_code">訂單碼:%1$s</string>
</resources> </resources>
...@@ -6,6 +6,7 @@ import androidx.lifecycle.MutableLiveData ...@@ -6,6 +6,7 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import com.billy.cc.core.component.CC import com.billy.cc.core.component.CC
import com.gingersoft.gsa.cloud.common.constans.DeliveryPickConstans
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.time.TimeUtils 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
...@@ -26,8 +27,8 @@ class HistoryOrderViewModel(private val historyOrderRepository: HistoryOrderRepo ...@@ -26,8 +27,8 @@ class HistoryOrderViewModel(private val historyOrderRepository: HistoryOrderRepo
var historyEndTime = MutableLiveData<String>(TimeUtils.getOldDate(0)) //查詢結束時間 var historyEndTime = MutableLiveData<String>(TimeUtils.getOldDate(0)) //查詢結束時間
var status = MutableLiveData("4") //按類型查詢 var status = MutableLiveData("4") //按類型查詢
var searchValue = MutableLiveData("")//按搜索內容查詢 var searchValue = MutableLiveData("")//按搜索內容查詢
var orderType = "2,7" //訂單類型 2 線上外賣訂單,7 自取訂單 var orderType = DeliveryPickConstans.DELIVERY_TYPE //訂單類型 2 線上外賣訂單,7 自取訂單
var orderFrom = 0 //訂單來源 8 冷鏈用 var orderFrom = 0 //訂單來源
fun getHistoryOrderList(pageIndex: String, orderNum: String = "", startDate: String, endDate: String, status: String) { fun getHistoryOrderList(pageIndex: String, orderNum: String = "", startDate: String, endDate: String, status: String) {
launch({ launch({
......
...@@ -25,6 +25,8 @@ public class BillItemView extends LinearLayout { ...@@ -25,6 +25,8 @@ public class BillItemView extends LinearLayout {
public BillItemView(Context context, List<PrintBillItem> data) { public BillItemView(Context context, List<PrintBillItem> data) {
super(context); super(context);
this.data = data; this.data = data;
setOrientation(LinearLayout.VERTICAL);
init();
} }
private void init() { private void init() {
......
...@@ -24,6 +24,7 @@ public class BillTypeView extends LinearLayout { ...@@ -24,6 +24,7 @@ public class BillTypeView extends LinearLayout {
public BillTypeView(Context context, List<PrintBillItem> data) { public BillTypeView(Context context, List<PrintBillItem> data) {
super(context); super(context);
this.data = data; this.data = data;
setOrientation(LinearLayout.VERTICAL);
init(); init();
} }
......
...@@ -25,6 +25,7 @@ public class BillView extends LinearLayout { ...@@ -25,6 +25,7 @@ public class BillView extends LinearLayout {
public BillView(Context context, List<BillingBean> data) { public BillView(Context context, List<BillingBean> data) {
super(context); super(context);
this.data = data; this.data = data;
setOrientation(LinearLayout.VERTICAL);
init(); init();
} }
......
...@@ -34,6 +34,7 @@ public class PrintFoodView extends LinearLayout { ...@@ -34,6 +34,7 @@ public class PrintFoodView extends LinearLayout {
super(context); super(context);
this.showPrice = showPrice; this.showPrice = showPrice;
this.data = data; this.data = data;
setOrientation(LinearLayout.VERTICAL);
init(deviceBean); init(deviceBean);
} }
......
...@@ -27,6 +27,7 @@ public class BasicUnitBean { ...@@ -27,6 +27,7 @@ public class BasicUnitBean {
private long createTime; private long createTime;
private long updateTime; private long updateTime;
private int updateUid; private int updateUid;
private Integer id;
public BasicUnitBean() { public BasicUnitBean() {
} }
......
...@@ -25,6 +25,10 @@ public class PurchaseFoodBean implements Serializable { ...@@ -25,6 +25,10 @@ public class PurchaseFoodBean implements Serializable {
public static final String CATEGORY_DIVIDER = "-"; public static final String CATEGORY_DIVIDER = "-";
private Integer id; private Integer id;
private String supplierName; private String supplierName;
/**
* 運費
*/
private double shipping;
private String images; private String images;
private String foodNo; private String foodNo;
private String name; private String name;
......
...@@ -35,7 +35,15 @@ public class SupplierInfoBean implements Serializable { ...@@ -35,7 +35,15 @@ public class SupplierInfoBean implements Serializable {
private long createTime; private long createTime;
private long updateTime; private long updateTime;
private Integer deletes; private Integer deletes;
/**
* 最低採購
*/
private double minimumAmount; private double minimumAmount;
/**
* 運費
*/
private double shipping;
private List<SupplierContacts> supplierContacts; private List<SupplierContacts> supplierContacts;
......
...@@ -40,6 +40,8 @@ public interface FoodUnitPageContract { ...@@ -40,6 +40,8 @@ public interface FoodUnitPageContract {
void callBackDeputyUnit(List<DeputyUnitBean> deputyUnitBeans); void callBackDeputyUnit(List<DeputyUnitBean> deputyUnitBeans);
void deleteDeputyUnit(int position); void deleteDeputyUnit(int position);
void deleteUnitKey(int position);
} }
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存 //Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
...@@ -69,5 +71,7 @@ public interface FoodUnitPageContract { ...@@ -69,5 +71,7 @@ public interface FoodUnitPageContract {
* @return * @return
*/ */
Observable<BaseResult> addBasicUnit(RequestBody requestBody); Observable<BaseResult> addBasicUnit(RequestBody requestBody);
Observable<BaseResult> deleteUnitKey(int id);
} }
} }
...@@ -4,6 +4,8 @@ import com.gingersoft.gsa.cloud.common.bean.BaseResult; ...@@ -4,6 +4,8 @@ import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.jess.arms.mvp.IView; import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel; import com.jess.arms.mvp.IModel;
import java.util.Map;
import io.reactivex.Observable; import io.reactivex.Observable;
import okhttp3.RequestBody; import okhttp3.RequestBody;
...@@ -24,6 +26,8 @@ public interface WarehousingInventoryContract { ...@@ -24,6 +26,8 @@ public interface WarehousingInventoryContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息 //对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView { interface View extends IView {
void updateSuccess(); void updateSuccess();
void loadRecord();
} }
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存 //Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
...@@ -35,5 +39,13 @@ public interface WarehousingInventoryContract { ...@@ -35,5 +39,13 @@ public interface WarehousingInventoryContract {
* @return * @return
*/ */
Observable<BaseResult> consumeWareHousing(RequestBody requestBody); Observable<BaseResult> consumeWareHousing(RequestBody requestBody);
/**
* 獲取庫存消耗記錄
*
* @param map
* @return
*/
Observable<BaseResult> getWarehousingRecord(Map<String, Object> map);
} }
} }
...@@ -68,4 +68,10 @@ public class FoodUnitPageModel extends BaseModel implements FoodUnitPageContract ...@@ -68,4 +68,10 @@ public class FoodUnitPageModel extends BaseModel implements FoodUnitPageContract
public Observable<BaseResult> addBasicUnit(RequestBody requestBody) { public Observable<BaseResult> addBasicUnit(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).addDeputyUnitInput(requestBody); return mRepositoryManager.obtainRetrofitService(SupplierServer.class).addDeputyUnitInput(requestBody);
} }
@Override
public Observable<BaseResult> deleteUnitKey(int id) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).deleteUnitKey(id);
}
} }
\ No newline at end of file
...@@ -14,6 +14,8 @@ import javax.inject.Inject; ...@@ -14,6 +14,8 @@ import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.WarehousingInventoryContract; import com.gingersoft.supply_chain.mvp.contract.WarehousingInventoryContract;
import java.util.Map;
import io.reactivex.Observable; import io.reactivex.Observable;
import okhttp3.RequestBody; import okhttp3.RequestBody;
...@@ -53,4 +55,9 @@ public class WarehousingInventoryModel extends BaseModel implements WarehousingI ...@@ -53,4 +55,9 @@ public class WarehousingInventoryModel extends BaseModel implements WarehousingI
public Observable<BaseResult> consumeWareHousing(RequestBody requestBody) { public Observable<BaseResult> consumeWareHousing(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).consumeWareHousing(requestBody); return mRepositoryManager.obtainRetrofitService(SupplierServer.class).consumeWareHousing(requestBody);
} }
@Override
public Observable<BaseResult> getWarehousingRecord(Map<String, Object> map) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).getWarehousingRecord(map);
}
} }
\ No newline at end of file
...@@ -148,6 +148,10 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo ...@@ -148,6 +148,10 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo
}); });
} }
/**
* 新增基本單位
* @param data
*/
public void addDeputyUnit(List<DeputyUnitBean> data) { public void addDeputyUnit(List<DeputyUnitBean> data) {
//新增為false,修改為true //新增為false,修改為true
if (isUpdate) { if (isUpdate) {
...@@ -280,7 +284,8 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo ...@@ -280,7 +284,8 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo
@Override @Override
public void onNext(BaseResult baseResult) { public void onNext(BaseResult baseResult) {
if (baseResult.isSuccess()) { if (baseResult.isSuccess()) {
mRootView.addBasicUnit(new BasicUnitBean(content)); BasicUnitBean basicUnitBean = GsonUtils.GsonToBean(baseResult.getData(), BasicUnitBean.class);
mRootView.addBasicUnit(basicUnitBean);
} else if (TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) { } else if (TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg()); mRootView.showMessage(baseResult.getErrMsg());
} else { } else {
...@@ -290,4 +295,30 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo ...@@ -290,4 +295,30 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo
}); });
} }
/**
* 刪除基本單位快捷輸入的
* @param id 單位id
* @param position 單位下標,刪除成功後本地刷新
*/
public void deleteUnitKey(int id, int position){
mModel.deleteUnitKey(id)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.SAVE_LOADING))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(BaseResult baseResult) {
if (baseResult.isSuccess()) {
mRootView.deleteUnitKey(position);
} else if (TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg());
} else {
mRootView.showMessage(GET_INFO_ERROR);
}
}
});
}
} }
...@@ -88,14 +88,17 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode ...@@ -88,14 +88,17 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
public final int addressIndex = 5; public final int addressIndex = 5;
public final int telephoneIndex = 6; public final int telephoneIndex = 6;
public final int lowPurchaseAmount = 7; public final int lowPurchaseAmount = 7;
public final int emailIndex = 10; //運費
public final int smsIndex = 15; public final int shippingIndex = 8;
public final int remarkIndex = 18;
public final int WhatsAppIndex = 11; public final int emailIndex = 11;
public final int weChatIndex = 12; public final int smsIndex = 16;
public final int lineIndex = 13; public final int remarkIndex = 19;
public final int kakaoIndex = 14;
public final int WhatsAppIndex = 12;
public final int weChatIndex = 13;
public final int lineIndex = 14;
public final int kakaoIndex = 15;
private InfoMultiAdapter infoMultiAdapter; private InfoMultiAdapter infoMultiAdapter;
private SupplierInfoBean supplierBean; private SupplierInfoBean supplierBean;
...@@ -135,8 +138,8 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode ...@@ -135,8 +138,8 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "聯繫人", true, "請輸入聯繫人", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)})); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "聯繫人", true, "請輸入聯繫人", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "詳細地址", true, "請輸入詳細地址", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)})); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "詳細地址", true, "請輸入詳細地址", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "聯繫人電話", true, "請輸入聯繫人電話", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 11)}, EditorInfo.TYPE_CLASS_PHONE)); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "聯繫人電話", true, "請輸入聯繫人電話", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 11)}, EditorInfo.TYPE_CLASS_PHONE));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "最低採購金額", false, "請輸入最低金額", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 7)}, EditorInfo.TYPE_CLASS_NUMBER)); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "最低採購金額", false, "請輸入最低金額", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 9)}, EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_FLAG_DECIMAL));
// infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "運費", true, "請輸入運費", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 7)}, EditorInfo.TYPE_CLASS_NUMBER)); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "運費", false, "請輸入運費", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 9)}, EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_FLAG_DECIMAL));
infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_LINE)); infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_LINE));
infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_TITLE, "接收方式")); infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_TITLE, "接收方式"));
...@@ -175,6 +178,7 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode ...@@ -175,6 +178,7 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
infoMultiBeans.get(addressIndex).setShowValue(supplierBean.getAddress()); infoMultiBeans.get(addressIndex).setShowValue(supplierBean.getAddress());
infoMultiBeans.get(remarkIndex).setShowValue(supplierBean.getRemarks()); infoMultiBeans.get(remarkIndex).setShowValue(supplierBean.getRemarks());
infoMultiBeans.get(lowPurchaseAmount).setShowValue(supplierBean.getMinimumAmount() + ""); infoMultiBeans.get(lowPurchaseAmount).setShowValue(supplierBean.getMinimumAmount() + "");
infoMultiBeans.get(shippingIndex).setShowValue(supplierBean.getShipping() + "");
} }
infoMultiAdapter = new InfoMultiAdapter(mContext, infoMultiBeans); infoMultiAdapter = new InfoMultiAdapter(mContext, infoMultiBeans);
infoMultiAdapter.setOnItemChildClickListener((adapter, view, position) -> { infoMultiAdapter.setOnItemChildClickListener((adapter, view, position) -> {
...@@ -498,18 +502,31 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode ...@@ -498,18 +502,31 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
if (supplierInfoBean == null) { if (supplierInfoBean == null) {
supplierInfoBean = new SupplierInfoBean(); supplierInfoBean = new SupplierInfoBean();
} }
//供應商編號
supplierInfoBean.setSupplierNo(infoMultiBeans.get(supplierNoIndex).getShowValue()); supplierInfoBean.setSupplierNo(infoMultiBeans.get(supplierNoIndex).getShowValue());
//供應商名稱
supplierInfoBean.setSupplierName(infoMultiBeans.get(supplierNameIndex).getShowValue()); supplierInfoBean.setSupplierName(infoMultiBeans.get(supplierNameIndex).getShowValue());
//聯繫人
supplierInfoBean.setContacts(infoMultiBeans.get(contactsIndex).getShowValue()); supplierInfoBean.setContacts(infoMultiBeans.get(contactsIndex).getShowValue());
//手機號碼
String telephone = infoMultiBeans.get(telephoneIndex).getShowValue(); String telephone = infoMultiBeans.get(telephoneIndex).getShowValue();
supplierInfoBean.setContactInformation(telephone); supplierInfoBean.setContactInformation(telephone);
//地址
supplierInfoBean.setAddress(infoMultiBeans.get(addressIndex).getShowValue()); supplierInfoBean.setAddress(infoMultiBeans.get(addressIndex).getShowValue());
//餐廳信息
supplierInfoBean.setRestaurantId(RestaurantInfoManager.newInstance().getRestaurantId()); supplierInfoBean.setRestaurantId(RestaurantInfoManager.newInstance().getRestaurantId());
supplierInfoBean.setBrandId(RestaurantInfoManager.newInstance().getBrandId()); supplierInfoBean.setBrandId(RestaurantInfoManager.newInstance().getBrandId());
//最低採購金額
String minimumAmount = infoMultiBeans.get(lowPurchaseAmount).getShowValue(); String minimumAmount = infoMultiBeans.get(lowPurchaseAmount).getShowValue();
if (TextUtil.isNotEmptyOrNullOrUndefined(minimumAmount)) { if (TextUtil.isNotEmptyOrNullOrUndefined(minimumAmount)) {
supplierInfoBean.setMinimumAmount(Double.parseDouble(minimumAmount)); supplierInfoBean.setMinimumAmount(Double.parseDouble(minimumAmount));
} }
//運費
String shipping = infoMultiBeans.get(shippingIndex).getShowValue();
if (TextUtil.isNotEmptyOrNullOrUndefined(shipping)) {
supplierInfoBean.setShipping(Double.parseDouble(shipping));
}
//供應商編號如果沒填,就設為空
if (TextUtil.isEmptyOrNullOrUndefined(supplierInfoBean.getSupplierNo())) { if (TextUtil.isEmptyOrNullOrUndefined(supplierInfoBean.getSupplierNo())) {
supplierInfoBean.setSupplierNo(null); supplierInfoBean.setSupplierNo(null);
} }
......
...@@ -108,23 +108,28 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode ...@@ -108,23 +108,28 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
//統計當前供應商選中食材的種類 //統計當前供應商選中食材的種類
int supplierTotalSpecies = 0; int supplierTotalSpecies = 0;
shoppingCartBean.setAllSelect(true); shoppingCartBean.setAllSelect(true);
double shipping = 0;
for (PurchaseFoodBean purchaseFoodBean : foods) { for (PurchaseFoodBean purchaseFoodBean : foods) {
if (purchaseFoodBean.isChecked()) { if (purchaseFoodBean.isChecked()) {
supplierTotalAmount = MoneyUtil.sum(supplierTotalAmount, MoneyUtil.priceCalculation(purchaseFoodBean.getUnitPrice(), purchaseFoodBean.getFoodQuantity())); supplierTotalAmount = MoneyUtil.sum(supplierTotalAmount, MoneyUtil.priceCalculation(purchaseFoodBean.getUnitPrice(), purchaseFoodBean.getFoodQuantity()));
supplierTotalSpecies++; supplierTotalSpecies++;
//有選中的食品才顯示運費
shipping = purchaseFoodBean.getShipping();
} else { } else {
shoppingCartBean.setAllSelect(false); shoppingCartBean.setAllSelect(false);
} }
} }
//不滿足最低採購金額,不可點擊創建訂單按鈕
if (MoneyUtil.compareTo(shoppingCartBean.getMinimumAmount(), supplierTotalAmount) == 1) { if (MoneyUtil.compareTo(shoppingCartBean.getMinimumAmount(), supplierTotalAmount) == 1) {
createBtnCheckable = false; createBtnCheckable = false;
} }
// shoppingCartBean.setShipping();運費 //運費
shoppingCartBean.setShipping(shipping);
shoppingCartBean.setInitialShippingTime(TimeUtils.getNextDay(1)); shoppingCartBean.setInitialShippingTime(TimeUtils.getNextDay(1));
shoppingCartBean.setSelectFoodAmount(supplierTotalAmount); shoppingCartBean.setSelectFoodAmount(supplierTotalAmount);
shoppingCartBean.setSelectSpeciesNum(supplierTotalSpecies); shoppingCartBean.setSelectSpeciesNum(supplierTotalSpecies);
//統計所有供應商的選中的食材的總金額 //統計所有供應商的選中的食材的總金額,加上運費
totalPrice = MoneyUtil.sum(totalPrice, supplierTotalAmount); totalPrice = MoneyUtil.sum(MoneyUtil.sum(totalPrice, supplierTotalAmount), shipping);
//統計所有供應商的選中的食材的種類數量 //統計所有供應商的選中的食材的種類數量
totalTypeNumber += supplierTotalSpecies; totalTypeNumber += supplierTotalSpecies;
shoppingCartBean.setFoodList(foods); shoppingCartBean.setFoodList(foods);
...@@ -177,6 +182,8 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode ...@@ -177,6 +182,8 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
} }
if (checkState) { if (checkState) {
shoppingCartBean.setSelectSpeciesNum(shoppingCartBean.getFoodList().size()); shoppingCartBean.setSelectSpeciesNum(shoppingCartBean.getFoodList().size());
//總金額要加上運費
totalAmount = MoneyUtil.sum(totalAmount, shoppingCartBean.getShipping());
} else { } else {
shoppingCartBean.setSelectSpeciesNum(0); shoppingCartBean.setSelectSpeciesNum(0);
} }
......
...@@ -21,6 +21,9 @@ import javax.inject.Inject; ...@@ -21,6 +21,9 @@ import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.WarehousingInventoryContract; import com.gingersoft.supply_chain.mvp.contract.WarehousingInventoryContract;
import com.jess.arms.utils.RxLifecycleUtils; import com.jess.arms.utils.RxLifecycleUtils;
import java.util.HashMap;
import java.util.Map;
/** /**
* ================================================ * ================================================
...@@ -95,4 +98,35 @@ public class WarehousingInventoryPresenter extends BasePresenter<WarehousingInve ...@@ -95,4 +98,35 @@ public class WarehousingInventoryPresenter extends BasePresenter<WarehousingInve
} }
}); });
} }
/**
* 查詢庫存盤點記錄
*/
public void getWarehousingRecord(int pageIndex) {
Map<String, Object> map = new HashMap<>(4);
Constant.addRestaurantId(map);
Constant.addBrandId(map);
Constant.addPageSize(map);
map.put("pageIndex", pageIndex * Constant.PAGE_SIZE);
mModel.getWarehousingRecord(map)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.SAVE_LOADING))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(BaseResult baseResult) {
if (baseResult != null && baseResult.isSuccess()) {
//消耗完之後,關閉頁面
mRootView.loadRecord();
} else if (baseResult != null && TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg());
} else {
mRootView.showMessage(Constant.SAVE_FAIL);
}
}
});
}
} }
...@@ -273,6 +273,7 @@ public interface SupplierServer { ...@@ -273,6 +273,7 @@ public interface SupplierServer {
/** /**
* 修改採購單信息 * 修改採購單信息
*
* @param orderId 訂單id * @param orderId 訂單id
* @return * @return
*/ */
...@@ -393,6 +394,14 @@ public interface SupplierServer { ...@@ -393,6 +394,14 @@ public interface SupplierServer {
@POST("basicUnitType/add" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2) @POST("basicUnitType/add" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> addDeputyUnitInput(@Body RequestBody requestBody); Observable<BaseResult> addDeputyUnitInput(@Body RequestBody requestBody);
/**
* 刪除副單位快捷輸入
*/
@Headers({"Domain-Name: ricepon-purchase"})
@FormUrlEncoded
@POST("basicUnitType/delete" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> deleteUnitKey(@Field("id") int id);
/** /**
* 查詢入庫流水 * 查詢入庫流水
...@@ -429,4 +438,13 @@ public interface SupplierServer { ...@@ -429,4 +438,13 @@ public interface SupplierServer {
@GET("purchaseConsume/get/remaining/quantity" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2) @GET("purchaseConsume/get/remaining/quantity" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> getWarehousingNum(@QueryMap Map<String, Object> map); Observable<BaseResult> getWarehousingNum(@QueryMap Map<String, Object> map);
/**
* 查詢庫存消耗記錄
*/
@Headers({"Domain-Name: ricepon-purchase"})
@GET("purchaseConsume/list" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> getWarehousingRecord(@QueryMap Map<String, Object> map);
} }
...@@ -19,8 +19,11 @@ import java.util.List; ...@@ -19,8 +19,11 @@ import java.util.List;
*/ */
public class BasicUnitAdapter extends BaseQuickAdapter<BasicUnitBean, BaseViewHolder> { public class BasicUnitAdapter extends BaseQuickAdapter<BasicUnitBean, BaseViewHolder> {
private boolean showDelete = false;
public BasicUnitAdapter(@Nullable List<BasicUnitBean> data) { public BasicUnitAdapter(@Nullable List<BasicUnitBean> data) {
super(R.layout.item_basic_unit, data); super(R.layout.item_basic_unit, data);
addChildClickViewIds(R.id.iv_delete_basic_unit);
} }
@Override @Override
...@@ -31,5 +34,16 @@ public class BasicUnitAdapter extends BaseQuickAdapter<BasicUnitBean, BaseViewHo ...@@ -31,5 +34,16 @@ public class BasicUnitAdapter extends BaseQuickAdapter<BasicUnitBean, BaseViewHo
} else { } else {
viewHolder.setTextColorRes(R.id.tv_basic_unit, R.color.color_3c); viewHolder.setTextColorRes(R.id.tv_basic_unit, R.color.color_3c);
} }
//沒有id的,就是系統自帶的默認的單位,不能刪除
if (item.getId() != null) {
viewHolder.setGone(R.id.iv_delete_basic_unit, !showDelete);
} else {
viewHolder.setGone(R.id.iv_delete_basic_unit, true);
}
}
public void toggleDelete() {
this.showDelete = !showDelete;
notifyDataSetChanged();
} }
} }
...@@ -2,6 +2,8 @@ package com.gingersoft.supply_chain.mvp.ui.adapter; ...@@ -2,6 +2,8 @@ package com.gingersoft.supply_chain.mvp.ui.adapter;
import android.animation.AnimatorSet; import android.animation.AnimatorSet;
import android.content.Context; import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View; import android.view.View;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.EditText; import android.widget.EditText;
...@@ -13,6 +15,7 @@ import androidx.recyclerview.widget.RecyclerView; ...@@ -13,6 +15,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.viewholder.BaseViewHolder; import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil; import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils; import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.ui.recylcler.decorator.DividerItemDecoration; import com.gingersoft.gsa.cloud.ui.recylcler.decorator.DividerItemDecoration;
import com.gingersoft.gsa.cloud.ui.utils.AnimateUtils; import com.gingersoft.gsa.cloud.ui.utils.AnimateUtils;
...@@ -21,6 +24,7 @@ import com.gingersoft.supply_chain.R; ...@@ -21,6 +24,7 @@ import com.gingersoft.supply_chain.R;
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.google.android.material.internal.ViewUtils; import com.google.android.material.internal.ViewUtils;
import com.google.android.material.textfield.TextInputEditText;
import com.xuexiang.rxutil2.rxjava.RxJavaUtils; import com.xuexiang.rxutil2.rxjava.RxJavaUtils;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
...@@ -44,12 +48,15 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base ...@@ -44,12 +48,15 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
private String amountUnitStr; private String amountUnitStr;
private String estimateDeliveryTimeStr; private String estimateDeliveryTimeStr;
private ShippingTextWatcher shippingTextWatcher;
public ShoppingCartAdapter(Context context, @Nullable List<ShoppingCartBean> data) { public ShoppingCartAdapter(Context context, @Nullable List<ShoppingCartBean> data) {
super(R.layout.item_shopping_cart, data); super(R.layout.item_shopping_cart, data);
this.context = context; this.context = context;
dividerItemDecoration = new DividerItemDecoration(context, DividerItemDecoration.VERTICAL_LIST); dividerItemDecoration = new DividerItemDecoration(context, DividerItemDecoration.VERTICAL_LIST);
amountUnitStr = context.getString(R.string.amount_string); amountUnitStr = context.getString(R.string.amount_string);
estimateDeliveryTimeStr = context.getString(R.string.estimate_delivery_time); estimateDeliveryTimeStr = context.getString(R.string.estimate_delivery_time);
shippingTextWatcher = new ShippingTextWatcher();
} }
@Override @Override
...@@ -59,13 +66,16 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base ...@@ -59,13 +66,16 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
TextView tvMinMinimumAmount = viewHolder.getView(R.id.tv_minimumAmount); TextView tvMinMinimumAmount = viewHolder.getView(R.id.tv_minimumAmount);
viewHolder.setText(R.id.rv_purchase_shopping_estimate_delivery_time, String.format(estimateDeliveryTimeStr, shoppingCartBean.getInitialShippingTime())); viewHolder.setText(R.id.rv_purchase_shopping_estimate_delivery_time, String.format(estimateDeliveryTimeStr, shoppingCartBean.getInitialShippingTime()));
setTvMinimumAmount(shoppingCartBean, tvMinMinimumAmount, viewHolder.getView(R.id.rv_purchase_shopping_minimum_tip)); setTvMinimumAmount(shoppingCartBean, tvMinMinimumAmount, viewHolder.getView(R.id.rv_purchase_shopping_minimum_tip));
// viewHolder.setText(R.id.tv_order_item_freight, shoppingCartBean.getFoodList());
//選中食品的總價 //選中食品的總價
setTotalAmount(viewHolder, shoppingCartBean.getSelectFoodAmount()); setTotalAmount(viewHolder, shoppingCartBean.getSelectFoodAmount());
//運費 //運費
viewHolder.setText(R.id.tv_order_item_freight, String.format(amountUnitStr, shoppingCartBean.getShipping())); TextInputEditText etShipping = viewHolder.getView(R.id.tv_order_item_freight);
etShipping.removeTextChangedListener(shippingTextWatcher);
viewHolder.setText(R.id.tv_order_item_freight, MoneyUtil.formatDouble(shoppingCartBean.getShipping()));
shippingTextWatcher.setViewHolder(viewHolder);
etShipping.addTextChangedListener(shippingTextWatcher);
//實際應付金額 //實際應付金額
setActualAmount(viewHolder, shoppingCartBean.getSelectFoodAmount()); setActualAmount(viewHolder, MoneyUtil.sum(shoppingCartBean.getSelectFoodAmount(), shoppingCartBean.getShipping()));
//選中食品的種類 //選中食品的種類
TextView tvFoodTypeNumber = viewHolder.getView(R.id.tv_order_item_food_type_total); TextView tvFoodTypeNumber = viewHolder.getView(R.id.tv_order_item_food_type_total);
tvFoodTypeNumber.setText(String.valueOf(shoppingCartBean.getSelectSpeciesNum())); tvFoodTypeNumber.setText(String.valueOf(shoppingCartBean.getSelectSpeciesNum()));
...@@ -175,6 +185,47 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base ...@@ -175,6 +185,47 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
} }
} }
private class ShippingTextWatcher implements TextWatcher {
BaseViewHolder viewHolder;
public void setViewHolder(BaseViewHolder viewHolder) {
this.viewHolder = viewHolder;
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
if (viewHolder != null) {
//需要修改實際應付金額和activity的總金額
//拿到現在的金額,減去之前的金額
double nowShipping = 0;
if (TextUtil.isNotEmptyOrNullOrUndefined(s)) {
nowShipping = Double.parseDouble(s.toString());
}
ShoppingCartBean shoppingCartBean = getData().get(viewHolder.getAdapterPosition());
//修改實際應付金額
setActualAmount(viewHolder, MoneyUtil.sum(shoppingCartBean.getSelectFoodAmount(), shoppingCartBean.getShipping()));
//通知activity修改
// getData().get(viewHolder.getAdapterPosition()).setShipping(Integer.parseInt());
}
}
}
/** /**
* 修改總金額 * 修改總金額
*/ */
...@@ -283,7 +334,7 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base ...@@ -283,7 +334,7 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
double currentPrice = MoneyUtil.sum(cartBean.getSelectFoodAmount(), MoneyUtil.priceCalculation(unitPrice, foodQuantity)); double currentPrice = MoneyUtil.sum(cartBean.getSelectFoodAmount(), MoneyUtil.priceCalculation(unitPrice, foodQuantity));
cartBean.setSelectFoodAmount(currentPrice); cartBean.setSelectFoodAmount(currentPrice);
setTotalAmount(viewHolder, currentPrice); setTotalAmount(viewHolder, currentPrice);
setActualAmount(viewHolder, currentPrice); setActualAmount(viewHolder, MoneyUtil.sum(currentPrice, cartBean.getShipping()));
//傳遞回去 //傳遞回去
if (onInfoChangeListener != null) { if (onInfoChangeListener != null) {
onInfoChangeListener.onInfoChange(MoneyUtil.priceCalculation(unitPrice, foodQuantity), species); onInfoChangeListener.onInfoChange(MoneyUtil.priceCalculation(unitPrice, foodQuantity), species);
...@@ -301,11 +352,13 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base ...@@ -301,11 +352,13 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
private void minusTotalPrice(BaseViewHolder viewHolder, ShoppingCartBean cartBean, double unitPrice, int foodQuantity, int species) { private void minusTotalPrice(BaseViewHolder viewHolder, ShoppingCartBean cartBean, double unitPrice, int foodQuantity, int species) {
//供應商總價減去-這個食品的總價=等於現價 //供應商總價減去-這個食品的總價=等於現價
double currentPrice = MoneyUtil.sub(cartBean.getSelectFoodAmount(), MoneyUtil.priceCalculation(unitPrice, foodQuantity)); double currentPrice = MoneyUtil.sub(cartBean.getSelectFoodAmount(), MoneyUtil.priceCalculation(unitPrice, foodQuantity));
//修改選中食品的金額
cartBean.setSelectFoodAmount(currentPrice); cartBean.setSelectFoodAmount(currentPrice);
String amountStr = String.format(amountUnitStr, currentPrice); //修改顯示總金額
setTotalAmount(viewHolder, currentPrice); setTotalAmount(viewHolder, currentPrice);
viewHolder.setText(R.id.tv_order_item_actual_pay_amount, amountStr); //修改實際應付金額
//傳遞回去 setActualAmount(viewHolder, MoneyUtil.sum(currentPrice, cartBean.getShipping()));
//傳遞回去,由於是減少食品,所以金額為負
if (onInfoChangeListener != null) { if (onInfoChangeListener != null) {
onInfoChangeListener.onInfoChange(-MoneyUtil.priceCalculation(unitPrice, foodQuantity), species); onInfoChangeListener.onInfoChange(-MoneyUtil.priceCalculation(unitPrice, foodQuantity), species);
} }
......
...@@ -14,6 +14,8 @@ import androidx.fragment.app.FragmentActivity; ...@@ -14,6 +14,8 @@ import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemChildClickListener;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
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;
...@@ -144,6 +146,11 @@ public class FoodUnitPageFragment extends BaseSupplyChainFragment<FoodUnitPagePr ...@@ -144,6 +146,11 @@ public class FoodUnitPageFragment extends BaseSupplyChainFragment<FoodUnitPagePr
@Override @Override
public void loadBasicUnitAdapter(List<BasicUnitBean> basicUnitBeans) { public void loadBasicUnitAdapter(List<BasicUnitBean> basicUnitBeans) {
basicUnitAdapter = new BasicUnitAdapter(basicUnitBeans); basicUnitAdapter = new BasicUnitAdapter(basicUnitBeans);
//獲取到基礎單位之後,才在標題欄中添加刪除按鈕
topBar.addRightImageButton(R.drawable.ic_white_delete, R.id.btn_delete).setOnClickListener(v -> {
//刪除
basicUnitAdapter.toggleDelete();
});
rvBasicUnitList.setLayoutManager(new GridLayoutManager(mContext, 5)); rvBasicUnitList.setLayoutManager(new GridLayoutManager(mContext, 5));
rvBasicUnitList.setAdapter(basicUnitAdapter); rvBasicUnitList.setAdapter(basicUnitAdapter);
basicUnitAdapter.setOnItemClickListener((adapter, view, position) -> { basicUnitAdapter.setOnItemClickListener((adapter, view, position) -> {
...@@ -174,13 +181,20 @@ public class FoodUnitPageFragment extends BaseSupplyChainFragment<FoodUnitPagePr ...@@ -174,13 +181,20 @@ public class FoodUnitPageFragment extends BaseSupplyChainFragment<FoodUnitPagePr
} }
} }
}); });
basicUnitAdapter.setOnItemChildClickListener((adapter, view, position) -> {
if (view.getId() == R.id.iv_delete_basic_unit) {
//刪除單位
mPresenter.deleteUnitKey(basicUnitAdapter.getItem(position).getId(), position);
}
});
} }
@Override @Override
public void addBasicUnit(BasicUnitBean basicUnitBean) { public void addBasicUnit(BasicUnitBean basicUnitBean) {
if (basicUnitAdapter != null) { if (basicUnitAdapter != null) {
int index = basicUnitAdapter.getItemCount() - 1; basicUnitAdapter.addData(0, basicUnitBean);
basicUnitAdapter.addData(Math.max(index, 0), basicUnitBean); rvBasicUnitList.scrollToPosition(0);
} }
} }
...@@ -227,4 +241,9 @@ public class FoodUnitPageFragment extends BaseSupplyChainFragment<FoodUnitPagePr ...@@ -227,4 +241,9 @@ public class FoodUnitPageFragment extends BaseSupplyChainFragment<FoodUnitPagePr
public void deleteDeputyUnit(int position) { public void deleteDeputyUnit(int position) {
deputyUnitAdapter.removeAt(position); deputyUnitAdapter.removeAt(position);
} }
@Override
public void deleteUnitKey(int position) {
basicUnitAdapter.removeAt(position);
}
} }
package com.gingersoft.supply_chain.mvp.ui.fragment.order; package com.gingersoft.supply_chain.mvp.ui.fragment.order;
import android.app.Dialog;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
......
...@@ -14,6 +14,7 @@ import android.widget.TextView; ...@@ -14,6 +14,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.gsa.cloud.common.utils.glide.GlideUtils; import com.gingersoft.gsa.cloud.common.utils.glide.GlideUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
...@@ -49,12 +50,16 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho ...@@ -49,12 +50,16 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho
TextView tvWarehouseDifference; TextView tvWarehouseDifference;
@BindView(R2.id.ed_warehouse_loss) @BindView(R2.id.ed_warehouse_loss)
EditText edWarehouseLoss; EditText edWarehouseLoss;
@BindView(R2.id.rv_warehouse_inventory_record)
RecyclerView rvRecord;
/** /**
* 食品總庫存 * 食品總庫存
*/ */
private int foodNum; private int foodNum;
private String foodNo; private String foodNo;
private int pageIndex;
public static WarehousingInventoryFragment newInstance(WareHouseListBean.WareHousingDataBean.PurchaseWarehousingOrderDetailsVOSBean purchaseWarehousingOrderDetailsVosBean) { public static WarehousingInventoryFragment newInstance(WareHouseListBean.WareHousingDataBean.PurchaseWarehousingOrderDetailsVOSBean purchaseWarehousingOrderDetailsVosBean) {
WarehousingInventoryFragment fragment = new WarehousingInventoryFragment(); WarehousingInventoryFragment fragment = new WarehousingInventoryFragment();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
...@@ -86,70 +91,89 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho ...@@ -86,70 +91,89 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho
public void initData(@Nullable Bundle savedInstanceState) { public void initData(@Nullable Bundle savedInstanceState) {
Bundle arguments = getArguments(); Bundle arguments = getArguments();
if (arguments != null) { if (arguments != null) {
//獲取庫存盤點記錄
getWarehousingRecord();
int foodId = arguments.getInt(WarehouseDetailsFragment.FOOD_ID_KEY); int foodId = arguments.getInt(WarehouseDetailsFragment.FOOD_ID_KEY);
//食品編號
foodNo = arguments.getString(WarehouseDetailsFragment.FOOD_NO_KEY); foodNo = arguments.getString(WarehouseDetailsFragment.FOOD_NO_KEY);
String foodName = arguments.getString(WarehouseDetailsFragment.FOOD_NAME_KEY); //食品庫存總數
foodNum = arguments.getInt(WarehouseDetailsFragment.FOOD_NUM_KEY); foodNum = arguments.getInt(WarehouseDetailsFragment.FOOD_NUM_KEY);
ivWarehouseImg.post(() -> { //加載食品圖片
ViewGroup.LayoutParams layoutParams = ivWarehouseImg.getLayoutParams(); loadFoodImage(arguments);
layoutParams.height = ivWarehouseImg.getWidth();
layoutParams.width = ivWarehouseImg.getWidth();
ivWarehouseImg.setLayoutParams(layoutParams);
String foodImageUrl = arguments.getString(WarehouseDetailsFragment.FOOD_IMAGE_KEY);
if (TextUtil.isNotEmptyOrNullOrUndefined(foodImageUrl)) {
GlideUtils.display(requireContext(), ivWarehouseImg, foodImageUrl);
} else {
ivWarehouseImg.setImageResource(R.drawable.img_small_default);
}
});
//初始化標題 //初始化標題
initTopBar(supplyTopBar, foodName); initTopBar(arguments);
Button btnSave = supplyTopBar.addRightTextButton(R.string.str_save, R.id.id_save); //初始化數量和編輯監聽
btnSave.setTextColor(getColor(R.color.white)); initEdit();
btnSave.setOnClickListener(mOnClickListener); } else {
//庫存數量 showMessage("獲取食材信息失敗,請稍候重試");
tvWarehouseTotal.setText(String.valueOf(foodNum)); killMyself();
tvWarehouseDifference.setText(String.valueOf(foodNum)); }
edWarehouseLoss.setOnFocusChangeListener((v, hasFocus) -> { }
if (hasFocus && edWarehouseLoss.getText().toString().equals("0")) {
edWarehouseLoss.setText("");
}
});
edWarehouseLoss.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
} private void getWarehousingRecord() {
mPresenter.getWarehousingRecord(pageIndex);
}
@Override private void initEdit() {
public void onTextChanged(CharSequence s, int start, int before, int count) { //庫存數量
tvWarehouseTotal.setText(String.valueOf(foodNum));
//庫存差異
tvWarehouseDifference.setText(String.valueOf(foodNum));
edWarehouseLoss.setOnFocusChangeListener((v, hasFocus) -> {
//當輸入框獲得焦點時,數量為0,去掉0
if (hasFocus && edWarehouseLoss.getText().toString().equals("0")) {
edWarehouseLoss.setText("");
}
});
edWarehouseLoss.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
} }
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
@Override }
public void afterTextChanged(Editable s) {
if (TextUtil.isNotEmptyOrNullOrUndefined(s + "")) { @Override
//用戶輸入的盤點數量 public void afterTextChanged(Editable s) {
int inventoryNum = Integer.parseInt(s + ""); if (TextUtil.isNotEmptyOrNullOrUndefined(s + "")) {
//用戶輸入的盤點數量
int inventoryNum = Integer.parseInt(s + "");
// if (inventoryNum > foodNum) { // if (inventoryNum > foodNum) {
// inventoryNum = foodNum; // inventoryNum = foodNum;
// showMessage("不能大於庫存數"); // showMessage("不能大於庫存數");
// edWarehouseLoss.setText(String.valueOf(foodNum)); // edWarehouseLoss.setText(String.valueOf(foodNum));
// edWarehouseLoss.setSelection(edWarehouseLoss.getText().length()); // edWarehouseLoss.setSelection(edWarehouseLoss.getText().length());
// } // }
tvWarehouseDifference.setText(String.valueOf(Math.abs(foodNum - inventoryNum))); tvWarehouseDifference.setText(String.valueOf(Math.abs(foodNum - inventoryNum)));
} else { } else {
tvWarehouseDifference.setText(String.valueOf(foodNum)); tvWarehouseDifference.setText(String.valueOf(foodNum));
}
} }
}); }
});
}
private void initTopBar(Bundle arguments) {
String foodName = arguments.getString(WarehouseDetailsFragment.FOOD_NAME_KEY);
//初始化標題
initTopBar(supplyTopBar, foodName);
//添加保存按鈕
Button btnSave = supplyTopBar.addRightTextButton(R.string.str_save, R.id.id_save);
btnSave.setTextColor(getColor(R.color.white));
btnSave.setOnClickListener(mOnClickListener);
}
private void loadFoodImage(Bundle arguments) {
String foodImageUrl = arguments.getString(WarehouseDetailsFragment.FOOD_IMAGE_KEY);
if (TextUtil.isNotEmptyOrNullOrUndefined(foodImageUrl)) {
GlideUtils.display(requireContext(), ivWarehouseImg, foodImageUrl);
} else { } else {
showMessage("獲取食材信息失敗,請稍候重試"); ivWarehouseImg.setImageResource(R.drawable.img_small_default);
killMyself();
} }
} }
private View.OnClickListener mOnClickListener = v -> { private View.OnClickListener mOnClickListener = v -> {
if (v.getId() == R.id.id_save) { if (v.getId() == R.id.id_save) {
//保存,調用庫存損耗 //保存,調用庫存損耗
...@@ -174,4 +198,9 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho ...@@ -174,4 +198,9 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho
public void updateSuccess() { public void updateSuccess() {
setFragmentResult(RESULT_OK, null); setFragmentResult(RESULT_OK, null);
} }
@Override
public void loadRecord() {
}
} }
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
android:imeOptions="actionSearch" android:imeOptions="actionSearch"
android:hint="搜索供應商" android:hint="搜索供應商"
android:maxLines="1" android:maxLines="1"
android:textCursorDrawable="@drawable/cursor_theme"
android:inputType="text" android:inputType="text"
android:textColor="@color/theme_333_color" android:textColor="@color/theme_333_color"
android:textColorHint="@color/hint_color" android:textColorHint="@color/hint_color"
......
...@@ -3,94 +3,170 @@ ...@@ -3,94 +3,170 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/color_f0"
android:orientation="vertical"> android:orientation="vertical">
<include layout="@layout/supply_chain_top_bar" /> <include layout="@layout/supply_chain_top_bar" />
<ImageView
android:id="@+id/iv_warehouse_img"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_36"
android:layout_marginRight="@dimen/dp_36" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_20" android:layout_marginLeft="@dimen/dp_5"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_20" android:layout_marginRight="@dimen/dp_5"
android:background="@drawable/shape_white_eight_corners_bg"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <ImageView
android:layout_width="wrap_content" android:id="@+id/iv_warehouse_img"
android:layout_height="wrap_content" android:layout_width="@dimen/dp_77"
android:text="庫存數量:" android:layout_height="@dimen/dp_77"
android:textColor="@color/color_66" android:layout_margin="@dimen/dp_10" />
android:textSize="@dimen/dp_17" />
<TextView <LinearLayout
android:id="@+id/tv_warehouse_total" android:layout_width="match_parent"
android:layout_width="wrap_content" android:layout_height="match_parent"
android:layout_height="wrap_content" android:layout_marginTop="@dimen/dp_6"
android:layout_marginLeft="@dimen/dp_10" android:layout_marginRight="@dimen/dp_10"
android:textColor="@color/color_3c" android:layout_marginBottom="@dimen/dp_6"
android:textSize="@dimen/dp_17" android:orientation="vertical">
android:textStyle="bold"
tools:text="100" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView <LinearLayout
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="庫存差異:" android:orientation="horizontal">
android:textColor="@color/color_66"
android:textSize="@dimen/dp_17" />
<TextView <TextView
android:id="@+id/tv_warehouse_difference" style="@style/WareHouse_Details_TextStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/color_3c" android:text="庫存:" />
android:textSize="@dimen/dp_17"
android:textStyle="bold" <TextView
tools:text="+100" /> android:id="@+id/tv_warehouse_total"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/other_order_details_sure_btn_color"
android:textSize="@dimen/dp_19"
tools:text="100" />
<TextView
android:id="@+id/tv_food_unit"
style="@style/WareHouse_Details_TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="盒" />
</LinearLayout>
<View
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
style="@style/WareHouse_Details_TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="庫存差異:" />
<TextView
android:id="@+id/tv_warehouse_difference"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_17"
android:textStyle="bold"
tools:text="+100" />
</LinearLayout>
<View
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
style="@style/WareHouse_Details_TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="盤點庫存:"
android:textSize="@dimen/dp_15" />
<EditText
android:id="@+id/ed_warehouse_loss"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shape_square_edit_border_aa"
android:gravity="center"
android:hint="請輸入"
android:inputType="number"
android:paddingTop="@dimen/dp_5"
android:paddingBottom="@dimen/dp_5"
android:text="0"
android:textColor="@color/theme_333_color"
android:textCursorDrawable="@drawable/cursor_theme"
android:textSize="@dimen/dp_18"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="@dimen/dp_38"
android:layout_marginLeft="@dimen/dp_20" android:layout_marginTop="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_15"
android:layout_marginRight="@dimen/dp_20"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:text="盤點庫存:" android:layout_weight="0.25"
android:textColor="@color/color_66" android:background="@color/theme_color"
android:textSize="@dimen/dp_17" />
<EditText
android:id="@+id/ed_warehouse_loss"
android:layout_width="@dimen/dp_86"
android:layout_height="wrap_content"
android:background="@drawable/shape_square_edit_border_3c"
android:gravity="center" android:gravity="center"
android:hint="請輸入" android:text="用戶名"
android:inputType="number" android:textColor="@color/white"
android:paddingTop="@dimen/dp_9" android:textSize="@dimen/dp_12" />
android:paddingBottom="@dimen/dp_9"
android:text="0"
android:textColor="@color/theme_333_color"
android:textCursorDrawable="@drawable/cursor_theme"
android:textSize="@dimen/dp_14"
android:textStyle="bold" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_1"
android:layout_weight="0.3"
android:background="@color/theme_color"
android:gravity="center"
android:text="盤點"
android:textColor="@color/white"
android:textSize="@dimen/dp_12" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_1"
android:layout_weight="0.55"
android:background="@color/theme_color"
android:gravity="center"
android:text="操作日期"
android:textColor="@color/white"
android:textSize="@dimen/dp_12" />
</LinearLayout> </LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_warehouse_inventory_record"
android:layout_width="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:layout_height="match_parent" />
</LinearLayout> </LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout 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:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content">
android:layout_marginLeft="@dimen/dp_3"
android:layout_marginRight="@dimen/dp_3"
android:layout_marginTop="@dimen/dp_3"
android:layout_marginBottom="@dimen/dp_3"
android:background="@color/white"
app:cardCornerRadius="@dimen/dp_8"
app:elevation="@dimen/dp_10">
<TextView <androidx.cardview.widget.CardView
android:id="@+id/tv_basic_unit" android:layout_width="match_parent"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_height="match_parent" android:layout_marginLeft="@dimen/dp_3"
android:layout_gravity="center" android:layout_marginRight="@dimen/dp_3"
android:paddingTop="@dimen/dp_7" android:background="@color/white"
android:paddingBottom="@dimen/dp_7" app:cardCornerRadius="@dimen/dp_4"
android:textColor="@color/color_3c" app:cardUseCompatPadding="true"
android:textSize="@dimen/dp_14" app:elevation="@dimen/dp_4">
tools:text="個" />
<TextView
android:id="@+id/tv_basic_unit"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:ellipsize="end"
android:maxLines="1"
android:paddingTop="@dimen/dp_7"
android:paddingBottom="@dimen/dp_7"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_14"
tools:text="個" />
</androidx.cardview.widget.CardView>
</androidx.cardview.widget.CardView> <ImageView
\ No newline at end of file android:id="@+id/iv_delete_basic_unit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:elevation="@dimen/dp_5"
android:src="@drawable/ic_red_circular_delete" />
</FrameLayout>
...@@ -26,9 +26,9 @@ ...@@ -26,9 +26,9 @@
<CheckBox <CheckBox
android:id="@+id/cb_order_item_all_select" android:id="@+id/cb_order_item_all_select"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="6"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_12" android:layout_marginLeft="@dimen/dp_12"
android:layout_weight="6"
android:button="@drawable/selector_checkbox" android:button="@drawable/selector_checkbox"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="@dimen/dp_16" android:textSize="@dimen/dp_16"
...@@ -41,10 +41,10 @@ ...@@ -41,10 +41,10 @@
android:layout_marginLeft="@dimen/dp_5" android:layout_marginLeft="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_5" android:layout_marginRight="@dimen/dp_5"
android:layout_weight="4" android:layout_weight="4"
android:textSize="@dimen/dp_14"
android:gravity="right" android:gravity="right"
android:text="@string/minimumAmount" android:text="@string/minimumAmount"
android:textColor="@color/required_color" /> android:textColor="@color/required_color"
android:textSize="@dimen/dp_14" />
</LinearLayout> </LinearLayout>
<include layout="@layout/include_horizontal_color_ccc_dividing_line" /> <include layout="@layout/include_horizontal_color_ccc_dividing_line" />
...@@ -117,11 +117,21 @@ ...@@ -117,11 +117,21 @@
android:textSize="@dimen/dp_15" /> android:textSize="@dimen/dp_15" />
<TextView <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="$"
android:textColor="@color/required_color"
android:textSize="@dimen/dp_14"
android:textStyle="bold" />
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/tv_order_item_freight" android:id="@+id/tv_order_item_freight"
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"
android:text="$0" android:background="@null"
android:inputType="numberDecimal"
android:text="0"
android:textColor="@color/required_color" android:textColor="@color/required_color"
android:textSize="@dimen/dp_14" android:textSize="@dimen/dp_14"
android:textStyle="bold" /> android:textStyle="bold" />
......
...@@ -3,6 +3,12 @@ package com.gingersoft.gsa.cloud.common.constans; ...@@ -3,6 +3,12 @@ package com.gingersoft.gsa.cloud.common.constans;
public class DeliveryPickConstans { public class DeliveryPickConstans {
public static final String ORDER_TYPE = "orderType"; public static final String ORDER_TYPE = "orderType";
/**
* 訂單類型:凍鏈
*/
public static final String COLD_CHAIN_TYPE = "8";
/**
* 2 線上外賣訂單,7 自取訂單
*/
public static final String DELIVERY_TYPE = "2,7";
} }
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/dp_4" />
<stroke
android:width="@dimen/dp_1"
android:color="@color/color_aaa" />
</shape>
\ No newline at end of file
...@@ -42,6 +42,8 @@ public class PrjBean { ...@@ -42,6 +42,8 @@ public class PrjBean {
private int id; private int id;
private int printerDeviceId; private int printerDeviceId;
private int status;//為2是帶*,需要切紙的 private int status;//為2是帶*,需要切紙的
public static final int PRJ_CUTE = 2;
private String tableName; private String tableName;
private String orderNo; private String orderNo;
private int orderTime; private int orderTime;
......
...@@ -55,13 +55,14 @@ public class InputProvider<T extends InfoMultiBean> extends MyBaseItemProvider<T ...@@ -55,13 +55,14 @@ public class InputProvider<T extends InfoMultiBean> extends MyBaseItemProvider<T
InputViewHolder viewHolder = (InputViewHolder) baseViewHolder; InputViewHolder viewHolder = (InputViewHolder) baseViewHolder;
MultiInputBean infoMultiBean = (MultiInputBean) t; MultiInputBean infoMultiBean = (MultiInputBean) t;
viewHolder.removeTextWatcher();
TextInputEditText editText = baseViewHolder.getView(R.id.ed_multi_value); TextInputEditText editText = baseViewHolder.getView(R.id.ed_multi_value);
editText.setError(null); editText.setError(null);
initEditFocusable(infoMultiBean, editText); initEditFocusable(infoMultiBean, editText);
//設置輸入限制 //設置輸入限制
setFilters(editText, infoMultiBean); setFilters(editText, infoMultiBean);
//刷新數據 //刷新數據
viewHolder.updateView(infoMultiBean); viewHolder.updateView();
//設置輸入框的值 //設置輸入框的值
initEditText(editText, infoMultiBean.getShowValue(), infoMultiBean.getHintText()); initEditText(editText, infoMultiBean.getShowValue(), infoMultiBean.getHintText());
//添加焦點監聽 //添加焦點監聽
...@@ -95,6 +96,8 @@ public class InputProvider<T extends InfoMultiBean> extends MyBaseItemProvider<T ...@@ -95,6 +96,8 @@ public class InputProvider<T extends InfoMultiBean> extends MyBaseItemProvider<T
} }
private void setFilters(EditText editText, MultiInputBean multiSelectBean) { private void setFilters(EditText editText, MultiInputBean multiSelectBean) {
//先清空值,再
editText.setText("");
//輸入攔截器 //輸入攔截器
editText.setFilters(multiSelectBean.getInputFilters()); editText.setFilters(multiSelectBean.getInputFilters());
//輸入類型限制 //輸入類型限制
...@@ -110,17 +113,19 @@ public class InputProvider<T extends InfoMultiBean> extends MyBaseItemProvider<T ...@@ -110,17 +113,19 @@ public class InputProvider<T extends InfoMultiBean> extends MyBaseItemProvider<T
super(view); super(view);
ButterKnife.bind(this, view); ButterKnife.bind(this, view);
editText = view.findViewById(R.id.ed_multi_value); editText = view.findViewById(R.id.ed_multi_value);
editText.addTextChangedListener(inputTextWatcher);
} }
public void updateView(MultiInputBean infoMultiBean) { public void removeTextWatcher() {
editText.removeTextChangedListener(inputTextWatcher);
}
public void updateView() {
editText.addTextChangedListener(inputTextWatcher);
inputTextWatcher.inputViewHolder = this; inputTextWatcher.inputViewHolder = this;
inputTextWatcher.infoMultiBean = infoMultiBean;
} }
} }
class InputTextWatcher implements TextWatcher { class InputTextWatcher implements TextWatcher {
MultiInputBean infoMultiBean;
InputViewHolder inputViewHolder; InputViewHolder inputViewHolder;
@Override @Override
...@@ -133,7 +138,8 @@ public class InputProvider<T extends InfoMultiBean> extends MyBaseItemProvider<T ...@@ -133,7 +138,8 @@ public class InputProvider<T extends InfoMultiBean> extends MyBaseItemProvider<T
@Override @Override
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
if (infoMultiBean != null) { if (inputViewHolder != null) {
MultiInputBean infoMultiBean = (MultiInputBean) getAdapter().getItem(inputViewHolder.getAdapterPosition());
infoMultiBean.setShowValue(s + ""); infoMultiBean.setShowValue(s + "");
} }
} }
......
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