Commit feb970a0 by Wyh

1、外送BUG、結賬失敗問題修復

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