Initial export of Delivery Unit EON_CRM_CONTRACT (24 files)
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"exposed": true,
|
||||||
|
"authentication": [{
|
||||||
|
"method": "Form"
|
||||||
|
}],
|
||||||
|
|
||||||
|
"mime_mapping": [{
|
||||||
|
"extension": "jpg",
|
||||||
|
"mimetype": "image/jpeg"
|
||||||
|
}],
|
||||||
|
"force_ssl": false,
|
||||||
|
"enable_etags": true,
|
||||||
|
"prevent_xsrf": true,
|
||||||
|
"anonymous_connection": null,
|
||||||
|
"cors": [{
|
||||||
|
"enabled": true
|
||||||
|
}],
|
||||||
|
"allowOrigin": ["*"],
|
||||||
|
"cache_control": "no-cache, no-store",
|
||||||
|
"default_file": "index.html"
|
||||||
|
}
|
||||||
@@ -0,0 +1,244 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.0.0",
|
||||||
|
"info": {
|
||||||
|
"version": "1.0-oas3",
|
||||||
|
"title": "E.ON CRM Contract API ",
|
||||||
|
"description": "Mit dieser Schnittstelle werden die Vertragsobjekt-Tabellen (UDO - User Defined Object) in SAP Business One gepflegt. Neue Verträge werden angelegt, existierende Verträg erhalten ein Update. Der Kunde muss in SAP Business One bereits vorhanden sein, dieser wird anhand der CRM-ID gesucht.",
|
||||||
|
"contact": {
|
||||||
|
"email": "t.schmitz@uniorg.de",
|
||||||
|
"name": "Thorsten Schmitz"
|
||||||
|
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "(C) UNIORG Services GmbH",
|
||||||
|
"url": "https://www.uniorg.de"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://xs-eon.rz4u.de/uniorg/eon/crm/contract/v1",
|
||||||
|
"description": "productive"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://xs-test-eon.rz4u.de/uniorg/eon/crm/contract/v1",
|
||||||
|
"description": "development"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"basicAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/setcontract.xsjs": {
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"Contract"
|
||||||
|
],
|
||||||
|
"summary": "Pflege Verträge",
|
||||||
|
"operationId": "setContract",
|
||||||
|
"description": "Hinzufügen oder Aktualisieren eines Vertrags in SAP Business One.",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "successfully received data"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"requestBody": {
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/Contract"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description": "Contract object"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"Contract": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"begin_date": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "2021-09-06T00:00:00.0000000"
|
||||||
|
},
|
||||||
|
"bp_crm": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "10077777"
|
||||||
|
},
|
||||||
|
"contract_id": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "40022222"
|
||||||
|
},
|
||||||
|
"end_date": {
|
||||||
|
"type": "string",
|
||||||
|
"example": ""
|
||||||
|
},
|
||||||
|
"ev_drivers": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"c_id": {
|
||||||
|
"type": "string",
|
||||||
|
"example": ""
|
||||||
|
},
|
||||||
|
"email": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "foo@foo.com"
|
||||||
|
},
|
||||||
|
"eoperate_ID": {
|
||||||
|
"type": "string",
|
||||||
|
"example": ""
|
||||||
|
},
|
||||||
|
"eoperate_valid_from": {
|
||||||
|
"type": "string",
|
||||||
|
"example": ""
|
||||||
|
},
|
||||||
|
"eoperate_valid_to": {
|
||||||
|
"type": "string",
|
||||||
|
"example": ""
|
||||||
|
},
|
||||||
|
"ev_driver": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "20099999"
|
||||||
|
},
|
||||||
|
"ev_driverid": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "38f56277-a20e-0000-0000-000d3ad88589",
|
||||||
|
"maxLength": 36,
|
||||||
|
"minLength": 36
|
||||||
|
},
|
||||||
|
"firstname": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Foo"
|
||||||
|
},
|
||||||
|
"lastname": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Foo"
|
||||||
|
},
|
||||||
|
"license_plate": {
|
||||||
|
"type": "string",
|
||||||
|
"example": ""
|
||||||
|
},
|
||||||
|
"nice_valid_from": {
|
||||||
|
"type": "string",
|
||||||
|
"example": ""
|
||||||
|
},
|
||||||
|
"nice_valid_to": {
|
||||||
|
"type": "string",
|
||||||
|
"example": ""
|
||||||
|
},
|
||||||
|
"parameters": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"component": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "RFID_CARD"
|
||||||
|
},
|
||||||
|
"numeric1": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32",
|
||||||
|
"example": "0"
|
||||||
|
},
|
||||||
|
"numeric2": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32",
|
||||||
|
"example": "0"
|
||||||
|
},
|
||||||
|
"text1": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "n/a"
|
||||||
|
},
|
||||||
|
"text2": {
|
||||||
|
"type": "string",
|
||||||
|
"example": ""
|
||||||
|
},
|
||||||
|
"valid_from": {
|
||||||
|
"type": "string",
|
||||||
|
"example": ""
|
||||||
|
},
|
||||||
|
"valid_to": {
|
||||||
|
"type": "string",
|
||||||
|
"example": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"virta_id": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "1509999"
|
||||||
|
},
|
||||||
|
"virta_valid_from": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "2021-09-05T00:00:00.0000000"
|
||||||
|
},
|
||||||
|
"virta_valid_to": {
|
||||||
|
"type": "string",
|
||||||
|
"example": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"orderid": {
|
||||||
|
"type": "string",
|
||||||
|
"example": ""
|
||||||
|
},
|
||||||
|
"prices": {
|
||||||
|
"type": "array",
|
||||||
|
"nullable": true,
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"factor": {
|
||||||
|
"type": "number",
|
||||||
|
"example": "0.1"
|
||||||
|
},
|
||||||
|
"item": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "BV_COMPENSATION_AC"
|
||||||
|
},
|
||||||
|
"price": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32",
|
||||||
|
"example": "0"
|
||||||
|
},
|
||||||
|
"valid_from": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "2021-11-14T23:00:00.0000000"
|
||||||
|
},
|
||||||
|
"valid_to": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "9999-12-31T00:00:00.000Z"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"product": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "E.ON Drive Easy"
|
||||||
|
},
|
||||||
|
"projectid": {
|
||||||
|
"type": "string",
|
||||||
|
"example": ""
|
||||||
|
},
|
||||||
|
"signature_date": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "2021-09-06T00:00:00.0000000"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {
|
||||||
|
"basicAuth": {
|
||||||
|
"type": "http",
|
||||||
|
"scheme": "basic"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 665 B |
Binary file not shown.
|
After Width: | Height: | Size: 628 B |
@@ -0,0 +1,16 @@
|
|||||||
|
html {
|
||||||
|
box-sizing: border-box;
|
||||||
|
overflow: -moz-scrollbars-vertical;
|
||||||
|
overflow-y: scroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
*,
|
||||||
|
*:before,
|
||||||
|
*:after {
|
||||||
|
box-sizing: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
background: #fafafa;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<!-- HTML for static distribution bundle build -->
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Swagger UI</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="index.css" />
|
||||||
|
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
|
||||||
|
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="swagger-ui"></div>
|
||||||
|
<script src="./swagger-ui-bundle.js" charset="UTF-8"> </script>
|
||||||
|
<script src="./swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
|
||||||
|
<script src="./swagger-initializer.js" charset="UTF-8"> </script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en-US">
|
||||||
|
<head>
|
||||||
|
<title>Swagger UI: OAuth2 Redirect</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
'use strict';
|
||||||
|
function run () {
|
||||||
|
var oauth2 = window.opener.swaggerUIRedirectOauth2;
|
||||||
|
var sentState = oauth2.state;
|
||||||
|
var redirectUrl = oauth2.redirectUrl;
|
||||||
|
var isValid, qp, arr;
|
||||||
|
|
||||||
|
if (/code|token|error/.test(window.location.hash)) {
|
||||||
|
qp = window.location.hash.substring(1).replace('?', '&');
|
||||||
|
} else {
|
||||||
|
qp = location.search.substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
arr = qp.split("&");
|
||||||
|
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';});
|
||||||
|
qp = qp ? JSON.parse('{' + arr.join() + '}',
|
||||||
|
function (key, value) {
|
||||||
|
return key === "" ? value : decodeURIComponent(value);
|
||||||
|
}
|
||||||
|
) : {};
|
||||||
|
|
||||||
|
isValid = qp.state === sentState;
|
||||||
|
|
||||||
|
if ((
|
||||||
|
oauth2.auth.schema.get("flow") === "accessCode" ||
|
||||||
|
oauth2.auth.schema.get("flow") === "authorizationCode" ||
|
||||||
|
oauth2.auth.schema.get("flow") === "authorization_code"
|
||||||
|
) && !oauth2.auth.code) {
|
||||||
|
if (!isValid) {
|
||||||
|
oauth2.errCb({
|
||||||
|
authId: oauth2.auth.name,
|
||||||
|
source: "auth",
|
||||||
|
level: "warning",
|
||||||
|
message: "Authorization may be unsafe, passed state was changed in server. The passed state wasn't returned from auth server."
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (qp.code) {
|
||||||
|
delete oauth2.state;
|
||||||
|
oauth2.auth.code = qp.code;
|
||||||
|
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
|
||||||
|
} else {
|
||||||
|
let oauthErrorMsg;
|
||||||
|
if (qp.error) {
|
||||||
|
oauthErrorMsg = "["+qp.error+"]: " +
|
||||||
|
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
|
||||||
|
(qp.error_uri ? "More info: "+qp.error_uri : "");
|
||||||
|
}
|
||||||
|
|
||||||
|
oauth2.errCb({
|
||||||
|
authId: oauth2.auth.name,
|
||||||
|
source: "auth",
|
||||||
|
level: "error",
|
||||||
|
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server."
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
|
||||||
|
}
|
||||||
|
window.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (document.readyState !== 'loading') {
|
||||||
|
run();
|
||||||
|
} else {
|
||||||
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
run();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
window.onload = function() {
|
||||||
|
//<editor-fold desc="Changeable Configuration Block">
|
||||||
|
|
||||||
|
// the following lines will be replaced by docker/configurator, when it runs in a docker-container
|
||||||
|
window.ui = SwaggerUIBundle({
|
||||||
|
url: "eon_CRM_Contract_API.json",
|
||||||
|
dom_id: '#swagger-ui',
|
||||||
|
deepLinking: true,
|
||||||
|
presets: [
|
||||||
|
SwaggerUIBundle.presets.apis,
|
||||||
|
SwaggerUIStandalonePreset
|
||||||
|
],
|
||||||
|
plugins: [
|
||||||
|
SwaggerUIBundle.plugins.DownloadUrl
|
||||||
|
],
|
||||||
|
layout: "StandaloneLayout"
|
||||||
|
});
|
||||||
|
|
||||||
|
//</editor-fold>
|
||||||
|
};
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,14 @@
|
|||||||
|
CREATE SCHEMA NICEPORTAL;
|
||||||
|
|
||||||
|
CREATE COLUMN TABLE "NICEPORTAL"."UO_CRM_DATA_CONTRACTS" ("ID" BIGINT CS_FIXED NOT NULL ,
|
||||||
|
"ID_MSD" VARCHAR(50) NOT NULL ,
|
||||||
|
"ID_CRM" VARCHAR(30) NOT NULL ,
|
||||||
|
"JSONRAW" NCLOB MEMORY THRESHOLD 1000,
|
||||||
|
"B1_CODE" VARCHAR(50),
|
||||||
|
"CREATE_TS" LONGDATE CS_LONGDATE DEFAULT CURRENT_TIMESTAMP NOT NULL ,
|
||||||
|
"UPDATE_TS" LONGDATE CS_LONGDATE NOT NULL ,
|
||||||
|
"RESPONSE_STATUS" VARCHAR(50),
|
||||||
|
"RESPONSE_MESSAGE" NCLOB MEMORY THRESHOLD 1000,
|
||||||
|
PRIMARY KEY ("ID")) UNLOAD PRIORITY 5 AUTO MERGE;
|
||||||
|
|
||||||
|
CREATE SEQUENCE "NICEPORTAL"."SEQ_CONTRACT_ID";
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
SET SCHEMA "A19753_EON_P01";
|
||||||
|
CREATE VIEW "A19753_EON_P01"."V_UO_LOST_CONTRACT_HISTORY_RECORDS" ( "DocEntry",
|
||||||
|
"ObjType",
|
||||||
|
"DocNum",
|
||||||
|
"U_EON_CONTRACT",
|
||||||
|
"U_EON_PERIOD_FROM",
|
||||||
|
"U_EON_PERIOD_TO",
|
||||||
|
"DocDate",
|
||||||
|
"DocTotal" ) AS select
|
||||||
|
t0."DocEntry" ,
|
||||||
|
t0."ObjType" ,
|
||||||
|
t0."DocNum" ,
|
||||||
|
t0."U_EON_CONTRACT" ,
|
||||||
|
t0."U_EON_PERIOD_FROM" ,
|
||||||
|
t0."U_EON_PERIOD_TO" ,
|
||||||
|
t0."DocDate" ,
|
||||||
|
t0."DocTotal"
|
||||||
|
from OINV t0
|
||||||
|
inner join OUSR t3 on t0."UserSign"=t3."USERID"
|
||||||
|
inner join "@EON_CONTRACT" t1 on t1."DocEntry"=t0."U_EON_CONTRACT"
|
||||||
|
where not exists ( select
|
||||||
|
1
|
||||||
|
from "@EON_CONTRACT_BILL" t2
|
||||||
|
where t0."DocEntry"=t2."U_DOCENTRY"
|
||||||
|
and t0."ObjType"=t2."U_OBJTYPE" )
|
||||||
|
and t0."DocDate" between '20220902' and '20221231'
|
||||||
|
and t0.CANCELED='N'
|
||||||
|
and t3.USER_CODE='XAPP'
|
||||||
|
order by t1."DocEntry",
|
||||||
|
t0."U_EON_PERIOD_FROM",
|
||||||
|
t0."U_EON_PERIOD_TO",
|
||||||
|
t0."DocEntry" WITH READ ONLY;
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,286 @@
|
|||||||
|
var slLib = $.import("uniorg.ServiceLayer", "B1SLLogic");
|
||||||
|
var slDest = $.import("uniorg.destinations", "uodestlib");
|
||||||
|
var datetimelib = $.import("uniorg.libs", "datetime");
|
||||||
|
|
||||||
|
var outMessages = [];
|
||||||
|
var output = {};
|
||||||
|
var outMsg = {};
|
||||||
|
var outStatus = "success";
|
||||||
|
var myDebug = {};
|
||||||
|
var SESSIONID = "";
|
||||||
|
var NODEID = "";
|
||||||
|
var slLoggedIn = false;
|
||||||
|
var UserName = slDest.uniorg_eon_nice_v1_UserName;
|
||||||
|
var UserPass = slDest.uniorg_eon_nice_v1_UserPass;
|
||||||
|
var UserComp = slDest.uniorg_eon_nice_v1_UserComp;
|
||||||
|
var ContractUDOID = "EON_CONTR";
|
||||||
|
|
||||||
|
var service_version = '1.0';
|
||||||
|
|
||||||
|
var debugLevel = 0;
|
||||||
|
switch ($.request.parameters.get("debug")) {
|
||||||
|
case "true":
|
||||||
|
case "yes":
|
||||||
|
case "1":
|
||||||
|
debugLevel = 1;
|
||||||
|
break;
|
||||||
|
case "full":
|
||||||
|
case "2":
|
||||||
|
debugLevel = 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debugLevel > 1) {
|
||||||
|
myDebug.requestParams = $.request.parameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setOutputMessage() {
|
||||||
|
output.status = outStatus;
|
||||||
|
if (debugLevel > 0) {
|
||||||
|
output.debugInfos = myDebug;
|
||||||
|
}
|
||||||
|
output.messages = outMessages;
|
||||||
|
$.response.contentType = "application/json";
|
||||||
|
$.response.setBody(JSON.stringify(output));
|
||||||
|
$.response.status = $.net.http.OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
function exceptionHandler(ex) {
|
||||||
|
if (outMsg.method) {
|
||||||
|
outMessages.push(outMsg);
|
||||||
|
}
|
||||||
|
outMsg = {};
|
||||||
|
outMsg.method = "exceptionHandler";
|
||||||
|
outMsg.status = "error";
|
||||||
|
outMsg.message = ex.toString();
|
||||||
|
if (debugLevel > 0) {
|
||||||
|
outMsg.exceptionInfo = {};
|
||||||
|
outMsg.exceptionInfo.name = ex.name;
|
||||||
|
outMsg.exceptionInfo.message = ex.message;
|
||||||
|
outMsg.exceptionInfo.fileName = ex.fileName;
|
||||||
|
outMsg.exceptionInfo.lineNumber = ex.lineNumber;
|
||||||
|
outMsg.exceptionInfo.columnNumber = ex.columnNumber;
|
||||||
|
outMsg.exceptionInfo.stack = ex.stack;
|
||||||
|
//outMsg.exceptionInfo.source = ex.toSource();
|
||||||
|
}
|
||||||
|
outMessages.push(outMsg);
|
||||||
|
outStatus = "error";
|
||||||
|
output.status = outStatus;
|
||||||
|
if (debugLevel > 0) {
|
||||||
|
output.debugInfos = myDebug;
|
||||||
|
}
|
||||||
|
output.messages = outMessages;
|
||||||
|
|
||||||
|
var errbody = JSON.stringify(output);
|
||||||
|
$.response.contentType = 'application/json';
|
||||||
|
$.response.setBody(errbody);
|
||||||
|
$.response.status = $.net.http.INTERNAL_SERVER_ERROR;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (slLoggedIn) {
|
||||||
|
slLib.SLLogout(SESSIONID, NODEID);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function slLogin() {
|
||||||
|
var loginResult = false;
|
||||||
|
var loginInfo = {};
|
||||||
|
loginInfo.UserName = UserName;
|
||||||
|
loginInfo.Password = UserPass;
|
||||||
|
loginInfo.CompanyDB = UserComp;
|
||||||
|
|
||||||
|
// SL LOGIN
|
||||||
|
var response = slLib.SLLogin(JSON.stringify(loginInfo), null, null);
|
||||||
|
|
||||||
|
// B1SESSION and ROUTEID cookies returned by Login
|
||||||
|
for (var j in response.cookies) {
|
||||||
|
if (response.cookies[j].name == "B1SESSION") {
|
||||||
|
SESSIONID = response.cookies[j].value;
|
||||||
|
//output.SessionID = SESSIONID;
|
||||||
|
} else if (response.cookies[j].name == "ROUTEID") {
|
||||||
|
NODEID = response.cookies[j].value;
|
||||||
|
//output.NodeID = NODEID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var loginResponse;
|
||||||
|
try {
|
||||||
|
loginResponse = JSON.parse(response.body.asString());
|
||||||
|
} catch (e) {
|
||||||
|
loginResponse = response.body.asString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debugLevel > 1) {
|
||||||
|
myDebug.loginInfo = loginInfo;
|
||||||
|
}
|
||||||
|
myDebug.loginResponse = loginResponse;
|
||||||
|
if (response.status === 200) {
|
||||||
|
loginResult = true;
|
||||||
|
} else {
|
||||||
|
outMsg = {};
|
||||||
|
outMsg.method = "login";
|
||||||
|
outMsg.status = "error";
|
||||||
|
outMsg.message = loginResponse;
|
||||||
|
outMessages.push(outMsg);
|
||||||
|
outStatus = "error";
|
||||||
|
}
|
||||||
|
return loginResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getViewData() {
|
||||||
|
var rsMsg = {};
|
||||||
|
var conn = $.db.getConnection();
|
||||||
|
var pstmt;
|
||||||
|
var query =
|
||||||
|
'SELECT "DocEntry", "ObjType", "DocNum", U_EON_CONTRACT, U_EON_PERIOD_FROM, U_EON_PERIOD_TO, "DocDate", "DocTotal" from A19753_EON_P01.V_UO_LOST_CONTRACT_HISTORY_RECORDS';
|
||||||
|
pstmt = conn.prepareStatement(query);
|
||||||
|
var rs = pstmt.executeQuery();
|
||||||
|
var rsmd = rs.getMetaData();
|
||||||
|
var colCount = rsmd.getColumnCount();
|
||||||
|
var rc = 0;
|
||||||
|
var rows = [];
|
||||||
|
while (rs.next()) {
|
||||||
|
var row = {};
|
||||||
|
rc++;
|
||||||
|
for (var c = 1; c <= colCount; c++) {
|
||||||
|
var colName = rsmd.getColumnName(c);
|
||||||
|
var colType = rsmd.getColumnTypeName(c);
|
||||||
|
switch (colType) {
|
||||||
|
case 'TINYINT':
|
||||||
|
case 'SMALLINT':
|
||||||
|
case 'INT':
|
||||||
|
case 'INTEGER':
|
||||||
|
case 'BIGINT':
|
||||||
|
row[colName] = rs.getInteger(c);
|
||||||
|
break;
|
||||||
|
case 'DECIMAL':
|
||||||
|
row[colName] = rs.getDecimal(c);
|
||||||
|
break;
|
||||||
|
case 'REAL':
|
||||||
|
case 'DOUBLE':
|
||||||
|
case 'FLOAT':
|
||||||
|
row[colName] = rs.getDouble(c);
|
||||||
|
break;
|
||||||
|
case 'NVARCHAR':
|
||||||
|
case 'NCHAR':
|
||||||
|
case 'SHORTTEXT':
|
||||||
|
row[colName] = rs.getNString(c);
|
||||||
|
break;
|
||||||
|
case 'VARCHAR':
|
||||||
|
case 'CHAR':
|
||||||
|
row[colName] = rs.getString(c);
|
||||||
|
break;
|
||||||
|
case 'BINARY':
|
||||||
|
case 'VARBINARY':
|
||||||
|
row[colName] = rs.getBString(c);
|
||||||
|
break;
|
||||||
|
case 'DATE':
|
||||||
|
row[colName] = rs.getDate(c);
|
||||||
|
break;
|
||||||
|
case 'TIME':
|
||||||
|
row[colName] = rs.getTime(c);
|
||||||
|
break;
|
||||||
|
case 'TIMESTAMP':
|
||||||
|
row[colName] = rs.getTimestamp(c);
|
||||||
|
break;
|
||||||
|
case 'CLOB':
|
||||||
|
row[colName] = rs.getClob(c);
|
||||||
|
break;
|
||||||
|
case 'NCLOB':
|
||||||
|
case 'TEXT':
|
||||||
|
row[colName] = rs.getNClob(c);
|
||||||
|
break;
|
||||||
|
case 'BLOB':
|
||||||
|
row[colName] = rs.getBlob(c);
|
||||||
|
break;
|
||||||
|
case 'SECONDDATE':
|
||||||
|
row[colName] = rs.getSeconddate(c);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rows.push(row);
|
||||||
|
}
|
||||||
|
rsMsg.rowCount = rc;
|
||||||
|
rsMsg.rows = rows;
|
||||||
|
rs.close();
|
||||||
|
pstmt.close();
|
||||||
|
conn.close();
|
||||||
|
return rsMsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
function repairContractHistory() {
|
||||||
|
var docData = getViewData();
|
||||||
|
myDebug.docData = docData;
|
||||||
|
var startTS = new Date();
|
||||||
|
if (docData.rowCount === 0) {
|
||||||
|
outMsg = {};
|
||||||
|
outMsg.method = "updateContract";
|
||||||
|
outMsg.result = "nothing to do";
|
||||||
|
outMessages.push(outMsg);
|
||||||
|
} else {
|
||||||
|
slLogin();
|
||||||
|
|
||||||
|
outMsg = {};
|
||||||
|
outMsg.method = "updateContract";
|
||||||
|
outMsg.results = [];
|
||||||
|
|
||||||
|
docData.rows.forEach(function(row) {
|
||||||
|
var result = {};
|
||||||
|
var slContractObj = {
|
||||||
|
EON_CONTRACT_BILLCollection: [
|
||||||
|
{
|
||||||
|
U_PERIOD_FROM: datetimelib.convertToISODate(row.U_EON_PERIOD_FROM),
|
||||||
|
U_PERIOD_TO: datetimelib.convertToISODate(row.U_EON_PERIOD_TO),
|
||||||
|
U_DOCDATE: datetimelib.convertToISODate(row.DocDate),
|
||||||
|
U_DOCTOTAL: row.DocTotal,
|
||||||
|
U_OBJTYPE: row.ObjType,
|
||||||
|
U_DOCENTRY: row.DocEntry,
|
||||||
|
U_DOCNUM: row.DocNum
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
result.slContractObj = slContractObj;
|
||||||
|
var responseContract = slLib.patchDynamicEntity('EON_CONTR', row.U_EON_CONTRACT, JSON.stringify(slContractObj), SESSIONID, NODEID,
|
||||||
|
false);
|
||||||
|
if (responseContract.status >= 200 && responseContract.status < 300) {
|
||||||
|
result.status = 'success';
|
||||||
|
} else {
|
||||||
|
result.success = 'failure';
|
||||||
|
outStatus = 'error';
|
||||||
|
if (responseContract.body) {
|
||||||
|
try {
|
||||||
|
result.slResponse = JSON.parse(responseContract.body.asString());
|
||||||
|
} catch (e) {
|
||||||
|
result.slResponse = responseContract.body.asString();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
result.slResponse = responseContract;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
outMsg.results.push(result);
|
||||||
|
});
|
||||||
|
output.durationMilliseconds = new Date() - startTS;
|
||||||
|
outMessages.push(outMsg);
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (slLoggedIn) {
|
||||||
|
slLib.SLLogout(SESSIONID, NODEID);
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//testmain();
|
||||||
|
|
||||||
|
// begin org
|
||||||
|
try {
|
||||||
|
repairContractHistory();
|
||||||
|
} catch (e) {
|
||||||
|
exceptionHandler(e);
|
||||||
|
}
|
||||||
|
setOutputMessage();
|
||||||
|
//ende org
|
||||||
Reference in New Issue
Block a user