Commit 188ca5d621cff4769ac9276e34e3e3e1d6202262
1 parent
4f7479a0
1. 优化入库环节的一些sql
2. 增加日志
Showing
4 changed files
with
48 additions
and
15 deletions
ant-design-vue-jeecg/src/views/system/task/ReceiptTaskHeaderList.vue
... | ... | @@ -141,7 +141,10 @@ |
141 | 141 | <a-divider type="vertical"/></a> |
142 | 142 | <a v-if="record.isDoubleIn == 1 && record.exceptionState == 1" v-has="'taskHeader:executeTask'" @click="handleDoubleInTask(record)">修复重入数据 |
143 | 143 | <a-divider type="vertical"/></a> |
144 | - <a v-if="record.status <= 10" v-has="'taskHeader:cancelTask'" @click="cancelTask(record)" >取消</a> | |
144 | +<!-- <a v-if="record.status <= 10" v-has="'taskHeader:cancelTask'" @click="cancelTask(record)" >取消</a>--> | |
145 | + <a-popconfirm v-if="record.status <= 10" v-has="'taskHeader:cancelTask'" title="确定取消任务吗?" @confirm="() => cancelTask(record)"> | |
146 | + <a>取消</a> | |
147 | + </a-popconfirm> | |
145 | 148 | </span> |
146 | 149 | |
147 | 150 | </a-table> |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java
... | ... | @@ -49,10 +49,12 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
49 | 49 | |
50 | 50 | import cn.monitor4all.logRecord.annotation.OperationLog; |
51 | 51 | import cn.monitor4all.logRecord.context.LogRecordContext; |
52 | +import lombok.extern.slf4j.Slf4j; | |
52 | 53 | |
53 | 54 | /** |
54 | 55 | * @author 游杰 |
55 | 56 | */ |
57 | +@Slf4j | |
56 | 58 | @Service |
57 | 59 | public class WcsServiceImpl implements WcsService { |
58 | 60 | |
... | ... | @@ -96,6 +98,7 @@ public class WcsServiceImpl implements WcsService { |
96 | 98 | msg = "'任务类型:' + #taskHeader.getTaskType() + ',起始库位:' + #taskHeader.getFromLocationCode() + ',目标库位:' + #taskHeader.getToLocationCode() + ',容器编码:' + #taskHeader.getContainerCode()", |
97 | 99 | recordReturnValue = true) |
98 | 100 | public Result warecellAllocation(WarecellDomain warecellDomain) { |
101 | + log.info("开始分配库位"); | |
99 | 102 | String warehouseCode = warecellDomain.getWarehouseCode(); |
100 | 103 | String zoneCode = warecellDomain.getZoneCode(); |
101 | 104 | String height = warecellDomain.getHeight(); |
... | ... | @@ -253,6 +256,7 @@ public class WcsServiceImpl implements WcsService { |
253 | 256 | LogRecordContext.putVariable("receiptContainerDetailList", receiptContainerDetailList);// 操作日志收集 |
254 | 257 | LogRecordContext.putVariable("extraJsonString", JSON.toJSONString(receiptContainerDetailList));// 操作日志收集 |
255 | 258 | LogRecordContext.putVariable("taskHeader", taskHeader);// 操作日志收集 |
259 | + log.info("完成分配库位,任务号:" + taskNo + ", 库位号:" + locationCode); | |
256 | 260 | return Result.OK(wcsTask); |
257 | 261 | } |
258 | 262 | |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/impl/ReceiptContainerHeaderServiceImpl.java
1 | 1 | package org.jeecg.modules.wms.receipt.receiptContainerHeader.service.impl; |
2 | 2 | |
3 | 3 | import java.io.Serializable; |
4 | +import java.math.BigDecimal; | |
4 | 5 | import java.util.ArrayList; |
5 | 6 | import java.util.Collection; |
6 | 7 | import java.util.List; |
... | ... | @@ -41,6 +42,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
41 | 42 | |
42 | 43 | import cn.monitor4all.logRecord.annotation.OperationLog; |
43 | 44 | import cn.monitor4all.logRecord.context.LogRecordContext; |
45 | +import lombok.extern.slf4j.Slf4j; | |
44 | 46 | |
45 | 47 | /** |
46 | 48 | * @Description: 入库组盘 |
... | ... | @@ -48,6 +50,7 @@ import cn.monitor4all.logRecord.context.LogRecordContext; |
48 | 50 | * @Date: 2022-11-09 |
49 | 51 | * @Version: V1.0 |
50 | 52 | */ |
53 | +@Slf4j | |
51 | 54 | @Service |
52 | 55 | public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContainerHeaderMapper, ReceiptContainerHeader> implements IReceiptContainerHeaderService { |
53 | 56 | |
... | ... | @@ -107,6 +110,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai |
107 | 110 | msg = "'任务类型:' + #taskHeader.getTaskType() + ',起始库位:' + #taskHeader.getFromLocationCode() + ',目标库位:' + #taskHeader.getToLocationCode() + ',容器编码:' + #taskHeader.getContainerCode()", |
108 | 111 | condition = "#taskDetailList.size() > 0", recordReturnValue = true) |
109 | 112 | public Result<TaskHeader> createReceiptTask(ReceiptContainerHeader receiptContainerHeader, String warehouseCode) { |
113 | + log.info("开始创建入库任务"); | |
110 | 114 | if (!receiptContainerHeader.getWarehouseCode().equals(warehouseCode)) { |
111 | 115 | return Result.error("id:" + receiptContainerHeader.getId() + "的入库组盘不能在" + warehouseCode + "仓库操作"); |
112 | 116 | } |
... | ... | @@ -201,8 +205,10 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai |
201 | 205 | if (receiptDetail == null) { |
202 | 206 | throw new JeecgBootException("根据id:" + receiptContainerDetail.getReceiptDetailId() + ",没有找到入库单详情"); |
203 | 207 | } |
208 | + Integer receiptId = receiptDetail.getReceiptId(); | |
204 | 209 | receiptDetail = new ReceiptDetail(); |
205 | - receiptDetail.setReceiptId(receiptContainerDetail.getReceiptDetailId()); | |
210 | + receiptDetail.setId(receiptContainerDetail.getReceiptDetailId()); | |
211 | + receiptDetail.setReceiptId(receiptId); | |
206 | 212 | receiptDetail.setStatus(QuantityConstant.RECEIPT_HEADER_WAIT_SHELF); |
207 | 213 | receiptDetailList.add(receiptDetail); |
208 | 214 | } |
... | ... | @@ -239,6 +245,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai |
239 | 245 | LogRecordContext.putVariable("extraJsonString1", JSON.toJSONString(receiptContainerDetailList));// 操作日志收集 |
240 | 246 | LogRecordContext.putVariable("taskDetailList", taskDetailList);// 操作日志收集 |
241 | 247 | LogRecordContext.putVariable("extraJsonString2", JSON.toJSONString(taskDetailList));// 操作日志收集 |
248 | + log.info("完成创建入库任务"); | |
242 | 249 | return Result.OK("生成入库任务成功", taskHeader); |
243 | 250 | } |
244 | 251 | |
... | ... | @@ -313,6 +320,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai |
313 | 320 | @OperationLog(bizId = "''", bizType = "'入库单追踪'", tag = "'入库任务取消'", extra = "#extraJsonString", msg = "'任务ID:' + #taskHeader.getId()", |
314 | 321 | condition = "#receiptContainerDetailList.size() > 0", recordReturnValue = true) |
315 | 322 | public boolean cancelReceiptTask(TaskHeader taskHeader) { |
323 | + log.info("开始取消入库任务"); | |
316 | 324 | ReceiptContainerHeader receiptContainerHeader = getById(taskHeader.getReceiptContainerHeaderId()); |
317 | 325 | if (receiptContainerHeader == null) { |
318 | 326 | return false; |
... | ... | @@ -339,9 +347,11 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai |
339 | 347 | if (receiptDetail == null) { |
340 | 348 | throw new JeecgBootException("取消入库任务时, 没有找到入库单详情" + receiptContainerDetail.getReceiptDetailId()); |
341 | 349 | } |
350 | + Integer receiptId = receiptDetail.getReceiptId(); | |
342 | 351 | receiptDetail = new ReceiptDetail(); |
343 | 352 | receiptDetail.setId(receiptContainerDetail.getReceiptDetailId()); |
344 | 353 | receiptDetail.setStatus(QuantityConstant.RECEIPT_HEADER_RECEIVING); |
354 | + receiptDetail.setReceiptId(receiptId); | |
345 | 355 | receiptDetailList.add(receiptDetail); |
346 | 356 | } |
347 | 357 | if (receiptDetailList.size() != 0) { |
... | ... | @@ -360,6 +370,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai |
360 | 370 | } |
361 | 371 | LogRecordContext.putVariable("receiptContainerDetailList", receiptContainerDetailList);// 操作日志收集 |
362 | 372 | LogRecordContext.putVariable("extraJsonString", JSON.toJSONString(receiptContainerDetailList));// 操作日志收集 |
373 | + log.info("完成取消入库任务"); | |
363 | 374 | return true; |
364 | 375 | } |
365 | 376 | |
... | ... | @@ -367,6 +378,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai |
367 | 378 | @Transactional(rollbackFor = JeecgBootException.class) |
368 | 379 | @OperationLog(bizId = "''", bizType = "'入库单追踪'", tag = "'详情取消组盘'", extra = "#extraJsonString", msg = "''", recordReturnValue = true) |
369 | 380 | public Result cancelReceiving(Integer id) { |
381 | + log.info("开始取消入库组盘"); | |
370 | 382 | ReceiptContainerHeader receiptContainerHeader = getById(id); |
371 | 383 | if (receiptContainerHeader == null) { |
372 | 384 | return Result.error("取消组盘失败,没有找到入库组盘头ID:" + id); |
... | ... | @@ -376,7 +388,6 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai |
376 | 388 | return Result.error("取消组盘失败,已经生成入库任务"); |
377 | 389 | } |
378 | 390 | List<ReceiptContainerDetail> receiptContainerDetailList = receiptContainerDetailService.getReceiptContainerDetailListByHeaderId(id); |
379 | - List<ReceiptDetail> receiptDetailList = new ArrayList<ReceiptDetail>(); | |
380 | 391 | for (ReceiptContainerDetail receiptContainerDetail : receiptContainerDetailList) { |
381 | 392 | if (receiptContainerDetail == null) { |
382 | 393 | throw new JeecgBootException("取消组盘失败, 没有找到入库组盘详情"); |
... | ... | @@ -385,25 +396,27 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai |
385 | 396 | if (receiptDetail == null) { |
386 | 397 | throw new JeecgBootException("取消组盘失败, 没有找到入库详情ID:" + receiptContainerDetail.getReceiptDetailId()); |
387 | 398 | } |
399 | + BigDecimal taskQty = receiptDetail.getTaskQty(); | |
400 | + Integer receiptId = receiptDetail.getReceiptId(); | |
388 | 401 | receiptDetail = new ReceiptDetail(); |
389 | 402 | receiptDetail.setId(receiptContainerDetail.getReceiptDetailId()); |
390 | 403 | receiptDetail.setStatus(QuantityConstant.RECEIPT_HEADER_BUILD); |
391 | - receiptDetail.setTaskQty(receiptDetail.getTaskQty().subtract(receiptContainerDetail.getQty())); | |
404 | + receiptDetail.setTaskQty(taskQty.subtract(receiptContainerDetail.getQty())); | |
392 | 405 | if (!receiptDetailService.updateById(receiptDetail)) { |
393 | 406 | throw new JeecgBootException("取消组盘失败, 更新入库明细失败,入库详情ID:" + receiptContainerDetail.getReceiptDetailId()); |
394 | 407 | } |
395 | 408 | if (!receiptContainerDetailService.removeById(receiptContainerDetail.getId())) { |
396 | 409 | throw new JeecgBootException("取消组盘失败, 删除入库组盘明细表失败,组盘详情ID:" + receiptContainerDetail.getId()); |
397 | 410 | } |
398 | - if (!receiptHeaderService.updateReceiptHeaderStatus(receiptDetail.getReceiptId())) { | |
399 | - throw new JeecgBootException("取消组盘失败, 更新入库单头失败,入库单ID:" + receiptDetail.getReceiptId()); | |
411 | + if (!receiptHeaderService.updateReceiptHeaderStatus(receiptId)) { | |
412 | + throw new JeecgBootException("取消组盘失败, 更新入库单头失败,入库单ID:" + receiptId); | |
400 | 413 | } |
401 | - receiptDetailList.add(receiptDetail); | |
402 | 414 | } |
403 | 415 | if (!this.removeById(id)) { |
404 | 416 | throw new JeecgBootException("取消组盘失败, 删除入库组盘头表失败,组盘ID:" + id); |
405 | 417 | } |
406 | 418 | LogRecordContext.putVariable("extraJsonString", JSON.toJSONString(receiptContainerDetailList)); |
419 | + log.info("完成取消入库组盘"); | |
407 | 420 | return Result.ok("取消组盘成功"); |
408 | 421 | } |
409 | 422 | |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/service/impl/ReceiveServiceImpl.java
... | ... | @@ -3,6 +3,7 @@ package org.jeecg.modules.wms.receipt.receiving.service.impl; |
3 | 3 | import java.math.BigDecimal; |
4 | 4 | import java.util.ArrayList; |
5 | 5 | import java.util.List; |
6 | +import java.util.stream.Collectors; | |
6 | 7 | |
7 | 8 | import javax.annotation.Resource; |
8 | 9 | |
... | ... | @@ -40,10 +41,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
40 | 41 | |
41 | 42 | import cn.monitor4all.logRecord.annotation.OperationLog; |
42 | 43 | import cn.monitor4all.logRecord.context.LogRecordContext; |
44 | +import lombok.extern.slf4j.Slf4j; | |
43 | 45 | |
44 | 46 | /** |
45 | 47 | * @author 游杰 |
46 | 48 | */ |
49 | +@Slf4j | |
47 | 50 | @Service |
48 | 51 | public class ReceiveServiceImpl extends ServiceImpl<ReceiveMapper, Receive> implements IReceiveService { |
49 | 52 | |
... | ... | @@ -104,7 +107,8 @@ public class ReceiveServiceImpl extends ServiceImpl<ReceiveMapper, Receive> impl |
104 | 107 | @OperationLog(bizId = "''", bizType = "'物料追踪'", tag = "'入库组盘'", extra = "#extraJsonString", msg = "''", recordReturnValue = true) |
105 | 108 | @OperationLog(bizId = "''", bizType = "'入库单追踪'", tag = "'详情组盘'", extra = "#extraJsonString", msg = "''", recordReturnValue = true) |
106 | 109 | public Result<ReceiptContainerHeader> receiving(List<Receive> receiveList, String warehouseCode) { |
107 | - boolean result = false; | |
110 | + log.info("开始入库组盘"); | |
111 | + boolean success = false; | |
108 | 112 | if (receiveList == null || receiveList.size() == 0) { |
109 | 113 | return Result.error("入库组盘,收货信息为空"); |
110 | 114 | } |
... | ... | @@ -157,8 +161,8 @@ public class ReceiveServiceImpl extends ServiceImpl<ReceiveMapper, Receive> impl |
157 | 161 | receiptContainerHeader.setToLocationCode(fromLocationCode); |
158 | 162 | } |
159 | 163 | } |
160 | - result = receiptContainerHeaderService.save(receiptContainerHeader); | |
161 | - if (!result) { | |
164 | + success = receiptContainerHeaderService.save(receiptContainerHeader); | |
165 | + if (!success) { | |
162 | 166 | throw new JeecgBootException("入库组盘,保存入库组盘头失败"); |
163 | 167 | } |
164 | 168 | } |
... | ... | @@ -207,8 +211,10 @@ public class ReceiveServiceImpl extends ServiceImpl<ReceiveMapper, Receive> impl |
207 | 211 | |
208 | 212 | receiptDetail.setTaskQty(receiptTaskQty); |
209 | 213 | ReceiptDetail receiptDetail1 = new ReceiptDetail(); |
214 | + receiptDetail1.setReceiptId(receiptDetail.getReceiptId()); | |
210 | 215 | receiptDetail1.setId(receiptDetail.getId()); |
211 | 216 | receiptDetail1.setTaskQty(receiptTaskQty); |
217 | + receiptDetail1.setStatus(QuantityConstant.RECEIPT_HEADER_RECEIVING); | |
212 | 218 | receiptDetailList.add(receiptDetail1); |
213 | 219 | |
214 | 220 | LambdaQueryWrapper<ReceiptContainerDetail> receiptContainerDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); |
... | ... | @@ -250,17 +256,24 @@ public class ReceiveServiceImpl extends ServiceImpl<ReceiveMapper, Receive> impl |
250 | 256 | if (CollectionUtils.isEmpty(receiptDetailList)) { |
251 | 257 | throw new JeecgBootException("入库组盘,请填入收货数量"); |
252 | 258 | } |
253 | - result = receiptDetailService.updateBatchById(receiptDetailList); | |
254 | - if (!result) { | |
259 | + success = receiptDetailService.updateBatchById(receiptDetailList); | |
260 | + if (!success) { | |
255 | 261 | throw new JeecgBootException("入库组盘,批量更新入库单详情失败"); |
256 | 262 | } |
263 | + List<Integer> receiptIdList = receiptDetailList.stream().map(ReceiptDetail::getReceiptId).distinct().collect(Collectors.toList()); | |
264 | + for (Integer receiptId : receiptIdList) { | |
265 | + if (!receiptHeaderService.updateReceiptHeaderStatus(receiptId)) { | |
266 | + throw new JeecgBootException("入库组盘, 更新入库单明细失败"); | |
267 | + } | |
268 | + } | |
257 | 269 | if (receiptContainerDetailList.size() > 0) { |
258 | - result = receiptContainerDetailService.saveBatch(receiptContainerDetailList); | |
259 | - if (!result) { | |
270 | + success = receiptContainerDetailService.saveBatch(receiptContainerDetailList); | |
271 | + if (!success) { | |
260 | 272 | throw new JeecgBootException("入库组盘,保存入库组盘详情失败"); |
261 | 273 | } |
262 | 274 | } |
263 | 275 | LogRecordContext.putVariable("extraJsonString", JSON.toJSONString(receiptContainerDetailList)); |
264 | - return Result.OK("收货成功", receiptContainerHeader); | |
276 | + log.info("完成入库组盘"); | |
277 | + return Result.OK("入库组盘成功", receiptContainerHeader); | |
265 | 278 | } |
266 | 279 | } |
... | ... |