Commit cae7d692 by Wyh

1、引入aspectjx 2、外送在線支付結賬報錯問題 3、自取訂單加上預留號碼 4、心跳長連接增加會員和設備號 5、供應鏈增加多個缺省頁

parent 6030444d
...@@ -13,8 +13,6 @@ buildscript { ...@@ -13,8 +13,6 @@ buildscript {
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.5.0' classpath 'com.android.tools.build:gradle:3.5.0'
// classpath 'com.android.tools.build:gradle:3.0.1'
// classpath "com.android.tools.build:gradle:4.0.1"
classpath 'com.android.tools:r8:2.1.67' classpath 'com.android.tools:r8:2.1.67'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0' classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
...@@ -30,10 +28,7 @@ buildscript { ...@@ -30,10 +28,7 @@ buildscript {
classpath 'org.greenrobot:greendao-gradle-plugin:3.3.0' classpath 'org.greenrobot:greendao-gradle-plugin:3.3.0'
classpath 'com.didichuxing.doraemonkit:dokitx-plugin:3.3.3' classpath 'com.didichuxing.doraemonkit:dokitx-plugin:3.3.3'
classpath 'com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.4'
// classpath 'org.aspectj:aspectjtools:1.8.13' // add
// classpath 'org.aspectj:aspectjrt:1.8.13' // add
// classpath fileTree(dir: 'plugins', include: ['*.jar'])
} }
} }
......
...@@ -147,6 +147,7 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw ...@@ -147,6 +147,7 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
network.thirdDelivery(requestBody.build()) network.thirdDelivery(requestBody.build())
} }
@Deprecated("統一使用gsUpdateOrderStatus")
suspend fun updateSelfOrderStatus(ids: String, status: String, restaurantId: String) = withContext(Dispatchers.IO) { suspend fun updateSelfOrderStatus(ids: String, status: String, restaurantId: String) = withContext(Dispatchers.IO) {
val requestBody = FormBody.Builder() val requestBody = FormBody.Builder()
.add("ids", ids) .add("ids", ids)
......
...@@ -44,6 +44,8 @@ public class OrderListBean { ...@@ -44,6 +44,8 @@ public class OrderListBean {
private int status; private int status;
//收貨電話 //收貨電話
private String phone; private String phone;
//會員電話
private String memberPhone;
//收貨聯繫人 //收貨聯繫人
private String receiver; private String receiver;
//訂單支付類型:0 店內支付,1 貨到付款,2 在線支付 //訂單支付類型:0 店內支付,1 貨到付款,2 在線支付
...@@ -285,6 +287,14 @@ public class OrderListBean { ...@@ -285,6 +287,14 @@ public class OrderListBean {
this.transportationType = transportationType; this.transportationType = transportationType;
} }
public String getMemberPhone() {
return memberPhone;
}
public void setMemberPhone(String memberPhone) {
this.memberPhone = memberPhone;
}
public int getPaymentValue() { public int getPaymentValue() {
return paymentValue; return paymentValue;
} }
......
...@@ -33,6 +33,7 @@ class CoolWeatherNetwork { ...@@ -33,6 +33,7 @@ class CoolWeatherNetwork {
private val rootGsaService = ServiceCreator.createRootGSA(WeatherService::class.java) private val rootGsaService = ServiceCreator.createRootGSA(WeatherService::class.java)
//獲取訂單列表 //獲取訂單列表
@Deprecated("使用getOrderList")
suspend fun fetchOrderList(requestBody: RequestBody) = ricepon_WechatService.getOrderList(requestBody).await() suspend fun fetchOrderList(requestBody: RequestBody) = ricepon_WechatService.getOrderList(requestBody).await()
//新的獲取訂單列表 //新的獲取訂單列表
...@@ -57,6 +58,7 @@ class CoolWeatherNetwork { ...@@ -57,6 +58,7 @@ class CoolWeatherNetwork {
suspend fun getShipanyOrderTime(requestBody: RequestBody) = gsposService.getShipanyOrderTime(requestBody).await() suspend fun getShipanyOrderTime(requestBody: RequestBody) = gsposService.getShipanyOrderTime(requestBody).await()
//修改訂單狀態 //修改訂單狀態
@Deprecated("使用gsUpdateOrderStatus")
suspend fun updateOrderStatus(requestBody: RequestBody) = ricepon_WechatService.updateOrderStatus(requestBody).await() suspend fun updateOrderStatus(requestBody: RequestBody) = ricepon_WechatService.updateOrderStatus(requestBody).await()
//gspost修改訂單狀態 //gspost修改訂單狀態
...@@ -71,6 +73,7 @@ class CoolWeatherNetwork { ...@@ -71,6 +73,7 @@ class CoolWeatherNetwork {
suspend fun updateIsRead(requestBody: RequestBody) = service.updateIsRead(requestBody).await() suspend fun updateIsRead(requestBody: RequestBody) = service.updateIsRead(requestBody).await()
//修改自取訂單狀態 //修改自取訂單狀態
@Deprecated("統一使用gsUpdateOrderStatus")
suspend fun updateSelfOrderStatus(requestBody: RequestBody) = ricepon_WechatService.updateSelfOrderStatus(requestBody).await() suspend fun updateSelfOrderStatus(requestBody: RequestBody) = ricepon_WechatService.updateSelfOrderStatus(requestBody).await()
// 獲取餐廳配送人員信息 // 獲取餐廳配送人員信息
......
...@@ -10,6 +10,7 @@ import retrofit2.http.* ...@@ -10,6 +10,7 @@ import retrofit2.http.*
interface WeatherService { interface WeatherService {
@POST("wechat/findOrderList") @POST("wechat/findOrderList")
@Deprecated("不用了,換getNewOrderList")
fun getOrderList(@Body requestBody: RequestBody): Call<OrderList> fun getOrderList(@Body requestBody: RequestBody): Call<OrderList>
@GET("orderInfo/getOrderList") @GET("orderInfo/getOrderList")
...@@ -34,6 +35,7 @@ interface WeatherService { ...@@ -34,6 +35,7 @@ interface WeatherService {
fun getShipanyOrderTime(@Body requestBody: RequestBody): Call<EstimatedBean> fun getShipanyOrderTime(@Body requestBody: RequestBody): Call<EstimatedBean>
@POST("wechat/updateOrderStatus") @POST("wechat/updateOrderStatus")
@Deprecated("使用gsUpdateOrderStatus")
fun updateOrderStatus(@Body requestBody: RequestBody): Call<UpdateOrderBean> fun updateOrderStatus(@Body requestBody: RequestBody): Call<UpdateOrderBean>
@POST("order/updateOrderStatus") @POST("order/updateOrderStatus")
...@@ -49,6 +51,7 @@ interface WeatherService { ...@@ -49,6 +51,7 @@ interface WeatherService {
fun updateIsRead(@Body requestBody: RequestBody): Call<String> fun updateIsRead(@Body requestBody: RequestBody): Call<String>
@POST("wechat/updateSelfOrderStatus") @POST("wechat/updateSelfOrderStatus")
@Deprecated("統一使用gsUpdateOrderStatus")
fun updateSelfOrderStatus(@Body requestBody: RequestBody): Call<UpdateOrderBean> fun updateSelfOrderStatus(@Body requestBody: RequestBody): Call<UpdateOrderBean>
@POST("wechat/findRestDelivery") @POST("wechat/findRestDelivery")
......
...@@ -638,10 +638,12 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -638,10 +638,12 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
} }
orderDetails.payTime = TimeUtils.getCurrentTimeInString(TimeUtils.DEFAULT_DATE_FORMAT) orderDetails.payTime = TimeUtils.getCurrentTimeInString(TimeUtils.DEFAULT_DATE_FORMAT)
val bean = GsonUtils.GsonToBean(GsonUtils.GsonString(data), OrderClosingBean::class.java) val bean = GsonUtils.GsonToBean(GsonUtils.GsonString(data), OrderClosingBean::class.java)
orderDetails.oldPoints = bean.oldPoints bean?.let {
orderDetails.nowPoints = bean.nowPoints orderDetails.oldPoints = bean.oldPoints
orderDetails.addPoints = bean.addPoints orderDetails.nowPoints = bean.nowPoints
printOrderClosing(orderDetails, listener) orderDetails.addPoints = bean.addPoints
printOrderClosing(orderDetails, listener)
}
} }
}, { }, {
listener.invoke(ErrorCode, false) listener.invoke(ErrorCode, false)
......
...@@ -361,10 +361,10 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() { ...@@ -361,10 +361,10 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
finish() finish()
} }
errorCode == PageViewModel.ErrorCode -> { errorCode == PageViewModel.ErrorCode -> {
ToastUtils.show(this@OrderDetailsActivity, "程序出現異常,請退出重試") ToastUtils.show(this@OrderDetailsActivity, "出問題啦,請退出重試")
} }
else -> { else -> {
ToastUtils.show(this@OrderDetailsActivity, "結賬失敗,請退出重試") ToastUtils.show(this@OrderDetailsActivity, "結賬失敗,請退出重試")
} }
} }
} }
......
...@@ -18,7 +18,7 @@ import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.OrderListBean ...@@ -18,7 +18,7 @@ import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.OrderListBean
import com.gingersoft.gsa.delivery_pick_mode.databinding.LayoutDeliveryOrderItemBinding import com.gingersoft.gsa.delivery_pick_mode.databinding.LayoutDeliveryOrderItemBinding
import com.scwang.smartrefresh.layout.util.SmartUtil.dp2px import com.scwang.smartrefresh.layout.util.SmartUtil.dp2px
class OrderListAdapter(var outTime: Int, var dataBean: List<OrderListBean> = ArrayList()) : Adapter<OrderListAdapter.ViewHolder>() { class OrderListAdapter(var context: Context, var outTime: Int, var dataBean: List<OrderListBean> = ArrayList()) : Adapter<OrderListAdapter.ViewHolder>() {
private var listener: ((item: OrderListBean) -> Unit)? = null private var listener: ((item: OrderListBean) -> Unit)? = null
...@@ -29,6 +29,13 @@ class OrderListAdapter(var outTime: Int, var dataBean: List<OrderListBean> = Arr ...@@ -29,6 +29,13 @@ class OrderListAdapter(var outTime: Int, var dataBean: List<OrderListBean> = Arr
override fun onBindViewHolder(holder: ViewHolder, position: Int) { override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val data = dataBean[position] val data = dataBean[position]
holder.binding.data = data holder.binding.data = data
//收貨人名稱那一列的數據為 收貨人(會員手機號)
var nameColumn: String = data.receiver + String.format(context.getString(R.string.str_parenthesis_format), data.memberPhone)
if (data.memberPhone != data.phone) {
//如果會員手機號和預留號碼不一致,需要再加上預留號碼
nameColumn += String.format(context.getString(R.string.str_parenthesis_format), data.phone)
}
holder.binding.nameColumnData = nameColumn
holder.binding.isSelf = data.orderType == 7 holder.binding.isSelf = data.orderType == 7
if (data.orderType != 7 && data.isDelete == 0) { if (data.orderType != 7 && data.isDelete == 0) {
holder.binding.deliveryState = when (data.curStatNumber) { holder.binding.deliveryState = when (data.curStatNumber) {
......
...@@ -2,7 +2,6 @@ package com.gingersoft.gsa.delivery_pick_mode.ui.fragment ...@@ -2,7 +2,6 @@ package com.gingersoft.gsa.delivery_pick_mode.ui.fragment
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
...@@ -75,7 +74,7 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) { ...@@ -75,7 +74,7 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) {
private fun initRecyclerView() { private fun initRecyclerView() {
rv_other_order.layoutManager = LinearLayoutManager(activity) rv_other_order.layoutManager = LinearLayoutManager(activity)
adapter = OrderListAdapter(pageViewModel.timeOut * 60 * 1000) adapter = OrderListAdapter(requireContext().applicationContext, pageViewModel.timeOut * 60 * 1000)
adapter.setOnItemClickListener { data -> adapter.setOnItemClickListener { data ->
// 點擊查詢食品詳情 // 點擊查詢食品詳情
val intent = Intent(activity, OrderDetailsActivity::class.java) val intent = Intent(activity, OrderDetailsActivity::class.java)
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android" <layout 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">
<data> <data>
...@@ -97,7 +98,8 @@ ...@@ -97,7 +98,8 @@
android:layout_margin="@dimen/other_order_info_dialog_content_marginLeft" android:layout_margin="@dimen/other_order_info_dialog_content_marginLeft"
android:text="@{data.order_from==7?@string/h5_order:@string/ricepon_order}" android:text="@{data.order_from==7?@string/h5_order:@string/ricepon_order}"
android:textSize="@dimen/dp_16" android:textSize="@dimen/dp_16"
android:textStyle="normal" /> android:textStyle="normal"
tools:text="訂單來源" />
<TextView <TextView
android:id="@+id/tv_order_state" android:id="@+id/tv_order_state"
...@@ -107,7 +109,8 @@ ...@@ -107,7 +109,8 @@
android:layout_margin="@dimen/other_order_info_dialog_content_marginRight" android:layout_margin="@dimen/other_order_info_dialog_content_marginRight"
android:text="@{orderStatus}" android:text="@{orderStatus}"
android:textColor="#009788" android:textColor="#009788"
android:textSize="@dimen/dp_15" /> android:textSize="@dimen/dp_15"
tools:text="訂單狀態" />
</RelativeLayout> </RelativeLayout>
<include layout="@layout/include_horizontal_color_eee_dividing_line" /> <include layout="@layout/include_horizontal_color_eee_dividing_line" />
...@@ -123,7 +126,8 @@ ...@@ -123,7 +126,8 @@
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
android:focusableInTouchMode="true" android:focusableInTouchMode="true"
android:text="@{@string/order_no + data.oRDER_NO}" /> android:text="@{@string/order_no + data.oRDER_NO}"
tools:text="@string/order_no" />
<TextView <TextView
android:id="@+id/tv_create_time" android:id="@+id/tv_create_time"
...@@ -132,7 +136,8 @@ ...@@ -132,7 +136,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/other_order_info_dialog_content_marginLeft" android:layout_marginLeft="@dimen/other_order_info_dialog_content_marginLeft"
android:layout_marginRight="@dimen/dp_10" android:layout_marginRight="@dimen/dp_10"
android:text="@{@string/create_order_time + TimeUtils.parseTimeRepeat(data.cREATE_TIME,TimeUtils.DEFAULT_DATE_FORMAT)}" /> android:text="@{@string/create_order_time + TimeUtils.parseTimeRepeat(data.cREATE_TIME,TimeUtils.DEFAULT_DATE_FORMAT)}"
tools:text="@string/create_order_time" />
<TextView <TextView
style="@style/otherOrder_details_twelve_text_Style" style="@style/otherOrder_details_twelve_text_Style"
...@@ -254,7 +259,8 @@ ...@@ -254,7 +259,8 @@
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="@{isSelf?@string/reserved_telephone:@string/receiving_telephone}" /> android:text="@{isSelf?@string/reserved_telephone:@string/receiving_telephone}"
tools:text="@string/reserved_telephone" />
<TextView <TextView
android:id="@+id/tv_receive_phone" android:id="@+id/tv_receive_phone"
...@@ -264,7 +270,7 @@ ...@@ -264,7 +270,7 @@
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_toRightOf="@id/tv_receive_phone_text" android:layout_toRightOf="@id/tv_receive_phone_text"
android:gravity="right" android:gravity="right"
android:text="@{data.pHONE}" /> android:text="@{data.pHONE.equals(data.memberPhone)?data.pHONE:data.memberPhone +'(' + data.pHONE + ')'}" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
...@@ -279,7 +285,8 @@ ...@@ -279,7 +285,8 @@
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="@{isSelf?@string/self_taking_time:@string/receiving_time}" /> android:text="@{isSelf?@string/self_taking_time:@string/receiving_time}"
tools:text="@string/self_taking_time" />
<TextView <TextView
android:id="@+id/tv_receive_time" android:id="@+id/tv_receive_time"
......
...@@ -53,6 +53,10 @@ ...@@ -53,6 +53,10 @@
<variable <variable
name="isTimeOut" name="isTimeOut"
type="Boolean" /> type="Boolean" />
<variable
name="nameColumnData"
type="String" />
</data> </data>
<FrameLayout <FrameLayout
...@@ -151,11 +155,11 @@ ...@@ -151,11 +155,11 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_2" android:layout_marginTop="@dimen/dp_2"
android:layout_marginRight="@dimen/dp_10" android:layout_marginRight="@dimen/dp_10"
android:text="@{data.receiver + @string/left_parenthesis+data.phone + @string/right_parenthesis}" android:text="@{nameColumnData}"
android:textColor="@color/theme_text_color" android:textColor="@color/theme_text_color"
android:textSize="@dimen/sp_14" android:textSize="@dimen/sp_14"
android:textStyle="bold" android:textStyle="bold"
tools:text="用戶名+手機號(1234567862)" tools:text="用戶名+會員號(預留號碼)如果會員手機號和預留號碼一致,只顯示一個"
tools:textColor="@color/theme_333_color" /> tools:textColor="@color/theme_333_color" />
<TextView <TextView
......
...@@ -167,39 +167,39 @@ public class HomePresenter extends BasePresenter<HomeContract.Model, HomeContrac ...@@ -167,39 +167,39 @@ public class HomePresenter extends BasePresenter<HomeContract.Model, HomeContrac
// .add("version", ) // .add("version", )
// .add("type", "2") // .add("type", "2")
// .build(); // .build();
mModel.checkAppVersion(DeviceUtils.getVersionName(mApplication) + "|" + DeviceUtils.getVersionCode(mApplication)) // mModel.checkAppVersion(DeviceUtils.getVersionName(mApplication) + "|" + DeviceUtils.getVersionCode(mApplication))
.subscribeOn(Schedulers.io()) // .subscribeOn(Schedulers.io())
.subscribeOn(AndroidSchedulers.mainThread()) // .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) // .observeOn(AndroidSchedulers.mainThread())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView)) // .compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<CheckVersionRequest>(mErrorHandler) { // .subscribe(new ErrorHandleSubscriber<CheckVersionRequest>(mErrorHandler) {
//
@Override // @Override
public void onNext(@NonNull CheckVersionRequest info) { // public void onNext(@NonNull CheckVersionRequest info) {
if (info != null) { // if (info != null) {
/** // /**
* 操作类型: // * 操作类型:
* 1、不提示更新 // * 1、不提示更新
* 2、提示更新可选择更新 // * 2、提示更新可选择更新
* 3、强行更新 // * 3、强行更新
* 4、跳转goole play下载app 没安装goole play就用webview打开goole网页下载 // * 4、跳转goole play下载app 没安装goole play就用webview打开goole网页下载
* 5、跳转goole play下载app 没安装goole play就用浏览器打开goole网页下载 // * 5、跳转goole play下载app 没安装goole play就用浏览器打开goole网页下载
*/ // */
int operate = info.getOperate(); // int operate = info.getOperate();
if (operate == 2 || operate == 3 || operate == 4 || operate == 5) { // if (operate == 2 || operate == 3 || operate == 4 || operate == 5) {
String updatePath = info.getUpdatePath(); // String updatePath = info.getUpdatePath();
if (!TextUtils.isEmpty(updatePath) && !updatePath.equals("null")) { // if (!TextUtils.isEmpty(updatePath) && !updatePath.equals("null")) {
updateAPK(operate, updatePath); // updateAPK(operate, updatePath);
} else { // } else {
if (operate == 3) { // if (operate == 3) {
mAppManager.appExit(); // mAppManager.appExit();
} // }
} // }
} // }
} else { // } else {
} // }
} // }
}); // });
} }
public void loginOut() { public void loginOut() {
......
...@@ -101,39 +101,39 @@ public class NewMainPresenter extends BasePresenter<NewMainContract.Model, NewMa ...@@ -101,39 +101,39 @@ public class NewMainPresenter extends BasePresenter<NewMainContract.Model, NewMa
// .add("version", ) // .add("version", )
// .add("type", "2") // .add("type", "2")
// .build(); // .build();
mModel.checkAppVersion(DeviceUtils.getVersionName(mApplication) + "|" + DeviceUtils.getVersionCode(mApplication)) // mModel.checkAppVersion(DeviceUtils.getVersionName(mApplication) + "|" + DeviceUtils.getVersionCode(mApplication))
.subscribeOn(Schedulers.io()) // .subscribeOn(Schedulers.io())
.subscribeOn(AndroidSchedulers.mainThread()) // .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) // .observeOn(AndroidSchedulers.mainThread())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView)) // .compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<CheckVersionRequest>(mErrorHandler) { // .subscribe(new ErrorHandleSubscriber<CheckVersionRequest>(mErrorHandler) {
//
@Override // @Override
public void onNext(@NonNull CheckVersionRequest info) { // public void onNext(@NonNull CheckVersionRequest info) {
if (info != null) { // if (info != null) {
/** // /**
* 操作类型: // * 操作类型:
* 1、不提示更新 // * 1、不提示更新
* 2、提示更新可选择更新 // * 2、提示更新可选择更新
* 3、强行更新 // * 3、强行更新
* 4、跳转goole play下载app 没安装goole play就用webview打开goole网页下载 // * 4、跳转goole play下载app 没安装goole play就用webview打开goole网页下载
* 5、跳转goole play下载app 没安装goole play就用浏览器打开goole网页下载 // * 5、跳转goole play下载app 没安装goole play就用浏览器打开goole网页下载
*/ // */
int operate = info.getOperate(); // int operate = info.getOperate();
if (operate == 2 || operate == 3 || operate == 4 || operate == 5) { // if (operate == 2 || operate == 3 || operate == 4 || operate == 5) {
String updatePath = info.getUpdatePath(); // String updatePath = info.getUpdatePath();
if (!TextUtils.isEmpty(updatePath) && !updatePath.equals("null")) { // if (!TextUtils.isEmpty(updatePath) && !updatePath.equals("null")) {
updateAPK(operate, updatePath); // updateAPK(operate, updatePath);
} else { // } else {
if (operate == 3) { // if (operate == 3) {
mAppManager.appExit(); // mAppManager.appExit();
} // }
} // }
} // }
} else { // } else {
} // }
} // }
}); // });
} }
public void loginOut() { public void loginOut() {
......
...@@ -3,6 +3,7 @@ package com.joe.print.mvp.presenter; ...@@ -3,6 +3,7 @@ package com.joe.print.mvp.presenter;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.common.bean.BaseResult; import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean; import com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean;
import com.jess.arms.di.scope.ActivityScope; import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.http.imageloader.ImageLoader; import com.jess.arms.http.imageloader.ImageLoader;
...@@ -121,6 +122,10 @@ public class PrinterAddPresenter extends BasePresenter<PrinterAddContract.Model, ...@@ -121,6 +122,10 @@ public class PrinterAddPresenter extends BasePresenter<PrinterAddContract.Model,
if (baseResult.isSuccess()) { if (baseResult.isSuccess()) {
mRootView.showMessage("保存成功"); mRootView.showMessage("保存成功");
mRootView.killMyself(); mRootView.killMyself();
} else if(TextUtil.isEmptyOrNullOrUndefined(baseResult.getErrMsg())){
mRootView.showMessage("出錯啦,請稍候重試");
} else {
mRootView.showMessage(baseResult.getErrMsg());
} }
} }
}); });
......
...@@ -253,21 +253,21 @@ public class PrintPrjKitchen extends PrinterRoot { ...@@ -253,21 +253,21 @@ public class PrintPrjKitchen extends PrinterRoot {
} }
setFoodItemType(data); setFoodItemType(data);
View view; View view;
if (PrjService.isPinPrinter(printerDeviceBean)) { // if (PrjService.isPinPrinter(printerDeviceBean)) {
//针式暂时用这个新的布局 //针式暂时用这个新的布局
view = LinearLayout.inflate(context, R.layout.print_dot_matrix_kitchen, null); view = LinearLayout.inflate(context, R.layout.print_dot_matrix_kitchen2, null);
} else { // } else {
view = LinearLayout.inflate(context, R.layout.print_kitchen, null); // view = LinearLayout.inflate(context, R.layout.print_kitchen, null);
} // }
TextView tvTableNumber = view.findViewById(R.id.tv_kitchen_print_table_number); TextView tvTableNumber = view.findViewById(R.id.tv_kitchen_print_table_number);
TextView tvOrderNumberText = view.findViewById(R.id.tv_order_num_text); TextView tvOrderNumberText = view.findViewById(R.id.tv_order_num_text);
TextView tvOrderNumber = view.findViewById(R.id.tv_order_num); TextView tvOrderNumber = view.findViewById(R.id.tv_order_num);
TextView tvTakeCodeText = view.findViewById(R.id.tv_take_code_text); // TextView tvTakeCodeText = view.findViewById(R.id.tv_take_code_text);
TextView tvTakeCode = view.findViewById(R.id.tv_take_code); TextView tvTakeCode = view.findViewById(R.id.tv_take_code);
TextView tvTakeTime = view.findViewById(R.id.tv_food_time); TextView tvTakeTime = view.findViewById(R.id.tv_food_time);
TextView tvOpeningTime = view.findViewById(R.id.tv_opening_time); TextView tvOpeningTime = view.findViewById(R.id.tv_opening_time);
TextView tvOrderTime = view.findViewById(R.id.tv_order_time); TextView tvOrderTime = view.findViewById(R.id.tv_order_time);
TextView tvKitChenLocationText = view.findViewById(R.id.tv_kitchen_location_text); // TextView tvKitChenLocationText = view.findViewById(R.id.tv_kitchen_location_text);
TextView tvKitChenLocation = view.findViewById(R.id.tv_kitchen_location); TextView tvKitChenLocation = view.findViewById(R.id.tv_kitchen_location);
TextView tvPeople = view.findViewById(R.id.tv_people); TextView tvPeople = view.findViewById(R.id.tv_people);
TextView tvCurrentPageIndex = view.findViewById(R.id.tv_prj_page_index); TextView tvCurrentPageIndex = view.findViewById(R.id.tv_prj_page_index);
...@@ -278,25 +278,21 @@ public class PrintPrjKitchen extends PrinterRoot { ...@@ -278,25 +278,21 @@ public class PrintPrjKitchen extends PrinterRoot {
TextView tvOrderReserved = view.findViewById(R.id.tv_order_reserved); TextView tvOrderReserved = view.findViewById(R.id.tv_order_reserved);
LinearLayout llWaiter = view.findViewById(R.id.ll_waiter); LinearLayout llWaiter = view.findViewById(R.id.ll_waiter);
TextView tvWaiterText = view.findViewById(R.id.tv_waiter_text);
TextView tvWaiter = view.findViewById(R.id.tv_waiter); TextView tvWaiter = view.findViewById(R.id.tv_waiter);
LinearLayout layoutOpenTableTime = view.findViewById(R.id.ll_opening_table_time); // LinearLayout layoutOpenTableTime = view.findViewById(R.id.ll_opening_table_time);
foodLayout.addView(new KitChenPrjFoodView(context, data, printerDeviceBean)); foodLayout.addView(new KitChenPrjFoodView(context, data, printerDeviceBean));
//廚房位置 //廚房位置
if (!TextUtil.isEmptyOrNullOrUndefined(key) && !key.equals("-1")) { if (!TextUtil.isEmptyOrNullOrUndefined(key) && !key.equals("-1")) {
tvKitChenLocationText.setVisibility(View.VISIBLE);
tvKitChenLocation.setVisibility(View.VISIBLE); tvKitChenLocation.setVisibility(View.VISIBLE);
tvKitChenLocation.setText(key); tvKitChenLocation.setText(key);
} else { } else {
tvKitChenLocationText.setVisibility(View.GONE);
tvKitChenLocation.setVisibility(View.GONE); tvKitChenLocation.setVisibility(View.GONE);
} }
if (!TextUtil.isEmptyOrNullOrUndefined(prjBean.getBillNo())) { if (!TextUtil.isEmptyOrNullOrUndefined(prjBean.getBillNo())) {
//訂單碼不為空 //訂單碼不為空
tvOrderNumberText.setText("訂單碼:"); tvOrderNumberText.setText(String.format(context.getString(R.string.str_order_code), ""));
tvOrderNumber.setText(prjBean.getBillNo()); tvOrderNumber.setText(prjBean.getBillNo());
} else { } else {
//訂單號 //訂單號
...@@ -305,52 +301,52 @@ public class PrintPrjKitchen extends PrinterRoot { ...@@ -305,52 +301,52 @@ public class PrintPrjKitchen extends PrinterRoot {
switch (prjBean.getOrderType()) { switch (prjBean.getOrderType()) {
case OrderTypeConstans.order_type_1: case OrderTypeConstans.order_type_1:
case OrderTypeConstans.order_type_3: case OrderTypeConstans.order_type_3:
tvTableNumber.setText("堂食"); tvTableNumber.setText(context.getString(R.string.str_dine));
tvTableNumber2.setText("堂食"); tvTableNumber2.setText(context.getString(R.string.str_dine));
tvTableNumber.setText(prjBean.getTableName()); tvTableNumber.setText(prjBean.getTableName());
tvTableNumber2.setText(prjBean.getTableName()); tvTableNumber2.setText(prjBean.getTableName());
break; break;
case OrderTypeConstans.order_type_7: case OrderTypeConstans.order_type_7:
layoutOpenTableTime.setVisibility(View.GONE); tvOpeningTime.setVisibility(View.GONE);
tvTableNumber.setText("自取"); tvTableNumber.setText(context.getString(R.string.str_self_collection));
tvTableNumber2.setText("自取"); tvTableNumber2.setText(context.getString(R.string.str_self_collection));
if (!TextUtil.isEmptyOrNullOrUndefined(prjBean.getTakeFoodCode())) { if (!TextUtil.isEmptyOrNullOrUndefined(prjBean.getTakeFoodCode())) {
tvTakeCodeText.setVisibility(View.VISIBLE);
tvTakeCode.setVisibility(View.VISIBLE); tvTakeCode.setVisibility(View.VISIBLE);
tvTakeCode.setText(prjBean.getTakeFoodCode()); tvTakeCode.setText(String.format(context.getString(R.string.str_take_meal_code), prjBean.getTakeFoodCode()));
} }
break; break;
case OrderTypeConstans.order_type_8: case OrderTypeConstans.order_type_8:
layoutOpenTableTime.setVisibility(View.GONE); tvOpeningTime.setVisibility(View.GONE);
tvTableNumber.setText("凍鏈"); tvTableNumber.setText(context.getString(R.string.str_cold_chain));
tvTableNumber2.setText("凍鏈"); tvTableNumber2.setText(context.getString(R.string.str_cold_chain));
tvOrderNumberText.setText("訂單碼:"); tvOrderNumberText.setText(String.format(context.getString(R.string.str_order_code), ""));
tvOrderNumber.setText(prjBean.getTakeFoodCode()); tvOrderNumber.setText(prjBean.getTakeFoodCode());
break; break;
default: default:
layoutOpenTableTime.setVisibility(View.GONE); tvOpeningTime.setVisibility(View.GONE);
tvTableNumber.setText("外賣"); tvTableNumber.setText(context.getString(R.string.str_takeaway));
tvTableNumber2.setText("外賣"); tvTableNumber2.setText(context.getString(R.string.str_takeaway));
tvOrderNumberText.setText("訂單碼:"); tvOrderNumberText.setText(String.format(context.getString(R.string.str_order_code), ""));
tvOrderNumber.setText(prjBean.getTakeFoodCode()); tvOrderNumber.setText(prjBean.getTakeFoodCode());
break; break;
} }
//操作人員名稱0 //操作人員名稱
if (!TextUtils.isEmpty(prjBean.getUserName())) { if (!TextUtils.isEmpty(prjBean.getUserName())) {
tvWaiter.setText(prjBean.getUserName()); tvWaiter.setText(String.format(context.getString(R.string.str_waiter), prjBean.getUserName()));
} else if (TextUtil.isNotEmptyOrNullOrUndefined(prjBean.getMemberName())) {
tvWaiter.setText(String.format(context.getString(R.string.str_waiter), prjBean.getMemberName()));
} else { } else {
tvWaiter.setText(prjBean.getMemberName()); tvWaiter.setVisibility(View.GONE);
} }
//人數 //人數
tvPeople.setText(prjBean.getPerson() + ""); tvPeople.setText(String.valueOf(prjBean.getPerson()));
int visibility = prjBean.getPerson() == 0 ? View.GONE : View.VISIBLE; int visibility = prjBean.getPerson() == 0 ? View.GONE : View.VISIBLE;
view.findViewById(R.id.tv_people_text).setVisibility(visibility);
tvPeople.setVisibility(visibility); tvPeople.setVisibility(visibility);
if (TextUtil.isNotEmptyOrNullOrUndefined(prjBean.getTakeTime())) { if (TextUtil.isNotEmptyOrNullOrUndefined(prjBean.getTakeTime())) {
tvTakeTime.setText("取餐:" + prjBean.getTakeTime()); tvTakeTime.setText(String.format(context.getString(R.string.str_take_meal), prjBean.getTakeTime()));
} else if (TextUtil.isNotEmptyOrNullOrUndefined(prjBean.getSendTime())) { } else if (TextUtil.isNotEmptyOrNullOrUndefined(prjBean.getSendTime())) {
tvTakeTime.setText("送達:" + prjBean.getSendTime()); tvTakeTime.setText(String.format(context.getString(R.string.str_service), prjBean.getSendTime()));
} else { } else {
tvTakeTime.setVisibility(View.GONE); tvTakeTime.setVisibility(View.GONE);
} }
...@@ -362,14 +358,14 @@ public class PrintPrjKitchen extends PrinterRoot { ...@@ -362,14 +358,14 @@ public class PrintPrjKitchen extends PrinterRoot {
} }
if (RestaurantExpandInfoUtils.getValue(ExpandConstant.PrintStatisticsAmount, false)) { if (RestaurantExpandInfoUtils.getValue(ExpandConstant.PrintStatisticsAmount, false)) {
tvPrintQuantity.setText(prjBean.getQuantity() + ""); tvPrintQuantity.setText(String.valueOf(prjBean.getQuantity()));
} else { } else {
tvPrintQuantity.setVisibility(View.GONE); tvPrintQuantity.setVisibility(View.GONE);
} }
//開台時間 //開台時間
tvOpeningTime.setText(TimeUtils.parseTimeRepeat(prjBean.getOrderDetailsTime(), TimeUtils.DEFAULT_DATE_MDHM)); tvOpeningTime.setText(String.format(context.getString(R.string.str_set_up_table), TimeUtils.parseTimeRepeat(prjBean.getOrderDetailsTime(), TimeUtils.DEFAULT_DATE_MDHM)));
//落單時間,為當前時間 //落單時間,為當前時間
tvOrderTime.setText(TimeUtils.getCurrentTimeInString(TimeUtils.DEFAULT_DATE_MDHM)); tvOrderTime.setText(String.format(context.getString(R.string.str_place_an_order), TimeUtils.getCurrentTimeInString(TimeUtils.DEFAULT_DATE_MDHM)));
if (RestaurantExpandInfoUtils.getValue(ExpandConstant.PrintPage, false)) { if (RestaurantExpandInfoUtils.getValue(ExpandConstant.PrintPage, false)) {
if (prjBean.getCurrentIndex() <= prjBean.getTotalPrj()) { if (prjBean.getCurrentIndex() <= prjBean.getTotalPrj()) {
tvCurrentPageIndex.setText(prjBean.getCurrentIndex() + "/" + prjBean.getTotalPrj()); tvCurrentPageIndex.setText(prjBean.getCurrentIndex() + "/" + prjBean.getTotalPrj());
......
...@@ -158,6 +158,7 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem ...@@ -158,6 +158,7 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
String[] ips = new String[4]; String[] ips = new String[4];
//如果不為空,則是編輯打印機,初始化信息 //如果不為空,則是編輯打印機,初始化信息
if (printerDeviceBean != null) { if (printerDeviceBean != null) {
//初始化頁面數據項
mEdPrintName.setText(String.valueOf(printerDeviceBean.getName())); mEdPrintName.setText(String.valueOf(printerDeviceBean.getName()));
ips = printerDeviceBean.getIp().split("[.]"); ips = printerDeviceBean.getIp().split("[.]");
etPort.setText(printerDeviceBean.getPort() + ""); etPort.setText(printerDeviceBean.getPort() + "");
...@@ -173,7 +174,6 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem ...@@ -173,7 +174,6 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
} else { } else {
modifierFontSize = Integer.parseInt(printerDeviceBean.getModifierFont()); modifierFontSize = Integer.parseInt(printerDeviceBean.getModifierFont());
} }
if (printerDeviceBean.getPrinterName() != null) { if (printerDeviceBean.getPrinterName() != null) {
mTvModel.setTextColor(getResources().getColor(R.color.color_3c)); mTvModel.setTextColor(getResources().getColor(R.color.color_3c));
mTvModel.setText(printerDeviceBean.getPrinterName()); mTvModel.setText(printerDeviceBean.getPrinterName());
......
apply from: rootProject.file('cc-settings.gradle') apply from: rootProject.file('cc-settings.gradle')
apply plugin: 'com.jakewharton.butterknife' apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'android-aspectjx'
android { android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"] compileSdkVersion rootProject.ext.android["compileSdkVersion"]
...@@ -49,8 +50,25 @@ android { ...@@ -49,8 +50,25 @@ android {
shrinkResources false shrinkResources false
zipAlignEnabled false zipAlignEnabled false
proguardFiles 'proguard.cfg' proguardFiles 'proguard.cfg'
//修改生成的apk名字
if (project.ext.runAsApp) {
applicationVariants.all { variant ->
variant.outputs.all {
def fileName
def date = new Date()
def formattedDate = date.format('yyyy-MM-dd')
if (variant.buildType.name == 'release') {
fileName = "採購_${variant.mergedFlavor.versionName}_${formattedDate}.apk"
} else if (variant.buildType.name == 'debug') {
fileName = "採購_${variant.mergedFlavor.versionName}_${formattedDate}.apk"
}
outputFileName = fileName
}
}
}
} }
} }
} }
dependencies { dependencies {
...@@ -71,4 +89,54 @@ dependencies { ...@@ -71,4 +89,54 @@ dependencies {
if (project.ext.runAsApp) { if (project.ext.runAsApp) {
addComponent 'component-scan' addComponent 'component-scan'
} }
} aspectjx {
\ No newline at end of file enabled true
exclude 'androidx', 'org.jetbrains.kotlin',"module-info", 'com.google', 'com.squareup', 'org.apache', 'versions.9', 'com.squareup.okio', 'okio', 'leakcanary', 'com.google.firebase', 'com.google.android'
}
}
//import org.aspectj.bridge.IMessage
//import org.aspectj.bridge.MessageHandler
//import org.aspectj.tools.ajc.Main
//final def log = project.logger
//final def variants = project.android.applicationVariants
//
//variants.all { variant ->
// if (!variant.buildType.isDebuggable()) {
// log.debug("Skipping non-debuggable build type '${variant.buildType.name}'.")
// return;
// }
//
// JavaCompile javaCompile = variant.javaCompile
// javaCompile.doLast {
// String[] args = ["-showWeaveInfo",
// "-1.8",
// "-inpath", javaCompile.destinationDir.toString(),
// "-aspectpath", javaCompile.classpath.asPath,
// "-d", javaCompile.destinationDir.toString(),
// "-classpath", javaCompile.classpath.asPath,
// "-bootclasspath", project.android.bootClasspath.join(File.pathSeparator)]
// log.debug "ajc args: " + Arrays.toString(args)
//
// MessageHandler handler = new MessageHandler(true);
// new Main().run(args, handler);
// for (IMessage message : handler.getMessages(null, true)) {
// switch (message.getKind()) {
// case IMessage.ABORT:
// case IMessage.ERROR:
// case IMessage.FAIL:
// log.error message.message, message.thrown
// break;
// case IMessage.WARNING:
// log.warn message.message, message.thrown
// break;
// case IMessage.INFO:
// log.info message.message, message.thrown
// break;
// case IMessage.DEBUG:
// log.debug message.message, message.thrown
// break;
// }
// }
// }
//}
\ No newline at end of file
package com.gingersoft.supply_chain.mvp.bean; package com.gingersoft.supply_chain.mvp.bean;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil; import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils; import com.gingersoft.supply_chain.mvp.content.PurchaseConstant;
import com.gingersoft.supply_chain.mvp.content.Constant;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
...@@ -53,8 +51,8 @@ public class ConfirmOrderBean { ...@@ -53,8 +51,8 @@ public class ConfirmOrderBean {
PurchaseOrder purchaseOrder = new PurchaseOrder(); PurchaseOrder purchaseOrder = new PurchaseOrder();
purchaseOrder.setSupplierId(shoppingCartBean.getSupplierId()); purchaseOrder.setSupplierId(shoppingCartBean.getSupplierId());
purchaseOrder.setSupplierName(shoppingCartBean.getSupplierName()); purchaseOrder.setSupplierName(shoppingCartBean.getSupplierName());
purchaseOrder.setBrandId(Constant.getBrandId()); purchaseOrder.setBrandId(PurchaseConstant.getBrandId());
purchaseOrder.setRestaurantId(Constant.getRestaurantId()); purchaseOrder.setRestaurantId(PurchaseConstant.getRestaurantId());
purchaseOrder.setRemarks(shoppingCartBean.getRemarks()); purchaseOrder.setRemarks(shoppingCartBean.getRemarks());
purchaseOrder.setInitialShippingTime(shoppingCartBean.getInitialShippingTime()); purchaseOrder.setInitialShippingTime(shoppingCartBean.getInitialShippingTime());
purchaseOrder.setShipping(shoppingCartBean.getShipping()); purchaseOrder.setShipping(shoppingCartBean.getShipping());
......
package com.gingersoft.supply_chain.mvp.bean; package com.gingersoft.supply_chain.mvp.bean;
import com.gingersoft.supply_chain.mvp.content.Constant; import com.gingersoft.supply_chain.mvp.content.PurchaseConstant;
import com.qmuiteam.qmui.widget.section.QMUISection; import com.qmuiteam.qmui.widget.section.QMUISection;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
...@@ -82,7 +82,7 @@ public class PurchaseFoodBean implements Serializable, QMUISection.Model<Purchas ...@@ -82,7 +82,7 @@ public class PurchaseFoodBean implements Serializable, QMUISection.Model<Purchas
private boolean isChecked = true; private boolean isChecked = true;
/** /**
* 是否刪除 * 是否刪除
* {@link Constant.DELETE,Constant.NORMAL} * {@link PurchaseConstant.DELETE, PurchaseConstant.NORMAL}
*/ */
private int deletes; private int deletes;
private int restaurantId; private int restaurantId;
......
...@@ -17,7 +17,7 @@ import okhttp3.FormBody; ...@@ -17,7 +17,7 @@ import okhttp3.FormBody;
* Time: 16:27 * Time: 16:27
* Use: * Use:
*/ */
public class Constant { public class PurchaseConstant {
public static final int PAGE_SIZE = 10; public static final int PAGE_SIZE = 10;
public static final int PURCHASE_FOOD_MAX = 9999; public static final int PURCHASE_FOOD_MAX = 9999;
/** /**
......
...@@ -3,7 +3,6 @@ package com.gingersoft.supply_chain.mvp.contract; ...@@ -3,7 +3,6 @@ package com.gingersoft.supply_chain.mvp.contract;
import com.gingersoft.gsa.cloud.common.bean.BaseResult; import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.supply_chain.mvp.bean.FoodCategoryResultBean; import com.gingersoft.supply_chain.mvp.bean.FoodCategoryResultBean;
import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean; import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean;
import com.gingersoft.supply_chain.mvp.content.Constant;
import com.jess.arms.mvp.IModel; import com.jess.arms.mvp.IModel;
import com.jess.arms.mvp.IView; import com.jess.arms.mvp.IView;
......
...@@ -6,16 +6,13 @@ import android.util.Log; ...@@ -6,16 +6,13 @@ import android.util.Log;
import com.gingersoft.gsa.cloud.common.bean.BaseResult; import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.utils.CollectionUtils; import com.gingersoft.gsa.cloud.common.utils.CollectionUtils;
import com.gingersoft.gsa.cloud.common.utils.JsonUtils; import com.gingersoft.gsa.cloud.common.utils.JsonUtils;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.ui.bean.view.CategoryBean;
import com.gingersoft.supply_chain.mvp.bean.BuyIngredientsBean; import com.gingersoft.supply_chain.mvp.bean.BuyIngredientsBean;
import com.gingersoft.supply_chain.mvp.bean.CategoryFoodTreeBean;
import com.gingersoft.supply_chain.mvp.bean.FoodByCategoryResultBean; import com.gingersoft.supply_chain.mvp.bean.FoodByCategoryResultBean;
import com.gingersoft.supply_chain.mvp.bean.FoodListInfoBean; import com.gingersoft.supply_chain.mvp.bean.FoodListInfoBean;
import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean; import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean; import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import com.gingersoft.supply_chain.mvp.content.Constant; import com.gingersoft.supply_chain.mvp.content.PurchaseConstant;
import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart; import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart;
import com.jess.arms.integration.AppManager; import com.jess.arms.integration.AppManager;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
...@@ -25,7 +22,6 @@ import com.jess.arms.http.imageloader.ImageLoader; ...@@ -25,7 +22,6 @@ import com.jess.arms.http.imageloader.ImageLoader;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull; import io.reactivex.annotations.NonNull;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
import lombok.val;
import me.jessyan.rxerrorhandler.core.RxErrorHandler; import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber; import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
...@@ -33,16 +29,9 @@ import javax.inject.Inject; ...@@ -33,16 +29,9 @@ import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.BuyIngredientsContract; import com.gingersoft.supply_chain.mvp.contract.BuyIngredientsContract;
import com.jess.arms.utils.RxLifecycleUtils; import com.jess.arms.utils.RxLifecycleUtils;
import com.qmuiteam.qmui.widget.section.QMUISection;
import com.xuexiang.rxutil2.rxjava.RxJavaUtils;
import com.xuexiang.rxutil2.rxjava.task.RxIOTask;
import com.xuexiang.rxutil2.rxjava.task.RxUITask;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -126,19 +115,19 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac ...@@ -126,19 +115,19 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
return; return;
} }
Map<String, Object> map = new HashMap<>(2); Map<String, Object> map = new HashMap<>(2);
Constant.addBrandId(map); PurchaseConstant.addBrandId(map);
Constant.addRestaurantId(map); PurchaseConstant.addRestaurantId(map);
mModel.getCategoryTrees(map) mModel.getCategoryTrees(map)//發送請求
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())//切換到io異步線程
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.GET_INFO_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.GET_INFO_LOADING))//顯示加載提示框
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())//切換到主線程,上面的提示框就在主線程
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())//切換到主線程,隱藏提示框在主線程
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())//任務執行完成後,隱藏提示框
.compose(RxLifecycleUtils.bindToLifecycle(mRootView)) .compose(RxLifecycleUtils.bindToLifecycle(mRootView))//綁定生命週期,頁面隱藏時斷開請求
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())//切換到主線程
.subscribe(new ErrorHandleSubscriber<OrderCategoryBean>(mErrorHandler) { .subscribe(new ErrorHandleSubscriber<OrderCategoryBean>(mErrorHandler) {//mErrorHandler是統一的錯誤處理
@Override @Override
public void onNext(OrderCategoryBean orderCategoryBean) { public void onNext(OrderCategoryBean orderCategoryBean) {//數據處理
if (orderCategoryBean.isSuccess()) { if (orderCategoryBean.isSuccess()) {
List<OrderCategoryBean.FoodCategoryTrees> data = orderCategoryBean.getData(); List<OrderCategoryBean.FoodCategoryTrees> data = orderCategoryBean.getData();
if (data != null) { if (data != null) {
...@@ -156,7 +145,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac ...@@ -156,7 +145,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
} else if (TextUtil.isNotEmptyOrNullOrUndefined(orderCategoryBean.getErrMsg())) { } else if (TextUtil.isNotEmptyOrNullOrUndefined(orderCategoryBean.getErrMsg())) {
mRootView.showMessage(orderCategoryBean.getErrMsg()); mRootView.showMessage(orderCategoryBean.getErrMsg());
} else { } else {
mRootView.showMessage(Constant.GET_INFO_ERROR); mRootView.showMessage(PurchaseConstant.GET_INFO_ERROR);
} }
} }
}); });
...@@ -174,8 +163,8 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac ...@@ -174,8 +163,8 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
Map<String, Object> map = new HashMap<>(5); Map<String, Object> map = new HashMap<>(5);
map.put("pageSize", 1000); map.put("pageSize", 1000);
map.put("pageIndex", 0); map.put("pageIndex", 0);
Constant.addBrandId(map); PurchaseConstant.addBrandId(map);
Constant.addRestaurantId(map); PurchaseConstant.addRestaurantId(map);
map.put("parentId", categoryTrees.getId()); map.put("parentId", categoryTrees.getId());
mModel.getFoodByCategory(map) mModel.getFoodByCategory(map)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
...@@ -328,14 +317,14 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac ...@@ -328,14 +317,14 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
Map<String, Object> map = new HashMap<>(5); Map<String, Object> map = new HashMap<>(5);
map.put("pageSize", 1000); map.put("pageSize", 1000);
map.put("pageIndex", 0); map.put("pageIndex", 0);
Constant.addBrandId(map); PurchaseConstant.addBrandId(map);
Constant.addRestaurantId(map); PurchaseConstant.addRestaurantId(map);
if (supplierId != -1) { if (supplierId != -1) {
map.put("supplierId", supplierId); map.put("supplierId", supplierId);
} }
mModel.getFoodIngredientsData(map) mModel.getFoodIngredientsData(map)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.GET_INFO_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.GET_INFO_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -346,7 +335,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac ...@@ -346,7 +335,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
if (info.isSuccess() && info.getData() != null) { if (info.isSuccess() && info.getData() != null) {
List<FoodListInfoBean.DataBean> data = info.getData(); List<FoodListInfoBean.DataBean> data = info.getData();
if (data != null) { if (data != null) {
supplierFoods = new ArrayList<>(data.size()); initSupplierFoods(data.size());
supplierTranCategoryCache = new ArrayList<>(data.size()); supplierTranCategoryCache = new ArrayList<>(data.size());
//將顯示的商品列表清空 //將顯示的商品列表清空
clearShowFoods(); clearShowFoods();
...@@ -359,9 +348,9 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac ...@@ -359,9 +348,9 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
if (i == 0) { if (i == 0) {
BuyIngredientsBean buyIngredientsBean = conversionSupplierToShowInfo(supplierToCategory, dataBean.getPurchaseFoodListVOS()); BuyIngredientsBean buyIngredientsBean = conversionSupplierToShowInfo(supplierToCategory, dataBean.getPurchaseFoodListVOS());
showFoods.add(buyIngredientsBean); showFoods.add(buyIngredientsBean);
supplierFoods.add(buyIngredientsBean); supplierFoods.set(i, buyIngredientsBean);
} else { } else {
supplierFoods.add(null); supplierFoods.set(i, null);
} }
supplierTranCategoryCache.add(supplierToCategory); supplierTranCategoryCache.add(supplierToCategory);
} }
...@@ -435,8 +424,8 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac ...@@ -435,8 +424,8 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
Map<String, Object> map = new HashMap<>(5); Map<String, Object> map = new HashMap<>(5);
map.put("pageSize", 1000); map.put("pageSize", 1000);
map.put("pageIndex", 0); map.put("pageIndex", 0);
Constant.addBrandId(map); PurchaseConstant.addBrandId(map);
Constant.addRestaurantId(map); PurchaseConstant.addRestaurantId(map);
if (foodCategoryTrees != null) { if (foodCategoryTrees != null) {
map.put("supplierId", foodCategoryTrees.getId()); map.put("supplierId", foodCategoryTrees.getId());
} }
...@@ -468,6 +457,57 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac ...@@ -468,6 +457,57 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
}); });
} }
/**
* 刪除食品
*
* @param categoryPosition 分類在一級分類的位置,用戶如果現在顯示的是供應商,則值為-1
* @param groupPosition 組下標
* @param position 在組中的下標
*/
public void deleteFood(int foodId, int categoryPosition, int groupPosition, int position) {
mModel.deleteFood(foodId)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.DELETE_LOADING))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterNext(dis -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(BaseResult baseResult) {
if (baseResult.isSuccess()) {
//需要在供應商和分類的緩存中這個食品移除
// if (categoryPosition == -1) {
// //頁面顯示供應商,那就把所有分類的數據清空
// clearCategoryFoods();
// supplierFoods.get(groupPosition).purchaseFoodList.remove(position);
// } else {
// categoryFoods.get(categoryPosition).get(groupPosition).purchaseFoodList.remove(position);
// clearSupplierFoods();
// }
showFoods.get(groupPosition).purchaseFoodList.remove(position);
//移除在購物車中的緩存
SupplyShoppingCart.getInstance().removeFoodsByFoodId(foodId);
// mRootView.onDeleteFoodSuccess(position);
mRootView.loadFood(showFoods, true, true);
} else if (TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg());
} else {
mRootView.showMessage(PurchaseConstant.DELETE_FAIL);
}
}
});
}
/**
* 如果頁面單是顯示一個供應商食材,那麼外部就要調用到這個,長度設置為一
*/
public void initSupplierFoods(int length) {
supplierFoods = new ArrayList<>(length);
for (int i = 0; i < length; i++) {
supplierFoods.add(null);
}
}
/** /**
* @return 用戶採購的食材 * @return 用戶採購的食材
......
...@@ -3,14 +3,11 @@ package com.gingersoft.supply_chain.mvp.presenter; ...@@ -3,14 +3,11 @@ package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.common.bean.BaseResult; import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils; import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.order.cart.ShoppingCart;
import com.gingersoft.supply_chain.mvp.bean.CategoryFoodTreeBean;
import com.gingersoft.supply_chain.mvp.bean.FoodCategoryResultBean; import com.gingersoft.supply_chain.mvp.bean.FoodCategoryResultBean;
import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean; import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean;
import com.gingersoft.supply_chain.mvp.content.Constant; import com.gingersoft.supply_chain.mvp.content.PurchaseConstant;
import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart; import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart;
import com.gingersoft.supply_chain.mvp.contract.CategoryContract; import com.gingersoft.supply_chain.mvp.contract.CategoryContract;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
...@@ -20,6 +17,7 @@ import com.jess.arms.mvp.BasePresenter; ...@@ -20,6 +17,7 @@ import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.RxLifecycleUtils; import com.jess.arms.utils.RxLifecycleUtils;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import javax.inject.Inject; import javax.inject.Inject;
...@@ -80,11 +78,11 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat ...@@ -80,11 +78,11 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat
*/ */
public void getCategoryTrees() { public void getCategoryTrees() {
Map<String, Object> map = new HashMap<>(2); Map<String, Object> map = new HashMap<>(2);
Constant.addBrandId(map); PurchaseConstant.addBrandId(map);
Constant.addRestaurantId(map); PurchaseConstant.addRestaurantId(map);
mModel.getCategoryTrees(map) mModel.getCategoryTrees(map)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.GET_INFO_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.GET_INFO_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -98,7 +96,7 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat ...@@ -98,7 +96,7 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat
} else if (TextUtil.isNotEmptyOrNullOrUndefined(orderCategoryBean.getErrMsg())) { } else if (TextUtil.isNotEmptyOrNullOrUndefined(orderCategoryBean.getErrMsg())) {
mRootView.showMessage(orderCategoryBean.getErrMsg()); mRootView.showMessage(orderCategoryBean.getErrMsg());
} else { } else {
mRootView.showMessage(Constant.GET_INFO_ERROR); mRootView.showMessage(PurchaseConstant.GET_INFO_ERROR);
} }
} }
...@@ -123,7 +121,7 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat ...@@ -123,7 +121,7 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(foodCategoryBean)); RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(foodCategoryBean));
mModel.createFoodCategory(requestBody) mModel.createFoodCategory(requestBody)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.SAVE_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.SAVE_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -145,7 +143,7 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat ...@@ -145,7 +143,7 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat
} else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) { } else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg()); mRootView.showMessage(info.getErrMsg());
} else { } else {
mRootView.showMessage(Constant.SAVE_FAIL); mRootView.showMessage(PurchaseConstant.SAVE_FAIL);
} }
} }
} }
...@@ -161,8 +159,8 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat ...@@ -161,8 +159,8 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat
*/ */
public FoodCategoryResultBean.DataBean.FoodCategoryBean toFoodCategoryBean(int parentId, String categoryName, int id) { public FoodCategoryResultBean.DataBean.FoodCategoryBean toFoodCategoryBean(int parentId, String categoryName, int id) {
FoodCategoryResultBean.DataBean.FoodCategoryBean foodCategoryBean = new FoodCategoryResultBean.DataBean.FoodCategoryBean(); FoodCategoryResultBean.DataBean.FoodCategoryBean foodCategoryBean = new FoodCategoryResultBean.DataBean.FoodCategoryBean();
foodCategoryBean.setBrandId(Constant.getBrandId()); foodCategoryBean.setBrandId(PurchaseConstant.getBrandId());
foodCategoryBean.setRestaurantId(Constant.getRestaurantId()); foodCategoryBean.setRestaurantId(PurchaseConstant.getRestaurantId());
foodCategoryBean.setName(categoryName); foodCategoryBean.setName(categoryName);
foodCategoryBean.setParentId(parentId); foodCategoryBean.setParentId(parentId);
foodCategoryBean.setId(id); foodCategoryBean.setId(id);
...@@ -179,12 +177,12 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat ...@@ -179,12 +177,12 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat
public void deleteFoodCategory(OrderCategoryBean.FoodCategoryTrees foodCategoryTrees, int hierarchy, int position) { public void deleteFoodCategory(OrderCategoryBean.FoodCategoryTrees foodCategoryTrees, int hierarchy, int position) {
RequestBody requestBody = new FormBody.Builder() RequestBody requestBody = new FormBody.Builder()
.add("id", foodCategoryTrees.getId() + "") .add("id", foodCategoryTrees.getId() + "")
.add("brandId", Constant.getBrandId() + "") .add("brandId", PurchaseConstant.getBrandId() + "")
.add("restaurantId", Constant.getRestaurantId() + "") .add("restaurantId", PurchaseConstant.getRestaurantId() + "")
.build(); .build();
mModel.deleteFoodCategory(requestBody) mModel.deleteFoodCategory(requestBody)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.DELETE_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.DELETE_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -195,11 +193,11 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat ...@@ -195,11 +193,11 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat
if (info.isSuccess()) { if (info.isSuccess()) {
//需要刪除購物車中被刪除的分類下的食材 //需要刪除購物車中被刪除的分類下的食材
SupplyShoppingCart.getInstance().removeFoodsByCategoryTress(foodCategoryTrees); SupplyShoppingCart.getInstance().removeFoodsByCategoryTress(foodCategoryTrees);
mRootView.updateCategory(Constant.DELETE, hierarchy, "", position); mRootView.updateCategory(PurchaseConstant.DELETE, hierarchy, "", position);
} else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) { } else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg()); mRootView.showMessage(info.getErrMsg());
} else { } else {
mRootView.showMessage(Constant.DELETE_FAIL); mRootView.showMessage(PurchaseConstant.DELETE_FAIL);
} }
} }
}); });
...@@ -217,7 +215,7 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat ...@@ -217,7 +215,7 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(foodCategoryBean)); RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(foodCategoryBean));
mModel.updateFoodCategory(requestBody) mModel.updateFoodCategory(requestBody)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.UPDATE_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.UPDATE_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -226,13 +224,48 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat ...@@ -226,13 +224,48 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat
@Override @Override
public void onNext(@NonNull BaseResult info) { public void onNext(@NonNull BaseResult info) {
if (info.isSuccess()) { if (info.isSuccess()) {
mRootView.updateCategory(Constant.UPDATE, hierarchy, foodCategoryBean.getName(), position); mRootView.updateCategory(PurchaseConstant.UPDATE, hierarchy, foodCategoryBean.getName(), position);
} else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) { } else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg()); mRootView.showMessage(info.getErrMsg());
} else { } else {
mRootView.showMessage(Constant.UPDATE_FAIL); mRootView.showMessage(PurchaseConstant.UPDATE_FAIL);
} }
} }
}); });
} }
public int[] getCategoryIndexByName(String name, List<OrderCategoryBean.FoodCategoryTrees> foodCategoryTrees) {
if (foodCategoryTrees == null) {
return new int[]{0, -1, -1};
}
for (int i = 0; i < foodCategoryTrees.size(); i++) {
OrderCategoryBean.FoodCategoryTrees firstCategory = foodCategoryTrees.get(i);
List<OrderCategoryBean.FoodCategoryTrees> secondCategoryTrees = firstCategory.getFoodCategoryTrees();
if (name.equals(firstCategory.getName())) {
//如果分類的名字一樣,說明是這個分類
return new int[]{i, -1, -1};
} else if (secondCategoryTrees != null) {
//如果不是這個分類,遍歷這個分類下的分類
for (int j = 0; j < secondCategoryTrees.size(); j++) {
OrderCategoryBean.FoodCategoryTrees secondCategory = secondCategoryTrees.get(j);
List<OrderCategoryBean.FoodCategoryTrees> thirdCategoryTress = secondCategory.getFoodCategoryTrees();
if (name.equals(secondCategory.getName())) {
//如果分類的名字一樣,說明是這個分類
return new int[]{i, j, -1};
} else if (thirdCategoryTress != null) {
//如果不是這個二級分類並且第三級分類不為空,找第三級分類
for (int k = 0; k < thirdCategoryTress.size(); k++) {
OrderCategoryBean.FoodCategoryTrees thirdCategory = thirdCategoryTress.get(k);
if (name.equals(thirdCategory.getName())) {
//如果分類的名字一樣,說明是這個分類
return new int[]{i, j, k};
}
//沒有第四級分類
}
}
}
}
}
return new int[]{0, -1, -1};
}
} }
...@@ -5,7 +5,7 @@ import android.app.Application; ...@@ -5,7 +5,7 @@ import android.app.Application;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.mvp.bean.FoodCategoryResultBean; import com.gingersoft.supply_chain.mvp.bean.FoodCategoryResultBean;
import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean; import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean;
import com.gingersoft.supply_chain.mvp.content.Constant; import com.gingersoft.supply_chain.mvp.content.PurchaseConstant;
import com.gingersoft.supply_chain.mvp.contract.CategorySelectContract; import com.gingersoft.supply_chain.mvp.contract.CategorySelectContract;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader; import com.jess.arms.http.imageloader.ImageLoader;
...@@ -70,11 +70,11 @@ public class CategorySelectPresenter extends BasePresenter<CategorySelectContrac ...@@ -70,11 +70,11 @@ public class CategorySelectPresenter extends BasePresenter<CategorySelectContrac
*/ */
public void getCategoryTrees() { public void getCategoryTrees() {
Map<String, Object> map = new HashMap<>(2); Map<String, Object> map = new HashMap<>(2);
Constant.addBrandId(map); PurchaseConstant.addBrandId(map);
Constant.addRestaurantId(map); PurchaseConstant.addRestaurantId(map);
mModel.getCategoryTrees(map) mModel.getCategoryTrees(map)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.GET_INFO_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.GET_INFO_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -88,7 +88,7 @@ public class CategorySelectPresenter extends BasePresenter<CategorySelectContrac ...@@ -88,7 +88,7 @@ public class CategorySelectPresenter extends BasePresenter<CategorySelectContrac
} else if (TextUtil.isNotEmptyOrNullOrUndefined(orderCategoryBean.getErrMsg())) { } else if (TextUtil.isNotEmptyOrNullOrUndefined(orderCategoryBean.getErrMsg())) {
mRootView.showMessage(orderCategoryBean.getErrMsg()); mRootView.showMessage(orderCategoryBean.getErrMsg());
} else { } else {
mRootView.showMessage(Constant.GET_INFO_ERROR); mRootView.showMessage(PurchaseConstant.GET_INFO_ERROR);
} }
} }
}); });
......
package com.gingersoft.supply_chain.mvp.presenter; package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application; import android.app.Application;
import android.os.AsyncTask;
import android.util.Log;
import com.gingersoft.gsa.cloud.common.bean.BaseResult; import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.utils.JsonUtils; import com.gingersoft.gsa.cloud.common.utils.JsonUtils;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.ui.bean.view.CategoryBean; import com.gingersoft.gsa.cloud.ui.bean.view.CategoryBean;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.CategoryFoodTreeBean; import com.gingersoft.supply_chain.mvp.bean.CategoryFoodTreeBean;
import com.gingersoft.supply_chain.mvp.bean.FoodByCategoryResultBean; import com.gingersoft.supply_chain.mvp.bean.FoodByCategoryResultBean;
import com.gingersoft.supply_chain.mvp.bean.FoodListInfoBean; import com.gingersoft.supply_chain.mvp.bean.FoodListInfoBean;
import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean; import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean;
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.content.PurchaseConstant;
import com.gingersoft.supply_chain.mvp.content.Constant;
import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart; import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart;
import com.gingersoft.supply_chain.mvp.contract.FoodIngredientsContract; import com.gingersoft.supply_chain.mvp.contract.FoodIngredientsContract;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
...@@ -42,13 +36,9 @@ import javax.inject.Inject; ...@@ -42,13 +36,9 @@ import javax.inject.Inject;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull; import io.reactivex.annotations.NonNull;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
import me.jessyan.rxerrorhandler.core.RxErrorHandler; import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber; import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import okhttp3.MediaType;
import okhttp3.RequestBody;
/** /**
...@@ -122,14 +112,14 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr ...@@ -122,14 +112,14 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr
Map<String, Object> map = new HashMap<>(5); Map<String, Object> map = new HashMap<>(5);
map.put("pageSize", 1000); map.put("pageSize", 1000);
map.put("pageIndex", 0); map.put("pageIndex", 0);
Constant.addBrandId(map); PurchaseConstant.addBrandId(map);
Constant.addRestaurantId(map); PurchaseConstant.addRestaurantId(map);
if (supplierId != -1) { if (supplierId != -1) {
map.put("supplierId", supplierId); map.put("supplierId", supplierId);
} }
mModel.getFoodIngredientsData(map) mModel.getFoodIngredientsData(map)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.GET_INFO_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.GET_INFO_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -222,14 +212,14 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr ...@@ -222,14 +212,14 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr
Map<String, Object> map = new HashMap<>(5); Map<String, Object> map = new HashMap<>(5);
map.put("pageSize", 1000); map.put("pageSize", 1000);
map.put("pageIndex", 0); map.put("pageIndex", 0);
Constant.addBrandId(map); PurchaseConstant.addBrandId(map);
Constant.addRestaurantId(map); PurchaseConstant.addRestaurantId(map);
if (supplierId != -1) { if (supplierId != -1) {
map.put("supplierId", supplierId); map.put("supplierId", supplierId);
} }
mModel.getFoodBySupplierId(map) mModel.getFoodBySupplierId(map)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.GET_INFO_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.GET_INFO_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -365,11 +355,11 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr ...@@ -365,11 +355,11 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr
return; return;
} }
Map<String, Object> map = new HashMap<>(2); Map<String, Object> map = new HashMap<>(2);
Constant.addBrandId(map); PurchaseConstant.addBrandId(map);
Constant.addRestaurantId(map); PurchaseConstant.addRestaurantId(map);
mModel.getCategoryTrees(map) mModel.getCategoryTrees(map)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.GET_INFO_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.GET_INFO_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -398,7 +388,7 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr ...@@ -398,7 +388,7 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr
} else if (TextUtil.isNotEmptyOrNullOrUndefined(orderCategoryBean.getErrMsg())) { } else if (TextUtil.isNotEmptyOrNullOrUndefined(orderCategoryBean.getErrMsg())) {
mRootView.showMessage(orderCategoryBean.getErrMsg()); mRootView.showMessage(orderCategoryBean.getErrMsg());
} else { } else {
mRootView.showMessage(Constant.GET_INFO_ERROR); mRootView.showMessage(PurchaseConstant.GET_INFO_ERROR);
} }
} }
...@@ -578,8 +568,8 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr ...@@ -578,8 +568,8 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr
Map<String, Object> map = new HashMap<>(5); Map<String, Object> map = new HashMap<>(5);
map.put("pageSize", 1000); map.put("pageSize", 1000);
map.put("pageIndex", 0); map.put("pageIndex", 0);
Constant.addBrandId(map); PurchaseConstant.addBrandId(map);
Constant.addRestaurantId(map); PurchaseConstant.addRestaurantId(map);
map.put("parentId", parentCategoryId); map.put("parentId", parentCategoryId);
mModel.getFoodByCategory(map) mModel.getFoodByCategory(map)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
......
...@@ -2,16 +2,14 @@ package com.gingersoft.supply_chain.mvp.presenter; ...@@ -2,16 +2,14 @@ package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application; import android.app.Application;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import com.gingersoft.gsa.cloud.common.bean.BaseResult; import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.utils.CollectionUtils; import com.gingersoft.gsa.cloud.common.utils.CollectionUtils;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils; import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.mvp.bean.BasicUnitBean; import com.gingersoft.supply_chain.mvp.bean.BasicUnitBean;
import com.gingersoft.supply_chain.mvp.bean.DeputyUnitBean; import com.gingersoft.supply_chain.mvp.bean.DeputyUnitBean;
import com.gingersoft.supply_chain.mvp.content.Constant; import com.gingersoft.supply_chain.mvp.content.PurchaseConstant;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodUnitPageFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodUnitPageFragment;
import com.jess.arms.integration.AppManager; import com.jess.arms.integration.AppManager;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
...@@ -22,7 +20,6 @@ import io.reactivex.android.schedulers.AndroidSchedulers; ...@@ -22,7 +20,6 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
import me.jessyan.rxerrorhandler.core.RxErrorHandler; import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber; import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import okhttp3.FormBody;
import okhttp3.MediaType; import okhttp3.MediaType;
import okhttp3.RequestBody; import okhttp3.RequestBody;
...@@ -31,17 +28,15 @@ import javax.inject.Inject; ...@@ -31,17 +28,15 @@ import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.FoodUnitPageContract; import com.gingersoft.supply_chain.mvp.contract.FoodUnitPageContract;
import com.jess.arms.utils.RxLifecycleUtils; import com.jess.arms.utils.RxLifecycleUtils;
import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import static com.gingersoft.supply_chain.mvp.content.Constant.GET_INFO_ERROR; import static com.gingersoft.supply_chain.mvp.content.PurchaseConstant.GET_INFO_ERROR;
import static com.gingersoft.supply_chain.mvp.content.Constant.GET_INFO_LOADING; import static com.gingersoft.supply_chain.mvp.content.PurchaseConstant.GET_INFO_LOADING;
/** /**
...@@ -125,7 +120,7 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo ...@@ -125,7 +120,7 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo
* 獲取副單位 快捷輸入列表數據集合 * 獲取副單位 快捷輸入列表數據集合
*/ */
public void getDeputyUnitList() { public void getDeputyUnitList() {
mModel.getDeputyUnitList(Constant.getBrandId(), Constant.getRestaurantId()) mModel.getDeputyUnitList(PurchaseConstant.getBrandId(), PurchaseConstant.getRestaurantId())
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(GET_INFO_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(GET_INFO_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
...@@ -183,10 +178,10 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo ...@@ -183,10 +178,10 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo
mRootView.deleteDeputyUnit(position); mRootView.deleteDeputyUnit(position);
return; return;
} }
deputyUnitBean.setDeletes(Constant.DELETE); deputyUnitBean.setDeletes(PurchaseConstant.DELETE);
mModel.updateDeputyUnit(RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(deputyUnitBean))) mModel.updateDeputyUnit(RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(deputyUnitBean)))
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.DELETE_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.DELETE_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -200,7 +195,7 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo ...@@ -200,7 +195,7 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo
} else if (TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) { } else if (TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg()); mRootView.showMessage(baseResult.getErrMsg());
} else { } else {
mRootView.showMessage(Constant.DELETE_FAIL); mRootView.showMessage(PurchaseConstant.DELETE_FAIL);
} }
} }
}); });
...@@ -212,7 +207,7 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo ...@@ -212,7 +207,7 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo
public void batchUpdateDeputyUnit(List<DeputyUnitBean> data) { public void batchUpdateDeputyUnit(List<DeputyUnitBean> data) {
mModel.updateDeputyUnitList(RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(data))) mModel.updateDeputyUnitList(RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(data)))
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.SAVE_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.SAVE_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -245,8 +240,8 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo ...@@ -245,8 +240,8 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo
} }
} }
DeputyUnitBean unitBean = new DeputyUnitBean(); DeputyUnitBean unitBean = new DeputyUnitBean();
unitBean.setBrandId(Constant.getBrandId()); unitBean.setBrandId(PurchaseConstant.getBrandId());
unitBean.setRestaurantId(Constant.getRestaurantId()); unitBean.setRestaurantId(PurchaseConstant.getRestaurantId());
unitBean.setPurchaseFoodId(foodId); unitBean.setPurchaseFoodId(foodId);
deputyUnitBeans.add(unitBean); deputyUnitBeans.add(unitBean);
mRootView.loadDeputyUnitAdapter(deputyUnitBeans); mRootView.loadDeputyUnitAdapter(deputyUnitBeans);
...@@ -268,14 +263,14 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo ...@@ -268,14 +263,14 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
try { try {
jsonObject.put("content", content); jsonObject.put("content", content);
jsonObject.put("brandId", Constant.getBrandId() + ""); jsonObject.put("brandId", PurchaseConstant.getBrandId() + "");
jsonObject.put("restaurantId", Constant.getRestaurantId() + ""); jsonObject.put("restaurantId", PurchaseConstant.getRestaurantId() + "");
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();
} }
mModel.addBasicUnit(RequestBody.create(MediaType.parse("application/json"), jsonObject.toString())) mModel.addBasicUnit(RequestBody.create(MediaType.parse("application/json"), jsonObject.toString()))
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.SAVE_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.SAVE_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -303,7 +298,7 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo ...@@ -303,7 +298,7 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo
public void deleteUnitKey(int id, int position){ public void deleteUnitKey(int id, int position){
mModel.deleteUnitKey(id) mModel.deleteUnitKey(id)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.SAVE_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.SAVE_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
......
...@@ -2,12 +2,11 @@ package com.gingersoft.supply_chain.mvp.presenter; ...@@ -2,12 +2,11 @@ package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.bean.BaseResult; import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils; import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.mvp.bean.MeasurementUnitBean; import com.gingersoft.supply_chain.mvp.bean.MeasurementUnitBean;
import com.gingersoft.supply_chain.mvp.content.Constant; import com.gingersoft.supply_chain.mvp.content.PurchaseConstant;
import com.gingersoft.supply_chain.mvp.contract.MeasurementUnitContract; import com.gingersoft.supply_chain.mvp.contract.MeasurementUnitContract;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader; import com.jess.arms.http.imageloader.ImageLoader;
...@@ -76,8 +75,8 @@ public class MeasurementUnitPresenter extends BasePresenter<MeasurementUnitContr ...@@ -76,8 +75,8 @@ public class MeasurementUnitPresenter extends BasePresenter<MeasurementUnitContr
if (!TextUtil.isEmptyOrNullOrUndefined(unitContent)) { if (!TextUtil.isEmptyOrNullOrUndefined(unitContent)) {
map.put("unitContent", unitContent); map.put("unitContent", unitContent);
} }
map.put("brandId", Constant.getBrandId()); map.put("brandId", PurchaseConstant.getBrandId());
map.put("restaurantId", Constant.getRestaurantId()); map.put("restaurantId", PurchaseConstant.getRestaurantId());
map.put("pageIndex", pageIndex); map.put("pageIndex", pageIndex);
mModel.getMeasurementUnitList(map) mModel.getMeasurementUnitList(map)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
......
...@@ -7,7 +7,6 @@ import android.text.InputType; ...@@ -7,7 +7,6 @@ import android.text.InputType;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
import com.gingersoft.gsa.cloud.common.bean.BaseResult; import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.utils.CollectionUtils; import com.gingersoft.gsa.cloud.common.utils.CollectionUtils;
import com.gingersoft.gsa.cloud.common.utils.JsonUtils; import com.gingersoft.gsa.cloud.common.utils.JsonUtils;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils; import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
...@@ -20,13 +19,12 @@ import com.gingersoft.gsa.cloud.ui.adapter.bean.MultiInputBean; ...@@ -20,13 +19,12 @@ import com.gingersoft.gsa.cloud.ui.adapter.bean.MultiInputBean;
import com.gingersoft.gsa.cloud.ui.adapter.bean.MultiSelectBean; import com.gingersoft.gsa.cloud.ui.adapter.bean.MultiSelectBean;
import com.gingersoft.gsa.cloud.ui.adapter.bean.UploadPicMultiBean; import com.gingersoft.gsa.cloud.ui.adapter.bean.UploadPicMultiBean;
import com.gingersoft.gsa.cloud.ui.adapter.multi.RemarkProvider; import com.gingersoft.gsa.cloud.ui.adapter.multi.RemarkProvider;
import com.gingersoft.gsa.cloud.ui.bean.SectionCheckItem;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.DeputyUnitBean; import com.gingersoft.supply_chain.mvp.bean.DeputyUnitBean;
import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean; import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean; import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean; import com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean;
import com.gingersoft.supply_chain.mvp.content.Constant; import com.gingersoft.supply_chain.mvp.content.PurchaseConstant;
import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart; import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart;
import com.gingersoft.supply_chain.mvp.contract.NewFoodIngredientsContract; import com.gingersoft.supply_chain.mvp.contract.NewFoodIngredientsContract;
import com.gingersoft.supply_chain.mvp.ui.fragment.category.CategorySelectFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.category.CategorySelectFragment;
...@@ -38,8 +36,6 @@ import com.jess.arms.http.imageloader.ImageLoader; ...@@ -38,8 +36,6 @@ import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager; import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter; import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.RxLifecycleUtils; import com.jess.arms.utils.RxLifecycleUtils;
import com.xuexiang.rxutil2.rxjava.RxJavaUtils;
import com.xuexiang.rxutil2.rxjava.task.RxIOTask;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -167,11 +163,11 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient ...@@ -167,11 +163,11 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
public void getIngredientsDetails(int ingredientId) { public void getIngredientsDetails(int ingredientId) {
Map<String, Object> map = new HashMap<>(3); Map<String, Object> map = new HashMap<>(3);
map.put("id", ingredientId); map.put("id", ingredientId);
Constant.addBrandId(map); PurchaseConstant.addBrandId(map);
Constant.addRestaurantId(map); PurchaseConstant.addRestaurantId(map);
mModel.getFoodIngredientsDetails(map) mModel.getFoodIngredientsDetails(map)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.GET_INFO_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.GET_INFO_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -179,7 +175,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient ...@@ -179,7 +175,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) { .subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override @Override
public void onNext(BaseResult baseResult) { public void onNext(BaseResult baseResult) {
if (ResultUtils.isSuccess(baseResult, Constant.NULL_INFO_ERROR, mRootView)) { if (ResultUtils.isSuccess(baseResult, PurchaseConstant.NULL_INFO_ERROR, mRootView)) {
PurchaseFoodBean purchaseFoodBean = GsonUtils.GsonToBean(baseResult.getData(), PurchaseFoodBean.class); PurchaseFoodBean purchaseFoodBean = GsonUtils.GsonToBean(baseResult.getData(), PurchaseFoodBean.class);
if (purchaseFoodBean != null) { if (purchaseFoodBean != null) {
purchaseFoodBean.setId(ingredientId); purchaseFoodBean.setId(ingredientId);
...@@ -193,7 +189,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient ...@@ -193,7 +189,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
setPurchaseFoodBean(purchaseFoodBean); setPurchaseFoodBean(purchaseFoodBean);
mRootView.initAdapter(); mRootView.initAdapter();
} else { } else {
mRootView.showMessage(Constant.NULL_INFO_ERROR); mRootView.showMessage(PurchaseConstant.NULL_INFO_ERROR);
} }
} }
} }
...@@ -208,8 +204,8 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient ...@@ -208,8 +204,8 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
infoMultiBeans.add(new UploadPicMultiBean(InfoMultiBean.EDIT_FOOD_ITEM_UPLOAD_PIC, "圖片上傳", R.drawable.png_upload_pic)); infoMultiBeans.add(new UploadPicMultiBean(InfoMultiBean.EDIT_FOOD_ITEM_UPLOAD_PIC, "圖片上傳", R.drawable.png_upload_pic));
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, "基本信息"));
infoMultiBeans.add(new MultiSelectBean(InfoMultiBean.EDIT_FOOD_ITEM_SELECT, "所屬供應商", true, "請輸入/選擇供應商", SELECT_SUPPLIER_RESULTCODE, true, new InputFilter[]{InputFilterUtils.getLengthFilter(context, 16), InputFilterUtils.getChAndEnAndNumInputFilter(context)}, SupplierListFragment.class)); infoMultiBeans.add(new MultiSelectBean(InfoMultiBean.EDIT_FOOD_ITEM_SELECT, "所屬供應商", true, "請輸入/選擇供應商", SELECT_SUPPLIER_RESULTCODE, true, new InputFilter[]{InputFilterUtils.getLengthFilter(context, 100), InputFilterUtils.getChAndEnAndNumInputFilter(context)}, SupplierListFragment.class));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "食材名稱", true, "請輸入名稱", new InputFilter[]{InputFilterUtils.getLengthFilter(context, 100), InputFilterUtils.getChAndEnAndNumAndPtInputFilter(context)}, InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES)); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "食材名稱", true, "請輸入名稱", new InputFilter[]{InputFilterUtils.getLengthFilter(context, 200), InputFilterUtils.getChAndEnAndNumAndPtInputFilter(context)}, InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES));
infoMultiBeans.add(new MultiSelectBean(InfoMultiBean.EDIT_FOOD_ITEM_SELECT, "食材類別", true, "請選擇食材類別", SELECT_FOOD_CATEGORY_REQUEST_CODE, CategorySelectFragment.class)); infoMultiBeans.add(new MultiSelectBean(InfoMultiBean.EDIT_FOOD_ITEM_SELECT, "食材類別", true, "請選擇食材類別", SELECT_FOOD_CATEGORY_REQUEST_CODE, CategorySelectFragment.class));
infoMultiBeans.add(new MultiSelectBean(InfoMultiBean.EDIT_FOOD_ITEM_SELECT, "基本單位", true, "請選擇食材單位", SELECT_PACKAGE_SPECIFICATION_REQUEST_CODE, FoodUnitPageFragment.class)); infoMultiBeans.add(new MultiSelectBean(InfoMultiBean.EDIT_FOOD_ITEM_SELECT, "基本單位", true, "請選擇食材單位", SELECT_PACKAGE_SPECIFICATION_REQUEST_CODE, FoodUnitPageFragment.class));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "包裝說明", false, "請輸入包裝說明", new InputFilter[]{InputFilterUtils.getLengthFilter(context, 10), InputFilterUtils.getTypeFilter(context, InputFilterUtils.chAndEnAndNumAndSlash)})); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "包裝說明", false, "請輸入包裝說明", new InputFilter[]{InputFilterUtils.getLengthFilter(context, 10), InputFilterUtils.getTypeFilter(context, InputFilterUtils.chAndEnAndNumAndSlash)}));
...@@ -322,8 +318,8 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient ...@@ -322,8 +318,8 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
infoMultiBeans.get(basicUnitIndex).setShowValue(basicUnitName); infoMultiBeans.get(basicUnitIndex).setShowValue(basicUnitName);
if (deputyUnitBeans != null) { if (deputyUnitBeans != null) {
for (DeputyUnitBean deputyUnitBean : deputyUnitBeans) { for (DeputyUnitBean deputyUnitBean : deputyUnitBeans) {
deputyUnitBean.setRestaurantId(Constant.getRestaurantId()); deputyUnitBean.setRestaurantId(PurchaseConstant.getRestaurantId());
deputyUnitBean.setBrandId(Constant.getBrandId()); deputyUnitBean.setBrandId(PurchaseConstant.getBrandId());
} }
} }
this.deputyUnitBeans = deputyUnitBeans; this.deputyUnitBeans = deputyUnitBeans;
...@@ -365,7 +361,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient ...@@ -365,7 +361,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
List<MultipartBody.Part> multipartBodies = new ArrayList<>(); List<MultipartBody.Part> multipartBodies = new ArrayList<>();
multipartBodies.add(MultipartBody.Part.createFormData("files", file.getName(), RequestBody.create(MediaType.parse("image/png"), file))); multipartBodies.add(MultipartBody.Part.createFormData("files", file.getName(), RequestBody.create(MediaType.parse("image/png"), file)));
Map<String, Object> map = new HashMap<>(1); Map<String, Object> map = new HashMap<>(1);
map.put("type", Constant.UPLOAD_PIC_TYPE_FOOD); map.put("type", PurchaseConstant.UPLOAD_PIC_TYPE_FOOD);
mModel.upLoadPic(multipartBodies, map) mModel.upLoadPic(multipartBodies, map)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("圖片上傳中...")) .doOnSubscribe(disposable -> mRootView.showLoading("圖片上傳中..."))
...@@ -397,7 +393,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient ...@@ -397,7 +393,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(purchaseFoodBean)); RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(purchaseFoodBean));
mModel.addFood(requestBody) mModel.addFood(requestBody)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.SAVE_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.SAVE_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -406,12 +402,12 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient ...@@ -406,12 +402,12 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
@Override @Override
public void onNext(BaseResult baseResult) { public void onNext(BaseResult baseResult) {
if (baseResult.isSuccess()) { if (baseResult.isSuccess()) {
mRootView.showMessage(Constant.SAVE_SUCCESS); mRootView.showMessage(PurchaseConstant.SAVE_SUCCESS);
mRootView.updateFoodInfoSuccess(purchaseFoodBean.getSupplierName(), purchaseFoodBean.getFoodCategoryName()); mRootView.updateFoodInfoSuccess(purchaseFoodBean.getSupplierName(), purchaseFoodBean.getFoodCategoryName());
} else if (TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) { } else if (TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg()); mRootView.showMessage(baseResult.getErrMsg());
} else { } else {
mRootView.showMessage(Constant.SAVE_FAIL); mRootView.showMessage(PurchaseConstant.SAVE_FAIL);
} }
} }
}); });
...@@ -429,7 +425,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient ...@@ -429,7 +425,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(purchaseFoodBean)); RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(purchaseFoodBean));
mModel.updateFood(requestBody) mModel.updateFood(requestBody)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.UPDATE_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.UPDATE_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -438,14 +434,14 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient ...@@ -438,14 +434,14 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
@Override @Override
public void onNext(BaseResult baseResult) { public void onNext(BaseResult baseResult) {
if (baseResult.isSuccess()) { if (baseResult.isSuccess()) {
mRootView.showMessage(Constant.UPDATE_SUCCESS); mRootView.showMessage(PurchaseConstant.UPDATE_SUCCESS);
mRootView.updateFoodInfoSuccess(purchaseFoodBean.getSupplierName(), purchaseFoodBean.getFoodCategoryName()); mRootView.updateFoodInfoSuccess(purchaseFoodBean.getSupplierName(), purchaseFoodBean.getFoodCategoryName());
purchaseFoodBean.setSupplierId(supplierId); purchaseFoodBean.setSupplierId(supplierId);
SupplyShoppingCart.getInstance().replaceFood(purchaseFoodBean); SupplyShoppingCart.getInstance().replaceFood(purchaseFoodBean);
} else if (TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) { } else if (TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg()); mRootView.showMessage(baseResult.getErrMsg());
} else { } else {
mRootView.showMessage(Constant.UPDATE_FAIL); mRootView.showMessage(PurchaseConstant.UPDATE_FAIL);
} }
} }
}); });
...@@ -574,9 +570,9 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient ...@@ -574,9 +570,9 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
purchaseFoodBean.setFoodUnits(deputyUnitBeans); purchaseFoodBean.setFoodUnits(deputyUnitBeans);
} }
//品牌id //品牌id
purchaseFoodBean.setBrandId(Constant.getBrandId()); purchaseFoodBean.setBrandId(PurchaseConstant.getBrandId());
//餐廳id //餐廳id
purchaseFoodBean.setRestaurantId(Constant.getRestaurantId()); purchaseFoodBean.setRestaurantId(PurchaseConstant.getRestaurantId());
return purchaseFoodBean; return purchaseFoodBean;
} }
......
...@@ -2,13 +2,12 @@ package com.gingersoft.supply_chain.mvp.presenter; ...@@ -2,13 +2,12 @@ package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.bean.BaseResult; import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils; import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.ui.adapter.bean.InfoMultiBean; import com.gingersoft.gsa.cloud.ui.adapter.bean.InfoMultiBean;
import com.gingersoft.supply_chain.mvp.bean.MeasurementUnitBean; import com.gingersoft.supply_chain.mvp.bean.MeasurementUnitBean;
import com.gingersoft.supply_chain.mvp.content.Constant; import com.gingersoft.supply_chain.mvp.content.PurchaseConstant;
import com.gingersoft.supply_chain.mvp.contract.NewFoodUnitContract; import com.gingersoft.supply_chain.mvp.contract.NewFoodUnitContract;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader; import com.jess.arms.http.imageloader.ImageLoader;
...@@ -130,8 +129,8 @@ public class NewFoodUnitPresenter extends BasePresenter<NewFoodUnitContract.Mode ...@@ -130,8 +129,8 @@ public class NewFoodUnitPresenter extends BasePresenter<NewFoodUnitContract.Mode
if (foodUnit == null) { if (foodUnit == null) {
foodUnit = new MeasurementUnitBean.DataBean.Unit(); foodUnit = new MeasurementUnitBean.DataBean.Unit();
} }
foodUnit.setBrandId(Constant.getBrandId()); foodUnit.setBrandId(PurchaseConstant.getBrandId());
foodUnit.setRestaurantId(Constant.getRestaurantId()); foodUnit.setRestaurantId(PurchaseConstant.getRestaurantId());
List<InfoMultiBean> units = infoMultiBeans.get(0).getInfoMultiBeans(); List<InfoMultiBean> units = infoMultiBeans.get(0).getInfoMultiBeans();
for (int i = 0; i < units.size(); i++) { for (int i = 0; i < units.size(); i++) {
if (units.get(i).isChecked()) { if (units.get(i).isChecked()) {
......
...@@ -10,7 +10,6 @@ import android.widget.EditText; ...@@ -10,7 +10,6 @@ import android.widget.EditText;
import com.gingersoft.gsa.cloud.common.bean.BaseResult; import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.constans.AppConstans; import com.gingersoft.gsa.cloud.common.constans.AppConstans;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.utils.MatchUtils; import com.gingersoft.gsa.cloud.common.utils.MatchUtils;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils; import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.inputFilter.InputFilterUtils; import com.gingersoft.gsa.cloud.common.utils.inputFilter.InputFilterUtils;
...@@ -18,13 +17,11 @@ import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; ...@@ -18,13 +17,11 @@ import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.ui.adapter.bean.InfoMultiBean; import com.gingersoft.gsa.cloud.ui.adapter.bean.InfoMultiBean;
import com.gingersoft.gsa.cloud.ui.adapter.bean.MultiCheckInputBean; import com.gingersoft.gsa.cloud.ui.adapter.bean.MultiCheckInputBean;
import com.gingersoft.gsa.cloud.ui.adapter.bean.MultiInputBean; import com.gingersoft.gsa.cloud.ui.adapter.bean.MultiInputBean;
import com.gingersoft.gsa.cloud.ui.adapter.bean.MultiSelectBean;
import com.gingersoft.gsa.cloud.ui.adapter.multi.InfoMultiAdapter; import com.gingersoft.gsa.cloud.ui.adapter.multi.InfoMultiAdapter;
import com.gingersoft.gsa.cloud.ui.adapter.multi.RemarkProvider; import com.gingersoft.gsa.cloud.ui.adapter.multi.RemarkProvider;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean; import com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean;
import com.gingersoft.supply_chain.mvp.content.Constant; import com.gingersoft.supply_chain.mvp.content.PurchaseConstant;
import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart; import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart;
import com.gingersoft.supply_chain.mvp.contract.NewSupplierContract; import com.gingersoft.supply_chain.mvp.contract.NewSupplierContract;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
...@@ -33,8 +30,6 @@ import com.jess.arms.integration.AppManager; ...@@ -33,8 +30,6 @@ import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter; import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.EnAndNumInputFilter; import com.jess.arms.utils.EnAndNumInputFilter;
import com.jess.arms.utils.RxLifecycleUtils; import com.jess.arms.utils.RxLifecycleUtils;
import com.xuexiang.rxutil2.rxjava.RxJavaUtils;
import com.xuexiang.rxutil2.rxjava.task.RxIOTask;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
...@@ -134,11 +129,11 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode ...@@ -134,11 +129,11 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
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, "基本信息"));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "供應商編號", false, "請輸入編號", new InputFilter[]{new InputFilter.LengthFilter(11), new EnAndNumInputFilter()})); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "供應商編號", false, "請輸入編號", new InputFilter[]{new InputFilter.LengthFilter(11), new EnAndNumInputFilter()}));
MultiInputBean multiInputSupplierName = new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "名稱", true, "請輸入名稱", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 100), InputFilterUtils.getChAndEnAndNumAndPtInputFilter(mContext)}, mSupplierNameChangeListener); MultiInputBean multiInputSupplierName = new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "名稱", true, "請輸入名稱", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 40), InputFilterUtils.getChAndEnAndNumAndPtInputFilter(mContext)}, mSupplierNameChangeListener);
multiInputSupplierName.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES); multiInputSupplierName.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
infoMultiBeans.add(multiInputSupplierName); infoMultiBeans.add(multiInputSupplierName);
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "聯繫人", true, "請輸入聯繫人", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}, InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_WORDS)); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "聯繫人", true, "請輸入聯繫人", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}, InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_WORDS));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "詳細地址", true, "請輸入詳細地址", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 150), InputFilterUtils.getChAndEnAndNumAndPtInputFilter(mContext)}, InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES)); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "詳細地址", true, "請輸入詳細地址", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 200), InputFilterUtils.getChAndEnAndNumAndPtInputFilter(mContext)}, InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES));
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, 9)}, EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_FLAG_DECIMAL)); 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, "運費", false, "請輸入運費", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 9)}, EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_FLAG_DECIMAL)); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "運費", false, "請輸入運費", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 9)}, EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_FLAG_DECIMAL));
...@@ -154,9 +149,7 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode ...@@ -154,9 +149,7 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
// childInfoMulti.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "Kakao Talk", false, "請輸入Kakao Talk")); // childInfoMulti.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "Kakao Talk", false, "請輸入Kakao Talk"));
// receivingMode.setInfoMultiBeans(childInfoMulti); // receivingMode.setInfoMultiBeans(childInfoMulti);
// infoMultiBeans.add(receivingMode); // infoMultiBeans.add(receivingMode);
MultiCheckInputBean emailInputBean = new MultiCheckInputBean(InfoMultiBean.ITEM_MULTIPLE_CHECKBOX, "Email", false, "請輸入Email", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 40)}, R.drawable.ic_email, false); contactInfo.add(new MultiCheckInputBean(InfoMultiBean.ITEM_MULTIPLE_CHECKBOX, "Email", false, "請輸入Email", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 40)}, R.drawable.ic_email, false).setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS));
emailInputBean.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
contactInfo.add(emailInputBean);
contactInfo.add(new MultiCheckInputBean(InfoMultiBean.ITEM_MULTIPLE_CHECKBOX, "WhatsApp", false, "請輸入WhatsApp", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}, R.drawable.ic_whatsapp, false).setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES)); contactInfo.add(new MultiCheckInputBean(InfoMultiBean.ITEM_MULTIPLE_CHECKBOX, "WhatsApp", false, "請輸入WhatsApp", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}, R.drawable.ic_whatsapp, false).setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES));
contactInfo.add(new MultiCheckInputBean(InfoMultiBean.ITEM_MULTIPLE_CHECKBOX, "WeChat", false, "請輸入WeChat", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}, R.drawable.ic_wechat, false)); contactInfo.add(new MultiCheckInputBean(InfoMultiBean.ITEM_MULTIPLE_CHECKBOX, "WeChat", false, "請輸入WeChat", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}, R.drawable.ic_wechat, false));
contactInfo.add(new MultiCheckInputBean(InfoMultiBean.ITEM_MULTIPLE_CHECKBOX, "Line", false, "請輸入Line", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}, R.drawable.ic_line, false)); contactInfo.add(new MultiCheckInputBean(InfoMultiBean.ITEM_MULTIPLE_CHECKBOX, "Line", false, "請輸入Line", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}, R.drawable.ic_line, false));
...@@ -241,8 +234,8 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode ...@@ -241,8 +234,8 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
*/ */
public void getSupplierInfo(EditText editText, String supplierName) { public void getSupplierInfo(EditText editText, String supplierName) {
Map<String, Object> map = new HashMap<>(3); Map<String, Object> map = new HashMap<>(3);
Constant.addRestaurantId(map); PurchaseConstant.addRestaurantId(map);
Constant.addBrandId(map); PurchaseConstant.addBrandId(map);
map.put("supplierName", supplierName); map.put("supplierName", supplierName);
mModel.getSupplierInfo(map) mModel.getSupplierInfo(map)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
...@@ -319,7 +312,7 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode ...@@ -319,7 +312,7 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
public void deleteSupplier(int supplierId) { public void deleteSupplier(int supplierId) {
mModel.deleteSupplier(supplierId) mModel.deleteSupplier(supplierId)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.SAVE_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.SAVE_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -335,7 +328,7 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode ...@@ -335,7 +328,7 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
} else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) { } else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg()); mRootView.showMessage(info.getErrMsg());
} else { } else {
mRootView.showMessage(Constant.SAVE_FAIL); mRootView.showMessage(PurchaseConstant.SAVE_FAIL);
} }
} }
} }
...@@ -521,8 +514,8 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode ...@@ -521,8 +514,8 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
//地址 //地址
supplierInfoBean.setAddress(TextUtil.getNotNullStrAndTrim(infoMultiBeans.get(addressIndex).getShowValue())); supplierInfoBean.setAddress(TextUtil.getNotNullStrAndTrim(infoMultiBeans.get(addressIndex).getShowValue()));
//餐廳信息 //餐廳信息
supplierInfoBean.setRestaurantId(Constant.getRestaurantId()); supplierInfoBean.setRestaurantId(PurchaseConstant.getRestaurantId());
supplierInfoBean.setBrandId(Constant.getBrandId()); supplierInfoBean.setBrandId(PurchaseConstant.getBrandId());
//最低採購金額 //最低採購金額
String minimumAmount = infoMultiBeans.get(lowPurchaseAmount).getShowValue(); String minimumAmount = infoMultiBeans.get(lowPurchaseAmount).getShowValue();
if (TextUtil.isNotEmptyOrNullOrUndefined(minimumAmount)) { if (TextUtil.isNotEmptyOrNullOrUndefined(minimumAmount)) {
......
...@@ -3,7 +3,6 @@ package com.gingersoft.supply_chain.mvp.presenter; ...@@ -3,7 +3,6 @@ package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.common.bean.BaseResult; import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.utils.CollectionUtils; import com.gingersoft.gsa.cloud.common.utils.CollectionUtils;
import com.gingersoft.gsa.cloud.common.utils.JsonUtils; import com.gingersoft.gsa.cloud.common.utils.JsonUtils;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil; import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
...@@ -16,7 +15,7 @@ import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodEncodeSn; ...@@ -16,7 +15,7 @@ import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodEncodeSn;
import com.gingersoft.supply_chain.mvp.bean.PurchaseOrderDetailsBean; import com.gingersoft.supply_chain.mvp.bean.PurchaseOrderDetailsBean;
import com.gingersoft.supply_chain.mvp.bean.OrderWareHouseBean; import com.gingersoft.supply_chain.mvp.bean.OrderWareHouseBean;
import com.gingersoft.supply_chain.mvp.bean.WareHousingUnitBean; import com.gingersoft.supply_chain.mvp.bean.WareHousingUnitBean;
import com.gingersoft.supply_chain.mvp.content.Constant; import com.gingersoft.supply_chain.mvp.content.PurchaseConstant;
import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart; import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart;
import com.jess.arms.integration.AppManager; import com.jess.arms.integration.AppManager;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
...@@ -39,19 +38,16 @@ import com.jess.arms.utils.RxLifecycleUtils; ...@@ -39,19 +38,16 @@ import com.jess.arms.utils.RxLifecycleUtils;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import static com.gingersoft.supply_chain.mvp.content.Constant.GET_INFO_ERROR; import static com.gingersoft.supply_chain.mvp.content.PurchaseConstant.GET_INFO_ERROR;
import static com.gingersoft.supply_chain.mvp.content.Constant.GET_INFO_LOADING; import static com.gingersoft.supply_chain.mvp.content.PurchaseConstant.GET_INFO_LOADING;
import static com.gingersoft.supply_chain.mvp.content.Constant.NULL_INFO_ERROR; import static com.gingersoft.supply_chain.mvp.content.PurchaseConstant.NULL_INFO_ERROR;
import static com.gingersoft.supply_chain.mvp.content.Constant.SAVE_FAIL; import static com.gingersoft.supply_chain.mvp.content.PurchaseConstant.SAVE_FAIL;
import static com.gingersoft.supply_chain.mvp.content.Constant.SAVE_LOADING; import static com.gingersoft.supply_chain.mvp.content.PurchaseConstant.SAVE_LOADING;
/** /**
...@@ -293,11 +289,11 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -293,11 +289,11 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
return; return;
} }
Map<String, Object> map = new HashMap<>(3); Map<String, Object> map = new HashMap<>(3);
Constant.addRestaurantId(map); PurchaseConstant.addRestaurantId(map);
Constant.addBrandId(map); PurchaseConstant.addBrandId(map);
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
for (PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean item : data) { for (PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean item : data) {
stringBuilder.append(item.getPurchaseFoodId()).append(Constant.COMMA_SEPARATED); stringBuilder.append(item.getPurchaseFoodId()).append(PurchaseConstant.COMMA_SEPARATED);
} }
map.put("ids", stringBuilder.substring(0, stringBuilder.length() - 1)); map.put("ids", stringBuilder.substring(0, stringBuilder.length() - 1));
mModel.buyAgainByFoodIds(map) mModel.buyAgainByFoodIds(map)
...@@ -350,8 +346,8 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -350,8 +346,8 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
String substring = files.substring(0, files.length()); String substring = files.substring(0, files.length());
purchaseWarehousingOrder.setFiles(substring); purchaseWarehousingOrder.setFiles(substring);
} }
purchaseWarehousingOrder.setRestaurantId(Constant.getRestaurantId()); purchaseWarehousingOrder.setRestaurantId(PurchaseConstant.getRestaurantId());
purchaseWarehousingOrder.setBrandId(Constant.getBrandId()); purchaseWarehousingOrder.setBrandId(PurchaseConstant.getBrandId());
purchaseWarehousingOrder.setRemarks(remark); purchaseWarehousingOrder.setRemarks(remark);
purchaseWarehousingOrder.setTotalPrice(totalAmount); purchaseWarehousingOrder.setTotalPrice(totalAmount);
orderWareHouseBean.setPurchaseWarehousingOrder(purchaseWarehousingOrder); orderWareHouseBean.setPurchaseWarehousingOrder(purchaseWarehousingOrder);
...@@ -393,8 +389,8 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -393,8 +389,8 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
//不是待收貨狀態才設置id,因為如果已經收過貨才有id //不是待收貨狀態才設置id,因為如果已經收過貨才有id
wareHousingUnitBean.setId(deputyUnitBean.getId()); wareHousingUnitBean.setId(deputyUnitBean.getId());
} }
wareHousingUnitBean.setBrandId(Constant.getBrandId()); wareHousingUnitBean.setBrandId(PurchaseConstant.getBrandId());
wareHousingUnitBean.setRestaurantId(Constant.getRestaurantId()); wareHousingUnitBean.setRestaurantId(PurchaseConstant.getRestaurantId());
purchaseWarehousingOrderDetail.setPurchaseWarehousingUnit(wareHousingUnitBean); purchaseWarehousingOrderDetail.setPurchaseWarehousingUnit(wareHousingUnitBean);
//sn碼 //sn碼
List<PurchaseFoodEncodeSn> snList = null; List<PurchaseFoodEncodeSn> snList = null;
...@@ -425,7 +421,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -425,7 +421,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
public void deleteOrder() { public void deleteOrder() {
mModel.deleteOrder(orderId) mModel.deleteOrder(orderId)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.DELETE_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.DELETE_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -434,7 +430,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -434,7 +430,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
@Override @Override
public void onNext(@NonNull BaseResult info) { public void onNext(@NonNull BaseResult info) {
if (info.isSuccess()) { if (info.isSuccess()) {
mRootView.showMessage(Constant.DELETE_SUCCESS); mRootView.showMessage(PurchaseConstant.DELETE_SUCCESS);
mRootView.killMyself(); mRootView.killMyself();
} }
} }
...@@ -487,7 +483,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -487,7 +483,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
map.put("encodeSnNo", encodeSnNo); map.put("encodeSnNo", encodeSnNo);
mModel.deleteSnCode(map) mModel.deleteSnCode(map)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.DELETE_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.DELETE_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -496,7 +492,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -496,7 +492,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
@Override @Override
public void onNext(@NonNull BaseResult info) { public void onNext(@NonNull BaseResult info) {
if (info.isSuccess()) { if (info.isSuccess()) {
mRootView.showMessage(Constant.DELETE_SUCCESS); mRootView.showMessage(PurchaseConstant.DELETE_SUCCESS);
} }
} }
...@@ -509,7 +505,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -509,7 +505,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
public void querySnCodes(int position, PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean infoVosBean, boolean singerFood) { public void querySnCodes(int position, PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean infoVosBean, boolean singerFood) {
mModel.querySnCodes(infoVosBean.getFoodNo(), infoVosBean.getOrderNo()) mModel.querySnCodes(infoVosBean.getFoodNo(), infoVosBean.getOrderNo())
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.QUERY_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.QUERY_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -556,10 +552,10 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -556,10 +552,10 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
List<MultipartBody.Part> multipartBodies = new ArrayList<>(); List<MultipartBody.Part> multipartBodies = new ArrayList<>();
multipartBodies.add(MultipartBody.Part.createFormData("files", file.getName(), RequestBody.create(MediaType.parse("image/png"), file))); multipartBodies.add(MultipartBody.Part.createFormData("files", file.getName(), RequestBody.create(MediaType.parse("image/png"), file)));
Map<String, Object> map = new HashMap<>(1); Map<String, Object> map = new HashMap<>(1);
map.put("type", Constant.UPLOAD_PIC_TYPE_ORDER); map.put("type", PurchaseConstant.UPLOAD_PIC_TYPE_ORDER);
mModel.upLoadPic(multipartBodies, map) mModel.upLoadPic(multipartBodies, map)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.IMG_UPLOAD_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.IMG_UPLOAD_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
......
...@@ -3,12 +3,10 @@ package com.gingersoft.supply_chain.mvp.presenter; ...@@ -3,12 +3,10 @@ package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.common.bean.BaseResult; import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.mvp.bean.OrderBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseOrderDetailsBean; import com.gingersoft.supply_chain.mvp.bean.PurchaseOrderDetailsBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseOrderResultBean; import com.gingersoft.supply_chain.mvp.bean.PurchaseOrderResultBean;
import com.gingersoft.supply_chain.mvp.content.Constant; import com.gingersoft.supply_chain.mvp.content.PurchaseConstant;
import com.gingersoft.supply_chain.mvp.contract.PurchaseListContract; import com.gingersoft.supply_chain.mvp.contract.PurchaseListContract;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader; import com.jess.arms.http.imageloader.ImageLoader;
...@@ -28,11 +26,8 @@ import io.reactivex.annotations.NonNull; ...@@ -28,11 +26,8 @@ import io.reactivex.annotations.NonNull;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
import me.jessyan.rxerrorhandler.core.RxErrorHandler; import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber; import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import static com.gingersoft.supply_chain.mvp.bean.PurchaseOrderDetailsBean.WAIT_RECEIVED; import static com.gingersoft.supply_chain.mvp.content.PurchaseConstant.PAGE_SIZE;
import static com.gingersoft.supply_chain.mvp.content.Constant.PAGE_SIZE;
/** /**
...@@ -65,9 +60,9 @@ public class PurchaseListPresenter extends BasePresenter<PurchaseListContract.Mo ...@@ -65,9 +60,9 @@ public class PurchaseListPresenter extends BasePresenter<PurchaseListContract.Mo
public void getOrderList(String orderNo, int orderStatus, int pageIndex) { public void getOrderList(String orderNo, int orderStatus, int pageIndex) {
Map<String, Object> map = new HashMap<>(6); Map<String, Object> map = new HashMap<>(6);
Constant.addRestaurantId(map); PurchaseConstant.addRestaurantId(map);
Constant.addBrandId(map); PurchaseConstant.addBrandId(map);
Constant.addPageSize(map); PurchaseConstant.addPageSize(map);
if (TextUtil.isNotEmptyOrNullOrUndefined(orderNo)) { if (TextUtil.isNotEmptyOrNullOrUndefined(orderNo)) {
map.put("orderNo", orderNo); map.put("orderNo", orderNo);
} }
...@@ -85,7 +80,7 @@ public class PurchaseListPresenter extends BasePresenter<PurchaseListContract.Mo ...@@ -85,7 +80,7 @@ public class PurchaseListPresenter extends BasePresenter<PurchaseListContract.Mo
map.put("pageIndex", pageIndex * PAGE_SIZE); map.put("pageIndex", pageIndex * PAGE_SIZE);
mModel.getOrderList(map) mModel.getOrderList(map)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.GET_INFO_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.GET_INFO_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -120,7 +115,7 @@ public class PurchaseListPresenter extends BasePresenter<PurchaseListContract.Mo ...@@ -120,7 +115,7 @@ public class PurchaseListPresenter extends BasePresenter<PurchaseListContract.Mo
public void deleteOrder(int position, int orderId) { public void deleteOrder(int position, int orderId) {
mModel.deleteOrder(orderId) mModel.deleteOrder(orderId)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.DELETE_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.DELETE_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
......
...@@ -4,7 +4,6 @@ import android.annotation.SuppressLint; ...@@ -4,7 +4,6 @@ import android.annotation.SuppressLint;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.common.bean.BaseResult; import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.utils.JsonUtils; import com.gingersoft.gsa.cloud.common.utils.JsonUtils;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil; import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils; import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
...@@ -15,7 +14,7 @@ import com.gingersoft.supply_chain.mvp.bean.NewPurchaseOrderBean; ...@@ -15,7 +14,7 @@ import com.gingersoft.supply_chain.mvp.bean.NewPurchaseOrderBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean; import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import com.gingersoft.supply_chain.mvp.bean.ShoppingCartBean; import com.gingersoft.supply_chain.mvp.bean.ShoppingCartBean;
import com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean; import com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean;
import com.gingersoft.supply_chain.mvp.content.Constant; import com.gingersoft.supply_chain.mvp.content.PurchaseConstant;
import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart; import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart;
import com.gingersoft.supply_chain.mvp.contract.ShoppingCatContract; import com.gingersoft.supply_chain.mvp.contract.ShoppingCatContract;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
...@@ -226,8 +225,8 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode ...@@ -226,8 +225,8 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
public void addNewPurchaseOrder(List<PurchaseFoodBean> purchaseFoodBeans, String remarks) { public void addNewPurchaseOrder(List<PurchaseFoodBean> purchaseFoodBeans, String remarks) {
NewPurchaseOrderBean newPurchaseOrderBean = new NewPurchaseOrderBean(); NewPurchaseOrderBean newPurchaseOrderBean = new NewPurchaseOrderBean();
newPurchaseOrderBean.setBrandId(Constant.getBrandId()); newPurchaseOrderBean.setBrandId(PurchaseConstant.getBrandId());
newPurchaseOrderBean.setRestaurantId(Constant.getRestaurantId()); newPurchaseOrderBean.setRestaurantId(PurchaseConstant.getRestaurantId());
double totalAmount = 0; double totalAmount = 0;
for (PurchaseFoodBean purchaseFoodBean : purchaseFoodBeans) { for (PurchaseFoodBean purchaseFoodBean : purchaseFoodBeans) {
totalAmount = MoneyUtil.sum(totalAmount, MoneyUtil.priceCalculation(purchaseFoodBean.getUnitPrice(), purchaseFoodBean.getFoodQuantity())); totalAmount = MoneyUtil.sum(totalAmount, MoneyUtil.priceCalculation(purchaseFoodBean.getUnitPrice(), purchaseFoodBean.getFoodQuantity()));
......
...@@ -6,7 +6,7 @@ import com.gingersoft.gsa.cloud.common.bean.BaseResult; ...@@ -6,7 +6,7 @@ import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils; import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodEncodeSn; import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodEncodeSn;
import com.gingersoft.supply_chain.mvp.content.Constant; import com.gingersoft.supply_chain.mvp.content.PurchaseConstant;
import com.jess.arms.integration.AppManager; import com.jess.arms.integration.AppManager;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.mvp.BasePresenter; import com.jess.arms.mvp.BasePresenter;
...@@ -23,7 +23,6 @@ import com.gingersoft.supply_chain.mvp.contract.SnCodeListContract; ...@@ -23,7 +23,6 @@ import com.gingersoft.supply_chain.mvp.contract.SnCodeListContract;
import com.jess.arms.utils.RxLifecycleUtils; import com.jess.arms.utils.RxLifecycleUtils;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -79,7 +78,7 @@ public class SnCodeListPresenter extends BasePresenter<SnCodeListContract.Model, ...@@ -79,7 +78,7 @@ public class SnCodeListPresenter extends BasePresenter<SnCodeListContract.Model,
} }
mModel.querySnCodeList(map) mModel.querySnCodeList(map)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.QUERY_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.QUERY_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -100,7 +99,7 @@ public class SnCodeListPresenter extends BasePresenter<SnCodeListContract.Model, ...@@ -100,7 +99,7 @@ public class SnCodeListPresenter extends BasePresenter<SnCodeListContract.Model,
public void queryInStockSnCodes(String foodNo) { public void queryInStockSnCodes(String foodNo) {
mModel.queryInStockSnCodes(foodNo) mModel.queryInStockSnCodes(foodNo)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.QUERY_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.QUERY_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
......
...@@ -3,11 +3,10 @@ package com.gingersoft.supply_chain.mvp.presenter; ...@@ -3,11 +3,10 @@ package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.common.bean.BaseResult; import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils; import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.mvp.bean.WareHousingOrderBean; import com.gingersoft.supply_chain.mvp.bean.WareHousingOrderBean;
import com.gingersoft.supply_chain.mvp.content.Constant; import com.gingersoft.supply_chain.mvp.content.PurchaseConstant;
import com.gingersoft.supply_chain.mvp.contract.StorageListContract; import com.gingersoft.supply_chain.mvp.contract.StorageListContract;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader; import com.jess.arms.http.imageloader.ImageLoader;
...@@ -71,8 +70,8 @@ public class StorageListPresenter extends BasePresenter<StorageListContract.Mode ...@@ -71,8 +70,8 @@ public class StorageListPresenter extends BasePresenter<StorageListContract.Mode
Map<String, Object> map = new HashMap<>(6); Map<String, Object> map = new HashMap<>(6);
map.put("pageSize", 10); map.put("pageSize", 10);
map.put("pageIndex", pageIndex); map.put("pageIndex", pageIndex);
Constant.addBrandId(map); PurchaseConstant.addBrandId(map);
Constant.addRestaurantId(map); PurchaseConstant.addRestaurantId(map);
map.put("status", status); map.put("status", status);
if (TextUtil.isNotEmptyOrNullOrUndefined(orderNo)) { if (TextUtil.isNotEmptyOrNullOrUndefined(orderNo)) {
map.put("orderNo", orderNo); map.put("orderNo", orderNo);
......
...@@ -2,14 +2,11 @@ package com.gingersoft.supply_chain.mvp.presenter; ...@@ -2,14 +2,11 @@ package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.bean.BaseResult; import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean; import com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean;
import com.gingersoft.supply_chain.mvp.bean.SupplierResultBean; import com.gingersoft.supply_chain.mvp.bean.SupplierResultBean;
import com.gingersoft.supply_chain.mvp.content.Constant; import com.gingersoft.supply_chain.mvp.content.PurchaseConstant;
import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart; import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart;
import com.gingersoft.supply_chain.mvp.contract.SupplierListContract; import com.gingersoft.supply_chain.mvp.contract.SupplierListContract;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
...@@ -19,11 +16,9 @@ import com.jess.arms.mvp.BasePresenter; ...@@ -19,11 +16,9 @@ import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.RxLifecycleUtils; import com.jess.arms.utils.RxLifecycleUtils;
import com.xuexiang.rxutil2.rxjava.RxJavaUtils; import com.xuexiang.rxutil2.rxjava.RxJavaUtils;
import com.xuexiang.rxutil2.rxjava.task.RxAsyncTask; import com.xuexiang.rxutil2.rxjava.task.RxAsyncTask;
import com.xuexiang.rxutil2.rxjava.task.RxIOTask;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -34,8 +29,6 @@ import io.reactivex.annotations.NonNull; ...@@ -34,8 +29,6 @@ import io.reactivex.annotations.NonNull;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
import me.jessyan.rxerrorhandler.core.RxErrorHandler; import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber; import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import okhttp3.MediaType;
import okhttp3.RequestBody;
/** /**
...@@ -91,10 +84,10 @@ public class SupplierListPresenter extends BasePresenter<SupplierListContract.Mo ...@@ -91,10 +84,10 @@ public class SupplierListPresenter extends BasePresenter<SupplierListContract.Mo
*/ */
public void getSupplierList(String content, int pageIndex, boolean needGetIndex) { public void getSupplierList(String content, int pageIndex, boolean needGetIndex) {
Map<String, Object> map = new HashMap<>(5); Map<String, Object> map = new HashMap<>(5);
map.put("pageSize", Constant.PAGE_SIZE); map.put("pageSize", PurchaseConstant.PAGE_SIZE);
map.put("pageIndex", pageIndex * Constant.PAGE_SIZE); map.put("pageIndex", pageIndex * PurchaseConstant.PAGE_SIZE);
Constant.addRestaurantId(map); PurchaseConstant.addRestaurantId(map);
Constant.addBrandId(map); PurchaseConstant.addBrandId(map);
if (!TextUtil.isEmptyOrNullOrUndefined(content)) { if (!TextUtil.isEmptyOrNullOrUndefined(content)) {
map.put("content", content); map.put("content", content);
} }
...@@ -175,7 +168,7 @@ public class SupplierListPresenter extends BasePresenter<SupplierListContract.Mo ...@@ -175,7 +168,7 @@ public class SupplierListPresenter extends BasePresenter<SupplierListContract.Mo
public void deleteSupplier(int id, int position) { public void deleteSupplier(int id, int position) {
mModel.deleteSupplier(id) mModel.deleteSupplier(id)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.DELETE_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.DELETE_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -191,7 +184,7 @@ public class SupplierListPresenter extends BasePresenter<SupplierListContract.Mo ...@@ -191,7 +184,7 @@ public class SupplierListPresenter extends BasePresenter<SupplierListContract.Mo
} else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) { } else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg()); mRootView.showMessage(info.getErrMsg());
} else { } else {
mRootView.showMessage(Constant.DELETE_FAIL); mRootView.showMessage(PurchaseConstant.DELETE_FAIL);
} }
} }
} }
......
package com.gingersoft.supply_chain.mvp.presenter; package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application; import android.app.Application;
import android.util.Log;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.utils.CollectionUtils; import com.gingersoft.gsa.cloud.common.utils.CollectionUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.mvp.bean.PurchaseWarehousingOrderDetailsVO; import com.gingersoft.supply_chain.mvp.bean.PurchaseWarehousingOrderDetailsVO;
import com.gingersoft.supply_chain.mvp.bean.SupplierResultBean;
import com.gingersoft.supply_chain.mvp.bean.WareHouseListBean; import com.gingersoft.supply_chain.mvp.bean.WareHouseListBean;
import com.gingersoft.supply_chain.mvp.content.Constant; import com.gingersoft.supply_chain.mvp.content.PurchaseConstant;
import com.jess.arms.integration.AppManager; import com.jess.arms.integration.AppManager;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.mvp.BasePresenter; import com.jess.arms.mvp.BasePresenter;
...@@ -17,7 +14,6 @@ import com.jess.arms.http.imageloader.ImageLoader; ...@@ -17,7 +14,6 @@ import com.jess.arms.http.imageloader.ImageLoader;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
import lombok.experimental.FieldDefaults;
import me.jessyan.rxerrorhandler.core.RxErrorHandler; import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber; import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
...@@ -26,11 +22,7 @@ import javax.inject.Inject; ...@@ -26,11 +22,7 @@ import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.WareHouseListContract; import com.gingersoft.supply_chain.mvp.contract.WareHouseListContract;
import com.jess.arms.utils.RxLifecycleUtils; import com.jess.arms.utils.RxLifecycleUtils;
import org.w3c.dom.Text;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -122,13 +114,13 @@ public class WareHouseListPresenter extends BasePresenter<WareHouseListContract. ...@@ -122,13 +114,13 @@ public class WareHouseListPresenter extends BasePresenter<WareHouseListContract.
if (TextUtil.isNotEmptyOrNullOrUndefined(foodName)) { if (TextUtil.isNotEmptyOrNullOrUndefined(foodName)) {
map.put("name", foodName); map.put("name", foodName);
} }
Constant.addRestaurantId(map); PurchaseConstant.addRestaurantId(map);
Constant.addBrandId(map); PurchaseConstant.addBrandId(map);
map.put("pageSize", 30); map.put("pageSize", 30);
map.put("pageIndex", pageIndex * 30); map.put("pageIndex", pageIndex * 30);
mModel.getWarehousing(map) mModel.getWarehousing(map)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.GET_INFO_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.GET_INFO_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -153,7 +145,7 @@ public class WareHouseListPresenter extends BasePresenter<WareHouseListContract. ...@@ -153,7 +145,7 @@ public class WareHouseListPresenter extends BasePresenter<WareHouseListContract.
mRootView.showMessage(wareHouseListBean.getErrMsg()); mRootView.showMessage(wareHouseListBean.getErrMsg());
mRootView.loadFail(); mRootView.loadFail();
} else { } else {
mRootView.showMessage(Constant.GET_INFO_ERROR); mRootView.showMessage(PurchaseConstant.GET_INFO_ERROR);
mRootView.loadFail(); mRootView.loadFail();
} }
} }
......
...@@ -4,20 +4,15 @@ import android.app.Application; ...@@ -4,20 +4,15 @@ import android.app.Application;
import android.view.View; import android.view.View;
import com.gingersoft.gsa.cloud.common.bean.BaseResult; import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.utils.CollectionUtils; import com.gingersoft.gsa.cloud.common.utils.CollectionUtils;
import com.gingersoft.gsa.cloud.common.utils.JsonUtils;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils; import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.mvp.bean.ConsumeReasonBean; import com.gingersoft.supply_chain.mvp.bean.ConsumeReasonBean;
import com.gingersoft.supply_chain.mvp.bean.ConsumeWareHousingBean; import com.gingersoft.supply_chain.mvp.bean.ConsumeWareHousingBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseConsumeSnBean; import com.gingersoft.supply_chain.mvp.bean.PurchaseConsumeSnBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodEncodeSn;
import com.gingersoft.supply_chain.mvp.bean.PurchaseWarehousingOrderDetailsVO; import com.gingersoft.supply_chain.mvp.bean.PurchaseWarehousingOrderDetailsVO;
import com.gingersoft.supply_chain.mvp.bean.WareHouseListBean;
import com.gingersoft.supply_chain.mvp.bean.WarehouseDetailsBean; import com.gingersoft.supply_chain.mvp.bean.WarehouseDetailsBean;
import com.gingersoft.supply_chain.mvp.content.Constant; import com.gingersoft.supply_chain.mvp.content.PurchaseConstant;
import com.google.gson.Gson;
import com.jess.arms.integration.AppManager; import com.jess.arms.integration.AppManager;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.mvp.BasePresenter; import com.jess.arms.mvp.BasePresenter;
...@@ -27,7 +22,6 @@ import io.reactivex.android.schedulers.AndroidSchedulers; ...@@ -27,7 +22,6 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
import me.jessyan.rxerrorhandler.core.RxErrorHandler; import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber; import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import okhttp3.FormBody;
import okhttp3.MediaType; import okhttp3.MediaType;
import okhttp3.RequestBody; import okhttp3.RequestBody;
...@@ -36,11 +30,9 @@ import javax.inject.Inject; ...@@ -36,11 +30,9 @@ import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.WarehouseDetailsContract; import com.gingersoft.supply_chain.mvp.contract.WarehouseDetailsContract;
import com.jess.arms.utils.RxLifecycleUtils; import com.jess.arms.utils.RxLifecycleUtils;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
...@@ -88,12 +80,12 @@ public class WarehouseDetailsPresenter extends BasePresenter<WarehouseDetailsCon ...@@ -88,12 +80,12 @@ public class WarehouseDetailsPresenter extends BasePresenter<WarehouseDetailsCon
*/ */
public void getWarehousingOrderDetails(String foodNo) { public void getWarehousingOrderDetails(String foodNo) {
Map<String, Object> map = new HashMap<>(4); Map<String, Object> map = new HashMap<>(4);
Constant.addBrandId(map); PurchaseConstant.addBrandId(map);
Constant.addRestaurantId(map); PurchaseConstant.addRestaurantId(map);
map.put("foodNo", foodNo); map.put("foodNo", foodNo);
mModel.getWarehousingOrderDetails(map) mModel.getWarehousingOrderDetails(map)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.GET_INFO_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.GET_INFO_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -107,7 +99,7 @@ public class WarehouseDetailsPresenter extends BasePresenter<WarehouseDetailsCon ...@@ -107,7 +99,7 @@ public class WarehouseDetailsPresenter extends BasePresenter<WarehouseDetailsCon
} else if (baseResult != null && TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) { } else if (baseResult != null && TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg()); mRootView.showMessage(baseResult.getErrMsg());
} else { } else {
mRootView.showMessage(Constant.GET_INFO_ERROR); mRootView.showMessage(PurchaseConstant.GET_INFO_ERROR);
} }
} }
}); });
...@@ -120,12 +112,12 @@ public class WarehouseDetailsPresenter extends BasePresenter<WarehouseDetailsCon ...@@ -120,12 +112,12 @@ public class WarehouseDetailsPresenter extends BasePresenter<WarehouseDetailsCon
*/ */
public void getOutStockDetails(String foodNo) { public void getOutStockDetails(String foodNo) {
Map<String, Object> map = new HashMap<>(4); Map<String, Object> map = new HashMap<>(4);
Constant.addBrandId(map); PurchaseConstant.addBrandId(map);
Constant.addRestaurantId(map); PurchaseConstant.addRestaurantId(map);
map.put("foodNo", foodNo); map.put("foodNo", foodNo);
mModel.getOutStockDetails(map) mModel.getOutStockDetails(map)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.GET_INFO_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.GET_INFO_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -139,7 +131,7 @@ public class WarehouseDetailsPresenter extends BasePresenter<WarehouseDetailsCon ...@@ -139,7 +131,7 @@ public class WarehouseDetailsPresenter extends BasePresenter<WarehouseDetailsCon
} else if (baseResult != null && TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) { } else if (baseResult != null && TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg()); mRootView.showMessage(baseResult.getErrMsg());
} else { } else {
mRootView.showMessage(Constant.GET_INFO_ERROR); mRootView.showMessage(PurchaseConstant.GET_INFO_ERROR);
} }
} }
}); });
...@@ -151,7 +143,7 @@ public class WarehouseDetailsPresenter extends BasePresenter<WarehouseDetailsCon ...@@ -151,7 +143,7 @@ public class WarehouseDetailsPresenter extends BasePresenter<WarehouseDetailsCon
public void getWarehouseInventoryReason() { public void getWarehouseInventoryReason() {
mModel.getWarehouseInventoryReason() mModel.getWarehouseInventoryReason()
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.GET_INFO_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.GET_INFO_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -165,7 +157,7 @@ public class WarehouseDetailsPresenter extends BasePresenter<WarehouseDetailsCon ...@@ -165,7 +157,7 @@ public class WarehouseDetailsPresenter extends BasePresenter<WarehouseDetailsCon
} else if (baseResult != null && TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) { } else if (baseResult != null && TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg()); mRootView.showMessage(baseResult.getErrMsg());
} else { } else {
mRootView.showMessage(Constant.GET_INFO_ERROR); mRootView.showMessage(PurchaseConstant.GET_INFO_ERROR);
} }
} }
}); });
...@@ -181,8 +173,8 @@ public class WarehouseDetailsPresenter extends BasePresenter<WarehouseDetailsCon ...@@ -181,8 +173,8 @@ public class WarehouseDetailsPresenter extends BasePresenter<WarehouseDetailsCon
*/ */
public void consumeWareHousing(PurchaseWarehousingOrderDetailsVO purchaseWarehousingOrderDetailsVO, int consumeQuantity, ConsumeReasonBean consumeReasonBean, String remarks, List<String> snCodes, boolean whetherPrint) { public void consumeWareHousing(PurchaseWarehousingOrderDetailsVO purchaseWarehousingOrderDetailsVO, int consumeQuantity, ConsumeReasonBean consumeReasonBean, String remarks, List<String> snCodes, boolean whetherPrint) {
PurchaseConsumeSnBean purchaseConsumeSnBean = new PurchaseConsumeSnBean(); PurchaseConsumeSnBean purchaseConsumeSnBean = new PurchaseConsumeSnBean();
purchaseConsumeSnBean.brandId = Constant.getBrandId(); purchaseConsumeSnBean.brandId = PurchaseConstant.getBrandId();
purchaseConsumeSnBean.restaurantId = Constant.getRestaurantId(); purchaseConsumeSnBean.restaurantId = PurchaseConstant.getRestaurantId();
purchaseConsumeSnBean.foodNo = purchaseWarehousingOrderDetailsVO.getFoodNo(); purchaseConsumeSnBean.foodNo = purchaseWarehousingOrderDetailsVO.getFoodNo();
purchaseConsumeSnBean.purchaseConsumeReasonId = consumeReasonBean.getId(); purchaseConsumeSnBean.purchaseConsumeReasonId = consumeReasonBean.getId();
purchaseConsumeSnBean.remarks = remarks; purchaseConsumeSnBean.remarks = remarks;
...@@ -195,7 +187,7 @@ public class WarehouseDetailsPresenter extends BasePresenter<WarehouseDetailsCon ...@@ -195,7 +187,7 @@ public class WarehouseDetailsPresenter extends BasePresenter<WarehouseDetailsCon
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(purchaseConsumeSnBean)); RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(purchaseConsumeSnBean));
mModel.consumeWareHousing(requestBody) mModel.consumeWareHousing(requestBody)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.UPDATE_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.UPDATE_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -219,7 +211,7 @@ public class WarehouseDetailsPresenter extends BasePresenter<WarehouseDetailsCon ...@@ -219,7 +211,7 @@ public class WarehouseDetailsPresenter extends BasePresenter<WarehouseDetailsCon
} else if (baseResult != null && TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) { } else if (baseResult != null && TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg()); mRootView.showMessage(baseResult.getErrMsg());
} else { } else {
mRootView.showMessage(Constant.GET_INFO_ERROR); mRootView.showMessage(PurchaseConstant.GET_INFO_ERROR);
} }
} }
}); });
...@@ -230,12 +222,12 @@ public class WarehouseDetailsPresenter extends BasePresenter<WarehouseDetailsCon ...@@ -230,12 +222,12 @@ public class WarehouseDetailsPresenter extends BasePresenter<WarehouseDetailsCon
*/ */
public void getWarehousingNum(String foodNo) { public void getWarehousingNum(String foodNo) {
Map<String, Object> map = new HashMap<>(3); Map<String, Object> map = new HashMap<>(3);
Constant.addBrandId(map); PurchaseConstant.addBrandId(map);
Constant.addRestaurantId(map); PurchaseConstant.addRestaurantId(map);
map.put("foodNo", foodNo); map.put("foodNo", foodNo);
mModel.getWarehousingNum(map) mModel.getWarehousingNum(map)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.QUERY_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.QUERY_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
......
...@@ -9,8 +9,7 @@ import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; ...@@ -9,8 +9,7 @@ import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.mvp.bean.InventoryRecordBean; import com.gingersoft.supply_chain.mvp.bean.InventoryRecordBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseConsumeSnBean; import com.gingersoft.supply_chain.mvp.bean.PurchaseConsumeSnBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodEncodeSn; import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodEncodeSn;
import com.gingersoft.supply_chain.mvp.content.Constant; import com.gingersoft.supply_chain.mvp.content.PurchaseConstant;
import com.google.gson.Gson;
import com.jess.arms.integration.AppManager; import com.jess.arms.integration.AppManager;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.mvp.BasePresenter; import com.jess.arms.mvp.BasePresenter;
...@@ -20,9 +19,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers; ...@@ -20,9 +19,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
import me.jessyan.rxerrorhandler.core.RxErrorHandler; import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber; import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import okhttp3.FormBody;
import okhttp3.MediaType; import okhttp3.MediaType;
import okhttp3.Request;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import javax.inject.Inject; import javax.inject.Inject;
...@@ -86,11 +83,11 @@ public class WarehousingInventoryPresenter extends BasePresenter<WarehousingInve ...@@ -86,11 +83,11 @@ public class WarehousingInventoryPresenter extends BasePresenter<WarehousingInve
public PurchaseConsumeSnBean getPurchaseConsumeSnBean(String foodNo, int consumeQuantity, List<PurchaseFoodEncodeSn> snCodes) { public PurchaseConsumeSnBean getPurchaseConsumeSnBean(String foodNo, int consumeQuantity, List<PurchaseFoodEncodeSn> snCodes) {
PurchaseConsumeSnBean purchaseConsumeSnBean = new PurchaseConsumeSnBean(); PurchaseConsumeSnBean purchaseConsumeSnBean = new PurchaseConsumeSnBean();
purchaseConsumeSnBean.brandId = Constant.getBrandId(); purchaseConsumeSnBean.brandId = PurchaseConstant.getBrandId();
purchaseConsumeSnBean.restaurantId = Constant.getRestaurantId(); purchaseConsumeSnBean.restaurantId = PurchaseConstant.getRestaurantId();
purchaseConsumeSnBean.foodNo = foodNo; purchaseConsumeSnBean.foodNo = foodNo;
purchaseConsumeSnBean.consumeQuantity = consumeQuantity; purchaseConsumeSnBean.consumeQuantity = consumeQuantity;
purchaseConsumeSnBean.purchaseConsumeReasonId = Constant.INVENTORY_CONSUME_ID; purchaseConsumeSnBean.purchaseConsumeReasonId = PurchaseConstant.INVENTORY_CONSUME_ID;
if (CollectionUtils.isNotNullOrEmpty(snCodes)) { if (CollectionUtils.isNotNullOrEmpty(snCodes)) {
purchaseConsumeSnBean.encodeFoodNos = new ArrayList<>(); purchaseConsumeSnBean.encodeFoodNos = new ArrayList<>();
for (PurchaseFoodEncodeSn snCode : snCodes) { for (PurchaseFoodEncodeSn snCode : snCodes) {
...@@ -107,7 +104,7 @@ public class WarehousingInventoryPresenter extends BasePresenter<WarehousingInve ...@@ -107,7 +104,7 @@ public class WarehousingInventoryPresenter extends BasePresenter<WarehousingInve
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(purchaseConsumeSnBean)); RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(purchaseConsumeSnBean));
mModel.wareHousingInventory(requestBody) mModel.wareHousingInventory(requestBody)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.SAVE_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.SAVE_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -117,12 +114,12 @@ public class WarehousingInventoryPresenter extends BasePresenter<WarehousingInve ...@@ -117,12 +114,12 @@ public class WarehousingInventoryPresenter extends BasePresenter<WarehousingInve
public void onNext(BaseResult baseResult) { public void onNext(BaseResult baseResult) {
if (baseResult != null && baseResult.isSuccess()) { if (baseResult != null && baseResult.isSuccess()) {
//消耗完之後,關閉頁面 //消耗完之後,關閉頁面
mRootView.showMessage(Constant.SAVE_SUCCESS); mRootView.showMessage(PurchaseConstant.SAVE_SUCCESS);
mRootView.updateSuccess(purchaseConsumeSnBean.consumeQuantity); mRootView.updateSuccess(purchaseConsumeSnBean.consumeQuantity);
} else if (baseResult != null && TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) { } else if (baseResult != null && TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg()); mRootView.showMessage(baseResult.getErrMsg());
} else { } else {
mRootView.showMessage(Constant.SAVE_FAIL); mRootView.showMessage(PurchaseConstant.SAVE_FAIL);
} }
} }
}); });
...@@ -134,11 +131,11 @@ public class WarehousingInventoryPresenter extends BasePresenter<WarehousingInve ...@@ -134,11 +131,11 @@ public class WarehousingInventoryPresenter extends BasePresenter<WarehousingInve
public void getWarehousingRecord(String foodNo, int pageIndex) { public void getWarehousingRecord(String foodNo, int pageIndex) {
Map<String, Object> map = new HashMap<>(3); Map<String, Object> map = new HashMap<>(3);
map.put("foodNo", foodNo); map.put("foodNo", foodNo);
Constant.addPageSize(map); PurchaseConstant.addPageSize(map);
map.put("pageIndex", pageIndex * Constant.PAGE_SIZE); map.put("pageIndex", pageIndex * PurchaseConstant.PAGE_SIZE);
mModel.getWarehousingRecord(map) mModel.getWarehousingRecord(map)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.QUERY_LOADING)) .doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.QUERY_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -159,7 +156,7 @@ public class WarehousingInventoryPresenter extends BasePresenter<WarehousingInve ...@@ -159,7 +156,7 @@ public class WarehousingInventoryPresenter extends BasePresenter<WarehousingInve
} else if (baseResult != null && TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) { } else if (baseResult != null && TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg()); mRootView.showMessage(baseResult.getErrMsg());
} else { } else {
mRootView.showMessage(Constant.SAVE_FAIL); mRootView.showMessage(PurchaseConstant.SAVE_FAIL);
} }
} }
}); });
......
...@@ -13,6 +13,7 @@ import com.gingersoft.gsa.cloud.common.utils.threadPool.ThreadPoolManager; ...@@ -13,6 +13,7 @@ import com.gingersoft.gsa.cloud.common.utils.threadPool.ThreadPoolManager;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.BuyIngredientsBean; import com.gingersoft.supply_chain.mvp.bean.BuyIngredientsBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean; import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.BuyIngredientsFragment;
import java.util.List; import java.util.List;
...@@ -24,16 +25,25 @@ import java.util.List; ...@@ -24,16 +25,25 @@ import java.util.List;
* Use: 食材列表 * Use: 食材列表
*/ */
public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredientsBean> { public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredientsBean> {
/**
* 編輯或者下單
* FOOD_INGREDIENTS
* ADD_ORDER
* ORDER_TYPE
*/
private int adapterType;
private boolean isSinger = true; private boolean isSinger = true;
private OnFoodNumberChangeListener onFoodNumberChangeListener; private OnFoodNumberChangeListener onFoodNumberChangeListener;
private boolean longClick = false; private boolean longClick = false;
private int delayTime = 500; private int delayTime = 500;
public BuyIngredientsAdapter(Context context, List<BuyIngredientsBean> buyIngredientsBeans) { public BuyIngredientsAdapter(Context context, List<BuyIngredientsBean> buyIngredientsBeans, int adapterType) {
super(context, buyIngredientsBeans); super(context, buyIngredientsBeans);
addChildClickViewIds(R.id.iv_commodity_edit, R.id.iv_commodity_delete);
this.adapterType = adapterType;
} }
public void setShowSingerRow(boolean showType) { public void setShowSingerRow(boolean showType) {
isSinger = showType; isSinger = showType;
} }
...@@ -133,7 +143,16 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi ...@@ -133,7 +143,16 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi
} }
} }
}); });
if (adapterType == BuyIngredientsFragment.FOOD_INGREDIENTS) {
//編輯食材頁面,顯示編輯和刪除,隱藏加減和數量
setDisplayStateByType(itemViewHolder, true, false, false);
} else if (adapterType == BuyIngredientsFragment.ADD_ORDER) {
//創建採購單頁面,隱藏編輯和刪除,顯示加減和數量
setDisplayStateByType(itemViewHolder, false, true, true);
} else if (adapterType == BuyIngredientsFragment.GET_FOOD_BY_SUPPLIER) {
//供應商商品列表,編輯和數量都顯示
setDisplayStateByType(itemViewHolder, true, purchaseFoodBean.getFoodQuantity() > 0, true);
}
//輸入框焦點監聽 //輸入框焦點監聽
// itemViewHolder.setOnFocusChangeListener(R.id.ed_food_ingredient_number, (v, hasFocus) -> { // itemViewHolder.setOnFocusChangeListener(R.id.ed_food_ingredient_number, (v, hasFocus) -> {
// CharSequence text = itemViewHolder.getText(R.id.ed_food_ingredient_number); // CharSequence text = itemViewHolder.getText(R.id.ed_food_ingredient_number);
...@@ -147,6 +166,14 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi ...@@ -147,6 +166,14 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi
} }
private void setDisplayStateByType(BaseViewHolder itemViewHolder, boolean b, boolean b2, boolean b3) {
itemViewHolder.setVisible(R.id.iv_commodity_edit, b);
itemViewHolder.setVisible(R.id.iv_commodity_delete, b);
itemViewHolder.setVisible(R.id.btn_food_operation_sub, b2);
itemViewHolder.setVisible(R.id.ed_food_ingredient_number, b2);
itemViewHolder.setVisible(R.id.btn_food_operation_add, b3);
}
/** /**
* 設置減少按鈕和輸入框的顯示或隱藏 * 設置減少按鈕和輸入框的顯示或隱藏
* *
......
...@@ -34,6 +34,8 @@ public class FirstLevelCategoryAdapter extends BaseQuickAdapter<OrderCategoryBea ...@@ -34,6 +34,8 @@ public class FirstLevelCategoryAdapter extends BaseQuickAdapter<OrderCategoryBea
private int selectColor = -1; private int selectColor = -1;
private int unSelectColor = -1; private int unSelectColor = -1;
private boolean showNumber = true;
public FirstLevelCategoryAdapter(@Nullable List<OrderCategoryBean.FoodCategoryTrees> data, Context context) { public FirstLevelCategoryAdapter(@Nullable List<OrderCategoryBean.FoodCategoryTrees> data, Context context) {
super(R.layout.item_first_level_category, data); super(R.layout.item_first_level_category, data);
selectColor = ContextCompat.getColor(context, R.color.other_order_details_sure_btn_color); selectColor = ContextCompat.getColor(context, R.color.other_order_details_sure_btn_color);
...@@ -45,7 +47,7 @@ public class FirstLevelCategoryAdapter extends BaseQuickAdapter<OrderCategoryBea ...@@ -45,7 +47,7 @@ public class FirstLevelCategoryAdapter extends BaseQuickAdapter<OrderCategoryBea
TextView tvCategoryName = viewHolder.getView(R.id.tv_category_name); TextView tvCategoryName = viewHolder.getView(R.id.tv_category_name);
tvCategoryName.setText(categoryBean.getName()); tvCategoryName.setText(categoryBean.getName());
CardView view = viewHolder.getView(R.id.layout_category); CardView view = viewHolder.getView(R.id.layout_category);
if (categoryBean.getSize() > 0) { if (categoryBean.getSize() > 0 && showNumber) {
viewHolder.setText(R.id.tv_category_number, String.valueOf(categoryBean.getSize())); viewHolder.setText(R.id.tv_category_number, String.valueOf(categoryBean.getSize()));
viewHolder.setGone(R.id.tv_category_number, false); viewHolder.setGone(R.id.tv_category_number, false);
} else { } else {
...@@ -81,6 +83,11 @@ public class FirstLevelCategoryAdapter extends BaseQuickAdapter<OrderCategoryBea ...@@ -81,6 +83,11 @@ public class FirstLevelCategoryAdapter extends BaseQuickAdapter<OrderCategoryBea
} }
} }
public FirstLevelCategoryAdapter setIsShowNumber(boolean showNumber) {
this.showNumber = showNumber;
return this;
}
public FirstLevelCategoryAdapter setSelectColor(int selectColor) { public FirstLevelCategoryAdapter setSelectColor(int selectColor) {
this.selectColor = selectColor; this.selectColor = selectColor;
return this; return this;
......
...@@ -3,7 +3,6 @@ package com.gingersoft.supply_chain.mvp.ui.adapter; ...@@ -3,7 +3,6 @@ package com.gingersoft.supply_chain.mvp.ui.adapter;
import android.content.Context; import android.content.Context;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.EditText; import android.widget.EditText;
...@@ -27,7 +26,7 @@ import java.util.HashMap; ...@@ -27,7 +26,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static com.gingersoft.supply_chain.mvp.content.Constant.PURCHASE_FOOD_MAX; import static com.gingersoft.supply_chain.mvp.content.PurchaseConstant.PURCHASE_FOOD_MAX;
import static com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodIngredientsFragment.FOOD_INGREDIENTS; import static com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodIngredientsFragment.FOOD_INGREDIENTS;
import static com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodIngredientsFragment.ORDER_TYPE; import static com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodIngredientsFragment.ORDER_TYPE;
......
...@@ -23,7 +23,6 @@ import com.chad.library.adapter.base.animation.SlideInBottomAnimation; ...@@ -23,7 +23,6 @@ import com.chad.library.adapter.base.animation.SlideInBottomAnimation;
import com.chad.library.adapter.base.animation.SlideInLeftAnimation; import com.chad.library.adapter.base.animation.SlideInLeftAnimation;
import com.chad.library.adapter.base.animation.SlideInRightAnimation; import com.chad.library.adapter.base.animation.SlideInRightAnimation;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.BuyIngredientsBean;
import com.gingersoft.supply_chain.mvp.bean.GroupStructure; import com.gingersoft.supply_chain.mvp.bean.GroupStructure;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -48,10 +47,11 @@ public abstract class GroupedRecyclerViewAdapter<T> ...@@ -48,10 +47,11 @@ public abstract class GroupedRecyclerViewAdapter<T>
private OnHeaderClickListener mOnHeaderClickListener; private OnHeaderClickListener mOnHeaderClickListener;
private OnFooterClickListener mOnFooterClickListener; private OnFooterClickListener mOnFooterClickListener;
private OnChildClickListener mOnChildClickListener; private OnItemClickListener mOnItemClickListener;
private OnHeaderLongClickListener mOnHeaderLongClickListener; private OnHeaderLongClickListener mOnHeaderLongClickListener;
private OnFooterLongClickListener mOnFooterLongClickListener; private OnFooterLongClickListener mOnFooterLongClickListener;
private OnChildLongClickListener mOnChildLongClickListener; private OnItemLongClickListener mOnItemLongClickListener;
private OnItemChildClickListener mOnItemChildClickListener;
protected Context mContext; protected Context mContext;
//保存分组列表的组结构 //保存分组列表的组结构
...@@ -66,6 +66,10 @@ public abstract class GroupedRecyclerViewAdapter<T> ...@@ -66,6 +66,10 @@ public abstract class GroupedRecyclerViewAdapter<T>
private boolean showEmptyView = false; private boolean showEmptyView = false;
private List<T> data; private List<T> data;
/**
* 子view點擊id
*/
private List<Integer> childClickViewIds = new ArrayList<>();
public GroupedRecyclerViewAdapter(Context context, List<T> data) { public GroupedRecyclerViewAdapter(Context context, List<T> data) {
this(context, false, data); this(context, false, data);
...@@ -164,14 +168,33 @@ public abstract class GroupedRecyclerViewAdapter<T> ...@@ -164,14 +168,33 @@ public abstract class GroupedRecyclerViewAdapter<T>
if (viewType == TYPE_EMPTY) { if (viewType == TYPE_EMPTY) {
return new BaseViewHolder(getEmptyView(parent)); return new BaseViewHolder(getEmptyView(parent));
} else { } else {
BaseViewHolder viewHolder;
if (mUseBinding) { if (mUseBinding) {
ViewDataBinding binding = DataBindingUtil.inflate(LayoutInflater.from(mContext), ViewDataBinding binding = DataBindingUtil.inflate(LayoutInflater.from(mContext),
getLayoutId(mTempPosition, viewType), parent, false); getLayoutId(mTempPosition, viewType), parent, false);
return new BaseViewHolder(binding.getRoot()); viewHolder = new BaseViewHolder(binding.getRoot());
} else { } else {
View view = LayoutInflater.from(mContext).inflate( View view = LayoutInflater.from(mContext).inflate(
getLayoutId(mTempPosition, viewType), parent, false); getLayoutId(mTempPosition, viewType), parent, false);
return new BaseViewHolder(view); viewHolder = new BaseViewHolder(view);
}
bindViewClickListener(viewHolder, viewType);
return viewHolder;
}
}
protected void bindViewClickListener(BaseViewHolder viewHolder, int viewType) {
if (mOnItemChildClickListener != null && viewType == TYPE_CHILD) {
for (Integer childClickViewId : childClickViewIds) {
View childView = viewHolder.get(childClickViewId);
if (!childView.isClickable()) {
childView.setClickable(true);
}
childView.setOnClickListener(v -> {
int groupPosition = getGroupPositionForPosition(viewHolder.getAdapterPosition());
mOnItemChildClickListener.onItemChildClick(GroupedRecyclerViewAdapter.this, v, groupPosition, getChildPositionForPosition(groupPosition, viewHolder.getAdapterPosition()));
});
} }
} }
} }
...@@ -248,16 +271,16 @@ public abstract class GroupedRecyclerViewAdapter<T> ...@@ -248,16 +271,16 @@ public abstract class GroupedRecyclerViewAdapter<T>
onBindFooterViewHolder((BaseViewHolder) holder, groupPosition, data.get(groupPosition)); onBindFooterViewHolder((BaseViewHolder) holder, groupPosition, data.get(groupPosition));
} else if (type == TYPE_CHILD) { } else if (type == TYPE_CHILD) {
int childPosition = getChildPositionForPosition(groupPosition, position); int childPosition = getChildPositionForPosition(groupPosition, position);
if (mOnChildClickListener != null) { if (mOnItemClickListener != null) {
holder.itemView.setOnClickListener(new View.OnClickListener() { holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (mOnChildClickListener != null) { if (mOnItemClickListener != null) {
int gPosition = getGroupPositionForPosition(holder.getLayoutPosition()); int gPosition = getGroupPositionForPosition(holder.getLayoutPosition());
int cPosition = getChildPositionForPosition(gPosition, holder.getLayoutPosition()); int cPosition = getChildPositionForPosition(gPosition, holder.getLayoutPosition());
if (gPosition >= 0 && gPosition < mStructures.size() && cPosition >= 0 if (gPosition >= 0 && gPosition < mStructures.size() && cPosition >= 0
&& cPosition < mStructures.get(gPosition).getChildrenCount()) { && cPosition < mStructures.get(gPosition).getChildrenCount()) {
mOnChildClickListener.onChildClick(GroupedRecyclerViewAdapter.this, mOnItemClickListener.onChildClick(GroupedRecyclerViewAdapter.this,
(BaseViewHolder) holder, gPosition, cPosition); (BaseViewHolder) holder, gPosition, cPosition);
} }
} }
...@@ -265,16 +288,16 @@ public abstract class GroupedRecyclerViewAdapter<T> ...@@ -265,16 +288,16 @@ public abstract class GroupedRecyclerViewAdapter<T>
}); });
} }
if (mOnChildLongClickListener != null) { if (mOnItemLongClickListener != null) {
holder.itemView.setOnLongClickListener(new View.OnLongClickListener() { holder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override @Override
public boolean onLongClick(View v) { public boolean onLongClick(View v) {
if (mOnChildLongClickListener != null) { if (mOnItemLongClickListener != null) {
int gPosition = getGroupPositionForPosition(holder.getLayoutPosition()); int gPosition = getGroupPositionForPosition(holder.getLayoutPosition());
int cPosition = getChildPositionForPosition(gPosition, holder.getLayoutPosition()); int cPosition = getChildPositionForPosition(gPosition, holder.getLayoutPosition());
if (gPosition >= 0 && gPosition < mStructures.size() && cPosition >= 0 if (gPosition >= 0 && gPosition < mStructures.size() && cPosition >= 0
&& cPosition < mStructures.get(gPosition).getChildrenCount()) { && cPosition < mStructures.get(gPosition).getChildrenCount()) {
return mOnChildLongClickListener.onChildLongClick(GroupedRecyclerViewAdapter.this, return mOnItemLongClickListener.onChildLongClick(GroupedRecyclerViewAdapter.this,
(BaseViewHolder) holder, gPosition, cPosition); (BaseViewHolder) holder, gPosition, cPosition);
} }
} }
...@@ -1303,6 +1326,16 @@ public abstract class GroupedRecyclerViewAdapter<T> ...@@ -1303,6 +1326,16 @@ public abstract class GroupedRecyclerViewAdapter<T>
} }
} }
/**
* 设置需要点击事件的子view
*
* @param viewIds IntArray
*/
public void addChildClickViewIds(int... viewIds) {
for (int viewId : viewIds) {
childClickViewIds.add(viewId);
}
}
//****** 设置点击事件 *****// //****** 设置点击事件 *****//
/** /**
...@@ -1328,8 +1361,12 @@ public abstract class GroupedRecyclerViewAdapter<T> ...@@ -1328,8 +1361,12 @@ public abstract class GroupedRecyclerViewAdapter<T>
* *
* @param listener * @param listener
*/ */
public void setOnChildLongClickListener(OnChildLongClickListener listener) { public void setOnItemLongClickListener(OnItemLongClickListener listener) {
mOnChildLongClickListener = listener; mOnItemLongClickListener = listener;
}
public void setOnItemChildClickListener(OnItemChildClickListener mOnItemChildClickListener) {
this.mOnItemChildClickListener = mOnItemChildClickListener;
} }
/** /**
...@@ -1355,8 +1392,8 @@ public abstract class GroupedRecyclerViewAdapter<T> ...@@ -1355,8 +1392,8 @@ public abstract class GroupedRecyclerViewAdapter<T>
* *
* @param listener * @param listener
*/ */
public void setOnChildClickListener(OnChildClickListener listener) { public void setOnItemClickListener(OnItemClickListener listener) {
mOnChildClickListener = listener; mOnItemClickListener = listener;
} }
public abstract int getGroupCount(); public abstract int getGroupCount();
...@@ -1427,11 +1464,15 @@ public abstract class GroupedRecyclerViewAdapter<T> ...@@ -1427,11 +1464,15 @@ public abstract class GroupedRecyclerViewAdapter<T>
void onFooterClick(GroupedRecyclerViewAdapter adapter, BaseViewHolder holder, int groupPosition); void onFooterClick(GroupedRecyclerViewAdapter adapter, BaseViewHolder holder, int groupPosition);
} }
public interface OnChildClickListener { public interface OnItemClickListener {
void onChildClick(GroupedRecyclerViewAdapter adapter, BaseViewHolder holder, void onChildClick(GroupedRecyclerViewAdapter adapter, BaseViewHolder holder,
int groupPosition, int childPosition); int groupPosition, int childPosition);
} }
public interface OnItemChildClickListener {
void onItemChildClick(@NonNull GroupedRecyclerViewAdapter adapter, @NonNull View view, int groupPosition, int position);
}
public interface OnHeaderLongClickListener { public interface OnHeaderLongClickListener {
boolean onHeaderLongClick(GroupedRecyclerViewAdapter adapter, BaseViewHolder holder, int groupPosition); boolean onHeaderLongClick(GroupedRecyclerViewAdapter adapter, BaseViewHolder holder, int groupPosition);
} }
...@@ -1440,7 +1481,7 @@ public abstract class GroupedRecyclerViewAdapter<T> ...@@ -1440,7 +1481,7 @@ public abstract class GroupedRecyclerViewAdapter<T>
boolean onFooterLongClick(GroupedRecyclerViewAdapter adapter, BaseViewHolder holder, int groupPosition); boolean onFooterLongClick(GroupedRecyclerViewAdapter adapter, BaseViewHolder holder, int groupPosition);
} }
public interface OnChildLongClickListener { public interface OnItemLongClickListener {
boolean onChildLongClick(GroupedRecyclerViewAdapter adapter, BaseViewHolder holder, boolean onChildLongClick(GroupedRecyclerViewAdapter adapter, BaseViewHolder holder,
int groupPosition, int childPosition); int groupPosition, int childPosition);
} }
......
...@@ -12,7 +12,7 @@ import androidx.recyclerview.widget.RecyclerView; ...@@ -12,7 +12,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemClickListener; import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.gingersoft.gsa.cloud.common.BuildConfig; import com.gingersoft.gsa.cloud.common.BuildConfig;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager; import com.gingersoft.gsa.cloud.common.function.click.SingleClick;
import com.gingersoft.gsa.cloud.common.utils.other.SPUtils; import com.gingersoft.gsa.cloud.common.utils.other.SPUtils;
import com.gingersoft.gsa.cloud.database.bean.Function; import com.gingersoft.gsa.cloud.database.bean.Function;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
...@@ -25,16 +25,13 @@ import com.gingersoft.supply_chain.mvp.ui.adapter.FunctionChildAdapter; ...@@ -25,16 +25,13 @@ import com.gingersoft.supply_chain.mvp.ui.adapter.FunctionChildAdapter;
import com.gingersoft.supply_chain.mvp.ui.adapter.PurchaseFunctionAdapter; import com.gingersoft.supply_chain.mvp.ui.adapter.PurchaseFunctionAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.category.CategoryFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.category.CategoryFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.BuyIngredientsFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.food.BuyIngredientsFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodIngredientsFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.MeasurementUnitFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.inventory.StorageListFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.inventory.StorageListFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.order.OrderDetailsFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.order.PurchaseListFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.order.PurchaseListFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.MeasurementUnitFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.supplier.SupplierListFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.supplier.SupplierListFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodIngredientsFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.WareHouseListFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.WareHouseListFragment;
import com.gingersoft.supply_chain.mvp.ui.widget.GoodsDetailsPopup;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.lxj.xpopup.XPopup;
import com.qmuiteam.qmui.widget.QMUITopBar; import com.qmuiteam.qmui.widget.QMUITopBar;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -116,7 +113,8 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr ...@@ -116,7 +113,8 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr
start(SupplierListFragment.newInstance(false, null)); start(SupplierListFragment.newInstance(false, null));
break; break;
case "食材": case "食材":
start(FoodIngredientsFragment.newInstance(FOOD_INGREDIENTS)); // start(FoodIngredientsFragment.newInstance(FOOD_INGREDIENTS));
start(BuyIngredientsFragment.newInstance(FOOD_INGREDIENTS));
break; break;
case "種類": case "種類":
start(CategoryFragment.newInstance()); start(CategoryFragment.newInstance());
......
...@@ -5,7 +5,9 @@ import android.view.LayoutInflater; ...@@ -5,7 +5,9 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.EditText; import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
...@@ -16,30 +18,37 @@ import androidx.recyclerview.widget.GridLayoutManager; ...@@ -16,30 +18,37 @@ import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.listener.OnItemClickListener; import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.gingersoft.gsa.cloud.common.loadsir.purchase.EmptyCategoryCallback;
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;
import com.gingersoft.supply_chain.R2; import com.gingersoft.supply_chain.R2;
import com.gingersoft.supply_chain.di.component.DaggerCategoryComponent; import com.gingersoft.supply_chain.di.component.DaggerCategoryComponent;
import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean; import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean;
import com.gingersoft.supply_chain.mvp.content.Constant; import com.gingersoft.supply_chain.mvp.content.PurchaseConstant;
import com.gingersoft.supply_chain.mvp.contract.CategoryContract; import com.gingersoft.supply_chain.mvp.contract.CategoryContract;
import com.gingersoft.supply_chain.mvp.presenter.CategoryPresenter; import com.gingersoft.supply_chain.mvp.presenter.CategoryPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.FoodCategoryAdapter; import com.gingersoft.supply_chain.mvp.ui.adapter.FoodCategoryAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.gingersoft.supply_chain.mvp.ui.widget.NewAddCategoryPopup; import com.gingersoft.supply_chain.mvp.ui.widget.NewAddCategoryPopup;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.kingja.loadsir.callback.Callback;
import com.kingja.loadsir.core.LoadSir;
import com.lxj.xpopup.XPopup; import com.lxj.xpopup.XPopup;
import com.qmuiteam.qmui.alpha.QMUIAlphaButton; import com.qmuiteam.qmui.alpha.QMUIAlphaButton;
import com.qmuiteam.qmui.alpha.QMUIAlphaTextView; import com.qmuiteam.qmui.alpha.QMUIAlphaTextView;
import com.qmuiteam.qmui.widget.QMUITopBar; import com.qmuiteam.qmui.widget.QMUITopBar;
import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import butterknife.BindView; import butterknife.BindView;
import butterknife.OnClick; import butterknife.OnClick;
import static com.gingersoft.supply_chain.mvp.ui.fragment.category.CategorySelectFragment.SELECT_CATEGORY_DATA_KEY;
import static com.gingersoft.supply_chain.mvp.ui.fragment.category.CategorySelectFragment.SELECT_FOOD_CATEGORY_RESULT_CODE;
/** /**
* ================================================ * ================================================
...@@ -67,21 +76,56 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -67,21 +76,56 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
RecyclerView rvThirdCategory; RecyclerView rvThirdCategory;
@BindView(R2.id.card_second_category) @BindView(R2.id.card_second_category)
CardView cardSecondCategory; CardView cardSecondCategory;
@BindView(R2.id.layout_third_category)
FrameLayout thirdCategoryLayout;
@BindView(R2.id.tv_new_third_category) @BindView(R2.id.tv_new_third_category)
QMUIAlphaTextView addThirdCategory; QMUIAlphaTextView addThirdCategory;
@BindView(R2.id.tv_new_second_category) @BindView(R2.id.tv_new_second_category)
QMUIAlphaTextView addSecondCategory; QMUIAlphaTextView addSecondCategory;
@BindView(R2.id.layout_category) @BindView(R2.id.layout_category)
LinearLayout layoutCategory; LinearLayout layoutCategory;
@BindView(R2.id.layout_select_category_btn)
LinearLayout layoutSelectBtn;
@BindView(R2.id.layout_category_right)
RelativeLayout layoutCategoryRight;
@BindView(R2.id.layout_category_content)
LinearLayout layoutCategoryContent;
/** /**
* 當前選中的是幾級分類 * 當前選中的是幾級分類
*/ */
private int currentLevel; private int currentLevel;
/**
* 頁面是管理分類
* 還是選擇分類 SELECT_CATEGORY
*/
private int pageType;
/**
* 默認選中的分類
*/
private String categoryName;
/**
* 默認分類的下標,一級、二級、三級
*/
private int[] categoryPosition;
public final static String PAGE_TYPE_KEY = "pageType";
private final static String CATEGORY_NAME_KEY = "categoryNameKey";
/** /**
* 當前等級分類的下標 * pageType 為選擇分類
*/ */
// private int currentLevelPosition; public final static int SELECT_CATEGORY = 1001;
public static CategoryFragment newInstance(String categoryName, int pageType) {
CategoryFragment fragment = new CategoryFragment();
Bundle bundle = new Bundle();
bundle.putInt(PAGE_TYPE_KEY, pageType);
bundle.putString(CATEGORY_NAME_KEY, categoryName);
fragment.setArguments(bundle);
return fragment;
}
public static CategoryFragment newInstance() { public static CategoryFragment newInstance() {
CategoryFragment fragment = new CategoryFragment(); CategoryFragment fragment = new CategoryFragment();
return fragment; return fragment;
...@@ -104,41 +148,48 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -104,41 +148,48 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
@Override @Override
public void initData(@Nullable Bundle savedInstanceState) { public void initData(@Nullable Bundle savedInstanceState) {
// loadService = LoadSir.getDefault().register(layoutCategory, (Callback.OnReloadListener) v -> mPresenter.getCategoryTrees()); loadService = LoadSir.getDefault().register(layoutCategoryContent, (Callback.OnReloadListener) v -> showAddCategory(getString(R.string.str_new_add_category), 0, mPresenter.primaryCategoryTag));
Bundle arguments = getArguments();
if (arguments != null) {
pageType = arguments.getInt(PAGE_TYPE_KEY, 0);
categoryName = arguments.getString(CATEGORY_NAME_KEY);
//選擇分類
layoutSelectBtn.setVisibility(pageType == SELECT_CATEGORY ? View.VISIBLE : View.GONE);
}
initTopBar(); initTopBar();
mPresenter.getCategoryTrees(); mPresenter.getCategoryTrees();
} }
private void initTopBar() { private void initTopBar() {
topbarFoodIngredients.addRightImageButton(R.drawable.ic_white_edit, R.id.topbar_right_delete_button).setOnClickListener(v -> editCategory()); topbarFoodIngredients.addRightImageButton(R.drawable.ic_white_edit, R.id.topbar_right_delete_button).setOnClickListener(v -> {
topbarFoodIngredients.setTitle("類別管理"); FoodCategoryAdapter currentCategoryAdapter = getCurrentCategoryAdapter();
OrderCategoryBean.FoodCategoryTrees categoryInfo = getCategoryInfo(currentCategoryAdapter);
if (categoryInfo != null) {
showEditCategoryPop(categoryInfo, currentCategoryAdapter.getSelectIndex());
}
});
if (pageType == SELECT_CATEGORY) {
topbarFoodIngredients.setTitle(getString(R.string.str_choice_category));
} else {
topbarFoodIngredients.setTitle(getString(R.string.str_category_manager));
}
topbarFoodIngredients.addLeftBackImageButton().setOnClickListener(v -> killMyself()); topbarFoodIngredients.addLeftBackImageButton().setOnClickListener(v -> killMyself());
} }
/** /**
* 右上角編輯分類 * 獲取當前選中的分類adapter
*/ */
private void editCategory() { private FoodCategoryAdapter getCurrentCategoryAdapter() {
OrderCategoryBean.FoodCategoryTrees foodCategoryTrees;
int position;
if (currentLevel == mPresenter.primaryCategoryTag) { if (currentLevel == mPresenter.primaryCategoryTag) {
foodCategoryTrees = getCategoryInfo(categoryAdapter); return categoryAdapter;
position = categoryAdapter.getSelectIndex();
} else if (currentLevel == mPresenter.secondCategoryTag) { } else if (currentLevel == mPresenter.secondCategoryTag) {
foodCategoryTrees = getCategoryInfo(secondCategoryAdapter); return secondCategoryAdapter;
position = secondCategoryAdapter.getSelectIndex();
} else if (currentLevel == mPresenter.thirdCategoryTag) { } else if (currentLevel == mPresenter.thirdCategoryTag) {
foodCategoryTrees = getCategoryInfo(thirdCategoryAdapter); return thirdCategoryAdapter;
position = thirdCategoryAdapter.getSelectIndex();
} else { } else {
showMessage("請重新選擇分類"); showMessage(getString(R.string.str_please_reselect_category));
return; return null;
}
if (foodCategoryTrees == null) {
showMessage("請重新選擇分類");
return;
} }
showEditCategoryPop(foodCategoryTrees, position);
} }
/** /**
...@@ -148,7 +199,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -148,7 +199,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
* @param position 編輯的分類下標,編輯之後用於刷新 * @param position 編輯的分類下標,編輯之後用於刷新
*/ */
private void showEditCategoryPop(OrderCategoryBean.FoodCategoryTrees foodCategoryTrees, int position) { private void showEditCategoryPop(OrderCategoryBean.FoodCategoryTrees foodCategoryTrees, int position) {
NewAddCategoryPopup categoryPopup = new NewAddCategoryPopup(mContext, "修改", "類別名稱", "请修改當前類別名稱", foodCategoryTrees.getName(), true); NewAddCategoryPopup categoryPopup = new NewAddCategoryPopup(mContext, getString(R.string.str_modify), getString(R.string.str_category_name), getString(R.string.str_please_modify_current_category_name), foodCategoryTrees.getName(), true);
categoryPopup.setOnDeleteListener(v -> { categoryPopup.setOnDeleteListener(v -> {
//刪除分類 //刪除分類
AppDialog.getInstance().showWaringDialog(mContext, String.format(getString(R.string.str_delete_category_tip), foodCategoryTrees.getName()), (view, dialog) -> { AppDialog.getInstance().showWaringDialog(mContext, String.format(getString(R.string.str_delete_category_tip), foodCategoryTrees.getName()), (view, dialog) -> {
...@@ -160,7 +211,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -160,7 +211,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
.asCustom(categoryPopup.setListener(() -> { .asCustom(categoryPopup.setListener(() -> {
//修改分類 //修改分類
if (TextUtil.isEmptyOrNullOrUndefined(categoryPopup.getEditText())) { if (TextUtil.isEmptyOrNullOrUndefined(categoryPopup.getEditText())) {
showMessage("請輸入分類名稱"); showMessage(getString(R.string.str_please_input_category_name));
return; return;
} }
mPresenter.updateFoodCategory(mPresenter.toFoodCategoryBean(foodCategoryTrees.getParentId(), TextUtil.getNotNullStrAndTrim(categoryPopup.getEditText().getText().toString()), foodCategoryTrees.getId()), currentLevel, position); mPresenter.updateFoodCategory(mPresenter.toFoodCategoryBean(foodCategoryTrees.getParentId(), TextUtil.getNotNullStrAndTrim(categoryPopup.getEditText().getText().toString()), foodCategoryTrees.getId()), currentLevel, position);
...@@ -177,7 +228,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -177,7 +228,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
*/ */
private OrderCategoryBean.FoodCategoryTrees getCategoryInfo(FoodCategoryAdapter categoryAdapter) { private OrderCategoryBean.FoodCategoryTrees getCategoryInfo(FoodCategoryAdapter categoryAdapter) {
if (categoryAdapter == null || categoryAdapter.getSelectIndex() == -1) { if (categoryAdapter == null || categoryAdapter.getSelectIndex() == -1) {
showMessage("请选择分类"); showMessage(getString(R.string.str_please_choise_category));
return null; return null;
} }
if (categoryAdapter.getItemCount() > categoryAdapter.getSelectIndex()) { if (categoryAdapter.getItemCount() > categoryAdapter.getSelectIndex()) {
...@@ -186,36 +237,52 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -186,36 +237,52 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
return null; return null;
} }
@OnClick({R2.id.btn_category_search, R2.id.tv_new_second_category, R2.id.btn_add_first_category, R2.id.tv_new_third_category}) @OnClick({R2.id.btn_category_search, R2.id.tv_new_second_category, R2.id.btn_add_first_category, R2.id.tv_new_third_category, R2.id.btn_food_ingredients_confirm, R2.id.btn_food_ingredients_cancel})
@Override @Override
public void onClick(View v) { public void onClick(View v) {
//新增一級、二級、三級分類
int viewId = v.getId(); int viewId = v.getId();
String parentCategoryName = null; if (viewId == R.id.btn_food_ingredients_confirm) {
int level = 0; //確定
int parentId = 0; OrderCategoryBean.FoodCategoryTrees categoryInfo = getCategoryInfo(getCurrentCategoryAdapter());
if (viewId == R.id.btn_add_first_category) { if (categoryInfo != null) {
//添加一級分類 Bundle bundle = new Bundle();
//沒有父級數據,直接添加 List<OrderCategoryBean.FoodCategoryTrees> selectCategory = new ArrayList<>();
parentCategoryName = "新增類別"; selectCategory.add(categoryInfo);
parentId = 0; bundle.putSerializable(SELECT_CATEGORY_DATA_KEY, (Serializable) selectCategory);
level = mPresenter.primaryCategoryTag; setFragmentResult(SELECT_FOOD_CATEGORY_RESULT_CODE, bundle);
} else if (viewId == R.id.tv_new_second_category) { killMyself();
//添加二級分類 }
//拿到選中的一級分類信息 } else if (viewId == R.id.btn_food_ingredients_cancel) {
OrderCategoryBean.FoodCategoryTrees foodCategoryTrees = categoryAdapter.getItem(categoryAdapter.getSelectIndex()); //取消
parentCategoryName = foodCategoryTrees.getName(); killMyself();
parentId = foodCategoryTrees.getId(); } else {
level = mPresenter.secondCategoryTag; //新增一級、二級、三級分類
} else if (viewId == R.id.tv_new_third_category) { String parentCategoryName = null;
//添加三級分類 int level = 0;
//拿到選中的二級分類信息 int parentId = 0;
OrderCategoryBean.FoodCategoryTrees item = secondCategoryAdapter.getItem(secondCategoryAdapter.getSelectIndex()); if (viewId == R.id.btn_add_first_category) {
parentCategoryName = item.getName(); //添加一級分類
parentId = item.getId(); //沒有父級數據,直接添加
level = mPresenter.thirdCategoryTag; parentCategoryName = getString(R.string.str_new_add_category);
parentId = 0;
level = mPresenter.primaryCategoryTag;
} else if (viewId == R.id.tv_new_second_category) {
//添加二級分類
//拿到選中的一級分類信息
OrderCategoryBean.FoodCategoryTrees foodCategoryTrees = categoryAdapter.getItem(categoryAdapter.getSelectIndex());
parentCategoryName = foodCategoryTrees.getName();
parentId = foodCategoryTrees.getId();
level = mPresenter.secondCategoryTag;
} else if (viewId == R.id.tv_new_third_category) {
//添加三級分類
//拿到選中的二級分類信息
OrderCategoryBean.FoodCategoryTrees item = secondCategoryAdapter.getItem(secondCategoryAdapter.getSelectIndex());
parentCategoryName = item.getName();
parentId = item.getId();
level = mPresenter.thirdCategoryTag;
}
showAddCategory(parentCategoryName, parentId, level);
} }
showAddCategory(parentCategoryName, parentId, level);
} }
/** /**
...@@ -227,12 +294,12 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -227,12 +294,12 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
*/ */
private void showAddCategory(String parentCategoryName, int parentId, int level) { private void showAddCategory(String parentCategoryName, int parentId, int level) {
if (TextUtil.isNotEmptyOrNullOrUndefined(parentCategoryName)) { if (TextUtil.isNotEmptyOrNullOrUndefined(parentCategoryName)) {
NewAddCategoryPopup categoryPopup = new NewAddCategoryPopup(mContext, parentCategoryName, "類別名稱", "请輸入類別名稱", null, false); NewAddCategoryPopup categoryPopup = new NewAddCategoryPopup(mContext, parentCategoryName, getString(R.string.str_category_name), getString(R.string.str_please_input_category_name), null, false);
new XPopup.Builder(getContext()) new XPopup.Builder(getContext())
.asCustom(categoryPopup.setListener(() -> { .asCustom(categoryPopup.setListener(() -> {
//創建分類 //創建分類
if (TextUtil.isEmptyOrNullOrUndefined(categoryPopup.getEditText())) { if (TextUtil.isEmptyOrNullOrUndefined(categoryPopup.getEditText())) {
showMessage("請輸入分類名稱"); showMessage(getString(R.string.str_please_input_category_name));
return; return;
} }
//創建分類 //創建分類
...@@ -241,7 +308,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -241,7 +308,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
})) }))
.show(); .show();
} else { } else {
showMessage("請選擇分類"); showMessage(getString(R.string.str_please_choise_category));
} }
} }
...@@ -263,6 +330,11 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -263,6 +330,11 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
@Override @Override
public void loadCategoryInfo(List<OrderCategoryBean.FoodCategoryTrees> data) { public void loadCategoryInfo(List<OrderCategoryBean.FoodCategoryTrees> data) {
if (TextUtil.isNotEmptyOrNullOrUndefined(categoryName)) {
categoryPosition = mPresenter.getCategoryIndexByName(categoryName, data);
} else {
categoryPosition = new int[]{0, 0, 0};
}
//加載一級分類 //加載一級分類
if (categoryAdapter == null) { if (categoryAdapter == null) {
categoryAdapter = new FoodCategoryAdapter(R.layout.item_first_category, data) categoryAdapter = new FoodCategoryAdapter(R.layout.item_first_category, data)
...@@ -286,14 +358,15 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -286,14 +358,15 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
categoryAdapter.setNewInstance(data); categoryAdapter.setNewInstance(data);
setCurrentInfo(mPresenter.primaryCategoryTag); setCurrentInfo(mPresenter.primaryCategoryTag);
} }
setSecondCategoryVisibility();
if (categoryAdapter.getItemCount() > 0) { if (categoryAdapter.getItemCount() > 0) {
int defaultSelect = categoryPosition[0];
//如果有一級分類,默認顯示第一個一級分類下的二級分類 //如果有一級分類,默認顯示第一個一級分類下的二級分類
categoryAdapter.setSelectIndex(0); categoryAdapter.setSelectIndex(defaultSelect);
loadSecondCategory(categoryAdapter.getItem(0).getFoodCategoryTrees()); loadSecondCategory(categoryAdapter.getItem(defaultSelect).getFoodCategoryTrees());
//顯示新增二級分類 //顯示新增二級分類
addSecondCategory.setVisibility(View.VISIBLE); addSecondCategory.setVisibility(View.VISIBLE);
} else { } else {
addSecondCategory.setVisibility(View.GONE);
categoryAdapter.setSelectIndex(-1); categoryAdapter.setSelectIndex(-1);
} }
} }
...@@ -327,10 +400,12 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -327,10 +400,12 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
.setUnCheckedBg(ContextCompat.getDrawable(mContext, R.drawable.shape_five_radius_gray_stroke)) .setUnCheckedBg(ContextCompat.getDrawable(mContext, R.drawable.shape_five_radius_gray_stroke))
.setCheckedTextColor(ContextCompat.getColor(mContext, R.color.white)) .setCheckedTextColor(ContextCompat.getColor(mContext, R.color.white))
.setUnCheckedTextColor(ContextCompat.getColor(mContext, R.color.color_3c)) .setUnCheckedTextColor(ContextCompat.getColor(mContext, R.color.color_3c))
.setSelectIndex(categoryPosition[1] + 1)
.setOnItemClickListener((adapter, view, position) -> { .setOnItemClickListener((adapter, view, position) -> {
//二級分類點擊事件,設置當前數據為二級分類 //二級分類點擊事件,設置當前數據為二級分類
setCurrentInfo(mPresenter.secondCategoryTag); setCurrentInfo(mPresenter.secondCategoryTag);
secondCategoryAdapter.setSelectIndex(position); secondCategoryAdapter.setSelectIndex(position);
setSecondCategoryVisibility();
//加載三級分類 //加載三級分類
loadThirdCategory(secondCategoryAdapter.getItem(position).getFoodCategoryTrees()); loadThirdCategory(secondCategoryAdapter.getItem(position).getFoodCategoryTrees());
}); });
...@@ -341,12 +416,38 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -341,12 +416,38 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
} }
}); });
rvSecondCategory.setAdapter(secondCategoryAdapter); rvSecondCategory.setAdapter(secondCategoryAdapter);
if (secondCategoryAdapter.getItemCount() > 0) {
if (secondCategoryAdapter.getSelectIndex() < secondCategoryAdapter.getItemCount()) {
//二級分類點擊事件,設置當前數據為二級分類
setCurrentInfo(mPresenter.secondCategoryTag);
loadThirdCategory(secondCategoryAdapter.getItem(secondCategoryAdapter.getSelectIndex()).getFoodCategoryTrees());
}
}
} else { } else {
//重置選中 //重置選中
secondCategoryAdapter.setSelectIndex(-1); secondCategoryAdapter.setSelectIndex(-1);
secondCategoryAdapter.setNewInstance(data); secondCategoryAdapter.setNewInstance(data);
secondCategoryAdapter.notifyDataSetChanged(); secondCategoryAdapter.notifyDataSetChanged();
} }
setThirdCategoryVisibility();
}
private void setSecondCategoryVisibility() {
cardSecondCategory.setVisibility(categoryAdapter.getItemCount() > 0 ? View.VISIBLE : View.GONE);
setThirdCategoryVisibility();
if (cardSecondCategory.getVisibility() == View.GONE) {
loadService.showCallback(EmptyCategoryCallback.class);
} else {
loadService.showSuccess();
}
}
private void setThirdCategoryVisibility() {
if (secondCategoryAdapter != null && secondCategoryAdapter.getItemCount() > 1 && secondCategoryAdapter.getSelectIndex() > 0) {
thirdCategoryLayout.setVisibility(View.VISIBLE);
} else {
thirdCategoryLayout.setVisibility(View.GONE);
}
} }
/** /**
...@@ -363,7 +464,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -363,7 +464,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
addNewAddBtn(data); addNewAddBtn(data);
if (thirdCategoryAdapter == null) { if (thirdCategoryAdapter == null) {
thirdCategoryAdapter = new FoodCategoryAdapter(data); thirdCategoryAdapter = new FoodCategoryAdapter(data);
thirdCategoryAdapter.setSelectIndex(-1) thirdCategoryAdapter.setSelectIndex(categoryPosition[2] + 1)
.setCheckedBg(ContextCompat.getDrawable(mContext, R.drawable.shape_color_theme_stoke_fifteen_corners)) .setCheckedBg(ContextCompat.getDrawable(mContext, R.drawable.shape_color_theme_stoke_fifteen_corners))
.setUnCheckedBg(ContextCompat.getDrawable(mContext, R.drawable.shape_color_da_stoke_fifteen_corners)) .setUnCheckedBg(ContextCompat.getDrawable(mContext, R.drawable.shape_color_da_stoke_fifteen_corners))
.setCheckedTextColor(ContextCompat.getColor(mContext, R.color.white)) .setCheckedTextColor(ContextCompat.getColor(mContext, R.color.white))
...@@ -372,6 +473,10 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -372,6 +473,10 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
setCurrentInfo(mPresenter.thirdCategoryTag); setCurrentInfo(mPresenter.thirdCategoryTag);
thirdCategoryAdapter.setSelectIndex(position); thirdCategoryAdapter.setSelectIndex(position);
}); });
if (thirdCategoryAdapter.getItemCount() > thirdCategoryAdapter.getSelectIndex()) {
//二級分類點擊事件,設置當前數據為二級分類
setCurrentInfo(mPresenter.thirdCategoryTag);
}
rvThirdCategory.setLayoutManager(new GridLayoutManager(mContext, 3)); rvThirdCategory.setLayoutManager(new GridLayoutManager(mContext, 3));
rvThirdCategory.setAdapter(thirdCategoryAdapter); rvThirdCategory.setAdapter(thirdCategoryAdapter);
} else { } else {
...@@ -399,9 +504,11 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -399,9 +504,11 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
categoryAdapter.setSelectIndex(clickIndex); categoryAdapter.setSelectIndex(clickIndex);
//調用點擊事件,刷新下面的二級分類 //調用點擊事件,刷新下面的二級分類
categoryAdapter.getOnItemClickListener().onItemClick(categoryAdapter, null, clickIndex); categoryAdapter.getOnItemClickListener().onItemClick(categoryAdapter, null, clickIndex);
setSecondCategoryVisibility();
} else if (hierarchy == mPresenter.secondCategoryTag) { } else if (hierarchy == mPresenter.secondCategoryTag) {
//如果是添加的二級分類,就要拿到當前的一級分類,給一級分類的子分類集合中添加分類 //如果是添加的二級分類,就要拿到當前的一級分類,給一級分類的子分類集合中添加分類
newCategory(categoryTrees, categoryAdapter); newCategory(categoryTrees, categoryAdapter);
setThirdCategoryVisibility();
} else if (hierarchy == mPresenter.thirdCategoryTag) { } else if (hierarchy == mPresenter.thirdCategoryTag) {
//如果是添加的二級分類,就要拿到當前的一級分類,給一級分類的子分類集合中添加分類 //如果是添加的二級分類,就要拿到當前的一級分類,給一級分類的子分類集合中添加分類
newCategory(categoryTrees, secondCategoryAdapter); newCategory(categoryTrees, secondCategoryAdapter);
...@@ -440,7 +547,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -440,7 +547,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
@Override @Override
public void updateCategory(int type, int hierarchy, String categoryName, int position) { public void updateCategory(int type, int hierarchy, String categoryName, int position) {
if (hierarchy == mPresenter.primaryCategoryTag && categoryAdapter != null) { if (hierarchy == mPresenter.primaryCategoryTag && categoryAdapter != null) {
if (type == Constant.DELETE) { if (type == PurchaseConstant.DELETE) {
//如果是刪除,就移除掉 //如果是刪除,就移除掉
categoryAdapter.removeAt(position); categoryAdapter.removeAt(position);
if (categoryAdapter.getItemCount() > 0) { if (categoryAdapter.getItemCount() > 0) {
...@@ -452,10 +559,9 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -452,10 +559,9 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
//清除二級三級分類 //清除二級三級分類
secondCategoryAdapter.setList(null); secondCategoryAdapter.setList(null);
secondCategoryAdapter.setList(null); secondCategoryAdapter.setList(null);
addSecondCategory.setVisibility(View.GONE); setSecondCategoryVisibility();
addThirdCategory.setVisibility(View.GONE);
} }
} else if (type == Constant.UPDATE) { } else if (type == PurchaseConstant.UPDATE) {
//修改了分類名稱,拿到對應數據刷新 //修改了分類名稱,拿到對應數據刷新
OrderCategoryBean.FoodCategoryTrees item = categoryAdapter.getItem(position); OrderCategoryBean.FoodCategoryTrees item = categoryAdapter.getItem(position);
item.setName(categoryName); item.setName(categoryName);
...@@ -483,14 +589,13 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -483,14 +589,13 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
* @param position 分類下標 * @param position 分類下標
*/ */
private void updateChildCategory(FoodCategoryAdapter adapter, int type, int hierarchy, String categoryName, int position) { private void updateChildCategory(FoodCategoryAdapter adapter, int type, int hierarchy, String categoryName, int position) {
if (type == Constant.DELETE) { if (type == PurchaseConstant.DELETE) {
adapter.removeAt(position); adapter.removeAt(position);
if (hierarchy == mPresenter.secondCategoryTag) { if (hierarchy == mPresenter.secondCategoryTag) {
thirdCategoryAdapter.setNewInstance(null); thirdCategoryAdapter.setNewInstance(null);
//如果是二級分類,還需要判斷如果分類數量為0時,就不顯示三級分類 //如果是二級分類,還需要判斷如果分類數量為0時,就不顯示三級分類
if (secondCategoryAdapter.getItemCount() <= 1) { if (secondCategoryAdapter.getItemCount() <= 1) {
thirdCategoryAdapter.setNewInstance(null); setThirdCategoryVisibility();
addThirdCategory.setVisibility(View.GONE);
//切換選中一級 //切換選中一級
setCurrentInfo(mPresenter.primaryCategoryTag); setCurrentInfo(mPresenter.primaryCategoryTag);
} else { } else {
...@@ -500,7 +605,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -500,7 +605,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
//刪除的是三級,切換選中到二級 //刪除的是三級,切換選中到二級
setCurrentInfo(mPresenter.secondCategoryTag); setCurrentInfo(mPresenter.secondCategoryTag);
} }
} else if (type == Constant.UPDATE) { } else if (type == PurchaseConstant.UPDATE) {
//修改了分類名稱 //修改了分類名稱
OrderCategoryBean.FoodCategoryTrees item = adapter.getItem(position); OrderCategoryBean.FoodCategoryTrees item = adapter.getItem(position);
item.setName(categoryName); item.setName(categoryName);
......
...@@ -20,12 +20,9 @@ import androidx.recyclerview.widget.RecyclerView.OnScrollListener; ...@@ -20,12 +20,9 @@ import androidx.recyclerview.widget.RecyclerView.OnScrollListener;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemClickListener; import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.gingersoft.gsa.cloud.common.loadsir.EmptyCallback; import com.gingersoft.gsa.cloud.common.loadsir.purchase.NotGoodsCallback;
import com.gingersoft.gsa.cloud.common.loadsir.ErrorCallback;
import com.gingersoft.gsa.cloud.common.utils.CollectionUtils; import com.gingersoft.gsa.cloud.common.utils.CollectionUtils;
import com.gingersoft.gsa.cloud.order.cart.ShoppingCart; import com.gingersoft.gsa.cloud.ui.utils.AppDialog;
import com.gingersoft.gsa.cloud.ui.animator.CustomAnimation1;
import com.gingersoft.gsa.cloud.ui.bean.view.CategoryBean;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2; import com.gingersoft.supply_chain.R2;
import com.gingersoft.supply_chain.di.component.DaggerBuyIngredientsComponent; import com.gingersoft.supply_chain.di.component.DaggerBuyIngredientsComponent;
...@@ -35,10 +32,8 @@ import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean; ...@@ -35,10 +32,8 @@ import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart; import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart;
import com.gingersoft.supply_chain.mvp.contract.BuyIngredientsContract; import com.gingersoft.supply_chain.mvp.contract.BuyIngredientsContract;
import com.gingersoft.supply_chain.mvp.presenter.BuyIngredientsPresenter; import com.gingersoft.supply_chain.mvp.presenter.BuyIngredientsPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.BaseViewHolder;
import com.gingersoft.supply_chain.mvp.ui.adapter.BuyIngredientsAdapter; import com.gingersoft.supply_chain.mvp.ui.adapter.BuyIngredientsAdapter;
import com.gingersoft.supply_chain.mvp.ui.adapter.FirstLevelCategoryAdapter; import com.gingersoft.supply_chain.mvp.ui.adapter.FirstLevelCategoryAdapter;
import com.gingersoft.supply_chain.mvp.ui.adapter.GroupedRecyclerViewAdapter;
import com.gingersoft.supply_chain.mvp.ui.adapter.SecondCategoryAdapter; import com.gingersoft.supply_chain.mvp.ui.adapter.SecondCategoryAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.order.ShoppingCatFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.order.ShoppingCatFragment;
...@@ -48,7 +43,6 @@ import com.gingersoft.supply_chain.mvp.ui.widget.GroupedGridLayoutManager; ...@@ -48,7 +43,6 @@ import com.gingersoft.supply_chain.mvp.ui.widget.GroupedGridLayoutManager;
import com.gingersoft.supply_chain.mvp.ui.widget.ShowSecondCategoryPopup; import com.gingersoft.supply_chain.mvp.ui.widget.ShowSecondCategoryPopup;
import com.gingersoft.supply_chain.mvp.ui.widget.StickyHeaderLayout; import com.gingersoft.supply_chain.mvp.ui.widget.StickyHeaderLayout;
import com.gingersoft.supply_chain.mvp.utils.ViewUtils; import com.gingersoft.supply_chain.mvp.utils.ViewUtils;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.appbar.CollapsingToolbarLayout; import com.google.android.material.appbar.CollapsingToolbarLayout;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.kingja.loadsir.callback.Callback; import com.kingja.loadsir.callback.Callback;
...@@ -72,7 +66,7 @@ import butterknife.BindView; ...@@ -72,7 +66,7 @@ import butterknife.BindView;
import butterknife.OnClick; import butterknife.OnClick;
import lombok.val; import lombok.val;
import static com.scwang.smartrefresh.layout.internal.InternalClassics.ID_TEXT_TITLE; import static com.gingersoft.supply_chain.mvp.ui.fragment.food.NewFoodIngredientsFragment.EDIT_FOOD_RESULT_CODE;
/** /**
* Description: 選購食材 * Description: 選購食材
...@@ -100,8 +94,6 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -100,8 +94,6 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
RecyclerView rvSecondCategory; RecyclerView rvSecondCategory;
private SecondCategoryAdapter secondCategoryAdapter; private SecondCategoryAdapter secondCategoryAdapter;
// @BindView(R2.id.section_food_ingredients)
// QMUIStickySectionLayout sectionFood;
private BuyIngredientsAdapter adapter; private BuyIngredientsAdapter adapter;
@BindView(R2.id.rv_food_ingredients) @BindView(R2.id.rv_food_ingredients)
RecyclerView rvFoodIngredients; RecyclerView rvFoodIngredients;
...@@ -125,15 +117,15 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -125,15 +117,15 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
CardView cardMoreCategory; CardView cardMoreCategory;
@BindView(R2.id.iv_unfold_arrow) @BindView(R2.id.iv_unfold_arrow)
ImageView ivUnfoldArrow; ImageView ivUnfoldArrow;
@BindView(R2.id.tv_unfold_category)
TextView tvUnfoldCategory;
@BindView(R2.id.refreshLayout) @BindView(R2.id.refreshLayout)
SmartRefreshLayout refreshLayout; SmartRefreshLayout refreshLayout;
@BindView(R2.id.view_stick_head) @BindView(R2.id.view_stick_head)
StickyHeaderLayout stickyHeaderLayout; StickyHeaderLayout stickyHeaderLayout;
@BindView(R2.id.fresh_header) @BindView(R2.id.fresh_header)
ClassicsHeader classicsHeader; ClassicsHeader classicsHeader;
//購物車數量textview /**
* 購物車數量textview
*/
TextView tvShoppingCart; TextView tvShoppingCart;
/** /**
* 購物車中商品數量 * 購物車中商品數量
...@@ -165,8 +157,14 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -165,8 +157,14 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
private final static String pageTypeKey = "pageType"; private final static String pageTypeKey = "pageType";
private final static String supplierIdKey = "supplierId"; private final static String supplierIdKey = "supplierId";
private final static String supplierNameKey = "supplierName"; private final static String supplierNameKey = "supplierName";
/**
public final static int TO_SHOPPING_CART_REQUESTCODE = 1001; * 購物車requestCode
*/
public final static int TO_SHOPPING_CART_REQUEST_CODE = 1001;
/**
* 新增/編輯食材 request_code
*/
private final int EDIT_FOOD_REQUEST_CODE = 1050;
public static BuyIngredientsFragment newInstance(int pageType) { public static BuyIngredientsFragment newInstance(int pageType) {
BuyIngredientsFragment fragment = new BuyIngredientsFragment(); BuyIngredientsFragment fragment = new BuyIngredientsFragment();
...@@ -209,6 +207,10 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -209,6 +207,10 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
} }
initTopBar(); initTopBar();
fullRegister = LoadSir.getDefault().register(layoutContent, (Callback.OnReloadListener) v -> { fullRegister = LoadSir.getDefault().register(layoutContent, (Callback.OnReloadListener) v -> {
if (v.getId() == R.id.layout_not_commodity) {
//新增食材
toCreateFood();
}
}); });
refreshLayout.setOnRefreshListener(refreshLayout -> { refreshLayout.setOnRefreshListener(refreshLayout -> {
//在這裡不是刷新,而是獲取上一個分類的數據 //在這裡不是刷新,而是獲取上一個分類的數據
...@@ -257,11 +259,16 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -257,11 +259,16 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
// mPresenter.addToSupplierCacheInfo(supplierId, supplierName); // mPresenter.addToSupplierCacheInfo(supplierId, supplierName);
//獲取該供應商數據 //獲取該供應商數據
// getFoodsBySupplierId(); // getFoodsBySupplierId();
//隱藏二級分類
setSecondCategoryShowState(View.GONE);
mPresenter.initSupplierFoods(1);
initCategoryInfo(Collections.singletonList(supplierToCategory));
mPresenter.getFoodsBySupplier(0, supplierToCategory, false, true); mPresenter.getFoodsBySupplier(0, supplierToCategory, false, true);
} else { } else {
killMyself(); killMyself();
} }
} else { } else {
setSecondCategoryShowState(View.VISIBLE);
//獲取一級分類 //獲取一級分類
mPresenter.getCategoryTrees(); mPresenter.getCategoryTrees();
} }
...@@ -292,11 +299,22 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -292,11 +299,22 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
* 新建食品 * 新建食品
*/ */
private void toCreateFood() { private void toCreateFood() {
String defaultName = getCurrentCategoryName();
if (isShowSupplier) { if (isShowSupplier) {
// startForResult(NewFoodIngredientsFragment.newInstance(currentSupplierName, ""), EDIT_FOOD_REQUEST_CODE); startForResult(NewFoodIngredientsFragment.newInstance(defaultName, ""), EDIT_FOOD_REQUEST_CODE);
} else { } else {
// startForResult(NewFoodIngredientsFragment.newInstance("", currentCategoryName), EDIT_FOOD_REQUEST_CODE); startForResult(NewFoodIngredientsFragment.newInstance("", defaultName), EDIT_FOOD_REQUEST_CODE);
}
}
private String getCurrentCategoryName() {
String defaultName = "";
if (firstLevelCategoryAdapter != null) {
if (firstLevelCategoryAdapter.getItemCount() > firstLevelCategoryAdapter.getSelectedIndex()) {
defaultName = firstLevelCategoryAdapter.getItem(firstLevelCategoryAdapter.getSelectedIndex()).getName();
}
} }
return defaultName;
} }
@OnClick({R2.id.layout_food_ingredients_search, R2.id.tv_switch_food_ingredients_show_type, R2.id.btn_food_ingredients_confirm, @OnClick({R2.id.layout_food_ingredients_search, R2.id.tv_switch_food_ingredients_show_type, R2.id.btn_food_ingredients_confirm,
...@@ -432,11 +450,11 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -432,11 +450,11 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
isShowSupplier = !isShowSupplier; isShowSupplier = !isShowSupplier;
if (isShowSupplier) { if (isShowSupplier) {
//獲取供應商 //獲取供應商
layoutCategory.setVisibility(View.GONE); setSecondCategoryShowState(View.GONE);
mPresenter.loadFoodIngredientsData(-1, true); mPresenter.loadFoodIngredientsData(-1, true);
} else { } else {
//獲取分類 //獲取分類
layoutCategory.setVisibility(View.VISIBLE); setSecondCategoryShowState(View.VISIBLE);
mPresenter.getCategoryTrees(); mPresenter.getCategoryTrees();
} }
setShowTypeBtn(); setShowTypeBtn();
...@@ -489,7 +507,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -489,7 +507,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
List<PurchaseFoodBean> purchaseFood = mPresenter.getPurchaseFood(); List<PurchaseFoodBean> purchaseFood = mPresenter.getPurchaseFood();
SupplyShoppingCart.getInstance().addAllFood(mPresenter.getPurchaseFood()); SupplyShoppingCart.getInstance().addAllFood(mPresenter.getPurchaseFood());
if (CollectionUtils.isNotNullOrEmpty(purchaseFood)) { if (CollectionUtils.isNotNullOrEmpty(purchaseFood)) {
startForResult(ShoppingCatFragment.newInstance(), TO_SHOPPING_CART_REQUESTCODE); startForResult(ShoppingCatFragment.newInstance(), TO_SHOPPING_CART_REQUEST_CODE);
} else { } else {
showMessage("請選擇食材"); showMessage("請選擇食材");
} }
...@@ -505,7 +523,8 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -505,7 +523,8 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
if (CollectionUtils.isNotNullOrEmpty(foodCategoryTrees)) { if (CollectionUtils.isNotNullOrEmpty(foodCategoryTrees)) {
fullRegister.showSuccess(); fullRegister.showSuccess();
if (firstLevelCategoryAdapter == null) { if (firstLevelCategoryAdapter == null) {
firstLevelCategoryAdapter = new FirstLevelCategoryAdapter(foodCategoryTrees, requireContext()); firstLevelCategoryAdapter = new FirstLevelCategoryAdapter(foodCategoryTrees, requireContext())
.setIsShowNumber(pageType == ADD_ORDER);
rvFirstCategory.setAdapter(firstLevelCategoryAdapter); rvFirstCategory.setAdapter(firstLevelCategoryAdapter);
firstLevelCategoryAdapter.setOnItemClickListener((adapter, view, position) -> { firstLevelCategoryAdapter.setOnItemClickListener((adapter, view, position) -> {
firstCategoryClick(position); firstCategoryClick(position);
...@@ -517,7 +536,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -517,7 +536,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
//默認選中第0個分類 //默認選中第0個分類
firstCategoryClick(0); firstCategoryClick(0);
} else { } else {
fullRegister.showCallback(EmptyCallback.class); fullRegister.showCallback(NotGoodsCallback.class);
} }
} }
...@@ -625,10 +644,10 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -625,10 +644,10 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
} else { } else {
secondCategoryAdapter.setNewInstance(foodCategoryTrees); secondCategoryAdapter.setNewInstance(foodCategoryTrees);
} }
Log.e("eee", "二級分類加載完成" + foodCategoryTrees.size()); // Log.e("eee", "二級分類加載完成" + foodCategoryTrees.size());
//默認選中第0個 //默認選中第0個
// secondCategorySelect(0, foodCategoryTrees != null && foodCategoryTrees.size() > 0); // secondCategorySelect(0, foodCategoryTrees != null && foodCategoryTrees.size() > 0);
layoutCategory.setVisibility(View.VISIBLE); setSecondCategoryShowState(View.VISIBLE);
} }
/** /**
...@@ -637,10 +656,17 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -637,10 +656,17 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
@Override @Override
public void loadFood(List<BuyIngredientsBean> buyIngredientsBeans, boolean addToHead, boolean isReset) { public void loadFood(List<BuyIngredientsBean> buyIngredientsBeans, boolean addToHead, boolean isReset) {
setRefreshState(false); setRefreshState(false);
if (pageType == GET_FOOD_BY_SUPPLIER) {
if (buyIngredientsBeans == null || CollectionUtils.isNullOrEmpty(buyIngredientsBeans.get(0).purchaseFoodList)) {
//如果是單個供應商,需要判斷食材是不是為空
fullRegister.showCallback(NotGoodsCallback.class);
return;
}
}
if (adapter == null) { if (adapter == null) {
adapter = new BuyIngredientsAdapter(requireContext(), buyIngredientsBeans); adapter = new BuyIngredientsAdapter(requireContext(), buyIngredientsBeans, pageType);
rvFoodIngredients.setAdapter(adapter); rvFoodIngredients.setAdapter(adapter);
adapter.setOnChildClickListener((a, holder, groupPosition, childPosition) -> { adapter.setOnItemClickListener((a, holder, groupPosition, childPosition) -> {
BuyIngredientsBean buyIngredientsBean = adapter.getData().get(groupPosition); BuyIngredientsBean buyIngredientsBean = adapter.getData().get(groupPosition);
PurchaseFoodBean purchaseFoodBean = buyIngredientsBean.purchaseFoodList.get(childPosition); PurchaseFoodBean purchaseFoodBean = buyIngredientsBean.purchaseFoodList.get(childPosition);
//显示弹窗 //显示弹窗
...@@ -652,9 +678,30 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -652,9 +678,30 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
foodNumberChanger(purchaseFoodBean, groupPosition, beforeNum, currentNum); foodNumberChanger(purchaseFoodBean, groupPosition, beforeNum, currentNum);
//需要刷新列表 //需要刷新列表
adapter.notifyChildChanged(groupPosition, childPosition); adapter.notifyChildChanged(groupPosition, childPosition);
})) }).setEditNumber(pageType != FOOD_INGREDIENTS))
.show(); .show();
}); });
adapter.setOnItemChildClickListener((a, view, groupPosition, position) -> {
if (groupPosition < adapter.getData().size()) {
if (position < adapter.getData().get(groupPosition).purchaseFoodList.size()) {
PurchaseFoodBean purchaseFoodBean = adapter.getData().get(groupPosition).purchaseFoodList.get(position);
if (view.getId() == R.id.iv_commodity_edit) {
//編輯
startForResult(NewFoodIngredientsFragment.newInstance(purchaseFoodBean), EDIT_FOOD_REQUEST_CODE);
} else if (view.getId() == R.id.iv_commodity_delete) {
//刪除食材
new AppDialog().showWaringDialog(mContext, "是否確認刪除" + purchaseFoodBean.getName(), (view1, dialog) -> {
if (!isShowSupplier) {
purchaseFoodBean.setFoodCategoryName(getCurrentCategoryName());
}
mPresenter.deleteFood(purchaseFoodBean.getId(), isShowSupplier ? -1 : firstLevelCategoryAdapter.getSelectedIndex(), groupPosition, position);
});
}
return;
}
}
showMessage(getString(R.string.str_data_info));
});
adapter.setAnimationWithDefault(BaseQuickAdapter.AnimationType.AlphaIn); adapter.setAnimationWithDefault(BaseQuickAdapter.AnimationType.AlphaIn);
adapter.setOnFoodNumberChangeListener((purchaseFoodBean, parentCategoryIndex, categoryIndex, beforeNum, currentNum) -> foodNumberChanger(purchaseFoodBean, parentCategoryIndex, beforeNum, currentNum)); adapter.setOnFoodNumberChangeListener((purchaseFoodBean, parentCategoryIndex, categoryIndex, beforeNum, currentNum) -> foodNumberChanger(purchaseFoodBean, parentCategoryIndex, beforeNum, currentNum));
rvFoodIngredients.removeOnScrollListener(mFoodScrollListener); rvFoodIngredients.removeOnScrollListener(mFoodScrollListener);
...@@ -715,12 +762,23 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -715,12 +762,23 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
setTvShoppingCartNum(shoppingCartNum); setTvShoppingCartNum(shoppingCartNum);
} }
private void setTvShoppingCartNum(int num) { private void setSecondCategoryShowState(int visibility) {
tvShoppingCart.setText(String.valueOf(shoppingCartNum)); if (pageType != GET_FOOD_BY_SUPPLIER) {
if (num > 0) { layoutCategory.setVisibility(visibility);
tvShoppingCart.setVisibility(View.VISIBLE);
} else { } else {
tvShoppingCart.setVisibility(View.GONE); layoutCategory.setVisibility(View.GONE);
}
}
private void setTvShoppingCartNum(int num) {
//食材管理頁面,這個tvShoppingCart為空
if (tvShoppingCart != null) {
tvShoppingCart.setText(String.valueOf(shoppingCartNum));
if (num > 0) {
tvShoppingCart.setVisibility(View.VISIBLE);
} else {
tvShoppingCart.setVisibility(View.GONE);
}
} }
} }
...@@ -752,21 +810,27 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -752,21 +810,27 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
@Override @Override
public void onFragmentResult(int requestCode, int resultCode, Bundle data) { public void onFragmentResult(int requestCode, int resultCode, Bundle data) {
super.onFragmentResult(requestCode, resultCode, data); super.onFragmentResult(requestCode, resultCode, data);
if (requestCode == TO_SHOPPING_CART_REQUESTCODE && resultCode == RESULT_OK) { if (requestCode == TO_SHOPPING_CART_REQUEST_CODE && resultCode == RESULT_OK) {
//之前去到購物車頁面,現在回到這個頁面 refreshAllData();
//購物車食材數量發生了變化,需要刷新當前頁面的食材數量 } else if (requestCode == EDIT_FOOD_REQUEST_CODE && resultCode == EDIT_FOOD_RESULT_CODE) {
mPresenter.tranShoppingCartToCache(); refreshAllData();
//如果修改了供應商和分類信息,可以清除掉緩存再獲取,就能刷新頁面 }
mPresenter.clearShowFoods(); }
mPresenter.clearCategoryFoods();
mPresenter.clearSupplierFoods(); private void refreshAllData() {
mPresenter.clearSupplierCache(); //之前去到購物車頁面,現在回到這個頁面
mPresenter.clearCategoryTreesCache(); //購物車食材數量發生了變化,需要刷新當前頁面的食材數量
if (isShowSupplier) { mPresenter.tranShoppingCartToCache();
mPresenter.loadFoodIngredientsData(-1, true); //如果修改了供應商和分類信息,可以清除掉緩存再獲取,就能刷新頁面
} else { mPresenter.clearShowFoods();
mPresenter.getCategoryTrees(); mPresenter.clearCategoryFoods();
} mPresenter.clearSupplierFoods();
mPresenter.clearSupplierCache();
mPresenter.clearCategoryTreesCache();
if (isShowSupplier) {
mPresenter.loadFoodIngredientsData(-1, true);
} else {
mPresenter.getCategoryTrees();
} }
} }
} }
...@@ -363,7 +363,9 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi ...@@ -363,7 +363,9 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi
} }
if (listSelectAdapter == null) { if (listSelectAdapter == null) {
listSelectAdapter = new LeftCategoryAdapter(categoryBeans); listSelectAdapter = new LeftCategoryAdapter(categoryBeans);
listSelectAdapter.setUnSelectColor(ContextCompat.getColor(mContext, R.color.color_3c)) listSelectAdapter.setSelectedBg(R.drawable.shape_left_radio_shadow)
.setUnSelectedBg(R.color.trans)
.setUnSelectColor(ContextCompat.getColor(mContext, R.color.color_3c))
.setSelectColor(ContextCompat.getColor(mContext, R.color.theme_color)); .setSelectColor(ContextCompat.getColor(mContext, R.color.theme_color));
listSelectAdapter.setOnItemClickListener((adapter, view, position) -> { listSelectAdapter.setOnItemClickListener((adapter, view, position) -> {
listSelectAdapter.setSelectedIndex(position); listSelectAdapter.setSelectedIndex(position);
......
...@@ -31,6 +31,7 @@ import com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean; ...@@ -31,6 +31,7 @@ import com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean;
import com.gingersoft.supply_chain.mvp.contract.NewFoodIngredientsContract; import com.gingersoft.supply_chain.mvp.contract.NewFoodIngredientsContract;
import com.gingersoft.supply_chain.mvp.presenter.NewFoodIngredientsPresenter; import com.gingersoft.supply_chain.mvp.presenter.NewFoodIngredientsPresenter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.category.CategoryFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.category.CategorySelectFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.category.CategorySelectFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.supplier.SupplierListFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.supplier.SupplierListFragment;
import com.gingersoft.supply_chain.mvp.utils.SelectPicture; import com.gingersoft.supply_chain.mvp.utils.SelectPicture;
...@@ -48,6 +49,7 @@ import butterknife.BindView; ...@@ -48,6 +49,7 @@ import butterknife.BindView;
import butterknife.OnClick; import butterknife.OnClick;
import static com.gingersoft.gsa.cloud.ui.recylcler.decorator.DividerItemDecoration.VERTICAL_LIST; import static com.gingersoft.gsa.cloud.ui.recylcler.decorator.DividerItemDecoration.VERTICAL_LIST;
import static com.gingersoft.supply_chain.mvp.ui.fragment.category.CategoryFragment.SELECT_CATEGORY;
import static com.gingersoft.supply_chain.mvp.ui.fragment.category.CategorySelectFragment.SELECT_CATEGORY_DATA_KEY; import static com.gingersoft.supply_chain.mvp.ui.fragment.category.CategorySelectFragment.SELECT_CATEGORY_DATA_KEY;
import static com.gingersoft.supply_chain.mvp.ui.fragment.category.CategorySelectFragment.SELECT_FOOD_CATEGORY_REQUEST_CODE; import static com.gingersoft.supply_chain.mvp.ui.fragment.category.CategorySelectFragment.SELECT_FOOD_CATEGORY_REQUEST_CODE;
import static com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodUnitPageFragment.BASIC_UNIT_KEY; import static com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodUnitPageFragment.BASIC_UNIT_KEY;
...@@ -180,7 +182,7 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI ...@@ -180,7 +182,7 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI
startForResult(SupplierListFragment.newInstance(true, multiBean.getShowValue()), multiBean.getRequestCode()); startForResult(SupplierListFragment.newInstance(true, multiBean.getShowValue()), multiBean.getRequestCode());
} else if (infoMultiBean.getFragment() == CategorySelectFragment.class) { } else if (infoMultiBean.getFragment() == CategorySelectFragment.class) {
//選擇分類 //選擇分類
startForResult(CategorySelectFragment.newInstance(mPresenter.getCategoryName()), multiBean.getRequestCode()); startForResult(CategoryFragment.newInstance(mPresenter.getCategoryName(), SELECT_CATEGORY), multiBean.getRequestCode());
} else if (infoMultiBean.getFragment() == FoodUnitPageFragment.class) { } else if (infoMultiBean.getFragment() == FoodUnitPageFragment.class) {
//食品單位 //食品單位
startForResult(FoodUnitPageFragment.newInstance(mPresenter.getBasicUnit(data), mPresenter.getDeputyUnitBeans(), isUpdate, mPresenter.getFoodId()), multiBean.getRequestCode()); startForResult(FoodUnitPageFragment.newInstance(mPresenter.getBasicUnit(data), mPresenter.getDeputyUnitBeans(), isUpdate, mPresenter.getFoodId()), multiBean.getRequestCode());
......
...@@ -60,6 +60,7 @@ import com.gingersoft.supply_chain.mvp.utils.ViewUtils; ...@@ -60,6 +60,7 @@ import com.gingersoft.supply_chain.mvp.utils.ViewUtils;
import com.google.android.material.checkbox.MaterialCheckBox; import com.google.android.material.checkbox.MaterialCheckBox;
import com.google.android.material.textfield.TextInputLayout; import com.google.android.material.textfield.TextInputLayout;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.jess.arms.http.imageloader.ImageLoader;
import com.lxj.xpopup.XPopup; import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.enums.PopupPosition; import com.lxj.xpopup.enums.PopupPosition;
import com.lxj.xpopup.interfaces.OnSelectListener; import com.lxj.xpopup.interfaces.OnSelectListener;
...@@ -229,10 +230,18 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr ...@@ -229,10 +230,18 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
* @param state 狀態,全部收貨還是部分收貨 * @param state 狀態,全部收貨還是部分收貨
*/ */
private void addWarehouse(int state) { private void addWarehouse(int state) {
AppDialog.getInstance().showTipDialog(requireContext(), "是否確認收貨?", (view, dialog) -> { for (PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean data : orderDetailsFoodAdapter.getData()) {
mPresenter.addWarehouse(state, edRemark.getText() + "", totalAmount, orderDetailsFoodAdapter.getData()); //只要有一個是選中的,就不循環了,開始收貨
setFragmentResult(RESULT_OK, null); if (data.isChecked()) {
}); AppDialog.getInstance().showTipDialog(requireContext(), getString(R.string.str_confirm_receipt), (view, dialog) -> {
mPresenter.addWarehouse(state, edRemark.getText() + "", totalAmount, orderDetailsFoodAdapter.getData());
setFragmentResult(RESULT_OK, null);
});
return;
}
}
//循環完了,沒有一個選中的,提示用戶
showMessage(getString(R.string.str_select_least_one_product));
} }
private OnSelectListener mOnSelectListener = (position, text) -> { private OnSelectListener mOnSelectListener = (position, text) -> {
......
...@@ -28,6 +28,7 @@ import com.gingersoft.supply_chain.mvp.contract.SupplierListContract; ...@@ -28,6 +28,7 @@ import com.gingersoft.supply_chain.mvp.contract.SupplierListContract;
import com.gingersoft.supply_chain.mvp.presenter.SupplierListPresenter; import com.gingersoft.supply_chain.mvp.presenter.SupplierListPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.SupplierAdapter; import com.gingersoft.supply_chain.mvp.ui.adapter.SupplierAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.BuyIngredientsFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodIngredientsFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodIngredientsFragment;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.kingja.loadsir.callback.Callback; import com.kingja.loadsir.callback.Callback;
...@@ -243,7 +244,7 @@ public class SupplierListFragment extends BaseSupplyChainFragment<SupplierListPr ...@@ -243,7 +244,7 @@ public class SupplierListFragment extends BaseSupplyChainFragment<SupplierListPr
} else if (view.getId() == R.id.layout_see_ingredients) { } else if (view.getId() == R.id.layout_see_ingredients) {
//跳轉到供應商食品詳情 //跳轉到供應商食品詳情
List<SupplierInfoBean> data = supplierAdapter.getData(); List<SupplierInfoBean> data = supplierAdapter.getData();
start(FoodIngredientsFragment.newInstance(data.get(position).getId(), data.get(position).getSupplierName())); start(BuyIngredientsFragment.newInstance(data.get(position).getId(), data.get(position).getSupplierName()));
} }
}); });
} else { } else {
......
package com.gingersoft.supply_chain.mvp.ui.widget; package com.gingersoft.supply_chain.mvp.ui.widget;
import android.content.Context; import android.content.Context;
import android.util.Log;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
...@@ -20,10 +19,8 @@ import com.gingersoft.gsa.cloud.ui.view.imageview.mask.PorterShapeImageView; ...@@ -20,10 +19,8 @@ import com.gingersoft.gsa.cloud.ui.view.imageview.mask.PorterShapeImageView;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2; import com.gingersoft.supply_chain.R2;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean; import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import com.gingersoft.supply_chain.mvp.content.Constant; import com.gingersoft.supply_chain.mvp.content.PurchaseConstant;
import com.gingersoft.supply_chain.mvp.ui.adapter.BuyIngredientsAdapter; import com.gingersoft.supply_chain.mvp.ui.adapter.BuyIngredientsAdapter;
import com.google.android.material.textfield.TextInputEditText;
import com.lxj.xpopup.core.BasePopupView;
import com.lxj.xpopup.core.CenterPopupView; import com.lxj.xpopup.core.CenterPopupView;
import com.lxj.xpopup.util.KeyboardUtils; import com.lxj.xpopup.util.KeyboardUtils;
import com.qmuiteam.qmui.layout.QMUIButton; import com.qmuiteam.qmui.layout.QMUIButton;
...@@ -68,6 +65,10 @@ public class GoodsDetailsPopup extends CenterPopupView { ...@@ -68,6 +65,10 @@ public class GoodsDetailsPopup extends CenterPopupView {
ImageView ivPopupClose; ImageView ivPopupClose;
private PurchaseFoodBean purchaseFoodBean; private PurchaseFoodBean purchaseFoodBean;
private BuyIngredientsAdapter.OnFoodNumberChangeListener onFoodNumberChangeListener; private BuyIngredientsAdapter.OnFoodNumberChangeListener onFoodNumberChangeListener;
/**
* 是否可以編輯數量
*/
private boolean isEditNumber;
public GoodsDetailsPopup(@NonNull Context context, PurchaseFoodBean purchaseFoodBean) { public GoodsDetailsPopup(@NonNull Context context, PurchaseFoodBean purchaseFoodBean) {
super(context); super(context);
...@@ -102,9 +103,13 @@ public class GoodsDetailsPopup extends CenterPopupView { ...@@ -102,9 +103,13 @@ public class GoodsDetailsPopup extends CenterPopupView {
} else { } else {
tvGoodsSpecification.setText(purchaseFoodBean.getBasicUnitName()); tvGoodsSpecification.setText(purchaseFoodBean.getBasicUnitName());
} }
edFoodIngredientNumber.setText(purchaseFoodBean.getFoodQuantity() + ""); ivPopupClose.setOnClickListener(this::onClick);
KeyboardUtils.hideSoftInput(this);
if (!isEditNumber) {
layoutOperationFoodNum.setVisibility(GONE);
return;
}
edFoodIngredientNumber.setText(purchaseFoodBean.getFoodQuantity() + "");
btnFoodOperationSub.setOnClickListener(v -> { btnFoodOperationSub.setOnClickListener(v -> {
//减 //减
if (purchaseFoodBean.getFoodQuantity() > 0) { if (purchaseFoodBean.getFoodQuantity() > 0) {
...@@ -127,12 +132,15 @@ public class GoodsDetailsPopup extends CenterPopupView { ...@@ -127,12 +132,15 @@ public class GoodsDetailsPopup extends CenterPopupView {
btnFoodOperationAdd.setOnClickListener(v -> { btnFoodOperationAdd.setOnClickListener(v -> {
//加 //加
if (purchaseFoodBean.getFoodQuantity() < Constant.PURCHASE_FOOD_MAX) { if (purchaseFoodBean.getFoodQuantity() < PurchaseConstant.PURCHASE_FOOD_MAX) {
foodNumberChange(1); foodNumberChange(1);
} }
}); });
ivPopupClose.setOnClickListener(this::onClick); }
KeyboardUtils.hideSoftInput(this);
public GoodsDetailsPopup setEditNumber(boolean editNumber) {
isEditNumber = editNumber;
return this;
} }
/** /**
...@@ -147,7 +155,7 @@ public class GoodsDetailsPopup extends CenterPopupView { ...@@ -147,7 +155,7 @@ public class GoodsDetailsPopup extends CenterPopupView {
return false; return false;
}; };
private int delayTime = Constant.LONG_CLICK_INIT_TIME; private int delayTime = PurchaseConstant.LONG_CLICK_INIT_TIME;
private boolean longClick = false; private boolean longClick = false;
/** /**
...@@ -159,16 +167,16 @@ public class GoodsDetailsPopup extends CenterPopupView { ...@@ -159,16 +167,16 @@ public class GoodsDetailsPopup extends CenterPopupView {
//開啟線程 //開啟線程
ThreadPoolManager.getInstence().putExecutableTasks(() -> { ThreadPoolManager.getInstence().putExecutableTasks(() -> {
int number = purchaseFoodBean.getFoodQuantity(); int number = purchaseFoodBean.getFoodQuantity();
delayTime = Constant.LONG_CLICK_INIT_TIME; delayTime = PurchaseConstant.LONG_CLICK_INIT_TIME;
if (addOrSub) { if (addOrSub) {
//+ //+
while (longClick) { while (longClick) {
if (number < Constant.PURCHASE_FOOD_MAX) { if (number < PurchaseConstant.PURCHASE_FOOD_MAX) {
try { try {
Thread.sleep(delayTime); Thread.sleep(delayTime);
number++; number++;
if (delayTime > Constant.LONG_CLICK_DECREASE_TIME) { if (delayTime > PurchaseConstant.LONG_CLICK_DECREASE_TIME) {
delayTime -= Constant.LONG_CLICK_DECREASE_TIME; delayTime -= PurchaseConstant.LONG_CLICK_DECREASE_TIME;
} }
edFoodIngredientNumber.post(() -> foodNumberChange(1)); edFoodIngredientNumber.post(() -> foodNumberChange(1));
} catch (InterruptedException e) { } catch (InterruptedException e) {
...@@ -185,8 +193,8 @@ public class GoodsDetailsPopup extends CenterPopupView { ...@@ -185,8 +193,8 @@ public class GoodsDetailsPopup extends CenterPopupView {
try { try {
Thread.sleep(delayTime); Thread.sleep(delayTime);
number--; number--;
if (delayTime > Constant.LONG_CLICK_DECREASE_TIME) { if (delayTime > PurchaseConstant.LONG_CLICK_DECREASE_TIME) {
delayTime -= Constant.LONG_CLICK_DECREASE_TIME; delayTime -= PurchaseConstant.LONG_CLICK_DECREASE_TIME;
} }
edFoodIngredientNumber.post(() -> foodNumberChange(-1)); edFoodIngredientNumber.post(() -> foodNumberChange(-1));
} catch (InterruptedException e) { } catch (InterruptedException e) {
......
package com.gingersoft.supply_chain.mvp.utils;
import android.app.Activity;
import android.os.Build;
import android.util.Log;
import android.view.View;
import android.view.ViewTreeObserver;
/**
* simple and powerful Keyboard show/hidden listener,view {@android.R.id.content} and {@ViewTreeObserver.OnGlobalLayoutListener}
* Created by yes.cpu@gmail.com 2016/7/13.
*/
public class KeyboardChangeListener implements ViewTreeObserver.OnGlobalLayoutListener {
private static final String TAG = "ListenerHandler";
private View mContentView;
private int mOriginHeight;
private int mPreHeight;
private KeyBoardListener mKeyBoardListen;
public interface KeyBoardListener {
/**
* call back
* @param isShow true is show else hidden
* @param keyboardHeight keyboard height
*/
void onKeyboardChange(boolean isShow, int keyboardHeight);
}
public void setKeyBoardListener(KeyBoardListener keyBoardListen) {
this.mKeyBoardListen = keyBoardListen;
}
public KeyboardChangeListener(Activity contextObj) {
if (contextObj == null) {
Log.i(TAG, "contextObj is null");
return;
}
mContentView = findContentView(contextObj);
if (mContentView != null) {
addContentTreeObserver();
}
}
private View findContentView(Activity contextObj) {
return contextObj.findViewById(android.R.id.content);
}
private void addContentTreeObserver() {
mContentView.getViewTreeObserver().addOnGlobalLayoutListener(this);
}
@Override
public void onGlobalLayout() {
int currHeight = mContentView.getHeight();
if (currHeight == 0) {
Log.i(TAG, "currHeight is 0");
return;
}
boolean hasChange = false;
if (mPreHeight == 0) {
mPreHeight = currHeight;
mOriginHeight = currHeight;
} else {
if (mPreHeight != currHeight) {
hasChange = true;
mPreHeight = currHeight;
} else {
hasChange = false;
}
}
if (hasChange) {
boolean isShow;
int keyboardHeight = 0;
if (mOriginHeight == currHeight) {
//hidden
isShow = false;
} else {
//show
keyboardHeight = mOriginHeight - currHeight;
isShow = true;
}
if (mKeyBoardListen != null) {
mKeyBoardListen.onKeyboardChange(isShow, keyboardHeight);
}
}
}
public void destroy() {
if (mContentView != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
mContentView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
}
}
}
...@@ -121,7 +121,6 @@ public class SelectPicture { ...@@ -121,7 +121,6 @@ public class SelectPicture {
if (takePictureIntent.resolveActivity(activity.getPackageManager()) != null) { if (takePictureIntent.resolveActivity(activity.getPackageManager()) != null) {
File photoFile; File photoFile;
photoFile = createImageFile(activity); photoFile = createImageFile(activity);
// currentPhotoPath = image.getAbsolutePath();
mCameraUri = Uri.fromFile(photoFile); mCameraUri = Uri.fromFile(photoFile);
try { try {
Uri photoUri = FileProvider.getUriForFile(activity, Uri photoUri = FileProvider.getUriForFile(activity,
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
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">
android:background="@drawable/shape_dialog_bg"
android:orientation="vertical">
<FrameLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:layout_marginBottom="@dimen/dp_10"
android:background="@drawable/shape_dialog_bg"
android:orientation="vertical">
<TextView <FrameLayout
android:id="@+id/tv_title" android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:orientation="horizontal">
android:layout_marginTop="@dimen/dp_15"
android:layout_marginBottom="@dimen/dp_15"
android:text="新增類別"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_17"
android:textStyle="bold" />
<ImageView <TextView
android:id="@+id/iv_create_category_close" android:id="@+id/tv_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical" android:layout_gravity="center"
android:layout_marginRight="@dimen/dp_10" android:layout_marginTop="@dimen/dp_15"
android:src="@drawable/icon_popup_close_dark" android:layout_marginBottom="@dimen/dp_15"
android:visibility="gone" /> android:text="@string/str_new_add_category"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_17"
android:textStyle="bold" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView <ImageView
android:id="@+id/tv_category_delete" android:id="@+id/iv_create_category_close"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical" android:layout_gravity="right|center_vertical"
android:layout_marginRight="@dimen/dp_19" android:layout_marginRight="@dimen/dp_10"
android:text="刪除" android:src="@drawable/icon_popup_close_dark"
android:textColor="@color/required_color" android:visibility="gone" />
android:textSize="@dimen/dp_14" />
</FrameLayout>
<include layout="@layout/include_horizontal_color_eee_dividing_line" /> <com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_category_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:layout_marginRight="@dimen/dp_19"
android:text="刪除"
android:textColor="@color/required_color"
android:textSize="@dimen/dp_14" />
</FrameLayout>
<include layout="@layout/include_horizontal_color_eee_dividing_line" />
<TextView <TextView
android:id="@+id/tv_content" android:id="@+id/tv_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/new_category_dialog_marginLeft" android:layout_marginLeft="@dimen/new_category_dialog_marginLeft"
android:layout_marginTop="@dimen/dp_20" android:layout_marginTop="@dimen/dp_20"
android:text="種類名稱" android:text="種類名稱"
android:textColor="@color/color_3c" android:textColor="@color/color_3c"
android:textSize="@dimen/dp_14" /> android:textSize="@dimen/dp_14" />
<EditText <EditText
android:id="@+id/et_input" android:id="@+id/et_input"
style="@style/Multi_Input_editStyle" style="@style/Multi_Input_editStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dp_40" android:layout_height="@dimen/dp_40"
android:layout_marginTop="@dimen/dp_5" android:layout_marginTop="@dimen/dp_5"
android:layout_marginRight="@dimen/new_category_dialog_marginLeft" android:layout_marginRight="@dimen/new_category_dialog_marginLeft"
android:inputType="text|textCapWords" android:background="@null"
android:background="@null" android:gravity="left|center_vertical"
android:gravity="left|center_vertical" android:hint="請輸入類別名稱"
android:hint="請輸入類別名稱" android:inputType="text|textCapWords"
android:maxLength="4" android:maxLength="4"
android:paddingLeft="@dimen/new_category_dialog_marginLeft" android:paddingLeft="@dimen/new_category_dialog_marginLeft"
android:paddingRight="@dimen/new_category_dialog_marginLeft" android:paddingRight="@dimen/new_category_dialog_marginLeft"
android:textColor="@color/color_3c" android:textColor="@color/color_3c"
android:textColorHint="@color/color_c9" android:textColorHint="@color/color_c9"
android:textSize="@dimen/dp_16" /> android:textSize="@dimen/dp_16" />
<include layout="@layout/include_horizontal_color_eee_dividing_line" /> <include layout="@layout/include_horizontal_color_eee_dividing_line" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_20"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_20"
android:orientation="horizontal">
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_confirm"
style="@style/Save_Btn_Style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_7"
android:layout_marginRight="@dimen/new_category_dialog_marginLeft"
android:layout_weight="1"
android:paddingTop="@dimen/dp_13"
android:paddingBottom="@dimen/dp_13"
android:text="保存" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView <com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_confirm" android:id="@+id/tv_cancel"
style="@style/Save_Btn_Style" style="@style/Cancel_Btn_Style"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_7" android:layout_marginLeft="@dimen/new_category_dialog_marginLeft"
android:layout_marginRight="@dimen/new_category_dialog_marginLeft" android:layout_marginRight="@dimen/dp_7"
android:layout_weight="1" android:layout_weight="1"
android:paddingTop="@dimen/dp_13" android:background="@drawable/shape_3c_cancel_btn_bg"
android:paddingBottom="@dimen/dp_13" android:paddingTop="@dimen/dp_13"
android:text="保存" /> android:paddingBottom="@dimen/dp_13"
android:text="取消" />
</LinearLayout>
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_cancel"
style="@style/Cancel_Btn_Style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/new_category_dialog_marginLeft"
android:layout_marginRight="@dimen/dp_7"
android:layout_weight="1"
android:background="@drawable/shape_3c_cancel_btn_bg"
android:paddingTop="@dimen/dp_13"
android:paddingBottom="@dimen/dp_13"
android:text="取消" />
</LinearLayout> </LinearLayout>
</FrameLayout>
</LinearLayout>
\ No newline at end of file
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/supply_chain_bg_color" android:background="@color/supply_chain_bg_color"
android:animateLayoutChanges="true"
android:orientation="vertical"> android:orientation="vertical">
<com.qmuiteam.qmui.widget.QMUITopBar <com.qmuiteam.qmui.widget.QMUITopBar
...@@ -114,52 +115,36 @@ ...@@ -114,52 +115,36 @@
android:layout_weight="4" android:layout_weight="4"
android:orientation="vertical"> android:orientation="vertical">
<!-- 二級分類 --> <!-- 二級分類 -->
<com.google.android.material.appbar.CollapsingToolbarLayout <com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/layout_category" android:id="@+id/layout_category"
android:background="@color/white" android:layout_width="match_parent"
android:layout_height="@dimen/dp_40"
android:visibility="gone"
android:background="@color/white">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_food_ingredients_second_category"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dp_40"> android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_40" />
<androidx.cardview.widget.CardView
android:id="@+id/card_show_more_category"
android:layout_width="@dimen/dp_40"
android:layout_height="match_parent"
android:layout_gravity="right"
android:background="@color/white"
app:cardElevation="@dimen/dp_10">
<androidx.recyclerview.widget.RecyclerView <ImageView
android:id="@+id/rv_food_ingredients_second_category" android:id="@+id/iv_unfold_arrow"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_58" /> android:src="@drawable/ic_inverted_triangle_66" />
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView </com.google.android.material.appbar.CollapsingToolbarLayout>
android:id="@+id/card_show_more_category"
android:layout_width="@dimen/dp_58"
android:layout_height="match_parent"
android:layout_gravity="right"
android:background="@color/white"
app:cardElevation="@dimen/dp_10">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_unfold_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_inverted_triangle_66" />
<TextView
android:id="@+id/tv_unfold_category"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_3"
android:text="展開"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_12" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</com.google.android.material.appbar.CollapsingToolbarLayout>
<!-- 食材 --> <!-- 食材 -->
<com.scwang.smartrefresh.layout.SmartRefreshLayout <com.scwang.smartrefresh.layout.SmartRefreshLayout
......
...@@ -61,6 +61,7 @@ ...@@ -61,6 +61,7 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/layout_category_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
...@@ -95,7 +96,8 @@ ...@@ -95,7 +96,8 @@
</LinearLayout> </LinearLayout>
<LinearLayout <RelativeLayout
android:id="@+id/layout_category_right"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="4" android:layout_weight="4"
...@@ -112,13 +114,14 @@ ...@@ -112,13 +114,14 @@
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="@dimen/dp_14" android:textSize="@dimen/dp_14"
android:visibility="gone" android:visibility="gone"
app:layout_constraintTop_toTopOf="parent"
tools:text="水果類" /> tools:text="水果類" />
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView
android:id="@+id/card_second_category" android:id="@+id/card_second_category"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="@dimen/dp_70" android:minHeight="@dimen/dp_100"
app:cardCornerRadius="@dimen/dp_0" app:cardCornerRadius="@dimen/dp_0"
app:cardElevation="@dimen/dp_5"> app:cardElevation="@dimen/dp_5">
...@@ -135,27 +138,32 @@ ...@@ -135,27 +138,32 @@
style="@style/Second_Category_Style" style="@style/Second_Category_Style"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone"
android:layout_marginLeft="@dimen/dp_15" android:layout_marginLeft="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_8" android:layout_marginTop="@dimen/dp_8"
android:background="@drawable/shape_border_white_bg" android:background="@drawable/shape_border_white_bg"
android:gravity="center" android:gravity="center"
android:text="@string/str_add_subtype" android:text="@string/str_add_subtype"
android:textColor="@color/theme_color" /> android:textColor="@color/theme_color"
android:visibility="gone" />
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>
<FrameLayout <FrameLayout
android:id="@+id/layout_third_category"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_above="@id/layout_select_category_btn"
android:layout_below="@id/card_second_category"
android:layout_marginTop="@dimen/dp_7" android:layout_marginTop="@dimen/dp_7"
android:layout_marginRight="@dimen/dp_4"> android:layout_marginRight="@dimen/dp_4"
android:paddingBottom="@dimen/dp_10"
android:background="@color/white"
android:minHeight="@dimen/dp_100">
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_third_category" android:id="@+id/rv_third_category"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:background="@color/white"
android:paddingLeft="@dimen/dp_4" android:paddingLeft="@dimen/dp_4"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" /> app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
...@@ -166,13 +174,47 @@ ...@@ -166,13 +174,47 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_13" android:layout_marginLeft="@dimen/dp_13"
android:layout_marginTop="@dimen/dp_8" android:layout_marginTop="@dimen/dp_8"
android:visibility="gone"
android:background="@drawable/shape_color_da_stoke_fifteen_corners" android:background="@drawable/shape_color_da_stoke_fifteen_corners"
android:gravity="center" android:gravity="center"
android:text="@string/str_add_subtype" android:text="@string/str_add_subtype"
android:textColor="@color/theme_color" /> android:textColor="@color/theme_color"
android:visibility="gone" />
</FrameLayout> </FrameLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/layout_select_category_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal">
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id="@+id/btn_food_ingredients_confirm"
style="@style/Save_Btn_Style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginBottom="@dimen/dp_5"
android:layout_weight="1"
android:text="確定"
android:visibility="visible" />
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id="@+id/btn_food_ingredients_cancel"
style="@style/Cancel_Btn_Style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_5"
android:layout_marginBottom="@dimen/dp_5"
android:layout_weight="1"
android:text="取消"
android:visibility="visible" />
</LinearLayout>
</RelativeLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
......
...@@ -114,6 +114,24 @@ ...@@ -114,6 +114,24 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView
android:id="@+id/iv_commodity_edit"
android:layout_width="@dimen/dp_26"
android:layout_height="@dimen/dp_26"
android:src="@drawable/ic_blue_edit"
android:padding="@dimen/dp_3"
android:visibility="gone" />
<ImageView
android:id="@+id/iv_commodity_delete"
android:layout_width="@dimen/dp_26"
android:layout_height="@dimen/dp_26"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_5"
android:src="@drawable/ic_red_delete"
android:padding="@dimen/dp_3"
android:visibility="gone" />
<com.qmuiteam.qmui.layout.QMUIButton <com.qmuiteam.qmui.layout.QMUIButton
android:id="@+id/btn_food_operation_sub" android:id="@+id/btn_food_operation_sub"
android:layout_width="@dimen/dp_24" android:layout_width="@dimen/dp_24"
......
...@@ -126,12 +126,31 @@ ...@@ -126,12 +126,31 @@
<!-- android:divider="@color/color_3c"--> <!-- android:divider="@color/color_3c"-->
<!-- android:gravity="center_vertical"--> <!-- android:gravity="center_vertical"-->
<!-- android:orientation="horizontal">--> <!-- android:orientation="horizontal">-->
<ImageView
android:id="@+id/iv_commodity_edit"
android:layout_width="@dimen/dp_26"
android:layout_height="@dimen/dp_26"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_5"
android:src="@drawable/ic_blue_edit"
android:padding="@dimen/dp_3"
android:visibility="gone" />
<ImageView
android:id="@+id/iv_commodity_delete"
android:layout_width="@dimen/dp_26"
android:layout_height="@dimen/dp_26"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_5"
android:padding="@dimen/dp_3"
android:src="@drawable/ic_red_delete"
android:visibility="gone" />
<com.qmuiteam.qmui.layout.QMUIButton <com.qmuiteam.qmui.layout.QMUIButton
android:id="@+id/btn_food_operation_sub" android:id="@+id/btn_food_operation_sub"
android:layout_width="@dimen/dp_24" android:layout_width="@dimen/dp_24"
android:layout_height="@dimen/dp_24" android:layout_height="@dimen/dp_24"
android:layout_marginLeft="@dimen/dp_2" android:layout_marginLeft="@dimen/dp_5"
android:background="@drawable/ic_circle_gray_sub" /> android:background="@drawable/ic_circle_gray_sub" />
<com.google.android.material.textfield.TextInputEditText <com.google.android.material.textfield.TextInputEditText
......
...@@ -52,4 +52,9 @@ ...@@ -52,4 +52,9 @@
<string name="str_amount">金額</string> <string name="str_amount">金額</string>
<string name="str_inventory_reason">消耗原因</string> <string name="str_inventory_reason">消耗原因</string>
<string name="str_only_allowed_input_number">只允許輸入數字</string> <string name="str_only_allowed_input_number">只允許輸入數字</string>
<string name="str_category_manager">類別管理</string>
<string name="str_choice_category">選擇類別</string>
<string name="str_select_least_one_product">至少選擇一個商品</string>
<string name="str_confirm_receipt">是否確認收貨?</string>
</resources> </resources>
\ No newline at end of file
...@@ -4,7 +4,7 @@ apply plugin: 'kotlin-android' ...@@ -4,7 +4,7 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.jakewharton.butterknife' apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'kotlin-kapt' apply plugin: 'kotlin-kapt'
apply plugin: 'android-aspectjx'
android { android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"] compileSdkVersion rootProject.ext.android["compileSdkVersion"]
...@@ -133,7 +133,58 @@ dependencies { ...@@ -133,7 +133,58 @@ dependencies {
api 'com.github.huangyanbin:SmartTable:2.2.0' api 'com.github.huangyanbin:SmartTable:2.2.0'
implementation 'com.lxj:xpopup:2.2.10' implementation 'com.lxj:xpopup:2.2.10'
implementation "androidx.documentfile:documentfile:1.0.1" implementation "androidx.documentfile:documentfile:1.0.1"
implementation 'org.aspectj:aspectjrt:1.8.14'
aspectjx {
exclude 'androidx', 'org.jetbrains.kotlin', "module-info", 'com.google', 'com.squareup', 'org.apache', 'versions.9', 'com.squareup.okio', 'okio', 'leakcanary', 'com.google.firebase', 'com.google.android'
}
} }
repositories { repositories {
mavenCentral() mavenCentral()
} }
import org.aspectj.bridge.IMessage
import org.aspectj.bridge.MessageHandler
import org.aspectj.tools.ajc.Main
final def log = project.logger
android.libraryVariants.all { variant ->
if (!variant.buildType.isDebuggable()) {
log.debug("Skipping non-debuggable build type '${variant.buildType.name}'.")
return
}
JavaCompile javaCompile = variant.javaCompiler
javaCompile.doLast {
String[] args = ["-showWeaveInfo",
"-1.8",
"-inpath", javaCompile.destinationDir.toString(),
"-aspectpath", javaCompile.classpath.asPath,
"-d", javaCompile.destinationDir.toString(),
"-classpath", javaCompile.classpath.asPath,
"-bootclasspath", project.android.bootClasspath.join(File.pathSeparator)]
log.debug "ajc args: " + Arrays.toString(args)
MessageHandler handler = new MessageHandler(true)
new Main().run(args, handler)
for (IMessage message : handler.getMessages(null, true)) {
switch (message.getKind()) {
case IMessage.ABORT:
case IMessage.ERROR:
case IMessage.FAIL:
log.error message.message, message.thrown
break
case IMessage.WARNING:
log.warn message.message, message.thrown
break
case IMessage.INFO:
log.info message.message, message.thrown
break
case IMessage.DEBUG:
log.debug message.message, message.thrown
break
}
}
}
}
...@@ -32,6 +32,8 @@ import com.gingersoft.gsa.cloud.common.loadsir.pos.PosRefundStatusExceptionCallb ...@@ -32,6 +32,8 @@ import com.gingersoft.gsa.cloud.common.loadsir.pos.PosRefundStatusExceptionCallb
import com.gingersoft.gsa.cloud.common.loadsir.pos.PosSettlementStatusExceptionCallback; import com.gingersoft.gsa.cloud.common.loadsir.pos.PosSettlementStatusExceptionCallback;
import com.gingersoft.gsa.cloud.common.loadsir.pos.PosTipsStatusExceptionCallback; import com.gingersoft.gsa.cloud.common.loadsir.pos.PosTipsStatusExceptionCallback;
import com.gingersoft.gsa.cloud.common.loadsir.pos.PosVoidStatusExceptionCallback; import com.gingersoft.gsa.cloud.common.loadsir.pos.PosVoidStatusExceptionCallback;
import com.gingersoft.gsa.cloud.common.loadsir.purchase.EmptyCategoryCallback;
import com.gingersoft.gsa.cloud.common.loadsir.purchase.NotGoodsCallback;
import com.gingersoft.gsa.cloud.common.logan.LoganManager; import com.gingersoft.gsa.cloud.common.logan.LoganManager;
import com.gingersoft.gsa.cloud.common.oaId.DeviceID; import com.gingersoft.gsa.cloud.common.oaId.DeviceID;
import com.gingersoft.gsa.cloud.common.printer.AidlUtil; import com.gingersoft.gsa.cloud.common.printer.AidlUtil;
...@@ -270,6 +272,8 @@ public class GsaCloudApplication extends BaseApplication { ...@@ -270,6 +272,8 @@ public class GsaCloudApplication extends BaseApplication {
.addCallback(new PosVoidStatusExceptionCallback()) .addCallback(new PosVoidStatusExceptionCallback())
.addCallback(new PosTipsStatusExceptionCallback()) .addCallback(new PosTipsStatusExceptionCallback())
.addCallback(new PosSettlementStatusExceptionCallback()) .addCallback(new PosSettlementStatusExceptionCallback())
.addCallback(new NotGoodsCallback())
.addCallback(new EmptyCategoryCallback())
.commit(); .commit();
} }
......
...@@ -86,6 +86,8 @@ class OrderDetails { ...@@ -86,6 +86,8 @@ class OrderDetails {
//是否是預約單 0 :即時單 1:是預約單 //是否是預約單 0 :即時單 1:是預約單
var appointmentType: Int = 0 var appointmentType: Int = 0
//會員號碼
var memberPhone: String? = null
var orderPayType: Int = 0//0店內支付,1為貨到付款,2是在線支付 var orderPayType: Int = 0//0店內支付,1為貨到付款,2是在線支付
var isDelete: Int = 1 //默認為1,為0是第三方物流,其他則是本店配送 var isDelete: Int = 1 //默認為1,為0是第三方物流,其他則是本店配送
var payTime: String? = null var payTime: String? = null
......
package com.gingersoft.gsa.cloud.common.function.click;
import android.util.Log;
import android.view.View;
import com.gingersoft.gsa.cloud.common.R;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import java.util.Calendar;
/**
* 全局BaseQuickAdapter item點擊事件AOP
*/
@Aspect
public class BaseQueicItemClickAspect {
static int TIME_TAG = R.id.click_time;
/**
* 方法切入点
*/
@Pointcut("execution(* com.chad.library.adapter.base.listener.OnItemClickListener.onItemClick(..))")
public void onItemSingleClickMethod() {
}
/**
* 在连接点进行方法替换
*
* @param joinPoint
* @throws Throwable
*/
@Around("onItemSingleClickMethod()")
public void doItemSingleClickMethod(ProceedingJoinPoint joinPoint) throws Throwable {
Log.d("SingleClickAspect", "來了");
View view = null;
for (Object arg : joinPoint.getArgs()) {
if (arg instanceof View) {
view = (View) arg;
}
if (view != null) {
Object tag = view.getTag(TIME_TAG);
long lastClickTime = ((tag != null) ? (long) tag : 0);
Log.d("SingleClickAspect", "lastClickTime:" + lastClickTime);
long currentTime = Calendar.getInstance().getTimeInMillis();
if (currentTime - lastClickTime > 500) {//过滤掉500毫秒内的连续点击
view.setTag(TIME_TAG, currentTime);
Log.d("SingleClickAspect", "currentTime:" + currentTime);
joinPoint.proceed();//执行原方法
} else {
Log.d("SingleClickAspect", "連點了");
}
}
}
}
}
package com.gingersoft.gsa.cloud.common.function.click; package com.gingersoft.gsa.cloud.common.function.click;
import android.view.View;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
...@@ -16,6 +18,7 @@ import java.lang.annotation.Target; ...@@ -16,6 +18,7 @@ import java.lang.annotation.Target;
@Target(ElementType.METHOD) @Target(ElementType.METHOD)
public @interface SingleClick { public @interface SingleClick {
long value() default 1000; long value() default 100;
int[] ids() default {View.NO_ID};
} }
//package com.gingersoft.gsa.cloud.common.function.click; package com.gingersoft.gsa.cloud.common.function.click;
//
//import android.util.Log; import android.util.Log;
//import android.view.View; import android.view.View;
//
//import org.aspectj.lang.ProceedingJoinPoint; import com.gingersoft.gsa.cloud.common.R;
//import org.aspectj.lang.annotation.Around;
//import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.ProceedingJoinPoint;
//import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.annotation.Around;
//import org.aspectj.lang.reflect.MethodSignature; import org.aspectj.lang.annotation.Aspect;
// import org.aspectj.lang.annotation.Pointcut;
//import java.lang.reflect.Method;
// import java.util.Calendar;
///**
// * @author 宇航. /**
// * User: admin * Created by jerry on 2018/6/13.
// * Date: 2021/3/3 */
// * Time: 11:46
// * Use: @Aspect
// */ public class SingleClickAspect {
//@Aspect static int TIME_TAG = R.id.click_time;
//public class SingleClickAspect {
// private static final long DEFAULT_TIME_INTERVAL = 5000; @Pointcut("execution(@com.gingersoft.gsa.cloud.common.function.click.SingleClick * *(..))")
// /** //方法切入点
// * 定义切点,标记切点为所有被@SingleClick注解的方法 public void onSingleClickMethod() {
// 注意:这里me.baron.test.annotation.SingleClick需要替换成 }
// * 你自己项目中SingleClick这个类的全路径哦
// */ @Around("onSingleClickMethod() && @annotation(singleClick)")//在连接点进行方法替换
// @Pointcut("execution(@com.gingersoft.gsa.cloud.common.function.click.SingleClick * *(..))") public void doSingleClickMethod(ProceedingJoinPoint joinPoint, SingleClick singleClick) throws Throwable {
// public void methodAnnotated() {} View view = null;
// for (Object arg : joinPoint.getArgs())
// /** if (arg instanceof View) view = (View) arg;
// * 定义一个切面方法,包裹切点方法 if (view != null) {
// */ Object tag = view.getTag(TIME_TAG);
// @Around("methodAnnotated()") long lastClickTime = ((tag != null) ? (long) tag : 0);
// public void aroundJoinPoint(ProceedingJoinPoint joinPoint) throws Throwable { Log.d("SingleClickAspect", "lastClickTime:" + lastClickTime);
// // 取出方法的参数 long currentTime = Calendar.getInstance().getTimeInMillis();
//// View view = null; long value = singleClick.value();
//// for (Object arg : joinPoint.getArgs()) { int[] ids = singleClick.ids();
//// if (arg instanceof View) {
//// view = (View) arg; if (currentTime - lastClickTime > value || !hasId(ids, view.getId())) {//过滤掉500毫秒内的连续点击
//// break; view.setTag(TIME_TAG, currentTime);
//// } Log.d("SingleClickAspect", "currentTime:" + currentTime);
//// } joinPoint.proceed();//执行原方法
//// if (view == null) { } else {
//// return; Log.d("SingleClickAspect", "連點了");
//// } }
// // 取出方法的注解 }
// MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature(); }
// Method method = methodSignature.getMethod();
// Log.e("eee", "aroundJoinPoint"); public static boolean hasId(int[] arr, int value) {
// if (!method.isAnnotationPresent(SingleClick.class)) { for (int i : arr) {
// Log.e("eee", "isAnnotationPresent"); if (i == value)
// return; return true;
// } }
// SingleClick singleClick = method.getAnnotation(SingleClick.class); return false;
// // 判断是否快速点击 }
// if (!isFastDoubleClick(method.getName(), singleClick.value())) { }
// Log.e("eee", "不是快速點擊");
// // 不是快速点击,执行原方法
// joinPoint.proceed();
// } else {
// Log.e("eee", "快速點擊");
// }
// }
//
// /**
// * 最近一次点击的时间
// */
// private static long mLastClickTime;
// /**
// * 最近一次点击的方法
// */
// private static String mLastMethodName;
//
// /**
// * 是否是快速点击
// * @param intervalMillis 时间间期(毫秒)
// * @return true:是,false:不是
// */
// public static boolean isFastDoubleClick(String methodName, long intervalMillis) {
// long time = System.currentTimeMillis();
// long timeInterval = Math.abs(time - mLastClickTime);
// if (timeInterval < intervalMillis && methodName.equals(mLastMethodName)) {
// return true;
// } else {
// mLastClickTime = time;
// mLastMethodName = methodName;
// return false;
// }
// }
//}
package com.gingersoft.gsa.cloud.common.loadsir.purchase;
import android.content.Context;
import android.view.View;
import com.gingersoft.gsa.cloud.common.R;
import com.kingja.loadsir.callback.Callback;
import butterknife.ButterKnife;
/**
* @author : bin
* @create date: 2020-10-27
* @update date: 2020-10-27
* @description:
*/
public class EmptyCategoryCallback extends Callback {
@Override
protected int onCreateView() {
return R.layout.loadsir_empty_category;
}
@Override
protected void onViewCreate(Context context, View view) {
super.onViewCreate(context, view);
ButterKnife.bind(this, view);
}
}
package com.gingersoft.gsa.cloud.common.loadsir.purchase;
import android.content.Context;
import android.view.View;
import com.gingersoft.gsa.cloud.common.R;
import com.kingja.loadsir.callback.Callback;
import butterknife.ButterKnife;
/**
* @author 宇航. 1239658231@qq.com
* User: admin
* Date: 2021/4/23
* Time: 9:50
* Use: 沒有商品時默認頁面
*/
public class NotGoodsCallback extends Callback {
@Override
protected int onCreateView() {
return R.layout.loadsir_not_have_goods;
}
@Override
protected void onViewCreate(Context context, View view) {
super.onViewCreate(context, view);
ButterKnife.bind(this, view);
}
}
...@@ -29,6 +29,7 @@ import com.gingersoft.gsa.cloud.common.utils.okhttpUtils.OkHttp3Utils ...@@ -29,6 +29,7 @@ import com.gingersoft.gsa.cloud.common.utils.okhttpUtils.OkHttp3Utils
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils
import com.gingersoft.gsa.cloud.component.ComponentName import com.gingersoft.gsa.cloud.component.ComponentName
import com.google.gson.Gson import com.google.gson.Gson
import com.jess.arms.utils.DeviceUtils
import com.xuexiang.rxutil2.rxjava.RxJavaUtils import com.xuexiang.rxutil2.rxjava.RxJavaUtils
import io.reactivex.disposables.Disposable import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers import io.reactivex.schedulers.Schedulers
...@@ -416,7 +417,7 @@ class ICommandService : Service() { ...@@ -416,7 +417,7 @@ class ICommandService : Service() {
val token = "weixin_" + RestaurantInfoManager.newInstance().restaurantId + "_" + getRandomString(24) val token = "weixin_" + RestaurantInfoManager.newInstance().restaurantId + "_" + getRandomString(24)
LoganManager.w_code(TAG, "token=" + token) LoganManager.w_code(TAG, "token=" + token)
if (mWebSocket != null) { if (mWebSocket != null) {
mWebSocket?.send(Gson().toJson(MsgBean(1, getConnectiontype(), token))) mWebSocket?.send(Gson().toJson(MsgBean(1, getConnectiontype(), token, UserContext.newInstance().memberId, DeviceUtils.getDeviceId(this))))
} }
} }
...@@ -521,6 +522,6 @@ class ICommandService : Service() { ...@@ -521,6 +522,6 @@ class ICommandService : Service() {
LoganManager.w_network("$TAG -> $content") LoganManager.w_network("$TAG -> $content")
} }
class MsgBean(var type: Int, var data: String, var token: String) class MsgBean(var type: Int, var data: String, var token: String, var userId: Int, var deviceId: String)
} }
\ No newline at end of file
...@@ -229,10 +229,10 @@ public class FileUtils { ...@@ -229,10 +229,10 @@ public class FileUtils {
return new File(folderPath, fileName + fileName); return new File(folderPath, fileName + fileName);
} }
/* /**
* 在SD卡上创建目录 * 在SD卡上创建目录
*/ */
public static File creatSDDir(String dirName) { public static File createSDDir(String dirName) {
File dir = new File(dirName); File dir = new File(dirName);
if (!dir.exists()) { if (!dir.exists()) {
dir.mkdirs(); dir.mkdirs();
......
...@@ -58,17 +58,22 @@ public class MatchUtils { ...@@ -58,17 +58,22 @@ public class MatchUtils {
")" + ")" +
"\\d{8}" + "\\d{8}" +
")"; ")";
private static final int PHONE_LENGTH = 11;
//
// private static final Pattern emailPattern = Pattern.compile("^([a-zA-Z0-9]*[-_]?[a-zA-Z0-9]+)*@([a-zA-Z0-9]*[-_]?[a-zA-Z0-9]+)+[\\.][A-Za-z]{2,3}([\\.][A-Za-z]{2})?$");
/**
* 郵箱驗證
*/
private static final Pattern EMAIL_PATTERN = Pattern.compile("[\\w!#$%&'*+/=?^_`{|}~-]+(?:\\.[\\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\\w](?:[\\w-]*[\\w])?\\.)+[\\w](?:[\\w-]*[\\w])?");
public static boolean checkMobile(String phone) { public static boolean checkMobile(String phone) {
if (phone.length() != 11) { if (phone.length() != PHONE_LENGTH) {
return false; return false;
} else { } else {
Pattern p = Pattern.compile(REGEX_MOBILE); Pattern p = Pattern.compile(REGEX_MOBILE);
Matcher m = p.matcher(phone); Matcher m = p.matcher(phone);
boolean isMatch = m.matches(); return m.matches();
if (!isMatch) {
}
return isMatch;
} }
} }
...@@ -82,9 +87,7 @@ public class MatchUtils { ...@@ -82,9 +87,7 @@ public class MatchUtils {
if (TextUtils.isEmpty(email)) { if (TextUtils.isEmpty(email)) {
return false; return false;
} }
Matcher m = EMAIL_PATTERN.matcher(email);
Pattern p = Pattern.compile("^([a-zA-Z0-9]*[-_]?[a-zA-Z0-9]+)*@([a-zA-Z0-9]*[-_]?[a-zA-Z0-9]+)+[\\.][A-Za-z]{2,3}([\\.][A-Za-z]{2})?$");
Matcher m = p.matcher(email);
return m.matches(); return m.matches();
} }
......
...@@ -97,7 +97,7 @@ public class InputFilterUtils { ...@@ -97,7 +97,7 @@ public class InputFilterUtils {
} }
public static InputFilter getLengthFilter(Context mContext, int maxLength) { public static InputFilter getLengthFilter(Context mContext, int maxLength) {
return InputFilterUtils.getMaxLengthFilter(mContext, "最多輸入" + maxLength + "個字", maxLength); return InputFilterUtils.getMaxLengthFilter(mContext, "最多輸入" + maxLength + "英文/" + maxLength / 2 + "中文", maxLength);
} }
public static InputFilter getNumberFilter(Context context) { public static InputFilter getNumberFilter(Context context) {
...@@ -216,18 +216,18 @@ public class InputFilterUtils { ...@@ -216,18 +216,18 @@ public class InputFilterUtils {
* 這裡就先注釋 * 這裡就先注釋
*/ */
private static int getCurLength(CharSequence s) { private static int getCurLength(CharSequence s) {
// int length = 0; int length = 0;
// if (s == null) { if (s == null) {
// return length; return length;
// } else { } else {
// for (int i = 0; i < s.length(); i++) { for (int i = 0; i < s.length(); i++) {
// if (s.charAt(i) < 128) { if (s.charAt(i) < 128) {
// length += 1; length += 1;
// } else { } else {
// length += 2; length += 2;
// } }
// } }
// } }
return s.length(); return s.length();
} }
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_not_have_goods"
android:gravity="center"
android:drawablePadding="@dimen/dp_20"
android:textColor="#999999"
android:textSize="@dimen/load_dialog_text_size"
android:text="@string/emptyView_click_new_add_category"
android:layout_marginBottom="@dimen/head_height"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/layout_not_commodity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/tv_not_goods_tip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_not_have_goods"
android:drawablePadding="@dimen/dp_20"
android:gravity="center"
android:text="@string/emptyView_not_have_commodity"
android:textColor="@color/dk_color_99"
android:textSize="@dimen/load_dialog_text_size"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_20"
android:layout_marginRight="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_11"
android:background="@drawable/shape_theme_five_corners_bg"
android:gravity="center"
android:paddingTop="@dimen/dp_10"
android:paddingBottom="@dimen/dp_10"
android:text="@string/str_new_add_commodity"
android:textColor="@color/white"
android:textSize="@dimen/dp_16"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
...@@ -539,7 +539,7 @@ ...@@ -539,7 +539,7 @@
<color name="dotted_color">#9FA0A2</color> <color name="dotted_color">#9FA0A2</color>
<color name="brick_red">#EC6941</color> <color name="brick_red">#EC6941</color>
<color name="add_deputy_unit_bg">#F19149</color> <color name="add_deputy_unit_bg">#F19149</color>
<color name="dk_color_999999">#999</color> <color name="dk_color_99">#999</color>
<color name="bright_orange">#FF7A0E</color> <color name="bright_orange">#FF7A0E</color>
<color name="print_success_color">#019944</color> <color name="print_success_color">#019944</color>
</resources> </resources>
\ No newline at end of file
...@@ -51,5 +51,6 @@ ...@@ -51,5 +51,6 @@
<item name="split" type="id"/> <item name="split" type="id"/>
<item name="layout_replace" type="id"/> <item name="layout_replace" type="id"/>
<item name="iv_prj_history" type="id"/> <item name="iv_prj_history" type="id"/>
<item name="click_time" type="id" />
</resources> </resources>
\ No newline at end of file
...@@ -133,6 +133,9 @@ ...@@ -133,6 +133,9 @@
<string name="emptyView_mode_desc_retry">點擊重試</string> <string name="emptyView_mode_desc_retry">點擊重試</string>
<string name="emptyView_mode_desc_double">未獲取到數據</string> <string name="emptyView_mode_desc_double">未獲取到數據</string>
<string name="emptyView_mode_desc_retry_query">點擊重試查詢</string> <string name="emptyView_mode_desc_retry_query">點擊重試查詢</string>
<string name="emptyView_not_have_commodity">還沒有添加商品哦</string>
<string name="emptyView_click_new_add_category">沒有類別,點擊新增類別</string>
<string name="emptyView_mode_desc_pos_pay">支付狀態異常,請嘗試重試查詢</string> <string name="emptyView_mode_desc_pos_pay">支付狀態異常,請嘗試重試查詢</string>
<string name="emptyView_mode_desc_pos_refund">退款狀態異常,請嘗試重試查詢</string> <string name="emptyView_mode_desc_pos_refund">退款狀態異常,請嘗試重試查詢</string>
...@@ -214,6 +217,7 @@ ...@@ -214,6 +217,7 @@
<string name="left_parenthesis"></string> <string name="left_parenthesis"></string>
<string name="right_parenthesis"></string> <string name="right_parenthesis"></string>
<string name="str_parenthesis_format">(%1$s)</string>
<string name="delivery_type">配送類型:</string> <string name="delivery_type">配送類型:</string>
<string name="delivery_expenses">配送費範圍:</string> <string name="delivery_expenses">配送費範圍:</string>
...@@ -244,4 +248,29 @@ ...@@ -244,4 +248,29 @@
<string name="str_yes"></string> <string name="str_yes"></string>
<string name="str_no"></string> <string name="str_no"></string>
<string name="str_place_an_order">落單:%1$s</string>
<string name="str_take_meal">取餐:%1$s</string>
<string name="str_service">送達:%1$s</string>
<string name="str_set_up_table">開台:%1$s</string>
<string name="str_take_meal_code">取餐碼:%1$s</string>
<string name="str_order_code">訂單碼:%1$s</string>
<string name="str_waiter">服務員:%1$s</string>
<string name="str_dine">堂食</string>
<string name="str_self_collection">自取</string>
<string name="str_cold_chain">凍鏈</string>
<string name="str_takeaway">外賣</string>
<string name="str_email_format_incorrect">郵箱格式不正確</string>
<string name="str_new_add_commodity">+新增商品</string>
<string name="str_new_add_category">新增類別</string>
<string name="str_please_input_category_name">請輸入類別名稱</string>
<string name="str_category_name">類別名稱</string>
<string name="str_please_choise_category">請選擇類別</string>
<string name="str_please_reselect_category">請重新選擇類別</string>
<string name="str_modify">修改</string>
<string name="str_please_modify_current_category_name">请修改當前類別名稱</string>
<string name="str_data_info">出錯啦,請重新進入後再試</string>
</resources> </resources>
...@@ -306,7 +306,7 @@ ...@@ -306,7 +306,7 @@
<!-- 廚房單台號體樣式--> <!-- 廚房單台號體樣式-->
<style name="Print_kitchen_table_number_text_style"> <style name="Print_kitchen_table_number_text_style">
<item name="android:textColor">@color/black</item> <item name="android:textColor">@color/black</item>
<item name="android:textSize">@dimen/sp_38</item> <item name="android:textSize">@dimen/dp_40</item>
</style> </style>
<style name="report_food_ranking"> <style name="report_food_ranking">
......
...@@ -46,6 +46,7 @@ public class AppDialog { ...@@ -46,6 +46,7 @@ public class AppDialog {
} }
private void showWaringDialog(Context context, String title, String confimText, String cancelText, DialogOnClickListenter sureOnclickListener, DialogOnClickListenter cancelOnclickListener, boolean isDismiss) { private void showWaringDialog(Context context, String title, String confimText, String cancelText, DialogOnClickListenter sureOnclickListener, DialogOnClickListenter cancelOnclickListener, boolean isDismiss) {
//DialogUtils內存洩漏,換Xpopup
new DialogUtils(context, R.layout.other_order_pause_orders) { new DialogUtils(context, R.layout.other_order_pause_orders) {
@Override @Override
public void initLayout(ViewHepler hepler, Dialog dialog) { public void initLayout(ViewHepler hepler, Dialog dialog) {
......
...@@ -49,7 +49,7 @@ public abstract class DialogUtils implements LifecycleObserver { ...@@ -49,7 +49,7 @@ public abstract class DialogUtils implements LifecycleObserver {
private void init(Context context) { private void init(Context context) {
dialog = new Dialog(context); dialog = new Dialog(context);
viewHepler = getViewHepler(context); viewHepler = getViewHepler();
initLayout(viewHepler, dialog); initLayout(viewHepler, dialog);
dialog.setContentView(viewHepler.getContentView()); dialog.setContentView(viewHepler.getContentView());
...@@ -204,8 +204,8 @@ public abstract class DialogUtils implements LifecycleObserver { ...@@ -204,8 +204,8 @@ public abstract class DialogUtils implements LifecycleObserver {
public abstract void initLayout(ViewHepler hepler, Dialog dialog); public abstract void initLayout(ViewHepler hepler, Dialog dialog);
private ViewHepler getViewHepler(Context context) { private ViewHepler getViewHepler() {
return new ViewHepler(context, view); return new ViewHepler(view);
} }
...@@ -223,7 +223,7 @@ public abstract class DialogUtils implements LifecycleObserver { ...@@ -223,7 +223,7 @@ public abstract class DialogUtils implements LifecycleObserver {
mConvertView = LayoutInflater.from(context).inflate(layoutId, null); mConvertView = LayoutInflater.from(context).inflate(layoutId, null);
} }
private ViewHepler(Context context, View view) { private ViewHepler(View view) {
this.mViews = new SparseArray<>(); this.mViews = new SparseArray<>();
mConvertView = view; mConvertView = view;
} }
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
tools:text="" /> tools:text="" />
<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:id="@+id/input_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:counterEnabled="true" app:counterEnabled="true"
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
<TextView <TextView
android:id="@+id/tv_food_time" android:id="@+id/tv_food_time"
style="@style/Print_eighteen_text" style="@style/Print_dot_matrix_normal"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="visible" android:visibility="visible"
...@@ -64,14 +64,14 @@ ...@@ -64,14 +64,14 @@
<TextView <TextView
android:id="@+id/tv_order_time_text" android:id="@+id/tv_order_time_text"
style="@style/Print_eighteen_text" style="@style/Print_dot_matrix_normal"
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_order_time" android:id="@+id/tv_order_time"
style="@style/Print_eighteen_text" style="@style/Print_dot_matrix_normal"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="01-04 19:32" /> android:text="01-04 19:32" />
...@@ -88,14 +88,14 @@ ...@@ -88,14 +88,14 @@
<TextView <TextView
android:id="@+id/tv_opening_time_text" android:id="@+id/tv_opening_time_text"
style="@style/Print_eighteen_text" style="@style/Print_dot_matrix_normal"
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_opening_time" android:id="@+id/tv_opening_time"
style="@style/Print_eighteen_text" style="@style/Print_dot_matrix_normal"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="01-20 12:00" /> android:text="01-20 12:00" />
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
<TextView <TextView
android:id="@+id/tv_people_text" android:id="@+id/tv_people_text"
style="@style/Print_eighteen_text" style="@style/Print_dot_matrix_normal"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="人數:" android:text="人數:"
...@@ -121,7 +121,7 @@ ...@@ -121,7 +121,7 @@
<TextView <TextView
android:id="@+id/tv_people" android:id="@+id/tv_people"
style="@style/Print_eighteen_text" style="@style/Print_dot_matrix_normal"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="0" android:text="0"
...@@ -129,7 +129,7 @@ ...@@ -129,7 +129,7 @@
<TextView <TextView
android:id="@+id/tv_kitchen_location_text" android:id="@+id/tv_kitchen_location_text"
style="@style/Print_eighteen_text" style="@style/Print_dot_matrix_normal"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_20" android:layout_marginLeft="@dimen/dp_20"
...@@ -138,7 +138,7 @@ ...@@ -138,7 +138,7 @@
<TextView <TextView
android:id="@+id/tv_kitchen_location" android:id="@+id/tv_kitchen_location"
style="@style/Print_eighteen_text" style="@style/Print_dot_matrix_normal"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="" android:text=""
...@@ -156,7 +156,7 @@ ...@@ -156,7 +156,7 @@
<TextView <TextView
android:id="@+id/tv_order_num_text" android:id="@+id/tv_order_num_text"
style="@style/Print_eighteen_text" style="@style/Print_dot_matrix_normal"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="單號:" /> android:text="單號:" />
...@@ -186,7 +186,7 @@ ...@@ -186,7 +186,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="取餐碼:" android:text="取餐碼:"
android:textSize="@dimen/sp_18" android:textSize="@dimen/sp_18"
android:visibility="gone" /> android:visibility="visible" />
<TextView <TextView
android:id="@+id/tv_take_code" android:id="@+id/tv_take_code"
...@@ -194,7 +194,7 @@ ...@@ -194,7 +194,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="@dimen/sp_18" android:textSize="@dimen/sp_18"
android:visibility="gone" /> android:visibility="visible" />
</LinearLayout> </LinearLayout>
<!--服務員--> <!--服務員-->
...@@ -208,14 +208,14 @@ ...@@ -208,14 +208,14 @@
<TextView <TextView
android:id="@+id/tv_waiter_text" android:id="@+id/tv_waiter_text"
style="@style/Print_eighteen_text" style="@style/Print_dot_matrix_normal"
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_waiter" android:id="@+id/tv_waiter"
style="@style/Print_eighteen_text" style="@style/Print_dot_matrix_normal"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="GSPOS" /> android:text="GSPOS" />
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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="match_parent"
android:orientation="vertical">
<!--廚房單-->
<!-- 頭單-->
<TextView
android:id="@+id/tv_kitchen_print_first_order"
style="@style/Print_kitchen_table_number_text_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="頭單"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="@+id/layout_time_and_order_number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="bottom"
android:orientation="horizontal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_kitchen_print_first_order">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<!-- 台號-->
<TextView
android:id="@+id/tv_kitchen_print_table_number"
style="@style/Print_kitchen_table_number_text_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="外賣19"
android:textSize="@dimen/sp_42"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_kitchen_print_first_order" />
<TextView
android:id="@+id/tv_food_time"
style="@style/Print_twenty_two_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_kitchen_print_table_number"
tools:text="盡快送達" />
<!--落單時間-->
<TextView
android:id="@+id/tv_order_time"
style="@style/Print_twenty_two_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="落單:01-04 19:31" />
<!--開台時間-->
<TextView
android:id="@+id/tv_opening_time"
style="@style/Print_twenty_two_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="開台:01-20 12:00" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_people"
style="@style/Print_twenty_four_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible"
tools:text="人數:0" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="@+id/tv_kitchen_location"
style="@style/Print_twenty_four_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:visibility="visible"
tools:text="廚房:K1" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginLeft="@dimen/dp_1"
android:layout_weight="1"
android:gravity="right"
android:orientation="vertical">
<!--預留-->
<TextView
android:id="@+id/tv_order_reserved"
style="@style/Print_kitchen_table_number_text_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_kitchen_print_first_order"
tools:text="預存" />
<!--單號-->
<LinearLayout
android:id="@+id/ll_order"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_order_num_text"
style="@style/Print_twenty_two_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="單號:" />
<TextView
android:id="@+id/tv_order_num"
style="@style/Print_thirty_eight_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="AE00" />
</LinearLayout>
<!--自取取餐碼-->
<TextView
android:id="@+id/tv_take_code"
style="@style/Print_twenty_four_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible"
tools:text="取餐碼:12" />
<TextView
android:id="@+id/tv_waiter"
style="@style/Print_twenty_four_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="服務員:GSPOS" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/line_kitchen_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="————————————————————————————————————————————"
android:textSize="@dimen/sp_18"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/layout_time_and_order_number" />
<LinearLayout
android:id="@+id/ll_kitchen_food"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:orientation="vertical"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/line_kitchen_info" />
<TextView
android:id="@+id/tv_kitchen_food_end_line"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:maxLines="1"
android:text="————————————————————————————————————————————"
android:textSize="@dimen/sp_18"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ll_kitchen_food" />
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_20"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_kitchen_food_end_line">
<TextView
android:id="@+id/tv_prj_page_index"
style="@style/Print_kitchen_table_number_text_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textSize="@dimen/sp_28"
tools:text="1/2" />
<TextView
android:id="@+id/tv_kitchen_print_table_number_bottom"
style="@style/Print_kitchen_table_number_text_style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="外賣19"
android:textSize="@dimen/sp_42"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_kitchen_print_quantity"
style="@style/Print_kitchen_table_number_text_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textSize="@dimen/sp_28"
tools:text="統計數量" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<style name="Print_eighteen_text"> <style name="Print_default_text">
<item name="android:textSize">@dimen/dp_18</item> <item name="android:textSize">@dimen/dp_20</item>
<item name="android:textColor">@color/black</item> <item name="android:textColor">@color/black</item>
<item name="android:includeFontPadding">false</item> <item name="android:includeFontPadding">false</item>
</style> </style>
<style name="Print_twenty_four_text"> <style name="Print_eighteen_text" parent="@style/Print_default_text">
<item name="android:textSize">@dimen/dp_18</item>
</style>
<style name="Print_twenty_two_text" parent="@style/Print_default_text">
<item name="android:textSize">@dimen/dp_22</item>
</style>
<style name="Print_twenty_four_text" parent="@style/Print_default_text">
<item name="android:textSize">@dimen/dp_24</item> <item name="android:textSize">@dimen/dp_24</item>
<item name="android:textColor">@color/black</item>
<item name="android:includeFontPadding">false</item>
</style> </style>
<style name="Print_twenty_six_text">
<style name="Print_twenty_six_text" parent="@style/Print_default_text">
<item name="android:textSize">@dimen/dp_26</item> <item name="android:textSize">@dimen/dp_26</item>
<item name="android:textColor">@color/black</item>
<item name="android:includeFontPadding">false</item>
</style> </style>
<style name="Print_twenty_eight_text">
<style name="Print_twenty_eight_text" parent="@style/Print_default_text">
<item name="android:textSize">@dimen/dp_28</item> <item name="android:textSize">@dimen/dp_28</item>
<item name="android:textColor">@color/black</item>
<item name="android:includeFontPadding">false</item>
</style> </style>
<style name="Print_thirty_two_text"> <style name="Print_thirty_two_text" parent="@style/Print_default_text">
<item name="android:textSize">@dimen/dp_32</item> <item name="android:textSize">@dimen/dp_32</item>
<item name="android:textColor">@color/black</item>
<item name="android:includeFontPadding">false</item>
</style> </style>
<style name="Print_thirty_eight_text" parent="@style/Print_default_text">
<style name="Print_forty_two_text"> <item name="android:textSize">@dimen/dp_38</item>
</style>
<style name="Print_forty_two_text" parent="@style/Print_default_text">
<item name="android:textSize">@dimen/dp_42</item> <item name="android:textSize">@dimen/dp_42</item>
<item name="android:textColor">@color/black</item>
<item name="android:includeFontPadding">false</item>
</style> </style>
<style name="Print_thermal_printing_normal" parent="@style/Print_twenty_four_text" /> <style name="Print_thermal_printing_normal" parent="@style/Print_twenty_four_text" />
<style name="Print_dot_matrix_normal" parent="@style/Print_twenty_six_text" /> <style name="Print_dot_matrix_normal" parent="@style/Print_twenty_six_text" />
</resources> </resources>
\ No newline at end of file
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