解决入库单被删之后,关联的订单状态不变的bug
This commit is contained in:
@@ -284,15 +284,28 @@ public class DepotHeadService {
|
||||
}
|
||||
}
|
||||
}
|
||||
/**删除单据子表数据*/
|
||||
//删除单据子表数据
|
||||
depotItemMapperEx.batchDeleteDepotItemByDepotHeadIds(new Long[]{depotHead.getId()});
|
||||
//删除单据主表信息
|
||||
batchDeleteDepotHeadByIds(depotHead.getId().toString());
|
||||
//将关联的订单置为审核状态-针对采购入库和销售出库
|
||||
if(StringUtil.isNotEmpty(depotHead.getLinkNumber())){
|
||||
if((BusinessConstants.DEPOTHEAD_TYPE_IN.equals(depotHead.getType()) &&
|
||||
BusinessConstants.SUB_TYPE_PURCHASE.equals(depotHead.getSubType()))
|
||||
|| (BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType()) &&
|
||||
BusinessConstants.SUB_TYPE_SALES.equals(depotHead.getSubType()))) {
|
||||
DepotHead dh = new DepotHead();
|
||||
dh.setStatus(BusinessConstants.BILLS_STATUS_AUDIT);
|
||||
DepotHeadExample example = new DepotHeadExample();
|
||||
example.createCriteria().andNumberEqualTo(depotHead.getLinkNumber());
|
||||
depotHeadMapper.updateByExampleSelective(dh, example);
|
||||
}
|
||||
}
|
||||
//更新当前库存
|
||||
List<DepotItem> list = depotItemService.getListByHeaderId(depotHead.getId());
|
||||
for (DepotItem depotItem : list) {
|
||||
depotItemService.updateCurrentStock(depotItem);
|
||||
}
|
||||
/**删除单据主表信息*/
|
||||
batchDeleteDepotHeadByIds(depotHead.getId().toString());
|
||||
} else {
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_UN_AUDIT_DELETE_FAILED_CODE,
|
||||
String.format(ExceptionConstants.DEPOT_HEAD_UN_AUDIT_DELETE_FAILED_MSG));
|
||||
@@ -350,32 +363,32 @@ 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);
|
||||
}
|
||||
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 {
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_AUDIT_TO_UN_AUDIT_FAILED_CODE,
|
||||
String.format(ExceptionConstants.DEPOT_HEAD_AUDIT_TO_UN_AUDIT_FAILED_MSG));
|
||||
}
|
||||
} else if("1".equals(status)){
|
||||
if("0".equals(depotHead.getStatus())) {
|
||||
dhIds.add(id);
|
||||
} else {
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_UN_AUDIT_TO_AUDIT_FAILED_CODE,
|
||||
String.format(ExceptionConstants.DEPOT_HEAD_UN_AUDIT_TO_AUDIT_FAILED_MSG));
|
||||
}
|
||||
}
|
||||
if(dhIds.size()>0) {
|
||||
DepotHead depotHead = new DepotHead();
|
||||
depotHead.setStatus(status);
|
||||
DepotHeadExample example = new DepotHeadExample();
|
||||
example.createCriteria().andIdIn(dhIds);
|
||||
result = depotHeadMapper.updateByExampleSelective(depotHead, example);
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
if(dhIds.size()>0) {
|
||||
DepotHead depotHead = new DepotHead();
|
||||
depotHead.setStatus(status);
|
||||
DepotHeadExample example = new DepotHeadExample();
|
||||
example.createCriteria().andIdIn(dhIds);
|
||||
result = depotHeadMapper.updateByExampleSelective(depotHead, example);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user