Creata nuova utility getMtbUntMisFromCodMart
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:
@@ -730,7 +730,7 @@ public class CommonRules extends QueryRules {
|
|||||||
public static String completeFlagQtaCnfFissa(Connection connection, IntegryCustomerDB customerDB, String codMart) {
|
public static String completeFlagQtaCnfFissa(Connection connection, IntegryCustomerDB customerDB, String codMart) {
|
||||||
final EntityCacheComponent entityCacheComponent = ApplicationContextProvider.getApplicationContext().getBean(EntityCacheComponent.class);
|
final EntityCacheComponent entityCacheComponent = ApplicationContextProvider.getApplicationContext().getBean(EntityCacheComponent.class);
|
||||||
|
|
||||||
final List<MtbAart> cachedMtbAarts = entityCacheComponent.getCachedEntitiesList(customerDB, MtbAart.ENTITY, x -> x.getCodMart().equals(codMart));
|
final List<MtbAart> cachedMtbAarts = entityCacheComponent.getCachedEntitiesList(customerDB, MtbAart.ENTITY, x -> x.getCodMart().equalsIgnoreCase(codMart));
|
||||||
|
|
||||||
if (cachedMtbAarts == null || cachedMtbAarts.isEmpty())
|
if (cachedMtbAarts == null || cachedMtbAarts.isEmpty())
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package it.integry.ems.utility.entity;
|
||||||
|
|
||||||
|
import it.integry.ems._context.ApplicationContextProvider;
|
||||||
|
import it.integry.ems.dynamic_cache.EntityCacheComponent;
|
||||||
|
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||||
|
import it.integry.ems_model.entity.MtbAart;
|
||||||
|
import it.integry.ems_model.entity.MtbUntMis;
|
||||||
|
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
public class MtbUntMisUtils {
|
||||||
|
|
||||||
|
public static final MtbUntMis getMtbUntMisFromCodMart(IntegryCustomerDB customerDB, String codMart) throws SQLException {
|
||||||
|
final EntityCacheComponent entityCacheComponent = ApplicationContextProvider.getApplicationContext().getBean(EntityCacheComponent.class);
|
||||||
|
|
||||||
|
MtbAart mtbAart = entityCacheComponent.<MtbAart>getCachedEntitiesStream(customerDB, MtbAart.ENTITY,
|
||||||
|
x -> x.getCodMart().equalsIgnoreCase(codMart))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
|
||||||
|
if (mtbAart != null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
final MtbUntMis mtbUntMis = entityCacheComponent.<MtbUntMis>getCachedEntitiesStream(customerDB, MtbUntMis.ENTITY,
|
||||||
|
x -> x.getUntMis().equalsIgnoreCase(mtbAart.getUntMis()))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
|
||||||
|
return mtbUntMis;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -18,6 +18,7 @@ import java.time.LocalDate
|
|||||||
import it.integry.ems_model.utility.UtilityLocalDate;
|
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||||
import it.integry.ems.migration._base.IntegryCustomer
|
import it.integry.ems.migration._base.IntegryCustomer
|
||||||
|
import it.integry.ems.utility.entity.MtbUntMisUtils
|
||||||
|
|
||||||
global Connection conn
|
global Connection conn
|
||||||
global String username
|
global String username
|
||||||
@@ -225,14 +226,13 @@ when
|
|||||||
eval(completeRulesEnabled)
|
eval(completeRulesEnabled)
|
||||||
$entity : MtbColr(artAPeso == null && codMart != null )
|
$entity : MtbColr(artAPeso == null && codMart != null )
|
||||||
then
|
then
|
||||||
String sql =
|
MtbUntMis mtbUntMis = MtbUntMisUtils.getMtbUntMisFromCodMart(customerDb, $entity.getCodMart());
|
||||||
"SELECT CASE WHEN dbo.f_getTipoUntMis(mtb_aart.unt_mis) = 'KG' THEN 'S' ELSE 'N' END " +
|
|
||||||
" FROM mtb_aart WHERE cod_mart = " + UtilityDB.valueToString($entity.getCodMart());
|
String artAPeso = "N";
|
||||||
|
|
||||||
|
if (mtbUntMis != null)
|
||||||
|
artAPeso = "KG".equalsIgnoreCase(mtbUntMis.getUntMis()) ? "S" : "N";
|
||||||
|
|
||||||
String artAPeso = (String) QueryRules.getSingleValue(conn, sql);
|
|
||||||
if (artAPeso == null ) {
|
|
||||||
artAPeso = "N";
|
|
||||||
}
|
|
||||||
modify ( $entity ) { setArtAPeso(artAPeso) }
|
modify ( $entity ) { setArtAPeso(artAPeso) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user