Commit cbe19d7043ec89420df96d52f7c6130ad9c12bdc

Authored by 谭毅彬
1 parent 99795bb1

入库组盘日志记录提交

Signed-off-by: TanYibin <5491541@qq.com>
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/monitor/operation/service/impl/OperationLogServiceImpl.java
... ... @@ -45,17 +45,23 @@ public class OperationLogServiceImpl extends ServiceImpl&lt;OperationLogMapper, Ope
45 45 if (receiptContainerDetail == null || receiptContainerDetail.getUniqueCode() == null) {
46 46 continue;
47 47 }
48   - String msg = StrUtil.format("上游单号:{},入库单据号:{},仓库编码:{},托盘编码:{},物料编码:{},数量:{}", receiptContainerDetail.getReferCode(),
  48 + String operationMsg = null;
  49 + String msg = StrUtil.format("上游单号:{},入库单据号:{},仓库编码:{},容器编码:{},物料编码:{},数量:{}", receiptContainerDetail.getReferCode(),
49 50 receiptContainerDetail.getReceiptCode(), receiptContainerDetail.getWarehouseCode(), receiptContainerDetail.getContainerCode(),
50 51 receiptContainerDetail.getMaterialCode(), receiptContainerDetail.getQty());
  52 + if (!StringUtils.isEmpty(logDTO.getMsg())) {
  53 + operationMsg = logDTO.getMsg() + "," + msg;
  54 + } else {
  55 + operationMsg = msg;
  56 + }
51 57 OperationLog operationLog = new OperationLog();
52 58 operationLog.setBizId(receiptContainerDetail.getUniqueCode());
  59 + operationLog.setOperationMsg(StringUtils.substring(operationMsg, 0, 1000));
53 60 operationLog.setBizType(logDTO.getBizType());
54 61 operationLog.setBizTag(logDTO.getTag());
55 62 operationLog.setContentException(StringUtils.substring(logDTO.getException(), 0, 1000));
56 63 operationLog.setContentReturn(StringUtils.substring(logDTO.getReturnStr(), 0, 1000));
57 64 operationLog.setOperationCostTime(logDTO.getExecutionTime());
58   - operationLog.setOperationMsg(StringUtils.substring(msg, 0, 1000));
59 65 operationLog.setOperationStatus(logDTO.getSuccess().equals(true) ? 1 : 0);
60 66 operationLog.setOperationTime(logDTO.getOperateDate());
61 67 operationLog.setOperatorName(logDTO.getOperatorId());
... ... @@ -71,10 +77,16 @@ public class OperationLogServiceImpl extends ServiceImpl&lt;OperationLogMapper, Ope
71 77 if (receiptDetail == null || receiptDetail.getReceiptCode() == null) {
72 78 continue;
73 79 }
  80 + String operationMsg = null;
74 81 String msg = StrUtil.format("物料编码:{},数量:{},已收数量:{}", receiptDetail.getMaterialCode(), receiptDetail.getQty(), receiptDetail.getTaskQty());
  82 + if (!StringUtils.isEmpty(logDTO.getMsg())) {
  83 + operationMsg = logDTO.getMsg() + "," + msg;
  84 + } else {
  85 + operationMsg = msg;
  86 + }
75 87 OperationLog operationLog = new OperationLog();
76 88 operationLog.setBizId(receiptDetail.getReceiptCode());
77   - operationLog.setOperationMsg(StringUtils.substring(msg, 0, 1000));
  89 + operationLog.setOperationMsg(StringUtils.substring(operationMsg, 0, 1000));
78 90 operationLog.setBizType(logDTO.getBizType());
79 91 operationLog.setBizTag(logDTO.getTag());
80 92 operationLog.setContentException(StringUtils.substring(logDTO.getException(), 0, 1000));
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptHeader/controller/ReceiptHeaderController.java
1 1 package org.jeecg.modules.wms.receipt.receiptHeader.controller;
2 2  
3 3 import java.io.IOException;
  4 +import java.util.ArrayList;
4 5 import java.util.Arrays;
  6 +import java.util.Collections;
5 7 import java.util.List;
6 8 import java.util.Map;
7 9 import java.util.stream.Collectors;
... ... @@ -42,6 +44,7 @@ import org.springframework.web.multipart.MultipartFile;
42 44 import org.springframework.web.multipart.MultipartHttpServletRequest;
43 45 import org.springframework.web.servlet.ModelAndView;
44 46  
  47 +import com.alibaba.fastjson.JSON;
45 48 import com.aliyun.oss.ServiceException;
46 49 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
47 50 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
... ... @@ -49,6 +52,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
49 52 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
50 53 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
51 54  
  55 +import cn.monitor4all.logRecord.annotation.OperationLog;
  56 +import cn.monitor4all.logRecord.context.LogRecordContext;
52 57 import io.swagger.annotations.Api;
53 58 import io.swagger.annotations.ApiOperation;
54 59 import lombok.extern.slf4j.Slf4j;
... ... @@ -219,8 +224,8 @@ public class ReceiptHeaderController extends JeecgController&lt;ReceiptHeader, IRec
219 224 */
220 225 @AutoLog(value = "入库单详情-添加")
221 226 @ApiOperation(value = "入库单详情-添加", notes = "入库单详情-添加")
222   - @PostMapping(value = "/addReceiptDetail")
223 227 @RequiresPermissions("receiptDetail:add")
  228 + @PostMapping(value = "/addReceiptDetail")
224 229 public Result<?> addReceiptDetail(@RequestBody ReceiptDetail receiptDetail) {
225 230 return receiptDetailService.saveReceiptDetail(receiptDetail);
226 231 }
... ... @@ -234,8 +239,10 @@ public class ReceiptHeaderController extends JeecgController&lt;ReceiptHeader, IRec
234 239 @ApiOperation(value = "入库单详情-编辑", notes = "入库单详情-编辑")
235 240 @RequiresPermissions("receiptDetail:edit")
236 241 @RequestMapping(value = "/editReceiptDetail", method = {RequestMethod.PUT, RequestMethod.POST})
  242 + @OperationLog(bizId = "''", bizType = "'入库单追踪'", tag = "'入库详情编辑'", extra = "#extraJsonString", msg = "''", recordReturnValue = true)
237 243 public Result<String> editReceiptDetail(@RequestBody ReceiptDetail receiptDetail) {
238 244 receiptDetailService.updateById(receiptDetail);
  245 + LogRecordContext.putVariable("extraJsonString", JSON.toJSONString(Collections.singletonList(receiptDetail)));// 操作日志收集
239 246 return Result.OK("编辑成功!");
240 247 }
241 248  
... ... @@ -248,6 +255,7 @@ public class ReceiptHeaderController extends JeecgController&lt;ReceiptHeader, IRec
248 255 @ApiOperation(value = "入库单详情-通过id删除", notes = "入库单详情-通过id删除")
249 256 @RequiresPermissions("receiptDetail:delete")
250 257 @DeleteMapping(value = "/deleteReceiptDetail")
  258 + @OperationLog(bizId = "''", bizType = "'入库单追踪'", tag = "'入库详情删除'", extra = "#extraJsonString", msg = "''", recordReturnValue = true)
251 259 public Result<String> deleteReceiptDetail(@RequestParam(name = "id", required = true) String id) {
252 260 ReceiptDetail receiptDetail = receiptDetailService.getById(id);
253 261 if (receiptDetail == null) {
... ... @@ -268,6 +276,7 @@ public class ReceiptHeaderController extends JeecgController&lt;ReceiptHeader, IRec
268 276 if (!success) {
269 277 throw new ServiceException("更新入库单头数量失败");
270 278 }
  279 + LogRecordContext.putVariable("extraJsonString", JSON.toJSONString(Collections.singletonList(receiptDetail)));// 操作日志收集
271 280 return Result.OK("删除成功!");
272 281 }
273 282  
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptHeader/service/impl/ReceiptDetailServiceImpl.java
... ... @@ -16,6 +16,7 @@ import org.jeecg.utils.constant.QuantityConstant;
16 16 import org.springframework.stereotype.Service;
17 17  
18 18 import java.util.ArrayList;
  19 +import java.util.Collections;
19 20 import java.util.List;
20 21 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
21 22  
... ... @@ -88,10 +89,7 @@ public class ReceiptDetailServiceImpl extends ServiceImpl&lt;ReceiptDetailMapper, R
88 89 if (!success) {
89 90 throw new ServiceException("添加失败, 保存入库单详失败");
90 91 }
91   - // 操作日志收集
92   - List<ReceiptDetail> receiptDetailList = new ArrayList<ReceiptDetail>();
93   - receiptDetailList.add(receiptDetail);
94   - LogRecordContext.putVariable("extraJsonString", JSON.toJSONString(receiptDetailList));
  92 + LogRecordContext.putVariable("extraJsonString", JSON.toJSONString(Collections.singletonList(receiptDetail)));// 操作日志收集
95 93 return Result.OK("添加成功!");
96 94 }
97 95 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptHeader/service/impl/ReceiptHeaderServiceImpl.java
... ... @@ -124,7 +124,6 @@ public class ReceiptHeaderServiceImpl extends ServiceImpl&lt;ReceiptHeaderMapper, R
124 124 @Override
125 125 @Transactional
126 126 public String createCode(String receiptType) {
127   - int i = 0;
128 127 String code = null;
129 128 Date now = new Date();
130 129 SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/service/impl/ReceiveServiceImpl.java
... ... @@ -88,7 +88,8 @@ public class ReceiveServiceImpl extends ServiceImpl&lt;ReceiveMapper, Receive&gt; impl
88 88 */
89 89 @Override
90 90 @Transactional(rollbackFor = ServiceException.class)
91   - @OperationLog(bizId = "''", bizType = "'物料追踪'", tag = "'入库组盘'", extra = "#extraJsonString", msg = "''", recordReturnValue = true)
  91 + @OperationLog(bizId = "''", bizType = "'物料追踪'", tag = "'入库组盘'", extra = "#extraJsonString1", msg = "''", recordReturnValue = true)
  92 + @OperationLog(bizId = "''", bizType = "'入库单追踪'", tag = "'入库组盘'", extra = "#extraJsonString2", msg = "'容器编码:' + #receiveList.get(0).getContainerCode()", recordReturnValue = true)
92 93 public Result<ReceiptContainerHeader> receiving(List<Receive> receiveList, String warehouseCode) {
93 94 boolean result = false;
94 95 if (receiveList == null || receiveList.size() == 0) {
... ... @@ -236,7 +237,8 @@ public class ReceiveServiceImpl extends ServiceImpl&lt;ReceiveMapper, Receive&gt; impl
236 237 throw new ServiceException("保存入库组盘详情失败");
237 238 }
238 239 }
239   - LogRecordContext.putVariable("extraJsonString", JSON.toJSONString(receiptContainerDetailList));
  240 + LogRecordContext.putVariable("extraJsonString1", JSON.toJSONString(receiptContainerDetailList));
  241 + LogRecordContext.putVariable("extraJsonString2", JSON.toJSONString(receiptDetailList));
240 242 return Result.OK("收货成功", receiptContainerHeader);
241 243 }
242 244 }
... ...