fix: 调整导入sap的参数

This commit is contained in:
曹鹏飞 2024-04-26 10:30:03 +08:00
parent 251d5b6bbd
commit 150649ed65
4 changed files with 58 additions and 14 deletions

View File

@ -0,0 +1,53 @@
package com.nflg.product.bomnew.api.user;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;
import com.nflg.product.bomnew.pojo.dto.sap.impart2.ImportSapParamDTO;
import com.nflg.product.bomnew.pojo.dto.sap.impart2.T1DTO;
import com.nflg.product.bomnew.service.SapOpUtilService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import nflg.product.common.vo.ResultVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @author 曹鹏飞
* @date 2024/4/26 09:54:06
*/
@Api(tags = "测试功能用的接口")
@RestController
@RequestMapping("test")
public class TestApi {
@Resource
SapOpUtilService sapOpUtilService;
@GetMapping("sap")
@ApiOperation("sap接口测试")
public ResultVO<Boolean> workDetailsListByPage() {
String dateYMD = DateUtil.format(new Date(), "yyyyMMdd");
ImportSapParamDTO sapDto = new ImportSapParamDTO();
sapDto.setZID(RandomUtil.randomNumbers(5));
sapDto.setI_WERKS("1");
sapDto.setI_STLAN("1");
List<T1DTO> t1s = new ArrayList<>();
T1DTO t1 = new T1DTO();
t1.setID(RandomUtil.randomNumbers(5));
t1.setMATNR("2200022146");
t1.setIDNRK("2100724596");
t1.setMEINS("PC");
t1.setMENGE("1.00");
t1.setPOSTP("L");
t1.setDATUM(dateYMD);
t1s.add(t1);
sapDto.setT1(t1s);
return sapOpUtilService.importToSapV2(sapDto, null);
}
}

View File

@ -13,10 +13,10 @@ import java.util.List;
public class ImportSapParamDTO { public class ImportSapParamDTO {
@ApiModelProperty("流程标题,默认“主数据平台") @ApiModelProperty("流程标题,默认“主数据平台")
private String I_LCBT="主数据平台"; private String I_LCBT = "主数据";
@ApiModelProperty("默认X") @ApiModelProperty("默认X")
private String I_ACT="X"; private String I_ACT = "x";
private String ZID=""; private String ZID="";

View File

@ -934,19 +934,9 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
ImportSapParamDTO sapDto = new ImportSapParamDTO(); ImportSapParamDTO sapDto = new ImportSapParamDTO();
sapDto.setZID(RandomUtil.randomNumbers(5)); sapDto.setZID(RandomUtil.randomNumbers(5));
sapDto.setI_WERKS(FactoryCodeEnum.FACTORY_1010.getValue()); sapDto.setI_WERKS("1");
sapDto.setI_STLAN("2"); sapDto.setI_STLAN("2");
String dateYMD = DateUtil.format(new Date(), "yyyyMMdd");
List<T1DTO> t1s = new ArrayList<>(); List<T1DTO> t1s = new ArrayList<>();
T1DTO troot = new T1DTO();
troot.setID(RandomUtil.randomNumbers(5));
troot.setMATNR("");
troot.setIDNRK(root.getMaterialNo());
troot.setMEINS(root.getMaterialUnit());
troot.setMENGE("1");
troot.setPOSTP("");
troot.setDATUM(dateYMD);
t1s.add(troot);
buildChildrenForSap(root, t1s); buildChildrenForSap(root, t1s);
sapDto.setT1(t1s); sapDto.setT1(t1s);
ResultVO<Boolean> resultVO = SpringUtil.getBean(SapOpUtilService.class).importToSapV2(sapDto, null); ResultVO<Boolean> resultVO = SpringUtil.getBean(SapOpUtilService.class).importToSapV2(sapDto, null);

View File

@ -365,9 +365,10 @@ public class DQBomService {
VUtils.isTure(root.getSapState() == 3).throwMessage("已导入过了,请勿重复操作"); VUtils.isTure(root.getSapState() == 3).throwMessage("已导入过了,请勿重复操作");
List<BomNewDQbomVO> datas = getAll(rootBomRowId); List<BomNewDQbomVO> datas = getAll(rootBomRowId);
datas.remove(0);
ImportSapParamDTO sapDto = new ImportSapParamDTO(); ImportSapParamDTO sapDto = new ImportSapParamDTO();
sapDto.setZID(RandomUtil.randomNumbers(5)); sapDto.setZID(RandomUtil.randomNumbers(5));
sapDto.setI_WERKS(FactoryCodeEnum.FACTORY_1010.getValue()); sapDto.setI_WERKS("1");
sapDto.setI_STLAN("2"); sapDto.setI_STLAN("2");
List<T1DTO> t1s = new ArrayList<>(); List<T1DTO> t1s = new ArrayList<>();
String dateYMD = DateUtil.format(new Date(), "yyyyMMdd"); String dateYMD = DateUtil.format(new Date(), "yyyyMMdd");