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