解决单据批量审核和删除的bug
This commit is contained in:
@@ -233,6 +233,8 @@ public class DepotHeadService {
|
||||
try{
|
||||
//查询单据主表信息
|
||||
DepotHead depotHead =getDepotHead(id);
|
||||
//只有未审核的单据才能被删除
|
||||
if("0".equals(depotHead.getStatus())) {
|
||||
User userInfo = userService.getCurrentUser();
|
||||
//删除出库数据回收序列号
|
||||
if (BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())
|
||||
@@ -271,6 +273,7 @@ public class DepotHeadService {
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(depotHead.getNumber()).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
result = 1;
|
||||
}
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
@@ -321,14 +324,31 @@ public class DepotHeadService {
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchSetStatus(String status, String depotHeadIDs)throws Exception {
|
||||
int result = 0;
|
||||
try{
|
||||
List<Long> dhIds = new ArrayList<>();
|
||||
List<Long> ids = StringUtil.strToLongList(depotHeadIDs);
|
||||
for(Long id: ids) {
|
||||
DepotHead depotHead = getDepotHead(id);
|
||||
if("0".equals(status)){
|
||||
if("1".equals(depotHead.getStatus())) {
|
||||
dhIds.add(id);
|
||||
}
|
||||
} else if("1".equals(status)){
|
||||
if("0".equals(depotHead.getStatus())) {
|
||||
dhIds.add(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(dhIds.size()>0) {
|
||||
DepotHead depotHead = new DepotHead();
|
||||
depotHead.setStatus(status);
|
||||
DepotHeadExample example = new DepotHeadExample();
|
||||
example.createCriteria().andIdIn(ids);
|
||||
int result = 0;
|
||||
try{
|
||||
example.createCriteria().andIdIn(dhIds);
|
||||
result = depotHeadMapper.updateByExampleSelective(depotHead, example);
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user