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
63c11ab4
Commit
63c11ab4
authored
Mar 06, 2021
by
Wyh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、打印改為Rx 2、供應鏈供應商信息存入購物車中
parent
19f0450f
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
210 additions
and
79 deletions
+210
-79
component-print/src/main/java/com/joe/print/mvp/print/PrinterRoot.java
+20
-18
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/bean/SupplierInfoBean.java
+11
-0
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/content/SupplyShoppingCart.java
+46
-5
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/FoodIngredientsPresenter.java
+5
-7
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/NewFoodIngredientsPresenter.java
+22
-0
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/NewSupplierPresenter.java
+5
-2
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/OrderDetailsPresenter.java
+2
-2
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/ShoppingCatPresenter.java
+22
-7
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/WarehouseDetailsPresenter.java
+2
-2
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/fragment/food/FoodUnitPageFragment.java
+1
-0
component-supply-chain/src/main/res/drawable-xhdpi/ic_viewed.png
+0
-0
component-supply-chain/src/main/res/layout/item_basic_unit.xml
+1
-1
library-common/src/main/java/com/gingersoft/gsa/cloud/common/core/restaurant/RestaurantInfoManager.java
+2
-2
library-common/src/main/java/com/gingersoft/gsa/cloud/common/utils/gson/GsonUtils.java
+8
-8
library-print/src/main/java/com/gingersoft/gsa/cloud/print/PrintExecutor.java
+63
-25
No files found.
component-print/src/main/java/com/joe/print/mvp/print/PrinterRoot.java
View file @
63c11ab4
...
...
@@ -366,24 +366,26 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintExecut
if
(
executor
==
null
)
{
executor
=
new
PrintExecutor
()
.
setOnStateChangedListener
(
state
->
{
// switch (state) {
// case PrintSocketHolder.STATE_1:
// tip = "開始創建連接";
// break;
// case PrintSocketHolder.STATE_2:
// tip = "創建連接成功,開始發送數據";
// break;
// case PrintSocketHolder.STATE_3:
// tip = "開始寫入數據";
// break;
// case PrintSocketHolder.STATE_4://关闭输出流
// tip = "關閉中";
// killMyself();
// break;
// default:
// break;
// }
LogUtil
.
e
(
"eee"
,
"打印狀態:"
+
state
);
switch
(
state
)
{
case
PrintSocketHolder
.
STATE_0
:
LoganManager
.
w_printer
(
TAG
,
"打印機狀態 --> 生成页面数据"
);
break
;
case
PrintSocketHolder
.
STATE_1
:
LoganManager
.
w_printer
(
TAG
,
"打印機狀態 --> 创建Socket连接"
);
break
;
case
PrintSocketHolder
.
STATE_2
:
LoganManager
.
w_printer
(
TAG
,
"打印機狀態 --> 获取输出流"
);
break
;
case
PrintSocketHolder
.
STATE_3
:
LoganManager
.
w_printer
(
TAG
,
"打印機狀態 --> 写入页面数据"
);
break
;
case
PrintSocketHolder
.
STATE_4
:
LoganManager
.
w_printer
(
TAG
,
"打印機狀態 --> 关闭输出流"
);
break
;
default
:
break
;
}
LogUtil
.
e
(
"eee"
,
"executePrint----打印狀態:"
+
state
);
if
(
state
==
PrintSocketHolder
.
STATE_4
)
{
printSuccess
();
}
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/bean/SupplierInfoBean.java
View file @
63c11ab4
...
...
@@ -58,6 +58,16 @@ public class SupplierInfoBean implements Serializable {
public
SupplierInfoBean
()
{
}
public
static
SupplierInfoBean
generateSupplierByFood
(
PurchaseFoodBean
purchaseFoodBean
)
{
SupplierInfoBean
supplierInfoBean
=
new
SupplierInfoBean
();
supplierInfoBean
.
setShipping
(
purchaseFoodBean
.
getShipping
());
supplierInfoBean
.
setSupplierName
(
purchaseFoodBean
.
getSupplierName
());
supplierInfoBean
.
setMinimumAmount
(
purchaseFoodBean
.
getMinimumAmount
());
supplierInfoBean
.
setAddress
(
purchaseFoodBean
.
getAddress
());
supplierInfoBean
.
setId
(
purchaseFoodBean
.
getSupplierId
());
return
supplierInfoBean
;
}
@Data
public
static
class
SupplierContacts
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
4586838211196656718L
;
...
...
@@ -89,6 +99,7 @@ public class SupplierInfoBean implements Serializable {
public
final
static
int
Kakao_Talk
=
5
;
public
final
static
int
SMS
=
6
;
public
final
static
int
Efax
=
7
;
public
static
String
getContractTitleByType
(
int
type
)
{
switch
(
type
)
{
case
Email:
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/content/SupplyShoppingCart.java
View file @
63c11ab4
...
...
@@ -2,12 +2,16 @@ package com.gingersoft.supply_chain.mvp.content;
import
com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean
;
import
com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean
;
import
com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean
;
import
com.xuexiang.rxutil2.rxjava.RxJavaUtils
;
import
com.xuexiang.rxutil2.rxjava.task.RxIOTask
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author 宇航.
...
...
@@ -22,6 +26,11 @@ public class SupplyShoppingCart {
* value為食品信息
*/
private
static
List
<
PurchaseFoodBean
>
cartFoods
;
/**
* 供應商信息map
* 有時候PurchaseFoodBean中的供應商信息不可靠,比如:用戶將食品添加到購物車中,然後又去供應商列表修改供應商信息,這時候需要更新供應商信息
*/
private
static
Map
<
Integer
,
SupplierInfoBean
>
supplierInfoBeanMap
;
private
static
SupplyShoppingCart
shoppingCart
;
...
...
@@ -39,12 +48,48 @@ public class SupplyShoppingCart {
return
cartFoods
;
}
public
Map
<
Integer
,
SupplierInfoBean
>
getSupplierInfoBeanMap
(){
if
(
supplierInfoBeanMap
==
null
){
supplierInfoBeanMap
=
new
HashMap
<>();
}
return
supplierInfoBeanMap
;
}
public
SupplierInfoBean
getSupplierById
(
int
supplierId
)
{
return
getSupplierInfoBeanMap
().
get
(
supplierId
);
}
public
void
updateSupplier
(
SupplierInfoBean
supplierInfoBean
){
getSupplierInfoBeanMap
().
put
(
supplierInfoBean
.
getId
(),
supplierInfoBean
);
}
public
void
addAllFood
(
Collection
<
PurchaseFoodBean
>
purchaseFoodBeans
)
{
for
(
PurchaseFoodBean
purchaseFoodBean
:
purchaseFoodBeans
)
{
addFood
(
purchaseFoodBean
);
}
}
/**
* 添加食品時記錄供應商信息,對供應商進行修改時,需要修改食材的供應商信息
*
* @param purchaseFoodBean
*/
public
void
addFood
(
PurchaseFoodBean
purchaseFoodBean
)
{
addFood
(
getCartFoods
().
size
(),
purchaseFoodBean
);
}
public
void
addFood
(
int
index
,
PurchaseFoodBean
purchaseFoodBean
)
{
getCartFoods
().
add
(
index
,
purchaseFoodBean
);
if
(
getSupplierInfoBeanMap
().
get
(
purchaseFoodBean
.
getSupplierId
())
==
null
)
{
getSupplierInfoBeanMap
().
put
(
purchaseFoodBean
.
getSupplierId
(),
SupplierInfoBean
.
generateSupplierByFood
(
purchaseFoodBean
));
}
}
public
void
clear
()
{
if
(
cartFoods
==
null
)
{
return
;
}
cartFoods
.
clear
();
cartFoods
=
null
;
}
...
...
@@ -149,8 +194,4 @@ public class SupplyShoppingCart {
}
}
public
void
setCartFoods
(
List
<
PurchaseFoodBean
>
cartFoods
)
{
SupplyShoppingCart
.
cartFoods
=
cartFoods
;
}
}
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/FoodIngredientsPresenter.java
View file @
63c11ab4
...
...
@@ -203,7 +203,7 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr
for
(
PurchaseFoodBean
cartFood
:
SupplyShoppingCart
.
getInstance
().
getCartFoods
())
{
//將購物車中的食品數量同步到當前數據中
for
(
PurchaseFoodBean
purchaseFoodListVO
:
purchaseFoodListVOS
)
{
if
(
cartFood
.
getId
()
==
purchaseFoodListVO
.
getId
(
))
{
if
(
cartFood
.
getId
()
.
equals
(
purchaseFoodListVO
.
getId
()
))
{
//購物車裡的食品id和當前的食品id一樣,則將購物車中的食品數量賦值給當前食品
purchaseFoodListVO
.
setFoodQuantity
(
cartFood
.
getFoodQuantity
());
totalCount
+=
cartFood
.
getFoodQuantity
();
...
...
@@ -312,12 +312,10 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr
integerMap
.
remove
(
purchaseFoodBean
);
}
}
//把購物車的食品取出來
List
<
PurchaseFoodBean
>
cartFoods
=
SupplyShoppingCart
.
getInstance
().
getCartFoods
();
//清空
cartFoods
.
clear
();
//把購物車的食品清空
SupplyShoppingCart
.
getInstance
().
clear
();
//將本次選擇的添加進去
cartFoods
.
addAll
(
integerMap
.
values
());
SupplyShoppingCart
.
getInstance
().
addAllFood
(
integerMap
.
values
());
}
/**
...
...
@@ -633,7 +631,7 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr
if
(
purchaseFoodBean
.
getFoodQuantity
()
>
0
)
{
boolean
hasThisFood
=
false
;
for
(
PurchaseFoodBean
cartFood
:
SupplyShoppingCart
.
getInstance
().
getCartFoods
())
{
if
(
purchaseFoodBean
.
getId
()
==
cartFood
.
getId
(
))
{
if
(
purchaseFoodBean
.
getId
()
.
equals
(
cartFood
.
getId
()
))
{
hasThisFood
=
true
;
purchaseFoodBean
.
setFoodQuantity
(
cartFood
.
getFoodQuantity
());
if
(
integerMap
!=
null
)
{
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/NewFoodIngredientsPresenter.java
View file @
63c11ab4
...
...
@@ -27,6 +27,7 @@ import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean;
import
com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean
;
import
com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean
;
import
com.gingersoft.supply_chain.mvp.content.Constant
;
import
com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart
;
import
com.gingersoft.supply_chain.mvp.contract.NewFoodIngredientsContract
;
import
com.gingersoft.supply_chain.mvp.ui.fragment.category.CategorySelectFragment
;
import
com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodUnitPageFragment
;
...
...
@@ -37,6 +38,8 @@ import com.jess.arms.http.imageloader.ImageLoader;
import
com.jess.arms.integration.AppManager
;
import
com.jess.arms.mvp.BasePresenter
;
import
com.jess.arms.utils.RxLifecycleUtils
;
import
com.xuexiang.rxutil2.rxjava.RxJavaUtils
;
import
com.xuexiang.rxutil2.rxjava.task.RxIOTask
;
import
java.io.File
;
import
java.util.ArrayList
;
...
...
@@ -413,6 +416,25 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
if
(
baseResult
.
isSuccess
())
{
mRootView
.
showMessage
(
Constant
.
UPDATE_SUCCESS
);
mRootView
.
updateFoodInfoSuccess
(
purchaseFoodBean
.
getSupplierName
(),
purchaseFoodBean
.
getFoodCategoryName
());
RxJavaUtils
.
doInIOThread
(
new
RxIOTask
<
Object
>(
1
)
{
@Override
public
Void
doInIOThread
(
Object
o
)
{
//修改完食品後,需要查看購物車中的這個食品,也要進行修改
List
<
PurchaseFoodBean
>
cartFoods
=
SupplyShoppingCart
.
getInstance
().
getCartFoods
();
for
(
int
i
=
0
;
i
<
cartFoods
.
size
();
i
++)
{
PurchaseFoodBean
cartFood
=
cartFoods
.
get
(
i
);
if
(
purchaseFoodBean
.
getId
().
equals
(
cartFood
.
getId
()))
{
//找到這個食品
int
foodNum
=
cartFood
.
getFoodQuantity
();
cartFoods
.
remove
(
cartFood
);
purchaseFoodBean
.
setFoodQuantity
(
foodNum
);
SupplyShoppingCart
.
getInstance
().
addFood
(
i
,
purchaseFoodBean
);
return
null
;
}
}
return
null
;
}
});
}
else
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
baseResult
.
getErrMsg
()))
{
mRootView
.
showMessage
(
baseResult
.
getErrMsg
());
}
else
{
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/NewSupplierPresenter.java
View file @
63c11ab4
...
...
@@ -277,6 +277,7 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
supplierInfoBean
.
setSupplierContacts
(
null
);
//修改供應商聯繫方式單獨在這個接口
updateSupplierContact
();
//如果供應商名稱沒有修改,就不傳給後台
if
(
supplierName
.
equals
(
supplierInfoBean
.
getSupplierName
()))
{
supplierInfoBean
.
setSupplierName
(
null
);
}
...
...
@@ -295,8 +296,10 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
public
void
onNext
(
@NonNull
BaseResult
info
)
{
if
(
info
!=
null
)
{
if
(
info
.
isSuccess
())
{
//供應商信息修改後,將購物車食品信息刪除掉,不然食品信息中的採購金額和地址不對
SupplyShoppingCart
.
getInstance
().
removeFoodsBySupplier
(
supplierBean
.
getId
());
//供應商信息修改後,將購物車中的供應商信息修改
supplierInfoBean
.
setSupplierName
(
supplierName
);
SupplyShoppingCart
.
getInstance
().
updateSupplier
(
supplierInfoBean
);
// SupplyShoppingCart.getInstance().removeFoodsBySupplier(supplierBean.getId());
mRootView
.
saveSuccess
();
}
else
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
info
.
getErrMsg
()))
{
mRootView
.
showMessage
(
info
.
getErrMsg
());
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/OrderDetailsPresenter.java
View file @
63c11ab4
...
...
@@ -301,7 +301,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
@Override
public
void
onNext
(
BaseResult
baseResult
)
{
if
(
baseResult
.
isSuccess
())
{
List
<
PurchaseFoodBean
>
purchaseFoodBeans
=
GsonUtils
.
G
sonToList
(
baseResult
.
getData
(),
PurchaseFoodBean
.
class
);
List
<
PurchaseFoodBean
>
purchaseFoodBeans
=
GsonUtils
.
j
sonToList
(
baseResult
.
getData
(),
PurchaseFoodBean
.
class
);
for
(
PurchaseFoodBean
purchaseFoodBean
:
purchaseFoodBeans
)
{
for
(
PurchaseOrderDetailsBean
.
PurchaseOrderDetailsInfoVosBean
item
:
data
)
{
if
(
purchaseFoodBean
.
getId
()
==
item
.
getPurchaseFoodId
())
{
...
...
@@ -311,7 +311,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
}
}
SupplyShoppingCart
.
getInstance
().
clear
();
SupplyShoppingCart
.
getInstance
().
getCartFoods
().
addAll
(
purchaseFoodBeans
);
SupplyShoppingCart
.
getInstance
().
addAllFood
(
purchaseFoodBeans
);
mRootView
.
buyAgain
();
}
else
{
mRootView
.
showMessage
(
GET_INFO_ERROR
);
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/ShoppingCatPresenter.java
View file @
63c11ab4
...
...
@@ -14,6 +14,7 @@ import com.gingersoft.supply_chain.mvp.bean.ConfirmOrderBean;
import
com.gingersoft.supply_chain.mvp.bean.NewPurchaseOrderBean
;
import
com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean
;
import
com.gingersoft.supply_chain.mvp.bean.ShoppingCartBean
;
import
com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean
;
import
com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart
;
import
com.gingersoft.supply_chain.mvp.contract.ShoppingCatContract
;
import
com.jess.arms.di.scope.FragmentScope
;
...
...
@@ -99,12 +100,6 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
if
(
foods
!=
null
&&
foods
.
size
()
>
0
)
{
//將供應商信息從食材中取出
PurchaseFoodBean
food
=
foods
.
get
(
0
);
shoppingCartBean
.
setAddress
(
food
.
getAddress
());
shoppingCartBean
.
setMinimumAmount
(
food
.
getMinimumAmount
());
if
(
entry
.
getKey
()
!=
null
)
{
shoppingCartBean
.
setSupplierId
(
entry
.
getKey
());
}
shoppingCartBean
.
setSupplierName
(
food
.
getSupplierName
());
//統計當前供應商所選中食品的總金額
double
supplierTotalAmount
=
0
;
//統計當前供應商選中食材的種類
...
...
@@ -125,8 +120,28 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
if
(
MoneyUtil
.
compareTo
(
shoppingCartBean
.
getMinimumAmount
(),
supplierTotalAmount
)
==
1
)
{
createBtnCheckable
=
false
;
}
//運費
//以購物車中的供應商信息為准,如果購物車拿出來的供應商信息為空,就用食材本身的供應商信息
SupplierInfoBean
supplierInfoBean
=
null
;
if
(
food
.
getSupplierId
()
!=
null
)
{
supplierInfoBean
=
SupplyShoppingCart
.
getInstance
().
getSupplierById
(
food
.
getSupplierId
());
}
if
(
supplierInfoBean
!=
null
)
{
shoppingCartBean
.
setAddress
(
supplierInfoBean
.
getAddress
());
shoppingCartBean
.
setMinimumAmount
(
supplierInfoBean
.
getMinimumAmount
());
shoppingCartBean
.
setSupplierId
(
supplierInfoBean
.
getId
());
shoppingCartBean
.
setSupplierName
(
supplierInfoBean
.
getSupplierName
());
shoppingCartBean
.
setShipping
(
supplierInfoBean
.
getShipping
());
}
else
{
shoppingCartBean
.
setAddress
(
food
.
getAddress
());
shoppingCartBean
.
setMinimumAmount
(
food
.
getMinimumAmount
());
if
(
entry
.
getKey
()
!=
null
)
{
shoppingCartBean
.
setSupplierId
(
entry
.
getKey
());
}
shoppingCartBean
.
setSupplierName
(
food
.
getSupplierName
());
shoppingCartBean
.
setShipping
(
shipping
);
}
//運費
// shoppingCartBean.setShipping(shipping);
shoppingCartBean
.
setInitialShippingTime
(
TimeUtils
.
getNextDay
(
1
));
shoppingCartBean
.
setSelectFoodAmount
(
supplierTotalAmount
);
shoppingCartBean
.
setSelectSpeciesNum
(
supplierTotalSpecies
);
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/WarehouseDetailsPresenter.java
View file @
63c11ab4
...
...
@@ -125,7 +125,7 @@ public class WarehouseDetailsPresenter extends BasePresenter<WarehouseDetailsCon
@Override
public
void
onNext
(
BaseResult
baseResult
)
{
if
(
baseResult
!=
null
&&
baseResult
.
isSuccess
())
{
List
<
ConsumeWareHousingBean
>
consumeWareHousingBeans
=
GsonUtils
.
G
sonToList
(
baseResult
.
getData
(),
ConsumeWareHousingBean
.
class
);
List
<
ConsumeWareHousingBean
>
consumeWareHousingBeans
=
GsonUtils
.
j
sonToList
(
baseResult
.
getData
(),
ConsumeWareHousingBean
.
class
);
mRootView
.
loadAdapter
(
WarehouseDetailsBean
.
getWarehousingByConsumes
(
consumeWareHousingBeans
));
}
else
if
(
baseResult
!=
null
&&
TextUtil
.
isNotEmptyOrNullOrUndefined
(
baseResult
.
getErrMsg
()))
{
mRootView
.
showMessage
(
baseResult
.
getErrMsg
());
...
...
@@ -151,7 +151,7 @@ public class WarehouseDetailsPresenter extends BasePresenter<WarehouseDetailsCon
@Override
public
void
onNext
(
BaseResult
baseResult
)
{
if
(
baseResult
!=
null
&&
baseResult
.
isSuccess
())
{
List
<
ConsumeReasonBean
>
consumeReasonBeans
=
GsonUtils
.
G
sonToList
(
baseResult
.
getData
(),
ConsumeReasonBean
.
class
);
List
<
ConsumeReasonBean
>
consumeReasonBeans
=
GsonUtils
.
j
sonToList
(
baseResult
.
getData
(),
ConsumeReasonBean
.
class
);
mRootView
.
loadConsumeReason
(
consumeReasonBeans
);
}
else
if
(
baseResult
!=
null
&&
TextUtil
.
isNotEmptyOrNullOrUndefined
(
baseResult
.
getErrMsg
()))
{
mRootView
.
showMessage
(
baseResult
.
getErrMsg
());
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/fragment/food/FoodUnitPageFragment.java
View file @
63c11ab4
...
...
@@ -158,6 +158,7 @@ public class FoodUnitPageFragment extends BaseSupplyChainFragment<FoodUnitPagePr
if
(
position
==
basicUnitAdapter
.
getItemCount
()
-
1
)
{
//新增
EditTextPopup
popup
=
new
EditTextPopup
(
requireContext
(),
new
InputFilter
[]{
InputFilterUtils
.
getLengthFilter
(
mContext
,
5
),
InputFilterUtils
.
getEnAndChInputFilter
(
mContext
)});
popup
.
setTitleContent
(
"新增單位"
,
"單位名稱:"
,
"請輸入單位名稱"
);
popup
.
setListener
(
text
->
{
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
text
))
{
mPresenter
.
addBasicUnit
(
text
,
basicUnitAdapter
.
getData
());
...
...
component-supply-chain/src/main/res/drawable-xhdpi/ic_viewed.png
0 → 100644
View file @
63c11ab4
1.25 KB
component-supply-chain/src/main/res/layout/item_basic_unit.xml
View file @
63c11ab4
...
...
@@ -3,7 +3,6 @@
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:background=
"@color/white"
android:layout_height=
"wrap_content"
>
<androidx.cardview.widget.CardView
...
...
@@ -11,6 +10,7 @@
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/dp_3"
android:layout_marginRight=
"@dimen/dp_3"
android:background=
"@color/white"
app:cardCornerRadius=
"@dimen/dp_4"
app:cardUseCompatPadding=
"true"
app:elevation=
"@dimen/dp_4"
>
...
...
library-common/src/main/java/com/gingersoft/gsa/cloud/common/core/restaurant/RestaurantInfoManager.java
View file @
63c11ab4
...
...
@@ -31,10 +31,10 @@ public class RestaurantInfoManager {
if
(
restaurantInfo
==
null
)
{
restaurantInfo
=
new
RestaurantInfo
();
}
brandInfo
.
setBrandId
((
Integer
)
SPUtils
.
get
(
UserConstans
.
brandId
,
0
));
brandInfo
.
setBrandId
((
Integer
)
SPUtils
.
get
(
UserConstans
.
brandId
,
1
));
brandInfo
.
setBrandName
((
String
)
SPUtils
.
get
(
UserConstans
.
brandName
,
""
));
restaurantInfo
.
setGsPosShopId
((
String
)
SPUtils
.
get
(
UserConstans
.
gsPosShopId
,
"-1"
));
restaurantInfo
.
setRestaurantId
((
Integer
)
SPUtils
.
get
(
UserConstans
.
restaurantId
,
0
));
restaurantInfo
.
setRestaurantId
((
Integer
)
SPUtils
.
get
(
UserConstans
.
restaurantId
,
26
));
restaurantInfo
.
setRestaurantName
((
String
)
SPUtils
.
get
(
UserConstans
.
restaurantName
,
""
));
}
...
...
library-common/src/main/java/com/gingersoft/gsa/cloud/common/utils/gson/GsonUtils.java
View file @
63c11ab4
...
...
@@ -90,14 +90,14 @@ public class GsonUtils {
* @param <T>
* @return
*/
public
static
<
T
>
List
GsonToList
(
Object
object
,
Class
<
T
>
cls
)
{
List
<
T
>
mList
=
new
ArrayList
<>();
JsonArray
array
=
new
JsonParser
().
parse
(
GsonString
(
object
)).
getAsJsonArray
();
for
(
final
JsonElement
elem
:
array
)
{
mList
.
add
(
gson
.
fromJson
(
elem
,
cls
));
}
return
mList
;
}
//
public static <T> List GsonToList(Object object, Class<T> cls) {
//
List<T> mList = new ArrayList<>();
//
JsonArray array = new JsonParser().parse(GsonString(object)).getAsJsonArray();
//
for (final JsonElement elem : array) {
//
mList.add(gson.fromJson(elem, cls));
//
}
//
return mList;
//
}
// 有問題,轉換出來的類型不對
...
...
library-print/src/main/java/com/gingersoft/gsa/cloud/print/PrintExecutor.java
View file @
63c11ab4
...
...
@@ -6,6 +6,7 @@ import com.gingersoft.gsa.cloud.common.logan.LoganManager;
import
com.gingersoft.gsa.cloud.common.utils.log.LogUtil
;
import
com.gingersoft.gsa.cloud.print.impl.OnPrjPrintResultListener
;
import
com.xuexiang.rxutil2.rxjava.RxJavaUtils
;
import
com.xuexiang.rxutil2.rxjava.task.RxAsyncTask
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -57,10 +58,12 @@ public class PrintExecutor {
* 异步执行打印请求
*/
public
void
doPrinterRequestAsync
(
PrintDataMaker
maker
)
{
holder
.
setOnStateChangedListener
(
listener
);
if
(
printDataMakers
.
size
()
<=
0
)
{
LogUtil
.
i
(
"eee"
,
"prj熱敏打印執行第一個任務"
);
printDataMakers
.
add
(
maker
);
new
PrintTask
().
execute
(
maker
);
// new PrintTask().execute(maker);
executePrint
(
maker
);
}
else
{
//如果隊列裡有任務在執行,只添加進去,等待執行完成之後,再來執行這個
LogUtil
.
i
(
"eee"
,
"prj熱敏打印添加隊列,前面還有"
+
printDataMakers
.
size
()
+
"個任務"
);
...
...
@@ -69,6 +72,39 @@ public class PrintExecutor {
}
}
private
void
executePrint
(
PrintDataMaker
maker
)
{
RxJavaUtils
.
executeAsyncTask
(
new
RxAsyncTask
<
PrintDataMaker
,
Integer
>(
maker
)
{
@Override
public
Integer
doInIOThread
(
PrintDataMaker
o
)
{
LogUtil
.
i
(
"eee"
,
"executePrint----doInIOThread"
);
return
doRequest
(
o
);
}
@Override
public
void
doInUIThread
(
Integer
i
)
{
LogUtil
.
i
(
"eee"
,
"executePrint----doInUIThread"
+
i
);
if
(
resetPrintDis
!=
null
)
{
resetPrintDis
.
dispose
();
}
//移除掉當前任務
if
(
printDataMakers
.
size
()
>
0
)
{
printDataMakers
.
remove
(
0
);
}
//執行下一個任務
if
(
printDataMakers
.
size
()
>
0
)
{
// new PrintTask().execute(printDataMakers.get(0));
executePrint
(
printDataMakers
.
get
(
0
));
startReset
();
}
LogUtil
.
d
(
"eee"
,
"executePrint----doInUIThread熱敏打印完成後,任務數量"
+
printDataMakers
.
size
());
//返回結果
if
(
i
!=
null
)
{
onResult
(
i
);
}
}
});
}
private
void
startReset
()
{
if
(
resetPrintDis
!=
null
)
{
resetPrintDis
.
dispose
();
...
...
@@ -77,7 +113,8 @@ public class PrintExecutor {
//如果三十秒之後,任務還沒在打印完成方法中取消,可能打印程序卡住了,在這裡執行下一個任務
LogUtil
.
e
(
"eee"
,
"prj熱敏打印等待時間超過三十秒,自動重新打印"
);
if
(
printDataMakers
.
size
()
>
0
)
{
new
PrintTask
().
execute
(
printDataMakers
.
get
(
0
));
// new PrintTask().execute(printDataMakers.get(0));
executePrint
(
printDataMakers
.
get
(
0
));
}
});
}
...
...
@@ -112,25 +149,25 @@ public class PrintExecutor {
@Override
protected
void
onPreExecute
()
{
super
.
onPreExecute
();
LogUtil
.
i
(
"eee"
,
"prj熱敏任務onPreExecute"
);
LogUtil
.
i
(
"eee"
,
"prj
Service
熱敏任務onPreExecute"
);
holder
.
setOnStateChangedListener
(
this
);
}
@Override
protected
Integer
doInBackground
(
PrintDataMaker
...
makers
)
{
LogUtil
.
i
(
"eee"
,
"prj熱敏任務開始"
);
LogUtil
.
i
(
"eee"
,
"prj
Service
熱敏任務開始"
);
holder
.
closeSocket
();
if
(
makers
==
null
||
makers
.
length
<
1
)
{
return
PrintSocketHolder
.
ERROR_0
;
}
LogUtil
.
e
(
"eee"
,
"prj
熱敏任務開始
"
+
makers
[
0
].
getPrjIds
());
LogUtil
.
e
(
"eee"
,
"prj
Service熱敏任務開始,prjID為
"
+
makers
[
0
].
getPrjIds
());
return
doRequest
(
makers
[
0
]);
}
@Override
protected
void
onProgressUpdate
(
Integer
...
values
)
{
super
.
onProgressUpdate
(
values
);
LogUtil
.
i
(
"eee"
,
"prj
熱敏任務onProgressUpdate"
+
values
);
LogUtil
.
i
(
"eee"
,
"prj
Service熱敏任務onProgressUpdate"
+
values
.
toString
()
);
if
(
values
==
null
||
values
.
length
<
1
)
{
return
;
}
...
...
@@ -142,7 +179,7 @@ public class PrintExecutor {
@Override
protected
void
onPostExecute
(
Integer
integer
)
{
super
.
onPostExecute
(
integer
);
LogUtil
.
i
(
"eee"
,
"prj熱敏任務onPostExecute"
+
integer
);
LogUtil
.
i
(
"eee"
,
"prj
Service
熱敏任務onPostExecute"
+
integer
);
if
(
resetPrintDis
!=
null
)
{
resetPrintDis
.
dispose
();
}
...
...
@@ -155,30 +192,13 @@ public class PrintExecutor {
new
PrintTask
().
execute
(
printDataMakers
.
get
(
0
));
startReset
();
}
LogUtil
.
d
(
"eee"
,
"prj熱敏打印完成後,任務數量"
+
printDataMakers
.
size
());
LogUtil
.
d
(
"eee"
,
"prj
Service
熱敏打印完成後,任務數量"
+
printDataMakers
.
size
());
//返回結果
if
(
integer
!=
null
)
{
onResult
(
integer
);
}
}
/**
* 打印结果
*
* @param errorCode 错误代码
*/
private
void
onResult
(
int
errorCode
)
{
try
{
if
(
mListener
!=
null
)
{
mListener
.
onResult
(
errorCode
);
}
if
(
onPrjPrintResultListener
!=
null
)
{
onPrjPrintResultListener
.
onResult
(
errorCode
,
prjIds
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
@Override
public
void
onStateChanged
(
int
state
)
{
...
...
@@ -206,6 +226,24 @@ public class PrintExecutor {
}
/**
* 打印结果
*
* @param errorCode 错误代码
*/
private
void
onResult
(
int
errorCode
)
{
try
{
if
(
mListener
!=
null
)
{
mListener
.
onResult
(
errorCode
);
}
if
(
onPrjPrintResultListener
!=
null
)
{
onPrjPrintResultListener
.
onResult
(
errorCode
,
prjIds
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
/**
* 设置状态监听
*
* @param listener 监听
...
...
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