Commit f414fdf1c64204218a666ad94f2baef7a3952383

Authored by pengcheng
1 parent 96e4ab1b

历史单修改

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