Commit 4bc3e205b39f5261a943fed7fe7332054e75df7d

Authored by 肖超群
1 parent 1c9e341c

替代锁定库位的方法

ant-design-vue-jeecg/src/views/system/task/CircleTaskHeaderList.vue
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
21 show-search 21 show-search
22 placeholder="请选择库区" 22 placeholder="请选择库区"
23 option-filter-prop="children" 23 option-filter-prop="children"
24 - 24 +
25 v-model="queryParam.zoneCode"> 25 v-model="queryParam.zoneCode">
26 <a-select-option v-for="item in zoneList" :key="item.name" :value="item.code"> 26 <a-select-option v-for="item in zoneList" :key="item.name" :value="item.code">
27 {{item.name}} 27 {{item.name}}
@@ -148,20 +148,7 @@ @@ -148,20 +148,7 @@
148 <a-divider type="vertical"/></a> 148 <a-divider type="vertical"/></a>
149 <a v-if="record.isDoubleIn == 1 && record.exceptionState == 1" v-has="'taskHeader:executeTask'" @click="handleDoubleInTask(record)">修复重入数据 149 <a v-if="record.isDoubleIn == 1 && record.exceptionState == 1" v-has="'taskHeader:executeTask'" @click="handleDoubleInTask(record)">修复重入数据
150 <a-divider type="vertical"/></a> 150 <a-divider type="vertical"/></a>
151 - <a v-if="record.status < 100" v-has="'taskHeader:cancelTask'" @click="cancelTask(record)">取消<a-divider type="vertical"/></a>  
152 - <a-dropdown>  
153 - <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>  
154 - <a-menu slot="overlay">  
155 - <a-menu-item v-has="'taskHeader:edit'">  
156 - <a @click="handleEdit(record)">编辑</a>  
157 - </a-menu-item>  
158 - <a-menu-item v-has="'taskHeader:delete'">  
159 - <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">  
160 - <a>删除</a>  
161 - </a-popconfirm>  
162 - </a-menu-item>  
163 - </a-menu>  
164 - </a-dropdown> 151 + <a v-if="record.status <= 10" v-has="'taskHeader:cancelTask'" @click="cancelTask(record)">取消<a-divider type="vertical"/></a>
165 </span> 152 </span>
166 153
167 </a-table> 154 </a-table>
ant-design-vue-jeecg/src/views/system/task/ReceiptTaskHeaderList.vue
@@ -141,7 +141,7 @@ @@ -141,7 +141,7 @@
141 <a-divider type="vertical"/></a> 141 <a-divider type="vertical"/></a>
142 <a v-if="record.isDoubleIn == 1 && record.exceptionState == 1" v-has="'taskHeader:executeTask'" @click="handleDoubleInTask(record)">修复重入数据 142 <a v-if="record.isDoubleIn == 1 && record.exceptionState == 1" v-has="'taskHeader:executeTask'" @click="handleDoubleInTask(record)">修复重入数据
143 <a-divider type="vertical"/></a> 143 <a-divider type="vertical"/></a>
144 - <a v-if="record.status < 100" v-has="'taskHeader:cancelTask'" @click="cancelTask(record)" >取消</a> 144 + <a v-if="record.status <= 10" v-has="'taskHeader:cancelTask'" @click="cancelTask(record)" >取消</a>
145 </span> 145 </span>
146 146
147 </a-table> 147 </a-table>
ant-design-vue-jeecg/src/views/system/task/ShipmentTaskHeaderList.vue
@@ -143,21 +143,8 @@ @@ -143,21 +143,8 @@
143 <a-divider type="vertical"/></a> 143 <a-divider type="vertical"/></a>
144 <a v-if="record.isDoubleIn == 1 && record.exceptionState == 1" v-has="'taskHeader:executeTask'" @click="handleDoubleInTask(record)">修复重入数据 144 <a v-if="record.isDoubleIn == 1 && record.exceptionState == 1" v-has="'taskHeader:executeTask'" @click="handleDoubleInTask(record)">修复重入数据
145 <a-divider type="vertical"/></a> 145 <a-divider type="vertical"/></a>
146 - <a v-if="record.status < 100" v-has="'taskHeader:cancelTask'" @click="cancelTask(record)">取消 146 + <a v-if="record.status <= 10" v-has="'taskHeader:cancelTask'" @click="cancelTask(record)">取消
147 <a-divider type="vertical"/></a> 147 <a-divider type="vertical"/></a>
148 - <a-dropdown>  
149 - <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>  
150 - <a-menu slot="overlay">  
151 - <a-menu-item v-has="'taskHeader:edit'">  
152 - <a @click="handleEdit(record)">编辑</a>  
153 - </a-menu-item>  
154 - <a-menu-item v-has="'taskHeader:delete'">  
155 - <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">  
156 - <a>删除</a>  
157 - </a-popconfirm>  
158 - </a-menu-item>  
159 - </a-menu>  
160 - </a-dropdown>  
161 </span> 148 </span>
162 149
163 </a-table> 150 </a-table>
ant-design-vue-jeecg/src/views/system/task/TransferTaskHeaderList.vue
@@ -147,20 +147,7 @@ @@ -147,20 +147,7 @@
147 <a-divider type="vertical"/></a> 147 <a-divider type="vertical"/></a>
148 <a v-if="record.isDoubleIn == 1 && record.exceptionState == 1" v-has="'taskHeader:executeTask'" @click="handleDoubleInTask(record)">修复重入数据 148 <a v-if="record.isDoubleIn == 1 && record.exceptionState == 1" v-has="'taskHeader:executeTask'" @click="handleDoubleInTask(record)">修复重入数据
149 <a-divider type="vertical"/></a> 149 <a-divider type="vertical"/></a>
150 - <a v-if="record.status < 100" v-has="'taskHeader:cancelTask'" @click="cancelTask(record)">取消<a-divider type="vertical"/></a>  
151 - <a-dropdown>  
152 - <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>  
153 - <a-menu slot="overlay">  
154 - <a-menu-item v-has="'taskHeader:edit'">  
155 - <a @click="handleEdit(record)">编辑</a>  
156 - </a-menu-item>  
157 - <a-menu-item v-has="'taskHeader:delete'">  
158 - <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">  
159 - <a>删除</a>  
160 - </a-popconfirm>  
161 - </a-menu-item>  
162 - </a-menu>  
163 - </a-dropdown> 150 + <a v-if="record.status <= 10" v-has="'taskHeader:cancelTask'" @click="cancelTask(record)">取消<a-divider type="vertical"/></a>
164 </span> 151 </span>
165 152
166 </a-table> 153 </a-table>
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java
@@ -172,7 +172,8 @@ public class WcsServiceImpl implements WcsService { @@ -172,7 +172,8 @@ public class WcsServiceImpl implements WcsService {
172 throw new JeecgBootException("分配库位时,更新库位状态失败"); 172 throw new JeecgBootException("分配库位时,更新库位状态失败");
173 } 173 }
174 if (StringUtils.isNotEmpty(taskHeader.getToLocationCode()) && !locationCode.equals(taskHeader.getToLocationCode())) { 174 if (StringUtils.isNotEmpty(taskHeader.getToLocationCode()) && !locationCode.equals(taskHeader.getToLocationCode())) {
175 - success = locationService.updateStatus(taskHeader.getToLocationCode(), QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); 175 + success = locationService.updateStatusByOldStatus(taskHeader.getToLocationCode(), QuantityConstant.STATUS_LOCATION_EMPTY,
  176 + QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode);
176 if (!success) { 177 if (!success) {
177 throw new JeecgBootException("分配库位时,更新之前分配的库位状态失败"); 178 throw new JeecgBootException("分配库位时,更新之前分配的库位状态失败");
178 } 179 }
@@ -593,7 +594,8 @@ public class WcsServiceImpl implements WcsService { @@ -593,7 +594,8 @@ public class WcsServiceImpl implements WcsService {
593 } 594 }
594 } 595 }
595 // 6. 锁定WMS分配的库位 596 // 6. 锁定WMS分配的库位
596 - boolean success = locationService.updateStatus(locationCode, QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); 597 + boolean success =
  598 + locationService.updateStatusByOldStatus(locationCode, QuantityConstant.STATUS_LOCATION_LOCK, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode);
597 if (!success) { 599 if (!success) {
598 throw new JeecgBootException("重入处理失败, 更新库位状态失败"); 600 throw new JeecgBootException("重入处理失败, 更新库位状态失败");
599 } 601 }
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/impl/ReceiptContainerHeaderServiceImpl.java
@@ -127,14 +127,16 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl&lt;ReceiptContai @@ -127,14 +127,16 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl&lt;ReceiptContai
127 String fromLocationCode = receiptContainerHeader.getFromLocationCode(); 127 String fromLocationCode = receiptContainerHeader.getFromLocationCode();
128 String toLocaitonCode = receiptContainerHeader.getToLocationCode(); 128 String toLocaitonCode = receiptContainerHeader.getToLocationCode();
129 if (StringUtils.isNotEmpty(fromLocationCode)) { 129 if (StringUtils.isNotEmpty(fromLocationCode)) {
130 - success = locationService.updateStatus(fromLocationCode, QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); 130 + success = locationService.updateStatusByOldStatus(fromLocationCode, QuantityConstant.STATUS_LOCATION_LOCK, QuantityConstant.STATUS_LOCATION_EMPTY,
  131 + warehouseCode);
131 if (!success) { 132 if (!success) {
132 throw new JeecgBootException("更新起始库位状态失败"); 133 throw new JeecgBootException("更新起始库位状态失败");
133 } 134 }
134 } 135 }
135 String zoneCode = null; 136 String zoneCode = null;
136 if (StringUtils.isNotEmpty(toLocaitonCode)) { 137 if (StringUtils.isNotEmpty(toLocaitonCode)) {
137 - success = locationService.updateStatus(toLocaitonCode, QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); 138 + success = locationService.updateStatusByOldStatus(toLocaitonCode, QuantityConstant.STATUS_LOCATION_LOCK, QuantityConstant.STATUS_LOCATION_EMPTY,
  139 + warehouseCode);
138 if (!success) { 140 if (!success) {
139 throw new JeecgBootException("更新目标库位状态失败"); 141 throw new JeecgBootException("更新目标库位状态失败");
140 } 142 }
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/impl/ShipmentCombinationServiceImpl.java
@@ -475,7 +475,8 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi @@ -475,7 +475,8 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi
475 if (!success) { 475 if (!success) {
476 throw new JeecgBootException("生成出库任务时, 更新容器失败" + containerCode); 476 throw new JeecgBootException("生成出库任务时, 更新容器失败" + containerCode);
477 } 477 }
478 - success = locationService.updateStatus(fromLocationCode, QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); 478 + success =
  479 + locationService.updateStatusByOldStatus(fromLocationCode, QuantityConstant.STATUS_LOCATION_LOCK, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode);
479 if (!success) { 480 if (!success) {
480 throw new JeecgBootException("生成出库任务时, 更新库位失败" + fromLocationCode); 481 throw new JeecgBootException("生成出库任务时, 更新库位失败" + fromLocationCode);
481 } 482 }
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailServiceImpl.java
@@ -8,6 +8,7 @@ import java.util.List; @@ -8,6 +8,7 @@ import java.util.List;
8 import javax.annotation.Resource; 8 import javax.annotation.Resource;
9 9
10 import org.jeecg.common.api.vo.Result; 10 import org.jeecg.common.api.vo.Result;
  11 +import org.jeecg.common.exception.JeecgBootException;
11 import org.jeecg.modules.wms.config.container.entity.Container; 12 import org.jeecg.modules.wms.config.container.entity.Container;
12 import org.jeecg.modules.wms.config.container.service.impl.ContainerServiceImpl; 13 import org.jeecg.modules.wms.config.container.service.impl.ContainerServiceImpl;
13 import org.jeecg.modules.wms.config.location.entity.Location; 14 import org.jeecg.modules.wms.config.location.entity.Location;
@@ -34,7 +35,6 @@ import org.springframework.beans.factory.annotation.Autowired; @@ -34,7 +35,6 @@ import org.springframework.beans.factory.annotation.Autowired;
34 import org.springframework.stereotype.Service; 35 import org.springframework.stereotype.Service;
35 import org.springframework.transaction.annotation.Transactional; 36 import org.springframework.transaction.annotation.Transactional;
36 37
37 -import org.jeecg.common.exception.JeecgBootException;  
38 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 38 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
39 import com.baomidou.mybatisplus.core.toolkit.Wrappers; 39 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
40 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 40 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -223,8 +223,11 @@ public class CycleCountDetailServiceImpl extends ServiceImpl&lt;CycleCountDetailMap @@ -223,8 +223,11 @@ public class CycleCountDetailServiceImpl extends ServiceImpl&lt;CycleCountDetailMap
223 } 223 }
224 224
225 // 生成任务同时锁定库位 225 // 生成任务同时锁定库位
226 - locationService.updateStatus(location.getCode(), QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode);  
227 - 226 + boolean success = locationService.updateStatusByOldStatus(location.getCode(), QuantityConstant.STATUS_LOCATION_LOCK, QuantityConstant.STATUS_LOCATION_EMPTY,
  227 + warehouseCode);
  228 + if (!success) {
  229 + throw new JeecgBootException("更新库位状态失败");
  230 + }
228 // 生成任务同时锁定容器 231 // 生成任务同时锁定容器
229 containerServiceImpl.updateStatus(location.getContainerCode(), QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); 232 containerServiceImpl.updateStatus(location.getContainerCode(), QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode);
230 233
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
@@ -352,7 +352,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea @@ -352,7 +352,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
352 throw new JeecgBootException("创建出库查看任务时,更新库存详情失败"); 352 throw new JeecgBootException("创建出库查看任务时,更新库存详情失败");
353 } 353 }
354 } 354 }
355 - success = locationService.updateStatus(fromLocationCode, QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); 355 + success =
  356 + locationService.updateStatusByOldStatus(fromLocationCode, QuantityConstant.STATUS_LOCATION_LOCK, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode);
356 if (!success) { 357 if (!success) {
357 throw new JeecgBootException("创建出库查看任务时,更新库位状态失败"); 358 throw new JeecgBootException("创建出库查看任务时,更新库位状态失败");
358 } 359 }
@@ -528,7 +529,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea @@ -528,7 +529,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
528 if (!toLocation.getStatus().equals(QuantityConstant.STATUS_LOCATION_EMPTY)) { 529 if (!toLocation.getStatus().equals(QuantityConstant.STATUS_LOCATION_EMPTY)) {
529 return Result.error("创建空托盘组入库任务时,目标库位状态不是空闲"); 530 return Result.error("创建空托盘组入库任务时,目标库位状态不是空闲");
530 } 531 }
531 - success = locationService.updateStatus(toLocationCode, QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); 532 + success = locationService.updateStatusByOldStatus(toLocationCode, QuantityConstant.STATUS_LOCATION_LOCK, QuantityConstant.STATUS_LOCATION_EMPTY,
  533 + warehouseCode);
532 if (!success) { 534 if (!success) {
533 throw new JeecgBootException("创建空托盘组入库任务时, 更新库位状态失败"); 535 throw new JeecgBootException("创建空托盘组入库任务时, 更新库位状态失败");
534 } 536 }
@@ -584,7 +586,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea @@ -584,7 +586,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
584 if (!success) { 586 if (!success) {
585 throw new JeecgBootException("创建空托盘组出库任务时, 更新容器状态失败"); 587 throw new JeecgBootException("创建空托盘组出库任务时, 更新容器状态失败");
586 } 588 }
587 - success = locationService.updateStatus(fromLocationCode, QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); 589 + success =
  590 + locationService.updateStatusByOldStatus(fromLocationCode, QuantityConstant.STATUS_LOCATION_LOCK, QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode);
588 if (!success) { 591 if (!success) {
589 throw new JeecgBootException("创建空托盘组出库任务时, 更新库位状态失败"); 592 throw new JeecgBootException("创建空托盘组出库任务时, 更新库位状态失败");
590 } 593 }
@@ -979,7 +982,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea @@ -979,7 +982,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
979 if (!QuantityConstant.STATUS_LOCATION_EMPTY.equals(toLocation.getStatus())) { 982 if (!QuantityConstant.STATUS_LOCATION_EMPTY.equals(toLocation.getStatus())) {
980 return Result.error("创建空托盘入库时, 目标库位非空闲"); 983 return Result.error("创建空托盘入库时, 目标库位非空闲");
981 } 984 }
982 - boolean success = locationService.updateStatus(toLocationCode, QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); 985 + boolean success = locationService.updateStatusByOldStatus(toLocationCode, QuantityConstant.STATUS_LOCATION_LOCK, QuantityConstant.STATUS_LOCATION_EMPTY,
  986 + warehouseCode);
983 if (!success) { 987 if (!success) {
984 throw new JeecgBootException("创建空托盘入库时,更新库位状态失败"); 988 throw new JeecgBootException("创建空托盘入库时,更新库位状态失败");
985 } 989 }
@@ -1045,7 +1049,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea @@ -1045,7 +1049,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1045 if (port == null) { 1049 if (port == null) {
1046 return Result.error("创建空托盘出库时, 没有找到出库口" + toPortCode); 1050 return Result.error("创建空托盘出库时, 没有找到出库口" + toPortCode);
1047 } 1051 }
1048 - boolean success = locationService.updateStatus(fromLocationCode, QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); 1052 + boolean success =
  1053 + locationService.updateStatusByOldStatus(fromLocationCode, QuantityConstant.STATUS_LOCATION_LOCK, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode);
1049 if (!success) { 1054 if (!success) {
1050 throw new JeecgBootException("创建空托盘出库时,更新库位状态失败"); 1055 throw new JeecgBootException("创建空托盘出库时,更新库位状态失败");
1051 } 1056 }
@@ -2250,13 +2255,15 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea @@ -2250,13 +2255,15 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
2250 2255
2251 boolean success = false; 2256 boolean success = false;
2252 if (StringUtils.isNotEmpty(fromLocationCode)) { 2257 if (StringUtils.isNotEmpty(fromLocationCode)) {
2253 - success = locationService.updateStatus(fromLocationCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); 2258 + success = locationService.updateStatusByOldStatus(fromLocationCode, QuantityConstant.STATUS_LOCATION_EMPTY, QuantityConstant.STATUS_LOCATION_LOCK,
  2259 + warehouseCode);
2254 if (!success) { 2260 if (!success) {
2255 throw new JeecgBootException("取消任务时, 更新起始库位状态失败"); 2261 throw new JeecgBootException("取消任务时, 更新起始库位状态失败");
2256 } 2262 }
2257 } 2263 }
2258 if (StringUtils.isNotEmpty(toLocationCode)) { 2264 if (StringUtils.isNotEmpty(toLocationCode)) {
2259 - success = locationService.updateStatus(toLocationCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); 2265 + success = locationService.updateStatusByOldStatus(toLocationCode, QuantityConstant.STATUS_LOCATION_EMPTY, QuantityConstant.STATUS_LOCATION_LOCK,
  2266 + warehouseCode);
2260 if (!success) { 2267 if (!success) {
2261 throw new JeecgBootException("取消任务时, 更新目标库位状态失败"); 2268 throw new JeecgBootException("取消任务时, 更新目标库位状态失败");
2262 } 2269 }