Commit 0715edf7 by Wyh

4.29 接單第三方物流,獲取打印機邏輯修改

parent 2da52ed5
package com.gingersoft.gsa.other_order_mode.data
import com.gingersoft.gsa.other_order_mode.data.model.bean.ThirdItem
import com.gingersoft.gsa.other_order_mode.data.network.CoolWeatherNetwork
import com.google.gson.Gson
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import okhttp3.FormBody
......@@ -21,7 +23,7 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
heWeather
}
suspend fun updateRestOpenStatus(state: Boolean,restaurantId: String) = withContext(Dispatchers.IO) {
suspend fun updateRestOpenStatus(state: Boolean, restaurantId: String) = withContext(Dispatchers.IO) {
val requestBody = FormBody.Builder()
.add("restId", restaurantId)
.add("openStatus", if (state) "1" else "2")
......@@ -30,7 +32,6 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
data
}
suspend fun getOrderInfo(orderId: String) = withContext(Dispatchers.IO) {
val requestBody = FormBody.Builder()
.add("orderId", orderId)
......@@ -53,6 +54,14 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
data
}
suspend fun thirdDelivery(orderId: String, thirdItem: ThirdItem) = withContext(Dispatchers.IO) {
val requestBody = FormBody.Builder()
.add("orderId", orderId)
.add("items", Gson().toJson(thirdItem))
.build()
network.thirdDelivery(requestBody)
}
suspend fun updateSelfOrderStatus(ids: String, status: String, restaurantId: String) = withContext(Dispatchers.IO) {
val requestBody = FormBody.Builder()
.add("ids", ids)
......@@ -64,7 +73,7 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
}
suspend fun getDeliveryInfo(restId: String, userId: String) = withContext(Dispatchers.IO){
suspend fun getDeliveryInfo(restId: String, userId: String) = withContext(Dispatchers.IO) {
val requestBody = FormBody.Builder()
.add("restId", restId)
.add("userId", userId)
......
package com.gingersoft.gsa.other_order_mode.data.model.bean
class OrderList {
/**
* success : true
* sysTime : 1585282096866
* data : {"data":[{"STATUS":0,"MEMBER_NAME":"觉得很多很多","ADDRESS_DETAIL":"香港荔枝角青山道479號麗昌工廠大廈2樓201L室Innovation Design Consultant Ltd.1111","PAY_AMOUNT":89,"PHONE":"15899876018","orderPayType":1,"ORDER_NO":"26200411316057124","Id":48883,"CREATE_TIME":"Mar 27, 2020 12:07:49 PM","takeFoodCode":"0","order_type":2,"RECEIVER":"有 女士"},{"STATUS":3,"MEMBER_NAME":"你好哦","ADDRESS_DETAIL":"香港長沙灣青山道479號麗昌工業大廈303","PAY_AMOUNT":128,"PHONE":"13554770615","orderPayType":1,"ORDER_NO":"26202501369354194","Id":48880,"CREATE_TIME":"Mar 27, 2020 11:43:53 AM","takeFoodCode":"0055","order_type":2,"RECEIVER":"劉先生 先生"},{"STATUS":2,"MEMBER_NAME":"你好哦","ADDRESS_DETAIL":"美國紐約州紐約123123","PAY_AMOUNT":128,"PHONE":"13554770615","orderPayType":1,"ORDER_NO":"26200341332451819","Id":48879,"CREATE_TIME":"Mar 27, 2020 11:39:08 AM","takeFoodCode":"0","order_type":2,"RECEIVER":"asdfasdf 先生"},{"STATUS":3,"MEMBER_NAME":"觉得很多很多","ADDRESS_DETAIL":"香港禮頓山禮頓道8號8號 59864香港銅鑼灣皇冠假日酒店一","PAY_AMOUNT":384,"PHONE":"15899876018","orderPayType":1,"ORDER_NO":"26200681397655588","Id":48875,"CREATE_TIME":"Mar 27, 2020 11:33:19 AM","takeFoodCode":"0052","order_type":2,"RECEIVER":"說 先生"},{"STATUS":2,"MEMBER_NAME":"觉得很多很多","ADDRESS_DETAIL":"香港半山堅尼地道28號香港特別行政區前任行政長官辦公室111","PAY_AMOUNT":228,"PHONE":"15899876018","orderPayType":1,"ORDER_NO":"26200031363851774","Id":48874,"CREATE_TIME":"Mar 27, 2020 11:33:01 AM","takeFoodCode":"0051","order_type":2,"RECEIVER":"特別 女士"},{"STATUS":3,"MEMBER_NAME":"觉得很多很多","ADDRESS_DETAIL":"香港鵝頸駱克道463-464號銅鑼灣廣場二期123","PAY_AMOUNT":128,"PHONE":"15899876018","orderPayType":1,"ORDER_NO":"26201261317059894","Id":48873,"CREATE_TIME":"Mar 27, 2020 11:31:37 AM","takeFoodCode":"0050","order_type":2,"RECEIVER":"杜 先生"},{"STATUS":2,"MEMBER_NAME":"許立燦","ADDRESS_DETAIL":"香港島大坑電腦大廈","PAY_AMOUNT":78,"PHONE":"18938995556","orderPayType":2,"ORDER_NO":"26202381350555250","Id":48866,"CREATE_TIME":"Mar 27, 2020 10:53:45 AM","takeFoodCode":"0046","order_type":2,"RECEIVER":"許 先生"},{"STATUS":2,"MEMBER_NAME":"許立燦","ADDRESS_DETAIL":"香港島中環餐飲服務公司","PAY_AMOUNT":88,"PHONE":"18938995556","orderPayType":2,"ORDER_NO":"26201801340350065","Id":48854,"CREATE_TIME":"Mar 27, 2020 10:44:41 AM","takeFoodCode":"0045","order_type":2,"RECEIVER":"12345 先生"},{"MaxOrder":200,"selflNum":35,"totalAmount":78,"maxOrderSelf":100,"num":111,"dayOrderNum":1,"Open_Status":"1"}],"count":0,"page":{"pageIndex":1,"pageSize":10,"pageCount":0,"totalCount":8}}
*/
private var success: Boolean = false
private var sysTime: Long = 0
private var data: DataBeanX? = null
class DataBeanX {
/**
* data : [{"STATUS":0,"MEMBER_NAME":"觉得很多很多","ADDRESS_DETAIL":"香港荔枝角青山道479號麗昌工廠大廈2樓201L室Innovation Design Consultant Ltd.1111","PAY_AMOUNT":89,"PHONE":"15899876018","orderPayType":1,"ORDER_NO":"26200411316057124","Id":48883,"CREATE_TIME":"Mar 27, 2020 12:07:49 PM","takeFoodCode":"0","order_type":2,"RECEIVER":"有 女士"},{"STATUS":3,"MEMBER_NAME":"你好哦","ADDRESS_DETAIL":"香港長沙灣青山道479號麗昌工業大廈303","PAY_AMOUNT":128,"PHONE":"13554770615","orderPayType":1,"ORDER_NO":"26202501369354194","Id":48880,"CREATE_TIME":"Mar 27, 2020 11:43:53 AM","takeFoodCode":"0055","order_type":2,"RECEIVER":"劉先生 先生"},{"STATUS":2,"MEMBER_NAME":"你好哦","ADDRESS_DETAIL":"美國紐約州紐約123123","PAY_AMOUNT":128,"PHONE":"13554770615","orderPayType":1,"ORDER_NO":"26200341332451819","Id":48879,"CREATE_TIME":"Mar 27, 2020 11:39:08 AM","takeFoodCode":"0","order_type":2,"RECEIVER":"asdfasdf 先生"},{"STATUS":3,"MEMBER_NAME":"觉得很多很多","ADDRESS_DETAIL":"香港禮頓山禮頓道8號8號 59864香港銅鑼灣皇冠假日酒店一","PAY_AMOUNT":384,"PHONE":"15899876018","orderPayType":1,"ORDER_NO":"26200681397655588","Id":48875,"CREATE_TIME":"Mar 27, 2020 11:33:19 AM","takeFoodCode":"0052","order_type":2,"RECEIVER":"說 先生"},{"STATUS":2,"MEMBER_NAME":"觉得很多很多","ADDRESS_DETAIL":"香港半山堅尼地道28號香港特別行政區前任行政長官辦公室111","PAY_AMOUNT":228,"PHONE":"15899876018","orderPayType":1,"ORDER_NO":"26200031363851774","Id":48874,"CREATE_TIME":"Mar 27, 2020 11:33:01 AM","takeFoodCode":"0051","order_type":2,"RECEIVER":"特別 女士"},{"STATUS":3,"MEMBER_NAME":"觉得很多很多","ADDRESS_DETAIL":"香港鵝頸駱克道463-464號銅鑼灣廣場二期123","PAY_AMOUNT":128,"PHONE":"15899876018","orderPayType":1,"ORDER_NO":"26201261317059894","Id":48873,"CREATE_TIME":"Mar 27, 2020 11:31:37 AM","takeFoodCode":"0050","order_type":2,"RECEIVER":"杜 先生"},{"STATUS":2,"MEMBER_NAME":"許立燦","ADDRESS_DETAIL":"香港島大坑電腦大廈","PAY_AMOUNT":78,"PHONE":"18938995556","orderPayType":2,"ORDER_NO":"26202381350555250","Id":48866,"CREATE_TIME":"Mar 27, 2020 10:53:45 AM","takeFoodCode":"0046","order_type":2,"RECEIVER":"許 先生"},{"STATUS":2,"MEMBER_NAME":"許立燦","ADDRESS_DETAIL":"香港島中環餐飲服務公司","PAY_AMOUNT":88,"PHONE":"18938995556","orderPayType":2,"ORDER_NO":"26201801340350065","Id":48854,"CREATE_TIME":"Mar 27, 2020 10:44:41 AM","takeFoodCode":"0045","order_type":2,"RECEIVER":"12345 先生"},{"MaxOrder":200,"selflNum":35,"totalAmount":78,"maxOrderSelf":100,"num":111,"dayOrderNum":1,"Open_Status":"1"}]
* count : 0
* page : {"pageIndex":1,"pageSize":10,"pageCount":0,"totalCount":8}
*/
var count: Int = 0
var page: PageBean? = null
......@@ -58,7 +49,12 @@ class OrderList {
* dayOrderNum : 1
* Open_Status : 1
*/
var delivery_man_phone_num: String? = null
var delivery_man_name: String? = null
var curStat: String? = null
var deliveryMode: String? = null
var trkNo: String? = null
var isDelete: Int = 0
var STATUS: Int = 0//0,1為待確認,2為製作中,3待取餐或送貨中
var MEMBER_NAME: String? = null
var ADDRESS_DETAIL: String? = null
......
package com.gingersoft.gsa.other_order_mode.data.network
import android.util.Log
import com.gingersoft.gsa.other_order_mode.data.network.api.WeatherService
import okhttp3.RequestBody
import retrofit2.Call
......@@ -16,6 +15,8 @@ class CoolWeatherNetwork {
private val service = ServiceCreator.create2(WeatherService::class.java)
private val gsposService = ServiceCreator.create3(WeatherService::class.java)
suspend fun fetchOrderList(requestBody: RequestBody) = orderService.getOrderList(requestBody).await()
suspend fun updateRestOpenStatus(requestBody: RequestBody) = service.updateRestOpenStatus(requestBody).await()
......@@ -24,6 +25,8 @@ class CoolWeatherNetwork {
suspend fun updateOrderStatus(requestBody: RequestBody) = orderService.updateOrderStatus(requestBody).await()
suspend fun thirdDelivery(requestBody: RequestBody) = gsposService.thirdDelivery(requestBody).await()
suspend fun updateSelfOrderStatus(requestBody: RequestBody) = orderService.updateSelfOrderStatus(requestBody).await()
suspend fun getDeliveryInfo(requestBody: RequestBody) = orderService.getDeliveryInfo(requestBody).await()
......@@ -40,7 +43,6 @@ class CoolWeatherNetwork {
override fun onResponse(call: Call<T>, response: Response<T>) {
val body = response.body()
Log.e("eee", "請求地址:" + response.raw().request().url())
if (body != null) {
continuation.resume(body)
} else continuation.resumeWithException(RuntimeException("response body is null") as Throwable)
......
package com.gingersoft.gsa.other_order_mode.data.network
import com.gingersoft.gsa.cloud.globalconfig.applyOptions.intercept.LoggingInterceptor
import okhttp3.OkHttpClient
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.converter.scalars.ScalarsConverterFactory
object ServiceCreator {
private val httpClient = OkHttpClient.Builder().addInterceptor(LoggingInterceptor())
private const val ROOT_SZ_URL = "http://192.168.1.74:6060"
private const val ROOT_HK_TEST_URL = "https://hktest.ricepon.com:64377"
private const val ROOT_FORMAL_URL = "https://m.ricepon.com"
const val ROOT_URL = ROOT_HK_TEST_URL
private const val BASE_URL = "$ROOT_URL/ricepon-wechat/api/"
private const val BASE_URL2 = "$ROOT_URL/member-web/api/"
private const val BASE_URL3 = "$ROOT_URL/member-web/ricepon-gsa/api/"
private const val BASE_URL = "https://hktest.ricepon.com:64377/ricepon-wechat/api/"
private const val BASE_URL2 = "https://hktest.ricepon.com:64377/member-web/api/"
//https://hktest.ricepon.com:64377/member-web/api/wx/updateRestOpenStatus
private val httpClient = OkHttpClient.Builder()
private val builder = Retrofit.Builder()
.baseUrl(BASE_URL)
......@@ -24,13 +32,15 @@ object ServiceCreator {
.addConverterFactory(ScalarsConverterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
private val retrofit = builder.build()
private val retrofit2 = builder2.build()
fun <T> create(serviceClass: Class<T>): T = retrofit.create(serviceClass)
private val builder3 = Retrofit.Builder()
.baseUrl(BASE_URL3)
.client(httpClient.build())
.addConverterFactory(ScalarsConverterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
fun <T> create2(serviceClass: Class<T>): T = retrofit2.create(serviceClass)
fun <T> create(serviceClass: Class<T>): T = builder.build().create(serviceClass)
fun <T> create2(serviceClass: Class<T>): T = builder2.build().create(serviceClass)
fun <T> create3(serviceClass: Class<T>): T = builder3.build().create(serviceClass)
}
\ No newline at end of file
......@@ -21,6 +21,9 @@ interface WeatherService {
@POST("wechat/updateOrderStatus")
fun updateOrderStatus(@Body requestBody: RequestBody): Call<UpdateOrderBean>
@POST("gsa/shipAnyOrdersNew")
fun thirdDelivery(@Body requestBody: RequestBody): Call<ThirdSend>
@POST("wechat/updateSelfOrderStatus")
fun updateSelfOrderStatus(@Body requestBody: RequestBody): Call<UpdateOrderBean>
......
......@@ -17,18 +17,32 @@ import com.gingersoft.gsa.cloud.base.common.bean.mealManage.MyOrderManage
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils
import com.gingersoft.gsa.cloud.base.widget.DialogUtils
import com.gingersoft.gsa.cloud.print.bean.OrderDetails
import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog
import com.gingersoft.gsa.other_order_mode.R
import com.gingersoft.gsa.other_order_mode.data.WeatherRepository
import com.gingersoft.gsa.other_order_mode.data.model.bean.DeliveryBean
import com.gingersoft.gsa.other_order_mode.data.model.bean.OrderList
import com.gingersoft.gsa.other_order_mode.data.model.bean.ThirdItem
import com.gingersoft.gsa.other_order_mode.data.model.bean.UpdateOrderBean
import com.gingersoft.gsa.other_order_mode.ui.adapter.DeliveryAdapter
import com.jess.arms.utils.ArmsUtils
import com.zhy.autolayout.utils.ScreenUtils
import kotlinx.coroutines.launch
class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
private fun showLoading(context: Context, message: String? = null) {
if (message != null)
LoadingDialog.showDialogForLoading(context, message, true)
else
LoadingDialog.showDialogForLoading(context)
}
fun cancelDialogForLoading() {
LoadingDialog.cancelDialogForLoading()
}
companion object {
var fragmentStatus = arrayOf("0,1,2,3", "0,1", "2", "3", "3")
var fragmentType = arrayOf("0", "0", "0", "2", "7")
......@@ -49,7 +63,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
var deliveryBean: DeliveryBean? = null
/**
* 獲取訂單信息
* 獲取訂單
*/
fun getOrderList(context: Context, position: Int, page: String, isLoadMore: Boolean, listener: (String) -> Unit) {
launch({
......@@ -164,6 +178,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
* 2 已確認,外賣是指派送單,自取是製作完成
*/
fun updateOrderStatus(context: Context, data: OrderList.DataBeanX.DataBean, orderDetails: OrderDetails, listener: (Boolean) -> Unit) {
launch({
val status = when (data.STATUS) {
0 -> 2
......@@ -209,7 +224,28 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}
}.createDialogView().show()
} else {
//確認訂單
showLoading(context)
// 確認訂單
val third = true
if (third) {
// 如果是第三方物流,調用第三方接口
thirdSend(data, orderDetails, status, isPush, data.order_type, context, listener)
} else {
updateOrderAndPrint(data, status, isPush, orderDetails, context, listener)
}
}
} else {
// 自取的確認訂單
repository.updateSelfOrderStatus(data.Id.toString(), status.toString(), GsaCloudApplication.getRestaurantId(context).toString()).apply {
listener.invoke(success)
}
}
}, {
})
}
private suspend fun updateOrderAndPrint(data: OrderList.DataBeanX.DataBean, status: Int, isPush: Int, orderDetails: OrderDetails, context: Context, listener: (Boolean) -> Unit) {
updateOrderStatus(data.Id.toString(), "", status, "", "", isPush, data.order_type).apply {
if (status == 0 || status == 1 || status == 2) {
//確認送單
......@@ -239,23 +275,37 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}
}
}
/**
* 第三方派送
*/
private suspend fun thirdSend(data: OrderList.DataBeanX.DataBean, orderDetails: OrderDetails, status: Int, isPush: Int, orderType: Int, context: Context, listener: (Boolean) -> Unit) {
val third = ThirdItem()
orderDetails.data?.get(0)?.PRODUCT_NAME?.let {
for (i in it) {
val price = ThirdItem.ThirdItemItem.UntPrice(`val` = i.PRICE!!.toDouble())
val thirdItem = if (i.PRODUCT_NAME != null) {
ThirdItem.ThirdItemItem(name = i.PRODUCT_NAME!!, qty = 1, unt_price = price)
} else {
// 自取的確認訂單
repository.updateSelfOrderStatus(data.Id.toString(), status.toString(), GsaCloudApplication.getRestaurantId(context).toString()).apply {
listener.invoke(success)
ThirdItem.ThirdItemItem(name = "", qty = 1, unt_price = price)
}
third.add(thirdItem)
}
}
repository.thirdDelivery(data.Id.toString(), third).apply {
if (success) {
cancelDialogForLoading()
updateOrderAndPrint(data, status, isPush, orderDetails, context, listener)
} else {
ToastUtils.show(context, "訂單派送失敗")
}
}
}, {
})
}
suspend fun updateOrderStatus(orderId: String, selfOrderId: String?, status: Int, mobile: String?, sender: String?, isPush: Int, orderType: Int): UpdateOrderBean {
return repository.updateOrderStatus(orderId, selfOrderId, status, mobile, sender, isPush, orderType)
}
/**
* 選擇派送員
*/
......
......@@ -7,6 +7,7 @@ import android.os.Handler
import android.os.IBinder
import android.util.Log
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication
import com.gingersoft.gsa.other_order_mode.data.network.ServiceCreator
import com.google.gson.Gson
import okhttp3.*
import okio.ByteString
......@@ -22,7 +23,8 @@ class GetInfoUpdateService : Service() {
* 心跳检测时间
*/
private val HEART_BEAT_RATE = (15 * 1000).toLong()//每隔15秒进行一次对长连接的心跳检测
private val WEBSOCKET_HOST_AND_PORT = "https://hktest.ricepon.com:64377/ricepon-websocket/js/webSocketServer"//可替换为自己的主机名和端口号
private val WEBSOCKET_HOST_AND_PORT = "${ServiceCreator.ROOT_URL}/ricepon-websocket/js/webSocketServer"//可替换为自己的主机名和端口号
private var mWebSocket: WebSocket? = null
var postCallBack: PostCallBack? = null
......
......@@ -80,7 +80,6 @@ class OtherOrderActivity : BaseActivity() {
pageViewModel.getDeliveryInfo(this)
}
/**
* 加載餐廳營業信息
*/
......@@ -192,7 +191,6 @@ class OtherOrderActivity : BaseActivity() {
}
}
})
}
override fun onServiceDisconnected(name: ComponentName) {
......
......@@ -5,7 +5,6 @@ import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
......@@ -16,8 +15,6 @@ import com.gingersoft.gsa.other_order_mode.ui.adapter.OtherOrdersAdapter
import com.gingersoft.gsa.other_order_mode.ui.base.BaseFragment
import com.gingersoft.gsa.other_order_mode.util.InjectorUtil
import com.gingersoft.gsa.other_order_mode.util.OtherOrderUtils
import com.scwang.smartrefresh.layout.header.BezierRadarHeader
import com.scwang.smartrefresh.layout.header.FalsifyHeader
import kotlinx.android.synthetic.main.fragment_other_order.*
/**
......@@ -76,7 +73,6 @@ class PlaceholderFragment : BaseFragment() {
}
// 綁定當前fragment的數據項
pageViewModel.mOrderList[arguments?.getInt(INDEX)!!].observe(viewLifecycleOwner, Observer {
Log.e("eee", "刷新數據")
it.let { adapter.setData(it) }
})
......@@ -123,4 +119,5 @@ class PlaceholderFragment : BaseFragment() {
}
}
}
}
\ No newline at end of file
......@@ -80,6 +80,8 @@
android:id="@+id/cl_order_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical">
<TextView
......@@ -97,10 +99,10 @@
android:id="@+id/tv_total_amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:text="@{@string/amount_unit + MoneyUtil.sub(total_amount, data.discount_amount)}"
android:textColor="#BE1C42"
android:textSize="@dimen/dp_24"
android:layout_marginTop="@dimen/dp_5"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_total_amount_text" />
......@@ -145,7 +147,6 @@
android:layout_marginLeft="@dimen/other_order_info_dialog_content_marginLeft"
android:layout_marginTop="@dimen/dp_8"
android:gravity="right"
android:text="收貨人:"
android:visibility="@{isSelf?View.GONE:View.VISIBLE}"
app:layout_constraintLeft_toLeftOf="parent"
......@@ -157,7 +158,6 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/other_order_info_dialog_content_marginRight"
android:gravity="right"
android:text="@{data.rECEIVER}"
android:visibility="@{isSelf?View.GONE:View.VISIBLE}"
......@@ -172,7 +172,6 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/other_order_info_dialog_content_marginLeft"
android:layout_marginTop="@dimen/dp_10"
android:text="@{isSelf?@string/reserved_telephone:@string/receiving_telephone}"
app:layout_constraintLeft_toLeftOf="parent"
......@@ -184,7 +183,6 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/other_order_info_dialog_content_marginRight"
android:gravity="right"
android:text="@{data.pHONE}"
app:layout_constraintLeft_toRightOf="@id/tv_receive_phone_text"
......@@ -198,7 +196,6 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/other_order_info_dialog_content_marginLeft"
android:layout_marginTop="@dimen/dp_10"
android:gravity="right"
android:text="@{isSelf?@string/self_taking_time:@string/receiving_time}"
......@@ -241,13 +238,91 @@
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_receive_address_text" />
<TextView
android:id="@+id/tv_delivery_man_name_text"
style="@style/otherOrderReceiving_title_textStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/other_order_info_dialog_content_marginLeft"
android:layout_marginTop="@dimen/dp_10"
android:gravity="right"
android:text="@string/deliveryman"
android:visibility="@{data.delivery_man_name==null?View.GONE:View.VISIBLE}"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_receive_address_text" />
<TextView
android:id="@+id/tv_delivery_man_name"
style="@style/otherOrderReceiving_information_textStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/other_order_info_dialog_content_marginRight"
android:text="@{data.delivery_man_name}"
android:visibility="@{data.delivery_man_name==null?View.GONE:View.VISIBLE}"
app:layout_constraintLeft_toRightOf="@id/tv_delivery_man_name_text"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_delivery_man_name_text" />
<TextView
android:id="@+id/tv_delivery_man_phone_text"
style="@style/otherOrderReceiving_title_textStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/other_order_info_dialog_content_marginLeft"
android:layout_marginTop="@dimen/dp_10"
android:gravity="right"
android:text="@string/deliveryman_phone"
android:visibility="@{data.delivery_man_phone_num==null?View.GONE:View.VISIBLE}"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_delivery_man_name_text" />
<TextView
android:id="@+id/tv_delivery_man_phone"
style="@style/otherOrderReceiving_information_textStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/other_order_info_dialog_content_marginRight"
android:text="@{data.delivery_man_phone_num}"
android:visibility="@{data.delivery_man_phone_num==null?View.GONE:View.VISIBLE}"
app:layout_constraintLeft_toRightOf="@id/tv_delivery_man_phone_text"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_delivery_man_phone_text" />
<TextView
android:id="@+id/tv_delivery_num_text"
style="@style/otherOrderReceiving_title_textStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/other_order_info_dialog_content_marginLeft"
android:layout_marginTop="@dimen/dp_10"
android:gravity="right"
android:text="@string/logistics_number"
android:visibility="@{data.trkNo==null?View.GONE:View.VISIBLE}"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_delivery_man_phone_text" />
<TextView
android:id="@+id/tv_delivery_num"
style="@style/otherOrderReceiving_information_textStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/other_order_info_dialog_content_marginRight"
android:gravity="right"
android:text="@{data.trkNo}"
android:visibility="@{data.trkNo==null?View.GONE:View.VISIBLE}"
app:layout_constraintLeft_toRightOf="@id/tv_delivery_num_text"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_delivery_num_text" />
<View
android:id="@+id/line_info_bottom"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_10"
android:background="@color/color_ef"
app:layout_constraintTop_toBottomOf="@id/tv_receive_address" />
app:layout_constraintTop_toBottomOf="@id/tv_delivery_num_text" />
<TextView
android:id="@+id/tv_food_details_text"
......
......@@ -37,5 +37,7 @@
<string name="ricepon_order">ricepon訂單</string>
<string name="order_no">訂單編號:</string>
<string name="deliveryman">送貨員:</string>
<string name="deliveryman_phone">送貨員手機號:</string>
<string name="logistics_number">物流號:</string>
</resources>
......@@ -13,7 +13,6 @@
android:launchMode="singleTop"
android:theme="@style/print_TranslucentTheme" />
<activity android:name=".mvp.ui.activity.PrinterListActivity" />
<activity android:name=".mvp.ui.activity.PrinterAddActivity" />
......
//package com.joe.print.mvp.model.bean;
//
//import java.io.Serializable;
//
///**
// * Created by Wyh on 2020/1/16.
// * 打印機實體類
// */
//public class PrinterDeviceBean implements Serializable {
// private int id; //這個類是用來“新增”打印機的,不能有id。解析打印機列表用另一個類
//// private int uid;
// private int restaurantId;
// private String ip;
// private int port;
// private int type;
//// private long createTime;
//
// public PrinterDeviceBean() {
// }
//
// public PrinterDeviceBean(int id, int restaurantId, String ip, int port, int type) {
// this.id = id;
// this.restaurantId = restaurantId;
// this.ip = ip;
// this.port = port;
// this.type = type;
// }
//
// public PrinterDeviceBean(int restaurantId, String ip, int port, int type) {
// this.restaurantId = restaurantId;
// this.ip = ip;
// this.port = port;
// this.type = type;
// }
//
// public int getRestaurantId() {
// return restaurantId;
// }
//
// public void setRestaurantId(int restaurantId) {
// this.restaurantId = restaurantId;
// }
//
// public String getIp() {
// return ip;
// }
//
// public void setIp(String ip) {
// this.ip = ip;
// }
//
// public int getPort() {
// return port;
// }
//
// public void setPort(int port) {
// this.port = port;
// }
//
// public int getType() {
// return type;
// }
//
// public void setType(int type) {
// this.type = type;
// }
//
// public int getId() {
// return id;
// }
//
// public void setId(int id) {
// this.id = id;
// }
//
//// public int getUid() {
//// return uid;
//// }
////
//// public void setUid(int uid) {
//// this.uid = uid;
//// }
////
//// public long getCreateTime() {
//// return createTime;
//// }
////
//// public void setCreateTime(long createTime) {
//// this.createTime = createTime;
//// }
//}
......@@ -12,6 +12,8 @@ import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.RxLifecycleUtils;
import com.joe.print.mvp.contract.PrinterAddContract;
import java.util.Objects;
import javax.inject.Inject;
import io.reactivex.android.schedulers.AndroidSchedulers;
......@@ -87,7 +89,7 @@ public class PrinterAddPresenter extends BasePresenter<PrinterAddContract.Model,
* 更新打印機信息
*/
public void updatePrinterInfo(PrinterDeviceBean deviceBean) {
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), JsonUtils.toJson(deviceBean));
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), Objects.requireNonNull(JsonUtils.toJson(deviceBean)));
mModel.updatePrinter(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(""))
......
......@@ -333,7 +333,8 @@ public abstract class PrinterRoot implements PrintSocketHolder.OnStateChangedLis
}
private void defaultPrint(List<PrinterDeviceBean> printerDeviceBeans, List<Bitmap> bitmaps) {
if (Objects.equals(SPUtils.get(mContext, Constans.DEFAULT_PRINT_METHOD, ""), "")) {
String deftultPrint = (String) SPUtils.get(mContext, Constans.DEFAULT_PRINT_METHOD, "");
if (deftultPrint.equals("")) {
// 如果沒有默認打印位置,彈出彈窗讓用戶選擇是本機打印還是ip打印
new DialogUtils(mContext, R.layout.print_dialog_select_device) {
@Override
......@@ -369,7 +370,7 @@ public abstract class PrinterRoot implements PrintSocketHolder.OnStateChangedLis
});
}
}.createDialogView().show();
} else if (Objects.equals(SPUtils.get(mContext, Constans.DEFAULT_PRINT_METHOD, ""), Constans.LOCAL_PRINT)) {
} else if (deftultPrint.equals(Constans.LOCAL_PRINT)) {
// 默認打印方式為本地,進行本地打印
locationPrint(bitmaps, new PrintListener() {
@Override
......@@ -387,7 +388,7 @@ public abstract class PrinterRoot implements PrintSocketHolder.OnStateChangedLis
setPrintState(PrintActivity.FINISH);
}
});
} else if (Objects.equals(SPUtils.get(mContext, Constans.DEFAULT_PRINT_METHOD, ""), Constans.IP_PRINT)) {
} else if (deftultPrint.equals(Constans.IP_PRINT)) {
// 默認打印方式為ip打印,調用ip打印方法
// 獲取默認ip打印機,
if (!Objects.equals(SPUtils.get(mContext, PrintConstans.DEFAULT_PRINT_IP, ""), "")) {
......
......@@ -67,6 +67,7 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
public final static int FINISH = 1003;//關閉頁面
public final static int ADD_PRINT_DEVICE = 1004;//添加打印機
private static List<PrinterDeviceBean> printerDeviceBeans;
private String callId;
private PrinterRoot printerInIt;
......@@ -106,6 +107,7 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
initDialog();
PrinterDeviceBean deviceBean = (PrinterDeviceBean) getIntent().getSerializableExtra("deviceBean");
// if (type != PrinterRoot.PRINT_TEST) {
......@@ -117,6 +119,7 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
if (printerInIt != null) {
printerInIt.setmContext(mContext).setPrintListener(this);
}
printerInIt.print(printerDeviceBeans);
// if (type == PrinterRoot.PRINT_TEST) {
// if (deviceBean != null) {
// printerInIt.ipDevicePrint(deviceBean, printerInIt.getPrintBitmap(mContext).get(""));
......@@ -294,12 +297,12 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
@Override
public void showPrinterList(List<PrinterDeviceBean> deviceBeans) {
if (deviceBeans != null && deviceBeans.size() > 0) {
printerInIt.print(deviceBeans);
} else {
//沒有配置打印機
addPrintDevice();
}
// if (deviceBeans != null && deviceBeans.size() > 0) {
printerDeviceBeans = deviceBeans;
// } else {
// //沒有配置打印機
// addPrintDevice();
// }
}
private void addPrintDevice() {
......
......@@ -7,6 +7,7 @@ import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.TextView;
......@@ -55,7 +56,8 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
TextView printTest;
@BindView(R2.id.printer_type)
RadioGroup rgPaperType;
@BindView(R2.id.cb_set_default)
CheckBox mCbDefalute;
private PrinterDeviceBean printerDeviceBean;
private boolean isEditPrinter = false;//是否是編輯打印機
......@@ -79,15 +81,7 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
@Override
public void initData(@Nullable Bundle savedInstanceState) {
isDefault = getIntent().getBooleanExtra("isDefault", false);
// etPort.setInputType(EditorInfo.TYPE_CLASS_NUMBER);
String[] ips = new String[4];
// if (BuildConfig.DEBUG) {
// ips[0] = "192";
// ips[1] = "168";
// ips[2] = "1";
// ips[3] = "240";
// }
//如果不為空,則是編輯打印機,初始化信息
if (printerDeviceBean != null) {
mEdPrintName.setText(String.valueOf(printerDeviceBean.getName()));
......@@ -206,7 +200,7 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
} else {
deviceBean = new PrinterDeviceBean(mEdPrintName.getText().toString().trim(), 0, GsaCloudApplication.getRestaurantId(mContext), ipAddress.substring(0, ipAddress.lastIndexOf(".")), Integer.parseInt(port), paperType);
}
deviceBean.setStatus(mCbDefalute.isChecked() ? 2 : 1);
//添加打印機
if (v.getId() == R.id.printer_add) {
if (isEditPrinter && printerDeviceBean != null) {
......
package com.joe.print.mvp.ui.adapter;
import android.content.Context;
import android.view.View;
import android.widget.RadioButton;
import androidx.annotation.Nullable;
......@@ -29,35 +30,35 @@ public class PrinterListAdapter extends BaseQuickAdapter<PrinterDeviceBean, Base
public PrinterListAdapter(@Nullable List<PrinterDeviceBean> data, Context mContext) {
super(R.layout.printer_item, data);
this.mContext = mContext;
selectPrintIp = (String) SPUtils.get(mContext, PrintConstans.DEFAULT_PRINT_IP, "");
if ((Integer) SPUtils.get(mContext, PrintConstans.DEFAULT_PRINT_PORT, -1) != -1) {
selectPrintPort = (int) SPUtils.get(mContext, PrintConstans.DEFAULT_PRINT_PORT, 0);
}
paperType = (int) SPUtils.get(mContext, PrintConstans.DEFAULT_PRINT_PAPER, 0);
// selectPrintIp = (String) SPUtils.get(mContext, PrintConstans.DEFAULT_PRINT_IP, "");
// if ((Integer) SPUtils.get(mContext, PrintConstans.DEFAULT_PRINT_PORT, -1) != -1) {
// selectPrintPort = (int) SPUtils.get(mContext, PrintConstans.DEFAULT_PRINT_PORT, 0);
// }
// paperType = (int) SPUtils.get(mContext, PrintConstans.DEFAULT_PRINT_PAPER, 0);
}
@Override
protected void convert(BaseViewHolder helper, PrinterDeviceBean item) {
if (selectPosition == -1) {
//ip、端口、紙張類型也要一致才是默認打印機
if (selectPrintIp.equals(item.getIp()) && paperType == item.getType()) {
if (selectPrintPort != null && item.getPort() != null) {
if (selectPrintPort.equals(item.getPort())) {
((RadioButton) helper.getView(R.id.cb_printer_item)).setChecked(true);
selectPosition = helper.getAdapterPosition();
}
} else if (selectPrintPort == null && item.getPort() == null) {
((RadioButton) helper.getView(R.id.cb_printer_item)).setChecked(true);
selectPosition = helper.getAdapterPosition();
}
} else {
((RadioButton) helper.getView(R.id.cb_printer_item)).setChecked(false);
}
} else if (selectPosition == helper.getAdapterPosition()) {
((RadioButton) helper.getView(R.id.cb_printer_item)).setChecked(true);
} else {
((RadioButton) helper.getView(R.id.cb_printer_item)).setChecked(false);
}
// if (selectPosition == -1) {
// //ip、端口、紙張類型也要一致才是默認打印機
// if (selectPrintIp.equals(item.getIp()) && paperType == item.getType()) {
// if (selectPrintPort != null && item.getPort() != null) {
// if (selectPrintPort.equals(item.getPort())) {
// ((RadioButton) helper.getView(R.id.cb_printer_item)).setChecked(true);
// selectPosition = helper.getAdapterPosition();
// }
// } else if (selectPrintPort == null && item.getPort() == null) {
// ((RadioButton) helper.getView(R.id.cb_printer_item)).setChecked(true);
// selectPosition = helper.getAdapterPosition();
// }
// } else {
// ((RadioButton) helper.getView(R.id.cb_printer_item)).setChecked(false);
// }
// } else if (selectPosition == helper.getAdapterPosition()) {
// ((RadioButton) helper.getView(R.id.cb_printer_item)).setChecked(true);
// } else {
// ((RadioButton) helper.getView(R.id.cb_printer_item)).setChecked(false);
// }
helper.setText(R.id.tv_printer_name, item.getName() + "");
helper.setText(R.id.tv_printer_ip, String.format(mContext.getString(R.string.print_ip), item.getIp()));
......@@ -66,6 +67,8 @@ public class PrinterListAdapter extends BaseQuickAdapter<PrinterDeviceBean, Base
} else {
helper.setText(R.id.tv_printer_port, String.format(mContext.getString(R.string.print_port), item.getPort() + ""));
}
((RadioButton) helper.getView(R.id.cb_printer_item)).setChecked(item.getStatus() == 2);
helper.getView(R.id.tv_default_print).setVisibility(item.getStatus() == 2 ? View.VISIBLE : View.GONE);
// helper.setOnCheckedChangeListener(R.id.cb_printer_item, (buttonView, isChecked) -> {
// if (getRecyclerView() != null) {
// if (getRecyclerView().isComputingLayout()) {//如果recyclerView在刷新時
......@@ -75,15 +78,16 @@ public class PrinterListAdapter extends BaseQuickAdapter<PrinterDeviceBean, Base
// }
// }
// });
helper.setOnClickListener(R.id.cb_printer_item, v -> {
if (getRecyclerView() != null) {
if (getRecyclerView().isComputingLayout()) {//如果recyclerView在刷新時
getRecyclerView().post(() -> setSelectPrint(helper, item, true));
} else {
setSelectPrint(helper, item, true);
}
}
});
// helper.setOnClickListener(R.id.cb_printer_item, v -> {
// if (getRecyclerView() != null) {
// if (getRecyclerView().isComputingLayout()) {//如果recyclerView在刷新時
// getRecyclerView().post(() -> setSelectPrint(helper, item, true));
// } else {
// setSelectPrint(helper, item, true);
// }
// }
// });
}
/**
......
......@@ -68,7 +68,7 @@ public class LocalPrintFragment extends BaseFragment<LocalPrintPresenter> implem
SPUtils.put(mContext, Constans.DEFAULT_PRINT_METHOD, Constans.LOCAL_PRINT);
ivSetLocationPrintBtn.setChecked(true);
} else {
//如果默認打印方式為本地,修改為IP打印
//如果默認打印方式為IP,修改為IP打印
SPUtils.put(mContext, Constans.DEFAULT_PRINT_METHOD, Constans.IP_PRINT);
ivSetLocationPrintBtn.setChecked(false);
}
......
......@@ -3,6 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<com.qmuiteam.qmui.widget.QMUITopBar
......@@ -238,6 +239,32 @@
<include layout="@layout/include_horizontal_color_ccc_dividing_line" />
<LinearLayout
style="@style/print_add_printer_input_style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:text="設為默認"
android:textColor="@color/normal_color"
android:textSize="@dimen/dp_14"
android:textStyle="bold" />
<CheckBox
android:id="@+id/cb_set_default"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.7" />
</LinearLayout>
<include layout="@layout/include_horizontal_color_ccc_dividing_line" />
<TextView
android:id="@+id/print_test"
android:layout_width="match_parent"
......
......@@ -3,6 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<com.qmuiteam.qmui.widget.QMUITopBar
......@@ -27,5 +28,4 @@
android:layout_height="match_parent" />
</LinearLayout>
\ No newline at end of file
......@@ -11,6 +11,7 @@
android:id="@+id/cb_printer_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
......@@ -21,11 +22,25 @@
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/dp_10"
android:gravity="center"
android:text="asdasda"
android:textColor="@color/normal_color"
android:textSize="@dimen/dp_16"
app:layout_constraintLeft_toRightOf="@id/cb_printer_item"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_default_print"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_5"
android:background="@color/theme_color"
android:padding="@dimen/dp_1"
android:text="默認"
android:textColor="@color/white"
android:textSize="@dimen/dp_10"
app:layout_constraintLeft_toRightOf="@id/tv_printer_name"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_printer_ip"
......
......@@ -150,7 +150,7 @@ public class GsaCloudApplication extends BaseApplication {
}
} else {
//如果當前機型不是上面兩種,那麼設置默認打印為ip打印
SPUtils.put(this, Constans.DEFAULT_PRINT_METHOD, Constans.IP_PRINT);
// SPUtils.put(this, Constans.DEFAULT_PRINT_METHOD, Constans.IP_PRINT);
}
//需要單獨配置域名URL的,在接口上添加@Headers({"Domain-Name: settlement_report_server"}),不添加則是使用默認域名
setGlobalDomain();
......
......@@ -27,6 +27,7 @@ public class PrinterDeviceBean implements Serializable {
private Integer port;//端口
private int type;//打印機紙張類型 為1時是58mm,否則是88mm
private Integer status;//2為默認打印機,1為普通打印機
@Generated(hash = 626885316)
public PrinterDeviceBean() {
}
......@@ -49,9 +50,9 @@ public class PrinterDeviceBean implements Serializable {
this.type = type;
}
@Generated(hash = 2107713534)
@Generated(hash = 422399868)
public PrinterDeviceBean(int id, Long dbid, String name, Integer restaurantId, String ip, Integer port,
int type) {
int type, Integer status) {
this.id = id;
this.dbid = dbid;
this.name = name;
......@@ -59,6 +60,7 @@ public class PrinterDeviceBean implements Serializable {
this.ip = ip;
this.port = port;
this.type = type;
this.status = status;
}
public String getName() {
......@@ -116,4 +118,12 @@ public class PrinterDeviceBean implements Serializable {
public void setRestaurantId(Integer restaurantId) {
this.restaurantId = restaurantId;
}
public int getStatus() {
return this.status;
}
public void setStatus(Integer status) {
this.status = status;
}
}
......@@ -31,6 +31,7 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> {
public final static Property Ip = new Property(4, String.class, "ip", false, "IP");
public final static Property Port = new Property(5, Integer.class, "port", false, "PORT");
public final static Property Type = new Property(6, int.class, "type", false, "TYPE");
public final static Property Status = new Property(7, Integer.class, "status", false, "STATUS");
}
......@@ -52,7 +53,8 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> {
"\"RESTAURANT_ID\" INTEGER," + // 3: restaurantId
"\"IP\" TEXT," + // 4: ip
"\"PORT\" INTEGER," + // 5: port
"\"TYPE\" INTEGER NOT NULL );"); // 6: type
"\"TYPE\" INTEGER NOT NULL ," + // 6: type
"\"STATUS\" INTEGER);"); // 7: status
}
/** Drops the underlying database table. */
......@@ -91,6 +93,11 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> {
stmt.bindLong(6, port);
}
stmt.bindLong(7, entity.getType());
Integer status = entity.getStatus();
if (status != null) {
stmt.bindLong(8, status);
}
}
@Override
......@@ -123,6 +130,11 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> {
stmt.bindLong(6, port);
}
stmt.bindLong(7, entity.getType());
Integer status = entity.getStatus();
if (status != null) {
stmt.bindLong(8, status);
}
}
@Override
......@@ -139,7 +151,8 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> {
cursor.isNull(offset + 3) ? null : cursor.getInt(offset + 3), // restaurantId
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // ip
cursor.isNull(offset + 5) ? null : cursor.getInt(offset + 5), // port
cursor.getInt(offset + 6) // type
cursor.getInt(offset + 6), // type
cursor.isNull(offset + 7) ? null : cursor.getInt(offset + 7) // status
);
return entity;
}
......@@ -153,6 +166,7 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> {
entity.setIp(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
entity.setPort(cursor.isNull(offset + 5) ? null : cursor.getInt(offset + 5));
entity.setType(cursor.getInt(offset + 6));
entity.setStatus(cursor.isNull(offset + 7) ? null : cursor.getInt(offset + 7));
}
@Override
......
......@@ -38,6 +38,10 @@ class OrderDetails {
* RECEIVER : 張學友 先生
* TOTAL_AMOUNT : 88.0
*/
var trkNo: String? = null
var delivery_man_phone_num: String? = null
var deliveryMode: String? = null
var delivery_man_name: String? = null
var Order_ID: Int = 0
var NUMBER: Int = 0
var MEMBER_NAME: String? = null
......@@ -93,7 +97,6 @@ class OrderDetails {
* PRODUCT_NAME : Pho
* child : [{"odsId":"1654488","PRICE":"0.0","num":"2","pid":"1654487","PRODUCT_NAME":"Pho"},{"odsId":"1654489","PRICE":"0.0","num":"2","pid":"1654487","PRODUCT_NAME":"rice flour"},{"odsId":"1654490","PRICE":"0.0","num":"2","pid":"1654487","PRODUCT_NAME":"Tang Meng"}]
*/
var odsId: String? = null
var PRICE: String? = null
var num: String? = null
......@@ -101,6 +104,7 @@ class OrderDetails {
var PRODUCT_NAME: String? = null
var child: List<ChildBean>? = null
var printseting: String? = null
class ChildBean {
/**
* odsId : 1654488
......@@ -109,7 +113,6 @@ class OrderDetails {
* pid : 1654487
* PRODUCT_NAME : Pho
*/
var odsId: String? = null
var PRICE: String? = null
var num: String? = null
......
......@@ -79,7 +79,7 @@ public class LoadingDialog {
return mLoadingDialog;
}
public static Dialog showDialogForLoading(Activity context) {
public static Dialog showDialogForLoading(Context context) {
View view = LayoutInflater.from(context).inflate(R.layout.ui_dialog_loading, null);
TextView loadingText = view.findViewById(R.id.tv_loading_dialog_text);
loadingText.setText(context.getString(R.string.base_loading));
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/dp_3" />
<corners android:radius="@dimen/dp_8" />
<solid android:color="@color/theme_color" />
</shape>
\ No newline at end of file
......@@ -13,7 +13,6 @@
android:layout_height="wrap_content"
android:text="19" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
......@@ -10,6 +10,9 @@
<!--App主色调-->
<!-- <color name="theme_color">#BF1C42</color>-->
<color name="theme_color">#398BED</color>
<color name="transparent_sixty_theme_color">#99398BED</color>
<color name="normal_color">#333333</color>
<!-- 統一頁面背景色-->
<color name="theme_bg_color">#F0edf1</color>
......
......@@ -24,7 +24,7 @@
tools:replace="android:label">
<activity
android:name=".mvp.ui.activity.WelcomeActivity"
android:name=".mvp.ui.activity.mvp.ui.activity.WelcomeActivity"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......@@ -34,9 +34,11 @@
</intent-filter>
</activity>
<activity
android:name=".mvp.ui.activity.LoginActivity"
android:name=".mvp.ui.activity.mvp.ui.activity.LoginActivity"
android:launchMode="singleTop" />
<activity android:name=".mvp.ui.activity.SwitchServerActivity" />
<activity android:name=".mvp.ui.activity.mvp.ui.activity.SwitchServerActivity" />
<activity android:name=".mvp.ui.activity.mvp.ui.activity.RecoverPasswordActivity" />
<meta-data
android:name="com.gingersoft.gsa.cloud.globalconfig.GlobalConfiguration"
......
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.gingersoft.gsa.cloud.user.login">
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.gingersoft.gsa.cloud.user.login">
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
<application
android:name="com.gingersoft.gsa.cloud.base.application.GsaCloudApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
......@@ -19,9 +18,9 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".mvp.ui.activity.LoginActivity"/>
<activity android:name=".mvp.ui.activity.SwitchServerActivity" />
<activity android:name=".mvp.ui.activity.WelcomeActivity">
<activity android:name=".mvp.ui.activity.mvp.ui.activity.LoginActivity" />
<activity android:name=".mvp.ui.activity.mvp.ui.activity.SwitchServerActivity" />
<activity android:name=".mvp.ui.activity.mvp.ui.activity.WelcomeActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
......@@ -29,8 +28,8 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".mvp.ui.activity.LoginOutActivity" />
<activity android:name=".mvp.ui.activity.mvp.ui.activity.LoginOutActivity" />
<activity android:name=".mvp.ui.activity.mvp.ui.activity.RecoverPasswordActivity"/>
<meta-data
android:name="com.gingersoft.gsa.cloud.globalconfig.GlobalConfiguration"
android:value="ConfigModule" />
......@@ -40,6 +39,6 @@
<meta-data
android:name="design_height_in_dp"
android:value="540" />
</application>
</application>
</manifest>
\ No newline at end of file
......@@ -4,8 +4,8 @@ import com.billy.cc.core.component.CC;
import com.billy.cc.core.component.CCResult;
import com.billy.cc.core.component.CCUtil;
import com.billy.cc.core.component.IComponent;
import com.gingersoft.gsa.cloud.user.login.mvp.ui.activity.LoginActivity;
import com.gingersoft.gsa.cloud.user.login.mvp.ui.activity.SwitchServerActivity;
import com.gingersoft.gsa.cloud.user.login.mvp.ui.activity.mvp.ui.activity.LoginActivity;
import com.gingersoft.gsa.cloud.user.login.mvp.ui.activity.mvp.ui.activity.SwitchServerActivity;
public class ComponentLogin implements IComponent {
......
......@@ -8,7 +8,7 @@ import com.gingersoft.gsa.cloud.user.login.di.module.LoginModule;
import com.gingersoft.gsa.cloud.user.login.mvp.contract.LoginContract;
import com.jess.arms.di.scope.ActivityScope;
import com.gingersoft.gsa.cloud.user.login.mvp.ui.activity.LoginActivity;
import com.gingersoft.gsa.cloud.user.login.mvp.ui.activity.mvp.ui.activity.LoginActivity;
/**
......
......@@ -9,7 +9,7 @@ import com.gingersoft.gsa.cloud.user.login.di.module.SwitchServerModule;
import com.gingersoft.gsa.cloud.user.login.mvp.contract.SwitchServerContract;
import com.jess.arms.di.scope.ActivityScope;
import com.gingersoft.gsa.cloud.user.login.mvp.ui.activity.SwitchServerActivity;
import com.gingersoft.gsa.cloud.user.login.mvp.ui.activity.mvp.ui.activity.SwitchServerActivity;
/**
......
package com.gingersoft.gsa.cloud.user.login.di.component;
import com.gingersoft.gsa.cloud.user.login.di.module.WelcomeModule;
import com.gingersoft.gsa.cloud.user.login.mvp.ui.activity.WelcomeActivity;
import com.gingersoft.gsa.cloud.user.login.mvp.ui.activity.mvp.ui.activity.WelcomeActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.di.scope.ActivityScope;
......
......@@ -11,7 +11,7 @@ import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean;
import com.gingersoft.gsa.cloud.ui.bean.view.SectionTextItem;
import com.gingersoft.gsa.cloud.ui.widget.dialog.ChooseRestaurantDialog;
import com.gingersoft.gsa.cloud.user.login.mvp.presenter.BaseLoginPresenter;
import com.gingersoft.gsa.cloud.user.login.mvp.ui.activity.SwitchServerActivity;
import com.gingersoft.gsa.cloud.user.login.mvp.ui.activity.mvp.ui.activity.SwitchServerActivity;
import com.jess.arms.base.BaseActivity;
import java.util.ArrayList;
......
......@@ -5,21 +5,15 @@ import android.app.Application;
import android.content.Intent;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.utils.LanguageUtils;
import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean;
import com.gingersoft.gsa.cloud.user.login.R;
import com.gingersoft.gsa.cloud.user.login.mvp.contract.BaseLoginContract;
import com.gingersoft.gsa.cloud.user.login.mvp.ui.activity.LoginActivity;
import com.gingersoft.gsa.cloud.user.login.mvp.ui.activity.mvp.ui.activity.LoginActivity;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.ArmsUtils;
import com.jess.arms.utils.PermissionUtil;
import com.jess.arms.utils.RxLifecycleUtils;
import java.util.List;
import javax.inject.Inject;
import io.reactivex.android.schedulers.AndroidSchedulers;
......
......@@ -5,7 +5,7 @@ import android.app.Application;
import com.gingersoft.gsa.cloud.base.utils.LanguageUtils;
import com.gingersoft.gsa.cloud.user.login.R;
import com.gingersoft.gsa.cloud.user.login.mvp.contract.LoginContract;
import com.gingersoft.gsa.cloud.user.login.mvp.ui.activity.LoginActivity;
import com.gingersoft.gsa.cloud.user.login.mvp.ui.activity.mvp.ui.activity.LoginActivity;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
......
package com.gingersoft.gsa.cloud.user.login.mvp.ui.activity;
package com.gingersoft.gsa.cloud.user.login.mvp.ui.activity.mvp.ui.activity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
import com.alibaba.fastjson.JSON;
......
package com.gingersoft.gsa.cloud.user.login.mvp.ui.activity;
package com.gingersoft.gsa.cloud.user.login.mvp.ui.activity.mvp.ui.activity;
import android.content.Intent;
import android.os.Bundle;
......
package com.gingersoft.gsa.cloud.user.login.mvp.ui.activity;
package com.gingersoft.gsa.cloud.user.login.mvp.ui.activity.mvp.ui.activity;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
......
......@@ -6,7 +6,9 @@
android:background="@color/theme_white_color"
android:clipChildren="true"
android:fillViewport="true"
android:orientation="vertical">
android:orientation="vertical"
android:paddingLeft="@dimen/dp_18"
android:paddingRight="@dimen/dp_18">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
......@@ -20,40 +22,33 @@
android:layout_marginTop="80dp"
android:text="@string/user_login_welcome_login"
android:textColor="@color/user_login_title_color"
android:textSize="@dimen/title_text_size"
android:textSize="@dimen/dp_26"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/login_icon"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="10dp"
<TextView
android:id="@+id/tv_account_text"
style="@style/user_login_edit_title_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="100dp"
android:background="@color/theme_color"
android:padding="8dp"
android:src="@mipmap/ic_user"
android:text="賬戶"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/login_title" />
<EditText
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/ed_login_user_account"
style="@style/user_login_edit_style"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@null"
android:hint="請輸入賬戶"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:hint="請輸入賬戶名或手機號"
android:maxLength="16"
android:paddingLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_10"
android:singleLine="true"
android:textColor="@color/theme_333_color"
android:textColorHint="@color/user_login_edit_color"
android:textSize="@dimen/edit_text_size"
app:layout_constraintBottom_toBottomOf="@id/login_icon"
app:layout_constraintLeft_toRightOf="@id/login_icon"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/iv_clear_account"
app:layout_constraintTop_toTopOf="@id/login_icon" />
app:layout_constraintTop_toBottomOf="@id/tv_account_text" />
<ImageView
android:id="@+id/iv_clear_account"
......@@ -67,46 +62,53 @@
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/ed_login_user_account" />
<ImageView
android:id="@+id/iv_login_pwd_icon"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:background="@color/theme_color"
android:padding="8dp"
android:src="@mipmap/ic_pwd"
app:layout_constraintLeft_toLeftOf="parent"
<View
android:id="@+id/line_account"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_0_5"
android:background="@color/user_login_line_color"
app:layout_constraintTop_toBottomOf="@id/ed_login_user_account" />
<EditText
<TextView
android:id="@+id/tv_password_text"
style="@style/user_login_edit_title_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_20"
android:text="密碼"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/line_account" />
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/ed_login_user_pwd"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#00000000"
android:gravity="center_vertical"
android:hint="請輸入密碼"
android:layout_height="wrap_content"
style="@style/user_login_edit_style"
android:layout_marginTop="@dimen/dp_5"
android:hint="輸入6~20個字符"
android:inputType="textPassword"
android:maxLength="16"
android:paddingLeft="@dimen/dp_10"
android:maxLength="20"
android:paddingRight="@dimen/dp_10"
android:singleLine="true"
android:textColor="@color/theme_333_color"
android:textColorHint="@color/user_login_edit_color"
android:textSize="@dimen/edit_text_size"
app:layout_constraintBottom_toBottomOf="@id/iv_login_pwd_icon"
app:layout_constraintLeft_toRightOf="@id/iv_login_pwd_icon"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/ic_look_pwd"
app:layout_constraintTop_toTopOf="@id/iv_login_pwd_icon" />
app:layout_constraintTop_toBottomOf="@id/tv_password_text" />
<View
android:id="@+id/line_password"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_0_5"
android:background="@color/user_login_line_color"
app:layout_constraintTop_toBottomOf="@id/ed_login_user_pwd" />
<CheckBox
android:id="@+id/rb_auto_login"
android:layout_width="@dimen/dp_30"
android:layout_height="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_15"
app:layout_constraintLeft_toLeftOf="@id/iv_login_pwd_icon"
app:layout_constraintTop_toBottomOf="@id/ed_login_user_pwd" />
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/line_password" />
<TextView
android:id="@+id/tv_auto_login_text"
......@@ -126,9 +128,8 @@
android:layout_width="@dimen/dp_30"
android:layout_height="@dimen/dp_30"
android:layout_marginLeft="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_15"
app:layout_constraintLeft_toRightOf="@id/tv_auto_login_text"
app:layout_constraintTop_toBottomOf="@id/ed_login_user_pwd" />
app:layout_constraintTop_toTopOf="@id/rb_auto_login" />
<TextView
android:id="@+id/tv_remember_pwd_text"
......@@ -169,40 +170,27 @@
android:id="@+id/tv_forget_pwd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="忘記密碼?"
android:textSize="14dp"
android:visibility="invisible"
app:layout_constraintLeft_toLeftOf="parent"
android:text="找回密碼"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_16"
android:visibility="visible"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/rb_remember_password" />
app:layout_constraintBottom_toBottomOf="@id/rb_auto_login"
app:layout_constraintTop_toBottomOf="@id/rb_auto_login"
app:layout_constraintTop_toTopOf="@id/rb_auto_login" />
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id="@+id/tv_gsa_user_login"
android:id="@+id/btn_gsa_user_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp"
android:layout_marginRight="10dp"
android:background="@drawable/shape_app_btn"
android:layout_marginBottom="@dimen/dp_20"
android:background="@drawable/selector_login_btn"
android:gravity="center"
android:padding="10dp"
android:text="登錄"
android:textColor="#fff"
android:textSize="16dp"
app:layout_constraintTop_toBottomOf="@id/tv_forget_pwd" />
android:textColor="@color/white"
android:textSize="@dimen/dp_16"
app:layout_constraintBottom_toBottomOf="parent" />
<TextView
android:id="@+id/tv_app_version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_10"
android:text="v1.0"
android:textSize="@dimen/sp_16"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
......@@ -2,4 +2,5 @@
<resources>
<color name="user_login_title_color">@color/theme_333_color</color>
<color name="user_login_edit_color">@color/theme_hint_color</color>
<color name="user_login_line_color">#E4E4E4</color>
</resources>
<resources>
<!-- 登陸頁面輸入框標題字體樣式-->
<style name="user_login_edit_title_style">
<item name="android:textSize">@dimen/dp_14</item>
<item name="android:textColor">@color/color_3c</item>
</style>
<style name="user_login_edit_style">
<item name="android:textSize">@dimen/dp_18</item>
<item name="android:textColor">@color/theme_333_color</item>
<item name="android:textColorHint">@color/user_login_edit_color</item>
<item name="android:background">@null</item>
<item name="android:paddingTop">@dimen/dp_8</item>
<item name="android:paddingBottom">@dimen/dp_8</item>
<item name="android:maxLines">1</item>
</style>
</resources>
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