Commit 13ff529e by Wyh

1、外送自取頁面強制功能 2、報表時間問題 3、檢測版本接口更換、供應鏈代碼

parent 33afd942
......@@ -6,9 +6,7 @@ import android.content.Intent;
import android.os.Bundle;
import android.print.PrintManager;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
......@@ -33,10 +31,10 @@ import com.gingersoft.coldchain_module.mvp.ui.adapter.MyPrintDocumentAdapter;
import com.gingersoft.coldchain_module.mvp.ui.adapter.OrderDetailsBtnAdapter;
import com.gingersoft.coldchain_module.mvp.ui.adapter.OrderDetailsFoodAdapter;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.common.constans.FunctionManagerConstants;
import com.gingersoft.gsa.cloud.common.constans.Takeaway;
import com.gingersoft.gsa.cloud.common.core.delivery.OrderDetails;
import com.gingersoft.gsa.cloud.common.function.FunctionManager;
import com.gingersoft.gsa.cloud.common.ui.utils.BtnBuilder;
import com.gingersoft.gsa.cloud.ui.utils.BtnBuilder;
import com.gingersoft.gsa.cloud.common.utils.ClipboardUtils;
import com.gingersoft.gsa.cloud.common.utils.CollectionUtils;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
......@@ -55,7 +53,6 @@ import com.qmuiteam.qmui.widget.QMUITopBar;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import butterknife.BindView;
......@@ -157,7 +154,7 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailsPresenter> im
requestPermissions(null);
mPresenter.findOrderDetails(orderId, isRead);
// mPresenter.download("https://labels.shipany.io/sbx2/325764d7-b2e2-4d8b-9a68-7f4473719f9c/2020-08-27/20200827171831451_SF5805023992121_144ac51b-5370-46db-9e8d-50904e33b1b7.pdf");
List<Function> functionByResModule = FunctionManager.getDefault().getFunctionByResModule(GsaCloudApplication.getAppContext(), FunctionManagerConstants.takeaway.class, FunctionManagerConstants.takeaway.orderDetails, "orderDetails/btn");
List<Function> functionByResModule = FunctionManager.getDefault().getFunctionByResModule(GsaCloudApplication.getAppContext(), Takeaway.ORDER_DETAILS_BTN_PERMISSION, Takeaway.TAKEAWAY_ORDER_DETAILS);
btnBuilder = BtnBuilder.getInstance(functionByResModule);
}
......
......@@ -3,7 +3,7 @@ package com.gingersoft.coldchain_module.mvp.ui.adapter
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.gingersoft.coldchain_module.R
import com.gingersoft.gsa.cloud.common.ui.utils.BtnBuilder
import com.gingersoft.gsa.cloud.ui.utils.BtnBuilder
class OrderDetailsBtnAdapter(list: MutableList<BtnBuilder.BtnBean>) : BaseQuickAdapter<BtnBuilder.BtnBean, BaseViewHolder>(R.layout.item_btn, list) {
......
......@@ -13,14 +13,14 @@ import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.billy.cc.core.component.CC
import com.gingersoft.gsa.cloud.app.GsaCloudApplication
import com.gingersoft.gsa.cloud.common.constans.AppConstans
import com.gingersoft.gsa.cloud.common.constans.FoodSummaryConstans
import com.gingersoft.gsa.cloud.common.constans.PrintConstans
import com.gingersoft.gsa.cloud.common.constans.*
import com.gingersoft.gsa.cloud.common.core.delivery.OrderDetails
import com.gingersoft.gsa.cloud.common.core.delivery.OrderDetails.Companion.verifiAmountTip
import com.gingersoft.gsa.cloud.common.core.delivery.OrderDetails.Companion.verificationAmount
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager
import com.gingersoft.gsa.cloud.common.core.user.UserContext
import com.gingersoft.gsa.cloud.common.function.XFunctionManager
import com.gingersoft.gsa.cloud.common.function.XFunctionViews
import com.gingersoft.gsa.cloud.common.logan.LoganManager
import com.gingersoft.gsa.cloud.common.service.ICommandService
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils
......@@ -29,6 +29,7 @@ import com.gingersoft.gsa.cloud.common.utils.other.TextUtil
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils
import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils
import com.gingersoft.gsa.cloud.component.ComponentName
import com.gingersoft.gsa.cloud.database.bean.Function
import com.gingersoft.gsa.cloud.order.order.TakeawayOrder
import com.gingersoft.gsa.cloud.pay.bean.PayMethod
import com.gingersoft.gsa.cloud.print.bean.adapter.PrintContentAdapter
......@@ -39,7 +40,6 @@ import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.*
import com.gingersoft.gsa.delivery_pick_mode.ui.adapter.DeliveryAdapter
import com.gingersoft.gsa.delivery_pick_mode.util.OtherOrderUtils
import com.jess.arms.utils.ArmsUtils
import kotlinx.android.synthetic.main.activity_other_order.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
......@@ -65,8 +65,13 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
val Transportation = 1009//修改運輸工具成功
val AmountError = 1010//訂單金額有錯
val ErrorCode = 1011//報錯提示
init {
XFunctionManager.inJect(this, Takeaway::class.java)
}
}
var mEnforceBtn: List<Function> = java.util.ArrayList(7)
//餐廳id
val restaurantId by lazy { RestaurantInfoManager.newInstance().restaurantId }
......@@ -605,7 +610,6 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
fun closingBill(orderDetails: OrderDetails.DataBean, payMethods: List<PayMethod>, listener: (Int, Boolean) -> Unit) {
launch({
val payMultiple = ArrayList<OrderDetails.DataBean.PayMultiple>()
payMethods.forEach {
payMultiple.add(OrderDetails.DataBean.PayMultiple(it.payType.toString(), it.payMoney, it.payName, 0.0))
}
......
......@@ -24,7 +24,7 @@ import com.billy.cc.core.component.CC
import com.gingersoft.gsa.cloud.common.constans.AppConstans
import com.gingersoft.gsa.cloud.common.constans.ExpandConstant
import com.gingersoft.gsa.cloud.common.constans.FoodSummaryConstans.TAKEAWAY_TYPE
import com.gingersoft.gsa.cloud.common.constans.FunctionManagerConstants
import com.gingersoft.gsa.cloud.common.constans.Takeaway
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager
import com.gingersoft.gsa.cloud.common.core.restaurant.utils.RestaurantExpandInfoUtils
import com.gingersoft.gsa.cloud.common.function.FunctionManager
......@@ -92,7 +92,7 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen
//功能配置
private val functionByResModule by lazy {
FunctionManager.getDefault().getFunctionByResModule(this, FunctionManagerConstants.takeaway::class.java, FunctionManagerConstants.takeaway.takeawayMain, "btn")
FunctionManager.getDefault().getFunctionByResModule(this, Takeaway.TAKEAWAY_MAIN_BTN_PERMISSION, Takeaway.TAKEAWAY_BTN)
}
//關閉心跳的廣播
......@@ -396,7 +396,7 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen
val notification: NotificationManagerCompat = NotificationManagerCompat.from(this)
if (!notification.areNotificationsEnabled()) {
//未開啟通知權限
AppDialog().showTipDialog(this, "檢測到通知權限未打開,建議打開,否則會影響正常使用!") { _, d ->
AppDialog().showTipDialog(this, "檢測到通知權限未打開,建議打開,否則會影響正常使用!") { ->
val intent = Intent()
when {
SDK_INT >= Build.VERSION_CODES.O -> {
......@@ -451,12 +451,9 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen
if (type == 3 || type == 4 || type == 5
|| type == 6 || type == 7) {
//上次是未確認訂單,本次的提示還是未確認訂單,就不刷新本地頁面
if (!(lastMsgType == 5 && type == 5)) {
getCurrentPageOrderList()
// 刷新餘額
pageViewModel.getBalance(RestaurantInfoManager.newInstance().brandId)
}
lastMsgType = type
getCurrentPageOrderList()
// 刷新餘額
pageViewModel.getBalance(RestaurantInfoManager.newInstance().brandId)
// 選擇了自動接單,有訂單來就接單
if (cb_takeaway_auto_receiving_orders.isChecked) {
//查詢待確定的訂單id
......@@ -467,6 +464,9 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen
//查詢預約單和即時單數量
pageViewModel.getOrderStatistics(fragmentStatus[view_pager.currentItem])
}
} else if(type == 1){
//長連接登陸成功,也刷新一下列表
getCurrentPageOrderList()
}
}
})
......@@ -545,9 +545,9 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen
*/
private fun initAppTop() {
//獲取功能權限
val newOrderFunction = FunctionManager.getFunctionByKey(functionByResModule, FunctionManagerConstants.takeaway.TAKEAWAY_NEW_ORDER)
val historyOrderFunction = FunctionManager.getFunctionByKey(functionByResModule, FunctionManagerConstants.takeaway.TAKEAWAY_HISTORY_ORDER)
val openCashBoxFunction = FunctionManager.getFunctionByKey(functionByResModule, FunctionManagerConstants.takeaway.TAKEAWAY_OPEN_CASH_BOX)
val newOrderFunction = FunctionManager.getFunctionByKey(functionByResModule, Takeaway.TAKEAWAY_NEW_ORDER)
val historyOrderFunction = FunctionManager.getFunctionByKey(functionByResModule, Takeaway.TAKEAWAY_HISTORY_ORDER)
val openCashBoxFunction = FunctionManager.getFunctionByKey(functionByResModule, Takeaway.TAKEAWAY_OPEN_CASH_BOX)
//顯示餐廳名
qm_other_order_bar.setTitle(RestaurantInfoManager.newInstance().restaurantName)
qm_other_order_bar.addLeftImageButton(R.drawable.icon_return, R.id.iv_left_back).setOnClickListener { finish() }
......
......@@ -17,18 +17,18 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.ethanhua.skeleton.Skeleton
import com.ethanhua.skeleton.ViewSkeletonScreen
import com.gingersoft.gsa.cloud.common.constans.FunctionManagerConstants
import com.gingersoft.gsa.cloud.common.constans.Takeaway
import com.gingersoft.gsa.cloud.common.core.delivery.OrderDetails
import com.gingersoft.gsa.cloud.common.core.delivery.OrderDetails.Companion.verifiAmountTip
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager
import com.gingersoft.gsa.cloud.common.core.user.UserContext
import com.gingersoft.gsa.cloud.common.function.FunctionManager
import com.gingersoft.gsa.cloud.common.ui.utils.BtnBuilder
import com.gingersoft.gsa.cloud.common.utils.ClipboardUtils
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil
import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils
import com.gingersoft.gsa.cloud.ui.utils.AppDialog
import com.gingersoft.gsa.cloud.ui.utils.BtnBuilder
import com.gingersoft.gsa.cloud.ui.utils.DialogUtils
import com.gingersoft.gsa.cloud.ui.view.AddKeyBoard
import com.gingersoft.gsa.delivery_pick_mode.R
......@@ -53,8 +53,11 @@ import com.gingersoft.gsa.delivery_pick_mode.util.getCustomColor
import com.gingersoft.gsa.delivery_pick_mode.util.showSelectDialog
import com.gingersoft.gsa.delivery_pick_mode.util.showWaringDialog
import com.jess.arms.mvp.IPresenter
import com.lxj.xpopup.XPopup
import com.lxj.xpopup.interfaces.OnSelectListener
import com.qmuiteam.qmui.widget.QMUITopBar
import kotlinx.android.synthetic.main.activity_order_details.*
import kotlinx.android.synthetic.main.activity_other_order.*
import java.util.*
class OrderDetailsActivity : BaseActivity<IPresenter>() {
......@@ -104,9 +107,8 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = DataBindingUtil.setContentView(this, R.layout.activity_order_details)
val functionByResModule = FunctionManager.getDefault().getFunctionByResModule(this, FunctionManagerConstants.takeaway::class.java, FunctionManagerConstants.takeaway.orderDetails, "orderDetails/btn")
val functionByResModule = FunctionManager.getDefault().getFunctionByResModule(this, Takeaway.ORDER_DETAILS_BTN_PERMISSION, Takeaway.TAKEAWAY_ORDER_DETAILS)
btnBuilder = BtnBuilder.getInstance(functionByResModule)
val rootView = findViewById<View>(R.id.scroll_order_info)
thirdExpensesLayout = findViewById(R.id.layout_third_expenses)
rvThirdExpenses = findViewById(R.id.rv_third_expenses)
......@@ -129,6 +131,7 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
//如果是未讀,調用設為已讀接口
updateIsRead(orderId)
}
mEnforceBtn = FunctionManager.getDefault().getFunctionByResModule(mContext, Takeaway.ORDER_DETAILS_BTN_ENFORCE_PERMISSION, Takeaway.TAKEAWAY_ORDER_DETAILS_ENFORCE)
//獲取訂單詳情
getOrderDetails(orderId, binding)
}
......@@ -157,9 +160,7 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
ClipboardUtils.copyText(orderNo)
showMessage("複製成功")
}
qm_order_details_bar.addRightImageButton(R.drawable.ic_print, R.id.iv_prj_history).setOnClickListener {
PrjQueryActivity.startPrjQueryActivity(this@OrderDetailsActivity, orderNo)
}
addTopBarMenuBtn(orderDetails)
//總金額
var totalAmount = orderDetails.TOTAL_AMOUNT!!.toDouble()
//合計:總金額減去餐盒費,配送費
......@@ -217,7 +218,7 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
cancelLogistics(orderDetails)
BtnBuilder.AssignDeliveryBtn ->
//指派送貨
selectorDelivery(this@OrderDetailsActivity, orderDetails, OrderDetails.appointDelivery) { _, _ -> finish() }
assignDelivery(orderDetails)
BtnBuilder.CancelBtn ->
//取消訂單
cancelOrder(orderDetails)
......@@ -235,57 +236,10 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
}
BtnBuilder.ClosingBtn -> {
//只要不是貨到付款
if (orderDetails.orderPayType != OrderDetails.payOnDelivery) {
//如果是在線支付的訂單,就直接修改訂單狀態
gsUpdateOrderStatus(orderDetails, null) { errorCode, isSuccess ->
when {
isSuccess -> {
finish()
}
errorCode == PageViewModel.ErrorCode -> {
ToastUtils.show(this@OrderDetailsActivity, "出問題啦,請退出重試")
}
else -> {
ToastUtils.show(this@OrderDetailsActivity, "結賬失敗啦,請退出重試")
}
}
}
} else {
//跳轉到結賬頁面
if (OrderDetails.verificationAmount(orderDetails)) {
ToastUtils.show(this@OrderDetailsActivity, verifiAmountTip)
return@setOnItemClickListener
}
val intent = Intent(this@OrderDetailsActivity, PayActivity::class.java)
intent.putExtra("orderDetails", orderDetails)
startActivityForResult(intent, 1001)
}
closingAccount(orderDetails)
}
BtnBuilder.SureBtn -> {
if (isBookingOrder) {
//是預約單,其他都不做改變,只修改狀態為8
updateOrderAndPrint(restaurantId, orderDetails, 8, false, listener)
} else {
//確認訂單,判斷是本店還是zeek或是lalamove
if (orderDetails.orderType == OrderDetails.yourselfPickUp) {
//如果是自取單,將物流類型改為本店
orderDetails.companyType = OrderDetails.ourStoreDistribution
}
when (orderDetails.companyType) {
OrderDetails.ourStoreDistribution, OrderDetails.zeekDistribution -> {
//本店配送和zeek
confirmOrder(orderDetails)
}
OrderDetails.lalamoveDistribution -> {
//lalamove
selectLalaMove(orderDetails, true) { it, orderDetails ->
showIsUpdateTransportation(it, orderDetails, true)
}
}
else -> ToastUtils.show(this@OrderDetailsActivity, "未知的物流類型")
}
}
confirmOrder(orderDetails)
}
BtnBuilder.PrintBtn -> {
//打印
......@@ -293,18 +247,7 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
}
BtnBuilder.ProductionCompletedBtn -> {
//製作完成
updateOrderAndPrint(restaurantId, orderDetails, OrderDetails.appointDelivery) {
if (it.success) {
finish()
}
ToastUtils.show(this@OrderDetailsActivity, if (it.success) {
"製作完成"
} else if (!TextUtil.isEmptyOrNullOrUndefined(it.errorMsg)) {
it.errorMsg
} else {
"修改訂單狀態失敗"
})
}
ProductionCompleted(orderDetails)
}
BtnBuilder.AdditionalServiceChargeBtn -> {
//追加貼士
......@@ -312,7 +255,7 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
}
else -> {
showLoading()
confirmOrder(orderDetails)
confirmOrderDefaultParameters(orderDetails)
}
}
}
......@@ -346,6 +289,143 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
})
}
private fun PageViewModel.ProductionCompleted(orderDetails: OrderDetails.DataBean) {
updateOrderAndPrint(restaurantId, orderDetails, OrderDetails.appointDelivery) {
if (it.success) {
finish()
}
ToastUtils.show(this@OrderDetailsActivity, if (it.success) {
"製作完成"
} else if (!TextUtil.isEmptyOrNullOrUndefined(it.errorMsg)) {
it.errorMsg
} else {
"修改訂單狀態失敗"
})
}
}
private fun PageViewModel.closingAccount(orderDetails: OrderDetails.DataBean) {
if (orderDetails.orderPayType != OrderDetails.payOnDelivery) {
//如果是在線支付的訂單,就直接修改訂單狀態
gsUpdateOrderStatus(orderDetails, null) { errorCode, isSuccess ->
when {
isSuccess -> {
finish()
}
errorCode == PageViewModel.ErrorCode -> {
ToastUtils.show(this@OrderDetailsActivity, "出問題啦,請退出重試")
}
else -> {
ToastUtils.show(this@OrderDetailsActivity, "結賬失敗啦,請退出重試")
}
}
}
} else {
//跳轉到結賬頁面
if (OrderDetails.verificationAmount(orderDetails)) {
ToastUtils.show(this@OrderDetailsActivity, verifiAmountTip)
return
}
val intent = Intent(this@OrderDetailsActivity, PayActivity::class.java)
intent.putExtra("orderDetails", orderDetails)
startActivityForResult(intent, 1001)
}
}
private fun assignDelivery(orderDetails: OrderDetails.DataBean) {
pageViewModel.selectorDelivery(this@OrderDetailsActivity, orderDetails, OrderDetails.appointDelivery) { _, _ -> finish() }
}
private fun confirmOrder(orderDetails: OrderDetails.DataBean) {
if (isBookingOrder) {
//是預約單,其他都不做改變,只修改狀態為8
pageViewModel.updateOrderAndPrint(restaurantId, orderDetails, 8, false, listener)
} else {
//確認訂單,判斷是本店還是zeek或是lalamove
if (orderDetails.orderType == OrderDetails.yourselfPickUp) {
//如果是自取單,將物流類型改為本店
orderDetails.companyType = OrderDetails.ourStoreDistribution
}
when (orderDetails.companyType) {
OrderDetails.ourStoreDistribution, OrderDetails.zeekDistribution -> {
//本店配送和zeek
pageViewModel.confirmOrderDefaultParameters(orderDetails)
}
OrderDetails.lalamoveDistribution -> {
//lalamove
pageViewModel.selectLalaMove(orderDetails, true) { it, orderDetails ->
pageViewModel.showIsUpdateTransportation(it, orderDetails, true)
}
}
else -> ToastUtils.show(this@OrderDetailsActivity, "未知的物流類型")
}
}
}
private fun PageViewModel.confirmOrderDefaultParameters(orderDetails: OrderDetails.DataBean, trafficType: String = "", isPrint: Boolean = true) {
showLoading()
confirmOrder(orderDetails, 2, trafficType, restaurantId, if (isBookingOrder) false else isPrint, if (isBookingOrder) false else isPrint, listener)
}
/**
* 添加頂部菜單按鈕
*/
private fun addTopBarMenuBtn(orderDetails: OrderDetails.DataBean) {
val enforceBtn = arrayListOf<String>()
for (function in pageViewModel.mEnforceBtn) {
enforceBtn.add(function.resName)
}
enforceBtn.add("打印查詢")
val addRightImageButton = qm_order_details_bar.addRightImageButton(R.drawable.icon_topbar_overflow, R.id.topbar_right_change_button);
addRightImageButton.setOnClickListener {
XPopup.Builder(this)
.atView(addRightImageButton)
.hasShadowBg(false)
.asAttachList(enforceBtn.toTypedArray(), null) { position, text ->
run {
pageViewModel.apply {
if (position >= pageViewModel.mEnforceBtn.size) {
PrjQueryActivity.startPrjQueryActivity(this@OrderDetailsActivity, orderDetails.ORDER_NO)
} else {
when (mEnforceBtn[position].resUrl) {
Takeaway.ORDER_DETAILS_BTN_ENFORCE_PERMISSION[0].keyRes -> {
//強制確認訂單
confirmOrder(orderDetails)
}
Takeaway.ORDER_DETAILS_BTN_ENFORCE_PERMISSION[1].keyRes -> {
//強制製作完成
ProductionCompleted(orderDetails)
}
Takeaway.ORDER_DETAILS_BTN_ENFORCE_PERMISSION[2].keyRes -> {
//強制取消訂單
cancelOrder(orderDetails)
}
Takeaway.ORDER_DETAILS_BTN_ENFORCE_PERMISSION[3].keyRes -> {
//強制打印訂單
printOrder(PrintCode, orderDetails) {}
}
Takeaway.ORDER_DETAILS_BTN_ENFORCE_PERMISSION[4].keyRes -> {
//強制取消物流
cancelLogistics(orderDetails)
}
Takeaway.ORDER_DETAILS_BTN_ENFORCE_PERMISSION[5].keyRes -> {
//強制指派送貨
assignDelivery(orderDetails)
}
Takeaway.ORDER_DETAILS_BTN_ENFORCE_PERMISSION[6].keyRes -> {
//強制結賬
closingAccount(orderDetails)
}
else -> {
}
}
}
}
}
}.show()
}
}
/**
* 初始化按鈕排列
*/
......@@ -472,21 +552,21 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
* 製作中
*/
private fun initMakingState(btnList: ArrayList<BtnBuilder.BtnBean>, orderDetails: OrderDetails.DataBean): String {
btnBuilder.getSureBtn()?.let {
btnList.add(it)
}
tv_order_state.setTextColor(getCustomColor(R.color.order_state0_color))
if (orderDetails.isDelete == 0) {
btnBuilder.getLogisticsBtn()?.let {
btnList.add(it)
}
//已超時,添加追加服務費的按鈕
if (isTimeOut && orderDetails.companyType == 2) {
btnBuilder.getAdditionalServiceChargeBtn()?.let {
btnList.add(it)
}
}
}
// btnBuilder.getSureBtn()?.let {
// btnList.add(it)
// }
// tv_order_state.setTextColor(getCustomColor(R.color.order_state0_color))
// if (orderDetails.isDelete == 0) {
// btnBuilder.getLogisticsBtn()?.let {
// btnList.add(it)
// }
// //已超時,添加追加服務費的按鈕
// if (isTimeOut && orderDetails.companyType == 2) {
// btnBuilder.getAdditionalServiceChargeBtn()?.let {
// btnList.add(it)
// }
// }
// }
btnBuilder.getPrintBtn()?.let {
btnList.add(it)
}
......@@ -573,7 +653,7 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
//默認交通工具,判斷價格是不是在這個金額範圍內,如果在,則不提示,如果不在,提示用戶修改交通工具
if (orderDetails.PAY_AMOUNT > value.amountUnder && orderDetails.PAY_AMOUNT < value.amountOn) {
//價格在範圍內
confirmOrder(orderDetails, value.type.toString(), isPrint)
confirmOrderDefaultParameters(orderDetails, value.type.toString(), isPrint)
return@getIsUpdateTransportation
} else {
//價格不在默認交通工具範圍內,回到activity中彈出彈窗,讓用戶選擇交通工具
......@@ -595,7 +675,7 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
//不修改運輸工具,使用默認的
for (value in it) {
if (value.status == 1) {
confirmOrder(orderDetails, value.type.toString(), isPrint)
confirmOrderDefaultParameters(orderDetails, value.type.toString(), isPrint)
break
}
}
......@@ -628,7 +708,7 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
if (adapter.selectIndex == -1) {
ToastUtils.show(this@OrderDetailsActivity, "請選擇交通工具")
} else {
confirmOrder(orderDetails, transportationBeans[adapter.selectIndex].type.toString(), isPrint)
confirmOrderDefaultParameters(orderDetails, transportationBeans[adapter.selectIndex].type.toString(), isPrint)
}
}, { dialog ->
dialog.dismiss()
......@@ -686,10 +766,13 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
}
set(value) {}
private fun PageViewModel.confirmOrder(orderDetails: OrderDetails.DataBean, trafficType: String = "", isPrint: Boolean = true) {
/**
* 確認訂單
*/
private fun confirmOrder(orderDetails: OrderDetails.DataBean, trafficType: String = "", isPrint: Boolean = true) {
showLoading()
val status = 2
confirmOrder(orderDetails, status, trafficType, restaurantId, if (isBookingOrder) false else isPrint, if (isBookingOrder) false else isPrint, listener)
pageViewModel.confirmOrder(orderDetails, status, trafficType, restaurantId, if (isBookingOrder) false else isPrint, if (isBookingOrder) false else isPrint, listener)
}
/**
......
......@@ -6,7 +6,7 @@ import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.gingersoft.gsa.cloud.common.ui.utils.BtnBuilder
import com.gingersoft.gsa.cloud.ui.utils.BtnBuilder
import com.gingersoft.gsa.delivery_pick_mode.R
class OrderBtnAdapter(var list: MutableList<BtnBuilder.BtnBean>) : RecyclerView.Adapter<OrderBtnAdapter.ViewHolder>() {
......
......@@ -2,7 +2,7 @@ package com.gingersoft.gsa.delivery_pick_mode.ui.adapter
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.gingersoft.gsa.cloud.common.ui.utils.BtnBuilder
import com.gingersoft.gsa.cloud.ui.utils.BtnBuilder
import com.gingersoft.gsa.delivery_pick_mode.R
class OrderDetailsAdapter(list: MutableList<BtnBuilder.BtnBean>) : BaseQuickAdapter<BtnBuilder.BtnBean, BaseViewHolder>(R.layout.item_btn, list) {
......
......@@ -22,7 +22,7 @@ import retrofit2.http.Query;
public interface MainService {
@Headers({"Domain-Name: update_version"})
@GET("system/checkAppVersionGsa" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
@GET("system/checkAppVersion" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<CheckVersionRequest> checkAppVersion(@Query("version") String version);
@FormUrlEncoded
......
......@@ -162,43 +162,39 @@ public class HomePresenter extends BasePresenter<HomeContract.Model, HomeContrac
}
public void checkAppVersion() {
// RequestBody requestBody = new FormBody.Builder()
// .add("version", )
// .add("type", "2")
// .build();
// mModel.checkAppVersion(DeviceUtils.getVersionName(mApplication) + "|" + DeviceUtils.getVersionCode(mApplication))
// .subscribeOn(Schedulers.io())
// .subscribeOn(AndroidSchedulers.mainThread())
// .observeOn(AndroidSchedulers.mainThread())
// .compose(RxLifecycleUtils.bindToLifecycle(mRootView))
// .subscribe(new ErrorHandleSubscriber<CheckVersionRequest>(mErrorHandler) {
//
// @Override
// public void onNext(@NonNull CheckVersionRequest info) {
// if (info != null) {
// /**
// * 操作类型:
// * 1、不提示更新
// * 2、提示更新可选择更新
// * 3、强行更新
// * 4、跳转goole play下载app 没安装goole play就用webview打开goole网页下载
// * 5、跳转goole play下载app 没安装goole play就用浏览器打开goole网页下载
// */
// int operate = info.getOperate();
// if (operate == 2 || operate == 3 || operate == 4 || operate == 5) {
// String updatePath = info.getUpdatePath();
// if (!TextUtils.isEmpty(updatePath) && !updatePath.equals("null")) {
// updateAPK(operate, updatePath);
// } else {
// if (operate == 3) {
// mAppManager.appExit();
// }
// }
// }
// } else {
// }
// }
// });
mModel.checkAppVersion(DeviceUtils.getVersionName(mApplication) + "|" + DeviceUtils.getVersionCode(mApplication))
.subscribeOn(Schedulers.io())
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<CheckVersionRequest>(mErrorHandler) {
@Override
public void onNext(@NonNull CheckVersionRequest info) {
if (info != null) {
/**
* 操作类型:
* 1、不提示更新
* 2、提示更新可选择更新
* 3、强行更新
* 4、跳转goole play下载app 没安装goole play就用webview打开goole网页下载
* 5、跳转goole play下载app 没安装goole play就用浏览器打开goole网页下载
*/
int operate = info.getOperate();
if (operate == 2 || operate == 3 || operate == 4 || operate == 5) {
String updatePath = info.getUpdatePath();
if (!TextUtils.isEmpty(updatePath) && !updatePath.equals("null")) {
updateAPK(operate, updatePath);
} else {
if (operate == 3) {
mAppManager.appExit();
}
}
}
} else {
}
}
});
}
public void loginOut() {
......
......@@ -97,43 +97,39 @@ public class NewMainPresenter extends BasePresenter<NewMainContract.Model, NewMa
}
public void checkAppVersion() {
// RequestBody requestBody = new FormBody.Builder()
// .add("version", )
// .add("type", "2")
// .build();
// mModel.checkAppVersion(DeviceUtils.getVersionName(mApplication) + "|" + DeviceUtils.getVersionCode(mApplication))
// .subscribeOn(Schedulers.io())
// .subscribeOn(AndroidSchedulers.mainThread())
// .observeOn(AndroidSchedulers.mainThread())
// .compose(RxLifecycleUtils.bindToLifecycle(mRootView))
// .subscribe(new ErrorHandleSubscriber<CheckVersionRequest>(mErrorHandler) {
//
// @Override
// public void onNext(@NonNull CheckVersionRequest info) {
// if (info != null) {
// /**
// * 操作类型:
// * 1、不提示更新
// * 2、提示更新可选择更新
// * 3、强行更新
// * 4、跳转goole play下载app 没安装goole play就用webview打开goole网页下载
// * 5、跳转goole play下载app 没安装goole play就用浏览器打开goole网页下载
// */
// int operate = info.getOperate();
// if (operate == 2 || operate == 3 || operate == 4 || operate == 5) {
// String updatePath = info.getUpdatePath();
// if (!TextUtils.isEmpty(updatePath) && !updatePath.equals("null")) {
// updateAPK(operate, updatePath);
// } else {
// if (operate == 3) {
// mAppManager.appExit();
// }
// }
// }
// } else {
// }
// }
// });
mModel.checkAppVersion(DeviceUtils.getVersionName(mApplication) + "|" + DeviceUtils.getVersionCode(mApplication))
.subscribeOn(Schedulers.io())
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<CheckVersionRequest>(mErrorHandler) {
@Override
public void onNext(@NonNull CheckVersionRequest info) {
if (info != null) {
/**
* 操作类型:
* 1、不提示更新
* 2、提示更新可选择更新
* 3、强行更新
* 4、跳转goole play下载app 没安装goole play就用webview打开goole网页下载
* 5、跳转goole play下载app 没安装goole play就用浏览器打开goole网页下载
*/
int operate = info.getOperate();
if (operate == 2 || operate == 3 || operate == 4 || operate == 5) {
String updatePath = info.getUpdatePath();
if (!TextUtils.isEmpty(updatePath) && !updatePath.equals("null")) {
updateAPK(operate, updatePath);
} else {
if (operate == 3) {
mAppManager.appExit();
}
}
}
} else {
}
}
});
}
public void loginOut() {
......
......@@ -505,7 +505,7 @@ public class BusinessReportFragment extends BaseFragment<BusinessReportPresenter
private String endTime;
private void getInfo() {
startTime = TimeUtils.getDatebyDate(mTvStartTime.getText().toString(), -1);
startTime = TimeUtils.getDatebyDate(mTvStartTime.getText().toString(), 0);
endTime = TimeUtils.getDatebyDate(mTvEndTime.getText().toString(), 1);
mPresenter.getRestaurantAmount(restaurantId, startTime, endTime);
mPresenter.getRestaurantBusinessInfo(restaurantId, startTime, endTime);
......
......@@ -136,7 +136,7 @@ public class PaymentMethodReportFragment extends BaseFragment<PaymentMethodRepor
}
private void getPayMenthInfo() {
String startTime = TimeUtils.getDatebyDate(mTvStartTime.getText().toString(), -1);
String startTime = TimeUtils.getDatebyDate(mTvStartTime.getText().toString(), 0);
String endTime = TimeUtils.getDatebyDate(mTvEndTime.getText().toString(), 1);
mPresenter.getPaymentInfo(RestaurantInfoManager.newInstance().getRestaurantId() + "", startTime, endTime);
}
......
......@@ -527,13 +527,13 @@ public class SalesFragment extends BaseFragment<SalesPresenter> implements Sales
}
private void getSaleReport() {
String startTime = TimeUtils.getDatebyDate(mTvStartTime.getText().toString(), -1);
String startTime = TimeUtils.getDatebyDate(mTvStartTime.getText().toString(), 0);
String endTime = TimeUtils.getDatebyDate(mTvEndTime.getText().toString(), 1);
mPresenter.getSalesReportInfo(RestaurantInfoManager.newInstance().getRestaurantId() + "", startTime, endTime);
}
private void getDeliveryReport(){
String startTime = TimeUtils.getDatebyDate(startEndTimePickerView.getStartTime(), -1);
String startTime = TimeUtils.getDatebyDate(startEndTimePickerView.getStartTime(), 0);
String endTime = TimeUtils.getDatebyDate(startEndTimePickerView.getEndTime(), 1);
mPresenter.getDeliveryOrderCurveInfo(RestaurantInfoManager.newInstance().getRestaurantId() + "", startTime, endTime);
mPresenter.getDeliveryPersonnelReport(RestaurantInfoManager.newInstance().getRestaurantId() + "", startTime, endTime);
......
apply from: rootProject.file('cc-settings.gradle')
apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'android-aspectjx'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
......
package com.gingersoft.supply_chain.di.component;
import dagger.BindsInstance;
import dagger.Component;
import com.jess.arms.di.component.AppComponent;
import com.gingersoft.supply_chain.di.module.WarehousingOrderListModule;
import com.gingersoft.supply_chain.mvp.contract.WarehousingOrderListContract;
import com.jess.arms.di.scope.FragmentScope;
import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.WarehousingOrderListFragment;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/28/2021 19:21
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@FragmentScope
@Component(modules = WarehousingOrderListModule.class, dependencies = AppComponent.class)
public interface WarehousingOrderListComponent {
void inject(WarehousingOrderListFragment fragment);
@Component.Builder
interface Builder {
@BindsInstance
WarehousingOrderListComponent.Builder view(WarehousingOrderListContract.View view);
WarehousingOrderListComponent.Builder appComponent(AppComponent appComponent);
WarehousingOrderListComponent build();
}
}
\ No newline at end of file
package com.gingersoft.supply_chain.di.module;
import com.jess.arms.di.scope.FragmentScope;
import dagger.Binds;
import dagger.Module;
import dagger.Provides;
import com.gingersoft.supply_chain.mvp.contract.WarehousingOrderListContract;
import com.gingersoft.supply_chain.mvp.model.WarehousingOrderListModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/28/2021 19:21
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@Module
public abstract class WarehousingOrderListModule {
@Binds
abstract WarehousingOrderListContract.Model bindWarehousingOrderListModel(WarehousingOrderListModel model);
}
\ No newline at end of file
......@@ -27,4 +27,6 @@ public class ConsumeWareHousingBean {
*/
private String purchaseConsumeNoId;
private String remarks;
}
......@@ -193,7 +193,6 @@ public class PurchaseFoodBean implements Serializable, QMUISection.Model<Purchas
minimumInventory == that.minimumInventory &&
shelfLife == that.shelfLife &&
warningDays == that.warningDays &&
foodMarkSn == that.foodMarkSn &&
Objects.equals(supplierName, that.supplierName) &&
Objects.equals(images, that.images) &&
Objects.equals(foodNo, that.foodNo) &&
......
package com.gingersoft.supply_chain.mvp.bean;
import java.io.Serializable;
import java.util.List;
import lombok.Data;
......
......@@ -56,6 +56,8 @@ public class WarehouseDetailsBean implements Serializable {
* 消耗狀態,1從未被消耗,2消耗了一部分,3完全消耗
*/
private int consumeStatus;
private String remarks;
/**
* 入庫詳情ids,逗號分隔
*/
......@@ -94,6 +96,7 @@ public class WarehouseDetailsBean implements Serializable {
warehousingBean.supplierName = consumeWareHousingBean.getSupplierName();
warehousingBean.purchaseConsumeNoId = consumeWareHousingBean.getPurchaseConsumeNoId();
warehousingBean.warehousingOrderDetailsIds = consumeWareHousingBean.getWarehousingOrderDetailsIds();
warehousingBean.remarks = consumeWareHousingBean.getRemarks();
return warehousingBean;
}
......
package com.gingersoft.supply_chain.mvp.bean;
/**
* @author 宇航. 1239658231@qq.com
* User: admin
* Date: 2021/4/28
* Time: 14:36
* Use:
*/
public class WarehouseOrderBean {
public String orderNo;
public String warehousingMember;
public String warehousingTime;
public String warehousingFoodName;
public int warehousingSpecies;
public String warehousingReason;
}
......@@ -12,6 +12,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author 宇航.
......@@ -21,16 +22,17 @@ import java.util.Map;
* Use: 供應鏈購物車,需要緩存用戶選中的食品
*/
public class SupplyShoppingCart {
/**
* key為食品id
* value為食品信息
*/
private static List<PurchaseFoodBean> cartFoods;
/**
* 供應商信息map
* 有時候PurchaseFoodBean中的供應商信息不可靠,比如:用戶將食品添加到購物車中,然後又去供應商列表修改供應商信息,這時候需要更新供應商信息
*/
private static Map<Integer, SupplierInfoBean> supplierInfoBeanMap;
/**
* key為食品id
* value為食品信息
*/
private static Map<Integer, PurchaseFoodBean> foodBeanMap;
private static SupplyShoppingCart shoppingCart;
......@@ -42,10 +44,14 @@ public class SupplyShoppingCart {
}
public List<PurchaseFoodBean> getCartFoods() {
if (cartFoods == null) {
cartFoods = new ArrayList<>();
return new ArrayList<>(getFoodBeanMap().values());
}
public Map<Integer, PurchaseFoodBean> getFoodBeanMap() {
if (foodBeanMap == null) {
foodBeanMap = new HashMap<>();
}
return cartFoods;
return foodBeanMap;
}
public Map<Integer, SupplierInfoBean> getSupplierInfoBeanMap() {
......@@ -72,49 +78,48 @@ public class SupplyShoppingCart {
/**
* 添加食品時記錄供應商信息,對供應商進行修改時,需要修改食材的供應商信息
*
* @param purchaseFoodBean
* @param purchaseFoodBean 食品
*/
public void addFood(PurchaseFoodBean purchaseFoodBean) {
addFood(getCartFoods().size(), purchaseFoodBean);
}
public void addFood(int index, PurchaseFoodBean purchaseFoodBean) {
getCartFoods().add(index, purchaseFoodBean);
getFoodBeanMap().put(purchaseFoodBean.getId(), purchaseFoodBean);
if (getSupplierInfoBeanMap().get(purchaseFoodBean.getSupplierId()) == null) {
getSupplierInfoBeanMap().put(purchaseFoodBean.getSupplierId(), SupplierInfoBean.generateSupplierByFood(purchaseFoodBean));
}
}
/**
* 替換食品信息
*
* @param purchaseFoodBean 食品信息
*/
public void replaceFood(PurchaseFoodBean purchaseFoodBean) {
RxJavaUtils.doInIOThread(new RxIOTask<Object>(1) {
@Override
public Void doInIOThread(Object o) {
for (int i = 0; i < getCartFoods().size(); i++) {
PurchaseFoodBean cartFood = getCartFoods().get(i);
//找到這個食品
if (purchaseFoodBean.getId().equals(cartFood.getId())) {
int foodNum = cartFood.getFoodQuantity();
purchaseFoodBean.setFoodQuantity(foodNum);
if (getSupplierInfoBeanMap().get(purchaseFoodBean.getSupplierId()) != null) {
//可能用戶修改了食品的供應商信息,但是這裡是沒有供應商的詳細,直接移除食品
getCartFoods().add(i, purchaseFoodBean);
}
cartFoods.remove(cartFood);
break;
}
}
return null;
}
});
//從食品緩衝中拿到這個食品
PurchaseFoodBean mapFood = getFoodBeanMap().get(purchaseFoodBean.getId());
//食品不為空並且這個食品的供應商還存在
if (mapFood != null && getSupplierInfoBeanMap().get(purchaseFoodBean.getSupplierId()) != null) {
//將要替換的食品數量同步為當前緩存中的數量
purchaseFoodBean.setFoodQuantity(mapFood.getFoodQuantity());
//用新的食材數據替換掉舊的,避免有可能修改了其他信息
getFoodBeanMap().put(purchaseFoodBean.getId(), purchaseFoodBean);
}
}
public void removeFood(PurchaseFoodBean purchaseFoodBean) {
getFoodBeanMap().remove(purchaseFoodBean.getId());
}
public void clear() {
if (cartFoods == null) {
return;
}
cartFoods.clear();
getFoodBeanMap().clear();
}
public PurchaseFoodBean getFoodByFoodId(int foodId) {
for (PurchaseFoodBean cartFood : getCartFoods()) {
if (cartFood.getId() == foodId) {
return cartFood;
}
}
return null;
}
public void removeFoodsByFoodId(int foodId) {
RxJavaUtils.doInIOThread(new RxIOTask<Object>(0) {
......@@ -208,9 +213,9 @@ public class SupplyShoppingCart {
public void removeFoodsByCategoryTress(List<OrderCategoryBean.FoodCategoryTrees> thirdCategory) {
if (thirdCategory != null) {
for (OrderCategoryBean.FoodCategoryTrees trees : thirdCategory) {
for (PurchaseFoodBean cartFood : cartFoods) {
for (PurchaseFoodBean cartFood : getCartFoods()) {
if (cartFood.getFoodCategoryId() == trees.getId()) {
cartFoods.remove(cartFood);
getFoodBeanMap().remove(cartFood.getId());
}
}
}
......
package com.gingersoft.supply_chain.mvp.contract;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/28/2021 19:21
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public interface WarehousingOrderListContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
}
}
package com.gingersoft.supply_chain.mvp.model;
import android.app.Application;
import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import com.jess.arms.di.scope.FragmentScope;
import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.WarehousingOrderListContract;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/28/2021 19:21
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@FragmentScope
public class WarehousingOrderListModel extends BaseModel implements WarehousingOrderListContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public WarehousingOrderListModel(IRepositoryManager repositoryManager) {
super(repositoryManager);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mGson = null;
this.mApplication = null;
}
}
\ No newline at end of file
......@@ -31,9 +31,11 @@ import com.gingersoft.supply_chain.mvp.contract.BuyIngredientsContract;
import com.jess.arms.utils.RxLifecycleUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
......@@ -58,12 +60,11 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
* 供應商信息轉為分類之後的緩存,之後加載就讀取這裡面的
*/
private List<OrderCategoryBean.FoodCategoryTrees> supplierTranCategoryCache;
// /**
// * 用戶選購的食材列表
// */
// private Map<Integer, PurchaseFoodBean> purchaseFoodBeanMap = new HashMap<>();
/**
* 用戶選購的食材列表
*/
private Map<Integer, PurchaseFoodBean> purchaseFoodBeanMap = new HashMap<>();
/**
* 分類商品緩存,用於根據一級分類下標獲取下面的分類和食材
*/
......@@ -92,20 +93,33 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
}
/**
* 將購物車中的商品添加到緩存中
* 統計食品數量
*/
public int tranShoppingCartToCache() {
purchaseFoodBeanMap.clear();
public int statisticsFoodQuantity() {
List<PurchaseFoodBean> cartFoods = SupplyShoppingCart.getInstance().getCartFoods();
int foodSize = 0;
for (PurchaseFoodBean cartFood : cartFoods) {
foodSize += cartFood.getFoodQuantity();
purchaseFoodBeanMap.put(cartFood.getId(), cartFood);
}
return foodSize;
}
/**
* 跟據供應商id統計食品數量
*/
public int statisticsFoodQuantityBySupplierId(int supplierId) {
List<PurchaseFoodBean> cartFoods = SupplyShoppingCart.getInstance().getCartFoods();
int foodSize = 0;
for (PurchaseFoodBean cartFood : cartFoods) {
if (cartFood.getSupplierId() == supplierId) {
foodSize += cartFood.getFoodQuantity();
}
}
return foodSize;
}
/**
* 獲取分類的結構:所有分類和分類的子分類都有
*/
public void getCategoryTrees() {
......@@ -225,7 +239,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
int categoryFoodSize = 0;
for (PurchaseFoodBean foodBean : foodBeans) {
//將食品按分類隔開
PurchaseFoodBean cachePurchaseFoodBean = purchaseFoodBeanMap.get(foodBean.getId());
PurchaseFoodBean cachePurchaseFoodBean = SupplyShoppingCart.getInstance().getFoodByFoodId(foodBean.getId());
if (cachePurchaseFoodBean != null) {
foodBean.setFoodQuantity(cachePurchaseFoodBean.getFoodQuantity());
categoryFoodSize++;
......@@ -263,16 +277,15 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
for (OrderCategoryBean.FoodCategoryTrees foodCategoryTree : foodCategoryTrees) {
foodCategoryTree.setSize(0);
}
for (Map.Entry<Integer, PurchaseFoodBean> integerPurchaseFoodBeanEntry : purchaseFoodBeanMap.entrySet()) {
PurchaseFoodBean value = integerPurchaseFoodBeanEntry.getValue();
for (PurchaseFoodBean cartFood : SupplyShoppingCart.getInstance().getCartFoods()) {
int size = foodCategoryTrees.size();
for (int i = 0; i < size; i++) {
OrderCategoryBean.FoodCategoryTrees categoryTrees = foodCategoryTrees.get(i);
if (value.getFoodCategoryId() == categoryTrees.getId()) {
if (cartFood.getFoodCategoryId() == categoryTrees.getId()) {
categoryTrees.setSize(categoryTrees.getSize() + 1);
break;
} else {
initCategorySize(categoryTrees, categoryTrees.getFoodCategoryTrees(), value);
initCategorySize(categoryTrees, categoryTrees.getFoodCategoryTrees(), cartFood);
}
}
}
......@@ -357,7 +370,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
//第一次需要初始化每個供應商下已採購的食品數量
initSupplierGoodsSize(supplierTranCategoryCache);
mRootView.initCategoryInfo(supplierTranCategoryCache);
mRootView.loadFood(showFoods, false, true);
loadFood(showFoods.get(0), false, true);
}
}
}
......@@ -374,12 +387,11 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
for (OrderCategoryBean.FoodCategoryTrees foodCategoryTree : foodCategoryTrees) {
foodCategoryTree.setSize(0);
}
for (Map.Entry<Integer, PurchaseFoodBean> integerPurchaseFoodBeanEntry : purchaseFoodBeanMap.entrySet()) {
PurchaseFoodBean value = integerPurchaseFoodBeanEntry.getValue();
for (PurchaseFoodBean cartFood : SupplyShoppingCart.getInstance().getCartFoods()) {
int size = foodCategoryTrees.size();
for (int i = 0; i < size; i++) {
OrderCategoryBean.FoodCategoryTrees categoryTrees = foodCategoryTrees.get(i);
if (value.getSupplierId() == categoryTrees.getId()) {
if (cartFood.getSupplierId() == categoryTrees.getId()) {
categoryTrees.setSize(categoryTrees.getSize() + 1);
}
}
......@@ -402,7 +414,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
int foodSize = 0;
for (PurchaseFoodBean foodBean : purchaseFoodListVOS) {
//將食品按分類隔開
PurchaseFoodBean cachePurchaseFoodBean = purchaseFoodBeanMap.get(foodBean.getId());
PurchaseFoodBean cachePurchaseFoodBean = SupplyShoppingCart.getInstance().getFoodByFoodId(foodBean.getId());
if (cachePurchaseFoodBean != null) {
foodBean.setFoodQuantity(cachePurchaseFoodBean.getFoodQuantity());
foodSize++;
......@@ -449,14 +461,18 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
BuyIngredientsBean buyIngredientsBean = conversionSupplierToShowInfo(foodCategoryTrees, purchaseFoodListVOS);
supplierFoods.set(position, buyIngredientsBean);
showFoods.add(addToHead ? 0 : showFoods.size(), buyIngredientsBean);
ArrayList<BuyIngredientsBean> buyIngredientsBeans = new ArrayList<>();
buyIngredientsBeans.add(buyIngredientsBean);
mRootView.loadFood(buyIngredientsBeans, addToHead, isReset);
loadFood(buyIngredientsBean, addToHead, isReset);
}
}
});
}
private void loadFood(BuyIngredientsBean buyIngredientsBean, boolean addToHead, boolean isReset) {
ArrayList<BuyIngredientsBean> buyIngredientsBeans = new ArrayList<>();
buyIngredientsBeans.add(buyIngredientsBean);
mRootView.loadFood(buyIngredientsBeans, addToHead, isReset);
}
/**
* 刪除食品
*
......@@ -477,18 +493,9 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
public void onNext(BaseResult baseResult) {
if (baseResult.isSuccess()) {
//需要在供應商和分類的緩存中這個食品移除
// if (categoryPosition == -1) {
// //頁面顯示供應商,那就把所有分類的數據清空
// clearCategoryFoods();
// supplierFoods.get(groupPosition).purchaseFoodList.remove(position);
// } else {
// categoryFoods.get(categoryPosition).get(groupPosition).purchaseFoodList.remove(position);
// clearSupplierFoods();
// }
showFoods.get(groupPosition).purchaseFoodList.remove(position);
//移除在購物車中的緩存
SupplyShoppingCart.getInstance().removeFoodsByFoodId(foodId);
// mRootView.onDeleteFoodSuccess(position);
mRootView.loadFood(showFoods, true, true);
} else if (TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg());
......@@ -513,7 +520,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
* @return 用戶採購的食材
*/
public List<PurchaseFoodBean> getPurchaseFood() {
return new ArrayList<>(purchaseFoodBeanMap.values());
return SupplyShoppingCart.getInstance().getCartFoods();
}
/**
......@@ -523,9 +530,13 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
*/
public void addFood(PurchaseFoodBean purchaseFoodBean) {
if (purchaseFoodBean.getFoodQuantity() == 0) {
purchaseFoodBeanMap.remove(purchaseFoodBean.getId());
// purchaseFoodBeanMap.remove(purchaseFoodBean.getId());
SupplyShoppingCart.getInstance().removeFoodsByFoodId(purchaseFoodBean.getId());
} else {
purchaseFoodBeanMap.put(purchaseFoodBean.getId(), purchaseFoodBean);
// purchaseFoodBeanMap.put(purchaseFoodBean.getId(), purchaseFoodBean);
if (!SupplyShoppingCart.getInstance().getCartFoods().contains(purchaseFoodBean)) {
SupplyShoppingCart.getInstance().addFood(purchaseFoodBean);
}
}
}
......@@ -551,7 +562,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
}
/**
* 清除分類食材緩存
* 清除供應商食材緩存
*/
public void clearSupplierFoods() {
int size = supplierFoods.size();
......@@ -711,10 +722,29 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
if (isSupplier) {
BuyIngredientsBean buyIngredientsBean = supplierFoods.get(position);
if (buyIngredientsBean != null) {
showFoods.add(addToHead ? 0 : showFoods.size(), buyIngredientsBean);
List<BuyIngredientsBean> buyIngredientsBeans = new ArrayList<>();
buyIngredientsBeans.add(buyIngredientsBean);
mRootView.loadFood(buyIngredientsBeans, addToHead, isReset);
if (showFoods.contains(buyIngredientsBean)) {
//如果列表中已经有这个分类的数据,则加载上一个分类
position -= 1;
if (position >= 0 && position < categoryFoods.size()) {
loadCacheFood(isSupplier, position, addToHead, isReset);
} else {
mRootView.finishLoad(false);
}
} else {
Log.e("eee", "加载供應商缓存");
List<BuyIngredientsBean> food = new ArrayList<>();
food.add(supplierFoods.get(position));
if (addToHead) {
showFoods.addAll(0, food);
} else {
showFoods.addAll(food);
}
mRootView.loadFood(food, addToHead, isReset);
}
} else {
Log.e("eee", "没有供應商缓存" + position);
//需要通过接口
getFoodsBySupplier(position, supplierTranCategoryCache.get(position), addToHead, isReset);
}
} else {
List<BuyIngredientsBean> buyIngredientsBeans = categoryFoods.get(position);
......
......@@ -77,7 +77,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
/**
* 所上傳的圖片路徑集合
*/
private List<String> imgs;
private List<Object> imgs;
/**
* 逗號分隔符
*/
......@@ -340,7 +340,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
OrderWareHouseBean.PurchaseWarehousingOrder purchaseWarehousingOrder = new OrderWareHouseBean.PurchaseWarehousingOrder();
if (imgs != null) {
StringBuilder files = new StringBuilder();
for (String img : imgs) {
for (Object img : imgs) {
files.append(img).append(COMMA_SEPARATED);
}
String substring = files.substring(0, files.length());
......@@ -579,13 +579,17 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
});
}
public List<Object> getImgs() {
return imgs;
}
public void deletePic(int position) {
if (imgs != null && position < imgs.size()) {
imgs.remove(position);
}
}
public String getPic(int position) {
public Object getPic(int position) {
if (imgs != null && position < imgs.size()) {
return imgs.get(position);
}
......
......@@ -129,18 +129,11 @@ public class WareHouseListPresenter extends BasePresenter<WareHouseListContract.
@Override
public void onNext(WareHouseListBean wareHouseListBean) {
if (wareHouseListBean.isSuccess()) {
// if (data == null || pageIndex == 0) {
// data = new WareHouseListBean.WareHousingDataBean();
// data.setPurchaseWarehousingOrderDetailsVOS(new ArrayList<>());
// data.getPurchaseWarehousingOrderDetailsVOS().add(new PurchaseWarehousingOrderDetailsVO());
// }
// data.setTotal(wareHouseListBean.getData().getTotal());
if (CollectionUtils.isNullOrEmpty(wareHouseListBean.getData().getPurchaseWarehousingOrderDetailsVOS())) {
mRootView.finishLoadNoMoreData();
} else {
mRootView.loadWarehousingInfo(wareHouseListBean.getData());
}
// data.getPurchaseWarehousingOrderDetailsVOS().addAll(wareHouseListBean.getData().getPurchaseWarehousingOrderDetailsVOS());
} else if (TextUtil.isNotEmptyOrNullOrUndefined(wareHouseListBean.getErrMsg())) {
mRootView.showMessage(wareHouseListBean.getErrMsg());
mRootView.loadFail();
......
package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application;
import com.jess.arms.integration.AppManager;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.http.imageloader.ImageLoader;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.WarehousingOrderListContract;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/28/2021 19:21
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@FragmentScope
public class WarehousingOrderListPresenter extends BasePresenter<WarehousingOrderListContract.Model, WarehousingOrderListContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
@Inject
public WarehousingOrderListPresenter(WarehousingOrderListContract.Model model, WarehousingOrderListContract.View rootView) {
super(model, rootView);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
}
......@@ -47,7 +47,6 @@ public class SupplyChainMainActivity extends BaseFragmentActivity<SupplyChainMai
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SoftHideKeyBoardUtil.assistActivity(this);
}
@Override
......
......@@ -7,6 +7,7 @@ import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
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.threadPool.ThreadPoolManager;
......@@ -100,7 +101,7 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi
itemViewHolder.setText(R.id.tv_food_item_supplier_name, purchaseFoodBean.getSupplierName());
itemViewHolder.setImageResource(R.id.iv_food_ingredient_img, R.drawable.img_small_default);
if (TextUtil.isNotEmptyOrNullOrUndefined(purchaseFoodBean.getImages())) {
GlideUtils.display(mContext, (ImageView) itemViewHolder.get(R.id.iv_food_ingredient_img), purchaseFoodBean.getImages());
GlideUtils.display(mContext, itemViewHolder.get(R.id.iv_food_ingredient_img), purchaseFoodBean.getImages());
}
itemViewHolder.setText(R.id.tv_food_item_no, purchaseFoodBean.getFoodNo());
itemViewHolder.setText(R.id.tv_food_item_name, purchaseFoodBean.getName());
......@@ -110,7 +111,7 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi
} else {
itemViewHolder.setText(R.id.tv_food_item_unit, purchaseFoodBean.getBasicUnitName());
}
itemViewHolder.setText(R.id.tv_food_item_price, String.format(mContext.getString(R.string.amount_string), purchaseFoodBean.getUnitPrice()));
itemViewHolder.setText(R.id.tv_food_item_price, String.format(mContext.getString(R.string.amount_string_s), MoneyUtil.formatDouble(purchaseFoodBean.getUnitPrice())));
EditText edNumberInput = itemViewHolder.get(R.id.ed_food_ingredient_number);
edNumberInput.setText(String.valueOf(purchaseFoodBean.getFoodQuantity()), TextView.BufferType.EDITABLE);
//如果數量小於等於0,就不顯示減號和數量
......@@ -148,7 +149,7 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi
setDisplayStateByType(itemViewHolder, true, false, false);
} else if (adapterType == BuyIngredientsFragment.ADD_ORDER) {
//創建採購單頁面,隱藏編輯和刪除,顯示加減和數量
setDisplayStateByType(itemViewHolder, false, true, true);
setDisplayStateByType(itemViewHolder, false, purchaseFoodBean.getFoodQuantity() > 0, true);
} else if (adapterType == BuyIngredientsFragment.GET_FOOD_BY_SUPPLIER) {
//供應商商品列表,編輯和數量都顯示
setDisplayStateByType(itemViewHolder, true, purchaseFoodBean.getFoodQuantity() > 0, true);
......@@ -181,7 +182,7 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi
*/
private void setSubAndNumShow(BaseViewHolder viewHolder, boolean showOrHide) {
viewHolder.setVisible(R.id.btn_food_operation_sub, !showOrHide);
viewHolder.setInvisible(R.id.ed_food_ingredient_number, showOrHide);
viewHolder.setVisible(R.id.ed_food_ingredient_number, !showOrHide);
}
/**
......
......@@ -16,10 +16,12 @@
package com.gingersoft.supply_chain.mvp.ui.adapter;
import android.text.Layout;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.LinearLayout;
import androidx.recyclerview.widget.RecyclerView;
......
package com.gingersoft.supply_chain.mvp.ui.adapter;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.TextView;
......@@ -9,7 +7,7 @@ import androidx.core.content.ContextCompat;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.WarehouseDetailsBean;
import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.WarehouseDetailsFragment;
......@@ -44,52 +42,58 @@ public class WareHousingDetailsAdapter extends BaseQuickAdapter<WarehouseDetails
}
@Override
protected void convert(@NotNull BaseViewHolder viewHolder, WarehouseDetailsBean purchaseWarehousingOrderDetailsContentsBean) {
protected void convert(@NotNull BaseViewHolder viewHolder, WarehouseDetailsBean item) {
//食品名
viewHolder.setText(R.id.tv_warehouse_details_food_name, purchaseWarehousingOrderDetailsContentsBean.getName());
viewHolder.setText(R.id.tv_warehouse_details_food_name, item.getName());
//入庫單位
viewHolder.setText(R.id.tv_warehouse_details_food_unit, purchaseWarehousingOrderDetailsContentsBean.getUnitName());
viewHolder.setText(R.id.tv_warehouse_details_food_unit, item.getUnitName());
//入庫食品數量
// if (purchaseWarehousingOrderDetailsContentsBean.getFoodQuantity() > 0) {
// if (item.getFoodQuantity() > 0) {
if (type == WarehouseDetailsFragment.WAREHOUSE_TYPE) {
// 入庫,顯示+
if (purchaseWarehousingOrderDetailsContentsBean.getFoodQuantity() >= 0) {
if (item.getFoodQuantity() >= 0) {
//如果大於0,前面顯示+號
viewHolder.setText(R.id.tv_warehouse_details_food_num, String.format(getContext().getString(R.string.str_format_positive_int), purchaseWarehousingOrderDetailsContentsBean.getFoodQuantity()));
viewHolder.setText(R.id.tv_warehouse_details_food_num, String.format(getContext().getString(R.string.str_format_positive_int), item.getFoodQuantity()));
} else {
//小於0,直接顯示負數
viewHolder.setText(R.id.tv_warehouse_details_food_num, String.valueOf(purchaseWarehousingOrderDetailsContentsBean.getFoodQuantity()));
viewHolder.setText(R.id.tv_warehouse_details_food_num, String.valueOf(item.getFoodQuantity()));
}
viewHolder.setGone(R.id.tv_warehouse_time_text, false);
viewHolder.setText(R.id.tv_warehouse_order_time_text, "下單日期:");
//入庫日期
viewHolder.setText(R.id.tv_warehouse_details_time, purchaseWarehousingOrderDetailsContentsBean.getWarehousingTime());
viewHolder.setText(R.id.tv_warehouse_details_time, item.getWarehousingTime());
viewHolder.setGone(R.id.tv_warehouse_details_time, false);
viewHolder.setGone(R.id.tv_warehouse_details_remarks, true);
} else {
//出庫,顯示-
if (purchaseWarehousingOrderDetailsContentsBean.getFoodQuantity() >= 0) {
if (item.getFoodQuantity() >= 0) {
//如果大於0,前面顯示-號
viewHolder.setText(R.id.tv_warehouse_details_food_num, String.format(getContext().getString(R.string.str_format_less), purchaseWarehousingOrderDetailsContentsBean.getFoodQuantity() + ""));
viewHolder.setText(R.id.tv_warehouse_details_food_num, String.format(getContext().getString(R.string.str_format_less), item.getFoodQuantity() + ""));
} else {
//小於0,顯示正數,負負得正
viewHolder.setText(R.id.tv_warehouse_details_food_num, String.format(getContext().getString(R.string.str_format_positive), Math.abs(purchaseWarehousingOrderDetailsContentsBean.getFoodQuantity()) + ""));
viewHolder.setText(R.id.tv_warehouse_details_food_num, String.format(getContext().getString(R.string.str_format_positive), Math.abs(item.getFoodQuantity()) + ""));
}
// 入庫顯示消耗日期,不顯示入庫日期
viewHolder.setGone(R.id.tv_warehouse_time_text, true);
viewHolder.setGone(R.id.tv_warehouse_details_time, true);
//消耗日期
viewHolder.setText(R.id.tv_warehouse_order_time_text, "消耗日期:");
viewHolder.setGone(R.id.tv_warehouse_details_time, true);
//顯示備註
viewHolder.setGone(R.id.tv_warehouse_details_remarks, false);
if (TextUtil.isNotEmptyOrNullOrUndefined(item.getRemarks())) {
viewHolder.setText(R.id.tv_warehouse_details_remarks, String.format(getContext().getString(R.string.str_format_remark_colon), item.getRemarks()));
}
}
//下單時間
viewHolder.setText(R.id.tv_warehouse_details_order_time, purchaseWarehousingOrderDetailsContentsBean.getPurchaseTime());
viewHolder.setText(R.id.tv_warehouse_details_order_time, item.getPurchaseTime());
//供應商
viewHolder.setText(R.id.tv_warehouse_details_supplier, purchaseWarehousingOrderDetailsContentsBean.getSupplierName());
viewHolder.setText(R.id.tv_warehouse_details_supplier, item.getSupplierName());
//入庫來源
viewHolder.setText(R.id.tv_warehouse_details_reason, purchaseWarehousingOrderDetailsContentsBean.getPurchase());
viewHolder.setText(R.id.tv_warehouse_details_reason, item.getPurchase());
//設置狀態
TextView tvState = viewHolder.getView(R.id.tv_warehouse_state);
TextView tvExpiresTime = viewHolder.getView(R.id.tv_warehouse_expires_time);
if (purchaseWarehousingOrderDetailsContentsBean.getConsumeStatus() == WarehouseDetailsBean.WAREHOUSE_STATE_ALL_CONSUMED) {
if (item.getConsumeStatus() == WarehouseDetailsBean.WAREHOUSE_STATE_ALL_CONSUMED) {
//全部消耗了
tvState.setText("庫存已使用");
tvState.setTextColor(ContextCompat.getColor(getContext(), R.color.required_color));
......@@ -98,26 +102,26 @@ public class WareHousingDetailsAdapter extends BaseQuickAdapter<WarehouseDetails
tvExpiresTime.setVisibility(View.GONE);
} else {
//部分消耗
if (purchaseWarehousingOrderDetailsContentsBean.getConsumeStatus() == WarehouseDetailsBean.WAREHOUSE_STATE_PART_CONSUMED) {
if (item.getConsumeStatus() == WarehouseDetailsBean.WAREHOUSE_STATE_PART_CONSUMED) {
tvState.setText("部分使用");
tvState.setTextColor(ContextCompat.getColor(getContext(), R.color.bright_orange));
tvState.setVisibility(View.VISIBLE);
} else {
tvState.setVisibility(View.INVISIBLE);
}
if (purchaseWarehousingOrderDetailsContentsBean.getDistanceExpiresTime() >= 0) {
if (item.getDistanceExpiresTime() >= 0) {
//即將過期天數大於等於0
if (purchaseWarehousingOrderDetailsContentsBean.getWarningDays() > purchaseWarehousingOrderDetailsContentsBean.getDistanceExpiresTime()) {
if (item.getWarningDays() > item.getDistanceExpiresTime()) {
//在預警天數內
//顯示即將過期
setExpiresTime(tvExpiresTime, R.drawable.shape_oval_bright_orange, "即将過期:", purchaseWarehousingOrderDetailsContentsBean.getDistanceExpiresTime());
setExpiresTime(tvExpiresTime, R.drawable.shape_oval_bright_orange, "即将過期:", item.getDistanceExpiresTime());
} else {
tvExpiresTime.setVisibility(View.GONE);
tvState.setVisibility(View.GONE);
}
} else {
//天數為負,則是已過期
setExpiresTime(tvExpiresTime, R.drawable.shape_oval_red_wine, "已過期:", Math.abs(purchaseWarehousingOrderDetailsContentsBean.getDistanceExpiresTime()));
setExpiresTime(tvExpiresTime, R.drawable.shape_oval_red_wine, "已過期:", Math.abs(item.getDistanceExpiresTime()));
}
}
}
......
package com.gingersoft.supply_chain.mvp.ui.adapter
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.gingersoft.supply_chain.R
import com.gingersoft.supply_chain.mvp.bean.WarehouseOrderBean
/**
* @author 宇航. 1239658231@qq.com
* User: admin
* Date: 2021/4/28
* Time: 14:19
* Use:
*/
class WarehousingOrderListAdapter(data: MutableList<WarehouseOrderBean>?) : BaseQuickAdapter<WarehouseOrderBean, BaseViewHolder>(R.layout.item_warehousing_order_list, data) {
override fun convert(holder: BaseViewHolder, item: WarehouseOrderBean) {
holder.setText(R.id.tv_warehousing_order_no, item.orderNo)
holder.setText(R.id.tv_warehousing_order_createTime, item.warehousingTime)
holder.setText(R.id.tv_warehousing_order_species, item.warehousingSpecies)
holder.setText(R.id.tv_warehousing_order_createMember, item.warehousingMember)
holder.setText(R.id.tv_warehousing_order_foods, item.warehousingFoodName)
holder.setText(R.id.tv_warehousing_order_createReason, item.warehousingReason)
}
}
\ No newline at end of file
......@@ -141,7 +141,6 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
* true 是 false 否,顯示分類食材
*/
private boolean isShowSupplier = false;
private LoadService fullRegister;
/**
* 頁面類型
......@@ -218,7 +217,6 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
if (i >= 0) {
loadFirstCategoryInfo(i, true, false);
} else {
Log.e("eee", "没有更多数据了" + i);
setRefreshState(false);
}
}).setOnLoadMoreListener(refreshLayout -> {
......@@ -228,7 +226,6 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
//判斷是否有緩存,把緩存拿出來,看看有沒有加載到列表中,如果已經加載了,繼續獲取下一個分類,一直到沒有加載的那個
mPresenter.loadNextCategoryFood(isShowSupplier, i, firstLevelCategoryAdapter.getData());
} else {
Log.e("eee", "没有更多数据了" + i);
finishLoad(true);
}
}).setEnableOverScrollBounce(false).setEnableAutoLoadMore(true);
......@@ -238,7 +235,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
private void loadDataByType() {
//將購物車中的食品數據導出
//初始化購物車數量
setTvShoppingCartNum(mPresenter.tranShoppingCartToCache());
setTvShoppingCartNum(mPresenter.statisticsFoodQuantity());
if (pageType == GET_FOOD_BY_SUPPLIER) {
Bundle arguments = getArguments();
if (arguments != null) {
......@@ -252,18 +249,11 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
layoutIngredientsLeft.setVisibility(View.GONE);
//將顯示模式設置為顯示供應商
isShowSupplier = true;
//設置供應商信息
// this.supplierId = supplierId;
// setCurrentSupplierName(supplierName);
//將當前供應商信息緩存到緩存中
// mPresenter.addToSupplierCacheInfo(supplierId, supplierName);
//獲取該供應商數據
// getFoodsBySupplierId();
//隱藏二級分類
setSecondCategoryShowState(View.GONE);
mPresenter.initSupplierFoods(1);
//在一級分類中加載食品信息
initCategoryInfo(Collections.singletonList(supplierToCategory));
mPresenter.getFoodsBySupplier(0, supplierToCategory, false, true);
} else {
killMyself();
}
......@@ -383,7 +373,6 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
return;
}
int currentStickyGroup = stickyHeaderLayout.getCurrentStickyGroup();
Log.e("eee", dy + "當前組下標:" + currentStickyGroup);
//手指往上滑動,獲取下一個分類數據
//記錄當前滑動到哪個header,如果和上次不一致,頂部的分類就切換選中
if (currentStickyGroup != lastIndex) {
......@@ -396,12 +385,10 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
if (headerDataByPosition == null) {
return;
}
Log.e("eee", "當前分類名稱:" + headerDataByPosition.categoryName);
//頂部懸浮顯示的是一級分類
if (headerDataByPosition.parentId == 0) {
//找到這個一級分類,左側一級分類切換到選中,頂部二級分類切換顯示
int firstLevelCategoryIndex = firstLevelCategoryAdapter.getItemPosition(new OrderCategoryBean.FoodCategoryTrees(headerDataByPosition.id, headerDataByPosition.categoryName, headerDataByPosition.parentId));
Log.e("eee", "一級分類下標:" + firstLevelCategoryIndex);
if (firstLevelCategoryIndex > -1) {
//判斷這個分類是否已經被加載了,如果已經加載過了,就需要往下找,一直找到沒有被加載那個
selectFirstCategoryByIndex(firstLevelCategoryIndex);
......@@ -410,23 +397,18 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
//二級或三級分類,同時也要判斷是否要切換一級分類
OrderCategoryBean.FoodCategoryTrees currentStickyCategory = new OrderCategoryBean.FoodCategoryTrees(headerDataByPosition.id, headerDataByPosition.categoryName, headerDataByPosition.parentId);
int secondLevelCategoryIndex = secondCategoryAdapter.getItemPosition(currentStickyCategory);
Log.e("eee", "二級分類下標:" + secondLevelCategoryIndex);
if (secondLevelCategoryIndex >= 0) {
secondCategorySelect(secondLevelCategoryIndex, true);
} else {
//沒有這個二級或三級分類,判斷是否切換了一級分類
BuyIngredientsBean firstCategory = mPresenter.getFirstCategoryByIndex(currentStickyGroup);
if (firstCategory != null) {
Log.e("eee", "一級分類:" + firstCategory.categoryName);
OrderCategoryBean.FoodCategoryTrees foodCategoryTrees = new OrderCategoryBean.FoodCategoryTrees(firstCategory.id, firstCategory.categoryName, firstCategory.parentId);
int firstCategoryIndex = firstLevelCategoryAdapter.getItemPosition(foodCategoryTrees);
Log.e("eee", "一級分類下標:" + firstCategoryIndex);
if (firstCategoryIndex != firstLevelCategoryAdapter.getSelectedIndex()) {
if (firstCategoryIndex >= 0 && firstCategoryIndex != firstLevelCategoryAdapter.getSelectedIndex() && firstCategoryIndex < firstLevelCategoryAdapter.getItemCount()) {
//切換一級分類
selectFirstCategoryByIndex(firstCategoryIndex);
//切換一級分類後,再切換二級分類
// int secondLevelCategoryIndex2 = secondCategoryAdapter.getItemPosition(currentStickyCategory);
// secondCategorySelect(secondLevelCategoryIndex2, secondLevelCategoryIndex2 >= 0);
}
}
}
......@@ -503,9 +485,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
* 確認,進入購物車頁面
*/
private void confirm() {
SupplyShoppingCart.getInstance().clear();
List<PurchaseFoodBean> purchaseFood = mPresenter.getPurchaseFood();
SupplyShoppingCart.getInstance().addAllFood(mPresenter.getPurchaseFood());
if (CollectionUtils.isNotNullOrEmpty(purchaseFood)) {
startForResult(ShoppingCatFragment.newInstance(), TO_SHOPPING_CART_REQUEST_CODE);
} else {
......@@ -548,8 +528,6 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
private void loadFirstCategoryInfo(int position, boolean addToHead, boolean isReset) {
//切換右側顯示的二級分類和食材
// 现在改为在滑動事件中切換
// selectFirstCategoryByIndex(position);
Log.e("eee", "loadFirstCategoryInfo:" + position);
if (!mPresenter.isHasLocationInfo(isShowSupplier, position)) {
//本地沒有緩衝才去查找
//獲取點擊的分類的所有食材
......@@ -558,17 +536,14 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
} else {
mPresenter.getFoodByCategory(position, firstLevelCategoryAdapter.getItem(position), addToHead, isReset);
}
Log.e("eee", "没有缓存");
} else {
//本地有緩存,拿緩存中的數據
Log.e("eee", "讀緩存:" + position);
mPresenter.loadCacheFood(isShowSupplier, position, addToHead, isReset);
}
}
@Override
public void selectFirstCategoryByIndex(int position) {
Log.e("eee", "selectFirstCategoryByIndex");
firstLevelCategoryAdapter.setSelectedIndex(position);
loadSecondCategory(firstLevelCategoryAdapter.getItem(position).getFoodCategoryTrees());
ViewUtils.moveToCenterByVertical(rvFirstCategory, position);
......@@ -622,7 +597,6 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
*/
private void loadSecondCategory(List<OrderCategoryBean.FoodCategoryTrees> foodCategoryTrees) {
if (secondCategoryAdapter != null && CollectionUtils.isNullOrEmpty(foodCategoryTrees)) {
Log.e("eee", "沒有二級分類");
secondCategoryAdapter.setNewInstance(null);
return;
}
......@@ -644,9 +618,6 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
} else {
secondCategoryAdapter.setNewInstance(foodCategoryTrees);
}
// Log.e("eee", "二級分類加載完成" + foodCategoryTrees.size());
//默認選中第0個
// secondCategorySelect(0, foodCategoryTrees != null && foodCategoryTrees.size() > 0);
setSecondCategoryShowState(View.VISIBLE);
}
......@@ -663,6 +634,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
return;
}
}
fullRegister.showSuccess();
if (adapter == null) {
adapter = new BuyIngredientsAdapter(requireContext(), buyIngredientsBeans, pageType);
rvFoodIngredients.setAdapter(adapter);
......@@ -723,6 +695,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
endIndex += startIndex;
Log.e("eee", "開始:" + startIndex + "結束:" + endIndex);
adapter.addData(addToHead ? 0 : adapter.getData().size(), buyIngredientsBeans, startIndex, endIndex);
// adapter.setList(buyIngredientsBeans);
}
}
}
......@@ -773,13 +746,14 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
private void setTvShoppingCartNum(int num) {
//食材管理頁面,這個tvShoppingCart為空
if (tvShoppingCart != null) {
tvShoppingCart.setText(String.valueOf(shoppingCartNum));
tvShoppingCart.setText(String.valueOf(num));
if (num > 0) {
tvShoppingCart.setVisibility(View.VISIBLE);
} else {
tvShoppingCart.setVisibility(View.GONE);
}
}
shoppingCartNum = num;
}
private void setRefreshState(boolean noMoreData) {
......@@ -819,16 +793,20 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
private void refreshAllData() {
//之前去到購物車頁面,現在回到這個頁面
//購物車食材數量發生了變化,需要刷新當前頁面的食材數量
mPresenter.tranShoppingCartToCache();
//如果修改了供應商和分類信息,可以清除掉緩存再獲取,就能刷新頁面
//購物車食材數量發生了變化,需要刷新當前頁面的食材數量
setTvShoppingCartNum(mPresenter.statisticsFoodQuantity());
mPresenter.clearShowFoods();
mPresenter.clearCategoryFoods();
mPresenter.clearSupplierFoods();
mPresenter.clearSupplierCache();
mPresenter.clearCategoryTreesCache();
if (isShowSupplier) {
mPresenter.loadFoodIngredientsData(-1, true);
if (pageType == GET_FOOD_BY_SUPPLIER) {
mPresenter.getFoodsBySupplier(0, firstLevelCategoryAdapter.getItem(0), false, true);
} else {
mPresenter.loadFoodIngredientsData(-1, true);
}
} else {
mPresenter.getCategoryTrees();
}
......
......@@ -142,7 +142,7 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI
purchaseFoodBean = (PurchaseFoodBean) arguments.getSerializable(FOOD_INFO_KEY);
if (purchaseFoodBean == null) {
isUpdate = false;
initTopBar(topbarNewFoodIngredients, "新增食材");
initTopBar(topbarNewFoodIngredients, getString(R.string.str_new_add_ingredients));
purchaseFoodBean = new PurchaseFoodBean();
purchaseFoodBean.setFoodMarkSn(-1);
//拿到分類集合
......@@ -303,9 +303,7 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI
public boolean onBackPressedSupport() {
if (mPresenter.isUpdate(infoMultiAdapter.getData()) && !isLeave) {
//用戶修改了數據,提示是否保存
AppDialog.getInstance().showTipDialog(requireContext(), getString(R.string.str_about_to_leave), getString(R.string.str_yes), getString(R.string.str_no), (view, dialog) -> {
saveGoodsInfo();
}, (view, dialog) -> {
AppDialog.getInstance().showTipDialog(requireContext(), getString(R.string.str_about_to_leave), getString(R.string.str_yes), getString(R.string.str_no), this::saveGoodsInfo, () -> {
isLeave = true;
killMyself();
});
......
......@@ -32,6 +32,7 @@ import com.chad.library.adapter.base.BaseQuickAdapter;
import com.gingersoft.gsa.cloud.common.utils.CollectionUtils;
import com.gingersoft.gsa.cloud.common.utils.FileUtils;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.common.utils.glide.GlideUtils;
import com.gingersoft.gsa.cloud.common.utils.inputFilter.InputFilterUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
......@@ -60,7 +61,6 @@ import com.gingersoft.supply_chain.mvp.utils.ViewUtils;
import com.google.android.material.checkbox.MaterialCheckBox;
import com.google.android.material.textfield.TextInputLayout;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.http.imageloader.ImageLoader;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.enums.PopupPosition;
import com.lxj.xpopup.interfaces.OnSelectListener;
......@@ -71,6 +71,7 @@ import com.yalantis.ucrop.UCrop;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
......@@ -176,7 +177,7 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
tvOrderDetailsReceipt.setVisibility(isShow);
mPresenter.getOrderDetailsById(orderId);
} else {
showMessage("未獲取到訂單編號,請重試");
showMessage("未獲取到訂單編號,請退出重試");
killMyself();
}
}
......@@ -233,7 +234,7 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
for (PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean data : orderDetailsFoodAdapter.getData()) {
//只要有一個是選中的,就不循環了,開始收貨
if (data.isChecked()) {
AppDialog.getInstance().showTipDialog(requireContext(), getString(R.string.str_confirm_receipt), (view, dialog) -> {
AppDialog.getInstance().showTipDialog(requireContext(), getString(R.string.str_confirm_receipt), () -> {
mPresenter.addWarehouse(state, edRemark.getText() + "", totalAmount, orderDetailsFoodAdapter.getData());
setFragmentResult(RESULT_OK, null);
});
......@@ -251,7 +252,7 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
} else if (position == 1) {
//刪除訂單
if (orderDetailsFoodAdapter != null && !mPresenter.allWaitReceived(orderDetailsFoodAdapter.getData())) {
showMessage("有已收货食材,不可删除订单");
showMessage("有已收貨食材,訂單不可刪除");
return;
}
AppDialog.getInstance().showWaringDialog(mContext, "是否刪除訂單", (view1, dialog) -> mPresenter.deleteOrder());
......@@ -390,8 +391,9 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
@Override
public void nextFood() {
currentFoodIndex++;
checkAllForEach();
hideSoftInput();
// currentFoodIndex++;
// checkAllForEach();
}
@Override
......@@ -406,15 +408,12 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
mPresenter.deletePic(position);
} else if (view.getId() == R.id.iv_img) {
//預覽大圖
String pic = mPresenter.getPic(position);
if (TextUtil.isNotEmptyOrNullOrUndefined(pic)) {
new XPopup.Builder(requireContext())
.isDestroyOnDismiss(true)
.isDarkTheme(true)
.enableDrag(false)
.asImageViewer((ImageView) view, pic, true, Color.parseColor("#f1f1f1"), -1, -1, false, -1, new ImageLoader())
.show();
}
new XPopup.Builder(requireContext())
.isDestroyOnDismiss(true)
.isDarkTheme(false)
.enableDrag(false)
.asImageViewer((ImageView) view, position, mPresenter.getImgs(), false, false, Color.parseColor("#f1f1f1"), -1, -1, false, Color.parseColor("#f0f0f0"), null, new ImageLoader())
.show();
}
});
}
......@@ -591,69 +590,69 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
}
}
}
})
// .setMinCodeSize((int) infoVosBean.getShowUnit().getDeputyValue())
.setOnScanResultListener((popup, scanResult) -> {
//當前食材infoVosBean裡面有個sn碼集合,將scanResult添加進去
if (scanResult != null && scanResult.size() > 0) {
//过滤出新增的
List<PurchaseFoodEncodeSn> newAddSnCodes = new ArrayList<>(scanResult.size());
for (PurchaseFoodEncodeSn purchaseFoodEncodeSn : scanResult) {
if (foodEncodeSns == null || (purchaseFoodEncodeSn.newAdd && !foodEncodeSns.contains(purchaseFoodEncodeSn))) {
//判斷這個snCode是不是已經收過貨了,沒收過貨,新增的就為true
PurchaseFoodEncodeSn newSnCodeBean = new PurchaseFoodEncodeSn();
newSnCodeBean.setEncodeFoodNo(infoVosBean.getFoodNo());
newSnCodeBean.setEncodeOrderNo(infoVosBean.getOrderNo());
newSnCodeBean.setEncodeSnNo(purchaseFoodEncodeSn.getEncodeSnNo());
newSnCodeBean.newAdd = true;
newAddSnCodes.add(newSnCodeBean);
}
}
if (CollectionUtils.isNotNullOrEmpty(foodEncodeSns)) {
//扫描完后的所有sn和之前的sn比较,如果之前的sn没了,说明删除了,就从食品对象中移除掉
Iterator<PurchaseFoodEncodeSn> iterator = foodEncodeSns.iterator();
while (iterator.hasNext()) {
PurchaseFoodEncodeSn next = iterator.next();
if (!scanResult.contains(next)) {
//将不存在的移除掉
iterator.remove();
}
}
}
//添加到食品中去
if (foodEncodeSns != null) {
foodEncodeSns.addAll(newAddSnCodes);
} else {
infoVosBean.setPurchaseFoodEncodeSns(newAddSnCodes);
}
int newAddSize = 0;
//在這裡遍歷,防止用戶多次添加,卻沒有點擊收貨
for (PurchaseFoodEncodeSn purchaseFoodEncodeSn : infoVosBean.getPurchaseFoodEncodeSns()) {
if (purchaseFoodEncodeSn.newAdd) {
newAddSize++;
}
});
scanSnPopup.setOnScanResultListener((popup, scanResult) -> {
//當前食材infoVosBean裡面有個sn碼集合,將scanResult添加進去
if (scanResult != null && scanResult.size() > 0) {
//过滤出新增的
List<PurchaseFoodEncodeSn> newAddSnCodes = new ArrayList<>(scanResult.size());
for (PurchaseFoodEncodeSn purchaseFoodEncodeSn : scanResult) {
if (foodEncodeSns == null || (purchaseFoodEncodeSn.newAdd && !foodEncodeSns.contains(purchaseFoodEncodeSn))) {
//判斷這個snCode是不是已經收過貨了,沒收過貨,新增的就為true
PurchaseFoodEncodeSn newSnCodeBean = new PurchaseFoodEncodeSn();
newSnCodeBean.setEncodeFoodNo(infoVosBean.getFoodNo());
newSnCodeBean.setEncodeOrderNo(infoVosBean.getOrderNo());
newSnCodeBean.setEncodeSnNo(purchaseFoodEncodeSn.getEncodeSnNo());
newSnCodeBean.newAdd = true;
newAddSnCodes.add(newSnCodeBean);
}
}
if (CollectionUtils.isNotNullOrEmpty(foodEncodeSns)) {
//扫描完后的所有sn和之前的sn比较,如果之前的sn没了,说明删除了,就从食品对象中移除掉
Iterator<PurchaseFoodEncodeSn> iterator = foodEncodeSns.iterator();
while (iterator.hasNext()) {
PurchaseFoodEncodeSn next = iterator.next();
if (!scanResult.contains(next)) {
//将不存在的移除掉
iterator.remove();
}
//本次收貨數量=新增掃sn碼數量
DeputyUnitBean showUnit = infoVosBean.getShowUnit();
// if (newAddSize != showUnit.getDeputyValue()) {
// showMessage("新增SN数量必须和入库数一致");
// return;
// }
showUnit.setDeputyValue(newAddSize);
setFoodCheckState(orderDetailsFoodAdapter, position, infoVosBean);
popup.dismiss();
} else {
showMessage("請掃描食材sn碼");
}
});
}
//添加到食品中去
if (foodEncodeSns != null) {
foodEncodeSns.addAll(newAddSnCodes);
} else {
infoVosBean.setPurchaseFoodEncodeSns(newAddSnCodes);
}
int newAddSize = 0;
//在這裡遍歷,防止用戶多次添加,卻沒有點擊收貨
for (PurchaseFoodEncodeSn purchaseFoodEncodeSn : infoVosBean.getPurchaseFoodEncodeSns()) {
if (purchaseFoodEncodeSn.newAdd) {
newAddSize++;
}
}
//本次收貨數量=新增掃sn碼數量
DeputyUnitBean showUnit = infoVosBean.getShowUnit();
showUnit.setDeputyValue(newAddSize);
if (newAddSize > 0) {
setFoodCheckState(orderDetailsFoodAdapter, position, infoVosBean);
} else {
showMessage("收貨數量必須大於0");
}
scanSnPopup.dismissOrHideSoftInput();
if (!scanSnPopup.isDismiss()) {
scanSnPopup.dismiss();
}
} else {
showMessage("請掃描食材sn碼");
}
});
new XPopup.Builder(requireContext())
.hasShadowBg(false)
.asCustom(scanSnPopup)
.show();
if (!singerFood) {
scanSnPopup.setOnDismissListener(this::nextFood);
}
// if (!singerFood) {
// scanSnPopup.setOnDismissListener(this::nextFood);
// }
}
/**
......
......@@ -118,9 +118,7 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres
if (viewId == R.id.tv_order_content_complete) {
//完成,篩選出選擇的食品
if (mPresenter.filterData(shoppingCartAdapter.getData())) {
AppDialog.getInstance().showTipDialog(requireContext(), "確認創建訂單?", (view, dialog) -> {
mPresenter.createOrder(shoppingCartAdapter.getData());
});
AppDialog.getInstance().showTipDialog(requireContext(), "確認創建訂單?", () -> mPresenter.createOrder(shoppingCartAdapter.getData()));
}
} else if (viewId == R.id.btn_order_content_order_template) {
//訂單模板
......@@ -139,7 +137,7 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres
shoppingCartAdapter = new ShoppingCartAdapter(mContext, shoppingCartBeans);
shoppingCartAdapter.setOnFoodDeleteListener((supplierIndex, foodListVosBean) -> {
//從購物車元數據移除掉這個食材
SupplyShoppingCart.getInstance().getCartFoods().remove(foodListVosBean);
SupplyShoppingCart.getInstance().removeFood(foodListVosBean);
List<ShoppingCartBean> shoppingCartAdapterData = shoppingCartAdapter.getData();
//購物車adapter移除這個供應商
if (shoppingCartAdapterData.get(supplierIndex).getFoodList().size() <= 0) {
......@@ -154,6 +152,9 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres
setAllSelect(shoppingCartAdapterData);
mPresenter.verificationMixAmount(shoppingCartAdapter.getData());
setFragmentResult(RESULT_OK, null);
if (shoppingCartAdapter.getItemCount() <= 0) {
killMyself();
}
});
rvOrderContent.setAdapter(shoppingCartAdapter);
setAllSelect(shoppingCartBeans);
......@@ -193,6 +194,8 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres
@Override
public void addOrderSuccess(List<ConfirmOrderBean.PurchaseOrder> purchaseOrders) {
setFragmentResult(RESULT_OK, null);
SupplyShoppingCart.getInstance().clear();
startWithPop(SendMsgFragment.newInstance(purchaseOrders));
}
......
......@@ -65,18 +65,8 @@ public class WareHouseListFragment extends BaseSupplyChainFragment<WareHouseList
TextView tvLowInventoryFoodNum;
@BindView(R2.id.tv_ingredients_cost_inventory)
TextView tvIngredientsCostInventory;
// @BindView(R2.id.rv_warehouse_list)
// RecyclerView rvWarehouseList;
@BindView(R2.id.table_ware_housing_list)
TableView mTableView;
// @BindView(R2.id.sl_warehousing_list)
// SmartRefreshLayout smartRefreshLayout;
// @BindView(R2.id.tv_warehouse_item_unit_price)
// TextView tvUnitPrice;
// @BindView(R2.id.tv_warehouse_item_inventory_quantity)
// TextView tvWarehousingQuantity;
// @BindView(R2.id.tv_warehouse_item_total_amount)
// TextView tvTotalAmount;
private int SORT_TYPE = 0;
/**
......@@ -111,7 +101,6 @@ public class WareHouseListFragment extends BaseSupplyChainFragment<WareHouseList
@Override
public void initData(@Nullable Bundle savedInstanceState) {
// smartRefreshLayout.setPrimaryColorsId(R.color.trans, R.color.black);
initTopBar(supplyTopBar, "庫存查詢");
loadService = LoadSir.getDefault().register(mTableView);
getWarehousing();
......
......@@ -546,10 +546,10 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
if (inventoryConsumptionView != null) {
if (scanSnView != null && scanSnView.getSnSize() > 0) {
//當前顯示著掃SN碼消耗,判斷有沒有SN碼,有的話提示是否保存
AppDialog.getInstance().showTipDialog(requireContext(), getString(R.string.str_info_not_save_about_to_leave), (view, dialog) -> {
AppDialog.getInstance().showTipDialog(requireContext(), getString(R.string.str_info_not_save_about_to_leave), () -> {
isLeave = true;
showList(View.VISIBLE);
}, (view, dialog) -> isLeave = false);
}, () -> isLeave = false);
} else {
showList(View.VISIBLE);
}
......
......@@ -3,7 +3,6 @@ package com.gingersoft.supply_chain.mvp.ui.fragment.warehouse;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
......@@ -18,28 +17,21 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import com.billy.cc.core.component.CC;
import com.gingersoft.gsa.cloud.common.loadsir.EmptyCallback;
import com.gingersoft.gsa.cloud.common.utils.CollectionUtils;
import com.gingersoft.gsa.cloud.common.utils.XPermissionUtils;
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.toast.ToastUtils;
import com.gingersoft.gsa.cloud.component.ComponentName;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2;
import com.gingersoft.supply_chain.di.component.DaggerWarehousingInventoryComponent;
import com.gingersoft.supply_chain.mvp.bean.InventoryRecordBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodEncodeSn;
import com.gingersoft.supply_chain.mvp.bean.PurchaseWarehousingOrderDetailsVO;
import com.gingersoft.supply_chain.mvp.contract.WarehousingInventoryContract;
import com.gingersoft.supply_chain.mvp.presenter.WarehousingInventoryPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.InventoryRecordAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.gingersoft.supply_chain.mvp.ui.widget.ScanSnPopup;
import com.gingersoft.supply_chain.mvp.ui.widget.ScanSnView;
import com.jess.arms.di.component.AppComponent;
import com.kingja.loadsir.LoadSirUtil;
import com.kingja.loadsir.callback.Callback;
import com.kingja.loadsir.core.LoadSir;
import com.qmuiteam.qmui.util.QMUIDisplayHelper;
......@@ -49,8 +41,6 @@ import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import java.util.List;
import butterknife.BindView;
import butterknife.OnClick;
import cn.bingoogolapple.qrcode.core.BarcodeType;
import static com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean.HAS_SN;
......
package com.gingersoft.supply_chain.mvp.ui.fragment.warehouse;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.jess.arms.di.component.AppComponent;
import com.gingersoft.supply_chain.di.component.DaggerWarehousingOrderListComponent;
import com.gingersoft.supply_chain.mvp.contract.WarehousingOrderListContract;
import com.gingersoft.supply_chain.mvp.presenter.WarehousingOrderListPresenter;
import com.gingersoft.supply_chain.R;
import static com.jess.arms.utils.Preconditions.checkNotNull;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/28/2021 19:21
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public class WarehousingOrderListFragment extends BaseSupplyChainFragment<WarehousingOrderListPresenter> implements WarehousingOrderListContract.View {
public static WarehousingOrderListFragment newInstance() {
WarehousingOrderListFragment fragment = new WarehousingOrderListFragment();
return fragment;
}
@Override
public void setupFragmentComponent(@NonNull AppComponent appComponent) {
DaggerWarehousingOrderListComponent //如找不到该类,请编译一下项目
.builder()
.appComponent(appComponent)
.view(this)
.build()
.inject(this);
}
@Override
public View initView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_warehousing_list, container, false);
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
}
}
......@@ -126,10 +126,12 @@ public class InventoryConsumptionView extends FrameLayout {
edInput.setEnabled(enabled);
return this;
}
public InventoryConsumptionView setHint(String hint) {
edInput.setHint(hint);
return this;
}
public InventoryConsumptionView setOnConfirmClickListener(OnConfirmClickListener onConfirmClickListener) {
this.onConfirmClickListener = onConfirmClickListener;
return this;
......@@ -178,20 +180,24 @@ public class InventoryConsumptionView extends FrameLayout {
int i = Integer.parseInt(s);
if (i > 0) {
if (i > maxConsumption) {
edInput.setError("不能超過當前庫存數量:" + maxConsumption);
String errMsg = "不能超過當前庫存數量:" + maxConsumption;
edInput.setError(errMsg);
ToastUtils.show(getContext(), errMsg);
return -1;
} else {
return i;
}
} else {
ToastUtils.show(getContext(), "請輸入消耗庫存數");
edInput.setError("請輸入消耗庫存數");
String errMsg = "請輸入消耗庫存數";
ToastUtils.show(getContext(), errMsg);
edInput.setError(errMsg);
return -1;
}
} catch (NumberFormatException e) {
e.printStackTrace();
ToastUtils.show(getContext(), "請輸入消耗庫存數");
edInput.setError("請輸入消耗庫存數");
String errMsg = "請輸入消耗庫存數";
ToastUtils.show(getContext(), errMsg);
edInput.setError(errMsg);
return -1;
}
}
......@@ -211,6 +217,7 @@ public class InventoryConsumptionView extends FrameLayout {
}
public void setConsumptionNumber(int consumptionNumber) {
edInput.setError(null);
edInput.setText(String.valueOf(consumptionNumber));
}
......
......@@ -13,6 +13,7 @@ import com.gingersoft.supply_chain.R2;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodEncodeSn;
import com.jess.arms.utils.DeviceUtils;
import com.lxj.xpopup.core.BottomPopupView;
import com.qmuiteam.qmui.util.QMUIDisplayHelper;
import java.util.ArrayList;
import java.util.List;
......@@ -84,12 +85,16 @@ public class ScanSnPopup extends BottomPopupView {
rootLayout.addView(new ScanSnView(fragment, snCodes)
.setOnScanResultListener((popup, scanResult) -> onScanResultListener.onScanResult(ScanSnPopup.this, scanResult))
.setOnDeleteSnCodeListener(onDeleteListener)
.setOnCancelListener(this::dismiss)
.setMinCodeSize(minCodeSize)
.setMaxCodeSize(maxCodeSize)
.setOnSingerResultListener((isAdd, snCode, currentSnCodeNumber) -> {
//每掃描出一個調用
tvFoodInboundQuantity.setText(String.valueOf(currentSnCodeNumber));
}).setOnCancelListener(() -> {
dismissOrHideSoftInput();
if (!isDismiss()) {
dismiss();
}
}).init()
, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
} else {
......@@ -108,15 +113,10 @@ public class ScanSnPopup extends BottomPopupView {
}
@Override
protected int getMaxHeight() {
return (int) (DeviceUtils.getScreenHeight(getContext()) / 2);
protected int getPopupHeight() {
return QMUIDisplayHelper.getScreenHeight(getContext()) / 2;
}
// @Override
// protected int getPopupHeight() {
// return (int) (DeviceUtils.getScreenHeight(getContext()) / 2);
// }
public interface OnScanResultListener {
/**
* 掃完碼確認之後回調
......
......@@ -7,6 +7,7 @@ import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
......@@ -186,8 +187,7 @@ public class ScanSnView extends FrameLayout {
btnFoodIngredientsCancel.setOnClickListener(v -> {
if (adapter.getData().size() != initCodeSize) {
AppDialog.getInstance().showWaringDialog(getContext(), "關閉後不會保存SN碼記錄", (view, dialog) -> {
dialog.dismiss();
AppDialog.getInstance().showTipDialog(getContext(), "關閉後不會保存SN碼記錄", () -> {
if (onCancelListener != null) {
onCancelListener.onCancel();
}
......@@ -198,15 +198,19 @@ public class ScanSnView extends FrameLayout {
});
adapter.setOnItemChildClickListener((adapter1, view, position) -> {
if (view.getId() == R.id.iv_sn_code_delete) {
onSingerResultListener.onScanValue(false, adapter.getItem(position), adapter.getItemCount());
if (onDeleteSnCodeListener != null) {
onDeleteSnCodeListener.onDelete(adapter.getItem(position), position);
}
if (adapter.getItem(position).newAdd) {
newCodeSize--;
onSingerResultListener.onScanValue(false, adapter.getItem(position), adapter.getItemCount());
if (onDeleteSnCodeListener != null) {
onDeleteSnCodeListener.onDelete(adapter.getItem(position), position);
}
if (adapter.getItem(position).newAdd) {
newCodeSize--;
}
adapter1.removeAt(position);
setConfirmBtnState();
} else {
ToastUtils.show(getContext(), "已入庫的SN碼不可刪除");
}
adapter1.removeAt(position);
setConfirmBtnState();
}
});
addView(rootView);
......@@ -271,7 +275,7 @@ public class ScanSnView extends FrameLayout {
private void addSnCode(SnCodeAdapter adapter, String snCode) {
PurchaseFoodEncodeSn purchaseFoodEncodeSn = new PurchaseFoodEncodeSn(snCode);
purchaseFoodEncodeSn.newAdd = true;
adapter.addData(purchaseFoodEncodeSn);
adapter.addData(0, purchaseFoodEncodeSn);
newCodeSize++;
edInputSn.setText("");
setConfirmBtnState();
......@@ -362,6 +366,12 @@ public class ScanSnView extends FrameLayout {
viewHolder.setTextColor(R.id.tv_sn_code, ContextCompat.getColor(getContext(), R.color.color_3c));
viewHolder.setTextColor(R.id.tv_serial_number, ContextCompat.getColor(getContext(), R.color.color_3c));
viewHolder.setGone(R.id.iv_sn_code_delete, false);
ImageView ivDelete = viewHolder.getView(R.id.iv_sn_code_delete);
if (s.newAdd) {
ivDelete.clearColorFilter();
} else {
ivDelete.setColorFilter(ContextCompat.getColor(getContext(), R.color.color_ccc));
}
viewHolder.setGone(R.id.it_sn_code_operating, true);
viewHolder.setText(R.id.tv_serial_number, String.valueOf(viewHolder.getAdapterPosition() + 1));
if (viewHolder.getAdapterPosition() % 2 == 0) {
......
......@@ -45,7 +45,8 @@
android:id="@+id/rv_order_content"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_5"
android:paddingBottom="@dimen/dp_5"
android:layout_weight="1"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
......
......@@ -70,7 +70,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_6"
tools:text="100" />
android:text="@string/str_zero" />
</LinearLayout>
<LinearLayout
......@@ -96,7 +96,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_6"
tools:text="3" />
android:text="@string/str_zero" />
</LinearLayout>
<LinearLayout
......@@ -122,7 +122,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_6"
tools:text="7" />
android:text="@string/str_zero" />
</LinearLayout>
<LinearLayout
......@@ -148,8 +148,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_6"
android:textColor="@color/required_color"
tools:text="¥10000.00" />
android:text="@string/str_zero"
android:textColor="@color/required_color" />
</LinearLayout>
</LinearLayout>
......
......@@ -4,7 +4,6 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:background="@color/supply_chain_bg_color"
android:orientation="vertical">
......@@ -163,6 +162,7 @@
android:id="@+id/vp_warehouse_viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="true"
android:layout_marginTop="@dimen/dp_10" />
</LinearLayout>
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
......
<?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:orientation="vertical">
<include layout="@layout/supply_chain_top_bar" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_second_category"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</LinearLayout>
\ No newline at end of file
......@@ -11,7 +11,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="@dimen/head_height"
android:drawableTop="@mipmap/loadsir_empty"
android:drawableTop="@drawable/ic_not_have_goods"
android:drawablePadding="@dimen/dp_10"
android:gravity="center"
android:text="@string/emptyView_mode_desc_double"
......
......@@ -85,7 +85,7 @@
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_weight="0.5"
android:textSize="@dimen/dp_12"
tools:text="3KG/盒" />
......@@ -97,8 +97,18 @@
android:textSize="@dimen/dp_12"
android:textStyle="bold"
android:visibility="gone" />
</LinearLayout>
<TextView
android:id="@+id/tv_food_item_price"
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="end"
android:textColor="@color/required_color"
android:textStyle="bold"
tools:text="$100.00" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
......@@ -109,16 +119,10 @@
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_food_item_price"
style="@style/Food_Ingredient_Info_TextStyle"
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/required_color"
android:textStyle="bold"
tools:text="$100.00" />
android:layout_height="0dp"
android:layout_weight="1" />
<!-- <LinearLayout-->
<!-- android:id="@+id/layout_operation_food_num"-->
<!-- android:layout_width="wrap_content"-->
......@@ -132,8 +136,8 @@
android:layout_height="@dimen/dp_26"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_5"
android:src="@drawable/ic_blue_edit"
android:padding="@dimen/dp_3"
android:src="@drawable/ic_blue_edit"
android:visibility="gone" />
<ImageView
......@@ -162,7 +166,7 @@
android:focusableInTouchMode="true"
android:gravity="center"
android:inputType="number"
android:maxLength="5"
android:maxLength="4"
android:maxLines="1"
android:paddingLeft="@dimen/dp_4"
android:paddingRight="@dimen/dp_4"
......
......@@ -112,6 +112,8 @@
android:layout_marginLeft="@dimen/dp_9"
android:layout_weight="1"
android:background="@drawable/shape_border_bg_c8"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -147,6 +149,8 @@
android:layout_marginLeft="@dimen/dp_9"
android:layout_weight="1"
android:background="@drawable/shape_border_bg_c8"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -164,10 +168,10 @@
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_5"
android:background="@null"
android:paddingRight="@dimen/dp_10"
android:gravity="end|center_vertical"
android:inputType="numberDecimal"
android:maxLines="1"
android:paddingRight="@dimen/dp_10"
android:textColor="@color/color_3c"
android:textCursorDrawable="@drawable/cursor_theme"
android:textSize="@dimen/dp_15"
......
......@@ -84,7 +84,7 @@
tools:text="肥牛天地供應商" />
</LinearLayout>
<LinearLayout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_6"
......@@ -99,36 +99,43 @@
android:layout_height="wrap_content"
android:text="入庫日期:"
android:textColor="@color/color_3c"
android:textSize="@dimen/sp_16"/>
android:textSize="@dimen/sp_16"
android:visibility="gone" />
<TextView
android:id="@+id/tv_warehouse_details_time"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/tv_warehouse_details_reason"
android:layout_toRightOf="@id/tv_warehouse_time_text"
android:layout_weight="1"
android:textColor="@color/color_3c"
android:textSize="@dimen/sp_16"
android:visibility="gone"
tools:text="2020-11-20" />
<TextView
android:id="@+id/tv_warehouse_details_remarks"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@id/tv_warehouse_details_reason"
android:paddingRight="@dimen/dp_5"
android:textColor="@color/color_3c"
android:textSize="@dimen/sp_14"
android:visibility="gone"
tools:text="備註:是打飛機死垃圾分類三代機福利社利社的" />
android:visibility="visible"
tools:text="備註:" />
<TextView
android:id="@+id/tv_warehouse_details_reason"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:gravity="end"
android:textColor="@color/color_3c"
android:textSize="@dimen/sp_14"
tools:text="採購入庫" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_10"
android:background="@drawable/shape_white_eight_corners_bg"
android:elevation="@dimen/dp_2"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_40"
android:layout_marginLeft="@dimen/dp_8"
android:layout_marginRight="@dimen/dp_8"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_warehousing_order_no"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="1"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_17"
tools:text="入庫單號" />
<TextView
android:id="@+id/tv_warehousing_order_createTime"
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:gravity="right"
android:maxLines="1"
tools:text="2020-11-20 12:00" />
</LinearLayout>
<include layout="@layout/include_horizontal_color_eee_dividing_line" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="@dimen/dp_8">
<TextView
android:id="@+id/tv_warehousing_order_species"
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="種類:12" />
<TextView
android:id="@+id/tv_warehousing_order_createMember"
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_5"
android:layout_weight="1"
android:gravity="end"
tools:text="入庫人" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="@dimen/dp_8"
android:paddingRight="@dimen/dp_8"
android:paddingBottom="@dimen/dp_8">
<TextView
android:id="@+id/tv_warehousing_order_foods"
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:singleLine="true"
tools:text="巴西肥牛、澳洲牛排" />
<TextView
android:id="@+id/tv_warehousing_order_createReason"
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="調撥入庫" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
......@@ -8,17 +8,17 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/dp_9"
android:paddingBottom="@dimen/dp_6"
android:background="@drawable/shape_white_top_border"
android:gravity="center_vertical"
android:orientation="horizontal"
android:background="@drawable/shape_white_top_border"
android:paddingLeft="@dimen/dp_19"
android:paddingRight="@dimen/dp_19">
android:paddingTop="@dimen/dp_9"
android:paddingRight="@dimen/dp_19"
android:paddingBottom="@dimen/dp_6">
<TextView
style="@style/WareHouse_Title_TextStyle"
android:id="@+id/tv_hint_scan_sn"
style="@style/WareHouse_Title_TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/str_enter_scan_sn" />
......
......@@ -56,5 +56,6 @@
<string name="str_choice_category">選擇類別</string>
<string name="str_select_least_one_product">至少選擇一個商品</string>
<string name="str_confirm_receipt">是否確認收貨?</string>
<string name="str_new_add_ingredients">新增食材</string>
</resources>
\ No newline at end of file
......@@ -57,10 +57,8 @@ public class SoftHideKeyBoardUtil {
if (usableHeightNow != usableHeightPrevious) {
//3、获取Activity中xml中布局在当前界面显示的高度
int usableHeightSansKeyboard = mChildOfContent.getRootView().getHeight();
Log.e("eee", "顯示高度:" + usableHeightSansKeyboard);
//4、Activity中xml布局的高度-当前可用高度
int heightDifference = usableHeightSansKeyboard - usableHeightNow;
Log.e("eee", "鍵盤高度:" + heightDifference);
//5、高度差大于屏幕1/4时,说明键盘弹出
if (heightDifference > (usableHeightSansKeyboard / 4)) {
// 6、键盘弹出了,Activity的xml布局高度应当减去键盘高度
......@@ -69,7 +67,6 @@ public class SoftHideKeyBoardUtil {
} else {
frameLayoutParams.height = usableHeightSansKeyboard - heightDifference;
}
Log.e("eee", "頁面高度:" + frameLayoutParams.height);
} else {
frameLayoutParams.height = contentHeight;
}
......
package com.gingersoft.gsa.cloud.common.constans;
import com.gingersoft.gsa.cloud.common.function.FModule;
public class FunctionManagerConstants {
public static class takeaway{
public static final String CONFIRM_BTN_KEY = "takeaway/orderDetails/btn/confirmOrder";
public static final String PRODUCTION_COMPLETED_BTN_KEY = "takeaway/orderDetails/btn/ProductionCompleted";
public static final String CANCEL_ORDER_BTN_KEY = "takeaway/orderDetails/btn/cancelOrder";
public static final String PRINT_ORDER_BTN_KEY = "takeaway/orderDetails/btn/printOrder";
public static final String LOGISTICS_BTN_KEY = "takeaway/orderDetails/btn/logistics";
public static final String ASSIGNDELIVERY_BTN_KEY = "takeaway/orderDetails/btn/assignDelivery";
public static final String CLOSING_BTN_KEY = "takeaway/orderDetails/btn/closing";
public static final String TRANSPORTATION_BTN_KEY = "takeaway/orderDetails/btn/transportation";
public static final String ADDITIONALSERVICECHARGE_BTN_KEY = "takeaway/orderDetails/btn/additionalServiceCharge";
//新訂單
public static final String TAKEAWAY_NEW_ORDER = "takeaway/btn/newOrder";
//歷史訂單
public static final String TAKEAWAY_HISTORY_ORDER = "takeaway/btn/historyOrder";
//開錢箱
public static final String TAKEAWAY_OPEN_CASH_BOX = "takeaway/btn/openCashBox";
/** 外送/自取- 訂單詳情管理 */
public static final FModule[] orderDetails = {
new FModule(CONFIRM_BTN_KEY, 0, 0),
new FModule(PRODUCTION_COMPLETED_BTN_KEY, 0, 0),
new FModule(CANCEL_ORDER_BTN_KEY, 0, 0),
new FModule(PRINT_ORDER_BTN_KEY, 0, 0),
new FModule(LOGISTICS_BTN_KEY, 0, 0),
new FModule(ASSIGNDELIVERY_BTN_KEY, 0, 0),
new FModule(CLOSING_BTN_KEY, 0, 0),
new FModule(TRANSPORTATION_BTN_KEY, 0, 0),
new FModule(ADDITIONALSERVICECHARGE_BTN_KEY, 0, 0)
};
/** 外送/自取- 首頁按鈕管理 */
public static final FModule[] takeawayMain = {
new FModule(TAKEAWAY_NEW_ORDER, 0, 0)
};
}
}
package com.gingersoft.gsa.cloud.common.constans;
import com.gingersoft.gsa.cloud.common.function.FModule;
import com.gingersoft.gsa.cloud.common.function.XFunctionItems;
/**
* @author admin
* 外送按鈕功能權限
*/
public class Takeaway {
public static final String TAKEAWAY_ORDER_DETAILS = "takeaway/orderDetails/btn/";
public static final String TAKEAWAY_ORDER_DETAILS_ENFORCE = "takeaway/orderDetails/btn/enforce/";
public static final String TAKEAWAY_BTN = "takeaway/btn/";
public static final String CONFIRM_BTN_KEY = TAKEAWAY_ORDER_DETAILS + "confirmOrder";
public static final String PRODUCTION_COMPLETED_BTN_KEY = TAKEAWAY_ORDER_DETAILS + "ProductionCompleted";
public static final String CANCEL_ORDER_BTN_KEY = TAKEAWAY_ORDER_DETAILS + "cancelOrder";
public static final String PRINT_ORDER_BTN_KEY = TAKEAWAY_ORDER_DETAILS + "printOrder";
public static final String LOGISTICS_BTN_KEY = TAKEAWAY_ORDER_DETAILS + "logistics";
public static final String ASSIGN_DELIVERY_BTN_KEY = TAKEAWAY_ORDER_DETAILS + "assignDelivery";
public static final String CLOSING_BTN_KEY = TAKEAWAY_ORDER_DETAILS + "closing";
public static final String TRANSPORTATION_BTN_KEY = TAKEAWAY_ORDER_DETAILS + "transportation";
public static final String ADDITIONAL_SERVICE_CHARGE_BTN_KEY = TAKEAWAY_ORDER_DETAILS + "additionalServiceCharge";
/**
* 新訂單
*/
public static final String TAKEAWAY_NEW_ORDER = TAKEAWAY_BTN + "newOrder";
/**
* 歷史訂單
*/
public static final String TAKEAWAY_HISTORY_ORDER = TAKEAWAY_BTN + "historyOrder";
/**
* 開錢箱
*/
public static final String TAKEAWAY_OPEN_CASH_BOX = TAKEAWAY_BTN + "openCashBox";
/**
* 外送/自取- 訂單詳情管理
*/
@XFunctionItems(TAKEAWAY_ORDER_DETAILS)
public static final FModule[] ORDER_DETAILS_BTN_PERMISSION = {
new FModule(CONFIRM_BTN_KEY, 0, 0),
new FModule(PRODUCTION_COMPLETED_BTN_KEY, 0, 0),
new FModule(CANCEL_ORDER_BTN_KEY, 0, 0),
new FModule(PRINT_ORDER_BTN_KEY, 0, 0),
new FModule(LOGISTICS_BTN_KEY, 0, 0),
new FModule(ASSIGN_DELIVERY_BTN_KEY, 0, 0),
new FModule(CLOSING_BTN_KEY, 0, 0),
new FModule(TRANSPORTATION_BTN_KEY, 0, 0),
new FModule(ADDITIONAL_SERVICE_CHARGE_BTN_KEY, 0, 0)
};
/**
* 外送/自取- 訂單詳情強制按鈕
*/
@XFunctionItems(TAKEAWAY_ORDER_DETAILS_ENFORCE)
public static final FModule[] ORDER_DETAILS_BTN_ENFORCE_PERMISSION = {
new FModule(TAKEAWAY_ORDER_DETAILS_ENFORCE + "EnforceConfirmOrder", 0, 0),//強制確認訂單
new FModule(TAKEAWAY_ORDER_DETAILS_ENFORCE + "EnforceProductionCompleted", 0, 0),//強制製作完成
new FModule(TAKEAWAY_ORDER_DETAILS_ENFORCE + "EnforceCancelOrder", 0, 0),//強制取消訂單
new FModule(TAKEAWAY_ORDER_DETAILS_ENFORCE + "EnforcePrintOrder", 0, 0),//強制打印訂單
new FModule(TAKEAWAY_ORDER_DETAILS_ENFORCE + "EnforceCancelLogistics", 0, 0),//強制取消物流
new FModule(TAKEAWAY_ORDER_DETAILS_ENFORCE + "EnforceAssignDelivery", 0, 0),//強制指派送貨
new FModule(TAKEAWAY_ORDER_DETAILS_ENFORCE + "EnforceClosing", 0, 0)//強制結賬
};
/**
* 外送/自取- 首頁按鈕管理
*/
@XFunctionItems(TAKEAWAY_BTN)
public static final FModule[] TAKEAWAY_MAIN_BTN_PERMISSION = {
new FModule(TAKEAWAY_NEW_ORDER, 0, 0),
new FModule(TAKEAWAY_HISTORY_ORDER, 0, 0),
new FModule(TAKEAWAY_OPEN_CASH_BOX, 0, 0)
};
}
......@@ -31,11 +31,18 @@ public class FunctionManager {
public List<Function> getFunctionByResModule(Context context, Class c, FModule[] fModules, String specific) {
String resLoction = c.getSimpleName().toLowerCase() + "/" + specific;
String resLocation = c.getSimpleName().toLowerCase() + "/" + specific;
FunctionDaoUtils daoUtils = new FunctionDaoUtils(context);
List<Function> functionList = daoUtils.queryAllFunction();
return filterFunctionByResLoction(functionList, fModules, resLoction);
return filterFunctionByResLoction(functionList, fModules, resLocation);
}
public List<Function> getFunctionByResModule(Context context, FModule[] fModules, String specific) {
String resLocation = specific;
FunctionDaoUtils daoUtils = new FunctionDaoUtils(context);
List<Function> functionList = daoUtils.queryAllFunction();
return filterFunctionByResLoction(functionList, fModules, resLocation);
}
private List<Function> filterFunctionByResLoction(List<Function> functionList, FModule[] fModules, String resLoction) {
......
......@@ -34,7 +34,6 @@ public class BaseQueicItemClickAspect {
*/
@Around("onItemSingleClickMethod()")
public void doItemSingleClickMethod(ProceedingJoinPoint joinPoint) throws Throwable {
Log.d("SingleClickAspect", "來了");
View view = null;
for (Object arg : joinPoint.getArgs()) {
if (arg instanceof View) {
......
......@@ -10,7 +10,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@mipmap/loadsir_empty"
android:drawableTop="@drawable/ic_not_have_goods"
android:gravity="center"
android:drawablePadding="@dimen/dp_10"
android:textColor="#999999"
......
......@@ -10,7 +10,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@mipmap/loadsir_empty"
android:drawableTop="@drawable/ic_not_have_goods"
android:gravity="center"
android:drawablePadding="@dimen/dp_10"
android:textColor="#999999"
......
......@@ -10,7 +10,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@mipmap/loadsir_empty"
android:drawableTop="@drawable/ic_not_have_goods"
android:gravity="center"
android:drawablePadding="@dimen/dp_10"
android:textColor="#999999"
......
<resources>
<string name="base_app_name">public-base</string>
<string name="str_zero">0</string>
<string name="str_one">1</string>
<string name="str_two">2</string>
<string name="str_three">3</string>
<string name="str_four">4</string>
<string name="str_five">5</string>
<string name="str_six">6</string>
<string name="str_seven">7</string>
<string name="str_eight">8</string>
<string name="str_nine">9</string>
<string name="Key_0">0</string>
<string name="Key_00">00</string>
......@@ -233,6 +243,8 @@
<string name="str_determine">確定</string>
<string name="str_remark">備註</string>
<string name="str_remark_colon">備註:</string>
<string name="str_format_remark_colon">備註:%1$s</string>
<string name="str_save">保存</string>
<string name="str_inventory">盤點</string>
......
......@@ -16,6 +16,7 @@ import com.jess.arms.utils.ArmsUtils;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.impl.InputConfirmPopupView;
import com.lxj.xpopup.interfaces.OnCancelListener;
import com.lxj.xpopup.interfaces.OnConfirmListener;
import java.util.List;
......@@ -33,19 +34,19 @@ public class AppDialog {
}
public void showWaringDialog(Context context, String title, DialogOnClickListenter sureOnclickListener) {
public void showWaringDialog(Context context, String title, DialogOnClickListener sureOnclickListener) {
showWaringDialog(context, title, null, null, sureOnclickListener, null, true);
}
public void showWaringDialog(Context context, String title, boolean isDismiss, DialogOnClickListenter sureOnclickListener) {
public void showWaringDialog(Context context, String title, boolean isDismiss, DialogOnClickListener sureOnclickListener) {
showWaringDialog(context, title, null, null, sureOnclickListener, null, isDismiss);
}
public void showWaringDialog(Context context, String title, boolean isDismiss, DialogOnClickListenter sureOnclickListener, DialogOnClickListenter cancelOnclickListener) {
public void showWaringDialog(Context context, String title, boolean isDismiss, DialogOnClickListener sureOnclickListener, DialogOnClickListener cancelOnclickListener) {
showWaringDialog(context, title, null, null, sureOnclickListener, cancelOnclickListener, isDismiss);
}
private void showWaringDialog(Context context, String title, String confimText, String cancelText, DialogOnClickListenter sureOnclickListener, DialogOnClickListenter cancelOnclickListener, boolean isDismiss) {
private void showWaringDialog(Context context, String title, String confimText, String cancelText, DialogOnClickListener sureOnclickListener, DialogOnClickListener cancelOnclickListener, boolean isDismiss) {
//DialogUtils內存洩漏,換Xpopup
new DialogUtils(context, R.layout.other_order_pause_orders) {
@Override
......@@ -76,7 +77,7 @@ public class AppDialog {
}.show();
}
public void showSelectDialog(Context context, String title, int spanCount, RecyclerView.Adapter adapter, DialogOnClickListenter sureOnclickListenter) {
public void showSelectDialog(Context context, String title, int spanCount, RecyclerView.Adapter adapter, DialogOnClickListener sureOnclickListenter) {
new DialogUtils(context, R.layout.dialog_select_layout) {
@Override
public void initLayout(ViewHepler hepler, Dialog dialog) {
......@@ -105,41 +106,42 @@ public class AppDialog {
/**
* 藍色的提示框
*/
public void showTipDialog(Context context, String title, DialogOnClickListenter sureOnclickListenter) {
showTipDialog(context, title, context.getString(R.string.str_determine), context.getString(R.string.str_cancel), sureOnclickListenter, null);
public void showTipDialog(Context context, String title, OnConfirmListener sureOnclickListener) {
showTipDialog(context, title, context.getString(R.string.str_determine), context.getString(R.string.str_cancel), sureOnclickListener, null);
}
/**
* 藍色的提示框
*/
public void showTipDialog(Context context, String title, DialogOnClickListenter sureOnclickListenter, DialogOnClickListenter onCancelListener) {
showTipDialog(context, title, context.getString(R.string.str_determine), context.getString(R.string.str_cancel), sureOnclickListenter, onCancelListener);
}
public void showTipDialog(Context context, String title, String sureBtnText, String cancelBtnText, DialogOnClickListenter sureOnclickListener, DialogOnClickListenter onCancelListener) {
new DialogUtils(context, R.layout.dialog_tip) {
@Override
public void initLayout(ViewHepler hepler, Dialog dialog) {
if (title != null) {
hepler.setText(R.id.tv_warning_title, title);
}
hepler.getView(R.id.tv_dialog_cancel).setOnClickListener(v -> dialog.dismiss());
((TextView) hepler.getView(R.id.tv_dialog_confirm)).setText(sureBtnText);
((TextView) hepler.getView(R.id.tv_dialog_cancel)).setText(cancelBtnText);
hepler.getView(R.id.tv_dialog_confirm).setOnClickListener(v -> {
if (sureOnclickListener != null) {
sureOnclickListener.onclick(v, dialog);
}
dialog.dismiss();
});
hepler.getView(R.id.tv_dialog_cancel).setOnClickListener(v -> {
dismiss();
if (onCancelListener != null) {
onCancelListener.onclick(v, dialog);
}
});
}
}.show();
public void showTipDialog(Context context, String title, OnConfirmListener sureOnclickListener, OnCancelListener onCancelListener) {
showTipDialog(context, title, context.getString(R.string.str_determine), context.getString(R.string.str_cancel), sureOnclickListener, onCancelListener);
}
public void showTipDialog(Context context, String title, String sureBtnText, String cancelBtnText, OnConfirmListener sureOnclickListener, OnCancelListener onCancelListener) {
new XPopup.Builder(context).asConfirm(title, "", cancelBtnText, sureBtnText, sureOnclickListener, onCancelListener, false, R.layout.dialog_tip).show();
// new DialogUtils(context, R.layout.dialog_tip) {
// @Override
// public void initLayout(ViewHepler hepler, Dialog dialog) {
// if (title != null) {
// hepler.setText(R.id.tv_warning_title, title);
// }
// hepler.getView(R.id.tv_dialog_cancel).setOnClickListener(v -> dialog.dismiss());
// ((TextView) hepler.getView(R.id.tv_dialog_confirm)).setText(sureBtnText);
// ((TextView) hepler.getView(R.id.tv_dialog_cancel)).setText(cancelBtnText);
// hepler.getView(R.id.tv_dialog_confirm).setOnClickListener(v -> {
// if (sureOnclickListener != null) {
// sureOnclickListener.onclick(v, dialog);
// }
// dialog.dismiss();
// });
// hepler.getView(R.id.tv_dialog_cancel).setOnClickListener(v -> {
// dismiss();
// if (onCancelListener != null) {
// onCancelListener.onclick(v, dialog);
// }
// });
// }
// }.show();
}
public void showListDialog(Context context, String[] data, onDialogSelectListener onSelectListener) {
......@@ -168,7 +170,7 @@ public class AppDialog {
}
public interface DialogOnClickListenter {
public interface DialogOnClickListener {
void onclick(View view, Dialog dialog);
}
......
package com.gingersoft.gsa.cloud.common.ui.utils
package com.gingersoft.gsa.cloud.ui.utils
import com.gingersoft.gsa.cloud.common.constans.FunctionManagerConstants
import com.gingersoft.gsa.cloud.common.constans.Takeaway
import com.gingersoft.gsa.cloud.database.bean.Function
import com.gingersoft.gsa.cloud.ui.R
/**
* 凍鏈外送都需要用到
*/
class BtnBuilder {
lateinit var functions: List<Function>
......@@ -17,6 +20,14 @@ class BtnBuilder {
const val ProductionCompletedBtn = 6
const val TransportationBtn = 7//選擇運輸工具
const val AdditionalServiceChargeBtn = 8//追加服務費
//強制
const val EnforceSureBtn = 9
const val EnforceCancelBtn = 10
const val EnforcePrintBtn = 11
const val EnforceLogisticsBtn = 12
const val EnforceAssignDeliveryBtn = 13
const val EnforceClosingBtn = 14
const val EnforceProductionCompletedBtn = 15
@Volatile
private var instance: BtnBuilder? = null
......@@ -37,54 +48,80 @@ class BtnBuilder {
class BtnBean(val type: Int, var btnContent: String, val btnColor: Int, val btnImg: Int)
fun getSureBtn(): BtnBean? {
return getBtn(FunctionManagerConstants.takeaway.CONFIRM_BTN_KEY, SureBtn, "確認訂單", R.color.other_order_details_sure_btn_color, R.drawable.ic_sure)
return getBtn(Takeaway.CONFIRM_BTN_KEY, SureBtn, "確認訂單", R.color.other_order_details_sure_btn_color, R.drawable.ic_sure)
}
fun getProductionCompletedBtn(): BtnBean? {
return getBtn(FunctionManagerConstants.takeaway.PRODUCTION_COMPLETED_BTN_KEY, ProductionCompletedBtn, "製作完成", R.color.other_order_details_sure_btn_color, R.drawable.ic_sure)
return getBtn(Takeaway.PRODUCTION_COMPLETED_BTN_KEY, ProductionCompletedBtn, "製作完成", R.color.other_order_details_sure_btn_color, R.drawable.ic_sure)
}
fun getCancelBtn(): BtnBean? {
return getBtn(FunctionManagerConstants.takeaway.CANCEL_ORDER_BTN_KEY, CancelBtn, "取消訂單", R.color.other_order_details_cancel_btn_color, R.drawable.ic_cancel)
return getBtn(Takeaway.CANCEL_ORDER_BTN_KEY, CancelBtn, "取消訂單", R.color.other_order_details_cancel_btn_color, R.drawable.ic_cancel)
}
fun getPrintBtn(): BtnBean? {
return getBtn(FunctionManagerConstants.takeaway.PRINT_ORDER_BTN_KEY, PrintBtn, "打印訂單", R.color.other_order_details_print_btn_color, R.drawable.ic_print)
return getBtn(Takeaway.PRINT_ORDER_BTN_KEY, PrintBtn, "打印訂單", R.color.other_order_details_print_btn_color, R.drawable.ic_print)
}
fun getLogisticsBtn(): BtnBean? {
return getBtn(FunctionManagerConstants.takeaway.LOGISTICS_BTN_KEY, LogisticsBtn, "取消物流", R.color.other_order_details_cancel_logistics_btn_color, R.drawable.ic_logistics)
return getBtn(Takeaway.LOGISTICS_BTN_KEY, LogisticsBtn, "取消物流", R.color.other_order_details_cancel_logistics_btn_color, R.drawable.ic_logistics)
}
fun getAssignDeliveryBtn(): BtnBean? {
return getBtn(FunctionManagerConstants.takeaway.ASSIGNDELIVERY_BTN_KEY, AssignDeliveryBtn, "指派送貨", R.color.other_order_details_sure_btn_color, R.drawable.ic_deliveryman)
return getBtn(Takeaway.ASSIGN_DELIVERY_BTN_KEY, AssignDeliveryBtn, "指派送貨", R.color.other_order_details_sure_btn_color, R.drawable.ic_deliveryman)
}
fun getClosingBtn(): BtnBean? {
return getBtn(FunctionManagerConstants.takeaway.CLOSING_BTN_KEY, ClosingBtn, "結賬", R.color.other_order_details_cancel_btn_color, R.drawable.ic_closing)
return getBtn(Takeaway.CLOSING_BTN_KEY, ClosingBtn, "結賬", R.color.other_order_details_cancel_btn_color, R.drawable.ic_closing)
}
fun getTransportationBtn(): BtnBean? {
return getBtn(FunctionManagerConstants.takeaway.TRANSPORTATION_BTN_KEY, TransportationBtn, "運輸工具", R.color.other_order_details_cancel_logistics_btn_color, R.drawable.ic_logistics)
return getBtn(Takeaway.TRANSPORTATION_BTN_KEY, TransportationBtn, "運輸工具", R.color.other_order_details_cancel_logistics_btn_color, R.drawable.ic_logistics)
}
fun getAdditionalServiceChargeBtn(): BtnBean? {
return getBtn(FunctionManagerConstants.takeaway.ADDITIONALSERVICECHARGE_BTN_KEY, AdditionalServiceChargeBtn, "追加貼士", R.color.additional_service_charge_btn_color, R.drawable.ic_additional_service_charge)
return getBtn(Takeaway.ADDITIONAL_SERVICE_CHARGE_BTN_KEY, AdditionalServiceChargeBtn, "追加貼士", R.color.additional_service_charge_btn_color, R.drawable.ic_additional_service_charge)
}
fun getEnforceSureBtn(): BtnBean? {
return getBtn(Takeaway.CONFIRM_BTN_KEY, SureBtn, "確認訂單", R.color.other_order_details_sure_btn_color, R.drawable.ic_sure)
}
fun getEnforceProductionCompletedBtn(): BtnBean? {
return getBtn(Takeaway.PRODUCTION_COMPLETED_BTN_KEY, ProductionCompletedBtn, "製作完成", R.color.other_order_details_sure_btn_color, R.drawable.ic_sure)
}
fun getEnforceCancelBtn(): BtnBean? {
return getBtn(Takeaway.CANCEL_ORDER_BTN_KEY, CancelBtn, "取消訂單", R.color.other_order_details_cancel_btn_color, R.drawable.ic_cancel)
}
fun getEnforcePrintBtn(): BtnBean? {
return getBtn(Takeaway.PRINT_ORDER_BTN_KEY, PrintBtn, "打印訂單", R.color.other_order_details_print_btn_color, R.drawable.ic_print)
}
fun getEnforceLogisticsBtn(): BtnBean? {
return getBtn(Takeaway.LOGISTICS_BTN_KEY, LogisticsBtn, "取消物流", R.color.other_order_details_cancel_logistics_btn_color, R.drawable.ic_logistics)
}
fun getEnforceAssignDeliveryBtn(): BtnBean? {
return getBtn(Takeaway.ASSIGN_DELIVERY_BTN_KEY, AssignDeliveryBtn, "指派送貨", R.color.other_order_details_sure_btn_color, R.drawable.ic_deliveryman)
}
fun getEnforceClosingBtn(): BtnBean? {
return getBtn(Takeaway.CLOSING_BTN_KEY, ClosingBtn, "結賬", R.color.other_order_details_cancel_btn_color, R.drawable.ic_closing)
}
private fun getBtn(key: String, btnCode: Int, btnContent: String, btnColor: Int, btnImg: Int): BtnBean? {
for (value in functions) {
if (value.resUrl == key) {
return when {
value.status == 3 -> BtnBean(btnCode, btnContent, R.color.color_ccc, btnImg)
// value.status == 1 -> BtnBean(btnCode, btnContent, btnColor, btnImg)
return when (value.status) {
3 -> BtnBean(btnCode, btnContent, R.color.color_ccc, btnImg)
else -> BtnBean(btnCode, btnContent, btnColor, btnImg)
}
}
}
return null
// return BtnBean(btnCode, btnContent, btnColor, btnImg)
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/shape_white_eight_corners_bg"
......@@ -16,13 +17,21 @@
android:src="@drawable/ic_question_prompt" />
<TextView
android:id="@+id/tv_warning_title"
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_22"
android:text="是否暫停接單?"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_20" />
android:textSize="@dimen/dp_20"
tools:text="是否暫停接單?" />
<TextView
android:id="@+id/tv_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_20"
android:visibility="gone" />
<LinearLayout
android:layout_width="wrap_content"
......@@ -31,7 +40,7 @@
android:orientation="horizontal">
<TextView
android:id="@+id/tv_dialog_confirm"
android:id="@+id/tv_confirm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape_theme_eight_corners_bg"
......@@ -44,7 +53,7 @@
android:textSize="@dimen/dp_15" />
<TextView
android:id="@+id/tv_dialog_cancel"
android:id="@+id/tv_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_28"
......
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