Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
Y
YPPos
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
朱世闯
YPPos
Commits
b1819aac
Commit
b1819aac
authored
Dec 28, 2021
by
UIUANG\Zsc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改DT40和高版本的bug
parent
21d3c2dd
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
131 additions
and
49 deletions
+131
-49
build.gradle
app/build.gradle
+2
-2
output-metadata.json
app/release/output-metadata.json
+3
-3
yppos_v100017-1.00.017-release-2021-12-28.apk
app/release/yppos_v100017-1.00.017-release-2021-12-28.apk
+0
-0
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+1
-0
ApiResponse.kt
...rc/main/java/com/ypsx/yppos/http/data/bean/ApiResponse.kt
+1
-1
AppVersionResponse.kt
.../java/com/ypsx/yppos/http/data/bean/AppVersionResponse.kt
+3
-0
CashPaySuccess.kt
...main/java/com/ypsx/yppos/http/data/bean/CashPaySuccess.kt
+3
-0
InsertOrderProductDTO.kt
...va/com/ypsx/yppos/http/data/bean/InsertOrderProductDTO.kt
+0
-2
LoginResponse.kt
.../main/java/com/ypsx/yppos/http/data/bean/LoginResponse.kt
+3
-0
OptionsResponse.kt
...ain/java/com/ypsx/yppos/http/data/bean/OptionsResponse.kt
+3
-0
PluRelation.kt
...rc/main/java/com/ypsx/yppos/http/data/bean/PluRelation.kt
+4
-1
PosConfigResponse.kt
...n/java/com/ypsx/yppos/http/data/bean/PosConfigResponse.kt
+3
-0
SimplePosCommandResponse.kt
...com/ypsx/yppos/http/data/bean/SimplePosCommandResponse.kt
+3
-0
UploadOrderResponse.kt
...java/com/ypsx/yppos/http/data/bean/UploadOrderResponse.kt
+3
-0
OrderStatusEnum.kt
...n/java/com/ypsx/yppos/http/data/entity/OrderStatusEnum.kt
+3
-0
PosCommandStatus.kt
.../java/com/ypsx/yppos/http/data/entity/PosCommandStatus.kt
+3
-0
PosCommandType.kt
...in/java/com/ypsx/yppos/http/data/entity/PosCommandType.kt
+3
-0
PosPayMethod.kt
...main/java/com/ypsx/yppos/http/data/entity/PosPayMethod.kt
+3
-0
PosProductStyle.kt
...n/java/com/ypsx/yppos/http/data/entity/PosProductStyle.kt
+3
-0
PosShelvesStatus.kt
.../java/com/ypsx/yppos/http/data/entity/PosShelvesStatus.kt
+1
-1
PosStatus.kt
...rc/main/java/com/ypsx/yppos/http/data/entity/PosStatus.kt
+3
-0
ProductActivityType.kt
...va/com/ypsx/yppos/http/data/entity/ProductActivityType.kt
+3
-0
ApplyPosMachineRequest.kt
...om/ypsx/yppos/http/data/request/ApplyPosMachineRequest.kt
+0
-12
PosLoginRequest.kt
.../java/com/ypsx/yppos/http/data/request/PosLoginRequest.kt
+3
-0
RefreshTokenRequest.kt
...a/com/ypsx/yppos/http/data/request/RefreshTokenRequest.kt
+3
-0
ReplyCommandListRequest.kt
...m/ypsx/yppos/http/data/request/ReplyCommandListRequest.kt
+3
-0
LogService.kt
app/src/main/java/com/ypsx/yppos/jobs/LogService.kt
+1
-0
SyncProductService.kt
app/src/main/java/com/ypsx/yppos/jobs/SyncProductService.kt
+1
-0
PosBuyRepository.kt
...n/java/com/ypsx/yppos/room/repository/PosBuyRepository.kt
+1
-0
OrderProductAdapter.kt
...ain/java/com/ypsx/yppos/ui/adapter/OrderProductAdapter.kt
+4
-1
ChangeQuantityPopupWindow.kt
...java/com/ypsx/yppos/ui/popup/ChangeQuantityPopupWindow.kt
+21
-11
PrintUtils.kt
app/src/main/java/com/ypsx/yppos/utils/PrintUtils.kt
+12
-4
RequestMainViewModel.kt
.../com/ypsx/yppos/viewmodel/request/RequestMainViewModel.kt
+25
-10
popup_change_quantity.xml
app/src/main/res/layout/popup_change_quantity.xml
+1
-1
ServerHostDialogExt.kt
.../main/java/com/ypsx/common/app/ext/ServerHostDialogExt.kt
+2
-0
No files found.
app/build.gradle
View file @
b1819aac
...
@@ -15,8 +15,8 @@ android {
...
@@ -15,8 +15,8 @@ android {
applicationId
"com.ypsx.yppos"
applicationId
"com.ypsx.yppos"
minSdkVersion
21
minSdkVersion
21
targetSdkVersion
30
targetSdkVersion
30
versionCode
10001
4
versionCode
10001
7
versionName
"1.00.01
4
"
versionName
"1.00.01
7
"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
}
}
...
...
app/release/output-metadata.json
View file @
b1819aac
...
@@ -10,9 +10,9 @@
...
@@ -10,9 +10,9 @@
{
{
"type"
:
"SINGLE"
,
"type"
:
"SINGLE"
,
"filters"
:
[],
"filters"
:
[],
"versionCode"
:
10001
4
,
"versionCode"
:
10001
7
,
"versionName"
:
"1.00.01
4
"
,
"versionName"
:
"1.00.01
7
"
,
"outputFile"
:
"yppos_v10001
4-1.00.014-release-2021-12-22
.apk"
"outputFile"
:
"yppos_v10001
7-1.00.017-release-2021-12-28
.apk"
}
}
]
]
}
}
\ No newline at end of file
app/release/yppos_v10001
4-1.00.014-release-2021-12-22
.apk
→
app/release/yppos_v10001
7-1.00.017-release-2021-12-28
.apk
View file @
b1819aac
No preview for this file type
app/src/main/AndroidManifest.xml
View file @
b1819aac
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
<uses-permission
android:name=
"android.permission.READ_PHONE_STATE"
/>
<uses-permission
android:name=
"android.permission.READ_PHONE_STATE"
/>
<uses-permission
android:name=
"android.permission.READ_PRIVILEGED_PHONE_STATE "
/>
<uses-permission
android:name=
"android.permission.READ_PRIVILEGED_PHONE_STATE "
/>
<uses-permission
android:name=
"android.permission.REQUEST_INSTALL_PACKAGES"
/>
<uses-permission
android:name=
"android.permission.REQUEST_INSTALL_PACKAGES"
/>
<uses-permission
android:name=
"android.permission.FOREGROUND_SERVICE"
/>
<application
<application
android:name=
".PosApp"
android:name=
".PosApp"
...
...
app/src/main/java/com/ypsx/yppos/http/data/bean/ApiResponse.kt
View file @
b1819aac
...
@@ -8,7 +8,7 @@ import com.ypsx.base.network.BaseResponse
...
@@ -8,7 +8,7 @@ import com.ypsx.base.network.BaseResponse
* 描述 :服务器返回数据的基类
* 描述 :服务器返回数据的基类
* 如果你的项目中有基类,那美滋滋,可以继承BaseResponse,请求时框架可以帮你自动脱壳,自动判断是否请求成功,怎么做:
* 如果你的项目中有基类,那美滋滋,可以继承BaseResponse,请求时框架可以帮你自动脱壳,自动判断是否请求成功,怎么做:
* 1.继承 BaseResponse
* 1.继承 BaseResponse
* 2.重写isSucces 方法,编写你的业务需求,根据自己的条件判断数据是否请求成功
* 2.重写isSucces
s
方法,编写你的业务需求,根据自己的条件判断数据是否请求成功
* 3.重写 getResponseCode、getResponseData、getResponseMsg方法,传入你的 code data msg
* 3.重写 getResponseCode、getResponseData、getResponseMsg方法,传入你的 code data msg
*/
*/
data class
ApiResponse
<
T
>(
data class
ApiResponse
<
T
>(
...
...
app/src/main/java/com/ypsx/yppos/http/data/bean/AppVersionResponse.kt
View file @
b1819aac
package
com.ypsx.yppos.http.data.bean
package
com.ypsx.yppos.http.data.bean
/**
* 版本信息
*/
data class
AppVersionResponse
(
data class
AppVersionResponse
(
val
desciption
:
String
?
=
null
,
val
desciption
:
String
?
=
null
,
val
downloadUrl
:
String
,
val
downloadUrl
:
String
,
...
...
app/src/main/java/com/ypsx/yppos/http/data/bean/CashPaySuccess.kt
View file @
b1819aac
package
com.ypsx.yppos.http.data.bean
package
com.ypsx.yppos.http.data.bean
/**
* 付款成功
*/
data class
CashPaySuccess
(
data class
CashPaySuccess
(
var
payAmount
:
Double
,
var
payAmount
:
Double
,
var
changeAmount
:
Double
,
var
changeAmount
:
Double
,
...
...
app/src/main/java/com/ypsx/yppos/http/data/bean/InsertOrderProductDTO.kt
View file @
b1819aac
package
com.ypsx.yppos.http.data.bean
package
com.ypsx.yppos.http.data.bean
data class
InsertOrderProductDTO
(
data class
InsertOrderProductDTO
(
var
activityPrice
:
Double
=
0.0
,
var
activityPrice
:
Double
=
0.0
,
var
activitys
:
List
<
ActivityInfoDTO
>?
=
null
,
var
activitys
:
List
<
ActivityInfoDTO
>?
=
null
,
//成交价
//成交价
...
...
app/src/main/java/com/ypsx/yppos/http/data/bean/LoginResponse.kt
View file @
b1819aac
package
com.ypsx.yppos.http.data.bean
package
com.ypsx.yppos.http.data.bean
/**
* 登录信息
*/
data class
LoginResponse
(
data class
LoginResponse
(
var
accessToken
:
String
,
var
accessToken
:
String
,
var
currentTime
:
String
,
var
currentTime
:
String
,
...
...
app/src/main/java/com/ypsx/yppos/http/data/bean/OptionsResponse.kt
View file @
b1819aac
package
com.ypsx.yppos.http.data.bean
package
com.ypsx.yppos.http.data.bean
/**
* 配置信息
*/
data class
OptionsResponse
(
data class
OptionsResponse
(
var
id
:
String
,
var
id
:
String
,
val
key
:
String
,
val
key
:
String
,
...
...
app/src/main/java/com/ypsx/yppos/http/data/bean/PluRelation.kt
View file @
b1819aac
package
com.ypsx.yppos.http.data.bean
package
com.ypsx.yppos.http.data.bean
class
PluRelation
(
var
plu
:
String
,
var
id
:
String
)
/**
* 扫描13位或18条码对应关系
*/
data class
PluRelation
(
var
plu
:
String
,
var
id
:
String
)
app/src/main/java/com/ypsx/yppos/http/data/bean/PosConfigResponse.kt
View file @
b1819aac
package
com.ypsx.yppos.http.data.bean
package
com.ypsx.yppos.http.data.bean
/**
* 获取pos配置
*/
data class
PosConfigResponse
(
data class
PosConfigResponse
(
//小票底部文字,最多144个汉字
//小票底部文字,最多144个汉字
var
ticketBottom
:
String
?
=
null
,
var
ticketBottom
:
String
?
=
null
,
...
...
app/src/main/java/com/ypsx/yppos/http/data/bean/SimplePosCommandResponse.kt
View file @
b1819aac
package
com.ypsx.yppos.http.data.bean
package
com.ypsx.yppos.http.data.bean
/**
* pos命令
*/
data class
SimplePosCommandResponse
(
data class
SimplePosCommandResponse
(
//命令ID
//命令ID
var
id
:
Long
,
var
id
:
Long
,
...
...
app/src/main/java/com/ypsx/yppos/http/data/bean/UploadOrderResponse.kt
View file @
b1819aac
package
com.ypsx.yppos.http.data.bean
package
com.ypsx.yppos.http.data.bean
/**
* 上传订单返回的结果
*/
data class
UploadOrderResponse
(
data class
UploadOrderResponse
(
// 错误消息
// 错误消息
var
errorMessage
:
String
,
var
errorMessage
:
String
,
...
...
app/src/main/java/com/ypsx/yppos/http/data/entity/OrderStatusEnum.kt
View file @
b1819aac
package
com.ypsx.yppos.http.data.entity
package
com.ypsx.yppos.http.data.entity
/**
* 订单状态
*/
enum
class
OrderStatusEnum
{
enum
class
OrderStatusEnum
{
//待付款
//待付款
CREATED
,
CREATED
,
...
...
app/src/main/java/com/ypsx/yppos/http/data/entity/PosCommandStatus.kt
View file @
b1819aac
package
com.ypsx.yppos.http.data.entity
package
com.ypsx.yppos.http.data.entity
/**
* pos命令状态
*/
enum
class
PosCommandStatus
{
enum
class
PosCommandStatus
{
CREATE
,
CANCELED
,
PROCESSING
,
FAILED
,
SUCCESS
CREATE
,
CANCELED
,
PROCESSING
,
FAILED
,
SUCCESS
}
}
app/src/main/java/com/ypsx/yppos/http/data/entity/PosCommandType.kt
View file @
b1819aac
package
com.ypsx.yppos.http.data.entity
package
com.ypsx.yppos.http.data.entity
/**
* pos命令类型
*/
enum
class
PosCommandType
{
enum
class
PosCommandType
{
UPLOAD_LOG
,
UPLOAD_DB
UPLOAD_LOG
,
UPLOAD_DB
}
}
\ No newline at end of file
app/src/main/java/com/ypsx/yppos/http/data/entity/PosPayMethod.kt
View file @
b1819aac
package
com.ypsx.yppos.http.data.entity
package
com.ypsx.yppos.http.data.entity
/**
* 付款方式
*/
enum
class
PosPayMethod
{
enum
class
PosPayMethod
{
CARDPAY
,
CARDPAY
,
//扫码聚合支付
//扫码聚合支付
...
...
app/src/main/java/com/ypsx/yppos/http/data/entity/PosProductStyle.kt
View file @
b1819aac
package
com.ypsx.yppos.http.data.entity
package
com.ypsx.yppos.http.data.entity
/**
* 商品规格
*/
enum
class
PosProductStyle
{
enum
class
PosProductStyle
{
/**
/**
*单品
*单品
...
...
app/src/main/java/com/ypsx/yppos/http/data/entity/PosShelvesStatus.kt
View file @
b1819aac
...
@@ -2,7 +2,7 @@ package com.ypsx.yppos.http.data.entity
...
@@ -2,7 +2,7 @@ package com.ypsx.yppos.http.data.entity
/**
/**
* string
* string
POS门店商品状态
POS门店商品
上下架
状态
*/
*/
enum
class
PosShelvesStatus
{
enum
class
PosShelvesStatus
{
ON
,
OFF
,
DELETED
ON
,
OFF
,
DELETED
...
...
app/src/main/java/com/ypsx/yppos/http/data/entity/PosStatus.kt
View file @
b1819aac
package
com.ypsx.yppos.http.data.entity
package
com.ypsx.yppos.http.data.entity
/**
* pos机状态
*/
enum
class
PosStatus
{
enum
class
PosStatus
{
/**
/**
* 申请中
* 申请中
...
...
app/src/main/java/com/ypsx/yppos/http/data/entity/ProductActivityType.kt
View file @
b1819aac
package
com.ypsx.yppos.http.data.entity
package
com.ypsx.yppos.http.data.entity
/**
* 商品活动状态
*/
enum
class
ProductActivityType
{
enum
class
ProductActivityType
{
UNKNOWN_ACTIVITY_TYPE
,
TIMESHARE_ACTIVITY
,
OTHER_ACTIVITY
,
UNRECOGNIZED
UNKNOWN_ACTIVITY_TYPE
,
TIMESHARE_ACTIVITY
,
OTHER_ACTIVITY
,
UNRECOGNIZED
}
}
\ No newline at end of file
app/src/main/java/com/ypsx/yppos/http/data/request/ApplyPosMachineRequest.kt
View file @
b1819aac
...
@@ -21,16 +21,4 @@ data class ApplyPosMachineRequest(
...
@@ -21,16 +21,4 @@ data class ApplyPosMachineRequest(
//安装目录
//安装目录
var
installationDirectory
:
String
var
installationDirectory
:
String
// {
// "brand": "string",
// "installDiskCapacity": "string",
// "installationDirectory": "string",
// "ip": "string",
// "macAddress": "string",
// "port": 0,
// "remark": "string",
// "specification": "string",
// "version": "string"
// }
)
)
app/src/main/java/com/ypsx/yppos/http/data/request/PosLoginRequest.kt
View file @
b1819aac
package
com.ypsx.yppos.http.data.request
package
com.ypsx.yppos.http.data.request
/**
* pos机登录
*/
data class
PosLoginRequest
(
data class
PosLoginRequest
(
//门店id
//门店id
var
workingOrgId
:
String
,
var
workingOrgId
:
String
,
...
...
app/src/main/java/com/ypsx/yppos/http/data/request/RefreshTokenRequest.kt
View file @
b1819aac
package
com.ypsx.yppos.http.data.request
package
com.ypsx.yppos.http.data.request
/**
* 刷新token
*/
data class
RefreshTokenRequest
(
data class
RefreshTokenRequest
(
var
refreshToken
:
String
var
refreshToken
:
String
)
)
app/src/main/java/com/ypsx/yppos/http/data/request/ReplyCommandListRequest.kt
View file @
b1819aac
package
com.ypsx.yppos.http.data.request
package
com.ypsx.yppos.http.data.request
/**
* 回复命令
*/
data class
ReplyCommandListRequest
(
data class
ReplyCommandListRequest
(
var
commandIds
:
List
<
String
>
var
commandIds
:
List
<
String
>
)
)
app/src/main/java/com/ypsx/yppos/jobs/LogService.kt
View file @
b1819aac
...
@@ -53,6 +53,7 @@ class LogService : Service() {
...
@@ -53,6 +53,7 @@ class LogService : Service() {
HttpRequestCoroutine
.
uploadLog
(
posConfig
?.
code
!!
)
HttpRequestCoroutine
.
uploadLog
(
posConfig
?.
code
!!
)
}
}
}
catch
(
e
:
Exception
)
{
}
catch
(
e
:
Exception
)
{
job
?.
cancel
()
e
.
message
?.
eXLog
()
e
.
message
?.
eXLog
()
}
}
...
...
app/src/main/java/com/ypsx/yppos/jobs/SyncProductService.kt
View file @
b1819aac
...
@@ -55,6 +55,7 @@ class SyncProductService: Service() {
...
@@ -55,6 +55,7 @@ class SyncProductService: Service() {
val
storeId
=
posConfig
?.
storeId
!!
val
storeId
=
posConfig
?.
storeId
!!
HttpRequestCoroutine
.
syncProduct
(
storeId
)
HttpRequestCoroutine
.
syncProduct
(
storeId
)
}
catch
(
e
:
Exception
)
{
}
catch
(
e
:
Exception
)
{
job
?.
cancel
()
e
.
message
?.
eXLog
()
e
.
message
?.
eXLog
()
}
}
}
}
...
...
app/src/main/java/com/ypsx/yppos/room/repository/PosBuyRepository.kt
View file @
b1819aac
...
@@ -66,6 +66,7 @@ class PosBuyRepository {
...
@@ -66,6 +66,7 @@ class PosBuyRepository {
getPosBuyDao
().
insert
(
posBuy
)
getPosBuyDao
().
insert
(
posBuy
)
for
(
payment
in
orderResponse
.
payments
)
{
for
(
payment
in
orderResponse
.
payments
)
{
payment
.
payCode
=
authCode
payment
.
payCode
=
authCode
payment
.
toJson
().
dXLog
()
getPosBuyPaymentDao
().
insert
(
payment
)
getPosBuyPaymentDao
().
insert
(
payment
)
}
}
orderResponse
.
products
.
toJson
().
dXLog
()
orderResponse
.
products
.
toJson
().
dXLog
()
...
...
app/src/main/java/com/ypsx/yppos/ui/adapter/OrderProductAdapter.kt
View file @
b1819aac
...
@@ -9,12 +9,15 @@ import com.ypsx.yppos.R
...
@@ -9,12 +9,15 @@ import com.ypsx.yppos.R
import
com.ypsx.yppos.http.data.bean.InsertOrderProductDTO
import
com.ypsx.yppos.http.data.bean.InsertOrderProductDTO
import
com.ypsx.yppos.http.data.entity.PosProductStyle
import
com.ypsx.yppos.http.data.entity.PosProductStyle
import
com.ypsx.yppos.utils.RoundBackgroundColorSpan
import
com.ypsx.yppos.utils.RoundBackgroundColorSpan
import
java.text.DecimalFormat
class
OrderProductAdapter
(
data
:
ArrayList
<
InsertOrderProductDTO
>)
:
class
OrderProductAdapter
(
data
:
ArrayList
<
InsertOrderProductDTO
>)
:
BaseQuickAdapter
<
InsertOrderProductDTO
,
BaseViewHolder
>(
BaseQuickAdapter
<
InsertOrderProductDTO
,
BaseViewHolder
>(
R
.
layout
.
item_pos_product
,
data
R
.
layout
.
item_pos_product
,
data
)
{
)
{
private
var
decimalFormat
:
DecimalFormat
=
DecimalFormat
(
"###################.###########"
)
override
fun
convert
(
holder
:
BaseViewHolder
,
item
:
InsertOrderProductDTO
)
{
override
fun
convert
(
holder
:
BaseViewHolder
,
item
:
InsertOrderProductDTO
)
{
item
.
run
{
item
.
run
{
when
(
style
)
{
when
(
style
)
{
...
@@ -53,7 +56,7 @@ class OrderProductAdapter(data: ArrayList<InsertOrderProductDTO>) :
...
@@ -53,7 +56,7 @@ class OrderProductAdapter(data: ArrayList<InsertOrderProductDTO>) :
PosProductStyle
.
WEIGHT
.
name
->
{
PosProductStyle
.
WEIGHT
.
name
->
{
holder
.
setGone
(
R
.
id
.
ll_count
,
false
)
holder
.
setGone
(
R
.
id
.
ll_count
,
false
)
holder
.
setGone
(
R
.
id
.
tv_weight
,
true
)
holder
.
setGone
(
R
.
id
.
tv_weight
,
true
)
holder
.
setText
(
R
.
id
.
tv_count
,
"$quantity"
)
holder
.
setText
(
R
.
id
.
tv_count
,
decimalFormat
.
format
(
quantity
)
)
}
}
else
->
{
else
->
{
...
...
app/src/main/java/com/ypsx/yppos/ui/popup/ChangeQuantityPopupWindow.kt
View file @
b1819aac
...
@@ -18,6 +18,7 @@ import com.ypsx.yppos.utils.toast
...
@@ -18,6 +18,7 @@ import com.ypsx.yppos.utils.toast
import
com.ypsx.yppos.viewmodel.state.ChangeQuantityViewModel
import
com.ypsx.yppos.viewmodel.state.ChangeQuantityViewModel
import
razerdp.basepopup.BasePopupWindow
import
razerdp.basepopup.BasePopupWindow
import
java.math.BigDecimal
import
java.math.BigDecimal
import
java.text.DecimalFormat
class
ChangeQuantityPopupWindow
(
context
:
Context
)
:
BasePopupWindow
(
context
)
{
class
ChangeQuantityPopupWindow
(
context
:
Context
)
:
BasePopupWindow
(
context
)
{
lateinit
var
bind
:
PopupChangeQuantityBinding
lateinit
var
bind
:
PopupChangeQuantityBinding
...
@@ -25,6 +26,7 @@ class ChangeQuantityPopupWindow(context: Context) : BasePopupWindow(context) {
...
@@ -25,6 +26,7 @@ class ChangeQuantityPopupWindow(context: Context) : BasePopupWindow(context) {
var
onChangeClick
:
OnChangeClick
?
=
null
var
onChangeClick
:
OnChangeClick
?
=
null
private
var
posProduct
:
PosProduct
?
=
null
private
var
posProduct
:
PosProduct
?
=
null
private
var
insertOrderProductDTO
:
InsertOrderProductDTO
?=
null
private
var
insertOrderProductDTO
:
InsertOrderProductDTO
?=
null
private
var
decimalFormat
:
DecimalFormat
=
DecimalFormat
(
"###################.###########"
)
...
@@ -92,15 +94,14 @@ class ChangeQuantityPopupWindow(context: Context) : BasePopupWindow(context) {
...
@@ -92,15 +94,14 @@ class ChangeQuantityPopupWindow(context: Context) : BasePopupWindow(context) {
}
}
bind
.
vm
?.
purchaseQuantityName
?.
set
(
purchaseQuantityName
)
bind
.
vm
?.
purchaseQuantityName
?.
set
(
purchaseQuantityName
)
bind
.
vm
?.
purchaseQuantity
?.
set
(
spec
)
bind
.
vm
?.
purchaseQuantity
?.
set
(
spec
)
bind
.
etPurchaseQuantity
.
setText
(
spec
)
//
bind.etPurchaseQuantity.setText(spec)
val
length
=
bind
.
etPurchaseQuantity
.
text
.
toString
().
length
//
val length = bind.etPurchaseQuantity.text.toString().length
bind
.
etPurchaseQuantity
.
setSelection
(
length
)
//
bind.etPurchaseQuantity.setSelection(length)
bind
.
etPurchaseQuantity
.
isFocusable
=
true
;
bind
.
etPurchaseQuantity
.
isFocusable
=
true
;
bind
.
etPurchaseQuantity
.
isFocusableInTouchMode
=
true
;
bind
.
etPurchaseQuantity
.
isFocusableInTouchMode
=
true
;
bind
.
etPurchaseQuantity
.
requestFocus
()
//获取焦点
bind
.
etPurchaseQuantity
.
requestFocus
()
//获取焦点
}
}
fun
setOrderProduct
(
insertOrderProductDTO
:
InsertOrderProductDTO
)
{
fun
setOrderProduct
(
insertOrderProductDTO
:
InsertOrderProductDTO
)
{
this
.
type
=
1
this
.
type
=
1
this
.
insertOrderProductDTO
=
insertOrderProductDTO
this
.
insertOrderProductDTO
=
insertOrderProductDTO
...
@@ -110,7 +111,8 @@ class ChangeQuantityPopupWindow(context: Context) : BasePopupWindow(context) {
...
@@ -110,7 +111,8 @@ class ChangeQuantityPopupWindow(context: Context) : BasePopupWindow(context) {
when
(
insertOrderProductDTO
.
style
)
{
when
(
insertOrderProductDTO
.
style
)
{
PosProductStyle
.
WEIGHT
.
name
->
{
PosProductStyle
.
WEIGHT
.
name
->
{
purchaseQuantityName
=
"修改重量"
purchaseQuantityName
=
"修改重量"
spec
=
insertOrderProductDTO
.
quantity
.
toString
()
spec
=
decimalFormat
.
format
(
insertOrderProductDTO
.
quantity
)
// spec = insertOrderProductDTO.quantity.toString()
bind
.
vm
?.
productBarCode
?.
set
(
"PLU:"
+
insertOrderProductDTO
.
mnemonicCode
)
bind
.
vm
?.
productBarCode
?.
set
(
"PLU:"
+
insertOrderProductDTO
.
mnemonicCode
)
bind
.
etPurchaseQuantity
.
filters
=
arrayOf
(
WeighInputFilter
())
bind
.
etPurchaseQuantity
.
filters
=
arrayOf
(
WeighInputFilter
())
}
}
...
@@ -126,11 +128,11 @@ class ChangeQuantityPopupWindow(context: Context) : BasePopupWindow(context) {
...
@@ -126,11 +128,11 @@ class ChangeQuantityPopupWindow(context: Context) : BasePopupWindow(context) {
}
}
bind
.
vm
?.
purchaseQuantityName
?.
set
(
purchaseQuantityName
)
bind
.
vm
?.
purchaseQuantityName
?.
set
(
purchaseQuantityName
)
bind
.
vm
?.
purchaseQuantity
?.
set
(
spec
)
bind
.
vm
?.
purchaseQuantity
?.
set
(
spec
)
bind
.
etPurchaseQuantity
.
setText
(
spec
)
//
bind.etPurchaseQuantity.setText(spec)
val
length
=
bind
.
etPurchaseQuantity
.
text
.
toString
().
length
//
val length = bind.etPurchaseQuantity.text.toString().length
bind
.
etPurchaseQuantity
.
setSelection
(
length
)
//
bind.etPurchaseQuantity.setSelection(length)
bind
.
etPurchaseQuantity
.
isFocusable
=
true
;
//
bind.etPurchaseQuantity.isFocusable = true;
bind
.
etPurchaseQuantity
.
isFocusableInTouchMode
=
true
;
//
bind.etPurchaseQuantity.isFocusableInTouchMode = true;
bind
.
etPurchaseQuantity
.
requestFocus
()
//获取焦点
bind
.
etPurchaseQuantity
.
requestFocus
()
//获取焦点
}
}
...
@@ -143,8 +145,16 @@ class ChangeQuantityPopupWindow(context: Context) : BasePopupWindow(context) {
...
@@ -143,8 +145,16 @@ class ChangeQuantityPopupWindow(context: Context) : BasePopupWindow(context) {
fun
confirm
()
{
fun
confirm
()
{
val
purchaseQuantity
:
String
=
bind
.
etPurchaseQuantity
.
text
.
toString
()
val
purchaseQuantity
:
String
=
bind
.
etPurchaseQuantity
.
text
.
toString
()
var
purchaseQuantityHint
=
bind
.
etPurchaseQuantity
.
hint
.
toString
()
if
(
purchaseQuantity
.
isEmpty
())
{
if
(
purchaseQuantity
.
isEmpty
())
{
"重量/数据不能为空"
.
toast
()
dismiss
()
if
(
type
==
0
)
{
posProduct
?.
spec
=
purchaseQuantityHint
onChangeClick
?.
confirm
(
posProduct
!!
,
null
)
}
else
{
insertOrderProductDTO
?.
quantity
=
purchaseQuantityHint
.
toDouble
()
onChangeClick
?.
confirm
(
null
,
insertOrderProductDTO
!!
)
}
return
return
}
}
if
(
BigDecimal
(
purchaseQuantity
)
==
BigDecimal
.
ZERO
)
{
if
(
BigDecimal
(
purchaseQuantity
)
==
BigDecimal
.
ZERO
)
{
...
...
app/src/main/java/com/ypsx/yppos/utils/PrintUtils.kt
View file @
b1819aac
...
@@ -38,8 +38,12 @@ object PrintUtils {
...
@@ -38,8 +38,12 @@ object PrintUtils {
private
const
val
PRNSTS_ERR_DRIVER
=
-
257
//Printer Driver error
private
const
val
PRNSTS_ERR_DRIVER
=
-
257
//Printer Driver error
private
lateinit
var
printerManager
:
PrinterManager
private
lateinit
var
printerManager
:
PrinterManager
fun
init
()
{
fun
init
()
{
printerManager
=
PrinterManager
()
try
{
printerManager
.
open
()
printerManager
=
PrinterManager
()
printerManager
.
open
()
}
catch
(
e
:
Exception
)
{
"打印机打开失败"
}
}
}
...
@@ -398,7 +402,11 @@ object PrintUtils {
...
@@ -398,7 +402,11 @@ object PrintUtils {
fun
close
()
{
fun
close
()
{
printerManager
.
close
()
try
{
printerManager
.
close
()
}
catch
(
e
:
Exception
)
{
}
}
}
private
fun
getSpace
(
content
:
String
):
String
?
{
private
fun
getSpace
(
content
:
String
):
String
?
{
...
@@ -689,7 +697,7 @@ object PrintUtils {
...
@@ -689,7 +697,7 @@ object PrintUtils {
product
.
quantity
,
product
.
quantity
,
product
.
price
,
product
.
price
,
product
.
amount
product
.
amount
),
0
,
height
,
384
,
-
1
,
fontName
,
fontSize
,
0
,
fontStyle
,
0
),
0
,
height
,
384
,
-
1
,
fontName
,
22
,
0
,
0
,
0
)
)
}
}
}
}
...
...
app/src/main/java/com/ypsx/yppos/viewmodel/request/RequestMainViewModel.kt
View file @
b1819aac
...
@@ -108,11 +108,24 @@ class RequestMainViewModel : BaseViewModel() {
...
@@ -108,11 +108,24 @@ class RequestMainViewModel : BaseViewModel() {
"没找到该商品"
.
toastSign
()
"没找到该商品"
.
toastSign
()
}
else
{
}
else
{
it
.
toJson
().
dXLog
()
it
.
toJson
().
dXLog
()
posProduct
.
postValue
(
it
)
when
{
// val productItem =
it
.
mnemonicCode
.
isEmpty
()
->
{
// ProductItem(it.merchantItemId!!, it.id, it.spec.toDouble(), it.sellPrice)
val
productItem
=
// productItem.toJson().dXLog()
ProductItem
(
it
.
merchantItemId
!!
,
it
.
id
,
it
.
spec
.
toDouble
(),
it
.
sellPrice
)
// productItemData.postValue(productItem)
productItem
.
toJson
().
dXLog
()
productItemData
.
postValue
(
productItem
)
}
it
.
mnemonicCode
==
key
->
{
posProduct
.
postValue
(
it
)
}
else
->
{
val
productItem
=
ProductItem
(
it
.
merchantItemId
!!
,
it
.
id
,
it
.
spec
.
toDouble
(),
it
.
sellPrice
)
productItem
.
toJson
().
dXLog
()
productItemData
.
postValue
(
productItem
)
}
}
}
}
},
{
},
{
...
@@ -170,10 +183,10 @@ class RequestMainViewModel : BaseViewModel() {
...
@@ -170,10 +183,10 @@ class RequestMainViewModel : BaseViewModel() {
}
}
val
amount
:
Double
=
product
.
price
.
times
(
product
.
quantity
)
?:
0.0
val
amount
:
Double
=
product
.
price
.
times
(
product
.
quantity
)
?:
0.0
amountTotal
=
BigDecimalUtils
.
forPlus
(
amountTotal
.
plus
(
amount
))
amountTotal
=
BigDecimalUtils
.
forPlus
(
amountTotal
.
plus
(
amount
))
var
weightCode
=
""
var
weightCode
=
""
if
(
pluList
.
size
>
index
)
{
if
(
pluList
.
size
>
index
)
{
weightCode
=
weightCode
=
if
(
pluList
[
index
].
id
==
posProduct
?.
id
)
pluList
[
index
].
plu
else
""
if
(
pluList
[
index
].
id
==
posProduct
?.
id
)
pluList
[
index
].
plu
else
""
}
}
...
@@ -192,7 +205,7 @@ class RequestMainViewModel : BaseViewModel() {
...
@@ -192,7 +205,7 @@ class RequestMainViewModel : BaseViewModel() {
price
=
product
.
price
?:
0.0
,
price
=
product
.
price
?:
0.0
,
quantity
=
product
.
quantity
?:
0.0
,
quantity
=
product
.
quantity
?:
0.0
,
tailAmount
=
0
,
tailAmount
=
0
,
weightCode
=
weightCode
,
weightCode
=
weightCode
,
name
=
posProduct
.
name
,
name
=
posProduct
.
name
,
spec
=
posProduct
.
spec
,
spec
=
posProduct
.
spec
,
unit
=
posProduct
.
unit
,
unit
=
posProduct
.
unit
,
...
@@ -255,7 +268,7 @@ class RequestMainViewModel : BaseViewModel() {
...
@@ -255,7 +268,7 @@ class RequestMainViewModel : BaseViewModel() {
var
posProduct
:
PosProduct
?
=
null
var
posProduct
:
PosProduct
?
=
null
var
listNum
=
0
var
listNum
=
0
for
((
index
,
product
)
in
productPromotions
.
withIndex
())
{
for
((
index
,
product
)
in
productPromotions
.
withIndex
())
{
for
(
item
in
it
)
{
for
(
item
in
it
)
{
if
(
product
.
productId
==
item
.
id
)
{
if
(
product
.
productId
==
item
.
id
)
{
posProduct
=
item
posProduct
=
item
...
@@ -285,7 +298,7 @@ class RequestMainViewModel : BaseViewModel() {
...
@@ -285,7 +298,7 @@ class RequestMainViewModel : BaseViewModel() {
}
}
var
activityPrice
=
activityInfo
?.
activityPrice
?:
0.0
var
activityPrice
=
activityInfo
?.
activityPrice
?:
0.0
var
weightCode
=
""
var
weightCode
=
""
if
(
pluList
.
size
>
index
)
{
if
(
pluList
.
size
>
index
)
{
weightCode
=
weightCode
=
...
@@ -436,8 +449,10 @@ class RequestMainViewModel : BaseViewModel() {
...
@@ -436,8 +449,10 @@ class RequestMainViewModel : BaseViewModel() {
"${CacheUtil.getRealName()}付款成功,保存数据库并打印"
.
dXLog
()
"${CacheUtil.getRealName()}付款成功,保存数据库并打印"
.
dXLog
()
pluList
.
clear
()
pluList
.
clear
()
launch
({
launch
({
val
currentTimeMillis
=
System
.
currentTimeMillis
()
PrintUtils
.
print
(
posConfig
!!
,
it
)
PrintUtils
.
print
(
posConfig
!!
,
it
)
PosBuyRepository
.
getInstance
().
savePosBuy
(
it
,
authCode
)
PosBuyRepository
.
getInstance
().
savePosBuy
(
it
,
authCode
)
"打印和保存数据库使用耗时::${System.currentTimeMillis()-currentTimeMillis}"
.
dXLog
()
},
{
},
{
"打印完成"
.
dXLog
()
"打印完成"
.
dXLog
()
"打印完成"
.
toastSuccess
()
"打印完成"
.
toastSuccess
()
...
...
app/src/main/res/layout/popup_change_quantity.xml
View file @
b1819aac
...
@@ -77,7 +77,7 @@
...
@@ -77,7 +77,7 @@
android:lines=
"1"
android:lines=
"1"
android:paddingVertical=
"10dp"
android:paddingVertical=
"10dp"
android:paddingStart=
"10dp"
android:paddingStart=
"10dp"
android:text=
"
@{vm.purchaseQuantity}
"
android:text=
""
android:textColor=
"#333333"
android:textColor=
"#333333"
android:textColorHint=
"#999999"
android:textColorHint=
"#999999"
android:textSize=
"20sp"
android:textSize=
"20sp"
...
...
common/src/main/java/com/ypsx/common/app/ext/ServerHostDialogExt.kt
View file @
b1819aac
package
com.ypsx.common.app.ext
package
com.ypsx.common.app.ext
import
android.annotation.SuppressLint
import
androidx.appcompat.app.AppCompatActivity
import
androidx.appcompat.app.AppCompatActivity
import
com.afollestad.materialdialogs.MaterialDialog
import
com.afollestad.materialdialogs.MaterialDialog
import
com.afollestad.materialdialogs.list.SingleChoiceListener
import
com.afollestad.materialdialogs.list.SingleChoiceListener
...
@@ -16,6 +17,7 @@ private val hostMap = mapOf(
...
@@ -16,6 +17,7 @@ private val hostMap = mapOf(
private
val
hosts
=
hostMap
.
values
.
toTypedArray
()
private
val
hosts
=
hostMap
.
values
.
toTypedArray
()
private
val
names
=
hostMap
.
keys
.
toList
()
private
val
names
=
hostMap
.
keys
.
toList
()
@SuppressLint
(
"StaticFieldLeak"
)
private
var
materialDialog
:
MaterialDialog
?
=
null
private
var
materialDialog
:
MaterialDialog
?
=
null
fun
AppCompatActivity
.
showServerHostExt
(
host
:
String
,
success
:
(
String
)
->
Unit
)
{
fun
AppCompatActivity
.
showServerHostExt
(
host
:
String
,
success
:
(
String
)
->
Unit
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment