updfate 20250919
This commit is contained in:
@@ -44,7 +44,7 @@ namespace API_NetFramework.Controllers
|
||||
public int senderror { get; set; } = 0;
|
||||
public string response { get; set; } = "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
public enum uploadtype
|
||||
{
|
||||
@@ -112,7 +112,7 @@ namespace API_NetFramework.Controllers
|
||||
{
|
||||
return Ok(DokumentID);
|
||||
}
|
||||
// db.Get_Tabledata("Select barcodenr from barcodeetikette where dokumentid='" + DokumentID + "'", false, true);
|
||||
// db.Get_Tabledata("Select barcodenr from barcodeetikette where dokumentid='" + DokumentID + "'", false, true);
|
||||
SQL = "Select barcodenr from barcodeetikette where dokumentid=@DokumentID";
|
||||
db.clear_parameter();
|
||||
db.add_parameter("@DokumentID", DokumentID);
|
||||
@@ -154,10 +154,10 @@ namespace API_NetFramework.Controllers
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
string ArchivAktiv;
|
||||
ArchivAktiv= System.Configuration.ConfigurationManager.AppSettings["ArchivierungAktiv"].ToString();
|
||||
ArchivAktiv = System.Configuration.ConfigurationManager.AppSettings["ArchivierungAktiv"].ToString();
|
||||
if (ArchivAktiv != "True")
|
||||
{
|
||||
string message = "Hinweismeldung: "+System.Configuration.ConfigurationManager.AppSettings["ArchivierungNoAktivMessage"].ToString();
|
||||
string message = "Hinweismeldung: " + System.Configuration.ConfigurationManager.AppSettings["ArchivierungNoAktivMessage"].ToString();
|
||||
return Content(HttpStatusCode.OK, message);
|
||||
}
|
||||
try
|
||||
@@ -306,7 +306,8 @@ namespace API_NetFramework.Controllers
|
||||
extension = "PDF";
|
||||
}
|
||||
|
||||
if (!revisionupload) {
|
||||
if (!revisionupload)
|
||||
{
|
||||
if (db.dsdaten.Tables[0].Rows[0]["BpNummer"].ToString() == "")
|
||||
{
|
||||
onbasedoc.personNummer = db.dsdaten.Tables[0].Rows[0]["PersonNummer"].ToString();
|
||||
@@ -334,7 +335,8 @@ namespace API_NetFramework.Controllers
|
||||
onbasedoc.dokumentDatei = pdfdoc;
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
onbasedoc_revision.dokumentHandle = revisionhandle;
|
||||
onbasedoc_revision.dokumentTyp = db.dsdaten.Tables[0].Rows[0]["dokumenttyp"].ToString(); ;
|
||||
onbasedoc_revision.dateiTyp = extension;
|
||||
@@ -344,9 +346,10 @@ namespace API_NetFramework.Controllers
|
||||
onbasedoc_revision.comment = "";
|
||||
foreach (System.Data.DataRow rw in db.dsdaten.Tables[1].Rows)
|
||||
{
|
||||
if (rw[0].ToString() != "Handle") {
|
||||
OnBaseDocUpload.attribute na = new OnBaseDocUpload.attribute(rw["fieldname"].ToString(), rw["fieldvalue"].ToString());
|
||||
onbasedoc_revision.attributes.Add(na);
|
||||
if (rw[0].ToString() != "Handle")
|
||||
{
|
||||
OnBaseDocUpload.attribute na = new OnBaseDocUpload.attribute(rw["fieldname"].ToString(), rw["fieldvalue"].ToString());
|
||||
onbasedoc_revision.attributes.Add(na);
|
||||
}
|
||||
}
|
||||
onbasedoc_revision.dokumentDatei = dok.dokument;
|
||||
@@ -364,8 +367,8 @@ namespace API_NetFramework.Controllers
|
||||
string debugdir = System.Configuration.ConfigurationManager.AppSettings["DebugDir"];
|
||||
string jsonstring = "";
|
||||
if (!revisionupload)
|
||||
{
|
||||
jsonstring = Newtonsoft.Json.JsonConvert.SerializeObject(onbasedoc);
|
||||
{
|
||||
jsonstring = Newtonsoft.Json.JsonConvert.SerializeObject(onbasedoc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -450,7 +453,7 @@ namespace API_NetFramework.Controllers
|
||||
DB db = new DB(connectionstring);
|
||||
db.clear_parameter();
|
||||
db.add_parameter("@dokumentid", dokumentid);
|
||||
|
||||
|
||||
db.Get_Tabledata("[OnDoc_IRIS_Archivierung]", true, false);
|
||||
string returnmessage = db.dsdaten.Tables[0].Rows[0][0].ToString();
|
||||
switch (db.dsdaten.Tables[0].Rows[0][1].ToString())
|
||||
@@ -598,7 +601,7 @@ namespace API_NetFramework.Controllers
|
||||
ilr.StatusCode = 0;
|
||||
ilr.senderror = 0;
|
||||
ilr.response = response;
|
||||
|
||||
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende Transfer to OnBase", LogLevelType.Debug);
|
||||
return Content(HttpStatusCode.OK, ilr);
|
||||
}
|
||||
@@ -611,7 +614,7 @@ namespace API_NetFramework.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private string archiv_sb_doc(string dokumentid, string partnernr, string serienbriefnr, string dokument, string inteintragnr)
|
||||
{
|
||||
OnBaseDocUpload.OnBaseDokument onbasedoc = new OnBaseDocUpload.OnBaseDokument();
|
||||
@@ -660,7 +663,7 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
public IHttpActionResult Send_Versandstrasse(string paketid = "")
|
||||
{
|
||||
|
||||
|
||||
string json_versandpaket = "";
|
||||
if (paketid != "")
|
||||
{
|
||||
@@ -682,9 +685,9 @@ namespace API_NetFramework.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
json_versandpaket = Request.Content.ReadAsStringAsync().Result;
|
||||
json_versandpaket = Request.Content.ReadAsStringAsync().Result;
|
||||
}
|
||||
|
||||
|
||||
Versandpaket versandpaket = new Versandpaket();
|
||||
versandpaket.Dokument = new List<Versanddokument>();
|
||||
versandpaket = JsonConvert.DeserializeObject<Versandpaket>(json_versandpaket);
|
||||
@@ -742,7 +745,7 @@ namespace API_NetFramework.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
oba.BPNummer = versandpaket.partnernr.ToString();
|
||||
oba.DocumentHandle = "";
|
||||
oba.DistributionOption = versandpaket.Versandoption.ToString();
|
||||
@@ -754,11 +757,11 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
|
||||
foreach (Versanddokument vd in versandpaket.Dokument)
|
||||
{
|
||||
{
|
||||
if (versandpaket.isSerienbrief)
|
||||
{
|
||||
string result = "";
|
||||
|
||||
|
||||
inthandle = archiv_sb_doc(vd.DokumentID, vd.Partnernr, versandpaket.sb.serienbriefnr.ToString(), vd.dokument, vd.inteintragnr.ToString());
|
||||
|
||||
int test;
|
||||
@@ -767,56 +770,59 @@ namespace API_NetFramework.Controllers
|
||||
if (!isnumeric || inthandle == "")
|
||||
{
|
||||
ILResponse ilr1 = new ILResponse();
|
||||
ilr1.response = "Dokument IntEIntrag="+vd.inteintragnr.ToString()+" nicht archiviert";
|
||||
ilr1.response = "Dokument IntEIntrag=" + vd.inteintragnr.ToString() + " nicht archiviert";
|
||||
ilr1.senderror = 1;
|
||||
DB db = new DB(connectionstring);
|
||||
db.Exec_SQL("Update OnDoc_Versandstrasse_paket set fehler=1, fehlerdatum=getdate(), fehlerbeschreibung='"+ ilr1.response+"' where id=" + paketid);
|
||||
db.Exec_SQL("Update OnDoc_Versandstrasse_paket set fehler=1, fehlerdatum=getdate(), fehlerbeschreibung='" + ilr1.response + "' where id=" + paketid);
|
||||
return Content(HttpStatusCode.InternalServerError, ilr1.response);
|
||||
}
|
||||
oba.DocumentHandle = inthandle.ToString();
|
||||
DOCGEN.DocGen dg = new DOCGEN.DocGen();
|
||||
versandpaket.finaldoc = dg.geneate_dummy_pdf("VS Serienbrief: Handle "+oba.DocumentHandle.ToString() +" "+ DateTime.Now.ToString("dd.MM.yyyy hh:mm:ss"));
|
||||
versandpaket.finaldoc = dg.geneate_dummy_pdf("VS Serienbrief: Handle " + oba.DocumentHandle.ToString() + " " + DateTime.Now.ToString("dd.MM.yyyy hh:mm:ss"));
|
||||
}
|
||||
else
|
||||
{
|
||||
IHttpActionResult res = ArchivDocFromDatabase(vd.DokumentID, vd.dokument);
|
||||
DB db = new DB(connectionstring);
|
||||
db.clear_parameter();
|
||||
db.add_parameter("@dokumentid", vd.DokumentID);
|
||||
db.Get_Tabledata("sp_get_handle", true, false);
|
||||
|
||||
if (db.dsdaten.Tables[0].Rows.Count > 0)
|
||||
if (!vd.DokumentID.Contains("ATT"))
|
||||
{
|
||||
inthandle = db.dsdaten.Tables[0].Rows[0][0].ToString();
|
||||
int test;
|
||||
bool isnumeric = int.TryParse(inthandle, out test);
|
||||
if (!isnumeric || inthandle=="")
|
||||
IHttpActionResult res = ArchivDocFromDatabase(vd.DokumentID, vd.dokument);
|
||||
DB db = new DB(connectionstring);
|
||||
db.clear_parameter();
|
||||
db.add_parameter("@dokumentid", vd.DokumentID);
|
||||
db.Get_Tabledata("sp_get_handle", true, false);
|
||||
|
||||
if (db.dsdaten.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
inthandle = db.dsdaten.Tables[0].Rows[0][0].ToString();
|
||||
int test;
|
||||
bool isnumeric = int.TryParse(inthandle, out test);
|
||||
if (!isnumeric || inthandle == "")
|
||||
{
|
||||
ILResponse ilr1 = new ILResponse();
|
||||
ilr1.response = "Dokument ID:'" + vd.DokumentID + "' nicht archiviert";
|
||||
ilr1.senderror = 1;
|
||||
db.Exec_SQL("Update OnDoc_Versandstrasse_paket set fehler=1, fehlerdatum=getdate(), fehlerbeschreibung='" + ilr1.response + "' where id=" + paketid);
|
||||
|
||||
return Content(HttpStatusCode.InternalServerError, ilr1.response);
|
||||
}
|
||||
|
||||
oba.DocumentHandle = inthandle;
|
||||
DOCGEN.DocGen dg = new DOCGEN.DocGen();
|
||||
versandpaket.finaldoc = dg.geneate_dummy_pdf("Versandstrasse - DummyDokument - " + DateTime.Now.ToString("dd.MM.yyyy hh:mm:ss"));
|
||||
//versandpaket.finaldoc = "";
|
||||
dg = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
ILResponse ilr1 = new ILResponse();
|
||||
ilr1.response = "Dokument ID:'"+ vd.DokumentID+"' nicht archiviert";
|
||||
ilr1.response = "Dokument ID:'" + vd.DokumentID + "' nicht archiviert";
|
||||
ilr1.senderror = 1;
|
||||
db.Exec_SQL("Update OnDoc_Versandstrasse_paket set fehler=1, fehlerdatum=getdate(), fehlerbeschreibung='" + ilr1.response + "' where id=" + paketid);
|
||||
|
||||
return Content(HttpStatusCode.InternalServerError, ilr1.response);
|
||||
|
||||
}
|
||||
|
||||
oba.DocumentHandle = inthandle;
|
||||
DOCGEN.DocGen dg = new DOCGEN.DocGen();
|
||||
versandpaket.finaldoc=dg.geneate_dummy_pdf("Versandstrasse - DummyDokument - " + DateTime.Now.ToString("dd.MM.yyyy hh:mm:ss"));
|
||||
//versandpaket.finaldoc = "";
|
||||
dg = null;
|
||||
db = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
ILResponse ilr1 = new ILResponse();
|
||||
ilr1.response = "Dokument ID:'" + vd.DokumentID + "' nicht archiviert";
|
||||
ilr1.senderror = 1;
|
||||
db.Exec_SQL("Update OnDoc_Versandstrasse_paket set fehler=1, fehlerdatum=getdate(), fehlerbeschreibung='" + ilr1.response + "' where id=" + paketid);
|
||||
|
||||
return Content(HttpStatusCode.InternalServerError, ilr1.response);
|
||||
|
||||
}
|
||||
db = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -829,15 +835,23 @@ namespace API_NetFramework.Controllers
|
||||
onbasedoc.dokumentDatei = versandpaket.finaldoc;
|
||||
onbasedoc.dateiTyp = "PDF";
|
||||
onbasedoc.attributes = new List<OnBaseDocUpload.attribute>();
|
||||
if (oba.GASCouvert=="") { oba.GASCouvert = "false"; } else { oba.GASCouvert = "true"; }
|
||||
|
||||
onbasedoc.attributes.Add(new OnBaseDocUpload.attribute("Document Handle",oba.DocumentHandle.ToString()));
|
||||
onbasedoc.attributes.Add(new OnBaseDocUpload.attribute("O2O DistributionOption",oba.DistributionOption.ToString()));
|
||||
if (oba.GASCouvert == "") { oba.GASCouvert = "false"; } else { oba.GASCouvert = "true"; }
|
||||
|
||||
onbasedoc.attributes.Add(new OnBaseDocUpload.attribute("Document Handle", oba.DocumentHandle.ToString()));
|
||||
onbasedoc.attributes.Add(new OnBaseDocUpload.attribute("O2O DistributionOption", oba.DistributionOption.ToString()));
|
||||
onbasedoc.attributes.Add(new OnBaseDocUpload.attribute("O2O GasCouvert", oba.GASCouvert.ToString()));
|
||||
onbasedoc.attributes.Add(new OnBaseDocUpload.attribute("O2O Returnaddress", oba.Returnaddress.ToString()));
|
||||
if (System.Configuration.ConfigurationManager.AppSettings["GASSize"].ToString() == "True")
|
||||
{
|
||||
onbasedoc.attributes.Add(new OnBaseDocUpload.attribute("O2O GasSize", oba.GASSize.ToString()));
|
||||
if (oba.GASCouvert.ToString().ToUpper() == "TRUE")
|
||||
{
|
||||
onbasedoc.attributes.Add(new OnBaseDocUpload.attribute("O2O GasSize", oba.GASSize.ToString()));
|
||||
}
|
||||
else
|
||||
{
|
||||
onbasedoc.attributes.Add(new OnBaseDocUpload.attribute("O2O GasSize", ""));
|
||||
}
|
||||
|
||||
}
|
||||
onbasedoc.attributes.Add(new OnBaseDocUpload.attribute("O2O Dochandle", oba.DocumentHandle.ToString()));
|
||||
onbasedoc.attributes.Add(new OnBaseDocUpload.attribute("O2O Status", oba.Status.ToString()));
|
||||
@@ -857,7 +871,7 @@ namespace API_NetFramework.Controllers
|
||||
{
|
||||
if (debugfilename != "")
|
||||
{
|
||||
debugfilename = debugfilename + "VS_"+oba.BPNummer+"_"+DateTime.Now.ToString("yyyyMMddhhmmss")+".json";
|
||||
debugfilename = debugfilename + "VS_" + oba.BPNummer + "_" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".json";
|
||||
System.IO.File.WriteAllText(debugfilename, jsonstring);
|
||||
debugfilename = debugfilename + ".pdf";
|
||||
Helper.clsFileHelper fh = new Helper.clsFileHelper();
|
||||
@@ -876,14 +890,14 @@ namespace API_NetFramework.Controllers
|
||||
APILogging.Log((HttpRequestMessage)Request, "Upload Versandstrasse:" + debugfilename, LogLevelType.Debug);
|
||||
|
||||
//Log nachführen
|
||||
// Update_IL_Log(ref ilr, DokumentID);
|
||||
// Update_IL_Log(ref ilr, DokumentID);
|
||||
if (ilr.senderror == 1)
|
||||
{
|
||||
return Content(HttpStatusCode.InternalServerError, ilr.response);
|
||||
}
|
||||
else
|
||||
{
|
||||
// update_dokumentstatus(debugfilename);
|
||||
// update_dokumentstatus(debugfilename);
|
||||
return Content(HttpStatusCode.OK, oba.BPNummer.ToString() + " *archiviert*");
|
||||
}
|
||||
}
|
||||
@@ -928,7 +942,7 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
APILogging.Log((HttpRequestMessage)Request, "Ende Resend_Versandstrasse: PaketID:" + PaketID, LogLevelType.Debug);
|
||||
|
||||
return Content(HttpStatusCode.NotFound,PaketID);
|
||||
return Content(HttpStatusCode.NotFound, PaketID);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user