Merge branch 'main' of https://gitea.grupoginseng.com.br/andrey.cunha/fluig
This commit is contained in:
commit
0bf4065e68
4
Transferência Ginseng/.vscode/servers.json
vendored
4
Transferência Ginseng/.vscode/servers.json
vendored
@ -2,13 +2,13 @@
|
||||
"version": "1.0.0",
|
||||
"configurations": [
|
||||
{
|
||||
"id": "1v6yi27yg82mmzgeg2todjqzi42g7",
|
||||
"id": "5i6o3b75rrmmn0z5dbms6ldputs2v",
|
||||
"name": "teste",
|
||||
"host": "comerciode188007.fluig.cloudtotvs.com.br",
|
||||
"ssl": true,
|
||||
"port": 443,
|
||||
"username": "andrey.cunha",
|
||||
"password": "eyJpdiI6Ijk2Mzg4MGUwODVkYTVkZmI0YjQ2ZTdmNmNlYTJlMGI2Iiwic2FsdCI6ImI0ODMzZTAyNDkxNWYzNGFkNDVkYjE5ZThkMGNlOTM3IiwidGV4dCI6IjY3NDBmZjM2MTE1YjhiODAyM2IzYjVjZDYyYzEwYWRiIn0=",
|
||||
"password": "eyJpdiI6ImE1ZmNlY2U2NjVlMjFlMzJiM2U1NzFjM2RlNTU3NDQyIiwic2FsdCI6ImU5ZDQ5MWUzNjA5OWZmYmFlZjgxZTRmODFmM2M1ZDNlIiwidGV4dCI6IjRkYTIxY2E1Mjg0ZDkxNTkzZTk0MTliYTljZGQ1ZjUzIn0=",
|
||||
"userCode": "andrey.cunha",
|
||||
"confirmExporting": false,
|
||||
"hasBrowser": false,
|
||||
|
||||
3
Transferência Ginseng/.vscode/settings.json
vendored
3
Transferência Ginseng/.vscode/settings.json
vendored
@ -1,3 +1,4 @@
|
||||
{
|
||||
"totvsLanguageServer.welcomePage": false
|
||||
"totvsLanguageServer.welcomePage": false,
|
||||
"totvsLanguageServer.editor.linter.includes": "C:\\25-04-14-P12-SMARTCLIENT_BUILD 20.3.2.12_WINDOWS_X64\\include"
|
||||
}
|
||||
@ -18,7 +18,7 @@ function createDataset(fields, constraints, sortFields) {
|
||||
var clientService = fluigAPI.getAuthorizeClientService();
|
||||
var data = {
|
||||
companyId: String(getValue("WKCompany") || "1"),
|
||||
serviceCode: "GINSENG APITESTE", // ajuste para o codigo do servico cadastrado no Fluig
|
||||
serviceCode: "GINSENG API", // ajuste para o codigo do servico cadastrado no Fluig
|
||||
endpoint: "/base_pdvs",
|
||||
method: "get",
|
||||
timeoutService: "60000",
|
||||
@ -236,7 +236,7 @@ function invokeAuthorizedGet(clientService, endpoint, auth) {
|
||||
|
||||
var data = {
|
||||
companyId: String(getValue("WKCompany") || "1"),
|
||||
serviceCode: "GINSENG APITESTE",
|
||||
serviceCode: "GinsengAPI2",
|
||||
endpoint: endpoint,
|
||||
method: "get",
|
||||
timeoutService: "30000",
|
||||
|
||||
@ -6,10 +6,16 @@ function defineStructure() {
|
||||
addColumn("sku");
|
||||
addColumn("brand");
|
||||
addColumn("ncmId");
|
||||
addColumn("categoria");
|
||||
}
|
||||
|
||||
function onSync(lastSyncDate) {}
|
||||
|
||||
var GB_TOKEN_URL = "https://api.grupoboticario.com.br/global/v2/jwt-token/token";
|
||||
var GB_STRATEGICS_URL = "https://api.grupoboticario.com.br/global/v1/franchising/gb-stores-data/product/classification/strategics";
|
||||
var DEFAULT_GB_CLIENT_ID = "88ymKwAUNfu06sD85i0RiokCxWGSkFBkx9ytgI5y1ZKxX3OQ";
|
||||
var DEFAULT_GB_CLIENT_SECRET = "YDFz43qAzL6ApNIKVCxu3dAmS9GWOqJbcc2aPnFDkmEaBXexSpsHGfcItg56i2dE";
|
||||
|
||||
function createDataset(fields, constraints, sortFields) {
|
||||
var dataset = DatasetBuilder.newDataset();
|
||||
dataset.addColumn("Code");
|
||||
@ -19,6 +25,7 @@ function createDataset(fields, constraints, sortFields) {
|
||||
dataset.addColumn("sku");
|
||||
dataset.addColumn("brand");
|
||||
dataset.addColumn("ncmId");
|
||||
dataset.addColumn("categoria");
|
||||
|
||||
try {
|
||||
var filtro = parseConstraints(constraints);
|
||||
@ -62,6 +69,8 @@ function createDataset(fields, constraints, sortFields) {
|
||||
|
||||
var searchNorm = normalize(filtro.search);
|
||||
var maxRows = filtro.maxRows;
|
||||
var categoryMap = null;
|
||||
var categoryDiag = "";
|
||||
|
||||
for (var i = 0; i < itens.length; i++) {
|
||||
var item = itens[i] || {};
|
||||
@ -77,7 +86,17 @@ function createDataset(fields, constraints, sortFields) {
|
||||
var desc = trim(item.description);
|
||||
var codigoDescricao = code + " - " + desc;
|
||||
var brand = trim(item.brand);
|
||||
var blob = normalize([code, desc, brand, trim(item.id)].join(" "));
|
||||
var categoria = trim(item.strategicDescription || item.strategic_description || item.categoria);
|
||||
if (!categoria) {
|
||||
if (categoryMap == null) {
|
||||
var categorization = loadStrategicCategoryMap(constraints, 30000);
|
||||
categoryMap = categorization.map || {};
|
||||
categoryDiag = categorization.diag || "";
|
||||
}
|
||||
var strategicId = resolveStrategicId(item, code);
|
||||
categoria = resolveCategory(categoryMap, strategicId);
|
||||
}
|
||||
var blob = normalize([code, desc, brand, trim(item.id), categoria].join(" "));
|
||||
|
||||
if (searchNorm && searchNorm.length >= 2 && blob.indexOf(searchNorm) === -1) {
|
||||
continue;
|
||||
@ -90,7 +109,8 @@ function createDataset(fields, constraints, sortFields) {
|
||||
desc,
|
||||
code,
|
||||
brand,
|
||||
trim(item.ncmId)
|
||||
trim(item.ncmId),
|
||||
categoria
|
||||
]);
|
||||
|
||||
if (dataset.rowsCount >= maxRows) {
|
||||
@ -99,7 +119,8 @@ function createDataset(fields, constraints, sortFields) {
|
||||
}
|
||||
|
||||
if (dataset.rowsCount === 0) {
|
||||
addDiagRow(dataset, "Sem produtos apos filtros (busca: " + filtro.search + ")");
|
||||
var suffix = categoryDiag ? " | Categoria: " + categoryDiag : "";
|
||||
addDiagRow(dataset, "Sem produtos apos filtros (busca: " + filtro.search + ")" + suffix);
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
@ -126,9 +147,10 @@ function parseConstraints(constraints) {
|
||||
if (!c || !c.fieldName) continue;
|
||||
|
||||
var name = String(c.fieldName);
|
||||
var lowerName = name.toLowerCase();
|
||||
var value = cleanSearchValue(c.initialValue);
|
||||
|
||||
if (name === "sqlLimit") {
|
||||
if (lowerName === "sqllimit") {
|
||||
var n = parseInt(value, 10);
|
||||
if (!isNaN(n) && n > 0 && n <= 1000) {
|
||||
out.maxRows = n;
|
||||
@ -138,9 +160,13 @@ function parseConstraints(constraints) {
|
||||
|
||||
if (
|
||||
value &&
|
||||
name !== "metadata#id" &&
|
||||
name !== "metadata#active" &&
|
||||
name !== "sqlLimit"
|
||||
lowerName !== "metadata#id" &&
|
||||
lowerName !== "metadata#active" &&
|
||||
lowerName !== "sqllimit" &&
|
||||
lowerName !== "gbclientid" &&
|
||||
lowerName !== "gbclientsecret" &&
|
||||
lowerName !== "clientid" &&
|
||||
lowerName !== "clientsecret"
|
||||
) {
|
||||
if (!out.search || value.length > out.search.length) {
|
||||
out.search = value;
|
||||
@ -209,6 +235,205 @@ function extractItems(obj) {
|
||||
return [];
|
||||
}
|
||||
|
||||
function getConstraintValue(constraints, fieldName) {
|
||||
if (!constraints || !fieldName) return "";
|
||||
var target = String(fieldName).toLowerCase();
|
||||
for (var i = 0; i < constraints.length; i++) {
|
||||
var c = constraints[i];
|
||||
if (!c || !c.fieldName) continue;
|
||||
if (String(c.fieldName).toLowerCase() === target) {
|
||||
return c.initialValue;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
function resolveGbCredentials(constraints) {
|
||||
var clientId = trim(getConstraintValue(constraints, "gbClientId"));
|
||||
if (!clientId) clientId = trim(getConstraintValue(constraints, "clientId"));
|
||||
if (!clientId) {
|
||||
try { clientId = trim(java.lang.System.getenv("GB_CLIENT_ID")); } catch (e1) {}
|
||||
}
|
||||
if (!clientId) clientId = DEFAULT_GB_CLIENT_ID;
|
||||
|
||||
var clientSecret = trim(getConstraintValue(constraints, "gbClientSecret"));
|
||||
if (!clientSecret) clientSecret = trim(getConstraintValue(constraints, "clientSecret"));
|
||||
if (!clientSecret) {
|
||||
try { clientSecret = trim(java.lang.System.getenv("GB_CLIENT_SECRET")); } catch (e2) {}
|
||||
}
|
||||
if (!clientSecret) clientSecret = DEFAULT_GB_CLIENT_SECRET;
|
||||
|
||||
return {
|
||||
clientId: clientId,
|
||||
clientSecret: clientSecret
|
||||
};
|
||||
}
|
||||
|
||||
function loadStrategicCategoryMap(constraints, timeoutMs) {
|
||||
var out = { map: {}, diag: "" };
|
||||
|
||||
var creds = resolveGbCredentials(constraints);
|
||||
if (!creds.clientId || !creds.clientSecret) {
|
||||
out.diag = "credenciais ausentes";
|
||||
return out;
|
||||
}
|
||||
|
||||
var tokenResp = requestGbToken(creds, timeoutMs || 30000);
|
||||
if (!tokenResp.token) {
|
||||
out.diag = tokenResp.diag || "falha ao obter token";
|
||||
return out;
|
||||
}
|
||||
|
||||
var strategicsResp = requestStrategics(tokenResp.token, timeoutMs || 30000);
|
||||
var strategics = strategicsResp.items || [];
|
||||
if (!strategics.length) {
|
||||
out.diag = strategicsResp.diag || "sem classificacoes";
|
||||
return out;
|
||||
}
|
||||
|
||||
for (var i = 0; i < strategics.length; i++) {
|
||||
var item = strategics[i] || {};
|
||||
var id = trim(item.strategicId || item.strategicID || item.id || item.code);
|
||||
var descricao = trim(item.description || item.descricao || item.category || item.name);
|
||||
if (!id || !descricao) continue;
|
||||
out.map[id] = descricao;
|
||||
}
|
||||
|
||||
if (!hasOwnKeys(out.map)) {
|
||||
out.diag = "classificacoes sem strategicId/description";
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
function requestGbToken(creds, timeoutMs) {
|
||||
var timeout = timeoutMs || 30000;
|
||||
var body = "client_id=" + urlEncode(creds.clientId) +
|
||||
"&client_secret=" + urlEncode(creds.clientSecret);
|
||||
|
||||
var attempts = [
|
||||
{
|
||||
name: "post-query-body",
|
||||
method: "POST",
|
||||
url: GB_TOKEN_URL + "?grant_type=client_credentials",
|
||||
headers: {
|
||||
"Accept": "application/json",
|
||||
"Content-Type": "application/x-www-form-urlencoded"
|
||||
},
|
||||
body: body
|
||||
}
|
||||
];
|
||||
|
||||
var trace = [];
|
||||
for (var i = 0; i < attempts.length; i++) {
|
||||
var attempt = attempts[i];
|
||||
var resp = httpRequest(attempt.url, attempt.method, attempt.headers, attempt.body, timeout);
|
||||
trace.push(attempt.name + ":" + trim(resp.status));
|
||||
var parsed = normalizeApiBody(resp.body);
|
||||
var token = trim(parsed && (parsed.access_token || parsed.accessToken || parsed.token));
|
||||
if (token) {
|
||||
return { token: token, diag: "token ok (" + attempt.name + ")" };
|
||||
}
|
||||
}
|
||||
|
||||
return { token: "", diag: "token falhou [" + trace.join(" | ") + "]" };
|
||||
}
|
||||
|
||||
function requestStrategics(accessToken, timeoutMs) {
|
||||
var resp = httpRequest(
|
||||
GB_STRATEGICS_URL,
|
||||
"GET",
|
||||
{
|
||||
"Accept": "application/json",
|
||||
"Authorization": "Bearer " + trim(accessToken)
|
||||
},
|
||||
"",
|
||||
timeoutMs || 30000
|
||||
);
|
||||
|
||||
var parsed = normalizeApiBody(resp.body);
|
||||
var items = extractItems(parsed);
|
||||
if ((!items || !items.length) && parsed && parsed.items instanceof Array) {
|
||||
items = parsed.items;
|
||||
}
|
||||
if ((!items || !items.length) && parsed && parsed.strategics instanceof Array) {
|
||||
items = parsed.strategics;
|
||||
}
|
||||
|
||||
if (!items || !items.length) {
|
||||
return { items: [], diag: "strategics HTTP " + trim(resp.status) };
|
||||
}
|
||||
|
||||
return { items: items, diag: "ok" };
|
||||
}
|
||||
|
||||
function resolveStrategicId(item, fallbackCode) {
|
||||
var candidates = [
|
||||
item && item.strategicId,
|
||||
item && item.strategicID,
|
||||
item && item.classificationStrategicId,
|
||||
item && item.productStrategicId,
|
||||
item && item.estrategicId,
|
||||
item && item.strategyId,
|
||||
item && item.code,
|
||||
fallbackCode
|
||||
];
|
||||
|
||||
for (var i = 0; i < candidates.length; i++) {
|
||||
var value = trim(candidates[i]);
|
||||
if (value) return value;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
function resolveCategory(map, strategicId) {
|
||||
var id = trim(strategicId);
|
||||
if (!id || !map) return "";
|
||||
|
||||
if (map.hasOwnProperty(id)) {
|
||||
return trim(map[id]);
|
||||
}
|
||||
|
||||
var asInt = parseInt(id, 10);
|
||||
if (!isNaN(asInt)) {
|
||||
var normalized = String(asInt);
|
||||
if (map.hasOwnProperty(normalized)) {
|
||||
return trim(map[normalized]);
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
function normalizeApiBody(text) {
|
||||
var obj = parseJsonSafe(text);
|
||||
if (!obj) return null;
|
||||
|
||||
if (obj.content && typeof obj.content === "string") {
|
||||
var parsedContent = parseJsonSafe(obj.content);
|
||||
if (parsedContent) return parsedContent;
|
||||
}
|
||||
|
||||
if (obj.result && typeof obj.result === "string") {
|
||||
var parsedResult = parseJsonSafe(obj.result);
|
||||
if (parsedResult) return parsedResult;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
function hasOwnKeys(obj) {
|
||||
for (var k in obj) {
|
||||
if (obj.hasOwnProperty(k)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function urlEncode(value) {
|
||||
return String(java.net.URLEncoder.encode(String(value || ""), "UTF-8"));
|
||||
}
|
||||
|
||||
function addDiagRow(dataset, msg) {
|
||||
dataset.addRow([
|
||||
"DEBUG",
|
||||
@ -223,23 +448,53 @@ function addDiagRow(dataset, msg) {
|
||||
}
|
||||
|
||||
function fetchDirect(url, timeoutMs) {
|
||||
return httpRequest(
|
||||
url,
|
||||
"GET",
|
||||
{ "Accept": "application/json" },
|
||||
"",
|
||||
timeoutMs || 30000
|
||||
);
|
||||
}
|
||||
|
||||
function httpRequest(url, method, headers, body, timeoutMs) {
|
||||
var conn = null;
|
||||
var reader = null;
|
||||
var writer = null;
|
||||
try {
|
||||
var URL = java.net.URL;
|
||||
var HttpURLConnection = java.net.HttpURLConnection;
|
||||
var InputStreamReader = java.io.InputStreamReader;
|
||||
var BufferedReader = java.io.BufferedReader;
|
||||
var OutputStreamWriter = java.io.OutputStreamWriter;
|
||||
var StringBuilder = java.lang.StringBuilder;
|
||||
|
||||
conn = new URL(url).openConnection();
|
||||
conn.setRequestMethod("GET");
|
||||
conn.setConnectTimeout(timeoutMs || 30000);
|
||||
conn.setReadTimeout(timeoutMs || 30000);
|
||||
conn.setRequestProperty("Accept", "application/json");
|
||||
var httpMethod = String(method || "GET").toUpperCase();
|
||||
var timeout = timeoutMs || 30000;
|
||||
var payload = body == null ? "" : String(body);
|
||||
|
||||
var status = conn.getResponseCode();
|
||||
var stream = (status >= 200 && status < 300) ? conn.getInputStream() : conn.getErrorStream();
|
||||
conn = new URL(url).openConnection();
|
||||
conn.setRequestMethod(httpMethod);
|
||||
conn.setConnectTimeout(timeout);
|
||||
conn.setReadTimeout(timeout);
|
||||
|
||||
if (headers) {
|
||||
for (var h in headers) {
|
||||
if (!headers.hasOwnProperty(h)) continue;
|
||||
if (headers[h] == null || headers[h] === "") continue;
|
||||
conn.setRequestProperty(String(h), String(headers[h]));
|
||||
}
|
||||
}
|
||||
|
||||
if (payload && (httpMethod === "POST" || httpMethod === "PUT" || httpMethod === "PATCH")) {
|
||||
conn.setDoOutput(true);
|
||||
writer = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
|
||||
writer.write(payload);
|
||||
writer.flush();
|
||||
}
|
||||
|
||||
var statusCode = conn.getResponseCode();
|
||||
var status = String(statusCode);
|
||||
var stream = (statusCode >= 200 && statusCode < 300) ? conn.getInputStream() : conn.getErrorStream();
|
||||
if (stream == null) {
|
||||
return { status: status, body: "" };
|
||||
}
|
||||
@ -251,14 +506,12 @@ function fetchDirect(url, timeoutMs) {
|
||||
sb.append(line);
|
||||
}
|
||||
|
||||
return {
|
||||
status: status,
|
||||
body: String(sb.toString())
|
||||
};
|
||||
return { status: status, body: String(sb.toString()) };
|
||||
} catch (e) {
|
||||
return { status: 0, body: "" };
|
||||
return { status: "", body: "" };
|
||||
} finally {
|
||||
try { if (reader) reader.close(); } catch (e1) {}
|
||||
try { if (conn) conn.disconnect(); } catch (e2) {}
|
||||
try { if (writer) writer.close(); } catch (e1) {}
|
||||
try { if (reader) reader.close(); } catch (e2) {}
|
||||
try { if (conn) conn.disconnect(); } catch (e3) {}
|
||||
}
|
||||
}
|
||||
|
||||
517
Transferência Ginseng/datasets/ds_rgb_products_v2.js
Normal file
517
Transferência Ginseng/datasets/ds_rgb_products_v2.js
Normal file
@ -0,0 +1,517 @@
|
||||
function defineStructure() {
|
||||
addColumn("Code");
|
||||
addColumn("Description");
|
||||
addColumn("codigoDescricao");
|
||||
addColumn("descricao");
|
||||
addColumn("sku");
|
||||
addColumn("brand");
|
||||
addColumn("ncmId");
|
||||
addColumn("categoria");
|
||||
}
|
||||
|
||||
function onSync(lastSyncDate) {}
|
||||
|
||||
var GB_TOKEN_URL = "https://api.grupoboticario.com.br/global/v2/jwt-token/token";
|
||||
var GB_STRATEGICS_URL = "https://api.grupoboticario.com.br/global/v1/franchising/gb-stores-data/product/classification/strategics";
|
||||
var DEFAULT_GB_CLIENT_ID = "88ymKwAUNfu06sD85i0RiokCxWGSkFBkx9ytgI5y1ZKxX3OQ";
|
||||
var DEFAULT_GB_CLIENT_SECRET = "YDFz43qAzL6ApNIKVCxu3dAmS9GWOqJbcc2aPnFDkmEaBXexSpsHGfcItg56i2dE";
|
||||
|
||||
function createDataset(fields, constraints, sortFields) {
|
||||
var dataset = DatasetBuilder.newDataset();
|
||||
dataset.addColumn("Code");
|
||||
dataset.addColumn("Description");
|
||||
dataset.addColumn("codigoDescricao");
|
||||
dataset.addColumn("descricao");
|
||||
dataset.addColumn("sku");
|
||||
dataset.addColumn("brand");
|
||||
dataset.addColumn("ncmId");
|
||||
dataset.addColumn("categoria");
|
||||
|
||||
try {
|
||||
var filtro = parseConstraints(constraints);
|
||||
var clientService = fluigAPI.getAuthorizeClientService();
|
||||
var data = {
|
||||
companyId: String(getValue("WKCompany") || "1"),
|
||||
serviceCode: "GINSENG APITESTE",
|
||||
endpoint: "/dados_rgb_products",
|
||||
method: "get",
|
||||
timeoutService: "60000",
|
||||
params: {}
|
||||
};
|
||||
|
||||
var vo = clientService.invoke(JSON.stringify(data));
|
||||
var statusHttp = vo ? String(vo.getHttpStatusResult() || "") : "";
|
||||
var retorno = vo ? String(vo.getResult() || "") : "";
|
||||
|
||||
// Fallback: se o servico integrado estiver com endpoint/base incorreto, chama URL direta.
|
||||
if (statusHttp !== "200" || !retorno) {
|
||||
var direct = fetchDirect("https://api.grupoginseng.com.br/dados_rgb_products", 60000);
|
||||
statusHttp = String(direct.status || statusHttp);
|
||||
retorno = direct.body || retorno;
|
||||
}
|
||||
|
||||
if (!retorno) {
|
||||
addDiagRow(dataset, "Sem retorno da API (HTTP " + statusHttp + ")");
|
||||
return dataset;
|
||||
}
|
||||
|
||||
var obj = parseJsonSafe(retorno);
|
||||
if (!obj) {
|
||||
addDiagRow(dataset, "Falha no JSON da API (HTTP " + statusHttp + ")");
|
||||
return dataset;
|
||||
}
|
||||
|
||||
var itens = extractItems(obj);
|
||||
if (!itens || !itens.length) {
|
||||
addDiagRow(dataset, "API sem itens (HTTP " + statusHttp + ")");
|
||||
return dataset;
|
||||
}
|
||||
|
||||
var searchNorm = normalize(filtro.search);
|
||||
var maxRows = filtro.maxRows;
|
||||
var categoryMap = null;
|
||||
var categoryDiag = "";
|
||||
|
||||
for (var i = 0; i < itens.length; i++) {
|
||||
var item = itens[i] || {};
|
||||
|
||||
if (item.discontinued === true) {
|
||||
continue;
|
||||
}
|
||||
if (item.purchaseBlocked === true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var code = trim(item.sku);
|
||||
var desc = trim(item.description);
|
||||
var codigoDescricao = code + " - " + desc;
|
||||
var brand = trim(item.brand);
|
||||
var categoria = trim(item.strategicDescription || item.strategic_description || item.categoria);
|
||||
if (!categoria) {
|
||||
if (categoryMap == null) {
|
||||
var categorization = loadStrategicCategoryMap(constraints, 30000);
|
||||
categoryMap = categorization.map || {};
|
||||
categoryDiag = categorization.diag || "";
|
||||
}
|
||||
var strategicId = resolveStrategicId(item, code);
|
||||
categoria = resolveCategory(categoryMap, strategicId);
|
||||
}
|
||||
var blob = normalize([code, desc, brand, trim(item.id), categoria].join(" "));
|
||||
|
||||
if (searchNorm && searchNorm.length >= 2 && blob.indexOf(searchNorm) === -1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
dataset.addRow([
|
||||
code,
|
||||
desc,
|
||||
codigoDescricao,
|
||||
desc,
|
||||
code,
|
||||
brand,
|
||||
trim(item.ncmId),
|
||||
categoria
|
||||
]);
|
||||
|
||||
if (maxRows > 0 && dataset.rowsCount >= maxRows) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (dataset.rowsCount === 0) {
|
||||
var suffix = categoryDiag ? " | Categoria: " + categoryDiag : "";
|
||||
addDiagRow(dataset, "Sem produtos apos filtros (busca: " + filtro.search + ")" + suffix);
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
addDiagRow(dataset, "Erro ao consultar API: " + e);
|
||||
}
|
||||
|
||||
return dataset;
|
||||
}
|
||||
|
||||
function onMobileSync(user) {}
|
||||
|
||||
function parseConstraints(constraints) {
|
||||
var out = {
|
||||
search: "",
|
||||
maxRows: 0
|
||||
};
|
||||
|
||||
if (!constraints) {
|
||||
return out;
|
||||
}
|
||||
|
||||
for (var i = 0; i < constraints.length; i++) {
|
||||
var c = constraints[i];
|
||||
if (!c || !c.fieldName) continue;
|
||||
|
||||
var name = String(c.fieldName);
|
||||
var lowerName = name.toLowerCase();
|
||||
var value = cleanSearchValue(c.initialValue);
|
||||
|
||||
if (lowerName === "sqllimit") {
|
||||
var n = parseInt(trim(c.initialValue), 10);
|
||||
if (!isNaN(n) && n > 0) {
|
||||
out.maxRows = n;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (
|
||||
value &&
|
||||
lowerName !== "metadata#id" &&
|
||||
lowerName !== "metadata#active" &&
|
||||
lowerName !== "sqllimit" &&
|
||||
lowerName !== "gbclientid" &&
|
||||
lowerName !== "gbclientsecret" &&
|
||||
lowerName !== "clientid" &&
|
||||
lowerName !== "clientsecret"
|
||||
) {
|
||||
if (!out.search || value.length > out.search.length) {
|
||||
out.search = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
function cleanSearchValue(v) {
|
||||
var s = trim(v);
|
||||
s = s.replace(/[%*_]/g, "");
|
||||
// Evita que flags comuns do Fluig virem termo de busca
|
||||
if (s === "true" || s === "false" || s === "on" || s === "off" || s === "1") {
|
||||
return "";
|
||||
}
|
||||
return trim(s);
|
||||
}
|
||||
|
||||
function normalize(v) {
|
||||
return trim(v).toLowerCase();
|
||||
}
|
||||
|
||||
function trim(v) {
|
||||
return String(v == null ? "" : v).trim();
|
||||
}
|
||||
|
||||
function parseJsonSafe(text) {
|
||||
try {
|
||||
return JSON.parse(text);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function extractItems(obj) {
|
||||
if (!obj) return [];
|
||||
if (obj instanceof Array) return obj;
|
||||
if (obj.data && obj.data instanceof Array) return obj.data;
|
||||
|
||||
if (obj.content) {
|
||||
if (obj.content instanceof Array) return obj.content;
|
||||
if (typeof obj.content === "string") {
|
||||
var parsedContent = parseJsonSafe(obj.content);
|
||||
if (parsedContent && parsedContent.data && parsedContent.data instanceof Array) {
|
||||
return parsedContent.data;
|
||||
}
|
||||
if (parsedContent && parsedContent instanceof Array) {
|
||||
return parsedContent;
|
||||
}
|
||||
}
|
||||
if (obj.content.data && obj.content.data instanceof Array) return obj.content.data;
|
||||
}
|
||||
|
||||
if (obj.result) {
|
||||
if (obj.result instanceof Array) return obj.result;
|
||||
if (typeof obj.result === "string") {
|
||||
var parsedResult = parseJsonSafe(obj.result);
|
||||
if (parsedResult && parsedResult.data && parsedResult.data instanceof Array) {
|
||||
return parsedResult.data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
function getConstraintValue(constraints, fieldName) {
|
||||
if (!constraints || !fieldName) return "";
|
||||
var target = String(fieldName).toLowerCase();
|
||||
for (var i = 0; i < constraints.length; i++) {
|
||||
var c = constraints[i];
|
||||
if (!c || !c.fieldName) continue;
|
||||
if (String(c.fieldName).toLowerCase() === target) {
|
||||
return c.initialValue;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
function resolveGbCredentials(constraints) {
|
||||
var clientId = trim(getConstraintValue(constraints, "gbClientId"));
|
||||
if (!clientId) clientId = trim(getConstraintValue(constraints, "clientId"));
|
||||
if (!clientId) {
|
||||
try { clientId = trim(java.lang.System.getenv("GB_CLIENT_ID")); } catch (e1) {}
|
||||
}
|
||||
if (!clientId) clientId = DEFAULT_GB_CLIENT_ID;
|
||||
|
||||
var clientSecret = trim(getConstraintValue(constraints, "gbClientSecret"));
|
||||
if (!clientSecret) clientSecret = trim(getConstraintValue(constraints, "clientSecret"));
|
||||
if (!clientSecret) {
|
||||
try { clientSecret = trim(java.lang.System.getenv("GB_CLIENT_SECRET")); } catch (e2) {}
|
||||
}
|
||||
if (!clientSecret) clientSecret = DEFAULT_GB_CLIENT_SECRET;
|
||||
|
||||
return {
|
||||
clientId: clientId,
|
||||
clientSecret: clientSecret
|
||||
};
|
||||
}
|
||||
|
||||
function loadStrategicCategoryMap(constraints, timeoutMs) {
|
||||
var out = { map: {}, diag: "" };
|
||||
|
||||
var creds = resolveGbCredentials(constraints);
|
||||
if (!creds.clientId || !creds.clientSecret) {
|
||||
out.diag = "credenciais ausentes";
|
||||
return out;
|
||||
}
|
||||
|
||||
var tokenResp = requestGbToken(creds, timeoutMs || 30000);
|
||||
if (!tokenResp.token) {
|
||||
out.diag = tokenResp.diag || "falha ao obter token";
|
||||
return out;
|
||||
}
|
||||
|
||||
var strategicsResp = requestStrategics(tokenResp.token, timeoutMs || 30000);
|
||||
var strategics = strategicsResp.items || [];
|
||||
if (!strategics.length) {
|
||||
out.diag = strategicsResp.diag || "sem classificacoes";
|
||||
return out;
|
||||
}
|
||||
|
||||
for (var i = 0; i < strategics.length; i++) {
|
||||
var item = strategics[i] || {};
|
||||
var id = trim(item.strategicId || item.strategicID || item.id || item.code);
|
||||
var descricao = trim(item.description || item.descricao || item.category || item.name);
|
||||
if (!id || !descricao) continue;
|
||||
out.map[id] = descricao;
|
||||
}
|
||||
|
||||
if (!hasOwnKeys(out.map)) {
|
||||
out.diag = "classificacoes sem strategicId/description";
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
function requestGbToken(creds, timeoutMs) {
|
||||
var timeout = timeoutMs || 30000;
|
||||
var body = "client_id=" + urlEncode(creds.clientId) +
|
||||
"&client_secret=" + urlEncode(creds.clientSecret);
|
||||
|
||||
var attempts = [
|
||||
{
|
||||
name: "post-query-body",
|
||||
method: "POST",
|
||||
url: GB_TOKEN_URL + "?grant_type=client_credentials",
|
||||
headers: {
|
||||
"Accept": "application/json",
|
||||
"Content-Type": "application/x-www-form-urlencoded"
|
||||
},
|
||||
body: body
|
||||
}
|
||||
];
|
||||
|
||||
var trace = [];
|
||||
for (var i = 0; i < attempts.length; i++) {
|
||||
var attempt = attempts[i];
|
||||
var resp = httpRequest(attempt.url, attempt.method, attempt.headers, attempt.body, timeout);
|
||||
trace.push(attempt.name + ":" + trim(resp.status));
|
||||
var parsed = normalizeApiBody(resp.body);
|
||||
var token = trim(parsed && (parsed.access_token || parsed.accessToken || parsed.token));
|
||||
if (token) {
|
||||
return { token: token, diag: "token ok (" + attempt.name + ")" };
|
||||
}
|
||||
}
|
||||
|
||||
return { token: "", diag: "token falhou [" + trace.join(" | ") + "]" };
|
||||
}
|
||||
|
||||
function requestStrategics(accessToken, timeoutMs) {
|
||||
var resp = httpRequest(
|
||||
GB_STRATEGICS_URL,
|
||||
"GET",
|
||||
{
|
||||
"Accept": "application/json",
|
||||
"Authorization": "Bearer " + trim(accessToken)
|
||||
},
|
||||
"",
|
||||
timeoutMs || 30000
|
||||
);
|
||||
|
||||
var parsed = normalizeApiBody(resp.body);
|
||||
var items = extractItems(parsed);
|
||||
if ((!items || !items.length) && parsed && parsed.items instanceof Array) {
|
||||
items = parsed.items;
|
||||
}
|
||||
if ((!items || !items.length) && parsed && parsed.strategics instanceof Array) {
|
||||
items = parsed.strategics;
|
||||
}
|
||||
|
||||
if (!items || !items.length) {
|
||||
return { items: [], diag: "strategics HTTP " + trim(resp.status) };
|
||||
}
|
||||
|
||||
return { items: items, diag: "ok" };
|
||||
}
|
||||
|
||||
function resolveStrategicId(item, fallbackCode) {
|
||||
var candidates = [
|
||||
item && item.strategicId,
|
||||
item && item.strategicID,
|
||||
item && item.classificationStrategicId,
|
||||
item && item.productStrategicId,
|
||||
item && item.estrategicId,
|
||||
item && item.strategyId,
|
||||
item && item.code,
|
||||
fallbackCode
|
||||
];
|
||||
|
||||
for (var i = 0; i < candidates.length; i++) {
|
||||
var value = trim(candidates[i]);
|
||||
if (value) return value;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
function resolveCategory(map, strategicId) {
|
||||
var id = trim(strategicId);
|
||||
if (!id || !map) return "";
|
||||
|
||||
if (map.hasOwnProperty(id)) {
|
||||
return trim(map[id]);
|
||||
}
|
||||
|
||||
var asInt = parseInt(id, 10);
|
||||
if (!isNaN(asInt)) {
|
||||
var normalized = String(asInt);
|
||||
if (map.hasOwnProperty(normalized)) {
|
||||
return trim(map[normalized]);
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
function normalizeApiBody(text) {
|
||||
var obj = parseJsonSafe(text);
|
||||
if (!obj) return null;
|
||||
|
||||
if (obj.content && typeof obj.content === "string") {
|
||||
var parsedContent = parseJsonSafe(obj.content);
|
||||
if (parsedContent) return parsedContent;
|
||||
}
|
||||
|
||||
if (obj.result && typeof obj.result === "string") {
|
||||
var parsedResult = parseJsonSafe(obj.result);
|
||||
if (parsedResult) return parsedResult;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
function hasOwnKeys(obj) {
|
||||
for (var k in obj) {
|
||||
if (obj.hasOwnProperty(k)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function urlEncode(value) {
|
||||
return String(java.net.URLEncoder.encode(String(value || ""), "UTF-8"));
|
||||
}
|
||||
|
||||
function addDiagRow(dataset, msg) {
|
||||
dataset.addRow([
|
||||
"DEBUG",
|
||||
String(msg),
|
||||
String(msg),
|
||||
String(msg),
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
""
|
||||
]);
|
||||
}
|
||||
|
||||
function fetchDirect(url, timeoutMs) {
|
||||
return httpRequest(
|
||||
url,
|
||||
"GET",
|
||||
{ "Accept": "application/json" },
|
||||
"",
|
||||
timeoutMs || 30000
|
||||
);
|
||||
}
|
||||
|
||||
function httpRequest(url, method, headers, body, timeoutMs) {
|
||||
var conn = null;
|
||||
var reader = null;
|
||||
var writer = null;
|
||||
try {
|
||||
var URL = java.net.URL;
|
||||
var InputStreamReader = java.io.InputStreamReader;
|
||||
var BufferedReader = java.io.BufferedReader;
|
||||
var OutputStreamWriter = java.io.OutputStreamWriter;
|
||||
var StringBuilder = java.lang.StringBuilder;
|
||||
|
||||
var httpMethod = String(method || "GET").toUpperCase();
|
||||
var timeout = timeoutMs || 30000;
|
||||
var payload = body == null ? "" : String(body);
|
||||
|
||||
conn = new URL(url).openConnection();
|
||||
conn.setRequestMethod(httpMethod);
|
||||
conn.setConnectTimeout(timeout);
|
||||
conn.setReadTimeout(timeout);
|
||||
|
||||
if (headers) {
|
||||
for (var h in headers) {
|
||||
if (!headers.hasOwnProperty(h)) continue;
|
||||
if (headers[h] == null || headers[h] === "") continue;
|
||||
conn.setRequestProperty(String(h), String(headers[h]));
|
||||
}
|
||||
}
|
||||
|
||||
if (payload && (httpMethod === "POST" || httpMethod === "PUT" || httpMethod === "PATCH")) {
|
||||
conn.setDoOutput(true);
|
||||
writer = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
|
||||
writer.write(payload);
|
||||
writer.flush();
|
||||
}
|
||||
|
||||
var statusCode = conn.getResponseCode();
|
||||
var status = String(statusCode);
|
||||
var stream = (statusCode >= 200 && statusCode < 300) ? conn.getInputStream() : conn.getErrorStream();
|
||||
if (stream == null) {
|
||||
return { status: status, body: "" };
|
||||
}
|
||||
|
||||
reader = new BufferedReader(new InputStreamReader(stream, "UTF-8"));
|
||||
var sb = new StringBuilder();
|
||||
var line = null;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
sb.append(line);
|
||||
}
|
||||
|
||||
return { status: status, body: String(sb.toString()) };
|
||||
} catch (e) {
|
||||
return { status: "", body: "" };
|
||||
} finally {
|
||||
try { if (writer) writer.close(); } catch (e1) {}
|
||||
try { if (reader) reader.close(); } catch (e2) {}
|
||||
try { if (conn) conn.disconnect(); } catch (e3) {}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@ -95,6 +95,10 @@ function validateForm(form) {
|
||||
message += getMessage("Data da entrega", 1, form);
|
||||
hasErros = true;
|
||||
}
|
||||
if (String(form.getValue("nomerecebedor") || "").trim() == "") {
|
||||
message += getMessage("Nome de quem recebeu a mercadoria", 1, form);
|
||||
hasErros = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case RECEBIMENTO:
|
||||
|
||||
@ -97,6 +97,7 @@ function processarArquivoExcel(file) {
|
||||
var codigo = getCellByAliases(item, ["codigoItem", "codigo", "codItem", "sku", "code", "item"]);
|
||||
var quantidade = getCellByAliases(item, ["quantidadeItem", "quantidade", "qtd", "qtde"]);
|
||||
var descricao = getCellByAliases(item, ["descricao", "description", "desc"]);
|
||||
var categoria = getCellByAliases(item, ["categoria", "category"]);
|
||||
|
||||
if (!codigo || !quantidade) {
|
||||
return;
|
||||
@ -105,7 +106,8 @@ function processarArquivoExcel(file) {
|
||||
linhasValidas.push({
|
||||
codigo: String(codigo).trim(),
|
||||
quantidade: String(quantidade).trim(),
|
||||
descricao: String(descricao || "").trim()
|
||||
descricao: String(descricao || "").trim(),
|
||||
categoria: String(categoria || "").trim()
|
||||
});
|
||||
});
|
||||
|
||||
@ -141,6 +143,11 @@ function processarArquivoExcel(file) {
|
||||
if (descricaoFinal) {
|
||||
$("#codigoItem___" + idx).val(descricaoFinal);
|
||||
}
|
||||
|
||||
var categoriaFinal = item.categoria || produtoInfo.categoria;
|
||||
if (categoriaFinal) {
|
||||
$("#categoriaItem___" + idx).val(categoriaFinal);
|
||||
}
|
||||
});
|
||||
|
||||
if (typeof processarConferenciaNfe === "function") {
|
||||
@ -192,16 +199,16 @@ function normalizeHeader(text) {
|
||||
function buscarProdutoPorCodigo(codigo) {
|
||||
try {
|
||||
if (typeof DatasetFactory === "undefined" || typeof ConstraintType === "undefined") {
|
||||
return { descricao: "", id: "" };
|
||||
return { descricao: "", id: "", categoria: "" };
|
||||
}
|
||||
|
||||
var codigoTxt = String(codigo || "").trim();
|
||||
if (!codigoTxt) return { descricao: "", id: "" };
|
||||
if (!codigoTxt) return { descricao: "", id: "", categoria: "" };
|
||||
|
||||
var cCodigo = DatasetFactory.createConstraint("Code", codigoTxt, codigoTxt, ConstraintType.MUST);
|
||||
var ds = DatasetFactory.getDataset("ds_rgb_products", null, [cCodigo], null);
|
||||
var ds = DatasetFactory.getDataset("ds_rgb_products_v2", null, [cCodigo], null);
|
||||
if (!ds || !ds.values || !ds.values.length) {
|
||||
return { descricao: "", id: "" };
|
||||
return { descricao: "", id: "", categoria: "" };
|
||||
}
|
||||
|
||||
for (var i = 0; i < ds.values.length; i++) {
|
||||
@ -209,7 +216,8 @@ function buscarProdutoPorCodigo(codigo) {
|
||||
if (String(row.Code || "").trim() === codigoTxt) {
|
||||
return {
|
||||
descricao: String(row.descricao || row.Description || "").trim(),
|
||||
id: String(row.id || "").trim()
|
||||
id: String(row.id || "").trim(),
|
||||
categoria: String(row.categoria || row.strategicDescription || "").trim()
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -217,11 +225,12 @@ function buscarProdutoPorCodigo(codigo) {
|
||||
var first = ds.values[0] || {};
|
||||
return {
|
||||
descricao: String(first.descricao || first.Description || "").trim(),
|
||||
id: String(first.id || "").trim()
|
||||
id: String(first.id || "").trim(),
|
||||
categoria: String(first.categoria || first.strategicDescription || "").trim()
|
||||
};
|
||||
} catch (e) {
|
||||
console.error("Erro ao buscar descricao por codigo:", e);
|
||||
return { descricao: "", id: "" };
|
||||
return { descricao: "", id: "", categoria: "" };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -49,13 +49,15 @@ $(document).ready(function () {
|
||||
processarConferenciaNfe();
|
||||
});
|
||||
|
||||
var activity = String($("#activity").val() || "");
|
||||
applyTransferStatus(activity);
|
||||
|
||||
if ($("#formMode").val() == "VIEW") {
|
||||
showAndBlock(["all"]);
|
||||
$("#btnConsultarChaveNfe").prop("disabled", true).hide();
|
||||
updateConferenciaNfeVisibility($("#activity").val());
|
||||
updateConferenciaNfeVisibility(activity);
|
||||
} else {
|
||||
//show the right fields
|
||||
var activity = $("#activity").val();
|
||||
var requestDate = getCurrentDate();
|
||||
|
||||
if (String(activity) !== "6") {
|
||||
@ -209,6 +211,40 @@ $(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
function applyTransferStatus(activity) {
|
||||
var current = String(activity || "");
|
||||
var pills = $("#transferStatus .status-pill");
|
||||
if (!pills.length) return;
|
||||
|
||||
pills.removeClass("is-active is-done");
|
||||
|
||||
var activeOrder = -1;
|
||||
pills.each(function () {
|
||||
var pill = $(this);
|
||||
var activities = String(pill.attr("data-activities") || "").split(",");
|
||||
for (var i = 0; i < activities.length; i++) {
|
||||
if ($.trim(activities[i]) === current) {
|
||||
pill.addClass("is-active");
|
||||
var order = parseInt(pill.attr("data-order"), 10);
|
||||
if (!isNaN(order)) {
|
||||
activeOrder = order;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (activeOrder < 0) return;
|
||||
|
||||
pills.each(function () {
|
||||
var pill = $(this);
|
||||
var order = parseInt(pill.attr("data-order"), 10);
|
||||
if (!isNaN(order) && order < activeOrder) {
|
||||
pill.addClass("is-done");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function resolveFormModeFallback() {
|
||||
var mode = ($("#formMode").val() || "").toUpperCase();
|
||||
if (mode) return mode;
|
||||
@ -353,30 +389,67 @@ function clearZoomField(fieldId) {
|
||||
$("#" + fieldId).val("");
|
||||
}
|
||||
|
||||
var MOTORISTAS_GROUP_ID = "Motoristas";
|
||||
var motoristasEntregaCache = null;
|
||||
var motoristasEntregaLoading = false;
|
||||
var MOTORISTAS_GROUP_DEFAULT_ID = "Motoristas";
|
||||
var MOTORISTAS_GROUP_BY_UF = {
|
||||
AL: "motoristaAL",
|
||||
BA: "motoristaBA",
|
||||
SE: "motoristaSE"
|
||||
};
|
||||
var motoristasEntregaCacheByGroup = {};
|
||||
var motoristasEntregaLoadingByGroup = {};
|
||||
var motoristaEntregaGroupAtual = "";
|
||||
|
||||
function normalizeUfCode(value) {
|
||||
return String(value || "").toUpperCase().replace(/[^A-Z]/g, "").substring(0, 2);
|
||||
}
|
||||
|
||||
function resolveMotoristasGroupIdByUf(uf) {
|
||||
var ufCode = normalizeUfCode(uf);
|
||||
if (!ufCode) {
|
||||
return MOTORISTAS_GROUP_DEFAULT_ID;
|
||||
}
|
||||
if (MOTORISTAS_GROUP_BY_UF[ufCode]) {
|
||||
return String(MOTORISTAS_GROUP_BY_UF[ufCode] || "").trim() || MOTORISTAS_GROUP_DEFAULT_ID;
|
||||
}
|
||||
// Convencao para facilitar novos estados sem precisar alterar o JS.
|
||||
return "motorista" + ufCode;
|
||||
}
|
||||
|
||||
function getMotoristasEntregaQueryContext() {
|
||||
var uf = normalizeUfCode($("#ufDestino").val());
|
||||
var groupId = resolveMotoristasGroupIdByUf(uf);
|
||||
return {
|
||||
uf: uf,
|
||||
groupId: groupId,
|
||||
cacheKey: groupId
|
||||
};
|
||||
}
|
||||
|
||||
function loadMotoristasEntregaSelect(forceReload) {
|
||||
var select = $("#motoristaEntregaSelecionado");
|
||||
if (!select.length) return;
|
||||
|
||||
if (!forceReload && motoristasEntregaCache && motoristasEntregaCache.length) {
|
||||
renderMotoristasEntregaOptions(motoristasEntregaCache);
|
||||
var context = getMotoristasEntregaQueryContext();
|
||||
var cacheKey = context.cacheKey;
|
||||
motoristaEntregaGroupAtual = context.groupId;
|
||||
|
||||
if (!forceReload && Object.prototype.hasOwnProperty.call(motoristasEntregaCacheByGroup, cacheKey)) {
|
||||
renderMotoristasEntregaOptions(motoristasEntregaCacheByGroup[cacheKey], context);
|
||||
return;
|
||||
}
|
||||
|
||||
if (motoristasEntregaLoading) return;
|
||||
if (motoristasEntregaLoadingByGroup[cacheKey]) return;
|
||||
|
||||
motoristasEntregaLoading = true;
|
||||
motoristasEntregaLoadingByGroup[cacheKey] = true;
|
||||
select.prop("disabled", true);
|
||||
|
||||
var requestPayload = {
|
||||
name: "ds_motoristas_grupo",
|
||||
fields: null,
|
||||
constraints: [{
|
||||
_field: "GROUP_ID",
|
||||
_initialValue: MOTORISTAS_GROUP_ID,
|
||||
_finalValue: MOTORISTAS_GROUP_ID,
|
||||
_initialValue: context.groupId,
|
||||
_finalValue: context.groupId,
|
||||
_type: 1
|
||||
}],
|
||||
order: null
|
||||
@ -390,14 +463,22 @@ function loadMotoristasEntregaSelect(forceReload) {
|
||||
data: JSON.stringify(requestPayload)
|
||||
}).done(function (response) {
|
||||
var values = ((((response || {}).content || {}).values) || []);
|
||||
motoristasEntregaCache = normalizeMotoristasEntregaRows(values);
|
||||
renderMotoristasEntregaOptions(motoristasEntregaCache);
|
||||
var rows = normalizeMotoristasEntregaRows(values);
|
||||
motoristasEntregaCacheByGroup[cacheKey] = rows;
|
||||
if (motoristaEntregaGroupAtual === context.groupId) {
|
||||
renderMotoristasEntregaOptions(rows, context);
|
||||
}
|
||||
}).fail(function (xhr) {
|
||||
console.error("Falha ao carregar motoristas do dataset:", xhr);
|
||||
motoristasEntregaCache = [];
|
||||
renderMotoristasEntregaOptions([]);
|
||||
console.error("Falha ao carregar motoristas do dataset (" + context.groupId + "):", xhr);
|
||||
motoristasEntregaCacheByGroup[cacheKey] = [];
|
||||
if (motoristaEntregaGroupAtual === context.groupId) {
|
||||
renderMotoristasEntregaOptions([], context);
|
||||
}
|
||||
}).always(function () {
|
||||
motoristasEntregaLoading = false;
|
||||
motoristasEntregaLoadingByGroup[cacheKey] = false;
|
||||
if (motoristaEntregaGroupAtual === context.groupId) {
|
||||
select.prop("disabled", false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -429,14 +510,21 @@ function normalizeMotoristasEntregaRows(values) {
|
||||
return out;
|
||||
}
|
||||
|
||||
function renderMotoristasEntregaOptions(rows) {
|
||||
function renderMotoristasEntregaOptions(rows, context) {
|
||||
var select = $("#motoristaEntregaSelecionado");
|
||||
if (!select.length) return;
|
||||
|
||||
var selectedValue = String($("#motoristaEntregaLogin").val() || select.val() || "").trim();
|
||||
var placeholder = "Selecione o motorista";
|
||||
if (context && context.uf) {
|
||||
placeholder = "Selecione o motorista da UF " + context.uf;
|
||||
}
|
||||
if ((rows || []).length === 0 && context && context.uf) {
|
||||
placeholder = "Sem motoristas cadastrados para UF " + context.uf;
|
||||
}
|
||||
|
||||
select.empty();
|
||||
select.append($("<option></option>").val("").text("Selecione o motorista"));
|
||||
select.append($("<option></option>").val("").text(placeholder));
|
||||
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var row = rows[i];
|
||||
@ -462,6 +550,12 @@ function renderMotoristasEntregaOptions(rows) {
|
||||
applySelectedMotoristaEntregaOption();
|
||||
}
|
||||
|
||||
function refreshMotoristasEntregaByUf(forceReload) {
|
||||
var escolha = String($("input[name='tipoMotoristaEntrega']:checked").val() || "");
|
||||
if (escolha !== "outro") return;
|
||||
loadMotoristasEntregaSelect(forceReload === true);
|
||||
}
|
||||
|
||||
function syncMotoristaEntregaSelectFromHidden() {
|
||||
var select = $("#motoristaEntregaSelecionado");
|
||||
if (!select.length) return;
|
||||
@ -1043,7 +1137,7 @@ var beforeSendValidate = function (numState, nextState) {
|
||||
throw "'Complemento' é obrigatório.";
|
||||
} else if ($("#justificativa").val() == "") {
|
||||
$("#justificativa").parent("div").addClass("errorValidate");
|
||||
throw "'Qual o motivo da compra?' é obrigatório.";
|
||||
throw "'Qual o motivo da transferência?' é obrigatório.";
|
||||
} else {
|
||||
$("input[id^='quantidadeItem___']").each(function (index, value) {
|
||||
var linha = $(value).attr("name").split("___")[1];
|
||||
@ -1152,6 +1246,9 @@ var beforeSendValidate = function (numState, nextState) {
|
||||
if ($("#dataEntrega").val() == "") {
|
||||
throw "'Data da entrega' é obrigatória.";
|
||||
}
|
||||
if (String($("#nomerecebedor").val() || "").trim() == "") {
|
||||
throw "'Nome de quem recebeu a mercadoria' é obrigatório.";
|
||||
}
|
||||
} else if (numState == 18) {
|
||||
var validacaoItens = $("input[name='validacaoItens']:checked").val();
|
||||
if (validacaoItens == "" || validacaoItens == undefined) {
|
||||
@ -1224,6 +1321,7 @@ function setSelectedZoomItem(selectedItem) {
|
||||
$("#gestorEmail").val(selectedItem["emailGestor"] || "");
|
||||
$("#gestor_cc").val(selectedItem["COLLEAGUE_ID"] || "");
|
||||
$("#ufDestino").val(selectedItem["UF"] || "");
|
||||
refreshMotoristasEntregaByUf(true);
|
||||
}
|
||||
|
||||
if (name_item == "estabelecimento") {
|
||||
@ -1250,9 +1348,11 @@ function setSelectedZoomItem(selectedItem) {
|
||||
var itemDescricao = selectedItem["descricao"] || selectedItem["Description"] || "";
|
||||
var itemCode = selectedItem["Code"] || selectedItem["sku"] || "";
|
||||
var itemProductId = selectedItem["id"] || selectedItem["productId"] || "";
|
||||
var itemCategoria = selectedItem["categoria"] || selectedItem["strategicDescription"] || "";
|
||||
$("#codigoItem" + "___" + indice).val(itemDescricao);
|
||||
$("#codigoProdutoItem" + "___" + indice).val(itemCode);
|
||||
$("#productIdItem" + "___" + indice).val(itemProductId);
|
||||
$("#categoriaItem" + "___" + indice).val(itemCategoria);
|
||||
processarConferenciaNfe();
|
||||
}
|
||||
|
||||
@ -1275,6 +1375,7 @@ function removedZoomItem(removedItem) {
|
||||
$("#gestorEmail").val("");
|
||||
$("#gestor_cc").val("");
|
||||
$("#ufDestino").val("");
|
||||
refreshMotoristasEntregaByUf(true);
|
||||
} else if (name_item == "estabelecimento") {
|
||||
$("#gestorNomeE").val("");
|
||||
$("#gestorEmailE").val("");
|
||||
@ -1292,6 +1393,7 @@ function removedZoomItem(removedItem) {
|
||||
$("#codigoItem___" + linha[1]).val("");
|
||||
$("#codigoProdutoItem___" + linha[1]).val("");
|
||||
$("#productIdItem___" + linha[1]).val("");
|
||||
$("#categoriaItem___" + linha[1]).val("");
|
||||
$("#quantidadeItem___" + linha[1]).val("");
|
||||
processarConferenciaNfe();
|
||||
}
|
||||
@ -1301,6 +1403,7 @@ function removedZoomItem(removedItem) {
|
||||
$("#codigoItem" + "___" + indice).val("");
|
||||
$("#codigoProdutoItem" + "___" + indice).val("");
|
||||
$("#productIdItem" + "___" + indice).val("");
|
||||
$("#categoriaItem" + "___" + indice).val("");
|
||||
processarConferenciaNfe();
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,57 @@
|
||||
<div style="font-family: Arial, sans-serif; background-color:#f4f6f8; padding:20px;">
|
||||
|
||||
<div style="max-width:600px; margin:auto; background:#ffffff; border-radius:8px; overflow:hidden; box-shadow:0 2px 8px rgba(0,0,0,0.1);">
|
||||
|
||||
<!-- 🔷 HEADER -->
|
||||
<div style="background:#0a6d8d; padding:15px; text-align:center; color:#ffffff;">
|
||||
<h2 style="margin:0;">Transferências Ginseng</h2>
|
||||
<p style="margin:0; font-size:13px;">Notificação de Processo</p>
|
||||
</div>
|
||||
|
||||
<!-- 📄 BODY -->
|
||||
<div style="padding:25px; color:#333;">
|
||||
|
||||
<h3 style="margin-top:0; color:#0a6d8d;">Nota Fiscal Emitida ✅</h3>
|
||||
|
||||
<p>Olá,</p>
|
||||
|
||||
<p>
|
||||
Sua solicitação teve a <b>Nota Fiscal emitida com sucesso</b>.
|
||||
</p>
|
||||
|
||||
<!-- 🔹 CARD INFO -->
|
||||
<div style="background:#f1f5f9; padding:15px; border-radius:6px; margin:20px 0;">
|
||||
<p style="margin:5px 0;"><b>Nº Solicitação:</b> ${WKNumProces}</p>
|
||||
<p style="margin:5px 0;"><b>Chave NFe:</b> ${chaveNfe}</p>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Clique no botão abaixo para acessar o processo:
|
||||
</p>
|
||||
|
||||
<!-- 🔘 BOTÃO -->
|
||||
<div style="text-align:center; margin:25px 0;">
|
||||
<a href="${linkSolicitacao}"
|
||||
target="_blank"
|
||||
style="display:inline-block; background:#0a6d8d; color:#ffffff; padding:12px 20px; text-decoration:none; border-radius:5px; font-weight:bold;">
|
||||
Acessar Solicitação
|
||||
</a>
|
||||
</div>
|
||||
<p style="font-size:12px; color:#888; margin-top:-10px;">
|
||||
Se o botao nao abrir, copie e cole este link no navegador:<br/>
|
||||
<span>${linkSolicitacao}</span>
|
||||
</p>
|
||||
|
||||
<p style="font-size:13px; color:#777;">
|
||||
Este é um e-mail automático, não responda.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- 🔻 FOOTER -->
|
||||
<div style="background:#f1f5f9; text-align:center; padding:10px; font-size:12px; color:#777;">
|
||||
© Ginseng
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -25,13 +25,40 @@
|
||||
}
|
||||
|
||||
.status-pill {
|
||||
background: #e9f4ff;
|
||||
color: #0d5b91;
|
||||
border: 1px solid #c3def6;
|
||||
background: #eef2f6;
|
||||
color: #5f7080;
|
||||
border: 1px solid #d3dde7;
|
||||
padding: 6px 12px;
|
||||
border-radius: 999px;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
transition: all .2s ease;
|
||||
}
|
||||
|
||||
.status-pill.is-done {
|
||||
background: #e8f7ed;
|
||||
color: #1f6e3e;
|
||||
border-color: #b8e3c4;
|
||||
}
|
||||
|
||||
.status-pill.is-active {
|
||||
background: #e8f2ff;
|
||||
color: #0e56a2;
|
||||
border-color: #8fb8e8;
|
||||
box-shadow: 0 0 0 2px rgba(31, 110, 169, 0.12);
|
||||
}
|
||||
|
||||
.status-pill.status-pill--problem.is-active {
|
||||
background: #ffecec;
|
||||
color: #a12f2f;
|
||||
border-color: #efb1b1;
|
||||
box-shadow: 0 0 0 2px rgba(199, 58, 58, 0.12);
|
||||
}
|
||||
|
||||
.status-pill.status-pill--problem.is-done {
|
||||
background: #fff4e6;
|
||||
color: #8a5c12;
|
||||
border-color: #f2d3a2;
|
||||
}
|
||||
|
||||
.transfer-main-title {
|
||||
@ -216,11 +243,15 @@
|
||||
<div class="fluig-style-guide">
|
||||
<form name="form" role="form">
|
||||
<div class="container-fluid transfer-shell">
|
||||
<div class="transfer-status">
|
||||
<span class="status-pill">Solicitação</span>
|
||||
<span class="status-pill">Coleta</span>
|
||||
<span class="status-pill">Entrega</span>
|
||||
<span class="status-pill">Recebimento</span>
|
||||
<div class="transfer-status" id="transferStatus">
|
||||
<span class="status-pill" data-order="1" data-activities="0,1">Solicitação</span>
|
||||
<span class="status-pill" data-order="2" data-activities="4">Aprovação</span>
|
||||
<span class="status-pill" data-order="3" data-activities="6">Emissão NFe</span>
|
||||
<span class="status-pill" data-order="4" data-activities="31">Coleta</span>
|
||||
<span class="status-pill" data-order="5" data-activities="57">Entrega</span>
|
||||
<span class="status-pill" data-order="6" data-activities="18">Recebimento</span>
|
||||
<span class="status-pill status-pill--problem" data-order="7" data-activities="24">Verificar Problema</span>
|
||||
<span class="status-pill" data-order="8" data-activities="101">Finalizada</span>
|
||||
</div>
|
||||
|
||||
<h1 class="transfer-main-title">Formulário de Transferência de Mercadorias</h1>
|
||||
@ -310,6 +341,7 @@
|
||||
<th style="width:34%;">Código do item</th>
|
||||
<th style="width:18%;">Quantidade</th>
|
||||
<th>Descrição</th>
|
||||
<th style="width:18%;">Categoria</th>
|
||||
<th style="width:70px;"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -319,11 +351,12 @@
|
||||
<td>
|
||||
<input type="zoom" class="form-control transfer-input" name="descricao" data-zoom="{
|
||||
'displayKey':'Code',
|
||||
'datasetId':'ds_rgb_products',
|
||||
'datasetId':'ds_rgb_products_v2',
|
||||
'maximumSelectionLength':'1',
|
||||
'fields':[
|
||||
{'field':'Code','label':'Codigo'},
|
||||
{'field':'Description','label':'Descricao'},
|
||||
{'field':'categoria','label':'Categoria'},
|
||||
{'field':'descricao','label':'Descricao item'},
|
||||
{'field':'id','label':'ID','visible':'false'}
|
||||
]
|
||||
@ -337,6 +370,9 @@
|
||||
<input type="hidden" name="productIdItem" />
|
||||
<input type="hidden" name="codigoProdutoItem" />
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" class="form-control transfer-input" name="categoriaItem" readonly />
|
||||
</td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-default hideButton" onclick="remove_row(this)">
|
||||
<i class="fluigicon fluigicon-trash"></i>
|
||||
@ -517,8 +553,14 @@
|
||||
<input type="text" class="form-control transfer-input inputAnexo" name="fdAnexo_Entrega" id="fdAnexo_Entrega" placeholder="Nenhum anexo selecionado" readonly />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-sm-12">
|
||||
<label class="transfer-label" for="nomerecebedor">Nome de quem recebeu a mercadoria:</label>
|
||||
<input type="text" class="form-control transfer-input" name="nomerecebedor" id="nomerecebedor" />
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="transfer-card activity activity-18">
|
||||
<h2 class="card-title">Validação do Recebimento</h2>
|
||||
<div class="row" style="margin-top:16px;" id="blocoConferenciaNfe">
|
||||
|
||||
@ -0,0 +1,44 @@
|
||||
<div style="font-family: Arial, sans-serif; background-color:#f4f6f8; padding:20px;">
|
||||
<div style="max-width:600px; margin:auto; background:#ffffff; border-radius:8px; overflow:hidden; box-shadow:0 2px 8px rgba(0,0,0,0.1);">
|
||||
|
||||
<div style="background:#0a6d8d; padding:15px; text-align:center; color:#ffffff;">
|
||||
<h2 style="margin:0;">Transferências Ginseng</h2>
|
||||
<p style="margin:0; font-size:13px;">Notificação de Processo</p>
|
||||
</div>
|
||||
|
||||
<div style="padding:25px; color:#333;">
|
||||
<h3 style="margin-top:0; color:#0a6d8d;">Coleta Realizada</h3>
|
||||
|
||||
<p>Olá,</p>
|
||||
<p>O motorista <b>${motoristaColetaNome}</b> coletou o produto na data <b>${dataColeta}</b>.</p>
|
||||
<p>O motorista <b>${motoristaEntregaNome}</b> irá realizar a entrega.</p>
|
||||
|
||||
<div style="background:#f1f5f9; padding:15px; border-radius:6px; margin:20px 0;">
|
||||
<p style="margin:5px 0;"><b>Nº Solicitação:</b> ${WKNumProces}</p>
|
||||
<p style="margin:5px 0;"><b>Chave NFe:</b> ${chaveNfe}</p>
|
||||
</div>
|
||||
|
||||
<p>Clique no botão abaixo para acessar o processo:</p>
|
||||
<div style="text-align:center; margin:25px 0;">
|
||||
<a href="${linkSolicitacao}"
|
||||
target="_blank"
|
||||
style="display:inline-block; background:#0a6d8d; color:#ffffff; padding:12px 20px; text-decoration:none; border-radius:5px; font-weight:bold;">
|
||||
Acessar Solicitação
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<p style="font-size:12px; color:#888; margin-top:-10px;">
|
||||
Se o botão não abrir, copie e cole este link no navegador:<br/>
|
||||
<span>${linkSolicitacao}</span>
|
||||
</p>
|
||||
|
||||
<p style="font-size:13px; color:#777;">
|
||||
Este é um e-mail automático, não responda.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div style="background:#f1f5f9; text-align:center; padding:10px; font-size:12px; color:#777;">
|
||||
© Ginseng
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -0,0 +1,44 @@
|
||||
<div style="font-family: Arial, sans-serif; background-color:#f4f6f8; padding:20px;">
|
||||
<div style="max-width:600px; margin:auto; background:#ffffff; border-radius:8px; overflow:hidden; box-shadow:0 2px 8px rgba(0,0,0,0.1);">
|
||||
|
||||
<div style="background:#0a6d8d; padding:15px; text-align:center; color:#ffffff;">
|
||||
<h2 style="margin:0;">Transferências Ginseng</h2>
|
||||
<p style="margin:0; font-size:13px;">Notificação de Processo</p>
|
||||
</div>
|
||||
|
||||
<div style="padding:25px; color:#333;">
|
||||
<h3 style="margin-top:0; color:#0a6d8d;">Entrega Realizada</h3>
|
||||
|
||||
<p>Olá,</p>
|
||||
<p>O motorista <b>${motoristaEntregaNome}</b> entregou a mercadoria na data <b>${dataEntrega}</b>.</p>
|
||||
<p>Quem recebeu foi: <b>${nomerecebedor}</b>.</p>
|
||||
|
||||
<div style="background:#f1f5f9; padding:15px; border-radius:6px; margin:20px 0;">
|
||||
<p style="margin:5px 0;"><b>Nº Solicitação:</b> ${WKNumProces}</p>
|
||||
<p style="margin:5px 0;"><b>Chave NFe:</b> ${chaveNfe}</p>
|
||||
</div>
|
||||
|
||||
<p>Clique no botão abaixo para acessar o processo:</p>
|
||||
<div style="text-align:center; margin:25px 0;">
|
||||
<a href="${linkSolicitacao}"
|
||||
target="_blank"
|
||||
style="display:inline-block; background:#0a6d8d; color:#ffffff; padding:12px 20px; text-decoration:none; border-radius:5px; font-weight:bold;">
|
||||
Acessar Solicitação
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<p style="font-size:12px; color:#888; margin-top:-10px;">
|
||||
Se o botão não abrir, copie e cole este link no navegador:<br/>
|
||||
<span>${linkSolicitacao}</span>
|
||||
</p>
|
||||
|
||||
<p style="font-size:13px; color:#777;">
|
||||
Este é um e-mail automático, não responda.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div style="background:#f1f5f9; text-align:center; padding:10px; font-size:12px; color:#777;">
|
||||
© Ginseng
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
839
Transferência Ginseng/workflow/.resources/Producao.ws.cache
Normal file
839
Transferência Ginseng/workflow/.resources/Producao.ws.cache
Normal file
@ -0,0 +1,839 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<java version="1.8.0_481" class="java.beans.XMLDecoder">
|
||||
<object class="java.util.HashMap">
|
||||
<void method="put">
|
||||
<string>mecanismoGrupo</string>
|
||||
<object class="java.util.ArrayList">
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>Tecnologia e Comunicação</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>TIC</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>Compras Indiretos</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>ComprasIndiretos</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>Obras e manutenção</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>Manutencao</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>Aprovadores Compras Nvl 3</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>AprovadoresComprasNvl3</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>Motoristas</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>Motoristas</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>Requisitantes de Vaga</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>Requisitantesdevaga</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>Recrutamento</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>Recrutamento</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>TODOS-TODOS-DIADMISSAO</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>TODOS-TODOS-DIADMISSAO</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>ResponsavelDesligamento</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>ResponsavelDesligamento</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>GENTE & CULTURA</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>GENTE_CULTURA</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>LOJA AL</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>LOJA_AL</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>CD</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>CD</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>ESPAÇO DO REVENDEDOR AL</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>ESPACO_DO_REVENDEDOR_AL</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>FINANCEIRO</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>FINANCEIRO</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>OPERAÇÕES</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>OPERACOES</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>AMG AL</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>AMG_AL</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>REGIONAL ALAGOAS</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>REGIONAL_ALAGOAS</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>PREVENÇÃO DE PERDA</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>PREVENCAO_DE_PERDA</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>MARKETING, TREINAMENTO</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>MARKETING_TREINAMENTO</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>SECRETARIA EXECUTIVA</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>SECRETARIA_EXECUTIVA</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>DIRETORIA EXECUTIVA</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>DIRETORIA_EXECUTIVA</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>INFRAESTRUTURA</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>INFRAESTRUTURA</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>ESPAÇO DO REVENDEDOR BA</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>ESPACO_DO_REVENDEDOR_BA</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>BUSINESS INTELLIGENCE</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>BUSINESS_INTELLIGENCE</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>DEPARTAMENTO PESSOAL</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>DEPARTAMENTO_PESSOAL</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>LOJA BA</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>LOJA_BA</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>TREINAMENTO</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>TREINAMENTO</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>AMG BA</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>AMG_BA</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>MARKETING</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>MARKETING</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>COMPRAS</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>COMPRAS</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>AMG SE</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>AMG_SE</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>LOJA SE</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>LOJA_SE</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>ESPAÇO DO REVENDEDOR SE</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>ESPACO_DO_REVENDEDOR_SE</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>VENDAS IN COMPANY</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>VENDAS_IN_COMPANY</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>REGIONAL BAHIA</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>REGIONAL_BAHIA</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>CANAL LOJA 01</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>CANAL_LOJA_01</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>AUDITORIA</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>AUDITORIA</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>CANAL LOJA 02</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>CANAL_LOJA_02</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>PLANEJAMENTO DE DEMANDAS</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>PLANEJAMENTO_DE_DEMANDAS</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>PROJETOS</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>PROJETOS</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>COMPLIANCE</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>COMPLIANCE</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>ESCRITÓRIO - MATRIZ</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>ESCRITORIO_MATRIZ</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>ESCRITÓRIO - CONQUISTA</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>ESCRITORIO_CONQUISTA</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>REGIONAL SERGIPE</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>REGIONAL_SERGIPE</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>Transferencia</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>Transferencia</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>Fiscal</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>Fiscal</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>motoristaAL</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>motoristaAL</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>motoristaBA</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>motoristaBA</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.tds.ecm.foundation.ws.GroupDto">
|
||||
<void property="groupDescription">
|
||||
<string>motoristaSE</string>
|
||||
</void>
|
||||
<void property="groupId">
|
||||
<string>motoristaSE</string>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="put">
|
||||
<string>expediente</string>
|
||||
<array class="java.lang.String" length="4">
|
||||
<void index="0">
|
||||
<string>Default</string>
|
||||
</void>
|
||||
<void index="1">
|
||||
<string>Expediente BackOffice, Logística e Motorista</string>
|
||||
</void>
|
||||
<void index="2">
|
||||
<string>Expediente Escritório Matriz</string>
|
||||
</void>
|
||||
<void index="3">
|
||||
<string>Expediente Lojas</string>
|
||||
</void>
|
||||
</array>
|
||||
</void>
|
||||
<void method="put">
|
||||
<string>camposFormulario, documentoId = 590</string>
|
||||
<array class="java.lang.String" length="64">
|
||||
<void index="0">
|
||||
<string>activity</string>
|
||||
</void>
|
||||
<void index="1">
|
||||
<string>categoriaItem</string>
|
||||
</void>
|
||||
<void index="2">
|
||||
<string>centroCusto</string>
|
||||
</void>
|
||||
<void index="3">
|
||||
<string>chaveNfe</string>
|
||||
</void>
|
||||
<void index="4">
|
||||
<string>codigoItem</string>
|
||||
</void>
|
||||
<void index="5">
|
||||
<string>codigoProdutoItem</string>
|
||||
</void>
|
||||
<void index="6">
|
||||
<string>currentUserId</string>
|
||||
</void>
|
||||
<void index="7">
|
||||
<string>currentUsermail</string>
|
||||
</void>
|
||||
<void index="8">
|
||||
<string>currentUserName</string>
|
||||
</void>
|
||||
<void index="9">
|
||||
<string>dataAbertura</string>
|
||||
</void>
|
||||
<void index="10">
|
||||
<string>dataColeta</string>
|
||||
</void>
|
||||
<void index="11">
|
||||
<string>dataEmissaoApiNfe</string>
|
||||
</void>
|
||||
<void index="12">
|
||||
<string>dataEmissaoNfe</string>
|
||||
</void>
|
||||
<void index="13">
|
||||
<string>dataEntradaNfeConsulta</string>
|
||||
</void>
|
||||
<void index="14">
|
||||
<string>dataEntrega</string>
|
||||
</void>
|
||||
<void index="15">
|
||||
<string>dataValidacaoGestor</string>
|
||||
</void>
|
||||
<void index="16">
|
||||
<string>descricao</string>
|
||||
</void>
|
||||
<void index="17">
|
||||
<string>emailSolicitante</string>
|
||||
</void>
|
||||
<void index="18">
|
||||
<string>estabelecimento</string>
|
||||
</void>
|
||||
<void index="19">
|
||||
<string>excelUpload</string>
|
||||
</void>
|
||||
<void index="20">
|
||||
<string>fdAnexo_Coleta</string>
|
||||
</void>
|
||||
<void index="21">
|
||||
<string>fdAnexo_Entrega</string>
|
||||
</void>
|
||||
<void index="22">
|
||||
<string>fdAnexo_recebimento</string>
|
||||
</void>
|
||||
<void index="23">
|
||||
<string>fnAnexo_Nfe</string>
|
||||
</void>
|
||||
<void index="24">
|
||||
<string>formMode</string>
|
||||
</void>
|
||||
<void index="25">
|
||||
<string>fornecedorNfeConsulta</string>
|
||||
</void>
|
||||
<void index="26">
|
||||
<string>gestorEmail</string>
|
||||
</void>
|
||||
<void index="27">
|
||||
<string>gestorEmailE</string>
|
||||
</void>
|
||||
<void index="28">
|
||||
<string>gestorNome</string>
|
||||
</void>
|
||||
<void index="29">
|
||||
<string>gestorNomeE</string>
|
||||
</void>
|
||||
<void index="30">
|
||||
<string>gestor_cc</string>
|
||||
</void>
|
||||
<void index="31">
|
||||
<string>gestor_cce</string>
|
||||
</void>
|
||||
<void index="32">
|
||||
<string>invoiceIdNfeConsulta</string>
|
||||
</void>
|
||||
<void index="33">
|
||||
<string>itensNfeConsulta</string>
|
||||
</void>
|
||||
<void index="34">
|
||||
<string>itensNfeJson</string>
|
||||
</void>
|
||||
<void index="35">
|
||||
<string>justificativa</string>
|
||||
</void>
|
||||
<void index="36">
|
||||
<string>justificativaDecisaoGestor</string>
|
||||
</void>
|
||||
<void index="37">
|
||||
<string>justificativaDecisaoItens</string>
|
||||
</void>
|
||||
<void index="38">
|
||||
<string>lojaNfeConsulta</string>
|
||||
</void>
|
||||
<void index="39">
|
||||
<string>motoristaColetaLogin</string>
|
||||
</void>
|
||||
<void index="40">
|
||||
<string>motoristaColetaNome</string>
|
||||
</void>
|
||||
<void index="41">
|
||||
<string>motoristaEntregaLogin</string>
|
||||
</void>
|
||||
<void index="42">
|
||||
<string>motoristaEntregaNome</string>
|
||||
</void>
|
||||
<void index="43">
|
||||
<string>motoristaEntregaSelecionado</string>
|
||||
</void>
|
||||
<void index="44">
|
||||
<string>nomerecebedor</string>
|
||||
</void>
|
||||
<void index="45">
|
||||
<string>numeroNfeConsulta</string>
|
||||
</void>
|
||||
<void index="46">
|
||||
<string>operacaoNfeConsulta</string>
|
||||
</void>
|
||||
<void index="47">
|
||||
<string>productIdItem</string>
|
||||
</void>
|
||||
<void index="48">
|
||||
<string>qtdDivergenciasNfe</string>
|
||||
</void>
|
||||
<void index="49">
|
||||
<string>quantidadeItem</string>
|
||||
</void>
|
||||
<void index="50">
|
||||
<string>requesterId</string>
|
||||
</void>
|
||||
<void index="51">
|
||||
<string>requesterMail</string>
|
||||
</void>
|
||||
<void index="52">
|
||||
<string>requesterName</string>
|
||||
</void>
|
||||
<void index="53">
|
||||
<string>serieNfeConsulta</string>
|
||||
</void>
|
||||
<void index="54">
|
||||
<string>situacaoNfeConsulta</string>
|
||||
</void>
|
||||
<void index="55">
|
||||
<string>storeIdNfeConsulta</string>
|
||||
</void>
|
||||
<void index="56">
|
||||
<string>tipoMotoristaEntrega</string>
|
||||
</void>
|
||||
<void index="57">
|
||||
<string>ufDestino</string>
|
||||
</void>
|
||||
<void index="58">
|
||||
<string>ufOrigem</string>
|
||||
</void>
|
||||
<void index="59">
|
||||
<string>userValidacaoGestor</string>
|
||||
</void>
|
||||
<void index="60">
|
||||
<string>usuarioEmissorNfe</string>
|
||||
</void>
|
||||
<void index="61">
|
||||
<string>validacaoItens</string>
|
||||
</void>
|
||||
<void index="62">
|
||||
<string>valorNfeConsulta</string>
|
||||
</void>
|
||||
<void index="63">
|
||||
<string>WKNumProces</string>
|
||||
</void>
|
||||
</array>
|
||||
</void>
|
||||
<void method="put">
|
||||
<string>mecanismo</string>
|
||||
<array class="[Ljava.lang.Object;" length="12">
|
||||
<void index="0">
|
||||
<array class="java.lang.Object" length="2">
|
||||
<void index="0">
|
||||
<string>Atribuição por Associação</string>
|
||||
</void>
|
||||
<void index="1">
|
||||
<string>Associado</string>
|
||||
</void>
|
||||
</array>
|
||||
</void>
|
||||
<void index="1">
|
||||
<array class="java.lang.Object" length="2">
|
||||
<void index="0">
|
||||
<string>Atribuição por Campo de Formulário</string>
|
||||
</void>
|
||||
<void index="1">
|
||||
<string>Campo Formulário</string>
|
||||
</void>
|
||||
</array>
|
||||
</void>
|
||||
<void index="2">
|
||||
<array class="java.lang.Object" length="2">
|
||||
<void index="0">
|
||||
<string>dpf_di_emp_filial_filtro</string>
|
||||
</void>
|
||||
<void index="1">
|
||||
<string>dpf_di_emp_filial_filtro</string>
|
||||
</void>
|
||||
</array>
|
||||
</void>
|
||||
<void index="3">
|
||||
<array class="java.lang.Object" length="2">
|
||||
<void index="0">
|
||||
<string>dpf_di_inicio_diadmissao</string>
|
||||
</void>
|
||||
<void index="1">
|
||||
<string>dpf_di_inicio_diadmissao</string>
|
||||
</void>
|
||||
</array>
|
||||
</void>
|
||||
<void index="4">
|
||||
<array class="java.lang.Object" length="2">
|
||||
<void index="0">
|
||||
<string>Atribuição por Executor de Atividade</string>
|
||||
</void>
|
||||
<void index="1">
|
||||
<string>Executor Atividade</string>
|
||||
</void>
|
||||
</array>
|
||||
</void>
|
||||
<void index="5">
|
||||
<array class="java.lang.Object" length="2">
|
||||
<void index="0">
|
||||
<string>Atribuição por Grupo</string>
|
||||
</void>
|
||||
<void index="1">
|
||||
<string>Grupo</string>
|
||||
</void>
|
||||
</array>
|
||||
</void>
|
||||
<void index="6">
|
||||
<array class="java.lang.Object" length="2">
|
||||
<void index="0">
|
||||
<string>Atribuição por Grupos do Colaborador</string>
|
||||
</void>
|
||||
<void index="1">
|
||||
<string>Grupos Colaborador</string>
|
||||
</void>
|
||||
</array>
|
||||
</void>
|
||||
<void index="7">
|
||||
<array class="java.lang.Object" length="2">
|
||||
<void index="0">
|
||||
<string>mecCustomAprov</string>
|
||||
</void>
|
||||
<void index="1">
|
||||
<string>mecCustomAprov</string>
|
||||
</void>
|
||||
</array>
|
||||
</void>
|
||||
<void index="8">
|
||||
<array class="java.lang.Object" length="2">
|
||||
<void index="0">
|
||||
<string>Atribuição por Papel</string>
|
||||
</void>
|
||||
<void index="1">
|
||||
<string>Papel</string>
|
||||
</void>
|
||||
</array>
|
||||
</void>
|
||||
<void index="9">
|
||||
<array class="java.lang.Object" length="2">
|
||||
<void index="0">
|
||||
<string>Atribuição para um Grupo</string>
|
||||
</void>
|
||||
<void index="1">
|
||||
<string>Pool Grupo</string>
|
||||
</void>
|
||||
</array>
|
||||
</void>
|
||||
<void index="10">
|
||||
<array class="java.lang.Object" length="2">
|
||||
<void index="0">
|
||||
<string>Atribuição para um Papel</string>
|
||||
</void>
|
||||
<void index="1">
|
||||
<string>Pool Papel</string>
|
||||
</void>
|
||||
</array>
|
||||
</void>
|
||||
<void index="11">
|
||||
<array class="java.lang.Object" length="2">
|
||||
<void index="0">
|
||||
<string>Atribuição por Usuário</string>
|
||||
</void>
|
||||
<void index="1">
|
||||
<string>Usuário</string>
|
||||
</void>
|
||||
</array>
|
||||
</void>
|
||||
</array>
|
||||
</void>
|
||||
</object>
|
||||
</java>
|
||||
1372
Transferência Ginseng/workflow/.resources/Producao.ws.cache.bkp
Normal file
1372
Transferência Ginseng/workflow/.resources/Producao.ws.cache.bkp
Normal file
File diff suppressed because it is too large
Load Diff
@ -8,10 +8,10 @@
|
||||
<instruction>Este flow permite abertura de solicitação de transferências automatizadas, informando qual item será transferido e direcionado para as aprovações corretas.</instruction>
|
||||
<active>true</active>
|
||||
<publicProcess>false</publicProcess>
|
||||
<volumeId>Fluig teste</volumeId>
|
||||
<volumeId>Default</volumeId>
|
||||
<categoryId>Transferência</categoryId>
|
||||
<managerEngineAllocationId>Usuário</managerEngineAllocationId>
|
||||
<managerEngineAllocationConfiguration><AssignmentController><User>projetos</User></AssignmentController></managerEngineAllocationConfiguration>
|
||||
<managerEngineAllocationId>Grupo</managerEngineAllocationId>
|
||||
<managerEngineAllocationConfiguration><AssignmentController><Group>CD</Group></AssignmentController></managerEngineAllocationConfiguration>
|
||||
<snapshotFrequency>0</snapshotFrequency>
|
||||
<baseDay>0</baseDay>
|
||||
<baseMonth>0</baseMonth>
|
||||
@ -33,7 +33,6 @@
|
||||
</processDefinitionVersionPK>
|
||||
<versionDescription></versionDescription>
|
||||
<formId>590</formId>
|
||||
<formIdV2>0</formIdV2>
|
||||
<editionMode>true</editionMode>
|
||||
<updateAttachmentsVersion>true</updateAttachmentsVersion>
|
||||
<controlsAttachmentsSecurity>false</controlsAttachmentsSecurity>
|
||||
@ -127,8 +126,8 @@
|
||||
<notifyAuthorityFollowUp>true</notifyAuthorityFollowUp>
|
||||
<notifyRequisitionerFollowUp>true</notifyRequisitionerFollowUp>
|
||||
<automatic>false</automatic>
|
||||
<positionX>490</positionX>
|
||||
<positionY>281</positionY>
|
||||
<positionX>500</positionX>
|
||||
<positionY>280</positionY>
|
||||
<forecastedEffortType>0</forecastedEffortType>
|
||||
<forecastedEffort>0</forecastedEffort>
|
||||
<notifyManagerFollowUp>false</notifyManagerFollowUp>
|
||||
@ -179,7 +178,7 @@
|
||||
<notifyAuthorityFollowUp>true</notifyAuthorityFollowUp>
|
||||
<notifyRequisitionerFollowUp>true</notifyRequisitionerFollowUp>
|
||||
<automatic>false</automatic>
|
||||
<positionX>490</positionX>
|
||||
<positionX>500</positionX>
|
||||
<positionY>490</positionY>
|
||||
<forecastedEffortType>0</forecastedEffortType>
|
||||
<forecastedEffort>0</forecastedEffort>
|
||||
@ -232,7 +231,7 @@
|
||||
<notifyRequisitionerFollowUp>true</notifyRequisitionerFollowUp>
|
||||
<automatic>false</automatic>
|
||||
<positionX>1170</positionX>
|
||||
<positionY>270</positionY>
|
||||
<positionY>284</positionY>
|
||||
<forecastedEffortType>0</forecastedEffortType>
|
||||
<forecastedEffort>0</forecastedEffort>
|
||||
<notifyManagerFollowUp>false</notifyManagerFollowUp>
|
||||
@ -283,7 +282,7 @@
|
||||
<notifyAuthorityFollowUp>true</notifyAuthorityFollowUp>
|
||||
<notifyRequisitionerFollowUp>true</notifyRequisitionerFollowUp>
|
||||
<automatic>false</automatic>
|
||||
<positionX>1410</positionX>
|
||||
<positionX>1400</positionX>
|
||||
<positionY>479</positionY>
|
||||
<forecastedEffortType>0</forecastedEffortType>
|
||||
<forecastedEffort>0</forecastedEffort>
|
||||
@ -319,8 +318,7 @@
|
||||
<deadlineFieldName></deadlineFieldName>
|
||||
<joint>false</joint>
|
||||
<agreementPercentage>0</agreementPercentage>
|
||||
<engineAllocationId>Pool Grupo</engineAllocationId>
|
||||
<engineAllocationConfiguration><AssignmentController><Group>Motoristas</Group></AssignmentController></engineAllocationConfiguration>
|
||||
<engineAllocationId></engineAllocationId>
|
||||
<selectColleague>1</selectColleague>
|
||||
<initialState>false</initialState>
|
||||
<notifyAuthorityDelay>false</notifyAuthorityDelay>
|
||||
@ -439,7 +437,7 @@
|
||||
<notifyRequisitionerFollowUp>false</notifyRequisitionerFollowUp>
|
||||
<automatic>false</automatic>
|
||||
<positionX>1600</positionX>
|
||||
<positionY>260</positionY>
|
||||
<positionY>284</positionY>
|
||||
<forecastedEffortType>0</forecastedEffortType>
|
||||
<forecastedEffort>0</forecastedEffort>
|
||||
<notifyManagerFollowUp>false</notifyManagerFollowUp>
|
||||
@ -541,7 +539,7 @@
|
||||
<notifyRequisitionerFollowUp>false</notifyRequisitionerFollowUp>
|
||||
<automatic>false</automatic>
|
||||
<positionX>1660</positionX>
|
||||
<positionY>260</positionY>
|
||||
<positionY>284</positionY>
|
||||
<forecastedEffortType>0</forecastedEffortType>
|
||||
<forecastedEffort>0</forecastedEffort>
|
||||
<notifyManagerFollowUp>false</notifyManagerFollowUp>
|
||||
@ -598,8 +596,33 @@
|
||||
<subProcessId></subProcessId>
|
||||
<formFolder>0</formFolder>
|
||||
<automatic>true</automatic>
|
||||
<positionX>1430</positionX>
|
||||
<positionY>250</positionY>
|
||||
<positionX>1420</positionX>
|
||||
<positionY>268</positionY>
|
||||
<inhibitTransfer>false</inhibitTransfer>
|
||||
<stateType>1</stateType>
|
||||
<bpmnType>120</bpmnType>
|
||||
<signalId>0</signalId>
|
||||
<openInstances>0</openInstances>
|
||||
<destinationStates/>
|
||||
<digitalSignature>false</digitalSignature>
|
||||
</ProcessState>
|
||||
<ProcessState>
|
||||
<processStatePK>
|
||||
<companyId>1</companyId>
|
||||
<processId>Transferência Ginseng</processId>
|
||||
<version>1</version>
|
||||
<sequence>107</sequence>
|
||||
</processStatePK>
|
||||
<stateName>Validar rota</stateName>
|
||||
<stateDescription>Validar rota</stateDescription>
|
||||
<joint>false</joint>
|
||||
<initialState>false</initialState>
|
||||
<transferAttachments>false</transferAttachments>
|
||||
<subProcessId></subProcessId>
|
||||
<formFolder>0</formFolder>
|
||||
<automatic>true</automatic>
|
||||
<positionX>520</positionX>
|
||||
<positionY>663</positionY>
|
||||
<inhibitTransfer>false</inhibitTransfer>
|
||||
<stateType>1</stateType>
|
||||
<bpmnType>120</bpmnType>
|
||||
@ -778,8 +801,8 @@
|
||||
<notifyAuthorityFollowUp>false</notifyAuthorityFollowUp>
|
||||
<notifyRequisitionerFollowUp>false</notifyRequisitionerFollowUp>
|
||||
<automatic>false</automatic>
|
||||
<positionX>1780</positionX>
|
||||
<positionY>280</positionY>
|
||||
<positionX>1777</positionX>
|
||||
<positionY>300</positionY>
|
||||
<forecastedEffortType>0</forecastedEffortType>
|
||||
<forecastedEffort>0</forecastedEffort>
|
||||
<notifyManagerFollowUp>false</notifyManagerFollowUp>
|
||||
@ -850,6 +873,62 @@
|
||||
<destinationSequenceId>24</destinationSequenceId>
|
||||
<conditionType>0</conditionType>
|
||||
</ConditionProcessState>
|
||||
<ConditionProcessState>
|
||||
<conditionProcessStatePK>
|
||||
<companyId>1</companyId>
|
||||
<processId>Transferência Ginseng</processId>
|
||||
<expressionOrder>1</expressionOrder>
|
||||
<version>46</version>
|
||||
<sequence>107</sequence>
|
||||
</conditionProcessStatePK>
|
||||
<condition>hAPI.getCardValue("ufOrigem") == "AL"</condition>
|
||||
<destinationSequenceId>31</destinationSequenceId>
|
||||
<engineAllocationConfiguration><AssignmentController><Group>motoristaAL</Group></AssignmentController></engineAllocationConfiguration>
|
||||
<engineAllocationId>Pool Grupo</engineAllocationId>
|
||||
<conditionType>0</conditionType>
|
||||
</ConditionProcessState>
|
||||
<ConditionProcessState>
|
||||
<conditionProcessStatePK>
|
||||
<companyId>1</companyId>
|
||||
<processId>Transferência Ginseng</processId>
|
||||
<expressionOrder>2</expressionOrder>
|
||||
<version>46</version>
|
||||
<sequence>107</sequence>
|
||||
</conditionProcessStatePK>
|
||||
<condition>hAPI.getCardValue("ufOrigem") == "BA"</condition>
|
||||
<destinationSequenceId>31</destinationSequenceId>
|
||||
<engineAllocationConfiguration><AssignmentController><Group>motoristaBA</Group></AssignmentController></engineAllocationConfiguration>
|
||||
<engineAllocationId>Pool Grupo</engineAllocationId>
|
||||
<conditionType>0</conditionType>
|
||||
</ConditionProcessState>
|
||||
<ConditionProcessState>
|
||||
<conditionProcessStatePK>
|
||||
<companyId>1</companyId>
|
||||
<processId>Transferência Ginseng</processId>
|
||||
<expressionOrder>3</expressionOrder>
|
||||
<version>46</version>
|
||||
<sequence>107</sequence>
|
||||
</conditionProcessStatePK>
|
||||
<condition>hAPI.getCardValue("ufOrigem") == "SE"</condition>
|
||||
<destinationSequenceId>31</destinationSequenceId>
|
||||
<engineAllocationConfiguration><AssignmentController><Group>motoristaSE</Group></AssignmentController></engineAllocationConfiguration>
|
||||
<engineAllocationId>Pool Grupo</engineAllocationId>
|
||||
<conditionType>0</conditionType>
|
||||
</ConditionProcessState>
|
||||
<ConditionProcessState>
|
||||
<conditionProcessStatePK>
|
||||
<companyId>1</companyId>
|
||||
<processId>Transferência Ginseng</processId>
|
||||
<expressionOrder>4</expressionOrder>
|
||||
<version>46</version>
|
||||
<sequence>107</sequence>
|
||||
</conditionProcessStatePK>
|
||||
<condition>hAPI.getCardValue("ufOrigem") == ""</condition>
|
||||
<destinationSequenceId>31</destinationSequenceId>
|
||||
<engineAllocationConfiguration><AssignmentController><Group>CD</Group></AssignmentController></engineAllocationConfiguration>
|
||||
<engineAllocationId>Pool Grupo</engineAllocationId>
|
||||
<conditionType>0</conditionType>
|
||||
</ConditionProcessState>
|
||||
</list>
|
||||
<list>
|
||||
<ProcessLink>
|
||||
@ -913,12 +992,12 @@
|
||||
<version>1</version>
|
||||
<linkSequence>26</linkSequence>
|
||||
</processLinkPK>
|
||||
<actionLabel></actionLabel>
|
||||
<actionLabel>Ajuste realizado</actionLabel>
|
||||
<returnPermited>false</returnPermited>
|
||||
<initialStateSequence>24</initialStateSequence>
|
||||
<finalStateSequence>18</finalStateSequence>
|
||||
<returnLabel></returnLabel>
|
||||
<name></name>
|
||||
<name>Ajuste de transferência</name>
|
||||
<automaticLink>false</automaticLink>
|
||||
<defaultLink>false</defaultLink>
|
||||
<type>0</type>
|
||||
@ -947,12 +1026,12 @@
|
||||
<version>1</version>
|
||||
<linkSequence>47</linkSequence>
|
||||
</processLinkPK>
|
||||
<actionLabel></actionLabel>
|
||||
<actionLabel>Confirmar recebimento</actionLabel>
|
||||
<returnPermited>false</returnPermited>
|
||||
<initialStateSequence>18</initialStateSequence>
|
||||
<finalStateSequence>46</finalStateSequence>
|
||||
<returnLabel></returnLabel>
|
||||
<name></name>
|
||||
<name>Confirmar recebimento</name>
|
||||
<automaticLink>false</automaticLink>
|
||||
<defaultLink>false</defaultLink>
|
||||
<type>0</type>
|
||||
@ -1015,7 +1094,7 @@
|
||||
<version>1</version>
|
||||
<linkSequence>85</linkSequence>
|
||||
</processLinkPK>
|
||||
<actionLabel>Produtos entregue</actionLabel>
|
||||
<actionLabel>Transferência entregue</actionLabel>
|
||||
<returnPermited>false</returnPermited>
|
||||
<initialStateSequence>57</initialStateSequence>
|
||||
<finalStateSequence>18</finalStateSequence>
|
||||
@ -1025,23 +1104,6 @@
|
||||
<defaultLink>false</defaultLink>
|
||||
<type>0</type>
|
||||
</ProcessLink>
|
||||
<ProcessLink>
|
||||
<processLinkPK>
|
||||
<companyId>1</companyId>
|
||||
<processId>Transferência Ginseng</processId>
|
||||
<version>1</version>
|
||||
<linkSequence>95</linkSequence>
|
||||
</processLinkPK>
|
||||
<actionLabel>Enviar para coleta</actionLabel>
|
||||
<returnPermited>false</returnPermited>
|
||||
<initialStateSequence>68</initialStateSequence>
|
||||
<finalStateSequence>31</finalStateSequence>
|
||||
<returnLabel></returnLabel>
|
||||
<name>Enviar para coleta</name>
|
||||
<automaticLink>false</automaticLink>
|
||||
<defaultLink>false</defaultLink>
|
||||
<type>0</type>
|
||||
</ProcessLink>
|
||||
<ProcessLink>
|
||||
<processLinkPK>
|
||||
<companyId>1</companyId>
|
||||
@ -1066,12 +1128,12 @@
|
||||
<version>1</version>
|
||||
<linkSequence>98</linkSequence>
|
||||
</processLinkPK>
|
||||
<actionLabel></actionLabel>
|
||||
<actionLabel>Pedido coletado</actionLabel>
|
||||
<returnPermited>false</returnPermited>
|
||||
<initialStateSequence>31</initialStateSequence>
|
||||
<finalStateSequence>57</finalStateSequence>
|
||||
<returnLabel></returnLabel>
|
||||
<name></name>
|
||||
<name>Entregar produto</name>
|
||||
<automaticLink>false</automaticLink>
|
||||
<defaultLink>false</defaultLink>
|
||||
<type>0</type>
|
||||
@ -1144,9 +1206,292 @@
|
||||
<defaultLink>false</defaultLink>
|
||||
<type>0</type>
|
||||
</ProcessLink>
|
||||
<ProcessLink>
|
||||
<processLinkPK>
|
||||
<companyId>1</companyId>
|
||||
<processId>Transferência Ginseng</processId>
|
||||
<version>1</version>
|
||||
<linkSequence>108</linkSequence>
|
||||
</processLinkPK>
|
||||
<actionLabel>Enviar para coleta</actionLabel>
|
||||
<returnPermited>false</returnPermited>
|
||||
<initialStateSequence>6</initialStateSequence>
|
||||
<finalStateSequence>107</finalStateSequence>
|
||||
<returnLabel></returnLabel>
|
||||
<name>Enviar para rota</name>
|
||||
<automaticLink>false</automaticLink>
|
||||
<defaultLink>false</defaultLink>
|
||||
<type>0</type>
|
||||
</ProcessLink>
|
||||
<ProcessLink>
|
||||
<processLinkPK>
|
||||
<companyId>1</companyId>
|
||||
<processId>Transferência Ginseng</processId>
|
||||
<version>1</version>
|
||||
<linkSequence>109</linkSequence>
|
||||
</processLinkPK>
|
||||
<actionLabel></actionLabel>
|
||||
<returnPermited>false</returnPermited>
|
||||
<initialStateSequence>107</initialStateSequence>
|
||||
<finalStateSequence>31</finalStateSequence>
|
||||
<returnLabel></returnLabel>
|
||||
<name></name>
|
||||
<automaticLink>false</automaticLink>
|
||||
<defaultLink>false</defaultLink>
|
||||
<type>0</type>
|
||||
</ProcessLink>
|
||||
</list>
|
||||
<list/>
|
||||
<list>
|
||||
<WorkflowProcessEvent>
|
||||
<workflowProcessEventPK>
|
||||
<companyId>1</companyId>
|
||||
<eventId>beforeTaskSave</eventId>
|
||||
<processId>Transferência Ginseng</processId>
|
||||
<version>1</version>
|
||||
</workflowProcessEventPK>
|
||||
<eventDescription>function beforeTaskSave(colleagueId, nextSequenceId, userList) {
|
||||
try {
|
||||
var currentState = parseInt(getValue("WKNumState"), 10);
|
||||
var completeTask = String(getValue("WKCompletTask") || "false");
|
||||
var nextState = parseInt(String(nextSequenceId || "0"), 10);
|
||||
|
||||
if (completeTask !== "true") return;
|
||||
|
||||
if (currentState === 6) {
|
||||
// Fluxo de cancelamento saindo da atividade 6 nao deve disparar template de nota emitida.
|
||||
if (nextState === 97) return;
|
||||
enviarNotificacaoNotaEmitida();
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentState === 31) {
|
||||
enviarNotificacaoColetaRealizada();
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentState === 57) {
|
||||
// 61 = cancelamento no diagrama.
|
||||
if (nextState === 61) return;
|
||||
enviarNotificacaoEntregaRealizada();
|
||||
}
|
||||
} catch (e) {
|
||||
log.error("[Transferencia.beforeTaskSave] Erro no beforeTaskSave: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
function enviarNotificacaoNotaEmitida() {
|
||||
var envio = montarContextoEnvio();
|
||||
if (!envio.ok) return;
|
||||
|
||||
var params = buildCommonParams(envio.processNumber, envio.chaveNfe, envio.processLink);
|
||||
notifyTemplate("tpl_nota_emitida", envio.destinoEmail, envio.requesterId, params, envio.processNumber, envio.processLink);
|
||||
}
|
||||
|
||||
function enviarNotificacaoColetaRealizada() {
|
||||
var envio = montarContextoEnvio();
|
||||
if (!envio.ok) return;
|
||||
|
||||
var motoristaColetaNome = safeTrim(hAPI.getCardValue("motoristaColetaNome"));
|
||||
var dataColeta = safeTrim(hAPI.getCardValue("dataColeta"));
|
||||
var motoristaEntregaNome = safeTrim(hAPI.getCardValue("motoristaEntregaNome"));
|
||||
var tipoMotoristaEntrega = safeTrim(hAPI.getCardValue("tipoMotoristaEntrega"));
|
||||
|
||||
if (motoristaEntregaNome === "" && tipoMotoristaEntrega === "mesmo") {
|
||||
motoristaEntregaNome = motoristaColetaNome;
|
||||
}
|
||||
|
||||
var params = buildCommonParams(envio.processNumber, envio.chaveNfe, envio.processLink);
|
||||
params.put("motoristaColetaNome", motoristaColetaNome);
|
||||
params.put("dataColeta", dataColeta);
|
||||
params.put("motoristaEntregaNome", motoristaEntregaNome);
|
||||
|
||||
notifyTemplate("tpl_coleta_realizada", envio.destinoEmail, envio.requesterId, params, envio.processNumber, envio.processLink);
|
||||
}
|
||||
|
||||
function enviarNotificacaoEntregaRealizada() {
|
||||
var envio = montarContextoEnvio();
|
||||
if (!envio.ok) return;
|
||||
|
||||
var motoristaEntregaNome = safeTrim(hAPI.getCardValue("motoristaEntregaNome"));
|
||||
var dataEntrega = safeTrim(hAPI.getCardValue("dataEntrega"));
|
||||
var nomerecebedor = safeTrim(hAPI.getCardValue("nomerecebedor"));
|
||||
|
||||
var params = buildCommonParams(envio.processNumber, envio.chaveNfe, envio.processLink);
|
||||
params.put("motoristaEntregaNome", motoristaEntregaNome);
|
||||
params.put("dataEntrega", dataEntrega);
|
||||
params.put("nomerecebedor", nomerecebedor);
|
||||
|
||||
notifyTemplate("tpl_entrega_realizada", envio.destinoEmail, envio.requesterId, params, envio.processNumber, envio.processLink);
|
||||
}
|
||||
|
||||
function montarContextoEnvio() {
|
||||
var requesterId = safeTrim(hAPI.getCardValue("requesterId"));
|
||||
var requesterMail = safeTrim(hAPI.getCardValue("requesterMail"));
|
||||
|
||||
if (requesterId === "" && requesterMail !== "") {
|
||||
requesterId = findColleagueIdByMail(requesterMail);
|
||||
}
|
||||
|
||||
// Prioriza email explicito salvo no formulario; fallback para email do colleague.
|
||||
var destinoEmail = requesterMail;
|
||||
if (!isValidEmail(destinoEmail)) {
|
||||
destinoEmail = resolveEmailByColleagueId(requesterId);
|
||||
}
|
||||
|
||||
if (!isValidEmail(destinoEmail)) {
|
||||
log.warn("[Transferencia.beforeTaskSave] Email do solicitante invalido. requesterId=" + requesterId + ", requesterMail=[" + requesterMail + "], destinoEmail=[" + destinoEmail + "]");
|
||||
return { ok: false };
|
||||
}
|
||||
|
||||
var processNumber = safeTrim(getValue("WKNumProces"));
|
||||
var chaveNfe = onlyDigits(hAPI.getCardValue("chaveNfe"));
|
||||
if (chaveNfe === "") chaveNfe = safeTrim(hAPI.getCardValue("chaveNfe"));
|
||||
var processLink = buildProcessLink(processNumber);
|
||||
|
||||
return {
|
||||
ok: true,
|
||||
requesterId: requesterId,
|
||||
destinoEmail: destinoEmail,
|
||||
processNumber: processNumber,
|
||||
chaveNfe: chaveNfe,
|
||||
processLink: processLink
|
||||
};
|
||||
}
|
||||
|
||||
function buildCommonParams(processNumber, chaveNfe, processLink) {
|
||||
var params = new java.util.HashMap();
|
||||
params.put("WKNumProces", processNumber);
|
||||
params.put("chaveNfe", chaveNfe);
|
||||
params.put("linkSolicitacao", processLink);
|
||||
params.put("link", processLink);
|
||||
return params;
|
||||
}
|
||||
|
||||
function notifyTemplate(templateCode, destinoEmail, requesterId, params, processNumber, processLink) {
|
||||
var NOTIFIER_SENDER_USER = "admin";
|
||||
var recipients = new java.util.ArrayList();
|
||||
recipients.add(destinoEmail);
|
||||
|
||||
notifier.notify(NOTIFIER_SENDER_USER, templateCode, params, recipients, "text/html");
|
||||
log.info("[Transferencia.beforeTaskSave] " + templateCode + " enviado. processo=" + processNumber + ", destino=" + destinoEmail + ", requesterId=" + requesterId + ", link=[" + processLink + "]");
|
||||
}
|
||||
|
||||
function buildProcessLink(processNumber) {
|
||||
var BASE_URL_FALLBACK = "https://comerciode188007.fluig.cloudtotvs.com.br";
|
||||
var baseUrl = safeTrim(getValue("WKServerURL"));
|
||||
var companyId = safeTrim(getValue("WKCompany"));
|
||||
if (baseUrl === "") baseUrl = BASE_URL_FALLBACK;
|
||||
if (baseUrl.indexOf("http://") !== 0 && baseUrl.indexOf("https://") !== 0) {
|
||||
baseUrl = "https://" + baseUrl;
|
||||
}
|
||||
if (baseUrl.charAt(baseUrl.length - 1) === "/") baseUrl = baseUrl.substring(0, baseUrl.length - 1);
|
||||
if (companyId === "") companyId = "1";
|
||||
if (baseUrl === "" || safeTrim(processNumber) === "") return "";
|
||||
return baseUrl + "/portal/p/" + companyId + "/pageworkflowview?app_ecm_workflowview_detailsProcessInstanceID=" + processNumber;
|
||||
}
|
||||
|
||||
function findColleagueIdByMail(mail) {
|
||||
var email = safeTrim(mail);
|
||||
if (email === "") return "";
|
||||
|
||||
try {
|
||||
var cMail = DatasetFactory.createConstraint("mail", email, email, ConstraintType.MUST);
|
||||
var dsColleague = DatasetFactory.getDataset("colleague", null, [cMail], null);
|
||||
if (!dsColleague || dsColleague.rowsCount < 1) return "";
|
||||
|
||||
return safeTrim(
|
||||
dsColleague.getValue(0, "colleaguePK.colleagueId") ||
|
||||
dsColleague.getValue(0, "colleagueId") ||
|
||||
dsColleague.getValue(0, "login")
|
||||
);
|
||||
} catch (e) {
|
||||
log.warn("[Transferencia.beforeTaskSave] Falha ao buscar solicitante por mail: " + e);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
function resolveEmailByColleagueId(colleagueId) {
|
||||
var id = safeTrim(colleagueId);
|
||||
if (id === "") return "";
|
||||
|
||||
try {
|
||||
var cActive = DatasetFactory.createConstraint("active", "true", "true", ConstraintType.MUST);
|
||||
|
||||
var cId = DatasetFactory.createConstraint("colleaguePK.colleagueId", id, id, ConstraintType.MUST);
|
||||
var byId = DatasetFactory.getDataset("colleague", null, [cId, cActive], null);
|
||||
if (byId && byId.rowsCount > 0) {
|
||||
return safeTrim(byId.getValue(0, "mail"));
|
||||
}
|
||||
|
||||
var cLogin = DatasetFactory.createConstraint("login", id, id, ConstraintType.MUST);
|
||||
var byLogin = DatasetFactory.getDataset("colleague", null, [cLogin, cActive], null);
|
||||
if (byLogin && byLogin.rowsCount > 0) {
|
||||
return safeTrim(byLogin.getValue(0, "mail"));
|
||||
}
|
||||
} catch (e) {
|
||||
log.warn("[Transferencia.beforeTaskSave] Falha ao buscar email do solicitante por colleagueId: " + e);
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
function isValidEmail(email) {
|
||||
var v = safeTrim(email);
|
||||
if (v === "") return false;
|
||||
if (/\s/.test(v)) return false;
|
||||
|
||||
var at = v.indexOf("@");
|
||||
if (at <= 0 || at !== v.lastIndexOf("@")) return false;
|
||||
|
||||
var dot = v.lastIndexOf(".");
|
||||
return dot > at + 1 && dot < (v.length - 1);
|
||||
}
|
||||
|
||||
function safeTrim(value) {
|
||||
return String(value == null ? "" : value).trim();
|
||||
}
|
||||
|
||||
function onlyDigits(value) {
|
||||
return String(value == null ? "" : value).replace(/\D/g, "");
|
||||
}
|
||||
</eventDescription>
|
||||
</WorkflowProcessEvent>
|
||||
<WorkflowProcessEvent>
|
||||
<workflowProcessEventPK>
|
||||
<companyId>1</companyId>
|
||||
<eventId>onNotify</eventId>
|
||||
<processId>Transferência Ginseng</processId>
|
||||
<version>1</version>
|
||||
</workflowProcessEventPK>
|
||||
<eventDescription>function onNotify(subject, receivers, template, params) {
|
||||

|
||||
log.info("===== onNotify GLOBAL ===== Template: " + template);
|
||||

|
||||
var validos = new java.util.ArrayList();
|
||||

|
||||
for (var i = 0; i < receivers.size(); i++) {
|
||||

|
||||
var email = receivers.get(i);
|
||||

|
||||
log.info("Receiver original: [" + email + "]");
|
||||

|
||||
if (email && email.indexOf("@") > 0 && email.indexOf(".") > 0) {
|
||||
validos.add(email);
|
||||
} else {
|
||||
log.warn("REMOVIDO EMAIL INVALIDO: [" + email + "] TEMPLATE: " + template);
|
||||
}
|
||||
}
|
||||

|
||||
receivers.clear();
|
||||

|
||||
for (var j = 0; j < validos.size(); j++) {
|
||||
receivers.add(validos.get(j));
|
||||
}
|
||||

|
||||
log.info("TOTAL FINAL RECEIVERS: " + receivers.size());
|
||||
}</eventDescription>
|
||||
</WorkflowProcessEvent>
|
||||
<WorkflowProcessEvent>
|
||||
<workflowProcessEventPK>
|
||||
<companyId>1</companyId>
|
||||
@ -1154,54 +1499,54 @@
|
||||
<processId>Transferência Ginseng</processId>
|
||||
<version>1</version>
|
||||
</workflowProcessEventPK>
|
||||
<eventDescription>function servicetask99(attempt, message) {
|
||||
try {
|
||||
var validacaoItens = safeTrim(hAPI.getCardValue("validacaoItens"));
|
||||

|
||||
// Só precisa consultar entrada da NFe quando o recebimento foi validado como entregue.
|
||||
if (validacaoItens !== "entregue") return;
|
||||

|
||||
var dataEntrada = safeTrim(hAPI.getCardValue("dataEntradaNfeConsulta"));
|
||||
if (dataEntrada !== "") return;
|
||||

|
||||
var chaveNfe = onlyDigits(hAPI.getCardValue("chaveNfe"));
|
||||
if (chaveNfe === "") {
|
||||
log.warn("[servicetask99] Chave NFe vazia. Nao foi possivel consultar entrada.");
|
||||
return;
|
||||
}
|
||||

|
||||
var cKey = DatasetFactory.createConstraint("key", chaveNfe, chaveNfe, ConstraintType.MUST);
|
||||
var dsNfe = DatasetFactory.getDataset("ds_fiscal_invoice_by_keys", null, [cKey], null);
|
||||

|
||||
if (!dsNfe || dsNfe.rowsCount < 1) {
|
||||
log.warn("[servicetask99] Dataset sem retorno para chave: " + chaveNfe);
|
||||
return;
|
||||
}
|
||||

|
||||
var dsSuccess = safeTrim(dsNfe.getValue(0, "success")).toLowerCase() === "true";
|
||||
var dsUpdatedAt = safeTrim(dsNfe.getValue(0, "updatedAt"));
|
||||

|
||||
if (dsSuccess && dsUpdatedAt !== "") {
|
||||
hAPI.setCardValue("dataEntradaNfeConsulta", dsUpdatedAt);
|
||||
log.info("[servicetask99] Data de entrada atualizada automaticamente: " + dsUpdatedAt);
|
||||
return;
|
||||
}
|
||||

|
||||
var dsMessage = safeTrim(dsNfe.getValue(0, "message"));
|
||||
log.warn("[servicetask99] Consulta executada sem data de entrada. message=" + dsMessage);
|
||||
} catch (e) {
|
||||
log.error("[servicetask99] Erro na consulta automatica da NFe: " + e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||

|
||||
function safeTrim(value) {
|
||||
return String(value == null ? "" : value).trim();
|
||||
}
|
||||

|
||||
function onlyDigits(value) {
|
||||
return String(value == null ? "" : value).replace(/\D/g, "");
|
||||
}
|
||||
<eventDescription>function servicetask99(attempt, message) {
|
||||
try {
|
||||
var validacaoItens = safeTrim(hAPI.getCardValue("validacaoItens"));
|
||||
|
||||
// Só precisa consultar entrada da NFe quando o recebimento foi validado como entregue.
|
||||
if (validacaoItens !== "entregue") return;
|
||||
|
||||
var dataEntrada = safeTrim(hAPI.getCardValue("dataEntradaNfeConsulta"));
|
||||
if (dataEntrada !== "") return;
|
||||
|
||||
var chaveNfe = onlyDigits(hAPI.getCardValue("chaveNfe"));
|
||||
if (chaveNfe === "") {
|
||||
log.warn("[servicetask99] Chave NFe vazia. Nao foi possivel consultar entrada.");
|
||||
return;
|
||||
}
|
||||
|
||||
var cKey = DatasetFactory.createConstraint("key", chaveNfe, chaveNfe, ConstraintType.MUST);
|
||||
var dsNfe = DatasetFactory.getDataset("ds_fiscal_invoice_by_keys", null, [cKey], null);
|
||||
|
||||
if (!dsNfe || dsNfe.rowsCount < 1) {
|
||||
log.warn("[servicetask99] Dataset sem retorno para chave: " + chaveNfe);
|
||||
return;
|
||||
}
|
||||
|
||||
var dsSuccess = safeTrim(dsNfe.getValue(0, "success")).toLowerCase() === "true";
|
||||
var dsUpdatedAt = safeTrim(dsNfe.getValue(0, "updatedAt"));
|
||||
|
||||
if (dsSuccess && dsUpdatedAt !== "") {
|
||||
hAPI.setCardValue("dataEntradaNfeConsulta", dsUpdatedAt);
|
||||
log.info("[servicetask99] Data de entrada atualizada automaticamente: " + dsUpdatedAt);
|
||||
return;
|
||||
}
|
||||
|
||||
var dsMessage = safeTrim(dsNfe.getValue(0, "message"));
|
||||
log.warn("[servicetask99] Consulta executada sem data de entrada. message=" + dsMessage);
|
||||
} catch (e) {
|
||||
log.error("[servicetask99] Erro na consulta automatica da NFe: " + e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
function safeTrim(value) {
|
||||
return String(value == null ? "" : value).trim();
|
||||
}
|
||||
|
||||
function onlyDigits(value) {
|
||||
return String(value == null ? "" : value).replace(/\D/g, "");
|
||||
}
|
||||
</eventDescription>
|
||||
</WorkflowProcessEvent>
|
||||
</list>
|
||||
@ -1210,7 +1555,7 @@ function onlyDigits(value) {
|
||||
<SwimLane>
|
||||
<color>FFFFFF</color>
|
||||
<height>794</height>
|
||||
<width>1791</width>
|
||||
<width>1861</width>
|
||||
<positionX>20</positionX>
|
||||
<positionY>20</positionY>
|
||||
<stateName>Solicitação de Transferência</stateName>
|
||||
@ -1226,7 +1571,7 @@ function onlyDigits(value) {
|
||||
<SwimLane>
|
||||
<color>82b0b7</color>
|
||||
<height>198</height>
|
||||
<width>1761</width>
|
||||
<width>1831</width>
|
||||
<positionX>50</positionX>
|
||||
<positionY>218</positionY>
|
||||
<stateName>Gerente de loja</stateName>
|
||||
@ -1242,7 +1587,7 @@ function onlyDigits(value) {
|
||||
<SwimLane>
|
||||
<color>d0daae</color>
|
||||
<height>198</height>
|
||||
<width>1761</width>
|
||||
<width>1831</width>
|
||||
<positionX>50</positionX>
|
||||
<positionY>416</positionY>
|
||||
<stateName>Logistica</stateName>
|
||||
@ -1258,7 +1603,7 @@ function onlyDigits(value) {
|
||||
<SwimLane>
|
||||
<color>d6e0d0</color>
|
||||
<height>198</height>
|
||||
<width>1761</width>
|
||||
<width>1831</width>
|
||||
<positionX>50</positionX>
|
||||
<positionY>20</positionY>
|
||||
<stateName>Analista de suprimentos</stateName>
|
||||
@ -1274,7 +1619,7 @@ function onlyDigits(value) {
|
||||
<SwimLane>
|
||||
<color>adc9ac</color>
|
||||
<height>200</height>
|
||||
<width>1761</width>
|
||||
<width>1831</width>
|
||||
<positionX>50</positionX>
|
||||
<positionY>614</positionY>
|
||||
<stateName>Motorista</stateName>
|
||||
@ -1357,30 +1702,10 @@ function onlyDigits(value) {
|
||||
<positionX>1149</positionX>
|
||||
<positionY>308</positionY>
|
||||
</ProcessLinkBend>
|
||||
<ProcessLinkBend>
|
||||
<processLinkBendPK>
|
||||
<companyId>1</companyId>
|
||||
<processId>Transferência Ginseng</processId>
|
||||
<version>46</version>
|
||||
<linkSequence>95</linkSequence>
|
||||
<bendSequence>1</bendSequence>
|
||||
</processLinkBendPK>
|
||||
<positionX>543</positionX>
|
||||
<positionY>717</positionY>
|
||||
</ProcessLinkBend>
|
||||
</list>
|
||||
<list/>
|
||||
<list/>
|
||||
<list>
|
||||
<ProcessFormField>
|
||||
<processFormFieldPK>
|
||||
<companyId>1</companyId>
|
||||
<processId>Transferência Ginseng</processId>
|
||||
<fieldId>anexo_lista1</fieldId>
|
||||
</processFormFieldPK>
|
||||
<fieldDescription>Nome do arquivo</fieldDescription>
|
||||
<slotId>1</slotId>
|
||||
</ProcessFormField>
|
||||
<ProcessFormField>
|
||||
<processFormFieldPK>
|
||||
<companyId>1</companyId>
|
||||
@ -1388,7 +1713,7 @@ function onlyDigits(value) {
|
||||
<fieldId>centroCusto</fieldId>
|
||||
</processFormFieldPK>
|
||||
<fieldDescription>Filial Destino</fieldDescription>
|
||||
<slotId>2</slotId>
|
||||
<slotId>1</slotId>
|
||||
</ProcessFormField>
|
||||
<ProcessFormField>
|
||||
<processFormFieldPK>
|
||||
@ -1397,6 +1722,15 @@ function onlyDigits(value) {
|
||||
<fieldId>dataAbertura</fieldId>
|
||||
</processFormFieldPK>
|
||||
<fieldDescription>Data de abertura</fieldDescription>
|
||||
<slotId>2</slotId>
|
||||
</ProcessFormField>
|
||||
<ProcessFormField>
|
||||
<processFormFieldPK>
|
||||
<companyId>1</companyId>
|
||||
<processId>Transferência Ginseng</processId>
|
||||
<fieldId>dataEmissaoNfe</fieldId>
|
||||
</processFormFieldPK>
|
||||
<fieldDescription>dataEmissaoNfe</fieldDescription>
|
||||
<slotId>3</slotId>
|
||||
</ProcessFormField>
|
||||
<ProcessFormField>
|
||||
@ -1421,9 +1755,9 @@ function onlyDigits(value) {
|
||||
<processFormFieldPK>
|
||||
<companyId>1</companyId>
|
||||
<processId>Transferência Ginseng</processId>
|
||||
<fieldId>userSolicitante</fieldId>
|
||||
<fieldId>requesterName</fieldId>
|
||||
</processFormFieldPK>
|
||||
<fieldDescription>Solicitante</fieldDescription>
|
||||
<fieldDescription>requesterName</fieldDescription>
|
||||
<slotId>6</slotId>
|
||||
</ProcessFormField>
|
||||
</list>
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 55 KiB |
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 22 KiB |
@ -511,6 +511,197 @@
|
||||
</void>
|
||||
</array>
|
||||
</void>
|
||||
<void method="put">
|
||||
<string>camposFormulario, documentoId = 590</string>
|
||||
<array class="java.lang.String" length="62">
|
||||
<void index="0">
|
||||
<string>activity</string>
|
||||
</void>
|
||||
<void index="1">
|
||||
<string>centroCusto</string>
|
||||
</void>
|
||||
<void index="2">
|
||||
<string>chaveNfe</string>
|
||||
</void>
|
||||
<void index="3">
|
||||
<string>codigoItem</string>
|
||||
</void>
|
||||
<void index="4">
|
||||
<string>codigoProdutoItem</string>
|
||||
</void>
|
||||
<void index="5">
|
||||
<string>currentUserId</string>
|
||||
</void>
|
||||
<void index="6">
|
||||
<string>currentUsermail</string>
|
||||
</void>
|
||||
<void index="7">
|
||||
<string>currentUserName</string>
|
||||
</void>
|
||||
<void index="8">
|
||||
<string>dataAbertura</string>
|
||||
</void>
|
||||
<void index="9">
|
||||
<string>dataColeta</string>
|
||||
</void>
|
||||
<void index="10">
|
||||
<string>dataEmissaoApiNfe</string>
|
||||
</void>
|
||||
<void index="11">
|
||||
<string>dataEmissaoNfe</string>
|
||||
</void>
|
||||
<void index="12">
|
||||
<string>dataEntradaNfeConsulta</string>
|
||||
</void>
|
||||
<void index="13">
|
||||
<string>dataEntrega</string>
|
||||
</void>
|
||||
<void index="14">
|
||||
<string>dataValidacaoGestor</string>
|
||||
</void>
|
||||
<void index="15">
|
||||
<string>descricao</string>
|
||||
</void>
|
||||
<void index="16">
|
||||
<string>emailSolicitante</string>
|
||||
</void>
|
||||
<void index="17">
|
||||
<string>estabelecimento</string>
|
||||
</void>
|
||||
<void index="18">
|
||||
<string>excelUpload</string>
|
||||
</void>
|
||||
<void index="19">
|
||||
<string>fdAnexo_Coleta</string>
|
||||
</void>
|
||||
<void index="20">
|
||||
<string>fdAnexo_Entrega</string>
|
||||
</void>
|
||||
<void index="21">
|
||||
<string>fdAnexo_recebimento</string>
|
||||
</void>
|
||||
<void index="22">
|
||||
<string>fnAnexo_Nfe</string>
|
||||
</void>
|
||||
<void index="23">
|
||||
<string>formMode</string>
|
||||
</void>
|
||||
<void index="24">
|
||||
<string>fornecedorNfeConsulta</string>
|
||||
</void>
|
||||
<void index="25">
|
||||
<string>gestorEmail</string>
|
||||
</void>
|
||||
<void index="26">
|
||||
<string>gestorEmailE</string>
|
||||
</void>
|
||||
<void index="27">
|
||||
<string>gestorNome</string>
|
||||
</void>
|
||||
<void index="28">
|
||||
<string>gestorNomeE</string>
|
||||
</void>
|
||||
<void index="29">
|
||||
<string>gestor_cc</string>
|
||||
</void>
|
||||
<void index="30">
|
||||
<string>gestor_cce</string>
|
||||
</void>
|
||||
<void index="31">
|
||||
<string>invoiceIdNfeConsulta</string>
|
||||
</void>
|
||||
<void index="32">
|
||||
<string>itensNfeConsulta</string>
|
||||
</void>
|
||||
<void index="33">
|
||||
<string>itensNfeJson</string>
|
||||
</void>
|
||||
<void index="34">
|
||||
<string>justificativa</string>
|
||||
</void>
|
||||
<void index="35">
|
||||
<string>justificativaDecisaoGestor</string>
|
||||
</void>
|
||||
<void index="36">
|
||||
<string>justificativaDecisaoItens</string>
|
||||
</void>
|
||||
<void index="37">
|
||||
<string>lojaNfeConsulta</string>
|
||||
</void>
|
||||
<void index="38">
|
||||
<string>motoristaColetaLogin</string>
|
||||
</void>
|
||||
<void index="39">
|
||||
<string>motoristaColetaNome</string>
|
||||
</void>
|
||||
<void index="40">
|
||||
<string>motoristaEntregaLogin</string>
|
||||
</void>
|
||||
<void index="41">
|
||||
<string>motoristaEntregaNome</string>
|
||||
</void>
|
||||
<void index="42">
|
||||
<string>motoristaEntregaSelecionado</string>
|
||||
</void>
|
||||
<void index="43">
|
||||
<string>numeroNfeConsulta</string>
|
||||
</void>
|
||||
<void index="44">
|
||||
<string>operacaoNfeConsulta</string>
|
||||
</void>
|
||||
<void index="45">
|
||||
<string>productIdItem</string>
|
||||
</void>
|
||||
<void index="46">
|
||||
<string>qtdDivergenciasNfe</string>
|
||||
</void>
|
||||
<void index="47">
|
||||
<string>quantidadeItem</string>
|
||||
</void>
|
||||
<void index="48">
|
||||
<string>requesterId</string>
|
||||
</void>
|
||||
<void index="49">
|
||||
<string>requesterMail</string>
|
||||
</void>
|
||||
<void index="50">
|
||||
<string>requesterName</string>
|
||||
</void>
|
||||
<void index="51">
|
||||
<string>serieNfeConsulta</string>
|
||||
</void>
|
||||
<void index="52">
|
||||
<string>situacaoNfeConsulta</string>
|
||||
</void>
|
||||
<void index="53">
|
||||
<string>storeIdNfeConsulta</string>
|
||||
</void>
|
||||
<void index="54">
|
||||
<string>tipoMotoristaEntrega</string>
|
||||
</void>
|
||||
<void index="55">
|
||||
<string>ufDestino</string>
|
||||
</void>
|
||||
<void index="56">
|
||||
<string>ufOrigem</string>
|
||||
</void>
|
||||
<void index="57">
|
||||
<string>userValidacaoGestor</string>
|
||||
</void>
|
||||
<void index="58">
|
||||
<string>usuarioEmissorNfe</string>
|
||||
</void>
|
||||
<void index="59">
|
||||
<string>validacaoItens</string>
|
||||
</void>
|
||||
<void index="60">
|
||||
<string>valorNfeConsulta</string>
|
||||
</void>
|
||||
<void index="61">
|
||||
<string>WKNumProces</string>
|
||||
</void>
|
||||
</array>
|
||||
</void>
|
||||
<void method="put">
|
||||
<string>mecanismo</string>
|
||||
<array class="[Ljava.lang.Object;" length="12">
|
||||
@ -636,5 +827,530 @@
|
||||
</void>
|
||||
</array>
|
||||
</void>
|
||||
<void method="put">
|
||||
<string>forms</string>
|
||||
<object class="java.util.LinkedList">
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>FLUIGADHOC</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>FLUIGADHOC</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>3</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>FLUIGADHOCPROCESS</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>FLUIGADHOCPROCESS</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>4</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>totvsflow_dataset_tipo_ocorrencia</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>totvsflow_dataset_tipo_ocorrencia</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>14</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>totvsflow_abertura_chamado</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>totvsflow_abertura_chamado</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>15</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>DSFormulariodeAberturadechamado</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>Formulário de Abertura de chamado</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>20</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>Abertura_de_chamados</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>Solicitação de abertura de chamados</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>21</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>DSvistoriadeServico</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>vistoriadeServico</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>24</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>DSFormulariodeReservadesala</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>Formulário de Reserva de sala</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>34</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>totvsflow_dataset_centrocusto</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>totvsflow_dataset_centrocusto</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>103</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>totvsflow_dataset_cadastro_item</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>totvsflow_dataset_cadastro_item</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>104</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>totvsflow_dataset_estabelecimento</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>totvsflow_dataset_estabelecimento</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>105</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>totvsflow_solicitacao_compras</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>totvsflow_solicitacao_compras</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>165</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>aberturadechamado_manutencao</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>aberturadechamado_manutencao</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>400</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>Solicitacao_transferencia</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>Solicitacao_transferencia</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>590</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>recrutamento</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>recrutamento</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>823</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>kit_aniversariantes</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>Aniversariantes</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>7690</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>kit_cardapio</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>Cardápio do Dia</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>7695</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>kit_convenios</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>Convênios</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>7703</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>kit_news</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>Notícias</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>7709</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>compras_digital</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>compras_digital</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>9305</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>dpf_di_formulario_processo_admissao</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>Digte_Public_Form_Di_Formulario_Processo_Admissao_Protheus</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>9626</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>dpf_cadastro_status</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>Digte_Public_Form_Status</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>9627</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>dpf_configuracoes</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>Digte_Public_Form_Configuracoes</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>9628</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>dpf_cadastro_jornada</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>Digte_Public_Form_Jornada</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>9629</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>dpf_tipo_documento</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>Digte_Public_Form_Tipo_Documento</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>9630</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>dpf_dataset</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>Digte_Public_Form_Dataset</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>9631</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>dpf_di_configuracao</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>Digte_Public_Form_Di_Configuracoes</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>9632</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>dpf_di_beneficio</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>Digte_Public_Form_Di_Beneficios</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>9633</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>dpf_di_compl_contrato</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>Digte_Public_Form_Di_Comp_Contrato</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>9634</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>dpf_di_funcao_jornada</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>Digte_Public_Form_Di_Funcao_Jornada</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>9635</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>dpf_dataset_estrutura</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>Digte_Public_Form_Di_Dataset_Estrutura</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>9636</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>dpf_grupo_tipo_contrato</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>Digte_Public_Form_Grupo_Tipo_Contrato</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>9637</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>dpf_tipo_contrato</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>Digte_Public_Form_Tipo_Contrato</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>9638</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>dpf_di_traducao_campo_valor</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>Digte_Public_Form_Di_Traducao_Campo_Valor</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>9639</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>dpf_di_restricoes_cpf</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>Digte_Public_Form_Di_Formulario_Restricao_CPF</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>9640</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>dpf_di_compl_vt</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>Digte_Public_Form_Di_Compl_VT</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>9641</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>dpf_di_traducao_campo</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>Digte_Public_Form_Di_Traducao_Campo</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>9995</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>desligamento</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>desligamento</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>12959</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>form_param_sla_csc</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>Formulário de Parametrização de SLA - Atendimento de Chamado TI</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>28647</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
<void method="add">
|
||||
<object class="com.totvs.technology.ecmrestclient.cardindexpublisher.FormVO">
|
||||
<void property="datasetName">
|
||||
<string>totvsflow_lancamento_documento</string>
|
||||
</void>
|
||||
<void property="documentDescription">
|
||||
<string>totvsflow_lancamento_documento</string>
|
||||
</void>
|
||||
<void property="documentId">
|
||||
<int>32331</int>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
</object>
|
||||
</void>
|
||||
</object>
|
||||
</java>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,205 @@
|
||||
function beforeTaskSave(colleagueId, nextSequenceId, userList) {
|
||||
try {
|
||||
var currentState = parseInt(getValue("WKNumState"), 10);
|
||||
var completeTask = String(getValue("WKCompletTask") || "false");
|
||||
var nextState = parseInt(String(nextSequenceId || "0"), 10);
|
||||
|
||||
if (completeTask !== "true") return;
|
||||
|
||||
if (currentState === 6) {
|
||||
// Fluxo de cancelamento saindo da atividade 6 nao deve disparar template de nota emitida.
|
||||
if (nextState === 97) return;
|
||||
enviarNotificacaoNotaEmitida();
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentState === 31) {
|
||||
enviarNotificacaoColetaRealizada();
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentState === 57) {
|
||||
// 61 = cancelamento no diagrama.
|
||||
if (nextState === 61) return;
|
||||
enviarNotificacaoEntregaRealizada();
|
||||
}
|
||||
} catch (e) {
|
||||
log.error("[Transferencia.beforeTaskSave] Erro no beforeTaskSave: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
function enviarNotificacaoNotaEmitida() {
|
||||
var envio = montarContextoEnvio();
|
||||
if (!envio.ok) return;
|
||||
|
||||
var params = buildCommonParams(envio.processNumber, envio.chaveNfe, envio.processLink);
|
||||
notifyTemplate("tpl_nota_emitida", envio.destinoEmail, envio.requesterId, params, envio.processNumber, envio.processLink);
|
||||
}
|
||||
|
||||
function enviarNotificacaoColetaRealizada() {
|
||||
var envio = montarContextoEnvio();
|
||||
if (!envio.ok) return;
|
||||
|
||||
var motoristaColetaNome = safeTrim(hAPI.getCardValue("motoristaColetaNome"));
|
||||
var dataColeta = safeTrim(hAPI.getCardValue("dataColeta"));
|
||||
var motoristaEntregaNome = safeTrim(hAPI.getCardValue("motoristaEntregaNome"));
|
||||
var tipoMotoristaEntrega = safeTrim(hAPI.getCardValue("tipoMotoristaEntrega"));
|
||||
|
||||
if (motoristaEntregaNome === "" && tipoMotoristaEntrega === "mesmo") {
|
||||
motoristaEntregaNome = motoristaColetaNome;
|
||||
}
|
||||
|
||||
var params = buildCommonParams(envio.processNumber, envio.chaveNfe, envio.processLink);
|
||||
params.put("motoristaColetaNome", motoristaColetaNome);
|
||||
params.put("dataColeta", dataColeta);
|
||||
params.put("motoristaEntregaNome", motoristaEntregaNome);
|
||||
|
||||
notifyTemplate("tpl_coleta_realizada", envio.destinoEmail, envio.requesterId, params, envio.processNumber, envio.processLink);
|
||||
}
|
||||
|
||||
function enviarNotificacaoEntregaRealizada() {
|
||||
var envio = montarContextoEnvio();
|
||||
if (!envio.ok) return;
|
||||
|
||||
var motoristaEntregaNome = safeTrim(hAPI.getCardValue("motoristaEntregaNome"));
|
||||
var dataEntrega = safeTrim(hAPI.getCardValue("dataEntrega"));
|
||||
var nomerecebedor = safeTrim(hAPI.getCardValue("nomerecebedor"));
|
||||
|
||||
var params = buildCommonParams(envio.processNumber, envio.chaveNfe, envio.processLink);
|
||||
params.put("motoristaEntregaNome", motoristaEntregaNome);
|
||||
params.put("dataEntrega", dataEntrega);
|
||||
params.put("nomerecebedor", nomerecebedor);
|
||||
|
||||
notifyTemplate("tpl_entrega_realizada", envio.destinoEmail, envio.requesterId, params, envio.processNumber, envio.processLink);
|
||||
}
|
||||
|
||||
function montarContextoEnvio() {
|
||||
var requesterId = safeTrim(hAPI.getCardValue("requesterId"));
|
||||
var requesterMail = safeTrim(hAPI.getCardValue("requesterMail"));
|
||||
|
||||
if (requesterId === "" && requesterMail !== "") {
|
||||
requesterId = findColleagueIdByMail(requesterMail);
|
||||
}
|
||||
|
||||
// Prioriza email explicito salvo no formulario; fallback para email do colleague.
|
||||
var destinoEmail = requesterMail;
|
||||
if (!isValidEmail(destinoEmail)) {
|
||||
destinoEmail = resolveEmailByColleagueId(requesterId);
|
||||
}
|
||||
|
||||
if (!isValidEmail(destinoEmail)) {
|
||||
log.warn("[Transferencia.beforeTaskSave] Email do solicitante invalido. requesterId=" + requesterId + ", requesterMail=[" + requesterMail + "], destinoEmail=[" + destinoEmail + "]");
|
||||
return { ok: false };
|
||||
}
|
||||
|
||||
var processNumber = safeTrim(getValue("WKNumProces"));
|
||||
var chaveNfe = onlyDigits(hAPI.getCardValue("chaveNfe"));
|
||||
if (chaveNfe === "") chaveNfe = safeTrim(hAPI.getCardValue("chaveNfe"));
|
||||
var processLink = buildProcessLink(processNumber);
|
||||
|
||||
return {
|
||||
ok: true,
|
||||
requesterId: requesterId,
|
||||
destinoEmail: destinoEmail,
|
||||
processNumber: processNumber,
|
||||
chaveNfe: chaveNfe,
|
||||
processLink: processLink
|
||||
};
|
||||
}
|
||||
|
||||
function buildCommonParams(processNumber, chaveNfe, processLink) {
|
||||
var params = new java.util.HashMap();
|
||||
params.put("WKNumProces", processNumber);
|
||||
params.put("chaveNfe", chaveNfe);
|
||||
params.put("linkSolicitacao", processLink);
|
||||
params.put("link", processLink);
|
||||
return params;
|
||||
}
|
||||
|
||||
function notifyTemplate(templateCode, destinoEmail, requesterId, params, processNumber, processLink) {
|
||||
var NOTIFIER_SENDER_USER = "admin";
|
||||
var recipients = new java.util.ArrayList();
|
||||
recipients.add(destinoEmail);
|
||||
|
||||
notifier.notify(NOTIFIER_SENDER_USER, templateCode, params, recipients, "text/html");
|
||||
log.info("[Transferencia.beforeTaskSave] " + templateCode + " enviado. processo=" + processNumber + ", destino=" + destinoEmail + ", requesterId=" + requesterId + ", link=[" + processLink + "]");
|
||||
}
|
||||
|
||||
function buildProcessLink(processNumber) {
|
||||
var BASE_URL_FALLBACK = "https://comerciode188007.fluig.cloudtotvs.com.br";
|
||||
var baseUrl = safeTrim(getValue("WKServerURL"));
|
||||
var companyId = safeTrim(getValue("WKCompany"));
|
||||
if (baseUrl === "") baseUrl = BASE_URL_FALLBACK;
|
||||
if (baseUrl.indexOf("http://") !== 0 && baseUrl.indexOf("https://") !== 0) {
|
||||
baseUrl = "https://" + baseUrl;
|
||||
}
|
||||
if (baseUrl.charAt(baseUrl.length - 1) === "/") baseUrl = baseUrl.substring(0, baseUrl.length - 1);
|
||||
if (companyId === "") companyId = "1";
|
||||
if (baseUrl === "" || safeTrim(processNumber) === "") return "";
|
||||
return baseUrl + "/portal/p/" + companyId + "/pageworkflowview?app_ecm_workflowview_detailsProcessInstanceID=" + processNumber;
|
||||
}
|
||||
|
||||
function findColleagueIdByMail(mail) {
|
||||
var email = safeTrim(mail);
|
||||
if (email === "") return "";
|
||||
|
||||
try {
|
||||
var cMail = DatasetFactory.createConstraint("mail", email, email, ConstraintType.MUST);
|
||||
var dsColleague = DatasetFactory.getDataset("colleague", null, [cMail], null);
|
||||
if (!dsColleague || dsColleague.rowsCount < 1) return "";
|
||||
|
||||
return safeTrim(
|
||||
dsColleague.getValue(0, "colleaguePK.colleagueId") ||
|
||||
dsColleague.getValue(0, "colleagueId") ||
|
||||
dsColleague.getValue(0, "login")
|
||||
);
|
||||
} catch (e) {
|
||||
log.warn("[Transferencia.beforeTaskSave] Falha ao buscar solicitante por mail: " + e);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
function resolveEmailByColleagueId(colleagueId) {
|
||||
var id = safeTrim(colleagueId);
|
||||
if (id === "") return "";
|
||||
|
||||
try {
|
||||
var cActive = DatasetFactory.createConstraint("active", "true", "true", ConstraintType.MUST);
|
||||
|
||||
var cId = DatasetFactory.createConstraint("colleaguePK.colleagueId", id, id, ConstraintType.MUST);
|
||||
var byId = DatasetFactory.getDataset("colleague", null, [cId, cActive], null);
|
||||
if (byId && byId.rowsCount > 0) {
|
||||
return safeTrim(byId.getValue(0, "mail"));
|
||||
}
|
||||
|
||||
var cLogin = DatasetFactory.createConstraint("login", id, id, ConstraintType.MUST);
|
||||
var byLogin = DatasetFactory.getDataset("colleague", null, [cLogin, cActive], null);
|
||||
if (byLogin && byLogin.rowsCount > 0) {
|
||||
return safeTrim(byLogin.getValue(0, "mail"));
|
||||
}
|
||||
} catch (e) {
|
||||
log.warn("[Transferencia.beforeTaskSave] Falha ao buscar email do solicitante por colleagueId: " + e);
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
function isValidEmail(email) {
|
||||
var v = safeTrim(email);
|
||||
if (v === "") return false;
|
||||
if (/\s/.test(v)) return false;
|
||||
|
||||
var at = v.indexOf("@");
|
||||
if (at <= 0 || at !== v.lastIndexOf("@")) return false;
|
||||
|
||||
var dot = v.lastIndexOf(".");
|
||||
return dot > at + 1 && dot < (v.length - 1);
|
||||
}
|
||||
|
||||
function safeTrim(value) {
|
||||
return String(value == null ? "" : value).trim();
|
||||
}
|
||||
|
||||
function onlyDigits(value) {
|
||||
return String(value == null ? "" : value).replace(/\D/g, "");
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
function onNotify(subject, receivers, template, params) {
|
||||
|
||||
log.info("===== onNotify GLOBAL ===== Template: " + template);
|
||||
|
||||
var validos = new java.util.ArrayList();
|
||||
|
||||
for (var i = 0; i < receivers.size(); i++) {
|
||||
|
||||
var email = receivers.get(i);
|
||||
|
||||
log.info("Receiver original: [" + email + "]");
|
||||
|
||||
if (email && email.indexOf("@") > 0 && email.indexOf(".") > 0) {
|
||||
validos.add(email);
|
||||
} else {
|
||||
log.warn("REMOVIDO EMAIL INVALIDO: [" + email + "] TEMPLATE: " + template);
|
||||
}
|
||||
}
|
||||
|
||||
receivers.clear();
|
||||
|
||||
for (var j = 0; j < validos.size(); j++) {
|
||||
receivers.add(validos.get(j));
|
||||
}
|
||||
|
||||
log.info("TOTAL FINAL RECEIVERS: " + receivers.size());
|
||||
}
|
||||
@ -18,4 +18,6 @@ function beforeTaskSave(colleagueId,nextSequenceId,userList){
|
||||
log.error("Erro ao buscar os dados do dataset 'colleague'.");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user