FSN#41577 Putorders vertragen bij herhaald falende opdrachten
svn path=/Website/branches/v2017.1/; revision=34880
This commit is contained in:
@@ -101,6 +101,39 @@ function send1Order(Bedrijf_key, prs_loc_key, XMLnode, OpdrKey, ordernr, Sender,
|
||||
Log2File(1, "====== Skipping actual sending because of puo_flags");
|
||||
return false;
|
||||
}
|
||||
debugger;
|
||||
// Hoe vaak al mislukt? Steeds minder vaak proberen
|
||||
if (XMLnode == "opdracht" || XMLnode == "bestelopdr") // mislukte contracten tracken we nog niet
|
||||
{
|
||||
var sql = "SELECT fac_tracking_refkey,"
|
||||
+ " fac_srtnotificatie_xmlnode,"
|
||||
+ " fac_srtnotificatie_code,"
|
||||
+ " MIN (fac_tracking_datum) firstdatum,"
|
||||
+ " MAX (fac_tracking_datum) faildatum,"
|
||||
+ " COUNT (*) failcount"
|
||||
+ " FROM fac_tracking ft, fac_srtnotificatie fs"
|
||||
+ " WHERE ft.fac_srtnotificatie_key = fs.fac_srtnotificatie_key"
|
||||
+ " AND ft.fac_tracking_refkey = " + OpdrKey
|
||||
+ " AND fac_srtnotificatie_code = " + (XMLnode == "opdracht" ? "'ORDSNX'" : "'BES2SX'")
|
||||
+ " GROUP BY fac_tracking_refkey, fac_srtnotificatie_xmlnode, fac_srtnotificatie_code"
|
||||
var oRs = Oracle.Execute(sql);
|
||||
if (!oRs.Eof)
|
||||
{
|
||||
var failcount = oRs("failcount").Value;
|
||||
var faildatum = new Date(oRs("faildatum").Value);
|
||||
var firstdatum = new Date(oRs("firstdatum").Value);
|
||||
var backofminutes = Math.min(120, failcount * 10); // Interval tussen pogingen steeds 10 minuten langer, max 2 uur
|
||||
var nextdatum = new Date(faildatum);
|
||||
nextdatum.setMinutes(nextdatum.getMinutes() + backofminutes);
|
||||
if (nextdatum > new Date())
|
||||
{
|
||||
Log2File(1, "Failed " + failcount + " times between " + toDateTimeString(firstdatum) + " and " + toDateTimeString(faildatum) + ", delaying until " + toDateTimeString(nextdatum));
|
||||
Log2File(1, "Failed {0} times between {1} and {2}, delaying until {3}".format(failcount, toDateTimeString(firstdatum), toDateTimeString(faildatum), toDateTimeString(nextdatum)));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
oRs.Close();
|
||||
}
|
||||
|
||||
var sqlB = "SELECT prs_bedrijfadres_url, "
|
||||
+ " prs_bedrijfadres_encoding, "
|
||||
|
||||
Reference in New Issue
Block a user