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
c9ddc1a8
Commit
c9ddc1a8
authored
Jan 08, 2017
by
季圣华
Browse files
完成进销存单据的账户余额的自动计算功能
parent
66d4b2fc
Changes
10
Hide whitespace changes
Inline
Side-by-side
WebRoot/WEB-INF/classes/com/jsh/action/basic/AccountAction.class
View file @
c9ddc1a8
No preview for this file type
WebRoot/WEB-INF/classes/com/jsh/action/materials/DepotHeadAction.class
View file @
c9ddc1a8
No preview for this file type
WebRoot/WEB-INF/classes/com/jsh/service/basic/AccountService.class
View file @
c9ddc1a8
No preview for this file type
WebRoot/WEB-INF/classes/spring/basic-applicationContext.xml
View file @
c9ddc1a8
...
@@ -306,6 +306,7 @@
...
@@ -306,6 +306,7 @@
<!-- spring整合struts2需要默认为request或者 prototype,不能是单例 -->
<!-- spring整合struts2需要默认为request或者 prototype,不能是单例 -->
<bean
id=
"accountAction"
class=
"com.jsh.action.basic.AccountAction"
scope=
"prototype"
>
<bean
id=
"accountAction"
class=
"com.jsh.action.basic.AccountAction"
scope=
"prototype"
>
<property
name=
"accountService"
ref=
"accountService"
/>
<property
name=
"accountService"
ref=
"accountService"
/>
<property
name=
"depotHeadService"
ref=
"depotHeadService"
/>
<property
name=
"logService"
ref=
"logService"
/>
<property
name=
"logService"
ref=
"logService"
/>
</bean>
</bean>
<!--结算账户配置结束 -->
<!--结算账户配置结束 -->
...
...
WebRoot/js/pages/materials/in_out.js
View file @
c9ddc1a8
...
@@ -740,12 +740,19 @@
...
@@ -740,12 +740,19 @@
else
else
{
{
var
OrganId
=
null
,
AllocationProjectId
=
null
;
var
OrganId
=
null
,
AllocationProjectId
=
null
;
var
ChangeAmount
=
$
.
trim
(
$
(
"
#ChangeAmount
"
).
val
());
var
TotalPrice
=
$
(
"
#depotHeadFM .datagrid-footer [field='AllPrice'] div
"
).
text
();
if
(
listSubType
!==
"
调拨
"
){
if
(
listSubType
!==
"
调拨
"
){
OrganId
=
$
(
'
#OrganId
'
).
combobox
(
'
getValue
'
);
OrganId
=
$
(
'
#OrganId
'
).
combobox
(
'
getValue
'
);
}
}
else
{
else
{
AllocationProjectId
=
$
.
trim
(
$
(
"
#AllocationProjectId
"
).
val
());
//收货仓库-对方
AllocationProjectId
=
$
.
trim
(
$
(
"
#AllocationProjectId
"
).
val
());
//收货仓库-对方
}
}
if
(
listSubType
===
"
采购
"
||
listSubType
===
"
销售退货
"
){
//付款为负数
ChangeAmount
=
0
-
ChangeAmount
;
TotalPrice
=
0
-
TotalPrice
;
}
$
.
ajax
({
$
.
ajax
({
type
:
"
post
"
,
type
:
"
post
"
,
url
:
url
,
url
:
url
,
...
@@ -761,8 +768,8 @@
...
@@ -761,8 +768,8 @@
OrganId
:
OrganId
,
OrganId
:
OrganId
,
HandsPersonId
:
$
.
trim
(
$
(
"
#HandsPersonId
"
).
val
()),
HandsPersonId
:
$
.
trim
(
$
(
"
#HandsPersonId
"
).
val
()),
AccountId
:
$
.
trim
(
$
(
"
#AccountId
"
).
val
()),
AccountId
:
$
.
trim
(
$
(
"
#AccountId
"
).
val
()),
ChangeAmount
:
$
.
trim
(
$
(
"
#
ChangeAmount
"
).
val
()),
ChangeAmount
:
ChangeAmount
,
//付款/收款
TotalPrice
:
$
(
"
#depotHeadFM .datagrid-footer [field='AllPrice'] div
"
).
text
(),
TotalPrice
:
TotalPrice
,
//合计
Remark
:
$
.
trim
(
$
(
"
#Remark
"
).
val
()),
Remark
:
$
.
trim
(
$
(
"
#Remark
"
).
val
()),
clientIp
:
clientIp
clientIp
:
clientIp
}),
}),
...
...
WebRoot/pages/materials/material.jsp
View file @
c9ddc1a8
...
@@ -323,8 +323,8 @@
...
@@ -323,8 +323,8 @@
{
title
:
'
最低售价
'
,
field
:
'
LowPrice
'
,
width
:
70
},
{
title
:
'
最低售价
'
,
field
:
'
LowPrice
'
,
width
:
70
},
{
title
:
'
预设售价一
'
,
field
:
'
PresetPriceOne
'
,
width
:
70
},
{
title
:
'
预设售价一
'
,
field
:
'
PresetPriceOne
'
,
width
:
70
},
{
title
:
'
预设售价二
'
,
field
:
'
PresetPriceTwo
'
,
width
:
70
},
{
title
:
'
预设售价二
'
,
field
:
'
PresetPriceTwo
'
,
width
:
70
},
{
title
:
'
备注
'
,
field
:
'
Remark
'
,
width
:
11
0
},
{
title
:
'
备注
'
,
field
:
'
Remark
'
,
width
:
9
0
},
{
title
:
'
操作
'
,
field
:
'
op
'
,
align
:
"
center
"
,
width
:
1
2
0
,
formatter
:
function
(
value
,
rec
)
{
title
:
'
操作
'
,
field
:
'
op
'
,
align
:
"
center
"
,
width
:
1
5
0
,
formatter
:
function
(
value
,
rec
)
{
{
var
str
=
''
;
var
str
=
''
;
var
rowInfo
=
rec
.
Id
+
'
AaBb
'
+
rec
.
Name
+
'
AaBb
'
+
rec
.
Model
+
'
AaBb
'
+
rec
.
Color
+
'
AaBb
'
+
rec
.
Unit
+
'
AaBb
'
+
rec
.
RetailPrice
+
'
AaBb
'
+
rec
.
LowPrice
+
'
AaBb
'
+
rec
.
PresetPriceOne
+
'
AaBb
'
+
rec
.
PresetPriceTwo
+
'
AaBb
'
+
rec
.
Remark
;
var
rowInfo
=
rec
.
Id
+
'
AaBb
'
+
rec
.
Name
+
'
AaBb
'
+
rec
.
Model
+
'
AaBb
'
+
rec
.
Color
+
'
AaBb
'
+
rec
.
Unit
+
'
AaBb
'
+
rec
.
RetailPrice
+
'
AaBb
'
+
rec
.
LowPrice
+
'
AaBb
'
+
rec
.
PresetPriceOne
+
'
AaBb
'
+
rec
.
PresetPriceTwo
+
'
AaBb
'
+
rec
.
Remark
;
...
...
config/spring/basic-applicationContext.xml
View file @
c9ddc1a8
...
@@ -306,6 +306,7 @@
...
@@ -306,6 +306,7 @@
<!-- spring整合struts2需要默认为request或者 prototype,不能是单例 -->
<!-- spring整合struts2需要默认为request或者 prototype,不能是单例 -->
<bean
id=
"accountAction"
class=
"com.jsh.action.basic.AccountAction"
scope=
"prototype"
>
<bean
id=
"accountAction"
class=
"com.jsh.action.basic.AccountAction"
scope=
"prototype"
>
<property
name=
"accountService"
ref=
"accountService"
/>
<property
name=
"accountService"
ref=
"accountService"
/>
<property
name=
"depotHeadService"
ref=
"depotHeadService"
/>
<property
name=
"logService"
ref=
"logService"
/>
<property
name=
"logService"
ref=
"logService"
/>
</bean>
</bean>
<!--结算账户配置结束 -->
<!--结算账户配置结束 -->
...
...
src/com/jsh/action/basic/AccountAction.java
View file @
c9ddc1a8
...
@@ -10,10 +10,12 @@ import net.sf.json.JSONObject;
...
@@ -10,10 +10,12 @@ import net.sf.json.JSONObject;
import
org.springframework.dao.DataAccessException
;
import
org.springframework.dao.DataAccessException
;
import
com.jsh.base.BaseAction
;
import
com.jsh.base.BaseAction
;
import
com.jsh.base.Log
;
import
com.jsh.base.Log
;
import
com.jsh.model.po.DepotHead
;
import
com.jsh.model.po.Logdetails
;
import
com.jsh.model.po.Logdetails
;
import
com.jsh.model.po.Account
;
import
com.jsh.model.po.Account
;
import
com.jsh.model.vo.basic.AccountModel
;
import
com.jsh.model.vo.basic.AccountModel
;
import
com.jsh.service.basic.AccountIService
;
import
com.jsh.service.basic.AccountIService
;
import
com.jsh.service.materials.DepotHeadIService
;
import
com.jsh.util.PageUtil
;
import
com.jsh.util.PageUtil
;
/**
/**
* 结算账户
* 结算账户
...
@@ -23,7 +25,8 @@ import com.jsh.util.PageUtil;
...
@@ -23,7 +25,8 @@ import com.jsh.util.PageUtil;
public
class
AccountAction
extends
BaseAction
<
AccountModel
>
public
class
AccountAction
extends
BaseAction
<
AccountModel
>
{
{
private
AccountIService
accountService
;
private
AccountIService
accountService
;
private
AccountModel
model
=
new
AccountModel
();
private
DepotHeadIService
depotHeadService
;
private
AccountModel
model
=
new
AccountModel
();
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
public
String
getAccount
()
public
String
getAccount
()
...
@@ -290,7 +293,7 @@ public class AccountAction extends BaseAction<AccountModel>
...
@@ -290,7 +293,7 @@ public class AccountAction extends BaseAction<AccountModel>
item
.
put
(
"name"
,
account
.
getName
());
item
.
put
(
"name"
,
account
.
getName
());
item
.
put
(
"serialNo"
,
account
.
getSerialNo
());
item
.
put
(
"serialNo"
,
account
.
getSerialNo
());
item
.
put
(
"initialAmount"
,
account
.
getInitialAmount
());
item
.
put
(
"initialAmount"
,
account
.
getInitialAmount
());
item
.
put
(
"currentAmount"
,
account
.
getCurrent
Amount
());
item
.
put
(
"currentAmount"
,
getAccountSum
(
account
.
getId
())
+
account
.
getInitial
Amount
());
item
.
put
(
"remark"
,
account
.
getRemark
());
item
.
put
(
"remark"
,
account
.
getRemark
());
item
.
put
(
"op"
,
1
);
item
.
put
(
"op"
,
1
);
dataArray
.
add
(
item
);
dataArray
.
add
(
item
);
...
@@ -309,6 +312,31 @@ public class AccountAction extends BaseAction<AccountModel>
...
@@ -309,6 +312,31 @@ public class AccountAction extends BaseAction<AccountModel>
Log
.
errorFileSync
(
">>>>>>>>>回写查询结算账户信息结果异常"
,
e
);
Log
.
errorFileSync
(
">>>>>>>>>回写查询结算账户信息结果异常"
,
e
);
}
}
}
}
/**
* 单个账户的金额求和
* @param id
* @return
*/
public
Double
getAccountSum
(
Long
id
){
Double
accountSum
=
0.0
;
try
{
PageUtil
<
DepotHead
>
pageUtil
=
new
PageUtil
<
DepotHead
>();
pageUtil
.
setPageSize
(
0
);
pageUtil
.
setCurPage
(
0
);
pageUtil
.
setAdvSearch
(
getCondition_getSum
(
id
));
depotHeadService
.
find
(
pageUtil
);
List
<
DepotHead
>
dataList
=
pageUtil
.
getPageList
();
if
(
dataList
!=
null
){
for
(
DepotHead
depotHead:
dataList
){
accountSum
=
accountSum
+
depotHead
.
getChangeAmount
();
}
}
}
catch
(
DataAccessException
e
){
Log
.
errorFileSync
(
">>>>>>>>>查找进销存信息异常"
,
e
);
}
return
accountSum
;
}
/**
/**
* 查找结算账户信息-下拉框
* 查找结算账户信息-下拉框
...
@@ -380,6 +408,20 @@ public class AccountAction extends BaseAction<AccountModel>
...
@@ -380,6 +408,20 @@ public class AccountAction extends BaseAction<AccountModel>
condition
.
put
(
"id_s_order"
,
"desc"
);
condition
.
put
(
"id_s_order"
,
"desc"
);
return
condition
;
return
condition
;
}
}
/**
* 拼接搜索条件-结算账户当前余额求和
* @return
*/
private
Map
<
String
,
Object
>
getCondition_getSum
(
Long
id
)
{
/**
* 拼接搜索条件
*/
Map
<
String
,
Object
>
condition
=
new
HashMap
<
String
,
Object
>();
condition
.
put
(
"AccountId_n_eq"
,
id
);
return
condition
;
}
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
//=============以下spring注入以及Model驱动公共方法,与Action处理无关==================
@Override
@Override
...
@@ -391,4 +433,7 @@ public class AccountAction extends BaseAction<AccountModel>
...
@@ -391,4 +433,7 @@ public class AccountAction extends BaseAction<AccountModel>
{
{
this
.
accountService
=
accountService
;
this
.
accountService
=
accountService
;
}
}
public
void
setDepotHeadService
(
DepotHeadIService
depotHeadService
)
{
this
.
depotHeadService
=
depotHeadService
;
}
}
}
src/com/jsh/action/materials/DepotHeadAction.java
View file @
c9ddc1a8
...
@@ -270,10 +270,10 @@ public class DepotHeadAction extends BaseAction<DepotHeadModel>
...
@@ -270,10 +270,10 @@ public class DepotHeadAction extends BaseAction<DepotHeadModel>
item
.
put
(
"HandsPersonName"
,
depotHead
.
getHandsPersonId
()==
null
?
""
:
depotHead
.
getHandsPersonId
().
getName
());
item
.
put
(
"HandsPersonName"
,
depotHead
.
getHandsPersonId
()==
null
?
""
:
depotHead
.
getHandsPersonId
().
getName
());
item
.
put
(
"AccountId"
,
depotHead
.
getAccountId
()==
null
?
""
:
depotHead
.
getAccountId
().
getId
());
item
.
put
(
"AccountId"
,
depotHead
.
getAccountId
()==
null
?
""
:
depotHead
.
getAccountId
().
getId
());
item
.
put
(
"AccountName"
,
depotHead
.
getAccountId
()==
null
?
""
:
depotHead
.
getAccountId
().
getName
());
item
.
put
(
"AccountName"
,
depotHead
.
getAccountId
()==
null
?
""
:
depotHead
.
getAccountId
().
getName
());
item
.
put
(
"ChangeAmount"
,
depotHead
.
getChangeAmount
());
item
.
put
(
"ChangeAmount"
,
depotHead
.
getChangeAmount
()
==
null
?
""
:
Math
.
abs
(
depotHead
.
getChangeAmount
())
);
item
.
put
(
"AllocationProjectId"
,
depotHead
.
getAllocationProjectId
()==
null
?
""
:
depotHead
.
getAllocationProjectId
().
getId
());
item
.
put
(
"AllocationProjectId"
,
depotHead
.
getAllocationProjectId
()==
null
?
""
:
depotHead
.
getAllocationProjectId
().
getId
());
item
.
put
(
"AllocationProjectName"
,
depotHead
.
getAllocationProjectId
()==
null
?
""
:
depotHead
.
getAllocationProjectId
().
getName
());
item
.
put
(
"AllocationProjectName"
,
depotHead
.
getAllocationProjectId
()==
null
?
""
:
depotHead
.
getAllocationProjectId
().
getName
());
item
.
put
(
"TotalPrice"
,
depotHead
.
getTotalPrice
());
item
.
put
(
"TotalPrice"
,
depotHead
.
getTotalPrice
()
==
null
?
""
:
Math
.
abs
(
depotHead
.
getTotalPrice
())
);
item
.
put
(
"Remark"
,
depotHead
.
getRemark
());
item
.
put
(
"Remark"
,
depotHead
.
getRemark
());
item
.
put
(
"op"
,
1
);
item
.
put
(
"op"
,
1
);
dataArray
.
add
(
item
);
dataArray
.
add
(
item
);
...
...
src/com/jsh/service/basic/AccountService.java
View file @
c9ddc1a8
package
com.jsh.service.basic
;
package
com.jsh.service.basic
;
import
com.jsh.base.BaseService
;
import
com.jsh.base.BaseService
;
import
com.jsh.dao.basic.AccountIDAO
;
import
com.jsh.dao.basic.AccountIDAO
;
import
com.jsh.model.po.Account
;
import
com.jsh.model.po.Account
;
...
@@ -9,11 +8,11 @@ public class AccountService extends BaseService<Account> implements AccountIServ
...
@@ -9,11 +8,11 @@ public class AccountService extends BaseService<Account> implements AccountIServ
@SuppressWarnings
(
"unused"
)
@SuppressWarnings
(
"unused"
)
private
AccountIDAO
accountDao
;
private
AccountIDAO
accountDao
;
public
void
setAccountDao
(
AccountIDAO
accountDao
)
public
void
setAccountDao
(
AccountIDAO
accountDao
)
{
{
this
.
accountDao
=
accountDao
;
this
.
accountDao
=
accountDao
;
}
}
@Override
@Override
protected
Class
<
Account
>
getEntityClass
()
protected
Class
<
Account
>
getEntityClass
()
{
{
...
...
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