Commit abfe8e59b26981b0a3ea513b73876a1b4eb84259

Authored by 谭毅彬
1 parent 0e5c4397

更新库存表状态事务修复,取消任务事务修复

Signed-off-by: TanYibin <5491541@qq.com>
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryHeaderServiceImpl.java
... ... @@ -7,6 +7,7 @@ import java.util.List;
7 7  
8 8 import javax.annotation.Resource;
9 9  
  10 +import org.jeecg.common.exception.JeecgBootException;
10 11 import org.jeecg.modules.wms.config.container.entity.Container;
11 12 import org.jeecg.modules.wms.config.container.service.IContainerService;
12 13 import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail;
... ... @@ -68,6 +69,7 @@ public class InventoryHeaderServiceImpl extends ServiceImpl&lt;InventoryHeaderMappe
68 69 }
69 70  
70 71 @Override
  72 + @Transactional
71 73 public boolean updateInventoryContainerStatusByContainerCode(String containerCode, String warehouseCode) {
72 74 Container container = containerService.getContainerByCode(containerCode, warehouseCode);
73 75 if (container == null) {
... ... @@ -75,63 +77,62 @@ public class InventoryHeaderServiceImpl extends ServiceImpl&lt;InventoryHeaderMappe
75 77 }
76 78 InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode);
77 79 if (inventoryHeader != null) {
78   - boolean success = inventoryHeaderService.updateContainerStatusById(container.getStatus(), inventoryHeader.getId());
79   - if (!success) {
80   - return success;
  80 + if (!inventoryHeaderService.updateContainerStatusById(container.getStatus(), inventoryHeader.getId())) {
  81 + throw new JeecgBootException("更新库存头表状态失败");
81 82 }
82 83 List<InventoryDetail> inventoryDetailList = inventoryDetailService.getInventoryDetailListByContainerCode(containerCode, warehouseCode);
83   - List<InventoryDetail> inventoryDetailList1 = new ArrayList<>();
  84 + List<InventoryDetail> updateInventoryDetailList = new ArrayList<>();
84 85 if (inventoryDetailList.size() > 0) {
85 86 for (InventoryDetail inventoryDetail : inventoryDetailList) {
86   - inventoryDetail.setContainerStatus(container.getStatus());
87   - InventoryDetail inventoryDetail1 = new InventoryDetail();
88   - inventoryDetail1.setId(inventoryDetail.getId());
89   - inventoryDetail1.setContainerStatus(container.getStatus());
90   - inventoryDetailList1.add(inventoryDetail1);
  87 + InventoryDetail updateInventoryDetail = new InventoryDetail();
  88 + updateInventoryDetail.setId(inventoryDetail.getId());
  89 + updateInventoryDetail.setContainerStatus(container.getStatus());
  90 + updateInventoryDetailList.add(updateInventoryDetail);
  91 + }
  92 + if (!inventoryDetailService.updateBatchById(updateInventoryDetailList)) {
  93 + throw new JeecgBootException("更新库存明细表状态失败");
91 94 }
92   - success = inventoryDetailService.updateBatchById(inventoryDetailList1);
93 95 }
94   - return success;
95 96 }
96 97 return true;
97 98 }
98 99  
99 100 @Override
  101 + @Transactional
100 102 public boolean updateInventoryLocationAndZoneById(String locationCode, String zoneCode, Integer id) {
101 103 InventoryHeader inventoryHeader = new InventoryHeader();
102 104 inventoryHeader.setId(id);
103 105 inventoryHeader.setLocationCode(locationCode);
104 106 inventoryHeader.setZoneCode(zoneCode);
105   - boolean success = inventoryHeaderService.updateById(inventoryHeader);
106   - return success;
  107 + return inventoryHeaderService.updateById(inventoryHeader);
107 108 }
108 109  
109 110 @Override
  111 + @Transactional
110 112 public boolean updateContainerStatusById(String containerStatus, Integer id) {
111 113 InventoryHeader inventoryHeader = new InventoryHeader();
112 114 inventoryHeader.setId(id);
113 115 inventoryHeader.setContainerStatus(containerStatus);
114   - boolean success = inventoryHeaderService.updateById(inventoryHeader);
115   - return success;
  116 + return inventoryHeaderService.updateById(inventoryHeader);
116 117 }
117 118  
118 119 @Override
  120 + @Transactional
119 121 public boolean updateContainerStatusAndLocationCode(String containerStatus, String locationCode, Integer id) {
120 122 InventoryHeader inventoryHeader = new InventoryHeader();
121 123 inventoryHeader.setId(id);
122 124 inventoryHeader.setContainerStatus(containerStatus);
123 125 inventoryHeader.setLocationCode(locationCode);
124   - boolean success = inventoryHeaderService.updateById(inventoryHeader);
125   - return success;
  126 + return inventoryHeaderService.updateById(inventoryHeader);
126 127 }
127 128  
128 129 @Override
  130 + @Transactional
129 131 public boolean updateLocationCodeById(String locationCode, Integer id) {
130 132 InventoryHeader inventoryHeader = new InventoryHeader();
131 133 inventoryHeader.setId(id);
132 134 inventoryHeader.setLocationCode(locationCode);
133   - boolean success = inventoryHeaderService.updateById(inventoryHeader);
134   - return success;
  135 + return inventoryHeaderService.updateById(inventoryHeader);
135 136 }
136 137  
137 138 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/controller/TaskHeaderController.java
... ... @@ -367,8 +367,7 @@ public class TaskHeaderController extends HuahengBaseController {
367 367 result = handleMultiProcess("cancelTask", new MultiProcessListener() {
368 368 @Override
369 369 public Result<?> doProcess() {
370   - Result result = taskHeaderService.cancelTask(taskId);
371   - return result;
  370 + return taskHeaderService.cancelTask(taskId);
372 371 }
373 372 });
374 373 }
... ...