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" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="workspaceImportForciblyTurnedOn" value="true" />
|
||||
</component>
|
||||
<component name="PWA">
|
||||
<option name="wasEnabledAtLeastOnce" value="true" />
|
||||
@@ -900,6 +899,21 @@
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
</SHUTDOWN>
|
||||
</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">
|
||||
<option name="USE_ENV_VARIABLES" value="true" />
|
||||
<STARTUP>
|
||||
|
||||
@@ -5,7 +5,9 @@ import it.integry.ems.settings.Model.SettingsModel;
|
||||
import it.integry.ems.settings.SettingsController;
|
||||
import it.integry.ems.sync.MultiDBTransaction.AdvancedDataSource;
|
||||
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.types.OperationType;
|
||||
import it.integry.ems_model.utility.Query;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -67,6 +69,11 @@ public abstract class BaseMigration implements MigrationModelInterface {
|
||||
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 {
|
||||
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;
|
||||
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.UtilityHashMap;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -162,6 +161,9 @@ public class MtbColt extends EntityBase {
|
||||
@SqlField("id_lotto")
|
||||
private Integer idLotto;
|
||||
|
||||
@SqlField(value = "barcode_ul", nullable = true, maxLength = 20)
|
||||
private String barcodeUl;
|
||||
|
||||
private String insPartitaMag;
|
||||
|
||||
private transient String stpPrz;
|
||||
@@ -610,6 +612,15 @@ public class MtbColt extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getBarcodeUl() {
|
||||
return barcodeUl;
|
||||
}
|
||||
|
||||
public MtbColt setBarcodeUl(String barcodeUl) {
|
||||
this.barcodeUl = barcodeUl;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<MtbColr> getMtbColr() {
|
||||
return mtbColr;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.fasterxml.jackson.databind.JsonNode;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
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.FileItem;
|
||||
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_model.base.EntityBase;
|
||||
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.NtbRapr;
|
||||
import it.integry.ems_model.entity._enum.GestioneEnum;
|
||||
@@ -493,9 +491,9 @@ public class PvmController {
|
||||
@RequestParam(value = "codProd", required = false) String codProd,
|
||||
@RequestParam(value = "dataValidita", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date dataValidita,
|
||||
@RequestParam(value = "codVlis", required = false) String codVlis) throws Exception {
|
||||
if (dataValidita == null) {
|
||||
|
||||
if (dataValidita == null)
|
||||
dataValidita = new Date();
|
||||
}
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(pvmService.getCostoProdottoDatiCommerciali(codProd, dataValidita.toInstant(), codVlis));
|
||||
}
|
||||
@@ -507,19 +505,11 @@ public class PvmController {
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestParam String codBarreCollo,
|
||||
@RequestParam(required = false, defaultValue = "false") boolean onlyResiduo,
|
||||
@RequestParam(required = false, defaultValue = "true") boolean throwExcIfNull) {
|
||||
ServiceRestResponse response;
|
||||
try {
|
||||
@RequestParam(required = false, defaultValue = "true") boolean throwExcIfNull) throws Exception {
|
||||
|
||||
MtbColt collo = pvmService.getColloByBarcode(codBarreCollo, onlyResiduo);
|
||||
|
||||
if (collo == null && throwExcIfNull) throw new Exception("Nessun bancale trovato");
|
||||
|
||||
response = ServiceRestResponse.createPositiveResponse((Object) collo);
|
||||
} catch (Exception e) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
response = new ServiceRestResponse(EsitoType.KO, configuration, e);
|
||||
}
|
||||
return response;
|
||||
return ServiceRestResponse.createPositiveResponse(collo);
|
||||
}
|
||||
|
||||
@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(required = false, defaultValue = "false") boolean onlyResiduo,
|
||||
@RequestParam(required = false, defaultValue = "true") boolean throwExcIfNull,
|
||||
@RequestBody MtbColt mtbColt) {
|
||||
@RequestBody MtbColt mtbColt) throws Exception {
|
||||
|
||||
ServiceRestResponse response;
|
||||
try {
|
||||
MtbColt collo = pvmService.getColloInGiac(mtbColt, onlyResiduo);
|
||||
|
||||
if (collo == null && throwExcIfNull) throw new Exception("Nessun bancale trovato");
|
||||
|
||||
response = ServiceRestResponse.createPositiveResponse((Object) collo);
|
||||
} catch (Exception e) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
response = new ServiceRestResponse(EsitoType.KO, configuration, e);
|
||||
}
|
||||
return response;
|
||||
return ServiceRestResponse.createPositiveResponse(collo);
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_GET_COLLI_IN_BASKET, method = RequestMethod.GET)
|
||||
@@ -550,15 +532,9 @@ public class PvmController {
|
||||
ServiceRestResponse getColliInBasket(
|
||||
HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestParam(required = false) String codMdep) {
|
||||
ServiceRestResponse response;
|
||||
try {
|
||||
response = ServiceRestResponse.createPositiveResponse(pvmService.getColliInBasket(codMdep));
|
||||
} catch (Exception e) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
response = new ServiceRestResponse(EsitoType.KO, configuration, e);
|
||||
}
|
||||
return response;
|
||||
@RequestParam(required = false) String codMdep) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(pvmService.getColliInBasket(codMdep));
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_CREA_RAPPORTINO_FG_PVM, method = RequestMethod.POST)
|
||||
@@ -566,12 +542,11 @@ public class PvmController {
|
||||
List<ServiceRestResponse> creaRapportinoFgPvm(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestParam("dataRapp") Date dataRapp,
|
||||
@RequestParam("codMdep") String codMdep
|
||||
) {
|
||||
@RequestParam("codMdep") String codMdep) {
|
||||
List<ServiceRestResponse> listResponse = new ArrayList<ServiceRestResponse>();
|
||||
try {
|
||||
List<EntityBase> entityList = pvmRapportiniFgService.creaRappParziali(dataRapp, codMdep);
|
||||
if (entityList != null && entityList.size() > 0) {
|
||||
if (entityList != null && !entityList.isEmpty()) {
|
||||
listResponse = UtilityEntity.toServiceRestResponse(entityList);
|
||||
} else {
|
||||
listResponse.add(new ServiceRestResponse(EsitoType.OK));
|
||||
@@ -776,7 +751,7 @@ public class PvmController {
|
||||
@RequestMapping(value = "popolaGiancezaDaInventario", method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse popolaGiancezaDaInventario(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@RequestParam (required = false) String codMdep) throws Exception {
|
||||
@RequestParam(required = false) String codMdep) throws Exception {
|
||||
|
||||
try {
|
||||
giacenzaService.popolaGiancezaDaInventario(codMdep);
|
||||
|
||||
@@ -2247,8 +2247,12 @@ public class PvmService {
|
||||
|
||||
|
||||
public MtbColt getColloByBarcode(String codBarreCollo, boolean onlyResiduo) throws Exception {
|
||||
HashMap<String, Object> datiCollo = new HashMap<>();
|
||||
|
||||
MtbColt mtbColt = getColloByExternalBarcode(codBarreCollo);
|
||||
|
||||
if(mtbColt == null) {
|
||||
|
||||
HashMap<String, Object> datiCollo = new HashMap<>();
|
||||
if (codBarreCollo.startsWith("U")) {
|
||||
datiCollo.put("gestione", null);
|
||||
datiCollo.put("anno", Integer.parseInt(codBarreCollo.substring(1, 3)));
|
||||
@@ -2302,7 +2306,6 @@ public class PvmService {
|
||||
datiCollo.put("serie", "/");
|
||||
}
|
||||
|
||||
MtbColt mtbColt;
|
||||
String query;
|
||||
|
||||
String whereCondGestione = "";
|
||||
@@ -2319,19 +2322,20 @@ public class PvmService {
|
||||
+ " 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);
|
||||
mtbColt = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), query, MtbColt.class);
|
||||
}
|
||||
|
||||
rs.close();
|
||||
ps.close();
|
||||
|
||||
if (mtbColt == null) return mtbColt;
|
||||
if (mtbColt == null) return null;
|
||||
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 {
|
||||
|
||||
|
||||
@@ -94,6 +94,7 @@ public class WMSAccettazioneService {
|
||||
.setPosizione(UtilityString.isNullOrEmpty(createUDCRequestDTO.getPosizione()) ? defaultPosizioneColliAccettazione : createUDCRequestDTO.getPosizione())
|
||||
.setCodTcol(createUDCRequestDTO.getCodTcol())
|
||||
.setAnnotazioni(createUDCRequestDTO.getAnnotazioni())
|
||||
.setBarcodeUl(createUDCRequestDTO.getBarcodeUl())
|
||||
.setSegno(1);
|
||||
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ public class CreateUDCRequestDTO {
|
||||
|
||||
private String annotazioni;
|
||||
|
||||
private String barcodeUl;
|
||||
|
||||
private List<CreateUDCRequestOrderDTO> orders;
|
||||
|
||||
|
||||
@@ -71,6 +73,15 @@ public class CreateUDCRequestDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getBarcodeUl() {
|
||||
return barcodeUl;
|
||||
}
|
||||
|
||||
public CreateUDCRequestDTO setBarcodeUl(String barcodeUl) {
|
||||
this.barcodeUl = barcodeUl;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<CreateUDCRequestOrderDTO> getOrders() {
|
||||
return orders;
|
||||
}
|
||||
|
||||
@@ -469,6 +469,7 @@ public class WMSLavorazioneService {
|
||||
.setPosizione(UtilityString.isNull(createUDCRequestDTO.getPosizione(), defaultPosizioneColliAccettazione))
|
||||
.setCodTcol(createUDCRequestDTO.getCodTcol())
|
||||
.setAnnotazioni(createUDCRequestDTO.getAnnotazioni())
|
||||
.setBarcodeUl(createUDCRequestDTO.getBarcodeUl())
|
||||
.setSegno(1);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user