Gestita lista di commesse attive in GetOptions

This commit is contained in:
2024-09-17 10:46:50 +02:00
parent 2119b508ad
commit 141c0c43f8
7 changed files with 178 additions and 39 deletions

75
.gitignore vendored
View File

@@ -1,5 +1,74 @@
src/cache/*
.idea/workspace.xml
.idea/usage.statistics.xml
.idea/tasks.xml
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

14
.idea/deployment.xml generated Normal file
View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PublishConfigData" remoteFilesAllowedToDisappearOnAutoupload="false">
<serverData>
<paths name="localhost">
<serverdata>
<mappings>
<mapping local="$PROJECT_DIR$" web="/" />
</mappings>
</serverdata>
</paths>
</serverData>
</component>
</project>

6
.idea/git_toolbox_blame.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GitToolBoxBlameSettings">
<option name="version" value="2" />
</component>
</project>

9
.idea/markdown.xml generated Normal file
View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MarkdownSettings">
<enabledExtensions>
<entry key="MermaidLanguageExtension" value="false" />
<entry key="PlantUMLLanguageExtension" value="false" />
</enabledExtensions>
</component>
</project>

2
.idea/vcs.xml generated
View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@@ -4,24 +4,64 @@
class GetOptions extends ServiceModel {
public $methodRequest = "GET";
private function getMaxDeviationTime() {
$query = new Query("SELECT value FROM stb_gest_setup WHERE gest_name = 'WINACCESS' AND section = 'SETUP' AND key_section = 'MAX_DEVIATION_TIME';");
public function run() {
$md5User = $this->getRequestParam("md5User");
$ret = new Ret;
if (!is_null($md5User)) {
$data = $this->getRequestParam("data");
$ret = $this->getCodJfas();
if ($ret->is_KO()) {
return $ret;
}
$listCodJfas = $ret->get_data();
$ret = $this->getJtbComt($data);
if ($ret->is_KO()) {
return $ret;
}
$listJtbComt = $ret->get_data();
$ret->set_data(array(
"commesse" => $listJtbComt["dto"],
"centriDiCosto" => $listCodJfas["dto"],
"maxDeviationTime" => $this->getMaxDeviationTime()
));
} else {
$ret->set_error("Parametri autenticazione incompleti");
}
return $ret;
}
private function getJtbComt($data) {
$query = new Query("SELECT value FROM stb_gest_setup WHERE gest_name = 'WINACCESS' AND section = 'SETUP' AND key_section = 'SOLO_COMMESSE_ATTIVE';");
$processSql = $this->getProcessSqlInstance();
$ret = $processSql->sql($query->getSql())->send();
if ($ret->is_KO()) {
$ret->display();
}
$z = $ret->get_data();
$value = array_shift($z["dto"]);
return is_array($value) && array_key_exists("value", $value) ? $value["value"] : null;
}
$ret = $ret->get_data();
$value = array_shift($ret["dto"]);
private function getJtbComt() {
$query = new Query();
$query->importSqlFile("listaCommesse")
->setVar("listBlockedStatus", "CONSEGNATA','SOSPESA','TERMINATA")
->setVar("minDataCommessa", "2018-01-01");
if ($value) {
$query
->importSqlFile("listaCommesseAttive")
->setVar("dataAtt", array_key_exists("dataAtt", $data) ? $data["dataAtt"] : (new DateTime())->format("Y/m/d"));
} else {
$query
->importSqlFile("listaCommesse")
->setVar("minDataCommessa", "2018-01-01");
}
$query
->setVar("listBlockedStatus", "CONSEGNATA','SOSPESA','TERMINATA");
$processSql = $this->getProcessSqlInstance();
return $processSql->sql($query->getSql())->send();
@@ -35,30 +75,15 @@ class GetOptions extends ServiceModel {
return $processSql->sql($query->getSql())->send();
}
public function run() {
$md5User = $this->getRequestParam("md5User");
$ret = new Ret;
if (!is_null($md5User)) {
$ret = $this->getCodJfas();
if ($ret->is_KO()) {
return $ret;
}
$listCodJfas = $ret->get_data();
$ret = $this->getJtbComt();
if ($ret->is_KO()) {
return $ret;
}
$listJtbComt = $ret->get_data();
$ret->set_data(array(
"commesse" => $listJtbComt["dto"],
"centriDiCosto" => $listCodJfas["dto"],
"maxDeviationTime" => $this->getMaxDeviationTime()
));
} else {
$ret->set_error("Parametri autenticazione incompleti");
private function getMaxDeviationTime() {
$query = new Query("SELECT value FROM stb_gest_setup WHERE gest_name = 'WINACCESS' AND section = 'SETUP' AND key_section = 'MAX_DEVIATION_TIME';");
$processSql = $this->getProcessSqlInstance();
$ret = $processSql->sql($query->getSql())->send();
if ($ret->is_KO()) {
$ret->display();
}
return $ret;
$data = $ret->get_data();
$value = array_shift($data["dto"]);
return is_array($value) && array_key_exists("value", $value) ? $value["value"] : null;
}
}

View File

@@ -0,0 +1,16 @@
SELECT DISTINCT jc.cod_jcom,
descrizione + ISNULL(' - ' + gtb_anag.rag_soc, '') AS descrizione,
descrizione_estesa,
stato_commessa,
rif_comm,
data_inizi_lav
FROM dtb_ord_steps dos
INNER JOIN dtb_ordt do ON dos.gestione = do.gestione AND
dos.data_ord = do.data_ord AND
dos.num_ord = do.num_ord
INNER JOIN jtb_comt jc ON do.cod_jcom = jc.cod_jcom
LEFT OUTER JOIN gtb_anag ON gtb_anag.cod_anag = jc.cod_anag
WHERE ISNULL(stato_commessa, '') NOT IN ('[listBlockedStatus]')
AND dos.gestione = 'L'
AND ((dos.data_iniz IS NOT NULL AND dos.data_fine IS NULL) OR
'[dataAtt]' BETWEEN CAST(data_iniz AS DATE) AND CAST(data_fine AS DATE))