FSN#36298: 1. Scenario’s (per complex moeten verschillende scenario’s gemaakt moeten kunnen.

svn path=/Website/trunk/; revision=34717
This commit is contained in:
Maykel Geerdink
2017-07-24 07:16:10 +00:00
parent eaea845292
commit 9589058504
3 changed files with 52 additions and 11 deletions

View File

@@ -29,10 +29,11 @@ scaffolding(this_model,
"name" "name"
] ]
}, },
"edit":{ "show": {
"modal": true, "modal": true,
requires: { js: ["./ctr_scenario.js"] }, requires: { js: ["./ctr_scenario.js"] },
buttons: [{ title: L("lcl_mjb_inst_scen"), action: "institute_scenario", icon: "plus.png" }] buttons: [{ title: L("lcl_mjb_inst_scen"), action: "institute_scenario", icon: "plus.png" },
{ title: L("lcl_mjb_copy_current"), action: "copy_current", icon: "delete.png" }]
} }
}); });
%> %>

View File

@@ -18,3 +18,19 @@ function institute_scenario(key, table)
} }
); );
} }
function copy_current(key, table)
{
FcltMgr.confirm( L("lcl_mjb_copy_current") + "?",
{ autoconfirm: false },
function() {
var data = { scen_key: key,
totalcopy: 1 };
protectRequest.dataToken(data);
$.post("../mjb/mjb_incl_scen_save.asp"
, data
, FcltCallbackClose
, "json");
}
);
}

View File

@@ -25,10 +25,27 @@ var JSON_Result = true;
<% <%
protectRequest.validateToken(); protectRequest.validateToken();
var ins_key_arr = getFParamIntArray("ins_keys");
var srtcont_key_arr = getFParamIntArray("srtcont_keys");
var scen_key = getFParamInt("scen_key"); var scen_key = getFParamInt("scen_key");
var totalcopy = getFParamInt("totalcopy", 0) == 1;
if (totalcopy)
{ // 1 Willekeurig object en controle ophalen om straks 1 maal de rechten te checken en in 1 keer een copie te maken van alle controles.
var sql = "SELECT ins_deel_key"
+ " , ins_srtcontrole_key"
+ " FROM ins_v_defined_inspect di"
+ " ORDER BY ins_deel_key DESC"
var oRs = Oracle.Execute(sql);
var ins_key_arr = [oRs("ins_deel_key").Value];
var srtcont_key_arr = [oRs("ins_srtcontrole_key").Value];
oRs.Close();
}
else
{
var ins_key_arr = getFParamIntArray("ins_keys");
var srtcont_key_arr = getFParamIntArray("srtcont_keys");
}
var sql = "SELECT isc.ctr_discipline_key" var sql = "SELECT isc.ctr_discipline_key"
+ " FROM ins_srtcontrole isc" + " FROM ins_srtcontrole isc"
+ " WHERE isc.ins_srtcontrole_key = " + srtcont_key_arr[0]; + " WHERE isc.ins_srtcontrole_key = " + srtcont_key_arr[0];
@@ -90,6 +107,7 @@ result.scen_key = scen_key;
for (var i = 0; i < ingesloten.length; i++) for (var i = 0; i < ingesloten.length; i++)
{ // Toevoegen van de taak voor het object aan het (nieuwe) scenario. { // Toevoegen van de taak voor het object aan het (nieuwe) scenario.
// Als totalcopy dan wordt de for lus 1 maal doorlopen en worden alle controles in 1 keer aangemaakt.
sql = "INSERT INTO ins_srtcontroledl_xcp (ins_srtcontroledl_xcp_key" sql = "INSERT INTO ins_srtcontroledl_xcp (ins_srtcontroledl_xcp_key"
+ " , ins_deel_key" + " , ins_deel_key"
+ " , ins_srtcontrole_key" + " , ins_srtcontrole_key"
@@ -110,8 +128,8 @@ for (var i = 0; i < ingesloten.length; i++)
+ " , ins_srtcontroledl_xcp_aanteh" + " , ins_srtcontroledl_xcp_aanteh"
+ " , ins_scenario_key)" + " , ins_scenario_key)"
+ " SELECT ins_s_srtcontroledl_xcp_key.nextval" + " SELECT ins_s_srtcontroledl_xcp_key.nextval"
+ " , " + ingesloten[i].ins_key + " , ins_deel_key"
+ " , " + ingesloten[i].srtcont_key + " , ins_srtcontrole_key"
+ " , ins_srtcontroledl_xcp_periode" + " , ins_srtcontroledl_xcp_periode"
+ " , ins_srtcontroledl_xcp_eenheid" + " , ins_srtcontroledl_xcp_eenheid"
+ " , ins_srtcontroledl_xcp_bits" + " , ins_srtcontroledl_xcp_bits"
@@ -129,9 +147,13 @@ for (var i = 0; i < ingesloten.length; i++)
+ " , ins_srtcontroledl_xcp_aanteh" + " , ins_srtcontroledl_xcp_aanteh"
+ " , " + scen_key + " , " + scen_key
+ " FROM ins_v_defined_inspect_xcp" + " FROM ins_v_defined_inspect_xcp"
+ " WHERE ins_deel_key = " + ingesloten[i].ins_key + " WHERE ins_srtcontrole_periode > 0"
+ " AND ins_srtcontrole_key = " + ingesloten[i].srtcont_key + (!totalcopy
+ " AND ins_scenario_key IS NULL"; ? " AND ins_deel_key = " + ingesloten[i].ins_key
+ " AND ins_srtcontrole_key = " + ingesloten[i].srtcont_key
: "")
+ " AND ins_scenario_key IS NULL"
+ " AND ctr_ismjob = 1"
var err = Oracle.Execute(sql, true); var err = Oracle.Execute(sql, true);
if (err.friendlyMsg) if (err.friendlyMsg)
@@ -161,8 +183,10 @@ for (var i = 0; i < ingesloten.length; i++)
+ " , " + scen_key + " , " + scen_key
+ " FROM ins_v_defined_inspect_xcp xcp" + " FROM ins_v_defined_inspect_xcp xcp"
+ " WHERE xcp.ins_srtcontrole_periode > 0" + " WHERE xcp.ins_srtcontrole_periode > 0"
+ " AND xcp.ins_deel_key = " + ingesloten[i].ins_key + (!totalcopy
+ " AND xcp.ins_srtcontrole_key = " + ingesloten[i].srtcont_key ? " AND xcp.ins_deel_key = " + ingesloten[i].ins_key
+ " AND xcp.ins_srtcontrole_key = " + ingesloten[i].srtcont_key
: "")
+ " AND xcp.ins_scenario_key IS NULL" + " AND xcp.ins_scenario_key IS NULL"
+ " AND xcp.ctr_ismjob = 1" + " AND xcp.ctr_ismjob = 1"