MARX#62647: Koppeling AX365 - Mareon (Push): Instelling van Communicatie logboek

svn path=/Mareon/trunk/; revision=49401
This commit is contained in:
Marcel Bourseau
2021-01-12 16:37:49 +00:00
parent e42b008544
commit 89efa1f42d
11 changed files with 65 additions and 71 deletions

View File

@@ -7,7 +7,8 @@
function A2012_UpdatePurchStatus(v_company_id, v_statuscode, v_purchId, v_extraInfo, v_dateTime)
{
v_resp = "";
//default gaan we ervan uit dat de communcatie goed verloopt (lekker positief ingesteld ;-)
var v_resp = {api_status_code: 1, api_status_message: "", api_response_message: ""};
if (G_mar_communicatielogboek == 1){
// Alleen als het communicatielogboek bij de klant is ingericht kunnen/mogen deze calls worden uitgevoerd!

View File

@@ -26,38 +26,57 @@
// " statusDateTime" : "2020-07-04T06:00:00Z"
//}
function A365_StatusLog(v_company_id, v_statuscode, v_purchId, v_extraInfo, v_dateTime)
// v_company_id is AX365 bedrijf-id
// v_statuscode is een van de vaste/afgesproken (ketenstandaard) statuscode, bv ACC, GER, etc
// v_purchId is het opdracht/ION nr van AX365
// v_extraInfo is optionele tekst
// v_dateTime is datum/tijd veld die bij sommige statuscodes verplicht is, bv bij die van GER (gereeddatum/tijd)
// v_communicatie_logboek_vereist(waarde 0/1) geeft aan of in AX365 het zg. "communicatielogboek" moet zijn ingericht (nee=0, ja=1) voor betreffende status 'v_statuscode',
// wanneer waarde 0 dan altijd communicatie, en bij waarde 1 betekent dat G_mar_communicatielogboek moet aanstaan, zo niet, dan wordt de status niet aan AX365 gestuurd (maar geskipt)
function A365_StatusLog(v_company_id, v_statuscode, v_purchId, v_extraInfo, v_dateTime, v_communicatie_logboek_vereist)
{
//default gaan we ervan uit dat de communcatie goed verloopt (lekker positief ingesteld ;-)
var v_resp = {api_status_code: 1, api_status_message: "", api_response_message: ""};
if (v_communicatie_logboek_vereist == 0 || G_mar_communicatielogboek == 1){
var v_API = "api/v0.1/" + v_company_id + "/StatusLog";
if (v_dateTime == "-1"){
// met v_dateTime gelijk aan -1 willen we de datumtime xml niet opnemen in de request!
v_dateTime = "";
}
else{
// en anders wordt in de request wel een datum-xml gedeelte meegestuurd...
if (v_dateTime != ""){
v_dateTime = v_dateTime + "Z";
// Gedeelte van het URL pad naar de webservice "StatusLog"
var v_API = "api/v0.1/" + v_company_id + "/StatusLog";
if (v_dateTime == "-1"){
// met v_dateTime gelijk aan -1 willen we de datumtime xml niet opnemen in de request!
v_dateTime = "";
}
else{
v_dateTime = "1900-01-01T00:00:00Z";
}
// en anders wordt in de request wel een datum-xml gedeelte meegestuurd...
if (v_dateTime != ""){
v_dateTime = v_dateTime + "Z";
}
else{
v_dateTime = "1900-01-01T00:00:00Z";
}
}
var l_json_data =
{entityName: "PurchaseOrder",
entityId: v_purchId,
statusCode: v_statuscode,
description: v_extraInfo,
statusDateTime: v_dateTime
}
var v_req = JSON.stringify(l_json_data, null, 2);
var v_type = 0;
var v_soapAction = "";
var v_discard_active_abort = 1; //In geval van 500-error, geen active abort...
var v_soort_api = 2;
var v_resp = apiAX_GENERAL(v_API, v_req, v_type, v_soapAction, v_discard_active_abort, v_soort_api);
}
else {
__Log("GEEN Communicatielogboek",2);
}
var l_json_data =
{entityName: "PurchaseOrder",
entityId: v_purchId,
statusCode: v_statuscode,
description: v_extraInfo,
statusDateTime: v_dateTime
}
var v_req = JSON.stringify(l_json_data, null, 2);
var v_type = 0;
var v_soapAction = "";
var v_discard_active_abort = 1; //In geval van 500-error, geen active abort...
var v_soort_api = 2;
var v_resp = apiAX_GENERAL(v_API, v_req, v_type, v_soapAction, v_discard_active_abort, v_soort_api);
return v_resp;
}

View File

@@ -6,7 +6,8 @@
function A_UpdatePurchStatus(v_company_id, v_statuscode, v_purchId, v_extraInfo, v_dateTime)
{
v_resp = "";
//default gaan we ervan uit dat de communcatie goed verloopt (lekker positief ingesteld ;-)
var v_resp = {api_status_code: 1, api_status_message: "", api_response_message: ""};
if (G_mar_communicatielogboek == 1){
// Alleen als het communicatielogboek bij de klant is ingericht kunnen/mogen deze calls worden uitgevoerd!

View File

@@ -93,7 +93,7 @@ function GEN_AcceptServiceTask(v_company_id, v_taskId, v_externnr, v_mld_opdr_ex
v_resp = A2012_AcceptServiceTask (v_company_id, v_taskId, v_mld_opdr_extrainfo);
}
if (AX_or_Tobias() == "A365") {
v_resp = A365_StatusLog(v_company_id, "ACC", v_externnr, v_mld_opdr_extrainfo, "-1");
v_resp = A365_StatusLog(v_company_id, "ACC", v_externnr, v_mld_opdr_extrainfo, "-1", 0);
}
if (AX_or_Tobias() == "T") {
v_resp = T_AcceptServiceTask (v_company_id, v_taskId, "Ja");
@@ -121,7 +121,7 @@ function GEN_RefuseServiceTask(v_company_id, v_taskId, v_externnr, v_code_geweig
v_resp = A2012_RefuseServiceTask (v_company_id, v_taskId, v_code_geweigerd, v_mld_opdr_extrainfo);
}
if (AX_or_Tobias() == "A365") {
v_resp = A365_StatusLog(v_company_id, "WEI", v_externnr, v_mld_opdr_extrainfo, "-1");
v_resp = A365_StatusLog(v_company_id, "WEI", v_externnr, v_mld_opdr_extrainfo, "-1", 0);
}
if (AX_or_Tobias() == "T") {
v_resp = T_AcceptServiceTask (v_company_id, v_taskId, "Nee");
@@ -148,7 +148,7 @@ function GEN_AnnuleerServiceTask(v_company_id, v_statuscode, v_externnr, v_mld_o
v_resp = A2012_UpdatePurchStatus(v_company_id, v_statuscode, v_externnr, v_mld_opdr_extrainfo, v_date);
}
if (AX_or_Tobias() == "A365") {
v_resp = A365_StatusLog(v_company_id, v_statuscode, v_externnr, v_mld_opdr_extrainfo, "-1");
v_resp = A365_StatusLog(v_company_id, v_statuscode, v_externnr, v_mld_opdr_extrainfo, "-1", 1);
}
if (AX_or_Tobias() == "T") {
v_resp = {api_status_code: 1, api_status_message: "", api_response_message: ""};

View File

@@ -70,7 +70,7 @@ function GEN_CompleteServiceTask(v_company_id, v_taskId, v_externnr, v_extraInfo
v_resp = A2012_CompleteServiceTask (v_company_id, v_taskId, v_dateComplete, v_extraInfo);
}
if (AX_or_Tobias() == "A365") {
v_resp = A365_StatusLog(v_company_id, "GER", v_externnr, v_extraInfo, v_dateComplete);
v_resp = A365_StatusLog(v_company_id, "GER", v_externnr, v_extraInfo, v_dateComplete, 0);
}
if (AX_or_Tobias() == "T") {
v_resp = T_CompleteServiceTask (v_company_id, v_taskId, v_dateComplete);

View File

@@ -70,7 +70,7 @@ function GEN_PlanServiceTask(v_company_id, v_taskId, v_externnr, v_extraInfo, v_
v_resp = A2012_PlanServiceTask (v_company_id, v_taskId, v_date, v_extraInfo);
}
if (AX_or_Tobias() == "A365") {
v_resp = A365_StatusLog(v_company_id, "AFH", v_externnr, v_extraInfo, v_date);
v_resp = A365_StatusLog(v_company_id, "AFH", v_externnr, v_extraInfo, v_date, 0);
}
if (AX_or_Tobias() == "T") {
v_resp = T_PlanServiceTask (v_company_id, v_taskId, v_date);

View File

@@ -69,7 +69,7 @@ function GEN_OnderbreekServiceTask(v_company_id, v_statuscode, v_externnr, v_ext
v_resp = A2012_UpdatePurchStatus(v_company_id, v_statuscode, v_externnr, v_extraInfo, v_date);
}
if (AX_or_Tobias() == "A365") {
v_resp = A365_StatusLog(v_company_id, v_statuscode, v_externnr, v_extraInfo, v_date);
v_resp = A365_StatusLog(v_company_id, v_statuscode, v_externnr, v_extraInfo, v_date, 1);
}
if (AX_or_Tobias() == "T") {
v_resp = {api_status_code: 1, api_status_message: "", api_response_message: ""};

View File

@@ -67,7 +67,7 @@ function GEN_SetSupplierText(v_company_id, v_taskId, v_externnr, v_extraInfo)
v_resp = A2012_SetSupplierText(v_company_id, v_taskId, v_extraInfo);
}
if (AX_or_Tobias() == "A365") {
v_resp = A365_StatusLog(v_company_id, "", v_externnr, v_extraInfo, "-1");
v_resp = A365_StatusLog(v_company_id, "INF", v_externnr, v_extraInfo, "-1", 0);
}
if (AX_or_Tobias() == "T") {
v_resp = T_SetSupplierText(v_company_id, v_taskId, v_extraInfo);

View File

@@ -174,13 +174,7 @@ function do_exec_opdrstatus(p_order){
// Communciatie vorige GEN_SetSupplierText is goed verlopen
if (l_mld_statusopdr_key == 8 && l_mld_opdr_halted == 1 && l_mld_opdr_onderbreek_code != ""){
// status is 8 (=geaccepteerd), halted is 1 (=onderbroken), en flexprop "onderbeekcode" is gevuld
if (G_mar_communicatielogboek == 1){
l_response = GEN_OnderbreekServiceTask(l_ax_company_id, l_mld_opdr_onderbreek_code, l_mld_opdr_externnr, l_mld_opdr_opmerking, "-1");
}
else {
//Communicatielogboek staat UIT, dan geen actie, maar wel uit queue laten verwijderen, dus status_code 1 teruggeven:
l_response = {api_status_code: 1, api_status_message: "", api_response_message: ""};
}
l_response = GEN_OnderbreekServiceTask(l_ax_company_id, l_mld_opdr_onderbreek_code, l_mld_opdr_externnr, l_mld_opdr_opmerking, "-1");
}
}
// 3. bijlage(n)
@@ -205,39 +199,18 @@ function do_exec_opdrstatus(p_order){
break;
case "ORDPL2":
// Gewijzigde Eind Plandatum bij opdracht
if (G_mar_communicatielogboek == 1){
//Communicatielogboek staat AAN
l_response = GEN_VerlengServiceTask(l_ax_company_id, "VER", l_mld_opdr_externnr, l_mld_opdr_opmerking, l_mld_opdr_plandatum2);
}
else {
//Communicatielogboek staat UIT, dan geen actie, maar wel uit queue laten verwijderen, dus status_code 1 teruggeven:
l_response = {api_status_code: 1, api_status_message: "", api_response_message: ""};
}
// Gewijzigde Eind Plandatum bij opdracht
l_response = GEN_VerlengServiceTask(l_ax_company_id, "VER", l_mld_opdr_externnr, l_mld_opdr_opmerking, l_mld_opdr_plandatum2);
break;
case "ORDHLT":
// Opdracht is onderbroken
if (G_mar_communicatielogboek == 1){
//Communicatielogboek staat AAN
l_response = GEN_OnderbreekServiceTask(l_ax_company_id, l_mld_opdr_onderbreek_code, l_mld_opdr_externnr, l_mld_opdr_opmerking, "-1");
}
else {
//Communicatielogboek staat UIT, dan geen actie, maar wel uit queue laten verwijderen, dus status_code 1 teruggeven:
l_response = {api_status_code: 1, api_status_message: "", api_response_message: ""};
}
// Opdracht is onderbroken
l_response = GEN_OnderbreekServiceTask(l_ax_company_id, l_mld_opdr_onderbreek_code, l_mld_opdr_externnr, l_mld_opdr_opmerking, "-1");
break;
case "ORDRSM":
// Opdracht is in uitvoering gezet
if (G_mar_communicatielogboek == 1){
//Communicatielogboek staat AAN
l_response = GEN_UitvoeringServiceTask(l_ax_company_id, "UIT", l_mld_opdr_externnr, l_mld_opdr_opmerking, "-1");
}
else {
//Communicatielogboek staat UIT, dan geen actie, maar wel uit queue laten verwijderen, dus status_code 1 teruggeven:
l_response = {api_status_code: 1, api_status_message: "", api_response_message: ""};
}
l_response = GEN_UitvoeringServiceTask(l_ax_company_id, "UIT", l_mld_opdr_externnr, l_mld_opdr_opmerking, "-1");
break;
case "ORDCAN":

View File

@@ -65,7 +65,7 @@ function GEN_UitvoeringServiceTask(v_company_id, v_statuscode, v_externnr, v_ext
v_resp = A2012_UpdatePurchStatus(v_company_id, v_statuscode, v_externnr, v_extraInfo, v_date);
}
if (AX_or_Tobias() == "A365") {
v_resp = A365_StatusLog(v_company_id, v_statuscode, v_externnr, v_extraInfo, v_date);
v_resp = A365_StatusLog(v_company_id, v_statuscode, v_externnr, v_extraInfo, v_date, 1);
}
if (AX_or_Tobias() == "T") {
v_resp = {api_status_code: 1, api_status_message: "", api_response_message: ""};

View File

@@ -68,7 +68,7 @@ function GEN_VerlengServiceTask(v_company_id, v_statuscode, v_externnr, v_extraI
v_resp = A2012_UpdatePurchStatus(v_company_id, v_statuscode, v_externnr, v_extraInfo, v_date);
}
if (AX_or_Tobias() == "A365") {
v_resp = A365_StatusLog(v_company_id, v_statuscode, v_externnr, v_extraInfo, v_date);
v_resp = A365_StatusLog(v_company_id, v_statuscode, v_externnr, v_extraInfo, v_date, 1);
}
if (AX_or_Tobias() == "T") {
v_resp = {api_status_code: 1, api_status_message: "", api_response_message: ""};