Compare commits
No commits in common. "f949b8f6169292e6f31e8b79d2c6ac2b3a794f2f" and "d705061237718826c085af29c26d8469431ebe73" have entirely different histories.
f949b8f616
...
d705061237
@ -5,7 +5,6 @@
|
|||||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||||
|
|
||||||
using Admin.NET.Core;
|
using Admin.NET.Core;
|
||||||
using DocumentFormat.OpenXml.Bibliography;
|
|
||||||
using DocumentFormat.OpenXml.Drawing.Spreadsheet;
|
using DocumentFormat.OpenXml.Drawing.Spreadsheet;
|
||||||
using Furion.DependencyInjection;
|
using Furion.DependencyInjection;
|
||||||
using Furion.DynamicApiController;
|
using Furion.DynamicApiController;
|
||||||
@ -301,99 +300,5 @@ public class DataValidationService : IDynamicApiController, ITransient
|
|||||||
|
|
||||||
return contrastResult;
|
return contrastResult;
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// 修改库存信息
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="recordGuid"></param>
|
|
||||||
/// <param name="code"></param>
|
|
||||||
/// <param name="objectid"></param>
|
|
||||||
/// <param name="Bdmng"></param>
|
|
||||||
/// <param name="Labst"></param>
|
|
||||||
/// <param name="ZwqslPo"></param>
|
|
||||||
/// <param name="ZwqslPr"></param>
|
|
||||||
/// <param name="dateUpdated"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public async Task<string> ModifyInventoryInformation(string recordGuid,string code,long objectid,string Bdmng, string Labst, string ZwqslPo, string ZwqslPr, DateTime dateUpdated)
|
|
||||||
{
|
|
||||||
if (code=="S")
|
|
||||||
{
|
|
||||||
if (objectid == 137)
|
|
||||||
{
|
|
||||||
var data = _obj137Rep.AsQueryable().Where(x => x.RecordGuid == recordGuid && x.deleted == false).OrderByDescending(x => x.idRecord).First();
|
|
||||||
if (data != null)
|
|
||||||
{
|
|
||||||
await _obj137Rep.AsUpdateable().SetColumns(it => new Obj137
|
|
||||||
{
|
|
||||||
fld006530 = Bdmng,
|
|
||||||
fld005623 = Labst,
|
|
||||||
fld006531 = ZwqslPo,
|
|
||||||
fld006532 = ZwqslPr,
|
|
||||||
fld005624 = dateUpdated
|
|
||||||
})
|
|
||||||
.Where(it => it.idRecord == data.idRecord)
|
|
||||||
.ExecuteCommandAsync();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (objectid == 112)
|
|
||||||
{
|
|
||||||
var data = _obj112Rep.AsQueryable().Where(x => x.RecordGuid == recordGuid && x.deleted == false).First();
|
|
||||||
if (data != null)
|
|
||||||
{
|
|
||||||
await _obj112Rep.AsUpdateable().SetColumns(it => new Obj112
|
|
||||||
{
|
|
||||||
fld006750 = Bdmng,
|
|
||||||
fld006751 = Labst,
|
|
||||||
fld006752 = ZwqslPo,
|
|
||||||
fld006753 = ZwqslPr,
|
|
||||||
fld006755 = dateUpdated
|
|
||||||
})
|
|
||||||
.Where(it => it.idRecord == data.idRecord)
|
|
||||||
.ExecuteCommandAsync();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (objectid == 137)
|
|
||||||
{
|
|
||||||
var data = await _obj137Rep.AsQueryable().Where(x => x.RecordGuid == recordGuid && x.deleted == false).OrderByDescending(x => x.idRecord).FirstAsync();
|
|
||||||
if (data != null)
|
|
||||||
{
|
|
||||||
await _obj137Rep.AsUpdateable().SetColumns(it => new Obj137
|
|
||||||
{
|
|
||||||
fld006530 = "",
|
|
||||||
fld005623 = "",
|
|
||||||
fld006531 = "",
|
|
||||||
fld006532 = "",
|
|
||||||
fld005624 = dateUpdated
|
|
||||||
})
|
|
||||||
.Where(it => it.idRecord == data.idRecord)
|
|
||||||
.ExecuteCommandAsync();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (objectid == 112)
|
|
||||||
{
|
|
||||||
var data = await _obj112Rep.AsQueryable().Where(x => x.RecordGuid == recordGuid && x.deleted == false).FirstAsync();
|
|
||||||
if (data != null)
|
|
||||||
{
|
|
||||||
await _obj112Rep.AsUpdateable().SetColumns(it => new Obj112
|
|
||||||
{
|
|
||||||
fld006750 = "",
|
|
||||||
fld006751 = "",
|
|
||||||
fld006752 = "",
|
|
||||||
fld006753 = "",
|
|
||||||
fld006755 = dateUpdated
|
|
||||||
})
|
|
||||||
.Where(it => it.idRecord == data.idRecord)
|
|
||||||
.ExecuteCommandAsync();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return "修改成功";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -522,35 +522,5 @@ public class Obj112
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnName = "fld005323", ColumnDescription = "", Length = -1)]
|
[SugarColumn(ColumnName = "fld005323", ColumnDescription = "", Length = -1)]
|
||||||
public string? fld005323 { get; set; }
|
public string? fld005323 { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 预留
|
|
||||||
/// </summary>
|
|
||||||
public string? fld006750 { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 库存
|
|
||||||
/// </summary>
|
|
||||||
public string? fld006751 { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 未清采购订单数量
|
|
||||||
/// </summary>
|
|
||||||
public string? fld006752 { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 未清采购申请数量
|
|
||||||
/// </summary>
|
|
||||||
public string? fld006753 { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 成本
|
|
||||||
/// </summary>
|
|
||||||
public string? fld006754 { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 库存更新日期
|
|
||||||
/// </summary>
|
|
||||||
public DateTime fld006755 { get; set; }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1378,33 +1378,4 @@ public class Obj137
|
|||||||
public string? fld005679_Rec { get; set; }
|
public string? fld005679_Rec { get; set; }
|
||||||
public DateTime? fld005680 { get; set; }
|
public DateTime? fld005680 { get; set; }
|
||||||
public string? fld005686 { get; set; }
|
public string? fld005686 { get; set; }
|
||||||
/// <summary>
|
|
||||||
/// 预留
|
|
||||||
/// </summary>
|
|
||||||
public string? fld006530 { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 库存
|
|
||||||
/// </summary>
|
|
||||||
public string? fld005623 { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 未清采购订单数量
|
|
||||||
/// </summary>
|
|
||||||
public string? fld006531 { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 未清采购申请数量
|
|
||||||
/// </summary>
|
|
||||||
public string? fld006532 { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 成本
|
|
||||||
/// </summary>
|
|
||||||
public string? fld005625 { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 库存更新日期
|
|
||||||
/// </summary>
|
|
||||||
public DateTime fld005624 { get; set; }
|
|
||||||
}
|
}
|
||||||
|
@ -1,80 +0,0 @@
|
|||||||
// 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 SapEcnQueryInput
|
|
||||||
{
|
|
||||||
/// <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>
|
|
||||||
/// 范围类型的行类型中的 SIGN 组件的类型 默认:I
|
|
||||||
/// </summary>
|
|
||||||
public string Sign { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 范围类型的行类型中的 OPTION 组件的类型 选择单值的时候,这里输入EQ,LOW值作为单选值值,输入范围的时候,这里输入BT,LOW作为区间起点,HIGH作为区间终点
|
|
||||||
/// </summary>
|
|
||||||
public string Option { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 物料编号
|
|
||||||
/// </summary>
|
|
||||||
public string Low { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 物料编号
|
|
||||||
/// </summary>
|
|
||||||
public string High { get; set; }
|
|
||||||
}
|
|
@ -110,7 +110,7 @@ public class SapService : IDynamicApiController, ITransient
|
|||||||
content.Headers.ContentType = new MediaTypeHeaderValue("text/xml");
|
content.Headers.ContentType = new MediaTypeHeaderValue("text/xml");
|
||||||
httpClient.DefaultRequestHeaders.Add("Accept-Language", "zh");
|
httpClient.DefaultRequestHeaders.Add("Accept-Language", "zh");
|
||||||
// 设置 SAP Web 服务的 URL
|
// 设置 SAP Web 服务的 URL
|
||||||
var url = "https://vhjqeps4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zmmfm012/800/zmmfm012/zmmfm012";
|
var url = "https://vhjqeps4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zmmfm012/100/zmmfm012/zmmfm012";
|
||||||
|
|
||||||
// 发起 POST 请求到 SAP Web 服务
|
// 发起 POST 请求到 SAP Web 服务
|
||||||
var response = await httpClient.PostAsync(url, content);
|
var response = await httpClient.PostAsync(url, content);
|
||||||
@ -222,7 +222,7 @@ public class SapService : IDynamicApiController, ITransient
|
|||||||
content.Headers.ContentType = new MediaTypeHeaderValue("text/xml");
|
content.Headers.ContentType = new MediaTypeHeaderValue("text/xml");
|
||||||
httpClient.DefaultRequestHeaders.Add("Accept-Language", "zh");
|
httpClient.DefaultRequestHeaders.Add("Accept-Language", "zh");
|
||||||
// 设置 SAP Web 服务的 URL
|
// 设置 SAP Web 服务的 URL
|
||||||
var url = "https://vhjqeps4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zppfm001/800/zppfm001/zppfm001";
|
var url = "https://vhjqeps4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zppfm001/100/zppfm001/zppfm001";
|
||||||
|
|
||||||
// 发起 POST 请求到 SAP Web 服务
|
// 发起 POST 请求到 SAP Web 服务
|
||||||
var response = await httpClient.PostAsync(url, content);
|
var response = await httpClient.PostAsync(url, content);
|
||||||
@ -396,7 +396,7 @@ public class SapService : IDynamicApiController, ITransient
|
|||||||
content.Headers.ContentType = new MediaTypeHeaderValue("text/xml");
|
content.Headers.ContentType = new MediaTypeHeaderValue("text/xml");
|
||||||
httpClient.DefaultRequestHeaders.Add("Accept-Language", "zh");
|
httpClient.DefaultRequestHeaders.Add("Accept-Language", "zh");
|
||||||
// 设置 SAP Web 服务的 URL
|
// 设置 SAP Web 服务的 URL
|
||||||
var url = "https://vhjqeps4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zppfm003/800/zppfm003/zppfm003";
|
var url = "https://vhjqeps4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zppfm003/100/zppfm003/zppfm003";
|
||||||
|
|
||||||
// 发起 POST 请求到 SAP Web 服务
|
// 发起 POST 请求到 SAP Web 服务
|
||||||
var response = await httpClient.PostAsync(url, content);
|
var response = await httpClient.PostAsync(url, content);
|
||||||
@ -506,7 +506,7 @@ public class SapService : IDynamicApiController, ITransient
|
|||||||
content.Headers.ContentType = new MediaTypeHeaderValue("text/xml");
|
content.Headers.ContentType = new MediaTypeHeaderValue("text/xml");
|
||||||
httpClient.DefaultRequestHeaders.Add("Accept-Language", "zh");
|
httpClient.DefaultRequestHeaders.Add("Accept-Language", "zh");
|
||||||
// 设置 SAP Web 服务的 URL
|
// 设置 SAP Web 服务的 URL
|
||||||
var url = "https://vhjqeps4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zppfm004/800/zppfm004/zppfm004";
|
var url = "https://vhjqeps4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zppfm004/100/zppfm004/zppfm004";
|
||||||
|
|
||||||
// 发起 POST 请求到 SAP Web 服务
|
// 发起 POST 请求到 SAP Web 服务
|
||||||
var response = await httpClient.PostAsync(url, content);
|
var response = await httpClient.PostAsync(url, content);
|
||||||
@ -660,7 +660,7 @@ public class SapService : IDynamicApiController, ITransient
|
|||||||
content.Headers.ContentType = new MediaTypeHeaderValue("text/xml");
|
content.Headers.ContentType = new MediaTypeHeaderValue("text/xml");
|
||||||
httpClient.DefaultRequestHeaders.Add("Accept-Language", "zh");
|
httpClient.DefaultRequestHeaders.Add("Accept-Language", "zh");
|
||||||
// 设置 SAP Web 服务的 URL
|
// 设置 SAP Web 服务的 URL
|
||||||
var url = "https://vhjqeps4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zmmfm013/800/zmmfm013/zmmfm013";
|
var url = "https://vhjqeps4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zmmfm013/100/zmmfm013/zmmfm013";
|
||||||
|
|
||||||
// 发起 POST 请求到 SAP Web 服务
|
// 发起 POST 请求到 SAP Web 服务
|
||||||
var response = await httpClient.PostAsync(url, content);
|
var response = await httpClient.PostAsync(url, content);
|
||||||
@ -767,128 +767,4 @@ public class SapService : IDynamicApiController, ITransient
|
|||||||
|
|
||||||
return itemElements;
|
return itemElements;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// SAP Ecn查询服务
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="input"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public async Task<SapEcnQueryOutput> SapEcnQueryApi(SapEcnQueryInput input)
|
|
||||||
{
|
|
||||||
// 创建SOAP XML请求
|
|
||||||
var soapEnvelope = new XDocument(
|
|
||||||
new XDeclaration("1.0", "utf-8", "yes"),
|
|
||||||
new XElement(XName.Get("Envelope", "http://schemas.xmlsoap.org/soap/envelope/"),
|
|
||||||
new XElement(XName.Get("Header", "http://schemas.xmlsoap.org/soap/envelope/")),
|
|
||||||
new XElement(XName.Get("Body", "http://schemas.xmlsoap.org/soap/envelope/"),
|
|
||||||
new XElement(XName.Get("Zppfm005", "urn:sap-com:document:sap:soap:functions:mc-style"),
|
|
||||||
new XElement("IsInput",
|
|
||||||
new XElement("ItMatnr",
|
|
||||||
new XElement("item",
|
|
||||||
new XElement("Sign", input.Sign),
|
|
||||||
new XElement("Option", input.Option),
|
|
||||||
new XElement("Low", input.Low),
|
|
||||||
new XElement("High", input.High)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
new XElement("IsReq",
|
|
||||||
new XElement("Reqkeyid", input.Reqkeyid),
|
|
||||||
new XElement("Businessid", input.Businessid),
|
|
||||||
new XElement("Messageid", input.Messageid),
|
|
||||||
new XElement("Sndprn", input.Sndprn),
|
|
||||||
new XElement("Rcvprn", input.Rcvprn),
|
|
||||||
new XElement("Requser", input.Requser),
|
|
||||||
new XElement("Note1", input.Note1),
|
|
||||||
new XElement("Note2", input.Note2),
|
|
||||||
new XElement("Note3", input.Note3)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
var httpClientHandler = new HttpClientHandler
|
|
||||||
{
|
|
||||||
ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => true,
|
|
||||||
ClientCertificateOptions = ClientCertificateOption.Manual
|
|
||||||
};
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (var httpClient = new HttpClient(httpClientHandler))
|
|
||||||
{
|
|
||||||
// 设置基本身份验证信息
|
|
||||||
var username = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName);
|
|
||||||
var password = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapPassword);
|
|
||||||
var credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{username}:{password}"));
|
|
||||||
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", credentials);
|
|
||||||
// 将 XML 内容转换为字符串并设置请求内容类型为 text/xml
|
|
||||||
var content = new StringContent(soapEnvelope.ToString(), Encoding.UTF8, "text/xml");
|
|
||||||
content.Headers.ContentType = new MediaTypeHeaderValue("text/xml");
|
|
||||||
httpClient.DefaultRequestHeaders.Add("Accept-Language", "zh");
|
|
||||||
// 设置 SAP Web 服务的 URL
|
|
||||||
var url = "https://vhjqeps4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zppfm005/800/zppfm005/zppfm005";
|
|
||||||
|
|
||||||
// 发起 POST 请求到 SAP Web 服务
|
|
||||||
var response = await httpClient.PostAsync(url, content);
|
|
||||||
|
|
||||||
if (response.IsSuccessStatusCode)
|
|
||||||
{
|
|
||||||
var result = await response.Content.ReadAsStringAsync();
|
|
||||||
XDocument doc = XDocument.Parse(result);
|
|
||||||
var esRet = doc.Descendants("EsRet").FirstOrDefault();
|
|
||||||
var code = esRet?.Element("Code")?.Value;
|
|
||||||
|
|
||||||
var item = doc.Descendants("item").FirstOrDefault();
|
|
||||||
var matnr= item?.Element("Matnr")?.Value;
|
|
||||||
var werks = item?.Element("Werks")?.Value;
|
|
||||||
var bdmng = item?.Element("Bdmng")?.Value;
|
|
||||||
var labst = item?.Element("Labst")?.Value;
|
|
||||||
var zwqslPr = item?.Element("ZwqslPr")?.Value;
|
|
||||||
var zwqslPo = item?.Element("ZwqslPo")?.Value;
|
|
||||||
var meins = item?.Element("Meins")?.Value;
|
|
||||||
|
|
||||||
|
|
||||||
var output = new SapEcnQueryOutput()
|
|
||||||
{
|
|
||||||
Parameter = soapEnvelope.ToString(),
|
|
||||||
Code = code,
|
|
||||||
Matnr = matnr,
|
|
||||||
Werks = werks,
|
|
||||||
Bdmng = bdmng,
|
|
||||||
Labst = labst,
|
|
||||||
ZwqslPr = zwqslPr,
|
|
||||||
ZwqslPo = zwqslPo,
|
|
||||||
Meins = meins,
|
|
||||||
Result= result
|
|
||||||
};
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var result = await response.Content.ReadAsStringAsync();
|
|
||||||
var output = new SapEcnQueryOutput()
|
|
||||||
{
|
|
||||||
Parameter = soapEnvelope.ToString(),
|
|
||||||
Code = "失败",
|
|
||||||
Result = result
|
|
||||||
};
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
|
|
||||||
// 记录错误日志
|
|
||||||
Console.WriteLine("发生错误: " + ex.Message);
|
|
||||||
var output = new SapEcnQueryOutput()
|
|
||||||
{
|
|
||||||
Code = "失败",
|
|
||||||
Result = "发生错误" + ex
|
|
||||||
};
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -168,7 +168,7 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient
|
|||||||
Messageid = "",
|
Messageid = "",
|
||||||
Sndprn = "PLM",
|
Sndprn = "PLM",
|
||||||
Rcvprn = "SAP",
|
Rcvprn = "SAP",
|
||||||
Requser = Requser,
|
Requser = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName),
|
||||||
Note1 = "",
|
Note1 = "",
|
||||||
Note2 = "",
|
Note2 = "",
|
||||||
Note3 = "",
|
Note3 = "",
|
||||||
@ -280,7 +280,6 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient
|
|||||||
/// 生成ECN差异清单
|
/// 生成ECN差异清单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[AllowAnonymous]
|
|
||||||
public async Task<string> EcnVarianceList()
|
public async Task<string> EcnVarianceList()
|
||||||
{
|
{
|
||||||
//获取符合条件的变更通知Ecn数据
|
//获取符合条件的变更通知Ecn数据
|
||||||
|
@ -1,112 +0,0 @@
|
|||||||
// 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.Service.StockInquiry.Dto;
|
|
||||||
public class BomStockInquiryOutput
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 物料编码
|
|
||||||
/// </summary>
|
|
||||||
public string materialCode { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 物料描述
|
|
||||||
/// </summary>
|
|
||||||
public string materialName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// sap入参
|
|
||||||
/// </summary>
|
|
||||||
public string Parameter { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 消息类型
|
|
||||||
/// </summary>
|
|
||||||
public string Code { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 物料编码
|
|
||||||
/// </summary>
|
|
||||||
public string Matnr { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 工厂
|
|
||||||
/// </summary>
|
|
||||||
public string Werks { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 预留需求数量
|
|
||||||
/// </summary>
|
|
||||||
public string Bdmng { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 库存
|
|
||||||
/// </summary>
|
|
||||||
public string Labst { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 未清采购申请数量
|
|
||||||
/// </summary>
|
|
||||||
public string ZwqslPr { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 未清采购订单数量
|
|
||||||
/// </summary>
|
|
||||||
public string ZwqslPo { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 基本计量单位
|
|
||||||
/// </summary>
|
|
||||||
public string Meins { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// sap出参
|
|
||||||
/// </summary>
|
|
||||||
public string Result { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 更新日期
|
|
||||||
/// </summary>
|
|
||||||
public DateTime DateUpdated { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询状态
|
|
||||||
/// </summary>
|
|
||||||
public string State { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public class BomStockInquiryUpdateable
|
|
||||||
{
|
|
||||||
public long Objectid { get; set; }
|
|
||||||
public string RecordGuid { get; set; }
|
|
||||||
public string Code { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 预留需求数量
|
|
||||||
/// </summary>
|
|
||||||
public string Bdmng { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 库存
|
|
||||||
/// </summary>
|
|
||||||
public string Labst { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 未清采购申请数量
|
|
||||||
/// </summary>
|
|
||||||
public string ZwqslPr { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 未清采购订单数量
|
|
||||||
/// </summary>
|
|
||||||
public string ZwqslPo { get; set; }
|
|
||||||
public DateTime DateUpdated { get; set; }
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
// 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.Service.StockInquiry.Dto;
|
|
||||||
public class RawMaterialInput
|
|
||||||
{
|
|
||||||
public string? materialCode { get; set; }
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
// 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.Service.StockInquiry.Dto;
|
|
||||||
public class RawMaterialOutput
|
|
||||||
{
|
|
||||||
public long? idRecord { get; set; }
|
|
||||||
public string _System_objNBS { get; set; }
|
|
||||||
public string _System_objDescription { get; set; }
|
|
||||||
}
|
|
@ -1,378 +0,0 @@
|
|||||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
|
||||||
//
|
|
||||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
|
||||||
//
|
|
||||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
|
||||||
|
|
||||||
using Admin.NET.Core;
|
|
||||||
using Admin.NET.Core.Service;
|
|
||||||
using Furion.DependencyInjection;
|
|
||||||
using Furion.DynamicApiController;
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
|
|
||||||
using SqlSugar;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Vistar.Application.Common;
|
|
||||||
using Vistar.Application.Const;
|
|
||||||
using Vistar.Application.Entity;
|
|
||||||
using Vistar.Application.SapService.Dto;
|
|
||||||
using Vistar.Application.Service.StockInquiry.Dto;
|
|
||||||
using Vistar.Application.Util;
|
|
||||||
|
|
||||||
namespace Vistar.Application.Service.StockInquiry;
|
|
||||||
|
|
||||||
[ApiDescriptionSettings(ApplicationConst.GroupName, Name = "StockInquiry", Order = 100)]
|
|
||||||
public class StockInquiryService : IDynamicApiController, ITransient
|
|
||||||
{
|
|
||||||
public Common.DataValidationService _dataValidationService;
|
|
||||||
public SqlSugarRepository<Obj137> _obj137Rep;
|
|
||||||
public SqlSugarRepository<Obj112> _obj112Rep;
|
|
||||||
public SqlSugarRepository<ConfigurationData> _configurationDataRep;
|
|
||||||
public SolidWorksManageService.SolidWorksManageService _solidWorksManageService;
|
|
||||||
private readonly SysConfigService _sysConfigService;
|
|
||||||
public SapService.SapService _sapService;
|
|
||||||
public StockInquiryService
|
|
||||||
(
|
|
||||||
DataValidationService dataValidationService,
|
|
||||||
SqlSugarRepository<Obj137> obj137Rep,
|
|
||||||
SqlSugarRepository<Obj112> obj112Rep,
|
|
||||||
SqlSugarRepository<ConfigurationData> configurationDataRep,
|
|
||||||
SolidWorksManageService.SolidWorksManageService solidWorksManageService,
|
|
||||||
SysConfigService sysConfigService,
|
|
||||||
SapService.SapService sapService
|
|
||||||
)
|
|
||||||
{
|
|
||||||
_obj137Rep = obj137Rep;
|
|
||||||
_obj112Rep = obj112Rep;
|
|
||||||
_configurationDataRep = configurationDataRep;
|
|
||||||
_solidWorksManageService = solidWorksManageService;
|
|
||||||
_sysConfigService = sysConfigService;
|
|
||||||
_sapService = sapService;
|
|
||||||
_dataValidationService = dataValidationService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 产品管理库-库存查询
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="materialCode"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[ApiDescriptionSettings(Name = "GetProductInventory", Description = "产品管理库-库存查询", Order = 1000), HttpGet]
|
|
||||||
[DisplayName("产品管理库-库存查询")]
|
|
||||||
[AllowAnonymous]
|
|
||||||
public async Task<SapEcnQueryOutput> GetProductInventory(string materialCode)
|
|
||||||
{
|
|
||||||
var Requser = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName);
|
|
||||||
|
|
||||||
var SapEcnQueryData = new SapEcnQueryInput
|
|
||||||
{
|
|
||||||
Reqkeyid = "",
|
|
||||||
Businessid = "",
|
|
||||||
Messageid = "",
|
|
||||||
Sndprn = "PLM",
|
|
||||||
Rcvprn = "SAP",
|
|
||||||
Requser = Requser,
|
|
||||||
Note1 = "",
|
|
||||||
Note2 = "",
|
|
||||||
Note3 = "",
|
|
||||||
Sign = "I",
|
|
||||||
Option = "EQ",
|
|
||||||
Low = materialCode,
|
|
||||||
High = ""
|
|
||||||
};
|
|
||||||
|
|
||||||
var apiOutput = await _sapService.SapEcnQueryApi(SapEcnQueryData);
|
|
||||||
|
|
||||||
if (apiOutput.Code == "S")
|
|
||||||
{
|
|
||||||
var data = await _obj137Rep.AsQueryable().Where(x => x._System_objNBS == materialCode && x.deleted == false).OrderByDescending(x => x.idRecord).FirstAsync();
|
|
||||||
if (data != null)
|
|
||||||
{
|
|
||||||
apiOutput.DateUpdated = DateTime.Now;
|
|
||||||
await _obj137Rep.AsUpdateable().SetColumns(it => new Obj137
|
|
||||||
{
|
|
||||||
fld006530 = apiOutput.Bdmng,
|
|
||||||
fld005623 = apiOutput.Labst,
|
|
||||||
fld006531 = apiOutput.ZwqslPo,
|
|
||||||
fld006532 = apiOutput.ZwqslPr,
|
|
||||||
fld005624 = apiOutput.DateUpdated
|
|
||||||
})
|
|
||||||
.Where(it => it.idRecord == data.idRecord)
|
|
||||||
.ExecuteCommandAsync();
|
|
||||||
return apiOutput;
|
|
||||||
}
|
|
||||||
var RawMaterialData = await _obj112Rep.AsQueryable().Where(x => x._System_objNBS == materialCode && x.deleted == false).FirstAsync();
|
|
||||||
if (RawMaterialData != null)
|
|
||||||
{
|
|
||||||
apiOutput.DateUpdated = DateTime.Now;
|
|
||||||
await _obj112Rep.AsUpdateable().SetColumns(it => new Obj112
|
|
||||||
{
|
|
||||||
fld006750 = apiOutput.Bdmng,
|
|
||||||
fld006751 = apiOutput.Labst,
|
|
||||||
fld006752 = apiOutput.ZwqslPo,
|
|
||||||
fld006753 = apiOutput.ZwqslPr,
|
|
||||||
fld006755 = apiOutput.DateUpdated
|
|
||||||
})
|
|
||||||
.Where(it => it.idRecord == RawMaterialData.idRecord)
|
|
||||||
.ExecuteCommandAsync();
|
|
||||||
return apiOutput;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return apiOutput;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 产品管理库-Bom库存查询
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="materialCode"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[ApiDescriptionSettings(Name = "GetBomProductInventory", Description = "产品管理库-Bom库存查询", Order = 1000), HttpGet]
|
|
||||||
[DisplayName("产品管理库-库存查询")]
|
|
||||||
[AllowAnonymous]
|
|
||||||
public async Task<List<BomStockInquiryOutput>> GetBomProductInventory(string materialCode)
|
|
||||||
{
|
|
||||||
var Requser = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName);
|
|
||||||
|
|
||||||
var materialData = await _obj137Rep.AsQueryable()
|
|
||||||
.Where(x => x._System_objNBS == materialCode && x.deleted == false)
|
|
||||||
.OrderByDescending(x => x.idRecord)
|
|
||||||
.FirstAsync();
|
|
||||||
|
|
||||||
var bomList = await _configurationDataRep.AsQueryable()
|
|
||||||
.Where(x => x.ParentGuid == materialData.RecordGuid && x.isDeleted == false
|
|
||||||
&& x.ParentVersion == materialData.VersionIndex
|
|
||||||
&& (x.fld005577 != "不包含" || x.fld005577 == null)
|
|
||||||
&& x.isSuppressed == false && x.inContext == false)
|
|
||||||
.ToListAsync();
|
|
||||||
|
|
||||||
var UpdateableList = new List<BomStockInquiryUpdateable>();
|
|
||||||
|
|
||||||
var tasks = bomList.Select(async item =>
|
|
||||||
{
|
|
||||||
var code = item.PartNumber;
|
|
||||||
var name = item.Description;
|
|
||||||
var objectid = item.ChildObjID;
|
|
||||||
var childGuid = item.ChildGuid;
|
|
||||||
|
|
||||||
var SapEcnQueryData = new SapEcnQueryInput
|
|
||||||
{
|
|
||||||
Reqkeyid = "",
|
|
||||||
Businessid = "",
|
|
||||||
Messageid = "",
|
|
||||||
Sndprn = "PLM",
|
|
||||||
Rcvprn = "SAP",
|
|
||||||
Requser = Requser,
|
|
||||||
Note1 = "",
|
|
||||||
Note2 = "",
|
|
||||||
Note3 = "",
|
|
||||||
Sign = "I",
|
|
||||||
Option = "EQ",
|
|
||||||
Low = code,
|
|
||||||
High = ""
|
|
||||||
};
|
|
||||||
|
|
||||||
var apiOutput = await _sapService.SapEcnQueryApi(SapEcnQueryData);
|
|
||||||
var dateUpdated = DateTime.Now;
|
|
||||||
if (apiOutput.Code == "S")
|
|
||||||
{
|
|
||||||
var UpdateableData = new BomStockInquiryUpdateable
|
|
||||||
{
|
|
||||||
Objectid = objectid,
|
|
||||||
Code = apiOutput.Code,
|
|
||||||
RecordGuid = childGuid,
|
|
||||||
Bdmng = apiOutput.Bdmng,
|
|
||||||
Labst = apiOutput.Labst,
|
|
||||||
ZwqslPo = apiOutput.ZwqslPo,
|
|
||||||
ZwqslPr = apiOutput.ZwqslPr,
|
|
||||||
DateUpdated = dateUpdated
|
|
||||||
};
|
|
||||||
UpdateableList.Add(UpdateableData);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var UpdateableData = new BomStockInquiryUpdateable
|
|
||||||
{
|
|
||||||
Code = "",
|
|
||||||
RecordGuid = "",
|
|
||||||
Bdmng = "",
|
|
||||||
Labst = "",
|
|
||||||
ZwqslPo = "",
|
|
||||||
ZwqslPr = "",
|
|
||||||
DateUpdated = dateUpdated
|
|
||||||
};
|
|
||||||
UpdateableList.Add(UpdateableData);
|
|
||||||
}
|
|
||||||
if (apiOutput.Code == "S")
|
|
||||||
{
|
|
||||||
return new BomStockInquiryOutput
|
|
||||||
{
|
|
||||||
materialCode = code,
|
|
||||||
materialName = name,
|
|
||||||
Labst = apiOutput.Labst,
|
|
||||||
Bdmng = apiOutput.Bdmng,
|
|
||||||
ZwqslPr = apiOutput.ZwqslPr,
|
|
||||||
ZwqslPo = apiOutput.ZwqslPo,
|
|
||||||
DateUpdated = dateUpdated,
|
|
||||||
State = "查询成功"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return new BomStockInquiryOutput
|
|
||||||
{
|
|
||||||
materialCode = code,
|
|
||||||
materialName = name,
|
|
||||||
State = "SAP未查询库存信息"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var bomStockInquiryOutput = await Task.WhenAll(tasks);
|
|
||||||
|
|
||||||
foreach (var item in UpdateableList)
|
|
||||||
{
|
|
||||||
await _dataValidationService.ModifyInventoryInformation(item.RecordGuid, item.Code, item.Objectid, item.Bdmng, item.Labst, item.ZwqslPo, item.ZwqslPr, item.DateUpdated);
|
|
||||||
}
|
|
||||||
|
|
||||||
return bomStockInquiryOutput.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取原材料
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="input"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[ApiDescriptionSettings(Name = "GetRawMaterial", Description = "获取原材料", Order = 1000), HttpPost]
|
|
||||||
[DisplayName("获取原材料")]
|
|
||||||
[AllowAnonymous]
|
|
||||||
public async Task<List<RawMaterialOutput>> GetRawMaterial(RawMaterialInput input)
|
|
||||||
{
|
|
||||||
var data = await _obj112Rep.AsQueryable()
|
|
||||||
.Where(x => x.deleted == false)
|
|
||||||
.WhereIF(!string.IsNullOrWhiteSpace(input.materialCode), u => u._System_objNBS.Contains(input.materialCode.Trim()))
|
|
||||||
.Select<RawMaterialOutput>()
|
|
||||||
.ToListAsync();
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 原材料库存查询
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[ApiDescriptionSettings(Name = "RawMaterialStockInquiry", Description = "原材料库存查询", Order = 1000), HttpGet]
|
|
||||||
[DisplayName("原材料库存查询")]
|
|
||||||
[AllowAnonymous]
|
|
||||||
public async Task<List<BomStockInquiryOutput>> RawMaterialStockInquiry()
|
|
||||||
{
|
|
||||||
var Requser = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName);
|
|
||||||
var data = await _obj112Rep.AsQueryable()
|
|
||||||
.Where(x => x.deleted == false)
|
|
||||||
.Select<RawMaterialOutput>()
|
|
||||||
.ToListAsync();
|
|
||||||
var UpdateableList = new List<BomStockInquiryUpdateable>();
|
|
||||||
|
|
||||||
var tasks = data.Select(async item =>
|
|
||||||
{
|
|
||||||
var code = item._System_objNBS;
|
|
||||||
var name = item._System_objDescription;
|
|
||||||
var objectid = 112;
|
|
||||||
var id = item.idRecord;
|
|
||||||
var SapEcnQueryData = new SapEcnQueryInput
|
|
||||||
{
|
|
||||||
Reqkeyid = "",
|
|
||||||
Businessid = "",
|
|
||||||
Messageid = "",
|
|
||||||
Sndprn = "PLM",
|
|
||||||
Rcvprn = "SAP",
|
|
||||||
Requser = Requser,
|
|
||||||
Note1 = "",
|
|
||||||
Note2 = "",
|
|
||||||
Note3 = "",
|
|
||||||
Sign = "I",
|
|
||||||
Option = "EQ",
|
|
||||||
Low = code,
|
|
||||||
High = ""
|
|
||||||
};
|
|
||||||
|
|
||||||
var apiOutput = await _sapService.SapEcnQueryApi(SapEcnQueryData);
|
|
||||||
var dateUpdated = DateTime.Now;
|
|
||||||
if (apiOutput.Code == "S")
|
|
||||||
{
|
|
||||||
var UpdateableData = new BomStockInquiryUpdateable
|
|
||||||
{
|
|
||||||
Objectid = objectid,
|
|
||||||
Code = apiOutput.Code,
|
|
||||||
RecordGuid = id.ToString(),
|
|
||||||
Bdmng = apiOutput.Bdmng,
|
|
||||||
Labst = apiOutput.Labst,
|
|
||||||
ZwqslPo = apiOutput.ZwqslPo,
|
|
||||||
ZwqslPr = apiOutput.ZwqslPr,
|
|
||||||
DateUpdated = dateUpdated
|
|
||||||
};
|
|
||||||
UpdateableList.Add(UpdateableData);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var UpdateableData = new BomStockInquiryUpdateable
|
|
||||||
{
|
|
||||||
Code = "",
|
|
||||||
RecordGuid = "",
|
|
||||||
Bdmng = "",
|
|
||||||
Labst = "",
|
|
||||||
ZwqslPo = "",
|
|
||||||
ZwqslPr = "",
|
|
||||||
DateUpdated = dateUpdated
|
|
||||||
};
|
|
||||||
UpdateableList.Add(UpdateableData);
|
|
||||||
}
|
|
||||||
if (apiOutput.Code == "S")
|
|
||||||
{
|
|
||||||
return new BomStockInquiryOutput
|
|
||||||
{
|
|
||||||
materialCode = code,
|
|
||||||
materialName = name,
|
|
||||||
Labst = apiOutput.Labst,
|
|
||||||
Bdmng = apiOutput.Bdmng,
|
|
||||||
ZwqslPr = apiOutput.ZwqslPr,
|
|
||||||
ZwqslPo = apiOutput.ZwqslPo,
|
|
||||||
DateUpdated = dateUpdated,
|
|
||||||
State = "查询成功"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return new BomStockInquiryOutput
|
|
||||||
{
|
|
||||||
materialCode = code,
|
|
||||||
materialName = name,
|
|
||||||
State = "SAP未查询库存信息"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var bomStockInquiryOutput = await Task.WhenAll(tasks);
|
|
||||||
foreach (var item in UpdateableList)
|
|
||||||
{
|
|
||||||
var dateUpdated = DateTime.Now;
|
|
||||||
await _obj112Rep.AsUpdateable().SetColumns(it => new Obj112
|
|
||||||
{
|
|
||||||
fld006750 = item.Bdmng,
|
|
||||||
fld006751 = item.Labst,
|
|
||||||
fld006752 = item.ZwqslPo,
|
|
||||||
fld006753 = item.ZwqslPr,
|
|
||||||
fld006755 = dateUpdated
|
|
||||||
})
|
|
||||||
.Where(it => it.idRecord == Convert.ToInt32(item.RecordGuid))
|
|
||||||
.ExecuteCommandAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
return bomStockInquiryOutput.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -23,63 +23,3 @@ public class SapOutput
|
|||||||
public string result { get; set; }
|
public string result { get; set; }
|
||||||
public string? banfn { get; set; }
|
public string? banfn { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SapEcnQueryOutput
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// sap入参
|
|
||||||
/// </summary>
|
|
||||||
public string Parameter { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 消息类型
|
|
||||||
/// </summary>
|
|
||||||
public string Code { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 物料编码
|
|
||||||
/// </summary>
|
|
||||||
public string Matnr { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 工厂
|
|
||||||
/// </summary>
|
|
||||||
public string Werks { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 预留需求数量
|
|
||||||
/// </summary>
|
|
||||||
public string Bdmng { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 库存
|
|
||||||
/// </summary>
|
|
||||||
public string Labst { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 未清采购申请数量
|
|
||||||
/// </summary>
|
|
||||||
public string ZwqslPr { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 未清采购订单数量
|
|
||||||
/// </summary>
|
|
||||||
public string ZwqslPo { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 基本计量单位
|
|
||||||
/// </summary>
|
|
||||||
public string Meins { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// sap出参
|
|
||||||
/// </summary>
|
|
||||||
public string Result { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 更新日期
|
|
||||||
/// </summary>
|
|
||||||
public DateTime DateUpdated { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user