Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
9f18f0bc
Commit
9f18f0bc
authored
Dec 10, 2017
by
季圣华
Browse files
增加默认账户的功能
parent
ad74d805
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
sql/jsh_erp.sql
View file @
9f18f0bc
This diff is collapsed.
Click to expand it.
src/main/java/com/jsh/action/basic/AccountAction.java
View file @
9f18f0bc
...
@@ -220,6 +220,41 @@ public class AccountAction extends BaseAction<AccountModel>
...
@@ -220,6 +220,41 @@ public class AccountAction extends BaseAction<AccountModel>
,
tipType
,
"更新结算账户ID为 "
+
model
.
getAccountID
()
+
" "
+
tipMsg
+
"!"
,
"更新结算账户"
+
tipMsg
));
,
tipType
,
"更新结算账户ID为 "
+
model
.
getAccountID
()
+
" "
+
tipMsg
+
"!"
,
"更新结算账户"
+
tipMsg
));
}
}
/**
* 更新结算账户-设置是否默认
* @return
*/
public
void
updateAmountIsDefault
()
{
Boolean
flag
=
false
;
try
{
Account
Account
=
accountService
.
get
(
model
.
getAccountID
());
Account
.
setIsDefault
(
model
.
getIsDefault
());
accountService
.
update
(
Account
);
flag
=
true
;
tipMsg
=
"成功"
;
tipType
=
0
;
}
catch
(
DataAccessException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>>修改结算账户ID为 : "
+
model
.
getAccountID
()
+
"信息失败"
,
e
);
flag
=
false
;
tipMsg
=
"失败"
;
tipType
=
1
;
}
finally
{
try
{
toClient
(
flag
.
toString
());
}
catch
(
IOException
e
)
{
Log
.
errorFileSync
(
">>>>>>>>>>>>修改结算账户回写客户端结果异常"
,
e
);
}
}
//如果改为默认账户时记录日志
if
(
model
.
getIsDefault
())
{
logService
.
create
(
new
Logdetails
(
getUser
(),
"更新默认账户"
,
model
.
getClientIp
(),
new
Timestamp
(
System
.
currentTimeMillis
()),
tipType
,
"更新账户ID"
+
model
.
getAccountID
()
+
"为默认账户"
+
tipMsg
+
"!"
,
"更新默认账户"
+
tipMsg
));
}
}
/**
/**
* 批量删除指定ID结算账户
* 批量删除指定ID结算账户
* @return
* @return
...
@@ -314,6 +349,7 @@ public class AccountAction extends BaseAction<AccountModel>
...
@@ -314,6 +349,7 @@ public class AccountAction extends BaseAction<AccountModel>
Double
currentAmount
=
getAccountSum
(
account
.
getId
(),
""
)
+
getAccountSumByHead
(
account
.
getId
(),
""
)
+
getAccountSumByDetail
(
account
.
getId
(),
""
)
+
getManyAccountSum
(
account
.
getId
(),
""
)
+
account
.
getInitialAmount
();
Double
currentAmount
=
getAccountSum
(
account
.
getId
(),
""
)
+
getAccountSumByHead
(
account
.
getId
(),
""
)
+
getAccountSumByDetail
(
account
.
getId
(),
""
)
+
getManyAccountSum
(
account
.
getId
(),
""
)
+
account
.
getInitialAmount
();
String
currentAmountFmt
=
df
.
format
(
currentAmount
);
String
currentAmountFmt
=
df
.
format
(
currentAmount
);
item
.
put
(
"currentAmount"
,
currentAmountFmt
);
//当前余额
item
.
put
(
"currentAmount"
,
currentAmountFmt
);
//当前余额
item
.
put
(
"isDefault"
,
account
.
getIsDefault
());
//是否默认
item
.
put
(
"remark"
,
account
.
getRemark
());
item
.
put
(
"remark"
,
account
.
getRemark
());
item
.
put
(
"op"
,
1
);
item
.
put
(
"op"
,
1
);
dataArray
.
add
(
item
);
dataArray
.
add
(
item
);
...
...
src/main/java/com/jsh/model/po/Account.java
View file @
9f18f0bc
...
@@ -8,6 +8,7 @@ public class Account implements java.io.Serializable
...
@@ -8,6 +8,7 @@ public class Account implements java.io.Serializable
private
String
SerialNo
;
private
String
SerialNo
;
private
Double
InitialAmount
;
private
Double
InitialAmount
;
private
Double
CurrentAmount
;
private
Double
CurrentAmount
;
private
Boolean
IsDefault
;
private
String
Remark
;
private
String
Remark
;
public
Account
()
public
Account
()
...
@@ -20,11 +21,12 @@ public class Account implements java.io.Serializable
...
@@ -20,11 +21,12 @@ public class Account implements java.io.Serializable
this
.
Id
=
Id
;
this
.
Id
=
Id
;
}
}
public
Account
(
String
name
,
String
serialNo
,
Double
initialAmount
,
Double
currentAmount
,
String
remark
)
{
public
Account
(
String
name
,
String
serialNo
,
Double
initialAmount
,
Double
currentAmount
,
Boolean
isDefault
,
String
remark
)
{
Name
=
name
;
Name
=
name
;
SerialNo
=
serialNo
;
SerialNo
=
serialNo
;
InitialAmount
=
initialAmount
;
InitialAmount
=
initialAmount
;
CurrentAmount
=
currentAmount
;
CurrentAmount
=
currentAmount
;
IsDefault
=
isDefault
;
Remark
=
remark
;
Remark
=
remark
;
}
}
...
@@ -78,6 +80,14 @@ public class Account implements java.io.Serializable
...
@@ -78,6 +80,14 @@ public class Account implements java.io.Serializable
return
CurrentAmount
;
return
CurrentAmount
;
}
}
public
Boolean
getIsDefault
()
{
return
IsDefault
;
}
public
void
setIsDefault
(
Boolean
isDefault
)
{
IsDefault
=
isDefault
;
}
public
void
setRemark
(
String
remark
)
public
void
setRemark
(
String
remark
)
{
{
Remark
=
remark
;
Remark
=
remark
;
...
...
src/main/java/com/jsh/model/vo/basic/AccountModel.java
View file @
9f18f0bc
...
@@ -28,6 +28,11 @@ public class AccountModel implements Serializable
...
@@ -28,6 +28,11 @@ public class AccountModel implements Serializable
*/
*/
private
Double
currentAmount
;
private
Double
currentAmount
;
/**
* 是否设为默认
*/
private
Boolean
isDefault
;
/**
/**
* 备注
* 备注
*/
*/
...
@@ -108,6 +113,14 @@ public class AccountModel implements Serializable
...
@@ -108,6 +113,14 @@ public class AccountModel implements Serializable
return
currentAmount
;
return
currentAmount
;
}
}
public
Boolean
getIsDefault
()
{
return
isDefault
;
}
public
void
setIsDefault
(
Boolean
isDefault
)
{
this
.
isDefault
=
isDefault
;
}
public
void
setRemark
(
String
remark
)
public
void
setRemark
(
String
remark
)
{
{
this
.
remark
=
remark
;
this
.
remark
=
remark
;
...
...
src/main/resources/hibernate/Account.hbm.xml
View file @
9f18f0bc
...
@@ -27,6 +27,11 @@
...
@@ -27,6 +27,11 @@
<comment>
当前余额
</comment>
<comment>
当前余额
</comment>
</column>
</column>
</property>
</property>
<property
generated=
"never"
lazy=
"false"
name=
"IsDefault"
type=
"boolean"
>
<column
length=
"1"
name=
"IsDefault"
>
<comment>
是否设为默认
</comment>
</column>
</property>
<property
generated=
"never"
lazy=
"false"
name=
"Remark"
type=
"java.lang.String"
>
<property
generated=
"never"
lazy=
"false"
name=
"Remark"
type=
"java.lang.String"
>
<column
length=
"100"
name=
"Remark"
>
<column
length=
"100"
name=
"Remark"
>
<comment>
备注
</comment>
<comment>
备注
</comment>
...
...
src/main/webapp/js/pages/materials/in_out.js
View file @
9f18f0bc
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
var
otherColumns
=
true
;
//明细中的‘别名’列是否显示
var
otherColumns
=
true
;
//明细中的‘别名’列是否显示
var
btnEnableList
=
getBtnStr
();
//获取按钮的权限
var
btnEnableList
=
getBtnStr
();
//获取按钮的权限
var
mPropertyList
=
""
;
//商品属性列表
var
mPropertyList
=
""
;
//商品属性列表
var
defaultAccountId
=
0
;
//默认账户id
$
(
function
(){
$
(
function
(){
//初始化系统基础信息
//初始化系统基础信息
getType
();
getType
();
...
@@ -457,6 +458,9 @@
...
@@ -457,6 +458,9 @@
for
(
var
i
=
0
;
i
<
accountList
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
accountList
.
length
;
i
++
)
{
var
account
=
accountList
[
i
];
var
account
=
accountList
[
i
];
options
+=
'
<option value="
'
+
account
.
id
+
'
" data-currentAmount="
'
+
account
.
currentAmount
+
'
">
'
+
account
.
name
+
'
</option>
'
;
options
+=
'
<option value="
'
+
account
.
id
+
'
" data-currentAmount="
'
+
account
.
currentAmount
+
'
">
'
+
account
.
name
+
'
</option>
'
;
if
(
account
.
isDefault
)
{
defaultAccountId
=
account
.
id
;
//给账户赋值默认id
}
}
}
$
(
"
#AccountId
"
).
empty
().
append
(
options
);
$
(
"
#AccountId
"
).
empty
().
append
(
options
);
}
}
...
@@ -1559,6 +1563,7 @@
...
@@ -1559,6 +1563,7 @@
$
(
"
#DiscountLastMoney
"
).
val
(
0
);
$
(
"
#DiscountLastMoney
"
).
val
(
0
);
$
(
"
#ChangeAmount
"
).
val
(
0
);
$
(
"
#ChangeAmount
"
).
val
(
0
);
$
(
"
#Debt
"
).
val
(
0
);
$
(
"
#Debt
"
).
val
(
0
);
$
(
"
#AccountId
"
).
val
(
defaultAccountId
);
//初始化默认的账户Id
var
addTitle
=
listTitle
.
replace
(
"
列表
"
,
"
信息
"
);
var
addTitle
=
listTitle
.
replace
(
"
列表
"
,
"
信息
"
);
$
(
'
#depotHeadDlg
'
).
dialog
(
'
open
'
).
dialog
(
'
setTitle
'
,
'
<img src="
'
+
path
+
'
/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加
'
+
addTitle
);
$
(
'
#depotHeadDlg
'
).
dialog
(
'
open
'
).
dialog
(
'
setTitle
'
,
'
<img src="
'
+
path
+
'
/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加
'
+
addTitle
);
$
(
"
.window-mask
"
).
css
({
width
:
webW
,
height
:
webH
});
$
(
"
.window-mask
"
).
css
({
width
:
webW
,
height
:
webH
});
...
...
src/main/webapp/pages/manage/account.jsp
View file @
9f18f0bc
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
<%@ page
language=
"java"
import=
"java.util.*"
pageEncoding=
"utf-8"
%>
<%@ page
language=
"java"
import=
"java.util.*"
pageEncoding=
"utf-8"
%>
<%
<%
String
path
=
request
.
getContextPath
();
String
path
=
request
.
getContextPath
();
String
basePath
=
request
.
getScheme
()+
"://"
+
request
.
getServerName
()+
":"
+
request
.
getServerPort
()+
path
+
"/"
;
String
clientIp
=
Tools
.
getLocalIp
(
request
);
String
clientIp
=
Tools
.
getLocalIp
(
request
);
%>
%>
<!DOCTYPE html>
<!DOCTYPE html>
...
@@ -101,9 +100,6 @@
...
@@ -101,9 +100,6 @@
//初始化表格数据
//初始化表格数据
function
initTableData
(){
function
initTableData
(){
$
(
'
#tableData
'
).
datagrid
({
$
(
'
#tableData
'
).
datagrid
({
//title:'结算账户',
//iconCls:'icon-save',
//width:700,
height
:
heightInfo
,
height
:
heightInfo
,
nowrap
:
false
,
nowrap
:
false
,
rownumbers
:
false
,
rownumbers
:
false
,
...
@@ -112,17 +108,10 @@
...
@@ -112,17 +108,10 @@
//选中单行
//选中单行
singleSelect
:
true
,
singleSelect
:
true
,
collapsible
:
false
,
collapsible
:
false
,
selectOnCheck
:
false
,
//fitColumns:true,
//单击行是否选中
checkOnSelect
:
false
,
//交替出现背景
//交替出现背景
striped
:
true
,
striped
:
true
,
url
:
'
<%=
path
%>
/account/findBy.action?pageSize=
'
+
initPageSize
,
url
:
'
<%=
path
%>
/account/findBy.action?pageSize=
'
+
initPageSize
,
pagination
:
true
,
pagination
:
true
,
//自动截取数据
//nowrap : true,
//loadFilter: pagerFilter,
pageSize
:
initPageSize
,
pageSize
:
initPageSize
,
pageList
:
initPageNum
,
pageList
:
initPageNum
,
columns
:[[
columns
:[[
...
@@ -131,6 +120,16 @@
...
@@ -131,6 +120,16 @@
{
title
:
'
编号
'
,
field
:
'
serialNo
'
,
width
:
150
,
align
:
"
center
"
},
{
title
:
'
编号
'
,
field
:
'
serialNo
'
,
width
:
150
,
align
:
"
center
"
},
{
title
:
'
期初金额
'
,
field
:
'
initialAmount
'
,
width
:
100
,
align
:
"
center
"
},
{
title
:
'
期初金额
'
,
field
:
'
initialAmount
'
,
width
:
100
,
align
:
"
center
"
},
{
title
:
'
当前余额
'
,
field
:
'
currentAmount
'
,
width
:
100
,
align
:
"
center
"
},
{
title
:
'
当前余额
'
,
field
:
'
currentAmount
'
,
width
:
100
,
align
:
"
center
"
},
{
title
:
'
是否默认
'
,
field
:
'
isDefault
'
,
width
:
100
,
align
:
"
center
"
,
formatter
:
function
(
value
,
rec
){
if
(
rec
.
isDefault
)
{
return
"
<b style='color:green'>是</b>
"
;
}
else
{
return
"
否
"
;
}
}
},
{
title
:
'
备注
'
,
field
:
'
remark
'
,
width
:
100
},
{
title
:
'
备注
'
,
field
:
'
remark
'
,
width
:
100
},
{
title
:
'
操作
'
,
field
:
'
op
'
,
align
:
"
center
"
,
width
:
180
,
formatter
:
function
(
value
,
rec
)
{
title
:
'
操作
'
,
field
:
'
op
'
,
align
:
"
center
"
,
width
:
180
,
formatter
:
function
(
value
,
rec
)
{
{
...
@@ -164,6 +163,15 @@
...
@@ -164,6 +163,15 @@
{
{
batDeleteAccount
();
batDeleteAccount
();
}
}
},
{
id
:
'
setAccountIsDefault
'
,
text
:
'
设为默认
'
,
iconCls
:
'
icon-ok
'
,
handler
:
function
()
{
setAccountIsDefault
();
}
}
}
],
],
onLoadError
:
function
()
onLoadError
:
function
()
...
@@ -333,6 +341,60 @@
...
@@ -333,6 +341,60 @@
accountID
=
0
;
accountID
=
0
;
url
=
'
<%=
path
%>
/account/create.action
'
;
url
=
'
<%=
path
%>
/account/create.action
'
;
}
}
//设为默认操作事件
function
setAccountIsDefault
(){
var
allRow
=
$
(
'
#tableData
'
).
datagrid
(
'
getRows
'
);
var
row
=
$
(
'
#tableData
'
).
datagrid
(
'
getChecked
'
);
if
(
row
.
length
==
0
)
{
$
.
messager
.
alert
(
'
设置提示
'
,
'
没有记录被选中!
'
,
'
info
'
);
return
;
}
if
(
row
.
length
>
0
)
{
function
setDefault
(
accountID
,
isDefault
)
{
$
.
ajax
({
type
:
"
post
"
,
url
:
"
<%=
path
%>
/account/updateAmountIsDefault.action
"
,
dataType
:
"
json
"
,
async
:
false
,
data
:
({
AccountID
:
accountID
,
IsDefault
:
isDefault
,
clientIp
:
'
<%=
clientIp
%>
'
}),
success
:
function
(
res
)
{
if
(
res
==
"
true
"
&&
isDefault
)
{
}
else
{
}
},
//此处添加错误处理
error
:
function
()
{
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除结算账户异常,请稍后再试!
'
,
'
error
'
);
return
;
}
});
}
if
(
row
.
length
==
1
)
{
setDefault
(
row
[
0
].
id
,
true
);
//设置默认
for
(
var
i
=
0
;
i
<
allRow
.
length
;
i
++
)
{
if
(
allRow
[
i
].
id
!=
row
[
0
].
id
)
{
setDefault
(
allRow
[
i
].
id
,
false
);
}
}
setTimeout
(
function
(){
$
(
"
#searchBtn
"
).
click
();
},
1000
);
}
return
;
}
}
//保存结算账户
//保存结算账户
$
(
"
#saveAccount
"
).
unbind
().
bind
({
$
(
"
#saveAccount
"
).
unbind
().
bind
({
...
...
src/main/webapp/pages/manage/user.jsp
View file @
9f18f0bc
...
@@ -142,9 +142,6 @@
...
@@ -142,9 +142,6 @@
function
initTableData
()
function
initTableData
()
{
{
$
(
'
#tableData
'
).
datagrid
({
$
(
'
#tableData
'
).
datagrid
({
//title:'用户列表',
//iconCls:'icon-save',
//width:widthInfo,
height
:
heightInfo
,
height
:
heightInfo
,
nowrap
:
false
,
nowrap
:
false
,
rownumbers
:
false
,
rownumbers
:
false
,
...
@@ -153,15 +150,10 @@
...
@@ -153,15 +150,10 @@
//选中单行
//选中单行
singleSelect
:
true
,
singleSelect
:
true
,
collapsible
:
false
,
collapsible
:
false
,
//selectOnCheck:false,
//fitColumns:true,
//单击行是否选中
//checkOnSelect : false,
url
:
'
<%=
path
%>
/user/findBy.action?pageSize=
'
+
initPageSize
,
url
:
'
<%=
path
%>
/user/findBy.action?pageSize=
'
+
initPageSize
,
pagination
:
true
,
pagination
:
true
,
//交替出现背景
//交替出现背景
striped
:
true
,
striped
:
true
,
//loadFilter: pagerFilter,
pageSize
:
initPageSize
,
pageSize
:
initPageSize
,
pageList
:
initPageNum
,
pageList
:
initPageNum
,
columns
:[[
columns
:[[
...
...
Write
Preview
Supports
Markdown
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