🤣去除SAP创建、修改客户档案接口操作类型,逻辑改为存在客户记录为修改不存在为添加

This commit is contained in:
bairubing 2024-10-16 13:49:11 +08:00
parent 4747009617
commit ce21fa4543
2 changed files with 10 additions and 7 deletions

View File

@ -13,10 +13,11 @@ using System.Threading.Tasks;
namespace Vistar.Application.Service.SapOpenInterface.Dto;
public class CreateClientRecordInput
{
/// <summary>
/// 标识 新增或修改
/// </summary>
public string actionType { get; set; }
///// <summary>
///// 标识 新增或修改
///// </summary>
//public string actionType { get; set; }
/// <summary>
/// 客户编码

View File

@ -47,14 +47,16 @@ public class SapOpenInterfaceService : IDynamicApiController, ITransient
{
var response = new ManageResponse();
if (string.IsNullOrWhiteSpace(input._System_objNBS) || string.IsNullOrWhiteSpace(input._System_objDescription) || string.IsNullOrWhiteSpace(input.actionType))
if (string.IsNullOrWhiteSpace(input._System_objNBS) || string.IsNullOrWhiteSpace(input._System_objDescription))
{
response.Success = true;
response.Message = "请输入必填字段";
return response;
}
//判断是否存在客户记录
var clientExists = await _obj132Rep.AsQueryable().AnyAsync(x => x._System_objNBS == input._System_objNBS);
if (input.actionType == "新增")
if (clientExists == false)
{
var fieldList = new List<Field>();
@ -80,7 +82,7 @@ public class SapOpenInterfaceService : IDynamicApiController, ITransient
response= await _solidWorksManageService.CreateRecord(data);
return response;
}
else if (input.actionType == "修改")
else if (clientExists == true)
{
var updateable = await _obj132Rep.AsUpdateable()
.SetColumns(it => new Obj132