From d81abded426cad12ad0335b38e8e575bcb012d9e Mon Sep 17 00:00:00 2001 From: lvzb <35200379@qq.com> Date: Tue, 13 Aug 2024 14:16:17 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Outgoing/DeliverNoteConverter.cs | 8 +++- .../Outgoing/IssueNoteConverter.cs | 8 ---- .../Outgoing/PurchaseOrderConverter.cs | 10 ----- .../Outgoing/PutawayNoteConverter.cs | 9 ---- .../Outgoing/TransferNoteConverter.cs | 2 +- .../Outgoing/TyrpOutgoingBackgroundWorker.cs | 44 ++++++++----------- 6 files changed, 25 insertions(+), 56 deletions(-) diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/DeliverNoteConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/DeliverNoteConverter.cs index a8d5409e5..7c71a5729 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/DeliverNoteConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/DeliverNoteConverter.cs @@ -54,7 +54,7 @@ public class DeliverNoteConverter : IOutgoingConverter var WipDetails = wmsReceipt.Details.GroupBy(r => new { r.Number, r.ItemCode, r.FromLocationErpCode }).Select(p => new DeliverNoteDetailExchangeDto { Qty = p.Sum(itm => itm.Qty), Number = p.Key.Number, ItemCode = p.Key.ItemCode, FromLocationErpCode = p.Key.FromLocationErpCode }); foreach (var detail in WipDetails) { - var item= _salePriceSheetAppService.GetByItemCodeAndCustomerCode(detail.ItemCode, wmsReceipt.CustomerCode); + var item= await _salePriceSheetAppService.GetByItemCodeAndCustomerCode(detail.ItemCode, wmsReceipt.CustomerCode); if (item==null) { flag = false; @@ -105,7 +105,11 @@ public class DeliverNoteConverter : IOutgoingConverter outgoingToExternal.DestinationDataContent = JsonSerializer.Serialize(purchaseOrder); outgoingToExternalList.Add(outgoingToExternal); outgoingFromWmsToTyrp.Add(outgoingFromWms);//加入到待传列表 - } + } + else + { + outgoingToExternalList.RemoveAll(r => r.SourceDataGroupCode == wmsReceipt.Number); + } #endregion } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/IssueNoteConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/IssueNoteConverter.cs index 76cdbecb8..8817630e3 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/IssueNoteConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/IssueNoteConverter.cs @@ -111,10 +111,6 @@ public class IssueNoteConverter : IOutgoingConverter scontrol_type = billtype, scontrol_id = 0,//明细中最大scmsend_id }; - if (ret.scontrol_nbr.Length > 10) - { - ret.scontrol_nbr = "SN23" + ret.scontrol_nbr.Substring(5, 6); - } return ret; } /// @@ -141,10 +137,6 @@ public class IssueNoteConverter : IOutgoingConverter scmsend_wipd_loc = exchangeDetailOrder.ToLocationErpCode, scmsend_userid = "WMS" }; - if (ret.scmsend_nbr.Length > 10) - { - ret.scmsend_nbr = "SN23" + ret.scmsend_nbr.Substring(5, 6); - } return ret; } } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/PurchaseOrderConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/PurchaseOrderConverter.cs index df28af930..891858f68 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/PurchaseOrderConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/PurchaseOrderConverter.cs @@ -118,12 +118,6 @@ public class PurchaseOrderConverter : IOutgoingConverter scontrol_type = billtype, scontrol_id = 0,//明细中最大scmsend_id }; - - - if (ret.scontrol_nbr.Length > 10) - { - ret.scontrol_nbr = "PO23" + ret.scontrol_nbr.Substring(5, 6); - } return ret; } /// @@ -150,10 +144,6 @@ public class PurchaseOrderConverter : IOutgoingConverter scmsend_wipd_loc = "", scmsend_userid = "WMS" }; - if (ret.scmsend_nbr.Length > 10) - { - ret.scmsend_nbr = "PO23" + ret.scmsend_nbr.Substring(5, 6); - } return ret; } } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/PutawayNoteConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/PutawayNoteConverter.cs index 6cc4573c7..250884fd7 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/PutawayNoteConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/PutawayNoteConverter.cs @@ -129,10 +129,6 @@ public class PutawayNoteConverter : IOutgoingConverter scontrol_type = billtype, scontrol_id = 0,//明细中最大scmsend_id }; - if (ret.scontrol_nbr == "YS24000076") - { - ret.scontrol_nbr = "YS23000002"; - } return ret; } /// @@ -159,11 +155,6 @@ public class PutawayNoteConverter : IOutgoingConverter scmsend_wipd_loc = "", scmsend_userid = "WMS" }; - if (ret.scmsend_nbr == "YS24000076") - { - ret.scmsend_nbr = "YS23000002"; - ret.scmsend_orderno = "PO23000011"; - } return ret; } } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/TransferNoteConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/TransferNoteConverter.cs index a2e751d05..aee24654d 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/TransferNoteConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/TransferNoteConverter.cs @@ -114,7 +114,7 @@ public class TransferNoteConverter : IOutgoingConverter var putawayNoteWmsoutm = BuildWmsoutmDataInterface(departmentCode, dt_w, tyrpNumber, location, stat); outgoingToExternal.DestinationDataContent = JsonSerializer.Serialize(putawayNoteWmsoutm); - WipDetails = details.GroupBy(r => new { r.Number, r.ItemCode, r.FromLocationErpCode }).Select(p => new TransferNoteDetailExchangeDto { Qty = p.Sum(itm => itm.Qty), Number = p.Key.Number, ItemCode = p.Key.ItemCode, FromLocationErpCode = p.Key.FromLocationErpCode }).ToList(); + WipDetails = details.GroupBy(r => new { r.Number, r.ItemCode, r.FromLocationErpCode, r.ToLocationErpCode }).Select(p => new TransferNoteDetailExchangeDto { Qty = p.Sum(itm => itm.Qty), Number = p.Key.Number, ItemCode = p.Key.ItemCode, FromLocationErpCode = p.Key.FromLocationErpCode, ToLocationErpCode = p.Key.ToLocationErpCode }).ToList(); } } 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 f5c6929a5..3b8c155a2 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 @@ -64,6 +64,22 @@ public class TyrpOutgoingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase int wmsoutm_count = 0; //wmsoutm插入条数 int mesout_asd_count = 0; //mesout_asd插入条数 + #region 缴库单 ProductReceipt mesout + 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); + Logger.LogInformation($"缴库单-ProductReceipt处理{productReceiptNoteList.Count}条"); + + #endregion + if (productReceiptNoteList.Count > 0)//如果mesout中有插入数据下边接口不执行 + { + Logger.LogInformation($"mesout处理{productReceiptNoteList.Count}条"); + return; + } + + #region 采购单 PurchaseOrder scontrol Logger.LogInformation($"传出采购单 PurchaseOrder");//采购单 var purchaseOrderConvert = workerContext.ServiceProvider.GetRequiredService(); @@ -254,10 +270,6 @@ public class TyrpOutgoingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase var wipAdjustNoteList = await wipAdjustNoteConvert.ConvertAsync().ConfigureAwait(false); await countadjustWriter.WriteAsync(wipAdjustNoteList).ConfigureAwait(false); Logger.LogInformation($"线边仓调整单-WIPAdjust处理{wipAdjustNoteList.Count}条"); - if (wipAdjustNoteList.Count > 0) - { - mesout_asd_count += wipAdjustNoteList.Count; - } #endregion #region 回收料调整单 Item_Transform mesout_asd @@ -266,10 +278,6 @@ public class TyrpOutgoingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase var ItemTransformNoteList = await ItemTransformNoteConvert.ConvertAsync().ConfigureAwait(false); await countadjustWriter.WriteAsync(ItemTransformNoteList).ConfigureAwait(false); Logger.LogInformation($"回收料调整单-Item_Transform处理{ItemTransformNoteList.Count}条"); - if (ItemTransformNoteList.Count > 0) - { - mesout_asd_count += ItemTransformNoteList.Count; - } #endregion #region 报废单、线边仓报废单 Scrap mesout_asd @@ -278,27 +286,11 @@ public class TyrpOutgoingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase var scrapNoteList = await scrapNoteConvert.ConvertAsync().ConfigureAwait(false); await countadjustWriter.WriteAsync(scrapNoteList).ConfigureAwait(false); Logger.LogInformation($"报废单、线边仓报废单-Scrap处理{scrapNoteList.Count}条"); - if (scrapNoteList.Count > 0) - { - mesout_asd_count += scrapNoteList.Count; - } #endregion - if (mesout_asd_count > 0)//如果mesout_asd中有插入数据下边接口不执行 - { - Logger.LogInformation($"mesout_asd处理{mesout_asd_count}条"); - return; - } - - #region 缴库单 ProductReceipt mesout - 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); - Logger.LogInformation($"缴库单-ProductReceipt处理{productReceiptNoteList.Count}条"); + - #endregion + Logger.LogInformation($"提交: 执行 {Outgoing}"); } From 030f20370d252d00b5aa94b4d412ebc3bf118951 Mon Sep 17 00:00:00 2001 From: lvzb <35200379@qq.com> Date: Wed, 14 Aug 2024 17:07:02 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Outgoing/TyrpOutgoingBackgroundWorker.cs | 47 ++++++++++++------- 1 file changed, 29 insertions(+), 18 deletions(-) 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 3b8c155a2..376a0e72a 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 @@ -64,22 +64,7 @@ public class TyrpOutgoingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase int wmsoutm_count = 0; //wmsoutm插入条数 int mesout_asd_count = 0; //mesout_asd插入条数 - #region 缴库单 ProductReceipt mesout - 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); - Logger.LogInformation($"缴库单-ProductReceipt处理{productReceiptNoteList.Count}条"); - - #endregion - if (productReceiptNoteList.Count > 0)//如果mesout中有插入数据下边接口不执行 - { - Logger.LogInformation($"mesout处理{productReceiptNoteList.Count}条"); - return; - } - - + #region 采购单 PurchaseOrder scontrol Logger.LogInformation($"传出采购单 PurchaseOrder");//采购单 var purchaseOrderConvert = workerContext.ServiceProvider.GetRequiredService(); @@ -270,6 +255,10 @@ public class TyrpOutgoingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase var wipAdjustNoteList = await wipAdjustNoteConvert.ConvertAsync().ConfigureAwait(false); await countadjustWriter.WriteAsync(wipAdjustNoteList).ConfigureAwait(false); Logger.LogInformation($"线边仓调整单-WIPAdjust处理{wipAdjustNoteList.Count}条"); + if (wipAdjustNoteList.Count > 0) + { + mesout_asd_count += wipAdjustNoteList.Count; + } #endregion #region 回收料调整单 Item_Transform mesout_asd @@ -278,6 +267,10 @@ public class TyrpOutgoingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase var ItemTransformNoteList = await ItemTransformNoteConvert.ConvertAsync().ConfigureAwait(false); await countadjustWriter.WriteAsync(ItemTransformNoteList).ConfigureAwait(false); Logger.LogInformation($"回收料调整单-Item_Transform处理{ItemTransformNoteList.Count}条"); + if (ItemTransformNoteList.Count > 0) + { + mesout_asd_count += ItemTransformNoteList.Count; + } #endregion #region 报废单、线边仓报废单 Scrap mesout_asd @@ -286,11 +279,29 @@ public class TyrpOutgoingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase var scrapNoteList = await scrapNoteConvert.ConvertAsync().ConfigureAwait(false); await countadjustWriter.WriteAsync(scrapNoteList).ConfigureAwait(false); Logger.LogInformation($"报废单、线边仓报废单-Scrap处理{scrapNoteList.Count}条"); + if (scrapNoteList.Count > 0) + { + mesout_asd_count += scrapNoteList.Count; + } + #endregion + + if (mesout_asd_count > 0)//如果mesout_asd中有插入数据下边接口不执行 + { + Logger.LogInformation($"mesout_asd处理{mesout_asd_count}条"); + return; + } + + #region 缴库单 ProductReceipt mesout + 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); + Logger.LogInformation($"缴库单-ProductReceipt处理{productReceiptNoteList.Count}条"); + #endregion - - Logger.LogInformation($"提交: 执行 {Outgoing}"); }