From 87f259d0dd3c6dc4523ff9df5b094c4235042fa7 Mon Sep 17 00:00:00 2001 From: 44673626 <44673626@qq.com> Date: Fri, 2 Sep 2022 11:06:21 +0800 Subject: [PATCH] =?UTF-8?q?20220902=E6=B4=BE=E6=A0=BC=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E6=9C=80=E6=96=B0=E4=BB=A3=E7=A0=81=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=EF=BC=8C=E6=96=B0git?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/Prices/PriceListAppService.cs | 3 +- .../Entities/Prices/PriceListAppServiceBJ.cs | 7 ++--- .../Entities/WMS/WMSHQHKanbanAppService.cs | 2 +- .../Entities/WMS/WMSKanbanAppService.cs | 4 +-- .../Entities/WMS/WMSSharePart90AppService.cs | 29 ++++++++++--------- .../SettleAccountApplicationModule.cs | 2 ++ .../Report/FisUpdateStateDapperRepository.cs | 25 ++++++++++++---- .../HQHSettledDetailDapperRepository.cs | 4 +-- .../HQMSettledDetailDapperRepository.cs | 4 +-- .../SettleSparePartDapperReportRepository.cs | 4 +-- .../Services/Report/FisUpdateExportService.cs | 29 +++++++++++++++++-- 11 files changed, 77 insertions(+), 36 deletions(-) diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs index c33ba1f8..0afee3d8 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs @@ -216,7 +216,8 @@ namespace Win.Sfs.SettleAccount.Entities.Prices var entityList = ObjectMapper.Map, List>(result); var _ls = entityList.Where(p=>p.EndDate.ToString().Contains("9999")).OrderByDescending(p => p.BeginDate).GroupBy(p => new { p.MaterialCode, p.CustomerCode,p.Type }).Select(p=>p.FirstOrDefault()); - + //只过滤类型为10的即正常价格,类型为20的是备件价格 + _ls = _ls.Where(p => p.Type == 10).ToList(); foreach (var itm in _ls) { diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs index 1c0cfe76..b0881d7a 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs @@ -170,17 +170,16 @@ namespace Win.Sfs.SettleAccount.Entities.Prices var entityList = ObjectMapper.Map, List>(result); var _ls = entityList.Where(p=>p.EndDate.ToString().Contains("9999")).OrderByDescending(p => p.BeginDate).GroupBy(p => new { p.MaterialCode, p.CustomerCode,p.Type }).Select(p=>p.FirstOrDefault()); + + //只要类型为20的备件价格数据 + _ls = _ls.Where(p => p.Type == 20).ToList(); foreach (var itm in _ls) { itm.Update(GuidGenerator.Create(),version); } - _ls=_ls.Where(p => p.Type == 20).ToList(); - - - await _mng.ImportAsync(_ls.ToList(), version); return ApplicationConsts.SuccessStr; } diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSHQHKanbanAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSHQHKanbanAppService.cs index 99eca55d..56ded856 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSHQHKanbanAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSHQHKanbanAppService.cs @@ -505,7 +505,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts { WmsHQHKanbanOutPutDetial _detail = new WmsHQHKanbanOutPutDetial( GuidGenerator.Create(), - !string.IsNullOrEmpty(itm.WmsBillNum) ? itm.WmsBillNum : string.Empty, + !string.IsNullOrEmpty(itm.WmsBillNum) ? (itm.WmsBillNum.Length > 36 ? "PF" : itm.WmsBillNum) : string.Empty, itm.Kanban, itm.MaterialCode, itm.MaterialDesc, diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs index 03d56af2..9dd49e7b 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs @@ -806,7 +806,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts { WmsKanbanOutPutDetial _detail = new WmsKanbanOutPutDetial( GuidGenerator.Create(), - !string.IsNullOrEmpty(itm.WmsBillNum) ? itm.WmsBillNum : string.Empty, + !string.IsNullOrEmpty(itm.WmsBillNum) ? (itm.WmsBillNum.Length > 36 ? "PF" : itm.WmsBillNum) : string.Empty, itm.Kanban, itm.MaterialCode, @@ -815,7 +815,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts string.Empty, string.Empty, 0, - !string.IsNullOrEmpty(itm.Extend1) ? itm.Extend1 : string.Empty, + !string.IsNullOrEmpty(itm.Extend1) ? itm.Extend1 : string.Empty,//客户物料号 !string.IsNullOrEmpty(itm.Extend2) ? itm.Extend2 : string.Empty, version, itm.MaterialCode, diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePart90AppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePart90AppService.cs index 79ac8e05..14afdc21 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePart90AppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePart90AppService.cs @@ -269,10 +269,10 @@ namespace Win.Sfs.SettleAccount.Entities.WMS string.Empty, string.Empty, 0, - !string.IsNullOrEmpty(p.Extend1) ? p.Extend1 : string.Empty, + !string.IsNullOrEmpty(p.Extend1) ? p.Extend1 : string.Empty,//客户物料号 string.Empty, p.Version, - p.MaterialCode, + p.ParentMaterialCode, _billNum, GuidGenerator.Create(), string.Empty, @@ -318,8 +318,8 @@ namespace Win.Sfs.SettleAccount.Entities.WMS string.Empty, string.Empty, 0, + !string.IsNullOrEmpty(p.Extend1) ? p.Extend1 : string.Empty, string.Empty, - string.Empty, input.Version, p.MaterialCode, _billNum, @@ -512,14 +512,14 @@ namespace Win.Sfs.SettleAccount.Entities.WMS } } - //和物料主数据中SAP物料号检验是否存在 - //foreach (var itm in filteResult) - //{ - // if (!_erpdapperRepository.GetMaterialList().Any(p => p.MaterialCode == itm.MaterialCode)) - // { - // checkList.Add(new ErrorExportDto(version, "大众备件出库单导入", string.Empty, string.Empty, itm.MaterialCode, string.Empty, string.Format("物料主数据不存在当前导入的物料号{0}!", itm.MaterialCode), string.Empty)); - // } - //} + + foreach (var itm in filteResult) + { + if (string.IsNullOrEmpty(itm.Extend1)) + { + checkList.Add(new ErrorExportDto(version, "大众备件出库单导入", string.Empty, string.Empty, string.Empty, string.Empty, string.Format("当前导入订单号{0}存在物料号为空情况,请检查!", itm.OrderBillNum), string.Empty)); + } + } if (checkList.Count > 0) { @@ -532,8 +532,9 @@ namespace Win.Sfs.SettleAccount.Entities.WMS { WmsSharePart90OutPutDetial _detail = new WmsSharePart90OutPutDetial( GuidGenerator.Create(), - //itm.WmsBillNum, - string.Empty, + //itm.WmsBillNum.Length > 36 ? "PF" : itm.WmsBillNum, + !string.IsNullOrEmpty(itm.WmsBillNum) ? (itm.WmsBillNum.Length > 36 ? "PF" : itm.WmsBillNum) : string.Empty, + //string.Empty, itm.OrderBillNum, itm.MaterialCode, @@ -542,7 +543,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS string.Empty, string.Empty, 0, - string.Empty, + !string.IsNullOrEmpty(itm.Extend1) ? itm.Extend1 : string.Empty,//客户物料号 string.Empty, version, itm.ParentMaterialCode, diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs index 257098e2..390c46b4 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs @@ -10,6 +10,7 @@ using Volo.Abp.Dapper; using Win.Abp.Snowflakes; using Volo.Abp.EventBus.RabbitMq; using Volo.Abp.RabbitMQ; +using Volo.Abp.EntityFrameworkCore; namespace Win.Sfs.SettleAccount { @@ -22,6 +23,7 @@ namespace Win.Sfs.SettleAccount typeof(AbpIdentityHttpApiClientModule), typeof(AbpAutoMapperModule), typeof(AbpAspNetCoreMvcModule), + typeof(AbpEntityFrameworkCoreModule), typeof(AbpDapperModule) //typeof(AbpEventBusRabbitMqModule) diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/FisUpdateStateDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/FisUpdateStateDapperRepository.cs index 07245ff9..52d9267e 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/FisUpdateStateDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/FisUpdateStateDapperRepository.cs @@ -23,6 +23,21 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report /// /// 主数据Dapper表 /// + //public class FisUpdateDapperRepository : DapperRepository, ITransientDependency + //{ + // public FisUpdateDapperRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + // { + + // } + // [UnitOfWork(isTransactional: false)] + // public virtual void UpdateFisSettle() + // { + + // DbConnection.Execute("EXEC sp_settle_fis_update", null, null, 1200, null); + + // } + //} + public class FisUpdateDapperRepository : DapperRepository, ITransientDependency { public FisUpdateDapperRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) @@ -30,15 +45,15 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report } [UnitOfWork(isTransactional: false)] - public virtual void UpdateFisSettle() + public virtual void UpdateFisSettle(string version) { - - DbConnection.Execute("EXEC sp_settle_fis_update", null, null, 1200, null); + + DbConnection.Execute(string.Format("EXEC sp_settle_fis_update N'{0}'", version), null, null, 1200, null); } - - } + + } } diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs index 711dba91..f6e28268 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs @@ -1845,7 +1845,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " ) A\n" + " LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" + " ) temp1\n" + - " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode"; + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceListBJ WHERE Version = '202110' and Type=20 ) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode"; var _sql = string.Format(str, version); @@ -1919,7 +1919,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " ) A\n" + " LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" + " ) temp1\n" + - " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode\n" + + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceListBJ WHERE Version = '202110' and Type=20 ) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode\n" + " LEFT JOIN (\n" + " SELECT SUM\n" + " ( Amt ) / SUM ( Qty ) AS Price,\n" + diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQMSettledDetailDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQMSettledDetailDapperRepository.cs index 2b402a17..5653d38f 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQMSettledDetailDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQMSettledDetailDapperRepository.cs @@ -114,7 +114,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " ( a.HQMKanBan <> 'BJ' ) \n" + " AND a.Version= '{0}' {1} \n" + " ) AS temp1\n" + - " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode"; + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) and Type=10) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode"; var _sql = string.Format(str, version, condition); var _query = DbConnection.Query(_sql, null, null, true, 1200, null); @@ -206,7 +206,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " ) A\n" + " LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" + " ) temp1\n" + - " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode"; + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceListBJ WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) and Type=20 ) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode"; var _sql = string.Format(str, version, condition); var _query = DbConnection.Query(_sql, null, null, true, 1200, null); diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs index 61401990..d14e2961 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs @@ -1332,7 +1332,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " ) AS temp1\n" + " LEFT JOIN ( SELECT * FROM set_backQty ) temp3 ON temp1.采购订单号 = temp3.Code \n" + " AND temp1.SAP编码= temp3.MaterialCode\n" + -" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n" + +" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceListBJ WHERE Version = '202110' and Type=20 ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n" + " ) unint1 UNION ALL\n" + "SELECT\n" + " * \n" + @@ -1389,7 +1389,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " ) AS temp1\n" + " LEFT JOIN ( SELECT * FROM set_backQty ) temp3 ON temp1.采购订单号 = temp3.Code \n" + " AND temp1.SAP编码= temp3.MaterialCode\n" + -" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n" + +" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceListBJ WHERE Version = '202110' and Type=20 ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n" + " ) unint2;"; diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/FisUpdateExportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/FisUpdateExportService.cs index de28ddc2..3e59b89d 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/FisUpdateExportService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/FisUpdateExportService.cs @@ -11,6 +11,27 @@ using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report; namespace SettleAccount.Job.Services.Report { + //public class FisUpdateExportService : ITransientDependency, IExportJob + //{ + // private readonly FisUpdateDapperRepository _dapperRepository; + + + // public FisUpdateExportService( + + // FisUpdateDapperRepository dapperRepository + + // ) + // { + // _dapperRepository = dapperRepository; + // } + // [UnitOfWork(isTransactional: false)] + // public string ExportFile(Guid id, List exportName, List property) + // { + // _dapperRepository.UpdateFisSettle(); + // return id.ToString(); + // } + //} + public class FisUpdateExportService : ITransientDependency, IExportJob { private readonly FisUpdateDapperRepository _dapperRepository; @@ -19,15 +40,17 @@ namespace SettleAccount.Job.Services.Report public FisUpdateExportService( FisUpdateDapperRepository dapperRepository - + ) { _dapperRepository = dapperRepository; } [UnitOfWork(isTransactional: false)] - public string ExportFile(Guid id, List exportName, List property) + public string ExportFile(Guid id, List exportName, List p_list) { - _dapperRepository.UpdateFisSettle(); + var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value; + + _dapperRepository.UpdateFisSettle(version); return id.ToString(); } }