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
247fe119
Commit
247fe119
authored
Oct 13, 2020
by
季圣华
Browse files
优化单据新增和更新接口
parent
73ad4dc2
Changes
4
Hide whitespace changes
Inline
Side-by-side
erp_web/js/pages/bill/in_out.js
View file @
247fe119
...
...
@@ -1353,8 +1353,6 @@
}
this
.
endAllEdit
();
var
inserted
=
$
(
"
#materialData
"
).
datagrid
(
'
getRows
'
);
var
deleted
=
[];
var
updated
=
[];
$
.
ajax
({
type
:
"
post
"
,
url
:
url
,
...
...
@@ -1363,9 +1361,7 @@
async
:
false
,
data
:
JSON
.
stringify
({
info
:
infoStr
,
inserted
:
JSON
.
stringify
(
inserted
),
deleted
:
JSON
.
stringify
(
deleted
),
updated
:
JSON
.
stringify
(
updated
)
inserted
:
JSON
.
stringify
(
inserted
)
}),
success
:
function
(
tipInfo
){
if
(
tipInfo
){
...
...
@@ -1396,8 +1392,6 @@
var
self
=
this
;
this
.
endAllEdit
();
var
inserted
=
$
(
"
#materialData
"
).
datagrid
(
'
getRows
'
);
var
deleted
=
[];
var
updated
=
[];
$
.
ajax
({
type
:
"
post
"
,
url
:
url
,
...
...
@@ -1408,8 +1402,6 @@
id
:
url
.
substring
(
url
.
lastIndexOf
(
"
?id=
"
)
+
4
,
url
.
length
),
info
:
infoStr
,
inserted
:
JSON
.
stringify
(
inserted
),
deleted
:
JSON
.
stringify
(
deleted
),
updated
:
JSON
.
stringify
(
updated
),
preTotalPrice
:
preTotalPrice
}),
success
:
function
(
tipInfo
){
...
...
src/main/java/com/jsh/erp/controller/DepotHeadController.java
View file @
247fe119
...
...
@@ -342,8 +342,6 @@ public class DepotHeadController {
JSONObject
result
=
ExceptionConstants
.
standardSuccess
();
String
beanJson
=
body
.
getInfo
();
String
inserted
=
body
.
getInserted
();
String
deleted
=
body
.
getDeleted
();
String
updated
=
body
.
getUpdated
();
Long
billsNumLimit
=
Long
.
parseLong
(
request
.
getSession
().
getAttribute
(
"billsNumLimit"
).
toString
());
Long
tenantId
=
Long
.
parseLong
(
request
.
getSession
().
getAttribute
(
"tenantId"
).
toString
());
Long
count
=
depotHeadService
.
countDepotHead
(
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
);
...
...
@@ -351,7 +349,7 @@ public class DepotHeadController {
throw
new
BusinessParamCheckingException
(
ExceptionConstants
.
DEPOT_HEAD_OVER_LIMIT_FAILED_CODE
,
ExceptionConstants
.
DEPOT_HEAD_OVER_LIMIT_FAILED_MSG
);
}
else
{
depotHeadService
.
addDepotHeadAndDetail
(
beanJson
,
inserted
,
deleted
,
updated
,
tenantId
,
request
);
depotHeadService
.
addDepotHeadAndDetail
(
beanJson
,
inserted
,
tenantId
,
request
);
}
return
result
;
}
...
...
@@ -370,10 +368,8 @@ public class DepotHeadController {
Long
id
=
body
.
getId
();
String
beanJson
=
body
.
getInfo
();
String
inserted
=
body
.
getInserted
();
String
deleted
=
body
.
getDeleted
();
String
updated
=
body
.
getUpdated
();
BigDecimal
preTotalPrice
=
body
.
getPreTotalPrice
();
depotHeadService
.
updateDepotHeadAndDetail
(
id
,
beanJson
,
inserted
,
deleted
,
updated
,
preTotalPrice
,
tenantId
,
request
);
depotHeadService
.
updateDepotHeadAndDetail
(
id
,
beanJson
,
inserted
,
preTotalPrice
,
tenantId
,
request
);
return
result
;
}
...
...
src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java
View file @
247fe119
...
...
@@ -470,14 +470,12 @@ public class DepotHeadService {
* 新增单据主表及单据子表信息
* @param beanJson
* @param inserted
* @param deleted
* @param updated
* @param tenantId
* @param request
* @throws Exception
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
void
addDepotHeadAndDetail
(
String
beanJson
,
String
inserted
,
String
deleted
,
String
updated
,
Long
tenantId
,
public
void
addDepotHeadAndDetail
(
String
beanJson
,
String
inserted
,
Long
tenantId
,
HttpServletRequest
request
)
throws
Exception
{
/**处理单据主表数据*/
DepotHead
depotHead
=
JSONObject
.
parseObject
(
beanJson
,
DepotHead
.
class
);
...
...
@@ -504,7 +502,7 @@ public class DepotHeadService {
if
(
list
!=
null
)
{
Long
headId
=
list
.
get
(
0
).
getId
();
/**入库和出库处理单据子表信息*/
depotItemService
.
saveDetials
(
inserted
,
deleted
,
updated
,
headId
,
tenantId
,
request
);
depotItemService
.
saveDetials
(
inserted
,
headId
,
tenantId
,
request
);
}
/**如果关联单据号非空则更新订单的状态为2 */
if
(
depotHead
.
getLinkNumber
()!=
null
)
{
...
...
@@ -528,15 +526,13 @@ public class DepotHeadService {
* @param id
* @param beanJson
* @param inserted
* @param deleted
* @param updated
* @param preTotalPrice
* @param tenantId
* @param request
* @throws Exception
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
void
updateDepotHeadAndDetail
(
Long
id
,
String
beanJson
,
String
inserted
,
String
deleted
,
String
updated
,
public
void
updateDepotHeadAndDetail
(
Long
id
,
String
beanJson
,
String
inserted
,
BigDecimal
preTotalPrice
,
Long
tenantId
,
HttpServletRequest
request
)
throws
Exception
{
/**更新单据主表信息*/
DepotHead
depotHead
=
JSONObject
.
parseObject
(
beanJson
,
DepotHead
.
class
);
...
...
@@ -554,7 +550,7 @@ public class DepotHeadService {
}
}
/**入库和出库处理单据子表信息*/
depotItemService
.
saveDetials
(
inserted
,
deleted
,
updated
,
depotHead
.
getId
(),
tenantId
,
request
);
depotItemService
.
saveDetials
(
inserted
,
depotHead
.
getId
(),
tenantId
,
request
);
logService
.
insertLog
(
"单据"
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_EDIT
).
append
(
depotHead
.
getNumber
()).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
...
...
src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java
View file @
247fe119
...
...
@@ -296,7 +296,7 @@ public class DepotItemService {
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
String
saveDetials
(
String
inserted
,
String
deleted
,
String
updated
,
Long
headerId
,
Long
tenantId
,
HttpServletRequest
request
)
throws
Exception
{
public
String
saveDetials
(
String
inserted
,
Long
headerId
,
Long
tenantId
,
HttpServletRequest
request
)
throws
Exception
{
//查询单据主表信息
DepotHead
depotHead
=
null
;
try
{
...
...
@@ -308,7 +308,6 @@ public class DepotItemService {
User
userInfo
=
userService
.
getCurrentUser
();
//转为json
JSONArray
insertedJson
=
JSONArray
.
parseArray
(
inserted
);
JSONArray
deletedJson
=
JSONArray
.
parseArray
(
deleted
);
//删除单据的明细
deleteDepotItemHeadId
(
headerId
);
...
...
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