质检还原为推送到SRM
This commit is contained in:
parent
dcdc34028b
commit
cf8d759287
|
|
@ -349,22 +349,22 @@ public class NormalPGIController extends BaseController {
|
|||
.setItem1(new ArrayList<>())
|
||||
.setItem2(new ArrayList<>());
|
||||
|
||||
// SRMInspectionInputDTO_D srmDto = new SRMInspectionInputDTO_D();
|
||||
// srmDto.setCode("WMS_RCV_RECEIVE_TO_SRM");
|
||||
// SRMInspectionContentDTO content = new SRMInspectionContentDTO();
|
||||
// content.setSupplierName(order.getSupplierName());
|
||||
// content.setSupplierNum(order.getSupplierNum());
|
||||
// content.setReceiveNum("");
|
||||
// content.setReceiveType("BY_DELIVERY");
|
||||
SRMInspectionInputDTO srmDto = new SRMInspectionInputDTO();
|
||||
srmDto.setCode("WMS_RCV_RECEIVE_TO_SRM");
|
||||
SRMInspectionContentDTO content = new SRMInspectionContentDTO();
|
||||
content.setSupplierName(order.getSupplierName());
|
||||
content.setSupplierNum(order.getSupplierNum());
|
||||
content.setReceiveNum("");
|
||||
content.setReceiveType("BY_DELIVERY");
|
||||
// content.setPurchaseGroup(order.getPurchaseGroup());
|
||||
// content.setLineVOList(new ArrayList<>());
|
||||
// srmDto.setContent(content);
|
||||
content.setLineVOList(new ArrayList<>());
|
||||
srmDto.setContent(content);
|
||||
|
||||
qcDto = new QCMaterialSyncDTO()
|
||||
.setPoNum(orderItem.getPoNum())
|
||||
.setReceiptIds(new ArrayList<>())
|
||||
.setZwm3A17DTO(sapDto);
|
||||
// .setPushDto(srmDto);
|
||||
.setZwm3A17DTO(sapDto)
|
||||
.setPushDto(srmDto);
|
||||
qcMaterialSyncDTOS.add(qcDto);
|
||||
}
|
||||
|
||||
|
|
@ -380,21 +380,22 @@ public class NormalPGIController extends BaseController {
|
|||
.setKZKRI(materialInfoInOrder.getKzkri()));
|
||||
|
||||
// SRM DTO
|
||||
// SRMLineVOListItem srmItem = new SRMLineVOListItem();
|
||||
// srmItem.setItemCode(item.getMaterialNo());
|
||||
// srmItem.setItemName(materialInfoInOrder.getMaktx());
|
||||
// srmItem.setUnit(materialInfoInOrder.getMeins());
|
||||
// srmItem.setFactory(materialInfoInOrder.getWerks());
|
||||
// srmItem.setReceivedWarehouse(materialInfoInOrder.getWarehouseNo());
|
||||
// srmItem.setReceiveBatchNum("");
|
||||
// srmItem.setReceivedQty(totalQty);
|
||||
// srmItem.setSerialNum("");
|
||||
// srmItem.setLineNumber(Integer.valueOf(orderItem.getLineNumber()));
|
||||
// srmItem.setNoteNum(order.getNoteNum());
|
||||
// srmItem.setRequestNo(String.valueOf(qcItem.getId()));
|
||||
// srmItem.setReceivedDate(DateTimeUtil.format(LocalDate.now(), "yyyy-MM-dd"));
|
||||
// srmItem.setInspectionFlag("Y");
|
||||
// qcDto.getPushDto().getContent().getLineVOList().add(srmItem);
|
||||
SRMLineVOListItem srmItem = new SRMLineVOListItem();
|
||||
srmItem.setItemCode(item.getMaterialNo());
|
||||
srmItem.setItemName(materialInfoInOrder.getMaktx());
|
||||
srmItem.setUnit(materialInfoInOrder.getMeins());
|
||||
srmItem.setFactory(materialInfoInOrder.getWerks());
|
||||
srmItem.setReceivedWarehouse(materialInfoInOrder.getWarehouseNo());
|
||||
srmItem.setReceiveBatchNum("");
|
||||
srmItem.setReceivedQty(totalQty);
|
||||
srmItem.setSerialNum("");
|
||||
srmItem.setLineNumber(Integer.valueOf(orderItem.getLineNumber()));
|
||||
srmItem.setNoteNum(order.getNoteNum());
|
||||
srmItem.setRequestNo(String.valueOf(qcItem.getId()));
|
||||
srmItem.setReceivedDate(DateTimeUtil.format(LocalDate.now(), "yyyy-MM-dd"));
|
||||
srmItem.setInspectionFlag("Y");
|
||||
qcDto.getPushDto().getContent().getLineVOList().add(srmItem);
|
||||
|
||||
qcDto.getIncomingInspectionApplyQOS().add(
|
||||
new ExternalIncomingInspectionApplyQO()
|
||||
.setRequestNo(String.valueOf(receiveItemId))
|
||||
|
|
@ -1129,53 +1130,54 @@ public class NormalPGIController extends BaseController {
|
|||
}
|
||||
|
||||
private void setSrmData(
|
||||
// SRMInspectionInputDTO_D pushDto,
|
||||
SRMInspectionInputDTO pushDto,
|
||||
List<ExternalIncomingInspectionApplyQO> incomingInspectionApplyQOS,
|
||||
WmsSrmOrder order,
|
||||
List<SrmMaterialReceiptScanCodes> codes,
|
||||
SrmMaterialReceiptQO item,
|
||||
Long receiveItemId
|
||||
Long receiveItemId,
|
||||
SAPSyncParamsDTO materialInfoInOrder
|
||||
) {
|
||||
// if (CollectionUtil.isNotEmpty(codes)) {
|
||||
// // 根据 BatchNumber 和 SerialNumbers 分组并汇总 CodeNum
|
||||
// Map<String, BigDecimal> batchNumbers = codes.stream()
|
||||
// .collect(Collectors.groupingBy(SrmMaterialReceiptScanCodes::getKey,
|
||||
// Collectors.mapping(SrmMaterialReceiptScanCodes::getCodeNum, Collectors.reducing(BigDecimal.ZERO, BigDecimal::add))));
|
||||
// for (Map.Entry<String, BigDecimal> entry : batchNumbers.entrySet()) {
|
||||
// String[] keys = entry.getKey().split(";", -1);
|
||||
// SRMLineVOListItem srmItem = new SRMLineVOListItem();
|
||||
// srmItem.setItemCode(item.getItemCode());
|
||||
// srmItem.setItemName(materialInfoInOrder.getMaktx());
|
||||
// srmItem.setUnit(materialInfoInOrder.getMeins());
|
||||
// srmItem.setFactory(materialInfoInOrder.getWerks());
|
||||
// srmItem.setReceivedWarehouse(materialInfoInOrder.getWarehouseNo());
|
||||
// srmItem.setReceiveBatchNum(keys[0]);
|
||||
// srmItem.setReceivedQty(entry.getValue());
|
||||
// srmItem.setSerialNum(keys[1]);
|
||||
// srmItem.setLineNumber(Integer.valueOf(item.getLineNumber()));
|
||||
// srmItem.setNoteNum(item.getNoteNum());
|
||||
// srmItem.setRequestNo(IdUtil.getSnowflakeNextIdStr());
|
||||
// srmItem.setReceivedDate(DateTimeUtil.format(LocalDate.now(), "yyyy-MM-dd"));
|
||||
// srmItem.setInspectionFlag("Y");
|
||||
// pushDto.getContent().getLineVOList().add(srmItem);
|
||||
// }
|
||||
// } else {
|
||||
// SRMLineVOListItem srmItem = new SRMLineVOListItem();
|
||||
// srmItem.setItemCode(item.getItemCode());
|
||||
// srmItem.setItemName(materialInfoInOrder.getMaktx());
|
||||
// srmItem.setUnit(materialInfoInOrder.getMeins());
|
||||
// srmItem.setFactory(materialInfoInOrder.getWerks());
|
||||
// srmItem.setReceivedWarehouse(materialInfoInOrder.getWarehouseNo());
|
||||
// srmItem.setReceiveBatchNum("");
|
||||
// srmItem.setReceivedQty(item.getReceiptNum());
|
||||
// srmItem.setSerialNum("");
|
||||
// srmItem.setLineNumber(Integer.valueOf(item.getLineNumber()));
|
||||
// srmItem.setNoteNum(item.getNoteNum());
|
||||
// srmItem.setRequestNo(IdUtil.getSnowflakeNextIdStr());
|
||||
// srmItem.setReceivedDate(DateTimeUtil.format(LocalDate.now(), "yyyy-MM-dd"));
|
||||
// srmItem.setInspectionFlag("Y");
|
||||
// pushDto.getContent().getLineVOList().add(srmItem);
|
||||
// }
|
||||
if (CollectionUtil.isNotEmpty(codes)) {
|
||||
// 根据 BatchNumber 和 SerialNumbers 分组并汇总 CodeNum
|
||||
Map<String, BigDecimal> batchNumbers = codes.stream()
|
||||
.collect(Collectors.groupingBy(SrmMaterialReceiptScanCodes::getKey,
|
||||
Collectors.mapping(SrmMaterialReceiptScanCodes::getCodeNum, Collectors.reducing(BigDecimal.ZERO, BigDecimal::add))));
|
||||
for (Map.Entry<String, BigDecimal> entry : batchNumbers.entrySet()) {
|
||||
String[] keys = entry.getKey().split(";", -1);
|
||||
SRMLineVOListItem srmItem = new SRMLineVOListItem();
|
||||
srmItem.setItemCode(item.getItemCode());
|
||||
srmItem.setItemName(materialInfoInOrder.getMaktx());
|
||||
srmItem.setUnit(materialInfoInOrder.getMeins());
|
||||
srmItem.setFactory(materialInfoInOrder.getWerks());
|
||||
srmItem.setReceivedWarehouse(materialInfoInOrder.getWarehouseNo());
|
||||
srmItem.setReceiveBatchNum(keys[0]);
|
||||
srmItem.setReceivedQty(entry.getValue());
|
||||
srmItem.setSerialNum(keys[1]);
|
||||
srmItem.setLineNumber(Integer.valueOf(item.getLineNumber()));
|
||||
srmItem.setNoteNum(item.getNoteNum());
|
||||
srmItem.setRequestNo(IdUtil.getSnowflakeNextIdStr());
|
||||
srmItem.setReceivedDate(DateTimeUtil.format(LocalDate.now(), "yyyy-MM-dd"));
|
||||
srmItem.setInspectionFlag("Y");
|
||||
pushDto.getContent().getLineVOList().add(srmItem);
|
||||
}
|
||||
} else {
|
||||
SRMLineVOListItem srmItem = new SRMLineVOListItem();
|
||||
srmItem.setItemCode(item.getItemCode());
|
||||
srmItem.setItemName(materialInfoInOrder.getMaktx());
|
||||
srmItem.setUnit(materialInfoInOrder.getMeins());
|
||||
srmItem.setFactory(materialInfoInOrder.getWerks());
|
||||
srmItem.setReceivedWarehouse(materialInfoInOrder.getWarehouseNo());
|
||||
srmItem.setReceiveBatchNum("");
|
||||
srmItem.setReceivedQty(item.getReceiptNum());
|
||||
srmItem.setSerialNum("");
|
||||
srmItem.setLineNumber(Integer.valueOf(item.getLineNumber()));
|
||||
srmItem.setNoteNum(item.getNoteNum());
|
||||
srmItem.setRequestNo(IdUtil.getSnowflakeNextIdStr());
|
||||
srmItem.setReceivedDate(DateTimeUtil.format(LocalDate.now(), "yyyy-MM-dd"));
|
||||
srmItem.setInspectionFlag("Y");
|
||||
pushDto.getContent().getLineVOList().add(srmItem);
|
||||
}
|
||||
Set<String> qrCodes = new HashSet<>();
|
||||
if (CollectionUtil.isNotEmpty(codes)) {
|
||||
List<WmsQrCodeMaster> qrCodeMasters = qrCodeMasterService.lambdaQuery()
|
||||
|
|
@ -1231,7 +1233,7 @@ public class NormalPGIController extends BaseController {
|
|||
) {
|
||||
ZWM3A17DTO zwm3A17DTO = null;
|
||||
QCMaterialSyncDTO qcDto = null;
|
||||
// SRMInspectionInputDTO_D srmPushDto = null;
|
||||
SRMInspectionInputDTO srmPushDto = null;
|
||||
|
||||
qcDto = qcMaterialSyncDTOS.stream()
|
||||
.filter(qcMaterialSyncDTO -> qcMaterialSyncDTO
|
||||
|
|
@ -1256,25 +1258,25 @@ public class NormalPGIController extends BaseController {
|
|||
}
|
||||
zwm3A17DTO = qcDto.getZwm3A17DTO();
|
||||
|
||||
// if (Objects.isNull(qcDto.getPushDto())) {
|
||||
// SRMInspectionInputDTO_D dto = new SRMInspectionInputDTO_D();
|
||||
// SRMInspectionContentDTO content = new SRMInspectionContentDTO();
|
||||
// content.setSupplierName(order.getSupplierName());
|
||||
// content.setSupplierNum(order.getSupplierNum());
|
||||
// content.setReceiveNum("");
|
||||
// content.setReceiveType("BY_DELIVERY");
|
||||
if (Objects.isNull(qcDto.getPushDto())) {
|
||||
SRMInspectionInputDTO dto = new SRMInspectionInputDTO();
|
||||
SRMInspectionContentDTO content = new SRMInspectionContentDTO();
|
||||
content.setSupplierName(order.getSupplierName());
|
||||
content.setSupplierNum(order.getSupplierNum());
|
||||
content.setReceiveNum("");
|
||||
content.setReceiveType("BY_DELIVERY");
|
||||
// content.setPurchaseGroup(order.getPurchaseGroup());
|
||||
// content.setLineVOList(new ArrayList<>());
|
||||
// dto.setContent(content);
|
||||
// dto.setCode("WMS_RCV_RECEIVE_TO_SRM");
|
||||
// qcDto.setPushDto(dto);
|
||||
// }
|
||||
// srmPushDto = qcDto.getPushDto();
|
||||
content.setLineVOList(new ArrayList<>());
|
||||
dto.setContent(content);
|
||||
dto.setCode("WMS_RCV_RECEIVE_TO_SRM");
|
||||
qcDto.setPushDto(dto);
|
||||
}
|
||||
srmPushDto = qcDto.getPushDto();
|
||||
|
||||
//组装SAP的参数
|
||||
setZWM3A17DTO(zwm3A17DTO, codes, item, materialInfoInOrder);
|
||||
////组装SRM的参数
|
||||
setSrmData(qcDto.getIncomingInspectionApplyQOS(), order, codes, item, receiveItemId);
|
||||
setSrmData(srmPushDto,qcDto.getIncomingInspectionApplyQOS(), order, codes, item, receiveItemId,materialInfoInOrder);
|
||||
|
||||
WmsQcReceiveItem qmsReceiptItem = new WmsQcReceiveItem()
|
||||
.setId(receiveItemId)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.nflg.wms.admin.pojo.dto;
|
||||
|
||||
import com.nflg.wms.common.pojo.dto.SRMInspectionInputDTO;
|
||||
import com.nflg.wms.common.pojo.qo.ExternalIncomingInspectionApplyQO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
|
@ -13,7 +14,7 @@ public class QCMaterialSyncDTO {
|
|||
|
||||
private ZWM3A17DTO zwm3A17DTO;
|
||||
|
||||
// private SRMInspectionInputDTO pushDto;
|
||||
private SRMInspectionInputDTO pushDto;
|
||||
|
||||
private List<ExternalIncomingInspectionApplyQO> incomingInspectionApplyQOS = new ArrayList<>();
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.nflg.wms.admin.service;
|
|||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.nflg.wms.admin.pojo.dto.GoodReceiptDTO;
|
||||
import com.nflg.wms.admin.pojo.dto.QCMaterialSyncDTO;
|
||||
import com.nflg.wms.admin.pojo.dto.ZWM3A17DTO;
|
||||
|
|
@ -24,8 +25,11 @@ import com.nflg.wms.repository.service.*;
|
|||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
|
@ -35,7 +39,9 @@ import java.time.LocalDateTime;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class NormalPGIControllerService {
|
||||
|
||||
|
|
@ -267,10 +273,10 @@ public class NormalPGIControllerService {
|
|||
//导入SAP
|
||||
Pair<Pair<String, String>, Pair<String, String>> zwm3A17ReturnDTO = sapService.zwm3a17(dto.getZwm3A17DTO());
|
||||
//推入srm
|
||||
// SRMInspectionContentDTO content = dto.getPushDto().getContent();
|
||||
// content.setReceiveNum(zwm3A17ReturnDTO.getValue().getKey());
|
||||
// pushInspectionMaterialsToSRM(dto.getPushDto());
|
||||
qmsService.pushIQCIncoming(dto.getIncomingInspectionApplyQOS());
|
||||
SRMInspectionContentDTO content = dto.getPushDto().getContent();
|
||||
content.setReceiveNum(zwm3A17ReturnDTO.getValue().getKey());
|
||||
pushInspectionMaterialsToSRM(dto.getPushDto());
|
||||
// qmsService.pushIQCIncoming(dto.getIncomingInspectionApplyQOS());
|
||||
//修改收货单的物料凭证和年度物料凭证
|
||||
List<Long> ids = dto.getReceiptIds();
|
||||
//修改收货单的物料凭证和年度物料凭证
|
||||
|
|
@ -405,10 +411,10 @@ public class NormalPGIControllerService {
|
|||
//导入SAP
|
||||
Pair<Pair<String, String>, Pair<String, String>> zwm3A17ReturnDTO = sapService.zwm3a17(dto.getZwm3A17DTO());
|
||||
//推入srm
|
||||
// SRMInspectionContentDTO content = dto.getPushDto().getContent();
|
||||
// content.setReceiveNum(zwm3A17ReturnDTO.getValue().getKey());
|
||||
// pushInspectionMaterialsToSRM(dto.getPushDto());
|
||||
qmsService.pushIQCIncoming(dto.getIncomingInspectionApplyQOS());
|
||||
SRMInspectionContentDTO content = dto.getPushDto().getContent();
|
||||
content.setReceiveNum(zwm3A17ReturnDTO.getValue().getKey());
|
||||
pushInspectionMaterialsToSRM(dto.getPushDto());
|
||||
// qmsService.pushIQCIncoming(dto.getIncomingInspectionApplyQOS());
|
||||
//修改收货单的物料凭证和年度物料凭证
|
||||
List<Long> ids = dto.getReceiptIds();
|
||||
//修改收货单的物料凭证和年度物料凭证
|
||||
|
|
@ -483,10 +489,10 @@ public class NormalPGIControllerService {
|
|||
if (CollectionUtil.isNotEmpty(qcMaterialSyncDTOS)) {
|
||||
for (QCMaterialSyncDTO dto : qcMaterialSyncDTOS) {
|
||||
Pair<Pair<String, String>, Pair<String, String>> zwm3A17ReturnDTO = sapService.zwm3a17(dto.getZwm3A17DTO());
|
||||
// SRMInspectionContentDTO content = dto.getPushDto().getContent();
|
||||
// content.setReceiveNum(zwm3A17ReturnDTO.getValue().getKey());
|
||||
// pushInspectionMaterialsToSRM(dto.getPushDto());
|
||||
qmsService.pushIQCIncoming(dto.getIncomingInspectionApplyQOS());
|
||||
SRMInspectionContentDTO content = dto.getPushDto().getContent();
|
||||
content.setReceiveNum(zwm3A17ReturnDTO.getValue().getKey());
|
||||
pushInspectionMaterialsToSRM(dto.getPushDto());
|
||||
// qmsService.pushIQCIncoming(dto.getIncomingInspectionApplyQOS());
|
||||
|
||||
List<Long> ids = dto.getReceiptIds();
|
||||
if (CollectionUtil.isNotEmpty(ids)) {
|
||||
|
|
@ -576,77 +582,78 @@ public class NormalPGIControllerService {
|
|||
// }
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 将检验物料信息推送到SRM系统
|
||||
// *
|
||||
// * @param request SRM检验输入数据传输对象,包含需要推送的检验物料信息
|
||||
// */
|
||||
// private void pushInspectionMaterialsToSRM(SRMInspectionInputDTO_D request) {
|
||||
// SRMInspectionContentDTO content = request.getContent();
|
||||
// if (content == null || CollectionUtil.isEmpty(content.getLineVOList())) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// List<ExternalIncomingInspectionApplyQO> qoList = new ArrayList<>();
|
||||
// for (SRMLineVOListItem item : content.getLineVOList()) {
|
||||
// ExternalIncomingInspectionApplyQO qo = new ExternalIncomingInspectionApplyQO();
|
||||
// qo.setRequestNo(item.getRequestNo());
|
||||
// qo.setMaterialNo(item.getItemCode());
|
||||
// qo.setInspectionType(0);
|
||||
// qo.setSupplierCode(content.getSupplierNum());
|
||||
// qo.setSupplierName(content.getSupplierName());
|
||||
// qo.setDeliveryOrderNo(content.getReceiveNum());
|
||||
// qo.setDeliveryOrderLine(String.valueOf(item.getLineNumber()));
|
||||
// qo.setPurchaseOrderNo(item.getNoteNum());
|
||||
// qo.setPurchaseOrderLine(String.valueOf(item.getLineNumber()));
|
||||
// qo.setFactory(item.getFactory());
|
||||
// qo.setInspectionQty(item.getReceivedQty() != null ? item.getReceivedQty().intValue() : 0);
|
||||
// qo.setPurchaseGroup(content.getPurchaseGroup());
|
||||
// qoList.add(qo);
|
||||
// }
|
||||
//
|
||||
// qmsService.pushIQCIncoming(qoList);
|
||||
// }
|
||||
/**
|
||||
* 将检验物料信息推送到SRM系统
|
||||
*
|
||||
* @param request SRM检验输入数据传输对象,包含需要推送的检验物料信息
|
||||
*/
|
||||
private void pushInspectionMaterialsToSRM(SRMInspectionInputDTO request) {
|
||||
// 获取SRM系统认证Token
|
||||
String token = GetSRMToken();
|
||||
VUtil.trueThrowBusinessError(token.trim().isEmpty()).throwMessage("获取SRM的TOKEN失败");
|
||||
|
||||
log.info("收货单推送SRM数据:" + JSONUtil.toJsonStr(request));
|
||||
|
||||
// 构建HTTP请求头信息
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
headers.add("AuthorizationCode", token);
|
||||
headers.add("Gateway-Tag", gatewayTag);
|
||||
HttpEntity<SRMInspectionInputDTO> requestEntity = new HttpEntity<>(request, headers);
|
||||
|
||||
// 调用SRM认证接口获取新的Token
|
||||
ResponseEntity<SRMBaseDTO<Object>> response = restTemplate.exchange(
|
||||
pushUrl,
|
||||
HttpMethod.POST,
|
||||
requestEntity,
|
||||
new ParameterizedTypeReference<SRMBaseDTO<Object>>() {
|
||||
}
|
||||
);
|
||||
|
||||
// 记录推送结果日志并验证响应状态
|
||||
log.info("收货单推送SRM的结果:{},{}", response.getStatusCodeValue(), JSONUtil.toJsonStr(response.getBody()));
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(response.getBody()) || !response.getBody().getStatus().equals("S")).throwMessage("收货单推送SRM失败");
|
||||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * 获取SRM系统认证Token
|
||||
// * <p>
|
||||
// * 该方法首先尝试从Redis缓存中获取SRM Token,如果缓存中不存在或为空,
|
||||
// * 则通过OAuth认证接口重新获取Token并存入Redis缓存50分钟。
|
||||
// *
|
||||
// * @return SRM系统认证Token字符串
|
||||
// */
|
||||
// private String GetSRMToken() {
|
||||
//
|
||||
// // 从Redis缓存中获取SRM Token
|
||||
// String srmToken = stringRedisTemplate.opsForValue().get("srm:token");
|
||||
// if (srmToken == null || srmToken.trim().isEmpty()) {
|
||||
// // 构造HTTP请求头和请求体
|
||||
// HttpHeaders headers = new HttpHeaders();
|
||||
// headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
// HttpEntity<SRMTokenInputDTO> requestEntity = new HttpEntity<>(new SRMTokenInputDTO(oauthApp, oauthSecret), headers);
|
||||
//
|
||||
// // 调用SRM认证接口获取新的Token
|
||||
// ResponseEntity<SRMBaseDTO<SRMTokenDTO>> response = restTemplate.exchange(
|
||||
// tokenUrl,
|
||||
// HttpMethod.POST,
|
||||
// requestEntity,
|
||||
// new ParameterizedTypeReference<SRMBaseDTO<SRMTokenDTO>>() {
|
||||
//
|
||||
// }
|
||||
// );
|
||||
//
|
||||
// // 提取返回的Token并存储到Redis缓存中,有效期50分钟
|
||||
// String newToken = response.getBody() == null ? "" : response.getBody().getData().getAuthorizationCode();
|
||||
// stringRedisTemplate.opsForValue().set("srm:token", newToken, 50, TimeUnit.MINUTES);
|
||||
// log.info("PushTagValue结果:{},{}", response.getStatusCodeValue(), JSONUtil.toJsonStr(response.getBody()));
|
||||
// }
|
||||
//
|
||||
// // 重新从Redis获取Token并返回
|
||||
// srmToken = stringRedisTemplate.opsForValue().get("srm:token");
|
||||
// return srmToken;
|
||||
// }
|
||||
/**
|
||||
* 获取SRM系统认证Token
|
||||
* <p>
|
||||
* 该方法首先尝试从Redis缓存中获取SRM Token,如果缓存中不存在或为空,
|
||||
* 则通过OAuth认证接口重新获取Token并存入Redis缓存50分钟。
|
||||
*
|
||||
* @return SRM系统认证Token字符串
|
||||
*/
|
||||
private String GetSRMToken() {
|
||||
|
||||
// 从Redis缓存中获取SRM Token
|
||||
String srmToken = stringRedisTemplate.opsForValue().get("srm:token");
|
||||
if (srmToken == null || srmToken.trim().isEmpty()) {
|
||||
// 构造HTTP请求头和请求体
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
HttpEntity<SRMTokenInputDTO> requestEntity = new HttpEntity<>(new SRMTokenInputDTO(oauthApp, oauthSecret), headers);
|
||||
|
||||
// 调用SRM认证接口获取新的Token
|
||||
ResponseEntity<SRMBaseDTO<SRMTokenDTO>> response = restTemplate.exchange(
|
||||
tokenUrl,
|
||||
HttpMethod.POST,
|
||||
requestEntity,
|
||||
new ParameterizedTypeReference<SRMBaseDTO<SRMTokenDTO>>() {
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
// 提取返回的Token并存储到Redis缓存中,有效期50分钟
|
||||
String newToken = response.getBody() == null ? "" : response.getBody().getData().getAuthorizationCode();
|
||||
stringRedisTemplate.opsForValue().set("srm:token", newToken, 50, TimeUnit.MINUTES);
|
||||
log.info("PushTagValue结果:{},{}", response.getStatusCodeValue(), JSONUtil.toJsonStr(response.getBody()));
|
||||
}
|
||||
|
||||
// 重新从Redis获取Token并返回
|
||||
srmToken = stringRedisTemplate.opsForValue().get("srm:token");
|
||||
return srmToken;
|
||||
}
|
||||
|
||||
public List<PDAOrderItemVO> getPackageContents(@NotNull @NotBlank String packageCode) {
|
||||
List<PackagePOItemDTO> packagePOItems = wmsPackageService.getPackagePOItems(packageCode);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
package com.nflg.wms.common.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SRMInspectionContentDTO {
|
||||
private String supplierName;
|
||||
private String supplierNum;
|
||||
private List<SRMLineVOListItem> lineVOList;
|
||||
private String receiveNum;
|
||||
private String receiveType;
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.nflg.wms.common.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SRMInspectionInputDTO {
|
||||
private String code;
|
||||
private SRMInspectionContentDTO content;
|
||||
}
|
||||
Loading…
Reference in New Issue