Commit f1f53df5 by Wyh

1、優化凍鏈、外送自取,自動接單 2、修復在線更新apk問題 3、供應鏈食材採購列表

parent 63c11ab4
...@@ -144,7 +144,6 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre ...@@ -144,7 +144,6 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre
for (int i = 0; i < titles.size(); i++) { for (int i = 0; i < titles.size(); i++) {
fragments.add(OrderListFragment.newInstance(status.get(i), ColdChainConstants.orderType + "", i)); fragments.add(OrderListFragment.newInstance(status.get(i), ColdChainConstants.orderType + "", i));
} }
getNumByOrderTypeInvoke("loadNumber");
initViewPager(titles); initViewPager(titles);
initService(); initService();
initHearBroadcast(); initHearBroadcast();
...@@ -235,6 +234,13 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre ...@@ -235,6 +234,13 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre
//兩次推送時間需要間隔五秒以上 //兩次推送時間需要間隔五秒以上
return; return;
} }
if (type == 3 || type == 5
|| type == 6 || type == 7) {
fragments.get(viewPager.getCurrentItem()).onRefreshData();
mPresenter.getBalance();
if (type != 5) {
getNumByOrderTypeInvoke("loadNumber");
}
LoganManager.w_action("eee", "心跳通知" + type); LoganManager.w_action("eee", "心跳通知" + type);
lastMsgTime = nowTime; lastMsgTime = nowTime;
LoganManager.w_action("eee", "自動上菜紙:" + RestaurantExpandInfoUtils.getValue(ExpandConstant.AutoPrinterPaper, true)); LoganManager.w_action("eee", "自動上菜紙:" + RestaurantExpandInfoUtils.getValue(ExpandConstant.AutoPrinterPaper, true));
...@@ -245,13 +251,6 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre ...@@ -245,13 +251,6 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre
if (autoReceivingOrders.isChecked()) { if (autoReceivingOrders.isChecked()) {
mPresenter.startToBeConfirmedOrderList(); mPresenter.startToBeConfirmedOrderList();
} }
if (type == 3 || type == 5
|| type == 6 || type == 7) {
fragments.get(viewPager.getCurrentItem()).onRefreshData();
mPresenter.getBalance();
if (type != 5) {
getNumByOrderTypeInvoke("loadNumber");
}
} }
}); });
......
...@@ -31,6 +31,23 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw ...@@ -31,6 +31,23 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
heWeather heWeather
} }
/**
* 新的獲取訂單列表接口
*/
suspend fun getNewOrderList(restaurantId: Int, appointmentType: Int, page: Int, pageSize: Int, status: String, orderNo: String, phone: String, type: Int) = withContext(Dispatchers.IO) {
val requestBody = FormBody.Builder()
.add("restaurantId", restaurantId.toString())
.add("appointmentType", appointmentType.toString())
.add("page", page.toString())
.add("pageSize", pageSize.toString())
.add("status", status)
.add("orderNo", orderNo)
.add("phone", phone)
.add("type", type.toString())
.build()
network.fetchOrderList(requestBody)
}
suspend fun getOrderGroup(restaurantId: String) = withContext(Dispatchers.IO) { suspend fun getOrderGroup(restaurantId: String) = withContext(Dispatchers.IO) {
val requestBody = FormBody.Builder() val requestBody = FormBody.Builder()
.add("restId", restaurantId) .add("restId", restaurantId)
......
...@@ -36,6 +36,9 @@ class CoolWeatherNetwork { ...@@ -36,6 +36,9 @@ class CoolWeatherNetwork {
//獲取訂單列表 //獲取訂單列表
suspend fun fetchOrderList(requestBody: RequestBody) = ricepon_WechatService.getOrderList(requestBody).await() suspend fun fetchOrderList(requestBody: RequestBody) = ricepon_WechatService.getOrderList(requestBody).await()
//新的獲取訂單列表
suspend fun getOrderList(requestBody: RequestBody) = ricepon_WechatService.getNewOrderList(requestBody).await()
//修改餐廳營業狀態 //修改餐廳營業狀態
suspend fun updateRestOpenStatus(requestBody: RequestBody) = service.updateRestOpenStatus(requestBody).await() suspend fun updateRestOpenStatus(requestBody: RequestBody) = service.updateRestOpenStatus(requestBody).await()
......
...@@ -14,6 +14,9 @@ interface WeatherService { ...@@ -14,6 +14,9 @@ interface WeatherService {
@POST("wechat/findOrderList") @POST("wechat/findOrderList")
fun getOrderList(@Body requestBody: RequestBody): Call<OrderList> fun getOrderList(@Body requestBody: RequestBody): Call<OrderList>
@POST("orderInfo/getOrderList")
fun getNewOrderList(@Body requestBody: RequestBody): Call<OrderList>
@POST("wx/updateRestOpenStatus") @POST("wx/updateRestOpenStatus")
fun updateRestOpenStatus(@Body requestBody: RequestBody): Call<MessageBean> fun updateRestOpenStatus(@Body requestBody: RequestBody): Call<MessageBean>
......
...@@ -63,18 +63,23 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -63,18 +63,23 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
val ErrorCode = 1011//報錯提示 val ErrorCode = 1011//報錯提示
} }
val restaurantId by lazy { RestaurantInfoManager.newInstance().getRestaurantId() } val restaurantId by lazy { RestaurantInfoManager.newInstance().restaurantId }
//用戶id
private val memberId by lazy { UserContext.newInstance().memberId }
//订单數量數組,有五種狀態
var mOrderNum = arrayListOf<MutableLiveData<Int>>() var mOrderNum = arrayListOf<MutableLiveData<Int>>()
var mOrderList = arrayListOf<MutableLiveData<ArrayList<OrderList.DataBeanX.DataBean>>>() var mFragmentData = arrayListOf<MutableLiveData<ArrayList<OrderList.DataBeanX.DataBean>>>()
var orderList = MutableLiveData<OrderList>() var orderList = MutableLiveData<OrderList>()
//其他的所有數據 //其他的所有數據
var otherInfo = MutableLiveData<OrderList.DataBeanX.DataBean>() var otherInfo = MutableLiveData<OrderList.DataBeanX.DataBean>()
var balanceBean = MutableLiveData<BalanceBean>() var balanceBean = MutableLiveData<BalanceBean>()
//是否顯示加載框
var showLoading = MutableLiveData<Boolean>(false)
//刷新狀態,值為當前頁面的下標 //刷新狀態,值為當前頁面的下標
var refreshState = MutableLiveData(0) var refreshState = MutableLiveData(0)
...@@ -90,7 +95,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -90,7 +95,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
//接單超時時間 //接單超時時間
var timeOut = 0 var timeOut = 0
var appointmentType = MutableLiveData(0) //0為即時單,1為預約單 var appointmentType = MutableLiveData<Int>() //0為即時單,1為預約單
var instantOrderNum = MutableLiveData(0) //即時單單數 var instantOrderNum = MutableLiveData(0) //即時單單數
var bookingOrderNum = MutableLiveData(0) //預約單單數 var bookingOrderNum = MutableLiveData(0) //預約單單數
var bookingConfigTime = MutableLiveData<Int>()//預約單配置時間 var bookingConfigTime = MutableLiveData<Int>()//預約單配置時間
...@@ -156,38 +161,44 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -156,38 +161,44 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
/** /**
* 獲取訂單列表 * 獲取訂單列表
*/ */
fun getOrderList(restaurantId: String, position: Int, page: String, isLoadMore: Boolean) { fun getOrderList(position: Int, page: String, isLoadMore: Boolean) {
launch({ launch({
var orderType = appointmentType.value var orderType = appointmentType.value
if (position > 1) { if (position > 1) {
orderType = 0 orderType = 0
} }
repository.requestOrderList(restaurantId, fragmentStatus[position], fragmentType[position], page, orderNo, phone, orderType repository.requestOrderList(restaurantId.toString(), fragmentStatus[position], fragmentType[position], page, orderNo, phone, orderType
?: 0).apply { ?: 0).apply {
if (isSuccess()) { if (isSuccess()) {
getOrderGroupNum(restaurantId) getOrderGroupNum(restaurantId.toString())
loadInfo(isLoadMore, position) loadInfo(isLoadMore, position)
} else { } else {
orderList.postValue(this) mFragmentData[position].postValue(null)
mOrderList[position].value = null
OkHttp3Utils.noticePersonnel(AppConstans.RP_ORDER_LIST_ERROR, "獲取訂單列表失敗") OkHttp3Utils.noticePersonnel(AppConstans.RP_ORDER_LIST_ERROR, "獲取訂單列表失敗")
} }
} }
}, { }, {
//出錯 //出錯
mOrderList[position].value = null mFragmentData[position].postValue(null)
OkHttp3Utils.noticePersonnel(AppConstans.RP_ORDER_LIST_ERROR, "獲取訂單列表報錯" + it.message) OkHttp3Utils.noticePersonnel(AppConstans.RP_ORDER_LIST_ERROR, "獲取訂單列表報錯" + it.message)
OtherOrderUtils.initSoundPool(GsaCloudApplication.getAppContext(), R.raw.raw_get_order_list_error) OtherOrderUtils.initSoundPool(GsaCloudApplication.getAppContext(), R.raw.raw_get_order_list_error)
}) })
} }
private var autoPolling: Disposable? = null; fun getNewOrderList(appointmentType: Int, page: Int, status: String, type: Int, orderNo: String = "", phone: String = "") {
launch({
repository.getNewOrderList(restaurantId, appointmentType, page, 10, status, orderNo, phone, type).apply {
}
}, {
})
}
/** /**
* 開始自動確認訂單 * 開始自動確認訂單
*/ */
fun startAutoConfirmOrder() { fun startAutoConfirmOrder() {
autoPolling = RxJavaUtils.polling(10) {
launch({ launch({
//獲取即時單 //獲取即時單
repository.requestOrderList(restaurantId.toString(), fragmentStatus[1] + ",8", fragmentType[0], "1", orderNo, phone, 0).apply { repository.requestOrderList(restaurantId.toString(), fragmentStatus[1] + ",8", fragmentType[0], "1", orderNo, phone, 0).apply {
...@@ -236,7 +247,6 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -236,7 +247,6 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
} }
} else { } else {
} }
} }
//獲取預約單 //獲取預約單
...@@ -265,12 +275,6 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -265,12 +275,6 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
LoganManager.w_delivery(LoganManager.EVENT_QUERY, "自動接單" + it.message) LoganManager.w_delivery(LoganManager.EVENT_QUERY, "自動接單" + it.message)
}) })
} }
}
fun stopAutoConfirmOrder() {
autoPolling?.dispose()
}
private fun OrderList.loadInfo(isLoadMore: Boolean, position: Int) { private fun OrderList.loadInfo(isLoadMore: Boolean, position: Int) {
getData()?.statistics?.let { getData()?.statistics?.let {
...@@ -293,18 +297,18 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -293,18 +297,18 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
myData.removeAt(myData.size - 1) myData.removeAt(myData.size - 1)
//如果是加載更多 //如果是加載更多
if (isLoadMore) { if (isLoadMore) {
if (mOrderList[position].value != null) { if (mFragmentData[position].value != null) {
mOrderList[position].value!!.addAll(myData) mFragmentData[position].value!!.addAll(myData)
mOrderList[position].postValue(mOrderList[position].value) mFragmentData[position].postValue(mFragmentData[position].value)
} }
} else { } else {
mOrderList[position].value = myData mFragmentData[position].value = myData
} }
} else { } else {
mOrderList[position].value = null mFragmentData[position].value = null
} }
} else { } else {
mOrderList[position].value = null mFragmentData[position].value = null
} }
} }
...@@ -315,9 +319,9 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -315,9 +319,9 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
* 修改餐廳營業狀態 * 修改餐廳營業狀態
* 0=休息中, 1=營業中,2=繁忙中不可接單,3繁忙可接單 * 0=休息中, 1=營業中,2=繁忙中不可接單,3繁忙可接單
*/ */
fun updateRestOpenStatus(state: Int, restaurantId: String) { fun updateRestOpenStatus(state: Int) {
launch({ launch({
repository.updateRestOpenStatus(state, restaurantId).apply { repository.updateRestOpenStatus(state, restaurantId.toString()).apply {
if (success) { if (success) {
restaurantState.value = state restaurantState.value = state
} }
...@@ -905,9 +909,9 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -905,9 +909,9 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
/** /**
* 獲取配送員信息 * 獲取配送員信息
*/ */
fun getDeliveryInfo(restaurantId: String, memberId: String) { fun getDeliveryInfo() {
launch({ launch({
repository.getDeliveryInfo(restaurantId, memberId).apply { repository.getDeliveryInfo(restaurantId.toString(), memberId.toString()).apply {
deliveryBean = this deliveryBean = this
} }
}, { }, {
......
...@@ -10,6 +10,9 @@ import com.gingersoft.gsa.delivery_pick_mode.ui.fragment.UpdateDeliveryFragment ...@@ -10,6 +10,9 @@ import com.gingersoft.gsa.delivery_pick_mode.ui.fragment.UpdateDeliveryFragment
import com.jess.arms.mvp.IPresenter import com.jess.arms.mvp.IPresenter
import kotlinx.android.synthetic.main.activity_delivery.* import kotlinx.android.synthetic.main.activity_delivery.*
/**
* 外送配置頁面,沒用了
*/
class DeliverySettingActivity : BaseActivity<IPresenter>() { class DeliverySettingActivity : BaseActivity<IPresenter>() {
lateinit var deliverylist_fragment: DeliveryFragment lateinit var deliverylist_fragment: DeliveryFragment
......
...@@ -20,6 +20,9 @@ import com.gingersoft.gsa.delivery_pick_mode.util.InjectorUtil ...@@ -20,6 +20,9 @@ import com.gingersoft.gsa.delivery_pick_mode.util.InjectorUtil
import com.gingersoft.gsa.delivery_pick_mode.util.setState import com.gingersoft.gsa.delivery_pick_mode.util.setState
import kotlinx.android.synthetic.main.fragment_delivery_list.* import kotlinx.android.synthetic.main.fragment_delivery_list.*
/**
* 外送配置頁面,沒用了
*/
class DeliveryFragment : BaseFragment() { class DeliveryFragment : BaseFragment() {
var deliveryListAdapter: DeliveryListAdapter? = null var deliveryListAdapter: DeliveryListAdapter? = null
...@@ -37,7 +40,6 @@ class DeliveryFragment : BaseFragment() { ...@@ -37,7 +40,6 @@ class DeliveryFragment : BaseFragment() {
override fun onActivityCreated(savedInstanceState: Bundle?) { override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState) super.onActivityCreated(savedInstanceState)
// childFragmentManager.beginTransaction().remove(this).add(null, "").addToBackStack(null).commit()
addBtn.text = "+添加配送方式" addBtn.text = "+添加配送方式"
addBtn.setOnClickListener { addBtn.setOnClickListener {
(activity as DeliverySettingActivity).editDelivery(null) (activity as DeliverySettingActivity).editDelivery(null)
......
...@@ -2,6 +2,7 @@ package com.gingersoft.gsa.delivery_pick_mode.ui.fragment ...@@ -2,6 +2,7 @@ package com.gingersoft.gsa.delivery_pick_mode.ui.fragment
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.util.Log
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
...@@ -17,40 +18,40 @@ import com.gingersoft.gsa.delivery_pick_mode.ui.adapter.OtherOrdersAdapter ...@@ -17,40 +18,40 @@ import com.gingersoft.gsa.delivery_pick_mode.ui.adapter.OtherOrdersAdapter
import com.gingersoft.gsa.delivery_pick_mode.ui.base.BaseFragment import com.gingersoft.gsa.delivery_pick_mode.ui.base.BaseFragment
import com.gingersoft.gsa.delivery_pick_mode.util.InjectorUtil import com.gingersoft.gsa.delivery_pick_mode.util.InjectorUtil
import com.gingersoft.gsa.delivery_pick_mode.util.setState import com.gingersoft.gsa.delivery_pick_mode.util.setState
import com.jess.arms.utils.LogUtils
import kotlinx.android.synthetic.main.fragment_other_order.* import kotlinx.android.synthetic.main.fragment_other_order.*
/** /**
* A placeholder fragment containing a simple view. * A placeholder fragment containing a simple view.
*/ */
class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) { class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) {
private val pageViewModel by lazy { ViewModelProvider(activity?.viewModelStore!!, InjectorUtil.getWeatherModelFactory())[PageViewModel::class.java] } private val pageViewModel by lazy { ViewModelProvider(activity?.viewModelStore!!, InjectorUtil.getWeatherModelFactory())[PageViewModel::class.java] }
//請求數據頁數
private var page = 1 private var page = 1
//當前fragment是第幾頁
private val restaurantId by lazy { RestaurantInfoManager.newInstance().getRestaurantId() }
private val memberId by lazy { UserContext.newInstance().getMemberId() }
private lateinit var adapter: OtherOrdersAdapter
private var position = 0 private var position = 0
private lateinit var adapter: OtherOrdersAdapter
override fun onActivityCreated(savedInstanceState: Bundle?) { override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState) super.onActivityCreated(savedInstanceState)
//獲取頁數
position = arguments?.getInt(INDEX) ?: 0 position = arguments?.getInt(INDEX) ?: 0
pageViewModel.apply { pageViewModel.apply {
// 綁定狀態,如果這個值發生變化 // 綁定狀態,如果這個值發生變化,並且是當前頁,就去獲取訂單列表
refreshState.observe(viewLifecycleOwner, Observer { refreshState.observe(viewLifecycleOwner, Observer {
if (position == it) { if (position == it) {
page = 1 page = 1
getOrderList(false) getOrderList(false)
} }
}) })
//有多少個Fragment就添加多少個監聽 //有多少個Fragment就添加多少個監聽
while (mOrderList.size <= position) { while (mFragmentData.size <= position) {
mOrderList.add(MutableLiveData()) mFragmentData.add(MutableLiveData())
} }
// 綁定監聽當前fragment的數據項 // 綁定監聽當前fragment的數據項
mOrderList[position].observe(viewLifecycleOwner, Observer { mFragmentData[position].observe(viewLifecycleOwner, Observer {
cancelDialogForLoading() cancelDialogForLoading()
refresh_layout.finishRefresh() refresh_layout.finishRefresh()
refresh_layout.finishLoadMore() refresh_layout.finishLoadMore()
...@@ -88,11 +89,6 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) { ...@@ -88,11 +89,6 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) {
initRefresh() initRefresh()
} }
override fun onResume() {
super.onResume()
refresh()
}
private fun initRefresh() { private fun initRefresh() {
// 设置 Header 顏色 // 设置 Header 顏色
refresh_layout.setPrimaryColorsId(R.color.color_f0, R.color.color_66) refresh_layout.setPrimaryColorsId(R.color.color_f0, R.color.color_66)
...@@ -100,7 +96,7 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) { ...@@ -100,7 +96,7 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) {
refresh_layout.setOnRefreshListener { refresh_layout.setOnRefreshListener {
refresh() refresh()
//重新拉取一遍送貨員信息 //重新拉取一遍送貨員信息
pageViewModel.getDeliveryInfo(restaurantId.toString(), memberId.toString()) pageViewModel.getDeliveryInfo()
} }
refresh_layout.setOnLoadMoreListener { refresh_layout.setOnLoadMoreListener {
page++ page++
...@@ -153,7 +149,7 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) { ...@@ -153,7 +149,7 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) {
} }
private fun getOrderList(isLoadMore: Boolean) { private fun getOrderList(isLoadMore: Boolean) {
pageViewModel.getOrderList(restaurantId.toString(), arguments?.getInt(INDEX) pageViewModel.getOrderList(arguments?.getInt(INDEX)
?: 0, page.toString(), isLoadMore) ?: 0, page.toString(), isLoadMore)
} }
......
...@@ -32,7 +32,7 @@ import java.lang.Double.parseDouble ...@@ -32,7 +32,7 @@ import java.lang.Double.parseDouble
object OtherOrderUtils { object OtherOrderUtils {
fun showOrderDetailsDialog(context: Context, data: OrderDetails, orderStuats: Int, orderType: Int,orderPayType :Int, payType: Int, refundStatus: Int, reasonDesc: String? = "", isHistory: Boolean = false, listenter: ((view: View, data: OrderDetails.DataBean, dialog: Dialog) -> Unit)?) { fun showOrderDetailsDialog(context: Context, data: OrderDetails, orderStuats: Int, orderType: Int, orderPayType: Int, payType: Int, refundStatus: Int, reasonDesc: String? = "", isHistory: Boolean = false, listenter: ((view: View, data: OrderDetails.DataBean, dialog: Dialog) -> Unit)?) {
object : DialogUtils(context, R.layout.layout_order_info_dialog_new) { object : DialogUtils(context, R.layout.layout_order_info_dialog_new) {
override fun initLayout(hepler: ViewHepler, dialog: Dialog) { override fun initLayout(hepler: ViewHepler, dialog: Dialog) {
if (data.data != null) { if (data.data != null) {
...@@ -118,7 +118,7 @@ object OtherOrderUtils { ...@@ -118,7 +118,7 @@ object OtherOrderUtils {
6 -> { 6 -> {
//已取消訂單 //已取消訂單
ivOrderState.setImageResource(R.drawable.img_cancelled) ivOrderState.setImageResource(R.drawable.img_cancelled)
setOrderReason(hepler, orderStuats, refundStatus, orderPayType,payType, reasonDesc) setOrderReason(hepler, orderStuats, refundStatus, orderPayType, payType, reasonDesc)
} }
} }
// val payName = StringBuffer() // val payName = StringBuffer()
...@@ -211,14 +211,14 @@ object OtherOrderUtils { ...@@ -211,14 +211,14 @@ object OtherOrderUtils {
.show() .show()
} }
private fun setOrderReason(holder: DialogUtils.ViewHepler, orderStatus: Int, refundStatus: Int, orderPayType: Int,payType: Int, reasonDesc: String?) { private fun setOrderReason(holder: DialogUtils.ViewHepler, orderStatus: Int, refundStatus: Int, orderPayType: Int, payType: Int, reasonDesc: String?) {
var tv_address_text = holder.getView<TextView>(R.id.tv_receive_address_text) var tv_address_text = holder.getView<TextView>(R.id.tv_receive_address_text)
var tv_address = holder.getView<TextView>(R.id.tv_receive_address) var tv_address = holder.getView<TextView>(R.id.tv_receive_address)
var tv_cancel_reason_text = holder.getView<TextView>(R.id.tv_cancel_reason_text) var tv_cancel_reason_text = holder.getView<TextView>(R.id.tv_cancel_reason_text)
var tv_cancel_reason = holder.getView<TextView>(R.id.tv_cancel_reason) var tv_cancel_reason = holder.getView<TextView>(R.id.tv_cancel_reason)
var tv_refund_reason_text = holder.getView<TextView>(R.id.tv_refund_reason_text) var tv_refund_reason_text = holder.getView<TextView>(R.id.tv_refund_reason_text)
var tv_refund_reason = holder.getView<TextView>(R.id.tv_refund_reason) var tv_refund_reason = holder.getView<TextView>(R.id.tv_refund_reason)
var refundReason = getRefundReasonByStatus(refundStatus, orderPayType,payType); var refundReason = getRefundReasonByStatus(refundStatus, orderPayType, payType);
if (!TextUtils.isEmpty(refundReason)) { if (!TextUtils.isEmpty(refundReason)) {
if (refundStatus == 5) { if (refundStatus == 5) {
tv_refund_reason.setTextColor(getColor(R.color.green_400)) tv_refund_reason.setTextColor(getColor(R.color.green_400))
...@@ -253,7 +253,7 @@ object OtherOrderUtils { ...@@ -253,7 +253,7 @@ object OtherOrderUtils {
/** /**
* 獲取退款說明 * 獲取退款說明
*/ */
private fun getRefundReasonByStatus(refundStatus: Int, orderPayType: Int,payType: Int): String { private fun getRefundReasonByStatus(refundStatus: Int, orderPayType: Int, payType: Int): String {
when (refundStatus) { when (refundStatus) {
5 -> { 5 -> {
return "退款完成" return "退款完成"
...@@ -285,7 +285,13 @@ object OtherOrderUtils { ...@@ -285,7 +285,13 @@ object OtherOrderUtils {
private var soundPool: SoundPool? = null private var soundPool: SoundPool? = null
var lastTime: Long = 0
fun initSoundPool(context: Context, resId: Int) { fun initSoundPool(context: Context, resId: Int) {
//限制10秒提示一次
if (System.currentTimeMillis() - lastTime < 10 * 1000) {
return
}
lastTime = System.currentTimeMillis()
//实例化SoundPool //实例化SoundPool
//sdk版本21是SoundPool 的一个分水岭 //sdk版本21是SoundPool 的一个分水岭
if (soundPool == null) { if (soundPool == null) {
......
...@@ -126,7 +126,7 @@ dependencies { ...@@ -126,7 +126,7 @@ dependencies {
addComponent 'component-delivery-pick' addComponent 'component-delivery-pick'
addComponent 'component-manager' addComponent 'component-manager'
addComponent 'component-coldchain' addComponent 'component-coldchain'
// addComponent 'component-supply-chain' addComponent 'component-supply-chain'
addComponent 'component-webview' addComponent 'component-webview'
addComponent 'component-scan' addComponent 'component-scan'
addComponent 'component-pay' addComponent 'component-pay'
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
android:name="com.yalantis.ucrop.UCropActivity" android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
<!-- 哪個模塊用到,哪個模塊的androidmanifest裡面就要加這個 file_paths 要唯一-->
<provider <provider
android:name="androidx.core.content.FileProvider" android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider" android:authorities="${applicationId}.fileprovider"
...@@ -32,7 +31,7 @@ ...@@ -32,7 +31,7 @@
android:grantUriPermissions="true"> android:grantUriPermissions="true">
<meta-data <meta-data
android:name="android.support.FILE_PROVIDER_PATHS" android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" /> android:resource="@xml/gsa_purchase_paths" />
</provider> </provider>
</application> </application>
......
package com.gingersoft.supply_chain.mvp.bean;
import lombok.Data;
/**
* @author 宇航.
* User: admin
* Date: 2021/3/13
* Time: 9:54
* Use:庫存盤點記錄
*/
@Data
public class InventoryRecordBean {
private String userName;
private int uid;
}
...@@ -26,6 +26,11 @@ public class OrderCategoryBean implements Serializable { ...@@ -26,6 +26,11 @@ public class OrderCategoryBean implements Serializable {
private String name; private String name;
private int parentId; private int parentId;
private List<FoodCategoryTrees> foodCategoryTrees; private List<FoodCategoryTrees> foodCategoryTrees;
/**
* 該分類下的食材信息,需要從接口獲取
*/
private List<PurchaseFoodBean> foodInfo;
public FoodCategoryTrees() { public FoodCategoryTrees() {
} }
public FoodCategoryTrees(int id) { public FoodCategoryTrees(int id) {
......
package com.gingersoft.supply_chain.mvp.bean; package com.gingersoft.supply_chain.mvp.bean;
import com.gingersoft.supply_chain.mvp.content.Constant; import com.gingersoft.supply_chain.mvp.content.Constant;
import com.qmuiteam.qmui.widget.section.QMUISection;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
...@@ -20,7 +21,7 @@ import lombok.Data; ...@@ -20,7 +21,7 @@ import lombok.Data;
* Use:食材信息 * Use:食材信息
*/ */
@Data @Data
public class PurchaseFoodBean implements Serializable { public class PurchaseFoodBean implements Serializable, QMUISection.Model<PurchaseFoodBean> {
private static final long serialVersionUID = 7084280906070243339L; private static final long serialVersionUID = 7084280906070243339L;
public static final String CATEGORY_DIVIDER = "-"; public static final String CATEGORY_DIVIDER = "-";
private Integer id; private Integer id;
...@@ -155,4 +156,22 @@ public class PurchaseFoodBean implements Serializable { ...@@ -155,4 +156,22 @@ public class PurchaseFoodBean implements Serializable {
} }
return clazz; return clazz;
} }
@Override
public PurchaseFoodBean cloneForDiff() {
return null;
}
@Override
public boolean isSameItem(PurchaseFoodBean other) {
return false;
}
@Override
public boolean isSameContent(PurchaseFoodBean other) {
return false;
}
} }
...@@ -28,7 +28,7 @@ public class WarehouseDetailsBean { ...@@ -28,7 +28,7 @@ public class WarehouseDetailsBean {
private String orderNo; private String orderNo;
private double foodQuantity; private double foodQuantity;
private double totalPrice; private double totalPrice;
// private String createTime; // private String createTime;
private String supplierName; private String supplierName;
/** /**
* 單位 * 單位
......
...@@ -48,8 +48,8 @@ public class SupplyShoppingCart { ...@@ -48,8 +48,8 @@ public class SupplyShoppingCart {
return cartFoods; return cartFoods;
} }
public Map<Integer, SupplierInfoBean> getSupplierInfoBeanMap(){ public Map<Integer, SupplierInfoBean> getSupplierInfoBeanMap() {
if(supplierInfoBeanMap == null){ if (supplierInfoBeanMap == null) {
supplierInfoBeanMap = new HashMap<>(); supplierInfoBeanMap = new HashMap<>();
} }
return supplierInfoBeanMap; return supplierInfoBeanMap;
...@@ -59,7 +59,7 @@ public class SupplyShoppingCart { ...@@ -59,7 +59,7 @@ public class SupplyShoppingCart {
return getSupplierInfoBeanMap().get(supplierId); return getSupplierInfoBeanMap().get(supplierId);
} }
public void updateSupplier(SupplierInfoBean supplierInfoBean){ public void updateSupplier(SupplierInfoBean supplierInfoBean) {
getSupplierInfoBeanMap().put(supplierInfoBean.getId(), supplierInfoBean); getSupplierInfoBeanMap().put(supplierInfoBean.getId(), supplierInfoBean);
} }
...@@ -85,6 +85,29 @@ public class SupplyShoppingCart { ...@@ -85,6 +85,29 @@ public class SupplyShoppingCart {
} }
} }
public void replaceFood(PurchaseFoodBean purchaseFoodBean) {
RxJavaUtils.doInIOThread(new RxIOTask<Object>(1) {
@Override
public Void doInIOThread(Object o) {
for (int i = 0; i < getCartFoods().size(); i++) {
PurchaseFoodBean cartFood = getCartFoods().get(i);
//找到這個食品
if (purchaseFoodBean.getId().equals(cartFood.getId())) {
int foodNum = cartFood.getFoodQuantity();
purchaseFoodBean.setFoodQuantity(foodNum);
if (getSupplierInfoBeanMap().get(purchaseFoodBean.getSupplierId()) != null) {
//可能用戶修改了食品的供應商信息,但是這裡是沒有供應商的詳細,直接移除食品
getCartFoods().add(i, purchaseFoodBean);
}
cartFoods.remove(cartFood);
break;
}
}
return null;
}
});
}
public void clear() { public void clear() {
if (cartFoods == null) { if (cartFoods == null) {
return; return;
......
...@@ -35,6 +35,11 @@ public interface SendMsgContract { ...@@ -35,6 +35,11 @@ public interface SendMsgContract {
* 發送成功,切換到下一個供應商並選中默認發送方式 * 發送成功,切換到下一個供應商並選中默認發送方式
*/ */
void sendSuccess(); void sendSuccess();
/**
* 回退到採購單列表
*/
void backToOrderList();
} }
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存 //Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
......
package com.gingersoft.supply_chain.mvp.contract; package com.gingersoft.supply_chain.mvp.contract;
import com.gingersoft.gsa.cloud.common.bean.BaseResult; import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.supply_chain.mvp.bean.InventoryRecordBean;
import com.jess.arms.mvp.IView; import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel; import com.jess.arms.mvp.IModel;
import java.util.List;
import java.util.Map; import java.util.Map;
import io.reactivex.Observable; import io.reactivex.Observable;
...@@ -27,7 +29,7 @@ public interface WarehousingInventoryContract { ...@@ -27,7 +29,7 @@ public interface WarehousingInventoryContract {
interface View extends IView { interface View extends IView {
void updateSuccess(); void updateSuccess();
void loadRecord(); void loadRecord(List<InventoryRecordBean> inventoryRecordBeans);
} }
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存 //Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
......
...@@ -401,6 +401,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient ...@@ -401,6 +401,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
*/ */
public void updateFood(PurchaseFoodBean purchaseFoodBean) { public void updateFood(PurchaseFoodBean purchaseFoodBean) {
//後台不要,不然修改供應商不成功 //後台不要,不然修改供應商不成功
int supplierId = purchaseFoodBean.getSupplierId();
purchaseFoodBean.setSupplierId(null); purchaseFoodBean.setSupplierId(null);
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(purchaseFoodBean)); RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(purchaseFoodBean));
mModel.updateFood(requestBody) mModel.updateFood(requestBody)
...@@ -416,25 +417,8 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient ...@@ -416,25 +417,8 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
if (baseResult.isSuccess()) { if (baseResult.isSuccess()) {
mRootView.showMessage(Constant.UPDATE_SUCCESS); mRootView.showMessage(Constant.UPDATE_SUCCESS);
mRootView.updateFoodInfoSuccess(purchaseFoodBean.getSupplierName(), purchaseFoodBean.getFoodCategoryName()); mRootView.updateFoodInfoSuccess(purchaseFoodBean.getSupplierName(), purchaseFoodBean.getFoodCategoryName());
RxJavaUtils.doInIOThread(new RxIOTask<Object>(1) { purchaseFoodBean.setSupplierId(supplierId);
@Override SupplyShoppingCart.getInstance().replaceFood(purchaseFoodBean);
public Void doInIOThread(Object o) {
//修改完食品後,需要查看購物車中的這個食品,也要進行修改
List<PurchaseFoodBean> cartFoods = SupplyShoppingCart.getInstance().getCartFoods();
for (int i = 0; i < cartFoods.size(); i++) {
PurchaseFoodBean cartFood = cartFoods.get(i);
if (purchaseFoodBean.getId().equals(cartFood.getId())) {
//找到這個食品
int foodNum = cartFood.getFoodQuantity();
cartFoods.remove(cartFood);
purchaseFoodBean.setFoodQuantity(foodNum);
SupplyShoppingCart.getInstance().addFood(i, purchaseFoodBean);
return null;
}
}
return null;
}
});
} else if (TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) { } else if (TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg()); mRootView.showMessage(baseResult.getErrMsg());
} else { } else {
......
...@@ -79,35 +79,15 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM ...@@ -79,35 +79,15 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM
this.mApplication = null; this.mApplication = null;
} }
public void getPurchaseOrderQrCode(String orderId) {
if (TextUtil.isNotEmptyOrNullOrUndefined(qrCodeMap.get(orderId))) {
// mRootView.loadQrCode(qrCodeMap.get(orderId));
return;
}
mModel.getPurchaseOrderQrCode(orderId)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("獲取訂單內容..."))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(@NonNull BaseResult info) {
if (info.isSuccess() && info.getData() != null) {
qrCodeMap.put(orderId, info.getData().toString());
// mRootView.loadQrCode(qrCodeMap.get(orderId));
}
}
});
}
static class PurchaseMsgBean { static class PurchaseMsgBean {
private int orderId; private int orderId;
private int type; private int type;
private String configText; private String configText;
} }
/**
* 發送採購信息
*/
public void sendMsg() { public void sendMsg() {
if (sendSupplierMsgBeans == null) { if (sendSupplierMsgBeans == null) {
mRootView.showMessage("供應商信息獲取失敗,請退出重試"); mRootView.showMessage("供應商信息獲取失敗,請退出重試");
...@@ -140,6 +120,11 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM ...@@ -140,6 +120,11 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM
} }
} }
/**
* 跟進訂單id和發送類型發送消息
* @param purchaseMsgBean 發送消息類
* @param sendType 發送類型
*/
public void sendMsgByOrderIdAndType(PurchaseMsgBean purchaseMsgBean, int sendType) { public void sendMsgByOrderIdAndType(PurchaseMsgBean purchaseMsgBean, int sendType) {
mModel.senMsg(RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(purchaseMsgBean))) mModel.senMsg(RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(purchaseMsgBean)))
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
...@@ -173,6 +158,37 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM ...@@ -173,6 +158,37 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM
}); });
} }
/**
* 獲取發送到供應商的消息內容並保存
* @param orderId 訂單id
*/
public void getSendMsgAndSave(int orderId) {
PurchaseMsgBean purchaseMsgBean = new PurchaseMsgBean();
purchaseMsgBean.orderId = orderId;
purchaseMsgBean.type = SupplierInfoBean.SupplierContacts.Whatsapp;
mModel.senMsg(RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(purchaseMsgBean)))
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("正在獲取發送內容..."))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(@NonNull BaseResult info) {
if (info.isSuccess() && info.getData() != null) {
MsgConfigBean msgConfigBean = GsonUtils.GsonToBean(info.getData(), MsgConfigBean.class);
qrCodeMap.put(orderId + "", msgConfigBean.getConfigText());
}
}
});
}
/**
* 根據不同的類型發送消息
* @param sendType 發送類型
* @param purchaseMsgBean 發送類
*/
private void sendMsgByType(int sendType, PurchaseMsgBean purchaseMsgBean) { private void sendMsgByType(int sendType, PurchaseMsgBean purchaseMsgBean) {
if (sendType == Whatsapp) { if (sendType == Whatsapp) {
mRootView.shareThirdApp(qrCodeMap.get(purchaseMsgBean.orderId + ""), Whatsapp); mRootView.shareThirdApp(qrCodeMap.get(purchaseMsgBean.orderId + ""), Whatsapp);
...@@ -191,6 +207,16 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM ...@@ -191,6 +207,16 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM
} }
} }
/**
* 獲取發送url
*
* @return
*/
public String getSendUrl() {
SendSupplierMsgBean sendSupplierMsgBean = sendSupplierMsgBeans.get(currentSelectedSupplier);
return qrCodeMap.get(sendSupplierMsgBean.getOrderId() + "");
}
public void getSupplierListByOrders(List<ConfirmOrderBean.PurchaseOrder> purchaseOrders) { public void getSupplierListByOrders(List<ConfirmOrderBean.PurchaseOrder> purchaseOrders) {
//將訂單信息轉為用於顯示的供應商信息 //將訂單信息轉為用於顯示的供應商信息
if (purchaseOrders != null) { if (purchaseOrders != null) {
...@@ -234,8 +260,11 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM ...@@ -234,8 +260,11 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM
public void getContactsBySupplier(int supplierIndex) { public void getContactsBySupplier(int supplierIndex) {
String supplierId; String supplierId;
if (sendSupplierMsgBeans != null && sendSupplierMsgBeans.size() > supplierIndex) { if (sendSupplierMsgBeans != null && sendSupplierMsgBeans.size() > supplierIndex) {
//切換當前選中
currentSelectedSupplier = supplierIndex; currentSelectedSupplier = supplierIndex;
//拿到供應商id
supplierId = sendSupplierMsgBeans.get(supplierIndex).getId() + ""; supplierId = sendSupplierMsgBeans.get(supplierIndex).getId() + "";
//從緩存中取出供應商聯繫方式
List<SupplierInfoBean.SupplierContacts> supplierContacts = sendSupplierMsgBeans.get(supplierIndex).getSupplierContacts(); List<SupplierInfoBean.SupplierContacts> supplierContacts = sendSupplierMsgBeans.get(supplierIndex).getSupplierContacts();
//把所有的供應鏈聯繫方式關閉 //把所有的供應鏈聯繫方式關閉
for (SendSupplierMsgBean sendSupplierMsgBean : sendSupplierMsgBeans) { for (SendSupplierMsgBean sendSupplierMsgBean : sendSupplierMsgBeans) {
...@@ -251,9 +280,12 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM ...@@ -251,9 +280,12 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM
return; return;
} else { } else {
mRootView.loadSupplierList(sendSupplierMsgBeans); mRootView.loadSupplierList(sendSupplierMsgBeans);
//通過聯繫方式獲取發送內容,然後保存
getSendMsgAndSave(sendSupplierMsgBeans.get(supplierIndex).getOrderId());
} }
} }
} else { } else {
mRootView.backToOrderList();
return; return;
} }
getSupplierContactById(supplierIndex, supplierId); getSupplierContactById(supplierIndex, supplierId);
...@@ -261,6 +293,7 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM ...@@ -261,6 +293,7 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM
/** /**
* 跟進供應商id 獲取供應商聯繫方式 * 跟進供應商id 獲取供應商聯繫方式
*
* @param supplierIndex 供應商下標,獲取到聯繫方式之後刷新 * @param supplierIndex 供應商下標,獲取到聯繫方式之後刷新
* @param supplierId 供應商id * @param supplierId 供應商id
*/ */
...@@ -289,6 +322,8 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM ...@@ -289,6 +322,8 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM
SendSupplierMsgBean sendSupplierMsgBean = sendSupplierMsgBeans.get(supplierIndex); SendSupplierMsgBean sendSupplierMsgBean = sendSupplierMsgBeans.get(supplierIndex);
sendSupplierMsgBean.setSupplierContacts(supplierContacts); sendSupplierMsgBean.setSupplierContacts(supplierContacts);
mRootView.loadSupplierList(sendSupplierMsgBeans); mRootView.loadSupplierList(sendSupplierMsgBeans);
//通過聯繫方式獲取發送內容,然後保存
getSendMsgAndSave(sendSupplierMsgBeans.get(supplierIndex).getOrderId());
} else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) { } else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg()); mRootView.showMessage(info.getErrMsg());
} else { } else {
......
...@@ -3,7 +3,9 @@ package com.gingersoft.supply_chain.mvp.presenter; ...@@ -3,7 +3,9 @@ package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.common.bean.BaseResult; import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.mvp.bean.InventoryRecordBean;
import com.gingersoft.supply_chain.mvp.content.Constant; import com.gingersoft.supply_chain.mvp.content.Constant;
import com.jess.arms.integration.AppManager; import com.jess.arms.integration.AppManager;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
...@@ -22,6 +24,7 @@ import com.gingersoft.supply_chain.mvp.contract.WarehousingInventoryContract; ...@@ -22,6 +24,7 @@ import com.gingersoft.supply_chain.mvp.contract.WarehousingInventoryContract;
import com.jess.arms.utils.RxLifecycleUtils; import com.jess.arms.utils.RxLifecycleUtils;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -118,7 +121,8 @@ public class WarehousingInventoryPresenter extends BasePresenter<WarehousingInve ...@@ -118,7 +121,8 @@ public class WarehousingInventoryPresenter extends BasePresenter<WarehousingInve
@Override @Override
public void onNext(BaseResult baseResult) { public void onNext(BaseResult baseResult) {
if (baseResult != null && baseResult.isSuccess()) { if (baseResult != null && baseResult.isSuccess()) {
List<InventoryRecordBean> inventoryRecordBeans = GsonUtils.jsonToList(baseResult.getData(), InventoryRecordBean.class);
mRootView.loadRecord(inventoryRecordBeans);
} else if (baseResult != null && TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) { } else if (baseResult != null && TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg()); mRootView.showMessage(baseResult.getErrMsg());
} else { } else {
......
package com.gingersoft.supply_chain.mvp.ui.adapter; package com.gingersoft.supply_chain.mvp.ui.adapter;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.widget.TextView; import android.widget.TextView;
import androidx.cardview.widget.CardView; import androidx.cardview.widget.CardView;
...@@ -11,7 +9,6 @@ import com.chad.library.adapter.base.BaseQuickAdapter; ...@@ -11,7 +9,6 @@ import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder; import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.gsa.cloud.common.R; import com.gingersoft.gsa.cloud.common.R;
import com.gingersoft.gsa.cloud.ui.bean.view.CategoryBean; import com.gingersoft.gsa.cloud.ui.bean.view.CategoryBean;
import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
...@@ -28,18 +25,18 @@ import java.util.List; ...@@ -28,18 +25,18 @@ import java.util.List;
public class BaseCategoryAdapter extends BaseQuickAdapter<CategoryBean, BaseViewHolder> { public class BaseCategoryAdapter extends BaseQuickAdapter<CategoryBean, BaseViewHolder> {
private int selectedIndex = 0; private int selectedIndex = 0;
private Drawable selectedBg; private int selectedBg;
private Drawable unSelectedBg; private int unSelectedBg;
private int selectColor = -1; private int selectColor = -1;
private int unSelectColor = -1; private int unSelectColor = -1;
private boolean showDelete = false; private boolean showDelete = false;
public BaseCategoryAdapter(@Nullable List<CategoryBean> data, Context context) { public BaseCategoryAdapter(@Nullable List<CategoryBean> data) {
super(R.layout.item_category, data); super(R.layout.item_base_category, data);
addChildClickViewIds(R.id.iv_category_delete); addChildClickViewIds(R.id.iv_category_delete);
selectedBg = ContextCompat.getDrawable(context, R.drawable.shape_left_radio_shadow); selectedBg = R.drawable.shape_left_radio_shadow;
unSelectedBg = ContextCompat.getDrawable(context, R.color.trans); unSelectedBg = R.color.trans;
} }
@Override @Override
...@@ -48,18 +45,14 @@ public class BaseCategoryAdapter extends BaseQuickAdapter<CategoryBean, BaseView ...@@ -48,18 +45,14 @@ public class BaseCategoryAdapter extends BaseQuickAdapter<CategoryBean, BaseView
tvCategoryName.setText(categoryBean.getCategoryName()); tvCategoryName.setText(categoryBean.getCategoryName());
CardView view = viewHolder.getView(R.id.layout_category); CardView view = viewHolder.getView(R.id.layout_category);
if (viewHolder.getAdapterPosition() == selectedIndex) { if (viewHolder.getAdapterPosition() == selectedIndex) {
if (selectedBg != null) { view.setBackground(ContextCompat.getDrawable(getContext(), selectedBg));
view.setBackground(selectedBg);
}
if (selectColor != -1) { if (selectColor != -1) {
tvCategoryName.setTextColor(selectColor); tvCategoryName.setTextColor(selectColor);
} }
tvCategoryName.setSelected(true); tvCategoryName.setSelected(true);
} else { } else {
tvCategoryName.setSelected(false); tvCategoryName.setSelected(false);
if (unSelectedBg != null) { view.setBackground(ContextCompat.getDrawable(getContext(), unSelectedBg));
view.setBackground(unSelectedBg);
}
if (unSelectColor != -1) { if (unSelectColor != -1) {
tvCategoryName.setTextColor(unSelectColor); tvCategoryName.setTextColor(unSelectColor);
} }
...@@ -72,12 +65,12 @@ public class BaseCategoryAdapter extends BaseQuickAdapter<CategoryBean, BaseView ...@@ -72,12 +65,12 @@ public class BaseCategoryAdapter extends BaseQuickAdapter<CategoryBean, BaseView
notifyDataSetChanged(); notifyDataSetChanged();
} }
public BaseCategoryAdapter setSelectedBg(Drawable selectedBg) { public BaseCategoryAdapter setSelectedBg(int selectedBg) {
this.selectedBg = selectedBg; this.selectedBg = selectedBg;
return this; return this;
} }
public BaseCategoryAdapter setUnSelectedBg(Drawable unSelectedBg) { public BaseCategoryAdapter setUnSelectedBg(int unSelectedBg) {
this.unSelectedBg = unSelectedBg; this.unSelectedBg = unSelectedBg;
return this; return this;
} }
......
package com.gingersoft.supply_chain.mvp.ui.adapter;
import android.content.Context;
import android.text.Editable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.gingersoft.gsa.cloud.common.utils.glide.GlideUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.ui.bean.view.CategoryBean;
import com.gingersoft.gsa.cloud.ui.view.section.QDSectionHeaderView;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import com.google.android.material.textfield.TextInputEditText;
import com.qmuiteam.qmui.alpha.QMUIAlphaTextView;
import com.qmuiteam.qmui.layout.QMUIButton;
import com.qmuiteam.qmui.widget.section.QMUIDefaultStickySectionAdapter;
import com.qmuiteam.qmui.widget.section.QMUISection;
import com.qmuiteam.qmui.widget.section.QMUIStickySectionAdapter;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* @author 宇航.
* User: admin
* Date: 2021/3/11
* Time: 16:18
* Use: 食材列表
*/
public class BuyIngredientsAdapter extends QMUIDefaultStickySectionAdapter<CategoryBean, PurchaseFoodBean> {
private Context context;
private boolean isShowDouble = false;
public BuyIngredientsAdapter(Context context, List<QMUISection<CategoryBean, PurchaseFoodBean>> food) {
this.context = context;
setData(food);
}
@NonNull
@Override
protected HeadViewHolder onCreateSectionHeaderViewHolder(@NonNull ViewGroup viewGroup) {
return new HeadViewHolder(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_buy_food_ingredient_header, viewGroup, false));
}
public int getLayoutId() {
if (isShowDouble) {
return R.layout.item_buy_food_ingredient_double_row;
}
return R.layout.item_buy_food_ingredient;
}
public void setShowDoubleRow(boolean showType) {
isShowDouble = showType;
}
@NonNull
@Override
protected ItemViewHolder onCreateSectionItemViewHolder(@NonNull ViewGroup viewGroup) {
return new ItemViewHolder(LayoutInflater.from(viewGroup.getContext()).inflate(getLayoutId(), viewGroup, false));
}
@Override
protected void onBindSectionHeader(QMUIStickySectionAdapter.ViewHolder holder, int position, QMUISection<CategoryBean, PurchaseFoodBean> section) {
super.onBindSectionHeader(holder, position, section);
HeadViewHolder headViewHolder = (HeadViewHolder) holder;
headViewHolder.tvHeader.setText(section.getHeader().getCategoryName());
}
@Override
protected void onBindSectionItem(QMUIStickySectionAdapter.ViewHolder holder, int position, QMUISection<CategoryBean, PurchaseFoodBean> section, int itemIndex) {
super.onBindSectionItem(holder, position, section, itemIndex);
ItemViewHolder itemViewHolder = (ItemViewHolder) holder;
PurchaseFoodBean purchaseFoodBean = section.getItemList().get(itemIndex);
itemViewHolder.tvSupplierName.setText(purchaseFoodBean.getSupplierName());
itemViewHolder.ivFoodIngredientImg.setImageResource(R.drawable.img_small_default);
if (TextUtil.isNotEmptyOrNullOrUndefined(purchaseFoodBean.getImages())) {
GlideUtils.display(itemViewHolder.ivFoodIngredientImg.getContext(), itemViewHolder.ivFoodIngredientImg, purchaseFoodBean.getImages());
}
itemViewHolder.tvFoodItemNo.setText(purchaseFoodBean.getFoodNo());
itemViewHolder.tvFoodItemName.setText(purchaseFoodBean.getName());
//如果有包裝描述就顯示包裝描述,沒有包裝描述顯示基本單位
if (TextUtil.isNotEmptyOrNullOrUndefined(purchaseFoodBean.getPackingDescription())) {
itemViewHolder.tvFoodItemUnit.setText(purchaseFoodBean.getPackingDescription());
} else {
itemViewHolder.tvFoodItemUnit.setText(purchaseFoodBean.getBasicUnitName());
}
itemViewHolder.tvFoodItemPrice.setText(String.format(context.getString(R.string.amount_string), purchaseFoodBean.getUnitPrice()));
itemViewHolder.edFoodIngredientNumber.setText(String.valueOf(purchaseFoodBean.getFoodQuantity()), TextView.BufferType.EDITABLE);
//如果數量小於等於0,就不顯示減號和數量
setSubAndNumShow(itemViewHolder, purchaseFoodBean.getFoodQuantity() <= 0);
//編輯數量
itemViewHolder.btnFoodOperationSub.setOnClickListener(v -> {
//食材數量減少
if (purchaseFoodBean.getFoodQuantity() > 0) {
purchaseFoodBean.setFoodQuantity(purchaseFoodBean.getFoodQuantity() - 1);
itemViewHolder.edFoodIngredientNumber.setText(String.valueOf(purchaseFoodBean.getFoodQuantity()));
}
setSubAndNumShow(itemViewHolder, purchaseFoodBean.getFoodQuantity() <= 0);
});
itemViewHolder.btnFoodOperationAdd.setOnClickListener(v -> {
//食材數量增加
purchaseFoodBean.setFoodQuantity(purchaseFoodBean.getFoodQuantity() + 1);
itemViewHolder.edFoodIngredientNumber.setText(String.valueOf(purchaseFoodBean.getFoodQuantity()));
setSubAndNumShow(itemViewHolder, true);
});
//輸入框焦點監聽
itemViewHolder.edFoodIngredientNumber.setOnFocusChangeListener((v, hasFocus) -> {
Editable text = itemViewHolder.edFoodIngredientNumber.getText();
if (!hasFocus) {
//當失去焦點時,如果沒有食品數量了,就隱藏減號和輸入框
if (TextUtil.isEmptyOrNullOrUndefined(text) || Integer.parseInt(text.toString()) == 0) {
setSubAndNumShow(itemViewHolder, false);
}
}
});
}
/**
* 設置減少按鈕和輸入框的顯示或隱藏
*
* @param showOrHide 顯示或隱藏
*/
private void setSubAndNumShow(ItemViewHolder itemViewHolder, boolean showOrHide) {
itemViewHolder.btnFoodOperationSub.setVisibility(showOrHide ? View.GONE : View.VISIBLE);
itemViewHolder.edFoodIngredientNumber.setVisibility(showOrHide ? View.INVISIBLE : View.VISIBLE);
}
public static class HeadViewHolder extends QMUIStickySectionAdapter.ViewHolder {
@BindView(R2.id.tv_buy_food_header)
QMUIAlphaTextView tvHeader;
public HeadViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
}
public static class ItemViewHolder extends QMUIStickySectionAdapter.ViewHolder {
@BindView(R2.id.iv_food_ingredient_img)
ImageView ivFoodIngredientImg;
@BindView(R2.id.tv_food_item_no)
TextView tvFoodItemNo;
@BindView(R2.id.tv_food_item_supplier_name)
TextView tvSupplierName;
@BindView(R2.id.tv_food_item_name)
TextView tvFoodItemName;
@BindView(R2.id.tv_food_item_unit)
TextView tvFoodItemUnit;
@BindView(R2.id.tv_food_item_price)
TextView tvFoodItemPrice;
@BindView(R2.id.btn_food_operation_sub)
QMUIButton btnFoodOperationSub;
@BindView(R2.id.ed_food_ingredient_number)
TextInputEditText edFoodIngredientNumber;
@BindView(R2.id.btn_food_operation_add)
QMUIButton btnFoodOperationAdd;
public ItemViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
}
}
...@@ -35,7 +35,7 @@ public class CategoryAdapter extends BaseQuickAdapter<OrderCategoryBean.FoodCate ...@@ -35,7 +35,7 @@ public class CategoryAdapter extends BaseQuickAdapter<OrderCategoryBean.FoodCate
private boolean showDelete = false; private boolean showDelete = false;
public CategoryAdapter(@Nullable List<OrderCategoryBean.FoodCategoryTrees> data, Context context) { public CategoryAdapter(@Nullable List<OrderCategoryBean.FoodCategoryTrees> data, Context context) {
super(R.layout.item_category, data); super(R.layout.item_base_category, data);
addChildClickViewIds(R.id.iv_category_delete); addChildClickViewIds(R.id.iv_category_delete);
selectedBg = ContextCompat.getDrawable(context, R.drawable.shape_left_radio_shadow); selectedBg = ContextCompat.getDrawable(context, R.drawable.shape_left_radio_shadow);
unSelectedBg = ContextCompat.getDrawable(context, R.color.trans); unSelectedBg = ContextCompat.getDrawable(context, R.color.trans);
......
package com.gingersoft.supply_chain.mvp.ui.adapter;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.widget.TextView;
import androidx.cardview.widget.CardView;
import androidx.core.content.ContextCompat;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.gsa.cloud.common.R;
import com.gingersoft.gsa.cloud.ui.bean.view.CategoryBean;
import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
/**
* @author 宇航.
* User: admin
* Date: 2020/11/28
* Time: 11:45
* Use: 一級分類
*/
public class FirstLevelCategoryAdapter extends BaseQuickAdapter<OrderCategoryBean.FoodCategoryTrees, BaseViewHolder> {
private int selectedIndex = 0;
private Drawable selectedBg;
private Drawable unSelectedBg;
private int selectColor = -1;
private int unSelectColor = -1;
public FirstLevelCategoryAdapter(@Nullable List<OrderCategoryBean.FoodCategoryTrees> data, Context context) {
super(R.layout.item_first_level_category, data);
selectedBg = ContextCompat.getDrawable(context, R.drawable.shape_left_radio_shadow);
unSelectedBg = ContextCompat.getDrawable(context, R.color.trans);
selectColor = ContextCompat.getColor(context, R.color.other_order_details_sure_btn_color);
unSelectColor = ContextCompat.getColor(context, R.color.color_3c);
}
@Override
protected void convert(@NotNull BaseViewHolder viewHolder, OrderCategoryBean.FoodCategoryTrees categoryBean) {
TextView tvCategoryName = viewHolder.getView(R.id.tv_category_name);
tvCategoryName.setText(categoryBean.getName());
CardView view = viewHolder.getView(R.id.layout_category);
//選中時的背景和文字顏色
if (viewHolder.getAdapterPosition() == selectedIndex) {
if (selectedBg != null) {
view.setBackground(selectedBg);
}
if (selectColor != -1) {
tvCategoryName.setTextColor(selectColor);
}
tvCategoryName.setSelected(true);
} else {
tvCategoryName.setSelected(false);
if (unSelectedBg != null) {
view.setBackground(unSelectedBg);
}
if (unSelectColor != -1) {
tvCategoryName.setTextColor(unSelectColor);
}
}
}
public FirstLevelCategoryAdapter setSelectedBg(Drawable selectedBg) {
this.selectedBg = selectedBg;
return this;
}
public FirstLevelCategoryAdapter setUnSelectedBg(Drawable unSelectedBg) {
this.unSelectedBg = unSelectedBg;
return this;
}
public FirstLevelCategoryAdapter setSelectColor(int selectColor) {
this.selectColor = selectColor;
return this;
}
public FirstLevelCategoryAdapter setUnSelectColor(int unSelectColor) {
this.unSelectColor = unSelectColor;
return this;
}
public void setSelectedIndex(int selectedIndex) {
this.selectedIndex = selectedIndex;
notifyDataSetChanged();
}
public int getSelectedIndex() {
return selectedIndex;
}
}
...@@ -82,10 +82,9 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodBean, BaseView ...@@ -82,10 +82,9 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodBean, BaseView
protected void convert(@NotNull BaseViewHolder viewHolder, PurchaseFoodBean foodInfoBean) { protected void convert(@NotNull BaseViewHolder viewHolder, PurchaseFoodBean foodInfoBean) {
viewHolder.setText(R.id.tv_food_item_supplier_name, foodInfoBean.getSupplierName()); viewHolder.setText(R.id.tv_food_item_supplier_name, foodInfoBean.getSupplierName());
ImageView foodImg = viewHolder.getView(R.id.iv_food_ingredient_img); ImageView foodImg = viewHolder.getView(R.id.iv_food_ingredient_img);
foodImg.setImageResource(R.drawable.img_small_default);
if (TextUtil.isNotEmptyOrNullOrUndefined(foodInfoBean.getImages())) { if (TextUtil.isNotEmptyOrNullOrUndefined(foodInfoBean.getImages())) {
GlideUtils.display(context, foodImg, foodInfoBean.getImages()); GlideUtils.display(context, foodImg, foodInfoBean.getImages());
} else {
foodImg.setImageResource(R.drawable.img_small_default);
} }
viewHolder.setText(R.id.tv_food_item_no, foodInfoBean.getFoodNo()); viewHolder.setText(R.id.tv_food_item_no, foodInfoBean.getFoodNo());
viewHolder.setText(R.id.tv_food_item_name, foodInfoBean.getName()); viewHolder.setText(R.id.tv_food_item_name, foodInfoBean.getName());
......
package com.gingersoft.supply_chain.mvp.ui.adapter;
import android.content.Context;
import androidx.core.content.ContextCompat;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.InventoryRecordBean;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
import cn.bingoogolapple.baseadapter.BGABaseAdapterUtil;
/**
* @author 宇航.
* User: admin
* Date: 2021/3/13
* Time: 10:02
* Use:
*/
public class InventoryRecordAdapter extends BaseQuickAdapter<InventoryRecordBean, BaseViewHolder> {
private int[] colors = new int[]{R.color.color_f9, R.color.white};
public InventoryRecordAdapter(@Nullable List<InventoryRecordBean> data) {
super(R.layout.item_inventory_record, data);
}
@Override
protected void convert(@NotNull BaseViewHolder viewHolder, InventoryRecordBean inventoryRecordBean) {
viewHolder.setText(R.id.tv_inventory_record_username, inventoryRecordBean.getUserName());
viewHolder.setText(R.id.tv_inventory_record_number, inventoryRecordBean.getUserName());
viewHolder.setText(R.id.tv_inventory_record_difference, inventoryRecordBean.getUserName());
viewHolder.setText(R.id.tv_inventory_record_operating_data, inventoryRecordBean.getUserName());
viewHolder.setTextColor(R.id.tv_inventory_record_username, ContextCompat.getColor(getContext(), R.color.color_3c));
viewHolder.setTextColor(R.id.tv_inventory_record_number, ContextCompat.getColor(getContext(), R.color.color_3c));
viewHolder.setTextColor(R.id.tv_inventory_record_difference, ContextCompat.getColor(getContext(), R.color.color_3c));
viewHolder.setTextColor(R.id.tv_inventory_record_operating_data, ContextCompat.getColor(getContext(), R.color.color_3c));
viewHolder.setBackgroundColor(R.id.layout_inventory_record, BGABaseAdapterUtil.getColor(colors[viewHolder.getAdapterPosition() % 2]));
}
}
...@@ -41,5 +41,6 @@ public class PurchaseOrderAdapter extends BaseQuickAdapter<OrderBean, BaseViewHo ...@@ -41,5 +41,6 @@ public class PurchaseOrderAdapter extends BaseQuickAdapter<OrderBean, BaseViewHo
viewHolder.setText(R.id.tv_purchase_order_total_price, String.format(getContext().getString(R.string.amount_string_s), MoneyUtil.formatDouble(purchaseOrderBean.getTotalAmount()))); viewHolder.setText(R.id.tv_purchase_order_total_price, String.format(getContext().getString(R.string.amount_string_s), MoneyUtil.formatDouble(purchaseOrderBean.getTotalAmount())));
viewHolder.setText(R.id.btn_receiver_goods, PurchaseOrderDetailsBean.getStringByOrderState(purchaseOrderBean.getStatus())); viewHolder.setText(R.id.btn_receiver_goods, PurchaseOrderDetailsBean.getStringByOrderState(purchaseOrderBean.getStatus()));
viewHolder.setTextColor(R.id.btn_receiver_goods, ContextCompat.getColor(getContext(), PurchaseOrderDetailsBean.getColorByOrderState(purchaseOrderBean.getStatus()))); viewHolder.setTextColor(R.id.btn_receiver_goods, ContextCompat.getColor(getContext(), PurchaseOrderDetailsBean.getColorByOrderState(purchaseOrderBean.getStatus())));
viewHolder.setGone(R.id.iv_viewed, !purchaseOrderBean.isVisibleState());
} }
} }
package com.gingersoft.supply_chain.mvp.ui.adapter;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.TextView;
import androidx.cardview.widget.CardView;
import androidx.core.content.ContextCompat;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
/**
* @author 宇航.
* User: admin
* Date: 2020/11/28
* Time: 15:41
* Use: 採購食材頁面二級分類
*/
public class SecondCategoryAdapter extends BaseQuickAdapter<OrderCategoryBean.FoodCategoryTrees, BaseViewHolder> {
private int selectIndex = 0;
private int checkedBg;
private int unCheckedBg;
private int checkedTextColor;
private int unCheckedTextColor;
public SecondCategoryAdapter(Context context, @Nullable List<OrderCategoryBean.FoodCategoryTrees> data) {
super(R.layout.item_purchase_second_category, data);
checkedBg = R.drawable.shape_theme_twelve_corners_bg;
unCheckedBg = R.drawable.shape_white_twelve_corners_bg;
checkedTextColor = ContextCompat.getColor(context, R.color.white);
unCheckedTextColor = ContextCompat.getColor(context, R.color.color_3c);
}
@Override
protected void convert(@NotNull BaseViewHolder viewHolder, OrderCategoryBean.FoodCategoryTrees categoryBean) {
viewHolder.setText(R.id.tv_second_category_title, categoryBean.getName());
TextView tvName = viewHolder.getView(R.id.tv_second_category_title);
CardView cardView = viewHolder.getView(R.id.card_purchase_category);
viewHolder.setVisible(R.id.tv_second_category_title, TextUtil.isNotEmptyOrNullOrUndefined(categoryBean.getName()));
if (viewHolder.getAdapterPosition() == selectIndex) {
cardView.setBackground(ContextCompat.getDrawable(getContext(), checkedBg));
tvName.setTextColor(checkedTextColor);
} else {
cardView.setBackground(ContextCompat.getDrawable(getContext(), unCheckedBg));
tvName.setTextColor(unCheckedTextColor);
}
}
public SecondCategoryAdapter setCheckedBg(int checkedBg) {
this.checkedBg = checkedBg;
return this;
}
public SecondCategoryAdapter setUnCheckedBg(int unCheckedBg) {
this.unCheckedBg = unCheckedBg;
return this;
}
public SecondCategoryAdapter setSelectIndex(int selectIndex) {
int lastIndex = this.selectIndex;
this.selectIndex = selectIndex;
if (lastIndex >= 0 && lastIndex < getItemCount()) {
notifyItemChanged(lastIndex);
}
if (this.selectIndex >= 0 && this.selectIndex < getItemCount()) {
notifyItemChanged(this.selectIndex);
}
return this;
}
public SecondCategoryAdapter setCheckedTextColor(int checkedTextColor) {
this.checkedTextColor = checkedTextColor;
return this;
}
public SecondCategoryAdapter setUnCheckedTextColor(int unCheckedTextColor) {
this.unCheckedTextColor = unCheckedTextColor;
return this;
}
public int getSelectIndex() {
return selectIndex;
}
}
...@@ -32,25 +32,14 @@ public class WareHousingDetailsAdapter extends BaseQuickAdapter<WarehouseDetails ...@@ -32,25 +32,14 @@ public class WareHousingDetailsAdapter extends BaseQuickAdapter<WarehouseDetails
* 入庫顯示+,出庫顯示- * 入庫顯示+,出庫顯示-
*/ */
private int type; private int type;
/**
* 已消耗的背景色
*/
private Drawable allConsumeBg;
/**
* 已過期的背景
*/
private Drawable expiredBg;
/**
* 即將過期背景
*/
private Drawable willExpireSoonBg;
public WareHousingDetailsAdapter(Context context, @Nullable List<WarehouseDetailsBean> data, int type) { //已消耗的背景色 shape_oval_48
//已過期的背景 shape_oval_red_wine
//即將過期背景 shape_oval_bright_orange
public WareHousingDetailsAdapter(@Nullable List<WarehouseDetailsBean> data, int type) {
super(R.layout.item_warehouse_details, data); super(R.layout.item_warehouse_details, data);
this.type = type; this.type = type;
allConsumeBg = ContextCompat.getDrawable(context, R.drawable.shape_oval_48);
expiredBg = ContextCompat.getDrawable(context, R.drawable.shape_oval_red_wine);
willExpireSoonBg = ContextCompat.getDrawable(context, R.drawable.shape_oval_bright_orange);
} }
@Override @Override
...@@ -98,29 +87,43 @@ public class WareHousingDetailsAdapter extends BaseQuickAdapter<WarehouseDetails ...@@ -98,29 +87,43 @@ public class WareHousingDetailsAdapter extends BaseQuickAdapter<WarehouseDetails
viewHolder.setText(R.id.tv_warehouse_details_reason, purchaseWarehousingOrderDetailsContentsBean.getPurchase()); viewHolder.setText(R.id.tv_warehouse_details_reason, purchaseWarehousingOrderDetailsContentsBean.getPurchase());
//設置狀態 //設置狀態
TextView tvState = viewHolder.getView(R.id.tv_warehouse_state); TextView tvState = viewHolder.getView(R.id.tv_warehouse_state);
tvState.setVisibility(View.VISIBLE); TextView tvExpiresTime = viewHolder.getView(R.id.tv_warehouse_expires_time);
if (purchaseWarehousingOrderDetailsContentsBean.getConsumeStatus() == WarehouseDetailsBean.WAREHOUSE_STATE_ALL_CONSUMED) { if (purchaseWarehousingOrderDetailsContentsBean.getConsumeStatus() == WarehouseDetailsBean.WAREHOUSE_STATE_ALL_CONSUMED) {
//全部消耗了 //全部消耗了
tvState.setBackground(allConsumeBg);
tvState.setText("庫存已使用"); tvState.setText("庫存已使用");
tvState.setTextColor(ContextCompat.getColor(getContext(), R.color.required_color));
tvState.setVisibility(View.VISIBLE);
//全部消耗的就不顯示過期時間
tvExpiresTime.setVisibility(View.GONE);
} else {
//部分消耗
if(purchaseWarehousingOrderDetailsContentsBean.getConsumeStatus() == WarehouseDetailsBean.WAREHOUSE_STATE_PART_CONSUMED){
tvState.setText("部分使用");
tvState.setTextColor(ContextCompat.getColor(getContext(), R.color.bright_orange));
tvState.setVisibility(View.VISIBLE);
} else { } else {
//未消耗或消耗部分的 tvState.setVisibility(View.INVISIBLE);
}
if (purchaseWarehousingOrderDetailsContentsBean.getDistanceExpiresTime() >= 0) { if (purchaseWarehousingOrderDetailsContentsBean.getDistanceExpiresTime() >= 0) {
//即將過期天數大於等於0 //即將過期天數大於等於0
if (purchaseWarehousingOrderDetailsContentsBean.getWarningDays() > purchaseWarehousingOrderDetailsContentsBean.getDistanceExpiresTime()) { if (purchaseWarehousingOrderDetailsContentsBean.getWarningDays() > purchaseWarehousingOrderDetailsContentsBean.getDistanceExpiresTime()) {
//在預警天數內 //在預警天數內
//顯示即將過期 //顯示即將過期
tvState.setBackground(willExpireSoonBg); setExpiresTime(tvExpiresTime, R.drawable.shape_oval_bright_orange, "即将過期:", purchaseWarehousingOrderDetailsContentsBean.getDistanceExpiresTime());
tvState.setText("即将過期:" + purchaseWarehousingOrderDetailsContentsBean.getDistanceExpiresTime() + "日");
} else { } else {
tvState.setVisibility(View.GONE); tvExpiresTime.setVisibility(View.GONE);
} }
} else { } else {
//天數為負,則是已過期 //天數為負,則是已過期
tvState.setBackground(expiredBg); setExpiresTime(tvExpiresTime, R.drawable.shape_oval_red_wine, "已過期:", Math.abs(purchaseWarehousingOrderDetailsContentsBean.getDistanceExpiresTime()));
tvState.setText("已過期:" + Math.abs(purchaseWarehousingOrderDetailsContentsBean.getDistanceExpiresTime()) + "日"); }
} }
} }
private void setExpiresTime(TextView tvExpiresTime, int p, String s, int distanceExpiresTime) {
tvExpiresTime.setBackground(ContextCompat.getDrawable(getContext(), p));
tvExpiresTime.setText(s + distanceExpiresTime + "日");
tvExpiresTime.setVisibility(View.VISIBLE);
} }
public void setType(int type) { public void setType(int type) {
......
...@@ -35,22 +35,15 @@ public class WarehousingQueryAdapter extends BaseQuickAdapter<WareHouseListBean. ...@@ -35,22 +35,15 @@ public class WarehousingQueryAdapter extends BaseQuickAdapter<WareHouseListBean.
protected void convert(@NotNull BaseViewHolder viewHolder, WareHouseListBean.WareHousingDataBean.PurchaseWarehousingOrderDetailsVOSBean item) { protected void convert(@NotNull BaseViewHolder viewHolder, WareHouseListBean.WareHousingDataBean.PurchaseWarehousingOrderDetailsVOSBean item) {
viewHolder.setText(R.id.tv_warehouse_item_ingredients_name, item.getName()); viewHolder.setText(R.id.tv_warehouse_item_ingredients_name, item.getName());
viewHolder.setText(R.id.tv_warehouse_item_ingredients_species, item.getFoodCategoryName()); viewHolder.setText(R.id.tv_warehouse_item_ingredients_species, item.getFoodCategoryName());
// viewHolder.setText(R.id.tv_warehouse_item_supplier, item.getSupplierName());
viewHolder.setText(R.id.tv_warehouse_item_unit, item.getUnitName()); viewHolder.setText(R.id.tv_warehouse_item_unit, item.getUnitName());
viewHolder.setText(R.id.tv_warehouse_item_unit_price, item.getFoodPrice() + ""); viewHolder.setText(R.id.tv_warehouse_item_unit_price, item.getFoodPrice() + "");
viewHolder.setText(R.id.tv_warehouse_item_inventory_quantity, item.getFoodNum() + ""); viewHolder.setText(R.id.tv_warehouse_item_inventory_quantity, item.getFoodNum() + "");
viewHolder.setText(R.id.tv_warehouse_item_total_amount, item.getFoodAmount() + ""); viewHolder.setText(R.id.tv_warehouse_item_total_amount, item.getFoodAmount() + "");
// if (viewHolder.getAdapterPosition() == 0) {
// int textColorRes = getColor(R.color.white);
// setTextColor(viewHolder, textColorRes);
// int bgColorRes = getColor(R.color.theme_color);
// setBgColor(viewHolder, bgColorRes);
// } else {
int textColorRes = getColor(R.color.color_3c); int textColorRes = getColor(R.color.color_3c);
setTextColor(viewHolder, textColorRes); setTextColor(viewHolder, textColorRes);
int colorRes = getColor(colors[viewHolder.getAdapterPosition() % 2]); int colorRes = getColor(colors[viewHolder.getAdapterPosition() % 2]);
setBgColor(viewHolder, colorRes); viewHolder.setBackgroundColor(R.id.layout_warehousing, colorRes);
// } // setBgColor(viewHolder, colorRes);
} }
private void setBgColor(@NotNull BaseViewHolder viewHolder, int bgColorRes) { private void setBgColor(@NotNull BaseViewHolder viewHolder, int bgColorRes) {
......
...@@ -23,6 +23,7 @@ import com.gingersoft.supply_chain.mvp.presenter.FunctionListPresenter; ...@@ -23,6 +23,7 @@ import com.gingersoft.supply_chain.mvp.presenter.FunctionListPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.FunctionChildAdapter; import com.gingersoft.supply_chain.mvp.ui.adapter.FunctionChildAdapter;
import com.gingersoft.supply_chain.mvp.ui.adapter.PurchaseFunctionAdapter; import com.gingersoft.supply_chain.mvp.ui.adapter.PurchaseFunctionAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.category.CategoryFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.category.CategoryFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.BuyIngredientsFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.inventory.StorageListFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.inventory.StorageListFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.order.OrderDetailsFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.order.OrderDetailsFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.order.PurchaseListFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.order.PurchaseListFragment;
...@@ -112,7 +113,8 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr ...@@ -112,7 +113,8 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr
start(SupplierListFragment.newInstance(false, null)); start(SupplierListFragment.newInstance(false, null));
break; break;
case "食材": case "食材":
start(FoodIngredientsFragment.newInstance(FOOD_INGREDIENTS)); // start(FoodIngredientsFragment.newInstance(FOOD_INGREDIENTS));
start(BuyIngredientsFragment.newInstance());
break; break;
case "種類": case "種類":
start(CategoryFragment.newInstance()); start(CategoryFragment.newInstance());
......
...@@ -25,10 +25,9 @@ import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean; ...@@ -25,10 +25,9 @@ import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean;
import com.gingersoft.supply_chain.mvp.content.Constant; import com.gingersoft.supply_chain.mvp.content.Constant;
import com.gingersoft.supply_chain.mvp.contract.CategoryContract; import com.gingersoft.supply_chain.mvp.contract.CategoryContract;
import com.gingersoft.supply_chain.mvp.presenter.CategoryPresenter; import com.gingersoft.supply_chain.mvp.presenter.CategoryPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.CategoryAdapter;
import com.gingersoft.supply_chain.mvp.ui.adapter.FoodCategoryAdapter; import com.gingersoft.supply_chain.mvp.ui.adapter.FoodCategoryAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.gingersoft.supply_chain.mvp.ui.widget.CategoryPopup; import com.gingersoft.supply_chain.mvp.ui.widget.NewAddCategoryPopup;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.lxj.xpopup.XPopup; import com.lxj.xpopup.XPopup;
import com.qmuiteam.qmui.alpha.QMUIAlphaButton; import com.qmuiteam.qmui.alpha.QMUIAlphaButton;
...@@ -149,7 +148,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -149,7 +148,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
* @param position 編輯的分類下標,編輯之後用於刷新 * @param position 編輯的分類下標,編輯之後用於刷新
*/ */
private void showEditCategoryPop(OrderCategoryBean.FoodCategoryTrees foodCategoryTrees, int position) { private void showEditCategoryPop(OrderCategoryBean.FoodCategoryTrees foodCategoryTrees, int position) {
CategoryPopup categoryPopup = new CategoryPopup(mContext, "修改", "類別名稱", "请修改當前類別名稱", foodCategoryTrees.getName(), true); NewAddCategoryPopup categoryPopup = new NewAddCategoryPopup(mContext, "修改", "類別名稱", "请修改當前類別名稱", foodCategoryTrees.getName(), true);
categoryPopup.setOnDeleteListener(v -> { categoryPopup.setOnDeleteListener(v -> {
//刪除分類 //刪除分類
AppDialog.getInstance().showWaringDialog(mContext, String.format(getString(R.string.str_delete_category_tip), foodCategoryTrees.getName()), (view, dialog) -> { AppDialog.getInstance().showWaringDialog(mContext, String.format(getString(R.string.str_delete_category_tip), foodCategoryTrees.getName()), (view, dialog) -> {
...@@ -228,7 +227,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -228,7 +227,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
*/ */
private void showAddCategory(String parentCategoryName, int parentId, int level) { private void showAddCategory(String parentCategoryName, int parentId, int level) {
if (TextUtil.isNotEmptyOrNullOrUndefined(parentCategoryName)) { if (TextUtil.isNotEmptyOrNullOrUndefined(parentCategoryName)) {
CategoryPopup categoryPopup = new CategoryPopup(mContext, parentCategoryName, "類別名稱", "请輸入類別名稱", null, false); NewAddCategoryPopup categoryPopup = new NewAddCategoryPopup(mContext, parentCategoryName, "類別名稱", "请輸入類別名稱", null, false);
new XPopup.Builder(getContext()) new XPopup.Builder(getContext())
.asCustom(categoryPopup.setListener(() -> { .asCustom(categoryPopup.setListener(() -> {
//創建分類 //創建分類
......
...@@ -49,8 +49,7 @@ import butterknife.OnClick; ...@@ -49,8 +49,7 @@ import butterknife.OnClick;
import static com.gingersoft.supply_chain.mvp.ui.fragment.food.NewFoodIngredientsFragment.EDIT_FOOD_RESULT_CODE; import static com.gingersoft.supply_chain.mvp.ui.fragment.food.NewFoodIngredientsFragment.EDIT_FOOD_RESULT_CODE;
/** /**
* ================================================ * Description: 食材管理
* Description: 食材管理,採購選食材
*/ */
public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredientsPresenter> implements FoodIngredientsContract.View, View.OnClickListener { public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredientsPresenter> implements FoodIngredientsContract.View, View.OnClickListener {
...@@ -137,7 +136,10 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi ...@@ -137,7 +136,10 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi
* 編輯食材 request_code * 編輯食材 request_code
*/ */
private final int EDIT_FOOD_REQUEST_CODE = 1050; private final int EDIT_FOOD_REQUEST_CODE = 1050;
/**
* 在回到這個頁面時,購物車食材數量可能發生了變化,需要刷新當前頁面的食材數量
*/
private boolean refreshList = false;
/** /**
* 當前顯示的是第幾級的分類 * 當前顯示的是第幾級的分類
* 現用於切換供應商再切換回來之後,顯示哪一級的分類 * 現用於切換供應商再切換回來之後,顯示哪一級的分類
...@@ -199,9 +201,10 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi ...@@ -199,9 +201,10 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi
@Override @Override
public void onSupportVisible() { public void onSupportVisible() {
super.onSupportVisible(); super.onSupportVisible();
if (foodListAdapter != null) { if (refreshList && foodListAdapter != null) {
//在回到這個頁面時,購物車食材數量可能發生了變化,需要刷新當前頁面的食材數量 //在回到這個頁面時,購物車食材數量可能發生了變化,需要刷新當前頁面的食材數量
mPresenter.refreshPageData(foodListAdapter.getData(), foodListAdapter.getIntegerMap()); mPresenter.refreshPageData(foodListAdapter.getData(), foodListAdapter.getIntegerMap());
refreshList = false;
} }
} }
...@@ -334,6 +337,7 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi ...@@ -334,6 +337,7 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi
} }
//需要先判斷是否有食品 //需要先判斷是否有食品
if (SupplyShoppingCart.getInstance().getCartFoods().size() > 0) { if (SupplyShoppingCart.getInstance().getCartFoods().size() > 0) {
refreshList = true;
start(ShoppingCatFragment.newInstance()); start(ShoppingCatFragment.newInstance());
} else { } else {
showMessage("請選擇食品"); showMessage("請選擇食品");
...@@ -354,7 +358,7 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi ...@@ -354,7 +358,7 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi
supplierId = categoryBeans.get(0).getId(); supplierId = categoryBeans.get(0).getId();
} }
if (listSelectAdapter == null) { if (listSelectAdapter == null) {
listSelectAdapter = new BaseCategoryAdapter(categoryBeans, mContext); listSelectAdapter = new BaseCategoryAdapter(categoryBeans);
listSelectAdapter.setUnSelectColor(ContextCompat.getColor(mContext, R.color.color_3c)) listSelectAdapter.setUnSelectColor(ContextCompat.getColor(mContext, R.color.color_3c))
.setSelectColor(ContextCompat.getColor(mContext, R.color.theme_color)); .setSelectColor(ContextCompat.getColor(mContext, R.color.theme_color));
listSelectAdapter.setOnItemClickListener((adapter, view, position) -> { listSelectAdapter.setOnItemClickListener((adapter, view, position) -> {
......
package com.gingersoft.supply_chain.mvp.ui.fragment.order; package com.gingersoft.supply_chain.mvp.ui.fragment.order;
import android.app.Dialog;
import android.os.Bundle; import android.os.Bundle;
import android.text.InputFilter;
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 android.widget.EditText;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
...@@ -17,7 +14,6 @@ import androidx.viewpager2.widget.ViewPager2; ...@@ -17,7 +14,6 @@ import androidx.viewpager2.widget.ViewPager2;
import com.gingersoft.gsa.cloud.common.loadsir.EmptyCallback; import com.gingersoft.gsa.cloud.common.loadsir.EmptyCallback;
import com.gingersoft.gsa.cloud.common.loadsir.ErrorCallback; import com.gingersoft.gsa.cloud.common.loadsir.ErrorCallback;
import com.gingersoft.gsa.cloud.common.utils.inputFilter.InputFilterUtils;
import com.gingersoft.gsa.cloud.ui.utils.AppDialog; import com.gingersoft.gsa.cloud.ui.utils.AppDialog;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2; import com.gingersoft.supply_chain.R2;
...@@ -37,13 +33,10 @@ import com.gingersoft.supply_chain.mvp.ui.widget.ScreenView; ...@@ -37,13 +33,10 @@ import com.gingersoft.supply_chain.mvp.ui.widget.ScreenView;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.kingja.loadsir.callback.Callback; import com.kingja.loadsir.callback.Callback;
import com.kingja.loadsir.callback.SuccessCallback; import com.kingja.loadsir.callback.SuccessCallback;
import com.kingja.loadsir.core.LoadService;
import com.kingja.loadsir.core.LoadSir; import com.kingja.loadsir.core.LoadSir;
import com.lxj.xpopup.XPopup; import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.enums.PopupPosition; import com.lxj.xpopup.enums.PopupPosition;
import com.lxj.xpopup.interfaces.OnSelectListener;
import com.qmuiteam.qmui.alpha.QMUIAlphaButton; import com.qmuiteam.qmui.alpha.QMUIAlphaButton;
import com.qmuiteam.qmui.util.QMUIDisplayHelper;
import com.qmuiteam.qmui.widget.QMUITopBar; import com.qmuiteam.qmui.widget.QMUITopBar;
import com.qmuiteam.qmui.widget.tab.QMUIBasicTabSegment; import com.qmuiteam.qmui.widget.tab.QMUIBasicTabSegment;
import com.qmuiteam.qmui.widget.tab.QMUITabBuilder; import com.qmuiteam.qmui.widget.tab.QMUITabBuilder;
...@@ -51,9 +44,6 @@ import com.qmuiteam.qmui.widget.tab.QMUITabIndicator; ...@@ -51,9 +44,6 @@ import com.qmuiteam.qmui.widget.tab.QMUITabIndicator;
import com.qmuiteam.qmui.widget.tab.QMUITabSegment; import com.qmuiteam.qmui.widget.tab.QMUITabSegment;
import com.qmuiteam.qmui.widget.tab.QMUITabSegment2; import com.qmuiteam.qmui.widget.tab.QMUITabSegment2;
import com.scwang.smartrefresh.layout.SmartRefreshLayout; import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
...@@ -125,10 +115,6 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr ...@@ -125,10 +115,6 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
refreshPurchaseList.setPrimaryColorsId(R.color.trans, R.color.black); refreshPurchaseList.setPrimaryColorsId(R.color.trans, R.color.black);
btnNewOrder.setText("+新增訂單"); btnNewOrder.setText("+新增訂單");
// edSearch.setFilters(new InputFilter[]{InputFilterUtils.getChAndEnAndNumInputFilter(mContext), InputFilterUtils.getLengthFilter(mContext, 20)}); // edSearch.setFilters(new InputFilter[]{InputFilterUtils.getChAndEnAndNumInputFilter(mContext), InputFilterUtils.getLengthFilter(mContext, 20)});
btnNewOrder.setOnClickListener(v -> {
//跳轉到下單頁面
startForResult(FoodIngredientsFragment.newInstance(ADD_ORDER), REQUEST_ORDER_DETAILS_CODE);
});
loadService = LoadSir.getDefault().register(loadBg, (Callback.OnReloadListener) v -> getOrderList()); loadService = LoadSir.getDefault().register(loadBg, (Callback.OnReloadListener) v -> getOrderList());
refreshPurchaseList.setOnRefreshListener(refreshLayout -> { refreshPurchaseList.setOnRefreshListener(refreshLayout -> {
pageIndex = 0; pageIndex = 0;
...@@ -172,7 +158,6 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr ...@@ -172,7 +158,6 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
start(ShoppingCatFragment.newInstance()); start(ShoppingCatFragment.newInstance());
} else { } else {
//跳轉到下單頁面 //跳轉到下單頁面
showMessage("請先選擇食品");
startForResult(FoodIngredientsFragment.newInstance(ADD_ORDER), REQUEST_ORDER_DETAILS_CODE); startForResult(FoodIngredientsFragment.newInstance(ADD_ORDER), REQUEST_ORDER_DETAILS_CODE);
} }
}); });
...@@ -258,7 +243,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr ...@@ -258,7 +243,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
start(SendMsgFragment.newInstance(Collections.singletonList(purchaseOrder))); start(SendMsgFragment.newInstance(Collections.singletonList(purchaseOrder)));
} }
@OnClick({R2.id.iv_purchase_list_screen, R2.id.iv_purchase_list_search}) @OnClick({R2.id.iv_purchase_list_screen, R2.id.iv_purchase_list_search, R2.id.btn_save})
@Override @Override
public void onClick(View v) { public void onClick(View v) {
int viewId = v.getId(); int viewId = v.getId();
...@@ -267,6 +252,9 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr ...@@ -267,6 +252,9 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
screenView.setVisibility(screenView.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE); screenView.setVisibility(screenView.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE);
} else if (viewId == R.id.iv_purchase_list_search) { } else if (viewId == R.id.iv_purchase_list_search) {
getOrderList(); getOrderList();
} else if(viewId == R.id.btn_save){
//跳轉到下單頁面
startForResult(FoodIngredientsFragment.newInstance(ADD_ORDER), REQUEST_ORDER_DETAILS_CODE);
} }
} }
......
...@@ -7,9 +7,11 @@ import android.view.ViewGroup; ...@@ -7,9 +7,11 @@ import android.view.ViewGroup;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.gsa.cloud.common.utils.ClipboardUtils; import com.gingersoft.gsa.cloud.common.utils.ClipboardUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils; import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2; import com.gingersoft.supply_chain.R2;
...@@ -20,8 +22,11 @@ import com.gingersoft.supply_chain.mvp.contract.SendMsgContract; ...@@ -20,8 +22,11 @@ import com.gingersoft.supply_chain.mvp.contract.SendMsgContract;
import com.gingersoft.supply_chain.mvp.presenter.SendMsgPresenter; import com.gingersoft.supply_chain.mvp.presenter.SendMsgPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.SendSupplierMsgAdapter; import com.gingersoft.supply_chain.mvp.ui.adapter.SendSupplierMsgAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodIngredientsFragment;
import com.gingersoft.supply_chain.mvp.ui.widget.TextPopup;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.DeviceUtils; import com.jess.arms.utils.DeviceUtils;
import com.lxj.xpopup.XPopup;
import com.qmuiteam.qmui.alpha.QMUIAlphaButton; import com.qmuiteam.qmui.alpha.QMUIAlphaButton;
import com.qmuiteam.qmui.widget.QMUITopBar; import com.qmuiteam.qmui.widget.QMUITopBar;
...@@ -30,6 +35,7 @@ import java.util.List; ...@@ -30,6 +35,7 @@ import java.util.List;
import butterknife.BindView; import butterknife.BindView;
import butterknife.OnClick; import butterknife.OnClick;
import me.yokeyword.fragmentation.ISupportFragment;
import static com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean.SupplierContacts.Kakao_Talk; import static com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean.SupplierContacts.Kakao_Talk;
import static com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean.SupplierContacts.Line; import static com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean.SupplierContacts.Line;
...@@ -82,6 +88,7 @@ public class SendMsgFragment extends BaseSupplyChainFragment<SendMsgPresenter> i ...@@ -82,6 +88,7 @@ public class SendMsgFragment extends BaseSupplyChainFragment<SendMsgPresenter> i
@Override @Override
public void initData(@Nullable Bundle savedInstanceState) { public void initData(@Nullable Bundle savedInstanceState) {
initTopBar(supplyTopBar, "發送"); initTopBar(supplyTopBar, "發送");
supplyTopBar.addRightTextButton(R.string.str_preview, R.id.qmui_preview).setOnClickListener(this::onClick);
Bundle arguments = getArguments(); Bundle arguments = getArguments();
if (arguments != null) { if (arguments != null) {
purchaseOrders = (List<ConfirmOrderBean.PurchaseOrder>) arguments.getSerializable(KEY_PURCHASE_ORDER_INFO); purchaseOrders = (List<ConfirmOrderBean.PurchaseOrder>) arguments.getSerializable(KEY_PURCHASE_ORDER_INFO);
...@@ -99,7 +106,18 @@ public class SendMsgFragment extends BaseSupplyChainFragment<SendMsgPresenter> i ...@@ -99,7 +106,18 @@ public class SendMsgFragment extends BaseSupplyChainFragment<SendMsgPresenter> i
//發送 //發送
mPresenter.sendMsg(); mPresenter.sendMsg();
} else if (viewId == R.id.btn_supplier_cancel) { } else if (viewId == R.id.btn_supplier_cancel) {
popTo(PurchaseListFragment.class, true); // popTo(PurchaseListFragment.class, true);
killMyself();
} else if (viewId == R.id.qmui_preview) {
//預覽
String sendUrl = mPresenter.getSendUrl();
if (TextUtil.isNotEmptyOrNullOrUndefined(sendUrl)) {
new XPopup.Builder(requireContext())
.asCustom(new TextPopup(requireContext(), "發送鏈接預覽", mPresenter.getSendUrl()))
.show();
} else {
showMessage("未獲取到採購單信息,請退出重試");
}
} }
} }
...@@ -143,6 +161,16 @@ public class SendMsgFragment extends BaseSupplyChainFragment<SendMsgPresenter> i ...@@ -143,6 +161,16 @@ public class SendMsgFragment extends BaseSupplyChainFragment<SendMsgPresenter> i
mPresenter.setSendSuccess(); mPresenter.setSendSuccess();
} }
@Override
public void backToOrderList() {
startWithPopTo(PurchaseListFragment.newInstance(), PurchaseListFragment.class, true);
}
@Override
public void killMyself() {
backToOrderList();
}
private boolean isSend = false; private boolean isSend = false;
@Override @Override
...@@ -153,4 +181,10 @@ public class SendMsgFragment extends BaseSupplyChainFragment<SendMsgPresenter> i ...@@ -153,4 +181,10 @@ public class SendMsgFragment extends BaseSupplyChainFragment<SendMsgPresenter> i
mPresenter.getContactsBySupplier(mPresenter.getCurrentSelectedSupplier() + 1); mPresenter.getContactsBySupplier(mPresenter.getCurrentSelectedSupplier() + 1);
} }
} }
@Override
public boolean onBackPressedSupport() {
backToOrderList();
return true;
}
} }
...@@ -12,9 +12,11 @@ import android.widget.TextView; ...@@ -12,9 +12,11 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil; import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.common.utils.log.LogUtil;
import com.gingersoft.gsa.cloud.ui.utils.AppDialog; import com.gingersoft.gsa.cloud.ui.utils.AppDialog;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2; import com.gingersoft.supply_chain.R2;
...@@ -34,6 +36,7 @@ import java.util.List; ...@@ -34,6 +36,7 @@ import java.util.List;
import butterknife.BindView; import butterknife.BindView;
import butterknife.OnClick; import butterknife.OnClick;
import me.yokeyword.fragmentation.ISupportFragment;
import static com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodIngredientsFragment.ADD_ORDER; import static com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodIngredientsFragment.ADD_ORDER;
...@@ -77,8 +80,7 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres ...@@ -77,8 +80,7 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres
public static ShoppingCatFragment newInstance() { public static ShoppingCatFragment newInstance() {
ShoppingCatFragment fragment = new ShoppingCatFragment(); return new ShoppingCatFragment();
return fragment;
} }
@Override @Override
...@@ -192,10 +194,6 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres ...@@ -192,10 +194,6 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres
@Override @Override
public void addOrderSuccess(List<ConfirmOrderBean.PurchaseOrder> purchaseOrders) { public void addOrderSuccess(List<ConfirmOrderBean.PurchaseOrder> purchaseOrders) {
ShoppingCatFragment childFragment = findChildFragment(ShoppingCatFragment.class);
if (childFragment != null) {
childFragment.killMyself();
}
startWithPop(SendMsgFragment.newInstance(purchaseOrders)); startWithPop(SendMsgFragment.newInstance(purchaseOrders));
} }
......
...@@ -6,7 +6,6 @@ import android.view.LayoutInflater; ...@@ -6,7 +6,6 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.EditText; import android.widget.EditText;
import android.widget.HorizontalScrollView;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
...@@ -15,9 +14,6 @@ import androidx.annotation.Nullable; ...@@ -15,9 +14,6 @@ import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemChildClickListener;
import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.gingersoft.gsa.cloud.common.loadsir.EmptyCallback; import com.gingersoft.gsa.cloud.common.loadsir.EmptyCallback;
import com.gingersoft.gsa.cloud.common.loadsir.ErrorCallback; import com.gingersoft.gsa.cloud.common.loadsir.ErrorCallback;
import com.gingersoft.gsa.cloud.common.utils.inputFilter.InputFilterUtils; import com.gingersoft.gsa.cloud.common.utils.inputFilter.InputFilterUtils;
...@@ -30,14 +26,9 @@ import com.gingersoft.supply_chain.mvp.presenter.WareHouseListPresenter; ...@@ -30,14 +26,9 @@ import com.gingersoft.supply_chain.mvp.presenter.WareHouseListPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.WarehousingQueryAdapter; import com.gingersoft.supply_chain.mvp.ui.adapter.WarehousingQueryAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.kingja.loadsir.callback.Callback;
import com.kingja.loadsir.callback.SuccessCallback;
import com.kingja.loadsir.core.LoadSir; import com.kingja.loadsir.core.LoadSir;
import com.qmuiteam.qmui.widget.QMUITopBar; import com.qmuiteam.qmui.widget.QMUITopBar;
import com.scwang.smartrefresh.layout.SmartRefreshLayout; import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
import java.util.List; import java.util.List;
...@@ -68,8 +59,8 @@ public class WareHouseListFragment extends BaseSupplyChainFragment<WareHouseList ...@@ -68,8 +59,8 @@ public class WareHouseListFragment extends BaseSupplyChainFragment<WareHouseList
RecyclerView rvWarehouseList; RecyclerView rvWarehouseList;
@BindView(R2.id.sl_warehousing_list) @BindView(R2.id.sl_warehousing_list)
SmartRefreshLayout smartRefreshLayout; SmartRefreshLayout smartRefreshLayout;
@BindView(R2.id.hs_warehousing_list) // @BindView(R2.id.hs_warehousing_list)
HorizontalScrollView hsWarehousingList; // HorizontalScrollView hsWarehousingList;
@BindView(R2.id.tv_warehouse_item_unit_price) @BindView(R2.id.tv_warehouse_item_unit_price)
TextView tvUnitPrice; TextView tvUnitPrice;
@BindView(R2.id.tv_warehouse_item_inventory_quantity) @BindView(R2.id.tv_warehouse_item_inventory_quantity)
...@@ -189,7 +180,7 @@ public class WareHouseListFragment extends BaseSupplyChainFragment<WareHouseList ...@@ -189,7 +180,7 @@ public class WareHouseListFragment extends BaseSupplyChainFragment<WareHouseList
} }
if (warehousingQueryAdapter == null) { if (warehousingQueryAdapter == null) {
warehousingQueryAdapter = new WarehousingQueryAdapter(mContext, purchaseWarehousingOrderDetailsVos); warehousingQueryAdapter = new WarehousingQueryAdapter(mContext, purchaseWarehousingOrderDetailsVos);
rvWarehouseList.setLayoutManager(new LinearLayoutManager(mContext)); rvWarehouseList.setLayoutManager(new LinearLayoutManager(requireContext()));
rvWarehouseList.setAdapter(warehousingQueryAdapter); rvWarehouseList.setAdapter(warehousingQueryAdapter);
warehousingQueryAdapter.setOnItemChildClickListener((adapter, view, position) -> { warehousingQueryAdapter.setOnItemChildClickListener((adapter, view, position) -> {
......
...@@ -236,7 +236,7 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD ...@@ -236,7 +236,7 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
} else { } else {
loadService.showSuccess(); loadService.showSuccess();
if (wareHousingDetailsAdapter == null) { if (wareHousingDetailsAdapter == null) {
wareHousingDetailsAdapter = new WareHousingDetailsAdapter(requireContext(), warehouseDetailsBeans, vpWarehouseViewpager.getCurrentItem()); wareHousingDetailsAdapter = new WareHousingDetailsAdapter(warehouseDetailsBeans, vpWarehouseViewpager.getCurrentItem());
if (adapter == null) { if (adapter == null) {
adapter = new PurchasePageAdapter(wareHousingDetailsAdapter, 2); adapter = new PurchasePageAdapter(wareHousingDetailsAdapter, 2);
vpWarehouseViewpager.setAdapter(adapter); vpWarehouseViewpager.setAdapter(adapter);
......
...@@ -21,9 +21,11 @@ import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; ...@@ -21,9 +21,11 @@ import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2; import com.gingersoft.supply_chain.R2;
import com.gingersoft.supply_chain.di.component.DaggerWarehousingInventoryComponent; import com.gingersoft.supply_chain.di.component.DaggerWarehousingInventoryComponent;
import com.gingersoft.supply_chain.mvp.bean.InventoryRecordBean;
import com.gingersoft.supply_chain.mvp.bean.WareHouseListBean; import com.gingersoft.supply_chain.mvp.bean.WareHouseListBean;
import com.gingersoft.supply_chain.mvp.contract.WarehousingInventoryContract; import com.gingersoft.supply_chain.mvp.contract.WarehousingInventoryContract;
import com.gingersoft.supply_chain.mvp.presenter.WarehousingInventoryPresenter; import com.gingersoft.supply_chain.mvp.presenter.WarehousingInventoryPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.InventoryRecordAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.qmuiteam.qmui.util.QMUIDisplayHelper; import com.qmuiteam.qmui.util.QMUIDisplayHelper;
...@@ -32,6 +34,8 @@ import com.zhy.autolayout.utils.ScreenUtils; ...@@ -32,6 +34,8 @@ import com.zhy.autolayout.utils.ScreenUtils;
import org.w3c.dom.Text; import org.w3c.dom.Text;
import java.util.List;
import butterknife.BindView; import butterknife.BindView;
...@@ -52,6 +56,7 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho ...@@ -52,6 +56,7 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho
EditText edWarehouseLoss; EditText edWarehouseLoss;
@BindView(R2.id.rv_warehouse_inventory_record) @BindView(R2.id.rv_warehouse_inventory_record)
RecyclerView rvRecord; RecyclerView rvRecord;
private InventoryRecordAdapter adapter;
/** /**
* 食品總庫存 * 食品總庫存
*/ */
...@@ -200,7 +205,13 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho ...@@ -200,7 +205,13 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho
} }
@Override @Override
public void loadRecord() { public void loadRecord(List<InventoryRecordBean> inventoryRecordBeans) {
//加載盤點記錄
if (adapter == null) {
adapter = new InventoryRecordAdapter(inventoryRecordBeans);
rvRecord.setAdapter(adapter);
} else {
adapter.setList(inventoryRecordBeans);
}
} }
} }
...@@ -28,7 +28,6 @@ public class EditTextPopup extends InputConfirmPopupView { ...@@ -28,7 +28,6 @@ public class EditTextPopup extends InputConfirmPopupView {
@Override @Override
protected void onCreate() { protected void onCreate() {
super.onCreate(); super.onCreate();
getEditText().setFilters(inputFilters); getEditText().setFilters(inputFilters);
} }
} }
...@@ -4,16 +4,12 @@ import android.content.Context; ...@@ -4,16 +4,12 @@ import android.content.Context;
import android.text.InputFilter; import android.text.InputFilter;
import android.view.View; import android.view.View;
import android.widget.EditText; import android.widget.EditText;
import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.gingersoft.gsa.cloud.common.utils.inputFilter.InputFilterUtils; import com.gingersoft.gsa.cloud.common.utils.inputFilter.InputFilterUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.ui.utils.AppDialog;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
import com.lxj.xpopup.impl.ConfirmPopupView; import com.lxj.xpopup.impl.ConfirmPopupView;
import com.lxj.xpopup.impl.InputConfirmPopupView;
import com.qmuiteam.qmui.alpha.QMUIAlphaTextView; import com.qmuiteam.qmui.alpha.QMUIAlphaTextView;
/** /**
...@@ -23,14 +19,14 @@ import com.qmuiteam.qmui.alpha.QMUIAlphaTextView; ...@@ -23,14 +19,14 @@ import com.qmuiteam.qmui.alpha.QMUIAlphaTextView;
* Time: 9:45 * Time: 9:45
* Use: 新增分類的彈窗 * Use: 新增分類的彈窗
*/ */
public class CategoryPopup extends ConfirmPopupView { public class NewAddCategoryPopup extends ConfirmPopupView {
private boolean showDelete; private boolean showDelete;
private EditText et_input; private EditText et_input;
private OnClickListener onDeleteListener; private OnClickListener onDeleteListener;
private String inputText; private String inputText;
private final int nameMaxLength = 100; private final int nameMaxLength = 100;
public CategoryPopup(@NonNull Context context, CharSequence title, CharSequence content, CharSequence hint, String inputText, boolean showDelete) { public NewAddCategoryPopup(@NonNull Context context, CharSequence title, CharSequence content, CharSequence hint, String inputText, boolean showDelete) {
super(context, R.layout.dialog_new_category); super(context, R.layout.dialog_new_category);
setTitleContent(title, content, hint); setTitleContent(title, content, hint);
this.showDelete = showDelete; this.showDelete = showDelete;
...@@ -60,7 +56,7 @@ public class CategoryPopup extends ConfirmPopupView { ...@@ -60,7 +56,7 @@ public class CategoryPopup extends ConfirmPopupView {
return et_input; return et_input;
} }
public CategoryPopup setOnDeleteListener(OnClickListener onDeleteListener) { public NewAddCategoryPopup setOnDeleteListener(OnClickListener onDeleteListener) {
this.onDeleteListener = onDeleteListener; this.onDeleteListener = onDeleteListener;
return this; return this;
} }
......
package com.gingersoft.supply_chain.mvp.ui.widget;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean;
import com.gingersoft.supply_chain.mvp.ui.adapter.SecondCategoryAdapter;
import com.google.android.flexbox.FlexWrap;
import com.google.android.flexbox.FlexboxLayoutManager;
import com.lxj.xpopup.core.AttachPopupView;
import java.util.List;
import lombok.val;
/**
* @author 宇航.
* User: admin
* Date: 2021/3/11
* Time: 11:37
* Use:
*/
public class ShowSecondCategoryPopup extends AttachPopupView {
private final int width;
private final List<OrderCategoryBean.FoodCategoryTrees> foodCategoryTreesList;
private final OnItemClickListener onItemClickListener;
private final int defaultSelect;
/**
* 當前是否是顯示三級分類
*/
private boolean showThirdCategory = false;
public ShowSecondCategoryPopup(@NonNull Context context, int width, int defaultSelect, List<OrderCategoryBean.FoodCategoryTrees> foodCategoryTreesList, OnItemClickListener onItemClickListener) {
super(context);
this.width = width;
this.defaultSelect = defaultSelect;
this.foodCategoryTreesList = foodCategoryTreesList;
this.onItemClickListener = onItemClickListener;
}
@Override
protected int getPopupLayoutId() {
return R.layout.layout_popup_category_recycler;
}
@Override
protected void onCreate() {
super.onCreate();
RecyclerView recyclerView = findViewById(R.id.rv_purchase_list_content);
FlexboxLayoutManager flexboxLayoutManager = new FlexboxLayoutManager(getContext());
flexboxLayoutManager.setFlexWrap(FlexWrap.WRAP);
recyclerView.setLayoutManager(flexboxLayoutManager);
SecondCategoryAdapter secondCategoryAdapter = new SecondCategoryAdapter(getContext(), foodCategoryTreesList);
secondCategoryAdapter.setSelectIndex(defaultSelect);
secondCategoryAdapter.setOnItemClickListener((adapter, view, position) -> {
if (!showThirdCategory) {
//三級分類就不回調
onItemClickListener.onItemClick(adapter, view, position);
val foodCategoryTrees = foodCategoryTreesList.get(position).getFoodCategoryTrees();
//有三級分類就顯示三級分類,沒有三級分類,關閉彈窗,食材列表定位到所選中的二級分類
if (foodCategoryTrees != null && foodCategoryTrees.size() > 0) {
//顯示三級分類
showThirdCategory = true;
secondCategoryAdapter.setNewInstance(foodCategoryTreesList.get(position).getFoodCategoryTrees());
} else {
//關閉彈窗,食材列表清空,第一條顯示當前分類
}
} else {
//當前是三級分類點擊,彈窗關閉,食材列表清空,第一條顯示當前分類
}
});
recyclerView.setAdapter(secondCategoryAdapter);
}
@Override
public int getMinimumWidth() {
return width;
}
@Override
protected int getMaxWidth() {
return width;
}
}
package com.gingersoft.supply_chain.mvp.ui.widget;
import android.content.Context;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.gingersoft.supply_chain.R;
import com.lxj.xpopup.core.CenterPopupView;
/**
* @author 宇航.
* User: admin
* Date: 2021/3/9
* Time: 17:39
* Use:
*/
public class TextPopup extends CenterPopupView {
private String title;
private String content;
public TextPopup(@NonNull Context context, String title, String content) {
super(context);
this.title = title;
this.content = content;
}
@Override
protected int getPopupLayoutId() {
return R.layout.popup_text;
}
@Override
protected void onCreate() {
super.onCreate();
TextView tvTitle = findViewById(R.id.tv_title);
tvTitle.setText(title);
TextView tvContent = findViewById(R.id.tv_content);
tvContent.setText(content);
}
}
package com.gingersoft.supply_chain.mvp.utils;
import android.view.View;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
/**
* @author 宇航.
* User: admin
* Date: 2021/3/11
* Time: 14:59
* Use:
*/
public class ViewUtils {
public static void moveToCenterByVertical(RecyclerView recyclerView, int sectionPosition) {
LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
if (layoutManager == null) {
return;
}
//取得中間位置的item
View childAt = recyclerView.getChildAt(sectionPosition - layoutManager.findFirstVisibleItemPosition());
//拿到列表一半的高度
int halfLeftRvHeight = recyclerView.getHeight() / 2;
if (childAt != null) {
//中間位置那個item減去一半的高度等於中間item一半顯示在列表中間
int y = (int) (childAt.getTop() - halfLeftRvHeight);
recyclerView.smoothScrollBy(0, y);
}
}
public static void moveToCenterByHorizontal(RecyclerView recyclerView, int sectionPosition) {
LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
if (layoutManager == null) {
return;
}
//取得中間位置的item
View childAt = recyclerView.getChildAt(sectionPosition - layoutManager.findFirstVisibleItemPosition());
//拿到列表一半的寬度
int halfLeftRvHeight = recyclerView.getWidth() / 2;
if (childAt != null) {
//中間位置那個item減去一半的高度等於中間item一半顯示在列表中間
int x = (int) (childAt.getLeft() - halfLeftRvHeight);
recyclerView.smoothScrollBy(x, 0);
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/shape_theme_twelve_corners_bg" android:state_checked="true" />
<item android:drawable="@drawable/shape_theme_twelve_corners_bg" android:state_selected="true" />
<item android:drawable="@drawable/shape_white_twelve_corners_bg" />
</selector>
\ No newline at end of file
...@@ -174,8 +174,8 @@ ...@@ -174,8 +174,8 @@
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_warehouse_list" android:id="@+id/rv_warehouse_list"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="wrap_content" />
</LinearLayout> </LinearLayout>
</HorizontalScrollView> </HorizontalScrollView>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/color_f0" android:background="@color/color_f0"
android:orientation="vertical"> android:orientation="vertical">
...@@ -109,11 +109,10 @@ ...@@ -109,11 +109,10 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/shape_square_edit_border_aa" android:background="@drawable/shape_square_edit_border_aa"
android:gravity="center" android:gravity="end"
android:hint="請輸入" android:hint="請輸入"
android:inputType="number" android:inputType="number"
android:paddingTop="@dimen/dp_5" android:padding="@dimen/dp_5"
android:paddingBottom="@dimen/dp_5"
android:text="0" android:text="0"
android:textColor="@color/theme_333_color" android:textColor="@color/theme_333_color"
android:textCursorDrawable="@drawable/cursor_theme" android:textCursorDrawable="@drawable/cursor_theme"
...@@ -123,50 +122,13 @@ ...@@ -123,50 +122,13 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<LinearLayout <include layout="@layout/item_inventory_record" />
android:layout_width="match_parent"
android:layout_height="@dimen/dp_38"
android:layout_marginTop="@dimen/dp_10"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:background="@color/theme_color"
android:gravity="center"
android:text="用戶名"
android:textColor="@color/white"
android:textSize="@dimen/dp_12" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_1"
android:layout_weight="0.3"
android:background="@color/theme_color"
android:gravity="center"
android:text="盤點"
android:textColor="@color/white"
android:textSize="@dimen/dp_12" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_1"
android:layout_weight="0.55"
android:background="@color/theme_color"
android:gravity="center"
android:text="操作日期"
android:textColor="@color/white"
android:textSize="@dimen/dp_12" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_warehouse_inventory_record" android:id="@+id/rv_warehouse_inventory_record"
android:layout_width="match_parent" android:layout_width="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" android:layout_height="match_parent"
android:layout_height="match_parent" /> app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</LinearLayout> </LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_marginBottom="@dimen/dp_1"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="horizontal"
android:paddingTop="@dimen/dp_8"
android:paddingBottom="@dimen/dp_8">
<ImageView
android:id="@+id/iv_food_ingredient_img"
android:layout_width="@dimen/dp_77"
android:layout_height="@dimen/dp_77"
android:layout_marginLeft="@dimen/dp_6" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_5"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_food_item_no"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_10"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_12"
tools:text="SP001" />
<TextView
android:id="@+id/tv_food_item_supplier_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="2"
android:gravity="right"
android:textColor="@color/black"
android:textSize="@dimen/dp_13"
android:textStyle="bold"
tools:text="海鮮天地" />
</LinearLayout>
<TextView
android:id="@+id/tv_food_item_name"
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
tools:text="巴西肥牛" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_food_item_unit"
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="@dimen/dp_12"
tools:text="3KG/盒" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="15/30"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_12"
android:textStyle="bold"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_food_item_price"
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/required_color"
android:textStyle="bold"
tools:text="$100.00" />
<LinearLayout
android:id="@+id/layout_operation_food_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:divider="@color/color_3c"
android:gravity="center_vertical"
android:orientation="horizontal">
<com.qmuiteam.qmui.layout.QMUIButton
android:id="@+id/btn_food_operation_sub"
android:layout_width="@dimen/dp_24"
android:layout_height="@dimen/dp_24"
android:background="@drawable/ic_circle_gray_sub" />
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/ed_food_ingredient_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_4"
android:layout_marginRight="@dimen/dp_4"
android:background="@null"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="center"
android:inputType="number"
android:maxLength="4"
android:maxLines="1"
android:minWidth="@dimen/dp_30"
android:textColor="@color/black"
android:textCursorDrawable="@drawable/cursor_theme"
android:textSize="@dimen/dp_22"
tools:text="10" />
<com.qmuiteam.qmui.layout.QMUIButton
android:id="@+id/btn_food_operation_add"
android:layout_width="@dimen/dp_24"
android:layout_height="@dimen/dp_24"
android:background="@drawable/ic_circle_theme_add" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView 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="wrap_content"
android:layout_margin="@dimen/dp_2"
app:cardCornerRadius="@dimen/dp_5"
app:cardElevation="@dimen/dp_5">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical"
android:paddingLeft="@dimen/dp_4"
android:paddingTop="@dimen/dp_8"
android:paddingRight="@dimen/dp_4"
android:paddingBottom="@dimen/dp_8">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_food_ingredient_img"
android:layout_width="@dimen/dp_67"
android:layout_height="@dimen/dp_67" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_4"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:visibility="gone">
<TextView
android:id="@+id/tv_food_item_no"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_10"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_12"
tools:text="SP001" />
<TextView
android:id="@+id/tv_food_item_supplier_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:gravity="right"
android:maxLines="2"
android:textColor="@color/black"
android:textSize="@dimen/dp_13"
android:textStyle="bold"
tools:text="海鮮天地" />
</LinearLayout>
<TextView
android:id="@+id/tv_food_item_name"
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:textStyle="bold"
tools:text="巴西肥牛" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_food_item_unit"
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="@dimen/dp_12"
tools:text="3KG/盒" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="15/30"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_12"
android:textStyle="bold"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_4"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_food_item_price"
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/required_color"
android:textStyle="bold"
tools:text="$100.00" />
<!-- <LinearLayout-->
<!-- android:id="@+id/layout_operation_food_num"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:divider="@color/color_3c"-->
<!-- android:gravity="center_vertical"-->
<!-- android:orientation="horizontal">-->
<com.qmuiteam.qmui.layout.QMUIButton
android:id="@+id/btn_food_operation_sub"
android:layout_width="@dimen/dp_24"
android:layout_height="@dimen/dp_24"
android:layout_marginLeft="@dimen/dp_2"
android:background="@drawable/ic_circle_gray_sub" />
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/ed_food_ingredient_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="center"
android:inputType="number"
android:maxLength="5"
android:maxLines="1"
android:paddingLeft="@dimen/dp_4"
android:paddingRight="@dimen/dp_4"
android:textColor="@color/black"
android:textCursorDrawable="@drawable/cursor_theme"
android:textSize="@dimen/dp_20"
tools:text="10" />
<com.qmuiteam.qmui.layout.QMUIButton
android:id="@+id/btn_food_operation_add"
android:layout_width="@dimen/dp_24"
android:layout_height="@dimen/dp_24"
android:background="@drawable/ic_circle_theme_add" />
<!-- </LinearLayout>-->
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
\ No newline at end of file
<?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_buy_food_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/theme_color"
android:gravity="center"
android:paddingLeft="@dimen/dp_4"
android:paddingTop="@dimen/dp_4"
android:paddingRight="@dimen/dp_4"
android:paddingBottom="@dimen/dp_4"
android:textColor="@color/white"
android:textSize="@dimen/dp_14" />
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_inventory_record"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/theme_color"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_inventory_record_username"
style="@style/WareHouse_item_TextStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="20"
android:text="用戶名" />
<include layout="@layout/include_vertical_color_white_dividing_line" />
<TextView
android:id="@+id/tv_inventory_record_number"
style="@style/WareHouse_item_TextStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="17"
android:text="盤點" />
<include layout="@layout/include_vertical_color_white_dividing_line" />
<TextView
android:id="@+id/tv_inventory_record_difference"
style="@style/WareHouse_item_TextStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="23"
android:text="差異數" />
<include layout="@layout/include_vertical_color_white_dividing_line" />
<TextView
android:id="@+id/tv_inventory_record_operating_data"
style="@style/WareHouse_item_TextStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="39"
android:text="操作日期" />
</LinearLayout>
\ No newline at end of file
...@@ -23,9 +23,9 @@ ...@@ -23,9 +23,9 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:ellipsize="end"
android:gravity="center_vertical" android:gravity="center_vertical"
android:maxLines="1" android:maxLines="1"
android:ellipsize="end"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="@dimen/dp_17" android:textSize="@dimen/dp_17"
android:textStyle="bold" android:textStyle="bold"
...@@ -43,9 +43,9 @@ ...@@ -43,9 +43,9 @@
android:id="@+id/iv_purchase_order_more" android:id="@+id/iv_purchase_order_more"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginRight="@dimen/dp_5"
android:paddingLeft="@dimen/dp_10" android:paddingLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_5" android:paddingRight="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_5"
android:src="@drawable/ic_more" /> android:src="@drawable/ic_more" />
</LinearLayout> </LinearLayout>
...@@ -136,16 +136,29 @@ ...@@ -136,16 +136,29 @@
tools:text="$100.00" /> tools:text="$100.00" />
</LinearLayout> </LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:orientation="horizontal">
<TextView <TextView
android:id="@+id/tv_purchase_order_goods" android:id="@+id/tv_purchase_order_goods"
style="@style/Food_Ingredient_Info_TextStyle" style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5" android:layout_weight="1"
android:ellipsize="end" android:ellipsize="end"
android:singleLine="true" android:singleLine="true"
tools:text="巴西肥牛、澳洲牛排" /> tools:text="巴西肥牛、澳洲牛排" />
<ImageView
android:id="@+id/iv_viewed"
android:layout_width="@dimen/dp_24"
android:layout_height="@dimen/dp_24"
android:src="@drawable/ic_viewed" />
</LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView 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:id="@+id/card_purchase_category"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_6"
android:layout_marginTop="@dimen/dp_7"
android:layout_marginRight="@dimen/dp_2"
android:layout_marginBottom="@dimen/dp_7"
app:cardCornerRadius="@dimen/dp_12"
app:cardElevation="@dimen/dp_3">
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_second_category_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_18"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_18"
android:layout_marginBottom="@dimen/dp_5"
android:gravity="center"
android:textColor="@color/s_3c_to_white"
android:textSize="@dimen/dp_12"
tools:text="瓜果類" />
</androidx.cardview.widget.CardView>
\ No newline at end of file
...@@ -87,10 +87,10 @@ ...@@ -87,10 +87,10 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_6"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingLeft="@dimen/dp_9" android:paddingLeft="@dimen/dp_9"
android:paddingTop="@dimen/dp_9" android:paddingTop="@dimen/dp_9"
android:layout_marginBottom="@dimen/dp_6"
android:paddingRight="@dimen/dp_9"> android:paddingRight="@dimen/dp_9">
<TextView <TextView
...@@ -121,20 +121,39 @@ ...@@ -121,20 +121,39 @@
tools:text="採購入庫" /> tools:text="採購入庫" />
</LinearLayout> </LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView <TextView
android:id="@+id/tv_warehouse_state" android:id="@+id/tv_warehouse_state"
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginRight="@dimen/dp_4" android:layout_marginRight="@dimen/dp_4"
android:paddingLeft="@dimen/dp_10" android:paddingLeft="@dimen/dp_10"
android:paddingTop="@dimen/dp_4"
android:paddingRight="@dimen/dp_10" android:paddingRight="@dimen/dp_10"
android:paddingBottom="@dimen/dp_4"
android:textColor="@color/white"
android:textSize="@dimen/dp_14"
tools:text="即將過期:3日" />
<TextView
android:id="@+id/tv_warehouse_expires_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_4"
android:paddingLeft="@dimen/dp_10"
android:paddingTop="@dimen/dp_4" android:paddingTop="@dimen/dp_4"
android:paddingRight="@dimen/dp_10"
android:paddingBottom="@dimen/dp_4" android:paddingBottom="@dimen/dp_4"
android:privateImeOptions="@dimen/dp_10"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="@dimen/dp_14" android:textSize="@dimen/dp_14"
android:visibility="gone"
tools:text="即將過期:3日" /> tools:text="即將過期:3日" />
</LinearLayout>
</LinearLayout> </LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_warehousing"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/theme_color"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
...@@ -12,6 +14,8 @@ ...@@ -12,6 +14,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="食材名" /> android:text="食材名" />
<include layout="@layout/include_vertical_color_white_dividing_line" />
<TextView <TextView
android:id="@+id/tv_warehouse_item_ingredients_species" android:id="@+id/tv_warehouse_item_ingredients_species"
style="@style/WareHouse_item_TextStyle" style="@style/WareHouse_item_TextStyle"
...@@ -19,13 +23,15 @@ ...@@ -19,13 +23,15 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="食材種類" /> android:text="食材種類" />
<include layout="@layout/include_vertical_color_white_dividing_line" />
<TextView <TextView
android:id="@+id/tv_warehouse_item_supplier" android:id="@+id/tv_warehouse_item_supplier"
style="@style/WareHouse_item_TextStyle" style="@style/WareHouse_item_TextStyle"
android:layout_width="@dimen/dp_62" android:layout_width="@dimen/dp_62"
android:visibility="gone"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="供應商" /> android:text="供應商"
android:visibility="gone" />
<TextView <TextView
android:id="@+id/tv_warehouse_item_unit" android:id="@+id/tv_warehouse_item_unit"
...@@ -34,6 +40,8 @@ ...@@ -34,6 +40,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="單位" /> android:text="單位" />
<include layout="@layout/include_vertical_color_white_dividing_line" />
<TextView <TextView
android:id="@+id/tv_warehouse_item_unit_price" android:id="@+id/tv_warehouse_item_unit_price"
style="@style/WareHouse_item_TextStyle" style="@style/WareHouse_item_TextStyle"
...@@ -41,6 +49,8 @@ ...@@ -41,6 +49,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="單價" /> android:text="單價" />
<include layout="@layout/include_vertical_color_white_dividing_line" />
<TextView <TextView
android:id="@+id/tv_warehouse_item_inventory_quantity" android:id="@+id/tv_warehouse_item_inventory_quantity"
style="@style/WareHouse_item_TextStyle" style="@style/WareHouse_item_TextStyle"
...@@ -48,12 +58,14 @@ ...@@ -48,12 +58,14 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="庫存數量" /> android:text="庫存數量" />
<include layout="@layout/include_vertical_color_white_dividing_line" />
<TextView <TextView
android:id="@+id/tv_warehouse_item_total_amount" android:id="@+id/tv_warehouse_item_total_amount"
style="@style/WareHouse_item_TextStyle" style="@style/WareHouse_item_TextStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:minWidth="@dimen/dp_55"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_0" android:layout_marginRight="@dimen/dp_0"
android:minWidth="@dimen/dp_55"
android:text="總價" /> android:text="總價" />
</LinearLayout> </LinearLayout>
\ No newline at end of file
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"
android:background="@color/theme_color"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
...@@ -15,7 +16,7 @@ ...@@ -15,7 +16,7 @@
<TextView <TextView
android:id="@+id/tv_warehouse_item_ingredients_species" android:id="@+id/tv_warehouse_item_ingredients_species"
style="@style/WareHouse_item_TextStyle" style="@style/WareHouse_item_TextStyle"
android:layout_width="wrap_content" android:layout_width="@dimen/dp_68"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="食材種類" /> android:text="食材種類" />
......
<?xml version="1.0" encoding="utf-8"?>
<com.lxj.xpopup.widget.PartShadowContainer xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/attachPopupContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content">"
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_purchase_list_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</com.lxj.xpopup.widget.PartShadowContainer>
...@@ -24,7 +24,8 @@ ...@@ -24,7 +24,8 @@
<EditText <EditText
android:id="@+id/et_input" android:id="@+id/et_input"
android:layout_width="@dimen/dp_70" android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:maxLines="1"
android:paddingTop="@dimen/dp_2" android:paddingTop="@dimen/dp_2"
...@@ -37,6 +38,8 @@ ...@@ -37,6 +38,8 @@
android:text="" android:text=""
android:textColor="@color/color_3c" android:textColor="@color/color_3c"
android:textSize="@dimen/sp_16" /> android:textSize="@dimen/sp_16" />
</LinearLayout> </LinearLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
......
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/centerPopupContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shape_white_eight_corners_bg"
android:orientation="vertical"
android:padding="@dimen/dp_20">
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="標題"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_16"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:text="標題"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14" />
</LinearLayout>
</FrameLayout>
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
app:qmui_topbar_title_color="@color/theme_white_color" app:qmui_topbar_title_color="@color/theme_white_color"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/head_height" android:layout_height="@dimen/head_height"
app:qmui_topbar_text_btn_color_state_list="@color/white"
android:background="@color/theme_color" android:background="@color/theme_color"
android:fitsSystemWindows="true" /> android:fitsSystemWindows="true" />
......
<?xml version="1.0" encoding="utf-8"?>
<com.qmuiteam.qmui.alpha.QMUIAlphaConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/layout_shopping_cart"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/iv_shopping_cart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_shopping_car" />
<TextView
android:id="@+id/tv_purchase_cart_number"
android:layout_width="@dimen/dp_12"
android:layout_height="@dimen/dp_12"
android:autoSizeMaxTextSize="@dimen/dp_8"
android:autoSizeMinTextSize="@dimen/dp_4"
android:background="@drawable/ui_shape_red_oval"
android:gravity="center"
android:text="3"
android:textColor="@color/white"
android:textSize="@dimen/dp_6"
app:layout_constraintRight_toRightOf="@id/iv_shopping_cart"
app:layout_constraintTop_toTopOf="@id/iv_shopping_cart" />
</com.qmuiteam.qmui.alpha.QMUIAlphaConstraintLayout>
\ No newline at end of file
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
<item name="qmui_shopping_cart" type="id"/> <item name="qmui_shopping_cart" type="id"/>
<item name="qmui_add_new_food_ingredients" type="id"/> <item name="qmui_add_new_food_ingredients" type="id"/>
<item name="qmui_delete_order" type="id"/> <item name="qmui_delete_order" type="id"/>
<item name="qmui_preview" type="id"/>
<item name="id_inventory_consumption" type="id"/> <item name="id_inventory_consumption" type="id"/>
<item name="id_save" type="id"/> <item name="id_save" type="id"/>
<item name="id_take_pictures" type="id"/> <item name="id_take_pictures" type="id"/>
......
...@@ -32,4 +32,5 @@ ...@@ -32,4 +32,5 @@
<string name="str_cancel">取消</string> <string name="str_cancel">取消</string>
<string name="str_determine">確定</string> <string name="str_determine">確定</string>
<string name="str_delete_category_tip">是否確認刪除該類別【%1$s】,子類和食材將一同刪除?</string> <string name="str_delete_category_tip">是否確認刪除該類別【%1$s】,子類和食材將一同刪除?</string>
<string name="str_preview">預覽</string>
</resources> </resources>
\ No newline at end of file
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
<item name="android:textSize">@dimen/dp_14</item> <item name="android:textSize">@dimen/dp_14</item>
<item name="android:textColor">@color/white</item> <item name="android:textColor">@color/white</item>
<item name="android:ellipsize">end</item> <item name="android:ellipsize">end</item>
<item name="android:background">@color/theme_color</item>
<item name="android:maxLength">8</item> <item name="android:maxLength">8</item>
<item name="android:maxLines">1</item> <item name="android:maxLines">1</item>
<item name="android:paddingTop">@dimen/dp_10</item> <item name="android:paddingTop">@dimen/dp_10</item>
...@@ -72,4 +71,10 @@ ...@@ -72,4 +71,10 @@
<item name="android:textStyle">bold</item> <item name="android:textStyle">bold</item>
<item name="android:textColor">@color/required_color</item> <item name="android:textColor">@color/required_color</item>
</style> </style>
<style name="supplier_search_style">
<item name="android:textColor">@color/theme_333_color</item>
<item name="android:textColorHint">@color/color_b8</item>
<item name="android:textSize">@dimen/dp_16</item>
</style>
</resources> </resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!-- <root-path/> :代表设备的根目录new File("/")
<files-path/> : 代表context.getFilesDir()
<cache-path/> : 代表context.getCacheDir()
<external-path/> : 代表Environment.getExternalStorageDirectory()
<external-files-path/> : 代表context.getExternalFilesDirs()
<external-cache-path/> : 代表getExternalCacheDirs() -->
<!--代表外部存储区域的根目录下的文件 Environment.getExternalStorageDirectory()/DCIM/camerademo目录-->
<!--/storage/emulated/0/DCIM/camerademo-->
<!--<external-path-->
<!-- name="hm_DCIM"-->
<!-- path="DCIM/camerademo" />-->
<!--代表app 私有的存储区域 Context.getFilesDir()目录下的images目录-->
<!--/data/user/0/com.hm.camerademo/files/images-->
<!--<files-path-->
<!--name="hm_private_files"-->
<!--path="images" />-->
<!-- 代表app 私有的存储区域 Context.getCacheDir()目录下的images目录 -->
<!--/data/user/0/com.hm.camerademo/cache/images-->
<!--<cache-path-->
<!--name="hm_private_cache"-->
<!--path="images" />-->
<!--代表app外部存储区域根目录下的文件 Context.getExternalFilesDir(Environment.DIRECTORY_PICTURES)目录下的Pictures目录-->
<!--/storage/emulated/0/Android/data/com.hm.camerademo/files/Pictures-->
<!--<external-files-path-->
<!--name="hm_external_files"-->
<!--path="Pictures" />-->
<!--代表app 外部存储区域根目录下的文件 Context.getExternalCacheDir目录下的images目录-->
<!--/storage/emulated/0/Android/data/com.hm.camerademo/cache/images-->
<!--<external-cache-path-->
<!--name="hm_external_cache"-->
<!--path="images" />-->
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<root-path
name="root"
path="" />
<files-path
name="files"
path="images" />
<cache-path
name="cache"
path="" />
<external-path
name="external"
path="image" />
<external-files-path
name="external_file_path"
path="" />
<external-cache-path
name="external_cache_path"
path="" />
</paths>
...@@ -7,8 +7,8 @@ ext { ...@@ -7,8 +7,8 @@ ext {
targetSdkVersion : 29, targetSdkVersion : 29,
//正式版: 1.0.3 3 //正式版: 1.0.3 3
//內部測試版:1.2.0 20 //內部測試版:1.2.0 20
versionCode : 26, versionCode : 29,
versionName : "1.2.6" versionName : "1.2.9"
] ]
version = [ version = [
......
...@@ -47,7 +47,7 @@ class DataNotificationService : Service() { ...@@ -47,7 +47,7 @@ class DataNotificationService : Service() {
/** /**
* 心跳检测时间 * 心跳检测时间
*/ */
private val HEART_BEAT_RATE = (30 * 1000).toLong()//每隔15秒进行一次对长连接的心跳检测 private val HEART_BEAT_RATE = (30 * 1000).toLong()//每隔30秒进行一次对长连接的心跳检测
private val WEBSOCKET_HOST_AND_PORT = "${HttpsConstans.ROOT_URL}/ricepon-websocket/js/webSocketServer"//可替换为自己的主机名和端口号 private val WEBSOCKET_HOST_AND_PORT = "${HttpsConstans.ROOT_URL}/ricepon-websocket/js/webSocketServer"//可替换为自己的主机名和端口号
private var mWebSocket: WebSocket? = null private var mWebSocket: WebSocket? = null
...@@ -262,9 +262,10 @@ class DataNotificationService : Service() { ...@@ -262,9 +262,10 @@ class DataNotificationService : Service() {
putTimeLog("取消心跳") putTimeLog("取消心跳")
cancelInterval() cancelInterval()
interval({ interval({
//保持設備喚醒
newWakeLock?.acquire(10 * 60 * 1000L /*10 minutes*/) newWakeLock?.acquire(10 * 60 * 1000L /*10 minutes*/)
putTimeLog("開啟心跳") putTimeLog("開啟心跳")
//先斷開之前的
client?.let { it -> client?.let { it ->
mWebSocket?.let { mWebSocket?.let {
it.cancel() it.cancel()
...@@ -287,9 +288,6 @@ class DataNotificationService : Service() { ...@@ -287,9 +288,6 @@ class DataNotificationService : Service() {
putTimeLog("連接成功") putTimeLog("連接成功")
cancelTimerDisposable() cancelTimerDisposable()
myBind?.block?.invoke(false) myBind?.block?.invoke(false)
if (postCallBack != null) {
postCallBack!!.callBack(0)
}
} }
} }
...@@ -332,7 +330,7 @@ class DataNotificationService : Service() { ...@@ -332,7 +330,7 @@ class DataNotificationService : Service() {
override fun onMessage(webSocket: WebSocket, bytes: ByteString) { override fun onMessage(webSocket: WebSocket, bytes: ByteString) {
super.onMessage(webSocket, bytes) super.onMessage(webSocket, bytes)
val json = JSONObject(bytes.toString()) val json = JSONObject(bytes.toString())
putTimeLog("onMessage222:$bytes") putTimeLog("onMessage2:$bytes")
if (postCallBack != null) { if (postCallBack != null) {
postCallBack!!.callBack(json.optInt("type")) postCallBack!!.callBack(json.optInt("type"))
} }
...@@ -353,7 +351,6 @@ class DataNotificationService : Service() { ...@@ -353,7 +351,6 @@ class DataNotificationService : Service() {
override fun onFailure(webSocket: WebSocket, t: Throwable, response: Response?) {//长连接连接失败的回调 override fun onFailure(webSocket: WebSocket, t: Throwable, response: Response?) {//长连接连接失败的回调
super.onFailure(webSocket, t, response) super.onFailure(webSocket, t, response)
Log.e(TAG, "onFailure " + t.message) Log.e(TAG, "onFailure " + t.message)
if (!this@DataNotificationService.isDestroy) { if (!this@DataNotificationService.isDestroy) {
//連接斷開,定時五秒,如果未重連,播放提示音 //連接斷開,定時五秒,如果未重連,播放提示音
delayFun({ delayFun({
...@@ -477,7 +474,6 @@ class DataNotificationService : Service() { ...@@ -477,7 +474,6 @@ class DataNotificationService : Service() {
var mIntervalDisposable: Disposable? = null var mIntervalDisposable: Disposable? = null
var timerDisposable: Disposable? = null var timerDisposable: Disposable? = null
/** /**
* 执行定时任务 * 执行定时任务
*/ */
......
...@@ -20,6 +20,11 @@ public class TextUtil { ...@@ -20,6 +20,11 @@ public class TextUtil {
str.equals("null") || str.equals("undefined"); str.equals("null") || str.equals("undefined");
} }
public static boolean isEmptyOrNullOrUndefined(CharSequence str) {
return str == null || str.length() == 0 ||
str.equals("null") || str.equals("undefined");
}
public static boolean isEmptyOrNullOrUndefined(EditText editText) { public static boolean isEmptyOrNullOrUndefined(EditText editText) {
if (editText == null || editText.getText() == null) { if (editText == null || editText.getText() == null) {
return true; return true;
......
...@@ -2,5 +2,6 @@ ...@@ -2,5 +2,6 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/white" android:state_checked="true"/> <item android:color="@color/white" android:state_checked="true"/>
<item android:color="@color/white" android:state_pressed="true"/> <item android:color="@color/white" android:state_pressed="true"/>
<item android:color="@color/white" android:state_selected="true"/>
<item android:color="@color/color_3c"/> <item android:color="@color/color_3c"/>
</selector> </selector>
\ No newline at end of file

7.79 KB | W: | H:

4.54 KB | W: | H:

library-common/src/main/res/drawable-xhdpi/ic_search.png
library-common/src/main/res/drawable-xhdpi/ic_search.png
library-common/src/main/res/drawable-xhdpi/ic_search.png
library-common/src/main/res/drawable-xhdpi/ic_search.png
  • 2-up
  • Swipe
  • Onion skin
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/dp_5" />
<solid android:color="@color/color_light_blue_50" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/theme_color"/>
<corners android:radius="@dimen/dp_12"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/white" />
<corners android:radius="@dimen/dp_12" />
</shape>
\ No newline at end of file
...@@ -5,13 +5,11 @@ ...@@ -5,13 +5,11 @@
android:id="@+id/layout_category" android:id="@+id/layout_category"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginTop="@dimen/dp_15"
android:elevation="@dimen/dp_5" android:elevation="@dimen/dp_5"
android:orientation="horizontal" android:orientation="horizontal"
app:cardElevation="@dimen/dp_10"> app:cardElevation="@dimen/dp_10">
<RelativeLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
...@@ -20,14 +18,13 @@ ...@@ -20,14 +18,13 @@
<TextView <TextView
android:id="@+id/tv_category_name" android:id="@+id/tv_category_name"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"
android:button="@null" android:button="@null"
android:paddingLeft="@dimen/dp_10"
android:ellipsize="marquee" android:ellipsize="marquee"
android:layout_toLeftOf="@id/iv_category_delete"
android:gravity="center_vertical" android:gravity="center_vertical"
android:paddingLeft="@dimen/dp_5"
android:paddingRight="@dimen/dp_2"
android:textColor="@color/s_btn_blue_3c_text" android:textColor="@color/s_btn_blue_3c_text"
android:textSize="@dimen/dp_14" android:textSize="@dimen/dp_14"
android:textStyle="bold" android:textStyle="bold"
...@@ -37,11 +34,26 @@ ...@@ -37,11 +34,26 @@
android:id="@+id/iv_category_delete" android:id="@+id/iv_category_delete"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:paddingLeft="@dimen/dp_5" android:paddingLeft="@dimen/dp_5"
android:paddingRight="@dimen/dp_5" android:paddingRight="@dimen/dp_5"
android:src="@drawable/ic_red_circular_delete" /> android:src="@drawable/ic_red_circular_delete"
</RelativeLayout> android:visibility="gone" />
<TextView
android:layout_width="@dimen/dp_14"
android:layout_height="@dimen/dp_14"
android:layout_gravity="center_vertical"
android:autoSizeMaxTextSize="@dimen/dp_12"
android:autoSizeMinTextSize="@dimen/dp_6"
android:layout_marginLeft="@dimen/dp_5"
android:visibility="gone"
android:background="@drawable/ui_shape_theme_oval"
android:gravity="center"
android:textColor="@color/white"
android:textSize="@dimen/dp_12"
tools:text="6" />
</LinearLayout>
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView 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:id="@+id/layout_category"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:background="@color/white"
android:orientation="horizontal"
app:cardElevation="@dimen/dp_10">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="@dimen/dp_8"
android:paddingBottom="@dimen/dp_8">
<TextView
android:id="@+id/tv_category_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:button="@null"
android:ellipsize="marquee"
android:gravity="center_vertical"
android:paddingLeft="@dimen/dp_10"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_14"
android:textStyle="bold"
tools:text="果蔬類看書福利卡駕駛的垃圾死了阿斯蘭大家啦款手機愛上了的框架拉三季度阿薩德科技拉屎" />
<TextView
android:layout_width="@dimen/dp_14"
android:layout_height="@dimen/dp_14"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/dp_5"
android:autoSizeMaxTextSize="@dimen/dp_12"
android:autoSizeMinTextSize="@dimen/dp_6"
android:background="@drawable/ui_shape_theme_oval"
android:gravity="center"
android:textColor="@color/white"
android:textSize="@dimen/dp_12"
android:visibility="gone"
tools:text="6" />
</LinearLayout>
</androidx.cardview.widget.CardView>
\ No newline at end of file
...@@ -478,7 +478,7 @@ ...@@ -478,7 +478,7 @@
<color name="color_53">#535353</color> <color name="color_53">#535353</color>
<color name="color_48">#484848</color> <color name="color_48">#484848</color>
<color name="color_75">#757575</color> <color name="color_75">#757575</color>
<color name="color_b8">#B8B8B8</color>
<color name="tran_twenty_send_order_btn_bg_color">#331196DB</color> <color name="tran_twenty_send_order_btn_bg_color">#331196DB</color>
<color name="tran_fifty_order_state0_color">#7F009788</color> <color name="tran_fifty_order_state0_color">#7F009788</color>
<!-- 待確認背景色--> <!-- 待確認背景色-->
...@@ -530,6 +530,7 @@ ...@@ -530,6 +530,7 @@
<color name="supply_chain_bg_color">@color/color_f3</color> <color name="supply_chain_bg_color">@color/color_f3</color>
<color name="supply_chain_category_title_bg">#2CA0EA</color> <color name="supply_chain_category_title_bg">#2CA0EA</color>
<color name="color_light_blue_50">#802CA0EA</color>
<color name="purchase_total_price_text_color">#EC2D2D</color> <color name="purchase_total_price_text_color">#EC2D2D</color>
......
package com.gingersoft.gsa.cloud.ui.bean.view; package com.gingersoft.gsa.cloud.ui.bean.view;
import com.qmuiteam.qmui.widget.section.QMUISection;
import java.util.Objects;
import lombok.Data; import lombok.Data;
/** /**
...@@ -10,12 +14,15 @@ import lombok.Data; ...@@ -10,12 +14,15 @@ import lombok.Data;
* Use: 共用的分類型左側分類數據 * Use: 共用的分類型左側分類數據
*/ */
@Data @Data
public class CategoryBean { public class CategoryBean implements QMUISection.Model<CategoryBean> {
private int id; private Integer id;
private String categoryName; private String categoryName;
//數量 /**
* 數量
*/
private int count; private int count;
public CategoryBean() { public CategoryBean() {
} }
...@@ -29,4 +36,19 @@ public class CategoryBean { ...@@ -29,4 +36,19 @@ public class CategoryBean {
this.categoryName = categoryName; this.categoryName = categoryName;
this.count = count; this.count = count;
} }
@Override
public CategoryBean cloneForDiff() {
return new CategoryBean(getId(), getCategoryName(), getCount());
}
@Override
public boolean isSameItem(CategoryBean other) {
return Objects.equals(categoryName, other.getCategoryName());
}
@Override
public boolean isSameContent(CategoryBean other) {
return true;
}
} }
...@@ -140,7 +140,6 @@ public class AppDialog { ...@@ -140,7 +140,6 @@ public class AppDialog {
} }
}, cancelListener, layoutId); }, cancelListener, layoutId);
inputConfirmPopupView.show(); inputConfirmPopupView.show();
// inputConfirmPopupView.getEditText().setFilters(new InputFilter[]{InputFilterUtils.getChAndEnAndNumInputFilter(context)});
} }
......
...@@ -205,7 +205,7 @@ public abstract class DialogUtils implements LifecycleObserver { ...@@ -205,7 +205,7 @@ public abstract class DialogUtils implements LifecycleObserver {
public abstract void initLayout(ViewHepler hepler, Dialog dialog); public abstract void initLayout(ViewHepler hepler, Dialog dialog);
private ViewHepler getViewHepler(Context context) { private ViewHepler getViewHepler(Context context) {
return ViewHepler.get(context, view); return new ViewHepler(context, view);
} }
...@@ -217,39 +217,33 @@ public abstract class DialogUtils implements LifecycleObserver { ...@@ -217,39 +217,33 @@ public abstract class DialogUtils implements LifecycleObserver {
public static class ViewHepler { public static class ViewHepler {
private final SparseArray<View> mViews; private final SparseArray<View> mViews;
private View mConvertView; private View mConvertView;
private static ViewHepler viewHepler = null;
private Context context;
private ViewHepler(Context context, int layoutId) { private ViewHepler(Context context, int layoutId) {
this.mViews = new SparseArray<>(); this.mViews = new SparseArray<>();
this.context = context;
mConvertView = LayoutInflater.from(context).inflate(layoutId, null); mConvertView = LayoutInflater.from(context).inflate(layoutId, null);
} }
private ViewHepler(Context context, View view) { private ViewHepler(Context context, View view) {
this.mViews = new SparseArray<>(); this.mViews = new SparseArray<>();
this.context = context;
mConvertView = view; mConvertView = view;
} }
public void clearAll() { public void clearAll() {
context = null;
if (mViews != null) { if (mViews != null) {
mViews.clear(); mViews.clear();
} }
mConvertView = null; mConvertView = null;
viewHepler = null;
} }
public static ViewHepler get(Context context, int layoutId) { // public ViewHepler get(Context context, int layoutId) {
viewHepler = new ViewHepler(context, layoutId); // viewHepler = new ViewHepler(context, layoutId);
return viewHepler; // return viewHepler;
} // }
//
public static ViewHepler get(Context context, View view) { // public ViewHepler get(Context context, View view) {
viewHepler = new ViewHepler(context, view); // viewHepler = new ViewHepler(context, view);
return viewHepler; // return viewHepler;
} // }
public View getContentView() { public View getContentView() {
return mConvertView; return mConvertView;
...@@ -282,6 +276,7 @@ public abstract class DialogUtils implements LifecycleObserver { ...@@ -282,6 +276,7 @@ public abstract class DialogUtils implements LifecycleObserver {
getView(viewId).setOnClickListener(onClickListener); getView(viewId).setOnClickListener(onClickListener);
return this; return this;
} }
public ViewHepler setVisibility(int viewId, int visible) { public ViewHepler setVisibility(int viewId, int visible) {
getView(viewId).setVisibility(visible); getView(viewId).setVisibility(visible);
return this; return this;
...@@ -290,8 +285,8 @@ public abstract class DialogUtils implements LifecycleObserver { ...@@ -290,8 +285,8 @@ public abstract class DialogUtils implements LifecycleObserver {
/** /**
* 为TextView设置字符串 * 为TextView设置字符串
* *
* @param viewId * @param viewId textview的id
* @param text * @param text 文本內容
* @return * @return
*/ */
public ViewHepler setText(int viewId, String text) { public ViewHepler setText(int viewId, String text) {
...@@ -304,8 +299,6 @@ public abstract class DialogUtils implements LifecycleObserver { ...@@ -304,8 +299,6 @@ public abstract class DialogUtils implements LifecycleObserver {
} }
/** /**
* 为ImageView设置图片 * 为ImageView设置图片
* *
...@@ -345,7 +338,7 @@ public abstract class DialogUtils implements LifecycleObserver { ...@@ -345,7 +338,7 @@ public abstract class DialogUtils implements LifecycleObserver {
public ViewHepler setImageByUrl(int viewId, String url, int roundedCorners, int defaultImg) { public ViewHepler setImageByUrl(int viewId, String url, int roundedCorners, int defaultImg) {
ImageView view = (ImageView) isHaveView(viewId); ImageView view = (ImageView) isHaveView(viewId);
Glide.with(context).load(url) Glide.with(view.getContext()).load(url)
.diskCacheStrategy(DiskCacheStrategy.ALL) .diskCacheStrategy(DiskCacheStrategy.ALL)
.apply(RequestOptions.bitmapTransform(new RoundedCorners(roundedCorners))) .apply(RequestOptions.bitmapTransform(new RoundedCorners(roundedCorners)))
.error(defaultImg) .error(defaultImg)
...@@ -437,8 +430,9 @@ public abstract class DialogUtils implements LifecycleObserver { ...@@ -437,8 +430,9 @@ public abstract class DialogUtils implements LifecycleObserver {
hepler.getView(R.id.btn_cancel).setOnClickListener(v -> dialog.dismiss()); hepler.getView(R.id.btn_cancel).setOnClickListener(v -> dialog.dismiss());
hepler.getView(R.id.btn_confirm).setOnClickListener(v -> { hepler.getView(R.id.btn_confirm).setOnClickListener(v -> {
dialog.dismiss(); dialog.dismiss();
if (onClickListener != null) if (onClickListener != null) {
onClickListener.onClick(adapter.getChecked()); onClickListener.onClick(adapter.getChecked());
}
}); });
} }
} }
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
android:id="@+id/iv_shop_car" android:id="@+id/iv_shop_car"
android:layout_width="@dimen/dp_32" android:layout_width="@dimen/dp_32"
android:layout_height="@dimen/dp_32" android:layout_height="@dimen/dp_32"
android:src="@drawable/ic_shoping_car" /> android:src="@drawable/ic_shopping_car" />
<Button <Button
android:id="@+id/btn_order_count" android:id="@+id/btn_order_count"
......
...@@ -18,6 +18,16 @@ ...@@ -18,6 +18,16 @@
android:theme="@style/DialogActivityTheme" /> android:theme="@style/DialogActivityTheme" />
<service android:name="service.UpdateAppService"/> <service android:name="service.UpdateAppService"/>
</application>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/update_file_paths"/>
</provider>
</application>
</manifest> </manifest>
\ No newline at end of file
...@@ -8,9 +8,11 @@ import android.content.Context; ...@@ -8,9 +8,11 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import java.io.File;
import androidx.core.content.FileProvider; import androidx.core.content.FileProvider;
import java.io.File;
import teprinciple.updateapputils.R; import teprinciple.updateapputils.R;
/** /**
...@@ -112,12 +114,9 @@ public class UpdateAppReceiver extends BroadcastReceiver { ...@@ -112,12 +114,9 @@ public class UpdateAppReceiver extends BroadcastReceiver {
* 跳转安装 * 跳转安装
*/ */
private void toInstall(Context context) { private void toInstall(Context context) {
Intent i = new Intent(Intent.ACTION_VIEW); Intent i = new Intent(Intent.ACTION_VIEW);
File apkFile = new File(DownloadAppUtils.downloadUpdateApkFilePath); File apkFile = new File(DownloadAppUtils.downloadUpdateApkFilePath);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
i.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
Uri contentUri = FileProvider.getUriForFile( Uri contentUri = FileProvider.getUriForFile(
context, context.getPackageName() + ".fileprovider", apkFile); context, context.getPackageName() + ".fileprovider", apkFile);
i.setDataAndType(contentUri, "application/vnd.android.package-archive"); i.setDataAndType(contentUri, "application/vnd.android.package-archive");
...@@ -125,6 +124,7 @@ public class UpdateAppReceiver extends BroadcastReceiver { ...@@ -125,6 +124,7 @@ public class UpdateAppReceiver extends BroadcastReceiver {
} else { } else {
i.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive"); i.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive");
} }
i.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);//添加这一句表示对目标应用临时授权该Uri所代表的文件
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i); context.startActivity(i);
} }
......
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-path path="" name="files_root" />
</paths>
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