Commit 268b6d27 by Wyh

1、替換了彈窗實現 2、報表的時間問題 3、外送訂單報表數據不顯示的BUG

parent 3586c6d6
...@@ -489,9 +489,7 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre ...@@ -489,9 +489,7 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre
mPresenter.updateRestOpenStatus(state, restaurantId); mPresenter.updateRestOpenStatus(state, restaurantId);
} else { } else {
//提示補單 //提示補單
new AppDialog().showWaringDialog(this, "是否暫停接單?", (view, dialog) -> { AppDialog.getInstance().showWaringDialog(this, "是否暫停接單?", () -> mPresenter.updateRestOpenStatus(state, restaurantId));
mPresenter.updateRestOpenStatus(state, restaurantId);
});
} }
restaurantPopup.dismiss(); restaurantPopup.dismiss();
} }
...@@ -501,9 +499,7 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre ...@@ -501,9 +499,7 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre
mPresenter.pickUp(restaurantId); mPresenter.pickUp(restaurantId);
} else { } else {
//提示補單 //提示補單
new AppDialog().showWaringDialog(this, "不滿足送貨條件,是否需要補單?", (view, dialog) -> { AppDialog.getInstance().showTipDialog(this, "不滿足送貨條件,是否需要補單?", () -> jumpSupplementOrder(bean));
jumpSupplementOrder(bean);
});
} }
} }
......
...@@ -345,7 +345,7 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailsPresenter> im ...@@ -345,7 +345,7 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailsPresenter> im
}); });
} else if (realBtnBeans.get(position).getType() == BtnBuilder.CancelBtn) { } else if (realBtnBeans.get(position).getType() == BtnBuilder.CancelBtn) {
//取消訂單 //取消訂單
new AppDialog().showWaringDialog(this, "確認取消訂單?", (v, dialog) -> { AppDialog.getInstance().showWaringDialog(this, "確認取消訂單?", () -> {
if (bean.isDelete() == 0) { if (bean.isDelete() == 0) {
mPresenter.cancelOrderAndLogistics(orderId); mPresenter.cancelOrderAndLogistics(orderId);
} else { } else {
...@@ -354,9 +354,7 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailsPresenter> im ...@@ -354,9 +354,7 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailsPresenter> im
}); });
} else if (realBtnBeans.get(position).getType() == BtnBuilder.LogisticsBtn) { } else if (realBtnBeans.get(position).getType() == BtnBuilder.LogisticsBtn) {
//取消物流 //取消物流
new AppDialog().showWaringDialog(this, "確認取消物流?", (v, dialog) -> { AppDialog.getInstance().showWaringDialog(this, "確認取消物流?", () -> mPresenter.cancelLogistics(bean.getID(), false));
mPresenter.cancelLogistics(bean.getID(), false);
});
} else if (realBtnBeans.get(position).getType() == BtnBuilder.PrintBtn) { } else if (realBtnBeans.get(position).getType() == BtnBuilder.PrintBtn) {
//打印 //打印
requestPermissions((allGranted, grantedList, deniedList) -> { requestPermissions((allGranted, grantedList, deniedList) -> {
......
...@@ -213,9 +213,7 @@ public class PrjQueryActivity extends BaseActivity<PrjQueryPresenter> implements ...@@ -213,9 +213,7 @@ public class PrjQueryActivity extends BaseActivity<PrjQueryPresenter> implements
List<PrjBean> prjData = prjQueryBean.getData(); List<PrjBean> prjData = prjQueryBean.getData();
if (prjData.get(position).getPrinterType() == 3) { if (prjData.get(position).getPrinterType() == 3) {
//已打印的,提示是否重新打印 //已打印的,提示是否重新打印
new AppDialog().showWaringDialog(mContext, "食品已打印,確認重印?", (view1, dialog) -> { AppDialog.getInstance().showTipDialog(mContext, "食品已打印,確認重印?", () -> organizeData(position, prjData));
organizeData(position, prjData);
});
} else { } else {
organizeData(position, prjData); organizeData(position, prjData);
} }
......
...@@ -371,18 +371,9 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen ...@@ -371,18 +371,9 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen
pageViewModel.updateRestOpenStatus(state) pageViewModel.updateRestOpenStatus(state)
} else { } else {
//暫停接單,彈窗向用戶確認是否關閉 //暫停接單,彈窗向用戶確認是否關閉
object : DialogUtils(this, R.layout.other_order_pause_orders) { AppDialog.getInstance().showWaringDialog(this, "是否暫停接單?") {
override fun initLayout(hepler: ViewHepler, dialog: Dialog) {
hepler.getView<TextView>(R.id.tv_dialog_confirm).setOnClickListener {
it.isClickable = false
pageViewModel.updateRestOpenStatus(state) pageViewModel.updateRestOpenStatus(state)
dialog.dismiss()
} }
hepler.getView<TextView>(R.id.tv_dialog_cancel).setOnClickListener {
dialog.dismiss()
}
}
}.show()
} }
restaurantPopup?.dismiss() restaurantPopup?.dismiss()
} }
...@@ -396,7 +387,7 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen ...@@ -396,7 +387,7 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen
val notification: NotificationManagerCompat = NotificationManagerCompat.from(this) val notification: NotificationManagerCompat = NotificationManagerCompat.from(this)
if (!notification.areNotificationsEnabled()) { if (!notification.areNotificationsEnabled()) {
//未開啟通知權限 //未開啟通知權限
AppDialog().showTipDialog(this, "檢測到通知權限未打開,建議打開,否則會影響正常使用!") { -> AppDialog().showTipDialog(this, "檢測到通知權限未打開,建議打開,否則會影響正常使用!") {
val intent = Intent() val intent = Intent()
when { when {
SDK_INT >= Build.VERSION_CODES.O -> { SDK_INT >= Build.VERSION_CODES.O -> {
...@@ -464,7 +455,7 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen ...@@ -464,7 +455,7 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen
//查詢預約單和即時單數量 //查詢預約單和即時單數量
pageViewModel.getOrderStatistics(fragmentStatus[view_pager.currentItem]) pageViewModel.getOrderStatistics(fragmentStatus[view_pager.currentItem])
} }
} else if(type == 1){ } else if (type == 1) {
//長連接登陸成功,也刷新一下列表 //長連接登陸成功,也刷新一下列表
getCurrentPageOrderList() getCurrentPageOrderList()
} }
......
...@@ -51,13 +51,10 @@ import com.gingersoft.gsa.delivery_pick_mode.ui.base.BaseActivity ...@@ -51,13 +51,10 @@ import com.gingersoft.gsa.delivery_pick_mode.ui.base.BaseActivity
import com.gingersoft.gsa.delivery_pick_mode.util.InjectorUtil import com.gingersoft.gsa.delivery_pick_mode.util.InjectorUtil
import com.gingersoft.gsa.delivery_pick_mode.util.getCustomColor import com.gingersoft.gsa.delivery_pick_mode.util.getCustomColor
import com.gingersoft.gsa.delivery_pick_mode.util.showSelectDialog 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.jess.arms.mvp.IPresenter
import com.lxj.xpopup.XPopup import com.lxj.xpopup.XPopup
import com.lxj.xpopup.interfaces.OnSelectListener
import com.qmuiteam.qmui.widget.QMUITopBar import com.qmuiteam.qmui.widget.QMUITopBar
import kotlinx.android.synthetic.main.activity_order_details.* import kotlinx.android.synthetic.main.activity_order_details.*
import kotlinx.android.synthetic.main.activity_other_order.*
import java.util.* import java.util.*
class OrderDetailsActivity : BaseActivity<IPresenter>() { class OrderDetailsActivity : BaseActivity<IPresenter>() {
...@@ -667,11 +664,10 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() { ...@@ -667,11 +664,10 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
} }
private fun PageViewModel.showIsUpdateTransportation(it: List<TransportationBean.DataX.Transportation>, orderDetails: OrderDetails.DataBean, isPrint: Boolean) { private fun PageViewModel.showIsUpdateTransportation(it: List<TransportationBean.DataX.Transportation>, orderDetails: OrderDetails.DataBean, isPrint: Boolean) {
showWaringDialog("金額範圍和對應的運輸工具不符,是否修改運輸工具", { dialog -> AppDialog.getInstance().showTipDialog(mContext,"金額範圍和對應的運輸工具不符,是否修改運輸工具", { ->
//要修改運輸工具,彈出彈窗讓用戶選擇 //要修改運輸工具,彈出彈窗讓用戶選擇
showSelectTransportation(it, orderDetails, isPrint) showSelectTransportation(it, orderDetails, isPrint)
dialog.dismiss() }, { ->
}, { dialog ->
//不修改運輸工具,使用默認的 //不修改運輸工具,使用默認的
for (value in it) { for (value in it) {
if (value.status == 1) { if (value.status == 1) {
...@@ -679,7 +675,6 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() { ...@@ -679,7 +675,6 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
break break
} }
} }
dialog.dismiss()
}) })
} }
...@@ -800,8 +795,7 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() { ...@@ -800,8 +795,7 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
* 是否確認取消訂單 * 是否確認取消訂單
*/ */
private fun PageViewModel.isSureCancelOrder(orderDetails: OrderDetails.DataBean, reasonId: String, reasonDesc: String) { private fun PageViewModel.isSureCancelOrder(orderDetails: OrderDetails.DataBean, reasonId: String, reasonDesc: String) {
showWaringDialog("是否確認取消訂單?", { dialog -> AppDialog.getInstance().showWaringDialog(mContext,"是否確認取消訂單?") { ->
dialog.dismiss()
showLoading() showLoading()
if (orderDetails.isDelete == 0) { if (orderDetails.isDelete == 0) {
//是第三方物流單,先取消物流,再取消訂單 //是第三方物流單,先取消物流,再取消訂單
...@@ -828,9 +822,7 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() { ...@@ -828,9 +822,7 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
} }
} }
} }
}, { }
it.dismiss()
})
} }
/** /**
...@@ -858,7 +850,7 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() { ...@@ -858,7 +850,7 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
* 是否確認取消物流 * 是否確認取消物流
*/ */
private fun PageViewModel.confirmCancelLogistics(orderId: String, reasonId: String, reasonDesc: String) { private fun PageViewModel.confirmCancelLogistics(orderId: String, reasonId: String, reasonDesc: String) {
AppDialog().showWaringDialog(this@OrderDetailsActivity, "是否確認取消第三方派送?") { _, _ -> AppDialog.getInstance().showWaringDialog(this@OrderDetailsActivity, "是否確認取消第三方派送?") { ->
showLoading() showLoading()
cancelLogistics(restaurantId, orderId, reasonId, reasonDesc) { cancelLogistics(restaurantId, orderId, reasonId, reasonDesc) {
cancelDialogForLoading() cancelDialogForLoading()
......
package com.gingersoft.gsa.delivery_pick_mode.ui.activity package com.gingersoft.gsa.delivery_pick_mode.ui.activity
import android.app.Dialog
import android.os.Bundle import android.os.Bundle
import android.widget.TextView
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
...@@ -14,7 +12,7 @@ import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager ...@@ -14,7 +12,7 @@ import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil import com.gingersoft.gsa.cloud.common.utils.MoneyUtil
import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils
import com.gingersoft.gsa.cloud.pay.bean.PayMethod import com.gingersoft.gsa.cloud.pay.bean.PayMethod
import com.gingersoft.gsa.cloud.ui.utils.DialogUtils import com.gingersoft.gsa.cloud.ui.utils.AppDialog
import com.gingersoft.gsa.delivery_pick_mode.R import com.gingersoft.gsa.delivery_pick_mode.R
import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.BillBean import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.BillBean
import com.gingersoft.gsa.delivery_pick_mode.model.viewModel.PageViewModel import com.gingersoft.gsa.delivery_pick_mode.model.viewModel.PageViewModel
...@@ -67,7 +65,7 @@ class PayActivity : BaseActivity<IPresenter>() { ...@@ -67,7 +65,7 @@ class PayActivity : BaseActivity<IPresenter>() {
} }
other_pay_view.loadInfo(this, ArrayList<PayMethod>(), totalAmount, foodCount) other_pay_view.loadInfo(this, ArrayList<PayMethod>(), totalAmount, foodCount)
pageViewModel.getPayMethod(RestaurantInfoManager.newInstance().getBrandId(), RestaurantInfoManager.newInstance().getRestaurantId()) pageViewModel.getPayMethod(RestaurantInfoManager.newInstance().brandId, RestaurantInfoManager.newInstance().restaurantId)
pageViewModel.payTypeBean.observe(this, Observer { pageViewModel.payTypeBean.observe(this, Observer {
//獲取支付方式 //獲取支付方式
// other_pay_view.loadInfo(this, PayTypeInfo.getPayMethodByPayType(it), MoneyUtil.sub(orderDetails.TOTAL_AMOUNT!!.toDouble(), orderDetails.discount_amount), foodCount) // other_pay_view.loadInfo(this, PayTypeInfo.getPayMethodByPayType(it), MoneyUtil.sub(orderDetails.TOTAL_AMOUNT!!.toDouble(), orderDetails.discount_amount), foodCount)
...@@ -80,15 +78,11 @@ class PayActivity : BaseActivity<IPresenter>() { ...@@ -80,15 +78,11 @@ class PayActivity : BaseActivity<IPresenter>() {
other_pay_view.setmOnSureClickLisenter { payMethods -> other_pay_view.setmOnSureClickLisenter { payMethods ->
//確認結賬,調用結賬接口 //確認結賬,調用結賬接口
object : DialogUtils(this, R.layout.other_order_pause_orders) { AppDialog.getInstance().showTipDialog(this, "是否確認結賬?") {
override fun initLayout(hepler: ViewHepler, dialog: Dialog) {
hepler.setText(R.id.tv_warning_title, "是否確認結賬?")
hepler.getView<TextView>(R.id.tv_dialog_confirm).setOnClickListener {
dialog.dismiss()
showLoading() showLoading()
if (OrderDetails.verificationAmount(orderDetails)) { if (OrderDetails.verificationAmount(orderDetails)) {
ToastUtils.show(this@PayActivity, verifiAmountTip) ToastUtils.show(this@PayActivity, verifiAmountTip)
return@setOnClickListener return@showTipDialog
} }
pageViewModel.closingBill(orderDetails, payMethods) { _, _ -> pageViewModel.closingBill(orderDetails, payMethods) { _, _ ->
cancelDialogForLoading() cancelDialogForLoading()
...@@ -96,17 +90,7 @@ class PayActivity : BaseActivity<IPresenter>() { ...@@ -96,17 +90,7 @@ class PayActivity : BaseActivity<IPresenter>() {
finish() finish()
} }
// pageViewModel.gsUpdateOrderStatus(orderDetails, payMethods[0].id, payMethods[0].name) { _, _ ->
// cancelDialogForLoading()
// setResult(RESULT_OK)
// finish()
// }
} }
hepler.getView<TextView>(R.id.tv_dialog_cancel).setOnClickListener {
dialog.dismiss()
}
}
}.show()
} }
......
...@@ -57,11 +57,10 @@ class DeliveryFragment : BaseFragment() { ...@@ -57,11 +57,10 @@ class DeliveryFragment : BaseFragment() {
deliveryListAdapter!!.setOnItemChildClickListener { _, view, position -> deliveryListAdapter!!.setOnItemChildClickListener { _, view, position ->
when (view.id) { when (view.id) {
R.id.iv_delete -> { R.id.iv_delete -> {
AppDialog().showWaringDialog(context, "是否確認刪除") { _, dialog -> AppDialog.getInstance().showWaringDialog(context, "是否確認刪除") { ->
showLoading() showLoading()
it.data.list[position].apply { it.data.list[position].apply {
viewModel.updateDeliveryConfig(distributionFeeMin.toString(), distributionFeeMax.toString(), distributionFee.toString(), deliveryCost.toString(), distributionType, type, desc, id, RestaurantInfoManager.newInstance().getRestaurantId(), UserContext.newInstance().getMemberId(), lackPrice.toString(), 1) { viewModel.updateDeliveryConfig(distributionFeeMin.toString(), distributionFeeMax.toString(), distributionFee.toString(), deliveryCost.toString(), distributionType, type, desc, id, RestaurantInfoManager.newInstance().restaurantId, UserContext.newInstance().memberId, lackPrice.toString(), 1) {
dialog.dismiss()
cancelDialogForLoading() cancelDialogForLoading()
} }
} }
......
...@@ -18,20 +18,6 @@ fun View.setState(state: Boolean) { ...@@ -18,20 +18,6 @@ fun View.setState(state: Boolean) {
} }
} }
fun Activity.showWaringDialog(title: String, confirm: (Dialog) -> Unit, cancel: (Dialog) -> Unit) {
AppDialog().showWaringDialog(this, title) { view, dialog ->
when (view.id) {
R.id.tv_dialog_confirm -> {
confirm.invoke(dialog)
}
R.id.tv_dialog_cancel -> {
cancel.invoke(dialog)
}
}
}
}
fun Activity.showSelectDialog(title: String, spanCount: Int, adapter: RecyclerView.Adapter<RecyclerView.ViewHolder>, confirm: (Dialog) -> Unit, cancel: (Dialog) -> Unit) { fun Activity.showSelectDialog(title: String, spanCount: Int, adapter: RecyclerView.Adapter<RecyclerView.ViewHolder>, confirm: (Dialog) -> Unit, cancel: (Dialog) -> Unit) {
AppDialog().showSelectDialog(this, title, spanCount, adapter) { view, dialog -> AppDialog().showSelectDialog(this, title, spanCount, adapter) { view, dialog ->
when (view.id) { when (view.id) {
......
...@@ -164,10 +164,7 @@ public class EditFoodFragment extends BaseFoodMenuFragment<EditFoodPresenter> im ...@@ -164,10 +164,7 @@ public class EditFoodFragment extends BaseFoodMenuFragment<EditFoodPresenter> im
private void itemChildChick(int viewId, int id, int position, ISupportFragment toFragment) { private void itemChildChick(int viewId, int id, int position, ISupportFragment toFragment) {
if (viewId == R.id.iv_food_group_delete) { if (viewId == R.id.iv_food_group_delete) {
new AppDialog().showWaringDialog(mContext, "是否確認刪除?", (view1, dialog) -> { AppDialog.getInstance().showWaringDialog(mContext, "是否確認刪除?", () -> mPresenter.deleteInfoById(fragmentType, id, position));
mPresenter.deleteInfoById(fragmentType, id, position);
dialog.dismiss();
});
} else if (viewId == R.id.iv_food_group_edit) { } else if (viewId == R.id.iv_food_group_edit) {
startForResult(toFragment, fragmentType); startForResult(toFragment, fragmentType);
} }
......
...@@ -260,7 +260,7 @@ public class IpPrintListActivityFragment extends BaseFragment<IpPrintListActivit ...@@ -260,7 +260,7 @@ public class IpPrintListActivityFragment extends BaseFragment<IpPrintListActivit
printListAdapter = new PrinterListAdapter(devicess, mContext); printListAdapter = new PrinterListAdapter(devicess, mContext);
printListAdapter.setOnItemChildClickListener((adapter, view, position) -> { printListAdapter.setOnItemChildClickListener((adapter, view, position) -> {
if (view.getId() == R.id.layout_delete) { if (view.getId() == R.id.layout_delete) {
new AppDialog().showWaringDialog(mContext, "是否刪除打印機", (view1, dialog) -> { AppDialog.getInstance().showWaringDialog(mContext, "是否刪除打印機", () -> {
//調用刪除接口 //調用刪除接口
mPresenter.deletePrinter(devicess.get(position).getId() + ""); mPresenter.deletePrinter(devicess.get(position).getId() + "");
devicess.remove(position); devicess.remove(position);
......
...@@ -179,7 +179,7 @@ public class LocalPrintFragment extends BaseFragment<LocalPrintPresenter> implem ...@@ -179,7 +179,7 @@ public class LocalPrintFragment extends BaseFragment<LocalPrintPresenter> implem
int finalI1 = i; int finalI1 = i;
view.findViewById(R.id.iv_currency_print_delete).setOnClickListener(v -> { view.findViewById(R.id.iv_currency_print_delete).setOnClickListener(v -> {
//刪除 //刪除
new AppDialog().showWaringDialog(mContext, "是否確認刪除", (view1, dialog) -> { AppDialog.getInstance().showWaringDialog(mContext, "是否確認刪除", () -> {
//調用刪除接口 //調用刪除接口
if (finalI1 < printCurrencyBeans.size()) { if (finalI1 < printCurrencyBeans.size()) {
printCurrencyBeans.get(finalI1).setDeletes(1); printCurrencyBeans.get(finalI1).setDeletes(1);
......
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.WarehousingOrderDetailsModule;
import com.gingersoft.supply_chain.mvp.contract.WarehousingOrderDetailsContract;
import com.jess.arms.di.scope.FragmentScope;
import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.WarehousingOrderDetailsFragment;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/29/2021 15:05
* <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 = WarehousingOrderDetailsModule.class, dependencies = AppComponent.class)
public interface WarehousingOrderDetailsComponent {
void inject(WarehousingOrderDetailsFragment fragment);
@Component.Builder
interface Builder {
@BindsInstance
WarehousingOrderDetailsComponent.Builder view(WarehousingOrderDetailsContract.View view);
WarehousingOrderDetailsComponent.Builder appComponent(AppComponent appComponent);
WarehousingOrderDetailsComponent 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.WarehousingOrderDetailsContract;
import com.gingersoft.supply_chain.mvp.model.WarehousingOrderDetailsModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/29/2021 15:05
* <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 WarehousingOrderDetailsModule {
@Binds
abstract WarehousingOrderDetailsContract.Model bindWarehousingOrderDetailsModel(WarehousingOrderDetailsModel model);
}
\ No newline at end of file
...@@ -227,4 +227,6 @@ public class PurchaseFoodBean implements Serializable, QMUISection.Model<Purchas ...@@ -227,4 +227,6 @@ public class PurchaseFoodBean implements Serializable, QMUISection.Model<Purchas
public int hashCode() { public int hashCode() {
return Objects.hash(supplierName, images, foodNo, name, unitPrice, foodCategoryName, remarks, quantityStarts, quantityEnd, packingDescription, basicUnitName, foodCategoryId, supplierId, inventoryAlarm, inventoryWarningId, reviews, minimumInventory, shelfLife, warningDays, foodMarkSn, foodUnits); return Objects.hash(supplierName, images, foodNo, name, unitPrice, foodCategoryName, remarks, quantityStarts, quantityEnd, packingDescription, basicUnitName, foodCategoryId, supplierId, inventoryAlarm, inventoryWarningId, reviews, minimumInventory, shelfLife, warningDays, foodMarkSn, foodUnits);
} }
} }
...@@ -15,4 +15,15 @@ public class WarehouseOrderBean { ...@@ -15,4 +15,15 @@ public class WarehouseOrderBean {
public int warehousingSpecies; public int warehousingSpecies;
public String warehousingReason; public String warehousingReason;
public WarehouseOrderBean() {
}
public WarehouseOrderBean(String orderNo, String warehousingMember, String warehousingTime, String warehousingFoodName, int warehousingSpecies, String warehousingReason) {
this.orderNo = orderNo;
this.warehousingMember = warehousingMember;
this.warehousingTime = warehousingTime;
this.warehousingFoodName = warehousingFoodName;
this.warehousingSpecies = warehousingSpecies;
this.warehousingReason = warehousingReason;
}
} }
package com.gingersoft.supply_chain.mvp.contract;
import com.gingersoft.supply_chain.mvp.ui.adapter.ConsumptionReasonAdapter;
import com.gingersoft.supply_chain.mvp.ui.adapter.WareHousingOrderFoodAdapter;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/29/2021 15:05
* <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 WarehousingOrderDetailsContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
void initReason(ConsumptionReasonAdapter consumptionReasonAdapter);
void initFoodView(WareHousingOrderFoodAdapter wareHousingOrderFoodAdapter);
}
//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.WarehousingOrderDetailsContract;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/29/2021 15:05
* <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 WarehousingOrderDetailsModel extends BaseModel implements WarehousingOrderDetailsContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public WarehousingOrderDetailsModel(IRepositoryManager repositoryManager) {
super(repositoryManager);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mGson = null;
this.mApplication = null;
}
}
\ No newline at end of file
...@@ -493,10 +493,14 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac ...@@ -493,10 +493,14 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
public void onNext(BaseResult baseResult) { public void onNext(BaseResult baseResult) {
if (baseResult.isSuccess()) { if (baseResult.isSuccess()) {
//需要在供應商和分類的緩存中這個食品移除 //需要在供應商和分類的緩存中這個食品移除
// categoryFoods
// supplierFoods
//列表中刪除掉這個食品
showFoods.get(groupPosition).purchaseFoodList.remove(position); showFoods.get(groupPosition).purchaseFoodList.remove(position);
//移除在購物車中的緩存 //移除在購物車中的緩存
SupplyShoppingCart.getInstance().removeFoodsByFoodId(foodId); SupplyShoppingCart.getInstance().removeFoodsByFoodId(foodId);
mRootView.loadFood(showFoods, true, true); //刷新頁面
mRootView.loadFood(new ArrayList<>(showFoods), true, true);
} else if (TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) { } else if (TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg()); mRootView.showMessage(baseResult.getErrMsg());
} else { } else {
......
package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application;
import com.gingersoft.supply_chain.mvp.bean.ConsumeReasonBean;
import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart;
import com.gingersoft.supply_chain.mvp.ui.adapter.ConsumptionReasonAdapter;
import com.gingersoft.supply_chain.mvp.ui.adapter.WareHousingOrderFoodAdapter;
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.WarehousingOrderDetailsContract;
import java.util.ArrayList;
import java.util.List;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/29/2021 15:05
* <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 WarehousingOrderDetailsPresenter extends BasePresenter<WarehousingOrderDetailsContract.Model, WarehousingOrderDetailsContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
private ConsumptionReasonAdapter consumptionReasonAdapter;
private WareHousingOrderFoodAdapter wareHousingOrderFoodAdapter;
@Inject
public WarehousingOrderDetailsPresenter(WarehousingOrderDetailsContract.Model model, WarehousingOrderDetailsContract.View rootView) {
super(model, rootView);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
public void getWarehousingReason() {
List<ConsumeReasonBean> consumeReasonBeans = new ArrayList<>();
consumptionReasonAdapter = new ConsumptionReasonAdapter(consumeReasonBeans);
mRootView.initReason(consumptionReasonAdapter);
}
public void getWarehousingFood() {
if (wareHousingOrderFoodAdapter == null) {
wareHousingOrderFoodAdapter = new WareHousingOrderFoodAdapter(SupplyShoppingCart.getInstance().getCartFoods());
mRootView.initFoodView(wareHousingOrderFoodAdapter);
} else {
wareHousingOrderFoodAdapter.setNewInstance(SupplyShoppingCart.getInstance().getCartFoods());
}
}
}
package com.gingersoft.supply_chain.mvp.ui.adapter; package com.gingersoft.supply_chain.mvp.ui.adapter;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.util.SparseArray;
import android.view.View; import android.view.View;
import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.databinding.DataBindingUtil; import androidx.databinding.DataBindingUtil;
import androidx.databinding.ViewDataBinding; import androidx.databinding.ViewDataBinding;
import androidx.recyclerview.widget.RecyclerView;
import org.jetbrains.annotations.NotNull;
/** /**
* 通用的RecyclerView.ViewHolder。提供了根据viewId获取View的方法。 * 通用的RecyclerView.ViewHolder。提供了根据viewId获取View的方法。
* 提供了对View、TextView、ImageView的常用设置方法。 * 提供了对View、TextView、ImageView的常用设置方法。
*/ */
public class BaseViewHolder extends RecyclerView.ViewHolder { public class BaseViewHolder extends com.chad.library.adapter.base.viewholder.BaseViewHolder {
private SparseArray<View> mViews;
public BaseViewHolder(View itemView) { public BaseViewHolder(@NotNull View view) {
super(itemView); super(view);
mViews = new SparseArray<>();
} }
/** /**
...@@ -34,137 +28,121 @@ public class BaseViewHolder extends RecyclerView.ViewHolder { ...@@ -34,137 +28,121 @@ public class BaseViewHolder extends RecyclerView.ViewHolder {
return DataBindingUtil.getBinding(this.itemView); return DataBindingUtil.getBinding(this.itemView);
} }
/**
* 根据View Id 获取对应的View
*
* @param viewId
* @param <T>
* @return
*/
public <T extends View> T get(int viewId) {
View view = mViews.get(viewId);
if (view == null) {
view = this.itemView.findViewById(viewId);
mViews.put(viewId, view);
}
return (T) view;
}
//******** 提供对View、TextView、ImageView的常用设置方法 ******// //******** 提供对View、TextView、ImageView的常用设置方法 ******//
public BaseViewHolder setText(int viewId, CharSequence text) { // public BaseViewHolder setText(int viewId, CharSequence text) {
TextView tv = get(viewId); // TextView tv = get(viewId);
tv.setText(text); // tv.setText(text);
return this; // return this;
} // }
//
public BaseViewHolder setText(int viewId, CharSequence text, TextView.BufferType type) { // public BaseViewHolder setText(int viewId, CharSequence text, TextView.BufferType type) {
TextView tv = get(viewId); // TextView tv = get(viewId);
tv.setText(text, type); // tv.setText(text, type);
return this; // return this;
} // }
//
//
public BaseViewHolder setText(int viewId, int textRes) { // public BaseViewHolder setText(int viewId, int textRes) {
TextView tv = get(viewId); // TextView tv = get(viewId);
tv.setText(textRes); // tv.setText(textRes);
return this; // return this;
} // }
//
public BaseViewHolder setTextColor(int viewId, int textColor) { // public BaseViewHolder setTextColor(int viewId, int textColor) {
TextView view = get(viewId); // TextView view = get(viewId);
view.setTextColor(textColor); // view.setTextColor(textColor);
return this; // return this;
} // }
//
public BaseViewHolder setTextSize(int viewId, float size) { // public BaseViewHolder setTextSize(int viewId, float size) {
TextView view = get(viewId); // TextView view = get(viewId);
view.setTextSize(size); // view.setTextSize(size);
return this; // return this;
} // }
//
public BaseViewHolder setImageResource(int viewId, int resId) { // public BaseViewHolder setImageResource(int viewId, int resId) {
ImageView view = get(viewId); // ImageView view = get(viewId);
view.setImageResource(resId); // view.setImageResource(resId);
return this; // return this;
} // }
//
public BaseViewHolder setImageBitmap(int viewId, Bitmap bitmap) { // public BaseViewHolder setImageBitmap(int viewId, Bitmap bitmap) {
ImageView view = get(viewId); // ImageView view = get(viewId);
view.setImageBitmap(bitmap); // view.setImageBitmap(bitmap);
return this; // return this;
} // }
//
//
public BaseViewHolder setImageDrawable(int viewId, Drawable drawable) { // public BaseViewHolder setImageDrawable(int viewId, Drawable drawable) {
ImageView view = get(viewId); // ImageView view = get(viewId);
view.setImageDrawable(drawable); // view.setImageDrawable(drawable);
return this; // return this;
} // }
//
//
public BaseViewHolder setBackgroundColor(int viewId, int color) { // public BaseViewHolder setBackgroundColor(int viewId, int color) {
View view = get(viewId); // View view = get(viewId);
view.setBackgroundColor(color); // view.setBackgroundColor(color);
return this; // return this;
} // }
//
public BaseViewHolder setBackgroundRes(int viewId, int backgroundRes) { // public BaseViewHolder setBackgroundRes(int viewId, int backgroundRes) {
View view = get(viewId); // View view = get(viewId);
view.setBackgroundResource(backgroundRes); // view.setBackgroundResource(backgroundRes);
return this; // return this;
} // }
//
public BaseViewHolder setVisible(int viewId, boolean visible) { // public BaseViewHolder setVisible(int viewId, boolean visible) {
View view = get(viewId); // View view = get(viewId);
view.setVisibility(visible ? View.VISIBLE : View.GONE); // view.setVisibility(visible ? View.VISIBLE : View.GONE);
return this; // return this;
} // }
//
public BaseViewHolder setVisible(int viewId, int visible) { // public BaseViewHolder setVisible(int viewId, int visible) {
View view = get(viewId); // View view = get(viewId);
view.setVisibility(visible); // view.setVisibility(visible);
return this; // return this;
} // }
//
public BaseViewHolder setInvisible(int viewId, boolean invisible) { // public BaseViewHolder setInvisible(int viewId, boolean invisible) {
View view = get(viewId); // View view = get(viewId);
view.setVisibility(invisible ? View.INVISIBLE : View.VISIBLE); // view.setVisibility(invisible ? View.INVISIBLE : View.VISIBLE);
return this; // return this;
} // }
//
public BaseViewHolder setInvisible(int viewId, int invisible) { // public BaseViewHolder setInvisible(int viewId, int invisible) {
View view = get(viewId); // View view = get(viewId);
view.setVisibility(invisible); // view.setVisibility(invisible);
return this; // return this;
} // }
public BaseViewHolder setOnClickListener(int viewId, View.OnClickListener onClickListener) { public BaseViewHolder setOnClickListener(int viewId, View.OnClickListener onClickListener) {
View view = get(viewId); View view = getView(viewId);
view.setOnClickListener(onClickListener); view.setOnClickListener(onClickListener);
return this; return this;
} }
public BaseViewHolder setOnLongClickListener(int viewId, View.OnLongClickListener l) { public BaseViewHolder setOnLongClickListener(int viewId, View.OnLongClickListener l) {
View view = get(viewId); View view = getView(viewId);
view.setOnLongClickListener(l); view.setOnLongClickListener(l);
return this; return this;
} }
public BaseViewHolder setOnTouchListener(int viewId, View.OnTouchListener l) { public BaseViewHolder setOnTouchListener(int viewId, View.OnTouchListener l) {
View view = get(viewId); View view = getView(viewId);
view.setOnTouchListener(l); view.setOnTouchListener(l);
return this; return this;
} }
public BaseViewHolder setOnFocusChangeListener(int viewId, View.OnFocusChangeListener onFocusChangeListener) { public BaseViewHolder setOnFocusChangeListener(int viewId, View.OnFocusChangeListener onFocusChangeListener) {
View view = get(viewId); View view = getView(viewId);
view.setOnFocusChangeListener(onFocusChangeListener); view.setOnFocusChangeListener(onFocusChangeListener);
return this; return this;
} }
public <T extends TextView> CharSequence getText(int viewId) { public <T extends TextView> CharSequence getText(int viewId) {
T view = get(viewId); T view = getView(viewId);
return view.getText(); return view.getText();
} }
} }
...@@ -101,7 +101,7 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi ...@@ -101,7 +101,7 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi
itemViewHolder.setText(R.id.tv_food_item_supplier_name, purchaseFoodBean.getSupplierName()); itemViewHolder.setText(R.id.tv_food_item_supplier_name, purchaseFoodBean.getSupplierName());
itemViewHolder.setImageResource(R.id.iv_food_ingredient_img, R.drawable.img_small_default); itemViewHolder.setImageResource(R.id.iv_food_ingredient_img, R.drawable.img_small_default);
if (TextUtil.isNotEmptyOrNullOrUndefined(purchaseFoodBean.getImages())) { if (TextUtil.isNotEmptyOrNullOrUndefined(purchaseFoodBean.getImages())) {
GlideUtils.display(mContext, itemViewHolder.get(R.id.iv_food_ingredient_img), purchaseFoodBean.getImages()); GlideUtils.display(mContext, itemViewHolder.getView(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_no, purchaseFoodBean.getFoodNo());
itemViewHolder.setText(R.id.tv_food_item_name, purchaseFoodBean.getName()); itemViewHolder.setText(R.id.tv_food_item_name, purchaseFoodBean.getName());
...@@ -112,7 +112,7 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi ...@@ -112,7 +112,7 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi
itemViewHolder.setText(R.id.tv_food_item_unit, purchaseFoodBean.getBasicUnitName()); 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_s), MoneyUtil.formatDouble(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); EditText edNumberInput = itemViewHolder.getView(R.id.ed_food_ingredient_number);
edNumberInput.setText(String.valueOf(purchaseFoodBean.getFoodQuantity()), TextView.BufferType.EDITABLE); edNumberInput.setText(String.valueOf(purchaseFoodBean.getFoodQuantity()), TextView.BufferType.EDITABLE);
//如果數量小於等於0,就不顯示減號和數量 //如果數量小於等於0,就不顯示減號和數量
setSubAndNumShow(itemViewHolder, purchaseFoodBean.getFoodQuantity() <= 0); setSubAndNumShow(itemViewHolder, purchaseFoodBean.getFoodQuantity() <= 0);
...@@ -205,7 +205,7 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi ...@@ -205,7 +205,7 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi
*/ */
public void setLongClick(BaseViewHolder itemViewHolder, int groupPosition, int childPosition, PurchaseFoodBean purchaseFoodBean, boolean addOrSub) { public void setLongClick(BaseViewHolder itemViewHolder, int groupPosition, int childPosition, PurchaseFoodBean purchaseFoodBean, boolean addOrSub) {
//開啟線程 //開啟線程
EditText edNumberInput = itemViewHolder.get(R.id.ed_food_ingredient_number); EditText edNumberInput = itemViewHolder.getView(R.id.ed_food_ingredient_number);
ThreadPoolManager.getInstence().putExecutableTasks(() -> { ThreadPoolManager.getInstence().putExecutableTasks(() -> {
int number = 0; int number = 0;
if (TextUtil.isNotEmptyOrNullOrUndefined(edNumberInput)) { if (TextUtil.isNotEmptyOrNullOrUndefined(edNumberInput)) {
......
...@@ -187,7 +187,7 @@ public abstract class GroupedRecyclerViewAdapter<T> ...@@ -187,7 +187,7 @@ public abstract class GroupedRecyclerViewAdapter<T>
protected void bindViewClickListener(BaseViewHolder viewHolder, int viewType) { protected void bindViewClickListener(BaseViewHolder viewHolder, int viewType) {
if (mOnItemChildClickListener != null && viewType == TYPE_CHILD) { if (mOnItemChildClickListener != null && viewType == TYPE_CHILD) {
for (Integer childClickViewId : childClickViewIds) { for (Integer childClickViewId : childClickViewIds) {
View childView = viewHolder.get(childClickViewId); View childView = viewHolder.getView(childClickViewId);
if (!childView.isClickable()) { if (!childView.isClickable()) {
childView.setClickable(true); childView.setClickable(true);
} }
......
...@@ -139,20 +139,19 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Shop ...@@ -139,20 +139,19 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Shop
if (number <= 0) { if (number <= 0) {
//如果數量小於等於0,需要詢問是否刪除 //如果數量小於等於0,需要詢問是否刪除
//彈窗顯示 是否刪除 //彈窗顯示 是否刪除
new AppDialog().showWaringDialog(context, "是否刪除食品?", true, (view, dialog) -> { AppDialog.getInstance().showWaringDialog(context, "是否刪除食品?", true, () -> {
boolean isDeleteSupplier = deleteFood(viewHolder.getAdapterPosition(), viewHolder, viewHolder.getView(R.id.tv_order_item_food_type_total), foodListAdapter, beforeNumber, position, purchaseFoodBean); boolean isDeleteSupplier = deleteFood(viewHolder.getAdapterPosition(), viewHolder, viewHolder.getView(R.id.tv_order_item_food_type_total), foodListAdapter, beforeNumber, position, purchaseFoodBean);
//如果這個供應商被刪除了,就不用判斷採購金額了 //如果這個供應商被刪除了,就不用判斷採購金額了
if (!isDeleteSupplier) { if (!isDeleteSupplier) {
//判斷當前總價是否滿足最低採購金額 //判斷當前總價是否滿足最低採購金額
setTvMinimumAmount(viewHolder); setTvMinimumAmount(viewHolder);
} }
}, (view, dialog) -> { }, () -> {
//不刪除這個食品 //不刪除這個食品
if (purchaseFoodBean.getFoodQuantity() <= 0) { if (purchaseFoodBean.getFoodQuantity() <= 0) {
purchaseFoodBean.setFoodQuantity(1); purchaseFoodBean.setFoodQuantity(1);
} }
foodListAdapter.notifyItemChanged(position); foodListAdapter.notifyItemChanged(position);
dialog.dismiss();
}); });
} else { } else {
//當數量發生改變時,重新計算價格。 //當數量發生改變時,重新計算價格。
......
package com.gingersoft.supply_chain.mvp.ui.adapter;
import androidx.annotation.Nullable;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import org.jetbrains.annotations.NotNull;
import java.util.List;
/**
* @author 宇航. 1239658231@qq.com
* User: admin
* Date: 2021/4/30
* Time: 9:20
* Use:
*/
public class WareHousingOrderFoodAdapter extends BaseQuickAdapter<PurchaseFoodBean, BaseViewHolder> {
public WareHousingOrderFoodAdapter(@Nullable List<PurchaseFoodBean> data) {
super(R.layout.item_warehousing_order_details, data);
addChildClickViewIds(R.id.tv_edit);
}
@Override
protected void convert(@NotNull BaseViewHolder holder, PurchaseFoodBean item) {
holder.setText(R.id.tv_goods_name, item.getName());
holder.setText(R.id.tv_goods_unit, item.getBasicUnitName());
holder.setText(R.id.tv_goods_quantity, String.valueOf(item.getFoodQuantity()));
holder.setText(R.id.tv_edit, getContext().getString(R.string.str_look_over));
if (item.getFoodUnits() != null && item.getFoodUnits().size() > 1) {
holder.setVisible(R.id.iv_switch_unit, true);
} else {
holder.setGone(R.id.iv_switch_unit, true);
}
}
}
...@@ -17,7 +17,7 @@ class WarehousingOrderListAdapter(data: MutableList<WarehouseOrderBean>?) : Base ...@@ -17,7 +17,7 @@ class WarehousingOrderListAdapter(data: MutableList<WarehouseOrderBean>?) : Base
override fun convert(holder: BaseViewHolder, item: WarehouseOrderBean) { override fun convert(holder: BaseViewHolder, item: WarehouseOrderBean) {
holder.setText(R.id.tv_warehousing_order_no, item.orderNo) 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_createTime, item.warehousingTime)
holder.setText(R.id.tv_warehousing_order_species, item.warehousingSpecies) holder.setText(R.id.tv_warehousing_order_species, item.warehousingSpecies.toString())
holder.setText(R.id.tv_warehousing_order_createMember, item.warehousingMember) 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_foods, item.warehousingFoodName)
holder.setText(R.id.tv_warehousing_order_createReason, item.warehousingReason) holder.setText(R.id.tv_warehousing_order_createReason, item.warehousingReason)
......
...@@ -27,6 +27,7 @@ import com.gingersoft.supply_chain.mvp.ui.fragment.inventory.StorageListFragment ...@@ -27,6 +27,7 @@ import com.gingersoft.supply_chain.mvp.ui.fragment.inventory.StorageListFragment
import com.gingersoft.supply_chain.mvp.ui.fragment.order.PurchaseListFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.order.PurchaseListFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.supplier.SupplierListFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.supplier.SupplierListFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.WareHouseListFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.WareHouseListFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.WarehousingOrderListFragment;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.qmuiteam.qmui.widget.QMUITopBar; import com.qmuiteam.qmui.widget.QMUITopBar;
...@@ -92,9 +93,11 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr ...@@ -92,9 +93,11 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr
List<Function> orderManger = new ArrayList<>(); List<Function> orderManger = new ArrayList<>();
orderManger.add(new Function("採購訂單", R.drawable.ic_purchase_order)); orderManger.add(new Function("採購訂單", R.drawable.ic_purchase_order));
purchaseFunctionBeans.add(new PurchaseFunctionBean("訂單管理", orderManger)); purchaseFunctionBeans.add(new PurchaseFunctionBean("訂單管理", orderManger));
List<Function> storage = new ArrayList<>(); List<Function> storage = new ArrayList<>();
storage.add(new Function("庫存查詢", R.drawable.ic_purchase_order)); storage.add(new Function("庫存查詢", R.drawable.ic_inventory_inquiry));
storage.add(new Function("入庫", R.drawable.ic_warehousing));
storage.add(new Function("出庫", R.drawable.ic_out_of_stock));
storage.add(new Function("盤點", R.drawable.ic_inventory));
if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG) {
storage.add(new Function("切換環境", R.drawable.ic_seekbar_btn)); storage.add(new Function("切換環境", R.drawable.ic_seekbar_btn));
} }
...@@ -121,12 +124,15 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr ...@@ -121,12 +124,15 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr
case "採購訂單": case "採購訂單":
start(PurchaseListFragment.newInstance()); start(PurchaseListFragment.newInstance());
break; break;
case "入庫": // case "入庫":
start(StorageListFragment.newInstance()); // start(StorageListFragment.newInstance());
break; // break;
case "庫存查詢": case "庫存查詢":
start(WareHouseListFragment.newInstance()); start(WareHouseListFragment.newInstance());
break; break;
case "入庫":
start(WarehousingOrderListFragment.newInstance());
break;
case "切換環境": case "切換環境":
int format = (int) SPUtils.get("isFormal", 3); int format = (int) SPUtils.get("isFormal", 3);
if (format == 3) { if (format == 3) {
......
...@@ -202,7 +202,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -202,7 +202,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
NewAddCategoryPopup categoryPopup = new NewAddCategoryPopup(mContext, getString(R.string.str_modify), getString(R.string.str_category_name), getString(R.string.str_please_modify_current_category_name), foodCategoryTrees.getName(), true); NewAddCategoryPopup categoryPopup = new NewAddCategoryPopup(mContext, getString(R.string.str_modify), getString(R.string.str_category_name), getString(R.string.str_please_modify_current_category_name), foodCategoryTrees.getName(), true);
categoryPopup.setOnDeleteListener(v -> { categoryPopup.setOnDeleteListener(v -> {
//刪除分類 //刪除分類
AppDialog.getInstance().showWaringDialog(mContext, String.format(getString(R.string.str_delete_category_tip), foodCategoryTrees.getName()), (view, dialog) -> { AppDialog.getInstance().showWaringDialog(mContext, String.format(getString(R.string.str_delete_category_tip), foodCategoryTrees.getName()), () -> {
categoryPopup.dismiss(); categoryPopup.dismiss();
mPresenter.deleteFoodCategory(foodCategoryTrees, currentLevel, position); mPresenter.deleteFoodCategory(foodCategoryTrees, currentLevel, position);
}); });
......
...@@ -14,6 +14,7 @@ import android.widget.TextView; ...@@ -14,6 +14,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.cardview.widget.CardView; import androidx.cardview.widget.CardView;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.RecyclerView.OnScrollListener; import androidx.recyclerview.widget.RecyclerView.OnScrollListener;
...@@ -36,7 +37,9 @@ import com.gingersoft.supply_chain.mvp.ui.adapter.BuyIngredientsAdapter; ...@@ -36,7 +37,9 @@ import com.gingersoft.supply_chain.mvp.ui.adapter.BuyIngredientsAdapter;
import com.gingersoft.supply_chain.mvp.ui.adapter.FirstLevelCategoryAdapter; import com.gingersoft.supply_chain.mvp.ui.adapter.FirstLevelCategoryAdapter;
import com.gingersoft.supply_chain.mvp.ui.adapter.SecondCategoryAdapter; import com.gingersoft.supply_chain.mvp.ui.adapter.SecondCategoryAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.order.PurchaseListFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.order.ShoppingCatFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.order.ShoppingCatFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.WarehousingOrderDetailsFragment;
import com.gingersoft.supply_chain.mvp.ui.widget.CenterLayoutManager; import com.gingersoft.supply_chain.mvp.ui.widget.CenterLayoutManager;
import com.gingersoft.supply_chain.mvp.ui.widget.GoodsDetailsPopup; import com.gingersoft.supply_chain.mvp.ui.widget.GoodsDetailsPopup;
import com.gingersoft.supply_chain.mvp.ui.widget.GroupedGridLayoutManager; import com.gingersoft.supply_chain.mvp.ui.widget.GroupedGridLayoutManager;
...@@ -123,6 +126,8 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -123,6 +126,8 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
StickyHeaderLayout stickyHeaderLayout; StickyHeaderLayout stickyHeaderLayout;
@BindView(R2.id.fresh_header) @BindView(R2.id.fresh_header)
ClassicsHeader classicsHeader; ClassicsHeader classicsHeader;
@BindView(R2.id.tv_select_food_size)
TextView tvSelectFoodSize;
/** /**
* 購物車數量textview * 購物車數量textview
*/ */
...@@ -143,15 +148,20 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -143,15 +148,20 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
private boolean isShowSupplier = false; private boolean isShowSupplier = false;
private LoadService fullRegister; private LoadService fullRegister;
/** /**
* 頁面類型越來越多了,有時間重寫一下,區分出不同的頁面來
*/
/**
* 頁面類型 * 頁面類型
* FOOD_INGREDIENTS 為編輯食材頁面 * FOOD_INGREDIENTS 為編輯食材頁面
* ADD_ORDER 為添加訂單頁面 * ADD_ORDER 為添加訂單頁面
* GET_FOOD_BY_SUPPLIER 根据供應商顯示食品列表 * GET_FOOD_BY_SUPPLIER 根据供應商顯示食品列表
* GET_FOOD_BY_WAREHOUSING_ORDER 入庫訂單選購食材
*/ */
private int pageType = 1; private int pageType = 1;
public final static int FOOD_INGREDIENTS = 1; public final static int FOOD_INGREDIENTS = 1;
public final static int ADD_ORDER = 2; public final static int ADD_ORDER = 2;
public final static int GET_FOOD_BY_SUPPLIER = 3; public final static int GET_FOOD_BY_SUPPLIER = 3;
public final static int GET_FOOD_BY_WAREHOUSING_ORDER = 4;
private final static String pageTypeKey = "pageType"; private final static String pageTypeKey = "pageType";
private final static String supplierIdKey = "supplierId"; private final static String supplierIdKey = "supplierId";
...@@ -205,12 +215,16 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -205,12 +215,16 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
pageType = arguments.getInt(pageTypeKey); pageType = arguments.getInt(pageTypeKey);
} }
initTopBar(); initTopBar();
fullRegister = LoadSir.getDefault().register(layoutContent, (Callback.OnReloadListener) v -> { initViewByPageType();
if (v.getId() == R.id.layout_not_commodity) { initLoadSir();
//新增食材 initRefresh();
toCreateFood(); loadDataByType();
} }
});
/**
* 初始化下拉刷新上拉加載
*/
private void initRefresh() {
refreshLayout.setOnRefreshListener(refreshLayout -> { refreshLayout.setOnRefreshListener(refreshLayout -> {
//在這裡不是刷新,而是獲取上一個分類的數據 //在這裡不是刷新,而是獲取上一個分類的數據
int i = firstLevelCategoryAdapter.getSelectedIndex() - 1; int i = firstLevelCategoryAdapter.getSelectedIndex() - 1;
...@@ -229,9 +243,20 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -229,9 +243,20 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
finishLoad(true); finishLoad(true);
} }
}).setEnableOverScrollBounce(false).setEnableAutoLoadMore(true); }).setEnableOverScrollBounce(false).setEnableAutoLoadMore(true);
loadDataByType();
} }
private void initLoadSir() {
fullRegister = LoadSir.getDefault().register(layoutContent, (Callback.OnReloadListener) v -> {
if (v.getId() == R.id.layout_not_commodity) {
//新增食材
toCreateFood();
}
});
}
/**
* 根據類型加載數據
*/
private void loadDataByType() { private void loadDataByType() {
//將購物車中的食品數據導出 //將購物車中的食品數據導出
//初始化購物車數量 //初始化購物車數量
...@@ -265,17 +290,14 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -265,17 +290,14 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
} }
private void initTopBar() { private void initTopBar() {
if (pageType == FOOD_INGREDIENTS) { if (pageType == FOOD_INGREDIENTS || pageType == GET_FOOD_BY_WAREHOUSING_ORDER) {
initTopBar(topbarFoodIngredients, "食材管理"); initTopBar(topbarFoodIngredients, "食材管理");
btnNewFoodIngredient.setVisibility(View.VISIBLE);
layoutFoodIngredientsBtn.setVisibility(View.GONE);
topbarFoodIngredients.addRightImageButton(R.drawable.ic_circle_new_food_ingredient, R.id.qmui_add_new_food_ingredients).setOnClickListener(v -> { topbarFoodIngredients.addRightImageButton(R.drawable.ic_circle_new_food_ingredient, R.id.qmui_add_new_food_ingredients).setOnClickListener(v -> {
//新增食材 //新增食材
toCreateFood(); toCreateFood();
}); });
} else { } else {
initTopBar(topbarFoodIngredients, "採購單"); initTopBar(topbarFoodIngredients, "採購單");
layoutFoodIngredientsBtn.setVisibility(View.VISIBLE);
View view = View.inflate(requireContext(), R.layout.view_shopping_car, null); View view = View.inflate(requireContext(), R.layout.view_shopping_car, null);
tvShoppingCart = view.findViewById(R.id.tv_purchase_cart_number); tvShoppingCart = view.findViewById(R.id.tv_purchase_cart_number);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT);
...@@ -285,6 +307,20 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -285,6 +307,20 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
} }
} }
private void initViewByPageType() {
if (pageType == FOOD_INGREDIENTS) {
layoutFoodIngredientsBtn.setVisibility(View.GONE);
btnNewFoodIngredient.setVisibility(View.VISIBLE);
tvSelectFoodSize.setVisibility(View.GONE);
} else if (pageType == GET_FOOD_BY_WAREHOUSING_ORDER) {
//創建入庫單
tvSelectFoodSize.setVisibility(View.VISIBLE);
btnFoodIngredientsCancel.setVisibility(View.GONE);
} else {
layoutFoodIngredientsBtn.setVisibility(View.VISIBLE);
}
}
/** /**
* 新建食品 * 新建食品
*/ */
...@@ -297,15 +333,6 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -297,15 +333,6 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
} }
} }
private String getCurrentCategoryName() {
String defaultName = "";
if (firstLevelCategoryAdapter != null) {
if (firstLevelCategoryAdapter.getItemCount() > firstLevelCategoryAdapter.getSelectedIndex()) {
defaultName = firstLevelCategoryAdapter.getItem(firstLevelCategoryAdapter.getSelectedIndex()).getName();
}
}
return defaultName;
}
@OnClick({R2.id.layout_food_ingredients_search, R2.id.tv_switch_food_ingredients_show_type, R2.id.btn_food_ingredients_confirm, @OnClick({R2.id.layout_food_ingredients_search, R2.id.tv_switch_food_ingredients_show_type, R2.id.btn_food_ingredients_confirm,
R2.id.btn_food_ingredients_cancel, R2.id.btn_switch_row, R2.id.card_show_more_category}) R2.id.btn_food_ingredients_cancel, R2.id.btn_switch_row, R2.id.card_show_more_category})
...@@ -363,6 +390,9 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -363,6 +390,9 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
rvFoodIngredients.setLayoutManager(linearLayoutManager); rvFoodIngredients.setLayoutManager(linearLayoutManager);
} }
/**
* 食材recyclerview滑動監聽
*/
private RecyclerView.OnScrollListener mFoodScrollListener = new OnScrollListener() { private RecyclerView.OnScrollListener mFoodScrollListener = new OnScrollListener() {
@Override @Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
...@@ -487,7 +517,21 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -487,7 +517,21 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
private void confirm() { private void confirm() {
List<PurchaseFoodBean> purchaseFood = mPresenter.getPurchaseFood(); List<PurchaseFoodBean> purchaseFood = mPresenter.getPurchaseFood();
if (CollectionUtils.isNotNullOrEmpty(purchaseFood)) { if (CollectionUtils.isNotNullOrEmpty(purchaseFood)) {
if (pageType == GET_FOOD_BY_WAREHOUSING_ORDER) {
//採購入庫單
List<Fragment> fragments = requireActivity().getSupportFragmentManager().getFragments();
for (Fragment fragment : fragments) {
if (fragment instanceof WarehousingOrderDetailsFragment) {
//有入庫單詳情
popTo(WarehousingOrderDetailsFragment.class, false);
return;
}
}
//沒入庫單詳情
startWithPop(WarehousingOrderDetailsFragment.newInstance());
} else {
startForResult(ShoppingCatFragment.newInstance(), TO_SHOPPING_CART_REQUEST_CODE); startForResult(ShoppingCatFragment.newInstance(), TO_SHOPPING_CART_REQUEST_CODE);
}
} else { } else {
showMessage("請選擇食材"); showMessage("請選擇食材");
} }
...@@ -504,7 +548,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -504,7 +548,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
fullRegister.showSuccess(); fullRegister.showSuccess();
if (firstLevelCategoryAdapter == null) { if (firstLevelCategoryAdapter == null) {
firstLevelCategoryAdapter = new FirstLevelCategoryAdapter(foodCategoryTrees, requireContext()) firstLevelCategoryAdapter = new FirstLevelCategoryAdapter(foodCategoryTrees, requireContext())
.setIsShowNumber(pageType == ADD_ORDER); .setIsShowNumber(pageType == ADD_ORDER || pageType == GET_FOOD_BY_WAREHOUSING_ORDER);
rvFirstCategory.setAdapter(firstLevelCategoryAdapter); rvFirstCategory.setAdapter(firstLevelCategoryAdapter);
firstLevelCategoryAdapter.setOnItemClickListener((adapter, view, position) -> { firstLevelCategoryAdapter.setOnItemClickListener((adapter, view, position) -> {
firstCategoryClick(position); firstCategoryClick(position);
...@@ -558,10 +602,8 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -558,10 +602,8 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
if (position > firstLevelCategoryAdapter.getItemCount()) { if (position > firstLevelCategoryAdapter.getItemCount()) {
return; return;
} }
Log.e("eee", "一级分类点击" + position);
//這個分類的數據是否已經在顯示列表中 //這個分類的數據是否已經在顯示列表中
int categoryIndex = mPresenter.isShowGoods(firstLevelCategoryAdapter.getItem(position)); int categoryIndex = mPresenter.isShowGoods(firstLevelCategoryAdapter.getItem(position));
Log.e("eee", "是否找到" + categoryIndex);
if (categoryIndex == -1) { if (categoryIndex == -1) {
//未顯示 //未顯示
//清空食材列表,重新加載當前下標分類的食品數據 //清空食材列表,重新加載當前下標分類的食品數據
...@@ -662,10 +704,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -662,10 +704,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
startForResult(NewFoodIngredientsFragment.newInstance(purchaseFoodBean), EDIT_FOOD_REQUEST_CODE); startForResult(NewFoodIngredientsFragment.newInstance(purchaseFoodBean), EDIT_FOOD_REQUEST_CODE);
} else if (view.getId() == R.id.iv_commodity_delete) { } else if (view.getId() == R.id.iv_commodity_delete) {
//刪除食材 //刪除食材
new AppDialog().showWaringDialog(mContext, "是否確認刪除" + purchaseFoodBean.getName(), (view1, dialog) -> { AppDialog.getInstance().showWaringDialog(mContext, "是否確認刪除" + purchaseFoodBean.getName(), () -> {
if (!isShowSupplier) {
purchaseFoodBean.setFoodCategoryName(getCurrentCategoryName());
}
mPresenter.deleteFood(purchaseFoodBean.getId(), isShowSupplier ? -1 : firstLevelCategoryAdapter.getSelectedIndex(), groupPosition, position); mPresenter.deleteFood(purchaseFoodBean.getId(), isShowSupplier ? -1 : firstLevelCategoryAdapter.getSelectedIndex(), groupPosition, position);
}); });
} }
...@@ -710,13 +749,10 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -710,13 +749,10 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
*/ */
private void foodNumberChanger(PurchaseFoodBean purchaseFoodBean, int parentCategoryIndex, int beforeNum, int currentNum) { private void foodNumberChanger(PurchaseFoodBean purchaseFoodBean, int parentCategoryIndex, int beforeNum, int currentNum) {
BuyIngredientsBean firstCategory = mPresenter.getFirstCategoryByIndex(parentCategoryIndex); BuyIngredientsBean firstCategory = mPresenter.getFirstCategoryByIndex(parentCategoryIndex);
Log.e("eee", parentCategoryIndex + "一級分類" + (firstCategory == null ? "null" : firstCategory.toString()));
if (firstCategory != null) { if (firstCategory != null) {
int firstCategoryByIndex = firstLevelCategoryAdapter.getItemPosition(new OrderCategoryBean.FoodCategoryTrees(firstCategory.id, firstCategory.categoryName, firstCategory.parentId)); int firstCategoryByIndex = firstLevelCategoryAdapter.getItemPosition(new OrderCategoryBean.FoodCategoryTrees(firstCategory.id, firstCategory.categoryName, firstCategory.parentId));
//找到一級分類下標 //找到一級分類下標
Log.e("eee", "一級分類下標:" + firstCategoryByIndex);
if (beforeNum == 0 || currentNum == 0) { if (beforeNum == 0 || currentNum == 0) {
Log.e("eee", beforeNum + "數量:" + currentNum);
OrderCategoryBean.FoodCategoryTrees item = firstLevelCategoryAdapter.getItem(firstCategoryByIndex); OrderCategoryBean.FoodCategoryTrees item = firstLevelCategoryAdapter.getItem(firstCategoryByIndex);
//正 //正
if (item.getSize() < 0) { if (item.getSize() < 0) {
...@@ -730,6 +766,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -730,6 +766,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
firstLevelCategoryAdapter.notifyItemChanged(firstCategoryByIndex); firstLevelCategoryAdapter.notifyItemChanged(firstCategoryByIndex);
} }
} }
//修改
mPresenter.addFood(purchaseFoodBean); mPresenter.addFood(purchaseFoodBean);
shoppingCartNum += currentNum - beforeNum; shoppingCartNum += currentNum - beforeNum;
setTvShoppingCartNum(shoppingCartNum); setTvShoppingCartNum(shoppingCartNum);
...@@ -744,6 +781,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -744,6 +781,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
} }
private void setTvShoppingCartNum(int num) { private void setTvShoppingCartNum(int num) {
tvSelectFoodSize.setText(String.valueOf(num));
//食材管理頁面,這個tvShoppingCart為空 //食材管理頁面,這個tvShoppingCart為空
if (tvShoppingCart != null) { if (tvShoppingCart != null) {
tvShoppingCart.setText(String.valueOf(num)); tvShoppingCart.setText(String.valueOf(num));
...@@ -770,17 +808,41 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -770,17 +808,41 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
scrollToPosition(index, (LinearLayoutManager) rvFoodIngredients.getLayoutManager()); scrollToPosition(index, (LinearLayoutManager) rvFoodIngredients.getLayoutManager());
} }
/**
* 獲取雙列的recyclerview的layoutManager
*/
@NotNull @NotNull
private GroupedGridLayoutManager getDoubleRowManager() { private GroupedGridLayoutManager getDoubleRowManager() {
val gridLayoutManager = new GroupedGridLayoutManager(requireContext(), 2, adapter); val gridLayoutManager = new GroupedGridLayoutManager(requireContext(), 2, adapter);
return gridLayoutManager; return gridLayoutManager;
} }
/**
* 滾動到指定位置
*
* @param n 下標
* @param linearLayoutManager recyclerview的layoutManager
*/
public void scrollToPosition(int n, LinearLayoutManager linearLayoutManager) { public void scrollToPosition(int n, LinearLayoutManager linearLayoutManager) {
isUser = false; isUser = false;
linearLayoutManager.scrollToPositionWithOffset(n, 0); linearLayoutManager.scrollToPositionWithOffset(n, 0);
} }
/**
* 獲取當前分類名稱
*
* @return 當前分類名稱
*/
private String getCurrentCategoryName() {
String defaultName = "";
if (firstLevelCategoryAdapter != null) {
if (firstLevelCategoryAdapter.getItemCount() > firstLevelCategoryAdapter.getSelectedIndex()) {
defaultName = firstLevelCategoryAdapter.getItem(firstLevelCategoryAdapter.getSelectedIndex()).getName();
}
}
return defaultName;
}
@Override @Override
public void onFragmentResult(int requestCode, int resultCode, Bundle data) { public void onFragmentResult(int requestCode, int resultCode, Bundle data) {
super.onFragmentResult(requestCode, resultCode, data); super.onFragmentResult(requestCode, resultCode, data);
......
...@@ -93,6 +93,7 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi ...@@ -93,6 +93,7 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi
* ADD_ORDER 為添加訂單頁面 * ADD_ORDER 為添加訂單頁面
* ORDER_TYPE 為購物車頁面 * ORDER_TYPE 為購物車頁面
* GET_FOOD_BY_SUPPLIER 根据供應商顯示食品列表 * GET_FOOD_BY_SUPPLIER 根据供應商顯示食品列表
* GET_FOOD_BY_WAREHOUSING_ORDER 入庫訂單選購食材
*/ */
private int pageType = 1; private int pageType = 1;
public final static int FOOD_INGREDIENTS = 1; public final static int FOOD_INGREDIENTS = 1;
...@@ -100,6 +101,7 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi ...@@ -100,6 +101,7 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi
public final static int ORDER_TYPE = 3; public final static int ORDER_TYPE = 3;
public final static int GET_FOOD_BY_SUPPLIER = 4; public final static int GET_FOOD_BY_SUPPLIER = 4;
private final static String pageTypeKey = "pageType"; private final static String pageTypeKey = "pageType";
private final static String supplierIdKey = "supplierId"; private final static String supplierIdKey = "supplierId";
private final static String supplierNameKey = "supplierName"; private final static String supplierNameKey = "supplierName";
...@@ -411,7 +413,7 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi ...@@ -411,7 +413,7 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi
} else if (view.getId() == R.id.iv_supplier_delete) { } else if (view.getId() == R.id.iv_supplier_delete) {
//刪除食材 //刪除食材
PurchaseFoodBean purchaseFoodBean = foodListAdapter.getData().get(position); PurchaseFoodBean purchaseFoodBean = foodListAdapter.getData().get(position);
new AppDialog().showWaringDialog(mContext, "是否確認刪除" + purchaseFoodBean.getName(), (view1, dialog) -> { AppDialog.getInstance().showWaringDialog(mContext, "是否確認刪除" + purchaseFoodBean.getName(), () -> {
if (!isSupplier) { if (!isSupplier) {
purchaseFoodBean.setFoodCategoryName(getCurrentCategory()); purchaseFoodBean.setFoodCategoryName(getCurrentCategory());
} }
......
...@@ -176,9 +176,7 @@ public class MeasurementUnitFragment extends BaseSupplyChainFragment<Measurement ...@@ -176,9 +176,7 @@ public class MeasurementUnitFragment extends BaseSupplyChainFragment<Measurement
measurementUnitAdapter.setOnItemChildClickListener((adapter, view, position) -> { measurementUnitAdapter.setOnItemChildClickListener((adapter, view, position) -> {
List<MeasurementUnitBean.DataBean.Unit> data = measurementUnitAdapter.getData(); List<MeasurementUnitBean.DataBean.Unit> data = measurementUnitAdapter.getData();
MeasurementUnitBean.DataBean.Unit unit = data.get(position); MeasurementUnitBean.DataBean.Unit unit = data.get(position);
new AppDialog().showWaringDialog(mContext, "是否確認刪除?", (view1, dialog) -> { AppDialog.getInstance().showWaringDialog(mContext, "是否確認刪除?", () -> mPresenter.deleteMeasurementUnit(unit, position));
mPresenter.deleteMeasurementUnit(unit, position);
});
}); });
measurementUnitAdapter.setOnItemClickListener((adapter, view, position) -> { measurementUnitAdapter.setOnItemClickListener((adapter, view, position) -> {
List<MeasurementUnitBean.DataBean.Unit> data = measurementUnitAdapter.getData(); List<MeasurementUnitBean.DataBean.Unit> data = measurementUnitAdapter.getData();
......
...@@ -253,6 +253,7 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI ...@@ -253,6 +253,7 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI
if (data != null) { if (data != null) {
Uri uri = data.getData(); Uri uri = data.getData();
if (uri != null) { if (uri != null) {
//有報錯
File file = SelectPicture.getInstance().uriToFileApiQ(requireContext(), uri); File file = SelectPicture.getInstance().uriToFileApiQ(requireContext(), uri);
SelectPicture.getInstance().crop(Uri.fromFile(file), this); SelectPicture.getInstance().crop(Uri.fromFile(file), this);
} }
......
...@@ -255,7 +255,7 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr ...@@ -255,7 +255,7 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
showMessage("有已收貨食材,訂單不可刪除"); showMessage("有已收貨食材,訂單不可刪除");
return; return;
} }
AppDialog.getInstance().showWaringDialog(mContext, "是否刪除訂單", (view1, dialog) -> mPresenter.deleteOrder()); AppDialog.getInstance().showWaringDialog(mContext, "是否刪除訂單", () -> mPresenter.deleteOrder());
} else if (position == 2) { } else if (position == 2) {
//部分收貨 //部分收貨
addWarehouse(PurchaseOrderDetailsBean.PART_RECEIVED); addWarehouse(PurchaseOrderDetailsBean.PART_RECEIVED);
...@@ -579,16 +579,9 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr ...@@ -579,16 +579,9 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
ScanSnPopup scanSnPopup = new ScanSnPopup(this, infoVosBean.getName(), CollectionUtils.deepCopy(foodEncodeSns), infoVosBean.getStatus() != PurchaseOrderDetailsBean.COMPLETE_RECEIVED) ScanSnPopup scanSnPopup = new ScanSnPopup(this, infoVosBean.getName(), CollectionUtils.deepCopy(foodEncodeSns), infoVosBean.getStatus() != PurchaseOrderDetailsBean.COMPLETE_RECEIVED)
.setOnDeleteListener((snCode, snPosition) -> { .setOnDeleteListener((snCode, snPosition) -> {
if (foodEncodeSns != null) { if (!snCode.newAdd) {
for (PurchaseFoodEncodeSn foodEncodeSn : foodEncodeSns) { mPresenter.deleteSn(infoVosBean.getOrderNo(), infoVosBean.getFoodNo(), snCode.getEncodeSnNo());
if (foodEncodeSn.getEncodeSnNo().equals(snCode)) { foodEncodeSns.remove(snCode);
if (!foodEncodeSn.newAdd) {
mPresenter.deleteSn(infoVosBean.getOrderNo(), infoVosBean.getFoodNo(), foodEncodeSn.getEncodeSnNo());
foodEncodeSns.remove(foodEncodeSn);
}
return;
}
}
} }
}); });
scanSnPopup.setOnScanResultListener((popup, scanResult) -> { scanSnPopup.setOnScanResultListener((popup, scanResult) -> {
......
...@@ -208,7 +208,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr ...@@ -208,7 +208,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
//刪除 //刪除
if (purchaseOrderAdapter.getItem(position).getStatus() == PurchaseOrderDetailsBean.WAIT_RECEIVED) { if (purchaseOrderAdapter.getItem(position).getStatus() == PurchaseOrderDetailsBean.WAIT_RECEIVED) {
//只有待收貨可以刪除 //只有待收貨可以刪除
AppDialog.getInstance().showWaringDialog(mContext, "是否刪除訂單", (view1, dialog) -> mPresenter.deleteOrder(position, purchaseOrderAdapter.getData().get(position).getId())); AppDialog.getInstance().showWaringDialog(mContext, "是否刪除訂單", () -> mPresenter.deleteOrder(position, purchaseOrderAdapter.getData().get(position).getId()));
} else { } else {
showMessage("該訂單已有入庫食品,不可刪除!"); showMessage("該訂單已有入庫食品,不可刪除!");
} }
......
...@@ -103,9 +103,7 @@ public class NewSupplierFragment extends BaseSupplyChainFragment<NewSupplierPres ...@@ -103,9 +103,7 @@ public class NewSupplierFragment extends BaseSupplyChainFragment<NewSupplierPres
int viewId = v.getId(); int viewId = v.getId();
if (viewId == R.id.topbar_right_delete_button) { if (viewId == R.id.topbar_right_delete_button) {
//刪除供應商 //刪除供應商
new AppDialog().showWaringDialog(mContext, "刪除供應商", (view1, dialog) -> { AppDialog.getInstance().showWaringDialog(mContext, "刪除供應商", () -> mPresenter.deleteSupplier(supplierBean.getId()));
mPresenter.deleteSupplier(supplierBean.getId());
});
} else if (viewId == R.id.btn_save_supplier) { } else if (viewId == R.id.btn_save_supplier) {
//保存 //保存
if (isUpdate) { if (isUpdate) {
......
...@@ -237,7 +237,7 @@ public class SupplierListFragment extends BaseSupplyChainFragment<SupplierListPr ...@@ -237,7 +237,7 @@ public class SupplierListFragment extends BaseSupplyChainFragment<SupplierListPr
}); });
supplierAdapter.setOnItemChildClickListener((adapter, view, position) -> { supplierAdapter.setOnItemChildClickListener((adapter, view, position) -> {
if (view.getId() == R.id.iv_supplier_delete) { if (view.getId() == R.id.iv_supplier_delete) {
new AppDialog().showWaringDialog(mContext, "刪除供應商", (view1, dialog) -> { AppDialog.getInstance().showWaringDialog(mContext, "刪除供應商", () -> {
List<SupplierInfoBean> data = supplierAdapter.getData(); List<SupplierInfoBean> data = supplierAdapter.getData();
mPresenter.deleteSupplier(data.get(position).getId(), position); mPresenter.deleteSupplier(data.get(position).getId(), position);
}); });
......
package com.gingersoft.supply_chain.mvp.ui.fragment.warehouse;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.SwitchCompat;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemChildClickListener;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2;
import com.gingersoft.supply_chain.di.component.DaggerWarehousingOrderDetailsComponent;
import com.gingersoft.supply_chain.mvp.bean.ConsumeReasonBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart;
import com.gingersoft.supply_chain.mvp.contract.WarehousingOrderDetailsContract;
import com.gingersoft.supply_chain.mvp.presenter.WarehousingOrderDetailsPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.ConsumptionReasonAdapter;
import com.gingersoft.supply_chain.mvp.ui.adapter.WareHousingOrderFoodAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.BuyIngredientsFragment;
import com.gingersoft.supply_chain.mvp.ui.widget.GoodsDetailsPopup;
import com.jess.arms.di.component.AppComponent;
import com.lxj.xpopup.XPopup;
import com.qmuiteam.qmui.alpha.QMUIAlphaTextView;
import com.qmuiteam.qmui.widget.QMUITopBar;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
/**
* Description: 入庫單詳情
*
* @author admin
*/
public class WarehousingOrderDetailsFragment extends BaseSupplyChainFragment<WarehousingOrderDetailsPresenter> implements WarehousingOrderDetailsContract.View {
@BindView(R2.id.supply_top_bar)
QMUITopBar supplyTopBar;
@BindView(R2.id.rv_warehousing_type)
RecyclerView rvWarehousingType;
@BindView(R2.id.rv_warehousing_food)
RecyclerView rvWarehousingFood;
@BindView(R2.id.switch_warehousing_is_print)
SwitchCompat switchWarehousingIsPrint;
@BindView(R2.id.tv_food_species)
TextView tvFoodSpecies;
@BindView(R2.id.tv_order_total_amount)
TextView tvOrderTotalAmount;
@BindView(R2.id.ed_remark)
EditText edRemark;
@BindView(R2.id.tv_order_confirm)
QMUIAlphaTextView tvOrderConfirm;
@BindView(R2.id.tv_order_cancel)
QMUIAlphaTextView tvOrderCancel;
public static WarehousingOrderDetailsFragment newInstance() {
WarehousingOrderDetailsFragment fragment = new WarehousingOrderDetailsFragment();
return fragment;
}
@Override
public void setupFragmentComponent(@NonNull AppComponent appComponent) {
DaggerWarehousingOrderDetailsComponent //如找不到该类,请编译一下项目
.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_order_details, container, false);
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
//入庫類型
rvWarehousingType.setLayoutManager(new GridLayoutManager(requireContext(), 3));
mPresenter.getWarehousingReason();
mPresenter.getWarehousingFood();
}
private View getHeader() {
View view = getLayoutInflater().inflate(R.layout.item_warehousing_order_details, rvWarehousingFood, false);
TextView goodsName = view.findViewById(R.id.tv_goods_name);
TextView goodsUnit = view.findViewById(R.id.tv_goods_unit);
TextView goodsNumber = view.findViewById(R.id.tv_goods_quantity);
TextView tvEdit = view.findViewById(R.id.tv_edit);
goodsName.setTypeface(null, Typeface.BOLD);
goodsUnit.setTypeface(null, Typeface.BOLD);
goodsNumber.setTypeface(null, Typeface.BOLD);
tvEdit.setTypeface(null, Typeface.BOLD);
return view;
}
private View getFooter(View.OnClickListener onClickListener) {
View view = getLayoutInflater().inflate(R.layout.footer_add, rvWarehousingFood, false);
view.setOnClickListener(onClickListener);
return view;
}
@Override
public void initReason(ConsumptionReasonAdapter consumptionReasonAdapter) {
rvWarehousingType.setAdapter(consumptionReasonAdapter);
}
@Override
public void initFoodView(WareHousingOrderFoodAdapter wareHousingOrderFoodAdapter) {
wareHousingOrderFoodAdapter.addHeaderView(getHeader());
wareHousingOrderFoodAdapter.addFooterView(getFooter(v -> start(BuyIngredientsFragment.newInstance(BuyIngredientsFragment.GET_FOOD_BY_WAREHOUSING_ORDER))));
rvWarehousingFood.setAdapter(wareHousingOrderFoodAdapter);
wareHousingOrderFoodAdapter.setOnItemChildClickListener(new OnItemChildClickListener() {
@Override
public void onItemChildClick(@NonNull BaseQuickAdapter adapter, @NonNull View view, int position) {
int viewId = view.getId();
if (viewId == R.id.tv_edit) {
//查看
PurchaseFoodBean item = wareHousingOrderFoodAdapter.getItem(position);
if (wareHousingOrderFoodAdapter.getItem(position).getFoodMarkSn() == PurchaseFoodBean.HAS_SN) {
//SN食材,輸入SN碼
} else {
//顯示詳情
new XPopup.Builder(requireContext())
.autoOpenSoftInput(false)
.autoFocusEditText(false)
.asCustom(new GoodsDetailsPopup(requireContext(), item).setEditNumber(false))
.show();
}
}
}
});
}
}
package com.gingersoft.supply_chain.mvp.ui.fragment.warehouse; package com.gingersoft.supply_chain.mvp.ui.fragment.warehouse;
import android.os.Bundle; import android.os.Bundle;
import android.os.UserManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment; import androidx.annotation.NonNull;
import com.jess.arms.di.component.AppComponent; import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.gsa.cloud.common.core.user.UserConstans;
import com.gingersoft.gsa.cloud.common.core.user.UserContext;
import com.gingersoft.gsa.cloud.common.core.user.info.UserInfo;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.ui.animator.CustomAnimation1;
import com.gingersoft.gsa.cloud.ui.animator.CustomAnimation3;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2;
import com.gingersoft.supply_chain.di.component.DaggerWarehousingOrderListComponent; import com.gingersoft.supply_chain.di.component.DaggerWarehousingOrderListComponent;
import com.gingersoft.supply_chain.mvp.bean.WarehouseOrderBean;
import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart;
import com.gingersoft.supply_chain.mvp.contract.WarehousingOrderListContract; import com.gingersoft.supply_chain.mvp.contract.WarehousingOrderListContract;
import com.gingersoft.supply_chain.mvp.presenter.WarehousingOrderListPresenter; import com.gingersoft.supply_chain.mvp.presenter.WarehousingOrderListPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.WarehousingOrderListAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.BuyIngredientsFragment;
import com.jess.arms.di.component.AppComponent;
import com.qmuiteam.qmui.widget.QMUITopBar;
import com.gingersoft.supply_chain.R; import java.util.ArrayList;
import java.util.List;
import static com.jess.arms.utils.Preconditions.checkNotNull; import butterknife.BindView;
import static com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodIngredientsFragment.FOOD_INGREDIENTS;
/** /**
...@@ -33,7 +49,12 @@ import static com.jess.arms.utils.Preconditions.checkNotNull; ...@@ -33,7 +49,12 @@ import static com.jess.arms.utils.Preconditions.checkNotNull;
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a> * <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================ * ================================================
*/ */
public class WarehousingOrderListFragment extends BaseSupplyChainFragment<WarehousingOrderListPresenter> implements WarehousingOrderListContract.View { public class WarehousingOrderListFragment extends BaseSupplyChainFragment<WarehousingOrderListPresenter> implements WarehousingOrderListContract.View, View.OnClickListener {
@BindView(R2.id.supply_top_bar)
QMUITopBar supplyTopBar;
@BindView(R2.id.rv_second_category)
RecyclerView rvSecondCategory;
public static WarehousingOrderListFragment newInstance() { public static WarehousingOrderListFragment newInstance() {
WarehousingOrderListFragment fragment = new WarehousingOrderListFragment(); WarehousingOrderListFragment fragment = new WarehousingOrderListFragment();
...@@ -57,6 +78,25 @@ public class WarehousingOrderListFragment extends BaseSupplyChainFragment<Wareho ...@@ -57,6 +78,25 @@ public class WarehousingOrderListFragment extends BaseSupplyChainFragment<Wareho
@Override @Override
public void initData(@Nullable Bundle savedInstanceState) { public void initData(@Nullable Bundle savedInstanceState) {
initTopBar(supplyTopBar, "入庫單");
supplyTopBar.addRightImageButton(R.drawable.ic_circle_new_food_ingredient, R.id.topbar_right_add_button).setOnClickListener(this);
List<WarehouseOrderBean> warehouseOrderBeanList = new ArrayList<>();
for (int i = 0; i < 15; i++) {
warehouseOrderBeanList.add(new WarehouseOrderBean("RKO1101" + i, UserContext.newInstance().getMemberName(), TimeUtils.getCurrentDate(TimeUtils.DEFAULT_DATE_FORMAT_YMDHM), "巴西肥牛", 1, "調撥入庫"));
}
WarehousingOrderListAdapter adapter = new WarehousingOrderListAdapter(warehouseOrderBeanList);
adapter.setAdapterAnimation(new CustomAnimation3());
rvSecondCategory.setAdapter(adapter);
}
@Override
public void onClick(View v) {
int viewId = v.getId();
if (viewId == R.id.topbar_right_add_button) {
//先清空購物車
SupplyShoppingCart.getInstance().clear();
//新增入庫單
start(BuyIngredientsFragment.newInstance(BuyIngredientsFragment.GET_FOOD_BY_WAREHOUSING_ORDER));
}
} }
} }
...@@ -107,6 +107,7 @@ public class GoodsDetailsPopup extends CenterPopupView { ...@@ -107,6 +107,7 @@ public class GoodsDetailsPopup extends CenterPopupView {
if (!isEditNumber) { if (!isEditNumber) {
layoutOperationFoodNum.setVisibility(GONE); layoutOperationFoodNum.setVisibility(GONE);
tvGoodsStock.setVisibility(GONE);
return; return;
} }
edFoodIngredientNumber.setText(purchaseFoodBean.getFoodQuantity() + ""); edFoodIngredientNumber.setText(purchaseFoodBean.getFoodQuantity() + "");
......
...@@ -139,7 +139,6 @@ public class ScanSnView extends FrameLayout { ...@@ -139,7 +139,6 @@ public class ScanSnView extends FrameLayout {
this.fragment = fragment; this.fragment = fragment;
} }
public ScanSnView init() { public ScanSnView init() {
View rootView = LayoutInflater.from(getContext()).inflate(R.layout.layout_scan_sn, this, false); View rootView = LayoutInflater.from(getContext()).inflate(R.layout.layout_scan_sn, this, false);
ButterKnife.bind(this, rootView); ButterKnife.bind(this, rootView);
...@@ -198,7 +197,7 @@ public class ScanSnView extends FrameLayout { ...@@ -198,7 +197,7 @@ public class ScanSnView extends FrameLayout {
}); });
adapter.setOnItemChildClickListener((adapter1, view, position) -> { adapter.setOnItemChildClickListener((adapter1, view, position) -> {
if (view.getId() == R.id.iv_sn_code_delete) { if (view.getId() == R.id.iv_sn_code_delete) {
if (adapter.getItem(position).newAdd) { // if (adapter.getItem(position).newAdd) {
onSingerResultListener.onScanValue(false, adapter.getItem(position), adapter.getItemCount()); onSingerResultListener.onScanValue(false, adapter.getItem(position), adapter.getItemCount());
if (onDeleteSnCodeListener != null) { if (onDeleteSnCodeListener != null) {
onDeleteSnCodeListener.onDelete(adapter.getItem(position), position); onDeleteSnCodeListener.onDelete(adapter.getItem(position), position);
...@@ -208,9 +207,9 @@ public class ScanSnView extends FrameLayout { ...@@ -208,9 +207,9 @@ public class ScanSnView extends FrameLayout {
} }
adapter1.removeAt(position); adapter1.removeAt(position);
setConfirmBtnState(); setConfirmBtnState();
} else { // } else {
ToastUtils.show(getContext(), "已入庫的SN碼不可刪除"); // ToastUtils.show(getContext(), "已入庫的SN碼不可刪除");
} // }
} }
}); });
addView(rootView); addView(rootView);
......
<?xml version="1.0" encoding="utf-8"?>
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tv_add_food"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:paddingLeft="@dimen/dp_10"
android:paddingTop="@dimen/dp_5"
android:paddingRight="@dimen/dp_10"
android:paddingBottom="@dimen/dp_5"
android:text="+添加食材"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16" />
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/supply_chain_bg_color"
android:animateLayoutChanges="true" android:animateLayoutChanges="true"
android:background="@color/supply_chain_bg_color"
android:orientation="vertical"> android:orientation="vertical">
<com.qmuiteam.qmui.widget.QMUITopBar <com.qmuiteam.qmui.widget.QMUITopBar
...@@ -120,8 +121,8 @@ ...@@ -120,8 +121,8 @@
android:id="@+id/layout_category" android:id="@+id/layout_category"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dp_40" android:layout_height="@dimen/dp_40"
android:visibility="gone" android:background="@color/white"
android:background="@color/white"> android:visibility="gone">
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_food_ingredients_second_category" android:id="@+id/rv_food_ingredients_second_category"
...@@ -140,8 +141,8 @@ ...@@ -140,8 +141,8 @@
<ImageView <ImageView
android:id="@+id/iv_unfold_arrow" android:id="@+id/iv_unfold_arrow"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/ic_inverted_triangle_66" /> android:src="@drawable/ic_inverted_triangle_66" />
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>
</com.google.android.material.appbar.CollapsingToolbarLayout> </com.google.android.material.appbar.CollapsingToolbarLayout>
...@@ -208,6 +209,7 @@ ...@@ -208,6 +209,7 @@
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_20" android:layout_marginRight="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_10" android:layout_marginBottom="@dimen/dp_10"
android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<com.qmuiteam.qmui.alpha.QMUIAlphaButton <com.qmuiteam.qmui.alpha.QMUIAlphaButton
...@@ -221,6 +223,43 @@ ...@@ -221,6 +223,43 @@
android:textSize="@dimen/dp_16" android:textSize="@dimen/dp_16"
android:visibility="gone" /> android:visibility="gone" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_20"
android:layout_weight="1"
android:visibility="visible">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/str_chosen"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_16" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/left_parenthesis"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_16" />
<TextView
android:id="@+id/tv_select_food_size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textColor="@color/required_color"
android:textSize="@dimen/dp_16" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/right_parenthesis"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_16" />
</LinearLayout>
<FrameLayout <FrameLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -264,9 +303,8 @@ ...@@ -264,9 +303,8 @@
android:layout_marginBottom="@dimen/dp_5" android:layout_marginBottom="@dimen/dp_5"
android:layout_weight="1" android:layout_weight="1"
android:text="取消" android:text="取消"
android:visibility="visible" /> android:visibility="gone" />
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>
</LinearLayout> </LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/supply_chain_top_bar" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_10"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="入庫類型:"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_warehousing_type"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_warehousing_food"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="@dimen/dp_10"
android:layout_weight="1"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/switch_warehousing_is_print"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_15"
android:shadowColor="@color/trans"
android:text="是否打印:"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16"
android:thumb="@drawable/shape_thumb_on"
android:track="@drawable/selector_switch_track" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_15"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="種類:"
android:textColor="@color/color_222"
android:textSize="@dimen/supply_chain_textSize_16" />
<TextView
android:id="@+id/tv_food_species"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/required_color"
android:textSize="@dimen/supply_chain_textSize_16"
android:textStyle="bold"
tools:text="3" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:gravity="right"
android:text="總計:"
android:textColor="@color/color_222"
android:textSize="@dimen/supply_chain_textSize_16" />
<TextView
android:id="@+id/tv_order_total_amount"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/required_color"
android:textSize="@dimen/supply_chain_textSize_16"
android:textStyle="bold"
tools:text="$330" />
</LinearLayout>
<EditText
android:id="@+id/ed_remark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_2"
android:layout_marginRight="@dimen/dp_15"
android:textCursorDrawable="@drawable/cursor_theme"
android:text="勝多負少"
android:hint="@string/str_remark"
android:textColorHint="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_15"
android:layout_marginBottom="@dimen/dp_10"
android:orientation="horizontal">
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_order_confirm"
style="@style/app_btn_style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/shape_app_btn_small_radius"
android:gravity="center"
android:paddingLeft="@dimen/dp_35"
android:paddingTop="@dimen/dp_10"
android:paddingRight="@dimen/dp_35"
android:paddingBottom="@dimen/dp_10"
android:text="確定" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_order_cancel"
style="@style/Cancel_Btn_Style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_15"
android:layout_weight="1"
android:gravity="center"
android:paddingLeft="@dimen/dp_35"
android:paddingTop="@dimen/dp_10"
android:paddingRight="@dimen/dp_35"
android:paddingBottom="@dimen/dp_10"
android:text="取消" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_goods_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:gravity="center"
android:paddingTop="@dimen/dp_5"
android:paddingBottom="@dimen/dp_5"
android:text="食材名"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16" />
<include layout="@layout/include_vertical_color_ccc_dividing_line" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_goods_unit"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:paddingTop="@dimen/dp_5"
android:paddingBottom="@dimen/dp_5"
android:text="單位"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16" />
<ImageView
android:id="@+id/iv_switch_unit"
android:layout_width="@dimen/dp_10"
android:layout_height="@dimen/dp_6"
android:layout_gravity="center_vertical"
android:layout_marginRight="@dimen/dp_11"
android:src="@drawable/ic_inverted_triangle_66"
android:visibility="gone" />
</LinearLayout>
<include layout="@layout/include_vertical_color_ccc_dividing_line" />
<TextView
android:id="@+id/tv_goods_quantity"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:paddingTop="@dimen/dp_5"
android:paddingBottom="@dimen/dp_5"
android:text="數量"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16" />
<include layout="@layout/include_vertical_color_ccc_dividing_line" />
<TextView
android:id="@+id/tv_edit"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:paddingTop="@dimen/dp_5"
android:paddingBottom="@dimen/dp_5"
android:text="編輯"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16" />
</LinearLayout>
\ No newline at end of file
...@@ -112,7 +112,8 @@ ...@@ -112,7 +112,8 @@
android:layout_weight="1" android:layout_weight="1"
android:text="庫存:15/60" android:text="庫存:15/60"
android:textColor="@color/color_3c" android:textColor="@color/color_3c"
android:textSize="@dimen/dp_15" /> android:textSize="@dimen/dp_15"
android:visibility="invisible" />
<LinearLayout <LinearLayout
android:id="@+id/layout_operation_food_num" android:id="@+id/layout_operation_food_num"
......
...@@ -65,7 +65,6 @@ ...@@ -65,7 +65,6 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:switchPadding="@dimen/dp_5" /> app:switchPadding="@dimen/dp_5" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout> </LinearLayout>
......
...@@ -6,4 +6,14 @@ ...@@ -6,4 +6,14 @@
<dimen name="new_supplier_info_item_marginBottom">@dimen/dp_10</dimen> <dimen name="new_supplier_info_item_marginBottom">@dimen/dp_10</dimen>
<dimen name="new_category_dialog_marginLeft">@dimen/dp_15</dimen> <dimen name="new_category_dialog_marginLeft">@dimen/dp_15</dimen>
<dimen name="purchase_order_confirm_item_marginTop">@dimen/dp_10</dimen> <dimen name="purchase_order_confirm_item_marginTop">@dimen/dp_10</dimen>
<!-- 供應鏈通用,便於統一管理,到時候要是修改,直接用名稱一鍵替換 -->
<dimen name="supply_chain_textSize_12">@dimen/textSize_12</dimen>
<dimen name="supply_chain_textSize_14">@dimen/textSize_14</dimen>
<dimen name="supply_chain_textSize_16">@dimen/textSize_16</dimen>
<dimen name="supply_chain_textSize_18">@dimen/textSize_18</dimen>
<dimen name="supply_chain_textSize_20">@dimen/textSize_20</dimen>
</resources> </resources>
\ No newline at end of file
...@@ -57,5 +57,7 @@ ...@@ -57,5 +57,7 @@
<string name="str_select_least_one_product">至少選擇一個商品</string> <string name="str_select_least_one_product">至少選擇一個商品</string>
<string name="str_confirm_receipt">是否確認收貨?</string> <string name="str_confirm_receipt">是否確認收貨?</string>
<string name="str_new_add_ingredients">新增食材</string> <string name="str_new_add_ingredients">新增食材</string>
<string name="str_chosen">已選擇</string>
</resources> </resources>
\ No newline at end of file
...@@ -489,5 +489,11 @@ ...@@ -489,5 +489,11 @@
<dimen name="multi_marginLeft">@dimen/dp_18</dimen> <dimen name="multi_marginLeft">@dimen/dp_18</dimen>
<!-- 多類型adapter 高度:輸入item,選擇item --> <!-- 多類型adapter 高度:輸入item,選擇item -->
<dimen name="multi_height">@dimen/dp_55</dimen> <dimen name="multi_height">@dimen/dp_55</dimen>
<!-- 統一使用字體大小,其他模塊字體大小繼承,便於統一管理-->
<dimen name="textSize_12">@dimen/dp_12</dimen>
<dimen name="textSize_14">@dimen/dp_14</dimen>
<dimen name="textSize_16">@dimen/dp_16</dimen>
<dimen name="textSize_18">@dimen/dp_18</dimen>
<dimen name="textSize_20">@dimen/dp_20</dimen>
</resources> </resources>
\ No newline at end of file
...@@ -285,5 +285,5 @@ ...@@ -285,5 +285,5 @@
<string name="str_modify">修改</string> <string name="str_modify">修改</string>
<string name="str_please_modify_current_category_name">请修改當前類別名稱</string> <string name="str_please_modify_current_category_name">请修改當前類別名稱</string>
<string name="str_data_info">出錯啦,請重新進入後再試</string> <string name="str_data_info">出錯啦,請重新進入後再試</string>
<string name="str_look_over">查看</string>
</resources> </resources>
...@@ -18,7 +18,7 @@ public class CustomAnimation3 implements BaseAnimation { ...@@ -18,7 +18,7 @@ public class CustomAnimation3 implements BaseAnimation {
alpha.setDuration(450); alpha.setDuration(450);
Animator translationY = Animator translationY =
ObjectAnimator.ofFloat(view, "translationY", view.getRootView().getHeight(), 0f); ObjectAnimator.ofFloat(view, "translationY", view.getRootView().getHeight(), 0.5f);
translationY.setDuration(450); translationY.setDuration(450);
translationY.setInterpolator(new DecelerateInterpolator(1.2f)); translationY.setInterpolator(new DecelerateInterpolator(1.2f));
......
...@@ -34,47 +34,19 @@ public class AppDialog { ...@@ -34,47 +34,19 @@ public class AppDialog {
} }
public void showWaringDialog(Context context, String title, DialogOnClickListener sureOnclickListener) { public void showWaringDialog(Context context, String title, OnConfirmListener confirmListener) {
showWaringDialog(context, title, null, null, sureOnclickListener, null, true); showWaringDialog(context, title, null, null, confirmListener, null, true);
} }
public void showWaringDialog(Context context, String title, boolean isDismiss, DialogOnClickListener sureOnclickListener) { public void showWaringDialog(Context context, String title, OnConfirmListener confirmListener, OnCancelListener cancelListener) {
showWaringDialog(context, title, null, null, sureOnclickListener, null, isDismiss); showWaringDialog(context, title, null, null, confirmListener, cancelListener, true);
} }
public void showWaringDialog(Context context, String title, boolean isDismiss, OnConfirmListener confirmListener, OnCancelListener cancelListener) {
public void showWaringDialog(Context context, String title, boolean isDismiss, DialogOnClickListener sureOnclickListener, DialogOnClickListener cancelOnclickListener) { showWaringDialog(context, title, null, null, confirmListener, cancelListener, isDismiss);
showWaringDialog(context, title, null, null, sureOnclickListener, cancelOnclickListener, isDismiss);
} }
private void showWaringDialog(Context context, String title, String confimText, String cancelText, DialogOnClickListener sureOnclickListener, DialogOnClickListener cancelOnclickListener, boolean isDismiss) { private void showWaringDialog(Context context, String title, String sureBtnText, String cancelBtnText, OnConfirmListener confirmListener, OnCancelListener cancelListener, boolean isDismiss) {
//DialogUtils內存洩漏,換Xpopup new XPopup.Builder(context).asConfirm(title, "", cancelBtnText, sureBtnText, confirmListener, cancelListener, false, R.layout.other_order_pause_orders).show();
new DialogUtils(context, R.layout.other_order_pause_orders) {
@Override
public void initLayout(ViewHepler hepler, Dialog dialog) {
if (title != null) {
hepler.setText(R.id.tv_warning_title, title);
}
if (confimText != null) {
hepler.setText(R.id.tv_dialog_confirm, confimText);
}
if (sureOnclickListener != null) {
hepler.getView(R.id.tv_dialog_confirm).setOnClickListener(v -> {
sureOnclickListener.onclick(v, dialog);
if (isDismiss) {
dialog.dismiss();
}
});
}
if (cancelText != null) {
hepler.setText(R.id.tv_dialog_cancel, cancelText);
}
if (cancelOnclickListener != null) {
hepler.getView(R.id.tv_dialog_cancel).setOnClickListener(v -> cancelOnclickListener.onclick(v, dialog));
} else {
hepler.getView(R.id.tv_dialog_cancel).setOnClickListener(v -> dialog.dismiss());
}
}
}.show();
} }
public void showSelectDialog(Context context, String title, int spanCount, RecyclerView.Adapter adapter, DialogOnClickListener sureOnclickListenter) { public void showSelectDialog(Context context, String title, int spanCount, RecyclerView.Adapter adapter, DialogOnClickListener sureOnclickListenter) {
...@@ -119,29 +91,6 @@ public class AppDialog { ...@@ -119,29 +91,6 @@ public class AppDialog {
public void showTipDialog(Context context, String title, String sureBtnText, String cancelBtnText, OnConfirmListener sureOnclickListener, OnCancelListener 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 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) { public void showListDialog(Context context, String[] data, onDialogSelectListener onSelectListener) {
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:background="@drawable/shape_white_eight_corners_bg" android:background="@drawable/shape_white_eight_corners_bg"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical" android:orientation="vertical"
...@@ -16,14 +17,20 @@ ...@@ -16,14 +17,20 @@
android:src="@drawable/ic_warning" /> android:src="@drawable/ic_warning" />
<TextView <TextView
android:id="@+id/tv_warning_title" android:id="@+id/tv_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_22" android:layout_marginTop="@dimen/dp_22"
android:text="是否暫停接單?" tools:text="是否暫停接單?"
android:textColor="@color/color_3c" android:textColor="@color/color_3c"
android:textSize="@dimen/dp_20" /> android:textSize="@dimen/dp_20" />
<TextView
android:id="@+id/tv_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" />
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -31,7 +38,7 @@ ...@@ -31,7 +38,7 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/tv_dialog_confirm" android:id="@+id/tv_confirm"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/shape_red_seven_radius_bg" android:background="@drawable/shape_red_seven_radius_bg"
...@@ -44,7 +51,7 @@ ...@@ -44,7 +51,7 @@
android:textSize="@dimen/dp_15" /> android:textSize="@dimen/dp_15" />
<TextView <TextView
android:id="@+id/tv_dialog_cancel" android:id="@+id/tv_cancel"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_28" 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