Commit f414fdf1c64204218a666ad94f2baef7a3952383
1 parent
96e4ab1b
历史单修改
Showing
1 changed file
with
5 additions
and
1 deletions
src/main/java/com/huaheng/pc/receipt/receiptHeaderHistory/service/ReceiptHeaderHistoryService.java
@@ -70,12 +70,16 @@ public class ReceiptHeaderHistoryService extends ServiceImpl<ReceiptHeaderHistor | @@ -70,12 +70,16 @@ public class ReceiptHeaderHistoryService extends ServiceImpl<ReceiptHeaderHistor | ||
70 | if (!receiptHeaderService.removeById(receiptHeader.getId())){ | 70 | if (!receiptHeaderService.removeById(receiptHeader.getId())){ |
71 | throw new ServiceException("删除头表失败"); | 71 | throw new ServiceException("删除头表失败"); |
72 | } | 72 | } |
73 | + if(!this.save(receiptHeaderHistory)){ | ||
74 | + throw new ServiceException("新增历史入库单失败"); | ||
75 | + } | ||
73 | // 当存在明细时删除 | 76 | // 当存在明细时删除 |
74 | if (list.size()!= 0){ | 77 | if (list.size()!= 0){ |
75 | //删除入库明细 | 78 | //删除入库明细 |
76 | List<Integer> receiptDetailIds = new ArrayList<>(); | 79 | List<Integer> receiptDetailIds = new ArrayList<>(); |
77 | for (int i=0; i<receiptDetailHistoryList.size();i++){ | 80 | for (int i=0; i<receiptDetailHistoryList.size();i++){ |
78 | receiptDetailHistoryList.get(i).setLastUpdatedBy(ShiroUtils.getLoginName()); | 81 | receiptDetailHistoryList.get(i).setLastUpdatedBy(ShiroUtils.getLoginName()); |
82 | + receiptDetailHistoryList.get(i).setReceiptId(receiptHeaderHistory.getId()); | ||
79 | receiptDetailIds.add(receiptDetailHistoryList.get(i).getId()); | 83 | receiptDetailIds.add(receiptDetailHistoryList.get(i).getId()); |
80 | } | 84 | } |
81 | if (!receiptDetailService.removeByIds(receiptDetailIds)) { | 85 | if (!receiptDetailService.removeByIds(receiptDetailIds)) { |
@@ -84,7 +88,7 @@ public class ReceiptHeaderHistoryService extends ServiceImpl<ReceiptHeaderHistor | @@ -84,7 +88,7 @@ public class ReceiptHeaderHistoryService extends ServiceImpl<ReceiptHeaderHistor | ||
84 | if (!receiptDetailHistoryService.saveBatch(receiptDetailHistoryList)){ | 88 | if (!receiptDetailHistoryService.saveBatch(receiptDetailHistoryList)){ |
85 | throw new ServiceException("新增明细失败"); | 89 | throw new ServiceException("新增明细失败"); |
86 | } } | 90 | } } |
87 | - this.save(receiptHeaderHistory); | 91 | + |
88 | }else { | 92 | }else { |
89 | return AjaxResult.success("入库单没有完成,无法删除"); | 93 | return AjaxResult.success("入库单没有完成,无法删除"); |
90 | } | 94 | } |