[WMS] Aggiunto metodo per permettere di suggerire i lotti in fase di generazione dei trasferimenti
This commit is contained in:
@@ -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_20240909152916 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetupQuery("SI_NO", "SI_NO", "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
createSetup("PVM", "DOC_INTERNI", "SUGGEST_LOTTI", null,
|
||||
"Suggerisce i lotti già esistenti", false, "SI_NO", false, false,
|
||||
false, false, false, "dtb_tipi", false, "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,10 +19,12 @@ public class TipiDocDTO {
|
||||
@SqlField("gestione_doc")
|
||||
private String gestioneDoc;
|
||||
|
||||
|
||||
@SqlField("require_note")
|
||||
private Boolean requireNote;
|
||||
|
||||
@SqlField("suggest_lotti")
|
||||
private Boolean suggestLotti;
|
||||
|
||||
|
||||
public String getCodDtip() {
|
||||
return codDtip;
|
||||
@@ -73,4 +75,13 @@ public class TipiDocDTO {
|
||||
this.flagChkTracciabilita = flagChkTracciabilita;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean getSuggestLotti() {
|
||||
return suggestLotti;
|
||||
}
|
||||
|
||||
public TipiDocDTO setSuggestLotti(Boolean suggestLotti) {
|
||||
this.suggestLotti = suggestLotti;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,8 @@ public class SmartEnterpriseService {
|
||||
" from dbo.ParseStringIntoArray(" +
|
||||
" dbo.getGestSetup('PVM', 'DOC_INTERNI', 'COD_DTIP_NOTE'), '|'))" +
|
||||
" then 1" +
|
||||
" else 0 end as require_note" +
|
||||
" else 0 end as require_note," +
|
||||
" CAST(IIF(setupDet.value = 'S', 1, 0) AS BIT) AS suggest_lotti" +
|
||||
" from dtb_tipi" +
|
||||
" inner join(SELECT tab.value_string AS cod_dtip," +
|
||||
" CASE" +
|
||||
@@ -77,7 +78,16 @@ public class SmartEnterpriseService {
|
||||
" AND key_section LIKE 'COD_DTIP_%') tipi_doc_trasf" +
|
||||
" CROSS APPLY dbo.ParseStringIntoArray(tipi_doc_trasf.value, '|') tab" +
|
||||
" ) enabled_docs ON dtb_tipi.cod_dtip = enabled_docs.cod_dtip" +
|
||||
" " +
|
||||
" LEFT OUTER JOIN (SELECT det.val_col_rif AS cod_dtip, det.value" +
|
||||
" FROM stb_gest_setup setup" +
|
||||
" LEFT OUTER JOIN stb_gest_setup_det det ON setup.gest_name = det.gest_name AND" +
|
||||
" setup.section = det.section AND" +
|
||||
" setup.key_section = det.key_section AND" +
|
||||
" setup.tipo_setup = det.tipo_setup" +
|
||||
" WHERE setup.gest_name = 'PVM'" +
|
||||
" AND setup.section = 'DOC_INTERNI'" +
|
||||
" AND setup.key_section = 'SUGGEST_LOTTI') setupDet" +
|
||||
" ON setupDet.cod_dtip = dtb_tipi.cod_dtip" +
|
||||
" where LEN(dtb_tipi.cod_dtip) > 0";
|
||||
PreparedStatement ps = multiDBTransactionManager.getPrimaryDatasource().getConnection().prepareStatement(sql);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
|
||||
@@ -47,4 +47,11 @@ public class WMSDocumentController {
|
||||
.setArts(wmsDocumentService.retrieveDocumentArts(codDtip, codMgrp, codAnagForn))
|
||||
);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/retrieveLotti", method = RequestMethod.GET)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse retrieveLotti(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@RequestParam(value = "codProd") String codProd) throws Exception {
|
||||
return ServiceRestResponse.createPositiveResponse(wmsDocumentService.retrieveLotti(codProd));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package it.integry.ems.retail.wms.documenti.dto;
|
||||
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class RetrieveLottiDTO {
|
||||
|
||||
@SqlField("cod_prod")
|
||||
private String codProd;
|
||||
|
||||
@SqlField("partita_mag")
|
||||
private String partitaMag;
|
||||
|
||||
@SqlField("data_scad")
|
||||
private Date dataScad;
|
||||
|
||||
public String getCodProd() {
|
||||
return codProd;
|
||||
}
|
||||
|
||||
public RetrieveLottiDTO setCodProd(String codProd) {
|
||||
this.codProd = codProd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPartitaMag() {
|
||||
return partitaMag;
|
||||
}
|
||||
|
||||
public RetrieveLottiDTO setPartitaMag(String partitaMag) {
|
||||
this.partitaMag = partitaMag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataScad() {
|
||||
return dataScad;
|
||||
}
|
||||
|
||||
public RetrieveLottiDTO setDataScad(Date dataScad) {
|
||||
this.dataScad = dataScad;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import it.integry.ems.retail.pvmRetail.dto.PvmArticoliChildDTO;
|
||||
import it.integry.ems.retail.pvmRetail.dto.PvmArticoliDTO;
|
||||
import it.integry.ems.retail.pvmRetail.service.PvmService;
|
||||
import it.integry.ems.retail.wms.documenti.dto.DocumentArtDTO;
|
||||
import it.integry.ems.retail.wms.documenti.dto.RetrieveLottiDTO;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems_model.entity.MtbUntMis;
|
||||
import it.integry.ems_model.entity._enum.GestioneEnum;
|
||||
@@ -124,4 +125,21 @@ public class WMSDocumentService {
|
||||
return arts;
|
||||
}
|
||||
|
||||
public List<RetrieveLottiDTO> retrieveLotti(String codProd) throws Exception {
|
||||
String sql =
|
||||
Query.format(
|
||||
"SELECT jtb_dist_mate.cod_prod,\n" +
|
||||
" mtb_partita_mag.partita_mag,\n" +
|
||||
" mtb_partita_mag.data_scad\n" +
|
||||
"FROM jtb_dist_mate\n" +
|
||||
" INNER JOIN mtb_partita_mag ON jtb_dist_mate.cod_mart = mtb_partita_mag.cod_mart AND\n" +
|
||||
" ISNULL(mtb_partita_mag.data_scad, mtb_partita_mag.data_ins) >\n" +
|
||||
" CAST(GETDATE() AS DATE)\n" +
|
||||
"WHERE jtb_dist_mate.cod_prod = %s",
|
||||
codProd
|
||||
);
|
||||
|
||||
return UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, RetrieveLottiDTO.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user