😭修改接口逻辑
This commit is contained in:
parent
a311452ab2
commit
1f2458c0ea
@ -598,4 +598,13 @@ public class ConfigurationData
|
||||
/// 基本数量
|
||||
/// </summary>
|
||||
public string fld005575 { get; set; }
|
||||
|
||||
public string fld006140 { get; set; }
|
||||
public string fld006141 { get; set; }
|
||||
public string fld006142 { get; set; }
|
||||
public string fld006143 { get; set; }
|
||||
public DateTime fld006144 { get; set; }
|
||||
public string fld006145 { get; set; }
|
||||
public string fld006146 { get; set; }
|
||||
public string fld006147 { get; set; }
|
||||
}
|
||||
|
@ -0,0 +1,187 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Vistar.Application.SapService.Dto;
|
||||
public class SapPurchasingRequisitionInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 接口唯一ID
|
||||
/// </summary>
|
||||
public string Reqkeyid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 业务唯一ID
|
||||
/// </summary>
|
||||
public string Businessid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 传入消息ID
|
||||
/// </summary>
|
||||
public string Messageid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 发送方的合作伙伴编号
|
||||
/// </summary>
|
||||
public string Sndprn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 接收方的合作伙伴编号
|
||||
/// </summary>
|
||||
public string Rcvprn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户名
|
||||
/// </summary>
|
||||
public string Requser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Note1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Note2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Note3 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 外部唯一ID
|
||||
/// </summary>
|
||||
public string Zwbid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 采购申请编号
|
||||
/// </summary>
|
||||
public string Banfn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 采购申请凭证类型
|
||||
/// </summary>
|
||||
public string Bsart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 业务修改类型I/U
|
||||
/// </summary>
|
||||
public string Zoperate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 抬头备用1
|
||||
/// </summary>
|
||||
public string Zttby1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 抬头备用2
|
||||
/// </summary>
|
||||
public string Zttby2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 抬头备用3
|
||||
/// </summary>
|
||||
public string Zttby3 { get; set; }
|
||||
|
||||
|
||||
public List<SapPurchasingRequisitionItem> Item { get; set; }
|
||||
}
|
||||
|
||||
public class SapPurchasingRequisitionItem
|
||||
{
|
||||
/// <summary>
|
||||
/// 采购申请的项目编号
|
||||
/// </summary>
|
||||
public string Bnfpo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 紧急标识
|
||||
/// </summary>
|
||||
public string Zzjjbs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 科目分配类别
|
||||
/// </summary>
|
||||
public string Knttp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 采购凭证中的项目类别
|
||||
/// </summary>
|
||||
public string Pstyp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料编号
|
||||
/// </summary>
|
||||
public string Matnr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 短文本
|
||||
/// </summary>
|
||||
public string Txz01 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
public string Menge { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 基本计量单位
|
||||
/// </summary>
|
||||
public string Meins { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 项目交货日期
|
||||
/// </summary>
|
||||
public string Lfdat { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料组
|
||||
/// </summary>
|
||||
public string Matkl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工厂
|
||||
/// </summary>
|
||||
public string Werks { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 存储地点
|
||||
/// </summary>
|
||||
public string Lgort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 采购组
|
||||
/// </summary>
|
||||
public string Ekgrp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 采购组织
|
||||
/// </summary>
|
||||
public string Ekorg { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 项目号
|
||||
/// </summary>
|
||||
public string Zzpspnr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 申请人姓名
|
||||
/// </summary>
|
||||
public string Afnam { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 采购凭证中的删除标识
|
||||
/// </summary>
|
||||
public string Loekz { get; set; }
|
||||
|
||||
}
|
@ -67,7 +67,7 @@ public class ProductManagementService : IDynamicApiController, ITransient
|
||||
public async Task<SqlSugarPagedList<ProductManagementOutput>> Page(PageProductManagementInput input)
|
||||
{
|
||||
var query = await _obj110Rep.AsQueryable()
|
||||
.Where(x => (x.CheckedStatus == 0||x.CheckedStatus==1) && x.fld005324 == "发布" && x.deleted == false && x.IsLatestVersion == true)
|
||||
.Where(x => (x.CheckedStatus == 0 || x.CheckedStatus == 1) && x.fld005324 == "发布" && x.deleted == false && x.IsLatestVersion == true)
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input._System_objNBS), u => u._System_objNBS.Contains(input._System_objNBS.Trim()))
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.fld004484), u => u.fld004484.Contains(input.fld004484.Trim()))
|
||||
.WhereIF(input.fld004494Range != null && input.fld004494Range.Length == 2, u => u.fld004494 >= input.fld004494Range[0] && u.fld004494 <= input.fld004494Range[1])
|
||||
@ -185,7 +185,7 @@ public class ProductManagementService : IDynamicApiController, ITransient
|
||||
var configid = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 110 && x.ConfigSystemName == "mBOM").FirstAsync();
|
||||
var parent = await _obj110Rep.AsQueryable().Where(x => x.RecordGuid == input.ParentGuid && x.deleted == false && x.fld004311 == "成功" && x.fld004312 == "N").MaxAsync(x => x.VersionIndex);
|
||||
var BomData = await _configurationDataRep.AsQueryable()
|
||||
.Where(x => x.ConfigId == configid.ConfigID && x.ParentGuid == input.ParentGuid && x.isDeleted == false && x.ParentVersion == parent && (x.fld005586 !="不包含"|| x.fld005586==null))
|
||||
.Where(x => x.ConfigId == configid.ConfigID && x.ParentGuid == input.ParentGuid && x.isDeleted == false && x.ParentVersion == parent && (x.fld005586 != "不包含" || x.fld005586 == null))
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.Description), u => u.Description.Contains(input.Description.Trim()))
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.PartNumber), u => u.PartNumber.Contains(input.PartNumber.Trim()))
|
||||
.Select<ProductManagementBomOutput>().ToPagedListAsync(input.Page, input.PageSize);
|
||||
@ -237,7 +237,7 @@ public class ProductManagementService : IDynamicApiController, ITransient
|
||||
if (!string.IsNullOrEmpty(ParentData.fld005288))
|
||||
{
|
||||
var configid = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 110 && x.ConfigSystemName == "mBOM").FirstAsync();
|
||||
var BomData = await _configurationDataRep.AsQueryable().Where(x => x.ConfigId == configid.ConfigID && x.ParentGuid == input[0].ParentGuid && x.isDeleted == false && x.ParentVersion == Convert.ToInt32(ParentData.fld005288)&&(x.fld005586!="不包含"|| x.fld005586==null)).ToListAsync();
|
||||
var BomData = await _configurationDataRep.AsQueryable().Where(x => x.ConfigId == configid.ConfigID && x.ParentGuid == input[0].ParentGuid && x.isDeleted == false && x.ParentVersion == Convert.ToInt32(ParentData.fld005288) && (x.fld005586 != "不包含" || x.fld005586 == null)).ToListAsync();
|
||||
for (int i = 0; i < BomData.Count; i++)
|
||||
{
|
||||
|
||||
@ -293,7 +293,9 @@ public class ProductManagementService : IDynamicApiController, ITransient
|
||||
};
|
||||
var apiOutput = await _sapService.SapBomApi(isreq);
|
||||
string codeVal = apiOutput.code == "S" ? "成功" : "失败";
|
||||
await _obj110Rep.AsUpdateable()
|
||||
if (codeVal == "成功")
|
||||
{
|
||||
await _obj110Rep.AsUpdateable()
|
||||
.SetColumns(it => new Obj110
|
||||
{
|
||||
fld004631 = DateTime.Now,
|
||||
@ -304,6 +306,21 @@ public class ProductManagementService : IDynamicApiController, ITransient
|
||||
})
|
||||
.Where(it => it.idRecord == ParentData.idRecord)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
await _obj110Rep.AsUpdateable()
|
||||
.SetColumns(it => new Obj110
|
||||
{
|
||||
fld004631 = DateTime.Now,
|
||||
fld004315 = codeVal,
|
||||
fld004316 = "N",
|
||||
fld004317 = apiOutput.msg
|
||||
})
|
||||
.Where(it => it.idRecord == ParentData.idRecord)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
var msg = apiOutput.msg;
|
||||
if (apiOutput.msg == "")
|
||||
{
|
||||
@ -356,7 +373,7 @@ public class ProductManagementService : IDynamicApiController, ITransient
|
||||
});
|
||||
continue;
|
||||
}
|
||||
if (input[i].fld004312 == "N" || input[i].fld004312 == "D" || input[i].fld004312==null)
|
||||
if (input[i].fld004312 == "N" || input[i].fld004312 == "D" || input[i].fld004312 == null)
|
||||
{
|
||||
SapOutputList.Add(new SapOutput()
|
||||
{
|
||||
@ -444,10 +461,10 @@ public class ProductManagementService : IDynamicApiController, ITransient
|
||||
public async Task<List<SapOutput>> TimingSyncToSAP()
|
||||
{
|
||||
var input = await _obj110Rep.AsQueryable()
|
||||
.Where(x => (x.CheckedStatus == 0 || x.CheckedStatus == 1)
|
||||
&& x.fld005324 == "发布"
|
||||
&& x.deleted == false
|
||||
&& x.IsLatestVersion == true
|
||||
.Where(x => (x.CheckedStatus == 0 || x.CheckedStatus == 1)
|
||||
&& x.fld005324 == "发布"
|
||||
&& x.deleted == false
|
||||
&& x.IsLatestVersion == true
|
||||
&& (x.fld004312 == "A" || x.fld004312 == "M"))
|
||||
.ToListAsync();
|
||||
const string lengthError = "物料描述长度大于40,请检查!";
|
||||
@ -561,7 +578,7 @@ public class ProductManagementService : IDynamicApiController, ITransient
|
||||
var configid = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 110 && x.ConfigSystemName == "mBOM").FirstAsync();
|
||||
|
||||
var materialData = await _obj110Rep.AsQueryable()
|
||||
.Where(x => (x.CheckedStatus == 0 || x.CheckedStatus == 1) && x.fld005324 == "发布" && x.deleted == false && x.IsLatestVersion == true && x.fld004311 == "成功" && x.fld004312=="N" && (x.fld004316 == "A" || x.fld004316 == "M"))
|
||||
.Where(x => (x.CheckedStatus == 0 || x.CheckedStatus == 1) && x.fld005324 == "发布" && x.deleted == false && x.IsLatestVersion == true && x.fld004311 == "成功" && x.fld004312 == "N" && (x.fld004316 == "A" || x.fld004316 == "M"))
|
||||
.ToListAsync();
|
||||
var groupedData = materialData.GroupBy(item => item.RecordGuid)
|
||||
.Select(group => group.OrderByDescending(item => item.VersionIndex).First())
|
||||
@ -569,7 +586,7 @@ public class ProductManagementService : IDynamicApiController, ITransient
|
||||
|
||||
foreach (var item in groupedData)
|
||||
{
|
||||
|
||||
|
||||
// 获取版本号
|
||||
var versionIndex = item.VersionIndex;
|
||||
// 获取 ECN guid
|
||||
@ -581,7 +598,7 @@ public class ProductManagementService : IDynamicApiController, ITransient
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// 查询 ECN 编码
|
||||
var ecnData = await _obj118Rep.AsQueryable().Where(x => x.RecordGuid == ecnGuid && x.deleted == false).OrderByDescending(x => x.VersionIndex).FirstAsync();
|
||||
var ecn = ecnData != null ? ecnData._System_objNBS : "";
|
||||
@ -674,16 +691,34 @@ public class ProductManagementService : IDynamicApiController, ITransient
|
||||
|
||||
var apiOutput = await _sapService.SapBomApi(isreq);
|
||||
string codeVal = apiOutput.code == "S" ? "成功" : "失败";
|
||||
await _obj110Rep.AsUpdateable()
|
||||
.SetColumns(it => new Obj110
|
||||
{
|
||||
fld004631 = DateTime.Now,
|
||||
fld004315 = codeVal,
|
||||
fld004316 = "N",
|
||||
fld004317 = apiOutput.msg
|
||||
})
|
||||
.Where(it => it.idRecord == item.idRecord)
|
||||
.ExecuteCommandAsync();
|
||||
|
||||
if (codeVal == "成功")
|
||||
{
|
||||
await _obj110Rep.AsUpdateable()
|
||||
.SetColumns(it => new Obj110
|
||||
{
|
||||
fld004631 = DateTime.Now,
|
||||
fld004315 = codeVal,
|
||||
fld004316 = "N",
|
||||
fld004317 = apiOutput.msg,
|
||||
fld005288 = versionIndex.ToString()
|
||||
})
|
||||
.Where(it => it.idRecord == item.idRecord)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
await _obj110Rep.AsUpdateable()
|
||||
.SetColumns(it => new Obj110
|
||||
{
|
||||
fld004631 = DateTime.Now,
|
||||
fld004315 = codeVal,
|
||||
fld004316 = "N",
|
||||
fld004317 = apiOutput.msg
|
||||
})
|
||||
.Where(it => it.idRecord == item.idRecord)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
var msg = apiOutput.msg;
|
||||
if (string.IsNullOrEmpty(msg))
|
||||
@ -847,7 +882,7 @@ public class ProductManagementService : IDynamicApiController, ITransient
|
||||
var versionIndex = item.VersionIndex;
|
||||
// 查询 BOM
|
||||
var processRouteData = await _configurationDataRep.AsQueryable()
|
||||
.Where(x => x.ConfigId == configid.ConfigID && x.ParentGuid == item.RecordGuid && x.isDeleted == false && x.ParentVersion == versionIndex ).ToListAsync();
|
||||
.Where(x => x.ConfigId == configid.ConfigID && x.ParentGuid == item.RecordGuid && x.isDeleted == false && x.ParentVersion == versionIndex).ToListAsync();
|
||||
if (processRouteData.Count == 0)
|
||||
{
|
||||
continue;
|
||||
|
@ -300,17 +300,33 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient
|
||||
};
|
||||
var apiOutput = await _sapService.SapBomApi(isreq);
|
||||
string codeVal = apiOutput.code == "S" ? "成功" : "失败";
|
||||
await _obj137Rep.AsUpdateable()
|
||||
.SetColumns(it => new Obj137
|
||||
{
|
||||
fld005539 = DateTime.Now,
|
||||
fld005533 = codeVal,
|
||||
fld005534 = "N",
|
||||
fld005535 = apiOutput.msg,
|
||||
fld005686 = input[0].ParentVersion.ToString()
|
||||
})
|
||||
.Where(it => it.idRecord == ParentData.idRecord)
|
||||
.ExecuteCommandAsync();
|
||||
if (codeVal == "成功")
|
||||
{
|
||||
await _obj137Rep.AsUpdateable()
|
||||
.SetColumns(it => new Obj137
|
||||
{
|
||||
fld005539 = DateTime.Now,
|
||||
fld005533 = codeVal,
|
||||
fld005534 = "N",
|
||||
fld005535 = apiOutput.msg,
|
||||
fld005686 = input[0].ParentVersion.ToString()
|
||||
})
|
||||
.Where(it => it.idRecord == ParentData.idRecord)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
else {
|
||||
await _obj137Rep.AsUpdateable()
|
||||
.SetColumns(it => new Obj137
|
||||
{
|
||||
fld005539 = DateTime.Now,
|
||||
fld005533 = codeVal,
|
||||
fld005534 = "N",
|
||||
fld005535 = apiOutput.msg
|
||||
})
|
||||
.Where(it => it.idRecord == ParentData.idRecord)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
var msg = apiOutput.msg;
|
||||
if (apiOutput.msg == "")
|
||||
{
|
||||
@ -681,17 +697,34 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient
|
||||
|
||||
var apiOutput = await _sapService.SapBomApi(isreq);
|
||||
string codeVal = apiOutput.code == "S" ? "成功" : "失败";
|
||||
await _obj137Rep.AsUpdateable()
|
||||
.SetColumns(it => new Obj137
|
||||
{
|
||||
fld005539 = DateTime.Now,
|
||||
fld005533 = codeVal,
|
||||
fld005534 = "N",
|
||||
fld005535 = apiOutput.msg,
|
||||
fld005686 = bomData[0].ParentVersion.ToString()
|
||||
})
|
||||
.Where(it => it.idRecord == item.idRecord)
|
||||
.ExecuteCommandAsync();
|
||||
|
||||
if (codeVal == "成功")
|
||||
{
|
||||
await _obj137Rep.AsUpdateable()
|
||||
.SetColumns(it => new Obj137
|
||||
{
|
||||
fld005539 = DateTime.Now,
|
||||
fld005533 = codeVal,
|
||||
fld005534 = "N",
|
||||
fld005535 = apiOutput.msg,
|
||||
fld005686 = versionIndex.ToString()
|
||||
})
|
||||
.Where(it => it.idRecord == item.idRecord)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
await _obj137Rep.AsUpdateable()
|
||||
.SetColumns(it => new Obj137
|
||||
{
|
||||
fld005539 = DateTime.Now,
|
||||
fld005533 = codeVal,
|
||||
fld005534 = "N",
|
||||
fld005535 = apiOutput.msg
|
||||
})
|
||||
.Where(it => it.idRecord == item.idRecord)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
var msg = apiOutput.msg;
|
||||
if (string.IsNullOrEmpty(msg))
|
||||
|
Loading…
Reference in New Issue
Block a user