Commit 7b3307da by Wyh

1、凍鏈的訂單碼調整 2、prj優化 3、供應鏈單位快捷輸入的刪除功能

parent 09fb6511
......@@ -372,7 +372,7 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre
view.findViewById(R.id.layout_history_order).setOnClickListener(v1 -> {
CC.obtainBuilder(com.gingersoft.gsa.cloud.component.ComponentName.COMPONENT_DELIVERYPICK)
.setActionName("historyActivity")
.addParam(DeliveryPickConstans.ORDER_TYPE, "1")
.addParam(DeliveryPickConstans.ORDER_TYPE, DeliveryPickConstans.COLD_CHAIN_TYPE)
.build()
.call();
pop.dismiss();
......
......@@ -235,7 +235,7 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailsPresenter> im
mTvOrderStatus.setText("待確認訂單");
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));
if (TextUtil.isNotEmptyOrNullOrUndefined(bean.getRECEIVER())) {
mTvReceiver.setText(bean.getRECEIVER());
......
......@@ -26,7 +26,7 @@ public class OrderListAdapter extends BaseQuickAdapter<OrderList.DataBeanX.DataB
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
baseViewHolder.setText(R.id.tv_address, "地址:" + dataBean.getADDRESS_DETAIL());
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_code, String.format(getContext().getString(R.string.str_order_code), dataBean.getTakeFoodCode()));
if (dataBean.getIsRead() == 0) {
baseViewHolder.setVisible(R.id.fl_border, true);
alphaAnimator(baseViewHolder.getView(R.id.fl_border));
......
......@@ -81,7 +81,7 @@
android:layout_height="wrap_content"
android:layout_margin="@dimen/other_order_info_dialog_content_marginLeft"
android:layout_marginTop="@dimen/dp_10"
tools:text="訂單號:" />
tools:text="訂單號:" />
<TextView
android:id="@+id/tv_create_time"
......@@ -149,7 +149,7 @@
style="@style/otherOrderReceiving_title_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="訂單:" />
android:text="訂單:" />
<TextView
android:id="@+id/tv_bill_num"
......
......@@ -73,21 +73,33 @@
app:layout_constraintRight_toLeftOf="@id/tv_order_state"
app:layout_constraintTop_toBottomOf="@id/tv_pay_method"
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:textColor="@color/theme_333_color" />
<TextView
android:id="@+id/tv_address"
style="@style/order_item_info_textStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_15"
android:layout_marginRight="@dimen/dp_10"
android:textColor="@color/color_3c"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
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"
tools:text="用戶收貨地址"
tools:textColor="#868686" />
......
......@@ -7,17 +7,17 @@
android:background="@color/white"
android:orientation="vertical">
<androidx.coordinatorlayout.widget.CoordinatorLayout
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/color_f0"
app:cardElevation="@dimen/dp_2"
tools:context=".ui.activity.DeliveryOrderMainActivity">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
app:elevation="@dimen/dp_0">
android:background="@color/white">
<com.qmuiteam.qmui.widget.QMUITopBar
android:id="@+id/coldchain_main_top_bar"
......@@ -198,11 +198,10 @@
android:padding="@dimen/dp_10"
android:text="餘額:"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_16"
android:visibility="gone" />
android:textSize="@dimen/dp_16" />
</com.google.android.material.appbar.AppBarLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.cardview.widget.CardView>
<androidx.viewpager.widget.ViewPager
android:id="@+id/view_pager"
......
<resources>
<string name="cold_chain_name">凍鏈</string>
<string name="str_order_code">訂單碼:%1$s</string>
</resources>
......@@ -6,6 +6,7 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
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.utils.time.TimeUtils
import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils
......@@ -26,8 +27,8 @@ class HistoryOrderViewModel(private val historyOrderRepository: HistoryOrderRepo
var historyEndTime = MutableLiveData<String>(TimeUtils.getOldDate(0)) //查詢結束時間
var status = MutableLiveData("4") //按類型查詢
var searchValue = MutableLiveData("")//按搜索內容查詢
var orderType = "2,7" //訂單類型 2 線上外賣訂單,7 自取訂單
var orderFrom = 0 //訂單來源 8 冷鏈用
var orderType = DeliveryPickConstans.DELIVERY_TYPE //訂單類型 2 線上外賣訂單,7 自取訂單
var orderFrom = 0 //訂單來源
fun getHistoryOrderList(pageIndex: String, orderNum: String = "", startDate: String, endDate: String, status: String) {
launch({
......
......@@ -27,6 +27,7 @@ public class BasicUnitBean {
private long createTime;
private long updateTime;
private int updateUid;
private Integer id;
public BasicUnitBean() {
}
......
......@@ -40,6 +40,8 @@ public interface FoodUnitPageContract {
void callBackDeputyUnit(List<DeputyUnitBean> deputyUnitBeans);
void deleteDeputyUnit(int position);
void deleteUnitKey(int position);
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
......@@ -69,5 +71,7 @@ public interface FoodUnitPageContract {
* @return
*/
Observable<BaseResult> addBasicUnit(RequestBody requestBody);
Observable<BaseResult> deleteUnitKey(int id);
}
}
......@@ -68,4 +68,10 @@ public class FoodUnitPageModel extends BaseModel implements FoodUnitPageContract
public Observable<BaseResult> addBasicUnit(RequestBody 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
......@@ -148,6 +148,10 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo
});
}
/**
* 新增基本單位
* @param data
*/
public void addDeputyUnit(List<DeputyUnitBean> data) {
//新增為false,修改為true
if (isUpdate) {
......@@ -290,4 +294,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);
}
}
});
}
}
......@@ -273,6 +273,7 @@ public interface SupplierServer {
/**
* 修改採購單信息
*
* @param orderId 訂單id
* @return
*/
......@@ -393,6 +394,14 @@ public interface SupplierServer {
@POST("basicUnitType/add" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
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);
/**
* 查詢入庫流水
......
......@@ -19,8 +19,11 @@ import java.util.List;
*/
public class BasicUnitAdapter extends BaseQuickAdapter<BasicUnitBean, BaseViewHolder> {
private boolean showDelete = false;
public BasicUnitAdapter(@Nullable List<BasicUnitBean> data) {
super(R.layout.item_basic_unit, data);
addChildClickViewIds(R.id.iv_delete_basic_unit);
}
@Override
......@@ -31,5 +34,16 @@ public class BasicUnitAdapter extends BaseQuickAdapter<BasicUnitBean, BaseViewHo
} else {
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();
}
}
......@@ -14,6 +14,8 @@ import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.GridLayoutManager;
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.ui.utils.AppDialog;
import com.gingersoft.supply_chain.R;
......@@ -144,6 +146,11 @@ public class FoodUnitPageFragment extends BaseSupplyChainFragment<FoodUnitPagePr
@Override
public void loadBasicUnitAdapter(List<BasicUnitBean> 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.setAdapter(basicUnitAdapter);
basicUnitAdapter.setOnItemClickListener((adapter, view, position) -> {
......@@ -174,6 +181,13 @@ 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
......@@ -227,4 +241,9 @@ public class FoodUnitPageFragment extends BaseSupplyChainFragment<FoodUnitPagePr
public void deleteDeputyUnit(int position) {
deputyUnitAdapter.removeAt(position);
}
@Override
public void deleteUnitKey(int position) {
basicUnitAdapter.removeAt(position);
}
}
......@@ -44,6 +44,7 @@
android:imeOptions="actionSearch"
android:hint="搜索供應商"
android:maxLines="1"
android:textCursorDrawable="@drawable/cursor_theme"
android:inputType="text"
android:textColor="@color/theme_333_color"
android:textColorHint="@color/hint_color"
......
<?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:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
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">
android:layout_height="wrap_content">
<TextView
android:id="@+id/tv_basic_unit"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
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
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_3"
android:layout_marginRight="@dimen/dp_3"
android:background="@color/white"
app:cardCornerRadius="@dimen/dp_8"
app:cardUseCompatPadding="true"
app:elevation="@dimen/dp_4">
<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>
\ No newline at end of file
<ImageView
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>
......@@ -3,6 +3,12 @@ package com.gingersoft.gsa.cloud.common.constans;
public class DeliveryPickConstans {
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";
}
......@@ -42,6 +42,8 @@ public class PrjBean {
private int id;
private int printerDeviceId;
private int status;//為2是帶*,需要切紙的
public static final int PRJ_CUTE = 2;
private String tableName;
private String orderNo;
private int orderTime;
......
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