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
7338ad68
Commit
7338ad68
authored
Nov 18, 2021
by
UIUANG\Zsc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改bug
parent
197c8c9d
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
88 additions
and
49 deletions
+88
-49
build.gradle
app/build.gradle
+2
-2
output-metadata.json
app/release/output-metadata.json
+3
-3
yppos_v100010-1.00.010-release-2021-11-16.apk
app/release/yppos_v100010-1.00.010-release-2021-11-16.apk
+0
-0
LogService.kt
app/src/main/java/com/ypsx/yppos/jobs/LogService.kt
+8
-2
SyncProductService.kt
app/src/main/java/com/ypsx/yppos/jobs/SyncProductService.kt
+9
-3
MainActivity.kt
app/src/main/java/com/ypsx/yppos/ui/activity/MainActivity.kt
+10
-3
RegisterActivity.kt
.../main/java/com/ypsx/yppos/ui/activity/RegisterActivity.kt
+5
-0
CashPayPopupWindow.kt
...c/main/java/com/ypsx/yppos/ui/popup/CashPayPopupWindow.kt
+7
-4
PrintUtils.kt
app/src/main/java/com/ypsx/yppos/utils/PrintUtils.kt
+42
-30
activity_login.xml
app/src/main/res/layout/activity_login.xml
+1
-1
popup_cash_pay.xml
app/src/main/res/layout/popup_cash_pay.xml
+1
-1
No files found.
app/build.gradle
View file @
7338ad68
...
...
@@ -15,8 +15,8 @@ android {
applicationId
"com.ypsx.yppos"
minSdkVersion
21
targetSdkVersion
30
versionCode
1000
07
versionName
"1.00.0
07
"
versionCode
1000
10
versionName
"1.00.0
10
"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
}
...
...
app/release/output-metadata.json
View file @
7338ad68
...
...
@@ -10,9 +10,9 @@
{
"type"
:
"SINGLE"
,
"filters"
:
[],
"versionCode"
:
1000
07
,
"versionName"
:
"1.00.0
07
"
,
"outputFile"
:
"yppos_v1000
07-1.00.007-release-2021-11-11
.apk"
"versionCode"
:
1000
10
,
"versionName"
:
"1.00.0
10
"
,
"outputFile"
:
"yppos_v1000
10-1.00.010-release-2021-11-16
.apk"
}
]
}
\ No newline at end of file
app/release/yppos_v1000
07-1.00.007-release-2021-11-11
.apk
→
app/release/yppos_v1000
10-1.00.010-release-2021-11-16
.apk
View file @
7338ad68
No preview for this file type
app/src/main/java/com/ypsx/yppos/jobs/LogService.kt
View file @
7338ad68
...
...
@@ -9,10 +9,12 @@ import android.content.Intent
import
android.os.Build
import
android.os.IBinder
import
com.ypsx.base.base.appContext
import
com.ypsx.base.util.eXLog
import
com.ypsx.yppos.R
import
com.ypsx.yppos.http.repository.request.HttpRequestCoroutine
import
com.ypsx.yppos.room.entity.PosConfig
import
com.ypsx.yppos.room.repository.PosConfigRepository
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.GlobalScope
import
kotlinx.coroutines.Job
import
kotlinx.coroutines.launch
...
...
@@ -46,8 +48,12 @@ class LogService : Service() {
override
fun
onCreate
()
{
super
.
onCreate
()
posConfig
=
PosConfigRepository
.
getInstance
().
loadConfig
()
job
=
GlobalScope
.
launch
{
HttpRequestCoroutine
.
uploadLog
(
posConfig
?.
code
!!
)
try
{
job
=
GlobalScope
.
launch
(
Dispatchers
.
IO
)
{
HttpRequestCoroutine
.
uploadLog
(
posConfig
?.
code
!!
)
}
}
catch
(
e
:
Exception
)
{
e
.
message
?.
eXLog
()
}
}
...
...
app/src/main/java/com/ypsx/yppos/jobs/SyncProductService.kt
View file @
7338ad68
...
...
@@ -9,10 +9,12 @@ import android.content.Intent
import
android.os.Build
import
android.os.IBinder
import
com.ypsx.base.base.appContext
import
com.ypsx.base.util.eXLog
import
com.ypsx.yppos.R
import
com.ypsx.yppos.http.repository.request.HttpRequestCoroutine
import
com.ypsx.yppos.room.entity.PosConfig
import
com.ypsx.yppos.room.repository.PosConfigRepository
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.GlobalScope
import
kotlinx.coroutines.Job
import
kotlinx.coroutines.launch
...
...
@@ -48,9 +50,13 @@ class SyncProductService: Service() {
override
fun
onCreate
()
{
super
.
onCreate
()
posConfig
=
PosConfigRepository
.
getInstance
().
loadConfig
()
job
=
GlobalScope
.
launch
{
val
storeId
=
posConfig
?.
storeId
!!
HttpRequestCoroutine
.
syncProduct
(
storeId
)
job
=
GlobalScope
.
launch
(
Dispatchers
.
IO
)
{
try
{
val
storeId
=
posConfig
?.
storeId
!!
HttpRequestCoroutine
.
syncProduct
(
storeId
)
}
catch
(
e
:
Exception
)
{
e
.
message
?.
eXLog
()
}
}
}
...
...
app/src/main/java/com/ypsx/yppos/ui/activity/MainActivity.kt
View file @
7338ad68
...
...
@@ -130,10 +130,10 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
if
(
payAmountPopupWindow
!=
null
&&
payAmountPopupWindow
!!
.
isShowing
&&
payAmountPopupWindow
!!
.
timeIsStart
())
{
var
payMethod
=
payAmountPopupWindow
?.
getPayMethod
()
?:
PosPayMethod
.
CCB_BAR_PAY
var
orderNo
=
mViewModel
.
orderNo
.
get
()
var
totalAmount
=
mViewModel
.
a
mount
.
get
()
var
totalAmount
=
mViewModel
.
payA
mount
.
get
()
var
payAmount
=
mViewModel
.
payAmount
.
get
()
var
promotionOnSaleTotal
=
mViewModel
.
discountSpecial
.
get
()
var
discountTotal
=
mViewModel
.
discount
.
get
()
var
discountTotal
=
mViewModel
.
discount
Money
.
get
()
var
data
=
orderProductAdapter
.
data
var
arrayList
=
ArrayList
<
InsertOrderProductDTO
>()
arrayList
.
addAll
(
data
)
...
...
@@ -142,7 +142,7 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
"$realName 付款方式:${payMethod.name} 支付码:$barcode"
.
dXLog
()
requestMainViewModel
.
createOrder
(
orderNo
,
totalAmount
,
totalAmount
.
toDouble
()
,
payAmount
.
toDouble
(),
promotionOnSaleTotal
.
toDouble
(),
discountTotal
.
toDouble
(),
...
...
@@ -355,6 +355,13 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
orderPayAmountPopupWindow
.
setPayClick
{
it
->
orderPayAmountPopupWindow
.
dismiss
()
if
(
it
==
PosPayMethod
.
CASHPAY
)
{
val
rawData
=
BigDecimal
(
payment
)
val
scale
=
rawData
.
setScale
(
1
,
RoundingMode
.
HALF_UP
)
if
(
scale
.
toDouble
()
<
0.1
)
{
"现金收款金额不能小于0.1元"
.
toastFailed
()
return
@setPayClick
}
val
cashPayPopupWindow
=
CashPayPopupWindow
(
this
@MainActivity
)
cashPayPopupWindow
.
showPopupWindow
()
cashPayPopupWindow
.
setData
(
it
,
payment
)
...
...
app/src/main/java/com/ypsx/yppos/ui/activity/RegisterActivity.kt
View file @
7338ad68
...
...
@@ -146,6 +146,11 @@ class RegisterActivity : BaseActivity<RegisterViewModel, ActivityRegisterBinding
mViewModel
.
submitState
.
set
(
true
)
mViewModel
.
submitText
.
set
(
"提交申请"
)
requestMeViewModel
.
cancelJob
()
}
else
{
it
.
errorMsg
.
toast
()
mViewModel
.
submitState
.
set
(
true
)
mViewModel
.
submitText
.
set
(
"提交申请"
)
}
})
...
...
app/src/main/java/com/ypsx/yppos/ui/popup/CashPayPopupWindow.kt
View file @
7338ad68
...
...
@@ -4,10 +4,12 @@ import android.content.Context
import
android.view.Gravity
import
android.view.View
import
android.view.inputmethod.EditorInfo
import
android.view.inputmethod.InputMethodManager
import
com.ypsx.base.base.appContext
import
com.ypsx.base.ext.util.screenWidth
import
com.ypsx.base.ext.view.afterTextChange
import
com.ypsx.base.util.dXLog
import
com.ypsx.common.app.ext.hideSoftKeyboard
import
com.ypsx.yppos.R
import
com.ypsx.yppos.databinding.PopupCashPayBinding
import
com.ypsx.yppos.http.data.entity.PosPayMethod
...
...
@@ -68,7 +70,9 @@ class CashPayPopupWindow(context: Context) : BasePopupWindow(context) {
}
bind
.
textView20
.
setOnEditorActionListener
{
v
,
actionId
,
event
->
if
(
actionId
==
EditorInfo
.
IME_ACTION_DONE
)
{
ProxyClick
().
confirm
()
val
imm
:
InputMethodManager
=
context
.
getSystemService
(
Context
.
INPUT_METHOD_SERVICE
)
as
InputMethodManager
imm
.
hideSoftInputFromWindow
(
bind
.
textView20
.
windowToken
,
InputMethodManager
.
HIDE_NOT_ALWAYS
)
return
@setOnEditorActionListener
true
}
return
@setOnEditorActionListener
false
...
...
@@ -97,12 +101,11 @@ class CashPayPopupWindow(context: Context) : BasePopupWindow(context) {
}
fun
confirm
()
{
va
l
payMoney
:
String
=
bind
.
textView20
.
text
.
toString
()
va
r
payMoney
:
String
=
bind
.
textView20
.
text
.
toString
()
val
receivables
:
Double
?
=
bind
.
vm
?.
receivables
?.
get
()
val
changeMoney
:
Double
?
=
bind
.
vm
?.
changeMoney
?.
get
()
if
(
payMoney
.
isEmpty
())
{
"应付金额不允许为空!"
.
toastFailed
()
return
payMoney
=
receivables
.
toString
()
}
if
(
receivables
!=
null
&&
changeMoney
!=
null
)
{
if
(
receivables
>
payMoney
.
toDouble
())
{
...
...
app/src/main/java/com/ypsx/yppos/utils/PrintUtils.kt
View file @
7338ad68
...
...
@@ -12,6 +12,7 @@ import com.ypsx.yppos.http.data.bean.ActivityInfoDTO
import
com.ypsx.yppos.http.data.bean.OrderActivityResponse
import
com.ypsx.yppos.http.data.bean.OrderDetailsResponse
import
com.ypsx.yppos.http.data.entity.PosPayMethod
import
com.ypsx.yppos.http.data.entity.PosProductStyle
import
com.ypsx.yppos.http.data.entity.ProductActivityType
import
com.ypsx.yppos.room.entity.PosBuy
import
com.ypsx.yppos.room.entity.PosBuyPart
...
...
@@ -123,6 +124,7 @@ object PrintUtils {
height
+=
printerManager
.
drawTextEx
(
"商品名称 数量 单价 成交价"
,
0
,
height
,
384
,
-
1
,
fontName
,
fontSize
,
0
,
fontStyle
,
0
)
var
buyNum
=
0
var
discountTime
=
0.0
//分时
var
discountSpecial
=
0.0
//特价
var
discountMoney
=
0.0
//满减
...
...
@@ -155,6 +157,11 @@ object PrintUtils {
}
}
}
if
(
product
.
style
==
PosProductStyle
.
WEIGHT
.
name
)
{
buyNum
+=
1
}
else
if
(
product
.
style
==
PosProductStyle
.
SINGLE
.
name
)
{
buyNum
+=
product
.
quantity
.
toInt
()
}
val
name
=
if
(
discountMoney
>
0.0
&&
isPromotion
)
{
"${index + 1} *${product.name}*"
...
...
@@ -184,18 +191,18 @@ object PrintUtils {
)
}
height
+=
printerManager
.
drawTextEx
(
" "
,
0
,
height
,
384
,
-
1
,
fontName
,
fontSize
,
0
,
fontStyle
,
0
)
//
height += printerManager.drawTextEx(
//
" ",
//
0,
//
height,
//
384,
//
-1,
//
fontName,
//
fontSize,
//
0,
//
fontStyle,
//
0
//
)
height
+=
printerManager
.
drawTextEx
(
"促销特价优惠:${BigDecimalUtils.forPlus(discountSpecial)}"
,
0
,
...
...
@@ -241,8 +248,8 @@ object PrintUtils {
height
+=
printerManager
.
drawTextEx
(
getAmountCenterSpace
(
"应付款:${orderResponse.
total
Amount}"
,
"数量:${
orderResponse.buyNumber
}"
"应付款:${orderResponse.
pay
Amount}"
,
"数量:${
buyNum
}"
),
0
,
height
,
...
...
@@ -254,7 +261,7 @@ object PrintUtils {
fontStyle
,
0
)
val
minus
=
BigDecimal
.
valueOf
(
orderResponse
.
total
Amount
)
val
minus
=
BigDecimal
.
valueOf
(
orderResponse
.
pay
Amount
)
.
minus
(
BigDecimal
.
valueOf
(
orderResponse
.
roundPrice
))
val
scale1
=
minus
.
plus
(
BigDecimal
.
valueOf
(
orderResponse
.
changeAmount
))
...
...
@@ -518,7 +525,7 @@ object PrintUtils {
0
)
height
+=
printerManager
.
drawTextEx
(
getSpace
(
"销售小票"
),
0
,
height
,
384
,
-
1
,
fontName
,
fontSize
,
0
,
fontStyle
,
0
getSpace
(
"
重打
销售小票"
),
0
,
height
,
384
,
-
1
,
fontName
,
fontSize
,
0
,
fontStyle
,
0
)
height
+=
printerManager
.
drawTextEx
(
...
...
@@ -569,7 +576,7 @@ object PrintUtils {
height
+=
printerManager
.
drawTextEx
(
"商品名称 数量 单价 成交价"
,
0
,
height
,
384
,
-
1
,
fontName
,
fontSize
,
0
,
fontStyle
,
0
)
var
buyNum
=
0
var
discountTime
=
0.0
//分时
var
discountSpecial
=
0.0
//特价
var
discountMoney
=
0.0
//满减
...
...
@@ -640,6 +647,11 @@ object PrintUtils {
}
else
{
"${index + 1} ${product.name}"
}
if
(
product
.
style
==
PosProductStyle
.
WEIGHT
.
name
)
{
buyNum
+=
1
}
else
if
(
product
.
style
==
PosProductStyle
.
SINGLE
.
name
)
{
buyNum
+=
product
.
quantity
.
toInt
()
}
height
+=
printerManager
.
drawTextEx
(
name
,
0
,
...
...
@@ -664,18 +676,18 @@ object PrintUtils {
}
}
height
+=
printerManager
.
drawTextEx
(
" "
,
0
,
height
,
384
,
-
1
,
fontName
,
fontSize
,
0
,
fontStyle
,
0
)
//
height += printerManager.drawTextEx(
//
" ",
//
0,
//
height,
//
384,
//
-1,
//
fontName,
//
fontSize,
//
0,
//
fontStyle,
//
0
//
)
height
+=
printerManager
.
drawTextEx
(
"促销特价优惠:${BigDecimalUtils.forPlus(discountSpecial)}"
,
0
,
...
...
@@ -722,7 +734,7 @@ object PrintUtils {
height
+=
printerManager
.
drawTextEx
(
getAmountCenterSpace
(
"应付款:${posBuy.totalAmount}"
,
"数量:${
posBuy.buyNumber
}"
"数量:${
buyNum
}"
),
0
,
height
,
...
...
app/src/main/res/layout/activity_login.xml
View file @
7338ad68
...
...
@@ -175,7 +175,7 @@
android:hint=
"@string/login_password_hint"
android:inputType=
"textPassword"
android:lines=
"1"
android:maxLength=
"
20
"
android:maxLength=
"
6
"
android:textColor=
"#333333"
android:textColorHint=
"#999999"
android:textSize=
"20sp"
...
...
app/src/main/res/layout/popup_cash_pay.xml
View file @
7338ad68
...
...
@@ -122,7 +122,7 @@
android:layout_height=
"wrap_content"
android:paddingVertical=
"15dp"
android:paddingEnd=
"20dp"
android:maxLength=
"
6
"
android:maxLength=
"
10
"
android:text=
"@{vm.change2}"
android:textColor=
"#333333"
android:textSize=
"20sp"
...
...
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