From 4667f352bc4b9f337200a722eea21487f9cd972e Mon Sep 17 00:00:00 2001 From: Christian Date: Mon, 1 Jul 2024 12:44:07 +0200 Subject: [PATCH] =?UTF-8?q?Bugfix=20beim=20Speichern=20von=20Rechnungen=20?= =?UTF-8?q?aus=20Rechnungs=C3=BCbersicht,=20Bugfix=20Anzeige=20von=20Ziele?= =?UTF-8?q?n,=20wenn=20=C3=BCbergeordnetes=20Ziel=20gel=C3=B6scht=20wurde?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BeWo/Core/Service/Cache.cs | 3 +- .../Views/Shared/_Layout.cshtml.bak | 401 ------------------ Host/Host.csproj.user | 2 +- .../ZeitdokumentationPlanIstUebersicht.cs | 281 ++++++------ .../ValueListEntryDC_ValueListEntry.cs | 1 + Service/Plugins/AiService.cs | 42 +- .../AccountingServiceImp.cs | 30 +- .../OperationsServiceImp.cs | 14 + Shared/DataContracts/ValueListEntryDC.cs | 3 + 9 files changed, 217 insertions(+), 560 deletions(-) delete mode 100644 BeWoPlanerMobil/Views/Shared/_Layout.cshtml.bak diff --git a/BeWo/Core/Service/Cache.cs b/BeWo/Core/Service/Cache.cs index 837c44ef3..2b4b7c043 100644 --- a/BeWo/Core/Service/Cache.cs +++ b/BeWo/Core/Service/Cache.cs @@ -347,7 +347,8 @@ namespace BeWo.Core.Service } if (ve == null) { - return new ValueListEntryDC {TypeDescription = ""}; + return new ValueListEntryDC {TypeDescription = "", ValueListEntryOid = oid }; + //return new ValueListEntryDC { TypeDescription = "" }; } return ve; } diff --git a/BeWoPlanerMobil/Views/Shared/_Layout.cshtml.bak b/BeWoPlanerMobil/Views/Shared/_Layout.cshtml.bak deleted file mode 100644 index b05495747..000000000 --- a/BeWoPlanerMobil/Views/Shared/_Layout.cshtml.bak +++ /dev/null @@ -1,401 +0,0 @@ -@using BeWoPlanerMobil.Controllers -@using BeWoPlanerMobil.Models - - - - - - - - @ViewBag.Title - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -@using(Html.BeginForm("LogOutAfterSessionTimeout", "Main", FormMethod.Post, new {id="logout-form", css="display:none;"})) -{ - -} - -@if(Model != null) -{ - -} - - - - - - - -@RenderBody() - - diff --git a/Host/Host.csproj.user b/Host/Host.csproj.user index a0002e9f5..769cd8b25 100644 --- a/Host/Host.csproj.user +++ b/Host/Host.csproj.user @@ -3,7 +3,7 @@ BeWo2.0 true - Debug|Any CPU + Release|Any CPU false diff --git a/ReportImp/Fortis/ZeitdokumentationPlanIstUebersicht.cs b/ReportImp/Fortis/ZeitdokumentationPlanIstUebersicht.cs index 97a477d7b..216903336 100644 --- a/ReportImp/Fortis/ZeitdokumentationPlanIstUebersicht.cs +++ b/ReportImp/Fortis/ZeitdokumentationPlanIstUebersicht.cs @@ -57,119 +57,11 @@ namespace Fortis { decimal minuten = pRO.ApprovedFLSPerWeek * 60; - if (minuten < 30) - { - ro.StufeGeplant = ""; - ro.KorridorVon = 0; - ro.KorridorBis = 30; - } - else if (minuten < 60) - { - ro.StufeGeplant = "1"; - ro.KorridorVon = 30; - ro.KorridorBis = 60; - } - else if (minuten < 90) - { - ro.StufeGeplant = "2"; - ro.KorridorVon = 60; - ro.KorridorBis = 90; - } - else if (minuten < 120) - { - ro.StufeGeplant = "3"; - ro.KorridorVon = 90; - ro.KorridorBis = 120; - } - else if (minuten < 150) - { - ro.StufeGeplant = "4"; - ro.KorridorVon = 120; - ro.KorridorBis = 150; - } - else if (minuten < 180) - { - ro.StufeGeplant = "5"; - ro.KorridorVon = 150; - ro.KorridorBis = 180; - } - else if (minuten < 210) - { - ro.StufeGeplant = "6"; - ro.KorridorVon = 180; - ro.KorridorBis = 210; - } - else if (minuten < 240) - { - ro.StufeGeplant = "7"; - ro.KorridorVon = 210; - ro.KorridorBis = 240; - } - else if (minuten < 270) - { - ro.StufeGeplant = "8"; - ro.KorridorVon = 240; - ro.KorridorBis = 270; - } - else if (minuten < 300) - { - ro.StufeGeplant = "9"; - ro.KorridorVon = 270; - ro.KorridorBis = 300; - } - else if (minuten < 330) - { - ro.StufeGeplant = "10"; - ro.KorridorVon = 300; - ro.KorridorBis = 330; - } - else if (minuten < 360) - { - ro.StufeGeplant = "11"; - ro.KorridorVon = 330; - ro.KorridorBis = 360; - } - else if (minuten < 390) - { - ro.StufeGeplant = "12"; - ro.KorridorVon = 360; - ro.KorridorBis = 390; - } - else if (minuten < 420) - { - ro.StufeGeplant = "13"; - ro.KorridorVon = 390; - ro.KorridorBis = 420; - } - else if (minuten < 450) - { - ro.StufeGeplant = "14"; - ro.KorridorVon = 420; - ro.KorridorBis = 450; - } - else if (minuten < 480) - { - ro.StufeGeplant = "15"; - ro.KorridorVon = 450; - ro.KorridorBis = 480; - } - else - { - int stufe = 16; - ro.KorridorVon = 480; - ro.KorridorBis = ro.KorridorVon + 30; - //AXDVG TEST - while (ro.KorridorBis < minuten) - { - stufe++; - ro.KorridorVon += 30; - ro.KorridorBis += 30; - } - - ro.StufeGeplant = String.Format("{0:0}", stufe); - } + ro.StufeGeplant = SetKorridorAndReturnStufe(minuten, out var korridorVon, out var korridorBis); + ro.KorridorVon = korridorVon; + ro.KorridorBis = korridorBis; } ro.AktuellesDatum = DateTime.Now.Date; @@ -197,50 +89,22 @@ namespace Fortis //Stufe IST: - var durchschnittProWoche = ro.DurchschnittProWocheDirekt + ro.DurchschnittProWocheAbgesagt; + var durchschnittProWoche = Math.Round(ro.DurchschnittProWocheDirekt + ro.DurchschnittProWocheAbgesagt, 2); if (!ro.DokuzeitraumStart.HasValue) { ro.StufeIst = "-"; } - else if (durchschnittProWoche < 90) + else { - ro.StufeIst = "< 1"; - } - else if (durchschnittProWoche >= 90 && durchschnittProWoche < 120) - { - ro.StufeIst = "2"; - } - else if (durchschnittProWoche >= 121 && durchschnittProWoche < 165) - { - ro.StufeIst = "3"; - } - else if (durchschnittProWoche >= 166 && durchschnittProWoche <= 225) - { - ro.StufeIst = "4"; - } - else if (durchschnittProWoche >= 226 && durchschnittProWoche <= 300) - { - ro.StufeIst = "5"; - } - else if (durchschnittProWoche >= 301 && durchschnittProWoche <= 420) - { - ro.StufeIst = "6"; - } - else if (durchschnittProWoche > 420) - { - ro.StufeIst = "> 6"; + ro.StufeIst = SetKorridorAndReturnStufe(durchschnittProWoche, out var kv, out var kb); } //Unter STufe: - if (durchschnittProWoche < 90) + if (durchschnittProWoche < ro.KorridorVon) { ro.MinutenProWocheUnterStufe = durchschnittProWoche - ro.KorridorVon; - } - else if (ro.KorridorVon > durchschnittProWoche + 1) - { - ro.MinutenProWocheUnterStufe = durchschnittProWoche + 1 - ro.KorridorVon; - } + } else { ro.MinutenProWocheUnterStufe = 0; @@ -249,11 +113,7 @@ namespace Fortis //Bis Ende Stufe: - if (durchschnittProWoche < 90) - { - ro.MinutenProWocheBisEndeStufe = 0; - } - else if (durchschnittProWoche + 1 >= ro.KorridorVon && durchschnittProWoche < ro.KorridorBis) + if (ro.KorridorVon <= durchschnittProWoche && durchschnittProWoche < ro.KorridorBis) { ro.MinutenProWocheBisEndeStufe = durchschnittProWoche - ro.KorridorBis; } @@ -261,9 +121,9 @@ namespace Fortis //Über Stufe: - if (ro.KorridorBis < durchschnittProWoche) + if (durchschnittProWoche >= ro.KorridorBis) { - ro.MinutenProWocheUeberStufe = (ro.KorridorBis - durchschnittProWoche) * -1; + ro.MinutenProWocheUeberStufe = durchschnittProWoche - ro.KorridorBis; } else { @@ -280,6 +140,125 @@ namespace Fortis } + private string SetKorridorAndReturnStufe(decimal minuten, out decimal korridorVon, out decimal korridorBis) + { + String stufe = ""; + if (minuten < 30) + { + korridorVon = 0; + korridorBis = 30; + } + else if (minuten < 60) + { + stufe = "1"; + korridorVon = 30; + korridorBis = 60; + } + else if (minuten < 90) + { + stufe = "2"; + korridorVon = 60; + korridorBis = 90; + } + else if (minuten < 120) + { + stufe = "3"; + korridorVon = 90; + korridorBis = 120; + } + else if (minuten < 150) + { + stufe = "4"; + korridorVon = 120; + korridorBis = 150; + } + else if (minuten < 180) + { + stufe = "5"; + korridorVon = 150; + korridorBis = 180; + } + else if (minuten < 210) + { + stufe = "6"; + korridorVon = 180; + korridorBis = 210; + } + else if (minuten < 240) + { + stufe = "7"; + korridorVon = 210; + korridorBis = 240; + } + else if (minuten < 270) + { + stufe = "8"; + korridorVon = 240; + korridorBis = 270; + } + else if (minuten < 300) + { + stufe = "9"; + korridorVon = 270; + korridorBis = 300; + } + else if (minuten < 330) + { + stufe = "10"; + korridorVon = 300; + korridorBis = 330; + } + else if (minuten < 360) + { + stufe = "11"; + korridorVon = 330; + korridorBis = 360; + } + else if (minuten < 390) + { + stufe = "12"; + korridorVon = 360; + korridorBis = 390; + } + else if (minuten < 420) + { + stufe = "13"; + korridorVon = 390; + korridorBis = 420; + } + else if (minuten < 450) + { + stufe = "14"; + korridorVon = 420; + korridorBis = 450; + } + else if (minuten < 480) + { + stufe = "15"; + korridorVon = 450; + korridorBis = 480; + } + else + { + int st = 16; + korridorVon = 480; + korridorBis = korridorVon + 30; + + //AXDVG TEST + + while (korridorBis < minuten) + { + st++; + korridorVon += 30; + korridorBis += 30; + } + + stufe = String.Format("{0:0}", st); + } + + return stufe; + } + private void BerechneGesamtSummenIst(ServicesOverviewRO pRO, PlanIstUebersichtRO ro) { if (pRO.CostBearer2SupportConceptList != null && pRO.CostBearer2SupportConceptList.Count > 0) diff --git a/Service/DCEntityMapper/ValueListEntryDC_ValueListEntry.cs b/Service/DCEntityMapper/ValueListEntryDC_ValueListEntry.cs index b2789f251..6d58789f9 100644 --- a/Service/DCEntityMapper/ValueListEntryDC_ValueListEntry.cs +++ b/Service/DCEntityMapper/ValueListEntryDC_ValueListEntry.cs @@ -23,6 +23,7 @@ namespace BeWo.Service.DCEntityMapper pDataContract.ParentOid = pEntity.ParentOid; pDataContract.CatalogOid = pEntity.ValueListEntryOid; pDataContract.Notice = pEntity.Notice; + pDataContract.IsActive = pEntity.IsActive == ActivationTypeId.Active; return pDataContract; } diff --git a/Service/Plugins/AiService.cs b/Service/Plugins/AiService.cs index 0894ec703..9ef238361 100644 --- a/Service/Plugins/AiService.cs +++ b/Service/Plugins/AiService.cs @@ -25,23 +25,56 @@ namespace BeWo.Service.Plugins public AiChatDC CreateAiQueryForServiceRecords(AiChatDC acdc, long cb2scOid, DateTime startdate, DateTime enddate) { String context = CreateContextForServiceRecords(cb2scOid, startdate, enddate); - return CreateWebRequest(acdc, context); + var settings = GetAiSettings(acdc, context); + return CreateAiQuery(acdc, context); } public AiChatDC CreateAiQueryForSingleCustomer(AiChatDC acdc, long customerOid) { String context = ""; - return CreateWebRequest(acdc, context); + return CreateAiQuery(acdc, context); } public AiChatDC CreateAiQueryForObjects(AiChatDC acdc, long objectTid) { String context = ""; - return CreateWebRequest(acdc, context); + return CreateAiQuery(acdc, context); } - public AiChatDC CreateWebRequest(AiChatDC acdc, String context) + public String GetAiSettings(AiChatDC acdc, String context) + { + + using (WebClient client = new WebClient()) + { + String url = "https://ai1.ownsoft.de/osaisettings.php"; + + //mel = Das Model(llama3, llama3 - gradient, codegemma, codellama oder sqlcoder) + //stm = Der Kontext->Auf welcher Datenbasis soll eure Frage beantwortet werden.Kann auch leer sein. + //pmt = Der Prompt->Eure Frage + //opt = Art der Rückgabe(json oder plaintext) + + + var nvc = new NameValueCollection(); + nvc.Add("mel", "llama3-gradient"); + nvc.Add("stm", context); + nvc.Add("pmt", acdc.Prompt); + nvc.Add("opt", "json"); + + //var t = JsonConvert.DeserializeAnonymousType();0 + var definition = new { mel = "", stm = new { pre = "", post = "" }, pmt = new { pre = "", post = "" } }; + var response = client.UploadValues(url, "POST", nvc); + String responseStr = System.Text.Encoding.UTF8.GetString(response); + var json = JsonConvert.DeserializeAnonymousType(responseStr, definition); + + return ""; + } + + return ""; + + } + + public AiChatDC CreateAiQuery(AiChatDC acdc, String context) { using (WebClient client = new WebClient()) @@ -72,6 +105,7 @@ namespace BeWo.Service.Plugins return new AiChatDC { Result = "Das kann ich leider nicht beantworten:)" }; } + public virtual string CreateContextForServiceRecords(long cb2scOid, DateTime startdate, DateTime enddate) { var c2s = DAOFactory.GenericDAO.LoadByID(cb2scOid); diff --git a/Service/ServiceImplementations/AccountingServiceImp.cs b/Service/ServiceImplementations/AccountingServiceImp.cs index 6d276dff4..e658998c2 100644 --- a/Service/ServiceImplementations/AccountingServiceImp.cs +++ b/Service/ServiceImplementations/AccountingServiceImp.cs @@ -561,8 +561,34 @@ namespace BeWo.Service.ServiceImplementations try { var originals = DAOFactory.GenericDAO.LoadByIDs(invoices.Select(i => i.InvoiceBaseOid.Value)); - MapperFactory.InvoiceBaseDC_InvoiceBase.MergeWithEntitys(invoices, originals); - DAOFactory.GenericDAO.Update(originals); + bool macheMerge = true; + foreach (var entity in originals) + { + var dc = invoices.Where(i => i.InvoiceBaseOid == entity.Oid).FirstOrDefault(); + + + if (dc.IsPaid != entity.IsPaid || + dc.IsExported != entity.IsExported || + dc.IsReviewed != entity.IsReviewed || + dc.IsSent != entity.IsSent || + dc.PartialPayment != entity.PartialPayment) + { + //Kann nur über die Rechnungsübersicht geändert werden, daher kein Merge mit dem dc machen! + entity.IsPaid = dc.IsPaid; + entity.IsExported = dc.IsExported; + entity.IsReviewed = dc.IsReviewed; + entity.IsSent = dc.IsSent; + entity.PartialPayment = dc.PartialPayment; + macheMerge = false; + DAOFactory.GenericDAO.Update(entity); + } + } + + if (macheMerge) + { + MapperFactory.InvoiceBaseDC_InvoiceBase.MergeWithEntitys(invoices, originals); + DAOFactory.GenericDAO.Update(originals); + } return originals.Select(e => e.Version.Value).ToList(); } catch (Exception e) diff --git a/Service/ServiceImplementations/OperationsServiceImp.cs b/Service/ServiceImplementations/OperationsServiceImp.cs index c6c1ebbfe..68c733cc8 100644 --- a/Service/ServiceImplementations/OperationsServiceImp.cs +++ b/Service/ServiceImplementations/OperationsServiceImp.cs @@ -2923,6 +2923,20 @@ namespace BeWo.Service.ServiceImplementations { var entryDc = MapperFactory.ValueListEntryDC_ValueListEntry.MapToNewDC(v2o.Entry); entryDc.RatingTypeOid = v2o.RatingTypeOid; + + //CB 1.7.24: Nach nächstem Update wieder rausnehmen: + if (entryDc.ParentOid.HasValue) + { + var p = DAOFactory.GenericDAO.LoadByID(entryDc.ParentOid.Value); + if (p.IsActive != ActivationTypeId.Active) + { + entryDc.Parent = null; + entryDc.ParentOid = null; + } + } + //########### + + dc.Goals.Add(entryDc); } diff --git a/Shared/DataContracts/ValueListEntryDC.cs b/Shared/DataContracts/ValueListEntryDC.cs index 136498ae6..783fef499 100644 --- a/Shared/DataContracts/ValueListEntryDC.cs +++ b/Shared/DataContracts/ValueListEntryDC.cs @@ -38,5 +38,8 @@ namespace BS.Shared.DataContracts [DataMember] public long? CatalogOid { get; set; } + + [DataMember] + public bool IsActive { get; set; } } } \ No newline at end of file