😎同步bom时,子项如果是137表的数据,就通过137表取物料编码

This commit is contained in:
bairubing 2025-02-14 17:24:38 +08:00
parent b2e89ddbd9
commit f98d4aeab9

View File

@ -20,6 +20,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Vistar.Application.Common;
using Vistar.Application.Const;
@ -132,7 +133,10 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient
//获取时间戳精确到毫秒sap要求每次调用生成不重复guid
string millisecondTimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
Random random = new Random();
// 生成1000到9999之间的随机数
string randomNumber = random.Next(1000, 10000).ToString();
millisecondTimestamp = millisecondTimestamp + randomNumber;
var sapMaterialInput = new SapMaterialInput()
{
Reqkeyid = "",
@ -210,10 +214,27 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient
.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.fld005577 != "不包含" || x.fld005577 == null) && x.isSuppressed == false && x.inContext == false && (!(x.ParentSwFileType == 1 && x.isAddedFromSW == false)))
.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<ProductDesignLibraryBomOutput>().ToPagedListAsync(input.Page, input.PageSize);
return BomData;
.Select<ProductDesignLibraryBomOutput>().ToListAsync();
foreach (var item in BomData)
{
if (item.ChildObjID==137)
{
if (item.PartNumber != null && Regex.IsMatch(item.PartNumber, "默认"))
{
var data137 = await _obj137Rep.AsQueryable().Where(x => x._System_objNBS == item.ChildGuid && x.deleted == false && x._system_objConfigurationName == "默认").OrderByDescending(x => x.idRecord).FirstAsync();
if (data137 != null)
{
item.PartNumber = data137._System_objNBS;
item.Description=data137._System_ObjDescription;
}
}
}
}
var data= BomData.ToPagedList(input.Page, input.PageSize);
//.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<ProductDesignLibraryBomOutput>().ToPagedListAsync(input.Page, input.PageSize);
return data;
}
/// <summary>
/// 产品设计库-Bom同步到SAP
@ -273,131 +294,6 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient
};
var output = await SyncBomToSap(syncBomData);
return output;
//for (int i = 0; i < input.Count; i++)
//{
// var Verification = await _dataValidationService.VerificationMaterial(input[i].ChildObjID, input[i].PartNumber, input[i].ChildGuid);
// if (Verification == "不存在")
// {
// continue;
// }
// //int sun = i + 1;
// var itemData = new ItemData()
// {
// POSNR = "",//组件序号 sun.ToString()
// IDNRK = input[i].PartNumber,//组件物料号
// MENGE = Math.Round((decimal)input[i].QtyManual, 3).ToString(),//组件数量
// SORTF = input[i].fld005541,
// ITISOB = input[i].fld005542,
// ALPGR = input[i].fld005543,
// ALPRF = input[i].fld005544,
// ZDELETE = input[i].fld005545,
// POSTP = input[i].fld005546,
// ZYFMK = input[i].fld005547
// };
// itemDataList.Add(itemData);
//}
//if (!string.IsNullOrEmpty(ParentData.fld005686))
//{
// var configid = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 137 && x.ConfigSystemName == "SolidWorks").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.fld005686) && (x.fld005577 != "不包含" || x.fld005577 == null) && x.isSuppressed == false && x.inContext == false).ToListAsync();
// for (int i = 0; i < BomData.Count; i++)
// {
// var itemList = itemDataList.Where(x => x.IDNRK == BomData[i].PartNumber).ToList();
// if (itemList.Count == 0)
// {
// var Verification = await _dataValidationService.VerificationMaterial(BomData[i].ChildObjID, BomData[i].PartNumber, BomData[i].ChildGuid);
// if (Verification == "不存在")
// {
// continue;
// }
// //int sun = i + 1;
// var itemData = new ItemData()
// {
// POSNR = "",//组件序号 sun.ToString()
// IDNRK = BomData[i].PartNumber,//组件物料号
// MENGE = Math.Round((decimal)BomData[i].QtyManual, 3).ToString(),//组件数量
// SORTF = BomData[i].fld005541,
// ITISOB = BomData[i].fld005542,
// ALPGR = BomData[i].fld005543,
// ALPRF = BomData[i].fld005544,
// ZDELETE = "X",
// POSTP = BomData[i].fld005546,
// ZYFMK = BomData[i].fld005547
// };
// itemDataList.Add(itemData);
// }
// }
//}
////获取时间戳精确到毫秒sap要求每次调用生成不重复guid
//string millisecondTimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
//var fld005678 = ParentData.fld005678 ?? 1;
//var isreq = new IS_REQ()
//{
// ReqKeyId = "",
// BusinessId = "",
// MessageId = "",
// SndPrn = "PLM",
// RcvPrn = "SAP",
// ReqUser = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName),
// Note1 = "",
// Note2 = "",
// Note3 = "",
// Zwbid = millisecondTimestamp,
// Matnr = ParentData._System_objNBS,//父物料编码
// Werks = ParentData._SWPDM_1187_SAP___,//工厂
// Bmeng = fld005678.ToString(),
// Aennr = ecn,
// Datuv = ParentData.fld005680.ToString(),
// ItemList = itemDataList
//};
//var apiOutput = await _sapService.SapBomApi(isreq);
//string codeVal = apiOutput.code == "S" ? "成功" : "失败";
//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 == "")
//{
// msg = "同步成功";
//}
//var output = new SapOutput()
//{
// parameter = apiOutput.parameter,
// code = codeVal,
// msg = msg,
// result = apiOutput.result
//};
//return output;
}
/// <summary>
/// 产品设计库-批量同步到SAP
@ -453,6 +349,11 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient
}
//获取时间戳精确到毫秒sap要求每次调用生成不重复guid
string millisecondTimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
Random random = new Random();
// 生成1000到9999之间的随机数
string randomNumber = random.Next(1000, 10000).ToString();
millisecondTimestamp = millisecondTimestamp + randomNumber;
var sapMaterialInput = new SapMaterialInput()
{
Reqkeyid = "",
@ -519,107 +420,6 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient
});
var materialOutput = await Task.WhenAll(tasks);
return materialOutput.ToList();
//for (int i = 0; i < input.Count; i++)
//{
// // 验证物料描述长度
// if (input[i]._SWPDM_1188_SAP___.Length > 40)
// {
// await _obj137Rep.AsUpdateable()
// .SetColumns(it => new Obj137
// {
// fld005532 = DateTime.Now,
// fld005530 = "N",
// fld005531 = lengthError,
// fld005529 = "失败"
// })
// .Where(it => it.idRecord == input[i].idRecord)
// .ExecuteCommandAsync().ConfigureAwait(false);
// SapOutputList.Add(new SapOutput()
// {
// materialCode = input[i]._System_objNBS,
// code = "失败",
// msg = lengthError,
// result = lengthError
// });
// continue;
// }
// if (input[i].fld005530 == "N" || input[i].fld005530 == "D" || input[i].fld005530 == null)
// {
// SapOutputList.Add(new SapOutput()
// {
// materialCode = input[i]._System_objNBS,
// code = "失败",
// msg = synchronized,
// result = synchronized
// });
// continue;
// }
// //获取时间戳精确到毫秒sap要求每次调用生成不重复guid
// string millisecondTimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
// var sapMaterialInput = new SapMaterialInput()
// {
// Reqkeyid = "",
// Businessid = "",
// Messageid = "",
// Sndprn = "PLM",
// Rcvprn = "SAP",
// Requser = Requser,
// Note1 = "",
// Note2 = "",
// Note3 = "",
// Zwbid = millisecondTimestamp,
// Matnr = input[i]._System_objNBS,
// Mbrsh = input[i]._SWPDM_1185_SAP___,
// Mtart = input[i]._SWPDM_1186_SAP_____,
// Maktx = input[i]._SWPDM_1188_SAP___,
// Meins = input[i]._SWPDM_126_SW___,
// Matkl = input[i]._SWPDM_1203_SAP____,
// Bismt = input[i]._SWPDM_64_SW___,
// Groes = input[i]._SWPDM_125_SW___,
// Normt = input[i]._SWPDM_65_SW___,
// Ferth = input[i]._SWPDM_62_SW___,
// Zeinr = input[i]._SWPDM_61_SW_____,
// Mstae = input[i]._SWPDM_1209_SAP_____,
// Raube = "",
// Mhdrz = "",
// Mhdhb = "",
// Werks = input[i]._SWPDM_1187_SAP___,
// Beskz = input[i]._SWPDM_1196_SAP_____,
// Sobsl = input[i]._SWPDM_1198_SAP_____,
// Schgt = input[i]._SWPDM_1197_SAP_____,
// Rgekz = input[i]._SWPDM_1199_SAP___,
// Zbom = input[i]._SWPDM_1208_SAP___BOM___
// };
// var sapOutput = await _sapService.SapMaterialApi(sapMaterialInput);
// string codeVal = sapOutput.code == "S" ? "成功" : "失败";
// string msg = sapOutput.msg;
// if (sapOutput.msg == "")
// {
// msg = "同步成功";
// }
// await _obj137Rep.AsUpdateable()
// .SetColumns(it => new Obj137
// {
// fld005532 = DateTime.Now,
// fld005529 = codeVal,
// fld005530 = "N",
// fld005531 = msg
// })
// .Where(it => it.idRecord == input[i].idRecord)
// .ExecuteCommandAsync();
// var output = new SapOutput()
// {
// parameter = sapOutput.parameter,
// materialCode = input[0]._System_objNBS,
// code = codeVal,
// msg = msg,
// result = sapOutput.result
// };
// SapOutputList.Add(output);
//}
}
/// <summary>
/// 产品设计库-定时同步到SAP
@ -665,6 +465,11 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient
//获取时间戳精确到毫秒sap要求每次调用生成不重复guid
string millisecondTimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
Random random = new Random();
// 生成1000到9999之间的随机数
string randomNumber = random.Next(1000, 10000).ToString();
millisecondTimestamp = millisecondTimestamp + randomNumber;
var sapMaterialInput = new SapMaterialInput()
{
Reqkeyid = "",
@ -731,102 +536,6 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient
});
var materialOutput = await Task.WhenAll(tasks);
return materialOutput.ToList();
//for (int i = 0; i < input.Count; i++)
//{
// if (!string.IsNullOrEmpty(input[i]._SWPDM_1188_SAP___))
// {
// // 验证物料描述长度
// if (input[i]._SWPDM_1188_SAP___.Length > 40)
// {
// await _obj137Rep.AsUpdateable()
// .SetColumns(it => new Obj137
// {
// fld005532 = DateTime.Now,
// fld005530 = "N",
// fld005531 = lengthError,
// fld005529 = "失败"
// })
// .Where(it => it.idRecord == input[i].idRecord)
// .ExecuteCommandAsync().ConfigureAwait(false);
// SapOutputList.Add(new SapOutput()
// {
// materialCode = input[i]._System_objNBS,
// code = "失败",
// msg = lengthError,
// result = lengthError
// });
// continue;
// }
// }
// //获取时间戳精确到毫秒sap要求每次调用生成不重复guid
// string millisecondTimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
// var sapMaterialInput = new SapMaterialInput()
// {
// Reqkeyid = "",
// Businessid = "",
// Messageid = "",
// Sndprn = "PLM",
// Rcvprn = "SAP",
// Requser = Requser,
// Note1 = "",
// Note2 = "",
// Note3 = "",
// Zwbid = millisecondTimestamp,
// Matnr = input[i]._System_objNBS,
// Mbrsh = input[i]._SWPDM_1185_SAP___,
// Mtart = input[i]._SWPDM_1186_SAP_____,
// Maktx = input[i]._SWPDM_1188_SAP___,
// Meins = input[i]._SWPDM_126_SW___,
// Matkl = input[i]._SWPDM_1203_SAP____,
// Bismt = input[i]._SWPDM_64_SW___,
// Groes = input[i]._SWPDM_125_SW___,
// Normt = input[i]._SWPDM_65_SW___,
// Ferth = input[i]._SWPDM_62_SW___,
// Zeinr = input[i]._SWPDM_61_SW_____,
// Mstae = input[i]._SWPDM_1209_SAP_____,
// Raube = "",
// Mhdrz = "",
// Mhdhb = "",
// Werks = input[i]._SWPDM_1187_SAP___,
// Beskz = input[i]._SWPDM_1196_SAP_____,
// Sobsl = input[i]._SWPDM_1198_SAP_____,
// Schgt = input[i]._SWPDM_1197_SAP_____,
// Rgekz = input[i]._SWPDM_1199_SAP___,
// Zbom = input[i]._SWPDM_1208_SAP___BOM___
// };
// var sapOutput = await _sapService.SapMaterialApi(sapMaterialInput);
// string codeVal = sapOutput.code == "S" ? "成功" : "失败";
// string msg = sapOutput.msg;
// if (sapOutput.msg == "")
// {
// msg = "同步成功";
// }
// await _obj137Rep.AsUpdateable()
// .SetColumns(it => new Obj137
// {
// fld005532 = DateTime.Now,
// fld005529 = codeVal,
// fld005530 = "N",
// fld005531 = msg
// })
// .Where(it => it.idRecord == input[i].idRecord)
// .ExecuteCommandAsync();
// var output = new SapOutput()
// {
// parameter = sapOutput.parameter,
// materialCode = input[0]._System_objNBS,
// code = codeVal,
// msg = msg,
// result = sapOutput.result
// };
// SapOutputList.Add(output);
//}
//return SapOutputList;
}
/// <summary>
@ -939,8 +648,24 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient
var itemDataList = new List<ItemData>();
foreach (var item in data.Bom)
{
var verification = await _dataValidationService.VerificationMaterial(item.ChildObjID, item.PartNumber, item.ChildGuid);
string verification = "不存在";
if (item.ChildObjID == 137)
{
var data137 = await db.CopyNew().Queryable<Obj137>().Where(x => x._System_objNBS == item.PartNumber && x.deleted == false && x.RecordGuid == item.ChildGuid && x._system_objConfigurationName == "默认").OrderByDescending(x => x.idRecord).FirstAsync();
if (data137 == null)
{
verification = "不存在";
}
else
{
item.PartNumber = data137._System_objNBS;
verification = "存在";
}
}
else
{
verification = await _dataValidationService.VerificationMaterial(item.ChildObjID, item.PartNumber, item.ChildGuid);
}
if (verification == "不存在")
{
if (item.ChildObjID == 137)
@ -950,7 +675,7 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient
{
continue;
}
var data137 = db.CopyNew().Queryable<Obj137>().Where(x => x._System_objNBS == item.ChildGuid && x.deleted == false&& x._system_objConfigurationName == "默认").OrderByDescending(x => x.idRecord).First();
var data137 = db.CopyNew().Queryable<Obj137>().Where(x => x._System_objNBS == item.ChildGuid && x.deleted == false && x._system_objConfigurationName == "默认").OrderByDescending(x => x.idRecord).First();
if (data137 != null)
{
@ -1041,6 +766,10 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient
}
string millisecondTimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
Random random = new Random();
// 生成1000到9999之间的随机数
string randomNumber = random.Next(1000, 10000).ToString();
millisecondTimestamp = millisecondTimestamp + randomNumber;
var Bmeng = data.Bmeng ?? 1;
@ -1188,95 +917,13 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient
idRecord = ParentData.idRecord,
_System_objNBS = ParentData._System_objNBS,
VersionIndex = ParentData.VersionIndex,
Werks=ParentData._SWPDM_1187_SAP___,
Werks = ParentData._SWPDM_1187_SAP___,
Datuv = ParentData.fld005680,
ProcessRouteList = processRouteList
};
var output = await SyncProcessRouteToSap(syncProcessRouteData);
return output;
//var itemDataList = new List<SapProcessRouteItemData>();
//for (int i = 0; i < input.Count; i++)
//{
// var Verification = await _dataValidationService.VerificationMaterial(input[i].ChildObjID, input[i].PartNumber, input[i].ChildGuid);
// if (Verification == "不存在")
// {
// continue;
// }
// //获取工序描述
// var procedureDescription = await _obj122Rep.AsQueryable().Where(x => x.RecordGuid == input[i].ChildGuid).ToListAsync();
// //获取工作中心
// var workCenter = await _obj121Rep.AsQueryable().Where(x => x.RecordGuid == procedureDescription[0].fld005059_Rec).ToListAsync();
// //int sun = i + 1;
// var itemData = new SapProcessRouteItemData()
// {
// VORNR = input[i].Marker,
// LTXA1 = procedureDescription[0]._System_ObjDescription,
// ARBPL = workCenter[0]._System_objNBS,
// VGW01 = input[i].fld005571.ToString(),
// VGE01 = input[i].fld005572,
// STEUS = input[i].fld005573,
// BMSCH = input[i].fld005575.ToString()
// };
// itemDataList.Add(itemData);
//}
////获取时间戳精确到毫秒sap要求每次调用生成不重复guid
//string millisecondTimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
//var Datuv = ParentData.fld005680.ToString();
//if (!string.IsNullOrEmpty(Datuv))
//{
// Datuv = ParentData.fld005680.ToDateTime().ToString("yyyy-MM-dd");
//}
//var isreq = new SapProcessRouteIS_REQ()
//{
// ReqKeyId = "",
// BusinessId = "",
// MessageId = "",
// SndPrn = "PLM",
// RcvPrn = "SAP",
// ReqUser = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName),
// Note1 = "",
// Note2 = "",
// Note3 = "",
// Zwbid = millisecondTimestamp,
// Matnr = ParentData._System_objNBS,
// Werks = ParentData._SWPDM_1187_SAP___,
// Datuv = Datuv,
// Plnal = "",
// ItemList = itemDataList
//};
//var apiOutput = await _sapService.SapProcessRouteApi(isreq);
//string codeVal = apiOutput.code == "S" ? "成功" : "失败";
//await _obj137Rep.AsUpdateable()
// .SetColumns(it => new Obj137
// {
// fld005540 = DateTime.Now,
// fld005536 = codeVal,
// fld005537 = "N",
// fld005538 = apiOutput.msg
// })
// .Where(it => it.idRecord == ParentData.idRecord)
// .ExecuteCommandAsync();
//var msg = apiOutput.msg;
//if (apiOutput.msg == "")
//{
// msg = "同步成功";
//}
//var output = new SapOutput()
//{
// parameter = apiOutput.parameter,
// code = codeVal,
// msg = msg,
// result = apiOutput.result
//};
//return output;
}
/// <summary>
@ -1345,126 +992,6 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient
var bomStockInquiryOutput = await Task.WhenAll(tasks);
return bomStockInquiryOutput.ToList();
//var sapOutputList = new List<SapOutput>();
//var sapUserName = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName);
//// 配置
//var configid = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 137 && x.ConfigSystemName == "pBOM").FirstAsync();
// //查询需要同步的产品
// var materialData = await _obj137Rep.AsQueryable()
// .Where(x =>
// x.CheckedStatus == 0
// && x.deleted == false
// && x.IsLatestVersion == true
// && x._system_objConfigurationName == "默认"
// && !x.SWPDMFileName.Contains("SLDDRW")
// && (x._SWPDM_1202_SW_____ != "不展开" || x._SWPDM_1202_SW_____ == null)
// && x.fld005530 == "N"
// && x.fld005529 == "成功"
// && (x.fld005537 == "A" || x.fld005537 == "M")
// )
// .ToListAsync();
// //分组查询最大版本的物料
// var groupedData = materialData.GroupBy(item => item.RecordGuid)
//.Select(group => group.OrderByDescending(item => item.VersionIndex).First())
//.ToList();
// foreach (var item in groupedData)
// {
// // 获取版本号
// 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();
// if (processRouteData.Count == 0)
// {
// continue;
// }
// var itemDataList = new List<SapProcessRouteItemData>();
// foreach (var processRouteItem in processRouteData)
// {
// var verification = await _dataValidationService.VerificationMaterial(processRouteItem.ChildObjID, processRouteItem.PartNumber, processRouteItem.ChildGuid);
// if (verification == "不存在")
// {
// continue;
// }
// //获取工序描述
// var procedureDescription = await _obj122Rep.AsQueryable().Where(x => x.RecordGuid == processRouteItem.ChildGuid).ToListAsync();
// //获取工作中心
// var workCenter = await _obj121Rep.AsQueryable().Where(x => x.RecordGuid == procedureDescription[0].fld005059_Rec).ToListAsync();
// var itemData = new SapProcessRouteItemData()
// {
// VORNR = processRouteItem.Marker,
// LTXA1 = procedureDescription[0]._System_ObjDescription,
// ARBPL = workCenter[0]._System_objNBS,
// VGW01 = processRouteItem.fld005571.ToString(),
// VGE01 = processRouteItem.fld005572,
// STEUS = processRouteItem.fld005573,
// BMSCH = processRouteItem.fld005575.ToString()
// };
// itemDataList.Add(itemData);
// }
// //获取时间戳精确到毫秒sap要求每次调用生成不重复guid
// string millisecondTimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
// var Datuv = item.fld005680.ToString();
// if (!string.IsNullOrEmpty(Datuv))
// {
// Datuv = item.fld005680.ToDateTime().ToString("yyyy-MM-dd");
// }
// var isreq = new SapProcessRouteIS_REQ()
// {
// ReqKeyId = "",
// BusinessId = "",
// MessageId = "",
// SndPrn = "PLM",
// RcvPrn = "SAP",
// ReqUser = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName),
// Note1 = "",
// Note2 = "",
// Note3 = "",
// Zwbid = millisecondTimestamp,
// Matnr = item._System_objNBS,
// Werks = item._SWPDM_1187_SAP___,
// Datuv = Datuv,
// Plnal = "",
// ItemList = itemDataList
// };
// var apiOutput = await _sapService.SapProcessRouteApi(isreq);
// string codeVal = apiOutput.code == "S" ? "成功" : "失败";
// await _obj137Rep.AsUpdateable()
// .SetColumns(it => new Obj137
// {
// fld005540 = DateTime.Now,
// fld005536 = codeVal,
// fld005537 = "N",
// fld005538 = apiOutput.msg
// })
// .Where(it => it.idRecord == item.idRecord)
// .ExecuteCommandAsync();
// var msg = apiOutput.msg;
// if (apiOutput.msg == "")
// {
// msg = "同步成功";
// }
// var output = new SapOutput()
// {
// parameter = apiOutput.parameter,
// code = codeVal,
// msg = msg,
// result = apiOutput.result
// };
// sapOutputList.Add(output);
// }
// return sapOutputList;
}
/// <summary>
@ -1511,6 +1038,10 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient
//获取时间戳精确到毫秒sap要求每次调用生成不重复guid
string millisecondTimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
Random random = new Random();
// 生成1000到9999之间的随机数
string randomNumber = random.Next(1000, 10000).ToString();
millisecondTimestamp = millisecondTimestamp + randomNumber;
var Datuv = data.Datuv.ToString();