From fb2d5cf0b5bb59c7666eb67fe42c156a5f677278 Mon Sep 17 00:00:00 2001 From: lvzb <35200379@qq.com> Date: Fri, 5 Jul 2024 15:24:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BB=A3=E7=A0=81=E6=95=B4?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Incoming/EosIncomingBackgroundWorker.cs | 6 +- .../Outgoing/EosOutgoingBackgroundWorker.cs | 6 +- .../Incoming/MesIncomingBackgroundWorker.cs | 53 ++++++--- .../Incoming/TyrpIncomingBackgroundWorker.cs | 78 +++++++++---- .../Outgoing/TyrpOutgoingBackgroundWorker.cs | 109 +++++++++--------- 5 files changed, 156 insertions(+), 96 deletions(-) diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/EosIncomingBackgroundWorker.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/EosIncomingBackgroundWorker.cs index 81c8b0aad..b3a743d81 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/EosIncomingBackgroundWorker.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/EosIncomingBackgroundWorker.cs @@ -11,7 +11,7 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent; public class EosIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase { - private readonly string Incoming = "EOS 接收"; + private readonly string Incoming = "EOS接收"; private readonly IOptions _options; @@ -28,7 +28,7 @@ public class EosIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase [UnitOfWork] protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) { - Logger.LogInformation($"开始: 处理 {Incoming}"); + Logger.LogInformation($"开始: 执行 {Incoming}"); if (!_options.Value.IncomingOptions.Active) { Logger.LogInformation($"{Incoming} 已关闭没有执行!"); @@ -62,7 +62,7 @@ public class EosIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase await productConverter.ConvertAsync(productsFromExternalList).ConfigureAwait(false); Logger.LogInformation($"处理产品【{productsFromExternalList.Count}】条数据"); - Logger.LogInformation($"提交: 处理 {Incoming}"); + Logger.LogInformation($"提交: 执行 {Incoming}"); } } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Outgoing/EosOutgoingBackgroundWorker.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Outgoing/EosOutgoingBackgroundWorker.cs index aa96e8145..677a44fa8 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Outgoing/EosOutgoingBackgroundWorker.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Outgoing/EosOutgoingBackgroundWorker.cs @@ -10,7 +10,7 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent; public class EosOutgoingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase { - private readonly string Outgoing = "EOS 发送"; + private readonly string Outgoing = "EOS发送"; private readonly IOptions _options; @@ -28,7 +28,7 @@ public class EosOutgoingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase [UnitOfWork] protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) { - Logger.LogInformation($"开始: 处理 {Outgoing}"); + Logger.LogInformation($"开始: 执行 {Outgoing}"); if (!_options.Value.IncomingOptions.Active) { Logger.LogInformation($"{Outgoing} 已关闭没有执行!"); @@ -49,7 +49,7 @@ public class EosOutgoingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase await returnWriter.WriteAsync(returnNoteList).ConfigureAwait(false); Logger.LogInformation($"处理采购退货单【{returnNoteList.Count}】条数据"); - Logger.LogInformation($"提交: 处理 {Outgoing}"); + Logger.LogInformation($"提交: 执行 {Outgoing}"); } } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesIncomingBackgroundWorker.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesIncomingBackgroundWorker.cs index 3a919536a..3824bb5e3 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesIncomingBackgroundWorker.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesIncomingBackgroundWorker.cs @@ -14,7 +14,7 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent; public class MesIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase { - private readonly string Incoming = "MES Incoming"; + private readonly string Incoming = "MES接收"; private readonly IOptions _options; @@ -31,10 +31,10 @@ public class MesIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase [UnitOfWork] protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) { - Logger.LogInformation($"Starting: Handling {Incoming}"); + Logger.LogInformation($"开始: 执行 {Incoming}"); if (!_options.Value.IncomingOptions.Active) { - Logger.LogInformation($"{Incoming} is not active!"); + Logger.LogInformation($"{Incoming} 已关闭没有执行!"); return; } @@ -45,7 +45,8 @@ public class MesIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase return; } - Logger.LogInformation($"Read MesOut");//缴库 + #region 缴库 MesOut + Logger.LogInformation($"读取缴库(MesOut)");//缴库 var mesOutReader = workerContext.ServiceProvider.GetRequiredService(); var mesOutConverter = workerContext.ServiceProvider.GetRequiredService(); var TransferNoteConverter = workerContext.ServiceProvider.GetRequiredService(); @@ -59,74 +60,92 @@ public class MesIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase { await TransferNoteConverter.ConvertAsync(mesOutsFromExternalList_TransferNote).ConfigureAwait(false); } + Logger.LogInformation($"处理完工收货(缴库)【{mesOutsFromExternalList_ProductReceipt.Count}】条数据"); + Logger.LogInformation($"处理储位调拨【{mesOutsFromExternalList_TransferNote.Count}】条数据"); + #endregion - Logger.LogInformation($"Read Scrap");//报废 + #region 报废 Scrap + Logger.LogInformation($"读取报废(Scrap)");//报废 var scrapReader = workerContext.ServiceProvider.GetRequiredService(); var scrapConverter = workerContext.ServiceProvider.GetRequiredService(); //读取并保存Scrap var scrapsFromExternalList = await scrapReader.ReadAsync().ConfigureAwait(false); //转换Scrap await scrapConverter.ConvertAsync(scrapsFromExternalList).ConfigureAwait(false); + Logger.LogInformation($"处理报废【{scrapsFromExternalList.Count}】条数据"); + #endregion - - Logger.LogInformation($"Read BackFlush");//耗用单 + #region 耗用单 BackFlush + Logger.LogInformation($"读取耗用单 (BackFlush)");//耗用单 var BackFlushReader = workerContext.ServiceProvider.GetRequiredService(); var BackFlushConverter = workerContext.ServiceProvider.GetRequiredService(); //读取并保存BackFlush var backFlushsFromExternalList = await BackFlushReader.ReadAsync().ConfigureAwait(false); //转换BackFlush await BackFlushConverter.ConvertAsync(backFlushsFromExternalList).ConfigureAwait(false); + Logger.LogInformation($"处理耗用单【{backFlushsFromExternalList.Count}】条数据"); + #endregion - - Logger.LogInformation($"Read TransferNote");//储位调拨 + #region 储位调拨 TransferNote + Logger.LogInformation($"读取储位调拨 (TransferNote)");//储位调拨 var TransferNoteReader = workerContext.ServiceProvider.GetRequiredService(); // var TransferNoteConverter = workerContext.ServiceProvider.GetRequiredService(); //读取并保存TransferNote var transferNoteFromExternalList = await TransferNoteReader.ReadAsync().ConfigureAwait(false); //转换TransferNote await TransferNoteConverter.ConvertAsync(transferNoteFromExternalList).ConfigureAwait(false); + Logger.LogInformation($"处理储位调拨【{transferNoteFromExternalList.Count}】条数据"); + #endregion - Logger.LogInformation($"Read Frozen");//冻结解冻 + #region 冻结解冻 Frozen + Logger.LogInformation($"读取冻结解冻 (Frozen)");//冻结解冻 var FrozenReader = workerContext.ServiceProvider.GetRequiredService(); var FrozenConverter = workerContext.ServiceProvider.GetRequiredService(); //读取并保存Frozen var mesNoteFromExternalList = await FrozenReader.ReadAsync().ConfigureAwait(false); //转换Frozen await FrozenConverter.ConvertAsync(mesNoteFromExternalList).ConfigureAwait(false); + Logger.LogInformation($"处理冻结解冻【{mesNoteFromExternalList.Count}】条数据"); + #endregion - - Logger.LogInformation($"Read Delivery");//成品发运 + #region 成品发运 Delivery + Logger.LogInformation($"读取成品发运 (Delivery)");//成品发运 var DeliveryReader = workerContext.ServiceProvider.GetRequiredService(); var DeliveryConverter = workerContext.ServiceProvider.GetRequiredService(); //读取并保存Delivery var deliveryNoteFromExternalList = await DeliveryReader.ReadAsync().ConfigureAwait(false); //转换Delivery await DeliveryConverter.ConvertAsync(deliveryNoteFromExternalList).ConfigureAwait(false); + Logger.LogInformation($"处理成品发运【{deliveryNoteFromExternalList.Count}】条数据"); + #endregion + #region 自动叫料 CallMtl - - Logger.LogInformation($"Read CallMtl");//自动叫料 + Logger.LogInformation($"读取自动叫料 (CallMtl)");//自动叫料 var CallMtlReader = workerContext.ServiceProvider.GetRequiredService(); var CallMtlConverter = workerContext.ServiceProvider.GetRequiredService(); //读取并保存Delivery var callMtlFromExternalList = await CallMtlReader.ReadAsync().ConfigureAwait(false); //转换Delivery await CallMtlConverter.ConvertAsync(callMtlFromExternalList).ConfigureAwait(false); + Logger.LogInformation($"处理自动叫料【{callMtlFromExternalList.Count}】条数据"); + #endregion - Logger.LogInformation($"Completed: Handling {Incoming}"); + Logger.LogInformation($"提交: 执行 {Incoming}"); #region 未启用接口启用时需要看逻辑修改 //上海和安徽无此接口 - //Logger.LogInformation($"Read PullTask");//拉动任务 + //Logger.LogInformation($"读取拉动任务 (PullTask)");//拉动任务 //var pullTaskReader = workerContext.ServiceProvider.GetRequiredService(); //var pullTaskConverter = workerContext.ServiceProvider.GetRequiredService(); ////读取并保存PullTask //var pullTaskFromExternalList = await pullTaskReader.ReadAsync().ConfigureAwait(false); ////转换PullTask //await pullTaskConverter.ConvertAsync(pullTaskFromExternalList).ConfigureAwait(false); + // Logger.LogInformation($"处理拉动任务【{pullTaskFromExternalList.Count}】条数据"); //上海和安徽无此接口 - //Logger.LogInformation($"Read Issue"); + //Logger.LogInformation($"Read (Issue)"); //var pckHandleService = workerContext.ServiceProvider.GetRequiredService(); //var pckConverter = workerContext.ServiceProvider.GetRequiredService(); ////读取并保持Pck diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/TyrpIncomingBackgroundWorker.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/TyrpIncomingBackgroundWorker.cs index d4be75195..e1cb31cb6 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/TyrpIncomingBackgroundWorker.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/TyrpIncomingBackgroundWorker.cs @@ -14,7 +14,7 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent; public class TyrpIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase { - private readonly string Incoming = "TYRP Incoming"; + private readonly string Incoming = "TYRP接收"; private readonly IOptions _options; @@ -33,10 +33,10 @@ public class TyrpIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase [UnitOfWork] protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) { - Logger.LogInformation($"Starting: Handling {Incoming}"); + Logger.LogInformation($"开始: 执行 {Incoming}"); if (!_options.Value.IncomingOptions.Active) { - Logger.LogInformation($"{Incoming} is not active!"); + Logger.LogInformation($"{Incoming} 已关闭没有执行!"); return; } @@ -59,15 +59,20 @@ public class TyrpIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase common.updatedt = DateTime.Now; common.isupdate = false; - Logger.LogInformation($"Read ItemBasic");//物品 + #region 物品 ItemBasic + + Logger.LogInformation($"读取物品 ItemBasic");//物品 var itemBasicReader = workerContext.ServiceProvider.GetRequiredService(); var itemBasicConverter = workerContext.ServiceProvider.GetRequiredService(); //读取并保存itemBasic var itemBasicOutsFromExternalList = await itemBasicReader.ReadAsync().ConfigureAwait(false); //转换itemBasic await itemBasicConverter.ConvertAsync(itemBasicOutsFromExternalList).ConfigureAwait(false); + Logger.LogInformation($"处理物品【{itemBasicOutsFromExternalList.Count}】条数据"); + #endregion - Logger.LogInformation($"Read User");//用户和部门 + #region 用户和部门 User + Logger.LogInformation($"读取用户和部门 User");//用户和部门 var userReader = workerContext.ServiceProvider.GetRequiredService(); var userConverter = workerContext.ServiceProvider.GetRequiredService(); var departmentConverter = workerContext.ServiceProvider.GetRequiredService(); @@ -79,96 +84,129 @@ public class TyrpIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase await userConverter.ConvertAsync(userOutsFromExternalList).ConfigureAwait(false); //转换department await departmentConverter.ConvertAsync(departmentOutsFromExternalList).ConfigureAwait(false); + Logger.LogInformation($"处理用户【{userOutsFromExternalList.Count}】条数据"); + Logger.LogInformation($"处理部门【{departmentOutsFromExternalList.Count}】条数据"); + #endregion - Logger.LogInformation($"Read InterfaceCalendar");//账期 + #region 账期 InterfaceCalendar + Logger.LogInformation($"读取账期 InterfaceCalendar");//账期 var interfaceCalendarReader = workerContext.ServiceProvider.GetRequiredService(); var interfaceCalendarConverter = workerContext.ServiceProvider.GetRequiredService(); //读取并保存InterfaceCalendar var interfaceCalendarOutsFromExternalList = await interfaceCalendarReader.ReadAsync().ConfigureAwait(false); //转换InterfaceCalendar await interfaceCalendarConverter.ConvertAsync(interfaceCalendarOutsFromExternalList).ConfigureAwait(false); + Logger.LogInformation($"处理账期【{interfaceCalendarOutsFromExternalList.Count}】条数据"); + #endregion - Logger.LogInformation($"Read Dict");//系统代码 + #region 系统代码 Dict + Logger.LogInformation($"读取系统代码 Dict");//系统代码 var dictReader = workerContext.ServiceProvider.GetRequiredService(); var dictConverter = workerContext.ServiceProvider.GetRequiredService(); //读取并保存Dict var dictOutsFromExternalList = await dictReader.ReadAsync().ConfigureAwait(false); //转换Dict await dictConverter.ConvertAsync(dictOutsFromExternalList).ConfigureAwait(false); + Logger.LogInformation($"处理系统代码【{dictOutsFromExternalList.Count}】条数据"); + #endregion - Logger.LogInformation($"Read Bom"); + #region Bom + Logger.LogInformation($"读取报目 Bom"); var BomReader = workerContext.ServiceProvider.GetRequiredService(); var BomConverter = workerContext.ServiceProvider.GetRequiredService(); //读取并保存Bom var bomsFromExternalList = await BomReader.ReadAsync().ConfigureAwait(false); //转换Bom await BomConverter.ConvertAsync(bomsFromExternalList).ConfigureAwait(false); + Logger.LogInformation($"处理Bom【{bomsFromExternalList.Count}】条数据"); + #endregion - Logger.LogInformation($"Read Supplier");//供应商 + #region 供应商 Supplier + Logger.LogInformation($"读取供应商 Supplier");//供应商 var SupplierReader = workerContext.ServiceProvider.GetRequiredService(); var SupplierConverter = workerContext.ServiceProvider.GetRequiredService(); //读取并保存Supplier var suppliersFromExternalList = await SupplierReader.ReadAsync().ConfigureAwait(false); //转换Supplier await SupplierConverter.ConvertAsync(suppliersFromExternalList).ConfigureAwait(false); + Logger.LogInformation($"处理供应商【{suppliersFromExternalList.Count}】条数据"); + #endregion - Logger.LogInformation($"Read Dictpj");//专案代码 + #region 专案代码 Dictpj + Logger.LogInformation($"读取专案代码 Dictpj");//专案代码 var DictpjReader = workerContext.ServiceProvider.GetRequiredService(); //读取并保存Dictpj var dictpjOutsFromExternalList = await DictpjReader.ReadAsync().ConfigureAwait(false); //转换Dictpj await dictConverter.ConvertAsync(dictpjOutsFromExternalList).ConfigureAwait(false); + Logger.LogInformation($"处理专案代码【{dictpjOutsFromExternalList.Count}】条数据"); + #endregion - - Logger.LogInformation($"Read ErpLocation");//ERP库位 + #region ERP库位 ErpLocation + Logger.LogInformation($"读取ERP库位 ErpLocation");//ERP库位 var ErpLocationReader = workerContext.ServiceProvider.GetRequiredService(); var ErpLocationConverter = workerContext.ServiceProvider.GetRequiredService(); //读取并保存ErpLocationItem var erpLocationFromExternalList = await ErpLocationReader.ReadAsync().ConfigureAwait(false); //转换ErpLocationItem await ErpLocationConverter.ConvertAsync(erpLocationFromExternalList).ConfigureAwait(false); + Logger.LogInformation($"处理ERP库位【{erpLocationFromExternalList.Count}】条数据"); + #endregion - - Logger.LogInformation($"Read Customer");//客户资料 + #region 客户资料 Customer + Logger.LogInformation($"读取客户资料 Customer");//客户资料 var CustomerReader = workerContext.ServiceProvider.GetRequiredService(); var CustomerConverter = workerContext.ServiceProvider.GetRequiredService(); //读取并保存Customer var customersFromExternalList = await CustomerReader.ReadAsync().ConfigureAwait(false); //转换Customer await CustomerConverter.ConvertAsync(customersFromExternalList).ConfigureAwait(false); + Logger.LogInformation($"处理客户资料【{customersFromExternalList.Count}】条数据"); + #endregion - Logger.LogInformation($"Read ErpLocationItem");//储位与物品对应关系(开账) + #region 储位与物品对应关系(开账) ErpLocationItem + Logger.LogInformation($"读取储位与物品对应关系(开账) ErpLocationItem");//储位与物品对应关系(开账) var ErpLocationItemReader = workerContext.ServiceProvider.GetRequiredService(); var ErpLocationItemConverter = workerContext.ServiceProvider.GetRequiredService(); //读取并保存ErpLocationItem var erpLocationItemFromExternalList = await ErpLocationItemReader.ReadAsync().ConfigureAwait(false); //转换ErpLocationItem await ErpLocationItemConverter.ConvertAsync(erpLocationItemFromExternalList).ConfigureAwait(false); + Logger.LogInformation($"处理开账【{erpLocationItemFromExternalList.Count}】条数据"); + #endregion - - Logger.LogInformation($"Read PurchasePrice");//采购价格 + #region 采购价格 PurchasePrice + Logger.LogInformation($"读取采购价格 PurchasePrice");//采购价格 var PurchasePriceReader = workerContext.ServiceProvider.GetRequiredService(); var PurchasePriceConverter = workerContext.ServiceProvider.GetRequiredService(); //读取并保存PurchasePrice var purchasePriceFromExternalList = await PurchasePriceReader.ReadAsync().ConfigureAwait(false); //转换PurchasePrice await PurchasePriceConverter.ConvertAsync(purchasePriceFromExternalList).ConfigureAwait(false); + Logger.LogInformation($"处理采购价格【{purchasePriceFromExternalList.Count}】条数据"); + #endregion - Logger.LogInformation($"Read SalePrice");//销售价格 + #region 销售价格 SalePrice + Logger.LogInformation($"读取销售价格 SalePrice");//销售价格 var SalePriceReader = workerContext.ServiceProvider.GetRequiredService(); var SalePriceConverter = workerContext.ServiceProvider.GetRequiredService(); //读取并保存SalePrice var salePriceFromExternalList = await SalePriceReader.ReadAsync().ConfigureAwait(false); //转换SalePrice await SalePriceConverter.ConvertAsync(salePriceFromExternalList).ConfigureAwait(false); + Logger.LogInformation($"处理销售价格【{salePriceFromExternalList.Count}】条数据"); + #endregion - Logger.LogInformation($"Read StdCostPrice");//标准成本价格 + #region 标准成本价格 StdCostPrice + Logger.LogInformation($"读取标准成本价格 StdCostPrice");//标准成本价格 var StdCostPriceReader = workerContext.ServiceProvider.GetRequiredService(); var StdCostPriceConverter = workerContext.ServiceProvider.GetRequiredService(); //读取并保存StdCostPrice var stdCostPriceFromExternalList = await StdCostPriceReader.ReadAsync().ConfigureAwait(false); //转换StdCostPrice await StdCostPriceConverter.ConvertAsync(stdCostPriceFromExternalList).ConfigureAwait(false); + Logger.LogInformation($"处理标准成本价格【{stdCostPriceFromExternalList.Count}】条数据"); + #endregion } else { @@ -184,7 +222,7 @@ public class TyrpIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase ////转换Customer //await BackFlushConverter.ConvertAsync(backFlushsFromExternalList).ConfigureAwait(false); - Logger.LogInformation($"Completed: Handling {Incoming}"); + Logger.LogInformation($"提交: 执行 {Incoming}"); } } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/TyrpOutgoingBackgroundWorker.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/TyrpOutgoingBackgroundWorker.cs index 0d9ebb392..bba3b1d39 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/TyrpOutgoingBackgroundWorker.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/TyrpOutgoingBackgroundWorker.cs @@ -14,7 +14,7 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent; public class TyrpOutgoingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase { - private readonly string Outgoing = "TYRP Outgoing"; + private readonly string Outgoing = "TYRP发送"; private readonly IOptions _options; @@ -32,11 +32,11 @@ public class TyrpOutgoingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase [UnitOfWork(true, isolationLevel: IsolationLevel.ReadUncommitted, 50)] protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) { - Logger.LogInformation($"Starting: Handling {Outgoing}"); + Logger.LogInformation($"开始: 执行 {Outgoing}"); if (!_options.Value.OutgoingOptions.Active) { - Logger.LogInformation($"{Outgoing} is not active!"); + Logger.LogInformation($"{Outgoing} 已关闭没有执行!"); return; } var scontrolWriter = workerContext.ServiceProvider.GetRequiredService();//scontrol中间表服务 @@ -47,93 +47,93 @@ public class TyrpOutgoingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase int mesout_asd_count = 0; //mesout_asd插入条数 #region 采购单 PurchaseOrder scontrol - Logger.LogInformation($"Write PurchaseOrder");//采购单 + Logger.LogInformation($"传出采购单 PurchaseOrder");//采购单 var purchaseOrderConvert = workerContext.ServiceProvider.GetRequiredService(); var purchaseOrderList = await purchaseOrderConvert.ConvertAsync().ConfigureAwait(false); await scontrolWriter.WriteAsync(purchaseOrderList).ConfigureAwait(false); + Logger.LogInformation($"采购单-PurchaseOrder处理{purchaseOrderList.Count}条"); if (purchaseOrderList.Count > 0) - { - Logger.LogInformation($"采购单-PurchaseOrder处理{purchaseOrderList.Count}条"); + { scontrol_count += purchaseOrderList.Count; } #endregion #region 采购退货单 PurchaseReturn scontrol - Logger.LogInformation($"Write PurchaseReturn");//采购退货单(汇总) + Logger.LogInformation($"传出采购退货单 PurchaseReturn");//采购退货单(汇总) var purchaseReturnConvert = workerContext.ServiceProvider.GetRequiredService(); var purchaseReturnList = await purchaseReturnConvert.ConvertAsync().ConfigureAwait(false); await scontrolWriter.WriteAsync(purchaseReturnList).ConfigureAwait(false); + Logger.LogInformation($"采购退货单-PurchaseReturn处理{purchaseReturnList.Count}条"); if (purchaseReturnList.Count > 0) - { - Logger.LogInformation($"采购退货单-PurchaseReturn处理{purchaseReturnList.Count}条"); + { scontrol_count += purchaseReturnList.Count; } #endregion #region 验收单 Putaway scontrol - Logger.LogInformation($"Write PutawayNote");//验收单(汇总) + Logger.LogInformation($"传出验收单 PutawayNote");//验收单(汇总) var putawayNoteConvert = workerContext.ServiceProvider.GetRequiredService(); var putawayNoteList = await putawayNoteConvert.ConvertAsync().ConfigureAwait(false); await scontrolWriter.WriteAsync(putawayNoteList).ConfigureAwait(false); + Logger.LogInformation($"验收单-Putaway处理{putawayNoteList.Count}条"); if (putawayNoteList.Count > 0) - { - Logger.LogInformation($"验收单-Putaway处理{putawayNoteList.Count}条"); + { scontrol_count += putawayNoteList.Count; } #endregion #region 线边仓领料单 Issue scontrol - Logger.LogInformation($"Write IssueNote");//线边仓领料单(汇总) + Logger.LogInformation($"传出线边仓领料单 IssueNote");//线边仓领料单(汇总) var issueNoteConvert = workerContext.ServiceProvider.GetRequiredService(); var issueNoteList = await issueNoteConvert.ConvertAsync().ConfigureAwait(false); await scontrolWriter.WriteAsync(issueNoteList).ConfigureAwait(false); + Logger.LogInformation($"线边仓领料单-Issue处理{issueNoteList.Count}条"); if (issueNoteList.Count > 0) { - Logger.LogInformation($"线边仓领料单-Issue处理{issueNoteList.Count}条"); scontrol_count += issueNoteList.Count; } #endregion #region 线边仓退料单 ProductionReturn scontrol - Logger.LogInformation($"Write ProductionReturnNote");//线边仓退料单(汇总) + Logger.LogInformation($"传出线边仓退料单 ProductionReturnNote");//线边仓退料单(汇总) var productionReturnNoteConvert = workerContext.ServiceProvider.GetRequiredService(); var productionReturnNoteList = await productionReturnNoteConvert.ConvertAsync().ConfigureAwait(false); await scontrolWriter.WriteAsync(productionReturnNoteList).ConfigureAwait(false); + Logger.LogInformation($"线边仓退料单-ProductionReturn处理{productionReturnNoteList.Count}条"); if (productionReturnNoteList.Count > 0) { - Logger.LogInformation($"线边仓退料单-ProductionReturn处理{productionReturnNoteList.Count}条"); scontrol_count += productionReturnNoteList.Count; } #endregion #region 半成品上架 SemiPutaway scontrol - Logger.LogInformation($"Write SemiPutawayNote");//半成品上架 + Logger.LogInformation($"传出半成品上架 SemiPutawayNote");//半成品上架 var semiPutawayNoteConvert = workerContext.ServiceProvider.GetRequiredService(); var semiPutawayNoteList = await semiPutawayNoteConvert.ConvertAsync().ConfigureAwait(false); await scontrolWriter.WriteAsync(semiPutawayNoteList).ConfigureAwait(false); + Logger.LogInformation($"半成品上架-SemiPutaway处理{semiPutawayNoteList.Count}条"); if (semiPutawayNoteList.Count > 0) - { - Logger.LogInformation($"半成品上架-SemiPutaway处理{semiPutawayNoteList.Count}条"); + { scontrol_count += semiPutawayNoteList.Count; } #endregion #region 储位、线边仓调拨单 和 客户储位调拨单 Transfer scontrol - Logger.LogInformation($"Write TransferNote");//储位、线边仓调拨单 和 客户储位调拨单(汇总) + Logger.LogInformation($"传出储位、线边仓调拨单 和 客户储位调拨单 TransferNote");//储位、线边仓调拨单 和 客户储位调拨单(汇总) var transferNoteConvert = workerContext.ServiceProvider.GetRequiredService(); var transferNoteList = await transferNoteConvert.ConvertAsync().ConfigureAwait(false); var transferNoteForErpList = transferNoteList.Where(r => r.DataType == EnumOutgoingDataType.TransferForErp.ToString()).ToList();//储位、线边仓调拨单 var transferNoteForCustomList = transferNoteList.Where(r => r.DataType == EnumOutgoingDataType.TransferForCustom.ToString()).ToList();//客户储位调拨单 await scontrolWriter.WriteAsync(transferNoteForErpList).ConfigureAwait(false); await wmsoutmWriter.WriteAsync(transferNoteForCustomList).ConfigureAwait(false); + Logger.LogInformation($"储位、线边仓调拨单-Transfer处理{transferNoteForErpList.Count}条"); + Logger.LogInformation($"客户储位调拨单-Transfer处理{transferNoteForCustomList.Count}条"); if (transferNoteForErpList.Count > 0) - { - Logger.LogInformation($"储位、线边仓调拨单-Transfer处理{transferNoteForErpList.Count}条"); + { scontrol_count += transferNoteForErpList.Count; } if (transferNoteForCustomList.Count > 0) - { - Logger.LogInformation($"客户储位调拨单-Transfer处理{transferNoteForCustomList.Count}条"); + { wmsoutm_count += transferNoteForCustomList.Count; } #endregion @@ -145,68 +145,73 @@ public class TyrpOutgoingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase } #region 出货单 Deliver wmsoutm - Logger.LogInformation($"Write DeliverNote");//出货单(汇总) + Logger.LogInformation($"传出出货单 DeliverNote");//出货单(汇总) var deliverNoteConvert = workerContext.ServiceProvider.GetRequiredService(); var deliverNoteList = await deliverNoteConvert.ConvertAsync().ConfigureAwait(false); await wmsoutmWriter.WriteAsync(deliverNoteList).ConfigureAwait(false); + Logger.LogInformation($"出货单-Deliver处理{deliverNoteList.Count}条"); if (deliverNoteList.Count > 0) - { - Logger.LogInformation($"出货单-Deliver处理{deliverNoteList.Count}条"); + { wmsoutm_count += deliverNoteList.Count; } #endregion #region 客户退货单 CustomerReturn wmsoutm - Logger.LogInformation($"Write CustomerReturnNote");//退货单 + Logger.LogInformation($"传出退货单 CustomerReturnNote");//退货单 var customerReturnNoteConvert = workerContext.ServiceProvider.GetRequiredService(); var customerReturnNoteList = await customerReturnNoteConvert.ConvertAsync().ConfigureAwait(false); await wmsoutmWriter.WriteAsync(customerReturnNoteList).ConfigureAwait(false); + Logger.LogInformation($"退货单-CustomerReturn处理{customerReturnNoteList.Count}条"); + if (customerReturnNoteList.Count > 0) + { + wmsoutm_count += customerReturnNoteList.Count; + } #endregion #region 非生产领料单 UnplannedIssue wmsoutm - Logger.LogInformation($"Write UnplannedIssueNote");//非生产领料单(汇总) + Logger.LogInformation($"传出非生产领料单 UnplannedIssueNote");//非生产领料单(汇总) var unplannedIssueNoteConvert = workerContext.ServiceProvider.GetRequiredService(); var unplannedIssueNoteNoteList = await unplannedIssueNoteConvert.ConvertAsync().ConfigureAwait(false); await wmsoutmWriter.WriteAsync(unplannedIssueNoteNoteList).ConfigureAwait(false); + Logger.LogInformation($"非生产领料单-UnplannedIssue处理{unplannedIssueNoteNoteList.Count}条"); if (unplannedIssueNoteNoteList.Count > 0) { - Logger.LogInformation($"非生产领料单-UnplannedIssue处理{unplannedIssueNoteNoteList.Count}条"); wmsoutm_count += unplannedIssueNoteNoteList.Count; } #endregion #region 非生产退料 UnplannedReceipt wmsoutm - Logger.LogInformation($"Write UnplannedReceiptNote");//非生产退料(汇总) + Logger.LogInformation($"传出非生产退料 UnplannedReceiptNote");//非生产退料(汇总) var unplannedReceiptNoteConvert = workerContext.ServiceProvider.GetRequiredService(); var unplannedReceiptNoteList = await unplannedReceiptNoteConvert.ConvertAsync().ConfigureAwait(false); await wmsoutmWriter.WriteAsync(unplannedReceiptNoteList).ConfigureAwait(false); + Logger.LogInformation($"非生产退料-UnplannedReceipt处理{unplannedReceiptNoteList.Count}条"); if (unplannedReceiptNoteList.Count > 0) - { - Logger.LogInformation($"非生产退料-UnplannedReceipt处理{unplannedReceiptNoteList.Count}条"); + { wmsoutm_count += unplannedReceiptNoteList.Count; } #endregion #region 回收料入库单 RecycledMaterialReceipt wmsoutm - Logger.LogInformation($"Write RecycledMaterialReceiptNote");//回收料入库单 + Logger.LogInformation($"传出回收料入库单 RecycledMaterialReceiptNote");//回收料入库单 var recycledMaterialReceiptNoteConvert = workerContext.ServiceProvider.GetRequiredService(); var recycledMaterialReceiptNoteList = await recycledMaterialReceiptNoteConvert.ConvertAsync().ConfigureAwait(false); await wmsoutmWriter.WriteAsync(recycledMaterialReceiptNoteList).ConfigureAwait(false); + Logger.LogInformation($"回收料入库单-RecycledMaterialReceipt处理{recycledMaterialReceiptNoteList.Count}条"); if (recycledMaterialReceiptNoteList.Count > 0) - { - Logger.LogInformation($"回收料入库单-RecycledMaterialReceipt处理{recycledMaterialReceiptNoteList.Count}条"); + { wmsoutm_count += recycledMaterialReceiptNoteList.Count; } #endregion #region 退拆单 ProductRecycle wmsoutm - Logger.LogInformation($"Write BackFlushNote");//退拆单 + Logger.LogInformation($"传出退拆单 BackFlushNote");//退拆单 var productRecycleNoteConvert = workerContext.ServiceProvider.GetRequiredService(); var productRecycleNoteList = await productRecycleNoteConvert.ConvertAsync().ConfigureAwait(false); await wmsoutmWriter.WriteAsync(productRecycleNoteList).ConfigureAwait(false); + Logger.LogInformation($"退拆单-ProductRecycle处理{productRecycleNoteList.Count}条"); if (productRecycleNoteList.Count > 0) - { - Logger.LogInformation($"退拆单-ProductRecycle处理{productRecycleNoteList.Count}条"); + { wmsoutm_count += productRecycleNoteList.Count; } #endregion @@ -219,44 +224,44 @@ public class TyrpOutgoingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase #region --接口以关闭-- 盘点调整单 CountAdjust mesout_asd //东阳上海和安徽暂时关闭此接口 - //Logger.LogInformation($"Write CountAdjusNote");//盘点调整单 + //Logger.LogInformation($"传出 CountAdjusNote");//盘点调整单 //var countadjustNoteConvert = workerContext.ServiceProvider.GetRequiredService(); //var countadjustNoteList = await countadjustNoteConvert.ConvertAsync().ConfigureAwait(false); //await countadjustWriter.WriteAsync(countadjustNoteList).ConfigureAwait(false); #endregion #region 线边仓调整单 WIPAdjust mesout_asd - Logger.LogInformation($"Write WIPAdjusNote");//线边仓调整单(汇总) + Logger.LogInformation($"传出线边仓调整单 WIPAdjusNote");//线边仓调整单(汇总) var wipAdjustNoteConvert = workerContext.ServiceProvider.GetRequiredService(); var wipAdjustNoteList = await wipAdjustNoteConvert.ConvertAsync().ConfigureAwait(false); await countadjustWriter.WriteAsync(wipAdjustNoteList).ConfigureAwait(false); + Logger.LogInformation($"线边仓调整单-WIPAdjust处理{wipAdjustNoteList.Count}条"); if (wipAdjustNoteList.Count > 0) { - Logger.LogInformation($"线边仓调整单-WIPAdjust处理{wipAdjustNoteList.Count}条"); mesout_asd_count += wipAdjustNoteList.Count; } #endregion #region 回收料调整单 Item_Transform mesout_asd - Logger.LogInformation($"Write ItemTransformNote");//回收料调整单(汇总) + Logger.LogInformation($"传出回收料调整单 ItemTransformNote");//回收料调整单(汇总) var ItemTransformNoteConvert = workerContext.ServiceProvider.GetRequiredService(); var ItemTransformNoteList = await ItemTransformNoteConvert.ConvertAsync().ConfigureAwait(false); await countadjustWriter.WriteAsync(ItemTransformNoteList).ConfigureAwait(false); + Logger.LogInformation($"回收料调整单-Item_Transform处理{ItemTransformNoteList.Count}条"); if (ItemTransformNoteList.Count > 0) - { - Logger.LogInformation($"回收料调整单-Item_Transform处理{ItemTransformNoteList.Count}条"); + { mesout_asd_count += ItemTransformNoteList.Count; } #endregion #region 报废单、线边仓报废单 Scrap mesout_asd - Logger.LogInformation($"Write ScrapNote");//报废单、线边仓报废单 + Logger.LogInformation($"传出报废单、线边仓报废单 ScrapNote");//报废单、线边仓报废单 var scrapNoteConvert = workerContext.ServiceProvider.GetRequiredService(); var scrapNoteList = await scrapNoteConvert.ConvertAsync().ConfigureAwait(false); await countadjustWriter.WriteAsync(scrapNoteList).ConfigureAwait(false); + Logger.LogInformation($"报废单、线边仓报废单-Scrap处理{scrapNoteList.Count}条"); if (scrapNoteList.Count > 0) { - Logger.LogInformation($"报废单、线边仓报废单-Scrap处理{scrapNoteList.Count}条"); mesout_asd_count += scrapNoteList.Count; } #endregion @@ -268,18 +273,16 @@ public class TyrpOutgoingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase } #region 缴库单 ProductReceipt mesout - Logger.LogInformation($"Write ProductReceiptNote");//缴库单 + Logger.LogInformation($"传出缴库单 ProductReceiptNote");//缴库单 var productReceiptNoteConvert = workerContext.ServiceProvider.GetRequiredService(); var productReceiptNoteList = await productReceiptNoteConvert.ConvertAsync().ConfigureAwait(false); var productReceiptNoteWriter = workerContext.ServiceProvider.GetRequiredService();//mesout中间表的服务 await productReceiptNoteWriter.WriteAsync(productReceiptNoteList).ConfigureAwait(false); - if (productReceiptNoteList.Count > 0) - { - Logger.LogInformation($"缴库单-ProductReceipt处理{productReceiptNoteList.Count}条"); - } + Logger.LogInformation($"缴库单-ProductReceipt处理{productReceiptNoteList.Count}条"); + #endregion - Logger.LogInformation($"Completed: Handling {Outgoing}"); + Logger.LogInformation($"提交: 执行 {Outgoing}"); } }