Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
wios
概览
Overview
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
苗卫卫
wios
Commits
e341389e
提交
e341389e
authored
1 年前
作者:
李超杰
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
辅材发货单导入
父级
976a708b
全部展开
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
43 行增加
和
56 行删除
+43
-56
src/main/java/com/starcharge/wios/Import/impl/AuxiliaryMaterialDeliveryImport.java
+22
-38
src/main/java/com/starcharge/wios/Import/impl/AuxiliarymaterialsCheckImport.java
+21
-18
src/main/java/com/starcharge/wios/controller/DeliveryController.java
+0
-0
src/main/resources/static/templates/辅材发货单导入模板.xls
+0
-0
没有找到文件。
src/main/java/com/starcharge/wios/Import/impl/AuxiliaryMaterialDeliveryImport.java
查看文件 @
e341389e
package
com
.
starcharge
.
wios
.
Import
.
impl
;
import
com.starcharge.wios.Import.Import
;
import
com.starcharge.wios.dao.entity.Order
;
import
com.starcharge.wios.dao.entity.Tauxiliarymaterials
;
import
com.starcharge.wios.dao.mappers.OrderMapper
;
import
com.starcharge.wios.dao.mappers.TauxiliarymaterialsMapper
;
import
com.starcharge.wios.enums2.ProductType
;
import
com.starcharge.wios.enums2.TauxiliarymaterialStatusEnum
;
import
com.starcharge.wios.validation.CreateEntityGroup
;
import
com.starcharge.wios.vo.DeliveryAddVo
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -42,55 +39,42 @@ public class AuxiliaryMaterialDeliveryImport implements Import {
@Override
public
List
<?>
handle
(
List
<
Object
>
list
)
{
// List<String> headList = (List<String>)list.get(0);
for
(
int
i
=
1
;
i
<
list
.
size
();
i
++){
List
<
String
>
rowdata
=
(
List
<
String
>)
list
.
get
(
i
);
DeliveryAddVo
deliveryAddVo
=
new
DeliveryAddVo
();
for
(
int
i
=
1
;
i
<
list
.
size
();
i
++)
{
StringBuilder
error
=
new
StringBuilder
();
List
<
String
>
rowdata
=
(
List
<
String
>)
list
.
get
(
i
);
DeliveryAddVo
deliveryAddVo
=
new
DeliveryAddVo
();
deliveryAddVo
.
setInstallOrder
(
rowdata
.
get
(
0
));
deliveryAddVo
.
setLogisticOrder
(
rowdata
.
get
(
1
));
try
{
deliveryAddVo
.
setQuantity
(
Integer
.
parseInt
(
rowdata
.
get
(
2
)));
}
catch
(
Exception
e
)
{
rowdata
.
ad
d
(
"error:发货数量必填且为整数"
);
}
catch
(
Exception
e
)
{
error
.
appen
d
(
"error:发货数量必填且为整数"
);
}
// deliveryAddVo.setMaterialCode(rowdata.get(1));
// deliveryAddVo.setMaterialName(rowdata.get(2));
// deliveryAddVo.setMaterialCompany(rowdata.get(3));
// deliveryAddVo.setLogisticOrder(rowdata.get(4));
// deliveryAddVo.setTeam(rowdata.get(5));
Set
<
ConstraintViolation
<
DeliveryAddVo
>>
sets
=
validator
.
validate
(
deliveryAddVo
,
AuxiliaryMaterialDeliveryImport
.
AuxiliaryBatchCreateEntityGroup
.
class
);
if
(!
sets
.
isEmpty
()){
rowdata
.
add
(
sets
.
stream
().
map
(
ConstraintViolation:
:
getMessage
).
reduce
(
"error:"
,(
s1
,
s2
)->
s1
+
";"
+
s2
));
continue
;
if
(!
sets
.
isEmpty
())
{
error
.
append
(
sets
.
stream
().
map
(
ConstraintViolation:
:
getMessage
).
reduce
(
"error:"
,
(
s1
,
s2
)
->
s1
+
";"
+
s2
));
}
Tauxiliarymaterials
tauxiliarymaterialsquery
=
new
Tauxiliarymaterials
();
Tauxiliarymaterials
tauxiliarymaterialsquery
=
new
Tauxiliarymaterials
();
tauxiliarymaterialsquery
.
setApplyOrder
(
deliveryAddVo
.
getInstallOrder
());
tauxiliarymaterialsquery
.
setApplyStatus
(
TauxiliarymaterialStatusEnum
.
已通过
.
name
());
List
<
Tauxiliarymaterials
>
tauxiliarymaterials
=
this
.
tauxiliarymaterialsMapper
.
selectTAuxiliaryMaterialsList
(
tauxiliarymaterialsquery
);
if
(
CollectionUtils
.
isEmpty
(
tauxiliarymaterials
)){
rowdata
.
add
(
"error:找不到已审批通过辅材申请单"
);
continue
;
}
Tauxiliarymaterials
tauxiliarymaterial
=
tauxiliarymaterials
.
stream
().
filter
(
t
->
TauxiliarymaterialStatusEnum
.
未发货
.
name
().
equals
(
t
.
getLogisticStatus
())).
findFirst
().
orElse
(
null
);
if
(
tauxiliarymaterial
==
null
){
rowdata
.
add
(
""
);
rowdata
.
add
(
""
);
rowdata
.
add
(
""
);
rowdata
.
add
(
"error:找不到已审批且未发货的辅材申请单"
);
}
else
{
rowdata
.
add
(
tauxiliarymaterial
.
getMaterialCode
());
rowdata
.
add
(
tauxiliarymaterial
.
getMaterialName
());
rowdata
.
add
(
tauxiliarymaterial
.
getApprovedQuantity
());
if
(!
StringUtils
.
hasLength
(
tauxiliarymaterial
.
getApprovedQuantity
())){
List
<
Tauxiliarymaterials
>
tauxiliarymaterials
=
this
.
tauxiliarymaterialsMapper
.
selectTAuxiliaryMaterialsList
(
tauxiliarymaterialsquery
);
if
(
CollectionUtils
.
isEmpty
(
tauxiliarymaterials
))
{
error
.
append
(
"error:找不到已审批通过辅材申请单"
);
}
else
{
Tauxiliarymaterials
tauxiliarymaterial
=
tauxiliarymaterials
.
stream
().
filter
(
t
->
TauxiliarymaterialStatusEnum
.
未发货
.
name
().
equals
(
t
.
getLogisticStatus
())).
findFirst
().
orElse
(
null
);
if
(
tauxiliarymaterial
==
null
)
{
error
.
append
(
"error:找不到已审批且未发货的辅材申请单"
);
}
else
{
if
(!
StringUtils
.
hasLength
(
tauxiliarymaterial
.
getApprovedQuantity
()))
{
tauxiliarymaterial
.
setApprovedQuantity
(
"0"
);
}
if
(
deliveryAddVo
.
getQuantity
()>
Float
.
parseFloat
(
tauxiliarymaterial
.
getApprovedQuantity
()))
{
rowdata
.
ad
d
(
"error:发货数量大于已审批数量"
);
if
(
deliveryAddVo
.
getQuantity
()
>
Integer
.
parseInt
(
tauxiliarymaterial
.
getApprovedQuantity
()))
{
error
.
appen
d
(
"error:发货数量大于已审批数量"
);
}
}
}
rowdata
.
add
(
error
.
toString
());
}
return
list
;
}
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/starcharge/wios/Import/impl/AuxiliarymaterialsCheckImport.java
查看文件 @
e341389e
...
...
@@ -27,42 +27,45 @@ public class AuxiliarymaterialsCheckImport implements Import {
public
List
<?>
handle
(
List
<
Object
>
list
)
{
for
(
int
i
=
1
;
i
<
list
.
size
();
i
++)
{
List
<
String
>
rowdata
=
(
List
<
String
>)
list
.
get
(
i
);
StringBuilder
error
=
new
StringBuilder
();
if
(
rowdata
.
size
()
<
2
||
StringUtils
.
isEmpty
(
rowdata
.
get
(
1
)))
{
rowdata
.
add
(
"error:批准数量不能为空"
);
continue
;
error
.
append
(
"error:批准数量不能为空"
);
}
try
{
Float
.
parseFloat
(
rowdata
.
get
(
1
));
}
catch
(
Exception
e
)
{
rowdata
.
ad
d
(
"error:批准数量必须是数字"
);
continue
;
error
.
appen
d
(
"error:批准数量必须是数字"
);
rowdata
.
add
(
5
,
error
.
toString
())
;
}
String
s
=
rowdata
.
get
(
1
);
rowdata
.
remove
(
1
);
if
(
StringUtils
.
isEmpty
(
rowdata
.
get
(
0
)))
{
rowdata
.
ad
d
(
"error:申请单号不能为空"
);
continue
;
error
.
appen
d
(
"error:申请单号不能为空"
);
rowdata
.
add
(
5
,
error
.
toString
())
;
}
String
materialCode
=
null
;
String
materialName
=
null
;
String
applyQuantity
=
null
;
Tauxiliarymaterials
exist
=
this
.
tauxiliarymaterialsMapper
.
selectByApplyOrder
(
rowdata
.
get
(
0
));
if
(
Objects
.
isNull
(
exist
))
{
rowdata
.
add
(
"error:找不到辅材申请单"
);
continue
;
}
error
.
append
(
"error:找不到辅材申请单"
);
}
else
{
materialCode
=
exist
.
getMaterialCode
();
materialName
=
exist
.
getMaterialName
();
applyQuantity
=
exist
.
getApplyQuantity
();
TauxiliarymaterialStatusEnum
enumByName
=
TauxiliarymaterialStatusEnum
.
getEnumByName
(
0
,
exist
.
getApplyStatus
());
if
(
Objects
.
nonNull
(
enumByName
)
&&
enumByName
.
getValue
()
!=
1
)
{
rowdata
.
add
(
"error:辅材申请单:"
+
exist
.
getApplyOrder
()
+
" 状态必须是已申请"
);
continue
;
error
.
append
(
"error:辅材申请单:"
).
append
(
exist
.
getApplyOrder
()).
append
(
" 状态必须是已申请"
);
}
if
(
Integer
.
parseInt
(
s
)
>
Integer
.
parseInt
(
exist
.
getApplyQuantity
()))
{
rowdata
.
add
(
"error:批准数量不能大于申请数量"
);
continue
;
error
.
append
(
"error:批准数量不能大于申请数量"
);
}
rowdata
.
add
(
exist
.
getMaterialCode
()
);
rowdata
.
add
(
exist
.
getMaterialName
()
);
rowdata
.
add
(
exist
.
getApplyQuantity
()
);
}
rowdata
.
add
(
materialCode
);
rowdata
.
add
(
materialName
);
rowdata
.
add
(
applyQuantity
);
rowdata
.
add
(
s
);
rowdata
.
add
(
error
.
toString
());
}
return
list
;
}
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/starcharge/wios/controller/DeliveryController.java
查看文件 @
e341389e
差异被折叠。
点击展开。
src/main/resources/static/templates/辅材发货单导入模板.xls
查看文件 @
e341389e
No preview for this file type
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论