Skip to content
项目
Groups
代码片段
帮助
正在加载...
Sign in / Register
Toggle navigation
W
workoffice
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图表
统计图
Create a new issue
作业
提交
议题看板
Open sidebar
冷广德
workoffice
Commits
3d3081fb
提交
3d3081fb
authored
6月 21, 2020
作者:
lgd
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1.修改通用购物车检查数量
上级
f0f366bc
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
136 行增加
和
22 行删除
+136
-22
ProductBean.java
app/src/main/java/com/wd/workoffice/bean/ProductBean.java
+9
-0
ApiService.java
app/src/main/java/com/wd/workoffice/retrofit/ApiService.java
+9
-0
ChooseInfoActivity.java
.../workoffice/ui/activity/bat/store/ChooseInfoActivity.java
+4
-0
StoreSaleCarActivity.java
...orkoffice/ui/activity/bat/store/StoreSaleCarActivity.java
+71
-3
StoreCarAdapter.java
...in/java/com/wd/workoffice/ui/adapter/StoreCarAdapter.java
+16
-9
item_store_car.xml
app/src/main/res/layout/item_store_car.xml
+27
-10
没有找到文件。
app/src/main/java/com/wd/workoffice/bean/ProductBean.java
浏览文件 @
3d3081fb
...
...
@@ -170,6 +170,15 @@ public class ProductBean {
private
double
outerPrice
;
private
double
quantity
;
private
double
innerPrice
;
private
int
flag
;
// 0 未超出,1 超出预警值
public
int
getFlag
()
{
return
flag
;
}
public
void
setFlag
(
int
flag
)
{
this
.
flag
=
flag
;
}
public
double
getInnerPrice
()
{
return
innerPrice
;
...
...
app/src/main/java/com/wd/workoffice/retrofit/ApiService.java
浏览文件 @
3d3081fb
...
...
@@ -1991,4 +1991,13 @@ public interface ApiService {
@PUT
(
"/returnApply/po/audit/group/{applyId}"
)
Observable
<
BaseBean
>
endPoCheck
(
@Path
(
"applyId"
)
String
applyId
,
@Body
RequestBody
requestBody
);
/**
* 下单或审核前预检(产品列表)安全库存数量是否超出
*
* @return
*/
@POST
(
"/stock-quantity/dept-product/startOrderProductsCountCheck"
)
Observable
<
BaseBean
>
proNumCheck
(
@Body
RequestBody
requestBody
);
}
app/src/main/java/com/wd/workoffice/ui/activity/bat/store/ChooseInfoActivity.java
浏览文件 @
3d3081fb
...
...
@@ -718,6 +718,10 @@ public class ChooseInfoActivity extends WorkToolBarActivity implements BatChoose
toast
(
"请填写销售单价"
);
return
;
}
if
(
TextUtils
.
equals
(
num
.
getNumber
(),
"0"
))
{
toast
(
"请选择数量"
);
return
;
}
addCart
(
data
,
num
.
getNumber
(),
etPrice
.
getText
().
toString
());
addCartDialog
.
dismiss
();
}
...
...
app/src/main/java/com/wd/workoffice/ui/activity/bat/store/StoreSaleCarActivity.java
浏览文件 @
3d3081fb
...
...
@@ -6,17 +6,24 @@ import android.widget.RelativeLayout;
import
android.widget.TextView
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.qmuiteam.qmui.widget.dialog.QMUIDialog
;
import
com.qmuiteam.qmui.widget.dialog.QMUIDialogAction
;
import
com.wd.workoffice.R
;
import
com.wd.workoffice.app.BaseBean
;
import
com.wd.workoffice.app.WorkToolBarActivity
;
import
com.wd.workoffice.bean.ProductBean
;
import
com.wd.workoffice.bean.StockBean
;
import
com.wd.workoffice.bean.event.ModifyCarEvent
;
import
com.wd.workoffice.bean.workEnum.PermissionType
;
import
com.wd.workoffice.retrofit.RtfUtils
;
import
com.wd.workoffice.retrofit.WorkObserver
;
import
com.wd.workoffice.ui.adapter.StoreCarAdapter
;
import
com.wd.workoffice.util.DialogUtils
;
import
com.wd.workoffice.util.MathUtils
;
import
com.wd.workoffice.util.UserKeeper
;
import
com.wd.workoffice.util.WorkUtils
;
import
org.greenrobot.eventbus.EventBus
;
...
...
@@ -24,13 +31,17 @@ import org.greenrobot.eventbus.Subscribe;
import
org.greenrobot.eventbus.ThreadMode
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.RecyclerView
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
import
butterknife.OnClick
;
import
flexible.xd.android_base.network.rtfhttp.Transformer
;
import
io.reactivex.disposables.Disposable
;
/**
* 商店-销售-购物车
...
...
@@ -52,6 +63,7 @@ public class StoreSaleCarActivity extends WorkToolBarActivity {
RecyclerView
rvProduct
;
private
List
<
ProductBean
.
RecordsBean
>
productList
;
private
StoreCarAdapter
productAdapter
;
private
int
warningFlag
;
@Override
protected
void
initView
()
{
...
...
@@ -107,7 +119,7 @@ public class StoreSaleCarActivity extends WorkToolBarActivity {
public
void
onViewClicked
()
{
String
allPrice
=
""
;
for
(
ProductBean
.
RecordsBean
recordsBean
:
productList
)
{
allPrice
=
MathUtils
.
add
(
allPrice
,
MathUtils
.
multiply
(
recordsBean
.
getCarNum
()
,
MathUtils
.
converData
(
recordsBean
.
getInternalPrice
(),
3
)
,
3
),
3
);
allPrice
=
MathUtils
.
add
(
allPrice
,
MathUtils
.
multiply
(
recordsBean
.
getCarNum
()
,
MathUtils
.
converData
(
recordsBean
.
getInternalPrice
(),
3
)
,
3
),
3
);
}
if
(
productList
.
size
()
==
0
)
{
toast
(
"购物车里没有产品哦"
);
...
...
@@ -119,7 +131,7 @@ public class StoreSaleCarActivity extends WorkToolBarActivity {
"subProcessId"
,
getIntent
().
getStringExtra
(
"subProcessId"
),
"inStockId"
,
getIntent
().
getStringExtra
(
"inStockId"
),
"intoStore"
,
getIntent
().
getStringExtra
(
"intoStore"
),
"outerStore"
,
getIntent
().
getStringExtra
(
"outerStore"
),
"outerStore"
,
getIntent
().
getStringExtra
(
"outerStore"
),
"customerId"
,
getIntent
().
getStringExtra
(
"customerId"
),
"receiveDeptId"
,
getIntent
().
getStringExtra
(
"receiveDeptId"
),
"code"
,
getIntent
().
getStringExtra
(
"code"
),
...
...
@@ -147,8 +159,64 @@ public class StoreSaleCarActivity extends WorkToolBarActivity {
tvNum
.
setText
(
"共 "
.
concat
(
productList
.
size
()
+
""
).
concat
(
" 件"
));
String
allPrice
=
""
;
for
(
ProductBean
.
RecordsBean
recordsBean
:
productList
)
{
allPrice
=
MathUtils
.
add
(
allPrice
,
MathUtils
.
multiply
(
recordsBean
.
getCarNum
(),
MathUtils
.
converData
(
recordsBean
.
getInternalPrice
(),
3
),
3
),
3
);
allPrice
=
MathUtils
.
add
(
allPrice
,
MathUtils
.
multiply
(
recordsBean
.
getCarNum
(),
MathUtils
.
converData
(
recordsBean
.
getInternalPrice
(),
3
),
3
),
3
);
}
tvPrice
.
setText
(
"总计: ¥ "
.
concat
(
allPrice
));
checkNum
();
}
/**
* 检查库存预警
*/
private
void
checkNum
()
{
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
param
.
put
(
"launchDeptId"
,
UserKeeper
.
getInstance
().
getUserDepId
());
List
<
JSONObject
>
proList
=
new
ArrayList
<>();
for
(
ProductBean
.
RecordsBean
proBean
:
productList
)
{
JSONObject
data
=
new
JSONObject
();
data
.
put
(
"productId"
,
proBean
.
getId
());
data
.
put
(
"productCount"
,
proBean
.
getCarNum
());
proList
.
add
(
data
);
}
param
.
put
(
"basalOrderItems"
,
proList
);
RtfUtils
.
getRtf
().
proNumCheck
(
WorkUtils
.
convertMapToBody
(
param
)).
compose
(
Transformer
.
schedule
()).
subscribe
(
new
WorkObserver
<
BaseBean
>()
{
@Override
public
void
doOnSubscribe
(
Disposable
d
)
{
}
@Override
public
void
onFail
(
String
errorMsg
)
{
hideLoading
();
toast
(
errorMsg
);
}
@Override
public
void
onSuccess
(
BaseBean
data
)
{
hideLoading
();
if
(
data
.
getCode
()
!=
0
)
{
toast
(
data
.
getMessage
());
return
;
}
JSONArray
warningList
=
JSON
.
parseArray
(
data
.
getData
().
toString
());
for
(
ProductBean
.
RecordsBean
pro
:
productList
)
{
pro
.
setFlag
(
0
);
}
if
(
warningList
.
size
()
>
0
)
{
warningFlag
=
1
;
for
(
int
i
=
0
;
i
<
warningList
.
size
();
i
++)
{
JSONObject
proWarning
=
warningList
.
getJSONObject
(
i
);
Integer
productId
=
proWarning
.
getInteger
(
"productId"
);
for
(
ProductBean
.
RecordsBean
pro
:
productList
)
{
if
(
pro
.
getId
()
==
productId
)
{
pro
.
setFlag
(
1
);
}
}
}
}
else
{
warningFlag
=
0
;
}
productAdapter
.
notifyDataSetChanged
();
}
});
}
}
app/src/main/java/com/wd/workoffice/ui/adapter/StoreCarAdapter.java
浏览文件 @
3d3081fb
...
...
@@ -48,6 +48,7 @@ public class StoreCarAdapter extends BaseQuickAdapter<ProductBean.RecordsBean, B
helper
.
setText
(
R
.
id
.
tv_price
,
"¥"
.
concat
(
MathUtils
.
converData
(
item
.
getInternalPrice
(),
3
)));
helper
.
setText
(
R
.
id
.
tv_unit
,
MathUtils
.
converData
(
item
.
getWeight
(),
3
).
concat
(
"吨"
));
helper
.
setText
(
R
.
id
.
tv_all_price
,
MathUtils
.
multiply
(
item
.
getCarNum
(),
MathUtils
.
converData
(
item
.
getInternalPrice
(),
3
),
3
));
helper
.
setGone
(
R
.
id
.
tv_desc
,
item
.
getFlag
()==
1
);
if
(
type
==
1
)
{
helper
.
addOnClickListener
(
R
.
id
.
rl_choose_dep
);
helper
.
addOnClickListener
(
R
.
id
.
rl_upload
);
...
...
@@ -63,9 +64,11 @@ public class StoreCarAdapter extends BaseQuickAdapter<ProductBean.RecordsBean, B
num
.
setOnNumberChangedListener
(
new
AddAndReduceView
.
OnNumberChangedListener
()
{
@Override
public
void
OnNumberChanged
(
String
vs
)
{
item
.
setCarNum
(
vs
);
helper
.
setText
(
R
.
id
.
tv_all_price
,
MathUtils
.
multiply
(
vs
,
MathUtils
.
converData
(
item
.
getInternalPrice
(),
3
),
3
));
EventBus
.
getDefault
().
post
(
new
ModifyCarEvent
(
JSON
.
toJSONString
(
getData
())));
if
(!
TextUtils
.
equals
(
vs
,
item
.
getCarNum
())){
item
.
setCarNum
(
vs
);
helper
.
setText
(
R
.
id
.
tv_all_price
,
MathUtils
.
multiply
(
vs
,
MathUtils
.
converData
(
item
.
getInternalPrice
(),
3
),
3
));
EventBus
.
getDefault
().
post
(
new
ModifyCarEvent
(
JSON
.
toJSONString
(
getData
())));
}
}
});
EditText
etPrice
=
helper
.
getView
(
R
.
id
.
et_price
);
...
...
@@ -77,9 +80,11 @@ public class StoreCarAdapter extends BaseQuickAdapter<ProductBean.RecordsBean, B
num
.
setOnNumberChangedListener
(
new
AddAndReduceView
.
OnNumberChangedListener
()
{
@Override
public
void
OnNumberChanged
(
String
vs
)
{
item
.
setCarNum
(
vs
);
helper
.
setText
(
R
.
id
.
tv_all_price
,
MathUtils
.
multiply
(
vs
,
MathUtils
.
converData
(
item
.
getInternalPrice
(),
3
),
3
));
EventBus
.
getDefault
().
post
(
new
ModifyCarEvent
(
JSON
.
toJSONString
(
getData
())));
if
(!
TextUtils
.
equals
(
vs
,
item
.
getCarNum
())){
item
.
setCarNum
(
vs
);
helper
.
setText
(
R
.
id
.
tv_all_price
,
MathUtils
.
multiply
(
vs
,
MathUtils
.
converData
(
item
.
getInternalPrice
(),
3
),
3
));
EventBus
.
getDefault
().
post
(
new
ModifyCarEvent
(
JSON
.
toJSONString
(
getData
())));
}
}
});
EditText
etPrice
=
helper
.
getView
(
R
.
id
.
et_price
);
...
...
@@ -102,9 +107,11 @@ public class StoreCarAdapter extends BaseQuickAdapter<ProductBean.RecordsBean, B
ToastUtil
.
showShort
(
"请输入销售单价"
);
return
;
}
item
.
setCarPrice
(
s
.
toString
());
helper
.
setText
(
R
.
id
.
tv_all_price
,
MathUtils
.
multiply
(
item
.
getCarNum
(),
MathUtils
.
converData
(
item
.
getInternalPrice
(),
3
),
3
));
EventBus
.
getDefault
().
post
(
new
ModifyCarEvent
(
JSON
.
toJSONString
(
getData
())));
if
(!
TextUtils
.
equals
(
s
.
toString
(),
item
.
getCarPrice
())){
item
.
setCarPrice
(
s
.
toString
());
helper
.
setText
(
R
.
id
.
tv_all_price
,
MathUtils
.
multiply
(
item
.
getCarNum
(),
MathUtils
.
converData
(
item
.
getInternalPrice
(),
3
),
3
));
EventBus
.
getDefault
().
post
(
new
ModifyCarEvent
(
JSON
.
toJSONString
(
getData
())));
}
}
});
num
.
setNumber
(
item
.
getCarNum
());
...
...
app/src/main/res/layout/item_store_car.xml
浏览文件 @
3d3081fb
...
...
@@ -209,24 +209,40 @@
android:layout_marginLeft=
"10mm"
/>
</LinearLayout>
<
Linear
Layout
android:layout_width=
"
wrap_cont
ent"
<
Relative
Layout
android:layout_width=
"
match_par
ent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"right"
android:layout_marginTop=
"30mm"
>
<TextView
android:id=
"@+id/tv_desc"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"小计: ¥ "
android:text=
"下单数量超出预警值"
android:visibility=
"gone"
android:textColor=
"@color/red"
android:textSize=
"12sp"
/>
<TextView
android:id=
"@+id/tv_all_price"
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"2300.00"
android:textSize=
"14sp"
android:textStyle=
"bold"
/>
</LinearLayout>
android:layout_alignParentRight=
"true"
android:layout_gravity=
"right"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"小计: ¥ "
android:textSize=
"12sp"
/>
<TextView
android:id=
"@+id/tv_all_price"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"2300.00"
android:textSize=
"14sp"
android:textStyle=
"bold"
/>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论