Commit 3f0b84fc2fea4da3dbdabf15bb3a2fbdb9690e02
1 parent
7b73017d
出库完成时删除临时容器
Showing
4 changed files
with
43 additions
and
18 deletions
src/main/java/com/huaheng/pc/config/container/service/ContainerService.java
... | ... | @@ -17,4 +17,7 @@ public interface ContainerService extends IService<Container>{ |
17 | 17 | |
18 | 18 | void updateLocationCodeAndStatus(String containerCode, String locationCode, String status); |
19 | 19 | |
20 | + void removeContainer(String containType, String containCode); | |
21 | + | |
22 | + void removeByCode(String containCode); | |
20 | 23 | } |
... | ... |
src/main/java/com/huaheng/pc/config/container/service/ContainerServiceImpl.java
... | ... | @@ -18,6 +18,7 @@ import java.util.List; |
18 | 18 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
19 | 19 | import com.huaheng.pc.config.container.domain.Container; |
20 | 20 | import com.huaheng.pc.config.container.mapper.ContainerMapper; |
21 | +import org.springframework.transaction.annotation.Transactional; | |
21 | 22 | |
22 | 23 | @Service |
23 | 24 | public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container> implements ContainerService{ |
... | ... | @@ -127,5 +128,38 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container |
127 | 128 | containerMapper.updateLocationCodeAndStatus(ShiroUtils.getWarehouseCode(), containerCode, locationCode, status); |
128 | 129 | } |
129 | 130 | |
131 | + /** | |
132 | + * 如果为临时容器,在取消组盘和出库任务完成时删除容器 | |
133 | + * @param containerType 容器类型 | |
134 | + * @param containerCode 容器编码 | |
135 | + * @return | |
136 | + */ | |
137 | + @Transactional | |
138 | + public void removeContainer(String containerType, String containerCode) { | |
139 | + if ("LS".equals(containerType)) { | |
140 | + LambdaQueryWrapper<Container> lambdaQueryWrapper = Wrappers.lambdaQuery(); | |
141 | + lambdaQueryWrapper.eq(Container::getCode,containerCode); | |
142 | + if (!this.remove(lambdaQueryWrapper)){ | |
143 | + throw new ServiceException("删除临时容器失败"); | |
144 | + } | |
145 | + } | |
146 | + } | |
147 | + | |
148 | + /** | |
149 | + * 如果为临时容器出库任务完成时删除容器 | |
150 | + * @param containCode | |
151 | + */ | |
152 | + @Override | |
153 | + @Transactional | |
154 | + public void removeByCode(String containCode) { | |
155 | + LambdaQueryWrapper<Container> lambdaQueryWrapper = Wrappers.lambdaQuery(); | |
156 | + lambdaQueryWrapper.eq(Container::getCode, containCode); | |
157 | + Container container = this.getOne(lambdaQueryWrapper); | |
158 | + if ("LS".equals(container.getContainerType())) { | |
159 | + if (!this.removeById(container.getId())){ | |
160 | + throw new ServiceException("删除临时容器失败"); | |
161 | + } | |
162 | + } | |
130 | 163 | |
164 | + } | |
131 | 165 | } |
... | ... |
src/main/java/com/huaheng/pc/receipt/receiptContainerHeader/service/ReceiptContainerHeaderServiceImpl.java
... | ... | @@ -164,7 +164,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai |
164 | 164 | List<ReceiptContainerDetail> containerDetailList = receiptContainerDetailService.list(containerDetailLambda); |
165 | 165 | |
166 | 166 | //如果是临时容器,取消组盘时删除容器表 |
167 | - removeContainer(receiptContainerDetail.getContainerType(), receiptContainerDetail.getContainerCode()); | |
167 | + containerService.removeContainer(receiptContainerDetail.getContainerType(), receiptContainerDetail.getContainerCode()); | |
168 | 168 | |
169 | 169 | //如果入库组盘没有该入库单的组盘信息,回滚入库单状态 |
170 | 170 | if (containerDetailList == null){ |
... | ... | @@ -393,21 +393,4 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai |
393 | 393 | } |
394 | 394 | return code; |
395 | 395 | } |
396 | - | |
397 | - /** | |
398 | - * 如果为临时容器,在取消组盘和出库任务完成时删除容器 | |
399 | - * @param containerType 容器类型 | |
400 | - * @param containerCode 容器编码 | |
401 | - * @return | |
402 | - */ | |
403 | - @Transactional | |
404 | - public void removeContainer(String containerType, String containerCode) { | |
405 | - if ("LS".equals(containerType)) { | |
406 | - LambdaQueryWrapper<Container> lambdaQueryWrapper = Wrappers.lambdaQuery(); | |
407 | - lambdaQueryWrapper.eq(Container::getCode,containerCode); | |
408 | - if (!containerService.remove(lambdaQueryWrapper)){ | |
409 | - throw new ServiceException("删除临时容器失败"); | |
410 | - } | |
411 | - } | |
412 | - } | |
413 | 396 | } |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderServiceImpl.java
... | ... | @@ -1174,6 +1174,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1174 | 1174 | * 完成出库任务 |
1175 | 1175 | * */ |
1176 | 1176 | @Override |
1177 | + @Transactional | |
1177 | 1178 | public void completeShipmentTask(TaskHeader task) { |
1178 | 1179 | //获取所有子任务 |
1179 | 1180 | TaskDetail condition = new TaskDetail(); |
... | ... | @@ -1246,6 +1247,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1246 | 1247 | task.setLastUpdatedBy(ShiroUtils.getLoginName()); |
1247 | 1248 | task.setLastUpdated(new Date()); |
1248 | 1249 | taskHeaderService.updateById(task); |
1250 | + | |
1251 | + //如果是临时容器出库完成后删除容器 | |
1252 | + containerService.removeByCode(task.getContainerCode()); | |
1253 | + | |
1249 | 1254 | //将库位状态改为空闲,如果是整出的对应的容器也清空 |
1250 | 1255 | Location locationRecord = new Location(); |
1251 | 1256 | locationRecord.setStatus("empty"); |
... | ... |