Merge remote-tracking branch 'origin/develop' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
This commit is contained in:
122
build/Jenkinsfile.groovy
Normal file
122
build/Jenkinsfile.groovy
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
stages {
|
||||||
|
stage ('PreBuild Steps (Master)') {
|
||||||
|
when {
|
||||||
|
expression {
|
||||||
|
return env.GIT_BRANCH == "master"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
echo "Creo version tag su Git"
|
||||||
|
bat 'build\\create_build_tag.bat'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Maven Build') {
|
||||||
|
steps {
|
||||||
|
echo "${WORKSPACE}"
|
||||||
|
withMaven(jdk: 'JDK 17.0.6 x64', traceability: true, maven: 'Maven 3.9.5') {
|
||||||
|
bat(script: 'mvn clean install -t toolchains-jenkins.xml', returnStdout: true)
|
||||||
|
archiveArtifacts(artifacts: 'ems-engine/target/*.war*', onlyIfSuccessful: true)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Publish Develop') {
|
||||||
|
when {
|
||||||
|
expression {
|
||||||
|
return env.GIT_BRANCH == "develop"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
parallel {
|
||||||
|
stage('Tomcat update') {
|
||||||
|
stages {
|
||||||
|
stage('Update Tomcat 1') {
|
||||||
|
steps {
|
||||||
|
echo "Updating Tomcat9 from ${WORKSPACE}"
|
||||||
|
powershell returnStdout: true, script: "build\\update_tomcat.ps1 -serviceName \"Tomcat9\" -httpPort \"8081\" -updatedArtifactPath \"${WORKSPACE}\\ems-engine\\target\\ems-api.war\""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Update Tomcat 2') {
|
||||||
|
steps {
|
||||||
|
echo "Updating Tomcat9 from ${WORKSPACE}"
|
||||||
|
powershell returnStdout: true, script: "build\\update_tomcat.ps1 -serviceName \"Tomcat9Backup\" -httpPort \"8082\" -updatedArtifactPath \"${WORKSPACE}\\ems-engine\\target\\ems-api.war\""
|
||||||
|
bat 'curl -k https://devservices.studioml.it/ems-api/updateWMSApp'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Publish over FTP') {
|
||||||
|
steps {
|
||||||
|
echo "Publish over FTP"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Publish Master') {
|
||||||
|
when {
|
||||||
|
expression {
|
||||||
|
return env.GIT_BRANCH == "master"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
parallel {
|
||||||
|
stage('Tomcat update') {
|
||||||
|
stages {
|
||||||
|
stage('Update Tomcat 1') {
|
||||||
|
steps {
|
||||||
|
echo "Updating Tomcat9 from ${WORKSPACE}"
|
||||||
|
sshPublisher(publishers: [sshPublisherDesc(configName: 'Production Linux Tomcat Server (192.168.3.16)', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: '''sudo /usr/bin/systemctl stop tomcat9
|
||||||
|
rm -R tomcat9/webapps/ems-api
|
||||||
|
sudo /usr/bin/systemctl start tomcat9
|
||||||
|
|
||||||
|
/home/studioml/./wait_tomcat_startup.sh 8081''', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '/tomcat9/webapps', remoteDirectorySDF: false, removePrefix: 'ems-engine/target/', sourceFiles: 'ems-engine/target/*.war*')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Update Tomcat 2') {
|
||||||
|
steps {
|
||||||
|
echo "Updating Tomcat9 from ${WORKSPACE}"
|
||||||
|
sshPublisher(publishers: [sshPublisherDesc(configName: 'Production Linux Tomcat Server (192.168.3.16)', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: '''sudo /usr/bin/systemctl stop tomcat9backup
|
||||||
|
rm -R tomcat9backup/webapps/ems-api
|
||||||
|
sudo /usr/bin/systemctl start tomcat9backup
|
||||||
|
|
||||||
|
/home/studioml/./wait_tomcat_startup.sh 8082
|
||||||
|
|
||||||
|
sleep 10''', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '/tomcat9backup/webapps', remoteDirectorySDF: false, removePrefix: 'ems-engine/target/', sourceFiles: 'ems-engine/target/*.war*')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
|
||||||
|
bat 'curl -k https://services.studioml.it/ems-api/updateWMSApp'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Publish over FTP') {
|
||||||
|
steps {
|
||||||
|
ftpPublisher alwaysPublishFromMaster: false,
|
||||||
|
continueOnError: false,
|
||||||
|
failOnError: false,
|
||||||
|
masterNodeName: '',
|
||||||
|
paramPublish: null,
|
||||||
|
publishers: [[configName: 'OVH Linux Web Server (51.38.112.23)',
|
||||||
|
transfers: [[asciiMode: false,
|
||||||
|
cleanRemote: false,
|
||||||
|
excludes: '',
|
||||||
|
flatten: false,
|
||||||
|
makeEmptyDirs: false,
|
||||||
|
noDefaultExcludes: false,
|
||||||
|
patternSeparator: '[, ]+',
|
||||||
|
remoteDirectory: '/download/Aggiornamenti',
|
||||||
|
remoteDirectorySDF: false,
|
||||||
|
removePrefix: 'ems-engine/target/',
|
||||||
|
sourceFiles: 'ems-engine/target/*.war*']],
|
||||||
|
usePromotionTimestamp: false,
|
||||||
|
useWorkspaceInPromotion: false,
|
||||||
|
verbose: true]]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
153
build/update_tomcat.ps1
Normal file
153
build/update_tomcat.ps1
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
Param(
|
||||||
|
[string]$serviceName, #Argomento passato dal chiamante
|
||||||
|
[Int32]$httpPort, #Argomento passato dal chiamante
|
||||||
|
[string]$updatedArtifactPath #Argomento passato dal chiamante
|
||||||
|
)
|
||||||
|
|
||||||
|
$max_attempts = 48
|
||||||
|
$attempt = 0
|
||||||
|
$webappsPath = "C:\Program Files\$serviceName\webapps"
|
||||||
|
|
||||||
|
# Funzione per eseguire la chiamata GET e controllare lo status code
|
||||||
|
function Check-Status {
|
||||||
|
try {
|
||||||
|
$request = Invoke-WebRequest -Uri "http://localhost:$httpPort/ems-api/system/ok" -Method Get -ErrorAction Stop
|
||||||
|
$statusCode = $request.StatusCode
|
||||||
|
if ($statusCode -eq 200) {
|
||||||
|
Write-Host "Status code 200 ricevuto, processo completato."
|
||||||
|
exit 0
|
||||||
|
} else {
|
||||||
|
Write-Host "Status code $statusCode ricevuto, continuo a provare..."
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
Write-Host "Errore: $_"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Funzione per cancellare una cartella e un file
|
||||||
|
function Delete-FilesAndFolder
|
||||||
|
{
|
||||||
|
param (
|
||||||
|
[string]$folderPath,
|
||||||
|
[string]$filePath
|
||||||
|
)
|
||||||
|
|
||||||
|
try {
|
||||||
|
# Cancellare la cartella specificata
|
||||||
|
if (Test-Path -Path $folderPath) {
|
||||||
|
Remove-Item -Path $folderPath -Recurse -Force
|
||||||
|
Write-Host "Cartella $folderPath eliminata con successo."
|
||||||
|
} else {
|
||||||
|
Write-Host "La cartella $folderPath non esiste."
|
||||||
|
}
|
||||||
|
|
||||||
|
# Cancellare il file specificato
|
||||||
|
if (Test-Path -Path $filePath) {
|
||||||
|
Remove-Item -Path $filePath -Force
|
||||||
|
Write-Host "File $filePath eliminato con successo."
|
||||||
|
} else {
|
||||||
|
Write-Host "Il file $filePath non esiste."
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch {
|
||||||
|
Write-Host "Errore nella cancellazione di file o cartella: $_"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Funzione per copiare un file
|
||||||
|
function Copy-File {
|
||||||
|
param (
|
||||||
|
[string]$sourceFilePath,
|
||||||
|
[string]$destinationFilePath
|
||||||
|
)
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (Test-Path -Path $sourceFilePath) {
|
||||||
|
Copy-Item -Path $sourceFilePath -Destination $destinationFilePath -Force
|
||||||
|
Write-Host "File copiato da $sourceFilePath a $destinationFilePath con successo."
|
||||||
|
} else {
|
||||||
|
Write-Host "Il file sorgente $sourceFilePath non esiste."
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
Write-Host "Errore nella copia del file: $_"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Funzione per stoppare un servizio e attendere che sia completamente fermato
|
||||||
|
function Stop-ServiceAndWait {
|
||||||
|
param (
|
||||||
|
[string]$serviceName
|
||||||
|
)
|
||||||
|
|
||||||
|
# Tentativo di stoppare il servizio
|
||||||
|
try {
|
||||||
|
Write-Host "Sto stoppando il servizio $serviceName..."
|
||||||
|
Stop-Service -Name $serviceName -Force
|
||||||
|
|
||||||
|
# Attesa finché il servizio non viene stoppato
|
||||||
|
$service = Get-Service -Name $serviceName
|
||||||
|
while ($service.Status -ne 'Stopped') {
|
||||||
|
Write-Host "Attendo che il servizio $serviceName si fermi..."
|
||||||
|
Start-Sleep -Seconds 5
|
||||||
|
$service = Get-Service -Name $serviceName
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Il servizio $serviceName è stato fermato con successo."
|
||||||
|
} catch {
|
||||||
|
Write-Host "Errore nello stoppare il servizio ${serviceName}: $_"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Funzione per avviare nuovamente un servizio e attendere che sia in esecuzione
|
||||||
|
function Start-ServiceAndWait {
|
||||||
|
param (
|
||||||
|
[string]$serviceName
|
||||||
|
)
|
||||||
|
|
||||||
|
try {
|
||||||
|
Write-Host "Sto avviando il servizio $serviceName..."
|
||||||
|
Start-Service -Name $serviceName
|
||||||
|
|
||||||
|
# Attesa finché il servizio non viene avviato
|
||||||
|
$service = Get-Service -Name $serviceName
|
||||||
|
while ($service.Status -ne 'Running') {
|
||||||
|
Write-Host "Attendo che il servizio $serviceName si avvii..."
|
||||||
|
Start-Sleep -Seconds 5
|
||||||
|
$service = Get-Service -Name $serviceName
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Il servizio $serviceName è stato avviato con successo."
|
||||||
|
|
||||||
|
} catch {
|
||||||
|
Write-Host "Errore nell'avvio del servizio ${serviceName}: $_"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Chiamare la funzione per stoppare il servizio
|
||||||
|
Stop-ServiceAndWait -serviceName $serviceName
|
||||||
|
|
||||||
|
# Subito dopo lo stop, cancellare la cartella e il file
|
||||||
|
$emsApiPath = "$webappsPath\ems-api"
|
||||||
|
$emsWarFilePath = "$webappsPath\ems-api.war"
|
||||||
|
Delete-FilesAndFolder -folderPath $emsApiPath -filePath $emsWarFilePath
|
||||||
|
|
||||||
|
# Chiamare la funzione per copiare il file
|
||||||
|
Write-Host "Copio $updatedArtifactPath in $emsWarFilePath"
|
||||||
|
Copy-File -sourceFilePath $updatedArtifactPath -destinationFilePath $emsWarFilePath
|
||||||
|
|
||||||
|
# Avvia nuovamente il servizio
|
||||||
|
Start-ServiceAndWait -serviceName $serviceName
|
||||||
|
|
||||||
|
# Ciclo fino a quando lo status code non è 200 o superiamo il numero massimo di tentativi
|
||||||
|
while ($attempt -lt $max_attempts) {
|
||||||
|
$attempt++
|
||||||
|
Check-Status
|
||||||
|
Start-Sleep -Seconds 5 # Attendere per 5 secondi prima di fare un altro tentativo
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Numero massimo di tentativi superato. Nessuna risposta 200 ricevuta."
|
||||||
|
exit 1
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package it.integry.ems.migration.model;
|
||||||
|
|
||||||
|
import it.integry.ems.migration._base.BaseMigration;
|
||||||
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
|
|
||||||
|
public class Migration_20241001164607 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
String value = "S";
|
||||||
|
|
||||||
|
createSetup("PICKING", "SETUP", "ENABLE_POSITION_CHANGE_REQUEST", value,
|
||||||
|
"Permette di abilitare il pop-up di richiesta di modifica posizione", false, "SI_NO", false, false,
|
||||||
|
false, false, false, null, false, "SELECT 'S' UNION ALL SELECT 'N'");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package it.integry.ems.migration.model;
|
||||||
|
|
||||||
|
import it.integry.ems.migration._base.BaseMigration;
|
||||||
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
|
|
||||||
|
public class Migration_20241007155146 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
createOrUpdateView("mvw_colli_contatore_lavorazione","CREATE VIEW [dbo].[mvw_colli_contatore_lavorazione] AS\n" +
|
||||||
|
"WITH colli AS (SELECT DISTINCT mtb_colt.gestione,\n" +
|
||||||
|
" mtb_colt.data_collo,\n" +
|
||||||
|
" mtb_colt.num_collo,\n" +
|
||||||
|
" mtb_colt.ser_collo,\n" +
|
||||||
|
" mtb_colr.data_ord,\n" +
|
||||||
|
" mtb_colr.num_ord,\n" +
|
||||||
|
" mtb_colr.partita_mag,\n" +
|
||||||
|
" mtb_colt.flag_stampato\n" +
|
||||||
|
" FROM mtb_colt\n" +
|
||||||
|
" INNER JOIN mtb_colr ON mtb_colt.gestione = mtb_colr.gestione AND\n" +
|
||||||
|
" mtb_colt.data_collo = mtb_colr.data_collo AND\n" +
|
||||||
|
" mtb_colt.ser_collo = mtb_colr.ser_collo AND\n" +
|
||||||
|
" mtb_colt.num_collo = mtb_colr.num_collo\n" +
|
||||||
|
" WHERE mtb_colt.gestione = 'L'\n" +
|
||||||
|
" AND mtb_colt.segno = 1\n" +
|
||||||
|
" AND mtb_colr.data_ord IS NOT NULL)\n" +
|
||||||
|
"SELECT *,\n" +
|
||||||
|
" DENSE_RANK() OVER (PARTITION BY data_ord, num_ord,partita_mag ORDER BY data_collo, ser_collo, num_collo) AS prog_collo,\n" +
|
||||||
|
" COUNT(*) OVER (PARTITION BY data_ord, num_ord,partita_mag ) AS tot_colli\n" +
|
||||||
|
"FROM colli\n" +
|
||||||
|
"GO\n" +
|
||||||
|
"\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,140 @@
|
|||||||
|
package it.integry.ems.migration.model;
|
||||||
|
|
||||||
|
import it.integry.ems.migration._base.BaseMigration;
|
||||||
|
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||||
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
|
|
||||||
|
public class Migration_20241008123321 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!isCustomerDb(IntegryCustomerDB.Carelli_Winact)) return;
|
||||||
|
|
||||||
|
createOrUpdateFunction("steup_getInevasi", "CREATE FUNCTION [dbo].[steup_getInevasi]\n" +
|
||||||
|
"( \n" +
|
||||||
|
" @codMdep varchar(5), @codJfas varchar(5), @dataIspezione datetime\n" +
|
||||||
|
")\n" +
|
||||||
|
"RETURNS TABLE \n" +
|
||||||
|
"AS\n" +
|
||||||
|
"RETURN \n" +
|
||||||
|
"with ordini as (\n" +
|
||||||
|
"select dtb_ordr.cod_mart, gtb_anag.part_iva\n" +
|
||||||
|
"from gestfood.dbo.dtb_ordt inner join gestfood.dbo.dtb_ordr on dtb_ordt.gestione = dtb_ordr.gestione \n" +
|
||||||
|
"and dtb_ordt.data_ord = dtb_ordr.data_ord\n" +
|
||||||
|
"and dtb_ordt.num_ord = dtb_ordr.num_ord\n" +
|
||||||
|
"inner join gestfood.dbo.gtb_anag on dtb_ordt.cod_anag = gtb_anag.cod_anag \n" +
|
||||||
|
"where dtb_ordt.gestione = 'A' \n" +
|
||||||
|
"and dtb_ordt.flag_annulla = 'N'\n" +
|
||||||
|
"and dtb_ordt.cod_mdep = @codMdep\n" +
|
||||||
|
"and dtb_ordr.data_cons between DateAdd(day, -8, @dataIspezione) and DateAdd(day, -1, @dataIspezione)\n" +
|
||||||
|
"and dtb_ordr.flag_evaso = 'I'\n" +
|
||||||
|
"union\n" +
|
||||||
|
"select dtb_ordr.cod_mart, gtb_anag.part_iva\n" +
|
||||||
|
"from carelli.dbo.dtb_ordt inner join carelli.dbo.dtb_ordr on dtb_ordt.gestione = dtb_ordr.gestione \n" +
|
||||||
|
"and dtb_ordt.data_ord = dtb_ordr.data_ord\n" +
|
||||||
|
"and dtb_ordt.num_ord = dtb_ordr.num_ord\n" +
|
||||||
|
"inner join carelli.dbo.gtb_anag on dtb_ordt.cod_anag = gtb_anag.cod_anag \n" +
|
||||||
|
"where dtb_ordt.gestione = 'A' \n" +
|
||||||
|
"and dtb_ordt.flag_annulla = 'N'\n" +
|
||||||
|
"and dtb_ordt.cod_mdep = @codMdep\n" +
|
||||||
|
"and dtb_ordr.data_cons between DateAdd(day, -8, @dataIspezione) and DateAdd(day, -1, @dataIspezione)\n" +
|
||||||
|
"and dtb_ordr.flag_evaso = 'I'\n" +
|
||||||
|
"union\n" +
|
||||||
|
"select dtb_ordr.cod_mart, gtb_anag.part_iva\n" +
|
||||||
|
"from panimal.dbo.dtb_ordt inner join panimal.dbo.dtb_ordr on dtb_ordt.gestione = dtb_ordr.gestione \n" +
|
||||||
|
"and dtb_ordt.data_ord = dtb_ordr.data_ord\n" +
|
||||||
|
"and dtb_ordt.num_ord = dtb_ordr.num_ord\n" +
|
||||||
|
"inner join panimal.dbo.gtb_anag on dtb_ordt.cod_anag = gtb_anag.cod_anag \n" +
|
||||||
|
"where dtb_ordt.gestione = 'A' \n" +
|
||||||
|
"and dtb_ordt.flag_annulla = 'N'\n" +
|
||||||
|
"and dtb_ordt.cod_mdep = @codMdep\n" +
|
||||||
|
"and dtb_ordr.data_cons between DateAdd(day, -8, @dataIspezione) and DateAdd(day, -1, @dataIspezione)\n" +
|
||||||
|
"and dtb_ordr.flag_evaso = 'I' )\n" +
|
||||||
|
"\n" +
|
||||||
|
"select art.cod_mart_griglia as cod_mart\n" +
|
||||||
|
"from ordini \n" +
|
||||||
|
"inner join (SELECT mtb_comp.cod_mart, cod_comp as cod_mart_griglia from carelli.dbo.mtb_comp inner join carelli.dbo.mtb_aart on mtb_comp.cod_mart = mtb_aart.cod_mart and mtb_aart.articolo_composto = 's'\n" +
|
||||||
|
"union all \n" +
|
||||||
|
"SELECT cod_comp as cod_mart, mtb_comp.cod_mart as cod_mart_griglia from carelli.dbo.mtb_comp inner join carelli.dbo.mtb_aart on mtb_comp.cod_mart = mtb_aart.cod_mart and mtb_aart.articolo_composto = 's'\n" +
|
||||||
|
"union all \n" +
|
||||||
|
"SELECt cod_mart, cod_mart as cod_mart_griglia from carelli.dbo.mtb_aart where articolo_composto = 'N'\n" +
|
||||||
|
" ) art on ordini.cod_mart = art.cod_mart\n" +
|
||||||
|
"inner join mtb_aart on ordini.cod_mart = mtb_aart.cod_mart\n" +
|
||||||
|
"inner join jrl_fasi_mtb_grup on jrl_fasi_mtb_grup.cod_mgrp = mtb_aart.cod_mgrp\n" +
|
||||||
|
"where jrl_fasi_mtb_grup.cod_jfas = @codJfas AND\n" +
|
||||||
|
"part_iva in (select value_string from dbo.ParseStringIntoArray((select dbo.getGestSetup('PVM', 'RILEVAZIONI_STEUP', 'ELENCO_FORN_INEVASI')), '|'))");
|
||||||
|
createOrUpdateFunction("steup_getAssortimento", "CREATE FUNCTION [dbo].[steup_getAssortimento]\n" +
|
||||||
|
" (\n" +
|
||||||
|
" @codmdep VARCHAR(5), @codjfas VARCHAR(5), @dataIspezione datetime\n" +
|
||||||
|
" )\n" +
|
||||||
|
" RETURNS TABLE\n" +
|
||||||
|
" AS\n" +
|
||||||
|
" RETURN(\n" +
|
||||||
|
" /*\n" +
|
||||||
|
" declare @codMdep varchar(5), @codJfas varchar(5)\n" +
|
||||||
|
"\n" +
|
||||||
|
" set @codMdep = '01'\n" +
|
||||||
|
" set @codJfas = '09';\n" +
|
||||||
|
"\n" +
|
||||||
|
" */\n" +
|
||||||
|
"\n" +
|
||||||
|
"\n" +
|
||||||
|
" WITH tipiart AS (SELECT value_string AS cod_mtip\n" +
|
||||||
|
" FROM dbo.parsestringintoarray((SELECT value\n" +
|
||||||
|
" FROM stb_gest_setup\n" +
|
||||||
|
" WHERE gest_name = 'PVM'\n" +
|
||||||
|
" AND section = 'RILEVAZIONI_STEUP'\n" +
|
||||||
|
" AND key_section = 'EXCLUDE_COD_MTIP'), '|') t)\n" +
|
||||||
|
" , art AS (SELECT DISTINCT griglia.cod_mart\n" +
|
||||||
|
" FROM carelli.dbo.getgrigliaacquisto(@dataIspezione, NULL, @codmdep, NULL, NULL) griglia\n" +
|
||||||
|
" INNER JOIN carelli.dbo.mtb_depo ON griglia.cod_mdep = mtb_depo.cod_mdep\n" +
|
||||||
|
" INNER JOIN carelli.dbo.getlistinovendita(NULL, NULL, NULL) AS lisv\n" +
|
||||||
|
" ON mtb_depo.cod_vlis = lisv.cod_vlis AND griglia.cod_mart = lisv.cod_mart\n" +
|
||||||
|
" WHERE griglia.tipo_variazione <> 'D'\n" +
|
||||||
|
" UNION\n" +
|
||||||
|
" SELECT DISTINCT cod_mart\n" +
|
||||||
|
" FROM mtb_depo\n" +
|
||||||
|
" INNER JOIN carelli.dbo.getpromozionevendita(@dataIspezione, @dataIspezione, NULL, NULL, NULL) promo\n" +
|
||||||
|
" ON promo.cod_vlis = mtb_depo.cod_vlis\n" +
|
||||||
|
" WHERE tipo_variazione <> 'D'\n" +
|
||||||
|
" AND mtb_depo.cod_mdep = @codmdep)\n" +
|
||||||
|
"\n" +
|
||||||
|
"\n" +
|
||||||
|
" SELECT DISTINCT mtb_aart.cod_mart,\n" +
|
||||||
|
" mtb_aart.descrizione,\n" +
|
||||||
|
" mtb_aart.bar_code,\n" +
|
||||||
|
" mtb_aart.cod_msgr,\n" +
|
||||||
|
" mtb_aart.plu,\n" +
|
||||||
|
" art_det.cod_mart_griglia AS cod_madre\n" +
|
||||||
|
" FROM mtb_aart\n" +
|
||||||
|
" INNER JOIN jrl_fasi_mtb_grup ON\n" +
|
||||||
|
" mtb_aart.cod_mgrp = jrl_fasi_mtb_grup.cod_mgrp\n" +
|
||||||
|
" INNER JOIN (SELECT mtb_comp.cod_mart, cod_comp AS cod_mart_griglia\n" +
|
||||||
|
" FROM carelli.dbo.mtb_comp\n" +
|
||||||
|
" INNER JOIN carelli.dbo.mtb_aart ON mtb_comp.cod_mart = mtb_aart.cod_mart AND\n" +
|
||||||
|
" mtb_aart.articolo_composto = 's'\n" +
|
||||||
|
" UNION ALL\n" +
|
||||||
|
" SELECT cod_comp AS cod_mart, mtb_comp.cod_mart AS cod_mart_griglia\n" +
|
||||||
|
" FROM carelli.dbo.mtb_comp\n" +
|
||||||
|
" INNER JOIN carelli.dbo.mtb_aart ON mtb_comp.cod_mart = mtb_aart.cod_mart AND\n" +
|
||||||
|
" mtb_aart.articolo_composto = 's'\n" +
|
||||||
|
" UNION ALL\n" +
|
||||||
|
" SELECT cod_mart, cod_mart AS cod_mart_griglia\n" +
|
||||||
|
" FROM carelli.dbo.mtb_aart\n" +
|
||||||
|
" WHERE articolo_composto = 'N') AS art_det\n" +
|
||||||
|
" ON mtb_aart.cod_mart = art_det.cod_mart\n" +
|
||||||
|
" INNER JOIN art ON art_det.cod_mart_griglia = art.cod_mart\n" +
|
||||||
|
" WHERE jrl_fasi_mtb_grup.cod_jfas = @codjfas\n" +
|
||||||
|
" AND flag_stato = 'A'\n" +
|
||||||
|
" AND (mtb_aart.cod_mtip IS NULL OR mtb_aart.cod_mtip NOT IN (SELECT cod_mtip FROM tipiart)))");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
package it.integry.ems.migration.model;
|
||||||
|
|
||||||
|
import it.integry.ems.migration._base.BaseMigration;
|
||||||
|
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||||
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
|
|
||||||
|
public class Migration_20241008151703 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
if (!isCustomerDb(IntegryCustomerDB.Carelli_Winact)) return;
|
||||||
|
|
||||||
|
createOrUpdateFunction("steup_getInevasi", "CREATE FUNCTION [dbo].[steup_getInevasi]\n" +
|
||||||
|
"( \n" +
|
||||||
|
" @codMdep varchar(5), @codJfas varchar(5), @dataIspezione datetime\n" +
|
||||||
|
")\n" +
|
||||||
|
"RETURNS TABLE \n" +
|
||||||
|
"AS\n" +
|
||||||
|
"RETURN \n" +
|
||||||
|
"with ordini as (\n" +
|
||||||
|
"select dtb_ordr.cod_mart, gtb_anag.part_iva\n" +
|
||||||
|
"from gestfood.dbo.dtb_ordt inner join gestfood.dbo.dtb_ordr on dtb_ordt.gestione = dtb_ordr.gestione \n" +
|
||||||
|
"and dtb_ordt.data_ord = dtb_ordr.data_ord\n" +
|
||||||
|
"and dtb_ordt.num_ord = dtb_ordr.num_ord\n" +
|
||||||
|
"inner join gestfood.dbo.gtb_anag on dtb_ordt.cod_anag = gtb_anag.cod_anag \n" +
|
||||||
|
"where dtb_ordt.gestione = 'A' \n" +
|
||||||
|
"and dtb_ordt.flag_annulla = 'N'\n" +
|
||||||
|
"and dtb_ordt.cod_mdep = @codMdep\n" +
|
||||||
|
"and dtb_ordr.data_cons between DateAdd(day, -8, @dataIspezione) and DateAdd(day, -1, @dataIspezione)\n" +
|
||||||
|
"and dtb_ordr.flag_evaso = 'I'\n" +
|
||||||
|
"union\n" +
|
||||||
|
"select dtb_ordr.cod_mart, gtb_anag.part_iva\n" +
|
||||||
|
"from carelli.dbo.dtb_ordt inner join carelli.dbo.dtb_ordr on dtb_ordt.gestione = dtb_ordr.gestione \n" +
|
||||||
|
"and dtb_ordt.data_ord = dtb_ordr.data_ord\n" +
|
||||||
|
"and dtb_ordt.num_ord = dtb_ordr.num_ord\n" +
|
||||||
|
"inner join carelli.dbo.gtb_anag on dtb_ordt.cod_anag = gtb_anag.cod_anag \n" +
|
||||||
|
"where dtb_ordt.gestione = 'A' \n" +
|
||||||
|
"and dtb_ordt.flag_annulla = 'N'\n" +
|
||||||
|
"and dtb_ordt.cod_mdep = @codMdep\n" +
|
||||||
|
"and dtb_ordr.data_cons between DateAdd(day, -8, @dataIspezione) and DateAdd(day, -1, @dataIspezione)\n" +
|
||||||
|
"and dtb_ordr.flag_evaso = 'I'\n" +
|
||||||
|
"union\n" +
|
||||||
|
"select dtb_ordr.cod_mart, gtb_anag.part_iva\n" +
|
||||||
|
"from panimal.dbo.dtb_ordt inner join panimal.dbo.dtb_ordr on dtb_ordt.gestione = dtb_ordr.gestione \n" +
|
||||||
|
"and dtb_ordt.data_ord = dtb_ordr.data_ord\n" +
|
||||||
|
"and dtb_ordt.num_ord = dtb_ordr.num_ord\n" +
|
||||||
|
"inner join panimal.dbo.gtb_anag on dtb_ordt.cod_anag = gtb_anag.cod_anag \n" +
|
||||||
|
"where dtb_ordt.gestione = 'A' \n" +
|
||||||
|
"and dtb_ordt.flag_annulla = 'N'\n" +
|
||||||
|
"and dtb_ordt.cod_mdep = @codMdep\n" +
|
||||||
|
"and dtb_ordr.data_cons between DateAdd(day, -8, @dataIspezione) and DateAdd(day, -1, @dataIspezione)\n" +
|
||||||
|
"and dtb_ordr.flag_evaso = 'I' )\n" +
|
||||||
|
"\n" +
|
||||||
|
"select art.cod_mart_griglia as cod_mart\n" +
|
||||||
|
"from ordini \n" +
|
||||||
|
"inner join (SELECT mtb_comp.cod_mart, cod_comp as cod_mart_griglia from carelli.dbo.mtb_comp inner join carelli.dbo.mtb_aart on mtb_comp.cod_mart = mtb_aart.cod_mart and mtb_aart.articolo_composto = 's'\n" +
|
||||||
|
"union all \n" +
|
||||||
|
"SELECT cod_comp as cod_mart, mtb_comp.cod_mart as cod_mart_griglia from carelli.dbo.mtb_comp inner join carelli.dbo.mtb_aart on mtb_comp.cod_mart = mtb_aart.cod_mart and mtb_aart.articolo_composto = 's'\n" +
|
||||||
|
"union all \n" +
|
||||||
|
"SELECt cod_mart, cod_mart as cod_mart_griglia from carelli.dbo.mtb_aart where articolo_composto = 'N'\n" +
|
||||||
|
" ) art on ordini.cod_mart = art.cod_mart\n" +
|
||||||
|
"inner join mtb_aart on ordini.cod_mart = mtb_aart.cod_mart\n" +
|
||||||
|
"inner join jrl_fasi_mtb_grup on jrl_fasi_mtb_grup.cod_mgrp = mtb_aart.cod_mgrp\n" +
|
||||||
|
"where jrl_fasi_mtb_grup.cod_jfas = @codJfas AND\n" +
|
||||||
|
"part_iva in (select value_string from dbo.ParseStringIntoArray((select dbo.getGestSetup('PVM', 'RILEVAZIONI_STEUP', 'ELENCO_FORN_INEVASI')), '|'))");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
package it.integry.ems.migration.model;
|
||||||
|
|
||||||
|
import it.integry.ems.migration._base.BaseMigration;
|
||||||
|
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||||
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
|
|
||||||
|
public class Migration_20241008151727 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!isCustomerDb(IntegryCustomerDB.Carelli_Winact)) return;
|
||||||
|
createOrUpdateFunction("steup_getAssortimento", "CREATE FUNCTION [dbo].[steup_getAssortimento]\n" +
|
||||||
|
" (\n" +
|
||||||
|
" @codmdep VARCHAR(5), @codjfas VARCHAR(5), @dataIspezione datetime\n" +
|
||||||
|
" )\n" +
|
||||||
|
" RETURNS TABLE\n" +
|
||||||
|
" AS\n" +
|
||||||
|
" RETURN(\n" +
|
||||||
|
" /*\n" +
|
||||||
|
" declare @codMdep varchar(5), @codJfas varchar(5)\n" +
|
||||||
|
"\n" +
|
||||||
|
" set @codMdep = '01'\n" +
|
||||||
|
" set @codJfas = '09';\n" +
|
||||||
|
"\n" +
|
||||||
|
" */\n" +
|
||||||
|
"\n" +
|
||||||
|
"\n" +
|
||||||
|
" WITH tipiart AS (SELECT value_string AS cod_mtip\n" +
|
||||||
|
" FROM dbo.parsestringintoarray((SELECT value\n" +
|
||||||
|
" FROM stb_gest_setup\n" +
|
||||||
|
" WHERE gest_name = 'PVM'\n" +
|
||||||
|
" AND section = 'RILEVAZIONI_STEUP'\n" +
|
||||||
|
" AND key_section = 'EXCLUDE_COD_MTIP'), '|') t)\n" +
|
||||||
|
" , art AS (SELECT DISTINCT griglia.cod_mart\n" +
|
||||||
|
" FROM carelli.dbo.getgrigliaacquisto(@dataIspezione, NULL, @codmdep, NULL, NULL) griglia\n" +
|
||||||
|
" INNER JOIN carelli.dbo.mtb_depo ON griglia.cod_mdep = mtb_depo.cod_mdep\n" +
|
||||||
|
" INNER JOIN carelli.dbo.getlistinovendita(NULL, NULL, NULL) AS lisv\n" +
|
||||||
|
" ON mtb_depo.cod_vlis = lisv.cod_vlis AND griglia.cod_mart = lisv.cod_mart\n" +
|
||||||
|
" WHERE griglia.tipo_variazione <> 'D'\n" +
|
||||||
|
" UNION\n" +
|
||||||
|
" SELECT DISTINCT cod_mart\n" +
|
||||||
|
" FROM mtb_depo\n" +
|
||||||
|
" INNER JOIN carelli.dbo.getpromozionevendita(@dataIspezione, @dataIspezione, NULL, NULL, NULL) promo\n" +
|
||||||
|
" ON promo.cod_vlis = mtb_depo.cod_vlis\n" +
|
||||||
|
" WHERE tipo_variazione <> 'D'\n" +
|
||||||
|
" AND mtb_depo.cod_mdep = @codmdep)\n" +
|
||||||
|
"\n" +
|
||||||
|
"\n" +
|
||||||
|
" SELECT DISTINCT mtb_aart.cod_mart,\n" +
|
||||||
|
" mtb_aart.descrizione,\n" +
|
||||||
|
" mtb_aart.bar_code,\n" +
|
||||||
|
" mtb_aart.cod_msgr,\n" +
|
||||||
|
" mtb_aart.plu,\n" +
|
||||||
|
" art_det.cod_mart_griglia AS cod_madre\n" +
|
||||||
|
" FROM mtb_aart\n" +
|
||||||
|
" INNER JOIN jrl_fasi_mtb_grup ON\n" +
|
||||||
|
" mtb_aart.cod_mgrp = jrl_fasi_mtb_grup.cod_mgrp\n" +
|
||||||
|
" INNER JOIN (SELECT mtb_comp.cod_mart, cod_comp AS cod_mart_griglia\n" +
|
||||||
|
" FROM carelli.dbo.mtb_comp\n" +
|
||||||
|
" INNER JOIN carelli.dbo.mtb_aart ON mtb_comp.cod_mart = mtb_aart.cod_mart AND\n" +
|
||||||
|
" mtb_aart.articolo_composto = 's'\n" +
|
||||||
|
" UNION ALL\n" +
|
||||||
|
" SELECT cod_comp AS cod_mart, mtb_comp.cod_mart AS cod_mart_griglia\n" +
|
||||||
|
" FROM carelli.dbo.mtb_comp\n" +
|
||||||
|
" INNER JOIN carelli.dbo.mtb_aart ON mtb_comp.cod_mart = mtb_aart.cod_mart AND\n" +
|
||||||
|
" mtb_aart.articolo_composto = 's'\n" +
|
||||||
|
" UNION ALL\n" +
|
||||||
|
" SELECT cod_mart, cod_mart AS cod_mart_griglia\n" +
|
||||||
|
" FROM carelli.dbo.mtb_aart\n" +
|
||||||
|
" WHERE articolo_composto = 'N') AS art_det\n" +
|
||||||
|
" ON mtb_aart.cod_mart = art_det.cod_mart\n" +
|
||||||
|
" INNER JOIN art ON art_det.cod_mart_griglia = art.cod_mart \n" +
|
||||||
|
" WHERE jrl_fasi_mtb_grup.cod_jfas = @codjfas\n" +
|
||||||
|
" AND flag_stato = 'A'\n" +
|
||||||
|
" AND (mtb_aart.cod_mtip IS NULL OR mtb_aart.cod_mtip NOT IN (SELECT cod_mtip FROM tipiart)))");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
package it.integry.ems.migration.model;
|
||||||
|
|
||||||
|
import it.integry.ems.migration._base.BaseMigration;
|
||||||
|
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||||
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
|
|
||||||
|
public class Migration_20241008153106 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
if (!isCustomerDb(IntegryCustomerDB.Carelli_Winact)) return;
|
||||||
|
|
||||||
|
|
||||||
|
createOrUpdateFunction("[steup_getInevasi]", "CREATE FUNCTION [dbo].[steup_getInevasi]\n" +
|
||||||
|
"( \n" +
|
||||||
|
" @codMdep varchar(5), @codJfas varchar(5), @dataIspezione datetime\n" +
|
||||||
|
")\n" +
|
||||||
|
"RETURNS TABLE \n" +
|
||||||
|
"AS\n" +
|
||||||
|
"RETURN \n" +
|
||||||
|
"with ordini as (\n" +
|
||||||
|
"select dtb_ordr.cod_mart, gtb_anag.part_iva\n" +
|
||||||
|
"from gestfood.dbo.dtb_ordt inner join gestfood.dbo.dtb_ordr on dtb_ordt.gestione = dtb_ordr.gestione \n" +
|
||||||
|
"and dtb_ordt.data_ord = dtb_ordr.data_ord\n" +
|
||||||
|
"and dtb_ordt.num_ord = dtb_ordr.num_ord\n" +
|
||||||
|
"inner join gestfood.dbo.gtb_anag on dtb_ordt.cod_anag = gtb_anag.cod_anag \n" +
|
||||||
|
"inner join gestfood.dbo.atb_list on dtb_ordt.listino = atb_list.cod_alis and atb_list.part_iva_forn is null\n" +
|
||||||
|
"where dtb_ordt.gestione = 'A' \n" +
|
||||||
|
"and dtb_ordt.flag_annulla = 'N'\n" +
|
||||||
|
"and dtb_ordt.cod_mdep = @codMdep\n" +
|
||||||
|
"and dtb_ordr.data_cons between DateAdd(day, -8, @dataIspezione) and DateAdd(day, -1, @dataIspezione)\n" +
|
||||||
|
"and dtb_ordr.flag_evaso = 'I'\n" +
|
||||||
|
"union\n" +
|
||||||
|
"select dtb_ordr.cod_mart, gtb_anag.part_iva\n" +
|
||||||
|
"from carelli.dbo.dtb_ordt inner join carelli.dbo.dtb_ordr on dtb_ordt.gestione = dtb_ordr.gestione \n" +
|
||||||
|
"and dtb_ordt.data_ord = dtb_ordr.data_ord\n" +
|
||||||
|
"and dtb_ordt.num_ord = dtb_ordr.num_ord\n" +
|
||||||
|
"inner join carelli.dbo.gtb_anag on dtb_ordt.cod_anag = gtb_anag.cod_anag \n" +
|
||||||
|
"inner join carelli.dbo.atb_list on dtb_ordt.listino = atb_list.cod_alis and atb_list.part_iva_forn is null\n" +
|
||||||
|
"where dtb_ordt.gestione = 'A' \n" +
|
||||||
|
"and dtb_ordt.flag_annulla = 'N'\n" +
|
||||||
|
"and dtb_ordt.cod_mdep = @codMdep\n" +
|
||||||
|
"and dtb_ordr.data_cons between DateAdd(day, -8, @dataIspezione) and DateAdd(day, -1, @dataIspezione)\n" +
|
||||||
|
"and dtb_ordr.flag_evaso = 'I'\n" +
|
||||||
|
"union\n" +
|
||||||
|
"select dtb_ordr.cod_mart, gtb_anag.part_iva\n" +
|
||||||
|
"from panimal.dbo.dtb_ordt inner join panimal.dbo.dtb_ordr on dtb_ordt.gestione = dtb_ordr.gestione \n" +
|
||||||
|
"and dtb_ordt.data_ord = dtb_ordr.data_ord\n" +
|
||||||
|
"and dtb_ordt.num_ord = dtb_ordr.num_ord\n" +
|
||||||
|
"inner join panimal.dbo.gtb_anag on dtb_ordt.cod_anag = gtb_anag.cod_anag \n" +
|
||||||
|
"inner join panimal.dbo.atb_list on dtb_ordt.listino = atb_list.cod_alis and atb_list.part_iva_forn is null\n" +
|
||||||
|
"where dtb_ordt.gestione = 'A' \n" +
|
||||||
|
"and dtb_ordt.flag_annulla = 'N'\n" +
|
||||||
|
"and dtb_ordt.cod_mdep = @codMdep\n" +
|
||||||
|
"and dtb_ordr.data_cons between DateAdd(day, -8, @dataIspezione) and DateAdd(day, -1, @dataIspezione)\n" +
|
||||||
|
"and dtb_ordr.flag_evaso = 'I' )\n" +
|
||||||
|
"\n" +
|
||||||
|
"select art.cod_mart_griglia as cod_mart\n" +
|
||||||
|
"from ordini \n" +
|
||||||
|
"inner join (SELECT mtb_comp.cod_mart, cod_comp as cod_mart_griglia from carelli.dbo.mtb_comp inner join carelli.dbo.mtb_aart on mtb_comp.cod_mart = mtb_aart.cod_mart and mtb_aart.articolo_composto = 's'\n" +
|
||||||
|
"union all \n" +
|
||||||
|
"SELECT cod_comp as cod_mart, mtb_comp.cod_mart as cod_mart_griglia from carelli.dbo.mtb_comp inner join carelli.dbo.mtb_aart on mtb_comp.cod_mart = mtb_aart.cod_mart and mtb_aart.articolo_composto = 's'\n" +
|
||||||
|
"union all \n" +
|
||||||
|
"SELECt cod_mart, cod_mart as cod_mart_griglia from carelli.dbo.mtb_aart where articolo_composto = 'N'\n" +
|
||||||
|
" ) art on ordini.cod_mart = art.cod_mart\n" +
|
||||||
|
"inner join mtb_aart on ordini.cod_mart = mtb_aart.cod_mart\n" +
|
||||||
|
"inner join jrl_fasi_mtb_grup on jrl_fasi_mtb_grup.cod_mgrp = mtb_aart.cod_mgrp\n" +
|
||||||
|
"where jrl_fasi_mtb_grup.cod_jfas = @codJfas AND\n" +
|
||||||
|
"part_iva in (select value_string from dbo.ParseStringIntoArray((select dbo.getGestSetup('PVM', 'RILEVAZIONI_STEUP', 'ELENCO_FORN_INEVASI')), '|'))");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,379 @@
|
|||||||
|
package it.integry.ems.migration.model;
|
||||||
|
|
||||||
|
import it.integry.ems.migration._base.BaseMigration;
|
||||||
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
|
|
||||||
|
public class Migration_20241009122649 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
createOrUpdateTrigger("t_UpdProgMagaInsT", "CREATE TRIGGER [dbo].[t_UpdProgMagaInsT]\n" +
|
||||||
|
" ON [dbo].[dtb_ordt]\n" +
|
||||||
|
" FOR INSERT\n" +
|
||||||
|
" AS\n" +
|
||||||
|
" DECLARE\n" +
|
||||||
|
" @ls_codMart VARCHAR(15),\n" +
|
||||||
|
" @ls_codComp VARCHAR(15),\n" +
|
||||||
|
" @ls_buffer VARCHAR(15),\n" +
|
||||||
|
" @ls_codTagl VARCHAR(15),\n" +
|
||||||
|
" @ls_codMdep VARCHAR(5),\n" +
|
||||||
|
" @ls_codCol VARCHAR(5),\n" +
|
||||||
|
" @ls_partitaMag VARCHAR(20),\n" +
|
||||||
|
" @ls_annotazioni VARCHAR(255),\n" +
|
||||||
|
" @ls_concatena VARCHAR(50),\n" +
|
||||||
|
" @ls_flagEvaso VARCHAR(1),\n" +
|
||||||
|
" @ls_flagAnnulla VARCHAR(1),\n" +
|
||||||
|
" @ls_gestione VARCHAR(1),\n" +
|
||||||
|
" @ls_articoloComposto VARCHAR(1),\n" +
|
||||||
|
" @ls_codProd VARCHAR(15),\n" +
|
||||||
|
" @ls_flagEvasoProd VARCHAR(1),\n" +
|
||||||
|
" @ls_codJcom VARCHAR(10),\n" +
|
||||||
|
" @ls_gestioneRif VARCHAR(1),\n" +
|
||||||
|
" @ls_descrizioneProd VARCHAR(40),\n" +
|
||||||
|
" @ls_descrEstesaProd VARCHAR(255),\n" +
|
||||||
|
" @ls_untMisProd VARCHAR(3),\n" +
|
||||||
|
" @ls_flagEvasoForzato VARCHAR(1),\n" +
|
||||||
|
" @ls_codAliq VARCHAR(5),\n" +
|
||||||
|
" @lc_qtaConf DECIMAL(15, 5),\n" +
|
||||||
|
" @lc_qtaAcc DECIMAL(15, 5),\n" +
|
||||||
|
" @lc_qtaCol DECIMAL(15, 5),\n" +
|
||||||
|
" @lc_qtaOrd DECIMAL(15, 5),\n" +
|
||||||
|
" @lc_qtaEvasa DECIMAL(15, 5),\n" +
|
||||||
|
" @lc_qtaAccComp DECIMAL(15, 5),\n" +
|
||||||
|
" @lc_qtaColComp DECIMAL(15, 5),\n" +
|
||||||
|
" @lc_qtaOrdComp DECIMAL(15, 5),\n" +
|
||||||
|
" @lc_qtaEvasaComp DECIMAL(15, 5),\n" +
|
||||||
|
" @lc_rapConv DECIMAL(15, 5),\n" +
|
||||||
|
" @lc_qtaOrdFor DECIMAL(15, 5),\n" +
|
||||||
|
" @lc_qtaImpLav DECIMAL(15, 5),\n" +
|
||||||
|
" @lc_qtaImpCli DECIMAL(15, 5),\n" +
|
||||||
|
" @lc_qtaStd DECIMAL(15, 5),\n" +
|
||||||
|
" @lc_percPrezzo DECIMAL(15, 3),\n" +
|
||||||
|
" @lc_sconto1 DECIMAL(15, 5),\n" +
|
||||||
|
" @lc_sconto2 DECIMAL(15, 5),\n" +
|
||||||
|
" @lc_sconto3 DECIMAL(15, 5),\n" +
|
||||||
|
" @lc_sconto4 DECIMAL(15, 5),\n" +
|
||||||
|
" @lc_totImponib DECIMAL(20, 5),\n" +
|
||||||
|
" @lc_qtaProd DECIMAL(15, 5),\n" +
|
||||||
|
" @lc_qtaEvasaProd DECIMAL(15, 5),\n" +
|
||||||
|
" @lc_valUnt DECIMAL(20, 5),\n" +
|
||||||
|
" @lc_cambioOrdAcq DECIMAL(20, 5),\n" +
|
||||||
|
" @lc_cambio DECIMAL(20, 5),\n" +
|
||||||
|
" @lc_rapConvProd DECIMAL(15, 5),\n" +
|
||||||
|
" @ll_numOrd INTEGER,\n" +
|
||||||
|
" @ll_rigaOrd INTEGER,\n" +
|
||||||
|
" @ll_rigaOrdRif INTEGER,\n" +
|
||||||
|
" @ll_numOrdRif INTEGER,\n" +
|
||||||
|
" @ll_cifreDecAcq INTEGER,\n" +
|
||||||
|
" @ldt_dataOrdRif DATETIME,\n" +
|
||||||
|
" @ldt_dataConsProd DATETIME,\n" +
|
||||||
|
" @ldt_dataOrd DATETIME,\n" +
|
||||||
|
" @ll_numFase INTEGER,\n" +
|
||||||
|
" @ll_totFasi INTEGER,\n" +
|
||||||
|
" @ls_codTcolUl VARCHAR(5),\n" +
|
||||||
|
" @lc_colliPedana DECIMAL(20, 5),\n" +
|
||||||
|
" @ls_errorMsg VARCHAR(255),\n" +
|
||||||
|
" @ls_codTcolUi VARCHAR(5),\n" +
|
||||||
|
" @li_posRiga INTEGER,\n" +
|
||||||
|
" @numCnf NUMERIC(20, 5),\n" +
|
||||||
|
" @flagQtaCnfFissa VARCHAR(1),\n" +
|
||||||
|
" @qtaOrd2 NUMERIC(20, 5),\n" +
|
||||||
|
" @qtaOrd3 NUMERIC(20, 5),\n" +
|
||||||
|
" @rapconv2 NUMERIC(20, 5),\n" +
|
||||||
|
" @rapconv3 NUMERIC(20, 5),\n" +
|
||||||
|
" @untOrd2 VARCHAR(3),\n" +
|
||||||
|
" @untOrd3 VARCHAR(3),\n" +
|
||||||
|
" @untOrd VARCHAR(3),\n" +
|
||||||
|
" @insertOrdProd bit\n" +
|
||||||
|
"\n" +
|
||||||
|
" /* Necessaria per connessione OLEDB */\n" +
|
||||||
|
" SET NOCOUNT ON\n" +
|
||||||
|
"\n" +
|
||||||
|
" select @insertOrdProd = CAST(IIF(dbo.getGestSetupWithDefault('DTB_ORDT','SETUP','DISABLE_TRIGGER_ORDL', 'N')='N',1,0) AS bit) \n" +
|
||||||
|
"\n" +
|
||||||
|
"/* Inserimento riga ordine di produzione */\n" +
|
||||||
|
" DECLARE\n" +
|
||||||
|
" csr_ordt_insert CURSOR FOR\n" +
|
||||||
|
" SELECT inserted.gestione,\n" +
|
||||||
|
" inserted.data_ord,\n" +
|
||||||
|
" inserted.num_ord,\n" +
|
||||||
|
" inserted.riga_ord_rif,\n" +
|
||||||
|
" inserted.cod_prod,\n" +
|
||||||
|
" dtb_ordt.flag_evaso_prod, /* legge il valore corretto di flag_evaso_prod*/\n" +
|
||||||
|
" inserted.flag_annulla,\n" +
|
||||||
|
" inserted.sconto1,\n" +
|
||||||
|
" inserted.sconto2,\n" +
|
||||||
|
" inserted.sconto3,\n" +
|
||||||
|
" inserted.sconto4,\n" +
|
||||||
|
" inserted.tot_imponib - inserted.tot_merce,\n" +
|
||||||
|
" inserted.qta_prod,\n" +
|
||||||
|
" inserted.cod_jcom,\n" +
|
||||||
|
" inserted.gestione_rif,\n" +
|
||||||
|
" inserted.data_ord_rif,\n" +
|
||||||
|
" inserted.num_ord_rif,\n" +
|
||||||
|
" inserted.qta_evasa_prod,\n" +
|
||||||
|
" inserted.rap_conv_prod,\n" +
|
||||||
|
" inserted.data_cons_prod,\n" +
|
||||||
|
" inserted.descrizione_prod,\n" +
|
||||||
|
" inserted.descr_estesa_prod,\n" +
|
||||||
|
" inserted.unt_mis_prod,\n" +
|
||||||
|
" inserted.flag_evaso_forzato,\n" +
|
||||||
|
" gtb_divi.cambio,\n" +
|
||||||
|
" inserted.note,\n" +
|
||||||
|
" inserted.partita_mag,\n" +
|
||||||
|
" inserted.cod_mdep,\n" +
|
||||||
|
" inserted.num_fase,\n" +
|
||||||
|
" inserted.tot_fasi,\n" +
|
||||||
|
" inserted.colli_pedana,\n" +
|
||||||
|
" inserted.cod_tcol_ul,\n" +
|
||||||
|
" inserted.cod_tcol_ui,\n" +
|
||||||
|
" inserted.num_cnf_prod\n" +
|
||||||
|
" FROM inserted,\n" +
|
||||||
|
" gtb_divi,\n" +
|
||||||
|
" dtb_ordt\n" +
|
||||||
|
" WHERE inserted.cod_divi = gtb_divi.cod_divi\n" +
|
||||||
|
" AND (dtb_ordt.gestione = inserted.gestione)\n" +
|
||||||
|
" AND (dtb_ordt.data_ord = inserted.data_ord)\n" +
|
||||||
|
" AND (dtb_ordt.num_ord = inserted.num_ord)\n" +
|
||||||
|
" OPEN csr_ordt_insert\n" +
|
||||||
|
" FETCH NEXT FROM csr_ordt_insert INTO @ls_gestione, @ldt_dataOrd, @ll_numOrd, @ll_rigaOrdRif,@ls_codProd, @ls_flagEvasoProd,\n" +
|
||||||
|
" @ls_flagAnnulla, @lc_sconto1, @lc_sconto2, @lc_sconto3, @lc_sconto4, @lc_totImponib,\n" +
|
||||||
|
" @lc_qtaProd, @ls_codJcom, @ls_gestioneRif, @ldt_dataOrdRif, @ll_numOrdRif,\n" +
|
||||||
|
" @lc_qtaEvasaProd, @lc_rapConvProd, @ldt_dataconsProd, @ls_descrizioneProd,\n" +
|
||||||
|
" @ls_descrEstesaProd, @ls_untMisProd, @ls_flagEvasoForzato, @lc_cambio, @ls_annotazioni,\n" +
|
||||||
|
" @ls_partitaMag,@ls_codMdep, @ll_numFase, @ll_totFasi,@lc_colliPedana ,@ls_codTcolUl, @ls_codTcolui, @numCnf;\n" +
|
||||||
|
" WHILE @@FETCH_STATUS = 0 BEGIN\n" +
|
||||||
|
" /*\n" +
|
||||||
|
" */\n" +
|
||||||
|
" IF @ls_gestione = 'L' AND @ls_gestioneRif = 'A' AND @ll_rigaOrdRif IS NOT NULL AND @ll_numFase = @ll_totFasi and @insertOrdProd = 1\n" +
|
||||||
|
" BEGIN\n" +
|
||||||
|
" /* SELECT @ls_errorMsg = \"cod_mart = \" + @ls_codProd + \" GESTIONE = \" + @ls_gestione + \" DATA = \" + CONVERT(varchar, @ldt_dataOrd, 111) + \" NUM. = \" + CONVERT(varchar, @ll_numOrd) + \" COLLI_PED = \" +CONVERT(varchar,@lc_colliPedana) + \" TIPO_PED \" + @ls_codTcolUL\n" +
|
||||||
|
" RAISERROR (@ls_errorMsg, 16, 1)*/\n" +
|
||||||
|
"\n" +
|
||||||
|
" SELECT @ls_codAliq = cod_aliq,\n" +
|
||||||
|
" @lc_qtaConf = qta_cnf / @lc_rapConvProd ,\n" +
|
||||||
|
" @flagQtaCnfFissa = flag_qta_cnf_fissa,\n" +
|
||||||
|
" @untOrd = mtb_aart.unt_mis,\n" +
|
||||||
|
" @untOrd2 = mtb_aart.unt_mis2,\n" +
|
||||||
|
" @untOrd3 = mtb_aart.unt_mis3,\n" +
|
||||||
|
" @rapConv2 = mtb_aart.rap_conv2,\n" +
|
||||||
|
" @rapConv3 = mtb_aart.rap_conv3\n" +
|
||||||
|
" FROM mtb_aart\n" +
|
||||||
|
" WHERE cod_mart = @ls_codProd\n" +
|
||||||
|
"\n" +
|
||||||
|
" IF @ls_untMisProd = @untOrd\n" +
|
||||||
|
" BEGIN\n" +
|
||||||
|
" SELECT @untOrd2 = @untOrd2\n" +
|
||||||
|
" IF @untOrd2 IS NOT NULL AND @rapconv2 <> 0\n" +
|
||||||
|
" SELECT @qtaOrd2 = ROUND(@lc_qtaProd / @rapconv2, 5)\n" +
|
||||||
|
"\n" +
|
||||||
|
" SELECT @untOrd3 = @untOrd3\n" +
|
||||||
|
" IF @untOrd3 IS NOT NULL AND @rapconv3 <> 0\n" +
|
||||||
|
" SELECT @qtaOrd3 = ROUND(@lc_qtaProd / @rapconv3, 5)\n" +
|
||||||
|
" END\n" +
|
||||||
|
" ELSE\n" +
|
||||||
|
" IF @ls_untMisProd = @untOrd2\n" +
|
||||||
|
" BEGIN\n" +
|
||||||
|
" SELECT @untOrd2 = @untOrd\n" +
|
||||||
|
" SELECT @qtaOrd2 = ROUND(@lc_qtaProd * @lc_rapConvProd, 5)\n" +
|
||||||
|
"\n" +
|
||||||
|
" SELECT @untOrd3 = @untOrd3\n" +
|
||||||
|
" IF @untOrd3 IS NOT NULL AND @rapconv3 <> 0\n" +
|
||||||
|
" SELECT @qtaOrd3 = ROUND(@lc_qtaProd * @lc_rapConvProd / @rapconv3, 5)\n" +
|
||||||
|
" END\n" +
|
||||||
|
" ELSE\n" +
|
||||||
|
" IF @ls_untMisProd = @untOrd3\n" +
|
||||||
|
" BEGIN\n" +
|
||||||
|
" SELECT @untOrd3 = @untOrd\n" +
|
||||||
|
" SELECT @qtaOrd3 = ROUND(@lc_qtaProd * @lc_rapConvProd, 5)\n" +
|
||||||
|
"\n" +
|
||||||
|
" IF @untOrd2 IS NOT NULL AND @rapconv2 <> 0\n" +
|
||||||
|
" SELECT @qtaOrd2 = ROUND(@lc_qtaProd * @lc_rapConvProd / @rapconv2, 5)\n" +
|
||||||
|
" END\n" +
|
||||||
|
"\n" +
|
||||||
|
"\n" +
|
||||||
|
" SELECT @lc_cambioOrdAcq = gtb_divi.cambio,\n" +
|
||||||
|
" @ll_cifreDecAcq = gtb_divi.cifre_dec\n" +
|
||||||
|
" FROM dtb_ordt,\n" +
|
||||||
|
" gtb_divi\n" +
|
||||||
|
" WHERE dtb_ordt.cod_divi = gtb_divi.cod_divi\n" +
|
||||||
|
" AND dtb_ordt.gestione = @ls_gestioneRif\n" +
|
||||||
|
" AND dtb_ordt.data_ord = @ldt_dataOrdRif\n" +
|
||||||
|
" AND dtb_ordt.num_ord = @ll_numOrdRif\n" +
|
||||||
|
"\n" +
|
||||||
|
" /*SELECT @lc_valUnt = round(@lc_totImponib / @lc_qtaProd / @lc_cambio * @lc_cambioOrdAcq, @ll_cifreDecAcq)*/\n" +
|
||||||
|
" SELECT @lc_valUnt = @lc_totImponib / @lc_qtaProd / @lc_cambio * @lc_cambioOrdAcq\n" +
|
||||||
|
" IF @lc_valUnt IS NULL SELECT @lc_valUnt = 0\n" +
|
||||||
|
" IF @ls_flagAnnulla <> 'N' SELECT @ls_flagEvasoProd = 'A'\n" +
|
||||||
|
"\n" +
|
||||||
|
" SELECT @li_posRiga = ISNULL(MAX(pos_riga), 0) + 1\n" +
|
||||||
|
" FROM dtb_ordr\n" +
|
||||||
|
" WHERE dtb_ordr.gestione = @ls_gestioneRif\n" +
|
||||||
|
" AND dtb_ordr.data_ord = @ldt_dataOrdRif\n" +
|
||||||
|
" AND dtb_ordr.num_ord = @ll_numOrdRif\n" +
|
||||||
|
"\n" +
|
||||||
|
" IF @numCnf IS NULL\n" +
|
||||||
|
" BEGIN\n" +
|
||||||
|
" SELECT @numCnf = CASE\n" +
|
||||||
|
" WHEN @lc_qtaConf <> 0 THEN CASE\n" +
|
||||||
|
" WHEN @flagQtaCnfFissa = 'N'\n" +
|
||||||
|
" THEN ROUND(@lc_qtaProd / @lc_qtaConf, 0)\n" +
|
||||||
|
" ELSE ROUND(@lc_qtaProd / @lc_qtaConf, 5) END\n" +
|
||||||
|
" ELSE 0 END\n" +
|
||||||
|
" END\n" +
|
||||||
|
" --SELECT @numCnf = case when @lc_qtaConf <> 0 then round(@lc_qtaProd / @lc_qtaConf, 0, 1) else 0 end \n" +
|
||||||
|
"\n" +
|
||||||
|
" \n" +
|
||||||
|
"\n" +
|
||||||
|
" declare @numCnfEvasa numeric(20,5)\n" +
|
||||||
|
" \n" +
|
||||||
|
" SELECT @numCnfEvasa = CASE\n" +
|
||||||
|
" WHEN @lc_qtaConf <> 0 THEN CASE\n" +
|
||||||
|
" WHEN @flagQtaCnfFissa = 'N'\n" +
|
||||||
|
" THEN ROUND(@lc_qtaEvasaProd / @lc_qtaConf, 0)\n" +
|
||||||
|
" ELSE ROUND(@lc_qtaEvasaProd / @lc_qtaConf, 5) END\n" +
|
||||||
|
" ELSE 0 END\n" +
|
||||||
|
" \n" +
|
||||||
|
"\n" +
|
||||||
|
" INSERT INTO dtb_ordr (gestione,\n" +
|
||||||
|
" data_ord,\n" +
|
||||||
|
" num_ord,\n" +
|
||||||
|
" riga_ord,\n" +
|
||||||
|
" flag_evaso,\n" +
|
||||||
|
" data_cons,\n" +
|
||||||
|
" cod_mart,\n" +
|
||||||
|
" descrizione,\n" +
|
||||||
|
" unt_ord,\n" +
|
||||||
|
" rap_conv,\n" +
|
||||||
|
" qta_ord,\n" +
|
||||||
|
" unt_ord2,\n" +
|
||||||
|
" qta_ord2,\n" +
|
||||||
|
" unt_ord3,\n" +
|
||||||
|
" qta_ord3,\n" +
|
||||||
|
" qta_evasa,\n" +
|
||||||
|
" val_unt,\n" +
|
||||||
|
" sconto5,\n" +
|
||||||
|
" sconto6,\n" +
|
||||||
|
" sconto7,\n" +
|
||||||
|
" sconto8,\n" +
|
||||||
|
" cod_aliq,\n" +
|
||||||
|
" importo_riga,\n" +
|
||||||
|
" descrizione_estesa,\n" +
|
||||||
|
" cod_jcom,\n" +
|
||||||
|
" pos_riga,\n" +
|
||||||
|
" flag_evaso_forzato,\n" +
|
||||||
|
" perc_prov,\n" +
|
||||||
|
" val_prov,\n" +
|
||||||
|
" perc_ispe,\n" +
|
||||||
|
" val_ispe,\n" +
|
||||||
|
" perc_promo,\n" +
|
||||||
|
" val_promo,\n" +
|
||||||
|
" perc_oneri,\n" +
|
||||||
|
" val_oneri,\n" +
|
||||||
|
" qta_acc,\n" +
|
||||||
|
" qta_col,\n" +
|
||||||
|
" perc_gest,\n" +
|
||||||
|
" val_gest,\n" +
|
||||||
|
" qta_cnf,\n" +
|
||||||
|
" note,\n" +
|
||||||
|
" partita_mag,\n" +
|
||||||
|
" cod_mdep,\n" +
|
||||||
|
" colli_pedana,\n" +
|
||||||
|
" cod_tcol_ul,\n" +
|
||||||
|
" cod_tcol_ui,\n" +
|
||||||
|
" num_cnf,\n" +
|
||||||
|
" id_art,\n" +
|
||||||
|
" num_cnf_evasa)\n" +
|
||||||
|
" VALUES (@ls_gestioneRif,\n" +
|
||||||
|
" @ldt_dataOrdRif,\n" +
|
||||||
|
" @ll_numOrdRif,\n" +
|
||||||
|
" @ll_rigaOrdRif,\n" +
|
||||||
|
" @ls_flagEvasoProd,\n" +
|
||||||
|
" @ldt_dataConsProd,\n" +
|
||||||
|
" @ls_codProd,\n" +
|
||||||
|
" @ls_descrizioneProd,\n" +
|
||||||
|
" @ls_untMisProd,\n" +
|
||||||
|
" @lc_rapConvProd,\n" +
|
||||||
|
" @lc_qtaProd,\n" +
|
||||||
|
" @untOrd2,\n" +
|
||||||
|
" @qtaOrd2,\n" +
|
||||||
|
" @untOrd3,\n" +
|
||||||
|
" @qtaOrd3,\n" +
|
||||||
|
" @lc_qtaEvasaProd,\n" +
|
||||||
|
" @lc_valUnt,\n" +
|
||||||
|
" @lc_sconto1,\n" +
|
||||||
|
" @lc_sconto2,\n" +
|
||||||
|
" @lc_sconto3,\n" +
|
||||||
|
" @lc_sconto4,\n" +
|
||||||
|
" @ls_codAliq,\n" +
|
||||||
|
" @lc_totImponib,\n" +
|
||||||
|
" @ls_descrEstesaProd,\n" +
|
||||||
|
" @ls_codJcom,\n" +
|
||||||
|
" @li_posRiga,\n" +
|
||||||
|
" @ls_flagEvasoForzato,\n" +
|
||||||
|
" 0,\n" +
|
||||||
|
" 0,\n" +
|
||||||
|
" 0,\n" +
|
||||||
|
" 0,\n" +
|
||||||
|
" 0,\n" +
|
||||||
|
" 0,\n" +
|
||||||
|
" 0,\n" +
|
||||||
|
" 0,\n" +
|
||||||
|
" 0,\n" +
|
||||||
|
" 0,\n" +
|
||||||
|
" 0,\n" +
|
||||||
|
" 0,\n" +
|
||||||
|
" @lc_qtaConf,\n" +
|
||||||
|
" @ls_annotazioni,\n" +
|
||||||
|
" @ls_partitaMag,\n" +
|
||||||
|
" @ls_codMdep,\n" +
|
||||||
|
" @lc_colliPedana,\n" +
|
||||||
|
" @ls_codTcolUl,\n" +
|
||||||
|
" @ls_codTcolUi,\n" +
|
||||||
|
" @numCnf,\n" +
|
||||||
|
" @li_posRiga,\n" +
|
||||||
|
" @numCnfEvasa)\n" +
|
||||||
|
"\n" +
|
||||||
|
" IF @@ERROR <> 0 RETURN\n" +
|
||||||
|
" END\n" +
|
||||||
|
" FETCH NEXT FROM csr_ordt_insert INTO @ls_gestione, @ldt_dataOrd, @ll_numOrd, @ll_rigaOrdRif,@ls_codProd, @ls_flagEvasoProd,\n" +
|
||||||
|
" @ls_flagAnnulla, @lc_sconto1, @lc_sconto2, @lc_sconto3, @lc_sconto4, @lc_totImponib,\n" +
|
||||||
|
" @lc_qtaProd, @ls_codJcom, @ls_gestioneRif, @ldt_dataOrdRif, @ll_numOrdRif,\n" +
|
||||||
|
" @lc_qtaEvasaProd, @lc_rapConvProd, @ldt_dataconsProd, @ls_descrizioneProd,\n" +
|
||||||
|
" @ls_descrEstesaProd, @ls_untMisProd, @ls_flagEvasoForzato, @lc_cambio, @ls_annotazioni,\n" +
|
||||||
|
" @ls_partitaMag,@ls_codMdep, @ll_numFase, @ll_totFasi,@lc_colliPedana ,@ls_codTcolUl, @ls_codTcolUi, @numCnf;\n" +
|
||||||
|
" END\n" +
|
||||||
|
" CLOSE csr_ordt_insert\n" +
|
||||||
|
" DEALLOCATE csr_ordt_insert\n" +
|
||||||
|
"\n" +
|
||||||
|
"/* corregge il valore di flag_evaso_prod, in base alla regola:\n" +
|
||||||
|
" le righe non annullate, in cui la quantità evasa è >= dell'ordinato > 0,\n" +
|
||||||
|
" sono da considerare evase\n" +
|
||||||
|
" Nota: le righe in cui ci sono valori nulli sui campi qta_evasa_prod, \n" +
|
||||||
|
" qta_prod, flag_evaso_prod non sono prese in considerazione\n" +
|
||||||
|
"*/\n" +
|
||||||
|
" UPDATE dtb_ordt\n" +
|
||||||
|
" SET flag_evaso_prod = 'E'\n" +
|
||||||
|
" FROM dtb_ordt,\n" +
|
||||||
|
" inserted\n" +
|
||||||
|
" WHERE (dtb_ordt.gestione = inserted.gestione)\n" +
|
||||||
|
" AND (dtb_ordt.data_ord = inserted.data_ord)\n" +
|
||||||
|
" AND (dtb_ordt.num_ord = inserted.num_ord)\n" +
|
||||||
|
" AND (dtb_ordt.flag_evaso_prod <> 'A')\n" +
|
||||||
|
" AND (dtb_ordt.qta_evasa_prod >= dtb_ordt.qta_prod)\n" +
|
||||||
|
" AND (dtb_ordt.qta_evasa_prod > 0) ;\n" +
|
||||||
|
" IF @@ERROR <> 0 RETURN\n" +
|
||||||
|
"/* Necessaria per connessione OLEDB */\n" +
|
||||||
|
" SET NOCOUNT OFF");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,614 @@
|
|||||||
|
package it.integry.ems.migration.model;
|
||||||
|
|
||||||
|
import it.integry.ems.migration._base.BaseMigration;
|
||||||
|
import it.integry.ems.migration._base.IntegryCustomer;
|
||||||
|
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||||
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
|
|
||||||
|
public class Migration_20241010103639 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
String value = null;
|
||||||
|
|
||||||
|
if (isCustomerDb(IntegryCustomerDB.Smetar_Smetar)) {
|
||||||
|
value = "DDTContoLavorazione";
|
||||||
|
}
|
||||||
|
|
||||||
|
createSetup("PVM", "MONITORAGGIO_ORDINI", "REPORT_DOCUMENTI", value,
|
||||||
|
"Nome report per i documenti di scarico.", "REPORT_NAME");
|
||||||
|
|
||||||
|
if (isCustomer(IntegryCustomer.Gramm)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
createOrUpdateFunction("MES_GetWorkOrders",
|
||||||
|
"CREATE FUNCTION [dbo].[MES_GetWorkOrders](@codJfas VARCHAR(50), @dateStart DATE, @dateEnd DATE, @flagEvaso VARCHAR(1),\n" +
|
||||||
|
" @codAnag VARCHAR(5))\n" +
|
||||||
|
" RETURNS @val TABLE\n" +
|
||||||
|
" (\n" +
|
||||||
|
" [sort] [int] NULL,\n" +
|
||||||
|
" [cod_jcom] [varchar](10) NULL,\n" +
|
||||||
|
" [data_ord_prod] [datetime] NULL,\n" +
|
||||||
|
" [num_ord_prod] [int] NULL,\n" +
|
||||||
|
" [riga_ord_prod] [int] NULL,\n" +
|
||||||
|
" [flag_avviabile] [varchar](1) NULL,\n" +
|
||||||
|
" [flag_tracciabilita] [varchar](1) NULL,\n" +
|
||||||
|
" [unt_ord] [varchar](3) NULL,\n" +
|
||||||
|
" [rap_conv] [numeric](20, 10) NULL,\n" +
|
||||||
|
" [unt_ord2] [varchar](3) NULL,\n" +
|
||||||
|
" [rap_conv2] [numeric](20, 5) NULL,\n" +
|
||||||
|
" [unt_ord3] [varchar](3) NULL,\n" +
|
||||||
|
" [rap_conv3] [numeric](20, 5) NULL,\n" +
|
||||||
|
" [descrizione_prod] [varchar](255) NULL,\n" +
|
||||||
|
" [num_pezzi] [numeric](38, 6) NULL,\n" +
|
||||||
|
" [num_cnf] [numeric](20, 5) NULL,\n" +
|
||||||
|
" [gg_scad_partita] [int] NULL,\n" +
|
||||||
|
" [qta_cnf] [numeric](15, 5) NULL,\n" +
|
||||||
|
" [colli_pedana] [numeric](20, 5) NULL,\n" +
|
||||||
|
" [num_pedane] [numeric](38, 18) NULL,\n" +
|
||||||
|
" [pos_riga] [int] NULL,\n" +
|
||||||
|
" [flag_evaso_prod] [varchar](1) NULL,\n" +
|
||||||
|
" [flag_evaso_forzato] [varchar](1) NOT NULL,\n" +
|
||||||
|
" [flag_ordine_evaso] [varchar](1) NULL,\n" +
|
||||||
|
" [gestione] [varchar](1) NOT NULL,\n" +
|
||||||
|
" [data_ord] [datetime] NOT NULL,\n" +
|
||||||
|
" [cod_tcol_UL] [varchar](5) NULL,\n" +
|
||||||
|
" [descrizione_tcol] [varchar](40) NULL,\n" +
|
||||||
|
" [cod_anag] [varchar](5) NOT NULL,\n" +
|
||||||
|
" [rag_soc_anag] [varchar](40) NULL,\n" +
|
||||||
|
" [part_iva] [varchar](20) NULL,\n" +
|
||||||
|
" [rif_ord] [varchar](40) NULL,\n" +
|
||||||
|
" [cod_vdes] [varchar](5) NULL,\n" +
|
||||||
|
" [cod_mdep] [varchar](5) NOT NULL,\n" +
|
||||||
|
" [cod_mdep_prod] [varchar](5) NOT NULL,\n" +
|
||||||
|
" [num_ord] [int] NOT NULL,\n" +
|
||||||
|
" [cod_jfas] [varchar](5) NOT NULL,\n" +
|
||||||
|
" [cod_jfas_lav] [varchar](5) NOT NULL,\n" +
|
||||||
|
" [partita_mag] [varchar](20) NULL,\n" +
|
||||||
|
" [note_lav] [varchar](255) NULL,\n" +
|
||||||
|
" [data_scad] [datetime] NULL,\n" +
|
||||||
|
" [cod_prod] [varchar](15) NULL,\n" +
|
||||||
|
" [descrizione_commessa] [varchar](40) NULL,\n" +
|
||||||
|
" [data_iniz_prod] [datetime] NULL,\n" +
|
||||||
|
" [max_step] [int] NULL,\n" +
|
||||||
|
" [unt_mis_prod] [varchar](5) NULL,\n" +
|
||||||
|
" [qta_batch_prod] [numeric](15, 5) NULL,\n" +
|
||||||
|
" [rap_conv_prod] [numeric](20, 10) NULL,\n" +
|
||||||
|
" [data_iniz] [datetime] NULL,\n" +
|
||||||
|
" [data_fine] [datetime] NULL,\n" +
|
||||||
|
" [qta_prod] [decimal](20, 5) NULL,\n" +
|
||||||
|
" [qta_lav] [decimal](20, 5) NULL,\n" +
|
||||||
|
" [max_fase] [int] NULL,\n" +
|
||||||
|
" [num_fase] [int] NULL,\n" +
|
||||||
|
" [hr_num] [int] NOT NULL,\n" +
|
||||||
|
" [descrizione_attivita] [varchar](1024) NULL,\n" +
|
||||||
|
" [prod_std] [numeric](38, 21) NULL,\n" +
|
||||||
|
" [elapsed_time] [int] NULL,\n" +
|
||||||
|
" [qta_trasferite] [numeric](38, 5) NULL,\n" +
|
||||||
|
" [udc_trasferiti] [int] NULL,\n" +
|
||||||
|
" [stato] [varchar](11) NOT NULL,\n" +
|
||||||
|
" [pz_trasferiti] [int] NULL,\n" +
|
||||||
|
" [run_time_sec] [numeric](38, 6) NULL,\n" +
|
||||||
|
" [cumulative_run_time_sec] [numeric](38, 6) NULL,\n" +
|
||||||
|
" [run_time_hour] [int] NULL,\n" +
|
||||||
|
" [run_time_min] [numeric](38, 6) NULL,\n" +
|
||||||
|
" [run_time_end] [datetime] NULL,\n" +
|
||||||
|
" [id_lotto] [int] NULL,\n" +
|
||||||
|
" [data_lotto] [datetime] NULL,\n" +
|
||||||
|
" [peso_kg] [numeric](20, 5) NULL,\n" +
|
||||||
|
" [data_cons_prod_max] [datetime] NULL\n" +
|
||||||
|
" ) AS\n" +
|
||||||
|
"BEGIN\n" +
|
||||||
|
"\n" +
|
||||||
|
" -- DECLARE @codJfas VARCHAR(5) = 'L1'\n" +
|
||||||
|
"-- DECLARE @dateStart DATE = DATEADD(MONTH, -1, GETDATE())\n" +
|
||||||
|
"-- DECLARE @dateEnd DATE = DATEADD(MONTH, 1, GETDATE())\n" +
|
||||||
|
"-- DECLARE @flagEvaso VARCHAR(1) = 'I'\n" +
|
||||||
|
"-- DECLARE @codAnag VARCHAR(5) = null;\n" +
|
||||||
|
"\n" +
|
||||||
|
" SET @dateStart = ISNULL(@dateStart, DATEADD(DAY, -14, GETDATE()));\n" +
|
||||||
|
" SET @dateEND = ISNULL(@dateEnd, GETDATE());\n" +
|
||||||
|
" SET @flagEvaso = ISNULL(@flagEvaso, 'I');\n" +
|
||||||
|
"\n" +
|
||||||
|
"--Funzione per calcolare la sequenza di ordini su una linea e il RunTimeEND\n" +
|
||||||
|
" WITH setup AS (SELECT @dateStart AS date_start,\n" +
|
||||||
|
" @dateEnd AS date_end,\n" +
|
||||||
|
" @flagEvaso AS flag_evaso,\n" +
|
||||||
|
" @codJfas AS cod_jfas,\n" +
|
||||||
|
" @codAnag AS cod_anag),\n" +
|
||||||
|
" setup_jfas AS (SELECT value_string AS cod_jfas\n" +
|
||||||
|
" FROM dbo.ParseStringIntoArray(@codJfas, '|')),\n" +
|
||||||
|
" setup_depo AS (SELECT cod_mdep, value AS flag_carico_scarico_immediato\n" +
|
||||||
|
" FROM stb_gest_setup_depo\n" +
|
||||||
|
" WHERE gest_name = 'CARICO_SCARICO_PF'\n" +
|
||||||
|
" AND section = 'SETUP'\n" +
|
||||||
|
" AND key_section = 'GENERA_CARICO_SCARICO_IMMEDIATO'),\n" +
|
||||||
|
" mtb_colr_sum AS (SELECT mtb_colr.gestione,\n" +
|
||||||
|
" mtb_colr.data_collo,\n" +
|
||||||
|
" mtb_colr.num_collo,\n" +
|
||||||
|
" mtb_colr.cod_mart,\n" +
|
||||||
|
" mtb_colr.data_ord,\n" +
|
||||||
|
" mtb_colr.num_ord,\n" +
|
||||||
|
" SUM(mtb_colr.qta_col) AS qta_col,\n" +
|
||||||
|
" SUM(mtb_colr.num_cnf) AS num_cnf\n" +
|
||||||
|
" FROM mtb_colr\n" +
|
||||||
|
" WHERE mtb_colr.gestione_rif IS NULL\n" +
|
||||||
|
" AND mtb_colr.data_collo_rif IS NULL\n" +
|
||||||
|
" AND mtb_colr.ser_collo_rif IS NULL\n" +
|
||||||
|
" AND mtb_colr.num_collo_rif IS NULL\n" +
|
||||||
|
" AND EXISTS(SELECT *\n" +
|
||||||
|
" FROM mtb_colt\n" +
|
||||||
|
" WHERE mtb_colr.gestione = mtb_colt.gestione\n" +
|
||||||
|
" AND mtb_colr.data_collo = mtb_colt.data_collo\n" +
|
||||||
|
" AND mtb_colr.ser_collo = mtb_colt.ser_collo\n" +
|
||||||
|
" AND mtb_colr.num_collo = mtb_colt.num_collo\n" +
|
||||||
|
" AND mtb_colt.segno = 1)\n" +
|
||||||
|
" GROUP BY mtb_colr.gestione,\n" +
|
||||||
|
" mtb_colr.data_collo,\n" +
|
||||||
|
" mtb_colr.num_collo,\n" +
|
||||||
|
" mtb_colr.cod_mart,\n" +
|
||||||
|
" mtb_colr.data_ord,\n" +
|
||||||
|
" mtb_colr.num_ord),\n" +
|
||||||
|
" in_production_machines AS (SELECT DISTINCT dtb_ord_macc.gestione,\n" +
|
||||||
|
" dtb_ord_macc.data_ord,\n" +
|
||||||
|
" dtb_ord_macc.num_ord,\n" +
|
||||||
|
" MAX(dtb_ord_macc.data_mov) AS max_data_mov\n" +
|
||||||
|
" FROM dtb_ord_macc\n" +
|
||||||
|
" INNER JOIN (SELECT gestione, data_ord, num_ord, cod_cmac, MAX(data_mov) AS data_mov\n" +
|
||||||
|
" FROM dtb_ord_macc\n" +
|
||||||
|
" GROUP BY gestione, data_ord, num_ord, cod_cmac) last_event\n" +
|
||||||
|
" ON dtb_ord_macc.data_ord = last_event.data_ord AND\n" +
|
||||||
|
" dtb_ord_macc.num_ord = last_event.num_ord AND\n" +
|
||||||
|
" dtb_ord_macc.gestione = last_event.gestione AND\n" +
|
||||||
|
" dtb_ord_macc.cod_cmac = last_event.cod_cmac AND\n" +
|
||||||
|
" dtb_ord_macc.data_mov = last_event.data_mov\n" +
|
||||||
|
" INNER JOIN (SELECT evento, IIF(tipologia = 'ENTRATA', 1, -1) AS value\n" +
|
||||||
|
" FROM dtb_ord_macc_eventi) dtb_ord_macc_eventi\n" +
|
||||||
|
" ON dtb_ord_macc.evento = dtb_ord_macc_eventi.evento\n" +
|
||||||
|
" WHERE value = 1\n" +
|
||||||
|
" GROUP BY dtb_ord_macc.num_ord, dtb_ord_macc.data_ord, dtb_ord_macc.gestione),\n" +
|
||||||
|
" dtb_ord_max_step AS (SELECT gestione,\n" +
|
||||||
|
" data_ord,\n" +
|
||||||
|
" num_ord,\n" +
|
||||||
|
" MAX(id_step) AS max_step,\n" +
|
||||||
|
" num_fase,\n" +
|
||||||
|
" MAX(num_fase) OVER (PARTITION BY gestione,\n" +
|
||||||
|
" data_ord,\n" +
|
||||||
|
" num_ord) AS max_fase,\n" +
|
||||||
|
" dtb_ord_steps.cod_jfas,\n" +
|
||||||
|
" SUM(DATEDIFF(S, data_iniz, ISNULL(data_fine, GETDATE()))) AS elapsed_time\n" +
|
||||||
|
" FROM dtb_ord_steps\n" +
|
||||||
|
" CROSS APPLY setup\n" +
|
||||||
|
" WHERE data_ord BETWEEN setup.date_start AND setup.date_end\n" +
|
||||||
|
" GROUP BY gestione,\n" +
|
||||||
|
" data_ord,\n" +
|
||||||
|
" num_ord,\n" +
|
||||||
|
" num_fase,\n" +
|
||||||
|
" dtb_ord_steps.cod_jfas),\n" +
|
||||||
|
" dtb_ordr_prod_with_art AS (SELECT dtb_ordr.data_ord AS data_ord_prod,\n" +
|
||||||
|
" dtb_ordr.num_ord AS num_ord_prod,\n" +
|
||||||
|
" dtb_ordr.riga_ord AS riga_ord_prod,\n" +
|
||||||
|
" dtb_ordr.gestione AS gestione_ord_prod,\n" +
|
||||||
|
" IIF(CONVERT(DATE, dtb_ordr.data_ord) >= CONVERT(DATE, GETDATE()), 'S',\n" +
|
||||||
|
" 'N') AS flag_avviabile,\n" +
|
||||||
|
" mtb_aart_prod.flag_tracciabilita,\n" +
|
||||||
|
" dtb_ordr.unt_ord,\n" +
|
||||||
|
" dtb_ordr.rap_conv,\n" +
|
||||||
|
" dtb_ordr.unt_ord2,\n" +
|
||||||
|
" CAST(ROUND(dtb_ordr.qta_ord2 / ISNULL(NULLIF(dtb_ordr.qta_ord, 0), 1),\n" +
|
||||||
|
" 5) AS NUMERIC(20, 5)) AS rap_conv2,\n" +
|
||||||
|
" dtb_ordr.unt_ord3,\n" +
|
||||||
|
" CAST(ROUND(dtb_ordr.qta_ord3 / ISNULL(NULLIF(dtb_ordr.qta_ord, 0), 1),\n" +
|
||||||
|
" 5) AS NUMERIC(20, 5)) AS rap_conv3,\n" +
|
||||||
|
" dtb_ordr.qta_ord,\n" +
|
||||||
|
" dtb_ordr.qta_ord2,\n" +
|
||||||
|
" dtb_ordr.qta_ord3,\n" +
|
||||||
|
" dtb_ordr.num_cnf,\n" +
|
||||||
|
" IIF(mtb_aart_prod.unt_mis IN ('PZ', 'NR'), mtb_aart_prod.qta_cnf,\n" +
|
||||||
|
" IIF(mtb_aart_prod.unt_mis2 IN ('PZ', 'NR'), mtb_aart_prod.qta_cnf /\n" +
|
||||||
|
" ISNULL(NULLIF(mtb_aart_prod.rap_conv2, 0), 1),\n" +
|
||||||
|
" mtb_aart_prod.qta_cnf)) AS cal_qta_cnf,\n" +
|
||||||
|
"\n" +
|
||||||
|
" IIF(dtb_ordr.colli_pedana = 0 OR dtb_ordr.colli_pedana = 1,\n" +
|
||||||
|
" IIF(mtb_aart_prod.colli_pedana = 0, 1, mtb_aart_prod.colli_pedana),\n" +
|
||||||
|
" dtb_ordr.colli_pedana)\n" +
|
||||||
|
" AS colli_pedana,\n" +
|
||||||
|
" dtb_ordr.pos_riga,\n" +
|
||||||
|
" dtb_ordt.cod_mdep,\n" +
|
||||||
|
" IIF(mtb_aart_prod.unt_mis IN ('PZ', 'NR'), 1,\n" +
|
||||||
|
" IIF(mtb_aart_prod.unt_mis2 IN ('PZ', 'NR') AND\n" +
|
||||||
|
" NULLIF(mtb_aart_prod.rap_conv2, 0) IS NOT NULL,\n" +
|
||||||
|
" mtb_aart_prod.rap_conv2,\n" +
|
||||||
|
" 1)) AS calc_rap_conv,\n" +
|
||||||
|
" mtb_aart_prod.gg_scad_partita,\n" +
|
||||||
|
" mtb_aart_prod.qta_cnf\n" +
|
||||||
|
" FROM dtb_ordr\n" +
|
||||||
|
" INNER JOIN dtb_ordt ON dtb_ordr.gestione = dtb_ordt.gestione AND\n" +
|
||||||
|
" dtb_ordr.data_ord = dtb_ordt.data_ord AND\n" +
|
||||||
|
" dtb_ordr.num_ord = dtb_ordt.num_ord\n" +
|
||||||
|
" INNER JOIN mtb_aart mtb_aart_prod ON mtb_aart_prod.cod_mart = dtb_ordr.cod_mart),\n" +
|
||||||
|
" ord_lav AS (SELECT dtb_ordt.cod_jcom,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.data_ord_prod,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.num_ord_prod,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.riga_ord_prod,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.flag_avviabile,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.flag_tracciabilita,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.unt_ord,\n" +
|
||||||
|
" CASE\n" +
|
||||||
|
" WHEN mtb_partita_mag.partita_mag IS NULL THEN\n" +
|
||||||
|
" dtb_ordr_prod_with_art.rap_conv\n" +
|
||||||
|
" ELSE CASE\n" +
|
||||||
|
" WHEN dtb_ordr_prod_with_art.unt_ord = mtb_aart.unt_mis THEN\n" +
|
||||||
|
" dtb_ordr_prod_with_art.rap_conv\n" +
|
||||||
|
" WHEN dtb_ordr_prod_with_art.unt_ord = mtb_aart.unt_mis2 THEN\n" +
|
||||||
|
" IIF(mtb_partita_mag.rap_conv2 IS NULL OR mtb_partita_mag.rap_conv2 = 0,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.rap_conv2, mtb_partita_mag.rap_conv2)\n" +
|
||||||
|
" WHEN dtb_ordr_prod_with_art.unt_ord = mtb_aart.unt_mis3 THEN\n" +
|
||||||
|
" IIF(mtb_partita_mag.rap_conv3 IS NULL OR mtb_partita_mag.rap_conv3 = 0,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.rap_conv3, mtb_partita_mag.rap_conv3)\n" +
|
||||||
|
" END\n" +
|
||||||
|
" END\n" +
|
||||||
|
" AS rap_conv,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.unt_ord2,\n" +
|
||||||
|
" CASE\n" +
|
||||||
|
" WHEN mtb_partita_mag.partita_mag IS NULL THEN\n" +
|
||||||
|
" dtb_ordr_prod_with_art.rap_conv2\n" +
|
||||||
|
" ELSE CASE\n" +
|
||||||
|
" WHEN dtb_ordr_prod_with_art.unt_ord2 = mtb_aart.unt_mis THEN\n" +
|
||||||
|
" dtb_ordr_prod_with_art.rap_conv2\n" +
|
||||||
|
" WHEN dtb_ordr_prod_with_art.unt_ord2 = mtb_aart.unt_mis2 THEN\n" +
|
||||||
|
" IIF(mtb_partita_mag.rap_conv2 IS NULL OR mtb_partita_mag.rap_conv2 = 0,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.rap_conv2, mtb_partita_mag.rap_conv2)\n" +
|
||||||
|
" WHEN dtb_ordr_prod_with_art.unt_ord2 = mtb_aart.unt_mis3 THEN\n" +
|
||||||
|
" IIF(mtb_partita_mag.rap_conv3 IS NULL OR mtb_partita_mag.rap_conv3 = 0,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.rap_conv3, mtb_partita_mag.rap_conv3)\n" +
|
||||||
|
" END\n" +
|
||||||
|
" END\n" +
|
||||||
|
" AS rap_conv2,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.unt_ord3,\n" +
|
||||||
|
" CASE\n" +
|
||||||
|
" WHEN mtb_partita_mag.partita_mag IS NULL THEN\n" +
|
||||||
|
" dtb_ordr_prod_with_art.rap_conv3\n" +
|
||||||
|
" ELSE CASE\n" +
|
||||||
|
" WHEN dtb_ordr_prod_with_art.unt_ord3 = mtb_aart.unt_mis THEN\n" +
|
||||||
|
" dtb_ordr_prod_with_art.rap_conv3\n" +
|
||||||
|
" WHEN dtb_ordr_prod_with_art.unt_ord3 = mtb_aart.unt_mis2 THEN\n" +
|
||||||
|
" IIF(mtb_partita_mag.rap_conv2 IS NULL OR mtb_partita_mag.rap_conv2 = 0,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.rap_conv2, mtb_partita_mag.rap_conv2)\n" +
|
||||||
|
" WHEN dtb_ordr_prod_with_art.unt_ord3 = mtb_aart.unt_mis3 THEN\n" +
|
||||||
|
" IIF(mtb_partita_mag.rap_conv3 IS NULL OR mtb_partita_mag.rap_conv3 = 0,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.rap_conv3, mtb_partita_mag.rap_conv3)\n" +
|
||||||
|
" END\n" +
|
||||||
|
" END\n" +
|
||||||
|
" AS rap_conv3,\n" +
|
||||||
|
" ISNULL(dtb_ordt.descr_estesa_prod, dtb_ordt.descrizione_prod) AS descrizione_prod,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.num_cnf * dtb_ordr_prod_with_art.cal_qta_cnf AS num_pezzi,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.num_cnf,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.gg_scad_partita,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.qta_cnf,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.colli_pedana,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.num_cnf / dtb_ordr_prod_with_art.colli_pedana AS num_pedane,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.pos_riga,\n" +
|
||||||
|
" dtb_ordt.flag_evaso_prod,\n" +
|
||||||
|
" dtb_ordt.flag_evaso_forzato,\n" +
|
||||||
|
" CASE\n" +
|
||||||
|
" WHEN (dtb_ordt.flag_evaso_prod = 'I' OR\n" +
|
||||||
|
" (setupCaricoImmediato.flag_carico_scarico_immediato = 'S' AND\n" +
|
||||||
|
" flag_evaso_prod = 'E'))\n" +
|
||||||
|
" AND dtb_ordt.flag_evaso_forzato = 'N'\n" +
|
||||||
|
" THEN 'I'\n" +
|
||||||
|
" WHEN flag_evaso_prod <> 'I' AND dtb_ordt.flag_evaso_forzato = 'S'\n" +
|
||||||
|
" THEN flag_evaso_prod\n" +
|
||||||
|
" END AS flag_ordine_evaso,\n" +
|
||||||
|
" dtb_ordt.gestione,\n" +
|
||||||
|
" dtb_ordt.data_ord,\n" +
|
||||||
|
" dtb_ordt.cod_tcol_UL,\n" +
|
||||||
|
" mtb_tcol.descrizione AS descrizione_tcol,\n" +
|
||||||
|
" dtb_ordt.cod_anag,\n" +
|
||||||
|
" gtb_anag.rag_soc AS rag_soc_anag,\n" +
|
||||||
|
" gtb_anag.part_iva,\n" +
|
||||||
|
" dtb_ordt.rif_ord,\n" +
|
||||||
|
" dtb_ordt.cod_vdes,\n" +
|
||||||
|
" dtb_ordt.cod_mdep,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.cod_mdep AS cod_mdep_prod,\n" +
|
||||||
|
" dtb_ordt.num_ord,\n" +
|
||||||
|
" dtb_ord_steps.cod_jfas,\n" +
|
||||||
|
" dtb_ordt.cod_jfas AS cod_jfas_lav,\n" +
|
||||||
|
" mtb_partita_mag.partita_mag,\n" +
|
||||||
|
" dtb_ordt.note AS note_lav,\n" +
|
||||||
|
" mtb_partita_mag.data_scad,\n" +
|
||||||
|
" dtb_ordt.cod_prod,\n" +
|
||||||
|
" jtb_comt.descrizione AS descrizione_commessa,\n" +
|
||||||
|
" dtb_ordt.data_iniz_prod,\n" +
|
||||||
|
" q.max_step,\n" +
|
||||||
|
" q.max_fase,\n" +
|
||||||
|
" q.num_fase,\n" +
|
||||||
|
" IIF(mtb_aart.flag_qta_cnf_fissa = 'S' AND\n" +
|
||||||
|
" (mtb_aart.qta_cnf > 1 OR dtb_ordr_prod_with_art.colli_pedana > 1), 'Colli',\n" +
|
||||||
|
" jtb_cicl.unt_mis_prod)\n" +
|
||||||
|
" AS unt_mis_prod,\n" +
|
||||||
|
" IIF(mtb_aart.flag_qta_cnf_fissa = 'S' AND\n" +
|
||||||
|
" (mtb_aart.qta_cnf > 1 OR dtb_ordr_prod_with_art.colli_pedana > 1),\n" +
|
||||||
|
" dtb_ordr_prod_with_art.colli_pedana, jtb_cicl.qta_prod)\n" +
|
||||||
|
" AS qta_batch_prod,\n" +
|
||||||
|
" IIF(mtb_aart.qta_cnf > 1 OR dtb_ordr_prod_with_art.colli_pedana > 1, mtb_aart.qta_cnf,\n" +
|
||||||
|
" jtb_cicl.rap_conv_prod) AS rap_conv_prod,\n" +
|
||||||
|
" dtb_ord_steps.data_iniz,\n" +
|
||||||
|
" dtb_ord_steps.data_fine,\n" +
|
||||||
|
" dtb_ord_steps.qta_lav AS qta_lav,\n" +
|
||||||
|
" IIF(dtb_ord_steps.qta_prod <> 0, dtb_ord_steps.qta_prod,\n" +
|
||||||
|
" dtb_ordt.qta_prod) AS qta_prod,\n" +
|
||||||
|
" dtb_ord_steps.hr_num,\n" +
|
||||||
|
" dtb_ord_steps.descrizione_attivita,\n" +
|
||||||
|
" 3600 / (ISNULL(NULLIF(jtb_dist_clav_dir.duration, 0), 1) /\n" +
|
||||||
|
" ISNULL(NULLIF(jtb_cicl.rap_conv_prod, 0), 1)) AS prod_std,\n" +
|
||||||
|
" q.elapsed_time,\n" +
|
||||||
|
" SUM(ISNULL(mtb_colr.qta_col, 0)) AS qta_trasferite,\n" +
|
||||||
|
" COUNT(mtb_colr.num_collo) AS udc_trasferiti,\n" +
|
||||||
|
" CASE\n" +
|
||||||
|
" WHEN (in_production_machines.max_data_mov IS NOT NULL AND (q.max_step = 0 OR\n" +
|
||||||
|
" (q.max_step > 0 AND\n" +
|
||||||
|
" dtb_ord_steps.data_fine IS NOT NULL AND\n" +
|
||||||
|
" DATEDIFF(MINUTE,\n" +
|
||||||
|
" dtb_ord_steps.data_fine,\n" +
|
||||||
|
" in_production_machines.max_data_mov) >\n" +
|
||||||
|
" 5)))\n" +
|
||||||
|
" THEN 'IN AVVIO'\n" +
|
||||||
|
" WHEN q.max_step = 0\n" +
|
||||||
|
" THEN 'PROGRAMMATO'\n" +
|
||||||
|
" WHEN data_fine IS NULL\n" +
|
||||||
|
" THEN 'IN CORSO'\n" +
|
||||||
|
" ELSE 'IN PAUSA'\n" +
|
||||||
|
" END\n" +
|
||||||
|
" AS stato,\n" +
|
||||||
|
" CONVERT(INT, SUM(ISNULL(mtb_colr.qta_col / dtb_ordr_prod_with_art.calc_rap_conv, 0))) AS pz_trasferiti,\n" +
|
||||||
|
" CASE\n" +
|
||||||
|
" WHEN (jtb_dist_clav_dir.duration / ISNULL(NULLIF(jtb_cicl.rap_conv_prod, 0), 1)) *\n" +
|
||||||
|
" (dtb_ordt.qta_prod * dtb_ordt.rap_conv_prod -\n" +
|
||||||
|
" SUM(ISNULL(mtb_colr.qta_col, 0))) > 0\n" +
|
||||||
|
" THEN\n" +
|
||||||
|
" (jtb_dist_clav_dir.duration /\n" +
|
||||||
|
" ISNULL(NULLIF(jtb_cicl.rap_conv_prod, 0), 1)) *\n" +
|
||||||
|
" (dtb_ordt.qta_prod * dtb_ordt.rap_conv_prod -\n" +
|
||||||
|
" SUM(ISNULL(mtb_colr.qta_col, 0)))\n" +
|
||||||
|
" ELSE 0 END AS run_time_sec,\n" +
|
||||||
|
" jl.id_lotto,\n" +
|
||||||
|
" jlt.data_lotto,\n" +
|
||||||
|
" mtb_aart.peso_kg,\n" +
|
||||||
|
" dtb_ordt.data_cons_prod_max\n" +
|
||||||
|
" FROM dtb_ord_steps\n" +
|
||||||
|
" INNER JOIN dtb_ordt ON dtb_ord_steps.data_ord = dtb_ordt.data_ord\n" +
|
||||||
|
" AND dtb_ord_steps.num_ord = dtb_ordt.num_ord\n" +
|
||||||
|
" AND dtb_ord_steps.gestione = dtb_ordt.gestione\n" +
|
||||||
|
" LEFT OUTER JOIN setup_depo setupCaricoImmediato\n" +
|
||||||
|
" ON dtb_ordt.cod_mdep = setupCaricoImmediato.cod_mdep\n" +
|
||||||
|
" LEFT OUTER JOIN jtb_dist_clav_dir\n" +
|
||||||
|
" ON dtb_ordt.cod_prod = jtb_dist_clav_dir.cod_prod AND\n" +
|
||||||
|
" dtb_ordt.cod_jfas = jtb_dist_clav_dir.cod_jfas\n" +
|
||||||
|
" LEFT OUTER JOIN mtb_partita_mag\n" +
|
||||||
|
" ON dtb_ordt.partita_mag = mtb_partita_mag.partita_mag AND\n" +
|
||||||
|
" dtb_ordt.cod_prod = mtb_partita_mag.cod_mart AND\n" +
|
||||||
|
" mtb_partita_mag.flag_stato = 'A'\n" +
|
||||||
|
" LEFT OUTER JOIN mtb_colr_sum mtb_colr ON dtb_ordt.data_ord = mtb_colr.data_ord AND\n" +
|
||||||
|
" dtb_ordt.gestione = mtb_colr.gestione AND\n" +
|
||||||
|
" dtb_ordt.num_ord = mtb_colr.num_ord AND\n" +
|
||||||
|
" dtb_ordt.cod_prod = mtb_colr.cod_mart\n" +
|
||||||
|
" LEFT OUTER JOIN jtb_comt ON dtb_ordt.cod_jcom = jtb_comt.cod_jcom\n" +
|
||||||
|
" INNER JOIN dtb_ord_max_step q ON dtb_ord_steps.gestione = q.gestione AND\n" +
|
||||||
|
" dtb_ord_steps.data_ord = q.data_ord AND\n" +
|
||||||
|
" dtb_ord_steps.num_ord = q.num_ord AND\n" +
|
||||||
|
" dtb_ord_steps.id_step = q.max_step AND\n" +
|
||||||
|
" dtb_ord_steps.cod_jfas = q.cod_jfas\n" +
|
||||||
|
" LEFT OUTER JOIN dtb_ordr_prod_with_art\n" +
|
||||||
|
" ON dtb_ordr_prod_with_art.gestione_ord_prod =\n" +
|
||||||
|
" dtb_ordt.gestione_rif AND\n" +
|
||||||
|
" dtb_ordr_prod_with_art.data_ord_prod = dtb_ordt.data_ord_rif AND\n" +
|
||||||
|
" dtb_ordr_prod_with_art.num_ord_prod = dtb_ordt.num_ord_rif AND\n" +
|
||||||
|
" dtb_ordr_prod_with_art.riga_ord_prod = dtb_ordt.riga_ord_rif\n" +
|
||||||
|
" LEFT OUTER JOIN jtb_cicl ON jtb_cicl.cod_prod = dtb_ordt.cod_prod\n" +
|
||||||
|
" LEFT OUTER JOIN mtb_aart ON mtb_aart.cod_mart = dtb_ordt.cod_prod\n" +
|
||||||
|
" LEFT OUTER JOIN gtb_anag ON dtb_ordt.cod_anag = gtb_anag.cod_anag\n" +
|
||||||
|
" LEFT OUTER JOIN mtb_tcol ON dtb_ordt.cod_tcol_UL = mtb_tcol.cod_tcol\n" +
|
||||||
|
" LEFT OUTER JOIN in_production_machines\n" +
|
||||||
|
" ON dtb_ord_steps.data_ord = in_production_machines.data_ord\n" +
|
||||||
|
" AND dtb_ord_steps.num_ord = in_production_machines.num_ord\n" +
|
||||||
|
" AND dtb_ord_steps.gestione = in_production_machines.gestione\n" +
|
||||||
|
" LEFT OUTER JOIN jtb_lotr jl\n" +
|
||||||
|
" ON dtb_ord_steps.cod_jfas = jl.cod_jfas AND\n" +
|
||||||
|
" dtb_ordt.gestione = jl.gestione AND\n" +
|
||||||
|
" dtb_ordt.data_ord = jl.data_ord AND\n" +
|
||||||
|
" dtb_ordt.num_ord = jl.num_ord\n" +
|
||||||
|
" LEFT OUTER JOIN jtb_lott jlt\n" +
|
||||||
|
" ON jl.cod_jfas = jlt.cod_jfas AND jl.id_lotto = jlt.id_lotto\n" +
|
||||||
|
"\n" +
|
||||||
|
" CROSS APPLY setup\n" +
|
||||||
|
" WHERE dtb_ordt.flag_annulla = 'N'\n" +
|
||||||
|
" AND (setup.flag_evaso IS NULL\n" +
|
||||||
|
" OR (\n" +
|
||||||
|
" (setup.flag_evaso = 'I'\n" +
|
||||||
|
" AND\n" +
|
||||||
|
" dtb_ord_steps.flag_step_attivo = 'S'\n" +
|
||||||
|
" AND (flag_evaso_prod = 'I'\n" +
|
||||||
|
" OR\n" +
|
||||||
|
" (setupCaricoImmediato.flag_carico_scarico_immediato = 'S'\n" +
|
||||||
|
" AND\n" +
|
||||||
|
" flag_evaso_prod = 'E'))\n" +
|
||||||
|
" AND dtb_ordt.flag_evaso_forzato = 'N'\n" +
|
||||||
|
" )\n" +
|
||||||
|
" OR (setup.flag_evaso = 'E'\n" +
|
||||||
|
" AND (flag_evaso_prod = 'E' OR jlt.data_chiusura IS NOT NULL))\n" +
|
||||||
|
" )\n" +
|
||||||
|
" )\n" +
|
||||||
|
" AND (setup.cod_jfas IS NULL\n" +
|
||||||
|
" OR dtb_ord_steps.cod_jfas IN (SELECT cod_jfas FROM setup_jfas))\n" +
|
||||||
|
" AND (setup.cod_anag IS NULL\n" +
|
||||||
|
" OR dtb_ordt.cod_anag = setup.cod_anag)\n" +
|
||||||
|
" GROUP BY dtb_ordr_prod_with_art.data_ord_prod,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.num_ord_prod,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.riga_ord_prod,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.flag_avviabile,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.flag_tracciabilita,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.unt_ord,\n" +
|
||||||
|
" mtb_partita_mag.rap_conv2,\n" +
|
||||||
|
" mtb_partita_mag.rap_conv3,\n" +
|
||||||
|
" dtb_ordt.note,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.rap_conv,\n" +
|
||||||
|
" dtb_ordt.descrizione_prod,\n" +
|
||||||
|
" dtb_ordt.descr_estesa_prod,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.num_cnf,\n" +
|
||||||
|
" mtb_aart.qta_cnf,\n" +
|
||||||
|
" mtb_aart.gg_scad_partita,\n" +
|
||||||
|
" mtb_aart.flag_qta_cnf_fissa,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.pos_riga,\n" +
|
||||||
|
" dtb_ordt.flag_evaso_prod,\n" +
|
||||||
|
" dtb_ordt.flag_evaso_forzato,\n" +
|
||||||
|
" dtb_ordt.gestione,\n" +
|
||||||
|
" dtb_ordt.data_ord,\n" +
|
||||||
|
" dtb_ordt.num_ord,\n" +
|
||||||
|
" dtb_ord_steps.cod_jfas,\n" +
|
||||||
|
" dtb_ordt.cod_jfas,\n" +
|
||||||
|
" dtb_ordt.cod_jcom,\n" +
|
||||||
|
" mtb_partita_mag.partita_mag,\n" +
|
||||||
|
" mtb_partita_mag.data_scad,\n" +
|
||||||
|
" dtb_ordt.cod_prod,\n" +
|
||||||
|
" dtb_ordt.data_iniz_prod,\n" +
|
||||||
|
" q.max_step,\n" +
|
||||||
|
" dtb_ord_steps.data_iniz,\n" +
|
||||||
|
" dtb_ord_steps.data_fine,\n" +
|
||||||
|
" dtb_ordt.cod_tcol_UL,\n" +
|
||||||
|
" dtb_ordt.cod_anag,\n" +
|
||||||
|
" gtb_anag.rag_soc,\n" +
|
||||||
|
" gtb_anag.part_iva,\n" +
|
||||||
|
" dtb_ordt.rif_ord,\n" +
|
||||||
|
" dtb_ordt.cod_vdes,\n" +
|
||||||
|
" dtb_ordt.cod_mdep,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.cod_mdep,\n" +
|
||||||
|
" mtb_aart.colli_pedana,\n" +
|
||||||
|
" dtb_ord_steps.qta_prod,\n" +
|
||||||
|
" dtb_ordt.qta_prod,\n" +
|
||||||
|
" jtb_dist_clav_dir.duration,\n" +
|
||||||
|
" jtb_comt.descrizione,\n" +
|
||||||
|
" q.elapsed_time,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.colli_pedana,\n" +
|
||||||
|
" dtb_ord_steps.hr_num,\n" +
|
||||||
|
" mtb_aart.unt_mis,\n" +
|
||||||
|
" mtb_aart.unt_mis2,\n" +
|
||||||
|
" mtb_aart.rap_conv2,\n" +
|
||||||
|
" mtb_aart.unt_mis3,\n" +
|
||||||
|
" mtb_aart.rap_conv3,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.unt_ord2,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.unt_ord3,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.qta_ord,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.qta_ord2,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.qta_ord3,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.rap_conv2,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.rap_conv3,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.qta_cnf,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.cal_qta_cnf,\n" +
|
||||||
|
" dtb_ordr_prod_with_art.gg_scad_partita,\n" +
|
||||||
|
" jtb_cicl.qta_prod,\n" +
|
||||||
|
" jtb_cicl.rap_conv_prod,\n" +
|
||||||
|
" dtb_ord_steps.descrizione_attivita,\n" +
|
||||||
|
" jtb_cicl.unt_mis_prod,\n" +
|
||||||
|
" mtb_tcol.descrizione,\n" +
|
||||||
|
" dtb_ordt.qta_prod,\n" +
|
||||||
|
" dtb_ordt.rap_conv_prod,\n" +
|
||||||
|
" setupCaricoImmediato.flag_carico_scarico_immediato,\n" +
|
||||||
|
" in_production_machines.max_data_mov, q.num_fase, dtb_ord_steps.qta_lav, q.max_fase,\n" +
|
||||||
|
" jl.id_lotto, jlt.data_lotto, mtb_aart.peso_kg, dtb_ordt.data_cons_prod_max)\n" +
|
||||||
|
" INSERT\n" +
|
||||||
|
" INTO @val\n" +
|
||||||
|
" SELECT ROW_NUMBER() OVER (ORDER BY data_ord, num_ord_prod, pos_riga, num_ord) AS sort,\n" +
|
||||||
|
" cod_jcom,\n" +
|
||||||
|
" data_ord_prod,\n" +
|
||||||
|
" num_ord_prod,\n" +
|
||||||
|
" riga_ord_prod,\n" +
|
||||||
|
" flag_avviabile,\n" +
|
||||||
|
" flag_tracciabilita,\n" +
|
||||||
|
" unt_ord,\n" +
|
||||||
|
" rap_conv,\n" +
|
||||||
|
" unt_ord2,\n" +
|
||||||
|
" rap_conv2,\n" +
|
||||||
|
" unt_ord3,\n" +
|
||||||
|
" rap_conv3,\n" +
|
||||||
|
" descrizione_prod,\n" +
|
||||||
|
" num_pezzi,\n" +
|
||||||
|
" num_cnf,\n" +
|
||||||
|
" gg_scad_partita,\n" +
|
||||||
|
" qta_cnf,\n" +
|
||||||
|
" colli_pedana,\n" +
|
||||||
|
" num_pedane,\n" +
|
||||||
|
" pos_riga,\n" +
|
||||||
|
" flag_evaso_prod,\n" +
|
||||||
|
" flag_evaso_forzato,\n" +
|
||||||
|
" flag_ordine_evaso,\n" +
|
||||||
|
" gestione,\n" +
|
||||||
|
" data_ord,\n" +
|
||||||
|
" cod_tcol_UL,\n" +
|
||||||
|
" descrizione_tcol,\n" +
|
||||||
|
" cod_anag,\n" +
|
||||||
|
" rag_soc_anag,\n" +
|
||||||
|
" part_iva,\n" +
|
||||||
|
" rif_ord,\n" +
|
||||||
|
" cod_vdes,\n" +
|
||||||
|
" cod_mdep,\n" +
|
||||||
|
" cod_mdep_prod,\n" +
|
||||||
|
" num_ord,\n" +
|
||||||
|
" cod_jfas,\n" +
|
||||||
|
" cod_jfas_lav,\n" +
|
||||||
|
" partita_mag,\n" +
|
||||||
|
" note_lav,\n" +
|
||||||
|
" data_scad,\n" +
|
||||||
|
" cod_prod,\n" +
|
||||||
|
" descrizione_commessa,\n" +
|
||||||
|
" data_iniz_prod,\n" +
|
||||||
|
" max_step,\n" +
|
||||||
|
" unt_mis_prod,\n" +
|
||||||
|
" qta_batch_prod,\n" +
|
||||||
|
" rap_conv_prod,\n" +
|
||||||
|
" data_iniz,\n" +
|
||||||
|
" data_fine,\n" +
|
||||||
|
" qta_prod,\n" +
|
||||||
|
" qta_lav,\n" +
|
||||||
|
" max_fase,\n" +
|
||||||
|
" num_fase,\n" +
|
||||||
|
" hr_num,\n" +
|
||||||
|
" descrizione_attivita,\n" +
|
||||||
|
" prod_std,\n" +
|
||||||
|
" elapsed_time,\n" +
|
||||||
|
" qta_trasferite,\n" +
|
||||||
|
" udc_trasferiti,\n" +
|
||||||
|
" stato,\n" +
|
||||||
|
" pz_trasferiti,\n" +
|
||||||
|
" run_time_sec,\n" +
|
||||||
|
" SUM(run_time_sec) OVER (PARTITION BY cod_jfas, data_ord_prod) AS cumulative_run_time_sec,\n" +
|
||||||
|
" CONVERT(INT, run_time_sec / 3600) AS run_time_hour,\n" +
|
||||||
|
" ROUND((run_time_sec / 3600 - CONVERT(INT, run_time_sec / 3600)) * 60, 0) AS run_time_min,\n" +
|
||||||
|
" DATEADD(SECOND, SUM(run_time_sec)\n" +
|
||||||
|
" OVER (PARTITION BY cod_jfas, data_ord_prod ORDER BY stato, cod_jfas, data_ord_prod, pos_riga ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW),\n" +
|
||||||
|
" CASE\n" +
|
||||||
|
" WHEN data_ord_prod > GETDATE() THEN DATEADD(HH, 7, data_ord_prod)\n" +
|
||||||
|
" ELSE GETDATE() END) AS run_time_end,\n" +
|
||||||
|
" id_lotto,\n" +
|
||||||
|
" data_lotto,\n" +
|
||||||
|
" peso_kg,\n" +
|
||||||
|
" data_cons_prod_max\n" +
|
||||||
|
" FROM ord_lav\n" +
|
||||||
|
" ORDER BY ord_lav.data_ord,\n" +
|
||||||
|
" ord_lav.num_ord_prod,\n" +
|
||||||
|
" ord_lav.pos_riga,\n" +
|
||||||
|
" ord_lav.num_ord\n" +
|
||||||
|
" RETURN\n" +
|
||||||
|
"END");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package it.integry.ems.migration.model;
|
||||||
|
|
||||||
|
import it.integry.ems.migration._base.BaseMigration;
|
||||||
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
|
|
||||||
|
public class Migration_20241010130131 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
executeStatement("UPDATE stb_gest_setup SET key_section = 'TIPI_DOCUMENTO' WHERE gest_name = 'IMPORT_DOCUMENTI' AND section = 'PAZIENZA_RIFORD' AND key_section = 'TIPO_DOCUMENTO' ");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -13,6 +13,7 @@ import java.math.BigDecimal;
|
|||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -111,8 +112,8 @@ public class OrderRules extends QueryRules {
|
|||||||
return dataCons;
|
return dataCons;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Date completeDataInizProdOrdP(Connection conn, DtbOrdr dtbOrdr) {
|
public static LocalDate completeDataInizProdOrdP(Connection conn, DtbOrdr dtbOrdr) {
|
||||||
return dtbOrdr.getDataOrd();
|
return UtilityLocalDate.localDateFromDate(dtbOrdr.getDataOrd());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String completeCausaleTrasp(String gestione) {
|
public static String completeCausaleTrasp(String gestione) {
|
||||||
|
|||||||
@@ -1,28 +1,33 @@
|
|||||||
package it.integry.ems.service;
|
package it.integry.ems.service;
|
||||||
|
|
||||||
import it.integry.ems.service.dto.AziendaInternalCodAnagDTO;
|
|
||||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
import it.integry.ems_model.utility.UtilityDB;
|
import it.integry.ems_model.utility.UtilityDB;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@Scope("request")
|
||||||
public class AziendaService {
|
public class AziendaService {
|
||||||
|
|
||||||
@Nullable
|
@Autowired
|
||||||
public List<AziendaInternalCodAnagDTO> retrieveInternalCodAnags(Connection connection) throws Exception {
|
private MultiDBTransactionManager multiDBTransactionManager;
|
||||||
String sql = "SELECT ga.cod_anag,\n" +
|
|
||||||
" CAST(CASE WHEN vc.cod_anag IS NOT NULL THEN 1 ELSE 0 END AS BIT) AS is_cliente,\n" +
|
|
||||||
" CAST(CASE WHEN af.cod_anag IS NOT NULL THEN 1 ELSE 0 END AS BIT) AS is_fornitore\n" +
|
|
||||||
"FROM azienda\n" +
|
|
||||||
"INNER JOIN gtb_anag ga on azienda.part_iva = ga.part_iva\n" +
|
|
||||||
"LEFT OUTER JOIN vtb_clie vc on ga.cod_anag = vc.cod_anag AND vc.flag_stato = 'A'\n" +
|
|
||||||
"LEFT OUTER JOIN atb_forn af on ga.cod_anag = af.cod_anag AND af.flag_stato = 'A'";
|
|
||||||
|
|
||||||
return UtilityDB.executeSimpleQueryDTO(connection, sql, AziendaInternalCodAnagDTO.class);
|
public String retrieveInternalCodAnagFornitore() throws Exception {
|
||||||
|
String internalCodAnagsQuery = "SELECT CAST(ga.cod_anag AS VARCHAR(5)) AS cod_anag\n" +
|
||||||
|
"FROM azienda\n" +
|
||||||
|
" INNER JOIN gtb_anag ga ON azienda.part_iva = ga.part_iva\n" +
|
||||||
|
" INNER JOIN atb_forn af ON ga.cod_anag = af.cod_anag AND af.flag_stato = 'A'";
|
||||||
|
|
||||||
|
return UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), internalCodAnagsQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String retrieveInternalCodAnagCliente() throws Exception {
|
||||||
|
String internalCodAnagsQuery = "SELECT CAST(ga.cod_anag AS VARCHAR(5)) AS cod_anag\n" +
|
||||||
|
"FROM azienda\n" +
|
||||||
|
" INNER JOIN gtb_anag ga ON azienda.part_iva = ga.part_iva\n" +
|
||||||
|
" INNER JOIN vtb_clie vc ON ga.cod_anag = vc.cod_anag AND vc.flag_stato = 'A'";
|
||||||
|
|
||||||
|
return UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), internalCodAnagsQuery);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
package it.integry.ems.service.dto;
|
|
||||||
|
|
||||||
public class AziendaInternalCodAnagDTO {
|
|
||||||
|
|
||||||
private String codAnag;
|
|
||||||
private boolean isCliente;
|
|
||||||
private boolean isFornitore;
|
|
||||||
|
|
||||||
public String getCodAnag() {
|
|
||||||
return codAnag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AziendaInternalCodAnagDTO setCodAnag(String codAnag) {
|
|
||||||
this.codAnag = codAnag;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isCliente() {
|
|
||||||
return isCliente;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AziendaInternalCodAnagDTO setCliente(boolean cliente) {
|
|
||||||
isCliente = cliente;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isFornitore() {
|
|
||||||
return isFornitore;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AziendaInternalCodAnagDTO setFornitore(boolean fornitore) {
|
|
||||||
isFornitore = fornitore;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -7,27 +7,30 @@ import it.integry.ems.rules.completing.DocOrdRules;
|
|||||||
import it.integry.ems.rules.completing.OrderRules;
|
import it.integry.ems.rules.completing.OrderRules;
|
||||||
import it.integry.ems.rules.completing.dto.DatiPartitaMagDTO;
|
import it.integry.ems.rules.completing.dto.DatiPartitaMagDTO;
|
||||||
import it.integry.ems_model.base.EntityBase;
|
import it.integry.ems_model.base.EntityBase;
|
||||||
import it.integry.ems_model.business_logic.dto.*;
|
import it.integry.ems_model.business_logic.dto.ActivityCicloProdDTO;
|
||||||
|
import it.integry.ems_model.business_logic.dto.CommessaDTO;
|
||||||
|
import it.integry.ems_model.business_logic.dto.ExplodeDistDTO;
|
||||||
|
import it.integry.ems_model.business_logic.dto.OrdProdSetupDTO;
|
||||||
import it.integry.ems_model.config.EmsRestConstants;
|
import it.integry.ems_model.config.EmsRestConstants;
|
||||||
import it.integry.ems_model.db.ResultSetMapper;
|
import it.integry.ems_model.db.ResultSetMapper;
|
||||||
import it.integry.ems_model.entity.*;
|
import it.integry.ems_model.entity.*;
|
||||||
import it.integry.ems_model.exception.DataConverterNotFoundException;
|
import it.integry.ems_model.exception.DataConverterNotFoundException;
|
||||||
import it.integry.ems_model.service.SetupGest;
|
import it.integry.ems_model.service.SetupGest;
|
||||||
import it.integry.ems_model.types.OperationType;
|
import it.integry.ems_model.types.OperationType;
|
||||||
import it.integry.ems_model.utility.Query;
|
import it.integry.ems_model.utility.*;
|
||||||
import it.integry.ems_model.utility.UtilityDB;
|
|
||||||
import it.integry.ems_model.utility.UtilityHashMap;
|
|
||||||
import it.integry.ems_model.utility.UtilityString;
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.sql.*;
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.time.LocalDate;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
@@ -189,7 +192,7 @@ public class GeneraOrdLav {
|
|||||||
BigDecimal qtaProdDist = BigDecimal.ONE;
|
BigDecimal qtaProdDist = BigDecimal.ONE;
|
||||||
HashMap<String, Object> datiDistinta = getDatiDistinta(conn, codProd);
|
HashMap<String, Object> datiDistinta = getDatiDistinta(conn, codProd);
|
||||||
datiDistinta.put("cod_prod", codProd);
|
datiDistinta.put("cod_prod", codProd);
|
||||||
if (!UtilityString.equalsIgnoreCase(UtilityHashMap.getValueIfExists(datiDistinta, "cod_jfas"), codJfas )){
|
if (!UtilityString.equalsIgnoreCase(UtilityHashMap.getValueIfExists(datiDistinta, "cod_jfas"), codJfas ) && !UtilityString.streNull(codJfas).isEmpty()){
|
||||||
datiDistinta.remove(datiDistinta.get("cod_jfas"));
|
datiDistinta.remove(datiDistinta.get("cod_jfas"));
|
||||||
datiDistinta.put("cod_jfas", codJfas);
|
datiDistinta.put("cod_jfas", codJfas);
|
||||||
}
|
}
|
||||||
@@ -238,7 +241,7 @@ public class GeneraOrdLav {
|
|||||||
// Generazione automatica nuova commessa
|
// Generazione automatica nuova commessa
|
||||||
if (genAutoCommOrdProd && UtilityString.isNullOrEmpty(codJcom)) {
|
if (genAutoCommOrdProd && UtilityString.isNullOrEmpty(codJcom)) {
|
||||||
assegnaCodJcom(conn, ordProdSetupDTO, dtbOrdt.getTipoAnag(), codAnag,
|
assegnaCodJcom(conn, ordProdSetupDTO, dtbOrdt.getTipoAnag(), codAnag,
|
||||||
gestioneLav, dataOrd, numOrdLav, dataCons, row.getDataInizProd(),
|
gestioneLav, dataOrd, numOrdLav, dataCons, UtilityLocalDate.localDateToDate(row.getDataInizProd()),
|
||||||
desCom, row);
|
desCom, row);
|
||||||
codJcom = row.getCodJcom();
|
codJcom = row.getCodJcom();
|
||||||
|
|
||||||
@@ -356,6 +359,7 @@ public class GeneraOrdLav {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
riproporzionaQtaOrd(conn, gestione, dataOrd, numOrd, rigaOrd, qtaProd, rapConv, ordT);
|
riproporzionaQtaOrd(conn, gestione, dataOrd, numOrd, rigaOrd, qtaProd, rapConv, ordT);
|
||||||
|
aggornaDataInizProd(conn, gestione, dataOrd, numOrd, rigaOrd, ordT, row, assegnaAttivita);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1378,6 +1382,80 @@ public class GeneraOrdLav {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void aggornaDataInizProd(Connection conn, String gestione, Date dataOrd, Integer numOrd, Integer rigaOrd,DtbOrdt ordT, DtbOrdr row, boolean assegnaAttivita) throws SQLException, IllegalAccessException, DataConverterNotFoundException, InstantiationException {
|
||||||
|
String sql;
|
||||||
|
sql =
|
||||||
|
Query.format(
|
||||||
|
"SELECT data_iniz_prod, activity_id " +
|
||||||
|
" FROM dtb_ordt " +
|
||||||
|
" WHERE dtb_ordt.gestione_rif = %s AND " +
|
||||||
|
" dtb_ordt.data_ord_rif = %s AND " +
|
||||||
|
" dtb_ordt.num_ord_rif = %s AND " +
|
||||||
|
" dtb_ordt.riga_ord_rif = %s",
|
||||||
|
gestione,
|
||||||
|
dataOrd,
|
||||||
|
numOrd,
|
||||||
|
rigaOrd);
|
||||||
|
|
||||||
|
HashMap<String, Object> datiOrdL = UtilityDB.executeSimpleQueryOnlyFirstRow(conn, sql);
|
||||||
|
|
||||||
|
LocalDate dataInizProdOld = null;
|
||||||
|
LocalDate dataInizNew = null;
|
||||||
|
String activityID = null;
|
||||||
|
if (datiOrdL != null && datiOrdL.size() > 0) {
|
||||||
|
dataInizProdOld = UtilityLocalDate.localDateFromDate((Date) datiOrdL.get("data_iniz_prod"));
|
||||||
|
dataInizNew = ordT.getDataInizProd();
|
||||||
|
activityID = (String) datiOrdL.get("activity_id");
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer ggDiff = Math.toIntExact(UtilityLocalDate.daysAfterDate(dataInizProdOld, dataInizNew ));
|
||||||
|
if (ggDiff != 0){
|
||||||
|
sql = "SELECT * FROM dtb_ordr";
|
||||||
|
sql = UtilityDB.addwhereCond(sql, ordT.getPkWhereCond(), true);
|
||||||
|
List<DtbOrdr> dtbOrdrL = UtilityDB.executeSimpleQueryDTO(conn, sql, DtbOrdr.class);
|
||||||
|
|
||||||
|
if (dtbOrdrL != null && !dtbOrdrL.isEmpty()){
|
||||||
|
dtbOrdrL.stream().forEach(x -> {
|
||||||
|
x.setDataCons(UtilityDate.dateAdd(x.getDataCons(), ggDiff));
|
||||||
|
x.setOperation(OperationType.UPDATE);
|
||||||
|
});
|
||||||
|
|
||||||
|
ordT.setDtbOrdr(dtbOrdrL);
|
||||||
|
}
|
||||||
|
|
||||||
|
sql = "SELECT * FROM dtb_ord_steps";
|
||||||
|
sql = UtilityDB.addwhereCond(sql, ordT.getPkWhereCond(), true);
|
||||||
|
List<DtbOrdSteps> dtbOrdSteps = UtilityDB.executeSimpleQueryDTO(conn, sql, DtbOrdSteps.class);
|
||||||
|
|
||||||
|
dtbOrdSteps.stream().forEach(x -> {
|
||||||
|
x.setDataIniz(UtilityDate.dateAdd(x.getDataIniz(), ggDiff));
|
||||||
|
x.setDataFine(UtilityDate.dateAdd(x.getDataFine(), ggDiff));
|
||||||
|
x.setOperation(OperationType.UPDATE);
|
||||||
|
});
|
||||||
|
|
||||||
|
ordT.setDtbOrdSteps(dtbOrdSteps);
|
||||||
|
|
||||||
|
// FABIO: DA CAPIRE COME VALORIZZATA LE ATTIVITA MODIFICATE
|
||||||
|
if (assegnaAttivita){
|
||||||
|
sql = "SELECT stb_activity.* " +
|
||||||
|
" FROM stb_activity " +
|
||||||
|
" where (activity_id = " + UtilityDB.valueToString(activityID) + " or " +
|
||||||
|
" parent_activity_id = " + UtilityDB.valueToString(activityID) + ")";
|
||||||
|
List<StbActivity> stbActivity = UtilityDB.executeSimpleQueryDTO(conn, sql, StbActivity.class);
|
||||||
|
|
||||||
|
stbActivity.stream().forEach(x -> {
|
||||||
|
x.setEstimatedDate(UtilityDate.dateAdd(x.getEstimatedDate(), ggDiff));
|
||||||
|
x.setEstimatedEnddate(UtilityDate.dateAdd(x.getEstimatedEnddate(), ggDiff));
|
||||||
|
x.setEstimatedTime(UtilityDate.dateAdd(x.getEstimatedTime(), ggDiff));
|
||||||
|
x.setEstimatedEndtime(UtilityDate.dateAdd(x.getEstimatedEndtime(), ggDiff));
|
||||||
|
x.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||||
|
});
|
||||||
|
|
||||||
|
row.setStbActivityList(stbActivity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void riproporzionaQtaOrd(Connection conn, String gestione, Date dataOrd, Integer numOrd, Integer rigaOrd, BigDecimal qtaProd, BigDecimal rapConv, DtbOrdt ordT) throws SQLException, IllegalAccessException, DataConverterNotFoundException, InstantiationException {
|
private static void riproporzionaQtaOrd(Connection conn, String gestione, Date dataOrd, Integer numOrd, Integer rigaOrd, BigDecimal qtaProd, BigDecimal rapConv, DtbOrdt ordT) throws SQLException, IllegalAccessException, DataConverterNotFoundException, InstantiationException {
|
||||||
String sql;
|
String sql;
|
||||||
sql =
|
sql =
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
package it.integry.ems_model.business_logic;
|
package it.integry.ems_model.business_logic;
|
||||||
|
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import it.integry.common.var.CommonConstants;
|
import it.integry.common.var.CommonConstants;
|
||||||
import it.integry.ems.json.ResponseJSONObjectMapper;
|
|
||||||
import it.integry.ems.rules.completing.ConfigActivityRules;
|
import it.integry.ems.rules.completing.ConfigActivityRules;
|
||||||
import it.integry.ems.rules.completing.DocOrdRules;
|
import it.integry.ems.rules.completing.DocOrdRules;
|
||||||
import it.integry.ems.rules.completing.OrderRules;
|
import it.integry.ems.rules.completing.OrderRules;
|
||||||
import it.integry.ems.rules.completing.QueryRules;
|
import it.integry.ems.rules.completing.QueryRules;
|
||||||
import it.integry.ems.rules.completing.dto.DatiPartitaMagDTO;
|
import it.integry.ems.rules.completing.dto.DatiPartitaMagDTO;
|
||||||
import it.integry.ems.utility.UtilityDebug;
|
|
||||||
import it.integry.ems_model.base.EntityBase;
|
import it.integry.ems_model.base.EntityBase;
|
||||||
import it.integry.ems_model.business_logic.dto.ActivityCicloProdDTO;
|
import it.integry.ems_model.business_logic.dto.ActivityCicloProdDTO;
|
||||||
import it.integry.ems_model.business_logic.dto.CommessaDTO;
|
import it.integry.ems_model.business_logic.dto.CommessaDTO;
|
||||||
@@ -21,19 +18,15 @@ import it.integry.ems_model.entity.*;
|
|||||||
import it.integry.ems_model.rules.util.DroolsUtil;
|
import it.integry.ems_model.rules.util.DroolsUtil;
|
||||||
import it.integry.ems_model.service.SetupGest;
|
import it.integry.ems_model.service.SetupGest;
|
||||||
import it.integry.ems_model.types.OperationType;
|
import it.integry.ems_model.types.OperationType;
|
||||||
import it.integry.ems_model.utility.Query;
|
import it.integry.ems_model.utility.*;
|
||||||
import it.integry.ems_model.utility.UtilityDB;
|
|
||||||
import it.integry.ems_model.utility.UtilityHashMap;
|
|
||||||
import it.integry.ems_model.utility.UtilityString;
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.StringWriter;
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@@ -1200,7 +1193,7 @@ public class ProductionBusinessLogic {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String codProd = row.getCodMart();
|
String codProd = row.getCodMart();
|
||||||
Date dataInizProd = row.getDataInizProd();
|
LocalDate dataInizProd = row.getDataInizProd();
|
||||||
Date dataOrdRif = row.getDataOrdRif();
|
Date dataOrdRif = row.getDataOrdRif();
|
||||||
String descrizione = row.getDescrizione();
|
String descrizione = row.getDescrizione();
|
||||||
String descrizioneEstesa = row.getDescrizioneEstesa();
|
String descrizioneEstesa = row.getDescrizioneEstesa();
|
||||||
@@ -1502,7 +1495,7 @@ public class ProductionBusinessLogic {
|
|||||||
.setGestione(gestioneLav)
|
.setGestione(gestioneLav)
|
||||||
.setDataOrd(dataOrd)
|
.setDataOrd(dataOrd)
|
||||||
.setDataCons(dataCons)
|
.setDataCons(dataCons)
|
||||||
.setDataInizLav(dataInizProd)
|
.setDataInizLav(UtilityLocalDate.localDateToDate(dataInizProd))
|
||||||
.setNumOrd(numOrdLav)
|
.setNumOrd(numOrdLav)
|
||||||
.setTipoAnag(tipoAnag)
|
.setTipoAnag(tipoAnag)
|
||||||
.setDescrComm(desCom)
|
.setDescrComm(desCom)
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import org.apache.logging.log4j.Logger;
|
|||||||
import org.kie.api.definition.type.PropertyReactive;
|
import org.kie.api.definition.type.PropertyReactive;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@PropertyReactive
|
@PropertyReactive
|
||||||
@@ -333,7 +334,7 @@ public class DtbOrdr extends DtbOrdCommonR implements EquatableEntityInterface<D
|
|||||||
|
|
||||||
private String tipoIva;
|
private String tipoIva;
|
||||||
|
|
||||||
private Date dataInizProd;
|
private LocalDate dataInizProd;
|
||||||
|
|
||||||
private Date dataOrdRif;
|
private Date dataOrdRif;
|
||||||
|
|
||||||
@@ -1303,11 +1304,11 @@ public class DtbOrdr extends DtbOrdCommonR implements EquatableEntityInterface<D
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataInizProd() {
|
public LocalDate getDataInizProd() {
|
||||||
return dataInizProd;
|
return dataInizProd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DtbOrdr setDataInizProd(Date dataInizProd) {
|
public DtbOrdr setDataInizProd(LocalDate dataInizProd) {
|
||||||
this.dataInizProd = dataInizProd;
|
this.dataInizProd = dataInizProd;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import org.kie.api.definition.type.PropertyReactive;
|
|||||||
import org.springframework.web.context.ContextLoader;
|
import org.springframework.web.context.ContextLoader;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -160,7 +161,7 @@ public class DtbOrdt extends DtbDocOrdT implements EquatableEntityInterface<DtbO
|
|||||||
private Date dataConferma;
|
private Date dataConferma;
|
||||||
|
|
||||||
@SqlField(value = "data_iniz_prod")
|
@SqlField(value = "data_iniz_prod")
|
||||||
private Date dataInizProd;
|
private LocalDate dataInizProd;
|
||||||
|
|
||||||
@SqlField(value = "data_iniz_trasp")
|
@SqlField(value = "data_iniz_trasp")
|
||||||
private Date dataInizTrasp;
|
private Date dataInizTrasp;
|
||||||
@@ -816,11 +817,11 @@ public class DtbOrdt extends DtbDocOrdT implements EquatableEntityInterface<DtbO
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataInizProd() {
|
public LocalDate getDataInizProd() {
|
||||||
return dataInizProd;
|
return dataInizProd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DtbOrdt setDataInizProd(Date dataInizProd) {
|
public DtbOrdt setDataInizProd(LocalDate dataInizProd) {
|
||||||
this.dataInizProd = dataInizProd;
|
this.dataInizProd = dataInizProd;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import it.integry.ems.rules.util.*
|
|||||||
import it.integry.ems.rules.completing.*
|
import it.integry.ems.rules.completing.*
|
||||||
import java.sql.Connection
|
import java.sql.Connection
|
||||||
import it.integry.ems_model.types.OperationType
|
import it.integry.ems_model.types.OperationType
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
global Connection conn
|
global Connection conn
|
||||||
global String username
|
global String username
|
||||||
@@ -51,7 +52,7 @@ when
|
|||||||
eval(completeRulesEnabled)
|
eval(completeRulesEnabled)
|
||||||
$ordR : DtbOrdr(dataInizProd == null && gestione == "A" && gestioneRif != null)
|
$ordR : DtbOrdr(dataInizProd == null && gestione == "A" && gestioneRif != null)
|
||||||
then
|
then
|
||||||
Date dataInizProd = OrderRules.completeDataInizProdOrdP(conn, $ordR);
|
LocalDate dataInizProd = OrderRules.completeDataInizProdOrdP(conn, $ordR);
|
||||||
modify ( $ordR ) { setDataInizProd(dataInizProd) }
|
modify ( $ordR ) { setDataInizProd(dataInizProd) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ public class SteUPController {
|
|||||||
) {
|
) {
|
||||||
ServiceRestResponse response = new ServiceRestResponse();
|
ServiceRestResponse response = new ServiceRestResponse();
|
||||||
try {
|
try {
|
||||||
response.setJsonObject(steUPService.getGrigliaPluRepo(codMdep, codJfas, activityTypeId, codCmac, UtilityDate.getTodayWithoutTime(), false));
|
response.setJsonObject(steUPService.getGrigliaPluRepo(codMdep, codJfas, activityTypeId, codCmac, UtilityDate.getTodayWithoutTime(), false, null));
|
||||||
response.setEsito(EsitoType.OK);
|
response.setEsito(EsitoType.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(request.getRequestURI(), e);
|
logger.error(request.getRequestURI(), e);
|
||||||
|
|||||||
@@ -692,7 +692,7 @@ public class SteUPService {
|
|||||||
boolean verificaVolantino = UtilityString.equalsIgnoreCase(tipoAttivitaVerificaVolantino, activityTypeId);
|
boolean verificaVolantino = UtilityString.equalsIgnoreCase(tipoAttivitaVerificaVolantino, activityTypeId);
|
||||||
barcodes = chkVolantino(codJfas, codMdep, barcodes, verificaVolantino, dataCreation);
|
barcodes = chkVolantino(codJfas, codMdep, barcodes, verificaVolantino, dataCreation);
|
||||||
} else if (activityTypeId.equalsIgnoreCase(tipoAttivitaRotturaStock)) {
|
} else if (activityTypeId.equalsIgnoreCase(tipoAttivitaRotturaStock)) {
|
||||||
List<HashMap<String, Object>> pluRepo = getGrigliaPluRepo(codMdep, codJfas, activityTypeId, null, dataCreation, true);
|
List<HashMap<String, Object>> pluRepo = getGrigliaPluRepo(codMdep, codJfas, activityTypeId, null, dataCreation, true, barcodes);
|
||||||
if (repartiFreschi != null && repartiFreschi.contains(codJfas)) {
|
if (repartiFreschi != null && repartiFreschi.contains(codJfas)) {
|
||||||
List<String> finalBarcodes = barcodes;
|
List<String> finalBarcodes = barcodes;
|
||||||
barcodes = new ArrayList<>();
|
barcodes = new ArrayList<>();
|
||||||
@@ -701,8 +701,6 @@ public class SteUPService {
|
|||||||
.collect(groupingBy(x -> x.get("cod_mart").toString()));
|
.collect(groupingBy(x -> x.get("cod_mart").toString()));
|
||||||
|
|
||||||
for (Map.Entry<String, List<HashMap<String, Object>>> entry : pluByCodMarts.entrySet()) {
|
for (Map.Entry<String, List<HashMap<String, Object>>> entry : pluByCodMarts.entrySet()) {
|
||||||
String codMart = entry.getKey();
|
|
||||||
System.out.println(codMart);
|
|
||||||
List<HashMap<String, Object>> hashMapList = entry.getValue();
|
List<HashMap<String, Object>> hashMapList = entry.getValue();
|
||||||
|
|
||||||
boolean containBarcode = hashMapList.stream().anyMatch(x -> finalBarcodes.contains(((String) x.get("barcode"))));
|
boolean containBarcode = hashMapList.stream().anyMatch(x -> finalBarcodes.contains(((String) x.get("barcode"))));
|
||||||
@@ -712,7 +710,8 @@ public class SteUPService {
|
|||||||
}
|
}
|
||||||
// barcodes = pluRepo.stream().filter(a-> !finalBarcodes.contains(((String) a.get("barcode")))).map(a->(String) a.get("barcode")).collect(Collectors.toList());
|
// barcodes = pluRepo.stream().filter(a-> !finalBarcodes.contains(((String) a.get("barcode")))).map(a->(String) a.get("barcode")).collect(Collectors.toList());
|
||||||
} else {
|
} else {
|
||||||
barcodes = barcodes.stream().filter(a -> pluRepo.stream().map(x -> x.get("barcode")).collect(Collectors.toList()).contains(a)).collect(Collectors.toList());
|
barcodes = pluRepo.stream().map(x->x.get("barcode").toString()).collect(Collectors.toList());
|
||||||
|
//barcodes.stream().filter(a -> pluRepo.stream().map(x -> x.get("barcode")).collect(Collectors.toList()).contains(a)).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -815,7 +814,8 @@ public class SteUPService {
|
|||||||
|
|
||||||
public List<HashMap<String, Object>> getGrigliaPluRepo(String codMdep, String codJfas,
|
public List<HashMap<String, Object>> getGrigliaPluRepo(String codMdep, String codJfas,
|
||||||
String activityTypeId, String codCmac, Date dataCreation,
|
String activityTypeId, String codCmac, Date dataCreation,
|
||||||
boolean chkRotturaStock) throws Exception {
|
boolean chkRotturaStock,
|
||||||
|
List<String> barcode) throws Exception {
|
||||||
String sql = "SELECT dbo.steup_getListinoDepo( " + UtilityDB.valueToString(codMdep) + ") as cod_vlis";
|
String sql = "SELECT dbo.steup_getListinoDepo( " + UtilityDB.valueToString(codMdep) + ") as cod_vlis";
|
||||||
String codVlis = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
String codVlis = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||||
if (UtilityString.isNullOrEmpty(codVlis))
|
if (UtilityString.isNullOrEmpty(codVlis))
|
||||||
@@ -856,8 +856,9 @@ public class SteUPService {
|
|||||||
sql = "Select cod_mart,descrizione,bar_code as barcode,cod_msgr from steup_getGrigliaVendita(" + UtilityDB.valueToString(codMdep) + "," + UtilityDB.valueToString(codJfas) + ")";
|
sql = "Select cod_mart,descrizione,bar_code as barcode,cod_msgr from steup_getGrigliaVendita(" + UtilityDB.valueToString(codMdep) + "," + UtilityDB.valueToString(codJfas) + ")";
|
||||||
} else if (chkRotturaStock) {
|
} else if (chkRotturaStock) {
|
||||||
sql = "SELECT cod_mart,descrizione,bar_code as barcode,cod_msgr\n" +
|
sql = "SELECT cod_mart,descrizione,bar_code as barcode,cod_msgr\n" +
|
||||||
"FROM steup_getAssortimento(" + UtilityDB.valueToString(codMdep) + "," + UtilityDB.valueToString(codJfas) + ")\n" +
|
"FROM steup_getAssortimento(" + UtilityDB.valueToString(codMdep) + "," + UtilityDB.valueToString(codJfas) + ", " + UtilityDB.valueToString(dataCreation) +") art\n" +
|
||||||
"WHERE cod_mart NOT IN (SELECT cod_mart\n" +
|
"WHERE EXISTS(SELECT cod_mart from carelli.dbo.mvw_barcode WHERE cod_barre in (" + UtilityDB.listValueToString(barcode) + ") and art.cod_mart = mvw_barcode.cod_mart)\n" +
|
||||||
|
" AND cod_mart NOT IN (SELECT cod_mart\n" +
|
||||||
" FROM (SELECT cod_mart,\n" +
|
" FROM (SELECT cod_mart,\n" +
|
||||||
" cod_mdep,\n" +
|
" cod_mdep,\n" +
|
||||||
" data_validita,\n" +
|
" data_validita,\n" +
|
||||||
@@ -873,13 +874,14 @@ public class SteUPService {
|
|||||||
" LEAD(tipo_variazione, 1, NULL)\n" +
|
" LEAD(tipo_variazione, 1, NULL)\n" +
|
||||||
" OVER (PARTITION BY cod_mart, cod_mdep ORDER BY data_validita, tipo_variazione ) AS tipo_variazione_succ\n" +
|
" OVER (PARTITION BY cod_mart, cod_mdep ORDER BY data_validita, tipo_variazione ) AS tipo_variazione_succ\n" +
|
||||||
" FROM carelli.dbo.atb_griglie_art\n" +
|
" FROM carelli.dbo.atb_griglie_art\n" +
|
||||||
" WHERE atb_griglie_art.data_validita <= CAST(GETDATE() AS DATE)\n" +
|
" WHERE atb_griglie_art.data_validita <= " + UtilityDB.valueToString(dataCreation) + "\n"+
|
||||||
" AND atb_griglie_art.cod_mdep = " + UtilityDB.valueToString(codMdep) + ") g\n" +
|
" AND atb_griglie_art.cod_mdep = " + UtilityDB.valueToString(codMdep) + ") g\n" +
|
||||||
" WHERE g.tipo_variazione_succ IS NULL\n" +
|
" WHERE g.tipo_variazione_succ IS NULL\n" +
|
||||||
" AND DATEDIFF(DAY, data_validita, CAST(GETDATE() AS DATE)) < 7\n" +
|
" AND DATEDIFF(DAY, data_validita, " + UtilityDB.valueToString(dataCreation) + ") < 7\n" +
|
||||||
" AND g.tipo_variazione = 'I'\n" +
|
" AND g.tipo_variazione = 'I'\n" +
|
||||||
" UNION " +
|
" UNION \n" +
|
||||||
" SELECT cod_mart FROM dbo.steup_getInevasi(" + UtilityDB.valueToString(codMdep) + ", " + UtilityDB.valueToString(codJfas) + ", " + UtilityDB.valueToString(dataCreation) + "))";
|
" SELECT cod_mart \n" +
|
||||||
|
" FROM dbo.steup_getInevasi(" + UtilityDB.valueToString(codMdep) + ", " + UtilityDB.valueToString(codJfas) + ", " + UtilityDB.valueToString(dataCreation) + "))";
|
||||||
} else {
|
} else {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
@@ -1239,7 +1241,7 @@ public class SteUPService {
|
|||||||
" mtb_aart.descrizione, " +
|
" mtb_aart.descrizione, " +
|
||||||
" mtb_aart.bar_code AS barcode," +
|
" mtb_aart.bar_code AS barcode," +
|
||||||
" mtb_aart.cod_msgr " +
|
" mtb_aart.cod_msgr " +
|
||||||
" FROM dbo.steup_getAssortimento(" + UtilityDB.valueToString(codMdep) + ", " + UtilityDB.valueToString(codJfas) + " ) mtb_aart" +
|
" FROM dbo.steup_getAssortimento(" + UtilityDB.valueToString(codMdep) + ", " + UtilityDB.valueToString(codJfas) + ", null ) mtb_aart" +
|
||||||
" WHERE mtb_aart.plu IS NOT NULL " +
|
" WHERE mtb_aart.plu IS NOT NULL " +
|
||||||
" AND (mtb_aart.bar_code = " + UtilityDB.valueToString(barcode) + " OR mtb_aart.cod_mart = " + UtilityDB.valueToString(barcode) + ")" +
|
" AND (mtb_aart.bar_code = " + UtilityDB.valueToString(barcode) + " OR mtb_aart.cod_mart = " + UtilityDB.valueToString(barcode) + ")" +
|
||||||
" ORDER BY mtb_aart.cod_msgr, mtb_aart.descrizione";
|
" ORDER BY mtb_aart.cod_msgr, mtb_aart.descrizione";
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class ScadenzeExporterService {
|
|||||||
EntityExportResponse<List<FileItem>> entityExportResponse = new EntityExportResponse<>();
|
EntityExportResponse<List<FileItem>> entityExportResponse = new EntityExportResponse<>();
|
||||||
entityExportResponse.setResponse(new ArrayList<>());
|
entityExportResponse.setResponse(new ArrayList<>());
|
||||||
|
|
||||||
String sql = "SELECT ISNULL(gtb_tipi_paga_intercode.intercode, ctb_scad.cod_paga) /*leggere da tabella di trascodifica*/ AS 'tipo_pagamento',\n" +
|
String sql = "SELECT gtb_tipi_paga_intercode.intercode AS 'tipo_pagamento',\n" +
|
||||||
" REPLACE(\n" +
|
" REPLACE(\n" +
|
||||||
" CAST(\n" +
|
" CAST(\n" +
|
||||||
" FORMAT(\n" +
|
" FORMAT(\n" +
|
||||||
@@ -46,8 +46,8 @@ public class ScadenzeExporterService {
|
|||||||
" 'N' AS 'raiting',\n" +
|
" 'N' AS 'raiting',\n" +
|
||||||
" REPLACE(CONVERT(VARCHAR(10), ctb_scad.data_scad, 103), '/', '') AS 'data_scadenza',\n" +
|
" REPLACE(CONVERT(VARCHAR(10), ctb_scad.data_scad, 103), '/', '') AS 'data_scadenza',\n" +
|
||||||
" REPLACE(CONVERT(VARCHAR(10), ctb_scad.data_scad, 103), '/', '') AS 'data_valuta',\n" +
|
" REPLACE(CONVERT(VARCHAR(10), ctb_scad.data_scad, 103), '/', '') AS 'data_valuta',\n" +
|
||||||
" LEFT(gtb_banc_azi_intercode.intercode, 8) AS 'banca',\n" +
|
" CASE WHEN c.banc_azi = 1 THEN LEFT(gtb_banc_azi_intercode.intercode, 8) ELSE '' END AS 'banca',\n" +
|
||||||
" RIGHT(gtb_banc_azi_intercode.intercode, 4) AS 'rbn',\n" +
|
" CASE WHEN c.banc_azi = 1 THEN RIGHT(gtb_banc_azi_intercode.intercode, 4) ELSE '' END AS 'rbn',\n" +
|
||||||
" 'N' AS 'bloccata',\n" +
|
" 'N' AS 'bloccata',\n" +
|
||||||
" IIF(ctb_part.tipo_anag = 'F', '0201', '0101') AS 'voce',\n" +
|
" IIF(ctb_part.tipo_anag = 'F', '0201', '0101') AS 'voce',\n" +
|
||||||
" gtb_anag.diacod AS 'piano_dei_conti',\n" +
|
" gtb_anag.diacod AS 'piano_dei_conti',\n" +
|
||||||
@@ -66,21 +66,22 @@ public class ScadenzeExporterService {
|
|||||||
" ctb_scad.id_riga,\n" +
|
" ctb_scad.id_riga,\n" +
|
||||||
" ctb_scad.tipo_anag)) AS 'chiave coge',\n" +
|
" ctb_scad.tipo_anag)) AS 'chiave coge',\n" +
|
||||||
" 'ROSSOGARGA' AS 'azienda',\n" +
|
" 'ROSSOGARGA' AS 'azienda',\n" +
|
||||||
" Right(ctb_part.iban,12) AS 'numero_cc',\n" +
|
" CASE WHEN c.banc_azi = 1 THEN '' ELSE Right(ctb_part.iban,12) END AS 'numero_cc',\n" +
|
||||||
" SUBSTRING(ctb_part.iban, 5, 1) AS 'cin',\n" +
|
" CASE WHEN c.banc_azi = 1 THEN '' ELSE SUBSTRING(ctb_part.iban, 5, 1) END AS 'cin',\n" +
|
||||||
" LEFT(ctb_part.iban, 2) AS 'paese',\n" +
|
" CASE WHEN c.banc_azi = 1 THEN '' ELSE LEFT(ctb_part.iban, 2) END AS 'paese',\n" +
|
||||||
" SUBSTRING(ctb_part.iban, 3, 2) AS 'chk_paese',\n" +
|
" CASE WHEN c.banc_azi = 1 THEN '' ELSE SUBSTRING(ctb_part.iban, 3, 2) END AS 'chk_paese',\n" +
|
||||||
" REPLACE(CONVERT(VARCHAR(10), ctb_part.data_doc, 103), '/', '') AS 'data_documento',\n" +
|
" REPLACE(CONVERT(VARCHAR(10), ctb_part.data_doc, 103), '/', '') AS 'data_documento',\n" +
|
||||||
" ctb_parr.des_agg AS 'note',\n" +
|
" ctb_parr.des_agg AS 'note',\n" +
|
||||||
" IIF(vtb_clie.cod_anag IS NULL, atb_forn.cod_bic, vtb_clie.cod_bic) AS 'cod_bic',\n" +
|
" IIF(vtb_clie.cod_anag IS NULL, atb_forn.cod_bic, vtb_clie.cod_bic) AS 'cod_bic',\n" +
|
||||||
" ctb_part.iban\n" +
|
" CASE WHEN c.banc_azi = 1 THEN gtb_banc_azi.cod_iban ELSE ctb_part.iban END AS iban\n" +
|
||||||
"FROM ctb_part\n" +
|
"FROM ctb_part\n" +
|
||||||
" INNER JOIN ctb_scad ON ctb_part.tipo_anag = ctb_scad.tipo_anag AND ctb_part.cod_anag = ctb_scad.cod_anag AND\n" +
|
" INNER JOIN ctb_scad ON ctb_part.tipo_anag = ctb_scad.tipo_anag AND ctb_part.cod_anag = ctb_scad.cod_anag AND\n" +
|
||||||
" ctb_part.anno_part = ctb_scad.anno_part AND ctb_part.ser_doc = ctb_scad.ser_doc AND\n" +
|
" ctb_part.anno_part = ctb_scad.anno_part AND ctb_part.ser_doc = ctb_scad.ser_doc AND\n" +
|
||||||
" ctb_part.num_doc = ctb_scad.num_doc\n" +
|
" ctb_part.num_doc = ctb_scad.num_doc\n" +
|
||||||
" INNER JOIN gtb_anag ON ctb_part.cod_anag = gtb_anag.cod_anag\n" +
|
" INNER JOIN gtb_anag ON ctb_part.cod_anag = gtb_anag.cod_anag\n" +
|
||||||
" INNER JOIN gtb_paga ON ctb_scad.cod_paga = gtb_paga.cod_paga\n" +
|
" INNER JOIN gtb_paga ON ctb_scad.cod_paga = gtb_paga.cod_paga\n" +
|
||||||
" LEFT OUTER JOIN gtb_tipi_paga_intercode ON gtb_paga.tipo_paga = gtb_tipi_paga_intercode.tipo_paga\n" +
|
" LEFT outer join gtb_tipi_paga on gtb_paga.tipo_paga = gtb_tipi_paga.tipo_paga\n" +
|
||||||
|
" LEFT OUTER JOIN gtb_tipi_paga_intercode ON gtb_tipi_paga.tipo_paga = gtb_tipi_paga_intercode.tipo_paga\n" +
|
||||||
" LEFT OUTER JOIN gtb_banc ON ctb_part.cod_banc = gtb_banc.cod_banc\n" +
|
" LEFT OUTER JOIN gtb_banc ON ctb_part.cod_banc = gtb_banc.cod_banc\n" +
|
||||||
" LEFT OUTER JOIN gtb_banc_azi ON gtb_banc.cod_banc = gtb_banc_azi.cod_banc\n" +
|
" LEFT OUTER JOIN gtb_banc_azi ON gtb_banc.cod_banc = gtb_banc_azi.cod_banc\n" +
|
||||||
" LEFT OUTER JOIN gtb_banc_azi_intercode ON gtb_banc_azi.cod_banc_azi = gtb_banc_azi_intercode.cod_banc_azi AND\n" +
|
" LEFT OUTER JOIN gtb_banc_azi_intercode ON gtb_banc_azi.cod_banc_azi = gtb_banc_azi_intercode.cod_banc_azi AND\n" +
|
||||||
@@ -97,10 +98,11 @@ public class ScadenzeExporterService {
|
|||||||
" AND ctb_part.anno_part = ctb_parr.anno_part\n" +
|
" AND ctb_part.anno_part = ctb_parr.anno_part\n" +
|
||||||
" AND ctb_part.ser_doc = ctb_parr.ser_doc\n" +
|
" AND ctb_part.ser_doc = ctb_parr.ser_doc\n" +
|
||||||
" AND ctb_part.num_doc = ctb_parr.num_doc\n" +
|
" AND ctb_part.num_doc = ctb_parr.num_doc\n" +
|
||||||
" ORDER BY ctb_parr.data_cmov) ctb_parr\n" +
|
" ORDER BY ctb_parr.data_cmov, ctb_parr.num_cmov) ctb_parr\n" +
|
||||||
|
" OUTER APPLY (SELECT CASE WHEN (ctb_part.tipo_anag = 'F' AND gtb_tipi_paga.flag_banca_acq = 'A' ) OR (ctb_part.tipo_anag = 'C' AND gtb_tipi_paga.flag_banca_ven = 'A' ) THEN 1 ELSE 0 END as banca_azi ) c\n " +
|
||||||
"WHERE ctb_scad.data_pag IS NULL\n" +
|
"WHERE ctb_scad.data_pag IS NULL\n" +
|
||||||
"UNION ALL\n" +
|
"UNION ALL\n" +
|
||||||
"SELECT 'RD' /*leggere da tabella di trascodifica*/ AS 'tipo_pagamento',\n" +
|
"SELECT 'RD' AS 'tipo_pagamento',\n" +
|
||||||
" REPLACE(\n" +
|
" REPLACE(\n" +
|
||||||
" CAST(\n" +
|
" CAST(\n" +
|
||||||
" FORMAT(\n" +
|
" FORMAT(\n" +
|
||||||
@@ -141,7 +143,7 @@ public class ScadenzeExporterService {
|
|||||||
" '' AS 'cambio_della_gestione',\n" +
|
" '' AS 'cambio_della_gestione',\n" +
|
||||||
" ISNULL(ctb_movr_intercode.num_doc_orig, '') AS 'numero_doc_origine',\n" +
|
" ISNULL(ctb_movr_intercode.num_doc_orig, '') AS 'numero_doc_origine',\n" +
|
||||||
" IIF(ctb_movr_intercode.intercode IS NOT NULL, ctb_movr_intercode.intercode + FORMAT(\n" +
|
" IIF(ctb_movr_intercode.intercode IS NOT NULL, ctb_movr_intercode.intercode + FORMAT(\n" +
|
||||||
" DENSE_RANK() OVER (PARTITION BY ctb_movr.cod_anag, ctb_movt.num_doc ORDER BY ctb_movt.data_cmov), '000'),\n" +
|
" DENSE_RANK() OVER (PARTITION BY ctb_movr.cod_anag, ctb_movt.num_doc, ctb_movr_intercode.intercode ORDER BY ctb_movt.data_cmov), '000'),\n" +
|
||||||
" RIGHT(ctb_movr.num_cmov, LEN(ctb_movr.num_cmov) - 2) + FORMAT(ctb_movr.id_riga, '000') +\n" +
|
" RIGHT(ctb_movr.num_cmov, LEN(ctb_movr.num_cmov) - 2) + FORMAT(ctb_movr.id_riga, '000') +\n" +
|
||||||
" '001') AS chiave_coge,\n" +
|
" '001') AS chiave_coge,\n" +
|
||||||
" 'ROSSOGARGA' AS 'azienda',\n" +
|
" 'ROSSOGARGA' AS 'azienda',\n" +
|
||||||
|
|||||||
@@ -125,6 +125,10 @@ public class RossoGarganoProductionService {
|
|||||||
.setScarto(cert.getScartoKg())
|
.setScarto(cert.getScartoKg())
|
||||||
.setCnfRese(cert.getCasseRese())
|
.setCnfRese(cert.getCasseRese())
|
||||||
.setNumCnf(cert.getCasseScaricate())
|
.setNumCnf(cert.getCasseScaricate())
|
||||||
|
.setPesoLordoCamion(cert.getPesoLordoKg())
|
||||||
|
.setPesoNettoPedane(cert.getPesoNettoKg())
|
||||||
|
.setQtaCol(cert.getPesoNettoKg())
|
||||||
|
.setCodVzon(cert.getCodVzon())
|
||||||
.setIndiceVariazione(cert.getIndiceVariazione())
|
.setIndiceVariazione(cert.getIndiceVariazione())
|
||||||
.setTassoRiduzione(cert.getTassoRiduzione())
|
.setTassoRiduzione(cert.getTassoRiduzione())
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import it.integry.ems_model.types.OperationType;
|
|||||||
import it.integry.ems_model.utility.Query;
|
import it.integry.ems_model.utility.Query;
|
||||||
import it.integry.ems_model.utility.UtilityDB;
|
import it.integry.ems_model.utility.UtilityDB;
|
||||||
import it.integry.ems_model.utility.UtilityHashMap;
|
import it.integry.ems_model.utility.UtilityHashMap;
|
||||||
|
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -116,7 +117,7 @@ public class ToscaProductionService {
|
|||||||
|
|
||||||
if (numOrd >= 0) dtbOrdtToInsert.setNumOrd(numOrd);
|
if (numOrd >= 0) dtbOrdtToInsert.setNumOrd(numOrd);
|
||||||
else {
|
else {
|
||||||
DtbOrdr dtbOrdr = new DtbOrdr().setCodJfas(codJfas).setDataInizProd(dataOrd).setQtaOrd(BigDecimal.ONE).setNumCnf(BigDecimal.ONE).setQtaCnf(BigDecimal.ONE).setDescrizione("Cassette da lavare");
|
DtbOrdr dtbOrdr = new DtbOrdr().setCodJfas(codJfas).setDataInizProd(UtilityLocalDate.localDateFromDate(dataOrd)).setQtaOrd(BigDecimal.ONE).setNumCnf(BigDecimal.ONE).setQtaCnf(BigDecimal.ONE).setDescrizione("Cassette da lavare");
|
||||||
dtbOrdr.setOperation(OperationType.INSERT);
|
dtbOrdr.setOperation(OperationType.INSERT);
|
||||||
|
|
||||||
dtbOrdtToInsert.getDtbOrdr().add(dtbOrdr);
|
dtbOrdtToInsert.getDtbOrdr().add(dtbOrdr);
|
||||||
|
|||||||
@@ -184,6 +184,9 @@ public class DocumentiImporter extends BaseEntityImporter<List<EntityBase>> impl
|
|||||||
case APULIA:
|
case APULIA:
|
||||||
fileNameDest = orginalFileName + "_" +
|
fileNameDest = orginalFileName + "_" +
|
||||||
new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".txt";
|
new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".txt";
|
||||||
|
case PAZIENZA_RIFORD:
|
||||||
|
fileNameDest = orginalFileName + "_" +
|
||||||
|
new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".xlsx";
|
||||||
default:
|
default:
|
||||||
fileNameDest = super.renameFile(orginalFileName, entities);
|
fileNameDest = super.renameFile(orginalFileName, entities);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ public class ChiusuraLavorazioneDTO {
|
|||||||
private boolean effettuaRientro = true;
|
private boolean effettuaRientro = true;
|
||||||
private boolean chiudiOrdine = true;
|
private boolean chiudiOrdine = true;
|
||||||
private boolean terminaLavorazioneLinea = false;
|
private boolean terminaLavorazioneLinea = false;
|
||||||
|
|
||||||
private boolean salvaDocumenti = true;
|
private boolean salvaDocumenti = true;
|
||||||
|
|
||||||
public DtbOrdt getOrdine() {
|
public DtbOrdt getOrdine() {
|
||||||
return ordine;
|
return ordine;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import it.integry.ems_model.entity.*;
|
|||||||
import it.integry.ems_model.service.SetupGest;
|
import it.integry.ems_model.service.SetupGest;
|
||||||
import it.integry.ems_model.types.OperationType;
|
import it.integry.ems_model.types.OperationType;
|
||||||
import it.integry.ems_model.utility.UtilityDB;
|
import it.integry.ems_model.utility.UtilityDB;
|
||||||
|
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||||
import it.integry.ems_model.utility.UtilityString;
|
import it.integry.ems_model.utility.UtilityString;
|
||||||
import it.integry.ems_model.utility.UtilityXML;
|
import it.integry.ems_model.utility.UtilityXML;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
@@ -1853,7 +1854,7 @@ public class FarmMesImportService {
|
|||||||
ordR.setQtaOrd(qtaProdOrd);
|
ordR.setQtaOrd(qtaProdOrd);
|
||||||
ordR.setRapConv(rapConvProd);
|
ordR.setRapConv(rapConvProd);
|
||||||
ordR.setUntOrd(untMisProd);
|
ordR.setUntOrd(untMisProd);
|
||||||
ordR.setDataInizProd(dataReg);
|
ordR.setDataInizProd(UtilityLocalDate.localDateFromDate(dataReg));
|
||||||
ordR.setDataCons(dataReg);
|
ordR.setDataCons(dataReg);
|
||||||
ordT.getDtbOrdr().add(ordR);
|
ordT.getDtbOrdr().add(ordR);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import it.integry.ems_model.entity.*;
|
|||||||
import it.integry.ems_model.service.SetupGest;
|
import it.integry.ems_model.service.SetupGest;
|
||||||
import it.integry.ems_model.types.OperationType;
|
import it.integry.ems_model.types.OperationType;
|
||||||
import it.integry.ems_model.utility.UtilityDB;
|
import it.integry.ems_model.utility.UtilityDB;
|
||||||
|
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||||
import it.integry.ems_model.utility.UtilityString;
|
import it.integry.ems_model.utility.UtilityString;
|
||||||
import org.josql.Query;
|
import org.josql.Query;
|
||||||
import org.josql.QueryResults;
|
import org.josql.QueryResults;
|
||||||
@@ -1410,7 +1411,6 @@ public class FarmMesScrofaieImportService {
|
|||||||
ordT.setTipoAnag(tipoAnag);
|
ordT.setTipoAnag(tipoAnag);
|
||||||
ordT.setCodAnag(dettProdNow.getCodAnag());
|
ordT.setCodAnag(dettProdNow.getCodAnag());
|
||||||
ordT.setCodVdes(dettProdNow.getCodVdes());
|
ordT.setCodVdes(dettProdNow.getCodVdes());
|
||||||
ordT.setUsername(requestDataDTO.getUsername());
|
|
||||||
ordT.setCodMdep(dettProdNow.getCodMdep());
|
ordT.setCodMdep(dettProdNow.getCodMdep());
|
||||||
ordT.setUsername(requestDataDTO.getUsername());
|
ordT.setUsername(requestDataDTO.getUsername());
|
||||||
ordT.setActivityId(activityID);
|
ordT.setActivityId(activityID);
|
||||||
@@ -1437,7 +1437,7 @@ public class FarmMesScrofaieImportService {
|
|||||||
ordR.setQtaOrd(totCapiProd);
|
ordR.setQtaOrd(totCapiProd);
|
||||||
ordR.setRapConv(dettProdNow.getRapConvProd());
|
ordR.setRapConv(dettProdNow.getRapConvProd());
|
||||||
ordR.setUntOrd(dettProdNow.getUntMisProd());
|
ordR.setUntOrd(dettProdNow.getUntMisProd());
|
||||||
ordR.setDataInizProd(transaction.getDataMov());
|
ordR.setDataInizProd(UtilityLocalDate.localDateFromDate(transaction.getDataMov()));
|
||||||
ordR.setDataCons(transaction.getDataMov());
|
ordR.setDataCons(transaction.getDataMov());
|
||||||
ordT.getDtbOrdr().add(ordR);
|
ordT.getDtbOrdr().add(ordR);
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import it.integry.ems_model.types.OperationType;
|
|||||||
import it.integry.ems_model.utility.*;
|
import it.integry.ems_model.utility.*;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.jcodec.common.DictionaryCompressor;
|
|
||||||
import org.josql.Query;
|
import org.josql.Query;
|
||||||
import org.josql.QueryResults;
|
import org.josql.QueryResults;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -37,12 +36,10 @@ import org.springframework.stereotype.Service;
|
|||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.sql.Connection;
|
import java.sql.*;
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.Statement;
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@@ -64,10 +61,10 @@ public class DocumentProdService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private DocumentiLavDaDist documentiLavDaDist;
|
private DocumentiLavDaDist documentiLavDaDist;
|
||||||
|
|
||||||
private Logger logger = LogManager.getLogger();
|
private final Logger logger = LogManager.getLogger();
|
||||||
|
|
||||||
private String tipoMateriaPrima = "MATERIA PRIMA";
|
private final String tipoMateriaPrima = "MATERIA PRIMA";
|
||||||
private String tipoImballaggi = "IMBALLAGGI";
|
private final String tipoImballaggi = "IMBALLAGGI";
|
||||||
|
|
||||||
public List<EntityBase> riapriGiornataProd(String codMdep, Date dataProd) throws Exception {
|
public List<EntityBase> riapriGiornataProd(String codMdep, Date dataProd) throws Exception {
|
||||||
List<EntityBase> arrayEntity = new ArrayList<EntityBase>();
|
List<EntityBase> arrayEntity = new ArrayList<EntityBase>();
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ public class AgribookFieldService {
|
|||||||
.setCodMdep(codMdepDest)
|
.setCodMdep(codMdepDest)
|
||||||
.setCodVdes(codVdes)
|
.setCodVdes(codVdes)
|
||||||
.setCodVzon(dto.getCodVzon())
|
.setCodVzon(dto.getCodVzon())
|
||||||
.setDataInizProd(UtilityLocalDate.localDateToDate(dto.getDataInizProd()))
|
.setDataInizProd(dto.getDataInizProd())
|
||||||
.setDtbOrdr(ordrList)
|
.setDtbOrdr(ordrList)
|
||||||
.setOperation(OperationType.INSERT);
|
.setOperation(OperationType.INSERT);
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ package it.integry.ems.production.controller;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import it.integry.common.var.CommonConstants;
|
import it.integry.common.var.CommonConstants;
|
||||||
|
import it.integry.ems.document.dto.ChiusuraLavorazioneDTO;
|
||||||
|
import it.integry.ems.document.dto.ScaricoLavorazioneDTO;
|
||||||
|
import it.integry.ems.document.service.DocumentProdService;
|
||||||
import it.integry.ems.production.dto.*;
|
import it.integry.ems.production.dto.*;
|
||||||
import it.integry.ems.production.service.MesProductionServiceV2;
|
import it.integry.ems.production.service.MesProductionServiceV2;
|
||||||
import it.integry.ems.production.service.ProductionLineService;
|
import it.integry.ems.production.service.ProductionLineService;
|
||||||
@@ -9,8 +12,11 @@ import it.integry.ems.production.service.ProductionOrderDataHandlerService;
|
|||||||
import it.integry.ems.response.EsitoType;
|
import it.integry.ems.response.EsitoType;
|
||||||
import it.integry.ems.response.ServiceRestResponse;
|
import it.integry.ems.response.ServiceRestResponse;
|
||||||
import it.integry.ems.response.StatusResponse;
|
import it.integry.ems.response.StatusResponse;
|
||||||
|
import it.integry.ems.rules.completing.DocumentRules;
|
||||||
import it.integry.ems.status.ServiceChecker;
|
import it.integry.ems.status.ServiceChecker;
|
||||||
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
import it.integry.ems_model.config.EmsRestConstants;
|
import it.integry.ems_model.config.EmsRestConstants;
|
||||||
|
import it.integry.ems_model.entity.DtbDoct;
|
||||||
import it.integry.ems_model.entity.MtbColt;
|
import it.integry.ems_model.entity.MtbColt;
|
||||||
import it.integry.ems_model.utility.UtilityDate;
|
import it.integry.ems_model.utility.UtilityDate;
|
||||||
import it.integry.ems_model.utility.UtilityString;
|
import it.integry.ems_model.utility.UtilityString;
|
||||||
@@ -33,9 +39,6 @@ import java.util.List;
|
|||||||
@RequestMapping("mes_v2")
|
@RequestMapping("mes_v2")
|
||||||
public class MesProductionControllerV2 {
|
public class MesProductionControllerV2 {
|
||||||
|
|
||||||
|
|
||||||
private final Logger logger = LogManager.getLogger();
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ServiceChecker serviceChecker;
|
private ServiceChecker serviceChecker;
|
||||||
|
|
||||||
@@ -46,6 +49,8 @@ public class MesProductionControllerV2 {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProductionOrderDataHandlerService productionOrderDataHandlerService;
|
private ProductionOrderDataHandlerService productionOrderDataHandlerService;
|
||||||
|
@Autowired
|
||||||
|
private DocumentProdService documentProdService;
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(value = "/status", method = RequestMethod.GET)
|
@RequestMapping(value = "/status", method = RequestMethod.GET)
|
||||||
@@ -403,4 +408,10 @@ public class MesProductionControllerV2 {
|
|||||||
@RequestBody List<OrdineLavorazioneDTO> ordini) throws Exception {
|
@RequestBody List<OrdineLavorazioneDTO> ordini) throws Exception {
|
||||||
return ServiceRestResponse.createPositiveResponse(mesProductionService.createColloCaricoGroup(ordini));
|
return ServiceRestResponse.createPositiveResponse(mesProductionService.createColloCaricoGroup(ordini));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("creaDocumentoContoTerzi")
|
||||||
|
public @ResponseBody
|
||||||
|
ServiceRestResponse creaDocumentoContoTerzi(@RequestBody ChiusuraLavorazioneDTO dtoChiusura) throws Exception {
|
||||||
|
return ServiceRestResponse.createPositiveResponse(mesProductionService.creaDocumentoContoTerzi(dtoChiusura));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -261,6 +261,11 @@ public class OrdineLavorazioneDTO {
|
|||||||
@JsonSerialize
|
@JsonSerialize
|
||||||
private String ragSocAnag;
|
private String ragSocAnag;
|
||||||
|
|
||||||
|
@SqlField(value = "part_iva")
|
||||||
|
@JsonProperty("partIva")
|
||||||
|
@JsonSerialize
|
||||||
|
private String partIva;
|
||||||
|
|
||||||
@SqlField(value = "rif_ord")
|
@SqlField(value = "rif_ord")
|
||||||
@JsonProperty("rifOrd")
|
@JsonProperty("rifOrd")
|
||||||
@JsonSerialize
|
@JsonSerialize
|
||||||
@@ -276,6 +281,11 @@ public class OrdineLavorazioneDTO {
|
|||||||
@JsonSerialize
|
@JsonSerialize
|
||||||
private String codMdep;
|
private String codMdep;
|
||||||
|
|
||||||
|
@SqlField(value = "cod_mdep_prod")
|
||||||
|
@JsonProperty("codMdepProd")
|
||||||
|
@JsonSerialize
|
||||||
|
private String codMdepProd;
|
||||||
|
|
||||||
@SqlField(value = "cod_jcom")
|
@SqlField(value = "cod_jcom")
|
||||||
@JsonProperty("codJcom")
|
@JsonProperty("codJcom")
|
||||||
@JsonSerialize
|
@JsonSerialize
|
||||||
@@ -377,48 +387,189 @@ public class OrdineLavorazioneDTO {
|
|||||||
return dataOrdProd;
|
return dataOrdProd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDataOrdProd(Date dataOrdProd) {
|
public OrdineLavorazioneDTO setDataOrdProd(Date dataOrdProd) {
|
||||||
this.dataOrdProd = dataOrdProd;
|
this.dataOrdProd = dataOrdProd;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getNumOrdProd() {
|
public Integer getNumOrdProd() {
|
||||||
return numOrdProd;
|
return numOrdProd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNumOrdProd(Integer numOrdProd) {
|
public OrdineLavorazioneDTO setNumOrdProd(Integer numOrdProd) {
|
||||||
this.numOrdProd = numOrdProd;
|
this.numOrdProd = numOrdProd;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getRigaOrdProd() {
|
public Integer getRigaOrdProd() {
|
||||||
return rigaOrdProd;
|
return rigaOrdProd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRigaOrdProd(Integer rigaOrdProd) {
|
public OrdineLavorazioneDTO setRigaOrdProd(Integer rigaOrdProd) {
|
||||||
this.rigaOrdProd = rigaOrdProd;
|
this.rigaOrdProd = rigaOrdProd;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFlagAvviabile() {
|
||||||
|
return flagAvviabile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setFlagAvviabile(String flagAvviabile) {
|
||||||
|
this.flagAvviabile = flagAvviabile;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFlagTracciabilita() {
|
||||||
|
return flagTracciabilita;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setFlagTracciabilita(String flagTracciabilita) {
|
||||||
|
this.flagTracciabilita = flagTracciabilita;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUntOrd() {
|
||||||
|
return untOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setUntOrd(String untOrd) {
|
||||||
|
this.untOrd = untOrd;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getRapConv() {
|
||||||
|
return rapConv;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setRapConv(BigDecimal rapConv) {
|
||||||
|
this.rapConv = rapConv;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUntOrd2() {
|
||||||
|
return untOrd2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setUntOrd2(String untOrd2) {
|
||||||
|
this.untOrd2 = untOrd2;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getRapConv2() {
|
||||||
|
return rapConv2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setRapConv2(BigDecimal rapConv2) {
|
||||||
|
this.rapConv2 = rapConv2;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUntOrd3() {
|
||||||
|
return untOrd3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setUntOrd3(String untOrd3) {
|
||||||
|
this.untOrd3 = untOrd3;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getRapConv3() {
|
||||||
|
return rapConv3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setRapConv3(BigDecimal rapConv3) {
|
||||||
|
this.rapConv3 = rapConv3;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getPosRiga() {
|
public Integer getPosRiga() {
|
||||||
return posRiga;
|
return posRiga;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPosRiga(Integer posRiga) {
|
public OrdineLavorazioneDTO setPosRiga(Integer posRiga) {
|
||||||
this.posRiga = posRiga;
|
this.posRiga = posRiga;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getNumPezzi() {
|
||||||
|
return numPezzi;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setNumPezzi(BigDecimal numPezzi) {
|
||||||
|
this.numPezzi = numPezzi;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getNumCnf() {
|
||||||
|
return numCnf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setNumCnf(BigDecimal numCnf) {
|
||||||
|
this.numCnf = numCnf;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQtaCnf() {
|
||||||
|
return qtaCnf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setQtaCnf(BigDecimal qtaCnf) {
|
||||||
|
this.qtaCnf = qtaCnf;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getGgScadPartita() {
|
||||||
|
return ggScadPartita;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setGgScadPartita(Integer ggScadPartita) {
|
||||||
|
this.ggScadPartita = ggScadPartita;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getColliPedana() {
|
||||||
|
return colliPedana;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setColliPedana(BigDecimal colliPedana) {
|
||||||
|
this.colliPedana = colliPedana;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getNumPedane() {
|
||||||
|
return numPedane;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setNumPedane(BigDecimal numPedane) {
|
||||||
|
this.numPedane = numPedane;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataOrd() {
|
public Date getDataOrd() {
|
||||||
return dataOrd;
|
return dataOrd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDataOrd(Date dataOrd) {
|
public OrdineLavorazioneDTO setDataOrd(Date dataOrd) {
|
||||||
this.dataOrd = dataOrd;
|
this.dataOrd = dataOrd;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataConsCommessa() {
|
||||||
|
return dataConsCommessa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setDataConsCommessa(Date dataConsCommessa) {
|
||||||
|
this.dataConsCommessa = dataConsCommessa;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFlagEvasoProd() {
|
public String getFlagEvasoProd() {
|
||||||
return flagEvasoProd;
|
return flagEvasoProd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFlagEvasoProd(String flagEvasoProd) {
|
public OrdineLavorazioneDTO setFlagEvasoProd(String flagEvasoProd) {
|
||||||
this.flagEvasoProd = flagEvasoProd;
|
this.flagEvasoProd = flagEvasoProd;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFlagOrdineEvaso() {
|
public String getFlagOrdineEvaso() {
|
||||||
@@ -434,32 +585,36 @@ public class OrdineLavorazioneDTO {
|
|||||||
return gestione;
|
return gestione;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGestione(String gestione) {
|
public OrdineLavorazioneDTO setGestione(String gestione) {
|
||||||
this.gestione = gestione;
|
this.gestione = gestione;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getNumOrd() {
|
public Integer getNumOrd() {
|
||||||
return numOrd;
|
return numOrd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNumOrd(Integer numOrd) {
|
public OrdineLavorazioneDTO setNumOrd(Integer numOrd) {
|
||||||
this.numOrd = numOrd;
|
this.numOrd = numOrd;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescrizioneProd() {
|
public String getDescrizioneProd() {
|
||||||
return descrizioneProd;
|
return descrizioneProd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDescrizioneProd(String descrizioneProd) {
|
public OrdineLavorazioneDTO setDescrizioneProd(String descrizioneProd) {
|
||||||
this.descrizioneProd = descrizioneProd;
|
this.descrizioneProd = descrizioneProd;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCodJfas() {
|
public String getCodJfas() {
|
||||||
return codJfas;
|
return codJfas;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCodJfas(String codJfas) {
|
public OrdineLavorazioneDTO setCodJfas(String codJfas) {
|
||||||
this.codJfas = codJfas;
|
this.codJfas = codJfas;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCodJfasLav() {
|
public String getCodJfasLav() {
|
||||||
@@ -471,292 +626,319 @@ public class OrdineLavorazioneDTO {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getMaxStep() {
|
|
||||||
return maxStep;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMaxStep(Integer maxStep) {
|
|
||||||
this.maxStep = maxStep;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getDataIniz() {
|
|
||||||
return dataIniz;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDataIniz(Date dataIniz) {
|
|
||||||
this.dataIniz = dataIniz;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getDataFine() {
|
|
||||||
return dataFine;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDataFine(Date dataFine) {
|
|
||||||
this.dataFine = dataFine;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getQtaProd() {
|
|
||||||
return qtaProd;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQtaProd(BigDecimal qtaProd) {
|
|
||||||
this.qtaProd = qtaProd;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getQtaTrasferite() {
|
|
||||||
return qtaTrasferite;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQtaTrasferite(BigDecimal qtaTrasferite) {
|
|
||||||
this.qtaTrasferite = qtaTrasferite;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getPzTrasferiti() {
|
|
||||||
return pzTrasferiti;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPzTrasferiti(BigDecimal pzTrasferiti) {
|
|
||||||
this.pzTrasferiti = pzTrasferiti;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getUdcTrasferiti() {
|
|
||||||
return udcTrasferiti;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUdcTrasferiti(BigDecimal udcTrasferiti) {
|
|
||||||
this.udcTrasferiti = udcTrasferiti;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStato() {
|
|
||||||
return stato;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStato(String stato) {
|
|
||||||
this.stato = stato;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUntOrd() {
|
|
||||||
return untOrd;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUntOrd(String untOrd) {
|
|
||||||
this.untOrd = untOrd;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getRapConv() {
|
|
||||||
return rapConv;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRapConv(BigDecimal rapConv) {
|
|
||||||
this.rapConv = rapConv;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getNumCnf() {
|
|
||||||
return numCnf;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNumCnf(BigDecimal numCnf) {
|
|
||||||
this.numCnf = numCnf;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getQtaCnf() {
|
|
||||||
return qtaCnf;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQtaCnf(BigDecimal qtaCnf) {
|
|
||||||
this.qtaCnf = qtaCnf;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPartitaMag() {
|
public String getPartitaMag() {
|
||||||
return partitaMag;
|
return partitaMag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPartitaMag(String partitaMag) {
|
public OrdineLavorazioneDTO setPartitaMag(String partitaMag) {
|
||||||
this.partitaMag = partitaMag;
|
this.partitaMag = partitaMag;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataScad() {
|
public Date getDataScad() {
|
||||||
return dataScad;
|
return dataScad;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDataScad(Date dataScad) {
|
public OrdineLavorazioneDTO setDataScad(Date dataScad) {
|
||||||
this.dataScad = dataScad;
|
this.dataScad = dataScad;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPartitaMagSuggested() {
|
public String getPartitaMagSuggested() {
|
||||||
return partitaMagSuggested;
|
return partitaMagSuggested;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPartitaMagSuggested(String partitaMagSuggested) {
|
public OrdineLavorazioneDTO setPartitaMagSuggested(String partitaMagSuggested) {
|
||||||
this.partitaMagSuggested = partitaMagSuggested;
|
this.partitaMagSuggested = partitaMagSuggested;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataScadSuggested() {
|
public Date getDataScadSuggested() {
|
||||||
return dataScadSuggested;
|
return dataScadSuggested;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDataScadSuggested(Date dataScadSuggested) {
|
public OrdineLavorazioneDTO setDataScadSuggested(Date dataScadSuggested) {
|
||||||
this.dataScadSuggested = dataScadSuggested;
|
this.dataScadSuggested = dataScadSuggested;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCodProd() {
|
public String getCodProd() {
|
||||||
return codProd;
|
return codProd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCodProd(String codProd) {
|
public OrdineLavorazioneDTO setCodProd(String codProd) {
|
||||||
this.codProd = codProd;
|
this.codProd = codProd;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getMaxStep() {
|
||||||
|
return maxStep;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setMaxStep(Integer maxStep) {
|
||||||
|
this.maxStep = maxStep;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataInizProd() {
|
public Date getDataInizProd() {
|
||||||
return dataInizProd;
|
return dataInizProd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDataInizProd(Date dataInizProd) {
|
public OrdineLavorazioneDTO setDataInizProd(Date dataInizProd) {
|
||||||
this.dataInizProd = dataInizProd;
|
this.dataInizProd = dataInizProd;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataIniz() {
|
||||||
|
return dataIniz;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setDataIniz(Date dataIniz) {
|
||||||
|
this.dataIniz = dataIniz;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataFine() {
|
||||||
|
return dataFine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setDataFine(Date dataFine) {
|
||||||
|
this.dataFine = dataFine;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQtaProd() {
|
||||||
|
return qtaProd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setQtaProd(BigDecimal qtaProd) {
|
||||||
|
this.qtaProd = qtaProd;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQtaLav() {
|
||||||
|
return qtaLav;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setQtaLav(BigDecimal qtaLav) {
|
||||||
|
this.qtaLav = qtaLav;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNumFase() {
|
||||||
|
return numFase;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setNumFase(int numFase) {
|
||||||
|
this.numFase = numFase;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxFase() {
|
||||||
|
return maxFase;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setMaxFase(int maxFase) {
|
||||||
|
this.maxFase = maxFase;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQtaTrasferite() {
|
||||||
|
return qtaTrasferite;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setQtaTrasferite(BigDecimal qtaTrasferite) {
|
||||||
|
this.qtaTrasferite = qtaTrasferite;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQtaBatchProd() {
|
||||||
|
return qtaBatchProd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setQtaBatchProd(BigDecimal qtaBatchProd) {
|
||||||
|
this.qtaBatchProd = qtaBatchProd;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUntMisProd() {
|
||||||
|
return untMisProd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setUntMisProd(String untMisProd) {
|
||||||
|
this.untMisProd = untMisProd;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getRapConvProd() {
|
||||||
|
return rapConvProd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setRapConvProd(BigDecimal rapConvProd) {
|
||||||
|
this.rapConvProd = rapConvProd;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getPzTrasferiti() {
|
||||||
|
return pzTrasferiti;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setPzTrasferiti(BigDecimal pzTrasferiti) {
|
||||||
|
this.pzTrasferiti = pzTrasferiti;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getUdcTrasferiti() {
|
||||||
|
return udcTrasferiti;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setUdcTrasferiti(BigDecimal udcTrasferiti) {
|
||||||
|
this.udcTrasferiti = udcTrasferiti;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStato() {
|
||||||
|
return stato;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setStato(String stato) {
|
||||||
|
this.stato = stato;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCodTcolUl() {
|
public String getCodTcolUl() {
|
||||||
return codTcolUl;
|
return codTcolUl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCodTcolUl(String codTcolUl) {
|
public OrdineLavorazioneDTO setCodTcolUl(String codTcolUl) {
|
||||||
this.codTcolUl = codTcolUl;
|
this.codTcolUl = codTcolUl;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCodAnag() {
|
public String getCodAnag() {
|
||||||
return codAnag;
|
return codAnag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCodAnag(String codAnag) {
|
public OrdineLavorazioneDTO setCodAnag(String codAnag) {
|
||||||
this.codAnag = codAnag;
|
this.codAnag = codAnag;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRagSocAnag() {
|
public String getRagSocAnag() {
|
||||||
return ragSocAnag;
|
return ragSocAnag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRagSocAnag(String ragSocAnag) {
|
public OrdineLavorazioneDTO setRagSocAnag(String ragSocAnag) {
|
||||||
this.ragSocAnag = ragSocAnag;
|
this.ragSocAnag = ragSocAnag;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPartIva() {
|
||||||
|
return partIva;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setPartIva(String partIva) {
|
||||||
|
this.partIva = partIva;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRifOrd() {
|
public String getRifOrd() {
|
||||||
return rifOrd;
|
return rifOrd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRifOrd(String rifOrd) {
|
public OrdineLavorazioneDTO setRifOrd(String rifOrd) {
|
||||||
this.rifOrd = rifOrd;
|
this.rifOrd = rifOrd;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCodVdes() {
|
public String getCodVdes() {
|
||||||
return codVdes;
|
return codVdes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCodVdes(String codVdes) {
|
public OrdineLavorazioneDTO setCodVdes(String codVdes) {
|
||||||
this.codVdes = codVdes;
|
this.codVdes = codVdes;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCodMdep() {
|
public String getCodMdep() {
|
||||||
return codMdep;
|
return codMdep;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCodMdep(String codMdep) {
|
public OrdineLavorazioneDTO setCodMdep(String codMdep) {
|
||||||
this.codMdep = codMdep;
|
this.codMdep = codMdep;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodMdepProd() {
|
||||||
|
return codMdepProd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setCodMdepProd(String codMdepProd) {
|
||||||
|
this.codMdepProd = codMdepProd;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCodJcom() {
|
public String getCodJcom() {
|
||||||
return codJcom;
|
return codJcom;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCodJcom(String codJcom) {
|
public OrdineLavorazioneDTO setCodJcom(String codJcom) {
|
||||||
this.codJcom = codJcom;
|
this.codJcom = codJcom;
|
||||||
}
|
return this;
|
||||||
|
|
||||||
public BigDecimal getColliPedana() {
|
|
||||||
return colliPedana;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setColliPedana(BigDecimal colliPedana) {
|
|
||||||
this.colliPedana = colliPedana;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getTempoTrascorso() {
|
|
||||||
return tempoTrascorso;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTempoTrascorso(BigDecimal tempoTrascorso) {
|
|
||||||
this.tempoTrascorso = tempoTrascorso;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescCommessa() {
|
|
||||||
return descCommessa;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescCommessa(String descCommessa) {
|
|
||||||
this.descCommessa = descCommessa;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getProdStd() {
|
|
||||||
return prodStd;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProdStd(BigDecimal prodStd) {
|
|
||||||
this.prodStd = prodStd;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFlagAvviabile() {
|
|
||||||
return flagAvviabile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFlagAvviabile(String flagAvviabile) {
|
|
||||||
this.flagAvviabile = flagAvviabile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getNumPezzi() {
|
|
||||||
return numPezzi;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNumPezzi(BigDecimal numPezzi) {
|
|
||||||
this.numPezzi = numPezzi;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getNumPedane() {
|
|
||||||
return numPedane;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNumPedane(BigDecimal numPedane) {
|
|
||||||
this.numPedane = numPedane;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getMtbColtToEdit() {
|
|
||||||
return mtbColtToEdit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMtbColtToEdit(Object mtbColtToEdit) {
|
|
||||||
this.mtbColtToEdit = mtbColtToEdit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getGgScadPartita() {
|
|
||||||
return ggScadPartita;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGgScadPartita(Integer ggScadPartita) {
|
|
||||||
this.ggScadPartita = ggScadPartita;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNoteLav() {
|
public String getNoteLav() {
|
||||||
return noteLav;
|
return noteLav;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNoteLav(String noteLav) {
|
public OrdineLavorazioneDTO setNoteLav(String noteLav) {
|
||||||
this.noteLav = noteLav;
|
this.noteLav = noteLav;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getTempoTrascorso() {
|
||||||
|
return tempoTrascorso;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setTempoTrascorso(BigDecimal tempoTrascorso) {
|
||||||
|
this.tempoTrascorso = tempoTrascorso;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescCommessa() {
|
||||||
|
return descCommessa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setDescCommessa(String descCommessa) {
|
||||||
|
this.descCommessa = descCommessa;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getProdStd() {
|
||||||
|
return prodStd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setProdStd(BigDecimal prodStd) {
|
||||||
|
this.prodStd = prodStd;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getMtbColtToEdit() {
|
||||||
|
return mtbColtToEdit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdineLavorazioneDTO setMtbColtToEdit(Object mtbColtToEdit) {
|
||||||
|
this.mtbColtToEdit = mtbColtToEdit;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getHrNum() {
|
public int getHrNum() {
|
||||||
return hrNum;
|
return hrNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHrNum(int hrNum) {
|
public OrdineLavorazioneDTO setHrNum(int hrNum) {
|
||||||
this.hrNum = hrNum;
|
this.hrNum = hrNum;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescrizioneAttivita() {
|
public String getDescrizioneAttivita() {
|
||||||
@@ -768,60 +950,13 @@ public class OrdineLavorazioneDTO {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getQtaBatchProd() {
|
public String getNoteStep() {
|
||||||
return qtaBatchProd;
|
return noteStep;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setQtaBatchProd(BigDecimal qtaBatchProd) {
|
public OrdineLavorazioneDTO setNoteStep(String noteStep) {
|
||||||
this.qtaBatchProd = qtaBatchProd;
|
this.noteStep = noteStep;
|
||||||
}
|
return this;
|
||||||
|
|
||||||
public String getUntOrd2() {
|
|
||||||
return untOrd2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUntOrd2(String untOrd2) {
|
|
||||||
this.untOrd2 = untOrd2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getRapConv2() {
|
|
||||||
return rapConv2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRapConv2(BigDecimal rapConv2) {
|
|
||||||
this.rapConv2 = rapConv2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUntOrd3() {
|
|
||||||
return untOrd3;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUntOrd3(String untOrd3) {
|
|
||||||
this.untOrd3 = untOrd3;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getRapConv3() {
|
|
||||||
return rapConv3;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRapConv3(BigDecimal rapConv3) {
|
|
||||||
this.rapConv3 = rapConv3;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUntMisProd() {
|
|
||||||
return untMisProd;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUntMisProd(String untMisProd) {
|
|
||||||
this.untMisProd = untMisProd;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getRapConvProd() {
|
|
||||||
return rapConvProd;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRapConvProd(BigDecimal rapConvProd) {
|
|
||||||
this.rapConvProd = rapConvProd;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescrizioneTcol() {
|
public String getDescrizioneTcol() {
|
||||||
@@ -878,33 +1013,6 @@ public class OrdineLavorazioneDTO {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataConsCommessa() {
|
|
||||||
return dataConsCommessa;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrdineLavorazioneDTO setDataConsCommessa(Date dataConsCommessa) {
|
|
||||||
this.dataConsCommessa = dataConsCommessa;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNoteStep() {
|
|
||||||
return noteStep;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrdineLavorazioneDTO setNoteStep(String noteStep) {
|
|
||||||
this.noteStep = noteStep;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFlagTracciabilita() {
|
|
||||||
return flagTracciabilita;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrdineLavorazioneDTO setFlagTracciabilita(String flagTracciabilita) {
|
|
||||||
this.flagTracciabilita = flagTracciabilita;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getDataConsProdMax() {
|
public Date getDataConsProdMax() {
|
||||||
return dataConsProdMax;
|
return dataConsProdMax;
|
||||||
}
|
}
|
||||||
@@ -936,30 +1044,8 @@ public class OrdineLavorazioneDTO {
|
|||||||
return pesoKg;
|
return pesoKg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getQtaLav() {
|
public OrdineLavorazioneDTO setPesoKg(BigDecimal pesoKg) {
|
||||||
return qtaLav;
|
this.pesoKg = pesoKg;
|
||||||
}
|
|
||||||
|
|
||||||
public OrdineLavorazioneDTO setQtaLav(BigDecimal qtaLav) {
|
|
||||||
this.qtaLav = qtaLav;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getNumFase() {
|
|
||||||
return numFase;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrdineLavorazioneDTO setNumFase(int numFase) {
|
|
||||||
this.numFase = numFase;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMaxFase() {
|
|
||||||
return maxFase;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrdineLavorazioneDTO setMaxFase(int maxFase) {
|
|
||||||
this.maxFase = maxFase;
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package it.integry.ems.production.service;
|
package it.integry.ems.production.service;
|
||||||
|
|
||||||
|
import com.annimon.stream.Collectors;
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
@@ -15,6 +16,7 @@ import it.integry.ems.exception.PrimaryDatabaseNotPresentException;
|
|||||||
import it.integry.ems.production.dto.*;
|
import it.integry.ems.production.dto.*;
|
||||||
import it.integry.ems.report.dto.JasperDTO;
|
import it.integry.ems.report.dto.JasperDTO;
|
||||||
import it.integry.ems.report.dto.PairsDTO;
|
import it.integry.ems.report.dto.PairsDTO;
|
||||||
|
import it.integry.ems.rules.completing.DocumentRules;
|
||||||
import it.integry.ems.service.*;
|
import it.integry.ems.service.*;
|
||||||
import it.integry.ems.service.dto.MailTemplateDataDTO;
|
import it.integry.ems.service.dto.MailTemplateDataDTO;
|
||||||
import it.integry.ems.service.exception.EmptyReportException;
|
import it.integry.ems.service.exception.EmptyReportException;
|
||||||
@@ -1290,8 +1292,8 @@ public class MesProductionServiceV2 {
|
|||||||
String codDtipRien = setupGest.getSetup("W_PORDI_RC", "SETUP_DOCUMENTI", "COD_DTIP_RIEN");
|
String codDtipRien = setupGest.getSetup("W_PORDI_RC", "SETUP_DOCUMENTI", "COD_DTIP_RIEN");
|
||||||
|
|
||||||
if (ordine.getNumFase() == ordine.getMaxFase()) {
|
if (ordine.getNumFase() == ordine.getMaxFase()) {
|
||||||
String codDtipCar = setupGest.getSetup("W_PORDI_RC", "SETUP_DOCUMENTI", "COD_DTIP_CAR");
|
Azienda azienda = Azienda.getDefaultAzienda(multiDBTransactionManager.getPrimaryConnection());
|
||||||
String codMdepCar = setupGest.getSetup("W_PORDI_RC", "SETUP_DOCUMENTI", "COD_MDEP_CAR");
|
boolean isTerzista = !ordine.getPartIva().equalsIgnoreCase(azienda.getPartIva());
|
||||||
|
|
||||||
ChiusuraLavorazioneDTO dto = new ChiusuraLavorazioneDTO();
|
ChiusuraLavorazioneDTO dto = new ChiusuraLavorazioneDTO();
|
||||||
|
|
||||||
@@ -1302,36 +1304,81 @@ public class MesProductionServiceV2 {
|
|||||||
.setUntMisProd(ordine.getUntMisProd())
|
.setUntMisProd(ordine.getUntMisProd())
|
||||||
.setRapConvProd(ordine.getRapConvProd())
|
.setRapConvProd(ordine.getRapConvProd())
|
||||||
.setCodJfas(groupStepDTO.getCodJfas())
|
.setCodJfas(groupStepDTO.getCodJfas())
|
||||||
.setEffettuaCarico(true)
|
|
||||||
.setEffettuaScarico(true)
|
|
||||||
.setChiudiOrdine(groupStepDTO.getTerminaLavorazione().equalsIgnoreCase("S"))
|
.setChiudiOrdine(groupStepDTO.getTerminaLavorazione().equalsIgnoreCase("S"))
|
||||||
.setTerminaLavorazioneLinea(groupStepDTO.getTerminaLavorazioneLinea().equalsIgnoreCase("S"))
|
.setTerminaLavorazioneLinea(groupStepDTO.getTerminaLavorazioneLinea().equalsIgnoreCase("S"))
|
||||||
.setSalvaDocumenti(false);
|
.setSalvaDocumenti(false);
|
||||||
|
|
||||||
CaricoLavorazioneDTO dtoCarico = new CaricoLavorazioneDTO();
|
CaricoLavorazioneDTO dtoCarico = new CaricoLavorazioneDTO();
|
||||||
|
|
||||||
|
String codDtipCar;
|
||||||
|
|
||||||
|
if (isTerzista) {
|
||||||
|
codDtipCar = setupGest.getSetup("DATI_AZIENDA", "CONTO_LAVORO", "COD_DTIP_CLAV");
|
||||||
|
} else {
|
||||||
|
codDtipCar = setupGest.getSetup("W_PORDI_RC", "SETUP_DOCUMENTI", "COD_DTIP_CAR");
|
||||||
|
}
|
||||||
|
|
||||||
dtoCarico
|
dtoCarico
|
||||||
.setCodDtip(codDtipCar)
|
.setCodDtip(codDtipCar)
|
||||||
.setQtaProd(ordine.getQtaTrasferite())
|
.setQtaProd(ordine.getQtaTrasferite())
|
||||||
.setCaricoDaCollo(true)
|
.setCaricoDaCollo(true)
|
||||||
.setCodMdep(codMdepCar)
|
.setCodMdep(ordine.getCodMdepProd())
|
||||||
.setCodAnag(ordine.getCodAnag());
|
.setCodAnag(ordine.getCodAnag());
|
||||||
|
|
||||||
ScaricoLavorazioneDTO dtoScarico = new ScaricoLavorazioneDTO();
|
dto
|
||||||
|
.setEffettuaCarico(true)
|
||||||
|
.setCaricoLavorazioneDTO(dtoCarico);
|
||||||
|
|
||||||
dtoScarico
|
if (isTerzista) {
|
||||||
.setCodDtip(codDtipScar)
|
String query = Query.format(
|
||||||
.setCodMdep(ordine.getCodMdep())
|
"SELECT DISTINCT mtb_colt.gestione,\n" +
|
||||||
.setCodAnag(ordine.getCodAnag())
|
" mtb_colt.data_collo,\n" +
|
||||||
.setQtaProd(ordine.getQtaTrasferite());
|
" mtb_colt.ser_collo,\n" +
|
||||||
|
" mtb_colt.num_collo\n" +
|
||||||
|
"FROM mtb_colt,\n" +
|
||||||
|
" mtb_colr\n" +
|
||||||
|
"WHERE mtb_colt.id_lotto = %s\n" +
|
||||||
|
" AND mtb_colt.cod_dtip IS NULL\n" +
|
||||||
|
" AND mtb_colt.segno = -1\n" +
|
||||||
|
" AND mtb_colt.gestione = mtb_colr.gestione\n" +
|
||||||
|
" AND mtb_colt.data_collo = mtb_colr.data_collo\n" +
|
||||||
|
" AND mtb_colt.ser_collo = mtb_colr.ser_collo\n" +
|
||||||
|
" AND mtb_colt.num_collo = mtb_colr.num_collo\n" +
|
||||||
|
"ORDER BY 1, 2, 3, 4",
|
||||||
|
ordine.getIdLotto()
|
||||||
|
);
|
||||||
|
|
||||||
|
List<MtbColt> colliNonAgganciati = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), query, MtbColt.class);
|
||||||
|
|
||||||
|
if (!UtilityList.isNullOrEmpty(colliNonAgganciati)) {
|
||||||
|
throw new Exception(String.format(
|
||||||
|
"Ci sono colli non agganciati a documenti:\n%s",
|
||||||
|
Stream.of(colliNonAgganciati)
|
||||||
|
.map(collo -> String.format("Collo N. %d del %s", collo.getNumCollo(), UtilityLocalDate.formatDate(collo.getDataCollo(), "dd/MM/yyyy")))
|
||||||
|
.collect(Collectors.joining("\n"))
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
dto.setEffettuaScarico(false);
|
||||||
|
} else {
|
||||||
|
ScaricoLavorazioneDTO dtoScarico = new ScaricoLavorazioneDTO();
|
||||||
|
|
||||||
|
dtoScarico
|
||||||
|
.setCodDtip(codDtipScar)
|
||||||
|
.setCodMdep(ordine.getCodMdep())
|
||||||
|
.setCodAnag(ordine.getCodAnag())
|
||||||
|
.setQtaProd(ordine.getQtaTrasferite());
|
||||||
|
|
||||||
|
dto
|
||||||
|
.setEffettuaScarico(true)
|
||||||
|
.setScaricoLavorazioneDTO(dtoScarico);
|
||||||
|
}
|
||||||
|
|
||||||
RientroLavorazioneDTO dtoRientro = new RientroLavorazioneDTO()
|
RientroLavorazioneDTO dtoRientro = new RientroLavorazioneDTO()
|
||||||
.setCodDtip(codDtipRien)
|
.setCodDtip(codDtipRien)
|
||||||
.setCodMdep(ordine.getCodMdep())
|
.setCodMdep(ordine.getCodMdepProd())
|
||||||
.setCodAnag(ordine.getCodAnag());
|
.setCodAnag(ordine.getCodAnag());
|
||||||
|
|
||||||
dto.setCaricoLavorazioneDTO(dtoCarico);
|
|
||||||
dto.setScaricoLavorazioneDTO(dtoScarico);
|
|
||||||
dto.setRientroLavorazioneDTO(dtoRientro);
|
dto.setRientroLavorazioneDTO(dtoRientro);
|
||||||
|
|
||||||
entitiesToSave.addAll(productionService.chiudiOrdineLotto(dto));
|
entitiesToSave.addAll(productionService.chiudiOrdineLotto(dto));
|
||||||
@@ -1358,7 +1405,6 @@ public class MesProductionServiceV2 {
|
|||||||
.setRapConvProd(ordine.getRapConvProd())
|
.setRapConvProd(ordine.getRapConvProd())
|
||||||
.setCodJfas(groupStepDTO.getCodJfas())
|
.setCodJfas(groupStepDTO.getCodJfas())
|
||||||
.setEffettuaCarico(false)
|
.setEffettuaCarico(false)
|
||||||
.setEffettuaScarico(true)
|
|
||||||
.setChiudiOrdine(false)
|
.setChiudiOrdine(false)
|
||||||
.setTerminaLavorazioneLinea(false)
|
.setTerminaLavorazioneLinea(false)
|
||||||
.setSalvaDocumenti(false);
|
.setSalvaDocumenti(false);
|
||||||
@@ -1371,12 +1417,15 @@ public class MesProductionServiceV2 {
|
|||||||
.setCodAnag(ordine.getCodAnag())
|
.setCodAnag(ordine.getCodAnag())
|
||||||
.setQtaProd(ordine.getQtaTrasferite());
|
.setQtaProd(ordine.getQtaTrasferite());
|
||||||
|
|
||||||
|
dto
|
||||||
|
.setEffettuaScarico(true)
|
||||||
|
.setScaricoLavorazioneDTO(dtoScarico);
|
||||||
|
|
||||||
RientroLavorazioneDTO dtoRientro = new RientroLavorazioneDTO()
|
RientroLavorazioneDTO dtoRientro = new RientroLavorazioneDTO()
|
||||||
.setCodDtip(codDtipRien)
|
.setCodDtip(codDtipRien)
|
||||||
.setCodMdep(ordine.getCodMdep())
|
.setCodMdep(ordine.getCodMdep())
|
||||||
.setCodAnag(ordine.getCodAnag());
|
.setCodAnag(ordine.getCodAnag());
|
||||||
|
|
||||||
dto.setScaricoLavorazioneDTO(dtoScarico);
|
|
||||||
dto.setRientroLavorazioneDTO(dtoRientro);
|
dto.setRientroLavorazioneDTO(dtoRientro);
|
||||||
|
|
||||||
entitiesToSave.addAll(productionService.chiudiOrdineLotto(dto));
|
entitiesToSave.addAll(productionService.chiudiOrdineLotto(dto));
|
||||||
@@ -1460,7 +1509,7 @@ public class MesProductionServiceV2 {
|
|||||||
.setMtbColr(new ArrayList<>())
|
.setMtbColr(new ArrayList<>())
|
||||||
.setGestione("L")
|
.setGestione("L")
|
||||||
.setSegno(1)
|
.setSegno(1)
|
||||||
.setCodMdep(ordineLav.getCodMdep())
|
.setCodMdep(ordineLav.getCodMdepProd())
|
||||||
.setCodJfas(ordineLav.getCodJfas())
|
.setCodJfas(ordineLav.getCodJfas())
|
||||||
.setCodAnag(ordineLav.getCodAnag())
|
.setCodAnag(ordineLav.getCodAnag())
|
||||||
.setPosizione(ordineLav.getCodJfas())
|
.setPosizione(ordineLav.getCodJfas())
|
||||||
@@ -1521,6 +1570,31 @@ public class MesProductionServiceV2 {
|
|||||||
return mtbColtToInsert;
|
return mtbColtToInsert;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<DtbDoct> creaDocumentoContoTerzi(ChiusuraLavorazioneDTO dtoChiusura) throws Exception {
|
||||||
|
ScaricoLavorazioneDTO scaricoDto = dtoChiusura.getScaricoLavorazioneDTO();
|
||||||
|
|
||||||
|
if (scaricoDto.getCodDtip() == null) {
|
||||||
|
String codDtipScar = setupGest.getSetup("DATI_AZIENDA", "CONTO_LAVORO", "COD_DTIP_SLAV");
|
||||||
|
|
||||||
|
scaricoDto.setCodDtip(codDtipScar);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scaricoDto.getSerDoc() == null) {
|
||||||
|
scaricoDto.setSerDoc(DocumentRules.getSerDoc(multiDBTransactionManager.getPrimaryConnection(), scaricoDto.getCodDtip(), scaricoDto.getCodMdep(), scaricoDto.getDataDoc()));
|
||||||
|
}
|
||||||
|
|
||||||
|
List<DtbDoct> listDocs = documentProdService.generaDocScaricoDaColliIdLotto(dtoChiusura);
|
||||||
|
|
||||||
|
entityProcessor.processEntityList(listDocs, true);
|
||||||
|
|
||||||
|
listDocs.forEach(doc -> {
|
||||||
|
doc.setOperation(OperationType.SELECT_OBJECT);
|
||||||
|
doc.setOnlyPkMaster(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
return listDocs;
|
||||||
|
}
|
||||||
|
|
||||||
private JsonNode completeBodyData(JsonNode data) {
|
private JsonNode completeBodyData(JsonNode data) {
|
||||||
|
|
||||||
if (data.has("dataOrd")) {
|
if (data.has("dataOrd")) {
|
||||||
@@ -1541,7 +1615,7 @@ public class MesProductionServiceV2 {
|
|||||||
" dtb_ordt.num_ord = drl_ord_attached.num_ord\n" +
|
" dtb_ordt.num_ord = drl_ord_attached.num_ord\n" +
|
||||||
" INNER JOIN stb_files_attached ON drl_ord_attached.id_attach = stb_files_attached.id_attach\n" +
|
" INNER JOIN stb_files_attached ON drl_ord_attached.id_attach = stb_files_attached.id_attach\n" +
|
||||||
"WHERE jtb_lott.cod_jfas = " + UtilityDB.valueToString(codJfas) + "\n" +
|
"WHERE jtb_lott.cod_jfas = " + UtilityDB.valueToString(codJfas) + "\n" +
|
||||||
" AND jtb_lott.id_lotto = " + UtilityDB.valueToString(idLotto) + "";
|
" AND jtb_lott.id_lotto = " + UtilityDB.valueToString(idLotto);
|
||||||
|
|
||||||
return UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, AttachmentDTO.class);
|
return UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, AttachmentDTO.class);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,16 +47,6 @@ public class MrpConsumiHandlerService {
|
|||||||
looperService.add(() -> this.internalCacheConsumi(consumiCachedData), (UtilityDebug.isDebugExecution()?5:1) * 60 * 1000, MrpConsumiHandlerService.class.getName());
|
looperService.add(() -> this.internalCacheConsumi(consumiCachedData), (UtilityDebug.isDebugExecution()?5:1) * 60 * 1000, MrpConsumiHandlerService.class.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (UtilityDebug.isIntegryServer()) {
|
|
||||||
looperService.add(() -> {
|
|
||||||
try {
|
|
||||||
loadConsumi( "biolevante", "BIOLEVANTE", consumiCachedData);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}, 5 * 1000, ProductionOrderDataHandlerService.class.getName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean saveCache(){
|
private boolean saveCache(){
|
||||||
@@ -250,7 +240,7 @@ public class MrpConsumiHandlerService {
|
|||||||
public Map<String, List<MRPDailyConsumiDTO>> getConsumi() throws Exception {
|
public Map<String, List<MRPDailyConsumiDTO>> getConsumi() throws Exception {
|
||||||
MultiDBTransactionManager multiDBTransactionManager = ContextLoader.getCurrentWebApplicationContext().getBean(MultiDBTransactionManager.class);
|
MultiDBTransactionManager multiDBTransactionManager = ContextLoader.getCurrentWebApplicationContext().getBean(MultiDBTransactionManager.class);
|
||||||
|
|
||||||
if (!saveCache() && !multiDBTransactionManager.getPrimaryDatasource().getDbName().equalsIgnoreCase("biolevante")) {
|
if (!saveCache()) {
|
||||||
return getConsumi(multiDBTransactionManager);
|
return getConsumi(multiDBTransactionManager);
|
||||||
} else {
|
} else {
|
||||||
HashMap<String, HashMap<String, Map<String, List<MRPDailyConsumiDTO>>>> inputMap = consumiCachedData;
|
HashMap<String, HashMap<String, Map<String, List<MRPDailyConsumiDTO>>>> inputMap = consumiCachedData;
|
||||||
|
|||||||
@@ -52,15 +52,7 @@ public class ProductionOrderDataHandlerService {
|
|||||||
looperService.add(() -> this.internalCacheOrdiniLavorazione(true, inevasiOrdersCachedData), 5 * 1000, ProductionOrderDataHandlerService.class.getName());
|
looperService.add(() -> this.internalCacheOrdiniLavorazione(true, inevasiOrdersCachedData), 5 * 1000, ProductionOrderDataHandlerService.class.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UtilityDebug.isIntegryServer()) {
|
|
||||||
looperService.add(() -> {
|
|
||||||
try {
|
|
||||||
loadOrdiniProfile(false, "biolevante", "BIOLEVANTE", inevasiOrdersCachedData);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}, 5 * 1000, ProductionOrderDataHandlerService.class.getName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -152,7 +144,7 @@ public class ProductionOrderDataHandlerService {
|
|||||||
MultiDBTransactionManager multiDBTransactionManager = ContextLoader.getCurrentWebApplicationContext().getBean(MultiDBTransactionManager.class);
|
MultiDBTransactionManager multiDBTransactionManager = ContextLoader.getCurrentWebApplicationContext().getBean(MultiDBTransactionManager.class);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
((UtilityDebug.isIntegryServer() || UtilityDebug.isDebugExecution()) && !multiDBTransactionManager.getPrimaryDatasource().getDbName().equalsIgnoreCase("biolevante")) ||
|
UtilityDebug.isIntegryServer() || UtilityDebug.isDebugExecution() ||
|
||||||
UtilityString.isNullOrEmpty(flagEvaso)
|
UtilityString.isNullOrEmpty(flagEvaso)
|
||||||
|| !flagEvaso.equalsIgnoreCase("I")
|
|| !flagEvaso.equalsIgnoreCase("I")
|
||||||
|| !isMESEnabled(multiDBTransactionManager)) {
|
|| !isMESEnabled(multiDBTransactionManager)) {
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class ReceiptsParser implements IReceiptsParser {
|
|||||||
String flagTrans = head[9];
|
String flagTrans = head[9];
|
||||||
|
|
||||||
if (("IS").equals(flagTrans) || ("EP").equals(flagTrans) ||
|
if (("IS").equals(flagTrans) || ("EP").equals(flagTrans) ||
|
||||||
("UP").equals(flagTrans) || ("UC").equals(flagTrans)) {
|
("UP").equals(flagTrans) || flagTrans.startsWith("UC")) {
|
||||||
|
|
||||||
String dataString = head[10].substring(0, 10) + " " + head[17];
|
String dataString = head[10].substring(0, 10) + " " + head[17];
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ public class ReceiptsParser implements IReceiptsParser {
|
|||||||
throw new Exception("Formato data errato " + dataString);
|
throw new Exception("Formato data errato " + dataString);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("UC".equals(flagTrans)) {
|
if (flagTrans.startsWith("UC")) {
|
||||||
if (receipts == null || receipts.getDataDoc() == null || !receipts.getDataDoc().equals(date)) {
|
if (receipts == null || receipts.getDataDoc() == null || !receipts.getDataDoc().equals(date)) {
|
||||||
receipts = new NtbDoct();
|
receipts = new NtbDoct();
|
||||||
receipts.setOperation(OperationType.INSERT);
|
receipts.setOperation(OperationType.INSERT);
|
||||||
@@ -89,7 +89,7 @@ public class ReceiptsParser implements IReceiptsParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String causale = "";
|
String causale = "";
|
||||||
if (("UC").equals(flagTrans)) {
|
if (flagTrans.startsWith("UC")) {
|
||||||
// PRELIEVO/FONDOCASSA
|
// PRELIEVO/FONDOCASSA
|
||||||
causale = "C";
|
causale = "C";
|
||||||
} else if (("EP").equals(flagTrans) || ("UP").equals(flagTrans)) {
|
} else if (("EP").equals(flagTrans) || ("UP").equals(flagTrans)) {
|
||||||
@@ -132,7 +132,7 @@ public class ReceiptsParser implements IReceiptsParser {
|
|||||||
|
|
||||||
/*receipts = new NtbDoct();
|
/*receipts = new NtbDoct();
|
||||||
receipts.setOperation(OperationType.INSERT);*/
|
receipts.setOperation(OperationType.INSERT);*/
|
||||||
} else if (("UC").equals(flagTrans)) {
|
} else if (flagTrans.startsWith("UC")) {
|
||||||
if (receipts.getDataDoc() == null) {
|
if (receipts.getDataDoc() == null) {
|
||||||
receipts.setCodOper(head[3]);
|
receipts.setCodOper(head[3]);
|
||||||
receipts.setDataScontr(date);
|
receipts.setDataScontr(date);
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ import it.integry.ems.retail.wms.exceptions.InvalidArticoloException;
|
|||||||
import it.integry.ems.retail.wms.generic.dto.MvwSitArtUdcDetInventarioDTO;
|
import it.integry.ems.retail.wms.generic.dto.MvwSitArtUdcDetInventarioDTO;
|
||||||
import it.integry.ems.retail.wms.generic.dto.SpostaArtsTraULRequestDTO;
|
import it.integry.ems.retail.wms.generic.dto.SpostaArtsTraULRequestDTO;
|
||||||
import it.integry.ems.retail.wms.generic.service.WMSGenericService;
|
import it.integry.ems.retail.wms.generic.service.WMSGenericService;
|
||||||
import it.integry.ems.retail.wms.generic.service.WMSGiacenzaULService;
|
|
||||||
import it.integry.ems.retail.wms.lavorazione.service.WMSLavorazioneService;
|
import it.integry.ems.retail.wms.lavorazione.service.WMSLavorazioneService;
|
||||||
import it.integry.ems.rules.businessLogic.LoadColliService;
|
import it.integry.ems.rules.businessLogic.LoadColliService;
|
||||||
import it.integry.ems.rules.businessLogic.dto.LoadColliDTO;
|
import it.integry.ems.rules.businessLogic.dto.LoadColliDTO;
|
||||||
|
import it.integry.ems.service.AziendaService;
|
||||||
import it.integry.ems.service.EntityProcessor;
|
import it.integry.ems.service.EntityProcessor;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
import it.integry.ems.user.UserSession;
|
import it.integry.ems.user.UserSession;
|
||||||
@@ -68,15 +68,15 @@ public class WMSAccettazioneService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private LoadColliService loadColliService;
|
private LoadColliService loadColliService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private WMSGiacenzaULService wmsGiacenzaULService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProductServices productServices;
|
private ProductServices productServices;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserSession userSession;
|
private UserSession userSession;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AziendaService aziendaService;
|
||||||
|
|
||||||
public MtbColt createUDC(CreateUDCRequestDTO createUDCRequestDTO) throws Exception {
|
public MtbColt createUDC(CreateUDCRequestDTO createUDCRequestDTO) throws Exception {
|
||||||
if (!userSession.isAttivo()) {
|
if (!userSession.isAttivo()) {
|
||||||
throw new UsernameNotFoundException("Utente " + userSession.getUsername() + " non riconoscuto!");
|
throw new UsernameNotFoundException("Utente " + userSession.getUsername() + " non riconoscuto!");
|
||||||
@@ -154,7 +154,7 @@ public class WMSAccettazioneService {
|
|||||||
boolean useCodAnagAziendale = setupGest.getSetupBoolean("PICKING", "SETUP", "FLAG_USE_COD_ANAG_AZIENDALE");
|
boolean useCodAnagAziendale = setupGest.getSetupBoolean("PICKING", "SETUP", "FLAG_USE_COD_ANAG_AZIENDALE");
|
||||||
|
|
||||||
if (UtilityString.isNullOrEmpty(createUDCRequestDTO.getCodAnag()) && useCodAnagAziendale) {
|
if (UtilityString.isNullOrEmpty(createUDCRequestDTO.getCodAnag()) && useCodAnagAziendale) {
|
||||||
String defaultCodAnag = wmsGenericService.retrieveInternalCodAnagFornitore();
|
String defaultCodAnag = aziendaService.retrieveInternalCodAnagFornitore();
|
||||||
udcMtbColt.setCodAnag(defaultCodAnag);
|
udcMtbColt.setCodAnag(defaultCodAnag);
|
||||||
} else
|
} else
|
||||||
udcMtbColt.setCodAnag(createUDCRequestDTO.getCodAnag());
|
udcMtbColt.setCodAnag(createUDCRequestDTO.getCodAnag());
|
||||||
|
|||||||
@@ -2668,27 +2668,6 @@ public class WMSGenericService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String retrieveInternalCodAnagFornitore() throws Exception {
|
|
||||||
String internalCodAnagsQuery = "SELECT CAST(ga.cod_anag AS VARCHAR(5)) as cod_anag\n" +
|
|
||||||
"FROM azienda\n" +
|
|
||||||
"INNER JOIN gtb_anag ga on azienda.part_iva = ga.part_iva\n" +
|
|
||||||
"LEFT OUTER JOIN atb_forn af on ga.cod_anag = af.cod_anag AND af.flag_stato = 'A'\n" +
|
|
||||||
"WHERE af.cod_anag IS NOT NULL";
|
|
||||||
|
|
||||||
return UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), internalCodAnagsQuery);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String retrieveInternalCodAnagCliente() throws Exception {
|
|
||||||
String internalCodAnagsQuery = "SELECT CAST(ga.cod_anag AS VARCHAR(5)) as cod_anag\n" +
|
|
||||||
"FROM azienda\n" +
|
|
||||||
"INNER JOIN gtb_anag ga on azienda.part_iva = ga.part_iva\n" +
|
|
||||||
"LEFT OUTER JOIN vtb_clie vc on ga.cod_anag = vc.cod_anag AND vc.flag_stato = 'A'\n" +
|
|
||||||
"WHERE vc.cod_anag IS NOT NULL";
|
|
||||||
|
|
||||||
return UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), internalCodAnagsQuery);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public boolean canULBeDeleted(MtbColt mtbColt) throws Exception {
|
public boolean canULBeDeleted(MtbColt mtbColt) throws Exception {
|
||||||
HashMap<String, Object> params = new HashMap<>();
|
HashMap<String, Object> params = new HashMap<>();
|
||||||
params.put("mtb_colt.gestione", mtbColt.getGestione());
|
params.put("mtb_colt.gestione", mtbColt.getGestione());
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package it.integry.ems.retail.wms.imballi.service;
|
package it.integry.ems.retail.wms.imballi.service;
|
||||||
|
|
||||||
|
|
||||||
import it.integry.ems.retail.wms.generic.service.WMSGenericService;
|
|
||||||
import it.integry.ems.retail.wms.imballi.dto.ImballoQuantityDTO;
|
import it.integry.ems.retail.wms.imballi.dto.ImballoQuantityDTO;
|
||||||
|
import it.integry.ems.service.AziendaService;
|
||||||
import it.integry.ems.service.EntityProcessor;
|
import it.integry.ems.service.EntityProcessor;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
import it.integry.ems.user.UserSession;
|
import it.integry.ems.user.UserSession;
|
||||||
@@ -44,7 +44,7 @@ public class WMSImballiService {
|
|||||||
private UserSession userSession;
|
private UserSession userSession;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private WMSGenericService wmsGenericService;
|
private AziendaService aziendaService;
|
||||||
|
|
||||||
public List<MtbTcol> retrieveAvailableTipiCollo() throws Exception {
|
public List<MtbTcol> retrieveAvailableTipiCollo() throws Exception {
|
||||||
String query = "SELECT * FROM " + MtbTcol.ENTITY + " WHERE flag_UI_UL = 'UL'";
|
String query = "SELECT * FROM " + MtbTcol.ENTITY + " WHERE flag_UI_UL = 'UL'";
|
||||||
@@ -69,7 +69,7 @@ public class WMSImballiService {
|
|||||||
public void registraScarico(String codVvett, List<ImballoQuantityDTO> imballiToRegister) throws Exception {
|
public void registraScarico(String codVvett, List<ImballoQuantityDTO> imballiToRegister) throws Exception {
|
||||||
final String codDtip = setupGest.getSetup("PICKING", "IMBALLI", "COD_DTIP_SCARICO");
|
final String codDtip = setupGest.getSetup("PICKING", "IMBALLI", "COD_DTIP_SCARICO");
|
||||||
|
|
||||||
String codAnag = wmsGenericService.retrieveInternalCodAnagCliente();
|
String codAnag = aziendaService.retrieveInternalCodAnagCliente();
|
||||||
|
|
||||||
registraImballi(codAnag, codDtip, codVvett, imballiToRegister);
|
registraImballi(codAnag, codDtip, codVvett, imballiToRegister);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import it.integry.ems.retail.wms.exceptions.UDSQuantityOverflowException;
|
|||||||
import it.integry.ems.retail.wms.generic.dto.MvwSitArtUdcDetInventarioDTO;
|
import it.integry.ems.retail.wms.generic.dto.MvwSitArtUdcDetInventarioDTO;
|
||||||
import it.integry.ems.retail.wms.generic.service.WMSGenericService;
|
import it.integry.ems.retail.wms.generic.service.WMSGenericService;
|
||||||
import it.integry.ems.retail.wms.generic.service.WMSGiacenzaULService;
|
import it.integry.ems.retail.wms.generic.service.WMSGiacenzaULService;
|
||||||
|
import it.integry.ems.service.AziendaService;
|
||||||
import it.integry.ems.service.EntityProcessor;
|
import it.integry.ems.service.EntityProcessor;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
import it.integry.ems.user.UserSession;
|
import it.integry.ems.user.UserSession;
|
||||||
@@ -72,10 +73,13 @@ public class WMSLavorazioneService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SetupGest setupGest;
|
private SetupGest setupGest;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AziendaService aziendaService;
|
||||||
|
|
||||||
public MtbColt createUDS(CreateUDSRequestDTO createUDSRequestDTO) throws Exception {
|
public MtbColt createUDS(CreateUDSRequestDTO createUDSRequestDTO) throws Exception {
|
||||||
|
|
||||||
if (!userSession.isAttivo()) {
|
if (!userSession.isAttivo()) {
|
||||||
throw new UsernameNotFoundException("Utente " + userSession.getUsername() + " non riconoscuto!");
|
throw new UsernameNotFoundException("Utente " + userSession.getUsername() + " non riconosciuto!");
|
||||||
}
|
}
|
||||||
|
|
||||||
List<DtbOrdt> foundDtbOrdts = new ArrayList<>();
|
List<DtbOrdt> foundDtbOrdts = new ArrayList<>();
|
||||||
@@ -193,7 +197,7 @@ public class WMSLavorazioneService {
|
|||||||
|
|
||||||
public CloseUDSResponseDTO closeUDS(CloseUDSRequestDTO closeUDSRequestDTO) throws Exception {
|
public CloseUDSResponseDTO closeUDS(CloseUDSRequestDTO closeUDSRequestDTO) throws Exception {
|
||||||
if (!userSession.isAttivo()) {
|
if (!userSession.isAttivo()) {
|
||||||
throw new UsernameNotFoundException("Utente " + userSession.getUsername() + " non riconoscuto!");
|
throw new UsernameNotFoundException("Utente " + userSession.getUsername() + " non riconosciuto!");
|
||||||
}
|
}
|
||||||
|
|
||||||
MtbColt mtbColtToClose = closeUDSRequestDTO.getMtbColt();
|
MtbColt mtbColtToClose = closeUDSRequestDTO.getMtbColt();
|
||||||
@@ -226,7 +230,7 @@ public class WMSLavorazioneService {
|
|||||||
|
|
||||||
public InsertUDSRowResponseDTO insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO) throws Exception {
|
public InsertUDSRowResponseDTO insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO) throws Exception {
|
||||||
if (!userSession.isAttivo()) {
|
if (!userSession.isAttivo()) {
|
||||||
throw new UsernameNotFoundException("Utente " + userSession.getUsername() + " non riconoscuto!");
|
throw new UsernameNotFoundException("Utente " + userSession.getUsername() + " non riconosciuto!");
|
||||||
}
|
}
|
||||||
|
|
||||||
MtbColt targetMtbColt = insertUDSRowRequestDTO.getTargetMtbColt();
|
MtbColt targetMtbColt = insertUDSRowRequestDTO.getTargetMtbColt();
|
||||||
@@ -310,7 +314,7 @@ public class WMSLavorazioneService {
|
|||||||
|
|
||||||
public EditUDSRowResponseDTO editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO) throws Exception {
|
public EditUDSRowResponseDTO editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO) throws Exception {
|
||||||
if (!userSession.isAttivo()) {
|
if (!userSession.isAttivo()) {
|
||||||
throw new UsernameNotFoundException("Utente " + userSession.getUsername() + " non riconoscuto!");
|
throw new UsernameNotFoundException("Utente " + userSession.getUsername() + " non riconosciuto!");
|
||||||
}
|
}
|
||||||
|
|
||||||
MtbColr sourceMtbColr = editUDSRowRequestDTO.getSourceMtbColr();
|
MtbColr sourceMtbColr = editUDSRowRequestDTO.getSourceMtbColr();
|
||||||
@@ -436,7 +440,7 @@ public class WMSLavorazioneService {
|
|||||||
|
|
||||||
public void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO) throws Exception {
|
public void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO) throws Exception {
|
||||||
if (!userSession.isAttivo()) {
|
if (!userSession.isAttivo()) {
|
||||||
throw new UsernameNotFoundException("Utente " + userSession.getUsername() + " non riconoscuto!");
|
throw new UsernameNotFoundException("Utente " + userSession.getUsername() + " non riconosciuto!");
|
||||||
}
|
}
|
||||||
|
|
||||||
MtbColr mtbColrToDelete = deleteUDSRowRequestDTO.getMtbColrToDelete();
|
MtbColr mtbColrToDelete = deleteUDSRowRequestDTO.getMtbColrToDelete();
|
||||||
@@ -456,7 +460,7 @@ public class WMSLavorazioneService {
|
|||||||
|
|
||||||
public MtbColt createUDC(CreateUDCRequestDTO createUDCRequestDTO) throws Exception {
|
public MtbColt createUDC(CreateUDCRequestDTO createUDCRequestDTO) throws Exception {
|
||||||
if (!userSession.isAttivo()) {
|
if (!userSession.isAttivo()) {
|
||||||
throw new UsernameNotFoundException("Utente " + userSession.getUsername() + " non riconoscuto!");
|
throw new UsernameNotFoundException("Utente " + userSession.getUsername() + " non riconosciuto!");
|
||||||
}
|
}
|
||||||
|
|
||||||
String defaultPosizioneColliAccettazione = setupGest.getSetup("PICKING", "SETUP", "DEFAULT_POSIZIONE_COLLI_ACCETTAZIONE");
|
String defaultPosizioneColliAccettazione = setupGest.getSetup("PICKING", "SETUP", "DEFAULT_POSIZIONE_COLLI_ACCETTAZIONE");
|
||||||
@@ -529,7 +533,7 @@ public class WMSLavorazioneService {
|
|||||||
boolean useCodAnagAziendale = setupGest.getSetupBoolean("PICKING", "SETUP", "FLAG_USE_COD_ANAG_AZIENDALE");
|
boolean useCodAnagAziendale = setupGest.getSetupBoolean("PICKING", "SETUP", "FLAG_USE_COD_ANAG_AZIENDALE");
|
||||||
|
|
||||||
if (UtilityString.isNullOrEmpty(createUDCRequestDTO.getCodAnag()) && useCodAnagAziendale) {
|
if (UtilityString.isNullOrEmpty(createUDCRequestDTO.getCodAnag()) && useCodAnagAziendale) {
|
||||||
String defaultCodAnag = wmsGenericService.retrieveInternalCodAnagFornitore();
|
String defaultCodAnag = aziendaService.retrieveInternalCodAnagFornitore();
|
||||||
udcMtbColt.setCodAnag(defaultCodAnag);
|
udcMtbColt.setCodAnag(defaultCodAnag);
|
||||||
} else
|
} else
|
||||||
udcMtbColt.setCodAnag(createUDCRequestDTO.getCodAnag());
|
udcMtbColt.setCodAnag(createUDCRequestDTO.getCodAnag());
|
||||||
@@ -546,7 +550,7 @@ public class WMSLavorazioneService {
|
|||||||
|
|
||||||
public CloseUDCResponseDTO closeUDC(CloseUDCRequestDTO closeUDCRequestDTO) throws Exception {
|
public CloseUDCResponseDTO closeUDC(CloseUDCRequestDTO closeUDCRequestDTO) throws Exception {
|
||||||
if (!userSession.isAttivo()) {
|
if (!userSession.isAttivo()) {
|
||||||
throw new UsernameNotFoundException("Utente " + userSession.getUsername() + " non riconoscuto!");
|
throw new UsernameNotFoundException("Utente " + userSession.getUsername() + " non riconosciuto!");
|
||||||
}
|
}
|
||||||
|
|
||||||
MtbColt mtbColtToClose = closeUDCRequestDTO.getMtbColt();
|
MtbColt mtbColtToClose = closeUDCRequestDTO.getMtbColt();
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package it.integry.ems.system.controller;
|
||||||
|
|
||||||
|
import it.integry.ems.response.ServiceRestResponse;
|
||||||
|
import it.integry.ems.service.AziendaService;
|
||||||
|
import it.integry.ems.settings.Model.SettingsModel;
|
||||||
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
|
import it.integry.ems_model.entity.Azienda;
|
||||||
|
import it.integry.ems_model.types.OperationType;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@Scope("request")
|
||||||
|
@RequestMapping("azienda")
|
||||||
|
public class AziendaController {
|
||||||
|
@Autowired
|
||||||
|
private MultiDBTransactionManager multiDBTransactionManager;
|
||||||
|
@Autowired
|
||||||
|
private AziendaService aziendaService;
|
||||||
|
|
||||||
|
@GetMapping()
|
||||||
|
public ServiceRestResponse getAzienda() throws Exception {
|
||||||
|
Azienda defaultAzienda = Azienda.getDefaultAzienda(multiDBTransactionManager.getPrimaryConnection());
|
||||||
|
defaultAzienda.setOnlyPkMaster(false);
|
||||||
|
defaultAzienda.setOperation(OperationType.SELECT_OBJECT);
|
||||||
|
|
||||||
|
return ServiceRestResponse.createEntityPositiveResponse(defaultAzienda);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("fornitore")
|
||||||
|
public ServiceRestResponse retrieveInternalCodAnagFornitore() throws Exception {
|
||||||
|
return ServiceRestResponse.createPositiveResponse(aziendaService.retrieveInternalCodAnagFornitore());
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("cliente")
|
||||||
|
public ServiceRestResponse retrieveInternalCodAnagCliente() throws Exception {
|
||||||
|
return ServiceRestResponse.createPositiveResponse(aziendaService.retrieveInternalCodAnagCliente());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -769,7 +769,7 @@ public class SystemController {
|
|||||||
"from jtb_comt \n" +
|
"from jtb_comt \n" +
|
||||||
"inner join jrl_flav_users on jtb_comt.cod_jflav_tec = jrl_flav_users.cod_jflav and jrl_flav_users.flag_jflav_default = 's'\n" +
|
"inner join jrl_flav_users on jtb_comt.cod_jflav_tec = jrl_flav_users.cod_jflav and jrl_flav_users.flag_jflav_default = 's'\n" +
|
||||||
"inner join stb_user on jrl_flav_users.user_name =stb_user.user_name " +
|
"inner join stb_user on jrl_flav_users.user_name =stb_user.user_name " +
|
||||||
"where cod_jcom = %S + AND stb_user.user_name <> %S", activity.getCodJcom(), activity.getUserCreator()) ;
|
"where cod_jcom = %S ", activity.getCodJcom()) ;
|
||||||
String emailResponsabile = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), query);
|
String emailResponsabile = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), query);
|
||||||
|
|
||||||
if (!UtilityString.isNullOrEmpty(emailResponsabile) && !listEmailCcn.contains(emailResponsabile))
|
if (!UtilityString.isNullOrEmpty(emailResponsabile) && !listEmailCcn.contains(emailResponsabile))
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ public class ExchangeDocumentImportService {
|
|||||||
mtbColrLavTableName, Query.format("data_doc BETWEEN {} AND {}", minDate, maxDate), retrieveAlreadyImported);
|
mtbColrLavTableName, Query.format("data_doc BETWEEN {} AND {}", minDate, maxDate), retrieveAlreadyImported);
|
||||||
|
|
||||||
|
|
||||||
righe.parallelStream()
|
final List<DtbDoct> orphanTestateToAdd = righe.parallelStream()
|
||||||
.filter(riga ->
|
.filter(riga ->
|
||||||
testate.parallelStream()
|
testate.parallelStream()
|
||||||
.noneMatch(testata ->
|
.noneMatch(testata ->
|
||||||
@@ -208,7 +208,7 @@ public class ExchangeDocumentImportService {
|
|||||||
Objects.equals(riga.getDataDoc(), testata.getDataDoc()) &&
|
Objects.equals(riga.getDataDoc(), testata.getDataDoc()) &&
|
||||||
Objects.equals(riga.getNumDoc(), testata.getNumDoc()) &&
|
Objects.equals(riga.getNumDoc(), testata.getNumDoc()) &&
|
||||||
Objects.equals(riga.getSerDoc(), testata.getSerDoc()))))
|
Objects.equals(riga.getSerDoc(), testata.getSerDoc()))))
|
||||||
.forEach(riga -> {
|
.map(riga -> {
|
||||||
DtbDoct testata = new DtbDoct()
|
DtbDoct testata = new DtbDoct()
|
||||||
.setSerDoc(riga.getSerDoc())
|
.setSerDoc(riga.getSerDoc())
|
||||||
.setDataDoc(riga.getDataDoc())
|
.setDataDoc(riga.getDataDoc())
|
||||||
@@ -217,9 +217,12 @@ public class ExchangeDocumentImportService {
|
|||||||
.setCodAnag(riga.getCodAnag());
|
.setCodAnag(riga.getCodAnag());
|
||||||
|
|
||||||
testata.setOperation(OperationType.UPDATE);
|
testata.setOperation(OperationType.UPDATE);
|
||||||
testate.add(testata);
|
return testata;
|
||||||
});
|
})
|
||||||
|
.filter(testataOrphan -> testate.stream().noneMatch(testataOrphan::equalsKey))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
testate.addAll(orphanTestateToAdd);
|
||||||
|
|
||||||
|
|
||||||
testate.parallelStream()
|
testate.parallelStream()
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ import it.integry.ems.system.exchange.service.structure.ExchangeImportDataManage
|
|||||||
import it.integry.ems.system.exchange.service.structure.ExchangeImportSchemaManagerService;
|
import it.integry.ems.system.exchange.service.structure.ExchangeImportSchemaManagerService;
|
||||||
import it.integry.ems_model.base.EquatableEntityInterface;
|
import it.integry.ems_model.base.EquatableEntityInterface;
|
||||||
import it.integry.ems_model.entity.MtbPartitaMag;
|
import it.integry.ems_model.entity.MtbPartitaMag;
|
||||||
|
import it.integry.ems_model.exception.EntityException;
|
||||||
import it.integry.ems_model.exception.MergeEntityDBToObjectException;
|
import it.integry.ems_model.exception.MergeEntityDBToObjectException;
|
||||||
import it.integry.ems_model.types.OperationType;
|
import it.integry.ems_model.types.OperationType;
|
||||||
import it.integry.ems_model.utility.UtilityDB;
|
import it.integry.ems_model.utility.UtilityDB;
|
||||||
import it.integry.ems_model.utility.UtilityLocalDate;
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -47,71 +47,80 @@ public class ExchangePartiteMagazzinoImportService {
|
|||||||
|
|
||||||
boolean useTempTable = true;
|
boolean useTempTable = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
exchangeImportSchemaManagerService.syncSchema(exchangeMultiDb.getPrimaryConnection(), ExchangeImportSchemaManagerService.SchemaType.PartiteMagazzinoLavorazione, useTempTable);
|
exchangeImportSchemaManagerService.syncSchema(exchangeMultiDb.getPrimaryConnection(), ExchangeImportSchemaManagerService.SchemaType.PartiteMagazzinoLavorazione, useTempTable);
|
||||||
|
|
||||||
final List<MtbPartitaMag> exchangeImportedData = retrievePartite(
|
final List<MtbPartitaMag> exchangeImportedData = retrievePartite(
|
||||||
exchangeMultiDb.getPrimaryConnection(),
|
exchangeMultiDb.getPrimaryConnection(),
|
||||||
LocalDate.of(2022, 1, 1),
|
null,
|
||||||
UtilityLocalDate.getNow(),
|
null,
|
||||||
true, false);
|
true, false);
|
||||||
|
|
||||||
final List<MtbPartitaMag> exchangeUpdatedData = retrievePartite(
|
final List<MtbPartitaMag> exchangeUpdatedData = retrievePartite(
|
||||||
exchangeMultiDb.getPrimaryConnection(),
|
exchangeMultiDb.getPrimaryConnection(),
|
||||||
LocalDate.of(2022, 1, 1),
|
null,
|
||||||
UtilityLocalDate.getNow(),
|
null,
|
||||||
false, useTempTable);
|
false, useTempTable);
|
||||||
|
|
||||||
List<EquatableEntityInterface> allData = exchangeImportDataManagerService
|
exchangeMultiDb.commitAll();
|
||||||
.runSync(MtbPartitaMag.class, exchangeImportedData, exchangeUpdatedData);
|
|
||||||
|
|
||||||
allData.forEach(x -> x.setOperation(x.getOperation() == OperationType.INSERT ? OperationType.INSERT_OR_UPDATE : x.getOperation()));
|
List<EquatableEntityInterface> allData = exchangeImportDataManagerService
|
||||||
|
.runSync(MtbPartitaMag.class, exchangeImportedData, exchangeUpdatedData);
|
||||||
|
|
||||||
|
allData.forEach(x -> x.setOperation(x.getOperation() == OperationType.INSERT ? OperationType.INSERT_OR_UPDATE : x.getOperation()));
|
||||||
|
|
||||||
// allData = allData.stream().filter(x -> x.getOperation() != OperationType.DELETE)
|
// allData = allData.stream().filter(x -> x.getOperation() != OperationType.DELETE)
|
||||||
// .collect(Collectors.toList());
|
// .collect(Collectors.toList());
|
||||||
|
|
||||||
final Exception[] firstExceptionToThrow = {null};
|
final Exception[] firstExceptionToThrow = {null};
|
||||||
|
|
||||||
AtomicInteger importedCounter = new AtomicInteger();
|
AtomicInteger importedCounter = new AtomicInteger();
|
||||||
List<RunnableThrowable> calls = new ArrayList<>();
|
List<RunnableThrowable> calls = new ArrayList<>();
|
||||||
|
|
||||||
for (EquatableEntityInterface dataToSave : allData) {
|
for (EquatableEntityInterface dataToSave : allData) {
|
||||||
|
|
||||||
//if(dataToSave.getOperation() == OperationType.DELETE) continue;
|
//if(dataToSave.getOperation() == OperationType.DELETE) continue;
|
||||||
|
|
||||||
// calls.add(() -> {
|
// calls.add(() -> {
|
||||||
logger.debug("Importate {} partite di magazzino di {}", importedCounter.incrementAndGet(), allData.size());
|
logger.debug("Importate {} partite di magazzino di {}", importedCounter.incrementAndGet(), allData.size());
|
||||||
|
try {
|
||||||
try {
|
try {
|
||||||
try {
|
entityProcessor.processEntity(dataToSave, true, true, ROSSOGARGANO_EXCHANGE_USER, internalMultiDb, requestDataDTO);
|
||||||
entityProcessor.processEntity(dataToSave, true, true, ROSSOGARGANO_EXCHANGE_USER, internalMultiDb, requestDataDTO);
|
} catch (MergeEntityDBToObjectException mergeEntityDBToObjectException) {
|
||||||
} catch (MergeEntityDBToObjectException mergeEntityDBToObjectException) {
|
//ignore error if is DELETE
|
||||||
//ignore error if is DELETE
|
if (dataToSave.getOperation() != OperationType.DELETE) throw mergeEntityDBToObjectException;
|
||||||
if (dataToSave.getOperation() != OperationType.DELETE) throw mergeEntityDBToObjectException;
|
} catch (EntityException e) {
|
||||||
}
|
//ignore error if is DELETE & foreign key error and rollback
|
||||||
singleUpdateImported(exchangeMultiDb.getPrimaryConnection(), (MtbPartitaMag) dataToSave, useTempTable);
|
if (e.getSqlErrorCode() == 547 && dataToSave.getOperation() == OperationType.DELETE) {
|
||||||
|
internalMultiDb.rollbackAll();
|
||||||
internalMultiDb.commitAll();
|
exchangeMultiDb.rollbackAll();
|
||||||
exchangeMultiDb.commitAll();
|
continue;
|
||||||
|
} else throw e;
|
||||||
} catch (Exception ex) {
|
|
||||||
if (firstExceptionToThrow[0] == null) firstExceptionToThrow[0] = ex;
|
|
||||||
|
|
||||||
logger.error("Errore durante l'importazione della partita di magazzino", ex);
|
|
||||||
internalMultiDb.rollbackAll();
|
|
||||||
exchangeMultiDb.rollbackAll();
|
|
||||||
//throw ex;
|
|
||||||
}
|
}
|
||||||
|
singleUpdateImported(exchangeMultiDb.getPrimaryConnection(), (MtbPartitaMag) dataToSave, useTempTable);
|
||||||
|
|
||||||
|
internalMultiDb.commitAll();
|
||||||
|
exchangeMultiDb.commitAll();
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (firstExceptionToThrow[0] == null) firstExceptionToThrow[0] = ex;
|
||||||
|
|
||||||
|
logger.error("Errore durante l'importazione della partita di magazzino", ex);
|
||||||
|
internalMultiDb.rollbackAll();
|
||||||
|
exchangeMultiDb.rollbackAll();
|
||||||
|
//throw ex;
|
||||||
|
}
|
||||||
|
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
// UtilityThread.executeParallel(calls);
|
// UtilityThread.executeParallel(calls);
|
||||||
|
|
||||||
|
|
||||||
if (firstExceptionToThrow[0] != null) throw firstExceptionToThrow[0];
|
if (firstExceptionToThrow[0] != null) throw firstExceptionToThrow[0];
|
||||||
} finally {
|
} finally {
|
||||||
if (useTempTable)
|
if (useTempTable)
|
||||||
exchangeImportSchemaManagerService.deleteTempTables(exchangeMultiDb.getPrimaryConnection(), ExchangeImportSchemaManagerService.SchemaType.PartiteMagazzinoLavorazione);
|
exchangeImportSchemaManagerService.deleteTempTables(exchangeMultiDb.getPrimaryConnection(), ExchangeImportSchemaManagerService.SchemaType.PartiteMagazzinoLavorazione);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user