优化单据新增和更新接口
This commit is contained in:
@@ -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){
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user