Aggiunto retrieveAllPartitaMag
This commit is contained in:
@@ -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_20240718150503 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("INSERT INTO stb_gest_setup (key_section, value, tipo_setup, description, query_default, flag_sync, flag_user_view, flag_setup_depo, flag_setup_user_web, flag_tipo_json, flag_tipo_colore, gest_name, section) VALUES('SUGGEST_DATA_SCAD', 'N', NULL, 'Suggerisce la data di scadenza di una partita già esistente', (SELECT TOP 1 cod_query FROM stb_gest_setup_query WHERE query_default = 'SELECT ''S'' UNION ALL SELECT ''N'''), 'N', 'N', 'N', 'N', 'N', 'N', 'PICKING', 'SPEDIZIONE');");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,6 +9,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@Scope("request")
|
||||
@RequestMapping("wms/partita-magazzino")
|
||||
@@ -27,4 +31,13 @@ public class WMSPartitaMagazzinoController {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(wmsPartitaMagazzinoService.retrievePartitaMag(codMart, partitaMag));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "retrieveAllPartitaMag", method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse retrieveAllPartitaMag(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@RequestBody List<String> codMarts,
|
||||
@RequestParam Date dataScad) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(wmsPartitaMagazzinoService.retrievePartitaMagList(codMarts, dataScad));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
package it.integry.ems.retail.wms.generic.service;
|
||||
|
||||
import com.lmax.disruptor.util.DaemonThreadFactory;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems_model.entity.MtbPartitaMag;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.Query;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityInteger;
|
||||
import it.integry.ems_model.utility.UtilityQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@@ -34,4 +38,17 @@ public class WMSPartitaMagazzinoService {
|
||||
|
||||
return UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), sql, MtbPartitaMag.class);
|
||||
}
|
||||
|
||||
public List<MtbPartitaMag> retrievePartitaMagList(List<String> codMarts, Date dataScad) throws Exception {
|
||||
String sql = String.format(
|
||||
"SELECT *\n" +
|
||||
"FROM mtb_partita_mag\n" +
|
||||
"WHERE data_scad >= %s\n" +
|
||||
" AND cod_mart in (%s)",
|
||||
UtilityDB.valueToString(dataScad),
|
||||
UtilityDB.listValueToString(codMarts)
|
||||
);
|
||||
|
||||
return UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, MtbPartitaMag.class);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user