Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hp-smart
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
platform
hp-smart
Commits
225364ef
Commit
225364ef
authored
Mar 02, 2024
by
wancheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据统计单前端校验优化
parent
66d521f9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
110 additions
and
2 deletions
+110
-2
ServiceHPKC008.java
.../java/com/baosight/hpjx/hp/kc/service/ServiceHPKC008.java
+64
-0
HPKC008.js
src/main/webapp/HP/KC/HPKC008.js
+46
-2
No files found.
src/main/java/com/baosight/hpjx/hp/kc/service/ServiceHPKC008.java
View file @
225364ef
...
...
@@ -7,6 +7,7 @@ import com.baosight.hpjx.core.dao.DaoUtils;
import
com.baosight.hpjx.hp.constant.HPConstant
;
import
com.baosight.hpjx.hp.constant.HPSqlConstant
;
import
com.baosight.hpjx.hp.kc.domain.HPKC008
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ002
;
import
com.baosight.hpjx.hp.pz.tools.HPPZTools
;
import
com.baosight.hpjx.util.CommonMethod
;
import
com.baosight.hpjx.util.EiInfoUtils
;
...
...
@@ -78,6 +79,69 @@ public class ServiceHPKC008 extends ServiceBase {
}
/**
* 保存
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"数据统计单"
,
operType
=
"保存"
,
operDesc
=
"保存"
)
public
EiInfo
save
(
EiInfo
inInfo
)
{
try
{
List
<
Map
>
resultRows
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
// 写入数据
for
(
int
i
=
0
;
i
<
resultRows
.
size
();
i
++)
{
HPKC008
fKc008
=
new
HPKC008
();
fKc008
.
fromMap
(
resultRows
.
get
(
i
));
if
(
fKc008
.
getId
()
==
null
||
fKc008
.
getId
()
==
0
)
{
this
.
add
(
fKc008
);
}
else
{
this
.
modify
(
fKc008
);
}
}
inInfo
=
this
.
query
(
inInfo
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
inInfo
.
setMsg
(
"操作成功!本次对["
+
resultRows
.
size
()
+
"]条数据保存成功!"
);
}
catch
(
Exception
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"保存失败"
);
}
return
inInfo
;
}
/**
* 新增操作
*
* @param fKc008
* @return
*/
public
void
add
(
HPKC008
fKc008
)
{
// 去除日期字符串中的-
fKc008
.
setDateMonth
(
StringUtil
.
removeHorizontalLine
(
fKc008
.
getDateMonth
()));
// 存货名称
fKc008
.
setInventName
(
HPPZTools
.
HpPz004
.
getByCode
(
fKc008
.
getInventCode
()).
getInventName
());
// 计算总金额
fKc008
.
setTotalPrice
(
fKc008
.
getAmount
().
multiply
(
fKc008
.
getPrice
()));
// 生成单据号
fKc008
.
setStatNo
(
SequenceGenerator
.
getNextSequence
(
HPConstant
.
SequenceId
.
HPKC008_NUMBER
));
DaoUtils
.
insert
(
HPKC008
.
INSERT
,
fKc008
);
}
/**
* 修改操作
*
* @param fKc008
* @return
*/
public
void
modify
(
HPKC008
fKc008
)
{
// 去除日期字符串中的-
fKc008
.
setDateMonth
(
StringUtil
.
removeHorizontalLine
(
fKc008
.
getDateMonth
()));
// 存货名称
fKc008
.
setInventName
(
HPPZTools
.
HpPz004
.
getByCode
(
fKc008
.
getInventCode
()).
getInventName
());
// 计算总金额
fKc008
.
setTotalPrice
(
fKc008
.
getAmount
().
multiply
(
fKc008
.
getPrice
()));
DaoUtils
.
update
(
HPKC008
.
UPDATE
,
fKc008
);
}
/**
* 新增操作
*
* @param inInfo
...
...
src/main/webapp/HP/KC/HPKC008.js
View file @
225364ef
...
...
@@ -35,9 +35,13 @@ $(function() {
refreshSelect
(
container
,
inInfo
);
}
}],
onSave
:
function
(
e
)
{
// 阻止后台保存请求,使用自定义保存
e
.
preventDefault
();
save
();
},
onSuccess
:
function
(
e
)
{
if
(
e
.
eiInfo
.
extAttr
.
methodName
==
'update'
||
e
.
eiInfo
.
extAttr
.
methodName
==
'insert'
if
(
e
.
eiInfo
.
extAttr
.
methodName
==
'save'
||
e
.
eiInfo
.
extAttr
.
methodName
==
'delete'
){
query
();
}
...
...
@@ -69,3 +73,42 @@ $(window).load(function () {
let
query
=
function
()
{
resultGrid
.
dataSource
.
page
(
1
);
}
/**
* 保存
*/
let
save
=
function
()
{
let
rows
=
resultGrid
.
getCheckedRows
();
if
(
rows
.
length
<
1
)
{
message
(
"请选择数据"
);
return
;
}
for
(
let
i
=
0
;
i
<
rows
.
length
;
i
++
)
{
if
(
isBlank
(
rows
[
i
][
'dateMonth'
]))
{
message
(
"勾选的第"
+
(
i
+
1
)
+
"行
\"
月份
\"
不能为空"
);
return
;
}
if
(
isBlank
(
rows
[
i
][
'inventCode'
]))
{
message
(
"勾选的第"
+
(
i
+
1
)
+
"行
\"
存货名称
\"
不能为空"
);
return
;
}
if
(
isBlank
(
rows
[
i
][
'unit'
]))
{
message
(
"勾选的第"
+
(
i
+
1
)
+
"行
\"
单位
\"
不能为空"
);
return
;
}
if
(
!
isPositiveInteger
(
rows
[
i
][
'amount'
]))
{
message
(
"勾选的第"
+
(
i
+
1
)
+
"行
\"
数量
\"
必须是大于0的整数"
);
return
;
}
if
(
isBlank
(
rows
[
i
][
'price'
]))
{
message
(
"勾选的第"
+
(
i
+
1
)
+
"行
\"
单价
\"
不能为空"
);
return
;
}
}
JSUtils
.
confirm
(
"确定对勾选中的["
+
rows
.
length
+
"]条数据做
\"
保存
\"
操作? "
,
{
ok
:
function
()
{
JSUtils
.
submitGridsData
(
"result"
,
"HPKC008"
,
"save"
,
true
);
}
});
}
\ 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