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
e48f6fae
Commit
e48f6fae
authored
Apr 13, 2024
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2024-04-12 设备管理功能开发
parent
44e13d25
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
118 additions
and
8 deletions
+118
-8
ServiceHPSB003.java
.../java/com/baosight/hpjx/hp/sb/service/ServiceHPSB003.java
+43
-5
HPSB003.xml
src/main/java/com/baosight/hpjx/hp/sb/sql/HPSB003.xml
+4
-1
HPSB003.js
src/main/webapp/HP/SB/HPSB003.js
+71
-2
No files found.
src/main/java/com/baosight/hpjx/hp/sb/service/ServiceHPSB003.java
View file @
e48f6fae
...
@@ -5,11 +5,10 @@ import com.baosight.hpjx.common.DdynamicEnum;
...
@@ -5,11 +5,10 @@ import com.baosight.hpjx.common.DdynamicEnum;
import
com.baosight.hpjx.core.constant.CommonConstant
;
import
com.baosight.hpjx.core.constant.CommonConstant
;
import
com.baosight.hpjx.core.dao.DaoUtils
;
import
com.baosight.hpjx.core.dao.DaoUtils
;
import
com.baosight.hpjx.core.security.UserSessionUtils
;
import
com.baosight.hpjx.core.security.UserSessionUtils
;
import
com.baosight.hpjx.hp.constant.HPConstant
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ002
;
import
com.baosight.hpjx.hp.sb.domain.HPSB003
;
import
com.baosight.hpjx.hp.sb.domain.HPSB003
;
import
com.baosight.hpjx.util.AssertUtils
;
import
com.baosight.hpjx.util.*
;
import
com.baosight.hpjx.util.CommonMethod
;
import
com.baosight.hpjx.util.ErrorCodeUtils
;
import
com.baosight.hpjx.util.StringUtil
;
import
com.baosight.hpjx.util.contants.ACConstants
;
import
com.baosight.hpjx.util.contants.ACConstants
;
import
com.baosight.iplat4j.core.ei.EiBlock
;
import
com.baosight.iplat4j.core.ei.EiBlock
;
import
com.baosight.iplat4j.core.ei.EiConstant
;
import
com.baosight.iplat4j.core.ei.EiConstant
;
...
@@ -17,6 +16,7 @@ import com.baosight.iplat4j.core.ei.EiInfo;
...
@@ -17,6 +16,7 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import
com.baosight.iplat4j.core.exception.PlatException
;
import
com.baosight.iplat4j.core.exception.PlatException
;
import
com.baosight.iplat4j.core.resource.I18nMessages
;
import
com.baosight.iplat4j.core.resource.I18nMessages
;
import
com.baosight.iplat4j.core.service.impl.ServiceEPBase
;
import
com.baosight.iplat4j.core.service.impl.ServiceEPBase
;
import
com.baosight.iplat4j.ed.util.SequenceGenerator
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -126,6 +126,44 @@ public class ServiceHPSB003 extends ServiceEPBase {
...
@@ -126,6 +126,44 @@ public class ServiceHPSB003 extends ServiceEPBase {
return
inInfo
;
return
inInfo
;
}
}
@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
++)
{
HPSB003
hpsb003
=
new
HPSB003
();
hpsb003
.
fromMap
(
resultRows
.
get
(
i
));
if
(
hpsb003
.
getId
()
==
null
||
hpsb003
.
getId
()
==
0
)
{
this
.
add
(
hpsb003
);
}
else
{
this
.
modify
(
hpsb003
);
}
}
inInfo
=
this
.
query
(
inInfo
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
inInfo
.
setMsg
(
"操作成功!本次对["
+
resultRows
.
size
()
+
"]条数据保存成功!"
);
}
catch
(
Exception
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"保存失败"
);
}
return
inInfo
;
}
/**
* 新增操作
*/
public
void
add
(
HPSB003
hpsb003
)
{
queryDeviceCode
(
hpsb003
);
DaoUtils
.
insert
(
HPSB003
.
INSERT
,
hpsb003
);
}
/**
* 修改操作
*/
public
void
modify
(
HPSB003
hpsb003
)
{
DaoUtils
.
update
(
HPSB003
.
UPDATE
,
hpsb003
);
}
@OperationLogAnnotation
(
operModul
=
"设备管理"
,
operType
=
"新增"
,
operDesc
=
"新增操作"
)
@OperationLogAnnotation
(
operModul
=
"设备管理"
,
operType
=
"新增"
,
operDesc
=
"新增操作"
)
@Override
@Override
public
EiInfo
insert
(
EiInfo
inInfo
)
{
public
EiInfo
insert
(
EiInfo
inInfo
)
{
...
@@ -168,7 +206,7 @@ public class ServiceHPSB003 extends ServiceEPBase {
...
@@ -168,7 +206,7 @@ public class ServiceHPSB003 extends ServiceEPBase {
public
void
queryDeviceCode
(
HPSB003
hpsb001
){
public
void
queryDeviceCode
(
HPSB003
hpsb001
){
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
HPSB003
.
FIELD_FACTORY_CODE
,
hpsb001
.
getFactoryCode
());
map
.
put
(
HPSB003
.
FIELD_FACTORY_CODE
,
hpsb001
.
getFactoryCode
());
map
.
put
(
HPSB003
.
FIELD_DEVICE_CODE
,
hpsb001
.
getDeviceCode
());
map
.
put
(
"deviceCodeStr"
,
hpsb001
.
getDeviceCode
());
map
.
put
(
HPSB003
.
FIELD_DELETE_FLAG
,
hpsb001
.
getDeleteFlag
());
map
.
put
(
HPSB003
.
FIELD_DELETE_FLAG
,
hpsb001
.
getDeleteFlag
());
List
<
HPSB003
>
hpsb003List
=
this
.
dao
.
query
(
HPSB003
.
QUERY
,
map
);
List
<
HPSB003
>
hpsb003List
=
this
.
dao
.
query
(
HPSB003
.
QUERY
,
map
);
AssertUtils
.
isNotEmpty
(
hpsb003List
,
String
.
format
(
"设备编码[%s]在当前工厂已存在,添加失败"
,
map
.
get
(
HPSB003
.
FIELD_DEVICE_CODE
)));
AssertUtils
.
isNotEmpty
(
hpsb003List
,
String
.
format
(
"设备编码[%s]在当前工厂已存在,添加失败"
,
map
.
get
(
HPSB003
.
FIELD_DEVICE_CODE
)));
...
...
src/main/java/com/baosight/hpjx/hp/sb/sql/HPSB003.xml
View file @
e48f6fae
...
@@ -69,6 +69,9 @@
...
@@ -69,6 +69,9 @@
<isNotEmpty
prepend=
" AND "
property=
"deviceStatus"
>
<isNotEmpty
prepend=
" AND "
property=
"deviceStatus"
>
DEVICE_STATUS = #deviceStatus#
DEVICE_STATUS = #deviceStatus#
</isNotEmpty>
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"deviceCodeStr"
>
DEVICE_CODE = #deviceCodeStr#
</isNotEmpty>
</sql>
</sql>
<!--根据companyCode获取用户绑定的组织的工厂编码-->
<!--根据companyCode获取用户绑定的组织的工厂编码-->
...
@@ -275,7 +278,7 @@
...
@@ -275,7 +278,7 @@
FACTORY_CODE as "factoryCode",
FACTORY_CODE as "factoryCode",
FACTORY_NAME as "factoryName"
FACTORY_NAME as "factoryName"
FROM ${platSchema}.txsog01
FROM ${platSchema}.txsog01
WHERE IS_DELETED = '0'
WHERE IS_DELETED = '0'
AND FACTORY_CODE IS NOT NULL
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
COMPANY_CODE = #companyCode#
COMPANY_CODE = #companyCode#
<!--and ORG_ID IN (<include refid="queryLoginNameBase"/>)-->
<!--and ORG_ID IN (<include refid="queryLoginNameBase"/>)-->
...
...
src/main/webapp/HP/SB/HPSB003.js
View file @
e48f6fae
...
@@ -131,8 +131,8 @@ $(function () {
...
@@ -131,8 +131,8 @@ $(function () {
},
},
onSave
:
function
(
e
)
{
onSave
:
function
(
e
)
{
// 阻止默认请求,使用自定义保存
// 阻止默认请求,使用自定义保存
//
e.preventDefault();
e
.
preventDefault
();
//saveFunc
();
save
();
},
},
onDelete
:
function
(
e
)
{
onDelete
:
function
(
e
)
{
// 阻止默认请求,使用自定义删除
// 阻止默认请求,使用自定义删除
...
@@ -203,6 +203,75 @@ let query = function () {
...
@@ -203,6 +203,75 @@ let query = function () {
resultGrid
.
dataSource
.
page
(
1
);
resultGrid
.
dataSource
.
page
(
1
);
}
}
/**
* 保存
*/
let
save
=
function
()
{
let
rows
=
resultGrid
.
getCheckedRows
();
if
(
rows
.
length
<
1
)
{
message
(
"请选择数据"
);
return
;
}
let
flag
=
true
;
$
.
each
(
rows
,
function
(
index
,
item
)
{
let
factoryCode
=
item
.
get
(
"factoryCode"
);
let
groupCode
=
item
.
get
(
"groupCode"
);
let
deviceType
=
item
.
get
(
"deviceType"
);
let
deviceCode
=
item
.
get
(
"deviceCode"
);
let
deviceName
=
item
.
get
(
"deviceName"
);
let
deviceModel
=
item
.
get
(
"deviceModel"
);
let
purchaseDate
=
item
.
get
(
"purchaseDate"
);
let
deviceUserId
=
item
.
get
(
"deviceUserId"
);
if
(
isBlank
(
factoryCode
)){
message
(
"选中的第"
+
(
index
+
1
)
+
"行
\"
工厂
\"
,不能为空!"
);
flag
=
false
;
return
false
;
}
if
(
isBlank
(
groupCode
)){
message
(
"选中的第"
+
(
index
+
1
)
+
"行
\"
设备区域
\"
,不能为空!"
);
flag
=
false
;
return
false
;
}
if
(
isBlank
(
deviceType
)){
message
(
"选中的第"
+
(
index
+
1
)
+
"行
\"
设备类型
\"
,不能为空!"
);
flag
=
false
;
return
false
;
}
if
(
isBlank
(
deviceCode
)){
message
(
"选中的第"
+
(
index
+
1
)
+
"行
\"
设备编码
\"
,不能为空!"
);
flag
=
false
;
return
false
;
}
if
(
isBlank
(
deviceName
)){
message
(
"选中的第"
+
(
index
+
1
)
+
"行
\"
设备名称
\"
,不能为空!"
);
flag
=
false
;
return
false
;
}
if
(
isBlank
(
deviceModel
)){
message
(
"选中的第"
+
(
index
+
1
)
+
"行
\"
设备型号
\"
,不能为空!"
);
flag
=
false
;
return
false
;
}
if
(
isBlank
(
purchaseDate
)){
message
(
"选中的第"
+
(
index
+
1
)
+
"行
\"
购置日期
\"
,不能为空!"
);
flag
=
false
;
return
false
;
}
if
(
isBlank
(
deviceUserId
)){
message
(
"选中的第"
+
(
index
+
1
)
+
"行
\"
设备负责人
\"
,不能为空!"
);
flag
=
false
;
return
false
;
}
});
if
(
flag
)
{
JSUtils
.
confirm
(
"确定对勾选中的["
+
rows
.
length
+
"]条数据做
\"
保存
\"
操作? "
,
{
ok
:
function
()
{
JSUtils
.
submitGridsData
(
"result"
,
"HPSB003"
,
"save"
,
true
);
}
});
}
}
function
updateStatus
(
id
,
deviceStatus
)
{
function
updateStatus
(
id
,
deviceStatus
)
{
let
inEiInfo
=
new
EiInfo
();
let
inEiInfo
=
new
EiInfo
();
inEiInfo
.
set
(
"result-0-id"
,
id
);
inEiInfo
.
set
(
"result-0-id"
,
id
);
...
...
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