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
044908ec
Commit
044908ec
authored
Jul 28, 2021
by
张建升
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
菜品食材綁定 代码同步
parent
adb702b0
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
122 additions
and
69 deletions
+122
-69
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/bean/DishDetailBean.java
+0
-2
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/DishesPresenter.java
+8
-3
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/adapter/dishes/DishDetailAdapter.java
+53
-15
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/adapter/dishes/DishProvider.java
+0
-2
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/adapter/dishes/DishesGroupProvider.java
+1
-1
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/fragment/DishesFragment.java
+40
-26
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/fragment/food/OtherFunctionFragment.java
+0
-1
component-supply-chain/src/main/res/layout/fragment_dishes.xml
+3
-14
component-supply-chain/src/main/res/layout/item_dishes_foods.xml
+17
-5
No files found.
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/bean/DishDetailBean.java
View file @
044908ec
...
@@ -24,7 +24,6 @@ public class DishDetailBean {
...
@@ -24,7 +24,6 @@ public class DishDetailBean {
private
boolean
deletes
;
// 非必须 删除 false 未删除 true 删除
private
boolean
deletes
;
// 非必须 删除 false 未删除 true 删除
private
String
foodBasicUnit
;
// string 非必须 食材基本单位
private
String
foodBasicUnit
;
// string 非必须 食材基本单位
private
List
<
DeputyUnitBean
>
foodUnits
;
private
List
<
DeputyUnitBean
>
foodUnits
;
private
boolean
show
=
true
;
public
DishDetailBean
(
PurchaseFoodBean
foodBean
,
DishNode
dishNode
)
{
public
DishDetailBean
(
PurchaseFoodBean
foodBean
,
DishNode
dishNode
)
{
// this.id = foodBean.get; ///此时的 id 一定是null deletes必是f
// this.id = foodBean.get; ///此时的 id 一定是null deletes必是f
...
@@ -41,6 +40,5 @@ public class DishDetailBean {
...
@@ -41,6 +40,5 @@ public class DishDetailBean {
this
.
foodNo
=
foodBean
.
getFoodNo
();
this
.
foodNo
=
foodBean
.
getFoodNo
();
this
.
type
=
0
;
this
.
type
=
0
;
this
.
foodUnits
=
foodBean
.
getFoodUnits
();
this
.
foodUnits
=
foodBean
.
getFoodUnits
();
this
.
show
=
true
;
}
}
}
}
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/presenter/DishesPresenter.java
View file @
044908ec
...
@@ -97,7 +97,6 @@ public class DishesPresenter extends BasePresenter<DishesContract.Model, DishesC
...
@@ -97,7 +97,6 @@ public class DishesPresenter extends BasePresenter<DishesContract.Model, DishesC
public
void
onError
(
@NotNull
Throwable
t
)
{
public
void
onError
(
@NotNull
Throwable
t
)
{
super
.
onError
(
t
);
super
.
onError
(
t
);
mRootView
.
loadDishGroupFail
();
mRootView
.
loadDishGroupFail
();
LogUtil
.
e
(
"ZJS"
,
" onError "
);
}
}
});
});
}
}
...
@@ -121,15 +120,22 @@ public class DishesPresenter extends BasePresenter<DishesContract.Model, DishesC
...
@@ -121,15 +120,22 @@ public class DishesPresenter extends BasePresenter<DishesContract.Model, DishesC
@Override
@Override
public
void
onNext
(
DishDetailResultBean
dishDetailBean
)
{
//數據處理
public
void
onNext
(
DishDetailResultBean
dishDetailBean
)
{
//數據處理
if
(
dishDetailBean
.
isSuccess
())
{
if
(
dishDetailBean
.
isSuccess
())
{
LogUtil
.
e
(
"ZJS"
,
" dishDetailBean"
+
dishDetailBean
.
toString
());
dishNode
.
setDetailBean
(
dishDetailBean
);
dishNode
.
setDetailBean
(
dishDetailBean
);
mRootView
.
loadDishesInfo
(
dishNode
,
dishDetailBean
);
mRootView
.
loadDishesInfo
(
dishNode
,
dishDetailBean
);
}
else
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
dishDetailBean
.
getErrMsg
()))
{
}
else
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
dishDetailBean
.
getErrMsg
()))
{
mRootView
.
showMessage
(
dishDetailBean
.
getErrMsg
());
mRootView
.
showMessage
(
dishDetailBean
.
getErrMsg
());
mRootView
.
loadDishesFail
();
}
else
{
}
else
{
mRootView
.
loadDishesFail
();
mRootView
.
showMessage
(
AppConstant
.
GET_INFO_ERROR
);
mRootView
.
showMessage
(
AppConstant
.
GET_INFO_ERROR
);
}
}
}
}
@Override
public
void
onError
(
@NotNull
Throwable
t
)
{
super
.
onError
(
t
);
mRootView
.
loadDishesFail
();
}
});
});
}
}
...
@@ -147,7 +153,6 @@ public class DishesPresenter extends BasePresenter<DishesContract.Model, DishesC
...
@@ -147,7 +153,6 @@ public class DishesPresenter extends BasePresenter<DishesContract.Model, DishesC
@Override
@Override
public
void
onNext
(
BaseResult
bindResult
)
{
//數據處理
public
void
onNext
(
BaseResult
bindResult
)
{
//數據處理
if
(
bindResult
.
isSuccess
())
{
if
(
bindResult
.
isSuccess
())
{
LogUtil
.
e
(
"ZJS"
,
" 菜品食材綁定成功 bindResult"
+
bindResult
.
toString
());
DishDetailResultBean
dishDetailResultBean
=
new
DishDetailResultBean
();
DishDetailResultBean
dishDetailResultBean
=
new
DishDetailResultBean
();
dishDetailResultBean
.
setData
(
dishDetailBeans
);
dishDetailResultBean
.
setData
(
dishDetailBeans
);
dishNode
.
setDetailBean
(
dishDetailResultBean
);
dishNode
.
setDetailBean
(
dishDetailResultBean
);
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/adapter/dishes/DishDetailAdapter.java
View file @
044908ec
package
com
.
gingersoft
.
supply_chain
.
mvp
.
ui
.
adapter
.
dishes
;
package
com
.
gingersoft
.
supply_chain
.
mvp
.
ui
.
adapter
.
dishes
;
import
android.content.Context
;
import
android.text.Editable
;
import
android.text.TextWatcher
;
import
android.widget.EditText
;
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.CollectionUtils
;
import
com.gingersoft.gsa.cloud.common.utils.other.TextUtil
;
import
com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils
;
import
com.gingersoft.supply_chain.R
;
import
com.gingersoft.supply_chain.R
;
import
com.gingersoft.supply_chain.mvp.bean.DeputyUnitBean
;
import
com.gingersoft.supply_chain.mvp.bean.DishDetailBean
;
import
com.gingersoft.supply_chain.mvp.bean.DishDetailBean
;
import
org.jetbrains.annotations.NotNull
;
import
org.jetbrains.annotations.NotNull
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -19,7 +22,8 @@ import java.util.List;
...
@@ -19,7 +22,8 @@ import java.util.List;
*/
*/
public
class
DishDetailAdapter
extends
BaseQuickAdapter
<
DishDetailBean
,
BaseViewHolder
>
{
public
class
DishDetailAdapter
extends
BaseQuickAdapter
<
DishDetailBean
,
BaseViewHolder
>
{
public
DishDetailAdapter
(
Context
context
,
List
<
DishDetailBean
>
foods
)
{
private
List
<
DishDetailBean
>
dels
=
new
ArrayList
<>();
public
DishDetailAdapter
(
List
<
DishDetailBean
>
foods
)
{
super
(
R
.
layout
.
item_dishes_foods
,
foods
);
super
(
R
.
layout
.
item_dishes_foods
,
foods
);
addChildClickViewIds
(
R
.
id
.
tv_dishes_unit
,
R
.
id
.
tv_dishes_del
);
addChildClickViewIds
(
R
.
id
.
tv_dishes_unit
,
R
.
id
.
tv_dishes_del
);
}
}
...
@@ -29,20 +33,54 @@ public class DishDetailAdapter extends BaseQuickAdapter<DishDetailBean, BaseView
...
@@ -29,20 +33,54 @@ public class DishDetailAdapter extends BaseQuickAdapter<DishDetailBean, BaseView
protected
void
convert
(
@NotNull
BaseViewHolder
viewHolder
,
DishDetailBean
item
)
{
protected
void
convert
(
@NotNull
BaseViewHolder
viewHolder
,
DishDetailBean
item
)
{
viewHolder
.
setText
(
R
.
id
.
tv_dishes_name
,
item
.
getFoodName
());
//食材名字
viewHolder
.
setText
(
R
.
id
.
tv_dishes_name
,
item
.
getFoodName
());
//食材名字
viewHolder
.
setText
(
R
.
id
.
tv_dishes_unit
,
item
.
getBasicUnitName
());
//配置的單位
viewHolder
.
setText
(
R
.
id
.
tv_dishes_unit
,
item
.
getBasicUnitName
());
//配置的單位
if
(
item
.
isShow
())
{
final
EditText
count
=
viewHolder
.
getView
(
R
.
id
.
et_dishes_count
);
// viewHolder.itemView.setVisibility(View.VISIBLE);
count
.
setTag
(
item
);
// viewHolder.setTextColor(R.id.tv_dishes_name, ArmsUtils.getColor(context, R.color.color_18));
count
.
addTextChangedListener
(
new
TextWatcher
()
{
}
else
{
@Override
// viewHolder.itemView.setVisibility(View.GONE);
public
void
beforeTextChanged
(
CharSequence
s
,
int
start
,
int
count
,
int
after
)
{
// viewHolder.setTextColor(R.id.tv_dishes_name, ArmsUtils.getColor(context, R.color.switcher_off_color));
}
@Override
public
void
onTextChanged
(
CharSequence
s
,
int
start
,
int
before
,
int
count
)
{
}
}
// viewHolder.setText(R.id.tv_dishes_unit, item.getUnitName());
@Override
List
<
DeputyUnitBean
>
deputyUnitBeans
=
item
.
getFoodUnits
();
//副單位
public
void
afterTextChanged
(
Editable
s
)
{
if
(
CollectionUtils
.
isNullOrEmpty
(
deputyUnitBeans
))
{
DishDetailBean
tag
=
(
DishDetailBean
)
count
.
getTag
();
// addChildClickViewIds(R.id.tv_dishes_unit); consumeQuantity
if
(
TextUtil
.
isEmptyOrNullOrUndefined
(
s
))
{
ToastUtils
.
show
(
getContext
(),
"數量不能為空"
);
count
.
setText
(
String
.
valueOf
(
tag
.
getConsumeQuantity
()));
count
.
setSelection
(
count
.
getText
().
toString
().
length
());
}
else
{
tag
.
setConsumeQuantity
(
Integer
.
parseInt
(
s
.
toString
()));
}
}
}
viewHolder
.
setText
(
R
.
id
.
tv_dishes_count
,
String
.
valueOf
(
item
.
getConsumeQuantity
()));
//消耗數量
});
count
.
setText
(
String
.
valueOf
(
item
.
getConsumeQuantity
()));
//消耗數量
}
public
void
addDel
(
DishDetailBean
del
){
dels
.
add
(
del
);
}
public
List
<
DishDetailBean
>
getDels
()
{
return
dels
;
}
public
void
removeDel
(
DishDetailBean
remove
){
for
(
int
i
=
0
;
i
<
dels
.
size
();
i
++)
{
DishDetailBean
del
=
dels
.
get
(
i
);
if
(
remove
.
getPurchaseFoodId
()==
del
.
getPurchaseFoodId
())
{
dels
.
remove
(
del
);
}
}
}
public
void
clearDel
(){
dels
.
clear
();
}
}
}
}
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/adapter/dishes/DishProvider.java
View file @
044908ec
...
@@ -38,8 +38,6 @@ public class DishProvider extends BaseNodeProvider {
...
@@ -38,8 +38,6 @@ public class DishProvider extends BaseNodeProvider {
@Override
@Override
public
void
onClick
(
@NotNull
BaseViewHolder
helper
,
@NotNull
View
view
,
BaseNode
data
,
int
position
)
{
public
void
onClick
(
@NotNull
BaseViewHolder
helper
,
@NotNull
View
view
,
BaseNode
data
,
int
position
)
{
DishNode
entity
=
(
DishNode
)
data
;
DishNode
entity
=
(
DishNode
)
data
;
LogUtil
.
e
(
"zjs"
,
" onClick entity.isExpanded()="
+
entity
.
toString
());
if
(
entity
.
isExpanded
())
{
if
(
entity
.
isExpanded
())
{
getAdapter
().
collapse
(
position
);
getAdapter
().
collapse
(
position
);
}
else
{
}
else
{
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/adapter/dishes/DishesGroupProvider.java
View file @
044908ec
...
@@ -95,7 +95,7 @@ public class DishesGroupProvider extends BaseNodeProvider {
...
@@ -95,7 +95,7 @@ public class DishesGroupProvider extends BaseNodeProvider {
DishesGroupNode
groupNode
=
(
DishesGroupNode
)
data
;
DishesGroupNode
groupNode
=
(
DishesGroupNode
)
data
;
List
<
DishNode
>
dishNodes
=
groupNode
.
getDishNodes
();
List
<
DishNode
>
dishNodes
=
groupNode
.
getDishNodes
();
LogUtil
.
e
(
"zjs"
,
"父菜单点击 onClick position ="
+
position
+
" getFoodName"
+
groupNode
.
getFoodName
()+
" groupNode="
+
groupNode
.
isExpanded
());
//
LogUtil.e("zjs","父菜单点击 onClick position ="+position+" getFoodName"+groupNode.getFoodName()+" groupNode="+groupNode.isExpanded());
if
(
CollectionUtils
.
isNotNullOrEmpty
(
dishNodes
))
{
if
(
CollectionUtils
.
isNotNullOrEmpty
(
dishNodes
))
{
if
(
groupNode
.
getPos
()==
0
)
{
if
(
groupNode
.
getPos
()==
0
)
{
groupNode
.
setPos
(
1
);
groupNode
.
setPos
(
1
);
...
...
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/fragment/DishesFragment.java
View file @
044908ec
This diff is collapsed.
Click to expand it.
component-supply-chain/src/main/java/com/gingersoft/supply_chain/mvp/ui/fragment/food/OtherFunctionFragment.java
View file @
044908ec
...
@@ -452,7 +452,6 @@ public class OtherFunctionFragment extends BaseSupplyChainFragment<OtherFunction
...
@@ -452,7 +452,6 @@ public class OtherFunctionFragment extends BaseSupplyChainFragment<OtherFunction
protected
void
confirm
()
{
protected
void
confirm
()
{
ArrayList
<
PurchaseFoodBean
>
purchaseFood
=
mPresenter
.
getPurchaseFood
();
ArrayList
<
PurchaseFoodBean
>
purchaseFood
=
mPresenter
.
getPurchaseFood
();
if
(
CollectionUtils
.
isNotNullOrEmpty
(
purchaseFood
))
{
if
(
CollectionUtils
.
isNotNullOrEmpty
(
purchaseFood
))
{
LogUtil
.
e
(
"zjs"
,
" purchaseFood "
+
purchaseFood
.
size
());
Bundle
bundle
=
new
Bundle
();
Bundle
bundle
=
new
Bundle
();
bundle
.
putSerializable
(
"zjs"
,
purchaseFood
);
bundle
.
putSerializable
(
"zjs"
,
purchaseFood
);
setFragmentResult
(
RESULT_OK
,
bundle
);
setFragmentResult
(
RESULT_OK
,
bundle
);
...
...
component-supply-chain/src/main/res/layout/fragment_dishes.xml
View file @
044908ec
...
@@ -94,14 +94,14 @@
...
@@ -94,14 +94,14 @@
</LinearLayout>
</LinearLayout>
<com.scwang.smartrefresh.layout.SmartRefreshLayout
<com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id=
"@+id/refreshLayout"
android:id=
"@+id/
dish_
refreshLayout"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
android:layout_height=
"wrap_content"
>
<com.scwang.smartrefresh.layout.header.ClassicsHeader
<com.scwang.smartrefresh.layout.header.ClassicsHeader
android:id=
"@+id/fresh_header"
android:id=
"@+id/fresh_header"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/dp_
30
"
android:layout_height=
"@dimen/dp_
48
"
app:srlAccentColor=
"#aaa"
app:srlAccentColor=
"#aaa"
app:srlDrawableArrow=
"@drawable/ic_pulling"
app:srlDrawableArrow=
"@drawable/ic_pulling"
app:srlDrawableMarginRight=
"@dimen/dp_5"
app:srlDrawableMarginRight=
"@dimen/dp_5"
...
@@ -113,7 +113,7 @@
...
@@ -113,7 +113,7 @@
app:srlTextPulling=
"下滑查看上一分類"
app:srlTextPulling=
"下滑查看上一分類"
app:srlTextRefreshing=
"正在飛速加載..."
app:srlTextRefreshing=
"正在飛速加載..."
app:srlTextRelease=
"釋放查看上一分類"
app:srlTextRelease=
"釋放查看上一分類"
app:srlTextSizeTitle=
"@dimen/dp_1
2
"
/>
app:srlTextSizeTitle=
"@dimen/dp_1
6
"
/>
<com.gingersoft.supply_chain.mvp.ui.widget.StickyHeaderLayout
<com.gingersoft.supply_chain.mvp.ui.widget.StickyHeaderLayout
android:id=
"@+id/view_stick_head"
android:id=
"@+id/view_stick_head"
...
@@ -128,17 +128,6 @@
...
@@ -128,17 +128,6 @@
</com.gingersoft.supply_chain.mvp.ui.widget.StickyHeaderLayout>
</com.gingersoft.supply_chain.mvp.ui.widget.StickyHeaderLayout>
<com.scwang.smartrefresh.layout.footer.ClassicsFooter
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/dp_30"
app:srlDrawableArrow=
"@drawable/ic_push"
app:srlDrawableMarginRight=
"@dimen/dp_5"
app:srlDrawableSize=
"@dimen/dp_12"
app:srlTextFailed=
"加載完成"
app:srlTextLoading=
"正在飛速加載中..."
app:srlTextPulling=
"上拉加載更多"
app:srlTextRelease=
"釋放查看下一分類"
app:srlTextSizeTitle=
"@dimen/dp_12"
/>
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</LinearLayout>
</LinearLayout>
...
...
component-supply-chain/src/main/res/layout/item_dishes_foods.xml
View file @
044908ec
...
@@ -30,6 +30,8 @@
...
@@ -30,6 +30,8 @@
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:paddingLeft=
"@dimen/dp_4"
android:paddingRight=
"@dimen/dp_4"
android:textColor=
"@color/color_18"
android:textColor=
"@color/color_18"
tools:text=
"單位"
/>
tools:text=
"單位"
/>
...
@@ -40,14 +42,24 @@
...
@@ -40,14 +42,24 @@
android:layout_marginBottom=
"@dimen/dp_2"
android:layout_marginBottom=
"@dimen/dp_2"
android:background=
"@color/supply_function_color"
/>
android:background=
"@color/supply_function_color"
/>
<TextView
<com.google.android.material.textfield.TextInputEditText
android:id=
"@+id/tv_dishes_count"
android:id=
"@+id/et_dishes_count"
style=
"@style/WareHouse_item_TextStyle"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"
wrap_cont
ent"
android:layout_height=
"
match_par
ent"
android:layout_weight=
"1"
android:layout_weight=
"1"
android:layout_marginLeft=
"@dimen/dp_6"
android:layout_marginRight=
"@dimen/dp_6"
android:layout_marginTop=
"@dimen/dp_4"
android:layout_marginBottom=
"@dimen/dp_4"
android:textColor=
"@color/color_18"
android:textColor=
"@color/color_18"
tools:text=
"數量"
/>
android:background=
"@drawable/shape_border_bg_c8"
android:gravity=
"center"
android:inputType=
"numberDecimal"
android:maxLines=
"1"
android:textColorHighlight=
"@color/theme_color"
android:textCursorDrawable=
"@drawable/cursor_theme"
android:textSize=
"@dimen/dp_15"
tools:text=
"2"
/>
<View
<View
android:layout_width=
"1px"
android:layout_width=
"1px"
...
...
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