From 7dd053ba98f131cd5cbee1faa87871fe9b143141 Mon Sep 17 00:00:00 2001 From: mahao Date: Mon, 11 Sep 2023 11:43:43 +0800 Subject: [PATCH 1/2] up --- .../Reports/SaSeEdiCompareDetailReport.cs | 176 ++++++++ .../SaSeEdiCompareDetailReportJisBBAC.cs | 8 + .../SaSeEdiCompareDetailReportJisHBPO.cs | 8 + .../Reports/SaSeEdiCompareDiff.cs | 410 ------------------ .../Reports/SaSeEdiCompareSumReport.cs | 53 +++ .../Reports/SeEidCompareReportJisBBAC.cs | 2 +- .../JisBBACSaSeEdiCompareExportService.cs | 4 +- .../JisHBPOSaSeEdiCompareExportService.cs | 4 +- .../Report/SaSeEdiCompareExportBaseService.cs | 12 +- .../SettleAccountJobAutoMapperProfile.cs | 4 +- 10 files changed, 258 insertions(+), 423 deletions(-) create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReport.cs create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReportJisBBAC.cs create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReportJisHBPO.cs create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareSumReport.cs diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReport.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReport.cs new file mode 100644 index 00000000..a903c64d --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReport.cs @@ -0,0 +1,176 @@ +using System; +using System.ComponentModel.DataAnnotations; +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; +using Win.Sfs.SettleAccount.Enums; + +namespace Win.Sfs.SettleAccount.Reports; + +/// +/// 结算、发运、Eid对比明细报告 +/// +[ExcelExporter(MaxRowNumberOnASheet = 500_000)] +public class SaSeEdiCompareDetailReport +{ + /// + /// 类别 + /// + [Display(Name = "类别")] + [ExporterHeader(DisplayName = "类别")] + [ValueMapping("有结算有发运(有EDI数据)", 1)] + [ValueMapping("有结算有发运(无EDI数据)", 2)] + [ValueMapping("有结算无发运(有EDI数据)", 3)] + [ValueMapping("有结算无发运(无EDI数据)", 4)] + [ValueMapping("无结算有发运(有EDI数据)", 5)] + [ValueMapping("无结算有发运(无EDI数据)", 6)] + public EnumSaSeEdiCompareCategory Category { get; set; } + [Display(Name = "WMS多发")] + [ExporterHeader(DisplayName = "WMS多发")] + [ValueMapping("", 0)] + [ValueMapping("WMS多发", 1)] + public EnumWMSSend WMSSend + { + get + { + return (Category, SaSeQty < 0) switch + { + (EnumSaSeEdiCompareCategory.HaveSaHaveSeHaveEdi, true) => EnumWMSSend.WMSRepeat, + (EnumSaSeEdiCompareCategory.HaveSaHaveSeNotHaveEdi, true) => EnumWMSSend.WMSRepeat, + _ => EnumWMSSend.None + }; + } + } + [Display(Name = "价格信息")] + [ExporterHeader(DisplayName = "价格信息", IsIgnore = true)] + [ValueMapping("有价格信息", true)] + [ValueMapping("无价格信息", false)] + public bool IsHavePrice => FixPrice != null && FixPrice != 0; + /// + /// 交货单号 + /// + [Display(Name = "交货单号")] + [ExporterHeader(DisplayName = "交货单号")] + public string WmsBillNum { get; set; } + /// + /// 发货日期 + /// + [Display(Name = "发货日期")] + [ExporterHeader(DisplayName = "发货日期")] + public DateTime? ShippingDate { get; set; } + /// + /// 生产码 + /// + [Display(Name = "生产码")] + [ExporterHeader(DisplayName = "订单生产码")] + public string PN { get; set; } + /// + /// 日顺序号 + /// + [Display(Name = "日顺序号")] + [ExporterHeader(DisplayName = "日顺序号")] + public string SeqNumber { get; set; } + /// + /// PJIS日顺序号 + /// + [Display(Name = "PJIS日顺序号")] + [ExporterHeader(DisplayName = "PJIS日顺序号")] + public string PJISSeqNumber { get; set; } + /// + /// 客户物料号 + /// + [Display(Name = "客户物料号")] + [ExporterHeader(DisplayName = "客户物料号")] + public string CustomerPartCode { get; set; } + /// + /// 物料描述 + /// + [Display(Name = "物料描述")] + [ExporterHeader(DisplayName = "物料描述")] + public string PartCodeDesc { get; set; } + /// + /// 厂内物料号 + /// + [Display(Name = "厂内物料号")] + [ExporterHeader(DisplayName = "厂内物料号")] + public string FactoryPartCode { get; set; } + /// + /// 替换厂内物料号 + /// + [Display(Name = "替换厂内物料号")] + [ExporterHeader(DisplayName = "替换厂内物料号")] + public string ReplaceFactoryPartCode { get; set; } + /// + /// 客户下线时间 + /// + [Display(Name = "客户下线时间")] + [ExporterHeader(DisplayName = "客户下线时间")] + public DateTime? CustomerOfflineTime { get; set; } + /// + /// 小总成号 + /// + [Display(Name = "小总成号")] + [ExporterHeader(DisplayName = "小总成号")] + public string AssemblyCode { get; set; } + /// + /// 注塑码 + /// + [Display(Name = "注塑码")] + [ExporterHeader(DisplayName = "注塑码")] + public string InjectionCode { get; set; } + /// + /// 结算数量 + /// + [Display(Name = "结算数量")] + [ExporterHeader(DisplayName = "结算数量")] + public decimal SAQty { get; set; } + /// + /// 发货数量 + /// + [Display(Name = "发货数量")] + [ExporterHeader(DisplayName = "WMS发货数量")] + public decimal SEQty { get; set; } + /// + /// Edi数量 + /// + [Display(Name = "Edi数量")] + [ExporterHeader(DisplayName = "Edi数量")] + public decimal EdiQty { get; set; } + /// + /// 结算与WMS发货量差 + /// + [ExporterHeader(DisplayName = "结算与WMS发货量差")] + public decimal SaSeQty => SAQty - SEQty; + /// + /// 结算与EDI量差 + /// + [ExporterHeader(DisplayName = "结算与EDI量差")] + public decimal SaEdiQty => SAQty - EdiQty; + /// + /// WMS发货与EDI数量差 + /// + [ExporterHeader(DisplayName = "WMS发货与EDI数量差")] + public decimal SeEdiQty => SEQty - EdiQty; + [Display(Name = "是否完全匹配")] + [ExporterHeader(DisplayName = "是否完全匹配")] + [ValueMapping("是", true)] + [ValueMapping("否", false)] + public bool MateType => SaSeQty == 0 && SaEdiQty == 0 && SeEdiQty == 0; + /// + /// 定价 + /// + [Display(Name = "定价")] + [ExporterHeader(DisplayName = "定价", IsIgnore = true)] + public decimal? FixPrice { get; set; } + /// + /// ERP销售库位 + /// + [Display(Name = "ERP销售库位")] + [ExporterHeader(DisplayName = "ERP销售库位")] + public string ToErpLocCode { get; set; } + /// + /// WMS发货库位 + /// + [Display(Name = "WMS发货库位")] + [ExporterHeader(DisplayName = "WMS发货库位")] + public string ToLocCode { get; set; } +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReportJisBBAC.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReportJisBBAC.cs new file mode 100644 index 00000000..e592b95c --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReportJisBBAC.cs @@ -0,0 +1,8 @@ +namespace Win.Sfs.SettleAccount.Reports; + +/// +/// JisBBAC结算、发运、Eid明细对比报告 +/// +public class SaSeEdiCompareDetailReportJisBBAC : SaSeEdiCompareDetailReport +{ +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReportJisHBPO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReportJisHBPO.cs new file mode 100644 index 00000000..6f5e5ca4 --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDetailReportJisHBPO.cs @@ -0,0 +1,8 @@ +namespace Win.Sfs.SettleAccount.Reports; + +/// +/// JisHBPO结算、发运、Eid明细对比报告 +/// +public class SaSeEdiCompareDetailReportJisHBPO : SaSeEdiCompareDetailReport +{ +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDiff.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDiff.cs index 192db73e..4343ed77 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDiff.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDiff.cs @@ -1,7 +1,5 @@ using System; using System.ComponentModel.DataAnnotations; -using Magicodes.ExporterAndImporter.Core; -using Magicodes.ExporterAndImporter.Excel; using Win.Sfs.SettleAccount.Enums; namespace Win.Sfs.SettleAccount.Reports; @@ -121,18 +119,6 @@ public class SaSeEdiCompareDiff /// [Display(Name = "替换厂内物料号")] public string ReplaceFactoryPartCode { get; set; } - /// - /// 是否替换了厂内零件号 - /// - public bool IsReplace { get; set; } -} - -/// -/// 结算、发运、Eid对比明细 -/// -[ExcelExporter(MaxRowNumberOnASheet = 500_000)] -public class SaSeEdiCompareDetailExport -{ } /// @@ -144,426 +130,30 @@ public interface ISaSeEdiCompareDetailExport /// 类别 /// [Display(Name = "类别")] - [ExporterHeader(DisplayName = "类别")] - [ValueMapping("有结算有发运(有EDI数据)", 1)] - [ValueMapping("有结算有发运(无EDI数据)", 2)] - [ValueMapping("有结算无发运(有EDI数据)", 3)] - [ValueMapping("有结算无发运(无EDI数据)", 4)] - [ValueMapping("无结算有发运(有EDI数据)", 5)] - [ValueMapping("无结算有发运(无EDI数据)", 6)] public EnumSaSeEdiCompareCategory Category { get; set; } /// /// 零件描述 /// [Display(Name = "零件描述")] - [ExporterHeader(DisplayName = "物料描述")] public string PartCodeDesc { get; set; } /// /// 替换厂内零件号 /// [Display(Name = "替换厂内零件号")] - [ExporterHeader(DisplayName = "替换厂内零件号")] - public string ReplaceFactoryPartCode { get; set; } - /// - /// 结算数量 - /// - [Display(Name = "结算数量")] - [ExporterHeader(DisplayName = "结算数量")] - public decimal SAQty { get; set; } - /// - /// 发货数量 - /// - [Display(Name = "发货数量")] - [ExporterHeader(DisplayName = "WMS发货数量")] - public decimal SEQty { get; set; } - /// - /// Edi数量 - /// - [Display(Name = "Edi数量")] - [ExporterHeader(DisplayName = "Edi数量")] - public decimal EdiQty { get; set; } -} - -/// -/// JisBBAC结算、发运、Eid对比明细 -/// -public class SaSeEdiCompareDetailExportJisBBAC : SaSeEdiCompareDetailExport, ISaSeEdiCompareDetailExport -{ - /// - /// 类别 - /// - [Display(Name = "类别")] - [ExporterHeader(DisplayName = "类别")] - [ValueMapping("有结算有发运(有EDI数据)", 1)] - [ValueMapping("有结算有发运(无EDI数据)", 2)] - [ValueMapping("有结算无发运(有EDI数据)", 3)] - [ValueMapping("有结算无发运(无EDI数据)", 4)] - [ValueMapping("无结算有发运(有EDI数据)", 5)] - [ValueMapping("无结算有发运(无EDI数据)", 6)] - public EnumSaSeEdiCompareCategory Category { get; set; } - [Display(Name = "WMS多发")] - [ExporterHeader(DisplayName = "WMS多发")] - [ValueMapping("", 0)] - [ValueMapping("WMS多发", 1)] - public EnumWMSSend WMSSend - { - get - { - return (Category, SaSeQty < 0) switch - { - (EnumSaSeEdiCompareCategory.HaveSaHaveSeHaveEdi, true) => EnumWMSSend.WMSRepeat, - (EnumSaSeEdiCompareCategory.HaveSaHaveSeNotHaveEdi, true) => EnumWMSSend.WMSRepeat, - _ => EnumWMSSend.None - }; - } - } - [Display(Name = "价格信息")] - [ExporterHeader(DisplayName = "价格信息")] - [ValueMapping("有价格信息", true)] - [ValueMapping("无价格信息", false)] - public bool IsHavePrice => FixPrice != null && FixPrice != 0; - /// - /// 交货单号 - /// - [Display(Name = "交货单号")] - [ExporterHeader(DisplayName = "交货单号")] - public string WmsBillNum { get; set; } - /// - /// 发货日期 - /// - [Display(Name = "发货日期")] - [ExporterHeader(DisplayName = "发货日期")] - public DateTime? ShippingDate { get; set; } - /// - /// 生产码 - /// - [Display(Name = "生产码")] - [ExporterHeader(DisplayName = "订单生产码")] - public string PN { get; set; } - /// - /// 日顺序号 - /// - [Display(Name = "日顺序号")] - [ExporterHeader(DisplayName = "日顺序号")] - public string SeqNumber { get; set; } - /// - /// PJIS日顺序号 - /// - [Display(Name = "PJIS日顺序号")] - [ExporterHeader(DisplayName = "PJIS日顺序号")] - public string PJISSeqNumber { get; set; } - /// - /// 客户物料号 - /// - [Display(Name = "客户物料号")] - [ExporterHeader(DisplayName = "客户物料号")] - public string CustomerPartCode { get; set; } - /// - /// 物料描述 - /// - [Display(Name = "物料描述")] - [ExporterHeader(DisplayName = "物料描述")] - public string PartCodeDesc { get; set; } - /// - /// 厂内物料号 - /// - [Display(Name = "厂内物料号")] - [ExporterHeader(DisplayName = "厂内物料号")] - public string FactoryPartCode { get; set; } - /// - /// 替换厂内物料号 - /// - [Display(Name = "替换厂内物料号")] - [ExporterHeader(DisplayName = "替换厂内物料号")] - public string ReplaceFactoryPartCode { get; set; } - /// - /// 客户下线时间 - /// - [Display(Name = "客户下线时间")] - [ExporterHeader(DisplayName = "客户下线时间")] - public DateTime? CustomerOfflineTime { get; set; } - /// - /// 小总成号 - /// - [Display(Name = "小总成号")] - [ExporterHeader(DisplayName = "小总成号")] - public string AssemblyCode { get; set; } - /// - /// 注塑码 - /// - [Display(Name = "注塑码")] - [ExporterHeader(DisplayName = "注塑码")] - public string InjectionCode { get; set; } - /// - /// 结算数量 - /// - [Display(Name = "结算数量")] - [ExporterHeader(DisplayName = "结算数量")] - public decimal SAQty { get; set; } - /// - /// 发货数量 - /// - [Display(Name = "发货数量")] - [ExporterHeader(DisplayName = "WMS发货数量")] - public decimal SEQty { get; set; } - /// - /// Edi数量 - /// - [Display(Name = "Edi数量")] - [ExporterHeader(DisplayName = "Edi数量")] - public decimal EdiQty { get; set; } - /// - /// 结算与WMS发货量差 - /// - [ExporterHeader(DisplayName = "结算与WMS发货量差")] - public decimal SaSeQty => SAQty - SEQty; - /// - /// 结算与EDI量差 - /// - [ExporterHeader(DisplayName = "结算与EDI量差")] - public decimal SaEdiQty => SAQty - EdiQty; - /// - /// WMS发货与EDI数量差 - /// - [ExporterHeader(DisplayName = "WMS发货与EDI数量差")] - public decimal SeEdiQty => SEQty - EdiQty; - [Display(Name = "是否完全匹配")] - [ExporterHeader(DisplayName = "是否完全匹配")] - [ValueMapping("是", true)] - [ValueMapping("否", false)] - public bool MateType => SaSeQty == 0 && SaEdiQty == 0 && SeEdiQty == 0; - /// - /// 定价 - /// - [Display(Name = "定价")] - [ExporterHeader(DisplayName = "定价")] - public virtual decimal? FixPrice { get; set; } - /// - /// ERP销售库位 - /// - [Display(Name = "ERP销售库位")] - [ExporterHeader(DisplayName = "ERP销售库位")] - public string ToErpLocCode { get; set; } - /// - /// WMS发货库位 - /// - [Display(Name = "WMS发货库位")] - [ExporterHeader(DisplayName = "WMS发货库位")] - public string ToLocCode { get; set; } -} - -/// -/// JisHBPO结算、发运、Eid对比明细 -/// -public class SaSeEdiCompareDetailExportJisHBPO : SaSeEdiCompareDetailExport, ISaSeEdiCompareDetailExport -{ - /// - /// 类别 - /// - [Display(Name = "类别")] - [ExporterHeader(DisplayName = "类别")] - [ValueMapping("有结算有发运(有EDI数据)", 1)] - [ValueMapping("有结算有发运(无EDI数据)", 2)] - [ValueMapping("有结算无发运(有EDI数据)", 3)] - [ValueMapping("有结算无发运(无EDI数据)", 4)] - [ValueMapping("无结算有发运(有EDI数据)", 5)] - [ValueMapping("无结算有发运(无EDI数据)", 6)] - public EnumSaSeEdiCompareCategory Category { get; set; } - [Display(Name = "WMS多发")] - [ExporterHeader(DisplayName = "WMS多发")] - [ValueMapping("", 0)] - [ValueMapping("WMS多发", 1)] - public EnumWMSSend WMSSend - { - get - { - return (Category, SaSeQty < 0) switch - { - (EnumSaSeEdiCompareCategory.HaveSaHaveSeHaveEdi, true) => EnumWMSSend.WMSRepeat, - (EnumSaSeEdiCompareCategory.HaveSaHaveSeNotHaveEdi, true) => EnumWMSSend.WMSRepeat, - _ => EnumWMSSend.None - }; - } - } - [Display(Name = "价格信息")] - [ExporterHeader(DisplayName = "价格信息")] - [ValueMapping("有价格信息", true)] - [ValueMapping("无价格信息", false)] - public bool IsHavePrice => FixPrice != null && FixPrice != 0; - /// - /// 交货单号 - /// - [Display(Name = "交货单号")] - [ExporterHeader(DisplayName = "交货单号")] - public string WmsBillNum { get; set; } - /// - /// 发货日期 - /// - [Display(Name = "发货日期")] - [ExporterHeader(DisplayName = "发货日期")] - public DateTime? ShippingDate { get; set; } - /// - /// 生产码 - /// - [Display(Name = "生产码")] - [ExporterHeader(DisplayName = "订单生产码")] - public string PN { get; set; } - /// - /// 日顺序号 - /// - [Display(Name = "日顺序号")] - [ExporterHeader(DisplayName = "日顺序号")] - public string SeqNumber { get; set; } - /// - /// PJIS日顺序号 - /// - [Display(Name = "PJIS日顺序号")] - [ExporterHeader(DisplayName = "PJIS日顺序号")] - public string PJISSeqNumber { get; set; } - /// - /// 客户物料号 - /// - [Display(Name = "客户物料号")] - [ExporterHeader(DisplayName = "客户物料号")] - public string CustomerPartCode { get; set; } - /// - /// 物料描述 - /// - [Display(Name = "物料描述")] - [ExporterHeader(DisplayName = "物料描述")] - public string PartCodeDesc { get; set; } - /// - /// 厂内物料号 - /// - [Display(Name = "厂内物料号")] - [ExporterHeader(DisplayName = "厂内物料号")] - public string FactoryPartCode { get; set; } - /// - /// 替换厂内物料号 - /// - [Display(Name = "替换厂内物料号")] - [ExporterHeader(DisplayName = "替换厂内物料号")] public string ReplaceFactoryPartCode { get; set; } /// - /// 客户下线时间 - /// - [Display(Name = "客户下线时间")] - [ExporterHeader(DisplayName = "客户下线时间")] - public DateTime? CustomerOfflineTime { get; set; } - /// - /// 小总成号 - /// - [Display(Name = "小总成号")] - [ExporterHeader(DisplayName = "小总成号")] - public string AssemblyCode { get; set; } - /// - /// 注塑码 - /// - [Display(Name = "注塑码")] - [ExporterHeader(DisplayName = "注塑码")] - public string InjectionCode { get; set; } - /// /// 结算数量 /// [Display(Name = "结算数量")] - [ExporterHeader(DisplayName = "结算数量")] public decimal SAQty { get; set; } /// /// 发货数量 /// [Display(Name = "发货数量")] - [ExporterHeader(DisplayName = "WMS发货数量")] public decimal SEQty { get; set; } /// /// Edi数量 /// [Display(Name = "Edi数量")] - [ExporterHeader(DisplayName = "Edi数量")] public decimal EdiQty { get; set; } - /// - /// 结算与EDI量差 - /// - [ExporterHeader(DisplayName = "结算与WMS发货量差")] - public decimal SaSeQty => SAQty - SEQty; - /// - /// 结算与EDI量差 - /// - [ExporterHeader(DisplayName = "结算与EDI量差")] - public decimal SaEdiQty => SAQty - EdiQty; - /// - /// WMS发货与EDI数量差 - /// - [ExporterHeader(DisplayName = "WMS发货与EDI数量差")] - public decimal SeEdiQty => SEQty - EdiQty; - [Display(Name = "是否完全匹配")] - [ExporterHeader(DisplayName = "是否完全匹配")] - [ValueMapping("是", true)] - [ValueMapping("否", false)] - public bool MateType => SaSeQty == 0 && SaEdiQty == 0 && SeEdiQty == 0; - /// - /// 定价 - /// - [Display(Name = "定价")] - [ExporterHeader(DisplayName = "定价")] - public virtual decimal? FixPrice { get; set; } - /// - /// ERP销售库位 - /// - [Display(Name = "ERP销售库位")] - [ExporterHeader(DisplayName = "ERP销售库位")] - public string ToErpLocCode { get; set; } - /// - /// WMS发货库位 - /// - [Display(Name = "WMS发货库位")] - [ExporterHeader(DisplayName = "WMS发货库位")] - public string ToLocCode { get; set; } -} - -/// -/// PUB结算与发运对比汇总 -/// -[ExcelExporter(MaxRowNumberOnASheet = 500_000)] -public class SaSeEdiCompareSumExport -{ - /// - /// 厂内物料号 - /// - [Display(Name = "厂内物料号")] - [ExporterHeader(DisplayName = "LU")] - public string FactoryPartCode { get; set; } - /// - /// 物料描述 - /// - [Display(Name = "物料描述")] - [ExporterHeader(DisplayName = "物料描述")] - public string PartCodeDesc { get; set; } - /// - /// 结算数量 - /// - [Display(Name = "结算数量")] - [ExporterHeader(DisplayName = "结算数量")] - public decimal SAQty { get; set; } - /// - /// 发货数量 - /// - [Display(Name = "发货数量")] - [ExporterHeader(DisplayName = "WMS发货数量")] - public decimal SEQty { get; set; } - /// - /// Edi数量 - /// - [Display(Name = "Edi数量")] - [ExporterHeader(DisplayName = "Edi数量")] - public decimal EdiQty { get; set; } - /// - /// 结算与EDI量差 - /// - [ExporterHeader(DisplayName = "结算与EDI量差")] - public decimal SaEdiQty => SAQty - EdiQty; - /// - /// WMS发货与EDI数量差 - /// - [ExporterHeader(DisplayName = "WMS发货与EDI数量差")] - public decimal SeEdiQty => SEQty - EdiQty; } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareSumReport.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareSumReport.cs new file mode 100644 index 00000000..93100f01 --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareSumReport.cs @@ -0,0 +1,53 @@ +using System.ComponentModel.DataAnnotations; +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; + +namespace Win.Sfs.SettleAccount.Reports; + +/// +/// 结算、发运、Edi汇总对比报告 +/// +[ExcelExporter(MaxRowNumberOnASheet = 500_000)] +public class SaSeEdiCompareSumReport +{ + /// + /// 厂内物料号 + /// + [Display(Name = "厂内物料号")] + [ExporterHeader(DisplayName = "LU")] + public string FactoryPartCode { get; set; } + /// + /// 物料描述 + /// + [Display(Name = "物料描述")] + [ExporterHeader(DisplayName = "物料描述")] + public string PartCodeDesc { get; set; } + /// + /// 结算数量 + /// + [Display(Name = "结算数量")] + [ExporterHeader(DisplayName = "结算数量")] + public decimal SAQty { get; set; } + /// + /// 发货数量 + /// + [Display(Name = "发货数量")] + [ExporterHeader(DisplayName = "WMS发货数量")] + public decimal SEQty { get; set; } + /// + /// Edi数量 + /// + [Display(Name = "Edi数量")] + [ExporterHeader(DisplayName = "Edi数量")] + public decimal EdiQty { get; set; } + /// + /// 结算与EDI量差 + /// + [ExporterHeader(DisplayName = "结算与EDI量差")] + public decimal SaEdiQty => SAQty - EdiQty; + /// + /// WMS发货与EDI数量差 + /// + [ExporterHeader(DisplayName = "WMS发货与EDI数量差")] + public decimal SeEdiQty => SEQty - EdiQty; +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SeEidCompareReportJisBBAC.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SeEidCompareReportJisBBAC.cs index 36a79337..03f90227 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SeEidCompareReportJisBBAC.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SeEidCompareReportJisBBAC.cs @@ -3,7 +3,7 @@ using Magicodes.ExporterAndImporter.Excel; namespace Win.Sfs.SettleAccount.Reports; /// -/// JisBBAC 发运、Edi与对比导出 +/// JisBBAC 发运、Edi与对比报告 /// [ExcelExporter(MaxRowNumberOnASheet = 500_000)] public class SeEidCompareReportJisBBAC : SeEidCompareReport diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs index 45b5fee1..73da9782 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs @@ -106,8 +106,8 @@ namespace SettleAccount.Job.Services.Report saSeEdiCompareDiffs = saSeEdiCompareDiffs.OrderBy(t => t.Category).ToList(); var excelExporter = new ExcelExporter(); - var items = _objectMapper.Map, List>(saSeEdiCompareDiffs); - excelExporter = BindExcelExporter(items, businessTypeDisplayName); + var items = _objectMapper.Map, List>(saSeEdiCompareDiffs); + excelExporter = BindExcelExporter(items, businessTypeDisplayName); var result = excelExporter.ExportAppendDataAsByteArray(); result.ShouldNotBeNull(); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs index b5dc8e4c..0869466a 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs @@ -105,8 +105,8 @@ namespace SettleAccount.Job.Services.Report saSeEdiCompareDiffs = saSeEdiCompareDiffs.OrderBy(t => t.Category).ToList(); var excelExporter = new ExcelExporter(); - var items = _objectMapper.Map, List>(saSeEdiCompareDiffs); - excelExporter = BindExcelExporter(items, businessTypeDisplayName); + var items = _objectMapper.Map, List>(saSeEdiCompareDiffs); + excelExporter = BindExcelExporter(items, businessTypeDisplayName); var result = excelExporter.ExportAppendDataAsByteArray(); result.ShouldNotBeNull(); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs index f3f240a6..59170860 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs @@ -179,7 +179,7 @@ namespace SettleAccount.Job.Services.Report /// /// 创建导出文件结构 /// - public ExcelExporter BindExcelExporter(List saSeEdiCompareDetailExports, string businessTypeDisplayName) where T : SaSeEdiCompareDetailExport, ISaSeEdiCompareDetailExport, new() + public ExcelExporter BindExcelExporter(List saSeEdiCompareDetailExports, string businessTypeDisplayName) where T : SaSeEdiCompareDetailReport, new() { //详情Sheet行数 var detailMaxRowNumberOnASheet = AppConst.DefaultRowNumberOnASheet; @@ -191,14 +191,14 @@ namespace SettleAccount.Job.Services.Report //汇总Sheet行数 var sumMaxRowNumberOnASheet = AppConst.DefaultRowNumberOnASheet; - var sumExportExporterAttribute = typeof(SaSeEdiCompareSumExport).GetAttribute(inherit: true); + var sumExportExporterAttribute = typeof(SaSeEdiCompareSumReport).GetAttribute(inherit: true); if (sumExportExporterAttribute != null) { sumMaxRowNumberOnASheet = sumExportExporterAttribute.MaxRowNumberOnASheet > 0 ? sumExportExporterAttribute.MaxRowNumberOnASheet : sumMaxRowNumberOnASheet; } //汇总 - var saSeEdiCompareSumExports = saSeEdiCompareDetailExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumExport() + var saSeEdiCompareSumExports = saSeEdiCompareDetailExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumReport() { FactoryPartCode = p.Key, PartCodeDesc = p.FirstOrDefault().PartCodeDesc, @@ -210,7 +210,7 @@ namespace SettleAccount.Job.Services.Report //有结算有发运 var haveSaHaveSeExports = saSeEdiCompareDetailExports.FindAll(t => new EnumSaSeEdiCompareCategory[] { EnumSaSeEdiCompareCategory.HaveSaHaveSeHaveEdi, EnumSaSeEdiCompareCategory.HaveSaHaveSeNotHaveEdi }.Contains(t.Category)); //有结算有发运汇总 - var haveSaHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumExport() + var haveSaHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumReport() { FactoryPartCode = p.Key, PartCodeDesc = p.FirstOrDefault().PartCodeDesc, @@ -221,7 +221,7 @@ namespace SettleAccount.Job.Services.Report //有结算无发运 var haveSaNotHaveSeExports = saSeEdiCompareDetailExports.FindAll(t => new EnumSaSeEdiCompareCategory[] { EnumSaSeEdiCompareCategory.HaveSaNotHaveSeHaveEdi, EnumSaSeEdiCompareCategory.HaveSaNotHaveSeNotHaveEdi }.Contains(t.Category)); //有结算无发运 - var haveSaNotHaveSeSumExports = haveSaNotHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumExport() + var haveSaNotHaveSeSumExports = haveSaNotHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumReport() { FactoryPartCode = p.Key, PartCodeDesc = p.FirstOrDefault().PartCodeDesc, @@ -232,7 +232,7 @@ namespace SettleAccount.Job.Services.Report //无结算有发运 var notHaveSaHaveSeExports = saSeEdiCompareDetailExports.FindAll(t => new EnumSaSeEdiCompareCategory[] { EnumSaSeEdiCompareCategory.NotHaveSaHaveSeHaveEdi, EnumSaSeEdiCompareCategory.NotHaveSaHaveSeNotHaveEdi }.Contains(t.Category)); //无结算有发运 - var notHaveSaHaveSeSumExports = notHaveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumExport() + var notHaveSaHaveSeSumExports = notHaveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumReport() { FactoryPartCode = p.Key, PartCodeDesc = p.FirstOrDefault().PartCodeDesc, diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobAutoMapperProfile.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobAutoMapperProfile.cs index 0611695b..55dffce8 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobAutoMapperProfile.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobAutoMapperProfile.cs @@ -28,8 +28,8 @@ namespace SettleAccount.Job /// public void CreateMapSaSeEdiCompare() { - CreateMap(); - CreateMap(); + CreateMap(); + CreateMap(); CreateMap(); CreateMap(); } From 89a166603afb7ee4974a1032939ee0474e0a33e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Mon, 11 Sep 2023 13:48:02 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Bases/BA_SERVICE.cs | 25 ++- .../Bases/CAN_SA_SERVICE.cs | 38 ++-- .../Entities/BQ/BBAC_BA_SERVICE.cs | 16 +- .../Entities/BQ/BBAC_CAN_SA_SERVICE.cs | 11 +- .../Entities/BQ/HBPO_CAN_SA_SERVICE.cs | 6 +- .../Entities/BQ/PUB_CAN_SA_SERVICE.cs | 6 +- .../BaseDomainServices/BaseDomainService.cs | 39 +++- .../Entities/BQ/Managers/INV_MNG.cs | 3 - .../Entities/BQ/Managers/INV_MNG_EXT.cs | 188 ++++++------------ 9 files changed, 154 insertions(+), 178 deletions(-) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs index c85fa2f2..3d5f2251 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs @@ -525,19 +525,7 @@ namespace Win.Sfs.SettleAccount.Bases - - - - - - - - - - - - - + /// /// 校验规则 @@ -547,6 +535,10 @@ namespace Win.Sfs.SettleAccount.Bases /// protected async Task> CheckInvoiceGenerationRules(List dto1s, List p_pricelist, EnumBusinessType p_businessType) where T : SA_CAN_BASE { + var first= dto1s.FirstOrDefault(); + var usepriceList = p_pricelist.Where(p => p.ClientCode == first.Site && p.IsCancel == false).ToList(); + var errorlist= _baseservice.CheckPriceListContinuity(usepriceList); + var inner = from d in dto1s join p in p_pricelist on d.LU equals p.LU where @@ -593,6 +585,13 @@ namespace Win.Sfs.SettleAccount.Bases keyname = "交付识别号"; break; } + foreach (var error in errorlist) + { + errorList.Add(new ERR_EXP_DTO() { ItemCode = error.LU, CustomCode = $"{name}", Message = $"LU:{error.LU},价格表开始日期:{error.BeginTime}价格表结束日期:{error.EndTime}在用价格时间段有交集或价格时间不连续!" }); + } + + + foreach (var error in left) { errorList.Add(new ERR_EXP_DTO() { ItemCode = error.LU, CustomCode = $"{name}", Message = $"LU:{error.LU}{keyname}:{error.PN},下线日期:{error.SettleDate}没有对应区间销售价格表!" }); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs index 013bec78..6467f925 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs @@ -26,6 +26,7 @@ using Volo.Abp.TenantManagement.EntityFrameworkCore; using Volo.Abp.Uow; using Win.Abp.Snowflakes; using Win.Sfs.BaseData.ImportExcelCommon; +using Win.Sfs.SettleAccount.Bases.DomainServices; using Win.Sfs.SettleAccount.CommonManagers; using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Entities.BQ; @@ -54,15 +55,15 @@ namespace Win.Sfs.SettleAccount.Bases protected readonly INormalEfCoreRepository _detailRepository; private readonly IExcelImportAppService _excelImportService; protected readonly INV_MNG _invmng; - + private readonly BaseDomainService _baseservice; protected CAN_SA_SERVICE( IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, ICommonManager commonManager, INormalEfCoreRepository repository, INormalEfCoreRepository detailRepository, - INV_MNG invmng - + INV_MNG invmng, + BaseDomainService baseservice ) : base(excelImportService, snowflakeIdGenerator, commonManager) { @@ -70,6 +71,7 @@ namespace Win.Sfs.SettleAccount.Bases _excelImportService = excelImportService; _repository = repository; _detailRepository = detailRepository; + _baseservice = baseservice; } /// @@ -259,8 +261,12 @@ namespace Win.Sfs.SettleAccount.Bases protected async Task> CheckInvoiceGenerationRules(List dto1s,string p_site, List p_pricelist,EnumBusinessType p_businessType) where T : SA_CAN_BASE { - //var maxDate = p_pricelist.Max(p => p.Date); - + //var maxDate = p_pricelist.Max(p => p.Date); + + var first = dto1s.FirstOrDefault(); + var usepriceList = p_pricelist.Where(p => p.ClientCode == first.Site && p.IsCancel == false).ToList(); + var errorlist = _baseservice.CheckPriceListContinuity(usepriceList); + var prices = p_pricelist.Where(p =>p.ClientCode==p_site && p.IsCancel == false).ToList(); var inner = from d in dto1s @@ -277,24 +283,6 @@ namespace Win.Sfs.SettleAccount.Bases select d; - - - //var maxDate = p_pricelist.Max(p => p.Date); - - //var left = from a in dto1s - // join b in (from p in p_pricelist - // where p.Date == maxDate - // select p) on a.LU equals b.LU into joinedResult - // from jr in joinedResult.DefaultIfEmpty() - // where a.SettleDate >= jr.BeginTime && a.SettleDate <= jr.EndTime && jr.LU == null - // select a; - - - - - - - List errorList = new List (); string name = string.Empty; string keyname = string.Empty; @@ -329,6 +317,10 @@ namespace Win.Sfs.SettleAccount.Bases keyname = "交付识别号"; break; } + foreach (var error in errorlist) + { + errorList.Add(new ERR_EXP_DTO() { ItemCode = error.LU, CustomCode = $"{name}", Message = $"LU:{error.LU},价格表开始日期:{error.BeginTime}价格表结束日期:{error.EndTime}在用价格时间段有交集或价格时间不连续!" }); + } foreach (var error in left) { errorList.Add(new ERR_EXP_DTO() { ItemCode = error.LU, CustomCode = $"{name}", Message = $"LU:{error.LU}{keyname}:{error.PN},下线日期:{error.SettleDate}没有对应区间销售价格表!" }); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs index 86bb6fcc..0fb6605e 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs @@ -4,6 +4,7 @@ using DocumentFormat.OpenXml.Spreadsheet; using EFCore.BulkExtensions; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.EntityFrameworkCore; using NPOI.HPSF; using SettleAccount.Domain.BQ; @@ -451,6 +452,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ }; var dtos = q.ToList(); + + + + + var testls = dtos.Where(p => string.IsNullOrEmpty(p.LU)).ToList(); + if (dtos != null && dtos.Count > 0) { if (invbillnum.Substring(0, 3) == "INV")//一次开票重开 @@ -465,15 +472,17 @@ namespace Win.Sfs.SettleAccount.Entities.BQ var entities = await ReissueSecInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum); var ls = ObjectMapper.Map, List>(entities); invBilllist.AddRange(ls); - } - } else { throw new UserFriendlyException($"不存发票号为:{invbillnum}发票"); } } + + var als= invBilllist.Where(p => string.IsNullOrEmpty(p.PartCode)).ToList(); + + var invlist=invBilllist.OrderBy(p => p.PartCode).ToList(); return new JsonResult(new { Code = 200, Data= invlist }); @@ -585,7 +594,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ { var entities = await ReissueFirstInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum); var ls = ObjectMapper.Map, List>(entities); - if (ls.Count > 0) { var invlist = ls.Select(p => p.InvbillNum).Distinct(); @@ -619,7 +627,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ var invBill = new INVOICE_REPEAT_DTO(); var invls = ls.Where(p => p.InvbillNum == itm).ToList(); var entitylist = entities.Where(p => p.InvbillNum == itm).ToList(); - var tax = inv.Tax;//税率 + var tax = inv.Tax==0?0.13m:inv.Tax;//税率 var amt = entitylist.Sum(p => p.Amt);//税前 var taxamt = amt + Math.Round(amt * tax, 2);//税后 var realamt = Math.Round(amt * tax, 2);//税额 diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs index 51038c01..b731a175 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs @@ -31,6 +31,7 @@ using Win.Sfs.SettleAccount.CommonManagers; using Volo.Abp; using Win.Sfs.SettleAccount.Entities.BQ.Temp; using Volo.Abp.Uow; +using Win.Sfs.SettleAccount.Bases.DomainServices; namespace Win.Sfs.SettleAccount.Entities.BQ { @@ -65,10 +66,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ INV_MNG invmng, INormalEfCoreRepository notRepository, INormalEfCoreRepository priceRepository, - BBAC_CAN_SA_MNG bbacMng - + BBAC_CAN_SA_MNG bbacMng, + BaseDomainService baseservice ) - : base(excelImportService, snowflakeIdGenerator, commonManager, repository, detailRepository, invmng) + : base(excelImportService, snowflakeIdGenerator, commonManager, repository, detailRepository, invmng,baseservice) { _notRepository = notRepository; _bbacMng = bbacMng; @@ -86,6 +87,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ [UnitOfWork(false)] public async Task GenerateInvoice([FromBody] string invbillNum) { + var main =await _bbacMng.GetMainAsync(invbillNum); if (main != null) { @@ -95,8 +97,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ } var entitys = await _bbacMng.GetDetalListAsync(invbillNum);//可结算 var priceList = _priceRepository.Where(p => p.IsCancel == false).ToList(); - - ;//价格单 + //价格单 var errorList = await CheckInvoiceGenerationRules(entitys,main.Site,priceList, main.BusinessType);//校验生成规则 if (errorList.Count() > 0) { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs index 9392f435..aecbd853 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs @@ -19,6 +19,7 @@ using Volo.Abp.Uow; using Win.Abp.Snowflakes; using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.SettleAccount.Bases; +using Win.Sfs.SettleAccount.Bases.DomainServices; using Win.Sfs.SettleAccount.CommonManagers; using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Entities.BQ.Dtos; @@ -61,8 +62,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ INV_MNG invmng, INormalEfCoreRepository notRepository, INormalEfCoreRepository priceRepository, - HBPO_CAN_SA_MNG hbpoMng - ) : base(excelImportService, snowflakeIdGenerator, commonManager, repository, detailRepository, invmng) + HBPO_CAN_SA_MNG hbpoMng, + BaseDomainService baseservice + ) : base(excelImportService, snowflakeIdGenerator, commonManager, repository, detailRepository, invmng,baseservice) { _priceRepository = priceRepository; diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs index 6941780c..64f2a82a 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs @@ -15,6 +15,7 @@ using Volo.Abp.Uow; using Win.Abp.Snowflakes; using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.SettleAccount.Bases; +using Win.Sfs.SettleAccount.Bases.DomainServices; using Win.Sfs.SettleAccount.CommonManagers; using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Entities.BQ.Dtos; @@ -59,9 +60,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ INV_MNG invmng, INormalEfCoreRepository priceRepository, INormalEfCoreRepository pricebjRepository, - PUB_CAN_SA_MNG pubMng + PUB_CAN_SA_MNG pubMng, + BaseDomainService baseservice - ) : base(excelImportService, snowflakeIdGenerator, commonManager, repository, detailRepository, invmng) + ) : base(excelImportService, snowflakeIdGenerator, commonManager, repository, detailRepository, invmng,baseservice) { _pubMng = pubMng; _priceRepository = priceRepository; diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/BaseDomainServices/BaseDomainService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/BaseDomainServices/BaseDomainService.cs index 3a38ddd7..60a0965e 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/BaseDomainServices/BaseDomainService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/BaseDomainServices/BaseDomainService.cs @@ -201,13 +201,43 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices return errorList; } + + /// + /// 价格表时间是否连续 + /// + /// + /// + public List CheckPriceListContinuity(List priceList) + { + List prices = new List(); + if (priceList.Count <= 1) + return prices; // 只有一个或零个价格条目 + + var sortedList = priceList.OrderBy(item => item.BeginTime).ToList(); + + for (int i = 1; i < sortedList.Count; i++) + { + if (sortedList[i].LU== sortedList[i - 1].LU && sortedList[i].BeginTime != sortedList[i - 1].EndTime.AddDays(1)) + { + prices.Add(sortedList[i]); + } + } + return prices; // 所有价格时间都连续 + } + + + public static bool IsTimeOverlap(PriceList range1, PriceList range2) + { + return range1.BeginTime <= range2.EndTime && range1.EndTime >= range2.BeginTime; + } + public async Task> CheckPriceList(List p_list,string p_site,bool isBj=false) where TEntity : ISA_BASE,new() { List errorList = new List(); if (isBj == true) { - var pricebjlist = _pricebjRepository.ToList(); + var pricebjlist = _pricebjRepository.Where(p => p.ClientCode == p_site && p.IsCancel == false).ToList(); var inner = from d in p_list join p in pricebjlist on d.LU equals p.LU @@ -226,10 +256,11 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices } else { - var pricebjlist = _priceRepository.Where(p=>p.ClientCode==p_site).ToList(); - + var pricelist = _priceRepository.Where(p=>p.ClientCode==p_site && p.IsCancel==false).ToList(); + + var inner = from d in p_list - join p in pricebjlist on d.LU equals p.LU + join p in pricelist on d.LU equals p.LU where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime select d; diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs index 53d59c65..de8aabdc 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs @@ -1370,12 +1370,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers BeginDate = itm.Key.BeginDate, EndDate = itm.Key.EndDate }).ToList(); - - decimal amt = detailDtos.Sum(k => k.Amt);//金额 decimal txtAmt =detailDtos.Sum(k => k.Amt) + Math.Round(detailList.Sum(k => k.Amt) * 0.13m, 2);//税后金额 decimal realAmt = Math.Round(detailDtos.Sum(k => k.Amt) * 0.13m, 2);//税额 - //decimal amt = detailDtos.Sum(k => k.Amt); //decimal txtAmt = Math.Round(detailDtos.Sum(k => k.Amt), 2); var mapList = new List(); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG_EXT.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG_EXT.cs index 4507787b..dcbbde6d 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG_EXT.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG_EXT.cs @@ -194,33 +194,33 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers { detailList.AddRange(_entityDetailList); } - decimal amt = detailList.Sum(k => k.Amt); - decimal txtAmt = Math.Round(detailList.Sum(k => k.Amt), 2); - + decimal amt = detailList.Sum(k => k.Amt);//金额 + decimal txtAmt = detailList.Sum(k => k.Amt) + Math.Round(detailList.Sum(k => k.Amt) * 0.13m, 2);//税后金额 + decimal readAmt = Math.Round(detailList.Sum(k => k.Amt) * 0.13m, 2);//税额 var contractList = ls.Select(p => p.ContractDocID).Distinct(); var _groupList = dtos.Where(p => contractList.Contains(p.ContractDocID)).GroupBy(p => new { p.GroupNum }) .Select(p => new { GroupNum = p.Key.GroupNum, Amt = p.Sum(itm => itm.Amt) }).Distinct(); //var _groupList = dtos.GroupBy(p => new { p.GroupNum }) // .Select(p => new { GroupNum = p.Key.GroupNum, Amt = p.Sum(itm => itm.Amt) }).Distinct(); - List group1 = new List(); + //List group1 = new List(); - foreach (var en in _groupList) - { - group1.Add( - new INVOICE_MAP_GROUP( - guid: GuidGenerator.Create(), - version: p_version, - invbillNum: key, - invGroupNum: p_InvGroupNum, - settleGroupNum: en.GroupNum, - amt: en.Amt, - extend1: string.Empty, - extend2: string.Empty)); - } - if (group1.Count > 0) - { - groupList.AddRange(group1); - } + //foreach (var en in _groupList) + //{ + // group1.Add( + // new INVOICE_MAP_GROUP( + // guid: GuidGenerator.Create(), + // version: p_version, + // invbillNum: key, + // invGroupNum: p_InvGroupNum, + // settleGroupNum: en.GroupNum, + // amt: en.Amt, + // extend1: string.Empty, + // extend2: string.Empty)); + //} + //if (group1.Count > 0) + //{ + // groupList.AddRange(group1); + //} var invbill = new INVOICE_GRP (guid: GuidGenerator.Create(), @@ -238,26 +238,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers preTaxDiff: 0, taxDiff: 0, clientCode: string.Empty, - realAmt: 0 + realAmt: readAmt ); invlist.Add(invbill); } - - //await _repository.DbContext.BulkInsertAsync(invlist); - //await _repository.DbContext.BulkInsertAsync(groupList); - //await _repository.DbContext.BulkInsertAsync(detailList); - //if(salist.Count>0) - //{ - // await _repository.DbContext.BulkUpdateAsync(salist); - //} - //if (adjlist.Count > 0) - //{ - // await _repository.DbContext.BulkUpdateAsync(adjlist); - //} - - //await _repository.DbContext.BulkInsertAsync(notDetialList); - //_invls = invlist.Select(p => p.InvbillNum).ToList(); } return detailList; @@ -342,13 +327,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers // adjdetails.Add(detail); // } //} - - var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.PartCode, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }) + var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.PartCode,p.LU, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }) .Select(itm => new { PartCode = itm.Key.PartCode, InvGroupNum = itm.Key.InvGroupNum, - LU = itm.Key.PartCode, + LU = itm.Key.LU, ContactDocID = itm.Key.ContractDocID, Price = itm.Key.Price, Amt = Math.Round(itm.Sum(k => k.Qty) * itm.Key.Price, 2), @@ -357,27 +341,28 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers EndDate = itm.Key.EndDate }) .ToList(); - decimal amt = detailDtos.Sum(k => k.Amt); - decimal txtAmt = Math.Round(detailDtos.Sum(k => k.Amt), 2); - var mapList = new List(); - foreach (var groupnum in ls) - { - mapList.Add(new INVOICE_MAP_GROUP( - guid: GuidGenerator.Create(), - version: p_version, - invbillNum: key, - invGroupNum: p_InvGroupNum, - settleGroupNum: groupnum, - amt: 0, - extend1: string.Empty, - extend2: string.Empty - ) - ); - } - if (mapList.Count > 0) - { - groupList.AddRange(mapList); - } + decimal amt = detailDtos.Sum(k => k.Amt);//金额 + decimal txtAmt = detailDtos.Sum(k => k.Amt) + Math.Round(detailList.Sum(k => k.Amt) * 0.13m, 2);//税后金额 + decimal realAmt = Math.Round(detailDtos.Sum(k => k.Amt) * 0.13m, 2);//税额 + //var mapList = new List(); + //foreach (var groupnum in ls) + //{ + // mapList.Add(new INVOICE_MAP_GROUP( + // guid: GuidGenerator.Create(), + // version: p_version, + // invbillNum: key, + // invGroupNum: p_InvGroupNum, + // settleGroupNum: groupnum, + // amt: 0, + // extend1: string.Empty, + // extend2: string.Empty + // ) + // ); + //} + //if (mapList.Count > 0) + //{ + // groupList.AddRange(mapList); + //} List _entityDetailList = new List(); foreach (var detail in detailDtos) { @@ -444,7 +429,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers preTaxDiff: 0, taxDiff: 0, clientCode: string.Empty, - realAmt: 0 + realAmt: realAmt ); invlist.Add(invbill); } @@ -635,8 +620,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers { detailList.AddRange(_entityDetailList); } - decimal amt = detailList.Sum(k => k.Amt); - decimal txtAmt = Math.Round(detailList.Sum(k => k.Amt), 2); + decimal amt = detailList.Sum(k => k.Amt);//金额 + decimal txtAmt = detailList.Sum(k => k.Amt) + Math.Round(detailList.Sum(k => k.Amt) * 0.13m, 2);//税后金额 + decimal realAmt = Math.Round(detailList.Sum(k => k.Amt) * 0.13m, 2);//税额 var invbill = new INVOICE_GRP (guid: GuidGenerator.Create(), @@ -654,24 +640,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers preTaxDiff:0, taxDiff:0, clientCode:string.Empty, - realAmt:0 + realAmt:realAmt ); invlist.Add(invbill); } - //await _repository.DbContext.BulkInsertAsync(invlist); - ////await _repository.DbContext.BulkInsertAsync(groupList); - //await _repository.DbContext.BulkInsertAsync(detailList); - //if (salist.Count > 0) - //{ - // await _repository.DbContext.BulkUpdateAsync(salist); - //} - //if (adjlist.Count > 0) - //{ - // await _repository.DbContext.BulkUpdateAsync(adjlist); - //} - //await _repository.DbContext.BulkInsertAsync(notDetialList); - //_invls = invlist.Select(p => p.InvbillNum).ToList(); + } return detailList; } @@ -776,12 +750,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers adjdetails.Add(detail); } } - var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.PartCode, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }) + var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.PartCode, p.Price, p.BeginDate, p.EndDate, p.ContractDocID,p.LU }) .Select(itm => new { PartCode=itm.Key.PartCode, InvGroupNum = itm.Key.InvGroupNum, - LU = itm.Key.PartCode, + LU = itm.Key.LU, ContactDocID = itm.Key.ContractDocID, Price = itm.Key.Price, Amt = Math.Round(itm.Sum(k => k.Qty) * itm.Key.Price, 2), @@ -790,8 +764,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers EndDate = itm.Key.EndDate }) .ToList(); - decimal amt = detailDtos.Sum(k => k.Amt); - decimal txtAmt = Math.Round(detailDtos.Sum(k => k.Amt), 2); + decimal amt = detailDtos.Sum(k => k.Amt);//金额 + decimal txtAmt = detailDtos.Sum(k => k.Amt) + Math.Round(detailDtos.Sum(k => k.Amt) * 0.13m, 2);//税后金额 + decimal realAmt = Math.Round(detailDtos.Sum(k => k.Amt) * 0.13m, 2);//税额 var mapList = new List(); foreach (var groupnum in ls) { @@ -876,27 +851,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers preTaxDiff: 0, taxDiff: 0, clientCode: string.Empty, - realAmt: 0 + realAmt: realAmt ); invlist.Add(invbill); } - //await _repository.DbContext.BulkInsertAsync(invlist); - //await _repository.DbContext.BulkInsertAsync(groupList); - //await _repository.DbContext.BulkInsertAsync(detailList); - - //if(salist.Count>0) - //{ - // await _repository.DbContext.BulkUpdateAsync(salist); - //} - //if (adjlist.Count > 0) - //{ - // await _repository.DbContext.BulkUpdateAsync(adjlist); - //} - //if (notDetialList.Count > 0) - //{ - // await _repository.DbContext.BulkInsertAsync(notDetialList); - //} - //_invls = invlist.Select(p => p.InvbillNum).ToList(); + } return detailList; @@ -1059,12 +1018,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers } } - var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.PartCode, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }) + var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.PartCode, p.Price, p.BeginDate, p.EndDate, p.ContractDocID,p.LU }) .Select(itm => new { PartCode = itm.Key.PartCode, InvGroupNum = itm.Key.InvGroupNum, - LU = itm.Key.PartCode, + LU = itm.Key.LU, ContactDocID = itm.Key.ContractDocID, Price = itm.Key.Price, Amt = Math.Round(itm.Sum(k => k.Qty) * itm.Key.Price, 2), @@ -1097,8 +1056,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers PartName = inv1.GetProperty("PartName", ""),//零件名称 }; - decimal amt = detailDtos.Sum(k => k.Amt); - decimal txtAmt = Math.Round(detailDtos.Sum(k => k.Amt), 2); + decimal amt = detailDtos.Sum(k => k.Amt);//金额 + decimal txtAmt = detailDtos.Sum(k => k.Amt) + Math.Round(detailDtos.Sum(k => k.Amt) * 0.13m, 2);//税后金额 + decimal readAmt = Math.Round(detailDtos.Sum(k => k.Amt) * 0.13m, 2);//税额 var mapList = new List(); foreach (var groupnum in ls) { @@ -1191,27 +1151,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers preTaxDiff: 0, taxDiff: 0, clientCode: string.Empty, - realAmt: 0 + realAmt: readAmt ); invlist.Add(invbill); } - //await _repository.DbContext.BulkInsertAsync(invlist); - //await _repository.DbContext.BulkInsertAsync(groupList); - //await _repository.DbContext.BulkInsertAsync(detailList); - - //if (salist.Count > 0) - //{ - // await _repository.DbContext.BulkUpdateAsync(salist); - //} - //if (adjlist.Count > 0) - //{ - // await _repository.DbContext.BulkUpdateAsync(adjlist); - //} - //if (notDetialList.Count > 0) - //{ - // await _repository.DbContext.BulkInsertAsync(notDetialList); - //} - //_invls = invlist.Select(p => p.InvbillNum).ToList(); + } return detailList;