Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
supplier
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王宇航
supplier
Commits
24b29e5c
Commit
24b29e5c
authored
Mar 19, 2021
by
Wyh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、外送刷新營業狀態 2、外送訂單列表context內存洩漏問題 3、打印失敗,兩秒自動關閉 4、避免了有多台重名的打印機問題 5、掃碼頁面新增可配置掃碼類型 6、供應鏈新增食材可選sn碼
parent
4ccca7e1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
1026 additions
and
76 deletions
+1026
-76
component-delivery-pick/src/main/java/com/gingersoft/gsa/delivery_pick_mode/ui/activity/DeliveryOrderMainActivity.kt
+4
-1
component-delivery-pick/src/main/java/com/gingersoft/gsa/delivery_pick_mode/ui/adapter/OrderListAdapter.kt
+12
-12
component-delivery-pick/src/main/java/com/gingersoft/gsa/delivery_pick_mode/ui/fragment/PlaceholderFragment.kt
+1
-1
component-print/src/main/java/com/joe/print/mvp/print/service/PrjService.java
+1
-0
component-print/src/main/java/com/joe/print/mvp/ui/activity/PrintActivity.java
+7
-5
component-scan/src/main/AndroidManifest.xml
+2
-2
component-scan/src/main/java/com/gingersoft/gsa/cloud/scan/ComponentScan.java
+3
-4
component-scan/src/main/java/com/gingersoft/gsa/cloud/scan/mvp/ui/activity/MipcaCaptureActivity.java
+23
-14
component-supply-chain/build.gradle
+4
-0
component-supply-chain/src/main/AndroidManifest.xml
+13
-9
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/adapter/ConsumptionReasonAdapter.java
+51
-0
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/fragment/order/OrderDetailsFragment.java
+8
-1
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/fragment/warehouse/WarehouseDetailsFragment.java
+44
-15
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/widget/InventoryConsumptionPopup.java
+0
-0
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/widget/InventoryConsumptionView.java
+174
-0
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/widget/ScanSnPopup.java
+89
-0
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/widget/ScanSnView.java
+179
-0
component-supply-chain/src/main/res/layout/fragment_warehouse_details.xml
+4
-0
component-supply-chain/src/main/res/layout/item_sn_code.xml
+53
-0
component-supply-chain/src/main/res/layout/layout_inventory_consumption.xml
+135
-0
component-supply-chain/src/main/res/layout/layout_scan_sn.xml
+107
-0
component-supply-chain/src/main/res/layout/popup_scan_sn.xml
+48
-0
component-supply-chain/src/main/res/values/strings.xml
+5
-10
library-common/src/main/java/com/gingersoft/gsa/cloud/common/utils/XPermissionUtils.java
+31
-0
library-common/src/main/res/drawable-xhdpi/ic_black_scan.png
+0
-0
library-common/src/main/res/drawable/shape_edit_border_c8.xml
+9
-0
library-common/src/main/res/drawable/shape_theme_five_corners_bg.xml
+7
-0
library-common/src/main/res/values/strings.xml
+10
-0
library-ui/src/main/res/layout/multi_item_boolean.xml
+2
-2
No files found.
component-delivery-pick/src/main/java/com/gingersoft/gsa/delivery_pick_mode/ui/activity/DeliveryOrderMainActivity.kt
View file @
24b29e5c
...
...
@@ -31,6 +31,7 @@ import com.gingersoft.gsa.cloud.common.function.FunctionManager
import
com.gingersoft.gsa.cloud.common.service.DataNotificationService
import
com.gingersoft.gsa.cloud.common.service.PostCallBack
import
com.gingersoft.gsa.cloud.common.utils.other.SPUtils
import
com.gingersoft.gsa.cloud.common.utils.other.TextUtil
import
com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils
import
com.gingersoft.gsa.cloud.order.order.BaseOrder
import
com.gingersoft.gsa.cloud.ui.utils.AppDialog
...
...
@@ -152,6 +153,8 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen
tv_booking_order_num
.
text
=
orderAppointment
.
reservationNumber
.
toString
()
//預約單時間
tv_booking_order
.
text
=
String
.
format
(
getString
(
R
.
string
.
str_reservation_time
),
orderAppointment
.
reservationConfigTime
)
//刷新餐廳營業狀態
restaurantState
.
postValue
(
it
.
openStatus
)
})
//餘額刷新監聽
balanceBean
.
observe
(
this
@DeliveryOrderMainActivity
,
Observer
{
...
...
@@ -280,7 +283,7 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen
private
fun
searchMethod
()
{
iv_search_order
.
setOnClickListener
{
//搜索
if
(
ed_order_num_search
.
text
!=
null
&&
ed_order_num_search
.
text
.
isNotEmpty
(
))
{
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
ed_order_num_search
))
{
pageViewModel
.
phone
=
ed_order_num_search
.
text
.
toString
()
getCurrentPageOrderList
()
}
else
{
...
...
component-delivery-pick/src/main/java/com/gingersoft/gsa/delivery_pick_mode/ui/adapter/OrderListAdapter.kt
View file @
24b29e5c
...
...
@@ -18,7 +18,7 @@ import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.OrderListBean
import
com.gingersoft.gsa.delivery_pick_mode.databinding.LayoutDeliveryOrderItemBinding
import
com.scwang.smartrefresh.layout.util.SmartUtil.dp2px
class
OrderListAdapter
(
var
context
:
Context
,
var
outTime
:
Int
,
var
dataBean
:
List
<
OrderListBean
>
=
ArrayList
())
:
Adapter
<
OrderListAdapter
.
ViewHolder
>()
{
class
OrderListAdapter
(
var
outTime
:
Int
,
var
dataBean
:
List
<
OrderListBean
>
=
ArrayList
())
:
Adapter
<
OrderListAdapter
.
ViewHolder
>()
{
private
var
listener
:
((
item
:
OrderListBean
)
->
Unit
)?
=
null
...
...
@@ -77,20 +77,20 @@ class OrderListAdapter(var context: Context, var outTime: Int, var dataBean: Lis
when
(
data
.
status
)
{
0
->
{
state
=
"待確認"
bg
.
setColor
(
getColor
(
R
.
color
.
order_state0_color
))
bg
.
setColor
(
getColor
(
holder
.
flBorder
.
context
,
R
.
color
.
order_state0_color
))
}
1
->
{
state
=
"待確認"
bg
.
setColor
(
getColor
(
R
.
color
.
order_state0_color
))
bg
.
setColor
(
getColor
(
holder
.
flBorder
.
context
,
R
.
color
.
order_state0_color
))
holder
.
flBorder
.
visibility
=
View
.
VISIBLE
//顯示邊框
}
2
->
{
state
=
"製作中"
bg
.
setColor
(
getColor
(
R
.
color
.
order_state1_color
))
bg
.
setColor
(
getColor
(
holder
.
flBorder
.
context
,
R
.
color
.
order_state1_color
))
}
8
->
{
state
=
"待製作"
bg
.
setColor
(
getColor
(
R
.
color
.
order_state4_color
))
bg
.
setColor
(
getColor
(
holder
.
flBorder
.
context
,
R
.
color
.
order_state4_color
))
holder
.
flBorder
.
visibility
=
View
.
VISIBLE
//顯示邊框
alphaAnimator
(
holder
.
flBorder
)
}
...
...
@@ -100,7 +100,7 @@ class OrderListAdapter(var context: Context, var outTime: Int, var dataBean: Lis
}
else
{
"派送中"
}
bg
.
setColor
(
getColor
(
R
.
color
.
order_state2_color
))
bg
.
setColor
(
getColor
(
holder
.
flBorder
.
context
,
R
.
color
.
order_state2_color
))
}
}
holder
.
binding
.
state
=
state
...
...
@@ -114,15 +114,15 @@ class OrderListAdapter(var context: Context, var outTime: Int, var dataBean: Lis
holder
.
binding
.
orderingMethod
=
when
(
data
.
orderType
)
{
2
->
{
orderingMethodBg
.
setColor
(
getColor
(
R
.
color
.
order_state2_color
))
orderingMethodBg
.
setColor
(
getColor
(
holder
.
flBorder
.
context
,
R
.
color
.
order_state2_color
))
"外送"
}
7
->
{
orderingMethodBg
.
setColor
(
getColor
(
R
.
color
.
order_state3_color
))
orderingMethodBg
.
setColor
(
getColor
(
holder
.
flBorder
.
context
,
R
.
color
.
order_state3_color
))
"自取"
}
else
->
{
orderingMethodBg
.
setColor
(
getColor
(
R
.
color
.
order_state1_color
))
orderingMethodBg
.
setColor
(
getColor
(
holder
.
flBorder
.
context
,
R
.
color
.
order_state1_color
))
"堂食"
}
}
...
...
@@ -135,11 +135,11 @@ class OrderListAdapter(var context: Context, var outTime: Int, var dataBean: Lis
holder
.
binding
.
payMethod
=
when
(
data
.
orderPayType
)
{
1
->
{
payMethodBg
.
setColor
(
getColor
(
R
.
color
.
cash_on_delivery_bg
))
payMethodBg
.
setColor
(
getColor
(
holder
.
flBorder
.
context
,
R
.
color
.
cash_on_delivery_bg
))
"貨到付款"
}
else
->
{
payMethodBg
.
setColor
(
getColor
(
R
.
color
.
online_payments_bg
))
payMethodBg
.
setColor
(
getColor
(
holder
.
flBorder
.
context
,
R
.
color
.
online_payments_bg
))
"在線支付"
}
}
...
...
@@ -183,7 +183,7 @@ class OrderListAdapter(var context: Context, var outTime: Int, var dataBean: Lis
return
dataBean
.
size
}
private
fun
getColor
(
color
:
Int
):
Int
{
private
fun
getColor
(
co
ntext
:
Context
,
co
lor
:
Int
):
Int
{
return
ContextCompat
.
getColor
(
context
,
color
)
}
...
...
component-delivery-pick/src/main/java/com/gingersoft/gsa/delivery_pick_mode/ui/fragment/PlaceholderFragment.kt
View file @
24b29e5c
...
...
@@ -73,7 +73,7 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) {
private
fun
initRecyclerView
()
{
rv_other_order
.
layoutManager
=
LinearLayoutManager
(
activity
)
adapter
=
OrderListAdapter
(
requireActivity
(),
pageViewModel
.
timeOut
*
60
*
1000
)
adapter
=
OrderListAdapter
(
pageViewModel
.
timeOut
*
60
*
1000
)
adapter
.
setOnItemClickListener
{
data
->
// 點擊查詢食品詳情
val
intent
=
Intent
(
activity
,
OrderDetailsActivity
::
class
.
java
)
...
...
component-print/src/main/java/com/joe/print/mvp/print/service/PrjService.java
View file @
24b29e5c
...
...
@@ -343,6 +343,7 @@ public class PrjService extends Service implements ReceiveListener {
// 這裡已經拿到這台打印機需要打印的所有數據,為prjMp.getValue(),
// 生成對應的打印數據,除了針式打印機,其他都生成bitmap
generatePrintData
(
prjMap
.
getKey
(),
prjMap
.
getValue
(),
configPrinterDeviceBean
);
break
;
}
}
if
(!
isFindDevice
)
{
...
...
component-print/src/main/java/com/joe/print/mvp/ui/activity/PrintActivity.java
View file @
24b29e5c
...
...
@@ -18,6 +18,7 @@ import com.gingersoft.gsa.cloud.common.logan.LoganManager;
import
com.gingersoft.gsa.cloud.common.printer.plugins.PrinterFlowListener
;
import
com.gingersoft.gsa.cloud.common.printer.plugins.PrinterFlowProxy
;
import
com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils
;
import
com.gingersoft.gsa.cloud.common.utils.log.LogUtil
;
import
com.gingersoft.gsa.cloud.common.utils.other.SPUtils
;
import
com.gingersoft.gsa.cloud.common.utils.other.TextUtil
;
import
com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils
;
...
...
@@ -41,6 +42,7 @@ import com.joe.print.mvp.print.utils.MyPrintUtils;
import
com.joe.print.mvp.ui.view.PrinterLoadingDialog
;
import
com.joe.print.mvp.ui.view.SelectPrintDevicePopup
;
import
com.lxj.xpopup.XPopup
;
import
com.xuexiang.rxutil2.rxjava.RxJavaUtils
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -165,11 +167,11 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
private
void
printFail
()
{
printerResult
=
false
;
//延遲兩秒關閉
//
RxJavaUtils.delay(2, aLong -> {
//
LogUtil.e("eee", "打印失敗");
//
CC.sendCCResult(callId, CCResult.error("print error"));
//
killMyself();
//
});
RxJavaUtils
.
delay
(
2
,
aLong
->
{
LogUtil
.
e
(
"eee"
,
"打印失敗"
);
CC
.
sendCCResult
(
callId
,
CCResult
.
error
(
"print error"
));
killMyself
();
});
}
@Override
...
...
component-scan/src/main/AndroidManifest.xml
View file @
24b29e5c
...
...
@@ -13,8 +13,7 @@
<uses-permission
android:name=
"android.permission.READ_EXTERNAL_STORAGE"
/>
<application
android:networkSecurityConfig=
"@xml/network_android"
>
<activity
android:name=
".mvp.ui.activity.MipcaCaptureActivity"
>
</activity>
<activity
android:name=
".mvp.ui.activity.MipcaCaptureActivity"
/>
</application>
</manifest>
\ No newline at end of file
component-scan/src/main/java/com/gingersoft/gsa/cloud/scan/ComponentScan.java
View file @
24b29e5c
...
...
@@ -39,8 +39,7 @@ public class ComponentScan implements IComponent {
String
actionName
=
cc
.
getActionName
();
switch
(
actionName
)
{
case
"openScanActivity"
:
openScanActivity
(
cc
);
break
;
return
openScanActivity
(
cc
);
default
:
//这个逻辑分支上没有调用CC.sendCCResult(...),是一种错误的示例
//并且方法的返回值为false,代表不会异步调用CC.sendCCResult(...)
...
...
@@ -51,8 +50,8 @@ public class ComponentScan implements IComponent {
}
private
void
openScanActivity
(
CC
cc
)
{
private
boolean
openScanActivity
(
CC
cc
)
{
CCUtil
.
navigateTo
(
cc
,
MipcaCaptureActivity
.
class
);
CC
.
sendCCResult
(
cc
.
getCallId
(),
CCResult
.
success
())
;
return
true
;
}
}
component-scan/src/main/java/com/gingersoft/gsa/cloud/scan/mvp/ui/activity/MipcaCaptureActivity.java
View file @
24b29e5c
package
com
.
gingersoft
.
gsa
.
cloud
.
scan
.
mvp
.
ui
.
activity
;
import
android.Manifest
;
import
android.app.Activity
;
import
android.content.ContentUris
;
import
android.content.Context
;
import
android.content.Intent
;
...
...
@@ -11,17 +10,20 @@ import android.net.Uri;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Environment
;
import
android.os.Handler
;
import
android.os.Message
;
import
android.os.Vibrator
;
import
android.provider.DocumentsContract
;
import
android.provider.MediaStore
;
import
android.util.Log
;
import
android.view.View
;
import
android.widget.TextView
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
androidx.core.content.ContextCompat
;
import
com.billy.cc.core.component.CC
;
import
com.billy.cc.core.component.CCResult
;
import
com.billy.cc.core.component.CCUtil
;
import
com.gingersoft.gsa.cloud.common.scan.ScanHelper
;
import
com.gingersoft.gsa.cloud.common.utils.view.BitmapUtil
;
import
com.gingersoft.gsa.cloud.scan.R
;
...
...
@@ -41,19 +43,18 @@ import com.jess.arms.di.component.AppComponent;
import
com.jess.arms.mvp.BasePresenter
;
import
com.jess.arms.mvp.IView
;
import
com.jess.arms.utils.ArmsUtils
;
import
com.jess.arms.utils.DeviceUtils
;
import
com.jess.arms.utils.Preconditions
;
import
com.qmuiteam.qmui.widget.QMUITopBar
;
import
java.lang.ref.WeakReference
;
import
java.util.Hashtable
;
import
butterknife.BindView
;
import
butterknife.OnClick
;
import
cn.bingoogolapple.qrcode.core.BarcodeType
;
import
cn.bingoogolapple.qrcode.core.QRCodeView
;
import
cn.bingoogolapple.qrcode.zxing.ZXingView
;
public
class
MipcaCaptureActivity
extends
BaseActivity
<
BasePresenter
>
implements
IView
,
QRCodeView
.
Delegate
{
public
class
MipcaCaptureActivity
extends
BaseActivity
<
BasePresenter
>
implements
IView
,
QRCodeView
.
Delegate
{
@BindView
(
R2
.
id
.
topbar
)
...
...
@@ -73,6 +74,9 @@ public class MipcaCaptureActivity extends BaseActivity<BasePresenter> implements
};
private
String
title
=
"掃碼"
;
public
final
static
String
QR_RESULT_CODE
=
"qrCodeResult"
;
public
final
static
String
SCAN_MODE
=
"scanMode"
;
@Override
public
void
setupActivityComponent
(
@NonNull
AppComponent
appComponent
)
{
...
...
@@ -91,8 +95,12 @@ public class MipcaCaptureActivity extends BaseActivity<BasePresenter> implements
@Override
public
void
initData
(
@Nullable
Bundle
savedInstanceState
)
{
mZXingView
.
setDelegate
(
this
);
BarcodeType
navigateParam
=
CCUtil
.
getNavigateParam
(
this
,
SCAN_MODE
,
BarcodeType
.
ALL
);
mZXingView
.
setType
(
navigateParam
,
null
);
if
(
BarcodeType
.
ONE_DIMENSION
==
navigateParam
)
{
mZXingView
.
changeToScanBarcodeStyle
();
}
}
@Override
...
...
@@ -110,8 +118,8 @@ public class MipcaCaptureActivity extends BaseActivity<BasePresenter> implements
@Override
public
void
onClick
(
View
v
)
{
Intent
intent
=
new
Intent
();
intent
.
putExtra
(
"qrCodeResult"
,
""
);
setResult
(
ScanHelper
.
CALL_BACK_QR_RESULT
,
intent
);
intent
.
putExtra
(
QR_RESULT_CODE
,
""
);
setResult
(
ScanHelper
.
CALL_BACK_QR_RESULT
,
intent
);
killMyself
();
}
});
...
...
@@ -121,8 +129,8 @@ public class MipcaCaptureActivity extends BaseActivity<BasePresenter> implements
@Override
public
void
onBackPressed
()
{
Intent
intent
=
new
Intent
();
intent
.
putExtra
(
"qrCodeResult"
,
""
);
setResult
(
ScanHelper
.
CALL_BACK_QR_RESULT
,
intent
);
intent
.
putExtra
(
QR_RESULT_CODE
,
""
);
setResult
(
ScanHelper
.
CALL_BACK_QR_RESULT
,
intent
);
killMyself
();
}
...
...
@@ -195,7 +203,6 @@ public class MipcaCaptureActivity extends BaseActivity<BasePresenter> implements
// 显示扫描框,并开始识别
mZXingView
.
startSpotAndShowRect
();
if
(
requestCode
==
PHOTOZOOM
)
{
if
(
data
==
null
)
{
return
;
...
...
@@ -252,8 +259,10 @@ public class MipcaCaptureActivity extends BaseActivity<BasePresenter> implements
mZXingView
.
startSpot
();
Intent
intent
=
new
Intent
();
intent
.
putExtra
(
"qrCodeResult"
,
result
);
setResult
(
ScanHelper
.
CALL_BACK_QR_RESULT
,
intent
);
intent
.
putExtra
(
QR_RESULT_CODE
,
result
);
setResult
(
ScanHelper
.
CALL_BACK_QR_RESULT
,
intent
);
CC
.
sendCCResult
(
CCUtil
.
getNavigateCallId
(
this
),
CCResult
.
success
(
QR_RESULT_CODE
,
result
));
killMyself
();
}
...
...
component-supply-chain/build.gradle
View file @
24b29e5c
...
...
@@ -65,4 +65,7 @@ dependencies {
implementation
rootProject
.
ext
.
dependencies
[
"glide"
]
annotationProcessor
rootProject
.
ext
.
dependencies
[
"glide-compiler"
]
implementation
'com.github.yalantis:ucrop:2.2.6'
if
(
project
.
ext
.
runAsApp
)
{
addComponent
'component-scan'
}
}
\ No newline at end of file
component-supply-chain/src/main/AndroidManifest.xml
View file @
24b29e5c
...
...
@@ -5,7 +5,10 @@
<uses-permission
android:name=
"android.permission.READ_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<!--相机权限-->
<uses-feature
android:name=
"android.hardware.camera"
/>
<uses-feature
android:name=
"android.hardware.camera.autofocus"
/>
<uses-permission
android:name=
"android.permission.CAMERA"
/>
<uses-permission
android:name=
"android.permission.FLASHLIGHT"
/>
<application
android:networkSecurityConfig=
"@xml/network_android"
>
<activity
android:name=
".mvp.ui.activity.SupplyChainMainActivity"
/>
...
...
@@ -24,15 +27,15 @@
android:name=
"com.yalantis.ucrop.UCropActivity"
android:screenOrientation=
"portrait"
android:theme=
"@style/Theme.AppCompat.Light.NoActionBar"
/>
<!-- <provider-->
<!-- android:name="androidx.core.content.FileProvider"-->
<!-- android:authorities="${applicationId}.fileprovider"-->
<!-- android:exported="false"-->
<!-- android:grantUriPermissions="true">-->
<!-- <meta-data-->
<!-- android:name="android.support.FILE_PROVIDER_PATHS"-->
<!-- android:resource="@xml/gsa_purchase_paths" />-->
<!-- </provider>-->
<!-- <provider-->
<!-- android:name="androidx.core.content.FileProvider"-->
<!-- android:authorities="${applicationId}.fileprovider"-->
<!-- android:exported="false"-->
<!-- android:grantUriPermissions="true">-->
<!-- <meta-data-->
<!-- android:name="android.support.FILE_PROVIDER_PATHS"-->
<!-- android:resource="@xml/gsa_purchase_paths" />-->
<!-- </provider>-->
</application>
</manifest>
\ No newline at end of file
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/adapter/ConsumptionReasonAdapter.java
0 → 100644
View file @
24b29e5c
package
com
.
gingersoft
.
supply_chain
.
mvp
.
ui
.
adapter
;
import
androidx.appcompat.widget.AppCompatCheckBox
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.chad.library.adapter.base.viewholder.BaseViewHolder
;
import
com.gingersoft.supply_chain.R
;
import
com.gingersoft.supply_chain.mvp.bean.ConsumeReasonBean
;
import
org.jetbrains.annotations.NotNull
;
import
java.util.List
;
/**
* @author 宇航.
* User: admin
* Date: 2021/3/18
* Time: 18:06
* Use: 庫存損耗原因
*/
public
class
ConsumptionReasonAdapter
extends
BaseQuickAdapter
<
ConsumeReasonBean
,
BaseViewHolder
>
{
private
int
selectIndex
=
0
;
public
ConsumptionReasonAdapter
(
List
<
ConsumeReasonBean
>
consumeReasonBeans
)
{
super
(
R
.
layout
.
item_consumption_reason
,
consumeReasonBeans
);
addChildClickViewIds
(
R
.
id
.
cb_consumption_reason
);
}
@Override
protected
void
convert
(
@NotNull
BaseViewHolder
viewHolder
,
ConsumeReasonBean
consumeReasonBean
)
{
AppCompatCheckBox
compatCheckBox
=
viewHolder
.
getView
(
R
.
id
.
cb_consumption_reason
);
compatCheckBox
.
setText
(
consumeReasonBean
.
getDescription
());
compatCheckBox
.
setChecked
(
viewHolder
.
getAdapterPosition
()
==
selectIndex
);
}
public
int
getSelectIndex
()
{
return
selectIndex
;
}
public
void
setSelectIndex
(
int
selectIndex
)
{
int
lastSelect
=
this
.
selectIndex
;
this
.
selectIndex
=
selectIndex
;
if
(
lastSelect
<
getData
().
size
())
{
notifyItemChanged
(
lastSelect
);
}
if
(
this
.
selectIndex
<
getData
().
size
())
{
notifyItemChanged
(
this
.
selectIndex
);
}
}
}
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/fragment/order/OrderDetailsFragment.java
View file @
24b29e5c
...
...
@@ -48,6 +48,7 @@ import com.gingersoft.supply_chain.mvp.ui.adapter.OrderDetailsFoodAdapter;
import
com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment
;
import
com.gingersoft.supply_chain.mvp.ui.widget.ChooseUnitPopup
;
import
com.gingersoft.supply_chain.mvp.ui.widget.PurchaseListMorePopup
;
import
com.gingersoft.supply_chain.mvp.ui.widget.ScanSnPopup
;
import
com.gingersoft.supply_chain.mvp.utils.SelectPicture
;
import
com.google.android.material.checkbox.MaterialCheckBox
;
import
com.jess.arms.di.component.AppComponent
;
...
...
@@ -361,7 +362,13 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
// return;
// }
//判斷是不是sn食材
// new XPopup.Builder(requireContext())
// .hasShadowBg(false)
// .asCustom(new ScanSnPopup(this, infoVosBean.getName(), null, scanResult -> {
// //當前食材infoVosBean裡面有個sn碼集合,將scanResult添加進去
//
// }))
// .show();
infoVosBean
.
setChecked
(!
infoVosBean
.
isChecked
());
adapter
.
notifyItemChanged
(
position
);
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/fragment/warehouse/WarehouseDetailsFragment.java
View file @
24b29e5c
package
com
.
gingersoft
.
supply_chain
.
mvp
.
ui
.
fragment
.
warehouse
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.Button
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
androidx.core.content.ContextCompat
;
import
androidx.viewpager.widget.ViewPager
;
import
androidx.viewpager2.widget.ViewPager2
;
import
com.gingersoft.gsa.cloud.common.loadsir.EmptyCallback
;
...
...
@@ -24,23 +23,19 @@ import com.gingersoft.supply_chain.di.component.DaggerWarehouseDetailsComponent;
import
com.gingersoft.supply_chain.mvp.bean.ConsumeReasonBean
;
import
com.gingersoft.supply_chain.mvp.bean.WareHouseListBean
;
import
com.gingersoft.supply_chain.mvp.bean.WarehouseDetailsBean
;
import
com.gingersoft.supply_chain.mvp.content.Constant
;
import
com.gingersoft.supply_chain.mvp.contract.WarehouseDetailsContract
;
import
com.gingersoft.supply_chain.mvp.presenter.WarehouseDetailsPresenter
;
import
com.gingersoft.supply_chain.mvp.ui.adapter.PurchasePageAdapter
;
import
com.gingersoft.supply_chain.mvp.ui.adapter.WareHousingDetailsAdapter
;
import
com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment
;
import
com.gingersoft.supply_chain.mvp.ui.widget.InventoryConsumptionPopup
;
import
com.gingersoft.supply_chain.mvp.ui.widget.InventoryConsumptionView
;
import
com.gingersoft.supply_chain.mvp.ui.widget.ScanSnView
;
import
com.jess.arms.di.component.AppComponent
;
import
com.kingja.loadsir.core.LoadSir
;
import
com.lxj.xpopup.XPopup
;
import
com.qmuiteam.qmui.widget.QMUITopBar
;
import
com.scwang.smartrefresh.layout.SmartRefreshLayout
;
import
com.scwang.smartrefresh.layout.api.RefreshLayout
;
import
com.scwang.smartrefresh.layout.listener.OnRefreshListener
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
butterknife.BindView
;
...
...
@@ -74,7 +69,15 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
SmartRefreshLayout
smartRefreshLayout
;
@BindView
(
R2
.
id
.
tv_food_unit
)
TextView
tvUnit
;
@BindView
(
R2
.
id
.
layout_warehousing_root
)
LinearLayout
layoutRoot
;
@BindView
(
R2
.
id
.
layout_warehousing_title
)
LinearLayout
layoutTitle
;
//庫存消耗view
private
InventoryConsumptionView
inventoryConsumptionView
;
//掃碼sn碼view
private
ScanSnView
scanSnView
;
private
WareHousingDetailsAdapter
wareHousingDetailsAdapter
;
private
PurchasePageAdapter
adapter
;
private
int
foodId
;
...
...
@@ -254,15 +257,41 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
button
.
setTextColor
(
ContextCompat
.
getColor
(
requireContext
(),
R
.
color
.
white
));
button
.
setOnClickListener
(
v
->
{
//庫存消耗
InventoryConsumptionPopup
inventoryConsumptionPopup
=
new
InventoryConsumptionPopup
(
requireContext
(),
consumeReasonBeans
,
wareHousingNum
);
inventoryConsumptionPopup
.
setOnConfirmClickListener
((
consumptionNum
,
reasonIndex
,
remarks
)
->
{
inventoryConsumptionPopup
.
dismiss
();
mPresenter
.
consumeWareHousing
(
foodNo
,
consumptionNum
,
consumeReasonBeans
.
get
(
reasonIndex
).
getId
(),
remarks
);
// InventoryConsumptionPopup inventoryConsumptionPopup = new InventoryConsumptionPopup(requireContext(), consumeReasonBeans, wareHousingNum);
// inventoryConsumptionPopup.setOnConfirmClickListener((consumptionNum, reasonIndex, remarks) -> {
// inventoryConsumptionPopup.dismiss();
// mPresenter.consumeWareHousing(foodNo, consumptionNum, consumeReasonBeans.get(reasonIndex).getId(), remarks);
// setFragmentResult(RESULT_OK, null);
// });
// inventoryConsumptionPopup.setTitleContent(getString(R.string.str_consumption_inventory), getString(R.string.str_remark_colon), getString(R.string.str_manual_input));
// new XPopup.Builder(requireContext())
// .asCustom(inventoryConsumptionPopup).show();
smartRefreshLayout
.
setVisibility
(
View
.
GONE
);
layoutTitle
.
setVisibility
(
View
.
GONE
);
loadService
.
getLoadLayout
().
setVisibility
(
View
.
GONE
);
inventoryConsumptionView
=
new
InventoryConsumptionView
(
requireContext
(),
consumeReasonBeans
,
wareHousingNum
);
layoutRoot
.
addView
(
inventoryConsumptionView
);
scanSnView
=
new
ScanSnView
(
this
,
null
,
scanResult
->
{
smartRefreshLayout
.
setVisibility
(
View
.
VISIBLE
);
layoutTitle
.
setVisibility
(
View
.
VISIBLE
);
loadService
.
getLoadLayout
().
setVisibility
(
View
.
VISIBLE
);
//獲取用戶輸入的消耗數量
int
consumptionNum
=
inventoryConsumptionView
.
getConsumptionNum
();
if
(
consumptionNum
==
-
1
)
{
return
;
}
mPresenter
.
consumeWareHousing
(
foodNo
,
consumptionNum
,
consumeReasonBeans
.
get
(
inventoryConsumptionView
.
getReasonIndex
()).
getId
(),
inventoryConsumptionView
.
getRemark
());
setFragmentResult
(
RESULT_OK
,
null
);
}).
setOnCancelListener
(()
->
{
//取消
smartRefreshLayout
.
setVisibility
(
View
.
VISIBLE
);
layoutTitle
.
setVisibility
(
View
.
VISIBLE
);
loadService
.
getLoadLayout
().
setVisibility
(
View
.
VISIBLE
);
});
inventoryConsumptionPopup
.
setTitleContent
(
getString
(
R
.
string
.
str_consumption_inventory
),
getString
(
R
.
string
.
str_remark_colon
),
getString
(
R
.
string
.
str_manual_input
));
new
XPopup
.
Builder
(
requireContext
())
.
asCustom
(
inventoryConsumptionPopup
).
show
();
layoutRoot
.
addView
(
scanSnView
);
});
}
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/widget/InventoryConsumptionPopup.java
View file @
24b29e5c
This diff is collapsed.
Click to expand it.
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/widget/InventoryConsumptionView.java
0 → 100644
View file @
24b29e5c
package
com
.
gingersoft
.
supply_chain
.
mvp
.
ui
.
widget
;
import
android.content.Context
;
import
android.text.Editable
;
import
android.text.InputFilter
;
import
android.text.TextWatcher
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.widget.EditText
;
import
android.widget.FrameLayout
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
androidx.annotation.NonNull
;
import
androidx.appcompat.widget.SwitchCompat
;
import
androidx.recyclerview.widget.GridLayoutManager
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.gingersoft.gsa.cloud.common.utils.inputFilter.InputFilterUtils
;
import
com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils
;
import
com.gingersoft.gsa.cloud.ui.adapter.multi.RemarkProvider
;
import
com.gingersoft.supply_chain.R
;
import
com.gingersoft.supply_chain.R2
;
import
com.gingersoft.supply_chain.mvp.bean.ConsumeReasonBean
;
import
com.gingersoft.supply_chain.mvp.ui.adapter.ConsumptionReasonAdapter
;
import
com.qmuiteam.qmui.alpha.QMUIAlphaTextView
;
import
java.util.List
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
/**
* @author 宇航.
* User: admin
* Date: 2021/3/18
* Time: 18:00
* Use: 庫存消耗
*/
public
class
InventoryConsumptionView
extends
FrameLayout
{
private
final
int
maxConsumption
;
@BindView
(
R2
.
id
.
et_input
)
EditText
edInput
;
@BindView
(
R2
.
id
.
switch_multi_boolean_state
)
SwitchCompat
switchMultiBooleanState
;
@BindView
(
R2
.
id
.
rv_inventory_consumption_reason
)
RecyclerView
rvConsumptionReason
;
@BindView
(
R2
.
id
.
ed_inventory_consumption_remark
)
EditText
edRemarks
;
@BindView
(
R2
.
id
.
tv_confirm
)
QMUIAlphaTextView
tvConfirm
;
@BindView
(
R2
.
id
.
tv_cancel
)
QMUIAlphaTextView
tvCancel
;
private
OnConfirmClickListener
onConfirmClickListener
;
private
ConsumptionReasonAdapter
consumptionReasonAdapter
;
public
InventoryConsumptionView
(
@NonNull
Context
context
,
List
<
ConsumeReasonBean
>
consumeReasonBeans
,
int
maxConsumption
)
{
super
(
context
);
View
rootView
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
layout_inventory_consumption
,
null
,
false
);
ButterKnife
.
bind
(
this
,
rootView
);
addView
(
rootView
);
this
.
maxConsumption
=
maxConsumption
;
edRemarks
.
setFilters
(
new
InputFilter
[]{
InputFilterUtils
.
getLengthFilter
(
getContext
(),
RemarkProvider
.
REMARK_TEXT_LENGTH
),
InputFilterUtils
.
getChAndEnAndNumAndPtInputFilter
(
getContext
())});
consumptionReasonAdapter
=
new
ConsumptionReasonAdapter
(
consumeReasonBeans
);
consumptionReasonAdapter
.
setOnItemChildClickListener
((
adapter
,
view
,
position
)
->
consumptionReasonAdapter
.
setSelectIndex
(
position
));
rvConsumptionReason
.
setLayoutManager
(
new
GridLayoutManager
(
getContext
(),
2
));
rvConsumptionReason
.
setAdapter
(
consumptionReasonAdapter
);
tvConfirm
.
setOnClickListener
(
v
->
{
if
(
onConfirmClickListener
!=
null
)
{
String
s
=
edInput
.
getText
().
toString
();
try
{
int
i
=
Integer
.
parseInt
(
s
);
if
(
i
>
0
)
{
if
(
i
>
maxConsumption
)
{
edInput
.
setError
(
"不能超過當前庫存數量:"
+
maxConsumption
);
}
else
{
onConfirmClickListener
.
onConfirm
(
i
,
consumptionReasonAdapter
.
getSelectIndex
(),
edRemarks
.
getText
().
toString
());
}
}
else
{
ToastUtils
.
show
(
getContext
(),
"請輸入消耗庫存數"
);
edInput
.
setError
(
"請輸入消耗庫存數"
);
}
}
catch
(
NumberFormatException
e
)
{
e
.
printStackTrace
();
ToastUtils
.
show
(
getContext
(),
"請輸入消耗庫存數"
);
edInput
.
setError
(
"請輸入消耗庫存數"
);
}
}
});
edInput
.
addTextChangedListener
(
new
TextWatcher
()
{
@Override
public
void
beforeTextChanged
(
CharSequence
s
,
int
start
,
int
count
,
int
after
)
{
}
@Override
public
void
onTextChanged
(
CharSequence
s
,
int
start
,
int
before
,
int
count
)
{
}
@Override
public
void
afterTextChanged
(
Editable
s
)
{
try
{
int
i
=
Integer
.
parseInt
(
s
.
toString
());
if
(
i
>
maxConsumption
)
{
edInput
.
setError
(
"不能超過當前庫存數量:"
+
maxConsumption
);
}
}
catch
(
NumberFormatException
e
)
{
e
.
printStackTrace
();
}
}
});
}
public
InventoryConsumptionView
setOnConfirmClickListener
(
OnConfirmClickListener
onConfirmClickListener
)
{
this
.
onConfirmClickListener
=
onConfirmClickListener
;
return
this
;
}
public
String
getRemark
()
{
return
edRemarks
.
getText
().
toString
();
}
/**
* 獲取選中的原因下標
*
* @return 原因下標
*/
public
int
getReasonIndex
()
{
return
consumptionReasonAdapter
.
getSelectIndex
();
}
/**
* 獲取消耗數量
*
* @return 輸入的數量
*/
public
int
getConsumptionNum
()
{
String
s
=
edInput
.
getText
().
toString
();
try
{
int
i
=
Integer
.
parseInt
(
s
);
if
(
i
>
0
)
{
if
(
i
>
maxConsumption
)
{
edInput
.
setError
(
"不能超過當前庫存數量:"
+
maxConsumption
);
return
-
1
;
}
else
{
return
i
;
}
}
else
{
ToastUtils
.
show
(
getContext
(),
"請輸入消耗庫存數"
);
edInput
.
setError
(
"請輸入消耗庫存數"
);
return
-
1
;
}
}
catch
(
NumberFormatException
e
)
{
e
.
printStackTrace
();
ToastUtils
.
show
(
getContext
(),
"請輸入消耗庫存數"
);
edInput
.
setError
(
"請輸入消耗庫存數"
);
return
-
1
;
}
}
public
interface
OnConfirmClickListener
{
/**
* 確認時,將消耗的庫存,原因,備註傳遞回去
*
* @param consumptionNum 消耗的庫存數量
* @param reasonIndex 原因下標
* @param remarks 備註
*/
void
onConfirm
(
int
consumptionNum
,
int
reasonIndex
,
String
remarks
);
}
}
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/widget/ScanSnPopup.java
0 → 100644
View file @
24b29e5c
package
com
.
gingersoft
.
supply_chain
.
mvp
.
ui
.
widget
;
import
android.annotation.SuppressLint
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
androidx.annotation.NonNull
;
import
androidx.fragment.app.Fragment
;
import
com.gingersoft.supply_chain.R
;
import
com.gingersoft.supply_chain.R2
;
import
com.jess.arms.utils.DeviceUtils
;
import
com.lxj.xpopup.core.BottomPopupView
;
import
java.util.ArrayList
;
import
java.util.List
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
/**
* @author 宇航.
* User: admin
* Date: 2021/3/18
* Time: 10:01
* Use: 掃描sn碼彈窗
*/
public
class
ScanSnPopup
extends
BottomPopupView
{
private
final
String
foodName
;
private
final
List
<
String
>
snCodes
;
private
final
Fragment
fragment
;
@BindView
(
R2
.
id
.
tv_food_Ingredients_name
)
TextView
tvFoodIngredientsName
;
@BindView
(
R2
.
id
.
tv_food_inbound_quantity
)
TextView
tvFoodInboundQuantity
;
@BindView
(
R2
.
id
.
layout_scan_sn
)
LinearLayout
rootLayout
;
private
OnScanResultListener
onScanResultListener
;
public
ScanSnPopup
(
@NonNull
Fragment
fragment
,
String
foodName
,
List
<
String
>
snCodes
,
OnScanResultListener
onScanResultListener
)
{
super
(
fragment
.
requireContext
());
if
(
snCodes
==
null
)
{
snCodes
=
new
ArrayList
<>();
}
this
.
foodName
=
foodName
;
this
.
snCodes
=
snCodes
;
this
.
fragment
=
fragment
;
this
.
onScanResultListener
=
onScanResultListener
;
addInnerContent
();
}
@Override
protected
int
getImplLayoutId
()
{
return
R
.
layout
.
popup_scan_sn
;
}
@Override
@SuppressLint
(
"ClickableViewAccessibility"
)
protected
void
initPopupContent
()
{
super
.
initPopupContent
();
ButterKnife
.
bind
(
this
);
tvFoodIngredientsName
.
setText
(
foodName
);
tvFoodInboundQuantity
.
setText
(
String
.
valueOf
(
snCodes
.
size
()));
rootLayout
.
addView
(
new
ScanSnView
(
fragment
,
snCodes
,
onScanResultListener
).
setOnCancelListener
(()
->
dismiss
()));
}
@Override
protected
int
getMaxHeight
()
{
return
(
int
)
(
DeviceUtils
.
getScreenHeight
(
getContext
())
/
2
);
}
@Override
protected
int
getPopupHeight
()
{
return
(
int
)
(
DeviceUtils
.
getScreenHeight
(
getContext
())
/
2
);
}
public
interface
OnScanResultListener
{
/**
* 掃完碼確認之後回調
*
* @param scanResult 本次掃碼結果
*/
void
onScanResult
(
List
<
String
>
scanResult
);
}
}
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/widget/ScanSnView.java
0 → 100644
View file @
24b29e5c
package
com
.
gingersoft
.
supply_chain
.
mvp
.
ui
.
widget
;
import
android.content.Context
;
import
android.util.AttributeSet
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.widget.EditText
;
import
android.widget.FrameLayout
;
import
androidx.annotation.Nullable
;
import
androidx.core.content.ContextCompat
;
import
androidx.fragment.app.Fragment
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.billy.cc.core.component.CC
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.chad.library.adapter.base.viewholder.BaseViewHolder
;
import
com.gingersoft.gsa.cloud.common.utils.XPermissionUtils
;
import
com.gingersoft.gsa.cloud.common.utils.other.TextUtil
;
import
com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils
;
import
com.gingersoft.gsa.cloud.component.ComponentName
;
import
com.gingersoft.gsa.cloud.ui.utils.AppDialog
;
import
com.gingersoft.supply_chain.R
;
import
com.gingersoft.supply_chain.R2
;
import
com.lxj.xpopup.interfaces.OnCancelListener
;
import
com.qmuiteam.qmui.alpha.QMUIAlphaButton
;
import
com.qmuiteam.qmui.alpha.QMUIAlphaImageButton
;
import
com.qmuiteam.qmui.alpha.QMUIAlphaTextView
;
import
org.jetbrains.annotations.NotNull
;
import
java.util.List
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
import
cn.bingoogolapple.qrcode.core.BarcodeType
;
/**
* @author 宇航.
* User: admin
* Date: 2021/3/18
* Time: 17:23
* Use: 掃描sn碼
*/
public
class
ScanSnView
extends
FrameLayout
{
private
List
<
String
>
snCodes
;
private
ScanSnPopup
.
OnScanResultListener
onScanResultListener
;
@BindView
(
R2
.
id
.
rv_sn_code
)
RecyclerView
rvSnCode
;
@BindView
(
R2
.
id
.
btn_confirm_sn
)
QMUIAlphaButton
btnFoodIngredientsConfirm
;
@BindView
(
R2
.
id
.
btn_cancel_sn
)
QMUIAlphaButton
btnFoodIngredientsCancel
;
@BindView
(
R2
.
id
.
ed_input_sn
)
EditText
edInputSn
;
@BindView
(
R2
.
id
.
iv_scan_sn
)
QMUIAlphaImageButton
btnScanSN
;
@BindView
(
R2
.
id
.
tv_submit_sn
)
QMUIAlphaTextView
tvSubmitSN
;
private
Fragment
fragment
;
private
OnCancelListener
onCancelListener
;
public
ScanSnView
(
Fragment
fragment
,
List
<
String
>
snCodes
,
ScanSnPopup
.
OnScanResultListener
onScanResultListener
)
{
super
(
fragment
.
requireContext
());
this
.
snCodes
=
snCodes
;
this
.
onScanResultListener
=
onScanResultListener
;
this
.
fragment
=
fragment
;
init
();
}
public
ScanSnView
(
Context
context
)
{
this
(
context
,
null
);
}
public
ScanSnView
(
Context
context
,
@Nullable
AttributeSet
attrs
)
{
this
(
context
,
attrs
,
-
1
);
}
public
ScanSnView
(
Context
context
,
@Nullable
AttributeSet
attrs
,
int
defStyleAttr
)
{
super
(
context
,
attrs
,
defStyleAttr
);
init
();
}
private
void
init
()
{
View
rootView
=
LayoutInflater
.
from
(
getContext
()).
inflate
(
R
.
layout
.
layout_scan_sn
,
null
,
false
);
ButterKnife
.
bind
(
this
,
rootView
);
//初始化adapter
SnCodeAdapter
adapter
=
new
SnCodeAdapter
(
R
.
layout
.
item_sn_code
,
snCodes
);
rvSnCode
.
setAdapter
(
adapter
);
//掃描sn媽
btnScanSN
.
setOnClickListener
(
v
->
XPermissionUtils
.
launchCamera
(
fragment
,
(
allGranted
,
grantedList
,
deniedList
)
->
{
if
(
allGranted
)
{
//去掃碼頁面
CC
.
obtainBuilder
(
ComponentName
.
COMPONENT_SCAN
)
.
setActionName
(
"openScanActivity"
)
.
addParam
(
"scanMode"
,
BarcodeType
.
ONE_DIMENSION
)
.
build
()
.
callAsyncCallbackOnMainThread
((
cc
,
result
)
->
{
Object
qrCodeResult
=
result
.
getDataItem
(
"qrCodeResult"
);
if
(
qrCodeResult
!=
null
)
{
String
snCode
=
String
.
valueOf
(
qrCodeResult
);
if
(
adapter
.
getData
().
contains
(
snCode
))
{
ToastUtils
.
show
(
getContext
(),
"商品已存在"
);
}
else
{
adapter
.
addData
(
String
.
valueOf
(
qrCodeResult
));
}
}
});
}
})
);
//提交按鈕
tvSubmitSN
.
setOnClickListener
(
v
->
{
//提交輸入框中的sn碼
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
edInputSn
))
{
adapter
.
addData
(
edInputSn
.
getText
().
toString
());
edInputSn
.
setText
(
""
);
}
});
btnFoodIngredientsConfirm
.
setOnClickListener
(
v
->
{
//保存本次掃描的所有sn碼
onScanResultListener
.
onScanResult
(
adapter
.
getData
());
});
btnFoodIngredientsCancel
.
setOnClickListener
(
v
->
{
if
(
adapter
.
getData
().
size
()
>
0
)
{
AppDialog
.
getInstance
().
showWaringDialog
(
getContext
(),
"關閉後不會保存SN碼記錄"
,
(
view
,
dialog
)
->
{
dialog
.
dismiss
();
onCancelListener
.
onCancel
();
});
}
else
if
(
onCancelListener
!=
null
)
{
onCancelListener
.
onCancel
();
}
});
adapter
.
setOnItemChildClickListener
((
adapter1
,
view
,
position
)
->
{
if
(
view
.
getId
()
==
R
.
id
.
iv_sn_code_delete
)
{
adapter1
.
removeAt
(
position
);
}
});
addView
(
rootView
);
}
public
ScanSnView
setOnCancelListener
(
OnCancelListener
onCancelListener
)
{
this
.
onCancelListener
=
onCancelListener
;
return
this
;
}
public
interface
OnCancelListener
{
void
onCancel
();
}
private
static
class
SnCodeAdapter
extends
BaseQuickAdapter
<
String
,
BaseViewHolder
>
{
public
SnCodeAdapter
(
int
layoutResId
,
@org
.
jetbrains
.
annotations
.
Nullable
List
<
String
>
data
)
{
super
(
layoutResId
,
data
);
addChildClickViewIds
(
R
.
id
.
iv_sn_code_delete
);
}
@Override
protected
void
convert
(
@NotNull
BaseViewHolder
viewHolder
,
String
s
)
{
viewHolder
.
setText
(
R
.
id
.
tv_sn_code
,
s
);
viewHolder
.
setTextColor
(
R
.
id
.
tv_sn_code
,
ContextCompat
.
getColor
(
getContext
(),
R
.
color
.
color_3c
));
viewHolder
.
setTextColor
(
R
.
id
.
tv_serial_number
,
ContextCompat
.
getColor
(
getContext
(),
R
.
color
.
color_3c
));
viewHolder
.
setGone
(
R
.
id
.
iv_sn_code_delete
,
false
);
viewHolder
.
setGone
(
R
.
id
.
it_sn_code_operating
,
true
);
viewHolder
.
setText
(
R
.
id
.
tv_serial_number
,
String
.
valueOf
(
viewHolder
.
getAdapterPosition
()
+
1
));
if
(
viewHolder
.
getAdapterPosition
()
%
2
==
0
)
{
viewHolder
.
setBackgroundColor
(
R
.
id
.
layout_sn_code
,
ContextCompat
.
getColor
(
getContext
(),
R
.
color
.
color_f9
));
}
else
{
viewHolder
.
setBackgroundColor
(
R
.
id
.
layout_sn_code
,
ContextCompat
.
getColor
(
getContext
(),
R
.
color
.
white
));
}
}
}
}
component-supply-chain/src/main/res/layout/fragment_warehouse_details.xml
View file @
24b29e5c
...
...
@@ -2,6 +2,7 @@
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/layout_warehousing_root"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/supply_chain_bg_color"
...
...
@@ -95,6 +96,7 @@
</LinearLayout>
<LinearLayout
android:id=
"@+id/layout_warehousing_title"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/dp_10"
...
...
@@ -143,4 +145,5 @@
android:layout_height=
"match_parent"
android:layout_marginTop=
"@dimen/dp_10"
/>
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</LinearLayout>
\ No newline at end of file
component-supply-chain/src/main/res/layout/item_sn_code.xml
0 → 100644
View file @
24b29e5c
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:id=
"@+id/layout_sn_code"
android:layout_height=
"@dimen/dp_38"
android:background=
"@color/theme_color"
android:orientation=
"horizontal"
>
<TextView
android:id=
"@+id/tv_serial_number"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_weight=
"0.21"
android:gravity=
"center"
android:text=
"@string/str_serial_number"
android:textColor=
"@color/white"
/>
<include
layout=
"@layout/include_vertical_color_e8_dividing_line"
/>
<TextView
android:id=
"@+id/tv_sn_code"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_weight=
"0.55"
android:gravity=
"center"
android:text=
"@string/str_sn_code"
android:textColor=
"@color/white"
/>
<include
layout=
"@layout/include_vertical_color_e8_dividing_line"
/>
<FrameLayout
android:layout_width=
"@dimen/dp_0"
android:layout_height=
"match_parent"
android:layout_weight=
"0.24"
>
<ImageView
android:id=
"@+id/iv_sn_code_delete"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:visibility=
"gone"
android:src=
"@drawable/ic_delete"
/>
<TextView
android:id=
"@+id/it_sn_code_operating"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:text=
"@string/str_operating"
android:textColor=
"@color/white"
/>
</FrameLayout>
</LinearLayout>
\ No newline at end of file
component-supply-chain/src/main/res/layout/layout_inventory_consumption.xml
0 → 100644
View file @
24b29e5c
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/dp_500"
android:layout_margin=
"@dimen/dp_10"
android:background=
"@drawable/shape_white_eight_corners_bg"
android:orientation=
"vertical"
android:paddingLeft=
"@dimen/dp_10"
android:paddingRight=
"@dimen/dp_10"
android:paddingBottom=
"@dimen/dp_17"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_16"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
>
<TextView
android:id=
"@+id/tv_title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"消耗庫存:"
android:textColor=
"@color/color_3c"
android:textSize=
"@dimen/dp_15"
/>
<EditText
android:id=
"@+id/et_input"
android:layout_width=
"0dp"
android:layout_height=
"@dimen/dp_38"
android:layout_weight=
"1"
android:background=
"@drawable/selector_edit_48_aaa_bg"
android:inputType=
"number"
android:maxLines=
"1"
android:paddingLeft=
"@dimen/dp_5"
android:paddingTop=
"@dimen/dp_2"
android:paddingRight=
"@dimen/dp_5"
android:paddingBottom=
"@dimen/dp_2"
android:text=
""
android:textColor=
"@color/color_3c"
android:textCursorDrawable=
"@drawable/cursor_theme"
android:textSize=
"@dimen/sp_16"
/>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
>
<androidx.appcompat.widget.SwitchCompat
android:id=
"@+id/switch_multi_boolean_state"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/dp_5"
android:shadowColor=
"@color/trans"
android:thumb=
"@drawable/shape_thumb_on"
android:track=
"@drawable/selector_switch_track"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:switchPadding=
"@dimen/dp_5"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<TextView
android:id=
"@+id/tv_update_reason"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_15"
android:text=
"更新原因:"
android:textColor=
"@color/color_3c"
android:textSize=
"@dimen/dp_15"
/>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_inventory_consumption_reason"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_10"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_20"
android:orientation=
"horizontal"
>
<TextView
android:id=
"@+id/tv_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/str_remark_colon"
android:textColor=
"@color/color_3c"
android:textSize=
"@dimen/dp_17"
/>
<EditText
android:id=
"@+id/ed_inventory_consumption_remark"
style=
"@style/Remark_editStyle"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"手動輸入"
android:text=
""
/>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_20"
android:orientation=
"horizontal"
android:visibility=
"gone"
>
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id=
"@+id/tv_confirm"
style=
"@style/app_btn_style"
android:layout_width=
"@dimen/dp_0"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:gravity=
"center"
android:paddingTop=
"@dimen/dp_12"
android:paddingBottom=
"@dimen/dp_12"
android:text=
"@string/str_determine"
/>
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id=
"@+id/tv_cancel"
style=
"@style/Cancel_Btn_Style"
android:layout_width=
"@dimen/dp_0"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/dp_13"
android:layout_weight=
"1"
android:gravity=
"center"
android:paddingTop=
"@dimen/dp_12"
android:paddingBottom=
"@dimen/dp_12"
android:text=
"@string/str_cancel"
/>
</LinearLayout>
</LinearLayout>
component-supply-chain/src/main/res/layout/layout_scan_sn.xml
0 → 100644
View file @
24b29e5c
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:orientation=
"vertical"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_9"
android:layout_marginBottom=
"@dimen/dp_6"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
android:paddingLeft=
"@dimen/dp_19"
android:paddingRight=
"@dimen/dp_19"
>
<TextView
style=
"@style/WareHouse_Title_TextStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/str_enter_scan_sn"
/>
<LinearLayout
android:layout_width=
"0dp"
android:layout_height=
"@dimen/dp_31"
android:layout_weight=
"1"
android:background=
"@drawable/shape_edit_border_c8"
android:orientation=
"horizontal"
>
<EditText
android:id=
"@+id/ed_input_sn"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_marginRight=
"@dimen/dp_4"
android:layout_weight=
"1"
android:background=
"@null"
android:gravity=
"center_vertical"
android:hint=
"@string/str_please_input"
android:inputType=
"number"
android:paddingLeft=
"@dimen/dp_8"
android:textColor=
"@color/theme_333_color"
android:textColorHint=
"@color/color_b8"
android:textSize=
"@dimen/dp_14"
/>
<com.qmuiteam.qmui.alpha.QMUIAlphaImageButton
android:id=
"@+id/iv_scan_sn"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_marginTop=
"@dimen/dp_4"
android:layout_marginRight=
"@dimen/dp_10"
android:layout_marginBottom=
"@dimen/dp_4"
android:src=
"@drawable/ic_black_scan"
/>
</LinearLayout>
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id=
"@+id/tv_submit_sn"
android:layout_width=
"@dimen/dp_48"
android:layout_height=
"@dimen/dp_29"
android:layout_marginLeft=
"@dimen/dp_6"
android:background=
"@drawable/shape_theme_five_corners_bg"
android:gravity=
"center"
android:text=
"@string/str_submit"
android:textColor=
"@color/white"
android:textSize=
"@dimen/dp_12"
/>
</LinearLayout>
<include
layout=
"@layout/item_sn_code"
/>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_sn_code"
app:layoutManager=
"androidx.recyclerview.widget.LinearLayoutManager"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_weight=
"1"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_10"
android:layout_marginBottom=
"@dimen/dp_10"
android:orientation=
"horizontal"
>
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id=
"@+id/btn_confirm_sn"
style=
"@style/Save_Btn_Style"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/dp_20"
android:layout_weight=
"1"
android:text=
"@string/str_determine"
android:visibility=
"visible"
/>
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id=
"@+id/btn_cancel_sn"
style=
"@style/Cancel_Btn_Style"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/dp_13"
android:layout_marginRight=
"@dimen/dp_20"
android:layout_weight=
"1"
android:text=
"@string/str_cancel"
/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
component-supply-chain/src/main/res/layout/popup_scan_sn.xml
0 → 100644
View file @
24b29e5c
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/layout_scan_sn"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@color/white"
android:orientation=
"vertical"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:paddingLeft=
"@dimen/dp_19"
android:paddingTop=
"@dimen/dp_6"
android:paddingRight=
"@dimen/dp_19"
android:paddingBottom=
"@dimen/dp_6"
>
<TextView
style=
"@style/Supplier_Info_text_Style"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/str_ingredients_name"
/>
<TextView
android:id=
"@+id/tv_food_Ingredients_name"
style=
"@style/Supplier_Info_text_Style"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
tools:text=
"牛肉"
/>
<TextView
style=
"@style/Supplier_Info_text_Style"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/str_Inbound_quantity"
/>
<TextView
android:id=
"@+id/tv_food_inbound_quantity"
style=
"@style/Supplier_Info_text_Style"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
tools:text=
"10"
/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
component-supply-chain/src/main/res/values/strings.xml
View file @
24b29e5c
...
...
@@ -14,24 +14,18 @@
<string
name=
"str_consumption_inventory"
>
消耗庫存:
</string>
<string
name=
"str_manual_input"
>
手動輸入
</string>
<string
name=
"str_remark"
>
備註
</string>
<string
name=
"str_remark_colon"
>
備註:
</string>
<string
name=
"str_save"
>
保存
</string>
<string
name=
"str_format_purchase_no"
>
採購單號:%1$s
</string>
<string
name=
"str_format_warehouse_no"
>
入庫單號:%1$s
</string>
<string
name=
"str_format_remark"
>
備註:%1$d
</string>
<string
name=
"str_format_positive"
>
+%1$s
</string>
<string
name=
"str_format_less"
>
-%1$s
</string>
<string
name=
"str_unit_price_colon"
>
單價:$%1$.2f
</string>
<string
name=
"str_latest_unit_price_colon"
>
最新單價:$%1$.2f
</string>
<string
name=
"str_total_amount_colon"
>
總價:$%1$.2f
</string>
<string
name=
"str_cancel"
>
取消
</string>
<string
name=
"str_determine"
>
確定
</string>
<string
name=
"str_delete_category_tip"
>
是否確認刪除該類別【%1$s】,子類和食材將一同刪除?
</string>
<string
name=
"str_preview"
>
預覽
</string>
<string
name=
"str_ingredients_name"
>
食材名:
</string>
<string
name=
"str_Inbound_quantity"
>
入庫數量:
</string>
<string
name=
"str_enter_scan_sn"
>
輸入/掃描SN碼:
</string>
<string
name=
"str_sn_code"
>
SN碼
</string>
</resources>
\ No newline at end of file
library-common/src/main/java/com/gingersoft/gsa/cloud/common/utils/XPermissionUtils.java
0 → 100644
View file @
24b29e5c
package
com
.
gingersoft
.
gsa
.
cloud
.
common
.
utils
;
import
android.Manifest
;
import
androidx.fragment.app.Fragment
;
import
com.permissionx.guolindev.PermissionX
;
import
com.permissionx.guolindev.callback.RequestCallback
;
/**
* @author 宇航.
* User: admin
* Date: 2021/3/18
* Time: 15:32
* Use:
*/
public
class
XPermissionUtils
{
/**
* 请求摄像头权限
*/
public
static
void
launchCamera
(
Fragment
fragment
,
RequestCallback
callback
)
{
PermissionX
.
init
(
fragment
)
.
permissions
(
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
,
Manifest
.
permission
.
CAMERA
)
.
onExplainRequestReason
((
scope
,
deniedList
)
->
scope
.
showRequestReasonDialog
(
deniedList
,
"這個功能需要申請使用相機"
,
"確定"
,
"取消"
))
.
onForwardToSettings
((
scope
,
deniedList
)
->
scope
.
showForwardToSettingsDialog
(
deniedList
,
"您需要去設置當中開啟相機權限"
,
"確定"
,
"取消"
))
.
request
(
callback
);
}
}
library-common/src/main/res/drawable-xhdpi/ic_black_scan.png
0 → 100644
View file @
24b29e5c
1.31 KB
library-common/src/main/res/drawable/shape_edit_border_c8.xml
0 → 100644
View file @
24b29e5c
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<stroke
android:width=
"@dimen/dp_1"
android:color=
"@color/color_c8"
/>
<corners
android:radius=
"@dimen/dp_8"
/>
</shape>
\ No newline at end of file
library-common/src/main/res/drawable/shape_theme_five_corners_bg.xml
0 → 100644
View file @
24b29e5c
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"@color/theme_color"
/>
<corners
android:radius=
"@dimen/dp_5"
/>
</shape>
\ No newline at end of file
library-common/src/main/res/values/strings.xml
View file @
24b29e5c
...
...
@@ -222,5 +222,15 @@
<string
name=
"delivery_difference"
>
補差價:
</string>
<string
name=
"str_amount_tran"
>
$%1$.2f
</string>
<string
name=
"str_amount_tran_integer"
>
$%1$d
</string>
<string
name=
"str_submit"
>
提交
</string>
<string
name=
"str_please_input"
>
請輸入
</string>
<string
name=
"str_cancel"
>
取消
</string>
<string
name=
"str_determine"
>
確定
</string>
<string
name=
"str_remark"
>
備註
</string>
<string
name=
"str_remark_colon"
>
備註:
</string>
<string
name=
"str_save"
>
保存
</string>
<string
name=
"str_operating"
>
操作
</string>
<string
name=
"str_serial_number"
>
序號
</string>
</resources>
library-ui/src/main/res/layout/multi_item_boolean.xml
View file @
24b29e5c
...
...
@@ -18,6 +18,5 @@
android:layout_height=
"wrap_content"
android:shadowColor=
"@color/trans"
android:thumb=
"@drawable/shape_thumb_on"
android:track=
"@drawable/selector_switch_track"
app:trackTint=
"@color/theme_color"
/>
android:track=
"@drawable/selector_switch_track"
/>
</LinearLayout>
\ No newline at end of file
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