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
94e2feb7
Commit
94e2feb7
authored
Feb 03, 2021
by
Wyh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、印單打印問題 2、供應鏈運費代碼
parent
e9bb692c
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
639 additions
and
368 deletions
+639
-368
component-print/src/main/java/com/joe/print/mvp/print/service/PrjService.java
+200
-214
component-print/src/main/java/com/joe/print/mvp/ui/view/BillItemView.java
+2
-0
component-print/src/main/java/com/joe/print/mvp/ui/view/BillTypeView.java
+1
-0
component-print/src/main/java/com/joe/print/mvp/ui/view/BillView.java
+1
-0
component-print/src/main/java/com/joe/print/mvp/ui/view/PrintFoodView.java
+1
-0
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/bean/PurchaseFoodBean.java
+4
-0
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/bean/SupplierInfoBean.java
+8
-0
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/contract/WarehousingInventoryContract.java
+12
-0
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/model/WarehousingInventoryModel.java
+8
-0
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/FoodUnitPagePresenter.java
+2
-1
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/NewSupplierPresenter.java
+26
-9
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/ShoppingCatPresenter.java
+10
-3
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/WarehousingInventoryPresenter.java
+34
-0
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/server/SupplierServer.java
+9
-0
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/adapter/ShoppingCartAdapter.java
+60
-7
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/fragment/food/FoodUnitPageFragment.java
+4
-4
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/fragment/order/ShoppingCatFragment.java
+0
-2
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/fragment/warehouse/WarehousingInventoryFragment.java
+74
-45
component-supply-chain/src/main/res/layout/fragment_warehousing_inventory.xml
+144
-67
component-supply-chain/src/main/res/layout/item_basic_unit.xml
+1
-1
component-supply-chain/src/main/res/layout/item_shopping_cart.xml
+14
-4
component-table/src/main/res/layout/table_dialog_cancel_food.xml
+0
-1
component-table/src/main/res/values/styles.xml
+4
-4
library-common/src/main/res/drawable/shape_square_edit_border_aa.xml
+8
-0
library-ui/src/main/java/com/gingersoft/gsa/cloud/ui/adapter/multi/InputProvider.java
+12
-6
No files found.
component-print/src/main/java/com/joe/print/mvp/print/service/PrjService.java
View file @
94e2feb7
...
@@ -16,7 +16,6 @@ import com.epson.epos2.Epos2Exception;
...
@@ -16,7 +16,6 @@ import com.epson.epos2.Epos2Exception;
import
com.epson.epos2.printer.Printer
;
import
com.epson.epos2.printer.Printer
;
import
com.epson.epos2.printer.PrinterStatusInfo
;
import
com.epson.epos2.printer.PrinterStatusInfo
;
import
com.epson.epos2.printer.ReceiveListener
;
import
com.epson.epos2.printer.ReceiveListener
;
import
com.gingersoft.gsa.cloud.common.constans.GoldConstants
;
import
com.gingersoft.gsa.cloud.common.constans.HttpsConstans
;
import
com.gingersoft.gsa.cloud.common.constans.HttpsConstans
;
import
com.gingersoft.gsa.cloud.common.constans.PrintConstans
;
import
com.gingersoft.gsa.cloud.common.constans.PrintConstans
;
import
com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager
;
import
com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager
;
...
@@ -42,9 +41,7 @@ import com.gingersoft.gsa.cloud.print.bean.UpdateBean;
...
@@ -42,9 +41,7 @@ import com.gingersoft.gsa.cloud.print.bean.UpdateBean;
import
com.hyweb.n5.lib.constant.PrinterConstant
;
import
com.hyweb.n5.lib.constant.PrinterConstant
;
import
com.hyweb.n5.lib.util.PrinterUtil
;
import
com.hyweb.n5.lib.util.PrinterUtil
;
import
com.hyweb.n5.server.aidl.IOnPrintCallback
;
import
com.hyweb.n5.server.aidl.IOnPrintCallback
;
import
com.jess.arms.utils.RxLifecycleUtils
;
import
com.joe.print.mvp.print.PrintPrjKitchen
;
import
com.joe.print.mvp.print.PrintPrjKitchen
;
import
com.joe.print.mvp.print.PrinterRoot
;
import
com.joe.print.mvp.print.common.PrinterFinderCallback
;
import
com.joe.print.mvp.print.common.PrinterFinderCallback
;
import
com.joe.print.mvp.print.common.SendResultCode
;
import
com.joe.print.mvp.print.common.SendResultCode
;
import
com.joe.print.mvp.print.maker.PrjPrintMaker
;
import
com.joe.print.mvp.print.maker.PrjPrintMaker
;
...
@@ -64,7 +61,6 @@ import org.json.JSONObject;
...
@@ -64,7 +61,6 @@ import org.json.JSONObject;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.PrintStream
;
import
java.io.PrintStream
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.List
;
...
@@ -72,7 +68,6 @@ import java.util.Map;
...
@@ -72,7 +68,6 @@ import java.util.Map;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
import
io.reactivex.Observable
;
import
io.reactivex.Observer
;
import
io.reactivex.Observer
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.disposables.Disposable
;
import
io.reactivex.disposables.Disposable
;
...
@@ -94,13 +89,8 @@ import static com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean.PRINT_USB
...
@@ -94,13 +89,8 @@ import static com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean.PRINT_USB
*/
*/
public
class
PrjService
extends
Service
implements
ReceiveListener
{
public
class
PrjService
extends
Service
implements
ReceiveListener
{
// private static final String TAG = PrjService.class.getSimpleName();
private
Disposable
pollDisposable
;
private
Disposable
pollDisposable
;
private
Disposable
wakeDisposable
;
private
Disposable
wakeDisposable
;
private
List
<
PrinterDeviceBean
>
printerDeviceBeans
;
private
List
<
PrjBean
.
DataBean
.
Bean
>
printDatas
=
new
ArrayList
<>();
private
List
<
PrintCurrencyBean
>
printCurrencyBeans
;
//通用打印配置
private
Context
mContext
;
private
Context
mContext
;
private
String
TAG
=
"Prj"
;
private
String
TAG
=
"Prj"
;
...
@@ -116,17 +106,6 @@ public class PrjService extends Service implements ReceiveListener {
...
@@ -116,17 +106,6 @@ public class PrjService extends Service implements ReceiveListener {
public
int
onStartCommand
(
Intent
intent
,
int
flags
,
int
startId
)
{
public
int
onStartCommand
(
Intent
intent
,
int
flags
,
int
startId
)
{
mContext
=
this
;
mContext
=
this
;
LoganManager
.
w_printer
(
TAG
,
"onStartCommand"
);
LoganManager
.
w_printer
(
TAG
,
"onStartCommand"
);
RxIOTask
ioTask
=
new
RxIOTask
(
0
)
{
@Override
public
Object
doInIOThread
(
Object
o
)
{
LoganManager
.
w_printer
(
TAG
,
"获取打印設備信息"
);
LoganManager
.
w_printer
(
TAG
,
"currThredName-->"
+
Thread
.
currentThread
().
getName
());
//获取打印設備信息
getPrintList
();
return
null
;
}
};
RxJavaUtils
.
doInIOThread
(
ioTask
);
//開始請求
//開始請求
startGetPrjInfo
();
startGetPrjInfo
();
return
super
.
onStartCommand
(
intent
,
flags
,
startId
);
return
super
.
onStartCommand
(
intent
,
flags
,
startId
);
...
@@ -162,15 +141,6 @@ public class PrjService extends Service implements ReceiveListener {
...
@@ -162,15 +141,6 @@ public class PrjService extends Service implements ReceiveListener {
printerFinder
.
startFinder
();
printerFinder
.
startFinder
();
}
}
private
void
getPrintList
()
{
if
(
printerDeviceBeans
==
null
||
printerDeviceBeans
.
size
()
==
0
)
{
PrinterDeviceDaoUtils
printerDeviceDaoUtils
=
new
PrinterDeviceDaoUtils
(
this
);
printerDeviceBeans
=
printerDeviceDaoUtils
.
queryAllPrinterDeviceBean
();
printerDeviceDaoUtils
.
closeConnection
();
}
printCurrencyBeans
=
MyPrintUtils
.
getPrintCurrencyBeans
(
this
);
}
@Nullable
@Nullable
@Override
@Override
public
IBinder
onBind
(
Intent
intent
)
{
public
IBinder
onBind
(
Intent
intent
)
{
...
@@ -188,12 +158,9 @@ public class PrjService extends Service implements ReceiveListener {
...
@@ -188,12 +158,9 @@ public class PrjService extends Service implements ReceiveListener {
return
;
return
;
}
}
pollDisposable
=
RxJavaUtils
.
polling
(
10
,
30
,
TimeUnit
.
SECONDS
)
pollDisposable
=
RxJavaUtils
.
polling
(
10
,
30
,
TimeUnit
.
SECONDS
)
.
subscribe
(
new
Consumer
<
Long
>()
{
.
subscribe
(
aLong
->
{
@Override
LoganManager
.
w_printer
(
TAG
,
"獲取Prj數據-->"
);
public
void
accept
(
Long
aLong
)
throws
Exception
{
getPrjInfo
();
LoganManager
.
w_printer
(
TAG
,
"獲取Prj數據-->"
);
getPrjInfo
();
}
});
});
}
}
...
@@ -215,17 +182,13 @@ public class PrjService extends Service implements ReceiveListener {
...
@@ -215,17 +182,13 @@ public class PrjService extends Service implements ReceiveListener {
public
void
onNext
(
String
prjInfo
)
{
public
void
onNext
(
String
prjInfo
)
{
LoganManager
.
w_printer
(
TAG
,
"獲取Prj數據 onNext: "
+
prjInfo
);
LoganManager
.
w_printer
(
TAG
,
"獲取Prj數據 onNext: "
+
prjInfo
);
//請求到數據,停止輪詢,開始打印,在打印完之後再重新開始輪詢
//請求到數據,停止輪詢,開始打印,在打印完之後再重新開始輪詢
// startPrint(s);
newPrint
(
prjInfo
);
newPrint
(
prjInfo
);
//開啟另一個定時,三十秒之後自動請求,避免上面的打印成功或失敗時沒有回調。
//開啟另一個定時,三十秒之後自動請求,避免上面的打印成功或失敗時沒有回調。
cancel
(
wakeDisposable
);
cancel
(
wakeDisposable
);
wakeDisposable
=
RxJavaUtils
.
delay
(
30
,
TimeUnit
.
SECONDS
)
wakeDisposable
=
RxJavaUtils
.
delay
(
30
,
TimeUnit
.
SECONDS
)
.
subscribe
(
new
Consumer
<
Long
>()
{
.
subscribe
(
aLong
->
{
@Override
LoganManager
.
w_printer
(
TAG
,
"輪詢獲取Prj數據-->"
);
public
void
accept
(
Long
aLong
)
throws
Exception
{
startGetPrjInfo
();
LoganManager
.
w_printer
(
TAG
,
"輪詢獲取Prj數據-->"
);
startGetPrjInfo
();
}
});
});
}
}
...
@@ -254,7 +217,6 @@ public class PrjService extends Service implements ReceiveListener {
...
@@ -254,7 +217,6 @@ public class PrjService extends Service implements ReceiveListener {
private
int
currentIndex
;
private
int
currentIndex
;
private
void
newPrint
(
String
json
)
{
private
void
newPrint
(
String
json
)
{
printDatas
.
clear
();
Map
<
String
,
List
<
PrjBean
.
DataBean
.
Bean
>>
listMap
=
new
HashMap
<>();
Map
<
String
,
List
<
PrjBean
.
DataBean
.
Bean
>>
listMap
=
new
HashMap
<>();
currentIndex
=
0
;
currentIndex
=
0
;
totalPrj
=
0
;
totalPrj
=
0
;
...
@@ -300,8 +262,7 @@ public class PrjService extends Service implements ReceiveListener {
...
@@ -300,8 +262,7 @@ public class PrjService extends Service implements ReceiveListener {
LoganManager
.
w_printer
(
TAG
,
"newPrint JSONException: "
+
e
.
getMessage
());
LoganManager
.
w_printer
(
TAG
,
"newPrint JSONException: "
+
e
.
getMessage
());
}
}
setPrjIndex
(
listMap
,
totalPrj
);
setPrjIndex
(
listMap
,
totalPrj
);
initPrinterDevices
();
foreachPrint
(
listMap
,
getPrinterDevices
());
foreachPrint
(
listMap
);
}
}
private
Map
<
String
,
List
<
PrjBean
.
DataBean
.
Bean
>>
setPrjIndex
(
Map
<
String
,
List
<
PrjBean
.
DataBean
.
Bean
>>
listMap
,
int
totalPrj
)
{
private
Map
<
String
,
List
<
PrjBean
.
DataBean
.
Bean
>>
setPrjIndex
(
Map
<
String
,
List
<
PrjBean
.
DataBean
.
Bean
>>
listMap
,
int
totalPrj
)
{
...
@@ -330,7 +291,7 @@ public class PrjService extends Service implements ReceiveListener {
...
@@ -330,7 +291,7 @@ public class PrjService extends Service implements ReceiveListener {
return
listMap
;
return
listMap
;
}
}
private
void
foreachPrint
(
Map
<
String
,
List
<
PrjBean
.
DataBean
.
Bean
>>
listMap
)
{
private
void
foreachPrint
(
Map
<
String
,
List
<
PrjBean
.
DataBean
.
Bean
>>
listMap
,
List
<
PrinterDeviceBean
>
printerDeviceBeans
)
{
//雙重遍歷可以以後優化
//雙重遍歷可以以後優化
//第二步:遍歷 Map<廚房位置,需要打印的數據>,通過廚房位置找到對應的打印機,並且通過數據拿到對應的通用配置
//第二步:遍歷 Map<廚房位置,需要打印的數據>,通過廚房位置找到對應的打印機,並且通過數據拿到對應的通用配置
for
(
Map
.
Entry
<
String
,
List
<
PrjBean
.
DataBean
.
Bean
>>
prjMap
:
listMap
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
List
<
PrjBean
.
DataBean
.
Bean
>>
prjMap
:
listMap
.
entrySet
())
{
...
@@ -351,15 +312,25 @@ public class PrjService extends Service implements ReceiveListener {
...
@@ -351,15 +312,25 @@ public class PrjService extends Service implements ReceiveListener {
}
}
}
}
private
void
initPrinterDevices
()
{
/**
* 獲取打印設備
*
* @return 打印機列表
*/
private
List
<
PrinterDeviceBean
>
getPrinterDevices
()
{
//讀取打印機和通用配置,可以優化
//讀取打印機和通用配置,可以優化
//獲取所有打印機
//獲取所有打印機
PrinterDeviceDaoUtils
printerDeviceDaoUtils
=
new
PrinterDeviceDaoUtils
(
this
);
PrinterDeviceDaoUtils
printerDeviceDaoUtils
=
new
PrinterDeviceDaoUtils
(
this
);
printerDeviceBeans
=
printerDeviceDaoUtils
.
queryAllPrinterDeviceBean
();
LoganManager
.
w_printer
(
TAG
,
"获取打印設備信息"
);
//獲取所有通用配置
return
printerDeviceDaoUtils
.
queryAllPrinterDeviceBean
();
printCurrencyBeans
=
MyPrintUtils
.
getPrintCurrencyBeans
(
this
);
}
}
/**
* 獲取通用打印配置
*
* @param beans prj數據
* @return 通用配置
*/
private
PrintCurrencyBean
getPrintCurrencyBean
(
List
<
PrjBean
.
DataBean
.
Bean
>
beans
)
{
private
PrintCurrencyBean
getPrintCurrencyBean
(
List
<
PrjBean
.
DataBean
.
Bean
>
beans
)
{
PrintCurrencyBean
printCurrencyBean
=
null
;
PrintCurrencyBean
printCurrencyBean
=
null
;
if
(
beans
!=
null
&&
beans
.
size
()
>
0
)
{
if
(
beans
!=
null
&&
beans
.
size
()
>
0
)
{
...
@@ -389,141 +360,102 @@ public class PrjService extends Service implements ReceiveListener {
...
@@ -389,141 +360,102 @@ public class PrjService extends Service implements ReceiveListener {
PrinterPlugins
.
getOnPrinterFlowHandler
().
onPrinterDataBefore
(
orderType
,
PrintConstans
.
PRINT_KITCHEN
,
GsonUtils
.
GsonString
(
beans
),
GsonUtils
.
GsonString
(
printerDeviceBean
));
PrinterPlugins
.
getOnPrinterFlowHandler
().
onPrinterDataBefore
(
orderType
,
PrintConstans
.
PRINT_KITCHEN
,
GsonUtils
.
GsonString
(
beans
),
GsonUtils
.
GsonString
(
printerDeviceBean
));
if
(
isPinPrinter
(
printerDeviceBean
)
&&
printerDeviceBean
.
getPrinterDeviceType
()
==
PRINT_IP
)
{
if
(
isPinPrinter
(
printerDeviceBean
)
&&
printerDeviceBean
.
getPrinterDeviceType
()
==
PRINT_IP
)
{
//針式打印機並且打印機類型為IP打印,生成獨特的格式
//針式打印
List
<
Map
<
String
,
Bitmap
>>
bitmapMaps
=
generatePrintMaps
(
key
,
beans
,
printerDeviceBean
);
stylusPrinting
(
key
,
beans
,
printerDeviceBean
);
}
else
if
(
printerDeviceBean
.
getPrinterDeviceType
()
==
PRINT_PRJ_PC
)
{
hookPrinterBitmap
(
bitmapMaps
,
beans
);
//prj模式,生成文件到共享電腦上
prjToPc
(
beans
,
printerDeviceBean
);
}
else
if
(
printerDeviceBean
.
getPrinterDeviceType
()
==
PRINT_LOCAL
&&
PrintConstans
.
PRINT_MODEL_WISEPOS
.
contains
(
Build
.
MODEL
))
{
//本機打印並且是BBPOS
EpsIds
=
getPrintIds
(
bitmapMaps
);
}
else
{
//第一個參數是機型,第二個參數是語言,
List
<
Map
<
String
,
Bitmap
>>
bitmapMaps
=
generatePrintMaps
(
key
,
beans
,
printerDeviceBean
);
Printer
mPrinter
=
null
;
switch
(
printerDeviceBean
.
getPrinterDeviceType
())
{
try
{
case
PRINT_IP:
mPrinter
=
new
Printer
(
Printer
.
TM_U220
,
Printer
.
MODEL_KOREAN
,
this
);
LoganManager
.
w_printer
(
TAG
,
"開始IP打印-->"
);
mPrinter
.
setReceiveEventListener
(
this
);
//IP打印
}
catch
(
Epos2Exception
e
)
{
ipPrint
(
printerDeviceBean
,
bitmapMaps
);
e
.
printStackTrace
();
break
;
updatePrjFailure
(
getPrintIds
(
bitmapMaps
));
case
PRINT_LOCAL:
//本地N5或Sunmi打印
locationPrint
(
bitmapMaps
);
break
;
case
PRINT_USB:
//USB打印
usbPrint
(
bitmapMaps
);
break
;
default
:
break
;
}
}
if
(
mPrinter
!=
null
)
{
}
try
{
}
mPrinter
.
clearCommandBuffer
();
for
(
int
i
=
0
;
i
<
bitmapMaps
.
size
();
i
++)
{
for
(
Map
.
Entry
<
String
,
Bitmap
>
mapEntry
:
bitmapMaps
.
get
(
i
).
entrySet
())
{
mPrinter
.
addImage
(
mapEntry
.
getValue
(),
0
,
0
,
mapEntry
.
getValue
().
getWidth
(),
mapEntry
.
getValue
().
getHeight
(),
Printer
.
COLOR_1
,
Printer
.
MODE_MONO_HIGH_DENSITY
,
//高密度
Printer
.
HALFTONE_DITHER
,
//半色調抖動
Printer
.
PARAM_DEFAULT
,
Printer
.
COMPRESS_NONE
);
//壓縮
mPrinter
.
addCut
(
Printer
.
CUT_FEED
);
}
}
}
catch
(
Epos2Exception
e
)
{
e
.
printStackTrace
();
updatePrjFailure
(
getPrintIds
(
bitmapMaps
));
mPrinter
.
clearCommandBuffer
();
}
try
{
PrinterPlugins
.
getOnPrinterFlowHandler
().
connectionBefore
(
"針式打印機"
,
printerDeviceBean
.
getIp
(),
printerDeviceBean
.
getPort
(),
0
,
0
);
mPrinter
.
connect
(
"TCP:"
+
printerDeviceBean
.
getIp
(),
Printer
.
PARAM_DEFAULT
);
mPrinter
.
sendData
(
Printer
.
PARAM_DEFAULT
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
updatePrjFailure
(
getPrintIds
(
bitmapMaps
));
PrinterPlugins
.
getOnPrinterFlowHandler
().
connectionError
(
e
);
while
(
true
)
{
try
{
PrinterPlugins
.
getOnPrinterFlowHandler
().
disconnect
();
mPrinter
.
disconnect
();
break
;
}
catch
(
final
Exception
ex
)
{
if
(
ex
instanceof
Epos2Exception
)
{
//Note: If printer is processing such as printing and so on, the disconnect API returns ERR_PROCESSING.
if
(((
Epos2Exception
)
ex
).
getErrorStatus
()
==
Epos2Exception
.
ERR_PROCESSING
)
{
}
else
{
/**
break
;
* PRJ模式,生成PRJ文件到共享的電腦上
}
*
}
else
{
* @param beans prj數據
break
;
* @param printerDeviceBean 打印設備
}
*/
}
private
void
prjToPc
(
List
<
PrjBean
.
DataBean
.
Bean
>
beans
,
PrinterDeviceBean
printerDeviceBean
)
{
}
//PRJ模式,生成PRJ文件到共享的電腦上
mPrinter
.
clearCommandBuffer
();
ThreadPoolManager
.
getInstence
().
putExecutableTasks
(()
->
{
mPrinter
.
setReceiveEventListener
(
null
);
List
<
PrjBean
.
DataBean
.
Bean
>
noCutList
=
new
ArrayList
<>();
List
<
PrjBean
.
DataBean
.
Bean
>
cutList
=
new
ArrayList
<>();
for
(
PrjBean
.
DataBean
.
Bean
bean
:
beans
)
{
if
(
bean
.
getStatus
()
==
2
)
{
//需要切紙
cutList
.
add
(
bean
);
}
else
{
//不需要切紙
noCutList
.
add
(
bean
);
}
}
}
else
{
updatePrjFailure
(
EpsIds
);
}
}
}
else
if
(
printerDeviceBean
.
getPrinterDeviceType
()
==
PRINT_PRJ_PC
)
{
}
else
{
String
rootPath
=
"smb://"
+
printerDeviceBean
.
getPrintPath
()
+
"/"
;
List
<
Map
<
String
,
Bitmap
>>
bitmapMaps
=
null
;
try
{
if
(
printerDeviceBean
.
getPrinterDeviceType
()
==
PRINT_LOCAL
&&
PrintConstans
.
PRINT_MODEL_WISEPOS
.
contains
(
Build
.
MODEL
))
{
SmbFile
smbFile
=
new
SmbFile
(
rootPath
);
//本機打印並且是BBPOS
smbFile
.
connect
();
if
(
smbFile
.
isDirectory
())
{
}
else
if
(
printerDeviceBean
.
getPrinterDeviceType
()
==
PRINT_PRJ_PC
)
{
for
(
int
i
=
0
;
i
<
cutList
.
size
();
i
++)
{
//PRJ模式,生成PRJ文件到共享的電腦上
String
newFilePath
=
rootPath
+
System
.
currentTimeMillis
()
+
".prj"
;
ThreadPoolManager
.
getInstence
().
putExecutableTasks
(()
->
{
SmbFile
createFile
=
new
SmbFile
(
newFilePath
);
List
<
PrjBean
.
DataBean
.
Bean
>
noCutList
=
new
ArrayList
<>();
createFile
.
createNewFile
();
List
<
PrjBean
.
DataBean
.
Bean
>
cutList
=
new
ArrayList
<>();
if
(
createFile
.
exists
())
{
for
(
PrjBean
.
DataBean
.
Bean
bean
:
beans
)
{
PrintStream
ps
=
new
PrintStream
(
new
SmbFileOutputStream
(
createFile
));
if
(
bean
.
getStatus
()
==
2
)
{
//需要切紙
// 往文件里写入字符串
cutList
.
add
(
bean
);
String
prjInfo
=
"[printType]ptKitchen\n"
+
}
else
{
"[table]4\n"
+
//不需要切紙
"[date]落單時間:11-13 17:48\n"
+
noCutList
.
add
(
bean
);
"[waiter]n5 收銀員\n"
+
"[KP]K2烤爐\n"
+
"[PAX]人數:2\n"
+
"[line]\n"
+
"[food_1]1 包子(主項)\n"
+
"[food_1]1 包子(主項)\n"
+
"[table2]4\n"
;
ps
.
println
(
prjInfo
);
}
}
}
}
if
(
noCutList
.
size
()
>
0
)
{
String
rootPath
=
"smb://"
+
printerDeviceBean
.
getPrintPath
()
+
"/"
;
String
newFilePath
=
rootPath
+
System
.
currentTimeMillis
()
+
".prj"
;
try
{
SmbFile
createFile
=
new
SmbFile
(
newFilePath
);
SmbFile
smbFile
=
new
SmbFile
(
rootPath
);
createFile
.
createNewFile
();
smbFile
.
connect
();
if
(
createFile
.
exists
())
{
if
(
smbFile
.
isDirectory
())
{
PrintStream
ps
=
new
PrintStream
(
new
SmbFileOutputStream
(
createFile
));
for
(
int
i
=
0
;
i
<
cutList
.
size
();
i
++)
{
PrjBean
.
DataBean
.
Bean
bean
=
noCutList
.
get
(
0
);
String
newFilePath
=
rootPath
+
System
.
currentTimeMillis
()
+
".prj"
;
SmbFile
createFile
=
new
SmbFile
(
newFilePath
);
String
tableName
=
""
;
createFile
.
createNewFile
();
if
(
TextUtil
.
isEmptyOrNullOrUndefined
(
bean
.
getTableName
()))
{
if
(
createFile
.
exists
())
{
if
(
bean
.
getOrderType
()
==
7
)
{
PrintStream
ps
=
new
PrintStream
(
new
SmbFileOutputStream
(
createFile
));
tableName
=
"自取"
;
}
else
{
// 往文件里写入字符串
tableName
=
"外賣"
;
String
prjInfo
=
"[printType]ptKitchen\n"
+
"[table]4\n"
+
"[date]落單時間:11-13 17:48\n"
+
"[waiter]n5 收銀員\n"
+
"[KP]K2烤爐\n"
+
"[PAX]人數:2\n"
+
"[line]\n"
+
"[food_1]1 包子(主項)\n"
+
"[food_1]1 包子(主項)\n"
+
"[table2]4\n"
;
ps
.
println
(
prjInfo
);
}
}
}
else
{
tableName
=
bean
.
getTableName
();
}
}
if
(
noCutList
.
size
()
>
0
)
{
// 往文件里写入字符串
String
newFilePath
=
rootPath
+
System
.
currentTimeMillis
()
+
".prj"
;
SmbFile
createFile
=
new
SmbFile
(
newFilePath
);
createFile
.
createNewFile
();
if
(
createFile
.
exists
())
{
PrintStream
ps
=
new
PrintStream
(
new
SmbFileOutputStream
(
createFile
));
PrjBean
.
DataBean
.
Bean
bean
=
noCutList
.
get
(
0
);
String
tableName
=
""
;
if
(
TextUtil
.
isEmptyOrNullOrUndefined
(
bean
.
getTableName
()))
{
if
(
bean
.
getOrderType
()
==
7
)
{
tableName
=
"自取"
;
}
else
{
tableName
=
"外賣"
;
}
}
else
{
tableName
=
bean
.
getTableName
();
}
// 往文件里写入字符串
// String prjInfo = "[printType]ptKitchen\n" +
// String prjInfo = "[printType]ptKitchen\n" +
// "[table]4\n" +
// "[table]4\n" +
// "[date]落單時間:11-13 17:48\n" +
// "[date]落單時間:11-13 17:48\n" +
...
@@ -534,47 +466,104 @@ public class PrjService extends Service implements ReceiveListener {
...
@@ -534,47 +466,104 @@ public class PrjService extends Service implements ReceiveListener {
// "[food_1]1 包子(主項)\n" +
// "[food_1]1 包子(主項)\n" +
// "[food_1]1 包子(主項)\n" +
// "[food_1]1 包子(主項)\n" +
// "[table2]4\n";
// "[table2]4\n";
String
prjInfo
=
"[printType]ptKitchen\n"
+
String
prjInfo
=
"[printType]ptKitchen\n"
+
"[table]"
+
tableName
+
"\n"
+
"[table]"
+
tableName
+
"\n"
+
"[date]落單時間:11-13 17:48\n"
+
"[date]落單時間:11-13 17:48\n"
+
"[waiter]n5 收銀員\n"
+
"[waiter]n5 收銀員\n"
+
"[KP]K2烤爐\n"
+
"[KP]K2烤爐\n"
+
"[PAX]人數:2\n"
+
"[PAX]人數:2\n"
+
"[line]\n"
+
"[line]\n"
+
"[food_1]1 包子(主項)\n"
+
"[food_1]1 包子(主項)\n"
+
"[food_1]1 包子(主項)\n"
+
"[food_1]1 包子(主項)\n"
+
"[table2]"
+
tableName
+
"\n"
;
"[table2]"
+
tableName
+
"\n"
;
ps
.
println
(
prjInfo
);
ps
.
println
(
prjInfo
);
}
}
}
}
}
else
{
ToastUtils
.
show
(
this
,
"PRJ輸出路徑必須為文件夾"
);
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
});
}
/**
* 針式打印機
*
* @param key 廚房位置
* @param beans prj數據
* @param printerDeviceBean 打印機
*/
private
void
stylusPrinting
(
String
key
,
List
<
PrjBean
.
DataBean
.
Bean
>
beans
,
PrinterDeviceBean
printerDeviceBean
)
{
//針式打印機並且打印機類型為IP打印,生成獨特的格式
List
<
Map
<
String
,
Bitmap
>>
bitmapMaps
=
generatePrintMaps
(
key
,
beans
,
printerDeviceBean
);
hookPrinterBitmap
(
bitmapMaps
,
beans
);
EpsIds
=
getPrintIds
(
bitmapMaps
);
//第一個參數是機型,第二個參數是語言,
Printer
mPrinter
=
null
;
try
{
mPrinter
=
new
Printer
(
Printer
.
TM_U220
,
Printer
.
MODEL_KOREAN
,
this
);
mPrinter
.
setReceiveEventListener
(
this
);
}
catch
(
Epos2Exception
e
)
{
e
.
printStackTrace
();
updatePrjFailure
(
getPrintIds
(
bitmapMaps
));
}
if
(
mPrinter
!=
null
)
{
try
{
mPrinter
.
clearCommandBuffer
();
for
(
int
i
=
0
;
i
<
bitmapMaps
.
size
();
i
++)
{
for
(
Map
.
Entry
<
String
,
Bitmap
>
mapEntry
:
bitmapMaps
.
get
(
i
).
entrySet
())
{
mPrinter
.
addImage
(
mapEntry
.
getValue
(),
0
,
0
,
mapEntry
.
getValue
().
getWidth
(),
mapEntry
.
getValue
().
getHeight
(),
Printer
.
COLOR_1
,
Printer
.
MODE_MONO_HIGH_DENSITY
,
//高密度
Printer
.
HALFTONE_DITHER
,
//半色調抖動
Printer
.
PARAM_DEFAULT
,
Printer
.
COMPRESS_NONE
);
//壓縮
mPrinter
.
addCut
(
Printer
.
CUT_FEED
);
}
}
}
catch
(
Epos2Exception
e
)
{
e
.
printStackTrace
();
updatePrjFailure
(
getPrintIds
(
bitmapMaps
));
mPrinter
.
clearCommandBuffer
();
}
try
{
PrinterPlugins
.
getOnPrinterFlowHandler
().
connectionBefore
(
"針式打印機"
,
printerDeviceBean
.
getIp
(),
printerDeviceBean
.
getPort
(),
0
,
0
);
mPrinter
.
connect
(
"TCP:"
+
printerDeviceBean
.
getIp
(),
Printer
.
PARAM_DEFAULT
);
mPrinter
.
sendData
(
Printer
.
PARAM_DEFAULT
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
updatePrjFailure
(
getPrintIds
(
bitmapMaps
));
PrinterPlugins
.
getOnPrinterFlowHandler
().
connectionError
(
e
);
while
(
true
)
{
try
{
PrinterPlugins
.
getOnPrinterFlowHandler
().
disconnect
();
mPrinter
.
disconnect
();
break
;
}
catch
(
final
Exception
ex
)
{
if
(
ex
instanceof
Epos2Exception
)
{
//Note: If printer is processing such as printing and so on, the disconnect API returns ERR_PROCESSING.
if
(((
Epos2Exception
)
ex
).
getErrorStatus
()
==
Epos2Exception
.
ERR_PROCESSING
)
{
}
else
{
break
;
}
}
else
{
}
else
{
ToastUtils
.
show
(
this
,
"PRJ輸出路徑必須為文件夾"
)
;
break
;
}
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
});
}
else
{
bitmapMaps
=
generatePrintMaps
(
key
,
beans
,
printerDeviceBean
);
switch
(
printerDeviceBean
.
getPrinterDeviceType
())
{
case
PRINT_IP:
LoganManager
.
w_printer
(
TAG
,
"開始IP打印-->"
);
//IP打印
ipPrint
(
printerDeviceBean
,
bitmapMaps
);
break
;
case
PRINT_LOCAL:
//本地N5或Sunmi打印
locationPrint
(
bitmapMaps
);
break
;
case
PRINT_USB:
//USB打印
usbPrint
(
bitmapMaps
);
break
;
default
:
break
;
}
}
mPrinter
.
clearCommandBuffer
();
mPrinter
.
setReceiveEventListener
(
null
);
}
}
}
else
{
updatePrjFailure
(
EpsIds
);
}
}
}
}
...
@@ -844,9 +833,6 @@ public class PrjService extends Service implements ReceiveListener {
...
@@ -844,9 +833,6 @@ public class PrjService extends Service implements ReceiveListener {
* @param printState 打印狀態 1未打印 2打印中 3已打印
* @param printState 打印狀態 1未打印 2打印中 3已打印
*/
*/
private
void
updatePrjState
(
int
printState
,
String
ids
)
{
private
void
updatePrjState
(
int
printState
,
String
ids
)
{
if
(
printDatas
==
null
)
{
return
;
}
Long
time
=
null
;
Long
time
=
null
;
if
(
printState
==
3
)
{
if
(
printState
==
3
)
{
time
=
TimeUtils
.
getCurrentTimeInLong
();
time
=
TimeUtils
.
getCurrentTimeInLong
();
...
...
component-print/src/main/java/com/joe/print/mvp/ui/view/BillItemView.java
View file @
94e2feb7
...
@@ -25,6 +25,8 @@ public class BillItemView extends LinearLayout {
...
@@ -25,6 +25,8 @@ public class BillItemView extends LinearLayout {
public
BillItemView
(
Context
context
,
List
<
PrintBillItem
>
data
)
{
public
BillItemView
(
Context
context
,
List
<
PrintBillItem
>
data
)
{
super
(
context
);
super
(
context
);
this
.
data
=
data
;
this
.
data
=
data
;
setOrientation
(
LinearLayout
.
VERTICAL
);
init
();
}
}
private
void
init
()
{
private
void
init
()
{
...
...
component-print/src/main/java/com/joe/print/mvp/ui/view/BillTypeView.java
View file @
94e2feb7
...
@@ -24,6 +24,7 @@ public class BillTypeView extends LinearLayout {
...
@@ -24,6 +24,7 @@ public class BillTypeView extends LinearLayout {
public
BillTypeView
(
Context
context
,
List
<
PrintBillItem
>
data
)
{
public
BillTypeView
(
Context
context
,
List
<
PrintBillItem
>
data
)
{
super
(
context
);
super
(
context
);
this
.
data
=
data
;
this
.
data
=
data
;
setOrientation
(
LinearLayout
.
VERTICAL
);
init
();
init
();
}
}
...
...
component-print/src/main/java/com/joe/print/mvp/ui/view/BillView.java
View file @
94e2feb7
...
@@ -25,6 +25,7 @@ public class BillView extends LinearLayout {
...
@@ -25,6 +25,7 @@ public class BillView extends LinearLayout {
public
BillView
(
Context
context
,
List
<
BillingBean
>
data
)
{
public
BillView
(
Context
context
,
List
<
BillingBean
>
data
)
{
super
(
context
);
super
(
context
);
this
.
data
=
data
;
this
.
data
=
data
;
setOrientation
(
LinearLayout
.
VERTICAL
);
init
();
init
();
}
}
...
...
component-print/src/main/java/com/joe/print/mvp/ui/view/PrintFoodView.java
View file @
94e2feb7
...
@@ -34,6 +34,7 @@ public class PrintFoodView extends LinearLayout {
...
@@ -34,6 +34,7 @@ public class PrintFoodView extends LinearLayout {
super
(
context
);
super
(
context
);
this
.
showPrice
=
showPrice
;
this
.
showPrice
=
showPrice
;
this
.
data
=
data
;
this
.
data
=
data
;
setOrientation
(
LinearLayout
.
VERTICAL
);
init
(
deviceBean
);
init
(
deviceBean
);
}
}
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/bean/PurchaseFoodBean.java
View file @
94e2feb7
...
@@ -25,6 +25,10 @@ public class PurchaseFoodBean implements Serializable {
...
@@ -25,6 +25,10 @@ public class PurchaseFoodBean implements Serializable {
public
static
final
String
CATEGORY_DIVIDER
=
"-"
;
public
static
final
String
CATEGORY_DIVIDER
=
"-"
;
private
Integer
id
;
private
Integer
id
;
private
String
supplierName
;
private
String
supplierName
;
/**
* 運費
*/
private
double
shipping
;
private
String
images
;
private
String
images
;
private
String
foodNo
;
private
String
foodNo
;
private
String
name
;
private
String
name
;
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/bean/SupplierInfoBean.java
View file @
94e2feb7
...
@@ -35,7 +35,15 @@ public class SupplierInfoBean implements Serializable {
...
@@ -35,7 +35,15 @@ public class SupplierInfoBean implements Serializable {
private
long
createTime
;
private
long
createTime
;
private
long
updateTime
;
private
long
updateTime
;
private
Integer
deletes
;
private
Integer
deletes
;
/**
* 最低採購
*/
private
double
minimumAmount
;
private
double
minimumAmount
;
/**
* 運費
*/
private
double
shipping
;
private
List
<
SupplierContacts
>
supplierContacts
;
private
List
<
SupplierContacts
>
supplierContacts
;
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/contract/WarehousingInventoryContract.java
View file @
94e2feb7
...
@@ -4,6 +4,8 @@ import com.gingersoft.gsa.cloud.common.bean.BaseResult;
...
@@ -4,6 +4,8 @@ import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import
com.jess.arms.mvp.IView
;
import
com.jess.arms.mvp.IView
;
import
com.jess.arms.mvp.IModel
;
import
com.jess.arms.mvp.IModel
;
import
java.util.Map
;
import
io.reactivex.Observable
;
import
io.reactivex.Observable
;
import
okhttp3.RequestBody
;
import
okhttp3.RequestBody
;
...
@@ -24,6 +26,8 @@ public interface WarehousingInventoryContract {
...
@@ -24,6 +26,8 @@ public interface WarehousingInventoryContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface
View
extends
IView
{
interface
View
extends
IView
{
void
updateSuccess
();
void
updateSuccess
();
void
loadRecord
();
}
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
...
@@ -35,5 +39,13 @@ public interface WarehousingInventoryContract {
...
@@ -35,5 +39,13 @@ public interface WarehousingInventoryContract {
* @return
* @return
*/
*/
Observable
<
BaseResult
>
consumeWareHousing
(
RequestBody
requestBody
);
Observable
<
BaseResult
>
consumeWareHousing
(
RequestBody
requestBody
);
/**
* 獲取庫存消耗記錄
*
* @param map
* @return
*/
Observable
<
BaseResult
>
getWarehousingRecord
(
Map
<
String
,
Object
>
map
);
}
}
}
}
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/model/WarehousingInventoryModel.java
View file @
94e2feb7
...
@@ -14,6 +14,8 @@ import javax.inject.Inject;
...
@@ -14,6 +14,8 @@ import javax.inject.Inject;
import
com.gingersoft.supply_chain.mvp.contract.WarehousingInventoryContract
;
import
com.gingersoft.supply_chain.mvp.contract.WarehousingInventoryContract
;
import
java.util.Map
;
import
io.reactivex.Observable
;
import
io.reactivex.Observable
;
import
okhttp3.RequestBody
;
import
okhttp3.RequestBody
;
...
@@ -53,4 +55,9 @@ public class WarehousingInventoryModel extends BaseModel implements WarehousingI
...
@@ -53,4 +55,9 @@ public class WarehousingInventoryModel extends BaseModel implements WarehousingI
public
Observable
<
BaseResult
>
consumeWareHousing
(
RequestBody
requestBody
)
{
public
Observable
<
BaseResult
>
consumeWareHousing
(
RequestBody
requestBody
)
{
return
mRepositoryManager
.
obtainRetrofitService
(
SupplierServer
.
class
).
consumeWareHousing
(
requestBody
);
return
mRepositoryManager
.
obtainRetrofitService
(
SupplierServer
.
class
).
consumeWareHousing
(
requestBody
);
}
}
@Override
public
Observable
<
BaseResult
>
getWarehousingRecord
(
Map
<
String
,
Object
>
map
)
{
return
mRepositoryManager
.
obtainRetrofitService
(
SupplierServer
.
class
).
getWarehousingRecord
(
map
);
}
}
}
\ No newline at end of file
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/FoodUnitPagePresenter.java
View file @
94e2feb7
...
@@ -284,7 +284,8 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo
...
@@ -284,7 +284,8 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo
@Override
@Override
public
void
onNext
(
BaseResult
baseResult
)
{
public
void
onNext
(
BaseResult
baseResult
)
{
if
(
baseResult
.
isSuccess
())
{
if
(
baseResult
.
isSuccess
())
{
mRootView
.
addBasicUnit
(
new
BasicUnitBean
(
content
));
BasicUnitBean
basicUnitBean
=
GsonUtils
.
GsonToBean
(
baseResult
.
getData
(),
BasicUnitBean
.
class
);
mRootView
.
addBasicUnit
(
basicUnitBean
);
}
else
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
baseResult
.
getErrMsg
()))
{
}
else
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
baseResult
.
getErrMsg
()))
{
mRootView
.
showMessage
(
baseResult
.
getErrMsg
());
mRootView
.
showMessage
(
baseResult
.
getErrMsg
());
}
else
{
}
else
{
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/NewSupplierPresenter.java
View file @
94e2feb7
...
@@ -88,14 +88,17 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
...
@@ -88,14 +88,17 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
public
final
int
addressIndex
=
5
;
public
final
int
addressIndex
=
5
;
public
final
int
telephoneIndex
=
6
;
public
final
int
telephoneIndex
=
6
;
public
final
int
lowPurchaseAmount
=
7
;
public
final
int
lowPurchaseAmount
=
7
;
public
final
int
emailIndex
=
10
;
//運費
public
final
int
smsIndex
=
15
;
public
final
int
shippingIndex
=
8
;
public
final
int
remarkIndex
=
18
;
public
final
int
WhatsAppIndex
=
11
;
public
final
int
emailIndex
=
11
;
public
final
int
weChatIndex
=
12
;
public
final
int
smsIndex
=
16
;
public
final
int
lineIndex
=
13
;
public
final
int
remarkIndex
=
19
;
public
final
int
kakaoIndex
=
14
;
public
final
int
WhatsAppIndex
=
12
;
public
final
int
weChatIndex
=
13
;
public
final
int
lineIndex
=
14
;
public
final
int
kakaoIndex
=
15
;
private
InfoMultiAdapter
infoMultiAdapter
;
private
InfoMultiAdapter
infoMultiAdapter
;
private
SupplierInfoBean
supplierBean
;
private
SupplierInfoBean
supplierBean
;
...
@@ -135,8 +138,8 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
...
@@ -135,8 +138,8 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
infoMultiBeans
.
add
(
new
MultiInputBean
(
InfoMultiBean
.
ITEM_TYPE_INPUT
,
"聯繫人"
,
true
,
"請輸入聯繫人"
,
new
InputFilter
[]{
InputFilterUtils
.
getLengthFilter
(
mContext
,
20
),
InputFilterUtils
.
getChAndEnAndNumInputFilter
(
mContext
)}));
infoMultiBeans
.
add
(
new
MultiInputBean
(
InfoMultiBean
.
ITEM_TYPE_INPUT
,
"聯繫人"
,
true
,
"請輸入聯繫人"
,
new
InputFilter
[]{
InputFilterUtils
.
getLengthFilter
(
mContext
,
20
),
InputFilterUtils
.
getChAndEnAndNumInputFilter
(
mContext
)}));
infoMultiBeans
.
add
(
new
MultiInputBean
(
InfoMultiBean
.
ITEM_TYPE_INPUT
,
"詳細地址"
,
true
,
"請輸入詳細地址"
,
new
InputFilter
[]{
InputFilterUtils
.
getLengthFilter
(
mContext
,
20
),
InputFilterUtils
.
getChAndEnAndNumInputFilter
(
mContext
)}));
infoMultiBeans
.
add
(
new
MultiInputBean
(
InfoMultiBean
.
ITEM_TYPE_INPUT
,
"詳細地址"
,
true
,
"請輸入詳細地址"
,
new
InputFilter
[]{
InputFilterUtils
.
getLengthFilter
(
mContext
,
20
),
InputFilterUtils
.
getChAndEnAndNumInputFilter
(
mContext
)}));
infoMultiBeans
.
add
(
new
MultiInputBean
(
InfoMultiBean
.
ITEM_TYPE_INPUT
,
"聯繫人電話"
,
true
,
"請輸入聯繫人電話"
,
new
InputFilter
[]{
InputFilterUtils
.
getLengthFilter
(
mContext
,
11
)},
EditorInfo
.
TYPE_CLASS_PHONE
));
infoMultiBeans
.
add
(
new
MultiInputBean
(
InfoMultiBean
.
ITEM_TYPE_INPUT
,
"聯繫人電話"
,
true
,
"請輸入聯繫人電話"
,
new
InputFilter
[]{
InputFilterUtils
.
getLengthFilter
(
mContext
,
11
)},
EditorInfo
.
TYPE_CLASS_PHONE
));
infoMultiBeans
.
add
(
new
MultiInputBean
(
InfoMultiBean
.
ITEM_TYPE_INPUT
,
"最低採購金額"
,
false
,
"請輸入最低金額"
,
new
InputFilter
[]{
InputFilterUtils
.
getLengthFilter
(
mContext
,
7
)},
EditorInfo
.
TYPE_CLASS_NUMBER
));
infoMultiBeans
.
add
(
new
MultiInputBean
(
InfoMultiBean
.
ITEM_TYPE_INPUT
,
"最低採購金額"
,
false
,
"請輸入最低金額"
,
new
InputFilter
[]{
InputFilterUtils
.
getLengthFilter
(
mContext
,
9
)},
EditorInfo
.
TYPE_CLASS_NUMBER
|
EditorInfo
.
TYPE_NUMBER_FLAG_DECIMAL
));
// infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "運費", true, "請輸入運費", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 7)}, EditorInfo.TYPE_CLASS_NUMBER
));
infoMultiBeans
.
add
(
new
MultiInputBean
(
InfoMultiBean
.
ITEM_TYPE_INPUT
,
"運費"
,
false
,
"請輸入運費"
,
new
InputFilter
[]{
InputFilterUtils
.
getLengthFilter
(
mContext
,
9
)},
EditorInfo
.
TYPE_CLASS_NUMBER
|
EditorInfo
.
TYPE_NUMBER_FLAG_DECIMAL
));
infoMultiBeans
.
add
(
new
InfoMultiBean
(
InfoMultiBean
.
ITEM_TYPE_LINE
));
infoMultiBeans
.
add
(
new
InfoMultiBean
(
InfoMultiBean
.
ITEM_TYPE_LINE
));
infoMultiBeans
.
add
(
new
InfoMultiBean
(
InfoMultiBean
.
ITEM_TYPE_TITLE
,
"接收方式"
));
infoMultiBeans
.
add
(
new
InfoMultiBean
(
InfoMultiBean
.
ITEM_TYPE_TITLE
,
"接收方式"
));
...
@@ -175,6 +178,7 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
...
@@ -175,6 +178,7 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
infoMultiBeans
.
get
(
addressIndex
).
setShowValue
(
supplierBean
.
getAddress
());
infoMultiBeans
.
get
(
addressIndex
).
setShowValue
(
supplierBean
.
getAddress
());
infoMultiBeans
.
get
(
remarkIndex
).
setShowValue
(
supplierBean
.
getRemarks
());
infoMultiBeans
.
get
(
remarkIndex
).
setShowValue
(
supplierBean
.
getRemarks
());
infoMultiBeans
.
get
(
lowPurchaseAmount
).
setShowValue
(
supplierBean
.
getMinimumAmount
()
+
""
);
infoMultiBeans
.
get
(
lowPurchaseAmount
).
setShowValue
(
supplierBean
.
getMinimumAmount
()
+
""
);
infoMultiBeans
.
get
(
shippingIndex
).
setShowValue
(
supplierBean
.
getShipping
()
+
""
);
}
}
infoMultiAdapter
=
new
InfoMultiAdapter
(
mContext
,
infoMultiBeans
);
infoMultiAdapter
=
new
InfoMultiAdapter
(
mContext
,
infoMultiBeans
);
infoMultiAdapter
.
setOnItemChildClickListener
((
adapter
,
view
,
position
)
->
{
infoMultiAdapter
.
setOnItemChildClickListener
((
adapter
,
view
,
position
)
->
{
...
@@ -498,18 +502,31 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
...
@@ -498,18 +502,31 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
if
(
supplierInfoBean
==
null
)
{
if
(
supplierInfoBean
==
null
)
{
supplierInfoBean
=
new
SupplierInfoBean
();
supplierInfoBean
=
new
SupplierInfoBean
();
}
}
//供應商編號
supplierInfoBean
.
setSupplierNo
(
infoMultiBeans
.
get
(
supplierNoIndex
).
getShowValue
());
supplierInfoBean
.
setSupplierNo
(
infoMultiBeans
.
get
(
supplierNoIndex
).
getShowValue
());
//供應商名稱
supplierInfoBean
.
setSupplierName
(
infoMultiBeans
.
get
(
supplierNameIndex
).
getShowValue
());
supplierInfoBean
.
setSupplierName
(
infoMultiBeans
.
get
(
supplierNameIndex
).
getShowValue
());
//聯繫人
supplierInfoBean
.
setContacts
(
infoMultiBeans
.
get
(
contactsIndex
).
getShowValue
());
supplierInfoBean
.
setContacts
(
infoMultiBeans
.
get
(
contactsIndex
).
getShowValue
());
//手機號碼
String
telephone
=
infoMultiBeans
.
get
(
telephoneIndex
).
getShowValue
();
String
telephone
=
infoMultiBeans
.
get
(
telephoneIndex
).
getShowValue
();
supplierInfoBean
.
setContactInformation
(
telephone
);
supplierInfoBean
.
setContactInformation
(
telephone
);
//地址
supplierInfoBean
.
setAddress
(
infoMultiBeans
.
get
(
addressIndex
).
getShowValue
());
supplierInfoBean
.
setAddress
(
infoMultiBeans
.
get
(
addressIndex
).
getShowValue
());
//餐廳信息
supplierInfoBean
.
setRestaurantId
(
RestaurantInfoManager
.
newInstance
().
getRestaurantId
());
supplierInfoBean
.
setRestaurantId
(
RestaurantInfoManager
.
newInstance
().
getRestaurantId
());
supplierInfoBean
.
setBrandId
(
RestaurantInfoManager
.
newInstance
().
getBrandId
());
supplierInfoBean
.
setBrandId
(
RestaurantInfoManager
.
newInstance
().
getBrandId
());
//最低採購金額
String
minimumAmount
=
infoMultiBeans
.
get
(
lowPurchaseAmount
).
getShowValue
();
String
minimumAmount
=
infoMultiBeans
.
get
(
lowPurchaseAmount
).
getShowValue
();
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
minimumAmount
))
{
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
minimumAmount
))
{
supplierInfoBean
.
setMinimumAmount
(
Double
.
parseDouble
(
minimumAmount
));
supplierInfoBean
.
setMinimumAmount
(
Double
.
parseDouble
(
minimumAmount
));
}
}
//運費
String
shipping
=
infoMultiBeans
.
get
(
shippingIndex
).
getShowValue
();
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
shipping
))
{
supplierInfoBean
.
setShipping
(
Double
.
parseDouble
(
shipping
));
}
//供應商編號如果沒填,就設為空
if
(
TextUtil
.
isEmptyOrNullOrUndefined
(
supplierInfoBean
.
getSupplierNo
()))
{
if
(
TextUtil
.
isEmptyOrNullOrUndefined
(
supplierInfoBean
.
getSupplierNo
()))
{
supplierInfoBean
.
setSupplierNo
(
null
);
supplierInfoBean
.
setSupplierNo
(
null
);
}
}
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/ShoppingCatPresenter.java
View file @
94e2feb7
...
@@ -108,23 +108,28 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
...
@@ -108,23 +108,28 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
//統計當前供應商選中食材的種類
//統計當前供應商選中食材的種類
int
supplierTotalSpecies
=
0
;
int
supplierTotalSpecies
=
0
;
shoppingCartBean
.
setAllSelect
(
true
);
shoppingCartBean
.
setAllSelect
(
true
);
double
shipping
=
0
;
for
(
PurchaseFoodBean
purchaseFoodBean
:
foods
)
{
for
(
PurchaseFoodBean
purchaseFoodBean
:
foods
)
{
if
(
purchaseFoodBean
.
isChecked
())
{
if
(
purchaseFoodBean
.
isChecked
())
{
supplierTotalAmount
=
MoneyUtil
.
sum
(
supplierTotalAmount
,
MoneyUtil
.
priceCalculation
(
purchaseFoodBean
.
getUnitPrice
(),
purchaseFoodBean
.
getFoodQuantity
()));
supplierTotalAmount
=
MoneyUtil
.
sum
(
supplierTotalAmount
,
MoneyUtil
.
priceCalculation
(
purchaseFoodBean
.
getUnitPrice
(),
purchaseFoodBean
.
getFoodQuantity
()));
supplierTotalSpecies
++;
supplierTotalSpecies
++;
//有選中的食品才顯示運費
shipping
=
purchaseFoodBean
.
getShipping
();
}
else
{
}
else
{
shoppingCartBean
.
setAllSelect
(
false
);
shoppingCartBean
.
setAllSelect
(
false
);
}
}
}
}
//不滿足最低採購金額,不可點擊創建訂單按鈕
if
(
MoneyUtil
.
compareTo
(
shoppingCartBean
.
getMinimumAmount
(),
supplierTotalAmount
)
==
1
)
{
if
(
MoneyUtil
.
compareTo
(
shoppingCartBean
.
getMinimumAmount
(),
supplierTotalAmount
)
==
1
)
{
createBtnCheckable
=
false
;
createBtnCheckable
=
false
;
}
}
// shoppingCartBean.setShipping();運費
//運費
shoppingCartBean
.
setShipping
(
shipping
);
shoppingCartBean
.
setInitialShippingTime
(
TimeUtils
.
getNextDay
(
1
));
shoppingCartBean
.
setInitialShippingTime
(
TimeUtils
.
getNextDay
(
1
));
shoppingCartBean
.
setSelectFoodAmount
(
supplierTotalAmount
);
shoppingCartBean
.
setSelectFoodAmount
(
supplierTotalAmount
);
shoppingCartBean
.
setSelectSpeciesNum
(
supplierTotalSpecies
);
shoppingCartBean
.
setSelectSpeciesNum
(
supplierTotalSpecies
);
//統計所有供應商的選中的食材的總金額
//統計所有供應商的選中的食材的總金額
,加上運費
totalPrice
=
MoneyUtil
.
sum
(
totalPrice
,
supplierTotalAmount
);
totalPrice
=
MoneyUtil
.
sum
(
MoneyUtil
.
sum
(
totalPrice
,
supplierTotalAmount
),
shipping
);
//統計所有供應商的選中的食材的種類數量
//統計所有供應商的選中的食材的種類數量
totalTypeNumber
+=
supplierTotalSpecies
;
totalTypeNumber
+=
supplierTotalSpecies
;
shoppingCartBean
.
setFoodList
(
foods
);
shoppingCartBean
.
setFoodList
(
foods
);
...
@@ -177,6 +182,8 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
...
@@ -177,6 +182,8 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
}
}
if
(
checkState
)
{
if
(
checkState
)
{
shoppingCartBean
.
setSelectSpeciesNum
(
shoppingCartBean
.
getFoodList
().
size
());
shoppingCartBean
.
setSelectSpeciesNum
(
shoppingCartBean
.
getFoodList
().
size
());
//總金額要加上運費
totalAmount
=
MoneyUtil
.
sum
(
totalAmount
,
shoppingCartBean
.
getShipping
());
}
else
{
}
else
{
shoppingCartBean
.
setSelectSpeciesNum
(
0
);
shoppingCartBean
.
setSelectSpeciesNum
(
0
);
}
}
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/WarehousingInventoryPresenter.java
View file @
94e2feb7
...
@@ -21,6 +21,9 @@ import javax.inject.Inject;
...
@@ -21,6 +21,9 @@ import javax.inject.Inject;
import
com.gingersoft.supply_chain.mvp.contract.WarehousingInventoryContract
;
import
com.gingersoft.supply_chain.mvp.contract.WarehousingInventoryContract
;
import
com.jess.arms.utils.RxLifecycleUtils
;
import
com.jess.arms.utils.RxLifecycleUtils
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
/**
* ================================================
* ================================================
...
@@ -95,4 +98,35 @@ public class WarehousingInventoryPresenter extends BasePresenter<WarehousingInve
...
@@ -95,4 +98,35 @@ public class WarehousingInventoryPresenter extends BasePresenter<WarehousingInve
}
}
});
});
}
}
/**
* 查詢庫存盤點記錄
*/
public
void
getWarehousingRecord
(
int
pageIndex
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>(
4
);
Constant
.
addRestaurantId
(
map
);
Constant
.
addBrandId
(
map
);
Constant
.
addPageSize
(
map
);
map
.
put
(
"pageIndex"
,
pageIndex
*
Constant
.
PAGE_SIZE
);
mModel
.
getWarehousingRecord
(
map
)
.
subscribeOn
(
Schedulers
.
io
())
.
doOnSubscribe
(
disposable
->
mRootView
.
showLoading
(
Constant
.
SAVE_LOADING
))
.
subscribeOn
(
AndroidSchedulers
.
mainThread
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
doAfterTerminate
(()
->
mRootView
.
hideLoading
())
.
compose
(
RxLifecycleUtils
.
bindToLifecycle
(
mRootView
))
.
subscribe
(
new
ErrorHandleSubscriber
<
BaseResult
>(
mErrorHandler
)
{
@Override
public
void
onNext
(
BaseResult
baseResult
)
{
if
(
baseResult
!=
null
&&
baseResult
.
isSuccess
())
{
//消耗完之後,關閉頁面
mRootView
.
loadRecord
();
}
else
if
(
baseResult
!=
null
&&
TextUtil
.
isNotEmptyOrNullOrUndefined
(
baseResult
.
getErrMsg
()))
{
mRootView
.
showMessage
(
baseResult
.
getErrMsg
());
}
else
{
mRootView
.
showMessage
(
Constant
.
SAVE_FAIL
);
}
}
});
}
}
}
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/server/SupplierServer.java
View file @
94e2feb7
...
@@ -438,4 +438,13 @@ public interface SupplierServer {
...
@@ -438,4 +438,13 @@ public interface SupplierServer {
@GET
(
"purchaseConsume/get/remaining/quantity"
+
RetrofitUrlManager
.
IDENTIFICATION_PATH_SIZE
+
2
)
@GET
(
"purchaseConsume/get/remaining/quantity"
+
RetrofitUrlManager
.
IDENTIFICATION_PATH_SIZE
+
2
)
Observable
<
BaseResult
>
getWarehousingNum
(
@QueryMap
Map
<
String
,
Object
>
map
);
Observable
<
BaseResult
>
getWarehousingNum
(
@QueryMap
Map
<
String
,
Object
>
map
);
/**
* 查詢庫存消耗記錄
*/
@Headers
({
"Domain-Name: ricepon-purchase"
})
@GET
(
"purchaseConsume/list"
+
RetrofitUrlManager
.
IDENTIFICATION_PATH_SIZE
+
2
)
Observable
<
BaseResult
>
getWarehousingRecord
(
@QueryMap
Map
<
String
,
Object
>
map
);
}
}
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/adapter/ShoppingCartAdapter.java
View file @
94e2feb7
...
@@ -2,6 +2,8 @@ package com.gingersoft.supply_chain.mvp.ui.adapter;
...
@@ -2,6 +2,8 @@ package com.gingersoft.supply_chain.mvp.ui.adapter;
import
android.animation.AnimatorSet
;
import
android.animation.AnimatorSet
;
import
android.content.Context
;
import
android.content.Context
;
import
android.text.Editable
;
import
android.text.TextWatcher
;
import
android.view.View
;
import
android.view.View
;
import
android.widget.CheckBox
;
import
android.widget.CheckBox
;
import
android.widget.EditText
;
import
android.widget.EditText
;
...
@@ -13,6 +15,7 @@ import androidx.recyclerview.widget.RecyclerView;
...
@@ -13,6 +15,7 @@ import androidx.recyclerview.widget.RecyclerView;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.chad.library.adapter.base.viewholder.BaseViewHolder
;
import
com.chad.library.adapter.base.viewholder.BaseViewHolder
;
import
com.gingersoft.gsa.cloud.common.utils.MoneyUtil
;
import
com.gingersoft.gsa.cloud.common.utils.MoneyUtil
;
import
com.gingersoft.gsa.cloud.common.utils.other.TextUtil
;
import
com.gingersoft.gsa.cloud.common.utils.time.TimeUtils
;
import
com.gingersoft.gsa.cloud.common.utils.time.TimeUtils
;
import
com.gingersoft.gsa.cloud.ui.recylcler.decorator.DividerItemDecoration
;
import
com.gingersoft.gsa.cloud.ui.recylcler.decorator.DividerItemDecoration
;
import
com.gingersoft.gsa.cloud.ui.utils.AnimateUtils
;
import
com.gingersoft.gsa.cloud.ui.utils.AnimateUtils
;
...
@@ -21,6 +24,7 @@ import com.gingersoft.supply_chain.R;
...
@@ -21,6 +24,7 @@ import com.gingersoft.supply_chain.R;
import
com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean
;
import
com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean
;
import
com.gingersoft.supply_chain.mvp.bean.ShoppingCartBean
;
import
com.gingersoft.supply_chain.mvp.bean.ShoppingCartBean
;
import
com.google.android.material.internal.ViewUtils
;
import
com.google.android.material.internal.ViewUtils
;
import
com.google.android.material.textfield.TextInputEditText
;
import
com.xuexiang.rxutil2.rxjava.RxJavaUtils
;
import
com.xuexiang.rxutil2.rxjava.RxJavaUtils
;
import
org.jetbrains.annotations.NotNull
;
import
org.jetbrains.annotations.NotNull
;
...
@@ -44,12 +48,15 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
...
@@ -44,12 +48,15 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
private
String
amountUnitStr
;
private
String
amountUnitStr
;
private
String
estimateDeliveryTimeStr
;
private
String
estimateDeliveryTimeStr
;
private
ShippingTextWatcher
shippingTextWatcher
;
public
ShoppingCartAdapter
(
Context
context
,
@Nullable
List
<
ShoppingCartBean
>
data
)
{
public
ShoppingCartAdapter
(
Context
context
,
@Nullable
List
<
ShoppingCartBean
>
data
)
{
super
(
R
.
layout
.
item_shopping_cart
,
data
);
super
(
R
.
layout
.
item_shopping_cart
,
data
);
this
.
context
=
context
;
this
.
context
=
context
;
dividerItemDecoration
=
new
DividerItemDecoration
(
context
,
DividerItemDecoration
.
VERTICAL_LIST
);
dividerItemDecoration
=
new
DividerItemDecoration
(
context
,
DividerItemDecoration
.
VERTICAL_LIST
);
amountUnitStr
=
context
.
getString
(
R
.
string
.
amount_string
);
amountUnitStr
=
context
.
getString
(
R
.
string
.
amount_string
);
estimateDeliveryTimeStr
=
context
.
getString
(
R
.
string
.
estimate_delivery_time
);
estimateDeliveryTimeStr
=
context
.
getString
(
R
.
string
.
estimate_delivery_time
);
shippingTextWatcher
=
new
ShippingTextWatcher
();
}
}
@Override
@Override
...
@@ -59,13 +66,16 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
...
@@ -59,13 +66,16 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
TextView
tvMinMinimumAmount
=
viewHolder
.
getView
(
R
.
id
.
tv_minimumAmount
);
TextView
tvMinMinimumAmount
=
viewHolder
.
getView
(
R
.
id
.
tv_minimumAmount
);
viewHolder
.
setText
(
R
.
id
.
rv_purchase_shopping_estimate_delivery_time
,
String
.
format
(
estimateDeliveryTimeStr
,
shoppingCartBean
.
getInitialShippingTime
()));
viewHolder
.
setText
(
R
.
id
.
rv_purchase_shopping_estimate_delivery_time
,
String
.
format
(
estimateDeliveryTimeStr
,
shoppingCartBean
.
getInitialShippingTime
()));
setTvMinimumAmount
(
shoppingCartBean
,
tvMinMinimumAmount
,
viewHolder
.
getView
(
R
.
id
.
rv_purchase_shopping_minimum_tip
));
setTvMinimumAmount
(
shoppingCartBean
,
tvMinMinimumAmount
,
viewHolder
.
getView
(
R
.
id
.
rv_purchase_shopping_minimum_tip
));
// viewHolder.setText(R.id.tv_order_item_freight, shoppingCartBean.getFoodList());
//選中食品的總價
//選中食品的總價
setTotalAmount
(
viewHolder
,
shoppingCartBean
.
getSelectFoodAmount
());
setTotalAmount
(
viewHolder
,
shoppingCartBean
.
getSelectFoodAmount
());
//運費
//運費
viewHolder
.
setText
(
R
.
id
.
tv_order_item_freight
,
String
.
format
(
amountUnitStr
,
shoppingCartBean
.
getShipping
()));
TextInputEditText
etShipping
=
viewHolder
.
getView
(
R
.
id
.
tv_order_item_freight
);
etShipping
.
removeTextChangedListener
(
shippingTextWatcher
);
viewHolder
.
setText
(
R
.
id
.
tv_order_item_freight
,
MoneyUtil
.
formatDouble
(
shoppingCartBean
.
getShipping
()));
shippingTextWatcher
.
setViewHolder
(
viewHolder
);
etShipping
.
addTextChangedListener
(
shippingTextWatcher
);
//實際應付金額
//實際應付金額
setActualAmount
(
viewHolder
,
shoppingCartBean
.
getSelectFoodAmount
(
));
setActualAmount
(
viewHolder
,
MoneyUtil
.
sum
(
shoppingCartBean
.
getSelectFoodAmount
(),
shoppingCartBean
.
getShipping
()
));
//選中食品的種類
//選中食品的種類
TextView
tvFoodTypeNumber
=
viewHolder
.
getView
(
R
.
id
.
tv_order_item_food_type_total
);
TextView
tvFoodTypeNumber
=
viewHolder
.
getView
(
R
.
id
.
tv_order_item_food_type_total
);
tvFoodTypeNumber
.
setText
(
String
.
valueOf
(
shoppingCartBean
.
getSelectSpeciesNum
()));
tvFoodTypeNumber
.
setText
(
String
.
valueOf
(
shoppingCartBean
.
getSelectSpeciesNum
()));
...
@@ -175,6 +185,47 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
...
@@ -175,6 +185,47 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
}
}
}
}
private
class
ShippingTextWatcher
implements
TextWatcher
{
BaseViewHolder
viewHolder
;
public
void
setViewHolder
(
BaseViewHolder
viewHolder
)
{
this
.
viewHolder
=
viewHolder
;
}
@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
)
{
if
(
viewHolder
!=
null
)
{
//需要修改實際應付金額和activity的總金額
//拿到現在的金額,減去之前的金額
double
nowShipping
=
0
;
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
s
))
{
nowShipping
=
Double
.
parseDouble
(
s
.
toString
());
}
ShoppingCartBean
shoppingCartBean
=
getData
().
get
(
viewHolder
.
getAdapterPosition
());
//修改實際應付金額
setActualAmount
(
viewHolder
,
MoneyUtil
.
sum
(
shoppingCartBean
.
getSelectFoodAmount
(),
shoppingCartBean
.
getShipping
()));
//通知activity修改
// getData().get(viewHolder.getAdapterPosition()).setShipping(Integer.parseInt());
}
}
}
/**
/**
* 修改總金額
* 修改總金額
*/
*/
...
@@ -283,7 +334,7 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
...
@@ -283,7 +334,7 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
double
currentPrice
=
MoneyUtil
.
sum
(
cartBean
.
getSelectFoodAmount
(),
MoneyUtil
.
priceCalculation
(
unitPrice
,
foodQuantity
));
double
currentPrice
=
MoneyUtil
.
sum
(
cartBean
.
getSelectFoodAmount
(),
MoneyUtil
.
priceCalculation
(
unitPrice
,
foodQuantity
));
cartBean
.
setSelectFoodAmount
(
currentPrice
);
cartBean
.
setSelectFoodAmount
(
currentPrice
);
setTotalAmount
(
viewHolder
,
currentPrice
);
setTotalAmount
(
viewHolder
,
currentPrice
);
setActualAmount
(
viewHolder
,
currentPrice
);
setActualAmount
(
viewHolder
,
MoneyUtil
.
sum
(
currentPrice
,
cartBean
.
getShipping
())
);
//傳遞回去
//傳遞回去
if
(
onInfoChangeListener
!=
null
)
{
if
(
onInfoChangeListener
!=
null
)
{
onInfoChangeListener
.
onInfoChange
(
MoneyUtil
.
priceCalculation
(
unitPrice
,
foodQuantity
),
species
);
onInfoChangeListener
.
onInfoChange
(
MoneyUtil
.
priceCalculation
(
unitPrice
,
foodQuantity
),
species
);
...
@@ -301,11 +352,13 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
...
@@ -301,11 +352,13 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
private
void
minusTotalPrice
(
BaseViewHolder
viewHolder
,
ShoppingCartBean
cartBean
,
double
unitPrice
,
int
foodQuantity
,
int
species
)
{
private
void
minusTotalPrice
(
BaseViewHolder
viewHolder
,
ShoppingCartBean
cartBean
,
double
unitPrice
,
int
foodQuantity
,
int
species
)
{
//供應商總價減去-這個食品的總價=等於現價
//供應商總價減去-這個食品的總價=等於現價
double
currentPrice
=
MoneyUtil
.
sub
(
cartBean
.
getSelectFoodAmount
(),
MoneyUtil
.
priceCalculation
(
unitPrice
,
foodQuantity
));
double
currentPrice
=
MoneyUtil
.
sub
(
cartBean
.
getSelectFoodAmount
(),
MoneyUtil
.
priceCalculation
(
unitPrice
,
foodQuantity
));
//修改選中食品的金額
cartBean
.
setSelectFoodAmount
(
currentPrice
);
cartBean
.
setSelectFoodAmount
(
currentPrice
);
String
amountStr
=
String
.
format
(
amountUnitStr
,
currentPrice
);
//修改顯示總金額
setTotalAmount
(
viewHolder
,
currentPrice
);
setTotalAmount
(
viewHolder
,
currentPrice
);
viewHolder
.
setText
(
R
.
id
.
tv_order_item_actual_pay_amount
,
amountStr
);
//修改實際應付金額
//傳遞回去
setActualAmount
(
viewHolder
,
MoneyUtil
.
sum
(
currentPrice
,
cartBean
.
getShipping
()));
//傳遞回去,由於是減少食品,所以金額為負
if
(
onInfoChangeListener
!=
null
)
{
if
(
onInfoChangeListener
!=
null
)
{
onInfoChangeListener
.
onInfoChange
(-
MoneyUtil
.
priceCalculation
(
unitPrice
,
foodQuantity
),
species
);
onInfoChangeListener
.
onInfoChange
(-
MoneyUtil
.
priceCalculation
(
unitPrice
,
foodQuantity
),
species
);
}
}
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/fragment/food/FoodUnitPageFragment.java
View file @
94e2feb7
...
@@ -147,7 +147,7 @@ public class FoodUnitPageFragment extends BaseSupplyChainFragment<FoodUnitPagePr
...
@@ -147,7 +147,7 @@ public class FoodUnitPageFragment extends BaseSupplyChainFragment<FoodUnitPagePr
public
void
loadBasicUnitAdapter
(
List
<
BasicUnitBean
>
basicUnitBeans
)
{
public
void
loadBasicUnitAdapter
(
List
<
BasicUnitBean
>
basicUnitBeans
)
{
basicUnitAdapter
=
new
BasicUnitAdapter
(
basicUnitBeans
);
basicUnitAdapter
=
new
BasicUnitAdapter
(
basicUnitBeans
);
//獲取到基礎單位之後,才在標題欄中添加刪除按鈕
//獲取到基礎單位之後,才在標題欄中添加刪除按鈕
topBar
.
addRightImageButton
(
R
.
drawable
.
ic_white_delete
,
R
.
id
.
btn_delete
).
setOnClickListener
(
v
->
{
topBar
.
addRightImageButton
(
R
.
drawable
.
ic_white_delete
,
R
.
id
.
btn_delete
).
setOnClickListener
(
v
->
{
//刪除
//刪除
basicUnitAdapter
.
toggleDelete
();
basicUnitAdapter
.
toggleDelete
();
});
});
...
@@ -183,7 +183,7 @@ public class FoodUnitPageFragment extends BaseSupplyChainFragment<FoodUnitPagePr
...
@@ -183,7 +183,7 @@ public class FoodUnitPageFragment extends BaseSupplyChainFragment<FoodUnitPagePr
});
});
basicUnitAdapter
.
setOnItemChildClickListener
((
adapter
,
view
,
position
)
->
{
basicUnitAdapter
.
setOnItemChildClickListener
((
adapter
,
view
,
position
)
->
{
if
(
view
.
getId
()
==
R
.
id
.
iv_delete_basic_unit
)
{
if
(
view
.
getId
()
==
R
.
id
.
iv_delete_basic_unit
)
{
//刪除單位
//刪除單位
mPresenter
.
deleteUnitKey
(
basicUnitAdapter
.
getItem
(
position
).
getId
(),
position
);
mPresenter
.
deleteUnitKey
(
basicUnitAdapter
.
getItem
(
position
).
getId
(),
position
);
}
}
...
@@ -193,8 +193,8 @@ public class FoodUnitPageFragment extends BaseSupplyChainFragment<FoodUnitPagePr
...
@@ -193,8 +193,8 @@ public class FoodUnitPageFragment extends BaseSupplyChainFragment<FoodUnitPagePr
@Override
@Override
public
void
addBasicUnit
(
BasicUnitBean
basicUnitBean
)
{
public
void
addBasicUnit
(
BasicUnitBean
basicUnitBean
)
{
if
(
basicUnitAdapter
!=
null
)
{
if
(
basicUnitAdapter
!=
null
)
{
int
index
=
basicUnitAdapter
.
getItemCount
()
-
1
;
basicUnitAdapter
.
addData
(
0
,
basicUnitBean
)
;
basicUnitAdapter
.
addData
(
Math
.
max
(
index
,
0
),
basicUnitBean
);
rvBasicUnitList
.
scrollToPosition
(
0
);
}
}
}
}
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/fragment/order/ShoppingCatFragment.java
View file @
94e2feb7
package
com
.
gingersoft
.
supply_chain
.
mvp
.
ui
.
fragment
.
order
;
package
com
.
gingersoft
.
supply_chain
.
mvp
.
ui
.
fragment
.
order
;
import
android.app.Dialog
;
import
android.graphics.drawable.Drawable
;
import
android.graphics.drawable.Drawable
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/fragment/warehouse/WarehousingInventoryFragment.java
View file @
94e2feb7
...
@@ -14,6 +14,7 @@ import android.widget.TextView;
...
@@ -14,6 +14,7 @@ import android.widget.TextView;
import
androidx.annotation.NonNull
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
androidx.core.content.ContextCompat
;
import
androidx.core.content.ContextCompat
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.gingersoft.gsa.cloud.common.utils.glide.GlideUtils
;
import
com.gingersoft.gsa.cloud.common.utils.glide.GlideUtils
;
import
com.gingersoft.gsa.cloud.common.utils.other.TextUtil
;
import
com.gingersoft.gsa.cloud.common.utils.other.TextUtil
;
...
@@ -49,12 +50,16 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho
...
@@ -49,12 +50,16 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho
TextView
tvWarehouseDifference
;
TextView
tvWarehouseDifference
;
@BindView
(
R2
.
id
.
ed_warehouse_loss
)
@BindView
(
R2
.
id
.
ed_warehouse_loss
)
EditText
edWarehouseLoss
;
EditText
edWarehouseLoss
;
@BindView
(
R2
.
id
.
rv_warehouse_inventory_record
)
RecyclerView
rvRecord
;
/**
/**
* 食品總庫存
* 食品總庫存
*/
*/
private
int
foodNum
;
private
int
foodNum
;
private
String
foodNo
;
private
String
foodNo
;
private
int
pageIndex
;
public
static
WarehousingInventoryFragment
newInstance
(
WareHouseListBean
.
WareHousingDataBean
.
PurchaseWarehousingOrderDetailsVOSBean
purchaseWarehousingOrderDetailsVosBean
)
{
public
static
WarehousingInventoryFragment
newInstance
(
WareHouseListBean
.
WareHousingDataBean
.
PurchaseWarehousingOrderDetailsVOSBean
purchaseWarehousingOrderDetailsVosBean
)
{
WarehousingInventoryFragment
fragment
=
new
WarehousingInventoryFragment
();
WarehousingInventoryFragment
fragment
=
new
WarehousingInventoryFragment
();
Bundle
bundle
=
new
Bundle
();
Bundle
bundle
=
new
Bundle
();
...
@@ -86,70 +91,89 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho
...
@@ -86,70 +91,89 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho
public
void
initData
(
@Nullable
Bundle
savedInstanceState
)
{
public
void
initData
(
@Nullable
Bundle
savedInstanceState
)
{
Bundle
arguments
=
getArguments
();
Bundle
arguments
=
getArguments
();
if
(
arguments
!=
null
)
{
if
(
arguments
!=
null
)
{
//獲取庫存盤點記錄
getWarehousingRecord
();
int
foodId
=
arguments
.
getInt
(
WarehouseDetailsFragment
.
FOOD_ID_KEY
);
int
foodId
=
arguments
.
getInt
(
WarehouseDetailsFragment
.
FOOD_ID_KEY
);
//食品編號
foodNo
=
arguments
.
getString
(
WarehouseDetailsFragment
.
FOOD_NO_KEY
);
foodNo
=
arguments
.
getString
(
WarehouseDetailsFragment
.
FOOD_NO_KEY
);
String
foodName
=
arguments
.
getString
(
WarehouseDetailsFragment
.
FOOD_NAME_KEY
);
//食品庫存總數
foodNum
=
arguments
.
getInt
(
WarehouseDetailsFragment
.
FOOD_NUM_KEY
);
foodNum
=
arguments
.
getInt
(
WarehouseDetailsFragment
.
FOOD_NUM_KEY
);
ivWarehouseImg
.
post
(()
->
{
//加載食品圖片
ViewGroup
.
LayoutParams
layoutParams
=
ivWarehouseImg
.
getLayoutParams
();
loadFoodImage
(
arguments
);
layoutParams
.
height
=
ivWarehouseImg
.
getWidth
();
layoutParams
.
width
=
ivWarehouseImg
.
getWidth
();
ivWarehouseImg
.
setLayoutParams
(
layoutParams
);
String
foodImageUrl
=
arguments
.
getString
(
WarehouseDetailsFragment
.
FOOD_IMAGE_KEY
);
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
foodImageUrl
))
{
GlideUtils
.
display
(
requireContext
(),
ivWarehouseImg
,
foodImageUrl
);
}
else
{
ivWarehouseImg
.
setImageResource
(
R
.
drawable
.
img_small_default
);
}
});
//初始化標題
//初始化標題
initTopBar
(
supplyTopBar
,
foodName
);
initTopBar
(
arguments
);
Button
btnSave
=
supplyTopBar
.
addRightTextButton
(
R
.
string
.
str_save
,
R
.
id
.
id_save
);
//初始化數量和編輯監聽
btnSave
.
setTextColor
(
getColor
(
R
.
color
.
white
));
initEdit
();
btnSave
.
setOnClickListener
(
mOnClickListener
);
}
else
{
//庫存數量
showMessage
(
"獲取食材信息失敗,請稍候重試"
);
tvWarehouseTotal
.
setText
(
String
.
valueOf
(
foodNum
));
killMyself
();
tvWarehouseDifference
.
setText
(
String
.
valueOf
(
foodNum
));
}
edWarehouseLoss
.
setOnFocusChangeListener
((
v
,
hasFocus
)
->
{
}
if
(
hasFocus
&&
edWarehouseLoss
.
getText
().
toString
().
equals
(
"0"
))
{
edWarehouseLoss
.
setText
(
""
);
}
});
edWarehouseLoss
.
addTextChangedListener
(
new
TextWatcher
()
{
@Override
public
void
beforeTextChanged
(
CharSequence
s
,
int
start
,
int
count
,
int
after
)
{
}
private
void
getWarehousingRecord
()
{
mPresenter
.
getWarehousingRecord
(
pageIndex
);
}
@Override
private
void
initEdit
()
{
public
void
onTextChanged
(
CharSequence
s
,
int
start
,
int
before
,
int
count
)
{
//庫存數量
tvWarehouseTotal
.
setText
(
String
.
valueOf
(
foodNum
));
//庫存差異
tvWarehouseDifference
.
setText
(
String
.
valueOf
(
foodNum
));
edWarehouseLoss
.
setOnFocusChangeListener
((
v
,
hasFocus
)
->
{
//當輸入框獲得焦點時,數量為0,去掉0
if
(
hasFocus
&&
edWarehouseLoss
.
getText
().
toString
().
equals
(
"0"
))
{
edWarehouseLoss
.
setText
(
""
);
}
});
edWarehouseLoss
.
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
)
{
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
s
+
""
))
{
@Override
//用戶輸入的盤點數量
public
void
afterTextChanged
(
Editable
s
)
{
int
inventoryNum
=
Integer
.
parseInt
(
s
+
""
);
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
s
+
""
))
{
//用戶輸入的盤點數量
int
inventoryNum
=
Integer
.
parseInt
(
s
+
""
);
// if (inventoryNum > foodNum) {
// if (inventoryNum > foodNum) {
// inventoryNum = foodNum;
// inventoryNum = foodNum;
// showMessage("不能大於庫存數");
// showMessage("不能大於庫存數");
// edWarehouseLoss.setText(String.valueOf(foodNum));
// edWarehouseLoss.setText(String.valueOf(foodNum));
// edWarehouseLoss.setSelection(edWarehouseLoss.getText().length());
// edWarehouseLoss.setSelection(edWarehouseLoss.getText().length());
// }
// }
tvWarehouseDifference
.
setText
(
String
.
valueOf
(
Math
.
abs
(
foodNum
-
inventoryNum
)));
tvWarehouseDifference
.
setText
(
String
.
valueOf
(
Math
.
abs
(
foodNum
-
inventoryNum
)));
}
else
{
}
else
{
tvWarehouseDifference
.
setText
(
String
.
valueOf
(
foodNum
));
tvWarehouseDifference
.
setText
(
String
.
valueOf
(
foodNum
));
}
}
}
});
}
});
}
private
void
initTopBar
(
Bundle
arguments
)
{
String
foodName
=
arguments
.
getString
(
WarehouseDetailsFragment
.
FOOD_NAME_KEY
);
//初始化標題
initTopBar
(
supplyTopBar
,
foodName
);
//添加保存按鈕
Button
btnSave
=
supplyTopBar
.
addRightTextButton
(
R
.
string
.
str_save
,
R
.
id
.
id_save
);
btnSave
.
setTextColor
(
getColor
(
R
.
color
.
white
));
btnSave
.
setOnClickListener
(
mOnClickListener
);
}
private
void
loadFoodImage
(
Bundle
arguments
)
{
String
foodImageUrl
=
arguments
.
getString
(
WarehouseDetailsFragment
.
FOOD_IMAGE_KEY
);
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
foodImageUrl
))
{
GlideUtils
.
display
(
requireContext
(),
ivWarehouseImg
,
foodImageUrl
);
}
else
{
}
else
{
showMessage
(
"獲取食材信息失敗,請稍候重試"
);
ivWarehouseImg
.
setImageResource
(
R
.
drawable
.
img_small_default
);
killMyself
();
}
}
}
}
private
View
.
OnClickListener
mOnClickListener
=
v
->
{
private
View
.
OnClickListener
mOnClickListener
=
v
->
{
if
(
v
.
getId
()
==
R
.
id
.
id_save
)
{
if
(
v
.
getId
()
==
R
.
id
.
id_save
)
{
//保存,調用庫存損耗
//保存,調用庫存損耗
...
@@ -174,4 +198,9 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho
...
@@ -174,4 +198,9 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho
public
void
updateSuccess
()
{
public
void
updateSuccess
()
{
setFragmentResult
(
RESULT_OK
,
null
);
setFragmentResult
(
RESULT_OK
,
null
);
}
}
@Override
public
void
loadRecord
()
{
}
}
}
component-supply-chain/src/main/res/layout/fragment_warehousing_inventory.xml
View file @
94e2feb7
...
@@ -3,94 +3,170 @@
...
@@ -3,94 +3,170 @@
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:background=
"@color/color_f0"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<include
layout=
"@layout/supply_chain_top_bar"
/>
<include
layout=
"@layout/supply_chain_top_bar"
/>
<ImageView
android:id=
"@+id/iv_warehouse_img"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/dp_36"
android:layout_marginRight=
"@dimen/dp_36"
/>
<LinearLayout
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/dp_
20
"
android:layout_marginLeft=
"@dimen/dp_
5
"
android:layout_marginTop=
"@dimen/dp_10"
android:layout_marginTop=
"@dimen/dp_10"
android:layout_marginRight=
"@dimen/dp_20"
android:layout_marginRight=
"@dimen/dp_5"
android:background=
"@drawable/shape_white_eight_corners_bg"
android:orientation=
"horizontal"
>
android:orientation=
"horizontal"
>
<TextView
<ImageView
android:layout_width=
"wrap_content"
android:id=
"@+id/iv_warehouse_img"
android:layout_height=
"wrap_content"
android:layout_width=
"@dimen/dp_77"
android:text=
"庫存數量:"
android:layout_height=
"@dimen/dp_77"
android:textColor=
"@color/color_66"
android:layout_margin=
"@dimen/dp_10"
/>
android:textSize=
"@dimen/dp_17"
/>
<TextView
<LinearLayout
android:id=
"@+id/tv_warehouse_total"
android:layout_width=
"match_parent"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_6"
android:layout_marginLeft=
"@dimen/dp_10"
android:layout_marginRight=
"@dimen/dp_10"
android:textColor=
"@color/color_3c"
android:layout_marginBottom=
"@dimen/dp_6"
android:textSize=
"@dimen/dp_17"
android:orientation=
"vertical"
>
android:textStyle=
"bold"
tools:text=
"100"
/>
<View
android:layout_width=
"0dp"
android:layout_height=
"0dp"
android:layout_weight=
"1"
/>
<TextView
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"庫存差異:"
android:orientation=
"horizontal"
>
android:textColor=
"@color/color_66"
android:textSize=
"@dimen/dp_17"
/>
<TextView
<TextView
android:id=
"@+id/tv_warehouse_difference"
style=
"@style/WareHouse_Details_TextStyle"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:textColor=
"@color/color_3c"
android:text=
"庫存:"
/>
android:textSize=
"@dimen/dp_17"
android:textStyle=
"bold"
<TextView
tools:text=
"+100"
/>
android:id=
"@+id/tv_warehouse_total"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textColor=
"@color/other_order_details_sure_btn_color"
android:textSize=
"@dimen/dp_19"
tools:text=
"100"
/>
<TextView
android:id=
"@+id/tv_food_unit"
style=
"@style/WareHouse_Details_TextStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
tools:text=
"盒"
/>
</LinearLayout>
<View
android:layout_width=
"wrap_content"
android:layout_height=
"0dp"
android:layout_weight=
"1"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
<TextView
style=
"@style/WareHouse_Details_TextStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"庫存差異:"
/>
<TextView
android:id=
"@+id/tv_warehouse_difference"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textColor=
"@color/color_3c"
android:textSize=
"@dimen/dp_17"
android:textStyle=
"bold"
tools:text=
"+100"
/>
</LinearLayout>
<View
android:layout_width=
"wrap_content"
android:layout_height=
"0dp"
android:layout_weight=
"1"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
<TextView
style=
"@style/WareHouse_Details_TextStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"盤點庫存:"
android:textSize=
"@dimen/dp_15"
/>
<EditText
android:id=
"@+id/ed_warehouse_loss"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@drawable/shape_square_edit_border_aa"
android:gravity=
"center"
android:hint=
"請輸入"
android:inputType=
"number"
android:paddingTop=
"@dimen/dp_5"
android:paddingBottom=
"@dimen/dp_5"
android:text=
"0"
android:textColor=
"@color/theme_333_color"
android:textCursorDrawable=
"@drawable/cursor_theme"
android:textSize=
"@dimen/dp_18"
android:textStyle=
"bold"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"@dimen/dp_38"
android:layout_marginLeft=
"@dimen/dp_20"
android:layout_marginTop=
"@dimen/dp_10"
android:layout_marginTop=
"@dimen/dp_15"
android:layout_marginRight=
"@dimen/dp_20"
android:orientation=
"horizontal"
>
android:orientation=
"horizontal"
>
<TextView
<TextView
android:layout_width=
"wrap_content"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_height=
"match_parent"
android:text=
"盤點庫存:"
android:layout_weight=
"0.25"
android:textColor=
"@color/color_66"
android:background=
"@color/theme_color"
android:textSize=
"@dimen/dp_17"
/>
<EditText
android:id=
"@+id/ed_warehouse_loss"
android:layout_width=
"@dimen/dp_86"
android:layout_height=
"wrap_content"
android:background=
"@drawable/shape_square_edit_border_3c"
android:gravity=
"center"
android:gravity=
"center"
android:hint=
"請輸入"
android:text=
"用戶名"
android:inputType=
"number"
android:textColor=
"@color/white"
android:paddingTop=
"@dimen/dp_9"
android:textSize=
"@dimen/dp_12"
/>
android:paddingBottom=
"@dimen/dp_9"
android:text=
"0"
android:textColor=
"@color/theme_333_color"
android:textCursorDrawable=
"@drawable/cursor_theme"
android:textSize=
"@dimen/dp_14"
android:textStyle=
"bold"
/>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_marginLeft=
"@dimen/dp_1"
android:layout_weight=
"0.3"
android:background=
"@color/theme_color"
android:gravity=
"center"
android:text=
"盤點"
android:textColor=
"@color/white"
android:textSize=
"@dimen/dp_12"
/>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_marginLeft=
"@dimen/dp_1"
android:layout_weight=
"0.55"
android:background=
"@color/theme_color"
android:gravity=
"center"
android:text=
"操作日期"
android:textColor=
"@color/white"
android:textSize=
"@dimen/dp_12"
/>
</LinearLayout>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_warehouse_inventory_record"
android:layout_width=
"match_parent"
app:layoutManager=
"androidx.recyclerview.widget.LinearLayoutManager"
android:layout_height=
"match_parent"
/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
component-supply-chain/src/main/res/layout/item_basic_unit.xml
View file @
94e2feb7
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
android:layout_marginLeft=
"@dimen/dp_3"
android:layout_marginLeft=
"@dimen/dp_3"
android:layout_marginRight=
"@dimen/dp_3"
android:layout_marginRight=
"@dimen/dp_3"
android:background=
"@color/white"
android:background=
"@color/white"
app:cardCornerRadius=
"@dimen/dp_
8
"
app:cardCornerRadius=
"@dimen/dp_
4
"
app:cardUseCompatPadding=
"true"
app:cardUseCompatPadding=
"true"
app:elevation=
"@dimen/dp_4"
>
app:elevation=
"@dimen/dp_4"
>
...
...
component-supply-chain/src/main/res/layout/item_shopping_cart.xml
View file @
94e2feb7
...
@@ -26,9 +26,9 @@
...
@@ -26,9 +26,9 @@
<CheckBox
<CheckBox
android:id=
"@+id/cb_order_item_all_select"
android:id=
"@+id/cb_order_item_all_select"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_weight=
"6"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/dp_12"
android:layout_marginLeft=
"@dimen/dp_12"
android:layout_weight=
"6"
android:button=
"@drawable/selector_checkbox"
android:button=
"@drawable/selector_checkbox"
android:textColor=
"@color/black"
android:textColor=
"@color/black"
android:textSize=
"@dimen/dp_16"
android:textSize=
"@dimen/dp_16"
...
@@ -41,10 +41,10 @@
...
@@ -41,10 +41,10 @@
android:layout_marginLeft=
"@dimen/dp_5"
android:layout_marginLeft=
"@dimen/dp_5"
android:layout_marginRight=
"@dimen/dp_5"
android:layout_marginRight=
"@dimen/dp_5"
android:layout_weight=
"4"
android:layout_weight=
"4"
android:textSize=
"@dimen/dp_14"
android:gravity=
"right"
android:gravity=
"right"
android:text=
"@string/minimumAmount"
android:text=
"@string/minimumAmount"
android:textColor=
"@color/required_color"
/>
android:textColor=
"@color/required_color"
android:textSize=
"@dimen/dp_14"
/>
</LinearLayout>
</LinearLayout>
<include
layout=
"@layout/include_horizontal_color_ccc_dividing_line"
/>
<include
layout=
"@layout/include_horizontal_color_ccc_dividing_line"
/>
...
@@ -117,11 +117,21 @@
...
@@ -117,11 +117,21 @@
android:textSize=
"@dimen/dp_15"
/>
android:textSize=
"@dimen/dp_15"
/>
<TextView
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"$"
android:textColor=
"@color/required_color"
android:textSize=
"@dimen/dp_14"
android:textStyle=
"bold"
/>
<com.google.android.material.textfield.TextInputEditText
android:id=
"@+id/tv_order_item_freight"
android:id=
"@+id/tv_order_item_freight"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:layout_weight=
"1"
android:text=
"$0"
android:background=
"@null"
android:inputType=
"numberDecimal"
android:text=
"0"
android:textColor=
"@color/required_color"
android:textColor=
"@color/required_color"
android:textSize=
"@dimen/dp_14"
android:textSize=
"@dimen/dp_14"
android:textStyle=
"bold"
/>
android:textStyle=
"bold"
/>
...
...
component-table/src/main/res/layout/table_dialog_cancel_food.xml
View file @
94e2feb7
...
@@ -79,7 +79,6 @@
...
@@ -79,7 +79,6 @@
android:id=
"@+id/slider_food_count"
android:id=
"@+id/slider_food_count"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:theme=
"@style/ThemeOverlay.PrimaryPalette.Red"
android:valueFrom=
"0"
android:valueFrom=
"0"
android:valueTo=
"11"
android:valueTo=
"11"
android:stepSize=
"1"
/>
android:stepSize=
"1"
/>
...
...
component-table/src/main/res/values/styles.xml
View file @
94e2feb7
...
@@ -8,8 +8,8 @@
...
@@ -8,8 +8,8 @@
<item
name=
"colorAccent"
>
@color/table_colorAccent
</item>
<item
name=
"colorAccent"
>
@color/table_colorAccent
</item>
</style>
</style>
<style
name=
"ThemeOverlay.PrimaryPalette.Red"
parent=
""
>
<!-- <style name="ThemeOverlay.PrimaryPalette.Red" parent="">--
>
<item
name=
"colorPrimary"
>
#e53935
</item
>
<!-- <item name="colorPrimary">#e53935</item>--
>
<item
name=
"colorPrimaryDark"
>
#ab000d
</item
>
<!-- <item name="colorPrimaryDark">#ab000d</item>--
>
</style
>
<!-- </style>--
>
</resources>
</resources>
library-common/src/main/res/drawable/shape_square_edit_border_aa.xml
0 → 100644
View file @
94e2feb7
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<corners
android:radius=
"@dimen/dp_4"
/>
<stroke
android:width=
"@dimen/dp_1"
android:color=
"@color/color_aaa"
/>
</shape>
\ No newline at end of file
library-ui/src/main/java/com/gingersoft/gsa/cloud/ui/adapter/multi/InputProvider.java
View file @
94e2feb7
...
@@ -55,13 +55,14 @@ public class InputProvider<T extends InfoMultiBean> extends MyBaseItemProvider<T
...
@@ -55,13 +55,14 @@ public class InputProvider<T extends InfoMultiBean> extends MyBaseItemProvider<T
InputViewHolder
viewHolder
=
(
InputViewHolder
)
baseViewHolder
;
InputViewHolder
viewHolder
=
(
InputViewHolder
)
baseViewHolder
;
MultiInputBean
infoMultiBean
=
(
MultiInputBean
)
t
;
MultiInputBean
infoMultiBean
=
(
MultiInputBean
)
t
;
viewHolder
.
removeTextWatcher
();
TextInputEditText
editText
=
baseViewHolder
.
getView
(
R
.
id
.
ed_multi_value
);
TextInputEditText
editText
=
baseViewHolder
.
getView
(
R
.
id
.
ed_multi_value
);
editText
.
setError
(
null
);
editText
.
setError
(
null
);
initEditFocusable
(
infoMultiBean
,
editText
);
initEditFocusable
(
infoMultiBean
,
editText
);
//設置輸入限制
//設置輸入限制
setFilters
(
editText
,
infoMultiBean
);
setFilters
(
editText
,
infoMultiBean
);
//刷新數據
//刷新數據
viewHolder
.
updateView
(
infoMultiBean
);
viewHolder
.
updateView
();
//設置輸入框的值
//設置輸入框的值
initEditText
(
editText
,
infoMultiBean
.
getShowValue
(),
infoMultiBean
.
getHintText
());
initEditText
(
editText
,
infoMultiBean
.
getShowValue
(),
infoMultiBean
.
getHintText
());
//添加焦點監聽
//添加焦點監聽
...
@@ -95,6 +96,8 @@ public class InputProvider<T extends InfoMultiBean> extends MyBaseItemProvider<T
...
@@ -95,6 +96,8 @@ public class InputProvider<T extends InfoMultiBean> extends MyBaseItemProvider<T
}
}
private
void
setFilters
(
EditText
editText
,
MultiInputBean
multiSelectBean
)
{
private
void
setFilters
(
EditText
editText
,
MultiInputBean
multiSelectBean
)
{
//先清空值,再
editText
.
setText
(
""
);
//輸入攔截器
//輸入攔截器
editText
.
setFilters
(
multiSelectBean
.
getInputFilters
());
editText
.
setFilters
(
multiSelectBean
.
getInputFilters
());
//輸入類型限制
//輸入類型限制
...
@@ -110,17 +113,19 @@ public class InputProvider<T extends InfoMultiBean> extends MyBaseItemProvider<T
...
@@ -110,17 +113,19 @@ public class InputProvider<T extends InfoMultiBean> extends MyBaseItemProvider<T
super
(
view
);
super
(
view
);
ButterKnife
.
bind
(
this
,
view
);
ButterKnife
.
bind
(
this
,
view
);
editText
=
view
.
findViewById
(
R
.
id
.
ed_multi_value
);
editText
=
view
.
findViewById
(
R
.
id
.
ed_multi_value
);
editText
.
addTextChangedListener
(
inputTextWatcher
);
}
}
public
void
updateView
(
MultiInputBean
infoMultiBean
)
{
public
void
removeTextWatcher
()
{
editText
.
removeTextChangedListener
(
inputTextWatcher
);
}
public
void
updateView
()
{
editText
.
addTextChangedListener
(
inputTextWatcher
);
inputTextWatcher
.
inputViewHolder
=
this
;
inputTextWatcher
.
inputViewHolder
=
this
;
inputTextWatcher
.
infoMultiBean
=
infoMultiBean
;
}
}
}
}
class
InputTextWatcher
implements
TextWatcher
{
class
InputTextWatcher
implements
TextWatcher
{
MultiInputBean
infoMultiBean
;
InputViewHolder
inputViewHolder
;
InputViewHolder
inputViewHolder
;
@Override
@Override
...
@@ -133,7 +138,8 @@ public class InputProvider<T extends InfoMultiBean> extends MyBaseItemProvider<T
...
@@ -133,7 +138,8 @@ public class InputProvider<T extends InfoMultiBean> extends MyBaseItemProvider<T
@Override
@Override
public
void
afterTextChanged
(
Editable
s
)
{
public
void
afterTextChanged
(
Editable
s
)
{
if
(
infoMultiBean
!=
null
)
{
if
(
inputViewHolder
!=
null
)
{
MultiInputBean
infoMultiBean
=
(
MultiInputBean
)
getAdapter
().
getItem
(
inputViewHolder
.
getAdapterPosition
());
infoMultiBean
.
setShowValue
(
s
+
""
);
infoMultiBean
.
setShowValue
(
s
+
""
);
}
}
}
}
...
...
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