|
|
@ -19,7 +19,7 @@ using Win_in.Sfs.Wms.Store.Application.Contracts; |
|
|
|
namespace Win_in.Sfs.Wms.DataExchange.MesAgent; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 传输相关的L7零件信息
|
|
|
|
/// 传输相关的L7物品信息
|
|
|
|
/// </summary>
|
|
|
|
public class JisInfoIncomingDataWorker : AsyncPeriodicBackgroundWorkerBase |
|
|
|
{ |
|
|
@ -214,7 +214,7 @@ public class JisInfoIncomingDataWorker : AsyncPeriodicBackgroundWorkerBase |
|
|
|
|
|
|
|
Logger.LogInformation($"{SendLogTitieString}Start adding exist file data in DataExchange Database.File name is {fileName}"); |
|
|
|
|
|
|
|
//开始添加在DataExchange数据库中的L7零件信息
|
|
|
|
//开始添加在DataExchange数据库中的L7物品信息
|
|
|
|
|
|
|
|
Logger.LogInformation($"{SendLogTitieString}Changing file data to MesProductL7PartsNoteCreateInput."); |
|
|
|
|
|
|
@ -224,20 +224,20 @@ public class JisInfoIncomingDataWorker : AsyncPeriodicBackgroundWorkerBase |
|
|
|
|
|
|
|
#region 开始保存Store DataBase
|
|
|
|
|
|
|
|
#region 添加没有的配置码零件信息
|
|
|
|
#region 添加没有的配置码物品信息
|
|
|
|
|
|
|
|
Logger.LogInformation($"{SendLogTitieString}Start adding exist file data in 开始保存Store Database.File name is {fileName}"); |
|
|
|
|
|
|
|
var L7PartCodes = deInputs.Select(p => p.L7Part).Distinct().ToList(); |
|
|
|
|
|
|
|
//需要查询的零件列表
|
|
|
|
//需要查询的物品列表
|
|
|
|
var partCodeList = deInputs.Select(p => p.Configuration).Distinct().ToList(); |
|
|
|
partCodeList.AddRange(L7PartCodes); |
|
|
|
|
|
|
|
//按照零件进行归总
|
|
|
|
//按照物品进行归总
|
|
|
|
var sumEntityList = deInputs.GroupBy(p => new { p.Year, p.ProductNo, p.Program, p.FATA, p.Configuration, p.Position }).ToList(); |
|
|
|
|
|
|
|
//获取所有的L7零件信息,并获取零件是不是采购件、制造件
|
|
|
|
//获取所有的L7物品信息,并获取物品是不是采购件、制造件
|
|
|
|
SfsBaseDataRequestInputBase requestInput = new SfsBaseDataRequestInputBase() { MaxResultCount = 999 }; |
|
|
|
if (L7PartCodes.Count > 0) |
|
|
|
{ |
|
|
@ -250,13 +250,13 @@ public class JisInfoIncomingDataWorker : AsyncPeriodicBackgroundWorkerBase |
|
|
|
|
|
|
|
var itemDtoListResult = await itemBasicAppService.GetPagedListByFilterAsync(requestInput, false).ConfigureAwait(false); |
|
|
|
|
|
|
|
//返回的所有需要的零件信息表
|
|
|
|
//返回的所有需要的物品信息表
|
|
|
|
var itemBaseList = itemDtoListResult.Items; |
|
|
|
|
|
|
|
Logger.LogInformation($"{SendLogTitieString}Finished geting item basic infos.Info count is{itemDtoListResult.Items.Count}."); |
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 开始构建Store的L7零件结构表
|
|
|
|
#region 开始构建Store的L7物品结构表
|
|
|
|
List<ProductL7PartsNoteEditInput> noteList = new List<ProductL7PartsNoteEditInput>(); |
|
|
|
|
|
|
|
foreach (var sumEntity in sumEntityList) |
|
|
@ -325,7 +325,7 @@ public class JisInfoIncomingDataWorker : AsyncPeriodicBackgroundWorkerBase |
|
|
|
var itemBase = itemBaseList.FirstOrDefault(p => p.Code == detail.L7Part); |
|
|
|
if (itemBase == null) |
|
|
|
{ |
|
|
|
//throw new Exception($"未找到零件{detail.L7PartCode}的零件基础信息,请确认基础信息是否齐全!");
|
|
|
|
//throw new Exception($"未找到物品{detail.L7PartCode}的物品基础信息,请确认基础信息是否齐全!");
|
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
@ -340,10 +340,10 @@ public class JisInfoIncomingDataWorker : AsyncPeriodicBackgroundWorkerBase |
|
|
|
noteList.Add(note); |
|
|
|
} |
|
|
|
|
|
|
|
#endregion 开始构建Store的L7零件结构表
|
|
|
|
#endregion 开始构建Store的L7物品结构表
|
|
|
|
|
|
|
|
Logger.LogInformation($"{SendLogTitieString}Starting productL7PartsNoteAppService.CreateAsync."); |
|
|
|
//开始添加在Store数据库中的L7零件信息
|
|
|
|
//开始添加在Store数据库中的L7物品信息
|
|
|
|
await productL7PartsNoteAppService.CreateAsync(noteList).ConfigureAwait(false); |
|
|
|
Logger.LogInformation($"{SendLogTitieString}Finished productL7PartsNoteAppService.CreateAsync."); |
|
|
|
|
|
|
@ -361,7 +361,7 @@ public class JisInfoIncomingDataWorker : AsyncPeriodicBackgroundWorkerBase |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 插入对应的零件基础信息
|
|
|
|
/// 插入对应的物品基础信息
|
|
|
|
/// </summary>
|
|
|
|
private static async Task InsertItemBasic(string program, string productNo, string configuration, string fata, string position, IItemBasicAppService itemBasicAppService) |
|
|
|
{ |
|
|
@ -465,7 +465,7 @@ public class JisInfoIncomingDataWorker : AsyncPeriodicBackgroundWorkerBase |
|
|
|
string position = strs[0]; //位置
|
|
|
|
string FATA = strs[1]; //Fata
|
|
|
|
string configuration = strs[2]; //配置码
|
|
|
|
string l7Part = strs[3]; //L7零件号
|
|
|
|
string l7Part = strs[3]; //L7ERP料号
|
|
|
|
string qty = strs[4]; //数量
|
|
|
|
|
|
|
|
MesProductL7PartsNoteCreateInput createInput = new MesProductL7PartsNoteCreateInput() |
|
|
@ -517,11 +517,11 @@ public class JisInfoIncomingDataWorker : AsyncPeriodicBackgroundWorkerBase |
|
|
|
#region Delete Store Database Data
|
|
|
|
Logger.LogInformation($"{SendLogTitieString}Start deleteing exist file data in Store Database.File name is {fileName}"); |
|
|
|
|
|
|
|
//开始删除在Store数据库中的L7零件信息
|
|
|
|
//开始删除在Store数据库中的L7物品信息
|
|
|
|
|
|
|
|
Logger.LogInformation($"{SendLogTitieString}Starting productL7PartsNoteAppService.DeleteByBaseInfoAsync."); |
|
|
|
|
|
|
|
//保存相关L7零件信息
|
|
|
|
//保存相关L7物品信息
|
|
|
|
await productL7PartsNoteAppService.DeleteByBaseInfoAsync(year, program, productNo).ConfigureAwait(false); |
|
|
|
Logger.LogInformation($"{SendLogTitieString}Finished productL7PartsNoteAppService.DeleteByBaseInfoAsync."); |
|
|
|
|
|
|
@ -533,7 +533,7 @@ public class JisInfoIncomingDataWorker : AsyncPeriodicBackgroundWorkerBase |
|
|
|
|
|
|
|
Logger.LogInformation($"{SendLogTitieString}Start deleteing exist file data in DataExchange Database.File name is {fileName}"); |
|
|
|
|
|
|
|
//开始删除在DataExchange数据库中的L7零件信息
|
|
|
|
//开始删除在DataExchange数据库中的L7物品信息
|
|
|
|
|
|
|
|
await mesProductL7PartsNoteAppService.DeleteByBaseInfoAsync(year, program, productNo).ConfigureAwait(false); |
|
|
|
|
|
|
@ -601,8 +601,8 @@ public class JisInfoIncomingDataWorker : AsyncPeriodicBackgroundWorkerBase |
|
|
|
// mesNotes.AddRange(inputList);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// #region 添加所有的L7零件信息
|
|
|
|
// //获取所有的L7零件信息,并获取零件是不是采购件、制造件
|
|
|
|
// #region 添加所有的L7物品信息
|
|
|
|
// //获取所有的L7物品信息,并获取物品是不是采购件、制造件
|
|
|
|
|
|
|
|
// var L7PartCodes = mesNotes.Select(p => p.L7Part).Distinct().ToList();
|
|
|
|
// Logger.LogInformation("{SendLogTitieString}Initial mesProductL7PartsNoteAppService...");
|
|
|
@ -647,7 +647,7 @@ public class JisInfoIncomingDataWorker : AsyncPeriodicBackgroundWorkerBase |
|
|
|
|
|
|
|
// #endregion
|
|
|
|
|
|
|
|
// //按照零件进行归总
|
|
|
|
// //按照物品进行归总
|
|
|
|
// var sumEntityList = mesNotes.GroupBy(p => new { p.ProductNo, p.Program, p.FATA, p.Configuration, p.Position }).ToList();
|
|
|
|
|
|
|
|
// List<ProductL7PartsNoteCreateInput> noteList = new List<ProductL7PartsNoteCreateInput>();
|
|
|
@ -715,7 +715,7 @@ public class JisInfoIncomingDataWorker : AsyncPeriodicBackgroundWorkerBase |
|
|
|
// var itemBase = itemBaseList.FirstOrDefault(p => p.Code == detail.L7Part);
|
|
|
|
// if (itemBase == null)
|
|
|
|
// {
|
|
|
|
// //throw new Exception($"未找到零件{detail.L7PartCode}的零件基础信息,请确认基础信息是否齐全!");
|
|
|
|
// //throw new Exception($"未找到物品{detail.L7PartCode}的物品基础信息,请确认基础信息是否齐全!");
|
|
|
|
|
|
|
|
// }
|
|
|
|
// else
|
|
|
@ -741,7 +741,7 @@ public class JisInfoIncomingDataWorker : AsyncPeriodicBackgroundWorkerBase |
|
|
|
|
|
|
|
// Logger.LogInformation($"{SendLogTitieString}productL7PartsNoteAppService.CreateAsync," + productL7PartsNoteAppService.ToString());
|
|
|
|
|
|
|
|
// //保存相关L7零件信息
|
|
|
|
// //保存相关L7物品信息
|
|
|
|
// await productL7PartsNoteAppService.CreateAsync(noteList);
|
|
|
|
// Logger.LogInformation($"{SendLogTitieString}productL7PartsNoteAppService.CreateAsync 结束");
|
|
|
|
|
|
|
|