Creato campo barcode_ul nella testata collo e gestito durante la create UDC
This commit is contained in:
@@ -549,7 +549,6 @@
|
|||||||
<option value="$PROJECT_DIR$/ems-retail/pom.xml" />
|
<option value="$PROJECT_DIR$/ems-retail/pom.xml" />
|
||||||
</set>
|
</set>
|
||||||
</option>
|
</option>
|
||||||
<option name="workspaceImportForciblyTurnedOn" value="true" />
|
|
||||||
</component>
|
</component>
|
||||||
<component name="PWA">
|
<component name="PWA">
|
||||||
<option name="wasEnabledAtLeastOnce" value="true" />
|
<option name="wasEnabledAtLeastOnce" value="true" />
|
||||||
@@ -900,6 +899,21 @@
|
|||||||
<option name="PROGRAM_PARAMETERS" value="" />
|
<option name="PROGRAM_PARAMETERS" value="" />
|
||||||
</SHUTDOWN>
|
</SHUTDOWN>
|
||||||
</ConfigurationWrapper>
|
</ConfigurationWrapper>
|
||||||
|
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="JProfiler">
|
||||||
|
<option name="USE_ENV_VARIABLES" value="true" />
|
||||||
|
<STARTUP>
|
||||||
|
<option name="USE_DEFAULT" value="true" />
|
||||||
|
<option name="SCRIPT" value="" />
|
||||||
|
<option name="VM_PARAMETERS" value="" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="" />
|
||||||
|
</STARTUP>
|
||||||
|
<SHUTDOWN>
|
||||||
|
<option name="USE_DEFAULT" value="true" />
|
||||||
|
<option name="SCRIPT" value="" />
|
||||||
|
<option name="VM_PARAMETERS" value="" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="" />
|
||||||
|
</SHUTDOWN>
|
||||||
|
</ConfigurationWrapper>
|
||||||
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Profile">
|
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Profile">
|
||||||
<option name="USE_ENV_VARIABLES" value="true" />
|
<option name="USE_ENV_VARIABLES" value="true" />
|
||||||
<STARTUP>
|
<STARTUP>
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ import it.integry.ems.settings.Model.SettingsModel;
|
|||||||
import it.integry.ems.settings.SettingsController;
|
import it.integry.ems.settings.SettingsController;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.AdvancedDataSource;
|
import it.integry.ems.sync.MultiDBTransaction.AdvancedDataSource;
|
||||||
import it.integry.ems.utility.UtilityDebug;
|
import it.integry.ems.utility.UtilityDebug;
|
||||||
|
import it.integry.ems_model.entity.StbGestSetup;
|
||||||
import it.integry.ems_model.rulescompleting.DroolsDataCompleting;
|
import it.integry.ems_model.rulescompleting.DroolsDataCompleting;
|
||||||
|
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 org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
@@ -67,6 +69,11 @@ public abstract class BaseMigration implements MigrationModelInterface {
|
|||||||
return val != null && val == 1;
|
return val != null && val == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void renameColumn(Connection connection, String tableName, String oldColumnname, String newColumnName) throws SQLException {
|
||||||
|
String sql = "exec sp_rename 'dbo." + tableName + "." + oldColumnname + "', " + newColumnName + ", 'COLUMN'";
|
||||||
|
executeStatement(connection, sql);
|
||||||
|
}
|
||||||
|
|
||||||
protected boolean existsTable(Connection connection, String tableName) throws SQLException {
|
protected boolean existsTable(Connection connection, String tableName) throws SQLException {
|
||||||
String sql = Query.format("SELECT CAST(COUNT(*) AS BIT) AS exist FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N%s", tableName);
|
String sql = Query.format("SELECT CAST(COUNT(*) AS BIT) AS exist FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N%s", tableName);
|
||||||
|
|
||||||
@@ -102,4 +109,34 @@ public abstract class BaseMigration implements MigrationModelInterface {
|
|||||||
String dropSql = "DROP TABLE " + tableName;
|
String dropSql = "DROP TABLE " + tableName;
|
||||||
executeStatement(connection, dropSql);
|
executeStatement(connection, dropSql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected void createSetup(Connection connection, String gestName, String section, String keySection, String value, String description, String codQuery) throws Exception {
|
||||||
|
StbGestSetup stbGestSetup = new StbGestSetup()
|
||||||
|
.setGestName(gestName)
|
||||||
|
.setSection(section)
|
||||||
|
.setKeySection(keySection)
|
||||||
|
.setValue(value)
|
||||||
|
.setDescription(description)
|
||||||
|
.setQueryDefault(codQuery);
|
||||||
|
|
||||||
|
stbGestSetup.setOperation(OperationType.INSERT);
|
||||||
|
|
||||||
|
stbGestSetup.manageWithParentConnection(connection);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected void deleteSetup(Connection connection, String gestName, String section, String keySection) throws Exception {
|
||||||
|
StbGestSetup stbGestSetup = new StbGestSetup()
|
||||||
|
.setGestName(gestName)
|
||||||
|
.setSection(section)
|
||||||
|
.setKeySection(keySection);
|
||||||
|
|
||||||
|
stbGestSetup.setOperation(OperationType.DELETE);
|
||||||
|
stbGestSetup.manageWithParentConnection(connection);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package it.integry.ems.migration.model;
|
||||||
|
|
||||||
|
import it.integry.ems.migration._base.BaseMigration;
|
||||||
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
|
|
||||||
|
public class Migration_20240219094933 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
String sql = "ALTER TABLE mtb_colt\n" +
|
||||||
|
" ADD barcode_ul VARCHAR(20)";
|
||||||
|
|
||||||
|
executeStatement(advancedDataSource.getConnection(), sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package it.integry.ems.migration.model;
|
||||||
|
|
||||||
|
import it.integry.ems.migration._base.BaseMigration;
|
||||||
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
|
|
||||||
|
public class Migration_20240219103840 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
createSetup(advancedDataSource.getConnection(),
|
||||||
|
"PICKING", "ACCETTAZIONE", "FLAG_ALLOW_BARCODE_FORNITORE", "N",
|
||||||
|
"Abilita la possibilità di effettuare l'accettazione merci utilizzando direttamente l'SSCC del fornitore (salvato poi nella colonna barcode_pedana)",
|
||||||
|
"SI_NO");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,6 @@ 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.UtilityHashMap;
|
import it.integry.ems_model.utility.UtilityHashMap;
|
||||||
import it.integry.ems_model.utility.UtilityString;
|
import it.integry.ems_model.utility.UtilityString;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.kie.api.definition.type.PropertyReactive;
|
import org.kie.api.definition.type.PropertyReactive;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -162,6 +161,9 @@ public class MtbColt extends EntityBase {
|
|||||||
@SqlField("id_lotto")
|
@SqlField("id_lotto")
|
||||||
private Integer idLotto;
|
private Integer idLotto;
|
||||||
|
|
||||||
|
@SqlField(value = "barcode_ul", nullable = true, maxLength = 20)
|
||||||
|
private String barcodeUl;
|
||||||
|
|
||||||
private String insPartitaMag;
|
private String insPartitaMag;
|
||||||
|
|
||||||
private transient String stpPrz;
|
private transient String stpPrz;
|
||||||
@@ -610,6 +612,15 @@ public class MtbColt extends EntityBase {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getBarcodeUl() {
|
||||||
|
return barcodeUl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MtbColt setBarcodeUl(String barcodeUl) {
|
||||||
|
this.barcodeUl = barcodeUl;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public List<MtbColr> getMtbColr() {
|
public List<MtbColr> getMtbColr() {
|
||||||
return mtbColr;
|
return mtbColr;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
import it.integry.common.var.CommonConstants;
|
import it.integry.common.var.CommonConstants;
|
||||||
import it.integry.ems.javabeans.RequestDataDTO;
|
import it.integry.ems.javabeans.RequestDataDTO;
|
||||||
import it.integry.ems.product.dto.TipoCosto;
|
import it.integry.ems.product.dto.TipoCosto;
|
||||||
import it.integry.ems.report.dto.ReportTypeDTO;
|
|
||||||
import it.integry.ems.response.EsitoType;
|
import it.integry.ems.response.EsitoType;
|
||||||
import it.integry.ems.response.FileItem;
|
import it.integry.ems.response.FileItem;
|
||||||
import it.integry.ems.response.ServiceRestResponse;
|
import it.integry.ems.response.ServiceRestResponse;
|
||||||
@@ -20,7 +19,6 @@ import it.integry.ems.user.UserSession;
|
|||||||
import it.integry.ems.utility.UtilityEntity;
|
import it.integry.ems.utility.UtilityEntity;
|
||||||
import it.integry.ems_model.base.EntityBase;
|
import it.integry.ems_model.base.EntityBase;
|
||||||
import it.integry.ems_model.config.EmsRestConstants;
|
import it.integry.ems_model.config.EmsRestConstants;
|
||||||
import it.integry.ems_model.entity.DtbOrdt;
|
|
||||||
import it.integry.ems_model.entity.MtbColt;
|
import it.integry.ems_model.entity.MtbColt;
|
||||||
import it.integry.ems_model.entity.NtbRapr;
|
import it.integry.ems_model.entity.NtbRapr;
|
||||||
import it.integry.ems_model.entity._enum.GestioneEnum;
|
import it.integry.ems_model.entity._enum.GestioneEnum;
|
||||||
@@ -493,9 +491,9 @@ public class PvmController {
|
|||||||
@RequestParam(value = "codProd", required = false) String codProd,
|
@RequestParam(value = "codProd", required = false) String codProd,
|
||||||
@RequestParam(value = "dataValidita", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date dataValidita,
|
@RequestParam(value = "dataValidita", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date dataValidita,
|
||||||
@RequestParam(value = "codVlis", required = false) String codVlis) throws Exception {
|
@RequestParam(value = "codVlis", required = false) String codVlis) throws Exception {
|
||||||
if (dataValidita == null) {
|
|
||||||
|
if (dataValidita == null)
|
||||||
dataValidita = new Date();
|
dataValidita = new Date();
|
||||||
}
|
|
||||||
|
|
||||||
return ServiceRestResponse.createPositiveResponse(pvmService.getCostoProdottoDatiCommerciali(codProd, dataValidita.toInstant(), codVlis));
|
return ServiceRestResponse.createPositiveResponse(pvmService.getCostoProdottoDatiCommerciali(codProd, dataValidita.toInstant(), codVlis));
|
||||||
}
|
}
|
||||||
@@ -507,19 +505,11 @@ public class PvmController {
|
|||||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||||
@RequestParam String codBarreCollo,
|
@RequestParam String codBarreCollo,
|
||||||
@RequestParam(required = false, defaultValue = "false") boolean onlyResiduo,
|
@RequestParam(required = false, defaultValue = "false") boolean onlyResiduo,
|
||||||
@RequestParam(required = false, defaultValue = "true") boolean throwExcIfNull) {
|
@RequestParam(required = false, defaultValue = "true") boolean throwExcIfNull) throws Exception {
|
||||||
ServiceRestResponse response;
|
|
||||||
try {
|
|
||||||
MtbColt collo = pvmService.getColloByBarcode(codBarreCollo, onlyResiduo);
|
|
||||||
|
|
||||||
if (collo == null && throwExcIfNull) throw new Exception("Nessun bancale trovato");
|
MtbColt collo = pvmService.getColloByBarcode(codBarreCollo, onlyResiduo);
|
||||||
|
if (collo == null && throwExcIfNull) throw new Exception("Nessun bancale trovato");
|
||||||
response = ServiceRestResponse.createPositiveResponse((Object) collo);
|
return ServiceRestResponse.createPositiveResponse(collo);
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error(request.getRequestURI(), e);
|
|
||||||
response = new ServiceRestResponse(EsitoType.KO, configuration, e);
|
|
||||||
}
|
|
||||||
return response;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = EmsRestConstants.PATH_GET_COLLO_IN_GIAC, method = RequestMethod.POST)
|
@RequestMapping(value = EmsRestConstants.PATH_GET_COLLO_IN_GIAC, method = RequestMethod.POST)
|
||||||
@@ -529,20 +519,12 @@ public class PvmController {
|
|||||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||||
@RequestParam(required = false, defaultValue = "false") boolean onlyResiduo,
|
@RequestParam(required = false, defaultValue = "false") boolean onlyResiduo,
|
||||||
@RequestParam(required = false, defaultValue = "true") boolean throwExcIfNull,
|
@RequestParam(required = false, defaultValue = "true") boolean throwExcIfNull,
|
||||||
@RequestBody MtbColt mtbColt) {
|
@RequestBody MtbColt mtbColt) throws Exception {
|
||||||
|
|
||||||
ServiceRestResponse response;
|
MtbColt collo = pvmService.getColloInGiac(mtbColt, onlyResiduo);
|
||||||
try {
|
if (collo == null && throwExcIfNull) throw new Exception("Nessun bancale trovato");
|
||||||
MtbColt collo = pvmService.getColloInGiac(mtbColt, onlyResiduo);
|
|
||||||
|
|
||||||
if (collo == null && throwExcIfNull) throw new Exception("Nessun bancale trovato");
|
return ServiceRestResponse.createPositiveResponse(collo);
|
||||||
|
|
||||||
response = ServiceRestResponse.createPositiveResponse((Object) collo);
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error(request.getRequestURI(), e);
|
|
||||||
response = new ServiceRestResponse(EsitoType.KO, configuration, e);
|
|
||||||
}
|
|
||||||
return response;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = EmsRestConstants.PATH_GET_COLLI_IN_BASKET, method = RequestMethod.GET)
|
@RequestMapping(value = EmsRestConstants.PATH_GET_COLLI_IN_BASKET, method = RequestMethod.GET)
|
||||||
@@ -550,15 +532,9 @@ public class PvmController {
|
|||||||
ServiceRestResponse getColliInBasket(
|
ServiceRestResponse getColliInBasket(
|
||||||
HttpServletRequest request,
|
HttpServletRequest request,
|
||||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||||
@RequestParam(required = false) String codMdep) {
|
@RequestParam(required = false) String codMdep) throws Exception {
|
||||||
ServiceRestResponse response;
|
|
||||||
try {
|
return ServiceRestResponse.createPositiveResponse(pvmService.getColliInBasket(codMdep));
|
||||||
response = ServiceRestResponse.createPositiveResponse(pvmService.getColliInBasket(codMdep));
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error(request.getRequestURI(), e);
|
|
||||||
response = new ServiceRestResponse(EsitoType.KO, configuration, e);
|
|
||||||
}
|
|
||||||
return response;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = EmsRestConstants.PATH_CREA_RAPPORTINO_FG_PVM, method = RequestMethod.POST)
|
@RequestMapping(value = EmsRestConstants.PATH_CREA_RAPPORTINO_FG_PVM, method = RequestMethod.POST)
|
||||||
@@ -566,12 +542,11 @@ public class PvmController {
|
|||||||
List<ServiceRestResponse> creaRapportinoFgPvm(HttpServletRequest request,
|
List<ServiceRestResponse> creaRapportinoFgPvm(HttpServletRequest request,
|
||||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||||
@RequestParam("dataRapp") Date dataRapp,
|
@RequestParam("dataRapp") Date dataRapp,
|
||||||
@RequestParam("codMdep") String codMdep
|
@RequestParam("codMdep") String codMdep) {
|
||||||
) {
|
|
||||||
List<ServiceRestResponse> listResponse = new ArrayList<ServiceRestResponse>();
|
List<ServiceRestResponse> listResponse = new ArrayList<ServiceRestResponse>();
|
||||||
try {
|
try {
|
||||||
List<EntityBase> entityList = pvmRapportiniFgService.creaRappParziali(dataRapp, codMdep);
|
List<EntityBase> entityList = pvmRapportiniFgService.creaRappParziali(dataRapp, codMdep);
|
||||||
if (entityList != null && entityList.size() > 0) {
|
if (entityList != null && !entityList.isEmpty()) {
|
||||||
listResponse = UtilityEntity.toServiceRestResponse(entityList);
|
listResponse = UtilityEntity.toServiceRestResponse(entityList);
|
||||||
} else {
|
} else {
|
||||||
listResponse.add(new ServiceRestResponse(EsitoType.OK));
|
listResponse.add(new ServiceRestResponse(EsitoType.OK));
|
||||||
@@ -776,7 +751,7 @@ public class PvmController {
|
|||||||
@RequestMapping(value = "popolaGiancezaDaInventario", method = RequestMethod.POST)
|
@RequestMapping(value = "popolaGiancezaDaInventario", method = RequestMethod.POST)
|
||||||
public @ResponseBody
|
public @ResponseBody
|
||||||
ServiceRestResponse popolaGiancezaDaInventario(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
ServiceRestResponse popolaGiancezaDaInventario(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||||
@RequestParam (required = false) String codMdep) throws Exception {
|
@RequestParam(required = false) String codMdep) throws Exception {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
giacenzaService.popolaGiancezaDaInventario(codMdep);
|
giacenzaService.popolaGiancezaDaInventario(codMdep);
|
||||||
|
|||||||
@@ -2247,91 +2247,95 @@ public class PvmService {
|
|||||||
|
|
||||||
|
|
||||||
public MtbColt getColloByBarcode(String codBarreCollo, boolean onlyResiduo) throws Exception {
|
public MtbColt getColloByBarcode(String codBarreCollo, boolean onlyResiduo) throws Exception {
|
||||||
HashMap<String, Object> datiCollo = new HashMap<>();
|
|
||||||
|
|
||||||
if (codBarreCollo.startsWith("U")) {
|
MtbColt mtbColt = getColloByExternalBarcode(codBarreCollo);
|
||||||
datiCollo.put("gestione", null);
|
|
||||||
datiCollo.put("anno", Integer.parseInt(codBarreCollo.substring(1, 3)));
|
|
||||||
datiCollo.put("num", Integer.parseInt(codBarreCollo.substring(3, 10)));
|
|
||||||
|
|
||||||
if (codBarreCollo.length() > 10) {
|
if(mtbColt == null) {
|
||||||
datiCollo.put("serie", codBarreCollo.substring(10));
|
|
||||||
} else {
|
|
||||||
datiCollo.put("serie", "UL");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
HashMap<String, Object> datiCollo = new HashMap<>();
|
||||||
|
if (codBarreCollo.startsWith("U")) {
|
||||||
|
datiCollo.put("gestione", null);
|
||||||
|
datiCollo.put("anno", Integer.parseInt(codBarreCollo.substring(1, 3)));
|
||||||
|
datiCollo.put("num", Integer.parseInt(codBarreCollo.substring(3, 10)));
|
||||||
|
|
||||||
} else {
|
if (codBarreCollo.length() > 10) {
|
||||||
datiCollo = new HashMap<>();
|
datiCollo.put("serie", codBarreCollo.substring(10));
|
||||||
|
} else {
|
||||||
codBarreCollo = codBarreCollo.substring(0, codBarreCollo.length() - 1); //Rimuovo il check digit finale
|
datiCollo.put("serie", "UL");
|
||||||
|
|
||||||
datiCollo.put("num", Integer.parseInt(codBarreCollo.substring(codBarreCollo.length() - 5, codBarreCollo.length())));
|
|
||||||
datiCollo.put("anno", Integer.parseInt(codBarreCollo.substring(codBarreCollo.length() - 7, codBarreCollo.length() - 5)));
|
|
||||||
int gestioneInt = Integer.parseInt("" + codBarreCollo.charAt(codBarreCollo.length() - 8));
|
|
||||||
|
|
||||||
int numMultiplier = 0;
|
|
||||||
if (codBarreCollo.length() >= 9) {
|
|
||||||
numMultiplier = Integer.parseInt("" + codBarreCollo.charAt(codBarreCollo.length() - 9)) * 100000;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
datiCollo.put("num", ((Integer) datiCollo.get("num")) + numMultiplier);
|
|
||||||
|
|
||||||
String gestione;
|
|
||||||
|
|
||||||
try {
|
|
||||||
switch (gestioneInt) {
|
|
||||||
case 1:
|
|
||||||
gestione = "A";
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
gestione = "L";
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
gestione = "V";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Exception("Il collo letto ha un errore nella gestione");
|
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
|
||||||
throw new Exception("Il collo letto ha un errore nella gestione");
|
|
||||||
|
} else {
|
||||||
|
datiCollo = new HashMap<>();
|
||||||
|
|
||||||
|
codBarreCollo = codBarreCollo.substring(0, codBarreCollo.length() - 1); //Rimuovo il check digit finale
|
||||||
|
|
||||||
|
datiCollo.put("num", Integer.parseInt(codBarreCollo.substring(codBarreCollo.length() - 5, codBarreCollo.length())));
|
||||||
|
datiCollo.put("anno", Integer.parseInt(codBarreCollo.substring(codBarreCollo.length() - 7, codBarreCollo.length() - 5)));
|
||||||
|
int gestioneInt = Integer.parseInt("" + codBarreCollo.charAt(codBarreCollo.length() - 8));
|
||||||
|
|
||||||
|
int numMultiplier = 0;
|
||||||
|
if (codBarreCollo.length() >= 9) {
|
||||||
|
numMultiplier = Integer.parseInt("" + codBarreCollo.charAt(codBarreCollo.length() - 9)) * 100000;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
datiCollo.put("num", ((Integer) datiCollo.get("num")) + numMultiplier);
|
||||||
|
|
||||||
|
String gestione;
|
||||||
|
|
||||||
|
try {
|
||||||
|
switch (gestioneInt) {
|
||||||
|
case 1:
|
||||||
|
gestione = "A";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
gestione = "L";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
gestione = "V";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Exception("Il collo letto ha un errore nella gestione");
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
throw new Exception("Il collo letto ha un errore nella gestione");
|
||||||
|
}
|
||||||
|
|
||||||
|
datiCollo.put("gestione", gestione);
|
||||||
|
datiCollo.put("serie", "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
datiCollo.put("gestione", gestione);
|
String query;
|
||||||
datiCollo.put("serie", "/");
|
|
||||||
|
String whereCondGestione = "";
|
||||||
|
|
||||||
|
if (datiCollo.containsKey("gestione") && datiCollo.get("gestione") != null) {
|
||||||
|
whereCondGestione = " gestione = " + UtilityDB.valueToString(datiCollo.get("gestione")) + " AND ";
|
||||||
|
}
|
||||||
|
|
||||||
|
query = "SELECT * "
|
||||||
|
+ "FROM mtb_colt "
|
||||||
|
+ "WHERE "
|
||||||
|
+ whereCondGestione
|
||||||
|
+ " num_collo = " + UtilityDB.valueToString(datiCollo.get("num")) + " AND "
|
||||||
|
+ " RIGHT(YEAR(data_collo), 2) = " + UtilityDB.valueToString(datiCollo.get("anno")) + " AND "
|
||||||
|
+ " ser_collo = " + UtilityDB.valueToString(datiCollo.get("serie"));
|
||||||
|
|
||||||
|
|
||||||
|
mtbColt = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), query, MtbColt.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
MtbColt mtbColt;
|
if (mtbColt == null) return null;
|
||||||
String query;
|
|
||||||
|
|
||||||
String whereCondGestione = "";
|
|
||||||
|
|
||||||
if (datiCollo.containsKey("gestione") && datiCollo.get("gestione") != null) {
|
|
||||||
whereCondGestione = " gestione = " + UtilityDB.valueToString(datiCollo.get("gestione")) + " AND ";
|
|
||||||
}
|
|
||||||
|
|
||||||
query = "SELECT * "
|
|
||||||
+ "FROM mtb_colt "
|
|
||||||
+ "WHERE "
|
|
||||||
+ whereCondGestione
|
|
||||||
+ " num_collo = " + UtilityDB.valueToString(datiCollo.get("num")) + " AND "
|
|
||||||
+ " RIGHT(YEAR(data_collo), 2) = " + UtilityDB.valueToString(datiCollo.get("anno")) + " AND "
|
|
||||||
+ " ser_collo = " + UtilityDB.valueToString(datiCollo.get("serie"));
|
|
||||||
|
|
||||||
PreparedStatement ps = multiDBTransactionManager.getPrimaryDatasource().getConnection().prepareStatement(query);
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
ResultSetMapper rsMapper = new ResultSetMapper();
|
|
||||||
mtbColt = rsMapper.mapResultSetToObject(rs, MtbColt.class);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
|
|
||||||
if (mtbColt == null) return mtbColt;
|
|
||||||
else return getColloInGiac(mtbColt, onlyResiduo);
|
else return getColloInGiac(mtbColt, onlyResiduo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private MtbColt getColloByExternalBarcode(String barcode) throws Exception {
|
||||||
|
String sql = Query.format("SELECT * FROM " + MtbColt.ENTITY +
|
||||||
|
" WHERE barcode_ul = %s", barcode);
|
||||||
|
|
||||||
|
return UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), sql, MtbColt.class);
|
||||||
|
}
|
||||||
|
|
||||||
public MtbColt getColloInGiac(MtbColt mtbColt, boolean onlyResiduo) throws Exception {
|
public MtbColt getColloInGiac(MtbColt mtbColt, boolean onlyResiduo) throws Exception {
|
||||||
|
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ public class WMSAccettazioneService {
|
|||||||
.setPosizione(UtilityString.isNullOrEmpty(createUDCRequestDTO.getPosizione()) ? defaultPosizioneColliAccettazione : createUDCRequestDTO.getPosizione())
|
.setPosizione(UtilityString.isNullOrEmpty(createUDCRequestDTO.getPosizione()) ? defaultPosizioneColliAccettazione : createUDCRequestDTO.getPosizione())
|
||||||
.setCodTcol(createUDCRequestDTO.getCodTcol())
|
.setCodTcol(createUDCRequestDTO.getCodTcol())
|
||||||
.setAnnotazioni(createUDCRequestDTO.getAnnotazioni())
|
.setAnnotazioni(createUDCRequestDTO.getAnnotazioni())
|
||||||
|
.setBarcodeUl(createUDCRequestDTO.getBarcodeUl())
|
||||||
.setSegno(1);
|
.setSegno(1);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ public class CreateUDCRequestDTO {
|
|||||||
|
|
||||||
private String annotazioni;
|
private String annotazioni;
|
||||||
|
|
||||||
|
private String barcodeUl;
|
||||||
|
|
||||||
private List<CreateUDCRequestOrderDTO> orders;
|
private List<CreateUDCRequestOrderDTO> orders;
|
||||||
|
|
||||||
|
|
||||||
@@ -71,6 +73,15 @@ public class CreateUDCRequestDTO {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getBarcodeUl() {
|
||||||
|
return barcodeUl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CreateUDCRequestDTO setBarcodeUl(String barcodeUl) {
|
||||||
|
this.barcodeUl = barcodeUl;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public List<CreateUDCRequestOrderDTO> getOrders() {
|
public List<CreateUDCRequestOrderDTO> getOrders() {
|
||||||
return orders;
|
return orders;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -469,6 +469,7 @@ public class WMSLavorazioneService {
|
|||||||
.setPosizione(UtilityString.isNull(createUDCRequestDTO.getPosizione(), defaultPosizioneColliAccettazione))
|
.setPosizione(UtilityString.isNull(createUDCRequestDTO.getPosizione(), defaultPosizioneColliAccettazione))
|
||||||
.setCodTcol(createUDCRequestDTO.getCodTcol())
|
.setCodTcol(createUDCRequestDTO.getCodTcol())
|
||||||
.setAnnotazioni(createUDCRequestDTO.getAnnotazioni())
|
.setAnnotazioni(createUDCRequestDTO.getAnnotazioni())
|
||||||
|
.setBarcodeUl(createUDCRequestDTO.getBarcodeUl())
|
||||||
.setSegno(1);
|
.setSegno(1);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user