Commit 43dfeb091d0d44547f9a61f90ed4859a1146df52
1 parent
cd1b594c
单据追踪代码提交
Signed-off-by: TanYibin <5491541@qq.com>
Showing
6 changed files
with
53 additions
and
3 deletions
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/monitor/operation/service/impl/OperationLogServiceImpl.java
... | ... | @@ -7,6 +7,7 @@ import org.jeecg.modules.wms.monitor.operation.entity.OperationLog; |
7 | 7 | import org.jeecg.modules.wms.monitor.operation.mapper.OperationLogMapper; |
8 | 8 | import org.jeecg.modules.wms.monitor.operation.service.IOperationLogService; |
9 | 9 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerDetail; |
10 | +import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail; | |
10 | 11 | import org.jeecg.utils.StringUtils; |
11 | 12 | import org.springframework.stereotype.Service; |
12 | 13 | import org.springframework.util.CollectionUtils; |
... | ... | @@ -44,7 +45,7 @@ public class OperationLogServiceImpl extends ServiceImpl<OperationLogMapper, Ope |
44 | 45 | if (receiptContainerDetail == null || receiptContainerDetail.getUniqueCode() == null) { |
45 | 46 | continue; |
46 | 47 | } |
47 | - String msg = StrUtil.format("上游单号:{},入库单据号:{},仓库编码:{},托盘编码:{},物料编码:{},入库数量:{}", receiptContainerDetail.getReferCode(), | |
48 | + String msg = StrUtil.format("上游单号:[{}],入库单据号:[{}],仓库编码:[{}],托盘编码:[{}],物料编码:[{}],数量:[{}]", receiptContainerDetail.getReferCode(), | |
48 | 49 | receiptContainerDetail.getReceiptCode(), receiptContainerDetail.getWarehouseCode(), receiptContainerDetail.getContainerCode(), |
49 | 50 | receiptContainerDetail.getMaterialCode(), receiptContainerDetail.getQty()); |
50 | 51 | OperationLog operationLog = new OperationLog(); |
... | ... | @@ -61,16 +62,41 @@ public class OperationLogServiceImpl extends ServiceImpl<OperationLogMapper, Ope |
61 | 62 | operationLogList.add(operationLog); |
62 | 63 | } |
63 | 64 | } |
65 | + if (logDTO.getBizType().equals("入库单据追踪")) { | |
66 | + List<ReceiptDetail> receiptDetailList = JSON.parseArray(logDTO.getExtra(), ReceiptDetail.class); | |
67 | + if (CollectionUtils.isEmpty(receiptDetailList)) { | |
68 | + return true; | |
69 | + } | |
70 | + for (ReceiptDetail receiptDetail : receiptDetailList) { | |
71 | + if (receiptDetail == null || receiptDetail.getReceiptCode() == null) { | |
72 | + continue; | |
73 | + } | |
74 | + String msg = StrUtil.format("上游单号:[{}],仓库编码:[{}],物料编码:[{}],数量:[{}],已收数量:[{}]", receiptDetail.getReferCode(), | |
75 | + receiptDetail.getWarehouseCode(), receiptDetail.getMaterialCode(), receiptDetail.getQty(), receiptDetail.getTaskQty()); | |
76 | + OperationLog operationLog = new OperationLog(); | |
77 | + operationLog.setBizId(receiptDetail.getReceiptCode()); | |
78 | + operationLog.setOperationMsg(StringUtils.substring(msg, 0, 1000)); | |
79 | + operationLog.setBizType(logDTO.getBizType()); | |
80 | + operationLog.setBizTag(logDTO.getTag()); | |
81 | + operationLog.setContentException(StringUtils.substring(logDTO.getException(), 0, 1000)); | |
82 | + operationLog.setContentReturn(StringUtils.substring(logDTO.getReturnStr(), 0, 1000)); | |
83 | + operationLog.setOperationCostTime(logDTO.getExecutionTime()); | |
84 | + operationLog.setOperationStatus(logDTO.getSuccess().equals(true) ? 1 : 0); | |
85 | + operationLog.setOperationTime(logDTO.getOperateDate()); | |
86 | + operationLog.setOperatorName(logDTO.getOperatorId()); | |
87 | + operationLogList.add(operationLog); | |
88 | + } | |
89 | + } | |
64 | 90 | } |
65 | 91 | if (!StringUtils.isEmpty(logDTO.getBizId())) { |
66 | 92 | OperationLog operationLog = new OperationLog(); |
67 | 93 | operationLog.setBizId(logDTO.getBizId()); |
94 | + operationLog.setOperationMsg(StringUtils.substring(logDTO.getMsg(), 0, 1000)); | |
68 | 95 | operationLog.setBizType(logDTO.getBizType()); |
69 | 96 | operationLog.setBizTag(logDTO.getTag()); |
70 | 97 | operationLog.setContentException(StringUtils.substring(logDTO.getException(), 0, 1000)); |
71 | 98 | operationLog.setContentReturn(StringUtils.substring(logDTO.getReturnStr(), 0, 1000)); |
72 | 99 | operationLog.setOperationCostTime(logDTO.getExecutionTime()); |
73 | - operationLog.setOperationMsg(StringUtils.substring(logDTO.getMsg(), 0, 1000)); | |
74 | 100 | operationLog.setOperationStatus(logDTO.getSuccess().equals(true) ? 1 : 0); |
75 | 101 | operationLog.setOperationTime(logDTO.getOperateDate()); |
76 | 102 | operationLog.setOperatorName(logDTO.getOperatorId()); |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/entity/ReceiptContainerDetail.java
... | ... | @@ -95,6 +95,7 @@ public class ReceiptContainerDetail implements Serializable { |
95 | 95 | @Excel(name = "项目号", width = 15) |
96 | 96 | @ApiModelProperty(value = "项目号") |
97 | 97 | private String project; |
98 | + @Excel(name = "唯一号", width = 15) | |
98 | 99 | @ApiModelProperty(value = "唯一号") |
99 | 100 | private String uniqueCode; |
100 | 101 | /** 备用字段1 */ |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptHeader/service/impl/ReceiptDetailServiceImpl.java
1 | 1 | package org.jeecg.modules.wms.receipt.receiptHeader.service.impl; |
2 | 2 | |
3 | +import com.alibaba.fastjson.JSON; | |
3 | 4 | import com.aliyun.oss.ServiceException; |
4 | 5 | import org.jeecg.common.api.vo.Result; |
5 | 6 | import org.jeecg.modules.wms.config.material.entity.Material; |
... | ... | @@ -9,11 +10,18 @@ import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; |
9 | 10 | import org.jeecg.modules.wms.receipt.receiptHeader.mapper.ReceiptDetailMapper; |
10 | 11 | import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptDetailService; |
11 | 12 | import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptHeaderService; |
13 | +import org.jeecg.utils.HuahengJwtUtil; | |
12 | 14 | import org.jeecg.utils.StringUtils; |
13 | 15 | import org.jeecg.utils.constant.QuantityConstant; |
14 | 16 | import org.springframework.stereotype.Service; |
17 | + | |
18 | +import java.util.ArrayList; | |
15 | 19 | import java.util.List; |
16 | 20 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
21 | + | |
22 | +import cn.monitor4all.logRecord.annotation.OperationLog; | |
23 | +import cn.monitor4all.logRecord.context.LogRecordContext; | |
24 | + | |
17 | 25 | import org.springframework.beans.factory.annotation.Autowired; |
18 | 26 | |
19 | 27 | import javax.annotation.Resource; |
... | ... | @@ -42,6 +50,7 @@ public class ReceiptDetailServiceImpl extends ServiceImpl<ReceiptDetailMapper, R |
42 | 50 | } |
43 | 51 | |
44 | 52 | @Override |
53 | + @OperationLog(bizId = "''", bizType = "'入库单据追踪'", tag = "'入库详情添加'", extra = "#extraJsonString", msg = "''", operatorId = "#username", recordReturnValue = true) | |
45 | 54 | public Result saveReceiptDetail(ReceiptDetail receiptDetail) { |
46 | 55 | ReceiptHeader receiptHeader = receiptHeaderService.getById(receiptDetail.getReceiptId()); |
47 | 56 | if (receiptHeader == null) { |
... | ... | @@ -79,6 +88,11 @@ public class ReceiptDetailServiceImpl extends ServiceImpl<ReceiptDetailMapper, R |
79 | 88 | if (!success) { |
80 | 89 | throw new ServiceException("添加失败, 保存入库单详失败"); |
81 | 90 | } |
91 | + // 操作日志收集 | |
92 | + List<ReceiptDetail> receiptDetailList = new ArrayList<ReceiptDetail>(); | |
93 | + receiptDetailList.add(receiptDetail); | |
94 | + LogRecordContext.putVariable("username", HuahengJwtUtil.getCurrentOperator()); | |
95 | + LogRecordContext.putVariable("extraJsonString", JSON.toJSONString(receiptDetailList)); | |
82 | 96 | return Result.OK("添加成功!"); |
83 | 97 | } |
84 | 98 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptHeader/service/impl/ReceiptHeaderServiceImpl.java
... | ... | @@ -15,10 +15,15 @@ import org.jeecg.modules.wms.receipt.receiptHeader.mapper.ReceiptHeaderMapper; |
15 | 15 | import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptDetailService; |
16 | 16 | import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptHeaderService; |
17 | 17 | import org.jeecg.modules.wms.receipt.receiptHeaderHistory.service.IReceiptHeaderHistoryService; |
18 | +import org.jeecg.utils.HuahengJwtUtil; | |
18 | 19 | import org.jeecg.utils.StringUtils; |
19 | 20 | import org.jeecg.utils.constant.QuantityConstant; |
20 | 21 | import org.springframework.stereotype.Service; |
21 | 22 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
23 | + | |
24 | +import cn.monitor4all.logRecord.annotation.OperationLog; | |
25 | +import cn.monitor4all.logRecord.context.LogRecordContext; | |
26 | + | |
22 | 27 | import org.springframework.beans.factory.annotation.Autowired; |
23 | 28 | import org.springframework.transaction.annotation.Transactional; |
24 | 29 | |
... | ... | @@ -89,6 +94,8 @@ public class ReceiptHeaderServiceImpl extends ServiceImpl<ReceiptHeaderMapper, R |
89 | 94 | |
90 | 95 | @Override |
91 | 96 | @Transactional |
97 | + @OperationLog(bizId = "#receiptHeader.getCode()", bizType = "'入库单据追踪'", tag = "'入库单生成'", | |
98 | + msg = "'上游单号:['+ #receiptHeader.getReferCode() + '],仓库编码:[' + #receiptHeader.getWarehouseCode() + ']'", operatorId = "#username", recordReturnValue = true) | |
92 | 99 | public Result<ReceiptHeader> saveReceiptHeader(ReceiptHeader receiptHeader) { |
93 | 100 | LambdaQueryWrapper<ReceiptType> lambdaQueryWrapper = Wrappers.lambdaQuery(); |
94 | 101 | lambdaQueryWrapper.eq(ReceiptType::getCode, receiptHeader.getType()).eq(ReceiptType::getWarehouseCode, receiptHeader.getWarehouseCode()); |
... | ... | @@ -107,13 +114,13 @@ public class ReceiptHeaderServiceImpl extends ServiceImpl<ReceiptHeaderMapper, R |
107 | 114 | if (!success) { |
108 | 115 | return Result.OK("添加失败!"); |
109 | 116 | } |
117 | + LogRecordContext.putVariable("username", HuahengJwtUtil.getCurrentOperator()); | |
110 | 118 | return Result.OK("添加成功!", receiptHeader); |
111 | 119 | } |
112 | 120 | |
113 | 121 | @Override |
114 | 122 | @Transactional |
115 | 123 | public String createCode(String receiptType) { |
116 | - int i = 0; | |
117 | 124 | String code = null; |
118 | 125 | Date now = new Date(); |
119 | 126 | SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd"); |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/entity/ShipmentDetail.java
... | ... | @@ -108,6 +108,7 @@ public class ShipmentDetail implements Serializable { |
108 | 108 | @Excel(name = "上游行号", width = 15) |
109 | 109 | @ApiModelProperty(value = "上游行号") |
110 | 110 | private String referLineNum; |
111 | + @Excel(name = "唯一号", width = 15) | |
111 | 112 | @ApiModelProperty(value = "唯一号") |
112 | 113 | private String uniqueCode; |
113 | 114 | /** 备用字段1 */ |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/entity/TaskDetail.java
... | ... | @@ -115,6 +115,7 @@ public class TaskDetail implements Serializable { |
115 | 115 | @Excel(name = "入库的库存详情id", width = 15) |
116 | 116 | @ApiModelProperty(value = "入库的库存详情id") |
117 | 117 | private Integer toInventoryDetailId; |
118 | + @Excel(name = "唯一号", width = 15) | |
118 | 119 | @ApiModelProperty(value = "唯一号") |
119 | 120 | private String uniqueCode; |
120 | 121 | /** 备用字段1 */ |
... | ... |