Commit 367cd0b3 by 宁斌

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	component-login/src/main/AndroidManifest.xml
#	component-main/src/main/java/com/gingersoft/gsa/cloud/main/mvp/ui/activity/NewMainActivity.java
#	library-order/src/main/java/com/gingersoft/gsa/cloud/order/order/DoshokuOrder.java
parents bf82ac4d feb970a0
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
apply from: "config.gradle" apply from: "config.gradle"
buildscript { buildscript {
ext.kotlin_version = '1.3.50' ext.kotlin_version = '1.4.21'
repositories { repositories {
google() google()
......
...@@ -27,7 +27,6 @@ android { ...@@ -27,7 +27,6 @@ android {
dataBinding { dataBinding {
enabled = true enabled = true
} }
buildTypes { buildTypes {
debug { debug {
buildConfigField "boolean", "LOG_DEBUG", "true" buildConfigField "boolean", "LOG_DEBUG", "true"
...@@ -49,15 +48,12 @@ kapt { ...@@ -49,15 +48,12 @@ kapt {
} }
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
kapt rootProject.ext.dependencies["dagger2-compiler"] kapt rootProject.ext.dependencies["dagger2-compiler"]
kapt rootProject.ext.dependencies["butterknife-compiler"] kapt rootProject.ext.dependencies["butterknife-compiler"]
// implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
// alternatively, just LiveData // alternatively, just LiveData
implementation "android.arch.lifecycle:livedata:1.1.1" implementation "android.arch.lifecycle:livedata:1.1.1"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.0-alpha01" implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.0-alpha01"
//协程 //协程
implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2' implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
//gson和scalars轉換器 //gson和scalars轉換器
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<activity android:name=".ui.activity.LogActivity" /> <activity android:name=".ui.activity.LogActivity" />
<activity android:name=".ui.activity.OrderDetailsActivity" /> <activity android:name=".ui.activity.OrderDetailsActivity" />
<activity <activity
android:name=".mvp.ui.activity.SendOrderActivity" android:name=".ui.activity.DeliveryOrderMainActivity"
android:label="@string/app_name"> android:label="@string/app_name">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
......
...@@ -58,6 +58,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -58,6 +58,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
val DeliveryPrint = 1008//訂單確認成功,是否成功打印回調 val DeliveryPrint = 1008//訂單確認成功,是否成功打印回調
val Transportation = 1009//修改運輸工具成功 val Transportation = 1009//修改運輸工具成功
val AmountError = 1010//訂單金額有錯 val AmountError = 1010//訂單金額有錯
val ErrorCode = 1011//報錯提示
} }
val restaurantId by lazy { ResturantInfoManager.newInstance().getRestaurantId() } val restaurantId by lazy { ResturantInfoManager.newInstance().getRestaurantId() }
...@@ -510,9 +511,9 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -510,9 +511,9 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
} }
launch({ launch({
repository.gsUpdateOrderStatus(orderDetails.ID, 4, orderDetails.order_type, 3, orderFrom = 0).apply { repository.gsUpdateOrderStatus(orderDetails.ID, 4, orderDetails.order_type, 3, orderFrom = 0).apply {
orderDetails.payMultiple = orderPayInfoVO if (orderPayInfoVO != null && orderPayInfoVO.isNotEmpty()) {
// orderDetails.payType = payTypeId orderDetails.payMultiple = orderPayInfoVO
// orderDetails.payName = payName }
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 orderDetails.oldPoints = bean.oldPoints
...@@ -521,9 +522,8 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -521,9 +522,8 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
printOrderClosing(orderDetails, listener) printOrderClosing(orderDetails, listener)
} }
}, { }, {
listener.invoke(OrderDelivery, false) listener.invoke(ErrorCode, false)
it.printStackTrace() it.printStackTrace()
// integralBean.postValue(null)
}) })
} }
...@@ -665,9 +665,8 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -665,9 +665,8 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
private fun printOrderClosing(dataBean: OrderDetails.DataBean, listener: (Int, Boolean) -> Unit) { private fun printOrderClosing(dataBean: OrderDetails.DataBean, listener: (Int, Boolean) -> Unit) {
TakeawayOrder.getInstance().shoppingCart.deliveryAndPickupData = dataBean TakeawayOrder.getInstance().shoppingCart.deliveryAndPickupData = dataBean
var contentAdapter = PrintContentAdapter() val contentAdapter = PrintContentAdapter()
var printContent = contentAdapter.adaptationPrintTakeawayCheckoutContent(TakeawayOrder.getInstance().shoppingCart.deliveryAndPickupData) val printContent = contentAdapter.adaptationPrintTakeawayCheckoutContent(TakeawayOrder.getInstance().shoppingCart.deliveryAndPickupData)
CC.obtainBuilder(ComponentName.COMPONENT_PRINT) CC.obtainBuilder(ComponentName.COMPONENT_PRINT)
.addParam(PrintConstans.PRINT_TYPE, PrintConstans.PRINT_OTHER_CLOSING) .addParam(PrintConstans.PRINT_TYPE, PrintConstans.PRINT_OTHER_CLOSING)
......
...@@ -91,7 +91,9 @@ class HistoryOrderActivity : BaseActivity<IPresenter>() { ...@@ -91,7 +91,9 @@ class HistoryOrderActivity : BaseActivity<IPresenter>() {
val cal = Calendar.getInstance() val cal = Calendar.getInstance()
try { try {
//設置默認時間為當前的起止時間 //設置默認時間為當前的起止時間
cal.time = TimeUtils.DATE_FORMAT_DATE.parse(tv_start_time.text.toString()) TimeUtils.DATE_FORMAT_DATE.parse(tv_start_time.text.toString())?.let {
cal.time = it
}
} catch (e: ParseException) { } catch (e: ParseException) {
e.printStackTrace() e.printStackTrace()
} }
......
...@@ -93,7 +93,7 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() { ...@@ -93,7 +93,7 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
.show() .show()
restaurantId = ResturantInfoManager.newInstance().getRestaurantId() restaurantId = ResturantInfoManager.newInstance().getRestaurantId()
orderId = intent.getStringExtra("orderId")//訂單id orderId = intent.getStringExtra("orderId")!!//訂單id
orderType = intent.getIntExtra("orderType", 0)//訂單類型 orderType = intent.getIntExtra("orderType", 0)//訂單類型
orderPayType = intent.getIntExtra("orderPayType", 0)//訂單支付方式 orderPayType = intent.getIntExtra("orderPayType", 0)//訂單支付方式
isRead = intent.getIntExtra("isRead", -1)//是否已讀訂單 isRead = intent.getIntExtra("isRead", -1)//是否已讀訂單
...@@ -349,11 +349,17 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() { ...@@ -349,11 +349,17 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
BtnBuilder.ClosingBtn -> { BtnBuilder.ClosingBtn -> {
//如果是在線支付的訂單,就直接修改訂單狀態 //如果是在線支付的訂單,就直接修改訂單狀態
if (orderPayType != 1) { if (orderPayType != 1) {
gsUpdateOrderStatus(orderDetails, null) { _, isSuccess -> gsUpdateOrderStatus(orderDetails, null) { errorCode, isSuccess ->
if (isSuccess) { when {
finish() isSuccess -> {
} else { finish()
ToastUtils.show(this@OrderDetailsActivity, "結賬失敗") }
errorCode == PageViewModel.ErrorCode -> {
ToastUtils.show(this@OrderDetailsActivity, "程序出現異常,請退出重試")
}
else -> {
ToastUtils.show(this@OrderDetailsActivity, "結賬失敗,請退出重試")
}
} }
} }
} else { } else {
...@@ -608,7 +614,7 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() { ...@@ -608,7 +614,7 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
} }
} }
} }
set(value) = TODO() set(value) {}
private fun PageViewModel.confirmOrder(orderDetails: OrderDetails.DataBean, trafficType: String = "", isPrint: Boolean = true) { private fun PageViewModel.confirmOrder(orderDetails: OrderDetails.DataBean, trafficType: String = "", isPrint: Boolean = true) {
showLoading() showLoading()
......
...@@ -6,6 +6,7 @@ import android.view.LayoutInflater ...@@ -6,6 +6,7 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.ImageView import android.widget.ImageView
import androidx.core.content.ContextCompat
import androidx.databinding.DataBindingUtil import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.gingersoft.gsa.delivery_pick_mode.R import com.gingersoft.gsa.delivery_pick_mode.R
...@@ -57,8 +58,8 @@ class HistoryOrderAdapter(var stauts: String?, private val context: Context, var ...@@ -57,8 +58,8 @@ class HistoryOrderAdapter(var stauts: String?, private val context: Context, var
val payMethodBg = GradientDrawable() val payMethodBg = GradientDrawable()
payMethodBg.cornerRadius = SmartUtil.dp2px(10f).toFloat() payMethodBg.cornerRadius = SmartUtil.dp2px(10f).toFloat()
holder.binding.payMethod = holder.binding.payMethod =
when { when (data.orderPayType) {
data.orderPayType == 1 -> { 1 -> {
payMethodBg.setColor(getColor(R.color.cash_on_delivery_bg)) payMethodBg.setColor(getColor(R.color.cash_on_delivery_bg))
"貨到付款" "貨到付款"
} }
...@@ -87,7 +88,7 @@ class HistoryOrderAdapter(var stauts: String?, private val context: Context, var ...@@ -87,7 +88,7 @@ class HistoryOrderAdapter(var stauts: String?, private val context: Context, var
} }
private fun getColor(color: Int): Int { private fun getColor(color: Int): Int {
return context.resources.getColor(color) return ContextCompat.getColor(context, color)
} }
class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
......
...@@ -16,6 +16,7 @@ import com.gingersoft.gsa.delivery_pick_mode.ui.activity.DeliverySettingActivity ...@@ -16,6 +16,7 @@ import com.gingersoft.gsa.delivery_pick_mode.ui.activity.DeliverySettingActivity
import com.gingersoft.gsa.delivery_pick_mode.ui.adapter.TextAdapter import com.gingersoft.gsa.delivery_pick_mode.ui.adapter.TextAdapter
import com.gingersoft.gsa.delivery_pick_mode.ui.base.BaseFragment import com.gingersoft.gsa.delivery_pick_mode.ui.base.BaseFragment
import com.gingersoft.gsa.delivery_pick_mode.util.InjectorUtil import com.gingersoft.gsa.delivery_pick_mode.util.InjectorUtil
import com.gingersoft.gsa.delivery_pick_mode.util.getCustomColor
import com.jess.arms.utils.ArmsUtils import com.jess.arms.utils.ArmsUtils
import com.qmuiteam.qmui.util.QMUIDisplayHelper import com.qmuiteam.qmui.util.QMUIDisplayHelper
import com.qmuiteam.qmui.widget.popup.QMUIPopup import com.qmuiteam.qmui.widget.popup.QMUIPopup
...@@ -53,7 +54,7 @@ class UpdateDeliveryFragment : BaseFragment(R.layout.update_delivery_fragment) { ...@@ -53,7 +54,7 @@ class UpdateDeliveryFragment : BaseFragment(R.layout.update_delivery_fragment) {
viewModel = ViewModelProvider(activity?.viewModelStore!!, InjectorUtil.getDeliveryFactory())[DeliveryViewModel::class.java] viewModel = ViewModelProvider(activity?.viewModelStore!!, InjectorUtil.getDeliveryFactory())[DeliveryViewModel::class.java]
top_bar_update_delivery.setTitle("配送設置") top_bar_update_delivery.setTitle("配送設置")
top_bar_update_delivery.setBackgroundColor(resources.getColor(R.color.theme_color)) top_bar_update_delivery.setBackgroundColor(getCustomColor(R.color.theme_color))
top_bar_update_delivery.addLeftImageButton(R.drawable.icon_return, R.id.iv_left_back).setOnClickListener { activity?.let { it.onBackPressed() } } top_bar_update_delivery.addLeftImageButton(R.drawable.icon_return, R.id.iv_left_back).setOnClickListener { activity?.let { it.onBackPressed() } }
deliveryConfig = arguments?.getSerializable(info) as DeliveryConfig.Data.DeliveryInfo? deliveryConfig = arguments?.getSerializable(info) as DeliveryConfig.Data.DeliveryInfo?
......
...@@ -52,10 +52,7 @@ android { ...@@ -52,10 +52,7 @@ android {
} }
dependencies { dependencies {
// implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(path: ':android_internal') implementation project(path: ':android_internal')
annotationProcessor rootProject.ext.dependencies["dagger2-compiler"] annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]
debugImplementation rootProject.ext.dependencies["canary-debug"] debugImplementation rootProject.ext.dependencies["canary-debug"]
releaseImplementation rootProject.ext.dependencies["canary-release"] releaseImplementation rootProject.ext.dependencies["canary-release"]
...@@ -66,8 +63,6 @@ dependencies { ...@@ -66,8 +63,6 @@ dependencies {
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0' implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
implementation 'cn.bingoogolapple:bga-progressbar:1.0.1'//进度条 implementation 'cn.bingoogolapple:bga-progressbar:1.0.1'//进度条
implementation "androidx.core:core-ktx:+" implementation "androidx.core:core-ktx:+"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
} }
repositories { repositories {
mavenCentral() mavenCentral()
......
...@@ -17,6 +17,7 @@ import android.widget.TextView; ...@@ -17,6 +17,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
...@@ -179,7 +180,7 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl ...@@ -179,7 +180,7 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
//側滑顯示或關閉時,修改背景圓角 //側滑顯示或關閉時,修改背景圓角
GradientDrawable drawable = new GradientDrawable(); GradientDrawable drawable = new GradientDrawable();
drawable.setColor(getResources().getColor(R.color.theme_bg_color)); drawable.setColor(ContextCompat.getColor(mContext, R.color.theme_bg_color));
slideMenu.setOnOpenChangedListenter(isOpen -> { slideMenu.setOnOpenChangedListenter(isOpen -> {
if (isOpen) { if (isOpen) {
drawable.setCornerRadii(new float[]{0f, 0f, getResources().getDimension(R.dimen.main_page_radius), getResources().getDimension(R.dimen.main_page_radius), 0f, 0f, getResources().getDimension(R.dimen.main_page_radius), getResources().getDimension(R.dimen.main_page_radius)}); drawable.setCornerRadii(new float[]{0f, 0f, getResources().getDimension(R.dimen.main_page_radius), getResources().getDimension(R.dimen.main_page_radius), 0f, 0f, getResources().getDimension(R.dimen.main_page_radius), getResources().getDimension(R.dimen.main_page_radius)});
...@@ -283,6 +284,7 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl ...@@ -283,6 +284,7 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
} }
List<Function> managerFuncations = FunctionManager.getDefault().getFunctionByResModule(this, ComponentMain.main.class, ComponentMain.main.manager, "manager"); List<Function> managerFuncations = FunctionManager.getDefault().getFunctionByResModule(this, ComponentMain.main.class, ComponentMain.main.manager, "manager");
managerFuncations.add(new Function(171, 163, 5, "二維碼", R.drawable.ic_qr_code, 0));
// managerFuncations.add(new Function(171, 163, 5, "二維碼", R.drawable.ic_qr_code, 0)); // managerFuncations.add(new Function(171, 163, 5, "二維碼", R.drawable.ic_qr_code, 0));
managerFuncations.add(new Function(171, 163, 5, "配置列表", R.drawable.ic_expand_list, 0)); managerFuncations.add(new Function(171, 163, 5, "配置列表", R.drawable.ic_expand_list, 0));
...@@ -418,6 +420,7 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl ...@@ -418,6 +420,7 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
launchActivity(new Intent(mContext, ExpandListActivity.class)); launchActivity(new Intent(mContext, ExpandListActivity.class));
break; break;
case "廚房打印查詢": case "廚房打印查詢":
case "廚房單查詢":
CC.obtainBuilder(ComponentName.COMPONENT_DELIVERYPICK) CC.obtainBuilder(ComponentName.COMPONENT_DELIVERYPICK)
.setActionName("PrjQueryActivity") .setActionName("PrjQueryActivity")
.build() .build()
......
...@@ -112,7 +112,7 @@ public class MyPrintUtils { ...@@ -112,7 +112,7 @@ public class MyPrintUtils {
if (defaultPrint.getFoodIsBold() == 0) { if (defaultPrint.getFoodIsBold() == 0) {
defaultPrint.setFoodIsBold(printCurrencyBean.getFoodIsBold()); defaultPrint.setFoodIsBold(printCurrencyBean.getFoodIsBold());
} }
if (defaultPrint.getFoodFont().equals("0")) { if (PrinterDeviceBean.DEFAULT_FONT_SIZE.equals(defaultPrint.getFoodFont())) {
defaultPrint.setFoodFont(printCurrencyBean.getFoodFont()); defaultPrint.setFoodFont(printCurrencyBean.getFoodFont());
} }
if (defaultPrint.getFoodIsItalic() == 0) { if (defaultPrint.getFoodIsItalic() == 0) {
...@@ -121,7 +121,7 @@ public class MyPrintUtils { ...@@ -121,7 +121,7 @@ public class MyPrintUtils {
if (defaultPrint.getModifierIsBold() == 0) { if (defaultPrint.getModifierIsBold() == 0) {
defaultPrint.setModifierIsBold(printCurrencyBean.getModifierIsBold()); defaultPrint.setModifierIsBold(printCurrencyBean.getModifierIsBold());
} }
if (defaultPrint.getModifierFont().equals("0")) { if (PrinterDeviceBean.DEFAULT_FONT_SIZE.equals(defaultPrint.getModifierFont())) {
defaultPrint.setModifierFont(printCurrencyBean.getModifierFont()); defaultPrint.setModifierFont(printCurrencyBean.getModifierFont());
} }
if (defaultPrint.getModifierIsItalic() == 0) { if (defaultPrint.getModifierIsItalic() == 0) {
...@@ -134,10 +134,10 @@ public class MyPrintUtils { ...@@ -134,10 +134,10 @@ public class MyPrintUtils {
if (printCurrencyBean == null) { if (printCurrencyBean == null) {
// 如果沒有預設,那麼判斷打印機字體大小是不是設置為預設 // 如果沒有預設,那麼判斷打印機字體大小是不是設置為預設
// 如果是預設,那麼手動給設置食品字體大小,不然打印不出來食品 // 如果是預設,那麼手動給設置食品字體大小,不然打印不出來食品
if (defaultPrint.getFoodFont().equals("0")) { if (PrinterDeviceBean.DEFAULT_FONT_SIZE.equals(defaultPrint.getFoodFont())) {
defaultPrint.setFoodFont("18"); defaultPrint.setFoodFont("18");
} }
if (defaultPrint.getModifierFont().equals("0")) { if (PrinterDeviceBean.DEFAULT_FONT_SIZE.equals(defaultPrint.getModifierFont())) {
defaultPrint.setModifierFont("16"); defaultPrint.setModifierFont("16");
} }
} }
......
...@@ -62,6 +62,10 @@ import java.util.Map; ...@@ -62,6 +62,10 @@ import java.util.Map;
import io.reactivex.Observable; import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import static com.gingersoft.gsa.cloud.common.constans.PrintConstans.PRINT_BILL;
import static com.gingersoft.gsa.cloud.common.constans.PrintConstans.PRINT_OTHER_CLOSING;
import static com.gingersoft.gsa.cloud.common.constans.PrintConstans.PRINT_OTHER_ORDER;
import static com.gingersoft.gsa.cloud.common.constans.PrintConstans.PRINT_SLIP;
import static com.jess.arms.utils.Preconditions.checkNotNull; import static com.jess.arms.utils.Preconditions.checkNotNull;
/** /**
...@@ -108,6 +112,7 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print ...@@ -108,6 +112,7 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
* 6:其他指令 * 6:其他指令
*/ */
private int type; private int type;
//是否顯示打印等待彈窗
private boolean isShowDialog; private boolean isShowDialog;
@Override @Override
...@@ -130,6 +135,7 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print ...@@ -130,6 +135,7 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
@Override @Override
public void initData(@Nullable Bundle savedInstanceState) { public void initData(@Nullable Bundle savedInstanceState) {
callId = CCUtil.getNavigateCallId(this); callId = CCUtil.getNavigateCallId(this);
//獲取打印類型,根據打印類型生成對應的bitmap //獲取打印類型,根據打印類型生成對應的bitmap
type = CCUtil.getNavigateParam(this, PrintConstans.PRINT_TYPE, PrintConstans.PRINT_TEST); type = CCUtil.getNavigateParam(this, PrintConstans.PRINT_TYPE, PrintConstans.PRINT_TEST);
PrintContent printContent = CCUtil.getNavigateParam(this, PrintConstans.PRINT_CONTENT, null); PrintContent printContent = CCUtil.getNavigateParam(this, PrintConstans.PRINT_CONTENT, null);
...@@ -145,19 +151,19 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print ...@@ -145,19 +151,19 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
private int selectPrint = -1; private int selectPrint = -1;
private void initPrintConfig() { private void initPrintConfig() {
PrintCurrencyBean printCurrencyBean = null; PrintCurrencyBean printCurrencyBean;
PrinterDeviceBean defaultPrint = null; PrinterDeviceBean defaultPrint;
//獲取通用打印配置,不同的打印 //獲取通用打印配置,不同的打印
if (type == 5 || type == 7) { if (type == PRINT_OTHER_ORDER || type == PRINT_OTHER_CLOSING) {
//外賣的通用打印配置 //外賣的通用打印配置
printCurrencyBean = mPresenter.getPrintCurrencyBeanByType(this, 2); printCurrencyBean = mPresenter.getPrintCurrencyBeanByType(this, PRINT_BILL);
} }
// else if (type == 0 || type == 1 || type == 2) { // else if (type == 0 || type == 1 || type == 2) {
// //堂食的通用打印配置 // //堂食的通用打印配置
// printCurrencyBean = mPresenter.getPrintCurrencyBeanByType(this, 1); // printCurrencyBean = mPresenter.getPrintCurrencyBeanByType(this, 1);
// } // }
else { else {
printCurrencyBean = mPresenter.getPrintCurrencyBeanByType(this, 1); printCurrencyBean = mPresenter.getPrintCurrencyBeanByType(this, PRINT_SLIP);
} }
//獲取打印機列表 //獲取打印機列表
printerDeviceBeans = mPresenter.getAllPrintList(this); printerDeviceBeans = mPresenter.getAllPrintList(this);
...@@ -165,10 +171,11 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print ...@@ -165,10 +171,11 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
//如果是打印測試 //如果是打印測試
defaultPrint = CCUtil.getNavigateParam(this, "deviceBean", null); defaultPrint = CCUtil.getNavigateParam(this, "deviceBean", null);
} else { } else {
// 獲取默認打印機,如果用戶沒有配置默認打印機,就取最近使用的一個. // 獲取默認打印機,如果用戶沒有配置默認打印機,就取最近使用的一個.
// 如果沒有最近使用的打印機,並且當前餐廳只有一台打印機,就用這一台打印機打印 // 如果沒有最近使用的打印機,並且當前餐廳只有一台打印機,就用這一台打印機打印
defaultPrint = mPresenter.getDefaultPrintInList(printerDeviceBeans, (String) SPUtils.get("defaultPrint", "")); defaultPrint = mPresenter.getDefaultPrintInList(printerDeviceBeans, (String) SPUtils.get("defaultPrint", ""));
} }
//廚房單
if (type == PrintConstans.PRINT_KITCHEN) { if (type == PrintConstans.PRINT_KITCHEN) {
List<PrjBean.DataBean.Bean> printDatas = CCUtil.getNavigateParam(this, "prjBeans", null); List<PrjBean.DataBean.Bean> printDatas = CCUtil.getNavigateParam(this, "prjBeans", null);
Map<String, List<PrjBean.DataBean.Bean>> prjMap = PrintPrjKitchen.getPrjMap(); Map<String, List<PrjBean.DataBean.Bean>> prjMap = PrintPrjKitchen.getPrjMap();
...@@ -252,9 +259,8 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print ...@@ -252,9 +259,8 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
if (isShowDialog) { if (isShowDialog) {
initDialog(); initDialog();
} }
Map<String, List<Bitmap>> listMap = null; Map<String, List<Bitmap>> listMap;
List<Bitmap> zoomBitmaps = null; List<Bitmap> zoomBitmaps = null;
String[] BBPosPrintDatas = null; String[] BBPosPrintDatas = null;
if (defaultPrint.getPrinterDeviceType() == PrinterDeviceBean.PRINT_LOCAL && PrintConstans.PRINT_MODEL_WISEPOS.contains(Build.MODEL)) { if (defaultPrint.getPrinterDeviceType() == PrinterDeviceBean.PRINT_LOCAL && PrintConstans.PRINT_MODEL_WISEPOS.contains(Build.MODEL)) {
//本機打印並且是BBPOS //本機打印並且是BBPOS
......
package com.gingersoft.gsa.cloud.scan;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.gingersoft.gsa.cloud.scan", appContext.getPackageName());
}
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.scan;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}
\ No newline at end of file
...@@ -4,24 +4,11 @@ ...@@ -4,24 +4,11 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<!--相机权限--> <!--相机权限-->
<uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.CAMERA" />
<application android:networkSecurityConfig="@xml/network_android"> <application android:networkSecurityConfig="@xml/network_android">
<activity android:name=".mvp.ui.activity.SupplyChainMainActivity" /> <activity android:name=".mvp.ui.activity.SupplyChainMainActivity" />
<activity
android:name=".mvp.ui.activity.SupplyChainMainActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data <meta-data
android:name="com.gingersoft.gsa.cloud.common.config.globalconfig.GlobalConfiguration" android:name="com.gingersoft.gsa.cloud.common.config.globalconfig.GlobalConfiguration"
......
...@@ -38,7 +38,7 @@ public class ConfirmOrderBean { ...@@ -38,7 +38,7 @@ public class ConfirmOrderBean {
private String remarks; private String remarks;
} }
public static PurchaseOrder conversionPurchaseOrder(PurchaseFoodListVosBean cartFood) { public static PurchaseOrder conversionPurchaseOrder(PurchaseFoodBean cartFood) {
PurchaseOrder purchaseOrder = new PurchaseOrder(); PurchaseOrder purchaseOrder = new PurchaseOrder();
purchaseOrder.setSupplierId(cartFood.getSupplierId()); purchaseOrder.setSupplierId(cartFood.getSupplierId());
purchaseOrder.setSupplierName(cartFood.getSupplierName()); purchaseOrder.setSupplierName(cartFood.getSupplierName());
...@@ -58,7 +58,7 @@ public class ConfirmOrderBean { ...@@ -58,7 +58,7 @@ public class ConfirmOrderBean {
private int orderId; private int orderId;
} }
public static PurchaseOrderDetails conversionPurchaseOrderDetails(PurchaseFoodListVosBean cartFood) { public static PurchaseOrderDetails conversionPurchaseOrderDetails(PurchaseFoodBean cartFood) {
PurchaseOrderDetails purchaseOrderDetails = new PurchaseOrderDetails(); PurchaseOrderDetails purchaseOrderDetails = new PurchaseOrderDetails();
purchaseOrderDetails.setPurchaseFoodId(cartFood.getId()); purchaseOrderDetails.setPurchaseFoodId(cartFood.getId());
purchaseOrderDetails.setFoodQuantity(cartFood.getFoodQuantity()); purchaseOrderDetails.setFoodQuantity(cartFood.getFoodQuantity());
......
package com.gingersoft.supply_chain.mvp.bean; package com.gingersoft.supply_chain.mvp.bean;
import java.io.Serializable;
import lombok.Data; import lombok.Data;
/** /**
...@@ -10,7 +12,7 @@ import lombok.Data; ...@@ -10,7 +12,7 @@ import lombok.Data;
* Use: * Use:
*/ */
@Data @Data
public class DeputyUnitBean { public class DeputyUnitBean implements Serializable {
/** /**
* 品牌id * 品牌id
*/ */
......
...@@ -16,6 +16,6 @@ public class FoodByCategoryResultBean { ...@@ -16,6 +16,6 @@ public class FoodByCategoryResultBean {
private boolean success; private boolean success;
private long sysTime; private long sysTime;
private String errMsg; private String errMsg;
private List<PurchaseFoodListVosBean> data; private List<PurchaseFoodBean> data;
} }
...@@ -26,6 +26,6 @@ public class FoodListInfoBean { ...@@ -26,6 +26,6 @@ public class FoodListInfoBean {
private String supplierName; private String supplierName;
private long createTime; private long createTime;
//食材集合 //食材集合
private List<PurchaseFoodListVosBean> purchaseFoodListVOS; private List<PurchaseFoodBean> purchaseFoodListVOS;
} }
} }
package com.gingersoft.supply_chain.mvp.bean;
import lombok.Data;
/**
* @author 宇航.
* User: admin
* Date: 2020/12/31
* Time: 10:25
* Use:
*/
@Data
public class MsgConfigBean {
private int uid;
private int orderId;
private int type;
private String configText;
private long createTime;
private long updateTime;
private int updateUid;
}
...@@ -15,30 +15,38 @@ import lombok.Data; ...@@ -15,30 +15,38 @@ import lombok.Data;
* Use:食材信息 * Use:食材信息
*/ */
@Data @Data
public class PurchaseFoodListVosBean implements Serializable { public class PurchaseFoodBean implements Serializable {
private static final long serialVersionUID = 7084280906070243339L; private static final long serialVersionUID = 7084280906070243339L;
private int id; private int id;
private String supplierName; private String supplierName;
private String images; private String images;
private String foodNo; private String foodNo;
private String name; private String name;
/**
* 單價
*/
private double unitPrice; private double unitPrice;
/**
* 分類名
*/
private String foodCategoryName; private String foodCategoryName;
private String remarks; private String remarks;
private int quantityStarts; private int quantityStarts;
private int quantityEnd; private int quantityEnd;
private int type; /**
private String unitContent; * 包裝描述:這個字段有值,顯示在採購列表,沒有值,採購列表顯示基本單位
*/
private String packingDescription;
private long createTime; private long createTime;
private int foodQuantity; private int foodQuantity;
/**
* 最低採購金額,食品列表用
*/
private double minimumAmount; private double minimumAmount;
private String address;
/** /**
* 是否審核 * 採購商地址
*/ */
private boolean reviews; private String address;
/** /**
* 分類id * 分類id
*/ */
...@@ -60,16 +68,33 @@ public class PurchaseFoodListVosBean implements Serializable { ...@@ -60,16 +68,33 @@ public class PurchaseFoodListVosBean implements Serializable {
private int restaurantId; private int restaurantId;
private int brandId; private int brandId;
private InventoryAlarm inventoryAlarm; private InventoryAlarm inventoryAlarm;
/**
* 庫存預警 模塊
*/
@Data @Data
public static class InventoryAlarm { public static class InventoryAlarm {
//食品id /**
private int id; * 是否審核 0否 1是
//庫存預警,單位id */
private int foodUnitId; private int reviews;
//最低庫存 /**
private int minimumImventory; * 最低庫存
*/
private int minimumInventory;
/**
* 保質期
*/
private int shelfLife;
/**
* 保質期預警天數
*/
private int warningDays;
} }
//包裝規格
/**
* 副單位
*/
private List<DeputyUnitBean> deputyUnitBeans; private List<DeputyUnitBean> deputyUnitBeans;
public boolean isChecked() { public boolean isChecked() {
......
...@@ -124,6 +124,9 @@ public class SupplierInfoBean implements Serializable { ...@@ -124,6 +124,9 @@ public class SupplierInfoBean implements Serializable {
} }
} }
public SupplierContacts() {
}
public SupplierContacts(String configText, int type, boolean isDefault) { public SupplierContacts(String configText, int type, boolean isDefault) {
this.configText = configText; this.configText = configText;
this.type = type; this.type = type;
......
package com.gingersoft.supply_chain.mvp.content; package com.gingersoft.supply_chain.mvp.content;
import android.util.Log; import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodListVosBean;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -20,7 +18,7 @@ public class SupplyShoppingCart extends Observable { ...@@ -20,7 +18,7 @@ public class SupplyShoppingCart extends Observable {
* key為食品id * key為食品id
* value為食品信息 * value為食品信息
*/ */
private static List<PurchaseFoodListVosBean> cartFoods; private static List<PurchaseFoodBean> cartFoods;
private static SupplyShoppingCart shoppingCart; private static SupplyShoppingCart shoppingCart;
...@@ -33,7 +31,7 @@ public class SupplyShoppingCart extends Observable { ...@@ -33,7 +31,7 @@ public class SupplyShoppingCart extends Observable {
return shoppingCart; return shoppingCart;
} }
public List<PurchaseFoodListVosBean> getCartFoods() { public List<PurchaseFoodBean> getCartFoods() {
if (cartFoods == null) { if (cartFoods == null) {
cartFoods = new ArrayList<>(); cartFoods = new ArrayList<>();
} }
...@@ -44,7 +42,7 @@ public class SupplyShoppingCart extends Observable { ...@@ -44,7 +42,7 @@ public class SupplyShoppingCart extends Observable {
return cartFoods; return cartFoods;
} }
public void setCartFoods(List<PurchaseFoodListVosBean> cartFoods) { public void setCartFoods(List<PurchaseFoodBean> cartFoods) {
SupplyShoppingCart.cartFoods = cartFoods; SupplyShoppingCart.cartFoods = cartFoods;
} }
} }
...@@ -5,7 +5,7 @@ import com.gingersoft.gsa.cloud.ui.bean.view.CategoryBean; ...@@ -5,7 +5,7 @@ import com.gingersoft.gsa.cloud.ui.bean.view.CategoryBean;
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.PurchaseFoodListVosBean; import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import com.jess.arms.mvp.IModel; import com.jess.arms.mvp.IModel;
import com.jess.arms.mvp.IView; import com.jess.arms.mvp.IView;
...@@ -33,7 +33,7 @@ public interface FoodIngredientsContract { ...@@ -33,7 +33,7 @@ public interface FoodIngredientsContract {
interface View extends IView { interface View extends IView {
void loadLeftSupplierInfo(List<CategoryBean> categoryBeans); void loadLeftSupplierInfo(List<CategoryBean> categoryBeans);
void loadRightFoodIngredients(List<PurchaseFoodListVosBean> purchaseFoodListVOS); void loadRightFoodIngredients(List<PurchaseFoodBean> purchaseFoodListVOS);
/** /**
* 刪除食品成功回調 * 刪除食品成功回調
......
...@@ -26,9 +26,15 @@ import okhttp3.RequestBody; ...@@ -26,9 +26,15 @@ import okhttp3.RequestBody;
public interface SendMsgContract { public interface SendMsgContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息 //对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView { interface View extends IView {
void loadQrCode(String url); // void loadQrCode(String url);
void shareThirdApp(String url, int type);
void loadSupplierList(List<SendSupplierMsgBean> sendSupplierMsgBeans); void loadSupplierList(List<SendSupplierMsgBean> sendSupplierMsgBeans);
/**
* 發送成功,切換到下一個供應商並選中默認發送方式
*/
void sendSuccess();
} }
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存 //Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
......
...@@ -2,7 +2,7 @@ package com.gingersoft.supply_chain.mvp.contract; ...@@ -2,7 +2,7 @@ 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.ConfirmOrderBean; import com.gingersoft.supply_chain.mvp.bean.ConfirmOrderBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodListVosBean; import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import com.jess.arms.mvp.IModel; import com.jess.arms.mvp.IModel;
import com.jess.arms.mvp.IView; import com.jess.arms.mvp.IView;
...@@ -27,7 +27,7 @@ import okhttp3.RequestBody; ...@@ -27,7 +27,7 @@ import okhttp3.RequestBody;
public interface ShoppingCatContract { public interface ShoppingCatContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息 //对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView { interface View extends IView {
void loadAdapter(List<List<PurchaseFoodListVosBean>> supplierFoods); void loadAdapter(List<List<PurchaseFoodBean>> supplierFoods);
void setTotalInfo(int typeTotal, double totalPrice); void setTotalInfo(int typeTotal, double totalPrice);
......
...@@ -8,7 +8,7 @@ import com.gingersoft.gsa.cloud.common.utils.MoneyUtil; ...@@ -8,7 +8,7 @@ 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;
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.ConfirmOrderBean; import com.gingersoft.supply_chain.mvp.bean.ConfirmOrderBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodListVosBean; 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.ConfirmOrderContract; import com.gingersoft.supply_chain.mvp.contract.ConfirmOrderContract;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
...@@ -74,7 +74,7 @@ public class ConfirmOrderPresenter extends BasePresenter<ConfirmOrderContract.Mo ...@@ -74,7 +74,7 @@ public class ConfirmOrderPresenter extends BasePresenter<ConfirmOrderContract.Mo
public void organizeShopCartData() { public void organizeShopCartData() {
Map<Integer, ConfirmOrderBean> listMap = new HashMap<>(4); Map<Integer, ConfirmOrderBean> listMap = new HashMap<>(4);
for (PurchaseFoodListVosBean cartFood : SupplyShoppingCart.getInstance().getCartFoods()) { for (PurchaseFoodBean cartFood : SupplyShoppingCart.getInstance().getCartFoods()) {
//計算總價 //計算總價
if (cartFood.isChecked()) { if (cartFood.isChecked()) {
ConfirmOrderBean confirmOrderBean = listMap.get(cartFood.getSupplierId()); ConfirmOrderBean confirmOrderBean = listMap.get(cartFood.getSupplierId());
...@@ -129,7 +129,7 @@ public class ConfirmOrderPresenter extends BasePresenter<ConfirmOrderContract.Mo ...@@ -129,7 +129,7 @@ public class ConfirmOrderPresenter extends BasePresenter<ConfirmOrderContract.Mo
purchaseOrders.add(confirmOrderBean.getPurchaseOrder()); purchaseOrders.add(confirmOrderBean.getPurchaseOrder());
} }
//訂單添加成功,將購物車中這些食品移除 //訂單添加成功,將購物車中這些食品移除
Iterator<PurchaseFoodListVosBean> iterator = SupplyShoppingCart.getInstance().getCartFoods().iterator(); Iterator<PurchaseFoodBean> iterator = SupplyShoppingCart.getInstance().getCartFoods().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
if (iterator.next().isChecked()) { if (iterator.next().isChecked()) {
iterator.remove(); iterator.remove();
......
...@@ -10,7 +10,7 @@ import com.gingersoft.gsa.cloud.ui.bean.view.CategoryBean; ...@@ -10,7 +10,7 @@ import com.gingersoft.gsa.cloud.ui.bean.view.CategoryBean;
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.PurchaseFoodListVosBean; import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import com.gingersoft.supply_chain.mvp.content.Constant; 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;
...@@ -63,7 +63,7 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr ...@@ -63,7 +63,7 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr
* 集合是對應的食品 * 集合是對應的食品
* 如果通過在map中有食品,就不用再次調用接口 * 如果通過在map中有食品,就不用再次調用接口
*/ */
private Map<Integer, List<PurchaseFoodListVosBean>> supplierFoodsMap; private Map<Integer, List<PurchaseFoodBean>> supplierFoodsMap;
/** /**
* 分類數據,之後通過分類獲取對應下面的食品 * 分類數據,之後通過分類獲取對應下面的食品
*/ */
...@@ -141,12 +141,12 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr ...@@ -141,12 +141,12 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr
* *
* @param purchaseFoodListVOS * @param purchaseFoodListVOS
*/ */
private int setFoodCount(List<PurchaseFoodListVosBean> purchaseFoodListVOS) { private int setFoodCount(List<PurchaseFoodBean> purchaseFoodListVOS) {
//統計當前食品集合中有多少個被選中 //統計當前食品集合中有多少個被選中
int totalCount = 0; int totalCount = 0;
for (PurchaseFoodListVosBean cartFood : SupplyShoppingCart.getInstance().getCartFoods()) { for (PurchaseFoodBean cartFood : SupplyShoppingCart.getInstance().getCartFoods()) {
//將購物車中的食品數量同步到當前數據中 //將購物車中的食品數量同步到當前數據中
for (PurchaseFoodListVosBean purchaseFoodListVO : purchaseFoodListVOS) { for (PurchaseFoodBean purchaseFoodListVO : purchaseFoodListVOS) {
if (cartFood.getId() == purchaseFoodListVO.getId()) { if (cartFood.getId() == purchaseFoodListVO.getId()) {
//購物車裡的食品id和當前的食品id一樣,則將購物車中的食品數量賦值給當前食品 //購物車裡的食品id和當前的食品id一樣,則將購物車中的食品數量賦值給當前食品
purchaseFoodListVO.setFoodQuantity(cartFood.getFoodQuantity()); purchaseFoodListVO.setFoodQuantity(cartFood.getFoodQuantity());
...@@ -183,7 +183,7 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr ...@@ -183,7 +183,7 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr
@Override @Override
public void onNext(@NonNull BaseResult info) { public void onNext(@NonNull BaseResult info) {
if (info.isSuccess() && info.getData() != null) { if (info.isSuccess() && info.getData() != null) {
List<PurchaseFoodListVosBean> purchaseFoodListVOS = JsonUtils.parseArray(info.getData(), PurchaseFoodListVosBean.class); List<PurchaseFoodBean> purchaseFoodListVOS = JsonUtils.parseArray(info.getData(), PurchaseFoodBean.class);
if (purchaseFoodListVOS == null) { if (purchaseFoodListVOS == null) {
supplierFoodsMap.put(supplierId, new ArrayList<>()); supplierFoodsMap.put(supplierId, new ArrayList<>());
} else { } else {
...@@ -200,9 +200,9 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr ...@@ -200,9 +200,9 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr
if (supplierFoodsMap == null) { if (supplierFoodsMap == null) {
supplierFoodsMap = new HashMap<>(5); supplierFoodsMap = new HashMap<>(5);
} }
List<PurchaseFoodListVosBean> purchaseFoodListVOSBeans = supplierFoodsMap.get(supplierId); List<PurchaseFoodBean> purchaseFoodBeans = supplierFoodsMap.get(supplierId);
if (purchaseFoodListVOSBeans != null && purchaseFoodListVOSBeans.size() > 0) { if (purchaseFoodBeans != null && purchaseFoodBeans.size() > 0) {
mRootView.loadRightFoodIngredients(purchaseFoodListVOSBeans); mRootView.loadRightFoodIngredients(purchaseFoodBeans);
} else { } else {
loadFoodsBySupplierId(supplierId); loadFoodsBySupplierId(supplierId);
} }
...@@ -213,14 +213,14 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr ...@@ -213,14 +213,14 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr
* *
* @param integerMap 存放食品id和數量的map * @param integerMap 存放食品id和數量的map
*/ */
public void getSelectFood(Map<Integer, PurchaseFoodListVosBean> integerMap) { public void getSelectFood(Map<Integer, PurchaseFoodBean> integerMap) {
for (PurchaseFoodListVosBean purchaseFoodListVosBean : integerMap.values()) { for (PurchaseFoodBean purchaseFoodBean : integerMap.values()) {
if (purchaseFoodListVosBean.getFoodQuantity() <= 0) { if (purchaseFoodBean.getFoodQuantity() <= 0) {
integerMap.remove(purchaseFoodListVosBean); integerMap.remove(purchaseFoodBean);
} }
} }
//把購物車的食品取出來 //把購物車的食品取出來
List<PurchaseFoodListVosBean> cartFoods = SupplyShoppingCart.getInstance().getCartFoods(); List<PurchaseFoodBean> cartFoods = SupplyShoppingCart.getInstance().getCartFoods();
//清空 //清空
cartFoods.clear(); cartFoods.clear();
//將本次選擇的添加進去 //將本次選擇的添加進去
...@@ -230,14 +230,14 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr ...@@ -230,14 +230,14 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr
/** /**
* 刪除食品 * 刪除食品
* *
* @param purchaseFoodListVosBean * @param purchaseFoodBean
* @param position * @param position
*/ */
public void deleteFood(PurchaseFoodListVosBean purchaseFoodListVosBean, int position) { public void deleteFood(PurchaseFoodBean purchaseFoodBean, int position) {
purchaseFoodListVosBean.setDeletes(Constant.DELETE); purchaseFoodBean.setDeletes(Constant.DELETE);
purchaseFoodListVosBean.setRestaurantId(ResturantInfoManager.newInstance().getRestaurantId()); purchaseFoodBean.setRestaurantId(ResturantInfoManager.newInstance().getRestaurantId());
purchaseFoodListVosBean.setBrandId(ResturantInfoManager.newInstance().getBrandId()); purchaseFoodBean.setBrandId(ResturantInfoManager.newInstance().getBrandId());
mModel.updateFood(RequestBody.create(MediaType.parse("application/json"), JsonUtils.toJson(purchaseFoodListVosBean))) mModel.updateFood(RequestBody.create(MediaType.parse("application/json"), JsonUtils.toJson(purchaseFoodBean)))
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("刪除中...")) .doOnSubscribe(disposable -> mRootView.showLoading("刪除中..."))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
......
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 android.os.Bundle;
import com.gingersoft.gsa.cloud.common.bean.BaseResult; import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.core.restaurant.ResturantInfoManager; import com.gingersoft.gsa.cloud.common.core.restaurant.ResturantInfoManager;
...@@ -9,8 +9,7 @@ import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils; ...@@ -9,8 +9,7 @@ import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.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.bean.PurchaseFoodListVosBean; import com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodUnitPageFragment;
import com.gingersoft.supply_chain.mvp.content.Constant;
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,8 +19,6 @@ import io.reactivex.android.schedulers.AndroidSchedulers; ...@@ -20,8 +19,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.MediaType;
import okhttp3.RequestBody;
import javax.inject.Inject; import javax.inject.Inject;
...@@ -61,6 +58,16 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo ...@@ -61,6 +58,16 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo
* 副單位 * 副單位
*/ */
private List<DeputyUnitBean> deputyUnitBeans; private List<DeputyUnitBean> deputyUnitBeans;
/**
* 是修改還是新增
* true:修改
* false:新增
*/
private boolean isUpdate = false;
/**
* 基本單位名稱
*/
private String basicUnitName;
@Inject @Inject
public FoodUnitPagePresenter(FoodUnitPageContract.Model model, FoodUnitPageContract.View rootView) { public FoodUnitPagePresenter(FoodUnitPageContract.Model model, FoodUnitPageContract.View rootView) {
...@@ -76,6 +83,18 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo ...@@ -76,6 +83,18 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo
this.mApplication = null; this.mApplication = null;
} }
public void initData(Bundle arguments) {
if (arguments != null) {
basicUnitName = arguments.getString(FoodUnitPageFragment.BASIC_UNIT_KEY);
deputyUnitBeans = (List<DeputyUnitBean>) arguments.getSerializable(FoodUnitPageFragment.DEPUTY_UNIT_KEY);
if (TextUtil.isNotEmptyOrNullOrUndefined(basicUnitName)) {
isUpdate = true;
} else {
isUpdate = false;
}
}
}
public void getDeputyUnitList() { public void getDeputyUnitList() {
mModel.getDeputyUnitList(ResturantInfoManager.newInstance().getBrandId(), ResturantInfoManager.newInstance().getRestaurantId()) mModel.getDeputyUnitList(ResturantInfoManager.newInstance().getBrandId(), ResturantInfoManager.newInstance().getRestaurantId())
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
......
...@@ -7,9 +7,11 @@ import com.gingersoft.gsa.cloud.common.utils.JsonUtils; ...@@ -7,9 +7,11 @@ 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.ConfirmOrderBean; import com.gingersoft.supply_chain.mvp.bean.ConfirmOrderBean;
import com.gingersoft.supply_chain.mvp.bean.MsgConfigBean;
import com.gingersoft.supply_chain.mvp.bean.SendSupplierMsgBean; import com.gingersoft.supply_chain.mvp.bean.SendSupplierMsgBean;
import com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean; import com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean;
import com.gingersoft.supply_chain.mvp.contract.SendMsgContract; import com.gingersoft.supply_chain.mvp.contract.SendMsgContract;
import com.google.gson.Gson;
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;
import com.jess.arms.integration.AppManager; import com.jess.arms.integration.AppManager;
...@@ -79,12 +81,12 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM ...@@ -79,12 +81,12 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM
public void getPurchaseOrderQrCode(String orderId) { public void getPurchaseOrderQrCode(String orderId) {
if (TextUtil.isNotEmptyOrNullOrUndefined(qrCodeMap.get(orderId))) { if (TextUtil.isNotEmptyOrNullOrUndefined(qrCodeMap.get(orderId))) {
mRootView.loadQrCode(qrCodeMap.get(orderId)); // mRootView.loadQrCode(qrCodeMap.get(orderId));
return; return;
} }
mModel.getPurchaseOrderQrCode(orderId) mModel.getPurchaseOrderQrCode(orderId)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("獲取...")) .doOnSubscribe(disposable -> mRootView.showLoading("獲取訂單內容..."))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -94,13 +96,13 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM ...@@ -94,13 +96,13 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM
public void onNext(@NonNull BaseResult info) { public void onNext(@NonNull BaseResult info) {
if (info.isSuccess() && info.getData() != null) { if (info.isSuccess() && info.getData() != null) {
qrCodeMap.put(orderId, info.getData().toString()); qrCodeMap.put(orderId, info.getData().toString());
mRootView.loadQrCode(qrCodeMap.get(orderId)); // mRootView.loadQrCode(qrCodeMap.get(orderId));
} }
} }
}); });
} }
class PurchaseMsgBean { static class PurchaseMsgBean {
private int orderId; private int orderId;
private int type; private int type;
private String configText; private String configText;
...@@ -122,29 +124,23 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM ...@@ -122,29 +124,23 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM
mRootView.showMessage("當前供應商沒有發送方式"); mRootView.showMessage("當前供應商沒有發送方式");
return; return;
} }
if (checkPosition > supplierContacts.size()) { if (checkPosition >= supplierContacts.size()) {
mRootView.showMessage("請重新選擇供應商的發送方式"); mRootView.showMessage("請重新選擇供應商的發送方式");
return; return;
} }
int sendType = supplierContacts.get(checkPosition).getType(); int sendType = supplierContacts.get(checkPosition).getType();
if (sendType == Whatsapp) { PurchaseMsgBean purchaseMsgBean = new PurchaseMsgBean();
purchaseMsgBean.orderId = sendSupplierMsgBean.getOrderId();
} else if (sendType == WeChat) { purchaseMsgBean.type = sendType;
purchaseMsgBean.configText = supplierContacts.get(checkPosition).getConfigText();
} else if (sendType == Line) { if (qrCodeMap.get(purchaseMsgBean.orderId + "") != null) {
sendMsgByType(sendType, purchaseMsgBean);
} else if (sendType == Kakao_Talk) {
} else { } else {
PurchaseMsgBean purchaseMsgBean = new PurchaseMsgBean(); sendMsgByOrderIdAndType(purchaseMsgBean, sendType);
purchaseMsgBean.orderId = sendSupplierMsgBean.getOrderId();
purchaseMsgBean.type = sendType;
sendMsgByOrderIdAndType(purchaseMsgBean);
} }
} }
public void sendMsgByOrderIdAndType(PurchaseMsgBean purchaseMsgBean) { public void sendMsgByOrderIdAndType(PurchaseMsgBean purchaseMsgBean, int sendType) {
//configText
mModel.senMsg(RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(purchaseMsgBean))) mModel.senMsg(RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(purchaseMsgBean)))
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("正在發送...")) .doOnSubscribe(disposable -> mRootView.showLoading("正在發送..."))
...@@ -156,12 +152,45 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM ...@@ -156,12 +152,45 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM
@Override @Override
public void onNext(@NonNull BaseResult info) { public void onNext(@NonNull BaseResult info) {
if (info.isSuccess() && info.getData() != null) { if (info.isSuccess() && info.getData() != null) {
MsgConfigBean msgConfigBean = GsonUtils.GsonToBean(info.getData(), MsgConfigBean.class);
qrCodeMap.put(purchaseMsgBean.orderId + "", msgConfigBean.getConfigText());
if (sendType == Whatsapp) {
mRootView.shareThirdApp(qrCodeMap.get(purchaseMsgBean.orderId + ""), Whatsapp);
} else if (sendType == WeChat) {
mRootView.shareThirdApp(qrCodeMap.get(purchaseMsgBean.orderId + ""), WeChat);
} else if (sendType == Line) {
mRootView.shareThirdApp(qrCodeMap.get(purchaseMsgBean.orderId + ""), Line);
} else if (sendType == Kakao_Talk) {
mRootView.shareThirdApp(qrCodeMap.get(purchaseMsgBean.orderId + ""), Kakao_Talk);
}
mRootView.sendSuccess();
} else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg());
} else {
mRootView.showMessage("發送失敗,請切換發送方式重試");
} }
} }
}); });
} }
private void sendMsgByType(int sendType, PurchaseMsgBean purchaseMsgBean) {
if (sendType == Whatsapp) {
mRootView.shareThirdApp(qrCodeMap.get(purchaseMsgBean.orderId + ""), Whatsapp);
mRootView.sendSuccess();
} else if (sendType == WeChat) {
mRootView.shareThirdApp(qrCodeMap.get(purchaseMsgBean.orderId + ""), WeChat);
mRootView.sendSuccess();
} else if (sendType == Line) {
mRootView.shareThirdApp(qrCodeMap.get(purchaseMsgBean.orderId + ""), Line);
mRootView.sendSuccess();
} else if (sendType == Kakao_Talk) {
mRootView.shareThirdApp(qrCodeMap.get(purchaseMsgBean.orderId + ""), Kakao_Talk);
mRootView.sendSuccess();
} else {
sendMsgByOrderIdAndType(purchaseMsgBean, sendType);
}
}
public void getSupplierListByOrders(List<ConfirmOrderBean.PurchaseOrder> purchaseOrders) { public void getSupplierListByOrders(List<ConfirmOrderBean.PurchaseOrder> purchaseOrders) {
//將訂單信息轉為用於顯示的供應商信息 //將訂單信息轉為用於顯示的供應商信息
if (purchaseOrders != null) { if (purchaseOrders != null) {
...@@ -188,15 +217,19 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM ...@@ -188,15 +217,19 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM
*/ */
private int currentSelectedSupplier; private int currentSelectedSupplier;
public int getCurrentSelectedSupplier() {
return currentSelectedSupplier;
}
/** /**
* 獲取供應商聯繫方式 * 獲取供應商聯繫方式
* *
* @param supplierIndex 供應商在集合中的下標,方便將聯繫方式插入到集合中 * @param supplierIndex 供應商在集合中的下標,方便將聯繫方式插入到集合中
*/ */
public void getContactsBySupplier(int supplierIndex) { public void getContactsBySupplier(int supplierIndex) {
currentSelectedSupplier = supplierIndex;
String supplierId; String supplierId;
if (sendSupplierMsgBeans != null && sendSupplierMsgBeans.size() > supplierIndex) { if (sendSupplierMsgBeans != null && sendSupplierMsgBeans.size() > supplierIndex) {
currentSelectedSupplier = supplierIndex;
supplierId = sendSupplierMsgBeans.get(supplierIndex).getId() + ""; supplierId = sendSupplierMsgBeans.get(supplierIndex).getId() + "";
List<SupplierInfoBean.SupplierContacts> supplierContacts = sendSupplierMsgBeans.get(supplierIndex).getSupplierContacts(); List<SupplierInfoBean.SupplierContacts> supplierContacts = sendSupplierMsgBeans.get(supplierIndex).getSupplierContacts();
for (SendSupplierMsgBean sendSupplierMsgBean : sendSupplierMsgBeans) { for (SendSupplierMsgBean sendSupplierMsgBean : sendSupplierMsgBeans) {
...@@ -207,13 +240,15 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM ...@@ -207,13 +240,15 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM
//如果已有聯繫方式,就不用調用接口 //如果已有聯繫方式,就不用調用接口
if (supplierContacts.size() <= 0) { if (supplierContacts.size() <= 0) {
mRootView.showMessage("當前供應商沒有聯繫方式"); mRootView.showMessage("當前供應商沒有聯繫方式");
mRootView.loadSupplierList(sendSupplierMsgBeans);
return; return;
} else { } else {
// getPurchaseOrderQrCode(sendSupplierMsgBeans.get(supplierIndex).getOrderId() + "");
mRootView.loadSupplierList(sendSupplierMsgBeans); mRootView.loadSupplierList(sendSupplierMsgBeans);
} }
} }
} else { } else {
mRootView.showMessage("未獲取到供應商聯繫方式"); // mRootView.showMessage("未獲取到供應商聯繫方式");
return; return;
} }
mModel.getSupplierContact(supplierId) mModel.getSupplierContact(supplierId)
...@@ -237,7 +272,9 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM ...@@ -237,7 +272,9 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM
} }
} }
} }
sendSupplierMsgBeans.get(supplierIndex).setSupplierContacts(supplierContacts); SendSupplierMsgBean sendSupplierMsgBean = sendSupplierMsgBeans.get(supplierIndex);
sendSupplierMsgBean.setSupplierContacts(supplierContacts);
// getPurchaseOrderQrCode(sendSupplierMsgBean.getOrderId() + "");
mRootView.loadSupplierList(sendSupplierMsgBeans); mRootView.loadSupplierList(sendSupplierMsgBeans);
} else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) { } else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg()); mRootView.showMessage(info.getErrMsg());
......
...@@ -10,10 +10,9 @@ import com.gingersoft.gsa.cloud.common.utils.JsonUtils; ...@@ -10,10 +10,9 @@ 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;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.ConfirmOrderBean; import com.gingersoft.supply_chain.mvp.bean.ConfirmOrderBean;
import com.gingersoft.supply_chain.mvp.bean.NewPurchaseOrderBean; import com.gingersoft.supply_chain.mvp.bean.NewPurchaseOrderBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodListVosBean; 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.ShoppingCatContract; import com.gingersoft.supply_chain.mvp.contract.ShoppingCatContract;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
...@@ -64,7 +63,7 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode ...@@ -64,7 +63,7 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
@Inject @Inject
AppManager mAppManager; AppManager mAppManager;
private List<List<PurchaseFoodListVosBean>> supplierFoods; private List<List<PurchaseFoodBean>> supplierFoods;
@Inject @Inject
public ShoppingCatPresenter(ShoppingCatContract.Model model, ShoppingCatContract.View rootView) { public ShoppingCatPresenter(ShoppingCatContract.Model model, ShoppingCatContract.View rootView) {
...@@ -81,16 +80,16 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode ...@@ -81,16 +80,16 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
} }
public void organizeShopCartData() { public void organizeShopCartData() {
Map<Integer, List<PurchaseFoodListVosBean>> listMap = new HashMap<>(4); Map<Integer, List<PurchaseFoodBean>> listMap = new HashMap<>(4);
double totalPrice = 0; double totalPrice = 0;
int totalTypeNumber = 0; int totalTypeNumber = 0;
for (PurchaseFoodListVosBean cartFood : SupplyShoppingCart.getInstance().getCartFoods()) { for (PurchaseFoodBean cartFood : SupplyShoppingCart.getInstance().getCartFoods()) {
//計算總價 //計算總價
if (cartFood.isChecked()) { if (cartFood.isChecked()) {
totalPrice = MoneyUtil.sum(totalPrice, MoneyUtil.priceCalculation(cartFood.getUnitPrice(), cartFood.getFoodQuantity())); totalPrice = MoneyUtil.sum(totalPrice, MoneyUtil.priceCalculation(cartFood.getUnitPrice(), cartFood.getFoodQuantity()));
totalTypeNumber++; totalTypeNumber++;
} }
List<PurchaseFoodListVosBean> foodListVosBeans = listMap.get(cartFood.getSupplierId()); List<PurchaseFoodBean> foodListVosBeans = listMap.get(cartFood.getSupplierId());
if (foodListVosBeans == null) { if (foodListVosBeans == null) {
foodListVosBeans = new ArrayList<>(); foodListVosBeans = new ArrayList<>();
foodListVosBeans.add(cartFood); foodListVosBeans.add(cartFood);
...@@ -111,10 +110,10 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode ...@@ -111,10 +110,10 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
public void calculateTotalPrice(CheckBox cbAllSelect) { public void calculateTotalPrice(CheckBox cbAllSelect) {
double totalAmount = 0; double totalAmount = 0;
int totalTypeFood = 0; int totalTypeFood = 0;
for (PurchaseFoodListVosBean purchaseFoodListVosBean : SupplyShoppingCart.getInstance().getCartFoods()) { for (PurchaseFoodBean purchaseFoodBean : SupplyShoppingCart.getInstance().getCartFoods()) {
if (purchaseFoodListVosBean.isChecked()) { if (purchaseFoodBean.isChecked()) {
totalTypeFood++; totalTypeFood++;
totalAmount = MoneyUtil.sum(totalAmount, MoneyUtil.priceCalculation(purchaseFoodListVosBean.getUnitPrice(), purchaseFoodListVosBean.getFoodQuantity())); totalAmount = MoneyUtil.sum(totalAmount, MoneyUtil.priceCalculation(purchaseFoodBean.getUnitPrice(), purchaseFoodBean.getFoodQuantity()));
} }
} }
mRootView.setTotalInfo(totalTypeFood, totalAmount); mRootView.setTotalInfo(totalTypeFood, totalAmount);
...@@ -122,19 +121,19 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode ...@@ -122,19 +121,19 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
} }
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
public void addNewPurchaseOrder(List<PurchaseFoodListVosBean> purchaseFoodListVosBeans, String remarks) { public void addNewPurchaseOrder(List<PurchaseFoodBean> purchaseFoodBeans, String remarks) {
NewPurchaseOrderBean newPurchaseOrderBean = new NewPurchaseOrderBean(); NewPurchaseOrderBean newPurchaseOrderBean = new NewPurchaseOrderBean();
newPurchaseOrderBean.setBrandId(ResturantInfoManager.newInstance().getBrandId()); newPurchaseOrderBean.setBrandId(ResturantInfoManager.newInstance().getBrandId());
newPurchaseOrderBean.setRestaurantId(ResturantInfoManager.newInstance().getRestaurantId()); newPurchaseOrderBean.setRestaurantId(ResturantInfoManager.newInstance().getRestaurantId());
double totalAmount = 0; double totalAmount = 0;
for (PurchaseFoodListVosBean purchaseFoodListVosBean : purchaseFoodListVosBeans) { for (PurchaseFoodBean purchaseFoodBean : purchaseFoodBeans) {
totalAmount = MoneyUtil.sum(totalAmount, MoneyUtil.priceCalculation(purchaseFoodListVosBean.getUnitPrice(), purchaseFoodListVosBean.getFoodQuantity())); totalAmount = MoneyUtil.sum(totalAmount, MoneyUtil.priceCalculation(purchaseFoodBean.getUnitPrice(), purchaseFoodBean.getFoodQuantity()));
} }
newPurchaseOrderBean.setTotalAmount(totalAmount); newPurchaseOrderBean.setTotalAmount(totalAmount);
newPurchaseOrderBean.setRemarks(remarks); newPurchaseOrderBean.setRemarks(remarks);
ArrayList<NewPurchaseOrderBean.PurchaseOrderDetailsBean> purchaseOrderDetailsBeans = new ArrayList<>(); ArrayList<NewPurchaseOrderBean.PurchaseOrderDetailsBean> purchaseOrderDetailsBeans = new ArrayList<>();
Observable.fromIterable(purchaseFoodListVosBeans) Observable.fromIterable(purchaseFoodBeans)
.map(purchaseFoodListVosBean -> { .map(purchaseFoodListVosBean -> {
NewPurchaseOrderBean.PurchaseOrderDetailsBean orderDetailsBean = new NewPurchaseOrderBean.PurchaseOrderDetailsBean(); NewPurchaseOrderBean.PurchaseOrderDetailsBean orderDetailsBean = new NewPurchaseOrderBean.PurchaseOrderDetailsBean();
orderDetailsBean.setFoodId(purchaseFoodListVosBean.getId()); orderDetailsBean.setFoodId(purchaseFoodListVosBean.getId());
...@@ -183,7 +182,7 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode ...@@ -183,7 +182,7 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
public List<ConfirmOrderBean> getOrganizeShopCartData() { public List<ConfirmOrderBean> getOrganizeShopCartData() {
Map<Integer, ConfirmOrderBean> listMap = new HashMap<>(4); Map<Integer, ConfirmOrderBean> listMap = new HashMap<>(4);
for (PurchaseFoodListVosBean cartFood : SupplyShoppingCart.getInstance().getCartFoods()) { for (PurchaseFoodBean cartFood : SupplyShoppingCart.getInstance().getCartFoods()) {
//計算總價 //計算總價
if (cartFood.isChecked()) { if (cartFood.isChecked()) {
ConfirmOrderBean confirmOrderBean = listMap.get(cartFood.getSupplierId()); ConfirmOrderBean confirmOrderBean = listMap.get(cartFood.getSupplierId());
...@@ -247,7 +246,7 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode ...@@ -247,7 +246,7 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
purchaseOrders.add(confirmOrderBean.getPurchaseOrder()); purchaseOrders.add(confirmOrderBean.getPurchaseOrder());
} }
//訂單添加成功,將購物車中這些食品移除 //訂單添加成功,將購物車中這些食品移除
Iterator<PurchaseFoodListVosBean> iterator = SupplyShoppingCart.getInstance().getCartFoods().iterator(); Iterator<PurchaseFoodBean> iterator = SupplyShoppingCart.getInstance().getCartFoods().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
if (iterator.next().isChecked()) { if (iterator.next().isChecked()) {
iterator.remove(); iterator.remove();
......
...@@ -99,7 +99,10 @@ public class SupplierListPresenter extends BasePresenter<SupplierListContract.Mo ...@@ -99,7 +99,10 @@ public class SupplierListPresenter extends BasePresenter<SupplierListContract.Mo
if (pageIndex == 0) { if (pageIndex == 0) {
supplierBeanList.clear(); supplierBeanList.clear();
} }
supplierBeanList.addAll(info.getData().getList()); if (info.getData() != null) {
List<SupplierInfoBean> list = info.getData().getList();
supplierBeanList.addAll(list);
}
mRootView.loadSupplierList(supplierBeanList); mRootView.loadSupplierList(supplierBeanList);
} else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) { } else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg()); mRootView.showMessage(info.getErrMsg());
......
...@@ -13,7 +13,7 @@ import com.chad.library.adapter.base.viewholder.BaseViewHolder; ...@@ -13,7 +13,7 @@ import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.gsa.cloud.common.utils.glide.GlideUtils; import com.gingersoft.gsa.cloud.common.utils.glide.GlideUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodListVosBean; import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
...@@ -23,7 +23,6 @@ import java.util.List; ...@@ -23,7 +23,6 @@ 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.Constant.PURCHASE_FOOD_MAX;
import static com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodIngredientsFragment.ADD_ORDER;
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;
...@@ -34,7 +33,7 @@ import static com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodIngredientsFr ...@@ -34,7 +33,7 @@ import static com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodIngredientsFr
* Time: 10:05 * Time: 10:05
* Use: 供應鏈食品列表 * Use: 供應鏈食品列表
*/ */
public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, FoodListAdapter.ViewHolder> { public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodBean, FoodListAdapter.ViewHolder> {
private Context context; private Context context;
/** /**
* 編輯或者下單 * 編輯或者下單
...@@ -47,9 +46,9 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, F ...@@ -47,9 +46,9 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, F
* key 為foodId * key 為foodId
* value 為 food信息 * value 為 food信息
*/ */
private Map<Integer, PurchaseFoodListVosBean> integerMap; private Map<Integer, PurchaseFoodBean> integerMap;
public FoodListAdapter(Context context, @Nullable List<PurchaseFoodListVosBean> data, int adapterType) { public FoodListAdapter(Context context, @Nullable List<PurchaseFoodBean> data, int adapterType) {
super(R.layout.item_food_ingredient, data); super(R.layout.item_food_ingredient, data);
addChildClickViewIds(R.id.iv_supplier_edit, R.id.iv_supplier_delete); addChildClickViewIds(R.id.iv_supplier_edit, R.id.iv_supplier_delete);
this.context = context; this.context = context;
...@@ -57,7 +56,7 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, F ...@@ -57,7 +56,7 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, F
integerMap = new HashMap<>(8); integerMap = new HashMap<>(8);
} }
public FoodListAdapter(int layoutId, Context context, @Nullable List<PurchaseFoodListVosBean> data, int adapterType) { public FoodListAdapter(int layoutId, Context context, @Nullable List<PurchaseFoodBean> data, int adapterType) {
super(layoutId, data); super(layoutId, data);
addChildClickViewIds(R.id.iv_supplier_edit, R.id.iv_supplier_delete, R.id.iv_order_food_delete); addChildClickViewIds(R.id.iv_supplier_edit, R.id.iv_supplier_delete, R.id.iv_order_food_delete);
this.context = context; this.context = context;
...@@ -66,17 +65,17 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, F ...@@ -66,17 +65,17 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, F
} }
@Override @Override
protected void convert(@NotNull ViewHolder viewHolder, PurchaseFoodListVosBean foodInfoBean) { protected void convert(@NotNull ViewHolder viewHolder, PurchaseFoodBean foodInfoBean) {
viewHolder.setText(R.id.tv_food_item_supplier_name, foodInfoBean.getSupplierName()); viewHolder.setText(R.id.tv_food_item_supplier_name, foodInfoBean.getSupplierName());
ImageView foodImg = viewHolder.getView(R.id.iv_food_ingredient_img); ImageView foodImg = viewHolder.getView(R.id.iv_food_ingredient_img);
if (TextUtil.isNotEmptyOrNullOrUndefined(foodInfoBean.getImages())) { if (TextUtil.isNotEmptyOrNullOrUndefined(foodInfoBean.getImages())) {
GlideUtils.display(context, foodImg, foodInfoBean.getImages()); GlideUtils.display(context, foodImg, foodInfoBean.getImages());
} else { } else {
foodImg.setVisibility(View.INVISIBLE); foodImg.setImageResource(R.drawable.img_small_default);
} }
viewHolder.setText(R.id.tv_food_item_no, foodInfoBean.getFoodNo()); viewHolder.setText(R.id.tv_food_item_no, foodInfoBean.getFoodNo());
viewHolder.setText(R.id.tv_food_item_name, foodInfoBean.getName()); viewHolder.setText(R.id.tv_food_item_name, foodInfoBean.getName());
viewHolder.setText(R.id.tv_food_item_unit, foodInfoBean.getUnitContent()); viewHolder.setText(R.id.tv_food_item_unit, foodInfoBean.getPackingDescription());
viewHolder.setText(R.id.tv_food_item_price, "$" + foodInfoBean.getUnitPrice()); viewHolder.setText(R.id.tv_food_item_price, "$" + foodInfoBean.getUnitPrice());
if (adapterType == FOOD_INGREDIENTS) { if (adapterType == FOOD_INGREDIENTS) {
viewHolder.setGone(R.id.iv_supplier_edit, false); viewHolder.setGone(R.id.iv_supplier_edit, false);
...@@ -116,9 +115,9 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, F ...@@ -116,9 +115,9 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, F
* 選中按鈕狀態切換時,將食品信息傳遞出去 * 選中按鈕狀態切換時,將食品信息傳遞出去
* *
* @param isChecked * @param isChecked
* @param purchaseFoodListVosBean * @param purchaseFoodBean
*/ */
void onChanged(boolean isChecked, PurchaseFoodListVosBean purchaseFoodListVosBean); void onChanged(boolean isChecked, PurchaseFoodBean purchaseFoodBean);
} }
...@@ -142,9 +141,9 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, F ...@@ -142,9 +141,9 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, F
* @param viewHolder * @param viewHolder
* @param foodInfoBean * @param foodInfoBean
*/ */
private void setEdit(@NotNull ViewHolder viewHolder, PurchaseFoodListVosBean foodInfoBean) { private void setEdit(@NotNull ViewHolder viewHolder, PurchaseFoodBean foodInfoBean) {
EditText editText = viewHolder.getView(R.id.ed_food_ingredient_number); EditText editText = viewHolder.getView(R.id.ed_food_ingredient_number);
PurchaseFoodListVosBean food = integerMap.get(foodInfoBean.getId()); PurchaseFoodBean food = integerMap.get(foodInfoBean.getId());
if (viewHolder.textWatcher != null) { if (viewHolder.textWatcher != null) {
editText.removeTextChangedListener(viewHolder.textWatcher); editText.removeTextChangedListener(viewHolder.textWatcher);
} }
...@@ -185,20 +184,20 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, F ...@@ -185,20 +184,20 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, F
@Override @Override
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
PurchaseFoodListVosBean purchaseFoodListVosBean = getData().get(viewHolder.getAdapterPosition()); PurchaseFoodBean purchaseFoodBean = getData().get(viewHolder.getAdapterPosition());
if (s == null || TextUtil.isEmptyOrNullOrUndefined(s.toString())) { if (s == null || TextUtil.isEmptyOrNullOrUndefined(s.toString())) {
editText.setText(String.valueOf(0)); editText.setText(String.valueOf(0));
editText.setSelection(editText.getText().length()); editText.setSelection(editText.getText().length());
if (onNumberChangeListener != null) { if (onNumberChangeListener != null) {
onNumberChangeListener.onChanged(purchaseFoodListVosBean.getId(), 0, viewHolder.getAdapterPosition()); onNumberChangeListener.onChanged(purchaseFoodBean.getId(), 0, viewHolder.getAdapterPosition());
} }
} else { } else {
purchaseFoodListVosBean.setFoodQuantity(Integer.parseInt(s.toString())); purchaseFoodBean.setFoodQuantity(Integer.parseInt(s.toString()));
if (purchaseFoodListVosBean.getFoodQuantity() > 0) { if (purchaseFoodBean.getFoodQuantity() > 0) {
integerMap.put(purchaseFoodListVosBean.getId(), purchaseFoodListVosBean); integerMap.put(purchaseFoodBean.getId(), purchaseFoodBean);
} }
if (onNumberChangeListener != null) { if (onNumberChangeListener != null) {
onNumberChangeListener.onChanged(purchaseFoodListVosBean.getId(), Integer.parseInt(s.toString()), viewHolder.getAdapterPosition()); onNumberChangeListener.onChanged(purchaseFoodBean.getId(), Integer.parseInt(s.toString()), viewHolder.getAdapterPosition());
} }
} }
} }
...@@ -211,36 +210,36 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, F ...@@ -211,36 +210,36 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, F
this.onNumberChangeListener = onNumberChangeListener; this.onNumberChangeListener = onNumberChangeListener;
} }
private void addNumber(EditText editText, PurchaseFoodListVosBean foodInfoBean) { private void addNumber(EditText editText, PurchaseFoodBean foodInfoBean) {
PurchaseFoodListVosBean purchaseFoodListVosBean = integerMap.get(foodInfoBean.getId()); PurchaseFoodBean purchaseFoodBean = integerMap.get(foodInfoBean.getId());
if (purchaseFoodListVosBean != null) { if (purchaseFoodBean != null) {
if (purchaseFoodListVosBean.getFoodQuantity() < PURCHASE_FOOD_MAX) { if (purchaseFoodBean.getFoodQuantity() < PURCHASE_FOOD_MAX) {
purchaseFoodListVosBean.setFoodQuantity(purchaseFoodListVosBean.getFoodQuantity() + 1); purchaseFoodBean.setFoodQuantity(purchaseFoodBean.getFoodQuantity() + 1);
} }
} else { } else {
foodInfoBean.setFoodQuantity(1); foodInfoBean.setFoodQuantity(1);
purchaseFoodListVosBean = foodInfoBean; purchaseFoodBean = foodInfoBean;
integerMap.put(foodInfoBean.getId(), purchaseFoodListVosBean); integerMap.put(foodInfoBean.getId(), purchaseFoodBean);
} }
editText.setText(String.valueOf(purchaseFoodListVosBean.getFoodQuantity())); editText.setText(String.valueOf(purchaseFoodBean.getFoodQuantity()));
editText.setSelection(editText.getText().length()); editText.setSelection(editText.getText().length());
} }
private void subNumber(EditText editText, PurchaseFoodListVosBean foodInfoBean) { private void subNumber(EditText editText, PurchaseFoodBean foodInfoBean) {
PurchaseFoodListVosBean purchaseFoodListVosBean = integerMap.get(foodInfoBean.getId()); PurchaseFoodBean purchaseFoodBean = integerMap.get(foodInfoBean.getId());
if (purchaseFoodListVosBean != null) { if (purchaseFoodBean != null) {
purchaseFoodListVosBean.setFoodQuantity(Math.max(purchaseFoodListVosBean.getFoodQuantity() - 1, 0)); purchaseFoodBean.setFoodQuantity(Math.max(purchaseFoodBean.getFoodQuantity() - 1, 0));
if (purchaseFoodListVosBean.getFoodQuantity() <= 0) { if (purchaseFoodBean.getFoodQuantity() <= 0) {
integerMap.remove(foodInfoBean.getId()); integerMap.remove(foodInfoBean.getId());
} }
editText.setText(String.valueOf(purchaseFoodListVosBean.getFoodQuantity())); editText.setText(String.valueOf(purchaseFoodBean.getFoodQuantity()));
editText.setSelection(editText.getText().length()); editText.setSelection(editText.getText().length());
} else { } else {
integerMap.remove(foodInfoBean.getId()); integerMap.remove(foodInfoBean.getId());
} }
} }
public Map<Integer, PurchaseFoodListVosBean> getIntegerMap() { public Map<Integer, PurchaseFoodBean> getIntegerMap() {
return integerMap; return integerMap;
} }
......
...@@ -47,14 +47,20 @@ public class SendSupplierMsgAdapter extends BaseQuickAdapter<SendSupplierMsgBean ...@@ -47,14 +47,20 @@ public class SendSupplierMsgAdapter extends BaseQuickAdapter<SendSupplierMsgBean
sendSupplierMsgBean.setCheckPosition(position); sendSupplierMsgBean.setCheckPosition(position);
}); });
rvContacts.setAdapter(contactsListAdapter); rvContacts.setAdapter(contactsListAdapter);
LinearLayout contactsLayout = viewHolder.getView(R.id.layout_send_supplier_msg_hide_show); LinearLayout contactsLayout = viewHolder.getView(R.id.layout_send_supplier_msg_hide_show);
viewHolder.setGone(R.id.layout_send_supplier_msg_hide_show, !sendSupplierMsgBean.isOpen());
viewHolder.getView(R.id.layout_open_hide_send_supplier_msg).setOnClickListener(v -> contactsLayout.setVisibility(View.GONE)); viewHolder.getView(R.id.layout_open_hide_send_supplier_msg).setOnClickListener(v -> contactsLayout.setVisibility(View.GONE));
viewHolder.getView(R.id.tv_item_send_supplier_msg_supplier_name).setOnClickListener(v -> contactsLayout.setVisibility(View.VISIBLE)); viewHolder.getView(R.id.tv_item_send_supplier_msg_supplier_name).setOnClickListener(v -> {
OnItemClickListener onItemClickListener = getOnItemClickListener();
if (onItemClickListener != null) {
onItemClickListener.onItemClick(this, v, viewHolder.getAdapterPosition());
}
contactsLayout.setVisibility(View.VISIBLE);
});
} }
public static class ContactsListAdapter extends BaseQuickAdapter<SupplierInfoBean.SupplierContacts, BaseViewHolder> { public static class ContactsListAdapter extends BaseQuickAdapter<SupplierInfoBean.SupplierContacts, BaseViewHolder> {
private int selectIndex = 0; private int selectIndex = -1;
public ContactsListAdapter(@Nullable List<SupplierInfoBean.SupplierContacts> data) { public ContactsListAdapter(@Nullable List<SupplierInfoBean.SupplierContacts> data) {
super(R.layout.item_pic_radio, data); super(R.layout.item_pic_radio, data);
...@@ -62,9 +68,17 @@ public class SendSupplierMsgAdapter extends BaseQuickAdapter<SendSupplierMsgBean ...@@ -62,9 +68,17 @@ public class SendSupplierMsgAdapter extends BaseQuickAdapter<SendSupplierMsgBean
@Override @Override
protected void convert(@NotNull BaseViewHolder viewHolder, SupplierInfoBean.SupplierContacts item) { protected void convert(@NotNull BaseViewHolder viewHolder, SupplierInfoBean.SupplierContacts item) {
RadioButton radioButton = viewHolder.getView(R.id.rb_select_dialog_list_radio); RadioButton radioButton = viewHolder.getView(R.id.rb_item_pic_radio_title_radio);
radioButton.setChecked(viewHolder.getAdapterPosition() == selectIndex); if (selectIndex == -1) {
viewHolder.setText(R.id.tv_select_dialog_list_title, SupplierInfoBean.SupplierContacts.getContractTitleByType(item.getType())); radioButton.setChecked(item.isDefault());
if (getData().size() == 1) {
selectIndex = 0;
radioButton.setChecked(true);
}
} else {
radioButton.setChecked(viewHolder.getAdapterPosition() == selectIndex);
}
viewHolder.setText(R.id.tv_item_pic_radio_title, SupplierInfoBean.SupplierContacts.getContractTitleByType(item.getType()));
viewHolder.setImageResource(R.id.iv_item_pic_radio_pic, getContractPicByType(item.getType())); viewHolder.setImageResource(R.id.iv_item_pic_radio_pic, getContractPicByType(item.getType()));
radioButton.setOnCheckedChangeListener((buttonView, isChecked) -> { radioButton.setOnCheckedChangeListener((buttonView, isChecked) -> {
if (isChecked) { if (isChecked) {
......
package com.gingersoft.supply_chain.mvp.ui.adapter; package com.gingersoft.supply_chain.mvp.ui.adapter;
import android.util.Log;
import android.widget.RadioButton; import android.widget.RadioButton;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
...@@ -35,6 +36,7 @@ public class SupplierAdapter extends BaseQuickAdapter<SupplierInfoBean, BaseView ...@@ -35,6 +36,7 @@ public class SupplierAdapter extends BaseQuickAdapter<SupplierInfoBean, BaseView
@Override @Override
protected void convert(@NotNull BaseViewHolder viewHolder, SupplierInfoBean supplierBean) { protected void convert(@NotNull BaseViewHolder viewHolder, SupplierInfoBean supplierBean) {
Log.e("eee", "供應商名:" +supplierBean.getSupplierName());
viewHolder.setText(R.id.tv_supplier_name, supplierBean.getSupplierName()); viewHolder.setText(R.id.tv_supplier_name, supplierBean.getSupplierName());
viewHolder.setText(R.id.tv_supplier_address, supplierBean.getAddress()); viewHolder.setText(R.id.tv_supplier_address, supplierBean.getAddress());
viewHolder.setText(R.id.tv_supplier_phone, supplierBean.getContactInformation()); viewHolder.setText(R.id.tv_supplier_phone, supplierBean.getContactInformation());
......
...@@ -82,16 +82,16 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr ...@@ -82,16 +82,16 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr
basicManagementFunction.add(new Function("供應商", R.drawable.ic_supplier)); basicManagementFunction.add(new Function("供應商", R.drawable.ic_supplier));
basicManagementFunction.add(new Function("食材", R.drawable.ic_food_ingredients)); basicManagementFunction.add(new Function("食材", R.drawable.ic_food_ingredients));
basicManagementFunction.add(new Function("種類", R.drawable.ic_type)); basicManagementFunction.add(new Function("種類", R.drawable.ic_type));
basicManagementFunction.add(new Function("包裝", R.drawable.ic_packing)); // basicManagementFunction.add(new Function("包裝", R.drawable.ic_packing));
purchaseFunctionBeans.add(new PurchaseFunctionBean("基礎管理", basicManagementFunction)); purchaseFunctionBeans.add(new PurchaseFunctionBean("基礎管理", basicManagementFunction));
List<Function> orderManger = new ArrayList<>(); List<Function> orderManger = new ArrayList<>();
orderManger.add(new Function("採購訂單", R.drawable.ic_purchase_order)); orderManger.add(new Function("採購訂單", R.drawable.ic_purchase_order));
purchaseFunctionBeans.add(new PurchaseFunctionBean("訂單管理", orderManger)); purchaseFunctionBeans.add(new PurchaseFunctionBean("訂單管理", orderManger));
List<Function> storage = new ArrayList<>(); // List<Function> storage = new ArrayList<>();
storage.add(new Function("入庫", R.drawable.ic_purchase_order)); // storage.add(new Function("入庫", R.drawable.ic_purchase_order));
purchaseFunctionBeans.add(new PurchaseFunctionBean("庫存管理", storage)); // purchaseFunctionBeans.add(new PurchaseFunctionBean("庫存管理", storage));
PurchaseFunctionAdapter purchaseFunctionAdapter = new PurchaseFunctionAdapter(mContext, purchaseFunctionBeans); PurchaseFunctionAdapter purchaseFunctionAdapter = new PurchaseFunctionAdapter(mContext, purchaseFunctionBeans);
purchaseFunctionAdapter.setFunctionClickListener(new OnItemClickListener() { purchaseFunctionAdapter.setFunctionClickListener(new OnItemClickListener() {
......
package com.gingersoft.supply_chain.mvp.ui.fragment.food; package com.gingersoft.supply_chain.mvp.ui.fragment.food;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
...@@ -24,7 +23,7 @@ import com.gingersoft.supply_chain.R; ...@@ -24,7 +23,7 @@ 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.DaggerFoodIngredientsComponent; import com.gingersoft.supply_chain.di.component.DaggerFoodIngredientsComponent;
import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean; import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodListVosBean; 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.FoodIngredientsContract; import com.gingersoft.supply_chain.mvp.contract.FoodIngredientsContract;
import com.gingersoft.supply_chain.mvp.presenter.FoodIngredientsPresenter; import com.gingersoft.supply_chain.mvp.presenter.FoodIngredientsPresenter;
...@@ -307,7 +306,7 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi ...@@ -307,7 +306,7 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi
* 加載右側食品數據 * 加載右側食品數據
*/ */
@Override @Override
public void loadRightFoodIngredients(List<PurchaseFoodListVosBean> purchaseFoodListVos) { public void loadRightFoodIngredients(List<PurchaseFoodBean> purchaseFoodListVos) {
if (purchaseFoodListVos == null || purchaseFoodListVos.size() <= 0) { if (purchaseFoodListVos == null || purchaseFoodListVos.size() <= 0) {
loadService.showCallback(EmptyCallback.class); loadService.showCallback(EmptyCallback.class);
return; return;
...@@ -318,9 +317,9 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi ...@@ -318,9 +317,9 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi
foodListAdapter.setList(purchaseFoodListVos); foodListAdapter.setList(purchaseFoodListVos);
} else { } else {
foodListAdapter = new FoodListAdapter(mContext, purchaseFoodListVos, pageType); foodListAdapter = new FoodListAdapter(mContext, purchaseFoodListVos, pageType);
Map<Integer, PurchaseFoodListVosBean> integerMap = foodListAdapter.getIntegerMap(); Map<Integer, PurchaseFoodBean> integerMap = foodListAdapter.getIntegerMap();
for (PurchaseFoodListVosBean purchaseFoodListVosBean : SupplyShoppingCart.getInstance().getCartFoods()) { for (PurchaseFoodBean purchaseFoodBean : SupplyShoppingCart.getInstance().getCartFoods()) {
integerMap.put(purchaseFoodListVosBean.getId(), purchaseFoodListVosBean); integerMap.put(purchaseFoodBean.getId(), purchaseFoodBean);
} }
LinearLayoutManager rightLayoutManager = new LinearLayoutManager(mContext); LinearLayoutManager rightLayoutManager = new LinearLayoutManager(mContext);
rvRightFoodIngredients.setLayoutManager(rightLayoutManager); rvRightFoodIngredients.setLayoutManager(rightLayoutManager);
...@@ -331,9 +330,9 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi ...@@ -331,9 +330,9 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi
startForResult(NewFoodIngredientsFragment.newInstance(foodListAdapter.getData().get(position)), EDIT_FOOD_REQUEST_CODE); startForResult(NewFoodIngredientsFragment.newInstance(foodListAdapter.getData().get(position)), EDIT_FOOD_REQUEST_CODE);
} else if (view.getId() == R.id.iv_supplier_delete) { } else if (view.getId() == R.id.iv_supplier_delete) {
//刪除食材 //刪除食材
PurchaseFoodListVosBean purchaseFoodListVosBean = foodListAdapter.getData().get(position); PurchaseFoodBean purchaseFoodBean = foodListAdapter.getData().get(position);
new AppDialog().showWaringDialog(mContext, "是否確認刪除" + purchaseFoodListVosBean.getName(), (view1, dialog) -> { new AppDialog().showWaringDialog(mContext, "是否確認刪除" + purchaseFoodBean.getName(), (view1, dialog) -> {
mPresenter.deleteFood(purchaseFoodListVosBean, position); mPresenter.deleteFood(purchaseFoodBean, position);
dialog.dismiss(); dialog.dismiss();
}); });
} }
......
...@@ -30,6 +30,7 @@ import com.jess.arms.di.component.AppComponent; ...@@ -30,6 +30,7 @@ import com.jess.arms.di.component.AppComponent;
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.List; import java.util.List;
import butterknife.BindView; import butterknife.BindView;
...@@ -55,8 +56,20 @@ public class FoodUnitPageFragment extends BaseSupplyChainFragment<FoodUnitPagePr ...@@ -55,8 +56,20 @@ public class FoodUnitPageFragment extends BaseSupplyChainFragment<FoodUnitPagePr
private DeputyUnitAdapter deputyUnitAdapter; private DeputyUnitAdapter deputyUnitAdapter;
public static FoodUnitPageFragment newInstance() { public final static String BASIC_UNIT_KEY = "basicUnitKey";
public final static String DEPUTY_UNIT_KEY = "deputyUnitKey";
/**
* @param basicUnit 基本單位
* @param deputyUnitBeans 副單位集合
* @return
*/
public static FoodUnitPageFragment newInstance(String basicUnit, List<DeputyUnitBean> deputyUnitBeans) {
FoodUnitPageFragment fragment = new FoodUnitPageFragment(); FoodUnitPageFragment fragment = new FoodUnitPageFragment();
Bundle bundle = new Bundle();
bundle.putSerializable(DEPUTY_UNIT_KEY, (Serializable) deputyUnitBeans);
bundle.putString(BASIC_UNIT_KEY, basicUnit);
fragment.setArguments(bundle);
return fragment; return fragment;
} }
...@@ -77,9 +90,13 @@ public class FoodUnitPageFragment extends BaseSupplyChainFragment<FoodUnitPagePr ...@@ -77,9 +90,13 @@ public class FoodUnitPageFragment extends BaseSupplyChainFragment<FoodUnitPagePr
@Override @Override
public void initData(@Nullable Bundle savedInstanceState) { public void initData(@Nullable Bundle savedInstanceState) {
initTopBar(topBar, "填寫商品單位"); mPresenter.initData(getArguments());
mPresenter.getDeputyUnitList(); // if(arguments != null){
mPresenter.loadDeputyUnit(null); // arguments.getSerializable(DEPUTY_UNIT_KEY);
// }
// initTopBar(topBar, "填寫商品單位");
// mPresenter.getDeputyUnitList();
// mPresenter.loadDeputyUnit(null);
} }
@OnClick({R2.id.tv_add_deputy}) @OnClick({R2.id.tv_add_deputy})
......
...@@ -36,7 +36,7 @@ import com.gingersoft.supply_chain.R; ...@@ -36,7 +36,7 @@ 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.DaggerNewFoodIngredientsComponent; import com.gingersoft.supply_chain.di.component.DaggerNewFoodIngredientsComponent;
import com.gingersoft.supply_chain.mvp.bean.FoodPackingSpecificationBean; import com.gingersoft.supply_chain.mvp.bean.FoodPackingSpecificationBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodListVosBean; 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.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;
...@@ -96,10 +96,10 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI ...@@ -96,10 +96,10 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI
*/ */
public boolean isUpdate = false; public boolean isUpdate = false;
public static NewFoodIngredientsFragment newInstance(PurchaseFoodListVosBean purchaseFoodListVosBean) { public static NewFoodIngredientsFragment newInstance(PurchaseFoodBean purchaseFoodBean) {
NewFoodIngredientsFragment fragment = new NewFoodIngredientsFragment(); NewFoodIngredientsFragment fragment = new NewFoodIngredientsFragment();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putSerializable(FOOD_INFO_KEY, purchaseFoodListVosBean); bundle.putSerializable(FOOD_INFO_KEY, purchaseFoodBean);
fragment.setArguments(bundle); fragment.setArguments(bundle);
return fragment; return fragment;
} }
...@@ -135,29 +135,26 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI ...@@ -135,29 +135,26 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI
.onExplainRequestReason((scope, deniedList) -> scope.showRequestReasonDialog(deniedList, "上傳食材圖片需要文件讀取權限", "確定", "取消")) .onExplainRequestReason((scope, deniedList) -> scope.showRequestReasonDialog(deniedList, "上傳食材圖片需要文件讀取權限", "確定", "取消"))
.onForwardToSettings((scope, deniedList) -> scope.showForwardToSettingsDialog(deniedList, "您需要去設置當中開啟文件讀取權限", "確定", "取消")) .onForwardToSettings((scope, deniedList) -> scope.showForwardToSettingsDialog(deniedList, "您需要去設置當中開啟文件讀取權限", "確定", "取消"))
.request((allGranted, grantedList, deniedList) -> { .request((allGranted, grantedList, deniedList) -> {
if (allGranted) { if (!allGranted) {
//權限通過 //權限通過
} else {
killMyself(); killMyself();
} }
}); });
//加載佈局
Bundle arguments = getArguments(); Bundle arguments = getArguments();
PurchaseFoodListVosBean purchaseFoodListVosBean = null; PurchaseFoodBean purchaseFoodBean;
if (arguments != null) { if (arguments != null) {
purchaseFoodListVosBean = (PurchaseFoodListVosBean) arguments.getSerializable(FOOD_INFO_KEY); purchaseFoodBean = (PurchaseFoodBean) arguments.getSerializable(FOOD_INFO_KEY);
if (purchaseFoodListVosBean == null) { if (purchaseFoodBean == null) {
isUpdate = false; isUpdate = false;
initTopBar(topbarNewFoodIngredients, "新增食材"); initTopBar(topbarNewFoodIngredients, "新增食材");
purchaseFoodListVosBean = new PurchaseFoodListVosBean(); purchaseFoodBean = new PurchaseFoodBean();
} else { } else {
isUpdate = true; isUpdate = true;
mPresenter.setPurchaseFoodListVosBean(purchaseFoodListVosBean); mPresenter.setPurchaseFoodBean(purchaseFoodBean);
initTopBar(topbarNewFoodIngredients, "編輯食材"); initTopBar(topbarNewFoodIngredients, "編輯食材");
} }
purchaseFoodListVosBean.setFoodCategoryName(arguments.getString(CATEGORY_NAME_KEY)); purchaseFoodBean.setFoodCategoryName(arguments.getString(CATEGORY_NAME_KEY));
purchaseFoodListVosBean.setSupplierName(arguments.getString(SUPPLIER_NAME_KEY)); purchaseFoodBean.setSupplierName(arguments.getString(SUPPLIER_NAME_KEY));
} }
infoMultiAdapter = new InfoMultiAdapter(mContext, mPresenter.getFragmentInfo()); infoMultiAdapter = new InfoMultiAdapter(mContext, mPresenter.getFragmentInfo());
rvNewFoodIngredients.addItemDecoration(new DividerItemDecoration(mContext, VERTICAL_LIST)); rvNewFoodIngredients.addItemDecoration(new DividerItemDecoration(mContext, VERTICAL_LIST));
......
...@@ -191,7 +191,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr ...@@ -191,7 +191,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
mTabSegment.setupWithViewPager(contentViewPager); mTabSegment.setupWithViewPager(contentViewPager);
mTabSegment.setIndicator(new QMUITabIndicator( mTabSegment.setIndicator(new QMUITabIndicator(
QMUIDisplayHelper.dp2px(getContext(), 2), false, false)); QMUIDisplayHelper.dp2px(getContext(), 2), false, false));
mTabSegment.addTab(builder.setText("待收貨").build(getContext())); mTabSegment.addTab(builder.setText("未完成").build(getContext()));
mTabSegment.addTab(builder.setText("已完成").build(getContext())); mTabSegment.addTab(builder.setText("已完成").build(getContext()));
// mTabSegment.addTab(builder.setText("部分收貨").build(getContext())); // mTabSegment.addTab(builder.setText("部分收貨").build(getContext()));
// mTabSegment.addTab(builder.setText("全部收貨").build(getContext())); // mTabSegment.addTab(builder.setText("全部收貨").build(getContext()));
......
...@@ -10,6 +10,8 @@ import androidx.annotation.Nullable; ...@@ -10,6 +10,8 @@ import androidx.annotation.Nullable;
import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.gsa.cloud.common.utils.ClipboardUtils;
import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils;
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.DaggerSendMsgComponent; import com.gingersoft.supply_chain.di.component.DaggerSendMsgComponent;
...@@ -20,6 +22,7 @@ import com.gingersoft.supply_chain.mvp.presenter.SendMsgPresenter; ...@@ -20,6 +22,7 @@ import com.gingersoft.supply_chain.mvp.presenter.SendMsgPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.SendSupplierMsgAdapter; import com.gingersoft.supply_chain.mvp.ui.adapter.SendSupplierMsgAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.DeviceUtils;
import com.qmuiteam.qmui.alpha.QMUIAlphaButton; import com.qmuiteam.qmui.alpha.QMUIAlphaButton;
import com.qmuiteam.qmui.widget.QMUITopBar; import com.qmuiteam.qmui.widget.QMUITopBar;
...@@ -29,6 +32,11 @@ import java.util.List; ...@@ -29,6 +32,11 @@ import java.util.List;
import butterknife.BindView; import butterknife.BindView;
import butterknife.OnClick; import butterknife.OnClick;
import static com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean.SupplierContacts.Kakao_Talk;
import static com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean.SupplierContacts.Line;
import static com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean.SupplierContacts.WeChat;
import static com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean.SupplierContacts.Whatsapp;
/** /**
* Description: 發送消息到供應商 * Description: 發送消息到供應商
...@@ -127,22 +135,46 @@ public class SendMsgFragment extends BaseSupplyChainFragment<SendMsgPresenter> i ...@@ -127,22 +135,46 @@ public class SendMsgFragment extends BaseSupplyChainFragment<SendMsgPresenter> i
private String url; private String url;
// @Override
// public void loadQrCode(String url) {
//
// }
@Override @Override
public void loadQrCode(String url) { public void shareThirdApp(String url, int type) {
if (type == Whatsapp) {
//分享到WhatsApp
DeviceUtils.shareWhatsApp(mContext, url);
} else if (type == WeChat) {
DeviceUtils.shareWeChatFriend(mContext, url);
} else if (type == Line) {
//分享到Line
DeviceUtils.shareLine(mContext, "", url);
} else if (type == Kakao_Talk) {
//分享到kakao
ClipboardUtils.copyText(url);
ToastUtils.show(mContext, "暫未開放此app發送,訂單已複製,請手動打開Kakao粘貼發送");
}
} }
@Override @Override
public void loadSupplierList(List<SendSupplierMsgBean> sendSupplierMsgBeans) { public void loadSupplierList(List<SendSupplierMsgBean> sendSupplierMsgBeans) {
sendSupplierMsgAdapter = new SendSupplierMsgAdapter(sendSupplierMsgBeans); if (sendSupplierMsgAdapter == null) {
rvSupplier.setLayoutManager(new GridLayoutManager(mContext, 2)); sendSupplierMsgAdapter = new SendSupplierMsgAdapter(sendSupplierMsgBeans);
rvSupplier.setAdapter(sendSupplierMsgAdapter); rvSupplier.setAdapter(sendSupplierMsgAdapter);
sendSupplierMsgAdapter.setOnItemClickListener((adapter, view, position) -> { sendSupplierMsgAdapter.setOnItemClickListener((adapter, view, position) -> {
//切換供應商 //切換供應商
//選擇默認的聯繫方式 //選擇默認的聯繫方式
//獲取信息鏈接 //獲取信息鏈接
mPresenter.getContactsBySupplier(position); mPresenter.getContactsBySupplier(position);
// mPresenter.getPurchaseOrderQrCode(purchaseOrders.get(position).getId() + ""); });
// sendSupplierMsgAdapter.setSelectIndex(position); } else {
}); sendSupplierMsgAdapter.setList(sendSupplierMsgBeans);
}
}
@Override
public void sendSuccess() {
mPresenter.getContactsBySupplier(mPresenter.getCurrentSelectedSupplier() + 1);
} }
} }
...@@ -17,7 +17,7 @@ import com.gingersoft.supply_chain.R; ...@@ -17,7 +17,7 @@ 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.DaggerShoppingCatComponent; import com.gingersoft.supply_chain.di.component.DaggerShoppingCatComponent;
import com.gingersoft.supply_chain.mvp.bean.ConfirmOrderBean; import com.gingersoft.supply_chain.mvp.bean.ConfirmOrderBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodListVosBean; 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.ShoppingCatContract; import com.gingersoft.supply_chain.mvp.contract.ShoppingCatContract;
import com.gingersoft.supply_chain.mvp.presenter.ShoppingCatPresenter; import com.gingersoft.supply_chain.mvp.presenter.ShoppingCatPresenter;
...@@ -31,7 +31,6 @@ import java.util.List; ...@@ -31,7 +31,6 @@ import java.util.List;
import butterknife.BindView; import butterknife.BindView;
import butterknife.OnClick; import butterknife.OnClick;
import me.yokeyword.fragmentation.ISupportFragment;
import static com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodIngredientsFragment.ADD_ORDER; import static com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodIngredientsFragment.ADD_ORDER;
...@@ -88,12 +87,12 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres ...@@ -88,12 +87,12 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres
if (shoppingCartAdapter != null) { if (shoppingCartAdapter != null) {
double totalAmount = 0; double totalAmount = 0;
int totalTypeFood = 0; int totalTypeFood = 0;
for (List<PurchaseFoodListVosBean> datum : shoppingCartAdapter.getData()) { for (List<PurchaseFoodBean> datum : shoppingCartAdapter.getData()) {
for (PurchaseFoodListVosBean purchaseFoodListVosBean : datum) { for (PurchaseFoodBean purchaseFoodBean : datum) {
purchaseFoodListVosBean.setChecked(isChecked); purchaseFoodBean.setChecked(isChecked);
if (isChecked) { if (isChecked) {
totalTypeFood++; totalTypeFood++;
totalAmount = MoneyUtil.sum(totalAmount, MoneyUtil.priceCalculation(purchaseFoodListVosBean.getUnitPrice(), purchaseFoodListVosBean.getFoodQuantity())); totalAmount = MoneyUtil.sum(totalAmount, MoneyUtil.priceCalculation(purchaseFoodBean.getUnitPrice(), purchaseFoodBean.getFoodQuantity()));
} }
} }
} }
...@@ -111,11 +110,11 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres ...@@ -111,11 +110,11 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres
int viewId = v.getId(); int viewId = v.getId();
if (viewId == R.id.tv_order_content_complete) { if (viewId == R.id.tv_order_content_complete) {
//完成 //完成
List<PurchaseFoodListVosBean> purchaseFoodListVosBeans = shoppingCartAdapter.getPurchaseFoodListVosBeans(); List<PurchaseFoodBean> purchaseFoodBeans = shoppingCartAdapter.getPurchaseFoodListVosBeans();
//去到訂單確認頁面 //去到訂單確認頁面
boolean isHasChecked = false; boolean isHasChecked = false;
for (PurchaseFoodListVosBean purchaseFoodListVosBean : purchaseFoodListVosBeans) { for (PurchaseFoodBean purchaseFoodBean : purchaseFoodBeans) {
if (purchaseFoodListVosBean.isChecked()) { if (purchaseFoodBean.isChecked()) {
isHasChecked = true; isHasChecked = true;
break; break;
} }
...@@ -136,15 +135,15 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres ...@@ -136,15 +135,15 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres
} }
@Override @Override
public void loadAdapter(List<List<PurchaseFoodListVosBean>> supplierFoods) { public void loadAdapter(List<List<PurchaseFoodBean>> supplierFoods) {
shoppingCartAdapter = new ShoppingCartAdapter(mContext, supplierFoods); shoppingCartAdapter = new ShoppingCartAdapter(mContext, supplierFoods);
shoppingCartAdapter.setOnFoodDeleteListener((supplierIndex, foodListVosBean) -> { shoppingCartAdapter.setOnFoodDeleteListener((supplierIndex, foodListVosBean) -> {
SupplyShoppingCart.getInstance().getCartFoods().remove(foodListVosBean); SupplyShoppingCart.getInstance().getCartFoods().remove(foodListVosBean);
List<PurchaseFoodListVosBean> purchaseFoodListVosBeans = shoppingCartAdapter.getData().get(supplierIndex); List<PurchaseFoodBean> purchaseFoodBeans = shoppingCartAdapter.getData().get(supplierIndex);
purchaseFoodListVosBeans.remove(foodListVosBean); purchaseFoodBeans.remove(foodListVosBean);
if (purchaseFoodListVosBeans.size() <= 0) { if (purchaseFoodBeans.size() <= 0) {
shoppingCartAdapter.removeAt(supplierIndex); shoppingCartAdapter.removeAt(supplierIndex);
} }
}); });
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout 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" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/supply_chain_bg_color" android:background="@color/supply_chain_bg_color"
android:orientation="vertical"> android:orientation="vertical">
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
android:paddingLeft="@dimen/dp_25" android:paddingLeft="@dimen/dp_25"
android:paddingTop="@dimen/dp_15" android:paddingTop="@dimen/dp_15"
android:paddingRight="@dimen/dp_25" android:paddingRight="@dimen/dp_25"
android:paddingBottom="@dimen/dp_15"> android:paddingBottom="@dimen/dp_15"
android:visibility="gone">
<com.qmuiteam.qmui.alpha.QMUIAlphaButton <com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id="@+id/btn_order_content_order_template" android:id="@+id/btn_order_content_order_template"
...@@ -45,8 +46,8 @@ ...@@ -45,8 +46,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" android:layout_weight="1"
android:layout_weight="1" /> app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -122,49 +123,49 @@ ...@@ -122,49 +123,49 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="備註:" android:text="備註:"
android:visibility="gone"
android:textColor="@color/color_3c" android:textColor="@color/color_3c"
android:textSize="@dimen/dp_16" /> android:textSize="@dimen/dp_16"
android:visibility="gone" />
<EditText <EditText
android:id="@+id/ed_order_content_remark" android:id="@+id/ed_order_content_remark"
style="@style/Multi_Input_editStyle" style="@style/Multi_Input_editStyle"
android:visibility="gone"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:gravity="left" android:gravity="left"
android:hint="輸入備註" android:hint="輸入備註"
android:paddingLeft="@dimen/dp_5" /> android:paddingLeft="@dimen/dp_5"
android:visibility="gone" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView <com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_order_content_complete" android:id="@+id/tv_order_content_complete"
style="@style/app_btn_style"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginLeft="@dimen/dp_10" android:layout_marginLeft="@dimen/dp_10"
style="@style/app_btn_style" android:layout_weight="1"
android:gravity="center"
android:paddingLeft="@dimen/dp_35" android:paddingLeft="@dimen/dp_35"
android:paddingTop="@dimen/dp_10" android:paddingTop="@dimen/dp_10"
android:paddingRight="@dimen/dp_35" android:paddingRight="@dimen/dp_35"
android:paddingBottom="@dimen/dp_10" android:paddingBottom="@dimen/dp_10"
android:text="確定"/> android:text="確定" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView <com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_order_content_cancel" android:id="@+id/tv_order_content_cancel"
style="@style/Cancel_Btn_Style" style="@style/Cancel_Btn_Style"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginLeft="@dimen/dp_15" android:layout_marginLeft="@dimen/dp_15"
android:layout_weight="1"
android:gravity="center"
android:paddingLeft="@dimen/dp_35" android:paddingLeft="@dimen/dp_35"
android:paddingTop="@dimen/dp_10" android:paddingTop="@dimen/dp_10"
android:paddingRight="@dimen/dp_35" android:paddingRight="@dimen/dp_35"
android:paddingBottom="@dimen/dp_10" android:paddingBottom="@dimen/dp_10"
android:text="取消"/> android:text="取消" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/color_f0"
android:orientation="vertical"> android:orientation="vertical">
<include layout="@layout/supply_chain_top_bar" /> <include layout="@layout/supply_chain_top_bar" />
...@@ -12,7 +14,8 @@ ...@@ -12,7 +14,8 @@
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginLeft="@dimen/dp_20" android:layout_marginLeft="@dimen/dp_20"
android:layout_marginRight="@dimen/dp_20" android:layout_marginRight="@dimen/dp_20"
android:layout_weight="1" /> android:layout_weight="1"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
......
...@@ -53,6 +53,9 @@ ...@@ -53,6 +53,9 @@
android:id="@+id/tv_food_item_no" android:id="@+id/tv_food_item_no"
style="@style/Food_Ingredient_Info_TextStyle" style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:ellipsize="end"
android:maxLines="1"
android:layout_marginRight="@dimen/dp_10"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:textSize="@dimen/dp_12" android:textSize="@dimen/dp_12"
......
...@@ -178,7 +178,6 @@ dependencies { ...@@ -178,7 +178,6 @@ dependencies {
implementation 'cn.onestravel.one:one_bottom_navigationbar:1.1.1' implementation 'cn.onestravel.one:one_bottom_navigationbar:1.1.1'
api 'androidx.core:core-ktx:+' api 'androidx.core:core-ktx:+'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
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"
......
...@@ -43,9 +43,9 @@ public class HttpsConstans { ...@@ -43,9 +43,9 @@ public class HttpsConstans {
public static String RESTAURANT_API_PATH = "/ricepon-restaurant/api/";//餐廳模塊路徑 public static String RESTAURANT_API_PATH = "/ricepon-restaurant/api/";//餐廳模塊路徑
public static String PURCHASE_API_PATH = "/ricepon-purchase/api/";//供應鏈路徑 public static String PURCHASE_API_PATH = "/ricepon-purchase/api/";//供應鏈路徑
public static String ROOT_SERVER_YOU_CHANG_HK = "http://192.168.1.142:9012/api/"; //友常本地 public static String ROOT_SERVER_YOU_CHANG_HK = "http://192.168.1.142:9015/api"; //友常本地
public static String ROOT_SERVER_ZHI_WANG_HK = "http://192.168.1.169:9012/api/"; //世維本地 public static String ROOT_SERVER_ZHI_WANG_HK = "http://192.168.1.169:9012/api"; //世維本地
public static String ROOT_SERVER_SHI_SHU_HK = "http://192.168.1.154:9012/api/"; //石书本地 public static String ROOT_SERVER_SHI_SHU_HK = "http://192.168.1.154:9012/api"; //石书本地
//------------------------------------------外賣接單--------------------------------------------------------------------------- //------------------------------------------外賣接單---------------------------------------------------------------------------
public static final String URL_RICEPON_WECHAT = "/ricepon-wechat/api/"; public static final String URL_RICEPON_WECHAT = "/ricepon-wechat/api/";
...@@ -56,7 +56,6 @@ public class HttpsConstans { ...@@ -56,7 +56,6 @@ public class HttpsConstans {
public static final String URL_MEMBER_WEB_RICEPON_GSA = "/member-web" + URK_RICEPON_GSA; public static final String URL_MEMBER_WEB_RICEPON_GSA = "/member-web" + URK_RICEPON_GSA;
public static final String ROOT_SZ_URL = "http://192.168.1.74:6060";//友常本地 public static final String ROOT_SZ_URL = "http://192.168.1.74:6060";//友常本地
public static final String ROOT_HK_TEST_URL = "https://hktest.ricepon.com:64377";//香港測試 public static final String ROOT_HK_TEST_URL = "https://hktest.ricepon.com:64377";//香港測試
public static final String ROOT_FORMAL_URL = "https://m.ricepon.com";//正式 public static final String ROOT_FORMAL_URL = "https://m.ricepon.com";//正式
...@@ -203,11 +202,16 @@ public class HttpsConstans { ...@@ -203,11 +202,16 @@ public class HttpsConstans {
_SERVER_ADDRESS = ROOT_SERVER_ZHI_WANG_HK + WECHAR_REPORT_PATH; _SERVER_ADDRESS = ROOT_SERVER_ZHI_WANG_HK + WECHAR_REPORT_PATH;
ROOT_SETTLEMENT_REPORT_SERVER_ADDRESS_FORMAL = REPORT_TEST_ADDRESS; ROOT_SETTLEMENT_REPORT_SERVER_ADDRESS_FORMAL = REPORT_TEST_ADDRESS;
ROOT_SERVER_ADDRESS_FORMAL = ROOT_SERVER_ZHI_WANG_HK; ROOT_SERVER_ADDRESS_FORMAL = ROOT_SERVER_ZHI_WANG_HK;
ROOT_SERVER_ADDRESS_FORMAL_RESTAURANT = ROOT_SERVER_YOU_CHANG_HK + RESTAURANT_API_PATH;
ROOT_SERVER_ADDRESS_RICEPON_PURCHASE = ROOT_SERVER_YOU_CHANG_HK;// + PURCHASE_API_PATH
ROOT_URL = ROOT_SZ_URL; ROOT_URL = ROOT_SZ_URL;
REPORT_SERVER_ADDRESS = REPORT_TEST_ADDRESS + REPORT_PATH; REPORT_SERVER_ADDRESS = REPORT_TEST_ADDRESS + REPORT_PATH;
WECHAR_REPORT_SERVER_ADDRESS = WECHAR_REPORT_TEST_ADDRESS + WECHAR_REPORT_PATH;//正式:WECHAR_REPORT_FORMAL_ADDRESS 測試:WECHAR_REPORT_TEST_ADDRESS WECHAR_REPORT_SERVER_ADDRESS = WECHAR_REPORT_TEST_ADDRESS + WECHAR_REPORT_PATH;
SYSTEM_URL = ROOT_SERVER_ZHI_WANG_HK + SYSTEM_PATH; SYSTEM_URL = ROOT_SERVER_ZHI_WANG_HK + SYSTEM_PATH;
ROOT_SERVER = ROOT_SERVER_YOU_CHANG_HK;
PRINT_QRCODE_ADDRESS = PRINT_QRCODE_ADDRESS_URL_HK + PRINT_QRCODE_SUFFIX; PRINT_QRCODE_ADDRESS = PRINT_QRCODE_ADDRESS_URL_HK + PRINT_QRCODE_SUFFIX;
UPLOAD_PIC_URL = ROOT_SERVER_YOU_CHANG_HK + UPLOAD_PIC_ADDRESS;
HK_TEST_RICEPON_MEMBER = ROOT_SERVER_YOU_CHANG_HK + API_RICEPON_MEMBER;
break; break;
case 4: case 4:
RICEPON_MEMBER_61177 = WECHAR_REPORT_TEST_ADDRESS + API_RICEPON_MEMBER; RICEPON_MEMBER_61177 = WECHAR_REPORT_TEST_ADDRESS + API_RICEPON_MEMBER;
......
...@@ -69,6 +69,7 @@ public class PrinterDeviceBean implements Serializable { ...@@ -69,6 +69,7 @@ public class PrinterDeviceBean implements Serializable {
private int foodIsBold;//食品是否加粗 0預設 1是 2否 private int foodIsBold;//食品是否加粗 0預設 1是 2否
public final static String DEFAULT_FONT_SIZE = "0";
private String foodFont;//食品字體大小 0預設 private String foodFont;//食品字體大小 0預設
private int foodIsItalic;//食品是否斜體 0預設 1是 2否 private int foodIsItalic;//食品是否斜體 0預設 1是 2否
...@@ -95,7 +96,7 @@ public class PrinterDeviceBean implements Serializable { ...@@ -95,7 +96,7 @@ public class PrinterDeviceBean implements Serializable {
@Generated(hash = 1843654148) @Generated(hash = 1843654148)
public PrinterDeviceBean(Long id, Long dbid, String name, Integer restaurantId, String ip, Long uid, Integer port, Integer type, Long printerModelId, String paperSpecification, int lineFontStop, String printerName, String model, String noteContent, Long printerDeviceDefaultId, int printerDeviceType, String printPath, Long flyPrinterDeviceId, Long flyPrinterDeviceId2, int foodComplexion, int modifierComplexion, int foodIsBold, String foodFont, int foodIsItalic, int modifierIsBold, public PrinterDeviceBean(Long id, Long dbid, String name, Integer restaurantId, String ip, Long uid, Integer port, Integer type, Long printerModelId, String paperSpecification, int lineFontStop, String printerName, String model, String noteContent, Long printerDeviceDefaultId, int printerDeviceType, String printPath, Long flyPrinterDeviceId, Long flyPrinterDeviceId2, int foodComplexion, int modifierComplexion, int foodIsBold, String foodFont, int foodIsItalic, int modifierIsBold,
String modifierFont, int modifierIsItalic, int numberIsFlip, String languageType) { String modifierFont, int modifierIsItalic, int numberIsFlip, String languageType) {
this.id = id; this.id = id;
this.dbid = dbid; this.dbid = dbid;
this.name = name; this.name = name;
......
...@@ -39,8 +39,6 @@ public abstract class BaseOrder { ...@@ -39,8 +39,6 @@ public abstract class BaseOrder {
* 購物車數據 * 購物車數據
*/ */
protected ShoppingCart shoppingCart; protected ShoppingCart shoppingCart;
/** /**
* 判斷是否當前訂單類型 * 判斷是否當前訂單類型
* @param type * @param type
......
...@@ -77,7 +77,7 @@ public class PrintSocketHolder { ...@@ -77,7 +77,7 @@ public class PrintSocketHolder {
bluetoothSocket = mDevice.createRfcommSocketToServiceRecord(uuid); bluetoothSocket = mDevice.createRfcommSocketToServiceRecord(uuid);
bluetoothSocket.connect(); bluetoothSocket.connect();
} else { } else {
socket = new Socket();//ip, port socket = new Socket();
InetSocketAddress socketAddress = new InetSocketAddress(printerDeviceBean.getIp(), printerDeviceBean.getPort()); InetSocketAddress socketAddress = new InetSocketAddress(printerDeviceBean.getIp(), printerDeviceBean.getPort());
//设置 超时时间 //设置 超时时间
socket.setSoTimeout(PrintConstans.SO_TIMEOUT); socket.setSoTimeout(PrintConstans.SO_TIMEOUT);
......
...@@ -30,7 +30,6 @@ import lombok.Data; ...@@ -30,7 +30,6 @@ import lombok.Data;
public class PrintContentAdapter implements AdaptationContent { public class PrintContentAdapter implements AdaptationContent {
public PrintContentAdapter() { public PrintContentAdapter() {
} }
...@@ -208,8 +207,10 @@ public class PrintContentAdapter implements AdaptationContent { ...@@ -208,8 +207,10 @@ public class PrintContentAdapter implements AdaptationContent {
private List<PrintPayTypeItem> getPrintPayTypeItemsByPayMultiple(List<OrderDetails.DataBean.PayMultiple> payMultiples) { private List<PrintPayTypeItem> getPrintPayTypeItemsByPayMultiple(List<OrderDetails.DataBean.PayMultiple> payMultiples) {
List<PrintPayTypeItem> printPayTypeItems = new ArrayList<>(); List<PrintPayTypeItem> printPayTypeItems = new ArrayList<>();
for (OrderDetails.DataBean.PayMultiple payMultiple : payMultiples) { if (payMultiples != null) {
printPayTypeItems.add(new PrintPayTypeItem(payMultiple.getPayName(), AppConstans.CARSH_STR + payMultiple.getAmount())); for (OrderDetails.DataBean.PayMultiple payMultiple : payMultiples) {
printPayTypeItems.add(new PrintPayTypeItem(payMultiple.getPayName(), AppConstans.CARSH_STR + payMultiple.getAmount()));
}
} }
return printPayTypeItems; return printPayTypeItems;
} }
......
...@@ -79,6 +79,5 @@ dependencies { ...@@ -79,6 +79,5 @@ dependencies {
} }
api rootProject.ext.dependencies["butterknife"] api rootProject.ext.dependencies["butterknife"]
kapt rootProject.ext.dependencies["butterknife-compiler"] kapt rootProject.ext.dependencies["butterknife-compiler"]
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.lxj:xpopup:2.2.10' implementation 'com.lxj:xpopup:2.2.10'
} }
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