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,6 +7,7 @@ import java.util.List;
7 7
8 import javax.annotation.Resource; 8 import javax.annotation.Resource;
9 9
  10 +import org.jeecg.common.exception.JeecgBootException;
10 import org.jeecg.modules.wms.config.container.entity.Container; 11 import org.jeecg.modules.wms.config.container.entity.Container;
11 import org.jeecg.modules.wms.config.container.service.IContainerService; 12 import org.jeecg.modules.wms.config.container.service.IContainerService;
12 import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; 13 import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail;
@@ -68,6 +69,7 @@ public class InventoryHeaderServiceImpl extends ServiceImpl&lt;InventoryHeaderMappe @@ -68,6 +69,7 @@ public class InventoryHeaderServiceImpl extends ServiceImpl&lt;InventoryHeaderMappe
68 } 69 }
69 70
70 @Override 71 @Override
  72 + @Transactional
71 public boolean updateInventoryContainerStatusByContainerCode(String containerCode, String warehouseCode) { 73 public boolean updateInventoryContainerStatusByContainerCode(String containerCode, String warehouseCode) {
72 Container container = containerService.getContainerByCode(containerCode, warehouseCode); 74 Container container = containerService.getContainerByCode(containerCode, warehouseCode);
73 if (container == null) { 75 if (container == null) {
@@ -75,63 +77,62 @@ public class InventoryHeaderServiceImpl extends ServiceImpl&lt;InventoryHeaderMappe @@ -75,63 +77,62 @@ public class InventoryHeaderServiceImpl extends ServiceImpl&lt;InventoryHeaderMappe
75 } 77 }
76 InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode); 78 InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode);
77 if (inventoryHeader != null) { 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 List<InventoryDetail> inventoryDetailList = inventoryDetailService.getInventoryDetailListByContainerCode(containerCode, warehouseCode); 83 List<InventoryDetail> inventoryDetailList = inventoryDetailService.getInventoryDetailListByContainerCode(containerCode, warehouseCode);
83 - List<InventoryDetail> inventoryDetailList1 = new ArrayList<>(); 84 + List<InventoryDetail> updateInventoryDetailList = new ArrayList<>();
84 if (inventoryDetailList.size() > 0) { 85 if (inventoryDetailList.size() > 0) {
85 for (InventoryDetail inventoryDetail : inventoryDetailList) { 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 return true; 97 return true;
97 } 98 }
98 99
99 @Override 100 @Override
  101 + @Transactional
100 public boolean updateInventoryLocationAndZoneById(String locationCode, String zoneCode, Integer id) { 102 public boolean updateInventoryLocationAndZoneById(String locationCode, String zoneCode, Integer id) {
101 InventoryHeader inventoryHeader = new InventoryHeader(); 103 InventoryHeader inventoryHeader = new InventoryHeader();
102 inventoryHeader.setId(id); 104 inventoryHeader.setId(id);
103 inventoryHeader.setLocationCode(locationCode); 105 inventoryHeader.setLocationCode(locationCode);
104 inventoryHeader.setZoneCode(zoneCode); 106 inventoryHeader.setZoneCode(zoneCode);
105 - boolean success = inventoryHeaderService.updateById(inventoryHeader);  
106 - return success; 107 + return inventoryHeaderService.updateById(inventoryHeader);
107 } 108 }
108 109
109 @Override 110 @Override
  111 + @Transactional
110 public boolean updateContainerStatusById(String containerStatus, Integer id) { 112 public boolean updateContainerStatusById(String containerStatus, Integer id) {
111 InventoryHeader inventoryHeader = new InventoryHeader(); 113 InventoryHeader inventoryHeader = new InventoryHeader();
112 inventoryHeader.setId(id); 114 inventoryHeader.setId(id);
113 inventoryHeader.setContainerStatus(containerStatus); 115 inventoryHeader.setContainerStatus(containerStatus);
114 - boolean success = inventoryHeaderService.updateById(inventoryHeader);  
115 - return success; 116 + return inventoryHeaderService.updateById(inventoryHeader);
116 } 117 }
117 118
118 @Override 119 @Override
  120 + @Transactional
119 public boolean updateContainerStatusAndLocationCode(String containerStatus, String locationCode, Integer id) { 121 public boolean updateContainerStatusAndLocationCode(String containerStatus, String locationCode, Integer id) {
120 InventoryHeader inventoryHeader = new InventoryHeader(); 122 InventoryHeader inventoryHeader = new InventoryHeader();
121 inventoryHeader.setId(id); 123 inventoryHeader.setId(id);
122 inventoryHeader.setContainerStatus(containerStatus); 124 inventoryHeader.setContainerStatus(containerStatus);
123 inventoryHeader.setLocationCode(locationCode); 125 inventoryHeader.setLocationCode(locationCode);
124 - boolean success = inventoryHeaderService.updateById(inventoryHeader);  
125 - return success; 126 + return inventoryHeaderService.updateById(inventoryHeader);
126 } 127 }
127 128
128 @Override 129 @Override
  130 + @Transactional
129 public boolean updateLocationCodeById(String locationCode, Integer id) { 131 public boolean updateLocationCodeById(String locationCode, Integer id) {
130 InventoryHeader inventoryHeader = new InventoryHeader(); 132 InventoryHeader inventoryHeader = new InventoryHeader();
131 inventoryHeader.setId(id); 133 inventoryHeader.setId(id);
132 inventoryHeader.setLocationCode(locationCode); 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,8 +367,7 @@ public class TaskHeaderController extends HuahengBaseController {
367 result = handleMultiProcess("cancelTask", new MultiProcessListener() { 367 result = handleMultiProcess("cancelTask", new MultiProcessListener() {
368 @Override 368 @Override
369 public Result<?> doProcess() { 369 public Result<?> doProcess() {
370 - Result result = taskHeaderService.cancelTask(taskId);  
371 - return result; 370 + return taskHeaderService.cancelTask(taskId);
372 } 371 }
373 }); 372 });
374 } 373 }