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
60d1a9cf
Commit
60d1a9cf
authored
Jan 30, 2021
by
Wyh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、打印的recyclerview切換成普通視圖
2、供應鏈驗收代碼
parent
d3938c2e
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
738 additions
and
114 deletions
+738
-114
component-main/src/main/res/layout/main_home_management_funcation_item.xml
+1
-1
component-print/src/main/java/com/joe/print/mvp/print/PrintServe.java
+2
-1
component-print/src/main/java/com/joe/print/mvp/print/PrinterRoot.java
+44
-16
component-print/src/main/java/com/joe/print/mvp/ui/adapter/FoodAdapter.java
+0
-4
component-print/src/main/java/com/joe/print/mvp/ui/view/BillItemView.java
+40
-0
component-print/src/main/java/com/joe/print/mvp/ui/view/BillTypeView.java
+40
-0
component-print/src/main/java/com/joe/print/mvp/ui/view/BillView.java
+46
-0
component-print/src/main/java/com/joe/print/mvp/ui/view/PrintFoodView.java
+115
-0
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/content/SupplyShoppingCart.java
+115
-1
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/CategoryPresenter.java
+9
-5
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/FoodIngredientsPresenter.java
+12
-0
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/NewFoodIngredientsPresenter.java
+12
-7
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/NewSupplierPresenter.java
+26
-16
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/OrderDetailsPresenter.java
+31
-19
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/SupplierListPresenter.java
+8
-2
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/activity/SupplyChainMainActivity.java
+7
-0
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/adapter/FoodListAdapter.java
+2
-4
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/adapter/ImageAdapter.java
+5
-1
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/adapter/OrderDetailsFoodAdapter.java
+25
-5
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/adapter/WareHousingDetailsAdapter.java
+5
-2
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/fragment/category/CategoryFragment.java
+1
-1
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/fragment/food/FoodIngredientsFragment.java
+2
-0
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/fragment/order/OrderDetailsFragment.java
+24
-13
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/fragment/warehouse/WarehousingInventoryFragment.java
+7
-1
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/widget/ChooseUnitPopup.java
+111
-0
component-supply-chain/src/main/res/drawable-xxhdpi/ic_red_delete_pic.png
+0
-0
component-supply-chain/src/main/res/layout/item_food_ingredient.xml
+10
-8
component-supply-chain/src/main/res/layout/item_image.xml
+4
-3
component-supply-chain/src/main/res/layout/item_order_details_food.xml
+3
-3
component-supply-chain/src/main/res/layout/item_shopping_cart_food.xml
+1
-1
component-supply-chain/src/main/res/layout/popup_choose_unit.xml
+25
-0
library-ui/src/main/java/com/gingersoft/gsa/cloud/ui/adapter/multi/InputProvider.java
+1
-0
library-ui/src/main/res/layout/base_print_bill_adapter_item_bill.xml
+4
-0
No files found.
component-main/src/main/res/layout/main_home_management_funcation_item.xml
View file @
60d1a9cf
<?xml version="1.0" encoding="utf-8"?>
<com.qmuiteam.qmui.alpha.QMUIAlphaLinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"
wrap_cont
ent"
android:layout_width=
"
match_par
ent"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"@dimen/dp_20"
android:gravity=
"center"
...
...
component-print/src/main/java/com/joe/print/mvp/print/PrintServe.java
View file @
60d1a9cf
...
...
@@ -151,8 +151,9 @@ public class PrintServe extends PrinterRoot<PrintServingPaperContent> {
//訂單信息
layout
.
addView
(
getDiningTableOrderInfo
(
mContext
,
"餐檯:"
+
mPrintServingPaperContent
.
getTableName
(),
"人數:"
+
mPrintServingPaperContent
.
getPerson
(),
orderNo
,
"日期:"
+
TimeUtils
.
getCurrentTimeInString
(
TimeUtils
.
DEFAULT_DATE_FORMAT
)));
layout
.
addView
(
getLine
(
mContext
));
//食品
layout
.
addView
(
getDiningFoodList
(
mContext
,
foodItemList
,
printerDeviceBean
,
0
,
false
));
//打印紙
layout
.
addView
(
getLine
(
mContext
));
layout
.
addView
(
getTextView
(
mContext
,
"Thank you!"
,
Gravity
.
CENTER_HORIZONTAL
,
getDimensionPixelSize
(
mContext
,
R
.
dimen
.
dp_8
)));
layout
.
addView
(
getTextView
(
mContext
,
TimeUtils
.
getCurrentTimeInString
(
TimeUtils
.
DEFAULT_DATE_FORMAT
),
Gravity
.
CENTER_HORIZONTAL
,
getDimensionPixelSize
(
mContext
,
R
.
dimen
.
dp_8
)));
...
...
component-print/src/main/java/com/joe/print/mvp/print/PrinterRoot.java
View file @
60d1a9cf
...
...
@@ -74,6 +74,10 @@ import com.joe.print.mvp.ui.adapter.BillAdapter;
import
com.joe.print.mvp.ui.adapter.BillItemAdapter
;
import
com.joe.print.mvp.ui.adapter.BillTypeAdapter
;
import
com.joe.print.mvp.ui.adapter.FoodAdapter
;
import
com.joe.print.mvp.ui.view.BillItemView
;
import
com.joe.print.mvp.ui.view.BillTypeView
;
import
com.joe.print.mvp.ui.view.BillView
;
import
com.joe.print.mvp.ui.view.PrintFoodView
;
import
com.sunmi.peripheral.printer.InnerResultCallbcak
;
import
java.io.IOException
;
...
...
@@ -717,7 +721,8 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket
}
protected
View
getTakeawayBillInfoView
(
Context
mContext
,
List
<
PrintBillItem
>
data
)
{
return
getVerticalRecyclerView
(
mContext
,
new
BillItemAdapter
(
data
));
// return getVerticalRecyclerView(mContext, new BillItemAdapter(data));
return
new
BillItemView
(
mContext
,
data
);
}
protected
void
addTakeawayPayViews
(
Context
mContext
,
ViewGroup
parent
,
List
<
OrderDetails
.
DataBean
.
PayMultiple
>
payMultiples
,
double
payAmount
)
{
...
...
@@ -810,40 +815,63 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket
}
/**
* 獲取食品列表
* 結賬單、印單。外送都用這個
* @param mContext
* @param foodList
* @param deviceBean
* @param foodList
食品信息
* @param deviceBean
打印設備
* @param type 0 食品清單,1 結賬單
* @param showPrice 是否顯示價格
* @return
*/
public
View
getDiningFoodList
(
Context
mContext
,
List
<
PrintFoodItem
>
foodList
,
PrinterDeviceBean
deviceBean
,
int
type
,
boolean
showPrice
)
{
// List<OrderDetail> newsFoodList = new ArrayList<>();
// for (OrderDetail orderDetail : foodList) {
// //如果食品設置了0元不打印並且食品等於0元,或者設置了不打印到單,就不打印
// if (!(orderDetail.getPrintToBill() == 0 && orderDetail.getPrice() == 0)
// || OrderDetail.isPrint((int) orderDetail.getPrintTo(), type)) {
// newsFoodList.add(orderDetail);
// }
// }
return
getVerticalRecyclerView
(
mContext
,
new
FoodAdapter
(
foodList
,
deviceBean
,
showPrice
));
//// List<OrderDetail> newsFoodList = new ArrayList<>();
//// for (OrderDetail orderDetail : foodList) {
//// //如果食品設置了0元不打印並且食品等於0元,或者設置了不打印到單,就不打印
//// if (!(orderDetail.getPrintToBill() == 0 && orderDetail.getPrice() == 0)
//// || OrderDetail.isPrint((int) orderDetail.getPrintTo(), type)) {
//// newsFoodList.add(orderDetail);
//// }
//// }
// return getVerticalRecyclerView(mContext, new FoodAdapter(foodList, deviceBean, showPrice));
return
new
PrintFoodView
(
mContext
,
foodList
,
deviceBean
,
showPrice
);
}
/**
* 結賬單和印單
* @param mContext
* @param billingBeans
* @return
*/
public
View
getDiningBillInfo
(
Context
mContext
,
List
<
BillingBean
>
billingBeans
)
{
return
getVerticalRecyclerView
(
mContext
,
new
BillAdapter
(
billingBeans
));
//
return getVerticalRecyclerView(mContext, new BillAdapter(billingBeans));
return
new
BillView
(
mContext
,
billingBeans
);
}
/**
* 結賬單,支付方式
* @param mContext
* @param payBillMoneys 支付方式數據
* @return
*/
public
View
getDiningBillPayMethod
(
Context
mContext
,
List
<
PrintBillItem
>
payBillMoneys
)
{
return
getVerticalRecyclerView
(
mContext
,
new
BillTypeAdapter
(
payBillMoneys
));
// return getVerticalRecyclerView(mContext, new BillTypeAdapter(payBillMoneys));
return
new
BillTypeView
(
mContext
,
payBillMoneys
);
}
/**
* 不用recyclerview,recyclerview可能會導致食品顯示不出來
*
* @param mContext
* @param adapter
* @return
*/
@Deprecated
public
View
getVerticalRecyclerView
(
Context
mContext
,
RecyclerView
.
Adapter
adapter
)
{
RecyclerView
recyclerView
=
new
RecyclerView
(
mContext
);
recyclerView
.
setLayoutManager
(
new
LinearLayoutManager
(
mContext
));
recyclerView
.
setAdapter
(
adapter
);
return
recyclerView
;
}
public
View
getAmountText
(
Context
mContext
,
String
text
)
{
...
...
component-print/src/main/java/com/joe/print/mvp/ui/adapter/FoodAdapter.java
View file @
60d1a9cf
...
...
@@ -121,10 +121,6 @@ public class FoodAdapter extends BaseQuickAdapter<PrintFoodItem, BaseViewHolder>
tvNum
.
setTypeface
(
null
,
Typeface
.
NORMAL
);
tvPrice
.
setTypeface
(
null
,
Typeface
.
NORMAL
);
}
// tvFoodName.setTypeface(null, Typeface.BOLD_ITALIC);
// tvFoodName.setTypeface(null, Typeface.BOLD);
// tvFoodName.setTypeface(null, Typeface.ITALIC);
// tvFoodName.setTypeface(null, Typeface.NORMAL);
tvNum
.
setText
(
"X"
+
item
.
getNum
());
tvPrice
.
setText
(
"$"
+
item
.
getPrice
());
}
...
...
component-print/src/main/java/com/joe/print/mvp/ui/view/BillItemView.java
0 → 100644
View file @
60d1a9cf
package
com
.
joe
.
print
.
mvp
.
ui
.
view
;
import
android.content.Context
;
import
android.view.View
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
com.gingersoft.gsa.cloud.print.bean.base.PrintBillItem
;
import
com.gingersoft.gsa.cloud.print.bean.base.PrintFoodItem
;
import
com.joe.print.R
;
import
java.util.List
;
/**
* @author 宇航.
* User: admin
* Date: 2021/1/30
* Time: 11:00
* Use:
*/
public
class
BillItemView
extends
LinearLayout
{
private
List
<
PrintBillItem
>
data
;
public
BillItemView
(
Context
context
,
List
<
PrintBillItem
>
data
)
{
super
(
context
);
this
.
data
=
data
;
}
private
void
init
()
{
for
(
PrintBillItem
item
:
data
)
{
View
view
=
View
.
inflate
(
getContext
(),
R
.
layout
.
print_bill_adapter_item_bill
,
null
);
TextView
billNam
=
view
.
findViewById
(
R
.
id
.
print_bill_name
);
TextView
billValue
=
view
.
findViewById
(
R
.
id
.
print_bill_value
);
billNam
.
setText
(
item
.
getBillName
());
billValue
.
setText
(
item
.
getBillAmount
());
addView
(
view
);
}
}
}
component-print/src/main/java/com/joe/print/mvp/ui/view/BillTypeView.java
0 → 100644
View file @
60d1a9cf
package
com
.
joe
.
print
.
mvp
.
ui
.
view
;
import
android.content.Context
;
import
android.view.View
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
com.gingersoft.gsa.cloud.print.bean.base.PrintBillItem
;
import
com.joe.print.R
;
import
java.util.List
;
/**
* @author 宇航.
* User: admin
* Date: 2021/1/30
* Time: 11:16
* Use:結賬單,支付方式的view
*/
public
class
BillTypeView
extends
LinearLayout
{
private
List
<
PrintBillItem
>
data
;
public
BillTypeView
(
Context
context
,
List
<
PrintBillItem
>
data
)
{
super
(
context
);
this
.
data
=
data
;
init
();
}
private
void
init
()
{
for
(
PrintBillItem
item
:
data
)
{
View
view
=
View
.
inflate
(
getContext
(),
R
.
layout
.
base_print_item_bill_type
,
null
);
TextView
tvBillTotalText
=
view
.
findViewById
(
R
.
id
.
tv_total_amount_text
);
TextView
tvBillTotal
=
view
.
findViewById
(
R
.
id
.
tv_total_amount
);
tvBillTotalText
.
setText
(
item
.
getBillName
());
tvBillTotal
.
setText
(
"$"
+
item
.
getBillAmount
());
addView
(
view
);
}
}
}
component-print/src/main/java/com/joe/print/mvp/ui/view/BillView.java
0 → 100644
View file @
60d1a9cf
package
com
.
joe
.
print
.
mvp
.
ui
.
view
;
import
android.content.Context
;
import
android.view.View
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
com.gingersoft.gsa.cloud.print.bean.base.PrintBillItem
;
import
com.joe.print.R
;
import
com.joe.print.mvp.model.bean.BillingBean
;
import
java.util.List
;
/**
* @author 宇航.
* User: admin
* Date: 2021/1/30
* Time: 11:12
* Use:結賬單和印單的賬單信息
*/
public
class
BillView
extends
LinearLayout
{
private
List
<
BillingBean
>
data
;
public
BillView
(
Context
context
,
List
<
BillingBean
>
data
)
{
super
(
context
);
this
.
data
=
data
;
init
();
}
private
void
init
()
{
for
(
BillingBean
item
:
data
)
{
View
view
=
View
.
inflate
(
getContext
(),
R
.
layout
.
base_print_bill_adapter_item_bill
,
null
);
TextView
tvBillTotalText
=
view
.
findViewById
(
R
.
id
.
tv_bill_total_text
);
TextView
tvBillTotal
=
view
.
findViewById
(
R
.
id
.
tv_bill_total
);
tvBillTotalText
.
setText
(
item
.
getOptionName
());
if
(
item
.
getTotalAmount
()
<
0
)
{
tvBillTotal
.
setText
(
"-$"
+
Math
.
abs
(
item
.
getTotalAmount
()));
}
else
if
(
item
.
getTotalAmount
()
>
0
)
{
tvBillTotal
.
setText
(
"$"
+
item
.
getTotalAmount
());
}
addView
(
view
);
}
}
}
\ No newline at end of file
component-print/src/main/java/com/joe/print/mvp/ui/view/PrintFoodView.java
0 → 100644
View file @
60d1a9cf
package
com
.
joe
.
print
.
mvp
.
ui
.
view
;
import
android.content.Context
;
import
android.graphics.Typeface
;
import
android.view.View
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean
;
import
com.gingersoft.gsa.cloud.print.bean.base.PrintFoodItem
;
import
com.joe.print.R
;
import
java.util.List
;
/**
* @author 宇航.
* User: admin
* Date: 2021/1/30
* Time: 10:40
* Use:
*/
public
class
PrintFoodView
extends
LinearLayout
{
private
int
foodFontSize
=
24
;
private
int
modifierFontSize
=
24
;
private
int
foodIsBold
=
2
;
private
int
modifierIsBold
=
2
;
private
int
foodIsItalic
=
2
;
private
int
modifierIsItalic
=
2
;
private
int
numberIsFlip
=
2
;
//熱敏打印沒有顏色,翻轉用不了
private
boolean
showPrice
=
true
;
private
List
<
PrintFoodItem
>
data
;
public
PrintFoodView
(
Context
context
,
List
<
PrintFoodItem
>
data
,
PrinterDeviceBean
deviceBean
,
boolean
showPrice
)
{
super
(
context
);
this
.
showPrice
=
showPrice
;
this
.
data
=
data
;
init
(
deviceBean
);
}
public
void
init
(
PrinterDeviceBean
deviceBean
)
{
try
{
this
.
foodFontSize
=
Integer
.
parseInt
(
deviceBean
.
getFoodFont
())
*
2
;
//36
this
.
modifierFontSize
=
Integer
.
parseInt
(
deviceBean
.
getModifierFont
())
*
2
;
}
catch
(
NumberFormatException
e
)
{
e
.
printStackTrace
();
}
this
.
foodIsBold
=
deviceBean
.
getFoodIsBold
();
this
.
modifierIsBold
=
deviceBean
.
getModifierIsBold
();
this
.
foodIsItalic
=
deviceBean
.
getFoodIsItalic
();
this
.
modifierIsItalic
=
deviceBean
.
getModifierIsItalic
();
this
.
numberIsFlip
=
deviceBean
.
getNumberIsFlip
();
initView
();
}
private
void
initView
()
{
for
(
PrintFoodItem
item
:
data
)
{
View
view
=
View
.
inflate
(
getContext
(),
R
.
layout
.
print_item_food
,
null
);
TextView
tvFoodName
=
view
.
findViewById
(
R
.
id
.
tv_food_name
);
TextView
tvNum
=
view
.
findViewById
(
R
.
id
.
tv_food_quantity
);
TextView
tvPrice
=
view
.
findViewById
(
R
.
id
.
tv_food_price
);
if
(
showPrice
)
{
tvPrice
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
tvPrice
.
setVisibility
(
View
.
GONE
);
}
boolean
isBold
,
isItalic
;
if
(
item
.
getItemType
()
==
2
)
{
//細項,縮進
tvFoodName
.
setText
(
"\u3000"
+
item
.
getName
());
tvFoodName
.
setTextSize
(
modifierFontSize
);
tvNum
.
setTextSize
(
modifierFontSize
);
tvPrice
.
setTextSize
(
modifierFontSize
);
isBold
=
modifierIsBold
==
1
;
isItalic
=
modifierIsItalic
==
1
;
}
else
if
(
item
.
getItemType
()
==
3
)
{
//細項,縮進
tvFoodName
.
setText
(
"\u3000\u3000"
+
item
.
getName
());
tvFoodName
.
setTextSize
(
modifierFontSize
);
tvNum
.
setTextSize
(
modifierFontSize
);
tvPrice
.
setTextSize
(
modifierFontSize
);
isBold
=
modifierIsBold
==
1
;
isItalic
=
modifierIsItalic
==
1
;
}
else
{
tvFoodName
.
setText
(
item
.
getName
());
tvFoodName
.
setTextSize
(
foodFontSize
);
tvNum
.
setTextSize
(
foodFontSize
);
tvPrice
.
setTextSize
(
foodFontSize
);
isBold
=
foodIsBold
==
1
;
isItalic
=
foodIsItalic
==
1
;
}
if
(
isBold
&&
isItalic
)
{
tvFoodName
.
setTypeface
(
null
,
Typeface
.
BOLD_ITALIC
);
tvNum
.
setTypeface
(
null
,
Typeface
.
BOLD_ITALIC
);
tvPrice
.
setTypeface
(
null
,
Typeface
.
BOLD_ITALIC
);
}
else
if
(
isBold
)
{
tvFoodName
.
setTypeface
(
null
,
Typeface
.
BOLD
);
tvNum
.
setTypeface
(
null
,
Typeface
.
BOLD
);
tvPrice
.
setTypeface
(
null
,
Typeface
.
BOLD
);
}
else
if
(
isItalic
)
{
tvFoodName
.
setTypeface
(
null
,
Typeface
.
ITALIC
);
tvNum
.
setTypeface
(
null
,
Typeface
.
ITALIC
);
tvPrice
.
setTypeface
(
null
,
Typeface
.
ITALIC
);
}
else
{
tvFoodName
.
setTypeface
(
null
,
Typeface
.
NORMAL
);
tvNum
.
setTypeface
(
null
,
Typeface
.
NORMAL
);
tvPrice
.
setTypeface
(
null
,
Typeface
.
NORMAL
);
}
tvNum
.
setText
(
"X"
+
item
.
getNum
());
tvPrice
.
setText
(
"$"
+
item
.
getPrice
());
addView
(
view
);
}
}
}
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/content/SupplyShoppingCart.java
View file @
60d1a9cf
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.xuexiang.rxutil2.rxjava.RxJavaUtils
;
import
com.xuexiang.rxutil2.rxjava.task.RxIOTask
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Observable
;
/**
* @author 宇航.
...
...
@@ -36,6 +39,117 @@ public class SupplyShoppingCart {
return
cartFoods
;
}
public
void
clear
()
{
if
(
cartFoods
==
null
)
{
return
;
}
cartFoods
.
clear
();
cartFoods
=
null
;
}
public
void
removeFoodsByFoodId
(
int
foodId
)
{
RxJavaUtils
.
doInIOThread
(
new
RxIOTask
<
Object
>(
0
)
{
@Override
public
Void
doInIOThread
(
Object
o
)
{
//刪除供應商成功後,需要從購物車數據中將這個供應商的食材都刪除掉
List
<
PurchaseFoodBean
>
cartFoods
=
SupplyShoppingCart
.
getInstance
().
getCartFoods
();
Iterator
<
PurchaseFoodBean
>
iterator
=
cartFoods
.
iterator
();
while
(
iterator
.
hasNext
())
{
PurchaseFoodBean
next
=
iterator
.
next
();
if
(
next
.
getId
()
!=
null
&&
next
.
getId
()
==
foodId
)
{
iterator
.
remove
();
break
;
}
}
return
null
;
}
});
}
public
void
removeFoodsBySupplier
(
int
supplierId
)
{
RxJavaUtils
.
doInIOThread
(
new
RxIOTask
<
Object
>(
0
)
{
@Override
public
Void
doInIOThread
(
Object
o
)
{
//刪除供應商成功後,需要從購物車數據中將這個供應商的食材都刪除掉
List
<
PurchaseFoodBean
>
cartFoods
=
SupplyShoppingCart
.
getInstance
().
getCartFoods
();
Iterator
<
PurchaseFoodBean
>
iterator
=
cartFoods
.
iterator
();
while
(
iterator
.
hasNext
())
{
PurchaseFoodBean
next
=
iterator
.
next
();
if
(
next
.
getSupplierId
()
!=
null
&&
next
.
getSupplierId
()
==
supplierId
)
{
iterator
.
remove
();
}
}
return
null
;
}
});
}
public
void
removeFoodsByCategoryId
(
int
categoryId
)
{
RxJavaUtils
.
doInIOThread
(
new
RxIOTask
<
Object
>(
0
)
{
@Override
public
Void
doInIOThread
(
Object
o
)
{
//刪除供應商成功後,需要從購物車數據中將這個供應商的食材都刪除掉
List
<
PurchaseFoodBean
>
cartFoods
=
SupplyShoppingCart
.
getInstance
().
getCartFoods
();
Iterator
<
PurchaseFoodBean
>
iterator
=
cartFoods
.
iterator
();
while
(
iterator
.
hasNext
())
{
PurchaseFoodBean
next
=
iterator
.
next
();
if
(
next
.
getFoodCategoryId
()
!=
null
&&
next
.
getFoodCategoryId
()
==
categoryId
)
{
iterator
.
remove
();
}
}
return
null
;
}
});
}
public
void
removeFoodsByCategoryTress
(
OrderCategoryBean
.
FoodCategoryTrees
foodCategoryTrees
)
{
RxJavaUtils
.
doInIOThread
(
new
RxIOTask
<
Object
>(
0
)
{
@Override
public
Void
doInIOThread
(
Object
o
)
{
//刪除分類成功後,需要從購物車數據中將這個分類的食材都刪除掉
List
<
PurchaseFoodBean
>
cartFoods
=
SupplyShoppingCart
.
getInstance
().
getCartFoods
();
Iterator
<
PurchaseFoodBean
>
iterator
=
cartFoods
.
iterator
();
while
(
iterator
.
hasNext
())
{
PurchaseFoodBean
next
=
iterator
.
next
();
if
(
next
.
getFoodCategoryId
()
!=
null
&&
next
.
getFoodCategoryId
()
==
foodCategoryTrees
.
getId
())
{
iterator
.
remove
();
}
}
//分類中的刪除完了,需要刪除分類下子分類的食材
List
<
OrderCategoryBean
.
FoodCategoryTrees
>
childCategory
=
foodCategoryTrees
.
getFoodCategoryTrees
();
if
(
childCategory
!=
null
)
{
//遍歷二級分類
for
(
OrderCategoryBean
.
FoodCategoryTrees
categoryTrees
:
childCategory
)
{
for
(
PurchaseFoodBean
cartFood
:
cartFoods
)
{
if
(
cartFood
.
getFoodCategoryId
()
==
categoryTrees
.
getId
())
{
cartFoods
.
remove
(
cartFood
);
break
;
}
}
//對三級分類進行遍歷
List
<
OrderCategoryBean
.
FoodCategoryTrees
>
thirdCategory
=
categoryTrees
.
getFoodCategoryTrees
();
removeFoodsByCategoryTress
(
thirdCategory
);
}
}
return
null
;
}
});
}
public
void
removeFoodsByCategoryTress
(
List
<
OrderCategoryBean
.
FoodCategoryTrees
>
thirdCategory
)
{
if
(
thirdCategory
!=
null
)
{
for
(
OrderCategoryBean
.
FoodCategoryTrees
trees
:
thirdCategory
)
{
for
(
PurchaseFoodBean
cartFood
:
cartFoods
)
{
if
(
cartFood
.
getFoodCategoryId
()
==
trees
.
getId
())
{
cartFoods
.
remove
(
cartFood
);
}
}
}
}
}
public
void
setCartFoods
(
List
<
PurchaseFoodBean
>
cartFoods
)
{
SupplyShoppingCart
.
cartFoods
=
cartFoods
;
}
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/CategoryPresenter.java
View file @
60d1a9cf
...
...
@@ -6,10 +6,12 @@ import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import
com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager
;
import
com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils
;
import
com.gingersoft.gsa.cloud.common.utils.other.TextUtil
;
import
com.gingersoft.gsa.cloud.order.cart.ShoppingCart
;
import
com.gingersoft.supply_chain.mvp.bean.CategoryFoodTreeBean
;
import
com.gingersoft.supply_chain.mvp.bean.FoodCategoryResultBean
;
import
com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean
;
import
com.gingersoft.supply_chain.mvp.content.Constant
;
import
com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart
;
import
com.gingersoft.supply_chain.mvp.contract.CategoryContract
;
import
com.jess.arms.di.scope.FragmentScope
;
import
com.jess.arms.http.imageloader.ImageLoader
;
...
...
@@ -171,13 +173,13 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat
/**
* 刪除分類
*
* @param
id 分類id
* @param hierarchy 第幾級分類,用於刪除後刷新
* @param position 刪除的分類下標
* @param
foodCategoryTrees 分類信息
* @param hierarchy
第幾級分類,用於刪除後刷新
* @param position
刪除的分類下標
*/
public
void
deleteFoodCategory
(
int
id
,
int
hierarchy
,
int
position
)
{
public
void
deleteFoodCategory
(
OrderCategoryBean
.
FoodCategoryTrees
foodCategoryTrees
,
int
hierarchy
,
int
position
)
{
RequestBody
requestBody
=
new
FormBody
.
Builder
()
.
add
(
"id"
,
id
+
""
)
.
add
(
"id"
,
foodCategoryTrees
.
getId
()
+
""
)
.
add
(
"brandId"
,
RestaurantInfoManager
.
newInstance
().
getBrandId
()
+
""
)
.
add
(
"restaurantId"
,
RestaurantInfoManager
.
newInstance
().
getRestaurantId
()
+
""
)
.
build
();
...
...
@@ -192,6 +194,8 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat
@Override
public
void
onNext
(
@NonNull
BaseResult
info
)
{
if
(
info
.
isSuccess
())
{
//需要刪除購物車中被刪除的分類下的食材
SupplyShoppingCart
.
getInstance
().
removeFoodsByCategoryTress
(
foodCategoryTrees
);
mRootView
.
updateCategory
(
Constant
.
DELETE
,
hierarchy
,
""
,
position
);
}
else
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
info
.
getErrMsg
()))
{
mRootView
.
showMessage
(
info
.
getErrMsg
());
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/FoodIngredientsPresenter.java
View file @
60d1a9cf
...
...
@@ -290,6 +290,16 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr
return
supplierId
;
}
/**
* 清除指定供應商的緩存
* @return
*/
public
void
removeSupplierCacheById
(
int
supplierId
)
{
if
(
supplierFoodsMap
!=
null
)
{
List
<
PurchaseFoodBean
>
purchaseFoodBeans
=
supplierFoodsMap
.
get
(
supplierId
);
supplierFoodsMap
.
put
(
supplierId
,
null
);
}
}
/**
* 獲取選中的食品,存入購物車
...
...
@@ -336,6 +346,8 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr
}
//移除在分類中的緩存
removeCacheByCategoryId
(
categoryId
);
//移除在購物車中的緩存
SupplyShoppingCart
.
getInstance
().
removeFoodsByFoodId
(
foodId
);
mRootView
.
onDeleteFoodSuccess
(
position
);
}
else
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
baseResult
.
getErrMsg
()))
{
mRootView
.
showMessage
(
baseResult
.
getErrMsg
());
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/NewFoodIngredientsPresenter.java
View file @
60d1a9cf
...
...
@@ -204,7 +204,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
infoMultiBeans
.
add
(
new
MultiInputBean
(
InfoMultiBean
.
ITEM_TYPE_INPUT
,
"食材名稱"
,
true
,
"請輸入名稱"
));
infoMultiBeans
.
add
(
new
MultiSelectBean
(
InfoMultiBean
.
EDIT_FOOD_ITEM_SELECT
,
"食材類別"
,
true
,
"請選擇食材類別"
,
SELECT_FOOD_CATEGORY_REQUEST_CODE
,
CategorySelectFragment
.
class
));
infoMultiBeans
.
add
(
new
MultiSelectBean
(
InfoMultiBean
.
EDIT_FOOD_ITEM_SELECT
,
"基本單位"
,
true
,
"請選擇食材單位"
,
SELECT_PACKAGE_SPECIFICATION_REQUEST_CODE
,
FoodUnitPageFragment
.
class
));
infoMultiBeans
.
add
(
new
MultiInputBean
(
InfoMultiBean
.
ITEM_TYPE_INPUT
,
"包裝說明"
,
false
,
"請輸入包裝說明"
,
new
InputFilter
[]{
new
InputFilter
.
LengthFilter
(
4
)}));
infoMultiBeans
.
add
(
new
MultiInputBean
(
InfoMultiBean
.
ITEM_TYPE_INPUT
,
"包裝說明"
,
false
,
"請輸入包裝說明"
,
new
InputFilter
[]{
new
InputFilter
.
LengthFilter
(
10
)}));
infoMultiBeans
.
add
(
new
MultiInputBean
(
InfoMultiBean
.
ITEM_TYPE_INPUT
,
"食材編號"
,
false
,
"請輸入食材編號"
));
infoMultiBeans
.
add
(
new
MultiInputBean
(
InfoMultiBean
.
ITEM_TYPE_INPUT
,
"單價($)"
,
false
,
"請輸入單價,保留2位小數"
,
new
InputFilter
[]{
InputFilterUtils
.
getLengthFilter
(
context
,
9
),
new
DecimalDigitsInputFilter
(
context
,
2
)},
InputType
.
TYPE_CLASS_NUMBER
|
InputType
.
TYPE_NUMBER_FLAG_DECIMAL
));
infoMultiBeans
.
add
(
new
InfoMultiBean
(
InfoMultiBean
.
ITEM_TYPE_LINE
));
...
...
@@ -281,7 +281,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
/**
* 設置供應商信息
* 設置供應商信息
R
*
* @param supplierInfoBean
* @param infoMultiBeans
...
...
@@ -447,7 +447,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
//食材所屬供應商
purchaseFoodBean
.
setSupplierName
(
infoMultiBeans
.
get
(
supplierIndex
).
getShowValue
());
//食材名稱
purchaseFoodBean
.
setName
(
infoMultiBeans
.
get
(
foodNameIndex
).
getShowValue
());
purchaseFoodBean
.
setName
(
infoMultiBeans
.
get
(
foodNameIndex
).
getShowValue
()
.
trim
()
);
//食材類別名稱
purchaseFoodBean
.
setFoodCategoryName
(
getCategoryName
());
//食材基本單位
...
...
@@ -455,7 +455,12 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
//包裝描述
purchaseFoodBean
.
setPackingDescription
(
infoMultiBeans
.
get
(
packingDescriptionIndex
).
getShowValue
());
//食材編號
purchaseFoodBean
.
setFoodNo
(
infoMultiBeans
.
get
(
foodNoIndex
).
getShowValue
());
String
foodNo
=
infoMultiBeans
.
get
(
foodNoIndex
).
getShowValue
();
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
foodNo
))
{
purchaseFoodBean
.
setFoodNo
(
infoMultiBeans
.
get
(
foodNoIndex
).
getShowValue
());
}
else
{
purchaseFoodBean
.
setFoodNo
(
null
);
}
//單價
String
unitPriceStr
=
infoMultiBeans
.
get
(
foodIngredientPriceIndex
).
getShowValue
();
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
unitPriceStr
))
{
...
...
@@ -499,13 +504,13 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
if
(
inventoryAlarm
.
getReviews
()
!=
purchaseFoodBean
.
getInventoryAlarm
().
getReviews
())
{
isUpdateAlarm
=
true
;
}
if
(!
isUpdateAlarm
&&
mixInventory
.
equals
(
purchaseFoodBean
.
getInventoryAlarm
().
getMinimumInventory
()
+
""
))
{
if
(!
isUpdateAlarm
&&
!
mixInventory
.
equals
(
purchaseFoodBean
.
getInventoryAlarm
().
getMinimumInventory
()
+
""
))
{
isUpdateAlarm
=
true
;
}
if
(!
isUpdateAlarm
&&
shelfLife
.
equals
(
purchaseFoodBean
.
getInventoryAlarm
().
getShelfLife
()
+
""
))
{
if
(!
isUpdateAlarm
&&
!
shelfLife
.
equals
(
purchaseFoodBean
.
getInventoryAlarm
().
getShelfLife
()
+
""
))
{
isUpdateAlarm
=
true
;
}
if
(!
isUpdateAlarm
&&
shelfLifeWarning
.
equals
(
purchaseFoodBean
.
getInventoryAlarm
().
getWarningDays
()
+
""
))
{
if
(!
isUpdateAlarm
&&
!
shelfLifeWarning
.
equals
(
purchaseFoodBean
.
getInventoryAlarm
().
getWarningDays
()
+
""
))
{
isUpdateAlarm
=
true
;
}
if
(
isUpdateAlarm
)
{
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/NewSupplierPresenter.java
View file @
60d1a9cf
...
...
@@ -22,8 +22,10 @@ import com.gingersoft.gsa.cloud.ui.adapter.bean.MultiSelectBean;
import
com.gingersoft.gsa.cloud.ui.adapter.multi.InfoMultiAdapter
;
import
com.gingersoft.gsa.cloud.ui.adapter.multi.RemarkProvider
;
import
com.gingersoft.supply_chain.R
;
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.NewSupplierContract
;
import
com.jess.arms.di.scope.FragmentScope
;
import
com.jess.arms.http.imageloader.ImageLoader
;
...
...
@@ -31,6 +33,8 @@ import com.jess.arms.integration.AppManager;
import
com.jess.arms.mvp.BasePresenter
;
import
com.jess.arms.utils.EnAndNumInputFilter
;
import
com.jess.arms.utils.RxLifecycleUtils
;
import
com.xuexiang.rxutil2.rxjava.RxJavaUtils
;
import
com.xuexiang.rxutil2.rxjava.task.RxIOTask
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
...
...
@@ -176,22 +180,27 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
infoMultiAdapter
.
setOnItemChildClickListener
((
adapter
,
view
,
position
)
->
{
if
(
view
.
getId
()
==
R
.
id
.
cb_multi_check
)
{
// 聯繫方式的選中
//先找到之前的默認聯繫方式
List
<
InfoMultiBean
>
data
=
infoMultiAdapter
.
getData
();
InfoMultiBean
infoMultiBean
=
data
.
get
(
position
);
if
(
infoMultiBean
instanceof
MultiCheckInputBean
)
{
int
lastDefault
=
emailIndex
;
for
(
int
i
=
emailIndex
;
i
<
smsIndex
+
1
;
i
++)
{
//從email開始,到sms,是所有的聯繫方式
//將聯繫方式的選中設為false
InfoMultiBean
infoMultiBean
=
data
.
get
(
i
);
//拿到對象,找到上一次被設為默認的那個聯繫方式,修改為false
MultiCheckInputBean
multiCheckInputBean
=
(
MultiCheckInputBean
)
infoMultiBean
;
int
index
=
contactInfo
.
indexOf
(
multiCheckInputBean
);
if
(
index
>=
0
)
{
MultiCheckInputBean
multiCheckInputBean1
=
contactInfo
.
get
(
index
);
if
(
multiCheckInputBean1
!=
null
)
{
for
(
MultiCheckInputBean
checkInputBean
:
contactInfo
)
{
checkInputBean
.
setDefault
(
false
);
}
multiCheckInputBean1
.
setDefault
(
true
);
}
if
(
multiCheckInputBean
.
isDefault
())
{
lastDefault
=
i
;
multiCheckInputBean
.
setDefault
(
false
);
break
;
}
infoMultiAdapter
.
notifyDataSetChanged
();
}
//然後再將本次選中的設為true,刷新這兩個item
InfoMultiBean
infoMultiBean
=
data
.
get
(
position
);
MultiCheckInputBean
multiCheckInputBean
=
(
MultiCheckInputBean
)
infoMultiBean
;
multiCheckInputBean
.
setDefault
(
true
);
infoMultiAdapter
.
notifyItemChanged
(
lastDefault
);
infoMultiAdapter
.
notifyItemChanged
(
position
);
}
});
return
infoMultiAdapter
;
...
...
@@ -203,9 +212,9 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
if
(!
hasFocus
)
{
EditText
editText
=
(
EditText
)
v
;
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
editText
))
{
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
supplierName
))
{
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
supplierName
))
{
//當供應商名稱不為空時,是修改供應商
if
(!
editText
.
getText
().
toString
().
equals
(
supplierName
))
{
if
(!
editText
.
getText
().
toString
().
equals
(
supplierName
))
{
//輸入的供應商名稱和之前的名稱不相同,說明進行了修改,需要進行查詢
getSupplierInfo
(
editText
,
editText
.
getText
().
toString
());
}
...
...
@@ -299,7 +308,7 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
public
void
deleteSupplier
(
int
supplierId
)
{
mModel
.
deleteSupplier
(
supplierId
)
.
subscribeOn
(
Schedulers
.
io
())
.
doOnSubscribe
(
disposable
->
mRootView
.
showLoading
(
"保存中..."
))
.
doOnSubscribe
(
disposable
->
mRootView
.
showLoading
(
Constant
.
SAVE_LOADING
))
.
subscribeOn
(
AndroidSchedulers
.
mainThread
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
doAfterTerminate
(()
->
mRootView
.
hideLoading
())
...
...
@@ -310,11 +319,12 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
public
void
onNext
(
@NonNull
BaseResult
info
)
{
if
(
info
!=
null
)
{
if
(
info
.
isSuccess
())
{
SupplyShoppingCart
.
getInstance
().
removeFoodsBySupplier
(
supplierId
);
mRootView
.
saveSuccess
();
}
else
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
info
.
getErrMsg
()))
{
mRootView
.
showMessage
(
info
.
getErrMsg
());
}
else
{
mRootView
.
showMessage
(
"保存失敗"
);
mRootView
.
showMessage
(
Constant
.
SAVE_FAIL
);
}
}
}
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/OrderDetailsPresenter.java
View file @
60d1a9cf
...
...
@@ -82,6 +82,10 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
* 逗號分隔符
*/
private
final
String
COMMA_SEPARATED
=
","
;
/**
* 訂單狀態
*/
public
int
orderState
;
@Inject
public
OrderDetailsPresenter
(
OrderDetailsContract
.
Model
model
,
OrderDetailsContract
.
View
rootView
)
{
...
...
@@ -117,10 +121,16 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
PurchaseOrderDetailsBean
orderDetailsBean
=
GsonUtils
.
GsonToBean
(
GsonUtils
.
GsonString
(
baseResult
.
getData
()),
PurchaseOrderDetailsBean
.
class
);
if
(
orderDetailsBean
!=
null
)
{
OrderDetailsPresenter
.
this
.
orderId
=
orderId
;
transformationWareHouse
(
orderDetailsBean
);
//加載圖片
loadImages
(
orderDetailsBean
.
getFiles
());
mRootView
.
loadOrderDetails
(
orderDetailsBean
);
try
{
transformationWareHouse
(
orderDetailsBean
);
orderState
=
orderDetailsBean
.
getStatus
();
//加載圖片
loadImages
(
orderDetailsBean
.
getFiles
());
mRootView
.
loadOrderDetails
(
orderDetailsBean
);
}
catch
(
NullPointerException
e
)
{
mRootView
.
showMessage
(
e
.
getMessage
());
mRootView
.
killMyself
();
}
}
else
{
mRootView
.
showMessage
(
GET_INFO_ERROR
);
}
...
...
@@ -139,7 +149,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
* 收過貨的單:不可操作單位,顯示入庫單位 purchaseWarehousingUnits
* showUnit 用於顯示的單位,進行收貨操作時傳遞給後台
*/
private
void
transformationWareHouse
(
PurchaseOrderDetailsBean
orderDetailsBean
)
{
private
void
transformationWareHouse
(
PurchaseOrderDetailsBean
orderDetailsBean
)
throws
NullPointerException
{
List
<
PurchaseOrderDetailsBean
.
PurchaseOrderDetailsInfoVosBean
>
purchaseOrderDetailsInfoVos
=
orderDetailsBean
.
getPurchaseOrderDetailsInfoVOS
();
if
(
purchaseOrderDetailsInfoVos
!=
null
)
{
//遍歷訂單商品
...
...
@@ -149,27 +159,29 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
List
<
DeputyUnitBean
>
deputyUnitBeans
=
purchaseOrderDetailsInfoVO
.
getFoodUnits
();
//計算出當前食材總金額
double
warehousingAmount
=
MoneyUtil
.
priceCalculation
(
purchaseOrderDetailsInfoVO
.
getFoodPrice
(),
purchaseOrderDetailsInfoVO
.
getFoodQuantity
());
//待收貨的
if
(
purchaseOrderDetailsInfoVO
.
getStatus
()
==
PurchaseOrderDetailsBean
.
WAIT_RECEIVED
)
{
//副單位為空,設置顯示主單位
if
(
deputyUnitBeans
==
null
)
{
deputyUnitBeans
=
new
ArrayList
<>();
//添加主單位到副單位列表,用戶可手動切換
DeputyUnitBean
deputyUnitBean
=
new
DeputyUnitBean
(
purchaseOrderDetailsInfoVO
.
getBasicUnitName
(),
purchaseOrderDetailsInfoVO
.
getFoodQuantity
());
deputyUnitBean
.
setDeputyValue
(
purchaseOrderDetailsInfoVO
.
getFoodQuantity
());
deputyUnitBean
.
setUnitPrice
(
purchaseOrderDetailsInfoVO
.
getFoodPrice
());
deputyUnitBeans
.
add
(
deputyUnitBean
);
//设置显示的单位為主單位
purchaseOrderDetailsInfoVO
.
setShowUnit
(
deputyUnitBeans
.
get
(
0
));
purchaseOrderDetailsInfoVO
.
setFoodUnits
(
deputyUnitBeans
);
}
if
(
TextUtil
.
isEmptyOrNullOrUndefined
(
purchaseOrderDetailsInfoVO
.
getBasicUnitName
()))
{
throw
new
NullPointerException
(
"未獲取到食品主單位,請檢查後重試"
);
}
//添加主單位到副單位列表,用戶可手動切換
DeputyUnitBean
deputyUnitBean
=
new
DeputyUnitBean
(
purchaseOrderDetailsInfoVO
.
getBasicUnitName
(),
purchaseOrderDetailsInfoVO
.
getFoodQuantity
());
deputyUnitBean
.
setDeputyValue
(
purchaseOrderDetailsInfoVO
.
getFoodQuantity
());
deputyUnitBean
.
setUnitPrice
(
purchaseOrderDetailsInfoVO
.
getFoodPrice
());
deputyUnitBeans
.
add
(
0
,
deputyUnitBean
);
//设置显示的单位,如果大於1,則顯示第一個,因為第一個是副單位,默認顯示副單位
if
(
deputyUnitBeans
.
size
()
>
1
)
{
purchaseOrderDetailsInfoVO
.
setShowUnit
(
deputyUnitBeans
.
get
(
1
));
}
else
{
//设置显示的单位為第一個副單位
DeputyUnitBean
deputyUnitBean
=
purchaseOrderDetailsInfoVO
.
getFoodUnits
().
get
(
0
);
deputyUnitBean
.
setDeputyValue
(
purchaseOrderDetailsInfoVO
.
getFoodQuantity
());
deputyUnitBean
.
setUnitPrice
(
purchaseOrderDetailsInfoVO
.
getFoodPrice
());
purchaseOrderDetailsInfoVO
.
setShowUnit
(
deputyUnitBean
);
//只有一個單位,顯示主單位
purchaseOrderDetailsInfoVO
.
setShowUnit
(
deputyUnitBeans
.
get
(
0
));
}
//設置單位集合
purchaseOrderDetailsInfoVO
.
setFoodUnits
(
deputyUnitBeans
);
}
else
{
//如果不是待收貨的商品:部分收貨和已完成,都不可再更改收貨單位,只顯示一個固定的單位
//拿到入庫的那個單位
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/SupplierListPresenter.java
View file @
60d1a9cf
...
...
@@ -6,9 +6,11 @@ import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import
com.gingersoft.gsa.cloud.common.bean.BaseResult
;
import
com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils
;
import
com.gingersoft.gsa.cloud.common.utils.other.TextUtil
;
import
com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean
;
import
com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean
;
import
com.gingersoft.supply_chain.mvp.bean.SupplierResultBean
;
import
com.gingersoft.supply_chain.mvp.content.Constant
;
import
com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart
;
import
com.gingersoft.supply_chain.mvp.contract.SupplierListContract
;
import
com.jess.arms.di.scope.FragmentScope
;
import
com.jess.arms.http.imageloader.ImageLoader
;
...
...
@@ -17,9 +19,11 @@ import com.jess.arms.mvp.BasePresenter;
import
com.jess.arms.utils.RxLifecycleUtils
;
import
com.xuexiang.rxutil2.rxjava.RxJavaUtils
;
import
com.xuexiang.rxutil2.rxjava.task.RxAsyncTask
;
import
com.xuexiang.rxutil2.rxjava.task.RxIOTask
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -125,7 +129,7 @@ public class SupplierListPresenter extends BasePresenter<SupplierListContract.Mo
RxJavaUtils
.
executeAsyncTask
(
new
RxAsyncTask
<
Object
,
Integer
>(
1
)
{
@Override
public
void
doInUIThread
(
Integer
o
)
{
if
(
o
!=
null
)
{
if
(
o
!=
null
)
{
mRootView
.
setSelectIndex
(
o
);
}
}
...
...
@@ -164,7 +168,8 @@ public class SupplierListPresenter extends BasePresenter<SupplierListContract.Mo
/**
* 刪除供應商
* @param id 供應商id
*
* @param id 供應商id
* @param position 所刪除的供應商下標
*/
public
void
deleteSupplier
(
int
id
,
int
position
)
{
...
...
@@ -181,6 +186,7 @@ public class SupplierListPresenter extends BasePresenter<SupplierListContract.Mo
public
void
onNext
(
@NonNull
BaseResult
info
)
{
if
(
info
!=
null
)
{
if
(
info
.
isSuccess
())
{
SupplyShoppingCart
.
getInstance
().
removeFoodsBySupplier
(
id
);
mRootView
.
deleteSuccess
(
position
);
}
else
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
info
.
getErrMsg
()))
{
mRootView
.
showMessage
(
info
.
getErrMsg
());
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/activity/SupplyChainMainActivity.java
View file @
60d1a9cf
...
...
@@ -14,6 +14,7 @@ import com.gingersoft.gsa.cloud.ui.adapter.multi.InfoMultiAdapter;
import
com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog
;
import
com.gingersoft.supply_chain.R
;
import
com.gingersoft.supply_chain.di.component.DaggerSupplyChainMainComponent
;
import
com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart
;
import
com.gingersoft.supply_chain.mvp.contract.SupplyChainMainContract
;
import
com.gingersoft.supply_chain.mvp.presenter.SupplyChainMainPresenter
;
import
com.gingersoft.supply_chain.mvp.ui.fragment.FunctionListFragment
;
...
...
@@ -151,6 +152,12 @@ public class SupplyChainMainActivity extends BaseFragmentActivity<SupplyChainMai
}
@Override
protected
void
onDestroy
()
{
super
.
onDestroy
();
SupplyShoppingCart
.
getInstance
().
clear
();
}
@Override
protected
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
@Nullable
Intent
data
)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
}
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/adapter/FoodListAdapter.java
View file @
60d1a9cf
...
...
@@ -18,6 +18,7 @@ import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import
com.gingersoft.supply_chain.R
;
import
com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean
;
import
com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodIngredientsFragment
;
import
com.google.android.material.textfield.TextInputEditText
;
import
org.jetbrains.annotations.NotNull
;
import
org.jetbrains.annotations.Nullable
;
...
...
@@ -161,7 +162,7 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodBean, BaseView
*/
private
void
setEdit
(
@NotNull
BaseViewHolder
viewHolder
,
PurchaseFoodBean
foodInfoBean
)
{
//食品數量
EditText
editText
=
viewHolder
.
getView
(
R
.
id
.
ed_food_ingredient_number
);
TextInput
EditText
editText
=
viewHolder
.
getView
(
R
.
id
.
ed_food_ingredient_number
);
//當前食品總價
TextView
mTvTotalAmount
=
viewHolder
.
getViewOrNull
(
R
.
id
.
tv_food_item_total_amount
);
//從緩存中取出這個食品信息,如果沒有對應的食品信息,說明沒操作過這個食品
...
...
@@ -252,9 +253,6 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodBean, BaseView
if
(
hasFocus
)
{
// if ("0".equals(editText.getText() + "")) {
// editText.setText("");
// editText.setText(null);
// editText.requestFocusFromTouch();
// editText.requestFocus();
// }
editText
.
addTextChangedListener
(
foodNumTextWatcher
);
}
else
{
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/adapter/ImageAdapter.java
View file @
60d1a9cf
...
...
@@ -16,13 +16,17 @@ import org.jetbrains.annotations.NotNull;
*/
public
class
ImageAdapter
extends
BaseQuickAdapter
<
String
,
BaseViewHolder
>
{
public
ImageAdapter
()
{
private
boolean
notShowDelete
;
public
ImageAdapter
(
boolean
notShowDelete
)
{
super
(
R
.
layout
.
item_image
);
addChildClickViewIds
(
R
.
id
.
iv_img
,
R
.
id
.
iv_img_delete
);
this
.
notShowDelete
=
notShowDelete
;
}
@Override
protected
void
convert
(
@NotNull
BaseViewHolder
viewHolder
,
String
s
)
{
GlideUtils
.
display
(
getContext
(),
viewHolder
.
getView
(
R
.
id
.
iv_img
),
s
);
viewHolder
.
setGone
(
R
.
id
.
iv_img_delete
,
notShowDelete
);
}
}
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/adapter/OrderDetailsFoodAdapter.java
View file @
60d1a9cf
...
...
@@ -141,9 +141,10 @@ public class OrderDetailsFoodAdapter extends BaseQuickAdapter<PurchaseOrderDetai
double
beforeNum
=
showUnit
.
getDeputyValue
();
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
s
+
""
))
{
showUnit
.
setDeputyValue
(
Double
.
parseDouble
(
s
.
toString
()));
}
else
{
showUnit
.
setDeputyValue
(
0
);
}
// else {
// showUnit.setDeputyValue(0);
// }
//實付金額發生改變,需要通知頁面刷新總金額
if
(
checkBox
.
isChecked
())
{
//現在的數量減去之前的數量,再乘以單價,得到增加或減少了多少總價
...
...
@@ -156,7 +157,15 @@ public class OrderDetailsFoodAdapter extends BaseQuickAdapter<PurchaseOrderDetai
edFoodNum
.
setOnFocusChangeListener
((
v
,
hasFocus
)
->
{
if
(
hasFocus
)
{
edFoodNum
.
addTextChangedListener
(
watcher
);
if
(
"0"
.
equals
(
edFoodNum
.
getText
().
toString
())){
edFoodNum
.
setText
(
""
);
}
}
else
{
if
(
TextUtil
.
isEmptyOrNullOrUndefined
(
edFoodNum
))
{
DeputyUnitBean
showUnit
=
getItem
(
viewHolder
.
getAdapterPosition
()).
getShowUnit
();
showUnit
.
setDeputyValue
(
0
);
edFoodNum
.
setText
(
"0"
);
}
edFoodNum
.
removeTextChangedListener
(
watcher
);
}
});
...
...
@@ -182,9 +191,10 @@ public class OrderDetailsFoodAdapter extends BaseQuickAdapter<PurchaseOrderDetai
double
beforePrice
=
showUnit
.
getUnitPrice
();
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
s
+
""
))
{
showUnit
.
setUnitPrice
(
Double
.
parseDouble
(
s
.
toString
()));
}
else
{
showUnit
.
setUnitPrice
(
0
);
}
// else {
// showUnit.setUnitPrice(0);
// }
//當前食品已選中,實付金額發生改變,需要通知頁面刷新總金額
if
(
checkBox
.
isChecked
())
{
//現在的單價減去之前的單價,再乘以數量,得到增加或減少的金額
...
...
@@ -196,12 +206,22 @@ public class OrderDetailsFoodAdapter extends BaseQuickAdapter<PurchaseOrderDetai
};
edUnitPrice
.
setOnFocusChangeListener
((
v
,
hasFocus
)
->
{
if
(
hasFocus
)
{
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
edUnitPrice
))
{
double
price
=
Double
.
parseDouble
(
edUnitPrice
.
getText
().
toString
());
if
(
price
==
0
){
edUnitPrice
.
setText
(
""
);
}
}
edUnitPrice
.
addTextChangedListener
(
unitPriceWatcher
);
}
else
{
if
(
TextUtil
.
isEmptyOrNullOrUndefined
(
edUnitPrice
))
{
DeputyUnitBean
showUnit
=
getItem
(
viewHolder
.
getAdapterPosition
()).
getShowUnit
();
showUnit
.
setUnitPrice
(
0
);
edUnitPrice
.
setText
(
"0"
);
}
edUnitPrice
.
removeTextChangedListener
(
unitPriceWatcher
);
}
});
}
/**
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/adapter/WareHousingDetailsAdapter.java
View file @
60d1a9cf
...
...
@@ -74,19 +74,21 @@ public class WareHousingDetailsAdapter extends BaseQuickAdapter<WarehouseDetails
viewHolder
.
setText
(
R
.
id
.
tv_warehouse_order_time_text
,
"下單日期:"
);
//入庫日期
viewHolder
.
setText
(
R
.
id
.
tv_warehouse_details_time
,
purchaseWarehousingOrderDetailsContentsBean
.
getWarehousingTime
());
viewHolder
.
setGone
(
R
.
id
.
tv_warehouse_details_time
,
false
);
}
else
{
//出庫,顯示-
if
(
purchaseWarehousingOrderDetailsContentsBean
.
getFoodQuantity
()
>=
0
)
{
//如果大於0,前面顯示-號
viewHolder
.
setText
(
R
.
id
.
tv_warehouse_details_food_num
,
String
.
format
(
getContext
().
getString
(
R
.
string
.
str_format_less
),
MoneyUtil
.
formatDouble
(
purchaseWarehousingOrderDetailsContentsBean
.
getFoodQuantity
())));
}
else
{
//小於0,
直接顯示負數
viewHolder
.
setText
(
R
.
id
.
tv_warehouse_details_food_num
,
String
.
valueOf
(
purchaseWarehousingOrderDetailsContentsBean
.
getFoodQuantity
(
)));
//小於0,
顯示正數,負負得正
viewHolder
.
setText
(
R
.
id
.
tv_warehouse_details_food_num
,
String
.
format
(
getContext
().
getString
(
R
.
string
.
str_format_positive
),
MoneyUtil
.
formatDouble
(
Math
.
abs
(
purchaseWarehousingOrderDetailsContentsBean
.
getFoodQuantity
())
)));
}
// 入庫顯示消耗日期,不顯示入庫日期
viewHolder
.
setGone
(
R
.
id
.
tv_warehouse_time_text
,
true
);
//消耗日期
viewHolder
.
setText
(
R
.
id
.
tv_warehouse_order_time_text
,
"消耗日期:"
);
viewHolder
.
setGone
(
R
.
id
.
tv_warehouse_details_time
,
true
);
}
//下單時間
viewHolder
.
setText
(
R
.
id
.
tv_warehouse_details_order_time
,
purchaseWarehousingOrderDetailsContentsBean
.
getPurchaseTime
());
...
...
@@ -102,6 +104,7 @@ public class WareHousingDetailsAdapter extends BaseQuickAdapter<WarehouseDetails
tvState
.
setBackground
(
allConsumeBg
);
tvState
.
setText
(
"庫存已使用"
);
}
else
{
//未消耗或消耗部分的
if
(
purchaseWarehousingOrderDetailsContentsBean
.
getDistanceExpiresTime
()
>=
0
)
{
//即將過期天數大於等於0
if
(
purchaseWarehousingOrderDetailsContentsBean
.
getWarningDays
()
>
purchaseWarehousingOrderDetailsContentsBean
.
getDistanceExpiresTime
())
{
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/fragment/category/CategoryFragment.java
View file @
60d1a9cf
...
...
@@ -155,7 +155,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
AppDialog
.
getInstance
().
showWaringDialog
(
mContext
,
String
.
format
(
getString
(
R
.
string
.
str_delete_category_tip
),
foodCategoryTrees
.
getName
()),
(
view
,
dialog
)
->
{
categoryPopup
.
dismiss
();
dialog
.
dismiss
();
mPresenter
.
deleteFoodCategory
(
foodCategoryTrees
.
getId
()
,
currentLevel
,
position
);
mPresenter
.
deleteFoodCategory
(
foodCategoryTrees
,
currentLevel
,
position
);
});
});
new
XPopup
.
Builder
(
getContext
())
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/fragment/food/FoodIngredientsFragment.java
View file @
60d1a9cf
...
...
@@ -615,6 +615,8 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi
String
categoryName
=
data
.
getString
(
NewFoodIngredientsFragment
.
CATEGORY_NAME_KEY
);
//從供應商的數據中將緩存移除掉,並拿到這個食材所屬的供應商
int
removeSupplierId
=
mPresenter
.
removeSupplierCache
(
supplierName
);
//當前頁面顯示的供應商緩存也要移除掉,重新查詢,避免用戶修改了供應商或者分類
mPresenter
.
removeSupplierCacheById
(
supplierId
);
//從分類的數據中將緩存移除掉
mPresenter
.
removeCacheByCategoryName
(
categoryName
);
//如果所屬供應商是當前選中的供應商,則調用接口重新獲取數據
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/fragment/order/OrderDetailsFragment.java
View file @
60d1a9cf
...
...
@@ -44,6 +44,7 @@ import com.gingersoft.supply_chain.mvp.presenter.OrderDetailsPresenter;
import
com.gingersoft.supply_chain.mvp.ui.adapter.ImageAdapter
;
import
com.gingersoft.supply_chain.mvp.ui.adapter.OrderDetailsFoodAdapter
;
import
com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment
;
import
com.gingersoft.supply_chain.mvp.ui.widget.ChooseUnitPopup
;
import
com.gingersoft.supply_chain.mvp.ui.widget.PurchaseListMorePopup
;
import
com.gingersoft.supply_chain.mvp.utils.SelectPicture
;
import
com.google.android.material.checkbox.MaterialCheckBox
;
...
...
@@ -111,6 +112,8 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
LinearLayout
layoutEdRemark
;
private
OrderDetailsFoodAdapter
orderDetailsFoodAdapter
;
ImageAdapter
imageAdapter
;
private
int
typesOfFood
=
0
;
private
double
totalAmount
=
0
;
...
...
@@ -285,12 +288,10 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
});
}
ImageAdapter
imageAdapter
;
@Override
public
void
uploadPicSuccess
(
String
imgUrl
)
{
if
(
imageAdapter
==
null
)
{
imageAdapter
=
new
ImageAdapter
();
imageAdapter
=
new
ImageAdapter
(
mPresenter
.
orderState
==
PurchaseOrderDetailsBean
.
ALL
);
rvOrderDetailsPictures
.
setAdapter
(
imageAdapter
);
rvOrderDetailsPictures
.
setLayoutManager
(
new
GridLayoutManager
(
requireContext
(),
4
));
imageAdapter
.
setOnItemChildClickListener
((
adapter
,
view
,
position
)
->
{
...
...
@@ -373,23 +374,33 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
//切換單位
PurchaseOrderDetailsBean
.
PurchaseOrderDetailsInfoVosBean
purchaseOrderDetailsInfoVosBean
=
orderDetailsFoodAdapter
.
getData
().
get
(
position
);
List
<
DeputyUnitBean
>
foodUnits
=
purchaseOrderDetailsInfoVosBean
.
getFoodUnits
();
String
[]
units
=
new
String
[
0
];
// String[] units = new String[0];
List
<
String
>
units
=
new
ArrayList
<>();
if
(
foodUnits
!=
null
)
{
units
=
new
String
[
foodUnits
.
size
()];
//
units = new String[foodUnits.size()];
for
(
int
i
=
0
;
i
<
foodUnits
.
size
();
i
++)
{
units
[
i
]
=
foodUnits
.
get
(
i
).
getDeputyUnit
();
// units[i] = foodUnits.get(i).getDeputyUnit();
units
.
add
(
foodUnits
.
get
(
i
).
getDeputyUnit
());
}
}
if
(
units
.
length
>
1
)
{
if
(
units
.
size
()
>
1
)
{
ChooseUnitPopup
popup
=
new
ChooseUnitPopup
(
requireContext
()).
setStringData
(
units
).
setOnSelectListener
(
new
OnSelectListener
()
{
@Override
public
void
onSelect
(
int
position
,
String
text
)
{
//將用戶之前輸入的值,修改到新選擇的單位匯中
DeputyUnitBean
showUnit
=
purchaseOrderDetailsInfoVosBean
.
getShowUnit
();
DeputyUnitBean
deputyUnitBean
=
foodUnits
.
get
(
position
);
deputyUnitBean
.
setDeputyValue
(
showUnit
.
getDeputyValue
());
deputyUnitBean
.
setUnitPrice
(
showUnit
.
getUnitPrice
());
purchaseOrderDetailsInfoVosBean
.
setShowUnit
(
deputyUnitBean
);
orderDetailsFoodAdapter
.
notifyItemChanged
(
position
);
}
});
new
XPopup
.
Builder
(
getContext
())
.
hasShadowBg
(
false
)
.
atView
(
view
)
// 依附于所点击的View,内部会自动判断在上方或者下方显示
.
asAttachList
(
units
,
null
,
(
position1
,
text
)
->
{
purchaseOrderDetailsInfoVosBean
.
setShowUnit
(
foodUnits
.
get
(
position1
));
orderDetailsFoodAdapter
.
notifyItemChanged
(
position
);
}).
show
();
.
asCustom
(
popup
)
.
show
();
}
}
});
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/fragment/warehouse/WarehousingInventoryFragment.java
View file @
60d1a9cf
...
...
@@ -131,7 +131,13 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
s
+
""
))
{
//用戶輸入的盤點數量
int
inventoryNum
=
Integer
.
parseInt
(
s
+
""
);
tvWarehouseDifference
.
setText
(
String
.
valueOf
(
foodNum
-
inventoryNum
));
// if (inventoryNum > foodNum) {
// inventoryNum = foodNum;
// showMessage("不能大於庫存數");
// edWarehouseLoss.setText(String.valueOf(foodNum));
// edWarehouseLoss.setSelection(edWarehouseLoss.getText().length());
// }
tvWarehouseDifference
.
setText
(
String
.
valueOf
(
Math
.
abs
(
foodNum
-
inventoryNum
)));
}
else
{
tvWarehouseDifference
.
setText
(
String
.
valueOf
(
foodNum
));
}
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/widget/ChooseUnitPopup.java
0 → 100644
View file @
60d1a9cf
package
com
.
gingersoft
.
supply_chain
.
mvp
.
ui
.
widget
;
import
android.content.Context
;
import
android.widget.LinearLayout
;
import
androidx.annotation.NonNull
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.chad.library.adapter.base.viewholder.BaseViewHolder
;
import
com.gingersoft.supply_chain.R
;
import
com.lxj.xpopup.animator.PopupAnimator
;
import
com.lxj.xpopup.animator.ScrollScaleAnimator
;
import
com.lxj.xpopup.enums.PopupAnimation
;
import
com.lxj.xpopup.impl.AttachListPopupView
;
import
com.lxj.xpopup.interfaces.OnSelectListener
;
import
com.lxj.xpopup.widget.VerticalRecyclerView
;
import
org.jetbrains.annotations.NotNull
;
import
java.util.List
;
/**
* @author 宇航.
* User: admin
* Date: 2021/1/29
* Time: 16:45
* Use:
*/
public
class
ChooseUnitPopup
extends
AttachListPopupView
{
private
OnSelectListener
selectListener
;
private
RecyclerView
recyclerView
;
private
int
width
;
/**
* @param context
*/
public
ChooseUnitPopup
(
@NonNull
Context
context
)
{
super
(
context
,
0
,
R
.
layout
.
popup_choose_unit
);
}
@Override
protected
void
onCreate
()
{
recyclerView
=
findViewById
(
R
.
id
.
recyclerView
);
width
=
popupInfo
.
atView
.
getMeasuredWidth
();
recyclerView
.
setHasFixedSize
(
false
);
recyclerView
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
()));
ChooseUnitAdapter
adapter
=
new
ChooseUnitAdapter
();
adapter
.
setOnItemClickListener
((
a
,
view
,
position
)
->
{
if
(
selectListener
!=
null
)
{
selectListener
.
onSelect
(
position
,
adapter
.
getItem
(
position
));
}
if
(
popupInfo
.
autoDismiss
)
{
dismiss
();
}
});
recyclerView
.
setAdapter
(
adapter
);
applyTheme
();
}
private
List
<
String
>
data
;
public
ChooseUnitPopup
setStringData
(
List
<
String
>
data
)
{
this
.
data
=
data
;
return
this
;
}
@Override
protected
PopupAnimator
getPopupAnimator
()
{
PopupAnimator
animator
;
if
(
isShowUpToTarget
())
{
// 在上方展示
animator
=
new
ScrollScaleAnimator
(
getPopupContentView
(),
PopupAnimation
.
ScrollAlphaFromBottom
);
}
else
{
// 在下方展示
animator
=
new
ScrollScaleAnimator
(
getPopupContentView
(),
PopupAnimation
.
ScrollAlphaFromTop
);
}
return
animator
;
}
@Override
protected
void
applyDarkTheme
()
{
((
VerticalRecyclerView
)
recyclerView
).
setupDivider
(
true
);
}
@Override
protected
void
applyLightTheme
()
{
((
VerticalRecyclerView
)
recyclerView
).
setupDivider
(
false
);
}
@Override
public
ChooseUnitPopup
setOnSelectListener
(
OnSelectListener
selectListener
)
{
this
.
selectListener
=
selectListener
;
return
this
;
}
public
class
ChooseUnitAdapter
extends
BaseQuickAdapter
<
String
,
BaseViewHolder
>
{
public
ChooseUnitAdapter
()
{
super
(
R
.
layout
.
popup_choose_unit
,
data
);
}
@Override
protected
void
convert
(
@NotNull
BaseViewHolder
viewHolder
,
String
s
)
{
viewHolder
.
setText
(
R
.
id
.
tv_text
,
s
);
LinearLayout
layout
=
viewHolder
.
getView
(
R
.
id
.
layout_choose_unit
);
LinearLayout
.
LayoutParams
layoutParams
=
new
LinearLayout
.
LayoutParams
(
width
,
LinearLayout
.
LayoutParams
.
WRAP_CONTENT
);
layout
.
setLayoutParams
(
layoutParams
);
}
}
}
component-supply-chain/src/main/res/drawable-xxhdpi/ic_red_delete_pic.png
0 → 100644
View file @
60d1a9cf
2.97 KB
component-supply-chain/src/main/res/layout/item_food_ingredient.xml
View file @
60d1a9cf
...
...
@@ -155,22 +155,24 @@
android:layout_height=
"@dimen/dp_24"
android:background=
"@drawable/ic_circle_gray_sub"
/>
<EditText
<
com.google.android.material.textfield.TextInput
EditText
android:id=
"@+id/ed_food_ingredient_number"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:minWidth=
"@dimen/dp_10"
android:layout_marginLeft=
"@dimen/dp_10"
android:layout_marginRight=
"@dimen/dp_10"
android:layout_marginLeft=
"@dimen/dp_4"
android:layout_marginRight=
"@dimen/dp_4"
android:background=
"@null"
android:focusable=
"true"
android:focusableInTouchMode=
"true"
android:gravity=
"center"
android:inputType=
"number"
android:maxLength=
"4"
android:paddingLeft=
"@dimen/dp_4"
android:paddingRight=
"@dimen/dp_4"
android:text=
"0"
android:maxLines=
"1"
android:minWidth=
"@dimen/dp_30"
android:textColor=
"@color/black"
android:textCursorDrawable=
"@drawable/cursor_theme"
android:textSize=
"@dimen/dp_22"
/>
android:textSize=
"@dimen/dp_22"
tools:text=
"10"
/>
<com.qmuiteam.qmui.layout.QMUIButton
android:id=
"@+id/btn_food_operation_add"
...
...
component-supply-chain/src/main/res/layout/item_image.xml
View file @
60d1a9cf
...
...
@@ -13,9 +13,9 @@
<ImageView
android:id=
"@+id/iv_img_delete"
android:layout_width=
"@dimen/dp_
20
"
android:layout_height=
"@dimen/dp_
20
"
android:layout_width=
"@dimen/dp_
17
"
android:layout_height=
"@dimen/dp_
17
"
android:layout_gravity=
"right"
android:src=
"@drawable/ic
on_dialog_close
"
/>
android:src=
"@drawable/ic
_red_delete_pic
"
/>
</FrameLayout>
\ No newline at end of file
component-supply-chain/src/main/res/layout/item_order_details_food.xml
View file @
60d1a9cf
...
...
@@ -128,11 +128,11 @@
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_marginLeft=
"@dimen/dp_5"
android:layout_marginRight=
"@dimen/dp_5"
android:background=
"@null"
android:gravity=
"end|center_vertical"
android:inputType=
"numberDecimal"
android:maxLines=
"1"
android:paddingRight=
"@dimen/dp_10"
android:textColor=
"@color/color_3c"
android:textColorHighlight=
"@color/theme_color"
android:textCursorDrawable=
"@drawable/cursor_theme"
...
...
@@ -163,13 +163,13 @@
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_marginLeft=
"@dimen/dp_5"
android:layout_marginRight=
"@dimen/dp_5"
android:background=
"@null"
android:
textCursorDrawable=
"@drawable/cursor_theme
"
android:
paddingRight=
"@dimen/dp_10
"
android:gravity=
"end|center_vertical"
android:inputType=
"numberDecimal"
android:maxLines=
"1"
android:textColor=
"@color/color_3c"
android:textCursorDrawable=
"@drawable/cursor_theme"
android:textSize=
"@dimen/dp_15"
android:textStyle=
"bold"
tools:text=
"2"
/>
...
...
component-supply-chain/src/main/res/layout/item_shopping_cart_food.xml
View file @
60d1a9cf
...
...
@@ -189,7 +189,7 @@
android:layout_height=
"@dimen/dp_24"
android:background=
"@drawable/ic_circle_gray_sub"
/>
<EditText
<
com.google.android.material.textfield.TextInput
EditText
android:id=
"@+id/ed_food_ingredient_number"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
...
...
component-supply-chain/src/main/res/layout/popup_choose_unit.xml
0 → 100644
View file @
60d1a9cf
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/layout_choose_unit"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:orientation=
"horizontal"
android:paddingTop=
"@dimen/dp_7"
android:paddingBottom=
"@dimen/dp_7"
>
<ImageView
android:id=
"@+id/iv_image"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
<TextView
android:id=
"@+id/tv_text"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"但"
android:textColor=
"@color/color_3c"
android:textSize=
"@dimen/dp_15"
/>
</LinearLayout>
\ No newline at end of file
library-ui/src/main/java/com/gingersoft/gsa/cloud/ui/adapter/multi/InputProvider.java
View file @
60d1a9cf
...
...
@@ -56,6 +56,7 @@ public class InputProvider<T extends InfoMultiBean> extends MyBaseItemProvider<T
MultiInputBean
infoMultiBean
=
(
MultiInputBean
)
t
;
TextInputEditText
editText
=
baseViewHolder
.
getView
(
R
.
id
.
ed_multi_value
);
editText
.
setError
(
null
);
initEditFocusable
(
infoMultiBean
,
editText
);
//設置輸入限制
setFilters
(
editText
,
infoMultiBean
);
...
...
library-ui/src/main/res/layout/base_print_bill_adapter_item_bill.xml
View file @
60d1a9cf
...
...
@@ -2,6 +2,7 @@
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
xmlns:tools=
"http://schemas.android.com/tools"
android:gravity=
"center"
android:orientation=
"horizontal"
>
...
...
@@ -9,6 +10,7 @@
android:id=
"@+id/tv_bill_total_text"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
tools:text=
"微信:"
android:layout_weight=
"0.7"
android:gravity=
"right"
style=
"@style/Print_text_style"
/>
...
...
@@ -20,5 +22,6 @@
android:layout_weight=
"0.3"
android:layout_gravity=
"bottom"
android:gravity=
"right"
tools:text=
"$500"
style=
"@style/Print_text_style"
/>
</LinearLayout>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment